export type OutcomeKind = "answer" | "build" | "bugfix" | "operation" | "pentest"; export type OutcomeStatus = "active" | "succeeded" | "partial" | "blocked" | "failed" | "aborted" | "paused_budget"; export type CriterionStatus = "unproven" | "supported" | "proven" | "refuted" | "waived"; export type EvidenceKind = "observation" | "automated-check" | "process-start" | "readiness" | "probe" | "reproduction" | "impact" | "artifact" | "scanner-lead"; export interface OutcomeCriterion { id: string; statement: string; required: boolean; status: CriterionStatus; evidenceIds: string[]; revision: number; domain?: "general" | "feature" | "bugfix" | "server" | "pentest-finding" | undefined; } export interface OutcomeContract { schemaVersion: 1; id: string; sessionId: string; userIntent: string; kind: OutcomeKind; criteria: OutcomeCriterion[]; assumptions: string[]; constraints: string[]; status: OutcomeStatus; revision: number; createdAt: string; updatedAt: string; } export interface EvidenceRecord { schemaVersion: 1; id: string; outcomeId: string; criterionIds: string[]; taskId?: string | undefined; source: { tool: string; callId: string; artifact?: string | undefined; }; kind: EvidenceKind; observedAt: string; freshness: "current" | "stale"; strength: "supporting" | "decisive"; observation: string; result: "pass" | "fail" | "inconclusive"; environment?: Record | undefined; outcomeRevision: number; } export interface CompletedOperation { signature: string; tool: string; summary: string; observation: string; /** Missing on legacy entries means a successful completed observation. */ ok?: boolean | undefined; exitCode?: number | undefined; observationDigest?: string | undefined; unchangedRepeats?: number | undefined; stateKey?: string | undefined; artifact?: string | undefined; observedAt: string; } export interface OutcomeEnvelope { schemaVersion: 1; outcome: OutcomeContract; evidence: EvidenceRecord[]; failedHypotheses: Array<{ signature: string; premise: string; observedAt: string; }>; completedOperations?: CompletedOperation[] | undefined; } export declare function createOutcome(input: { sessionId: string; userIntent: string; kind: OutcomeKind; criteria: Array & { id?: string; }>; }): OutcomeContract; export declare function reviseOutcome(outcome: OutcomeContract, criteria: OutcomeContract["criteria"]): OutcomeContract; export declare function linkEvidence(outcome: OutcomeContract, evidence: EvidenceRecord): void; export declare function validateCriterionEvidence(criterion: OutcomeCriterion, records: readonly EvidenceRecord[]): { ok: boolean; reason?: string; }; export declare function deriveOutcomeStatus(outcome: OutcomeContract, records: readonly EvidenceRecord[]): OutcomeStatus; export declare function saveOutcomeState(envelope: OutcomeEnvelope): Promise; export declare function loadOutcomeState(sessionId: string): Promise; export declare function createEvidence(input: Omit): EvidenceRecord; export declare function inferOutcomeKind(input: { userIntent: string; buildLike?: boolean; pentestLike?: boolean; }): OutcomeKind; export declare function defaultOutcomeCriteria(kind: OutcomeKind, userIntent: string): Array>; export declare function openOutcomeState(input: { sessionId: string; userIntent: string; kind: OutcomeKind; continueExisting?: boolean; }): Promise; export declare function recordFailedHypothesis(envelope: OutcomeEnvelope, input: { signature: string; premise: string; }): void; export declare function isCompletedReadOperation(tool: string, args?: Record): boolean; export declare function normalizeOperationArgs(tool: string, args: Record): Record; export declare function completedOperationSignature(tool: string, args?: Record): string | undefined; export declare function completedOperationObservationDigest(tool: string, output: string): string; export declare function recordCompletedOperation(envelope: OutcomeEnvelope, input: { tool: string; args?: Record; output: string; ok?: boolean; exitCode?: number; artifact?: string; stateKey?: string; }): CompletedOperation | undefined; export declare function recordToolEvidence(envelope: OutcomeEnvelope, input: { tool: string; callId: string; ok: boolean; exitCode?: number | undefined; output: string; artifact?: string | undefined; taskId?: string | undefined; args?: Record | undefined; stateKey?: string | undefined; }): EvidenceRecord[]; export declare function recordAnswerEvidence(envelope: OutcomeEnvelope, answer: string): EvidenceRecord | undefined;