/**
 * @fileoverview Workflow (ultracode) Run Watcher
 *
 * Watches `~/.claude/projects/<projHash>/<sessionUuid>/workflows/wf_*.json` —
 * the run-state JSON the Workflow tool writes for each ultracode run — and emits
 * events powering the master-detail "working agents" view (tasks/phases on the
 * LEFT, per-agent tokens/tool-calls on the RIGHT).
 *
 * Deliberately STANDALONE: it never imports from or touches subagent-watcher.ts.
 * It globs the run-state tree (`.../workflows/wf_*.json`); subagent-watcher globs
 * the disjoint, deeper transcript tree (`.../subagents/workflows/wf_<id>/agent-*`).
 * Separate singletons, disjoint directories, no shared mutable state.
 *
 * Discovery is dual: a periodic poll (catches new run dirs + removals) plus a
 * per-run-dir chokidar watcher (live within-run updates). A per-file mtime skip
 * keeps the hot path cheap — the run JSON is rewritten on every agent tick.
 *
 * @module workflow-run-watcher
 */
import { EventEmitter } from 'node:events';
import type { WorkflowRunInfo, WorkflowRunSummary } from './types/workflow-run.js';
/** Drop the heavy `agents[]` for list/snapshot use. */
export declare function summarizeRun(info: WorkflowRunInfo): WorkflowRunSummary;
export declare class WorkflowRunWatcher extends EventEmitter {
    private projectsDir;
    private pollTimer;
    private _isRunning;
    /** runId -> latest parsed run info (LRU-bounded). */
    private runs;
    /** absolute run-file path -> last seen mtimeMs (skip unchanged files). */
    private fileMtimes;
    /** runId -> absolute run-file path (for mtime cleanup on removal). */
    private runIdToPath;
    /** workflows-dir absolute path -> chokidar watcher (one per live run dir). */
    private dirWatchers;
    constructor(projectsDir?: string);
    isRunning(): boolean;
    start(): void;
    stop(): void;
    /** All cached runs (no recency filter), most-recently-active first. */
    getAllRuns(): WorkflowRunInfo[];
    /** Runs active within the last `minutes`, most-recently-active first. */
    getRecentRuns(minutes?: number): WorkflowRunInfo[];
    /**
     * Lightweight summaries (no agents[]) of ALL cached runs, most-recently-active
     * first. This is the LEFT-pane list + getLightState snapshot source: the cache
     * is LRU-bounded (MAX_CACHED_WORKFLOW_RUNS), so it's already size-capped, and a
     * run-browser should show past runs — NOT hide everything older than a window.
     */
    getAllRunSummaries(): WorkflowRunSummary[];
    /** Summaries filtered to the last `minutes` of activity (opt-in via ?minutes). */
    getRecentRunSummaries(minutes?: number): WorkflowRunSummary[];
    getRun(runId: string): WorkflowRunInfo | undefined;
    getStats(): {
        runCount: number;
        running: number;
        agentCount: number;
    };
    private poll;
    private pollAsync;
    /** Walk projects/<projHash>/<sessionUuid>/workflows/ for wf_*.json files. */
    private discover;
    private maybeParse;
    /**
     * Parse a wf_<runId>.json into WorkflowRunInfo, STRIPPING the heavyweight
     * `script`/`scriptPath`/`result`/`logs` fields (the embedded script alone is
     * 15–660KB) so they never reach the cache, SSE, or routes.
     */
    private parseFile;
    private toAgent;
    private ensureDirWatcher;
    private removeDirWatcher;
}
/** Process-wide singleton (mirrors subagentWatcher / imageWatcher). */
export declare const workflowRunWatcher: WorkflowRunWatcher;
//# sourceMappingURL=workflow-run-watcher.d.ts.map