@uncaged/nerve-store
v0.5.0
Published
Persistent storage for the [nerve](../../README.md) daemon — append-only structured logs, optional JSONL cold archive, and content-addressable blobs.
Readme
@uncaged/nerve-store
Persistent storage for the nerve daemon — append-only structured logs, optional JSONL cold archive, and content-addressable blobs.
LogStore (createLogStore, log-store.ts)
- Append-only log table — rows with
source,type,refId,payload,ts(string payloads for ad hoc fields) - SQLite WAL —
DatabaseSyncfromnode:sqlite - Workflow run tracking — materialized
workflow_runstable plus helpers to list active runs, upsert status transitions, and read thread messages / role rounds for CLI and crash recovery - Meta key-value — small
metatable (e.g. archive watermarks)
Public exports include LogStore, LogEntry, LogQuery, WorkflowRun, WorkflowRunStatus, ThreadRoundRow, GetThreadRoundsParams, and archive-related types re-exported from log-archive.
WorkflowRunStatus
Runs progress through a small state machine. Typical paths:
queued→startedwhen a worker picks up the threadstarted→completed|failed|crashed|interrupted|dropped
Semantics in the daemon/store layer:
completed/failed— normal terminal outcomes from the workflow workercrashed— worker exited unexpectedly; manager may respawn andresume-threadeligiblestartedrunsinterrupted— e.g. hot-reload drain killed an in-flight thread after timeoutdropped— concurrencyoverflow: droprejected a new run, oroverflow: queueevicted an queued item when the queue was full
LogArchive (log-archive.ts)
archiveLogs/ helpers — export eligible UTC days of old rows todata/archive/logs/YYYY-MM-DD.jsonl, delete archived rows from SQLite, optionalVACUUM- Used by
nerve store archivein@uncaged/nerve-cli
BlobStore (createBlobStore, blob-store.ts)
- Content-addressable storage —
writereturns lowercase sha256 hex; files live underdata/blobs/<2-hex>/<62-hex> read/exists— path must match digest on disk (tamper detection)
Install
pnpm add @uncaged/nerve-storeRequires Node.js ≥ 22.5 (same as the rest of the stack).
License
MIT
