@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
64 lines • 2.9 kB
TypeScript
import { type ContainmentHost } from "./child-containment.ts";
import { type HostCallHandler } from "./host-calls-server.ts";
import { type SupervisorTimers } from "./job-supervisor.ts";
import { type ToolChildCommand } from "./launch.ts";
export type ToolChildState = "none" | "spawning" | "live" | "retiring" | "dead";
export interface ToolChildStatus {
readonly state: "spawned" | "exited";
readonly generation: number;
readonly pid: number;
}
/** A child's `wake`: something happened on it outside any job's lifetime, for the job kind named by `source`. */
export interface ToolChildWake {
readonly source: string;
readonly value: unknown;
readonly generation: number;
}
export declare class ToolChildError extends Error {
readonly code: string;
constructor(code: string, message: string);
}
export interface ToolChildClientOptions {
readonly dir: string;
readonly cwd: string;
/** A function is read at every spawn, so each generation sees the current value. */
readonly env?: NodeJS.ProcessEnv | (() => NodeJS.ProcessEnv);
readonly command?: ToolChildCommand;
readonly readyMs?: number;
readonly shutdownMs?: number;
readonly onStatus?: (status: ToolChildStatus) => void;
/** Tests inject a fake clock for the job supervisor. */
readonly timers?: SupervisorTimers;
/** Serves the child's reverse-bridge calls (tool, completion, reserved, list_tools); unset = every call fails. */
readonly onHostCall?: HostCallHandler;
/** Receives the child's wakes, in order; each is acknowledged once delivered. */
readonly onWake?: (wake: ToolChildWake) => void;
/** Observes the child's cancel acknowledgements (tests and status). */
readonly onCancelAck?: (jobId: string) => void;
/** Read for `SENPI_TOOL_CHILD_DEADLINE_<KIND>_MS` fixture overrides. */
readonly policyEnv?: NodeJS.ProcessEnv;
/** Tests inject the platform and kernel; production uses this host's. */
readonly containmentHost?: ContainmentHost;
}
export declare class ToolChildClient {
#private;
constructor(options: ToolChildClientOptions);
get state(): ToolChildState;
get dir(): string;
/** The live child's manifest (its `hello`'s job kinds); empty when no child is live. */
get jobKinds(): readonly string[];
get generation(): number;
/** Resolves once the current or last generation's teardown (group sweep, ledger removal) finished. */
ended(): Promise<void>;
get pid(): number | undefined;
start(): Promise<void>;
run(kind: string, args: unknown, signal?: AbortSignal, options?: {
readonly idempotent?: boolean;
readonly deadlineMs?: number;
readonly hostContext?: unknown;
readonly onUpdate?: (value: unknown) => void;
}): Promise<unknown>;
ping(): Promise<number>;
close(): Promise<void>;
}
//# sourceMappingURL=client.d.ts.map