/** * Active tool-call tracking for the long-tool heartbeat. The Codex * app-server emits `item/started`/`item/completed` for every item; tool * items (`functionCall`/`dynamicToolCall`) bracket one tool execution. The * gateway keeps the currently-executing tool so the UI can show "正在执行 * shell_command · 已运行 X 分 Y 秒" while a long local command runs — * without that heartbeat a multi-minute tool execution looks like a hang. * * @module dsh-subagent-codex-plus/gateway/tool-tracker */ /** A Codex tool call currently executing inside the active turn. */ export interface ActiveTool { /** Tool name as reported by Codex (e.g. `shell_command`). */ readonly name: string; /** Epoch ms when the tool call started; clients derive the elapsed time. */ readonly startedAt: number; } /** * Tracks the currently-executing Codex tool call. Parallel tool starts stack * on a counter so the first completion does not clear a still-running tool; * the counter also absorbs a completion whose start was missed (e.g. after a * mid-turn reconnect) without going negative. */ export declare class ActiveToolTracker { private count; private active; /** The tool call currently executing, if any. */ get current(): ActiveTool | undefined; /** Feed an `item/started` notification. */ onItemStarted(params: Record, now?: number): void; /** Feed an `item/completed` notification. */ onItemCompleted(params: Record): void; /** Clear on turn boundaries so a stale tool never sticks. */ reset(): void; }