Documentation
¶
Overview ¶
Package daemon runs continuous ingestion: an initial catch-up pass over each source's whole tree, then live incremental re-ingestion as session files change, watched via fsnotify.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(ctx context.Context, db *sql.DB, sources []Source, fallbackInterval, debounceDelay time.Duration) error
Run performs an initial catch-up ingest across every source, then blocks, watching each source's directory tree for live changes and incrementally re-ingesting touched files. A periodic fallback re-scan (every fallbackInterval) catches anything fsnotify missed — filesystem event delivery isn't perfectly reliable on every platform WSL might run this under, so this isn't just defensive theater — and is also what notices a source root that didn't exist yet at startup (an agent used for the first time after the daemon started) and starts watching it.
debounceDelay is how long a .jsonl file must go quiet before it's re-ingested — a real writer appends line by line, and re-running ingest on every single Write event would be wasteful. Exposed as a parameter (rather than a hardcoded constant) mainly so tests aren't stuck waiting out a production-sized delay.
Types ¶
type Source ¶
Source is one agent's session tree: where it lives, and how to get a fresh Adapter for it. Mirrors cmd/ctx's agentSource — kept as its own type here so this package doesn't depend on cmd/ctx's path-resolution concerns (home directory, per-agent subpaths), only on "here's a root and an adapter factory".