/** * Automated-plan gate (2026-09). * * A planning pass never claims or closes a task, so a plan-mode task stays * `open` with the agent assigned and every re-emitted assignment wake sees it * again. The rule is uniform across every automated path: a planning pass may * start only while `planRunCount === 0`; after the first pass further passes * are manual only ("Improve plan" -> `plan.trigger`, which does not consult * this gate) or a continuation of an interrupted pass (question resume). * * Two checks, in order: * 1. `planRunCount >= 1` -> already planned; skip (matches the sweep / * re-sync filters, which use `planRunCount > 0`; `plannedAt != null` * implies count >= 1, so the count is the single source of truth). * 2. a local plan-session record exists -> THIS machine is (or was) mid-pass * while the hub's `POST /tasks/:id/plan-started` has not yet bumped the * count; never spawn a twin. Closes the two-wakes-before-plan-started race. * * Callers MUST return `'skipped'` on a skip - never fall through to the * executing `spawnAgentSession` tail (that would run a plan-mode task). */ export type AutomatedPlanGate = { action: 'plan'; } | { action: 'skip'; reason: 'already-planned' | 'local-plan-session'; planRuns: number; }; /** * Decide whether an automated wake may start a planning pass. * * @param task the task as returned by `GET /tasks/:id` (only `planRunCount` * is read; a missing/unknown field counts as 0 = first pass) * @param hasLocalPlanSession `hasHarnessSession(agentId, taskId, 'plan')` */ export declare function automatedPlanGate(task: { planRunCount?: unknown; } | null | undefined, hasLocalPlanSession: boolean): AutomatedPlanGate;