export declare function resolveStreamWatchdogMs(): number; /** * A single-timer dead-man's switch: `poke(token)` (re)arms it, `clear()` * disarms it, and `onStall(token)` fires exactly once if `poke()` isn't called * again within `ms`. The broker pokes it on relayed engine events while a turn * is awaiting the provider and clears it at `agent_end` / tool execution — see * broker.ts `relayEvent`. * * The `token` is an opaque generation stamp: each arm captures the token passed * to its `poke()`, and `onStall` receives exactly that token. The broker bumps * a session generation on every rebind, so a timer armed against a since- * superseded session hands its stale generation to `onStall`, which no-ops it * instead of aborting the live replacement session. */ export declare class StreamWatchdog { private readonly onStall; private timer; private paused; private readonly ms; constructor(onStall: (token: number) => void, ms?: number); /** Proof of progress — (re)arm the timer for `token`, canceling any prior * countdown. The fired `onStall` receives THIS arm's token. Inert while * paused (a deliberate known-stream wait, see `pause`), so a poke relayed * during the wait cannot rearm the disarmed watchdog. */ poke(token: number): void; /** Turn over (or broker tearing down) — no more relay expected until the * next `poke()`. Idempotent. Does NOT touch the paused flag. */ clear(): void; /** Enter a deliberate known-stream wait: disarm the timer AND make `poke()` * inert, so an intentional provider cooldown (which relays no engine events) * is not mistaken for a wedged network stream. Paired with `resume()`. */ pause(): void; /** Leave a known-stream wait and rearm against `token` (the live session * generation). A no-op arm if the turn has already moved on — the broker only * resumes while still streaming and idle of tools. */ resume(token: number): void; /** Fully disarm AND unpause — the lifecycle reset used at agent_end, session * rebind, and dispose so a superseded known-stream wait can never strand a * later session in a paused state. */ reset(): void; } /** Broker release policy for a deliberate wait: only an unchanged provider * stream resumes; a completed/rebound turn or active tool fully resets. */ export declare function releaseKnownStreamWait(watchdog: StreamWatchdog, token: number, sessionIsStreaming: boolean, hasExecutingTools: boolean): void; export declare const KNOWN_STREAM_WAIT_UI: unique symbol; /** The broker-supplied control: given a finite future deadline (epoch ms), pause * the dead-stream watchdog and return a release fn that resumes it. */ export type KnownStreamWaitControl = (deadlineMs: number) => () => void; /** Run a deliberate, deadline-bounded provider wait as KNOWN liveness so the * broker's dead-stream watchdog does not abort the intentional silence. Looks up * the broker-owned control on the extension UI context (keyed by * `KNOWN_STREAM_WAIT_UI`) and holds the watchdog paused for the duration of * `op`, releasing in `finally`. Falls back to a plain `op()` when no broker * control is present (unit tests, non-broker hosts). */ export declare function withKnownStreamWait(ui: unknown, deadlineMs: number, op: () => Promise): Promise;