/** * Wake handling: `handleWake` (rate-limit defer, dedupe, quiet hours, * immediate stop signals, busy queue) and `spawnWake` (project/folder * guard, plan/build routing, folder serialization, per-type session * spawn). Split out of daemon.ts (line budget). */ import { loadConfig } from '../lib/config'; import { TeamshareApi } from '../lib/api'; import type { OrchestratorClient } from '../lib/orchestrator'; import { type SessionSettings } from './spawn'; import { type WakeEvent, type WakeOutcome } from './wake-routing'; export declare function handleWake(api: TeamshareApi, agentId: string, apiKey: string, event: WakeEvent, configInput: ReturnType | (() => ReturnType), extra: { settings?: SessionSettings | null; wakeQueue: Map; recentSpawns: Map; orchestratorClient?: OrchestratorClient | null; /** * This pass came from the OUTBOX DRAIN, for the lane it is already on * (2026-11-05). * * Every "ask again later" gate below used to call `enqueueOutbox` * unconditionally. When the caller was the drain itself, that re-enqueued * the very lane being drained: `enqueueOutbox` appends a trigger AND resets * `attempts` to 0, so the lane could never reach `OUTBOX_MAX_ATTEMPTS` and * retried forever at `LOCK_POLL_MS` (10s) - one real incident grew 13 * triggers and a "Wake queued" entry every 10 seconds while the run history * showed no progress. The lane it came from IS the queue; re-adding it is * pure duplication. */ fromOutbox?: boolean; }): Promise; /** * Per-wake context `spawnWake` was called with. Extracted so the folder-blocked * retry can re-enter `handleWake` with exactly what it was given. */ type SpawnExtra = { settings?: SessionSettings | null; wakeQueue?: Map; recentSpawns?: Map; orchestratorClient?: OrchestratorClient | null; /** This pass came from the outbox drain for the lane it is already on. */ fromOutbox?: boolean; }; export declare function spawnWake(api: TeamshareApi, agentId: string, apiKey: string, event: WakeEvent, config: ReturnType, extra?: SpawnExtra): Promise; export {};