import type { RunState } from "./status.ts"; export function revivalPrompt(name: string, state: RunState, message: string): string { return ( "You are continuing a previous run of this task.\n\n" + `Agent: ${name} (previous attempt ended ${state})\n\n` + "Your session history above is your own prior work. The original process is\n" + "no longer running. Continue from where you left off.\n\n" + "Follow-up from the orchestrator:\n" + message ); } export function assertResumable(state: RunState): void { if (state === "stopped") throw new Error("stopped runs cannot be resumed; delegate a new run"); if (state !== "paused" && state !== "complete" && state !== "timedOut" && state !== "failed") { throw new Error(`run in state '${state}' cannot be resumed`); } }