Module def_schema

Module def_schema 

Source
Expand description

Global agent-definition registry file format + per-row validation.

Sibling of schema.rs (which describes the named instance record). This record carries a full agent definition so the roster can be reconstructed from any channel/version without joining the local channel’s SQLite — the foundation of cross-channel agent persistence (docs/specs/SPEC_CROSS_CHANNEL_AGENT_PERSISTENCE_2026-06-13.md, P0.2).

Layering: the registry module must NOT depend on backend::storage (which already depends on registry — that would cycle). So the fields of AgentDefinition are mirrored here as a self-contained struct; the AgentDefinition <-> DefinitionRecordV1 conversion lives in backend::storage (the dependent side). Bumping DEF_MAX_SUPPORTED_SCHEMA is the additive-evolution path, exactly like the instance record.

Structs§

DefContentBlob
A content blob (system prompt / mcp / env / soul / startup) attached to a definition — mirrors a db_agent_content row. Carried in the global record so a cross-channel agent launches with its instructions even though db_agent_content is per-version. (codex P1 on #1384.)
DefSkillBlob
A skill attached to a definition — mirrors a db_agent_skills row.
DefinitionRecord
On-disk envelope for a global agent-definition record. Stored at <shared>/agents/definitions/<id>.json.
DefinitionRecordV1
v1 definition payload — a faithful mirror of AgentDefinition’s columns, PLUS the per-definition content + skills blobs (which live in separate per-version tables and must travel with the definition for a cross-channel agent to launch with its instructions). New fields go here under #[serde(default)] (so older files still deserialize) paired with a DEF_MAX_SUPPORTED_SCHEMA bump.

Enums§

DefValidationError

Constants§

DEF_MAX_SUPPORTED_SCHEMA
Highest envelope schema this binary will write or read. Bumped per release that adds fields to the definition payload.
DEF_MIN_SUPPORTED_SCHEMA
Lowest envelope schema this binary will load.

Functions§

default_container_volumes 🔒
Serde default for container_volumes — preserves the db invariant that an omitted value is the empty JSON array "[]", not "" (which would surface via the read-path overlay). (reagent P2 on #1385.)
validate
Per-row validation. Mirrors schema::validate: reject anything that would surface a malformed definition to the roster. Failures are skipped (not auto-fixed), logged, and the file stays on disk for ops triage.