UNPKG

@code-yeongyu/senpi

Version:

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

49 lines • 2.48 kB
import type { RegisteredTool } from "../../../core/extensions/types.ts"; import type { ToolChildKindRunner, ToolChildRunner } from "../../../core/tool-dispatch/tool-dispatcher.ts"; import { type ToolChildWake } from "./client.ts"; import type { HostCallHandler } from "./host-calls-server.ts"; import type { ToolChildCommand } from "./launch.ts"; export interface SessionToolChildRecord { readonly state: "spawned" | "exited" | "respawned"; readonly generation: number; readonly pid: number; } export interface SessionToolChildRow { readonly state: "none" | "live" | "exited"; readonly generation?: number; readonly pid?: number; } export interface SessionToolChildOptions { readonly dir: string; readonly cwd: string; /** Installed extension directories the child may load `module` jobs from, read at every spawn. */ readonly moduleRoots: () => readonly string[]; readonly onRecord: (record: SessionToolChildRecord) => void; readonly env?: NodeJS.ProcessEnv; readonly command?: ToolChildCommand; /** Serves the child's reverse-bridge calls; the request's `context.toolCallId` names the calling tool call. */ readonly onHostCall?: HostCallHandler; /** Receives the child's wakes (`ToolChildWake`); the session hands each to the job definition of its kind. */ readonly onWake?: (wake: ToolChildWake) => void; /** The crash loop's clock; tests inject a fake one. */ readonly now?: () => number; } /** The directories of the extensions whose tools declare a `childModule`: the only places a `module` job may load from. */ export declare function toolChildModuleRoots(tools: readonly RegisteredTool[]): readonly string[]; export declare class SessionToolChild { #private; constructor(options: SessionToolChildOptions); /** * Runs a module job on this session's child. A job lost to the child's exit is retried exactly once, on a fresh * generation, and only when it is idempotent; a non-idempotent job reports the error and is never re-run. */ readonly runner: ToolChildRunner; /** * Runs a job of a built-in kind (`ToolDefinition.childJob`, e.g. `terminal.bash`) on this session's child, streaming * its updates to `onUpdate`. Never retried: such a job's state (a PTY session) does not survive a child exit. */ readonly kindRunner: ToolChildKindRunner; row(): SessionToolChildRow; close(): Promise<void>; } //# sourceMappingURL=session-child.d.ts.map