@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.51 kB
TypeScript
import { type Agent, type AgentToolResult, type AgentToolUpdateCallback, type PreparedAgentToolCall } from "@earendil-works/pi-agent-core";
type HostAgent = Pick<Agent, "batchStoreFactory" | "executionScope" | "getExecutionScope" | "onExecutionPipeline">;
export interface ExecuteToolHookResult {
readonly content?: AgentToolResult<unknown>["content"];
readonly details?: unknown;
/** The error flag after the hooks: the hook's, else the tool's (senpi#6904). */
readonly isError?: boolean;
}
export interface ExecuteToolHostSession {
readonly agent: HostAgent;
afterHooks(prepared: PreparedAgentToolCall, result: AgentToolResult<unknown>, isError: boolean): Promise<ExecuteToolHookResult | undefined>;
}
export interface ExecuteToolHostOptions {
readonly signal?: AbortSignal;
readonly onUpdate?: AgentToolUpdateCallback<unknown>;
}
export interface ExecuteToolHostOutcome {
readonly result: AgentToolResult<unknown>;
readonly hook: ExecuteToolHookResult | undefined;
}
/**
* Runs a call `executeTool()` already prepared and preflighted on the in-process prepared ToolHost (S19a). The host
* freezes the preflighted arguments; the caller's own signal and `onUpdate` reach the body, since `executeTool()` never
* raced an abort.
*/
export declare function runExecuteToolOnHost(session: ExecuteToolHostSession, prepared: PreparedAgentToolCall, options: ExecuteToolHostOptions): Promise<ExecuteToolHostOutcome>;
export {};
//# sourceMappingURL=execute-tool-on-host.d.ts.map