import type { WakeEvent } from '../bridge/wake-routing'; /** * WHO MAY WORK A TASK THAT IS NOT `open` (2026-10) — bridge mirror. * * The authoritative rule lives in the backend (`teamshare-backend` * `src/common/constants/task-work-gate.ts`, enforced by * `AgentEventsService.workBlockReason` and `TaskLifecycleService.claimTask`). * This file is the SAME rule on the bridge side, kept deliberately small and * duplicated rather than shared: the bridge is its own repo/package and has no * dependency on the API, and the rule is a handful of lines. **If you change one * side, change the other** — the tests below assert the two agree. * * WHY THE BRIDGE NEEDS ITS OWN COPY: the hub gate only sees wakes that pass * through `AgentEventsService.wake`. The bridge ALSO builds wakes locally, from * its own inbox poll, its reconnect re-sync and its on-disk wake queue — none of * which the hub ever sees. A resolved task can therefore still be handed to a * session from a queued wake flushed an hour later. Two gates, one rule. * * `in_progress` is WORKABLE, and that is load-bearing in both directions: * - the bridge moves a task `open -> in_progress` on pickup, so every live run * sits there; refusing it would refuse the task's own continuation; * - a run that died without cleaning up (killed process, power loss) leaves * the task `in_progress` forever, and the stranded-task sweep is the only * thing that recovers it. That is why the sweep admits `in_progress`. * * MANUAL = a human pressed something. Everything else (resumes, replays, * reconnects, sweeps, timeouts, inbox polls) is refused. */ export declare const WORKABLE_TASK_STATUSES: ReadonlySet; export declare const MANUAL_TASK_WAKE_TYPES: ReadonlySet; /** * `true` when a wake may work `status`. * * `status === null/undefined` means the task could not be read — callers that * failed to fetch fall through and let `claimTask` refuse (TASK_NOT_OPEN), so an * unreadable task never becomes workable by accident. * * `orchestratorManaged` exempts an orchestrator run. Its workers are dispatched * with plain `task.assigned` wakes tagged `orchestratorTaskId` + `role: 'worker'`, * and the hub scheduler treats a refused wake as a FAILED dispatch and reverts * it ("otherwise the OT runs forever with nobody on it"). Gating those on the * source task's board status would break a run the moment a human resolved a * source task mid-flight, stalling every chain/group run on its next task. The * run owns that task's lifecycle, so there is nothing to gate. */ export declare function mayWorkTaskStatus(status: string | null | undefined, wakeType: WakeEvent['type'], opts?: { orchestratorManaged?: boolean; }): boolean;