daemon

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type Source struct {
	Agent      string
	Root       string
	NewAdapter func() ingest.Adapter
}

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".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL