import { type AnalysisReference, type CompiledReviewPlan, type JsonValue, type ReviewNodeResult, type ReviewPlanCache, type ReviewPlanRun } from "@actuarial-ts/core"; export declare const REVIEW_CHECKPOINT_CONTRACT_VERSION: "actuarial-review-checkpoint/1"; export declare const REVIEW_EXECUTION_LIMITS: Readonly<{ maximumAttemptedNodes: 256; maximumCheckpointCharacters: 100000000; }>; export interface ReviewCheckpointKey { readonly plan: AnalysisReference; readonly node: string; readonly dependencyIdentity: string; } export interface ReviewNodeCheckpoint { readonly contractVersion: typeof REVIEW_CHECKPOINT_CONTRACT_VERSION; readonly key: ReviewCheckpointKey; readonly result: ReviewNodeResult; } /** * Host-owned, tenant-scoped storage. putIfAbsent must be atomic and must never replace an existing * value. read must observe committed writes. A thrown write may have committed; the runner queries * the same key before reporting its outcome. Fingerprints are lookup keys, not authentication. */ export interface ReviewCheckpointStore { read(key: ReviewCheckpointKey): Promise; putIfAbsent(key: ReviewCheckpointKey, checkpoint: ReviewNodeCheckpoint): Promise; } export interface ReviewCheckpointReceipt { readonly key: ReviewCheckpointKey; readonly read: "not-requested" | "missing" | "matched" | "conflict" | "failed"; readonly write: "not-requested" | "confirmed" | "outcome-unknown" | "conflict"; readonly acknowledgement: "received" | "failed" | null; readonly verification: "not-applicable" | "current-sdk-execution" | "verified-memory"; readonly retainedEvidence: "not-applicable" | "within-limit" | "exceeded"; } export interface ReviewExecutionStep { readonly calculation: ReviewPlanRun["nodes"][number]; readonly checkpoint: ReviewCheckpointReceipt; readonly progress: { readonly kind: "review-node-completed"; readonly completedNodes: number; readonly totalNodes: number; readonly remainingNodes: number; }; } export interface ReviewExecutionLimits { readonly maximumAttemptedNodes: number; readonly maximumCheckpointCharacters: number; } export interface ReviewExecutionOptions { readonly checkpointFailure: "stop" | "continue"; readonly store?: ReviewCheckpointStore; readonly cache?: ReviewPlanCache; readonly signal?: AbortSignal; readonly limits?: ReviewExecutionLimits; /** Checked before each node. Cancellation never interrupts a synchronous mathematical kernel. */ readonly cancelled?: () => boolean | Promise; /** Hosts may yield to their event loop or worker scheduler between nodes. */ readonly yieldControl?: () => Promise; readonly onProgress?: (step: ReviewExecutionStep) => void | Promise; } export interface ReviewExecutionResult { readonly plan: CompiledReviewPlan; readonly state: "finished" | "cancelled" | "stopped"; readonly reason: "CHECKPOINT_UNRESOLVED" | "HOST_CALLBACK_FAILED" | "RESOURCE_LIMIT_EXCEEDED" | null; readonly steps: readonly ReviewExecutionStep[]; readonly remaining: readonly string[]; /** Present only when every planned node has been attempted, including failed/blocked operations. */ readonly run: ReviewPlanRun | null; readonly persistence: { readonly scope: "completed-nodes-attempted-in-this-execution"; readonly status: "not-requested" | "confirmed" | "incomplete" | "uncertain" | "conflict"; }; readonly assurance: { readonly restoredCalculations: "compared-with-current-process-execution"; readonly independentVerification: "not-performed"; readonly storageAuthenticity: "host-responsibility"; readonly publication: "not-requested"; }; } /** * Sequential host orchestration of the pure graph. A restart recalculates saved nodes (or uses * verified in-process cache evidence), compares their complete contents and avoids duplicate saves. * No serialized checkpoint can skip mathematical verification. No mid-kernel checkpoint is claimed. */ export declare function executeReviewPlan(input: unknown, options: ReviewExecutionOptions): Promise; export declare const REVIEW_ARTIFACT_LIFECYCLE_CONTRACT_VERSION: "actuarial-review-artifact-lifecycle/1"; export declare const REVIEW_ARTIFACT_LIFECYCLE_LIMITS: Readonly<{ maximumInputCharacters: 120000000; maximumArtifactCharacters: 120000000; maximumPublicationReceiptCharacters: 1000000; }>; export interface ReviewArtifactKey { readonly snapshot: AnalysisReference; readonly destination: { readonly id: string; readonly version: string; }; } export interface ReviewArtifactRecord { readonly contractVersion: typeof REVIEW_ARTIFACT_LIFECYCLE_CONTRACT_VERSION; readonly key: ReviewArtifactKey; readonly artifact: Readonly>; readonly state: "saved" | "published"; readonly publication: JsonValue | null; } export interface ReviewArtifactLifecycleRequest { readonly contractVersion: typeof REVIEW_ARTIFACT_LIFECYCLE_CONTRACT_VERSION; readonly artifact: Readonly>; readonly destination: { readonly id: string; readonly version: string; }; readonly action: "compute-only" | "save" | "save-and-publish"; readonly limits: { readonly [K in keyof typeof REVIEW_ARTIFACT_LIFECYCLE_LIMITS]: number; }; } /** * Host-owned durable storage and publication. Both mutations must be idempotent by key. A thrown * call may have committed, so callers always query the same key before deciding the outcome. * publishIfSaved must refuse a different artifact and retain a host receipt when it publishes. */ export interface ReviewArtifactStore { read(key: ReviewArtifactKey): Promise; saveIfAbsent(key: ReviewArtifactKey, record: ReviewArtifactRecord): Promise; publishIfSaved(key: ReviewArtifactKey): Promise; } export type ReviewArtifactLifecycleState = "computed" | "save-pending" | "saved" | "publication-pending" | "published" | "failed" | "cancelled"; export interface ReviewArtifactLifecycleEvent { readonly kind: "review-artifact-lifecycle"; readonly sequence: number; readonly state: ReviewArtifactLifecycleState; readonly key: ReviewArtifactKey; } export interface ReviewArtifactLifecycleResult { readonly key: ReviewArtifactKey; readonly state: "computed" | "saved" | "published" | "failed" | "cancelled"; readonly reason: "HOST_CALLBACK_FAILED" | "HOST_READ_FAILED" | "SAVE_NOT_CONFIRMED" | "SAVE_OUTCOME_UNKNOWN" | "PUBLICATION_NOT_CONFIRMED" | "PUBLICATION_OUTCOME_UNKNOWN" | "ARTIFACT_CONFLICT" | null; readonly events: readonly ReviewArtifactLifecycleEvent[]; readonly record: ReviewArtifactRecord | null; readonly persistence: "not-requested" | "confirmed" | "unknown" | "conflict"; readonly publication: "not-requested" | "confirmed" | "not-confirmed" | "unknown" | "conflict"; readonly assurance: { readonly artifactIdentity: "verified-from-complete-content"; readonly storageAuthenticity: "host-responsibility"; readonly publicationIdempotency: "host-contract-by-snapshot-and-destination"; }; } export interface ReviewArtifactLifecycleOptions { readonly store: ReviewArtifactStore; readonly signal?: AbortSignal; readonly cancelled?: () => boolean | Promise; readonly onProgress?: (event: ReviewArtifactLifecycleEvent) => void | Promise; } /** * Coordinates a computed artifact with host-owned save and publication effects. It never infers * review approval and cannot attest an external destination. Cancellation is observed only between * host calls; a host must use its own worker/process boundary to interrupt synchronous work. */ export declare function executeReviewArtifactLifecycle(input: unknown, options: ReviewArtifactLifecycleOptions): Promise; //# sourceMappingURL=reviewExecution.d.ts.map