import type { WorkflowAttemptCompletion } from "../shared/types.js"; import type { WorkflowAttemptRecord, WorkflowError, WorkflowRunDetail } from "./runtime.js"; import type { WorkflowRepository } from "./repository.js"; import type { WorkflowSessionExecutor } from "./session-executor.js"; import type { WorkflowTodoSessionLink } from "./todo-ports.js"; /** * Replacing an attempt a gateway restart killed. * * The restart is not a fault of the work — the process the attempt lived in went * away — so its replacement spends no retry budget and waits out no backoff. It * carries the engine thread the dead session still holds, so the phase resumes * where it was instead of re-deriving everything it had already worked out. * * A gateway that keeps dying would re-dispatch forever, so the count of restarts * a node has already survived is the bound. Past it, the caller settles the run. */ /** How many restarts one node's work survives before the run fails instead. */ export declare const RESTART_REDISPATCH_CAP = 3; /** Restarts kept killing the same node. Re-dispatching again would be a loop, so * the run stops and says how many of them it survived. */ export declare function restartExhaustedFailure(nodeId: string, attempt: number, restarts: number): WorkflowError; /** How many of this node's attempts a gateway restart has killed. */ export declare function restartsOn(run: WorkflowRunDetail, nodeId: string): number; export interface RestartReplacementPorts { repository: WorkflowRepository; executor: WorkflowSessionExecutor; todoSessions?: WorkflowTodoSessionLink; /** What the replacement carries, composed for a continuing or a cold turn. */ prompt: (continued: boolean) => string; } /** * Settle the killed attempt and open its replacement in one transaction, leaving * it `dispatching` for the caller to send. Null at the cap: the caller settles * the failure instead. */ export declare function openRestartReplacement(deps: RestartReplacementPorts, run: WorkflowRunDetail, attempt: WorkflowAttemptRecord, error: WorkflowError, event: WorkflowAttemptCompletion): number | null; //# sourceMappingURL=restart-redispatch.d.ts.map