UNPKG

@code-yeongyu/senpi

Version:

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

35 lines • 2.4 kB
/** * What a session's tool child can reach on the server (senpi#3566 todo 7, DESIGN PART 1): a call from a child-run tool * body. A `tool` call runs as a nested call of the tool call that owns the job - the same path as in-process * `ctx.executeTool`, hooks once - and `list_tools` names the tools such a call may reach. `authorize` asks the session's * filesystem policy (never cached: every call is decided again). `lock_file` takes the file's slot in the same mutation * queue the session's own file tools use, granted only to a live job; the slot is released only by `unlock_file` or * by the child's observed exit - never by a cancel, so a write still in flight finishes before anyone else's begins. */ import type { AgentToolCallOutcome } from "@earendil-works/pi-agent-core"; import type { HostCallHandler } from "../modes/rpc/tool-child/host-calls-server.ts"; import type { FilesystemPolicyChecker } from "./extensions/types.ts"; export interface SessionHostCallDeps { /** The session cwd: a child's relative path names the same file the session's own file tools would. */ readonly cwd: string; /** Runs `name` as a nested call of `parentToolCallId` through the session's tool pipeline. */ readonly executeNested: (parentToolCallId: string, name: string, args: unknown, signal: AbortSignal) => Promise<AgentToolCallOutcome>; readonly callableToolNames: () => readonly string[]; /** The `completion` / `reserved` targets registered on the session (codemode's runtime registers them). */ readonly target: (kind: RegisteredHostCallKind) => HostCallTarget | undefined; /** The session's composed filesystem policy; undefined when no extension registered one. */ readonly filesystemPolicy: () => FilesystemPolicyChecker | undefined; } export type RegisteredHostCallKind = "completion" | "reserved"; /** Serves one registered kind on the server; it runs with whatever server-side context its registrar holds. */ export type HostCallTarget = (request: { readonly name: string | undefined; readonly args: unknown; readonly signal: AbortSignal; }) => Promise<unknown>; export declare class HostCallError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function createSessionHostCallHandler(deps: SessionHostCallDeps): HostCallHandler; //# sourceMappingURL=tool-child-host-calls.d.ts.map