import { type PreparedRunArtifactPaths } from "./run-paths.js"; import { type StudyAnalysisAdmission, type StudyAnalysisProgress, type StudyAnalysisDispatchContext } from "./study-analysis-engine.js"; import { type StudyAnalysisArtifact, type StudyAnalysisConfig, type StudyAnalysisCorrection, type LoadedStudyAnalysis } from "./study-analysis.js"; export declare const ANALYZE_RESULT_SCHEMA = "humanish.analyze-result.v1"; export interface AnalyzeOptions { config: StudyAnalysisConfig; dryRun?: boolean; rerun?: boolean; /** Internal/default policy; explicit token limits are always used exactly. */ preferLargerOutput?: boolean; } export interface AnalyzeResult { schema: typeof ANALYZE_RESULT_SCHEMA; ok: boolean; run: string; dryRun: boolean; reused: boolean; analysisId?: string; artifactPath?: string; executionReceiptPath?: string; status?: StudyAnalysisArtifact["status"]; usage?: StudyAnalysisArtifact["usage"]; admission?: StudyAnalysisAdmission; warnings: string[]; error?: { code: string; message: string; }; } export interface AnalyzeDeps { apiKey?: string; signal?: AbortSignal; onProgress?: (progress: StudyAnalysisProgress) => void; /** Request boundary only: evidence capture, admission, validation and writes remain real. */ fetch?: typeof fetch; /** Internal producer pin: use this original run identity without resolving a replacement. */ expectedRun?: PreparedRunArtifactPaths; /** Internal post-run orchestration; never populated from an Observer request. */ analysisId?: string; beforeDispatch?: (context: StudyAnalysisDispatchContext) => Promise; } /** A producer pin is authority for one physical project and exact run ID only. */ export declare function resolveStudyAnalysisRun(cwd: string, run: string, expectedRun?: PreparedRunArtifactPaths): Promise; /** One analysis or correction writer per run. Never steal a lock based on an untrusted PID. */ export declare function withStudyAnalysisLock(prepared: PreparedRunArtifactPaths, action: () => Promise): Promise; /** Internal completion gate shared with the opt-in post-run owner. */ export declare function readCompletedStudyAnalysisSource(cwd: string, prepared: PreparedRunArtifactPaths): Promise; export declare function analyzeStudy(cwdInput: string, run: string, options: AnalyzeOptions, deps?: AnalyzeDeps): Promise; export declare function showStudyAnalysis(cwd: string, run: string, id?: string): Promise; export declare function correctStudyAnalysis(cwd: string, run: string, options: { analysisId: string; findingId: string; status: StudyAnalysisCorrection["status"]; reason: string; replacementClaim?: string; }): Promise;