Expand description
WaveStore: generic OID-based CRUD for WaveObj types. Port of Go’s pkg/wstore/wstore_dbops.go + wstore_dbsetup.go.
Uses Mutex<Connection> matching Go’s MaxOpenConns(1).
SQLite WAL mode + 5s busy timeout (same as Go).
Structs§
- Agent
Content - A content blob associated with a agent definition.
- Agent
Definition - A user-defined AI agent in the user’s agent-definition catalog.
- Agent
History - An append-only session history entry for a agent definition.
- Agent
Identity Link - Junction row: which identity an agent uses for a given provider.
- Agent
Instance - One row per running/historical execution of an agent definition.
block_id/session_id/github_contextare modelled as empty strings on the wire rather thanOption<String>to match the existing schema conventions (NOT NULL DEFAULT ''). Callers that need structured absence can use.is_empty(). - Agent
Skill - A reusable skill/capability attached to a agent definition.
- GitHub
Context - Optional context describing which GitHub-side unit of work a specific
instance is operating on. Stored as JSON in
db_agent_instances.github_context(empty string when unset). - Identity
- A named credential bundle. Contains zero or more accounts via the
db_identity_bindingsjunction.is_blanktags the seeded singleton row that the launch UI uses as the default option. - Identity
Account - An identity account (reusable credential, linked to agents via the
db_agent_identity_linksjunction). Replaces the browser localStorage identity store. - Identity
Binding - Junction row binding an account to an identity for a given provider.
- Memory
- A Memory bundle — the agent’s personality and capability stack. Provider, model, instructions, and JSON-encoded arrays of context files / MCP servers / skills. Agent definitions shadow-migrate into this table during the v7 migration.
- StoreTx
- A borrowed connection handle for use inside
WaveStore::with_tx. Provides the same CRUD methods asWaveStorebut operates on the already-locked connection without additional Mutex acquisition. - Wave
Store - SQLite-backed object store for WaveObj types.
Enums§
- Instance
Status - Instance lifecycle status. Serialised lowercase to match the DB text.
- Secret
Ref - Provider-specific credential reference. Stored as JSON in
db_identity_accounts.secret_ref.backendis the discriminator. The actual secret value is NEVER stored in the DB — only how to look it up at launch time (env var, secrets-manager path, etc.).PlaintextDevexists for local dev convenience and must never be the default path in production builds.
Functions§
- agent_
instance_ 🔒to_ record - Build a registry record from an
AgentInstance. Returns an error if the working directory can’t be expressed as a path relative to the canonical shared agents root (e.g. user pointed an agent at~/projects/foo, which would also fail a naive"agents"segment-scan that happened to match~/projects/agents/foo). Caller logs + skips — agent stays in SQLite, just not in the cross-version dropdown. - default_
agent_ 🔒type - default_
context_ 🔒json - default_
identity_ 🔒status - default_
json_ 🔒array_ string - derive_
slug - Derive a filesystem-safe slug from a display name. Lowercase,
ASCII alphanumeric + dash/underscore, consecutive dashes collapsed,
trimmed to 64 chars. Returns
"agent"if the input has no valid characters (defensive fallback). - empty_
to_ 🔒none - format_
epoch_ 🔒date - Format days-since-epoch as YYYY-MM-DD string. Simple implementation without chrono dependency.
- map_
agent_ 🔒definition_ row - Phase 3b — row mapper for
db_agentsrows projected back into theAgentDefinitionshape. The column order MUST match the SELECT inagent_def_list.parent_template_idmaps toparent_idbecause the consolidated table renamed the field to clarify its semantics (template lineage), but the wire shape kept the old name. - map_
instance_ 🔒row - map_
memory_ 🔒row - relative_
workdir 🔒 - Express
absas a path relative toagents_root. ReturnsNonewhenabsis empty, not underagents_root, or after stripping resolves to an empty path. Anchors against the resolved shared root (passed in by the caller) — never scans for a path segment named “agents”, which would match unrelated user directories like/home/me/projects/agents/foo.