/** * Watchdog Scheduler Hook Handlers * * Starts a periodic health-check timer when a session begins and stops it when * the session ends. One watchdog per project root, enforced by a module-level * Map keyed on the resolved project root. * * Each 60-second tick: * 1. Detects agents with a stale heartbeat (> STALE_THRESHOLD_MS) * 2. Records each crash as a learning event in brain.db * 3. Attempts recovery (status reset to 'starting') for all crashed agents * 4. Fires the `onPatrol` hook for observability * * Best-effort contract: the watchdog NEVER crashes or throws. Any tick failure * is swallowed so the timer continues. Any error in the start/stop handlers is * also swallowed so it never blocks session operations. * * Gated behind `brain.autoCapture` config — the watchdog does NOT start unless * auto-capture is enabled. * * Auto-registers on module load. * * @task T549 * @epic T5149 */ import type { SessionEndPayload, SessionStartPayload } from '../types.js'; /** * Handle SessionStart — start the watchdog timer for this project root. * * Idempotent: if a watchdog is already running for this root (e.g. a second * session in the same process), the existing timer is reused. * * Gated behind `brain.autoCapture` — watchdog does not start unless auto-capture * is enabled. This aligns with all other brain-capture hooks. * * @param projectRoot - Absolute path to the project root directory. * @param _payload - SessionStart payload (unused). */ export declare function handleWatchdogStart(projectRoot: string, _payload: SessionStartPayload): Promise; /** * Handle SessionEnd — stop the watchdog timer for this project root. * * Safe to call when no watchdog is running (no-op). * * @param projectRoot - Absolute path to the project root directory. * @param _payload - SessionEnd payload (unused). */ export declare function handleWatchdogStop(projectRoot: string, _payload: SessionEndPayload): Promise; //# sourceMappingURL=watchdog-hooks.d.ts.map