Expand description
Background daemon for DiffLore.
Consumes the SQLite outbox in a loop so AI-agent hooks stay on the
fast path (hook = enqueue, daemon = drain). Does NOT listen on any
HTTP port — the local stack is Rust-on-SQLite so in-process access
is strictly cheaper than IPC. Lifecycle management uses a PID file
at ~/.difflore/daemon.pid; liveness is checked with kill(pid, 0).
run is the only long-running entry point; it installs a SIGTERM /
SIGINT handler that breaks out of the drain loop cleanly and deletes
the PID file before returning.
Enums§
- Daemon
Status - Report the daemon liveness state.
- Stop
Outcome - What
stopactually did — useful for UX messages.
Functions§
- pid_
path - Path of the PID file used by the internal daemon helpers.
- run
- Long-running drain loop. Claims outbox rows and dispatches them to the cloud on a fixed cadence. Only exits on SIGTERM / SIGINT or on a genuinely fatal error (DB open failure, etc.).
- status
- Probe the PID file + live process without mutating anything.
- stop
- Gracefully stop the daemon. Sends SIGTERM, waits up to
grace_secsfor the process to exit, then escalates to SIGKILL. Removes a stale PID file regardless of which path exits. Returns what actually happened so the CLI can phrase the UX correctly.