/** * SQLite store for the GLOBAL-tier **Agent Registry** — the canonical agent * identity database (agents / capabilities / skills / credentials). Formerly * labelled "signaldock"; renamed under T11622 / SG-AGENT-IDENTITY E4. * * The Agent Registry holds cross-project agent identity, the capability/skill * catalog, and cloud-sync tables. It has ZERO send/receive functions — * agent-to-agent messaging is owned by the conduit domain (conduit-sqlite.ts, * T344). The external `api.signaldock.io` URL is a Conduit transport CHANNEL, not * this local registry, and intentionally keeps its legacy hostname. * * ## E6-L5 — thin-facade migration (T11525) * * `ensureGlobalAgentRegistryDb()` is a thin facade that delegates the database * open to {@link openDualScopeDb}('global') — the canonical dual-scope chokepoint * (E3/E4 · T11512/T11517) already adopted by the tasks domain (E6-L1, T11521), * the brain domain (E6-L2, T11522), the conduit domain (E6-L3, T11523), and the * nexus domain (E6-L4, T11524). The Agent Registry tables live inside the * consolidated GLOBAL `cleo.db` under {@link getCleoHome}, sharing the SAME native * handle the nexus / skills global domains use. * * ## COMPLETE-CUTOVER to prefixed `agent_registry_*` tables (T11622 · folds T11578 AC2) * * The Agent Registry runtime READ + WRITE path now targets the PREFIXED * consolidated tables (`agent_registry_agents`, `agent_registry_capabilities`, * `agent_registry_skills`, …) that the consolidated cleo-global migration creates * (20260531000001 + the 20260602000001_t11622 `ALTER TABLE … RENAME` flip) — NOT * the legacy BARE tables (`agents`, `capabilities`, …). The schema barrel imported * below is therefore `schema/cleo-global/agent-registry.ts` (the prefixed target * shape: TEXT ISO-8601 timestamps + CHECK constraints), replacing the legacy * `schema/agent-registry-schema.ts` bare shape. * * The drizzle journal `runAgentRegistryMigrations` reconciles now only needs the * two legacy `_agent_registry_meta` / `_agent_registry_migrations` health-probe * tables that the consolidated migration omits (mirrors the conduit AC4 pattern). * The 13 prefixed `agent_registry_*` tables are owned by the consolidated migration * (single SSoT) — this domain no longer creates a disjoint bare runtime shape. * * Migration folder: packages/core/migrations/drizzle-agent-registry/ * * GLOBAL-TIER ONLY. This module MUST NOT resolve paths under any project's .cleo/ * directory. The path guard in getGlobalAgentRegistryDbPath() enforces this. * * @task T346 * @task T1166 * @task T11525 - E6-L5: route ensureGlobalAgentRegistryDb through openDualScopeDb('global') * @task T11622 - Signaldock → Agent Registry rename + runtime cutover to agent_registry_* (folds T11578 AC2) * @epic T310 * @epic T1150 * @epic T11249 * @related ADR-037 */ import type { DatabaseSync } from 'node:sqlite'; /** * Database file name within the global cleo home directory. * * @task T346 * @epic T310 */ export declare const GLOBAL_AGENT_REGISTRY_DB_FILENAME = "signaldock.db"; /** * Schema version for the global Agent Registry database. * * @task T346 * @epic T310 */ export declare const GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION = "2026.4.12"; /** * @deprecated Use GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION. T310 is done (archived). * Retained only because packages/core/src/internal.ts re-exports this name. * Removal blocked until internal.ts export is cleaned up. * Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0. */ export declare const AGENT_REGISTRY_SCHEMA_VERSION = "2026.4.12"; /** * Returns the GLOBAL-tier Agent Registry DB path — the consolidated GLOBAL * `cleo.db`. * * E6-L5 (T11525): resolves `getCleoHome()` + `cleo.db` (the same path * {@link openDualScopeDb}('global') opens). The Agent Registry holds canonical * agent identity + cloud-sync tables and stays GLOBAL — its tables live inside the * consolidated GLOBAL `cleo.db`, NOT a separate file. Project-local messaging state * lives in conduit.db (T344). * * Guard: asserts the resolved path starts with getCleoHome() (defense in depth, * mirrors the ADR-036/037 pattern used by getNexusDbPath in nexus-sqlite.ts). * * @task T346 * @task T11525 * @epic T310 * @epic T11249 * @throws {Error} If resolved path is not under getCleoHome() — indicates a code * path that bypasses canonical path resolution. Fix the caller, do not suppress. */ export declare function getGlobalAgentRegistryDbPath(): string; /** * @deprecated Use getGlobalAgentRegistryDbPath() directly. T310 is done (archived). * Blocked from deletion: two callers still use this shim and require migration: * - packages/core/src/store/cross-db-cleanup.ts (calls with cwd — will throw) * - packages/core/src/internal.ts (re-exports this name) * Fix: migrate cross-db-cleanup.ts to use getConduitDbPath() and remove from * internal.ts. Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0. * * When called WITHOUT arguments: returns the global-tier path (forwards to * getGlobalAgentRegistryDbPath()). * * When called WITH a non-undefined `cwd` argument: throws a migration error * immediately. The project-tier path is now owned by conduit-sqlite.ts (T344). * * @param cwd - Must be undefined. Any other value throws a migration error. * @task T346 * @epic T310 */ export declare function getAgentRegistryDbPath(cwd?: string): string; /** * Resolve the absolute path to the drizzle-agent-registry migrations folder inside * @cleocode/core, using ESM-native module resolution (T1177). * * Delegates to {@link resolveCorePackageMigrationsFolder} which handles * bundled dist/, workspace dev, and global-install layouts uniformly via * `import.meta.resolve()` + `createRequire().resolve()` fallback. * * @task T1166 * @epic T1150 */ export declare function resolveAgentRegistryMigrationsFolder(): string; /** * Ensure the global Agent Registry tables exist inside the consolidated GLOBAL * `cleo.db`. Creates the global cleo home directory if it doesn't exist. * Idempotent — safe to call multiple times. * * Post-T11622 cutover: the prefixed `agent_registry_*` runtime tables are created * by the consolidated cleo-global migration that `openDualScopeDb('global')` runs. * This function then reconciles the legacy health-probe ledger via the * drizzle-agent-registry migration. It no longer creates the bare-named tables. * * @returns Object with action ('created' | 'exists') and the database path. * @task T346 * @task T1166 * @task T11622 * @epic T310 */ export declare function ensureGlobalAgentRegistryDb(): Promise<{ action: 'created' | 'exists'; path: string; }>; /** * @deprecated Use ensureGlobalAgentRegistryDb(). T310 is done (archived). * Blocked from deletion: caller still uses this shim and requires migration: * - packages/core/src/upgrade.ts calls ensureAgentRegistryDb(projectRootForMaint) * (with cwd arg — will throw at runtime). Must migrate to ensureConduitDb(cwd). * - packages/core/src/internal.ts re-exports this name. * Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0. * * When called WITHOUT arguments: forwards to ensureGlobalAgentRegistryDb(). * When called WITH a non-undefined `cwd` argument: throws a migration error. * * @param cwd - Must be undefined. Any other value throws a migration error. * @task T346 * @epic T310 */ export declare function ensureAgentRegistryDb(cwd?: string): Promise<{ action: 'created' | 'exists'; path: string; }>; /** * Check global Agent Registry health: table count, WAL mode, schema version. * Used by `cleo doctor` to verify global Agent Registry integrity. * * E6-L5 (T11525): reads against the SHARED consolidated GLOBAL `cleo.db` handle * (via {@link ensureGlobalAgentRegistryDb}, which routes through * {@link openDualScopeDb}('global')). The metrics describe the consolidated * `cleo.db` that hosts the prefixed `agent_registry_*` tables. * * @returns Health report object, or object with exists=false if the DB does not exist. * @task T346 * @task T11525 * @epic T310 * @epic T11249 */ export declare function checkGlobalAgentRegistryDbHealth(): Promise<{ exists: boolean; path: string; tableCount: number; walMode: boolean; schemaVersion: string | null; foreignKeysEnabled: boolean; } | null>; /** * @deprecated Use checkGlobalAgentRegistryDbHealth(). T310 is done (archived). * Retained only because packages/core/src/internal.ts re-exports this name. * Removal blocked until internal.ts export is cleaned up. * Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0. * * When called WITHOUT arguments: forwards to checkGlobalAgentRegistryDbHealth(). * When called WITH a non-undefined `cwd` argument: throws a migration error. * * @param cwd - Must be undefined. Any other value throws a migration error. * @task T346 * @epic T310 */ export declare function checkAgentRegistryDbHealth(cwd?: string): Promise<{ exists: boolean; path: string; tableCount: number; walMode: boolean; schemaVersion: string | null; foreignKeysEnabled: boolean; } | null>; /** * Get the underlying node:sqlite DatabaseSync instance for the global Agent * Registry (consolidated `cleo.db`). Returns the handle stored by the most recent * ensureGlobalAgentRegistryDb() call, or null if not yet initialized in this * process. * * Used by sqlite-backup.ts to activate the GLOBAL_SNAPSHOT_TARGET (spec §6.2, T310). * * @task T346 * @epic T310 */ export declare function getGlobalAgentRegistryNativeDb(): DatabaseSync | null; /** * Reset the in-process global Agent Registry singleton. * ONLY for use in test isolation — never call in production code. * * ## E6-L5 (T11525) — shared-handle close rule * * `_globalAgentRegistryNativeDb` is the SHARED consolidated GLOBAL `cleo.db` handle * owned by {@link openDualScopeDb}('global') and co-owned by the nexus / skills * global domains. This reset MUST NOT call `.close()` on it directly — doing so * would tear the handle out from under nexus / skills (the exact bug class L4 fixed * at `dual-scope-db.ts`). Instead it evicts the GLOBAL-scope entry from the * dual-scope cache and drops the local reference. The next * `ensureGlobalAgentRegistryDb()` re-opens a fresh consolidated handle. * * @task T346 * @task T11525 * @epic T310 * @epic T11249 */ export declare function _resetGlobalAgentRegistryDb_TESTING_ONLY(): void; //# sourceMappingURL=agent-registry-store.d.ts.map