/**
 * WorkflowDataWatcher — observe `<project>/.ccweb/workflow_data.json`
 * for `task_progress[taskIndex].finish === true` signals.
 *
 * Replaces (and inlines a more focused version of) the inline polling
 * loop in backend/src/flows/runner.ts:waitForTaskFinish. The track
 * subsystem needs the same primitive but decoupled from FlowRunner.
 *
 * Strategy:
 *   - fs.watch with 50ms debounce
 *   - on each event, read file + parse JSON
 *   - for any pending waiter whose taskIndex.finish is true → resolve
 *   - AbortSignal cancels the wait (returns 'cancelled')
 *   - timeoutMs caps the wait (returns 'timeout')
 *
 * The watcher does NOT write to workflow_data.json. Only the LLM (via
 * the PTY process the adapter injects into) is expected to write.
 */
import type { WorkflowData } from './types';
export type FinishOutcome = {
    kind: 'ok';
    finishedAt: number;
    data: WorkflowData;
} | {
    kind: 'timeout';
} | {
    kind: 'cancelled';
} | {
    kind: 'error';
    message: string;
};
export interface WorkflowDataWatcher {
    /** Begin watching the file. Idempotent. */
    start(): void;
    /** Stop watching + reject all pending waiters with cancelled. */
    stop(): void;
    /**
     * Wait until workflow_data.task_progress[taskIndex].finish === true
     * for the given taskIndex, OR timeoutMs elapses, OR signal aborts.
     * Returns the post-finish WorkflowData snapshot on success.
     */
    waitForFinish(taskIndex: number, timeoutMs: number, signal?: AbortSignal): Promise<FinishOutcome>;
    /** One-shot read of the file (used by tests + adapter). */
    read(): Promise<WorkflowData>;
}
export declare function createWorkflowDataWatcher(workflowDataPath: string): WorkflowDataWatcher;
//# sourceMappingURL=workflow-data-watcher.d.ts.map