import type { ActivityTracker } from "./activity-tracker.js";
import type { VisionClawConfig } from "../config/types.js";
/** Info about a tool call that was killed due to timeout. */
export interface ToolTimeoutInfo {
    toolName: string;
    toolUseId: string;
    /** Truncated JSON of the tool input (for context injection). */
    toolInput?: string;
    elapsedMs: number;
    browserRestarted: boolean;
    /** When true the abort was decided by the smart alarm evaluator, not a hard timeout. */
    smartAlarm?: boolean;
    /** The reason provided by the evaluator (if smart alarm). */
    smartAlarmReason?: string;
}
/**
 * Monitors in-flight tool calls and aborts the query when a call appears stuck.
 *
 * **Browser tools** (Playwright / computer_use): hard timeout at 120 s, then
 * restart Chrome and abort.
 *
 * **All other tools**: after 30 s a "smart alarm" fires — a fast model decides
 * whether to keep waiting or abort.  Alarms repeat every 30 s for as long as
 * the evaluator says "continue".  A generous absolute ceiling
 * ({@link ABSOLUTE_TIMEOUT_MS}, default 30 min) force-aborts as a last-resort
 * safety net.
 */
export declare class ToolCallWatchdog {
    private readonly onTimeout;
    private readonly config?;
    private readonly activityTracker?;
    private readonly browserTimeoutMs;
    private readonly activeToolCalls;
    private readonly watchdogTimer;
    private result;
    private triggerInProgress;
    constructor(onTimeout: () => void, config?: VisionClawConfig | undefined, activityTracker?: ActivityTracker | undefined, browserTimeoutMs?: number);
    /** Whether a tool name is a GUI-related tool (Playwright, computer_use, or android_use). */
    private isGUITool;
    /** Whether a tool name is a browser-related tool (Playwright or computer_use). */
    private isBrowserTool;
    /** Record that a tool call has started. */
    trackStart(toolUseId: string, toolName: string, toolInput?: string): void;
    /** Record that a tool call has completed (success or error). */
    trackEnd(toolUseId: string): void;
    /**
     * Handle a `tool_progress` SDK event. If the elapsed time exceeds
     * the threshold for a browser tool, triggers the timeout.
     */
    handleProgress(toolUseId: string, toolName: string | undefined, elapsedSeconds: number): void;
    /** Return the timeout info if a timeout was triggered, or `null`. */
    getResult(): ToolTimeoutInfo | null;
    /** Whether a timeout has been triggered (query should be considered aborted). */
    get triggered(): boolean;
    /** Stop the watchdog timer. Must be called when the stream ends. */
    dispose(): void;
    /**
     * Backup watchdog check: scans all active tool calls.
     * - Browser tools: hard timeout.
     * - Other tools: smart alarm evaluation.
     */
    private checkForTimeouts;
    private triggerBrowserTimeout;
    /**
     * Fire a smart alarm if the non-browser tool call has exceeded the alarm
     * interval.  The alarm threshold is `GENERAL_ALARM_INTERVAL_MS * (alarmCount + 1)`
     * so successive alarms are spaced evenly.
     */
    private maybeFireSmartAlarm;
}
//# sourceMappingURL=tool-call-watchdog.d.ts.map