Skip to main content

agentmux_srv_core/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
20pub mod atomic;
21pub mod complete_enumeration;
22pub mod def_migrate;
23pub mod def_record_lock;
24pub mod def_schema;
25pub mod def_slug_index;
26pub mod def_store;
27pub mod leases;
28/// Blocking, exclusive, cross-process file lock (flock / LockFileEx), also
29/// used by `backend::cli_install` to serialize installs into the shared CLI dir.
30pub(crate) use leases::{lock_exclusive, try_lock_exclusive, try_lock_exclusive_range};
31pub mod migrate;
32pub mod paths;
33pub mod schema;
34pub mod shared_guard;
35pub mod store;
36pub mod unreadable;
37pub mod work_store;
38
39#[cfg(test)]
40mod tests;
41
42#[cfg(test)]
43pub(crate) mod upgrade_shapes_tests;
44
45pub use unreadable::UnreadableRecord;
46pub use migrate::{
47    backfill_source_bases_once, enumerate_objects_dbs, migrate_from_sqlite_once, MigrateStats,
48    SourceBackfillStats,
49};
50pub use paths::{
51    resolve_identity_store_path, resolve_isolated_work_store_path, resolve_shared_definitions_dir, resolve_shared_instances_dir, resolve_shared_lan_instances_dir,
52    resolve_shared_reactive_dir, resolve_shared_registry_dir, resolve_shared_store_path,
53    resolve_shared_transcripts_dir,
54};
55// crate-internal only — see resolve_global_shared_root's doc comment for why
56// migrations/runner.rs must call this directly instead of deriving `home`
57// from resolve_shared_store_path()'s (isolation-aware) return value.
58pub use paths::{resolve_global_shared_root, shared_root_ignoring_deferral};
59pub use complete_enumeration::enumerate_objects_dbs_complete;
60pub use def_migrate::{migrate_definitions_global_once, DefMigrateStats};
61pub use def_schema::{
62    DefContentBlob, DefSkillBlob, DefValidationError, DefinitionRecord, DefinitionRecordV1,
63    FormerSlug, AgentSeat, Handover, DEF_MAX_SUPPORTED_SCHEMA, DEF_MIN_SUPPORTED_SCHEMA,
64};
65pub use def_slug_index::SlugEntry;
66pub use def_store::{record_bytes, DefStoreError, DefinitionStore, LockedRecord, SlugAllocationLock};
67pub use leases::{ClaimantInfo, Lease, LeaseError, LeaseHolder, LeaseStore, LEASE_TTL_MS, RENEW_INTERVAL_MS};
68pub use schema::{
69    NamedAgentRecord, NamedAgentRecordV1, ValidationError, MAX_SUPPORTED_SCHEMA,
70    MIN_SUPPORTED_SCHEMA,
71};
72pub use store::{RecordScope, Registry, RegistryError};