@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
40 lines • 2.08 kB
TypeScript
import { type HostStopSender } from "./host-crash-record.ts";
import type { HostGenerationPaths } from "./host-daemon-paths.ts";
import { type HostStopIntent } from "./host-stop-intent.ts";
/**
* The RPC host exits 0 only through its own clean shutdown path - including its idle/empty-host
* policy - so that is an intentional stop, not a crash: the supervisor mirrors its own idle exit
* instead of reporting failure. Any non-zero code or signal stays a crash.
*/
export declare function classifyChildExit(code: number | null, signal: NodeJS.Signals | null): {
reason: string;
exitCode: number;
};
export interface ChildExitContext {
readonly daemonDir: string;
readonly generation: HostGenerationPaths;
readonly instanceId: string;
readonly code: number | null;
readonly signal: NodeJS.Signals | null;
readonly childStartedAt: number;
/** Set while the supervisor is shutting down: the stop is the engine's even without an intent file. */
readonly shutdown?: {
readonly reason: string;
readonly supervisor: HostStopSender;
};
readonly now?: number;
}
/**
* Record how the host child ended. A fresh stop intent for THIS generation makes it an `engine_stop`
* naming the intent's sender; a supervisor shutdown without one is the supervisor's own stop; a signal
* nobody announced is `external`; any other non-zero exit is the supervisor's observation of a crash.
* A clean exit the host chose itself writes nothing. Never throws.
*/
export declare function noteChildExit(context: ChildExitContext): Promise<void>;
/**
* The terminal record a CALLER writes after it had to SIGKILL a supervisor: a SIGKILLed supervisor
* runs no exit handler, so the caller is the only process guaranteed to survive this path. It writes
* BEFORE it releases or clears the registration, whose recursive removal takes the intent with it.
*/
export declare function noteEscalatedStop(daemonDir: string, instanceId: string, intent: HostStopIntent, now?: number): Promise<void>;
//# sourceMappingURL=host-child-exit.d.ts.map