import type { NormalizedTask } from '../tasks/types.js'; /** * 70 minutes: WORKER_MAX_DURATION (1 h) + 10 min buffer. * * A `running` task row older than this is almost certainly a ghost (#979): * the worker crashed / was killed without emitting task_failed, leaving a * stale DB row. We surface `stale: true` so UIs can show a "may be stuck" * indicator instead of displaying an indefinitely running task. * * Do NOT shorten below 70 min — a legitimately long task can occupy the full * WORKER_MAX_DURATION (1 h) and must not be false-positive-staled. */ export declare const DEFAULT_TASK_STALE_AFTER_MS: number; export interface UseTasksOptions { /** Override the age threshold for marking a running row stale. Defaults to DEFAULT_TASK_STALE_AFTER_MS. */ staleAfterMs?: number; } export interface UseTasksResult { tasks: NormalizedTask[]; isLoading: boolean; error: Error | null; refetch: () => void; } /** * useTasks — hydrates the tasks store slice from REST (user-wide via * `listAllTasks` when the provider supports it, #1591; else legacy * per-session `listTasks(sessionId)`; user-wide 端点缺失(404/501)时同样回退 * per-session,解耦 gateway 部署顺序), and derives a `stale` flag for ghost * `running` rows as a #979 mitigation. * * Authority model(聚合模式下按 session 分野,review Important-4): * - 当前 session 的行:live task_* WS 事件(B3 store slice)保持权威 —— * task_* 只经该 session 自己的反向 WS 上行,gateway 无 user 级 fanout。 * - 跨 session 的行:WS 事件到不了,终态只能靠重新 hydrate 收敛 * (mount / sessionId 变化 / 消费方接 refetch 于 WS 重连时)。无定时对账 —— * 其他 session 已完成的任务在下次 hydrate 前可能仍显示进行中。 * * Missing-provider behavior matches useWorkspaceFiles exactly: throw if * `tasksProvider` is null on the context. */ export declare function useTasks(opts?: UseTasksOptions): UseTasksResult; //# sourceMappingURL=use-tasks.d.ts.map