@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
46 lines • 2.34 kB
TypeScript
/**
* Places a terminal tool on the session's tool child (senpi#3566 todo 9): `placement: "child"` plus the job that runs
* the same body there (`terminal-jobs.ts`). The job's arguments are built on the server from what the body would read
* in-process - the shell environment with the session's PI_* overrides, the shell path, the default size, the cwd - so
* the command sees the same environment wherever it runs. Under `--tool-runtime in-process` the placement is ignored and
* `execute` runs here, unchanged.
*/
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
import type { ToolChildJob } from "../../../types.ts";
import type { TerminalExitView, TerminalToolContext } from "./context.ts";
export declare const TERMINAL_CHILD_JOB_KINDS: {
readonly bash: "terminal.bash";
readonly output: "terminal.output";
readonly input: "terminal.input";
readonly resize: "terminal.resize";
readonly kill: "terminal.kill";
};
/**
* A tool child's terminal manager scopes its ids by generation (`bash_c<generation>_<n>`, `idScope`), so they never
* match the server's own (a monitor's `bash_N`, `mon_*`, `watch_*`, `rpc_*`): the id alone says who owns the session.
*/
export declare function childTerminalIdScope(generation: number): string;
export declare function isChildSessionId(id: string): boolean;
/** What a child reports about a background session after the job that started it ended (`wake`). */
export type TerminalBackgroundWake = {
readonly event: "background_start";
readonly id: string;
readonly description: string;
readonly startedAtMs: number;
readonly command?: string;
readonly autoReapMinutes?: number;
} | {
readonly event: "background_exit";
readonly id: string;
readonly exit: TerminalExitView["exitResult"];
readonly output: string;
readonly autoReapedAfterMinutes?: number;
} | {
readonly event: "background_reap_failed";
readonly id: string;
readonly autoReapMinutes: number;
readonly reason: string;
};
export declare function lostSessionResult(id: string, generation: number): AgentToolResult<unknown>;
export declare function terminalChildJob(ctx: TerminalToolContext, kind: (typeof TERMINAL_CHILD_JOB_KINDS)[keyof typeof TERMINAL_CHILD_JOB_KINDS]): ToolChildJob;
//# sourceMappingURL=child-placement.d.ts.map