Expand description
Cross-version named-agent registry mirror.
Mirrors db_agent_instances mutations into the JSON registry at
~/.agentmux/agents/registry/ so other AgentMux versions running
on the same machine see each other’s named agents in their launch
modal dropdowns. SQLite is authoritative for the local version;
the registry is a best-effort cross-version view.
Extracted from store.rs in Phase R.6 of the storage
modularization plan
(docs/specs/SPEC_STORE_MODULARIZATION_2026_05_27.md). This whole
file retires when Phase R sunsets the JSON registry entirely;
isolating it now makes that future deletion a clean unit.
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. - empty_
to_ 🔒none - 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.