Documentation
¶
Overview ¶
Package daemon hosts Ozy's runtime: it owns configuration, the catalog store, and the in-process broker that every adapter shares (SPEC.md §6.1). The runtime is hosted by the serving process (the MCP adapter) rather than a standalone command: Start provisions the sidecar and conditionally indexes, then returns once ready. The Broker seam is swappable under a lock so a background provisioning pass can upgrade lexical search to hybrid semantic in place, visible to an adapter that reads Broker() per request.
Index ¶
- type Daemon
- func (d *Daemon) Broker() broker.Broker
- func (d *Daemon) Config() *config.Loaded
- func (d *Daemon) Index(ctx context.Context) *index.Summary
- func (d *Daemon) SemanticDegraded() bool
- func (d *Daemon) SetLogger(log *slog.Logger)
- func (d *Daemon) Shutdown()
- func (d *Daemon) Start(ctx context.Context)
- func (d *Daemon) Store() catalog.Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon holds the runtime wiring shared by the CLI and MCP adapter.
func New ¶
New constructs the runtime from already-loaded configuration. It initializes the persistent catalog store and the broker. Configuration validation happens in config.Load, so an invalid config never reaches this point.
Semantic search is wired during Start() when the sidecar can be provisioned; New returns the lexical-only baseline that works without Python.
func NewWithStore ¶
NewWithStore constructs a daemon with an injected store. It keeps tests and focused in-memory callers from touching the user's durable catalog. The logger defaults to a discard logger; the serving process installs a real one via SetLogger.
func (*Daemon) Broker ¶
Broker returns the shared broker used by all adapters. It is read under a lock so a background sidecar swap is visible and race-free.
func (*Daemon) Index ¶
Index provisions the embedding sidecar (idempotently) and runs the indexer, attaching the embedding sink when semantic search is available. It is the one index path shared by Start and the standalone `ozy index` command, so both index identically — catalog plus vectors when semantic is enabled.
func (*Daemon) SemanticDegraded ¶
SemanticDegraded reports whether semantic search is configured but the sidecar is not actually serving (provisioning failed, health check failed, or the sidecar crashed), so callers can surface the graceful fallback to lexical search (SPEC.md §4.10, §10.1). Returns false when semantic is disabled or when it is enabled AND the sidecar is healthy.
func (*Daemon) SetLogger ¶
SetLogger installs the structured logger used for lifecycle and degradation events. The serving process points this at the config-dir log file; tests may install a capturing handler. A nil logger is ignored.
func (*Daemon) Shutdown ¶
func (d *Daemon) Shutdown()
Shutdown stops the embedding sidecar if one is running. It is safe to call when no sidecar was provisioned. The serving adapter and the standalone `ozy index` / `ozy search` paths use it to avoid leaking the subprocess.
func (*Daemon) Start ¶
Start provisions the embedding sidecar (when semantic search is enabled) and runs a conditional index, then returns once the runtime is ready. It does NOT block: the serving process owns the lifetime and calls Shutdown on exit. A cold model download or provisioning failure degrades to the lexical baseline rather than failing Start, so a serving adapter can launch Start in the background and keep answering from lexical until semantic becomes ready.