import type { Agent, AgentCheckpointRestoreHook, AgentEvent, AgentRunCheckpointMetadataSource, AgentRunRef, AgentRunResult, AgentRunResume, AgentRunResumeOptions, AgentRunResumeStreamOptions, AgentRunStatusResult, CheckpointStore, OwnershipScope, SubscribeOptions } from "./contracts.js"; export interface AgentRunLifecycleAgent { readonly agent: Agent; /** Current host-authored revision; it must match the stored revision. */ readonly definitionRevision: string; } export interface AgentRunLifecycleOptions { readonly checkpoints: CheckpointStore; readonly resolveAgent: (input: { readonly agentId: string; readonly ownership?: OwnershipScope; readonly signal?: AbortSignal; }) => AgentRunLifecycleAgent | Promise; readonly fencingToken?: number; /** * Plan 094 Task 3: external-state restore hooks, run on every claiming resume before the * checkpoint is claimed. Registered once here because a resume builds its session from the * stored state (there is no live session to register against beforehand). */ readonly restoreHooks?: readonly AgentCheckpointRestoreHook[]; /** Per-hook restore ceiling in ms; defaults to `DEFAULT_CHECKPOINT_RESTORE_TIMEOUT_MS`. */ readonly restoreHookTimeoutMs?: number; } export interface AgentRunLifecycleRequest { readonly ownership?: OwnershipScope; readonly signal?: AbortSignal; /** Adapter-selected capability; stored runs for another agent are non-enumerable. */ readonly agentId?: string; /** Opt-in (plan 015 Task 4): restore persisted loaded-skill names on resume. */ readonly persistSessionState?: boolean; /** Opt-in (plan 018 Task 6): restore persisted loaded-skill bodies on resume (requires `persistSessionState` too). */ readonly includeSkillBodies?: boolean; /** Checkpoint sidecar metadata applied on resume (and to the resumed run's later checkpoints). */ readonly checkpointMetadata?: AgentRunCheckpointMetadataSource; /** Plan 094 Task 3: restore hooks for this resume; the lifecycle's own hooks are used when omitted. */ readonly restoreHooks?: readonly AgentCheckpointRestoreHook[]; /** Per-hook restore ceiling in ms; defaults to `DEFAULT_CHECKPOINT_RESTORE_TIMEOUT_MS`. */ readonly restoreHookTimeoutMs?: number; } /** Bounded live-event options for a durable lifecycle resume. */ export interface AgentRunLifecycleStreamRequest extends AgentRunLifecycleRequest, SubscribeOptions { } export interface AgentRunLifecycle { status(ref: AgentRunRef, options?: AgentRunLifecycleRequest): Promise; resume(ref: AgentRunRef, resume: AgentRunResume, options?: AgentRunLifecycleRequest): Promise; resumeStream(ref: AgentRunRef, resume: AgentRunResume, options?: AgentRunLifecycleStreamRequest): AsyncIterable; } /** Host capability for durable agent status/resume. Adapters supply authorized ownership only. */ export declare function createAgentRunLifecycle(options: AgentRunLifecycleOptions): AgentRunLifecycle; /** Resume a persisted built-in run. A claimed/dispatched tool is never replayed automatically. */ export declare function resumeAgentRun(agent: Agent, ref: AgentRunRef, resume: AgentRunResume, options: AgentRunResumeOptions): Promise; /** Subscribe before resuming one durable run. Early consumer return aborts that resumed execution. */ export declare function resumeAgentRunStream(agent: Agent, ref: AgentRunRef, resume: AgentRunResume, options: AgentRunResumeStreamOptions): AsyncGenerator;