/** * Run Registry - tracks background sequence runs by run id. * * `replay({ action: 'run' })` returns a run id immediately and executes in the * background; this registry is what `status` and `cancel` use to address a * specific run. Held in memory only: a server restart (e.g. the supervisor's * hot-restart on rebuild) kills any in-flight run with the process and * forgets every id - callers polling an old id get REPLAY_RUN_NOT_FOUND. */ import type { StepResult } from './replay-executor.js'; export type RunStatus = 'running' | 'cancelling' | 'paused' | 'completed' | 'failed' | 'cancelled'; export interface RunRecord { runId: string; sequenceId: string; sequenceName: string; connectionReason?: string; status: RunStatus; startedAt: number; /** Set when the background execution settles (including on pause). */ endedAt?: number; totalSteps: number; /** 1-based step currently executing (or last reached). 0 = setup phase. */ currentStep: number; currentTool?: string; /** Top-level step results, populated when the run settles. */ results: StepResult[]; controller: AbortController; /** The full tool response the old blocking `run` would have returned. */ finalResponse?: any; /** Failure that escaped the run path itself (not a step failure). */ error?: string; } /** How long a settled run (completed/failed/cancelled/paused) stays retrievable. */ export declare const RUN_RETENTION_MS: number; /** Hard cap on records; oldest settled runs are evicted first. */ export declare const MAX_RUN_RECORDS = 50; declare class RunRegistry { private runs; private counter; /** Ids are unique per process; the timestamp suffix keeps an id from a * previous server process from accidentally resolving after a restart. */ newRunId(): string; register(record: RunRecord): void; get(runId: string): RunRecord | undefined; list(): RunRecord[]; /** Runs that are still executing (running or cancelling). */ active(): RunRecord[]; isSettled(record: RunRecord): boolean; private prune; /** Test hook. */ clear(): void; } export declare const runRegistry: RunRegistry; export {}; //# sourceMappingURL=replay-run-registry.d.ts.map