/** * CLI-private execution evidence, not an observer event or admission artifact. * Keep this module dependency-free so the scheduler uses the same parser. * * Atomic snapshots cover process interruption and reported IO failures. They * do not claim power-loss durability, provider idempotency, or priced usage. */ export declare const FOUNDRY_EXECUTION_EVIDENCE_MAX_BYTES: number; export declare const FOUNDRY_EXECUTION_EVIDENCE_MAX_REQUESTS = 10000; export type FoundryExecutionEvidenceIdentity = { readonly repositoryRoot: string; readonly executionDigest: string; readonly parentPlanDigest: string; readonly caseId: string; readonly purpose: "generation" | "finalization" | "independent-review" | "semantic-calibration" | "repository-agent-trial" | "serving-request-trial"; }; export type FoundryInvocationEvidence = { readonly id: number; readonly operationId: string; readonly model: string; readonly role?: string; readonly requestDigest: string; /** Candidate trials only; requestDigest remains the exact ingress-body digest. */ readonly trial?: FoundryTrialRequestIntent; readonly state: "running" | "returned" | "failed" | "interrupted"; }; export type FoundryRequestUnknownReason = "transport-failure" | "response-incomplete" | "interrupted" /** Only candidate trials: no guessed linkage after reconcile/persist failure. */ | "upstream-reconciliation"; /** Finite, payload-free transport metadata. This never establishes request closure. */ export declare const FOUNDRY_REQUEST_DIAGNOSTIC_CODE_KINDS: Readonly<{ readonly UND_ERR_HEADERS_TIMEOUT: "timeout"; readonly UND_ERR_BODY_TIMEOUT: "timeout"; readonly UND_ERR_CONNECT_TIMEOUT: "timeout"; readonly ETIMEDOUT: "timeout"; readonly ECONNRESET: "connection"; readonly ECONNREFUSED: "connection"; readonly ENOTFOUND: "connection"; readonly EAI_AGAIN: "connection"; readonly ABORT_ERR: "abort"; readonly ROUTEKIT_HTTP_DEADLINE_EXCEEDED: "timeout"; }>; export type FoundryRequestDiagnosticCode = keyof typeof FOUNDRY_REQUEST_DIAGNOSTIC_CODE_KINDS; export type FoundryRequestDiagnostic = { readonly phase: "headers" | "body"; readonly kind: "timeout" | "abort" | "connection" | "unknown"; readonly code?: FoundryRequestDiagnosticCode; }; export type FoundryRequestReturn = { readonly httpStatus: number; readonly callId?: string; /** Present only after the existing owner persists exact upstream association. */ readonly trial?: FoundryTrialRequestSettlement; }; export type FoundryPhysicalRequestEvidence = { readonly id: number; readonly invocationId: number; readonly retryOrdinal: number; } & ({ readonly state: "submission-intent"; } | { readonly state: "returned"; readonly response: FoundryRequestReturn; } | { readonly state: "unknown"; readonly reason: FoundryRequestUnknownReason; readonly diagnostic?: FoundryRequestDiagnostic; }); export type FoundryExecutionOutcome = "success" | "failure" | "interrupted"; /** Payload-free host semantic decision, not a successful benchmark or admission. */ export type FoundryGenerationRejection = { readonly code: "specification-dimension-mismatch" | "specification-review-exhausted"; readonly completedRevisions: number; }; export type FoundryExecutionEvidence = { readonly version: 1; readonly kind: "foundry-execution-evidence"; readonly durability: "process-and-reported-io-v1"; readonly identity: FoundryExecutionEvidenceIdentity; /** The session call allowance already includes any reserved transient retries. */ readonly maximumPhysicalRequests: number; /** New provider-owning sessions require a separate authenticated upstream receipt. */ readonly upstreamEvidenceRequired?: true; /** Additive candidate metadata in this journal, not a second journal or plan. */ readonly trial?: FoundryTrialIdentity; /** Inner candidate checkpoint; never a final session/exposure seal. */ readonly trialCheckpoint?: FoundryTrialCheckpoint; readonly revision: number; readonly invocations: readonly FoundryInvocationEvidence[]; readonly requests: readonly FoundryPhysicalRequestEvidence[]; } & ({ readonly state: "open"; } | { readonly state: "sealed"; readonly terminal: { readonly outcome: FoundryExecutionOutcome; readonly requestExposure: "closed" | "unknown"; readonly generationRejection?: FoundryGenerationRejection; }; }); export declare class FoundryExecutionEvidenceProtocolError extends Error { readonly name = "FoundryExecutionEvidenceProtocolError"; } export declare function parseFoundryGenerationRejection(value: unknown): FoundryGenerationRejection; /** Validate and copy only own JSON data fields; never retain caller-owned error objects. */ export declare function parseFoundryRequestDiagnostic(value: unknown): FoundryRequestDiagnostic; export declare function parseFoundryExecutionEvidenceIdentity(value: unknown): FoundryExecutionEvidenceIdentity; export declare const foundryExecutionIsCandidateTrial: (purpose: FoundryExecutionEvidenceIdentity["purpose"]) => boolean; export declare function foundryExecutionEvidenceRelativePath(executionDigest: string): string; export declare function summarizeFoundryExecutionEvidence(evidence: FoundryExecutionEvidence): { logicalInvocations: number; returnedLogicalInvocations: number; physicalRequests: number; returnedPhysicalRequests: number; unresolvedPhysicalRequests: number; }; export declare function foundryExecutionRequestExposure(evidence: Pick, outcome: FoundryExecutionOutcome): "closed" | "unknown"; /** Parse the complete private format. Unknown keys cannot smuggle payloads into a receipt. */ export declare function parseFoundryExecutionEvidence(value: unknown): FoundryExecutionEvidence; /** * Additive fields of the existing canonical foundry execution journal. * No additional ledger/path/store, transport observation issuer, or runner. * Keep the parser dependency-free and copy only bounded own JSON data. */ export type FoundryTrialIdentity = { readonly version: 1; readonly lane: "repository-agent" | "request"; readonly trialId: string; readonly runId: string; readonly manifestDigest: string; readonly bindingDigest: string; readonly visibleTaskDigest: string; readonly candidateModel: string; readonly initialEvidenceDigest: string; readonly maximumGatewayRequests: number; }; export type FoundryTrialRequestIntent = { readonly requestId: string; readonly sequence: number; readonly localRequestDigest: string; /** Exact emitted body bytes; intentionally distinct from localRequestDigest. */ readonly ingressRequestDigest: string; readonly requestBytes: number; readonly beforeEvidenceDigest: string; }; export type FoundryTrialGatewayObservation = { readonly fetchInvocations: 1; readonly headersObserved: true; readonly httpStatus: number; readonly modelCallId: string; readonly responseBytes: number; readonly responseDigest: string; readonly rawEof: true; readonly terminal: "unobserved" | "completed" | "failed" | "incomplete" | "invalid"; readonly responseId?: string; readonly failure: "none" | "transport" | "wire" | "budget" | "deadline" | "interrupted" | "local-lifecycle"; }; /** * Submission is lane-specific, never an oracle/matcher grade. Repository * candidates must actually complete a successful model turn. The serving lane * instead submits the fully observed original wire to its existing matcher: * a non-2xx, failed/incomplete terminal or opaque/malformed JSON body can be a * high-signal negative observation. Local transport, budget, decoder, deadline * and cleanup failures are not submitted observations even when exposure closes. */ export declare const foundryTrialObservationSupportsSubmission: (lane: FoundryTrialIdentity["lane"], observation: FoundryTrialGatewayObservation) => boolean; export type FoundryTrialRequestSettlement = { readonly ingressId: string; readonly providerAttemptIds: readonly string[]; readonly beforeEvidenceDigest: string; readonly evidenceDigest: string; readonly observationDigest: string; readonly observation: FoundryTrialGatewayObservation; }; /** * Inner candidate checkpoint only. It neither seals the session nor establishes * trial success. The existing outer owner closes, reconciles and seals later. * Request/attempt counts are derived from the durable records, not copied from * the adapter's potentially lost acknowledgement counters. */ export type FoundryTrialCheckpoint = { readonly outcome: "submitted" | "failed" | "interrupted"; readonly toolInvocations: number; readonly totalToolArgumentBytes: number; readonly totalToolResultBytes: number; }; export declare class FoundryTrialEvidenceProtocolError extends Error { readonly name = "FoundryTrialEvidenceProtocolError"; } export declare const parseFoundryTrialIdentity: (input: unknown) => FoundryTrialIdentity; export declare const parseFoundryTrialRequestIntent: (input: unknown) => FoundryTrialRequestIntent; export declare const parseFoundryTrialGatewayObservation: (input: unknown) => FoundryTrialGatewayObservation; export declare const parseFoundryTrialRequestSettlement: (input: unknown) => FoundryTrialRequestSettlement; export declare const parseFoundryTrialCheckpoint: (input: unknown) => FoundryTrialCheckpoint;