import { z } from "zod"; import type { TranscriptMessage } from "../contracts/turn.js"; import { type LoopBoundary } from "../loop/boundary.js"; export { assertCheckpointTranscript } from "../loop/boundary.js"; /** Host-owned configuration/version pins and restorable environment reference. No credentials. */ export declare const CheckpointBindingsSchema: z.ZodObject<{ configuration: z.ZodRecord; environment: z.ZodJSONSchema; }, z.core.$strict>; export type CheckpointBindings = z.infer; declare const checkpointSchema: z.ZodObject<{ version: z.ZodLiteral<1>; executionId: z.ZodString; revision: z.ZodNumber; parent: z.ZodNullable>; position: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"ready">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"waiting">; reason: z.ZodEnum<{ waiting_for_reply: "waiting_for_reply"; resuming_later: "resuming_later"; }>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"finished">; reason: z.ZodEnum<{ aborted: "aborted"; done: "done"; iteration_limit: "iteration_limit"; }>; }, z.core.$strict>], "kind">; iterationsUsed: z.ZodNumber; maxIterations: z.ZodNumber; state: z.ZodObject<{ messages: z.ZodArray>; inputTokens: z.ZodNumber; outputTokens: z.ZodNumber; costCents: z.ZodNumber; lastPromptTokens: z.ZodNumber; lastOutputTokens: z.ZodNumber; hasFreshTokenCount: z.ZodBoolean; toolCalls: z.ZodNumber; endedTurnViaTool: z.ZodOptional; suspended: z.ZodOptional; request: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; stats: z.ZodObject<{ turns: z.ZodNumber; toolCalls: z.ZodNumber; inputTokens: z.ZodNumber; outputTokens: z.ZodNumber; cachedInputTokens: z.ZodNumber; costCents: z.ZodNumber; modelTimeMs: z.ZodNumber; toolTimeMs: z.ZodNumber; outputTokensPerSecond: z.ZodNullable; toolTimeBreakdownMs: z.ZodRecord; }, z.core.$strict>; bindings: z.ZodObject<{ configuration: z.ZodRecord; environment: z.ZodJSONSchema; }, z.core.$strict>; }, z.core.$strict>; export type LoopCheckpoint = z.infer; /** Parse untrusted storage before it can become executable state. Always detached. */ export declare function parseLoopCheckpoint(value: unknown): LoopCheckpoint; export declare function serializeLoopCheckpoint(checkpoint: LoopCheckpoint): string; export declare function createLoopCheckpoint(input: { executionId: string; messages: TranscriptMessage[]; maxIterations: number; bindings: CheckpointBindings; }): LoopCheckpoint; /** Pure boundary reducer used by the real loop's checkpoint driver. */ export declare function advanceLoopCheckpoint(previous: LoopCheckpoint, boundary: LoopBoundary, invocationStart: LoopCheckpoint, bindings: CheckpointBindings): LoopCheckpoint; /** A fork inherits history and context pressure, but never spend or future identity. */ export declare function forkLoopCheckpoint(source: LoopCheckpoint, input: { executionId: string; maxIterations: number; bindings: CheckpointBindings; }): LoopCheckpoint; export type CheckpointInput = { kind: "reply"; message: Extract; } | { kind: "wake"; messages: Extract[]; } | { kind: "message"; message: Extract; }; /** Resolve a waiting state explicitly. A finished history needs new input to run again. */ export declare function applyCheckpointInput(source: LoopCheckpoint, input: CheckpointInput): LoopCheckpoint;