/** * useBackgroundRuns - Hook for tracking background run processes * * Manages a list of backgrounded feature loop runs, polling their * status files periodically to track completion. */ import { type LoopStatus } from '../utils/loop-status.js'; /** * A backgrounded feature loop run */ export interface BackgroundRun { /** Feature name being implemented */ featureName: string; /** Timestamp when backgrounded */ backgroundedAt: number; /** Path to the log file */ logPath: string; /** Last polled status */ lastStatus: LoopStatus; /** Whether the run has completed */ completed: boolean; /** If polling was stopped due to repeated failures, the error reason */ pollError?: string; } /** * Return type for useBackgroundRuns hook */ export interface UseBackgroundRunsReturn { /** Current list of background runs */ runs: BackgroundRun[]; /** Add a feature to background tracking. Reads initial status and starts polling. */ background: (featureName: string) => void; /** Remove a completed run from tracking */ dismiss: (featureName: string) => void; /** Get a specific run by feature name */ getRun: (featureName: string) => BackgroundRun | undefined; } /** * Hook to track background feature loop runs * * @example * ```tsx * const { runs, background, dismiss, getRun } = useBackgroundRuns(); * * // When user presses Esc on RunScreen * background('my-feature'); * * // Check if a feature is running in background * const run = getRun('my-feature'); * ``` */ export declare function useBackgroundRuns(): UseBackgroundRunsReturn;