@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
32 lines • 1.35 kB
TypeScript
export interface SupervisedChild {
sendCancel(jobId: string): void;
sendPing(seq: number): void;
/** TERM ends the child gracefully (Windows: the job is terminated); KILL ends it at once. */
signal(signal: "SIGTERM" | "SIGKILL"): void;
}
export interface SupervisorTimers {
set(fn: () => void, ms: number): () => void;
}
export declare const REAL_TIMERS: SupervisorTimers;
export declare class JobSupervisorError extends Error {
readonly code: string;
constructor(code: string, message: string);
}
export declare class JobSupervisor {
#private;
constructor(child: SupervisedChild, timers?: SupervisorTimers);
/** Starts supervising a job; `settle` must be called when its result, error or refusal arrives. */
track(jobId: string, options: {
readonly reject: (error: Error) => void;
readonly backstopMs: number | undefined;
readonly userText: string;
readonly signal?: AbortSignal;
}): void;
settle(jobId: string): void;
/** The child acted on the cancel: the ladder stops; the job settles on its own, still under its backstop. */
cancelAcked(jobId: string): void;
pongReceived(): void;
/** The child is gone: stop every timer; pending jobs are rejected by the caller's exit handling. */
end(): void;
}
//# sourceMappingURL=job-supervisor.d.ts.map