@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
26 lines • 1.34 kB
TypeScript
/**
* How a tool child's whole tree is held and ended (senpi#3566, plan todo 4). POSIX: the child leads its own process
* group, signalled as one. Windows: the child is assigned to its generation's Job Object right after spawn - before it
* can send `hello` - and membership is confirmed with `IsProcessInJob`; ending the tree terminates the job.
*/
import type { ChildProcess } from "node:child_process";
import { type Kernel32Job } from "./windows-job.ts";
export interface ChildContainment {
readonly kind: "process-group" | "job";
/** Ends the child and everything it started (its group, or every job member). */
kill(): void;
/** Releases the handle; the job's kill-on-close ends any member still running. */
close(): void;
/** Windows: whether a running pid is listed in the job right now (confirmation only, never a refutation). */
readonly isMember?: (pid: number) => boolean;
}
export interface ContainmentHost {
readonly platform: NodeJS.Platform;
readonly loadKernel: () => Kernel32Job | undefined;
}
export declare class ChildContainmentError extends Error {
readonly code: string;
constructor(code: string, message: string);
}
export declare function containChild(child: ChildProcess, host?: ContainmentHost): ChildContainment;
//# sourceMappingURL=child-containment.d.ts.map