UNPKG

@code-yeongyu/senpi

Version:

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

33 lines • 1.61 kB
/** * How long the host waits on one tool hook handler (oh-my-openagent#14354). * * A `tool_call` / `tool_result` handler runs in-process. One that never settles used to hold the tool loop forever: * the await had no deadline and ignored the turn's abort signal, so neither Esc nor an RPC interrupt ended it. The * wait now ends when the handler settles, when the turn is aborted, or (for `tool_result`) at a deadline. A handler * the host stopped waiting on keeps running detached; whatever it later returns or throws is discarded. */ /** The `tool_result` deadline for an extension: 0 (none) for a self-bounded one, else the env override or the default. */ export declare function toolResultHandlerTimeoutMs(extensionPath: string, env?: Readonly<Record<string, string | undefined>>): number; export type ToolHookWaitOutcome<T> = { readonly kind: "settled"; readonly value: T; } | { readonly kind: "failed"; readonly error: unknown; } | { readonly kind: "timed_out"; readonly elapsedMs: number; } | { readonly kind: "aborted"; }; export interface ToolHookWait<T> { readonly run: () => Promise<T> | T; /** The turn's abort signal: its abort ends the wait at once. */ readonly signal?: AbortSignal; /** 0 waits without a deadline. */ readonly timeoutMs: number; readonly now?: () => number; } /** Waits on one handler until it settles, the signal aborts or the deadline passes, whichever comes first. */ export declare function waitForToolHook<T>(wait: ToolHookWait<T>): Promise<ToolHookWaitOutcome<T>>; //# sourceMappingURL=tool-hook-wait.d.ts.map