UNPKG

@code-yeongyu/senpi

Version:

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

31 lines • 1.87 kB
import type { ToolDispatcher } from "../tool-dispatcher.ts"; /** The module the cases run on the child. `dieOnce` kills its own child the first time it runs (per marker file). */ export declare const KILL_CHILD_MODULE = "import { appendFileSync, existsSync } from \"node:fs\";\nexport function dieOnce(args) {\n\tappendFileSync(args.log, \"run\\n\");\n\tif (!existsSync(args.marker)) {\n\t\tappendFileSync(args.marker, \"\");\n\t\tprocess.kill(process.pid, \"SIGKILL\");\n\t}\n\treturn { pid: process.pid };\n}\nexport function survive(args) {\n\tappendFileSync(args.log, \"run\\n\");\n\treturn { pid: process.pid };\n}\n"; export interface KillChildStep { readonly export: "dieOnce" | "survive"; readonly idempotent: boolean; } export interface KillChildStepOutcome { /** `ok`, or the error code the job failed with. */ readonly result: string; /** The child generation the job finished on; only for `ok`. */ readonly generation?: number; } export interface KillChildOutcome { readonly steps: readonly KillChildStepOutcome[]; /** How many times the module body ran in total (a re-run counts again). */ readonly runs: number; } export interface KillChildCase { readonly id: string; readonly placement: "fused"; readonly kill: string; readonly steps: readonly KillChildStep[]; readonly expected: KillChildOutcome; /** The tool child's lifecycle records, as `[state, generation]`. */ readonly records: readonly (readonly [string, number])[]; } export declare const KILL_CHILD_CASES: readonly KillChildCase[]; /** Runs one case's steps on `dispatcher`, with `modulePath` holding {@link KILL_CHILD_MODULE}. */ export declare function runKillChildCase(dispatcher: ToolDispatcher, modulePath: string, workDir: string, killCase: KillChildCase): Promise<KillChildOutcome>; //# sourceMappingURL=kill-child.d.ts.map