UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

30 lines • 1.85 kB
/** * The `restartable-command` restore handler. It stops a verified crash-orphaned watcher first, * re-spawns the saved command once in the saved cwd with the restore environment (stable id, * state dir, restored flag, downtime bound), and only calls the watch restored if it is still * running when the grace window closes: an immediate non-zero exit is lost with its exit code and * first output line, an immediate zero exit is a completed one-shot gate. A persistent watch has * no deadline; an ephemeral one gets exactly the time it had left. Nothing the pre-restart PTY * produced is replayed. */ import type { KillGuardVerdict } from "../../../kill-guard/types.ts"; import type { MonitorRegistry } from "./monitor-registry.ts"; import { type ReapResult } from "./orphan-reaper.ts"; import type { ChildProcessIdentity } from "./process-identity.ts"; import { type RestoreHandler } from "./restore.ts"; import type { TerminalToolContext } from "./tools/context.ts"; import { spawnCommandSession } from "./tools/spawn.ts"; export interface RestartableCommandDeps { readonly ctx: TerminalToolContext; readonly registry: MonitorRegistry; readonly spawn?: typeof spawnCommandSession; readonly directoryExists?: (path: string) => Promise<boolean>; readonly onRestored?: (monitorId: string, runtimeId: string) => void; readonly graceMs?: number; readonly reapOrphan?: (runtime: ChildProcessIdentity, monitorId: string) => Promise<ReapResult>; /** Whether the kill guard is on (user settings); a restored command is judged again unless it is off (senpi#5349). */ readonly killGuardOn?: () => boolean; readonly judge?: (command: string) => KillGuardVerdict; } export declare function createRestartableCommandHandler(deps: RestartableCommandDeps): RestoreHandler; //# sourceMappingURL=durable-command.d.ts.map