Skip to main content

agentmux_srv/registry/
mod.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Shared, cross-version named-agent registry. File-per-agent JSON
5//! tree at `<shared_home>/agents/registry/`. See
6//! `docs/specs/SPEC_SHARED_AGENT_REGISTRY_2026_05_12.md`.
7//!
8//! PR A — Parallel-write only. The `Store` `instance_*` mutators
9//! call `Registry::{upsert,retire,unretire,hard_delete}` after their
10//! SQL execute() succeeds. Frontend RPCs still source rows from
11//! SQLite; the registry files are populated but not yet read.
12//!
13//! `MIN_SUPPORTED_SCHEMA`, `ValidationError`, `RegistryError`, and
14//! `Registry::list_active` are part of the registry's stable surface
15//! but are only consumed by tests + by PR B's read-path swap. The
16//! `allow(dead_code)` on the re-exports keeps that intent explicit.
17
18#![allow(dead_code, unused_imports)]
19
20mod atomic;
21mod def_migrate;
22mod def_schema;
23mod def_store;
24mod leases;
25/// Blocking, exclusive, cross-process file lock (flock / LockFileEx), also
26/// used by `backend::cli_install` to serialize installs into the shared CLI dir.
27pub(crate) use leases::{lock_exclusive, try_lock_exclusive};
28mod migrate;
29mod paths;
30mod schema;
31mod store;
32
33#[cfg(test)]
34mod tests;
35
36pub use migrate::{
37    backfill_source_bases_once, enumerate_objects_dbs, migrate_from_sqlite_once, MigrateStats,
38    SourceBackfillStats,
39};
40pub use paths::{
41    resolve_identity_store_path, resolve_shared_definitions_dir, resolve_shared_lan_instances_dir,
42    resolve_shared_reactive_dir, resolve_shared_registry_dir, resolve_shared_store_path,
43    resolve_shared_transcripts_dir,
44};
45// crate-internal only — see resolve_global_shared_root's doc comment for why
46// migrations/runner.rs must call this directly instead of deriving `home`
47// from resolve_shared_store_path()'s (isolation-aware) return value.
48pub(crate) use paths::resolve_global_shared_root;
49pub use def_migrate::{migrate_definitions_global_once, DefMigrateStats};
50pub use def_schema::{
51    DefContentBlob, DefSkillBlob, DefValidationError, DefinitionRecord, DefinitionRecordV1,
52    DEF_MAX_SUPPORTED_SCHEMA, DEF_MIN_SUPPORTED_SCHEMA,
53};
54pub use def_store::{DefStoreError, DefinitionStore};
55pub use leases::{ClaimantInfo, Lease, LeaseError, LeaseHolder, LeaseStore, LEASE_TTL_MS, RENEW_INTERVAL_MS};
56pub use schema::{
57    NamedAgentRecord, NamedAgentRecordV1, ValidationError, MAX_SUPPORTED_SCHEMA,
58    MIN_SUPPORTED_SCHEMA,
59};
60pub use store::{RecordScope, Registry, RegistryError};