@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
30 lines • 1.82 kB
TypeScript
import type { HostCallHandler } from "../../modes/rpc/tool-child/host-calls-server.ts";
import { type ModuleHost } from "../../modes/rpc/tool-child/module-host.ts";
import type { ToolChildModuleJob } from "./tool-dispatcher.ts";
/** A refused or unrun in-process call: the same codes a child's caller reads from `.code`. */
export declare class InProcessHostCallError extends Error {
readonly code: string;
constructor(code: string, message: string);
}
export interface InProcessHostCalls {
readonly host: ModuleHost;
stopAdmitting(): void;
/** The session closed: every further call is refused `host_call_session_closed`, and calls running are signalled. */
close(): void;
/** Ends the job: running calls are signalled and every lock it holds is released. */
end(): void;
ended(): boolean;
heldFiles(): string[];
markStuck(holder: string): void;
}
/**
* The host an in-process module gets, its calls answered by the session's host-call handler under the same rules the
* child's `ServerHostCalls` applies: one admission per job, the job's cancel signalled into every call except the lock
* calls (a lock is released after the writes stop, not when the cancel arrives), and every call still running signalled
* when the job ends. `end` resolves the generation's `exited`, which releases the locks the job still holds;
* `markStuck` resolves its `stuck`, which keeps them held and fails every waiter on them.
*/
export declare function inProcessHostCalls(job: ToolChildModuleJob, cancelled: AbortSignal, hostCalls: HostCallHandler | undefined): InProcessHostCalls;
/** Calls `run` now; a synchronous throw becomes a rejection like an async one. */
export declare function settleNow<T>(run: () => T | Promise<T>): Promise<T>;
//# sourceMappingURL=in-process-host-calls.d.ts.map