/** * Inactivity bound for a prompt whose session host has no tool call in flight: after * this much silence the host is treated as having stopped producing, so the prompt is * settled instead of hanging the client forever. * * Every step of a live turn emits a frame (`agent_start`, message events, tool events, * `agent_end`), so this bound only has to exceed the longest frame-free gap a healthy * turn can produce *with nothing executing*: one model round trip, from the request * leaving the host to the first streamed event coming back, possibly straddling a * transport reconnect. * * `TOOL_TIMEOUTS` is this runtime's own statement of how long a single unattended step * may block before it is declared stuck, and its slowest **default** * ({@link DEFAULT_TOOL_RUNTIME_MS}) is the longest such wait nobody explicitly opted * into. That is well above the agent's own model-stream watchdog (120s idle / 100s * first event in `packages/ai/src/utils/idle-iterator.ts`), which aborts a stalled * provider stream and republishes it as an error frame — itself a frame — long before * this bound. {@link SDK_RECONNECT_BUDGET_MS} is added on top so a reconnect landing * inside that gap cannot trip it either. Two providers widen their first-event * fallback past this bound (alibaba-token-plan 600s, kimi-code 300s); a turn that * emits nothing at all for this long on those is reported as abandoned rather than * left `running`, and the session still accepts the next prompt. * * {@link MAX_TOOL_RUNTIME_MS} is deliberately *not* used here. `max` is what a caller * may request, not what tools take, so sizing every gap for it produced a 63min bound * that could never act as a safety net. Turns that legitimately reach that ceiling are * covered by {@link ACP_PROMPT_TOOL_ACTIVITY_TIMEOUT_MS} instead, which is gated on * evidence that a tool is actually executing. */ export declare const ACP_PROMPT_INACTIVITY_TIMEOUT_MS: number; /** * Inactivity bound that applies only while the session host has an unfinished tool * call — a `tool_execution_start`/`tool_execution_update` with no matching * `tool_execution_end`. * * A long `bash` is protected by the evidence that it is running, not by a constant * sized for the worst case, so this wide bound stands only for as long as that * evidence does. It still terminates: no tool call may outlive * {@link MAX_TOOL_RUNTIME_MS}, after which the host must publish `tool_execution_end`, * so a host that dies mid-tool is still reported (one reconnect budget later). */ export declare const ACP_PROMPT_TOOL_ACTIVITY_TIMEOUT_MS: number; /** * Inactivity bound that applies while a prompt is awaiting the model: a provider call is in * flight and has not produced the first frame of its response yet. * * Tool execution had evidence and model inference did not, so a turn thinking after * `agent_start` looked exactly like a dead producer and was killed at * {@link ACP_PROMPT_INACTIVITY_TIMEOUT_MS}. Inference gets the same evidence-based * tolerance: the wide bound stands only as long as a model call is observably unanswered. * * It still terminates. A provider stream that yields nothing within * {@link MAX_PROVIDER_FIRST_EVENT_TIMEOUT_MS} is aborted by the agent's own stream watchdog, * which republishes as an error/retry frame, so a host that dies mid-inference is still * reported one reconnect budget later. */ export declare const ACP_PROMPT_INFERENCE_TIMEOUT_MS: number; /** * Per-prompt view of what the session host is observably doing: which tool calls it has * started but not finished, and whether it is waiting on a model call. Inbound frames are * the only evidence the ACP side has, so "a tool is running" means exactly "a start was * observed and its end was not", and "awaiting the model" means exactly "a model call was * dispatched and nothing from its response has been observed". */ export declare class PromptActivity { #private; /** Folds one inbound frame's lifecycle event into the in-flight tool and model state. */ observe(eventType: string | undefined, toolCallId: string | undefined, messageRole: string | undefined): void; /** True while at least one started tool call has not reported an end. */ get running(): boolean; /** True while a dispatched model call has not produced the first frame of its response. */ get awaitingModel(): boolean; /** Bound that applies to the next frame-free gap, given what is observably executing. */ get inactivityBoundMs(): number; } /** Timer surface behind the prompt watchdog; tests substitute a virtual clock. */ export interface PromptWatchdogClock { now(): number; /** Runs `handler` after `delayMs`; the returned callback cancels the pending run. */ schedule(handler: () => void, delayMs: number): () => void; } export declare const systemPromptWatchdogClock: PromptWatchdogClock;