import type { WorkspaceCheckpointRef, WorkspaceCheckpointRequest } from "@tangle-network/agent-interface"; import type { SandboxClientLike, SandboxInstanceLike, SandboxSnapshotInfoLike, SandboxSnapshotResultLike, SandboxWorkspaceOperationLookupLike } from "./tangle-types.js"; import type { ForkMarker } from "./tangle-workspace-markers.js"; export interface CheckpointRecord { request: WorkspaceCheckpointRequest; checkpoint: WorkspaceCheckpointRef; snapshotId: string; } interface RecoveredForkChild { child: SandboxInstanceLike; createdAt: Date | string | undefined; } /** Normalize remote checkpoint recovery before each caller chooses its output. */ type CheckpointReconciliation = { state: "found"; record: CheckpointRecord; } | { state: "conflict"; existingRequestDigest: `sha256:${string}`; } | { state: "undecided"; reason: "inventory_unavailable" | "metadata_invalid"; } | { state: "retired"; } | { state: "absent"; }; export declare function checkpointRecordFromSnapshot(request: WorkspaceCheckpointRequest, snapshot: SandboxSnapshotResultLike | SandboxSnapshotInfoLike): CheckpointRecord | undefined; export declare function validSnapshotResult(result: SandboxSnapshotResultLike | undefined): result is SandboxSnapshotResultLike; /** Normalize one remote checkpoint recovery attempt for every caller. */ export declare function reconcileCheckpoint(box: SandboxInstanceLike, provider: string, request: Pick, signal?: AbortSignal): Promise; /** * Confirm that one snapshot id is a settled checkpoint this provider created. * * `expected` binds the answer to a specific checkpoint reference. A reference * that does not match its marker is absent, not unknown: the caller supplied a * checkpoint this source never produced. */ export declare function findManagedCheckpoint(box: SandboxInstanceLike, provider: string, id: string, expected?: WorkspaceCheckpointRef, signal?: AbortSignal): Promise; export declare function findForkByKey(client: SandboxClientLike, box: SandboxInstanceLike, provider: string, key: string, signal?: AbortSignal): Promise<(RecoveredForkChild & { marker: ForkMarker; }) | null | undefined>; export declare function findForkChildById(client: SandboxClientLike, box: SandboxInstanceLike, provider: string, id: string, signal?: AbortSignal): Promise; /** * Resolve a complete child identity when an acknowledgement omits durable data. * * A branch response can precede a richer registry read during a rolling * deployment. Recover the exact child when its creation time or provider * marker is absent. Never invent either field from the request. */ export declare function completeForkChild(client: SandboxClientLike, child: SandboxInstanceLike, signal?: AbortSignal): Promise; export declare function findBlockingForks(box: SandboxInstanceLike, client: SandboxClientLike, provider: string, checkpointId: string, signal?: AbortSignal): Promise; /** * Read a fork ledger answer for a key that left no marked resource behind. * * `absent` is the settled answer: a decided operation with no inventory marker * means the child was cleaned after creation, and the provider must not * resurrect it from the ledger. Every other state is undecided for the caller. */ export declare function lookupOutcomeFromSandbox(lookup: SandboxWorkspaceOperationLookupLike | undefined, kind: "fork"): { absent: true; } | { absent: false; message: string; retryable: boolean; }; export declare function isoDate(value: Date | string): string; export {};