defaultStatePath (src/dispatcher-state.ts)

gitingest_agenticmail_agenticmail · packages/claudecode/src/dispatcher-state.ts · typescript · MIT
email

Persists dispatcher cursors to a JSON file, enabling resume after restarts.

// Source: https://github.com/agenticmail/agenticmail | License: MIT | Copyright 2026 Ope Olatunji
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Dispatcher state persistence — per-agent cursors that survive a
 * restart so the dispatcher can resume where it left off.
 *
 * Why this exists
 * ───────────────
 * Before 0.9.8 the dispatcher kept all of its routing memory in RAM:
 *
 *   - `channel.seenUids` (Set<number>)  — UIDs already woken on, for dedup
 *   - `channel.seenTaskIds` (Set<string>) — task ids already spawned
 *   - in-flight wake-budget counts
 *
 * On every restart (PM2 reload, host reboot, a crash absorbed by the
 * uncaughtException guard) ALL of that state was lost. The visible
 * symptoms:
 *
 *   1. Mail that arrived WHILE the dispatcher was do

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key