@cleocode/core 2026.5.133 → 2026.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binaries/README.md +49 -27
- package/dist/agents/{agent-registry.d.ts → agent-capacity-tracker.d.ts} +2 -2
- package/dist/agents/agent-capacity-tracker.d.ts.map +1 -0
- package/dist/agents/{agent-registry.js → agent-capacity-tracker.js} +2 -2
- package/dist/agents/agent-capacity-tracker.js.map +1 -0
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +4 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/seed-install.d.ts +1 -1
- package/dist/agents/seed-install.d.ts.map +1 -1
- package/dist/agents/seed-install.js +42 -36
- package/dist/agents/seed-install.js.map +1 -1
- package/dist/caamp-export.d.ts +18 -0
- package/dist/caamp-export.d.ts.map +1 -0
- package/dist/caamp-export.js +18 -0
- package/dist/caamp-export.js.map +1 -0
- package/dist/conduit/local-transport.d.ts +1 -1
- package/dist/conduit/local-transport.d.ts.map +1 -1
- package/dist/conduit/local-transport.js +69 -43
- package/dist/conduit/local-transport.js.map +1 -1
- package/dist/dispatch/mutate-projection.d.ts.map +1 -1
- package/dist/dispatch/mutate-projection.js +11 -0
- package/dist/dispatch/mutate-projection.js.map +1 -1
- package/dist/docs/docs-read-model.d.ts +7 -0
- package/dist/docs/docs-read-model.d.ts.map +1 -1
- package/dist/docs/docs-read-model.js +5 -0
- package/dist/docs/docs-read-model.js.map +1 -1
- package/dist/docs/supersede.d.ts.map +1 -1
- package/dist/docs/supersede.js +12 -7
- package/dist/docs/supersede.js.map +1 -1
- package/dist/doctor/db-substrate.d.ts.map +1 -1
- package/dist/doctor/db-substrate.js +10 -9
- package/dist/doctor/db-substrate.js.map +1 -1
- package/dist/git-shim-export.d.ts +18 -0
- package/dist/git-shim-export.d.ts.map +1 -0
- package/dist/git-shim-export.js +18 -0
- package/dist/git-shim-export.js.map +1 -0
- package/dist/hooks/payload-schemas.d.ts +2 -2
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +39 -32
- package/dist/init.js.map +1 -1
- package/dist/internal.d.ts +11 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +14 -5
- package/dist/internal.js.map +1 -1
- package/dist/lafs-export.d.ts +18 -0
- package/dist/lafs-export.d.ts.map +1 -0
- package/dist/lafs-export.js +18 -0
- package/dist/lafs-export.js.map +1 -0
- package/dist/lifecycle/effective-stage.js +1 -1
- package/dist/lifecycle/index.js +1 -1
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle/rollup.js +1 -1
- package/dist/llm/credential-pool.d.ts +17 -0
- package/dist/llm/credential-pool.d.ts.map +1 -1
- package/dist/llm/credential-pool.js +40 -1
- package/dist/llm/credential-pool.js.map +1 -1
- package/dist/llm/plugin-facade.d.ts.map +1 -1
- package/dist/llm/plugin-facade.js +11 -19
- package/dist/llm/plugin-facade.js.map +1 -1
- package/dist/llm/role-executor.d.ts +8 -0
- package/dist/llm/role-executor.d.ts.map +1 -1
- package/dist/llm/role-executor.js +96 -4
- package/dist/llm/role-executor.js.map +1 -1
- package/dist/llm/role-resolver.d.ts.map +1 -1
- package/dist/llm/role-resolver.js +56 -1
- package/dist/llm/role-resolver.js.map +1 -1
- package/dist/llm/transports/codex-oauth-headers.d.ts +51 -0
- package/dist/llm/transports/codex-oauth-headers.d.ts.map +1 -0
- package/dist/llm/transports/codex-oauth-headers.js +89 -0
- package/dist/llm/transports/codex-oauth-headers.js.map +1 -0
- package/dist/memory/claude-mem-migration.d.ts.map +1 -1
- package/dist/memory/claude-mem-migration.js +1 -3
- package/dist/memory/claude-mem-migration.js.map +1 -1
- package/dist/memory/decisions.d.ts.map +1 -1
- package/dist/memory/decisions.js +77 -23
- package/dist/memory/decisions.js.map +1 -1
- package/dist/memory/graph-memory-bridge.d.ts.map +1 -1
- package/dist/memory/graph-memory-bridge.js +12 -6
- package/dist/memory/graph-memory-bridge.js.map +1 -1
- package/dist/memory/learnings.d.ts +2 -2
- package/dist/memory/nexus-plasticity.d.ts +21 -9
- package/dist/memory/nexus-plasticity.d.ts.map +1 -1
- package/dist/memory/nexus-plasticity.js +44 -22
- package/dist/memory/nexus-plasticity.js.map +1 -1
- package/dist/memory/patterns.d.ts +2 -2
- package/dist/memory/redaction.d.ts +19 -3
- package/dist/memory/redaction.d.ts.map +1 -1
- package/dist/memory/redaction.js +22 -94
- package/dist/memory/redaction.js.map +1 -1
- package/dist/metrics/token-service.d.ts +8 -2
- package/dist/metrics/token-service.d.ts.map +1 -1
- package/dist/metrics/token-service.js +1 -1
- package/dist/metrics/token-service.js.map +1 -1
- package/dist/nexus/analyze-orchestrator.d.ts.map +1 -1
- package/dist/nexus/analyze-orchestrator.js +6 -8
- package/dist/nexus/analyze-orchestrator.js.map +1 -1
- package/dist/nexus/api-extractors/http-extractor.d.ts.map +1 -1
- package/dist/nexus/api-extractors/http-extractor.js +3 -3
- package/dist/nexus/api-extractors/http-extractor.js.map +1 -1
- package/dist/nexus/clusters.d.ts.map +1 -1
- package/dist/nexus/clusters.js +3 -2
- package/dist/nexus/clusters.js.map +1 -1
- package/dist/nexus/context.d.ts.map +1 -1
- package/dist/nexus/context.js +10 -16
- package/dist/nexus/context.js.map +1 -1
- package/dist/nexus/diff.d.ts.map +1 -1
- package/dist/nexus/diff.js +6 -4
- package/dist/nexus/diff.js.map +1 -1
- package/dist/nexus/export.d.ts.map +1 -1
- package/dist/nexus/export.js +7 -4
- package/dist/nexus/export.js.map +1 -1
- package/dist/nexus/flows.d.ts.map +1 -1
- package/dist/nexus/flows.js +3 -1
- package/dist/nexus/flows.js.map +1 -1
- package/dist/nexus/impact.d.ts +1 -1
- package/dist/nexus/impact.d.ts.map +1 -1
- package/dist/nexus/impact.js +31 -17
- package/dist/nexus/impact.js.map +1 -1
- package/dist/nexus/living-brain.d.ts.map +1 -1
- package/dist/nexus/living-brain.js +27 -15
- package/dist/nexus/living-brain.js.map +1 -1
- package/dist/nexus/nexus-bridge.d.ts.map +1 -1
- package/dist/nexus/nexus-bridge.js +28 -29
- package/dist/nexus/nexus-bridge.js.map +1 -1
- package/dist/nexus/plasticity-queries.d.ts +4 -2
- package/dist/nexus/plasticity-queries.d.ts.map +1 -1
- package/dist/nexus/plasticity-queries.js +27 -15
- package/dist/nexus/plasticity-queries.js.map +1 -1
- package/dist/nexus/query.d.ts.map +1 -1
- package/dist/nexus/query.js +6 -2
- package/dist/nexus/query.js.map +1 -1
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +65 -30
- package/dist/nexus/registry.js.map +1 -1
- package/dist/nexus/route-analysis.d.ts +3 -2
- package/dist/nexus/route-analysis.d.ts.map +1 -1
- package/dist/nexus/route-analysis.js +11 -10
- package/dist/nexus/route-analysis.js.map +1 -1
- package/dist/nexus/sigil.d.ts.map +1 -1
- package/dist/nexus/sigil.js +60 -13
- package/dist/nexus/sigil.js.map +1 -1
- package/dist/nexus/user-profile.d.ts +2 -1
- package/dist/nexus/user-profile.d.ts.map +1 -1
- package/dist/nexus/user-profile.js +8 -4
- package/dist/nexus/user-profile.js.map +1 -1
- package/dist/orchestrate/index.d.ts +1 -1
- package/dist/orchestrate/index.d.ts.map +1 -1
- package/dist/orchestrate/index.js +1 -1
- package/dist/orchestrate/index.js.map +1 -1
- package/dist/orchestrate/plan.d.ts +3 -3
- package/dist/orchestrate/plan.d.ts.map +1 -1
- package/dist/orchestrate/plan.js +7 -7
- package/dist/orchestrate/plan.js.map +1 -1
- package/dist/orchestrate/spawn-ops.js +2 -2
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestration/classify.d.ts +2 -2
- package/dist/orchestration/classify.js +3 -3
- package/dist/orchestration/classify.js.map +1 -1
- package/dist/orchestration/validate-spawn.d.ts.map +1 -1
- package/dist/orchestration/validate-spawn.js +5 -5
- package/dist/orchestration/validate-spawn.js.map +1 -1
- package/dist/paths-export.d.ts +18 -0
- package/dist/paths-export.d.ts.map +1 -0
- package/dist/paths-export.js +18 -0
- package/dist/paths-export.js.map +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +24 -11
- package/dist/paths.js.map +1 -1
- package/dist/playbooks/index.d.ts +1 -0
- package/dist/playbooks/index.d.ts.map +1 -1
- package/dist/playbooks/index.js +4 -0
- package/dist/playbooks/index.js.map +1 -1
- package/dist/playbooks/skill-node-executor.d.ts +155 -0
- package/dist/playbooks/skill-node-executor.d.ts.map +1 -0
- package/dist/playbooks/skill-node-executor.js +156 -0
- package/dist/playbooks/skill-node-executor.js.map +1 -0
- package/dist/repair.d.ts +3 -7
- package/dist/repair.d.ts.map +1 -1
- package/dist/repair.js +5 -43
- package/dist/repair.js.map +1 -1
- package/dist/sagas/migrate-containment.js +7 -7
- package/dist/sagas/migrate-containment.js.map +1 -1
- package/dist/scaffold/ensure-dirs.d.ts +8 -2
- package/dist/scaffold/ensure-dirs.d.ts.map +1 -1
- package/dist/scaffold/ensure-dirs.js +24 -11
- package/dist/scaffold/ensure-dirs.js.map +1 -1
- package/dist/scaffold/project-detection.d.ts +5 -1
- package/dist/scaffold/project-detection.d.ts.map +1 -1
- package/dist/scaffold/project-detection.js +9 -5
- package/dist/scaffold/project-detection.js.map +1 -1
- package/dist/sentient/hygiene-scan.js +6 -6
- package/dist/sentient/hygiene-scan.js.map +1 -1
- package/dist/sentient/proposal-dedup.js +2 -2
- package/dist/sentient/proposal-rate-limiter.js +1 -1
- package/dist/sentient/propose-tick.js +5 -5
- package/dist/sentient/propose-tick.js.map +1 -1
- package/dist/sentient/stage-drift-tick.js +3 -3
- package/dist/sentient/stage-drift-tick.js.map +1 -1
- package/dist/sequence/index.d.ts.map +1 -1
- package/dist/sequence/index.js +6 -2
- package/dist/sequence/index.js.map +1 -1
- package/dist/setup/sections/verification.js +2 -2
- package/dist/setup/sections/verification.js.map +1 -1
- package/dist/shutdown.d.ts +81 -0
- package/dist/shutdown.d.ts.map +1 -0
- package/dist/shutdown.js +105 -0
- package/dist/shutdown.js.map +1 -0
- package/dist/skills/index.d.ts +2 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/skill-executor-adapter.d.ts +136 -0
- package/dist/skills/skill-executor-adapter.d.ts.map +1 -0
- package/dist/skills/skill-executor-adapter.js +137 -0
- package/dist/skills/skill-executor-adapter.js.map +1 -0
- package/dist/skills/usage-recorder.d.ts.map +1 -1
- package/dist/skills/usage-recorder.js +30 -0
- package/dist/skills/usage-recorder.js.map +1 -1
- package/dist/skills-export.d.ts +23 -0
- package/dist/skills-export.d.ts.map +1 -0
- package/dist/skills-export.js +23 -0
- package/dist/skills-export.js.map +1 -0
- package/dist/stats/index.d.ts.map +1 -1
- package/dist/stats/index.js +8 -3
- package/dist/stats/index.js.map +1 -1
- package/dist/store/agent-doctor.d.ts +3 -3
- package/dist/store/agent-doctor.d.ts.map +1 -1
- package/dist/store/agent-doctor.js +18 -13
- package/dist/store/agent-doctor.js.map +1 -1
- package/dist/store/agent-install.d.ts +6 -5
- package/dist/store/agent-install.d.ts.map +1 -1
- package/dist/store/agent-install.js +20 -16
- package/dist/store/agent-install.js.map +1 -1
- package/dist/store/agent-registry-accessor.d.ts +66 -28
- package/dist/store/agent-registry-accessor.d.ts.map +1 -1
- package/dist/store/agent-registry-accessor.js +248 -167
- package/dist/store/agent-registry-accessor.js.map +1 -1
- package/dist/store/agent-registry-store.d.ts +242 -0
- package/dist/store/agent-registry-store.d.ts.map +1 -0
- package/dist/store/agent-registry-store.js +501 -0
- package/dist/store/agent-registry-store.js.map +1 -0
- package/dist/store/agent-resolver.d.ts +8 -8
- package/dist/store/agent-resolver.d.ts.map +1 -1
- package/dist/store/agent-resolver.js +19 -17
- package/dist/store/agent-resolver.js.map +1 -1
- package/dist/store/backup-pack.d.ts.map +1 -1
- package/dist/store/backup-pack.js +24 -8
- package/dist/store/backup-pack.js.map +1 -1
- package/dist/store/conduit-sqlite.d.ts +181 -74
- package/dist/store/conduit-sqlite.d.ts.map +1 -1
- package/dist/store/conduit-sqlite.js +307 -528
- package/dist/store/conduit-sqlite.js.map +1 -1
- package/dist/store/cross-db-cleanup.d.ts +5 -5
- package/dist/store/cross-db-cleanup.d.ts.map +1 -1
- package/dist/store/cross-db-cleanup.js +12 -10
- package/dist/store/cross-db-cleanup.js.map +1 -1
- package/dist/store/data-accessor.d.ts +4 -4
- package/dist/store/data-accessor.js +5 -5
- package/dist/store/data-accessor.js.map +1 -1
- package/dist/store/data-safety-central.d.ts +83 -1
- package/dist/store/data-safety-central.d.ts.map +1 -1
- package/dist/store/data-safety-central.js +257 -0
- package/dist/store/data-safety-central.js.map +1 -1
- package/dist/store/db-helpers.d.ts +8 -2
- package/dist/store/db-helpers.d.ts.map +1 -1
- package/dist/store/db-helpers.js +6 -2
- package/dist/store/db-helpers.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts +46 -4
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +103 -9
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/__fixtures__/representative-fixture.d.ts +116 -0
- package/dist/store/exodus/__fixtures__/representative-fixture.d.ts.map +1 -0
- package/dist/store/exodus/__fixtures__/representative-fixture.js +274 -0
- package/dist/store/exodus/__fixtures__/representative-fixture.js.map +1 -0
- package/dist/store/exodus/index.d.ts +18 -0
- package/dist/store/exodus/index.d.ts.map +1 -0
- package/dist/store/exodus/index.js +18 -0
- package/dist/store/exodus/index.js.map +1 -0
- package/dist/store/exodus/migrate.d.ts +160 -0
- package/dist/store/exodus/migrate.d.ts.map +1 -0
- package/dist/store/exodus/migrate.js +1220 -0
- package/dist/store/exodus/migrate.js.map +1 -0
- package/dist/store/exodus/on-open.d.ts +189 -0
- package/dist/store/exodus/on-open.d.ts.map +1 -0
- package/dist/store/exodus/on-open.js +464 -0
- package/dist/store/exodus/on-open.js.map +1 -0
- package/dist/store/exodus/plan.d.ts +44 -0
- package/dist/store/exodus/plan.d.ts.map +1 -0
- package/dist/store/exodus/plan.js +178 -0
- package/dist/store/exodus/plan.js.map +1 -0
- package/dist/store/exodus/status.d.ts +22 -0
- package/dist/store/exodus/status.d.ts.map +1 -0
- package/dist/store/exodus/status.js +88 -0
- package/dist/store/exodus/status.js.map +1 -0
- package/dist/store/exodus/table-name-map.d.ts +173 -0
- package/dist/store/exodus/table-name-map.d.ts.map +1 -0
- package/dist/store/exodus/table-name-map.js +660 -0
- package/dist/store/exodus/table-name-map.js.map +1 -0
- package/dist/store/exodus/types.d.ts +169 -0
- package/dist/store/exodus/types.d.ts.map +1 -0
- package/dist/store/exodus/types.js +21 -0
- package/dist/store/exodus/types.js.map +1 -0
- package/dist/store/exodus/verify-migration.d.ts +72 -0
- package/dist/store/exodus/verify-migration.d.ts.map +1 -0
- package/dist/store/exodus/verify-migration.js +678 -0
- package/dist/store/exodus/verify-migration.js.map +1 -0
- package/dist/store/exodus/verify.d.ts +58 -0
- package/dist/store/exodus/verify.d.ts.map +1 -0
- package/dist/store/exodus/verify.js +74 -0
- package/dist/store/exodus/verify.js.map +1 -0
- package/dist/store/index.d.ts +2 -3
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +2 -3
- package/dist/store/index.js.map +1 -1
- package/dist/store/memory-accessor.d.ts +31 -0
- package/dist/store/memory-accessor.d.ts.map +1 -1
- package/dist/store/memory-accessor.js +38 -0
- package/dist/store/memory-accessor.js.map +1 -1
- package/dist/store/memory-sqlite.d.ts +86 -13
- package/dist/store/memory-sqlite.d.ts.map +1 -1
- package/dist/store/memory-sqlite.js +326 -528
- package/dist/store/memory-sqlite.js.map +1 -1
- package/dist/store/migrate-signaldock-to-conduit.d.ts +1 -1
- package/dist/store/migrate-signaldock-to-conduit.d.ts.map +1 -1
- package/dist/store/migrate-signaldock-to-conduit.js +126 -35
- package/dist/store/migrate-signaldock-to-conduit.js.map +1 -1
- package/dist/store/migration-manager.d.ts +49 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +167 -67
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/migration-sqlite.d.ts +1 -1
- package/dist/store/migration-sqlite.d.ts.map +1 -1
- package/dist/store/migration-sqlite.js +32 -3
- package/dist/store/migration-sqlite.js.map +1 -1
- package/dist/store/nexus-sqlite.d.ts +152 -29
- package/dist/store/nexus-sqlite.d.ts.map +1 -1
- package/dist/store/nexus-sqlite.js +496 -177
- package/dist/store/nexus-sqlite.js.map +1 -1
- package/dist/store/nexus-validation-schemas.d.ts +32 -32
- package/dist/store/open-cleo-db.d.ts +37 -40
- package/dist/store/open-cleo-db.d.ts.map +1 -1
- package/dist/store/open-cleo-db.js +76 -153
- package/dist/store/open-cleo-db.js.map +1 -1
- package/dist/store/role-accessors-impl.d.ts +4 -4
- package/dist/store/role-accessors-impl.d.ts.map +1 -1
- package/dist/store/role-accessors-impl.js +18 -15
- package/dist/store/role-accessors-impl.js.map +1 -1
- package/dist/store/schema/{signaldock-schema.d.ts → agent-registry-schema.d.ts} +15 -5
- package/dist/store/schema/agent-registry-schema.d.ts.map +1 -0
- package/dist/store/schema/{signaldock-schema.js → agent-registry-schema.js} +15 -5
- package/dist/store/schema/agent-registry-schema.js.map +1 -0
- package/dist/store/schema/agent-schema.d.ts +1 -1
- package/dist/store/schema/agent-schema.js +4 -4
- package/dist/store/schema/agent-schema.js.map +1 -1
- package/dist/store/schema/attachments.d.ts +1 -1
- package/dist/store/schema/audit.d.ts +15 -5
- package/dist/store/schema/audit.d.ts.map +1 -1
- package/dist/store/schema/audit.js +12 -2
- package/dist/store/schema/audit.js.map +1 -1
- package/dist/store/schema/background-jobs.d.ts +1 -1
- package/dist/store/schema/cleo-global/{signaldock.d.ts → agent-registry.d.ts} +277 -271
- package/dist/store/schema/cleo-global/agent-registry.d.ts.map +1 -0
- package/dist/store/schema/cleo-global/{signaldock.js → agent-registry.js} +136 -125
- package/dist/store/schema/cleo-global/agent-registry.js.map +1 -0
- package/dist/store/schema/cleo-global/index.d.ts +29 -22
- package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/index.js +29 -22
- package/dist/store/schema/cleo-global/index.js.map +1 -1
- package/dist/store/schema/cleo-global/nexus.d.ts +36 -1034
- package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/nexus.js +32 -337
- package/dist/store/schema/cleo-global/nexus.js.map +1 -1
- package/dist/store/schema/cleo-global/skills.d.ts +16 -0
- package/dist/store/schema/cleo-global/skills.d.ts.map +1 -1
- package/dist/store/schema/cleo-global/skills.js +11 -0
- package/dist/store/schema/cleo-global/skills.js.map +1 -1
- package/dist/store/schema/{cleo-project → cleo-global}/telemetry.d.ts +33 -17
- package/dist/store/schema/cleo-global/telemetry.d.ts.map +1 -0
- package/dist/store/schema/{cleo-project → cleo-global}/telemetry.js +30 -18
- package/dist/store/schema/cleo-global/telemetry.js.map +1 -0
- package/dist/store/schema/cleo-project/audit.d.ts +8 -8
- package/dist/store/schema/cleo-project/audit.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/audit.js +2 -6
- package/dist/store/schema/cleo-project/audit.js.map +1 -1
- package/dist/store/schema/cleo-project/docs.d.ts +1 -1
- package/dist/store/schema/cleo-project/index.d.ts +29 -12
- package/dist/store/schema/cleo-project/index.d.ts.map +1 -1
- package/dist/store/schema/cleo-project/index.js +29 -12
- package/dist/store/schema/cleo-project/index.js.map +1 -1
- package/dist/store/schema/cleo-project/lifecycle.d.ts +2 -2
- package/dist/store/schema/cleo-project/nexus-graph.d.ts +1067 -0
- package/dist/store/schema/cleo-project/nexus-graph.d.ts.map +1 -0
- package/dist/store/schema/cleo-project/nexus-graph.js +407 -0
- package/dist/store/schema/cleo-project/nexus-graph.js.map +1 -0
- package/dist/store/schema/cleo-project/provenance-orphans.d.ts +385 -0
- package/dist/store/schema/cleo-project/provenance-orphans.d.ts.map +1 -0
- package/dist/store/schema/cleo-project/provenance-orphans.js +142 -0
- package/dist/store/schema/cleo-project/provenance-orphans.js.map +1 -0
- package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
- package/dist/store/schema/cleo-project/runtime.d.ts +1 -1
- package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts +1 -1
- package/dist/store/schema/cleo-project/tasks-core.d.ts +3 -3
- package/dist/store/schema/cleo-shared/brain.d.ts +711 -494
- package/dist/store/schema/cleo-shared/brain.d.ts.map +1 -1
- package/dist/store/schema/cleo-shared/brain.js +215 -134
- package/dist/store/schema/cleo-shared/brain.js.map +1 -1
- package/dist/store/schema/conduit-schema.d.ts +63 -51
- package/dist/store/schema/conduit-schema.d.ts.map +1 -1
- package/dist/store/schema/conduit-schema.js +23 -11
- package/dist/store/schema/conduit-schema.js.map +1 -1
- package/dist/store/schema/goal.d.ts +3 -2
- package/dist/store/schema/goal.d.ts.map +1 -1
- package/dist/store/schema/goal.js +3 -2
- package/dist/store/schema/goal.js.map +1 -1
- package/dist/store/schema/index.d.ts +1 -0
- package/dist/store/schema/index.d.ts.map +1 -1
- package/dist/store/schema/index.js +1 -0
- package/dist/store/schema/index.js.map +1 -1
- package/dist/store/schema/lifecycle.d.ts +2 -2
- package/dist/store/schema/memory-schema.d.ts +2 -2
- package/dist/store/schema/nexus-schema.d.ts +174 -115
- package/dist/store/schema/nexus-schema.d.ts.map +1 -1
- package/dist/store/schema/nexus-schema.js +175 -55
- package/dist/store/schema/nexus-schema.js.map +1 -1
- package/dist/store/schema/provenance/releases.d.ts +1 -1
- package/dist/store/schema/schema-utils.d.ts +78 -0
- package/dist/store/schema/schema-utils.d.ts.map +1 -0
- package/dist/store/schema/schema-utils.js +49 -0
- package/dist/store/schema/schema-utils.js.map +1 -0
- package/dist/store/schema/skills-schema.d.ts +81 -44
- package/dist/store/schema/skills-schema.d.ts.map +1 -1
- package/dist/store/schema/skills-schema.js +49 -16
- package/dist/store/schema/skills-schema.js.map +1 -1
- package/dist/store/schema/tasks.d.ts +3 -3
- package/dist/store/skills-db.d.ts +90 -50
- package/dist/store/skills-db.d.ts.map +1 -1
- package/dist/store/skills-db.js +132 -146
- package/dist/store/skills-db.js.map +1 -1
- package/dist/store/sqlite-backup.d.ts +2 -2
- package/dist/store/sqlite-backup.d.ts.map +1 -1
- package/dist/store/sqlite-backup.js +11 -10
- package/dist/store/sqlite-backup.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +25 -18
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/sqlite.d.ts +72 -12
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +153 -89
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/tasks-schema.d.ts +4 -0
- package/dist/store/tasks-schema.d.ts.map +1 -1
- package/dist/store/tasks-schema.js +60 -0
- package/dist/store/tasks-schema.js.map +1 -1
- package/dist/store/tasks-sqlite.d.ts +2 -2
- package/dist/store/tasks-sqlite.d.ts.map +1 -1
- package/dist/store/tasks-sqlite.js +10 -5
- package/dist/store/tasks-sqlite.js.map +1 -1
- package/dist/store/umbrella-data-accessor.d.ts +17 -6
- package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
- package/dist/store/umbrella-data-accessor.js +8 -8
- package/dist/store/umbrella-data-accessor.js.map +1 -1
- package/dist/store/validation-schemas.d.ts +241 -208
- package/dist/store/validation-schemas.d.ts.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +11 -6
- package/dist/system/health.js.map +1 -1
- package/dist/system/project-health.d.ts.map +1 -1
- package/dist/system/project-health.js +58 -12
- package/dist/system/project-health.js.map +1 -1
- package/dist/tasks/add.d.ts +8 -0
- package/dist/tasks/add.d.ts.map +1 -1
- package/dist/tasks/add.js +101 -0
- package/dist/tasks/add.js.map +1 -1
- package/dist/tasks/cancelled-child-waiver-audit.d.ts +47 -0
- package/dist/tasks/cancelled-child-waiver-audit.d.ts.map +1 -0
- package/dist/tasks/cancelled-child-waiver-audit.js +34 -0
- package/dist/tasks/cancelled-child-waiver-audit.js.map +1 -0
- package/dist/tasks/complete.d.ts +22 -2
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +71 -6
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/compute-task-view.js +1 -1
- package/dist/tasks/session-scope.d.ts +5 -0
- package/dist/tasks/session-scope.d.ts.map +1 -1
- package/dist/tasks/session-scope.js +4 -0
- package/dist/tasks/session-scope.js.map +1 -1
- package/dist/tools/guard.d.ts +71 -1
- package/dist/tools/guard.d.ts.map +1 -1
- package/dist/tools/guard.js +73 -1
- package/dist/tools/guard.js.map +1 -1
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +25 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +22 -13
- package/dist/upgrade.js.map +1 -1
- package/dist/workgraph/containment.js +18 -18
- package/dist/workgraph/relations.js +2 -2
- package/dist/worktree/list.d.ts +1 -1
- package/dist/worktree/list.d.ts.map +1 -1
- package/dist/worktree/list.js +19 -21
- package/dist/worktree/list.js.map +1 -1
- package/dist/worktree-export.d.ts +18 -0
- package/dist/worktree-export.d.ts.map +1 -0
- package/dist/worktree-export.js +18 -0
- package/dist/worktree-export.js.map +1 -0
- package/migrations/drizzle-agent-registry/20260412000000_initial-global-agent-registry/migration.sql +29 -0
- package/migrations/drizzle-brain/20260601000001_t11522-brain-task-observations/migration.sql +28 -0
- package/migrations/drizzle-brain/20260601000002_t11522-inline-only-brain-tables/migration.sql +75 -0
- package/migrations/drizzle-cleo-global/20260531000001_t11363-consolidation-cleo-global/migration.sql +49 -144
- package/migrations/drizzle-cleo-global/20260531000001_t11363-consolidation-cleo-global/snapshot.json +8 -8
- package/migrations/drizzle-cleo-global/20260531000002_t11546-brain-usage-log/migration.sql +16 -0
- package/migrations/drizzle-cleo-global/20260601000001_t11544-skills-usage-project-id/migration.sql +12 -0
- package/migrations/drizzle-cleo-global/20260602000001_t11622-agent-registry-rename/migration.sql +80 -0
- package/migrations/drizzle-cleo-project/20260531000001_t11363-consolidation-cleo-project/migration.sql +26 -167
- package/migrations/drizzle-cleo-project/20260531000001_t11363-consolidation-cleo-project/snapshot.json +8 -8
- package/migrations/drizzle-cleo-project/20260531000002_t11546-brain-usage-log/migration.sql +21 -0
- package/migrations/drizzle-cleo-project/20260601000001_t11549-agent-credentials-brain-release-links/migration.sql +49 -0
- package/migrations/drizzle-cleo-project/20260601000002_t11538-project-nexus-graph/migration.sql +140 -0
- package/migrations/drizzle-cleo-project/20260602000002_t11649-token-usage-transport-mcp/migration.sql +146 -0
- package/migrations/drizzle-conduit/20260601000003_t11523-conduit-inline-schema/migration.sql +82 -0
- package/migrations/drizzle-nexus/20260421200001_t1165-baseline-reset/migration.sql +26 -8
- package/migrations/drizzle-nexus/20260601000001_t11545-nexus-relation-weights-partition/migration.sql +97 -0
- package/package.json +43 -11
- package/scripts/install-supervisor-binary.mjs +50 -201
- package/scripts/napi-binary-picker.mjs +267 -0
- package/dist/agents/agent-registry.d.ts.map +0 -1
- package/dist/agents/agent-registry.js.map +0 -1
- package/dist/store/data-safety.d.ts +0 -92
- package/dist/store/data-safety.d.ts.map +0 -1
- package/dist/store/data-safety.js +0 -274
- package/dist/store/data-safety.js.map +0 -1
- package/dist/store/schema/cleo-global/signaldock.d.ts.map +0 -1
- package/dist/store/schema/cleo-global/signaldock.js.map +0 -1
- package/dist/store/schema/cleo-project/telemetry.d.ts.map +0 -1
- package/dist/store/schema/cleo-project/telemetry.js.map +0 -1
- package/dist/store/schema/signaldock-schema.d.ts.map +0 -1
- package/dist/store/schema/signaldock-schema.js.map +0 -1
- package/dist/store/signaldock-sqlite.d.ts +0 -173
- package/dist/store/signaldock-sqlite.d.ts.map +0 -1
- package/dist/store/signaldock-sqlite.js +0 -445
- package/dist/store/signaldock-sqlite.js.map +0 -1
- package/migrations/drizzle-nexus/20260318205558_initial/migration.sql +0 -46
- package/migrations/drizzle-nexus/20260412000001_t529-nexus-graph-tables/migration.sql +0 -49
- package/migrations/drizzle-nexus/20260415000001_t622-project-registry-paths/migration.sql +0 -12
- package/migrations/drizzle-nexus/20260419000001_t998-nexus-plasticity/migration.sql +0 -13
- package/migrations/drizzle-nexus/20260423052640_t1077-add-user-profile-table/migration.sql +0 -16
- package/migrations/drizzle-nexus/20260423052640_t1077-add-user-profile-table/snapshot.json +0 -1531
- package/migrations/drizzle-nexus/20260424140538_t1148-add-sigils-table/migration.sql +0 -13
- package/migrations/drizzle-nexus/20260424140538_t1148-add-sigils-table/snapshot.json +0 -1652
- package/migrations/drizzle-nexus/20260504000001_t1839-fts5-nexus-symbols/migration.sql +0 -68
- package/migrations/drizzle-nexus/20260507135519_t9163-nexus-is-external/migration.sql +0 -20
- package/migrations/drizzle-nexus/20260507135519_t9163-nexus-is-external/snapshot.json +0 -1652
- package/migrations/drizzle-nexus/20260526222449_t11025-project-id-aliases/migration.sql +0 -16
- package/migrations/drizzle-signaldock/20260412000000_initial-global-signaldock/migration.sql +0 -209
- package/migrations/drizzle-signaldock/20260412000000_initial-global-signaldock/snapshot.json +0 -2060
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite store for the GLOBAL-tier **Agent Registry** — the canonical agent
|
|
3
|
+
* identity database (agents / capabilities / skills / credentials). Formerly
|
|
4
|
+
* labelled "signaldock"; renamed under T11622 / SG-AGENT-IDENTITY E4.
|
|
5
|
+
*
|
|
6
|
+
* The Agent Registry holds cross-project agent identity, the capability/skill
|
|
7
|
+
* catalog, and cloud-sync tables. It has ZERO send/receive functions —
|
|
8
|
+
* agent-to-agent messaging is owned by the conduit domain (conduit-sqlite.ts,
|
|
9
|
+
* T344). The external `api.signaldock.io` URL is a Conduit transport CHANNEL, not
|
|
10
|
+
* this local registry, and intentionally keeps its legacy hostname.
|
|
11
|
+
*
|
|
12
|
+
* ## E6-L5 — thin-facade migration (T11525)
|
|
13
|
+
*
|
|
14
|
+
* `ensureGlobalAgentRegistryDb()` is a thin facade that delegates the database
|
|
15
|
+
* open to {@link openDualScopeDb}('global') — the canonical dual-scope chokepoint
|
|
16
|
+
* (E3/E4 · T11512/T11517) already adopted by the tasks domain (E6-L1, T11521),
|
|
17
|
+
* the brain domain (E6-L2, T11522), the conduit domain (E6-L3, T11523), and the
|
|
18
|
+
* nexus domain (E6-L4, T11524). The Agent Registry tables live inside the
|
|
19
|
+
* consolidated GLOBAL `cleo.db` under {@link getCleoHome}, sharing the SAME native
|
|
20
|
+
* handle the nexus / skills global domains use.
|
|
21
|
+
*
|
|
22
|
+
* ## COMPLETE-CUTOVER to prefixed `agent_registry_*` tables (T11622 · folds T11578 AC2)
|
|
23
|
+
*
|
|
24
|
+
* The Agent Registry runtime READ + WRITE path now targets the PREFIXED
|
|
25
|
+
* consolidated tables (`agent_registry_agents`, `agent_registry_capabilities`,
|
|
26
|
+
* `agent_registry_skills`, …) that the consolidated cleo-global migration creates
|
|
27
|
+
* (20260531000001 + the 20260602000001_t11622 `ALTER TABLE … RENAME` flip) — NOT
|
|
28
|
+
* the legacy BARE tables (`agents`, `capabilities`, …). The schema barrel imported
|
|
29
|
+
* below is therefore `schema/cleo-global/agent-registry.ts` (the prefixed target
|
|
30
|
+
* shape: TEXT ISO-8601 timestamps + CHECK constraints), replacing the legacy
|
|
31
|
+
* `schema/agent-registry-schema.ts` bare shape.
|
|
32
|
+
*
|
|
33
|
+
* The drizzle journal `runAgentRegistryMigrations` reconciles now only needs the
|
|
34
|
+
* two legacy `_agent_registry_meta` / `_agent_registry_migrations` health-probe
|
|
35
|
+
* tables that the consolidated migration omits (mirrors the conduit AC4 pattern).
|
|
36
|
+
* The 13 prefixed `agent_registry_*` tables are owned by the consolidated migration
|
|
37
|
+
* (single SSoT) — this domain no longer creates a disjoint bare runtime shape.
|
|
38
|
+
*
|
|
39
|
+
* Migration folder: packages/core/migrations/drizzle-agent-registry/
|
|
40
|
+
*
|
|
41
|
+
* GLOBAL-TIER ONLY. This module MUST NOT resolve paths under any project's .cleo/
|
|
42
|
+
* directory. The path guard in getGlobalAgentRegistryDbPath() enforces this.
|
|
43
|
+
*
|
|
44
|
+
* @task T346
|
|
45
|
+
* @task T1166
|
|
46
|
+
* @task T11525 - E6-L5: route ensureGlobalAgentRegistryDb through openDualScopeDb('global')
|
|
47
|
+
* @task T11622 - Signaldock → Agent Registry rename + runtime cutover to agent_registry_* (folds T11578 AC2)
|
|
48
|
+
* @epic T310
|
|
49
|
+
* @epic T1150
|
|
50
|
+
* @epic T11249
|
|
51
|
+
* @related ADR-037
|
|
52
|
+
*/
|
|
53
|
+
import { existsSync } from 'node:fs';
|
|
54
|
+
import { join } from 'node:path';
|
|
55
|
+
import { drizzle } from 'drizzle-orm/node-sqlite';
|
|
56
|
+
import { getCleoHome } from '../paths.js';
|
|
57
|
+
// E6-L5 (T11525): dual-scope chokepoint — the Agent Registry domain opens the
|
|
58
|
+
// consolidated GLOBAL `cleo.db` through here. openDualScopeDb manages the
|
|
59
|
+
// DatabaseSync lifecycle, pragmas, and the consolidated migrations (which create
|
|
60
|
+
// the prefixed `agent_registry_*` tables). T11622 routes the runtime read/write
|
|
61
|
+
// path onto those prefixed tables; this module only reconciles the legacy
|
|
62
|
+
// health-probe ledger via the drizzle-agent-registry forward migration.
|
|
63
|
+
import { _resetDualScopeDbCache, openDualScopeDb } from './dual-scope-db.js';
|
|
64
|
+
import { migrateSanitized, reconcileJournal } from './migration-manager.js';
|
|
65
|
+
import { resolveCorePackageMigrationsFolder } from './resolve-migrations-folder.js';
|
|
66
|
+
import * as agentRegistrySchema from './schema/cleo-global/agent-registry.js';
|
|
67
|
+
/**
|
|
68
|
+
* Database file name within the global cleo home directory.
|
|
69
|
+
*
|
|
70
|
+
* @task T346
|
|
71
|
+
* @epic T310
|
|
72
|
+
*/
|
|
73
|
+
export const GLOBAL_AGENT_REGISTRY_DB_FILENAME = 'signaldock.db';
|
|
74
|
+
/**
|
|
75
|
+
* Schema version for the global Agent Registry database.
|
|
76
|
+
*
|
|
77
|
+
* @task T346
|
|
78
|
+
* @epic T310
|
|
79
|
+
*/
|
|
80
|
+
export const GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION = '2026.4.12';
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated Use GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION. T310 is done (archived).
|
|
83
|
+
* Retained only because packages/core/src/internal.ts re-exports this name.
|
|
84
|
+
* Removal blocked until internal.ts export is cleaned up.
|
|
85
|
+
* Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0.
|
|
86
|
+
*/
|
|
87
|
+
export const AGENT_REGISTRY_SCHEMA_VERSION = GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION;
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Path helpers
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* Returns the GLOBAL-tier Agent Registry DB path — the consolidated GLOBAL
|
|
93
|
+
* `cleo.db`.
|
|
94
|
+
*
|
|
95
|
+
* E6-L5 (T11525): resolves `getCleoHome()` + `cleo.db` (the same path
|
|
96
|
+
* {@link openDualScopeDb}('global') opens). The Agent Registry holds canonical
|
|
97
|
+
* agent identity + cloud-sync tables and stays GLOBAL — its tables live inside the
|
|
98
|
+
* consolidated GLOBAL `cleo.db`, NOT a separate file. Project-local messaging state
|
|
99
|
+
* lives in conduit.db (T344).
|
|
100
|
+
*
|
|
101
|
+
* Guard: asserts the resolved path starts with getCleoHome() (defense in depth,
|
|
102
|
+
* mirrors the ADR-036/037 pattern used by getNexusDbPath in nexus-sqlite.ts).
|
|
103
|
+
*
|
|
104
|
+
* @task T346
|
|
105
|
+
* @task T11525
|
|
106
|
+
* @epic T310
|
|
107
|
+
* @epic T11249
|
|
108
|
+
* @throws {Error} If resolved path is not under getCleoHome() — indicates a code
|
|
109
|
+
* path that bypasses canonical path resolution. Fix the caller, do not suppress.
|
|
110
|
+
*/
|
|
111
|
+
export function getGlobalAgentRegistryDbPath() {
|
|
112
|
+
// Resolve via THIS module's getCleoHome binding so the path and the guard are
|
|
113
|
+
// self-consistent. (The dual-scope resolver builds the identical path —
|
|
114
|
+
// join(getCleoHome(), 'cleo.db') — but binds getCleoHome through its own module
|
|
115
|
+
// graph, which can diverge under per-test vi.doMock timing. Building locally and
|
|
116
|
+
// asserting against the SAME binding keeps the defense-in-depth guard correct
|
|
117
|
+
// without spuriously firing when a test mocks getCleoHome. T11525.)
|
|
118
|
+
const cleoHome = getCleoHome();
|
|
119
|
+
const dbPath = join(cleoHome, 'cleo.db');
|
|
120
|
+
if (!dbPath.startsWith(cleoHome)) {
|
|
121
|
+
/* c8 ignore next 7 — unreachable: dbPath is built FROM cleoHome above. */
|
|
122
|
+
throw new Error(`BUG: getGlobalAgentRegistryDbPath() resolved to "${dbPath}" which is NOT under ` +
|
|
123
|
+
`getCleoHome() ("${cleoHome}"). The Agent Registry is global-only per ADR-037. ` +
|
|
124
|
+
`This indicates a code path that bypasses path resolution — ` +
|
|
125
|
+
`fix the caller, do not suppress this error.`);
|
|
126
|
+
}
|
|
127
|
+
return dbPath;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated Use getGlobalAgentRegistryDbPath() directly. T310 is done (archived).
|
|
131
|
+
* Blocked from deletion: two callers still use this shim and require migration:
|
|
132
|
+
* - packages/core/src/store/cross-db-cleanup.ts (calls with cwd — will throw)
|
|
133
|
+
* - packages/core/src/internal.ts (re-exports this name)
|
|
134
|
+
* Fix: migrate cross-db-cleanup.ts to use getConduitDbPath() and remove from
|
|
135
|
+
* internal.ts. Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0.
|
|
136
|
+
*
|
|
137
|
+
* When called WITHOUT arguments: returns the global-tier path (forwards to
|
|
138
|
+
* getGlobalAgentRegistryDbPath()).
|
|
139
|
+
*
|
|
140
|
+
* When called WITH a non-undefined `cwd` argument: throws a migration error
|
|
141
|
+
* immediately. The project-tier path is now owned by conduit-sqlite.ts (T344).
|
|
142
|
+
*
|
|
143
|
+
* @param cwd - Must be undefined. Any other value throws a migration error.
|
|
144
|
+
* @task T346
|
|
145
|
+
* @epic T310
|
|
146
|
+
*/
|
|
147
|
+
export function getAgentRegistryDbPath(cwd) {
|
|
148
|
+
if (cwd !== undefined) {
|
|
149
|
+
throw new Error('getAgentRegistryDbPath(cwd) is removed as of T310 (v2026.4.12). ' +
|
|
150
|
+
'The global Agent Registry is now global-only at $XDG_DATA_HOME/cleo/cleo.db. ' +
|
|
151
|
+
'Use getGlobalAgentRegistryDbPath(), or for project-local messaging use ' +
|
|
152
|
+
'getConduitDbPath() from conduit-sqlite.ts (T344).');
|
|
153
|
+
}
|
|
154
|
+
return getGlobalAgentRegistryDbPath();
|
|
155
|
+
}
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
// Migration folder resolution
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
/**
|
|
160
|
+
* Resolve the absolute path to the drizzle-agent-registry migrations folder inside
|
|
161
|
+
* @cleocode/core, using ESM-native module resolution (T1177).
|
|
162
|
+
*
|
|
163
|
+
* Delegates to {@link resolveCorePackageMigrationsFolder} which handles
|
|
164
|
+
* bundled dist/, workspace dev, and global-install layouts uniformly via
|
|
165
|
+
* `import.meta.resolve()` + `createRequire().resolve()` fallback.
|
|
166
|
+
*
|
|
167
|
+
* @task T1166
|
|
168
|
+
* @epic T1150
|
|
169
|
+
*/
|
|
170
|
+
export function resolveAgentRegistryMigrationsFolder() {
|
|
171
|
+
return resolveCorePackageMigrationsFolder('drizzle-agent-registry');
|
|
172
|
+
}
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Migration runner
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
/**
|
|
177
|
+
* Reconcile + apply the drizzle-agent-registry migrations on the shared handle.
|
|
178
|
+
*
|
|
179
|
+
* Post-T11622 cutover the migration carries ONLY the legacy `_agent_registry_meta`
|
|
180
|
+
* / `_agent_registry_migrations` health-probe ledger tables — the 13 prefixed
|
|
181
|
+
* `agent_registry_*` runtime tables are owned by the consolidated cleo-global
|
|
182
|
+
* migration (single SSoT). The reconcile sentinel is `_agent_registry_meta` (a
|
|
183
|
+
* table THIS migration creates), so `reconcileJournal` Scenario 2 (orphan
|
|
184
|
+
* deletion) stays dormant on first open — pinning the sentinel to a
|
|
185
|
+
* migration-created table avoids corrupting the SHARED `__drizzle_migrations`
|
|
186
|
+
* journal (the conduit AC4 pattern, T11578).
|
|
187
|
+
*
|
|
188
|
+
* @param nativeDb - An open DatabaseSync handle at the global consolidated cleo.db
|
|
189
|
+
* @task T1166
|
|
190
|
+
* @task T11622
|
|
191
|
+
* @epic T1150
|
|
192
|
+
*/
|
|
193
|
+
function runAgentRegistryMigrations(nativeDb) {
|
|
194
|
+
const migrationsFolder = resolveAgentRegistryMigrationsFolder();
|
|
195
|
+
// Reconcile the Drizzle journal before running migrations. Sentinel =
|
|
196
|
+
// `_agent_registry_meta` (created by this domain's forward migration), so
|
|
197
|
+
// Scenario 2 orphan-deletion stays dormant on a fresh consolidated open.
|
|
198
|
+
reconcileJournal(nativeDb, migrationsFolder, '_agent_registry_meta', 'agent-registry');
|
|
199
|
+
// Create the drizzle ORM wrapper and run any pending migrations (the
|
|
200
|
+
// health-probe ledger tables). The schema is the prefixed consolidated shape.
|
|
201
|
+
const db = drizzle({ client: nativeDb, schema: agentRegistrySchema });
|
|
202
|
+
migrateSanitized(db, { migrationsFolder });
|
|
203
|
+
}
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Database lifecycle
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
/**
|
|
208
|
+
* Singleton native DatabaseSync handle for the current process.
|
|
209
|
+
*
|
|
210
|
+
* E6-L5 (T11525): this is the SHARED consolidated GLOBAL `cleo.db` handle owned
|
|
211
|
+
* by {@link openDualScopeDb}('global') and co-owned by the nexus / skills global
|
|
212
|
+
* domains. The Agent Registry domain MUST NOT close it directly (see
|
|
213
|
+
* {@link _resetGlobalAgentRegistryDb_TESTING_ONLY}).
|
|
214
|
+
*/
|
|
215
|
+
let _globalAgentRegistryNativeDb = null;
|
|
216
|
+
/**
|
|
217
|
+
* Read the `schema_version` row from `_agent_registry_meta` if it exists.
|
|
218
|
+
*
|
|
219
|
+
* Used by {@link ensureGlobalAgentRegistryDb} as a fast-path sentinel: when the
|
|
220
|
+
* value matches {@link GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION} we know the DB is
|
|
221
|
+
* fully bootstrapped + migrated to the in-process code version, so we can skip the
|
|
222
|
+
* {@link runAgentRegistryMigrations} pipeline on every CLI invocation (T9027 —
|
|
223
|
+
* epic T9026, CLI startup tax reduction).
|
|
224
|
+
*
|
|
225
|
+
* Defensive: returns `null` if the meta table is missing or the row is absent.
|
|
226
|
+
* Any throw is swallowed — a sentinel miss simply forces the fall-through
|
|
227
|
+
* migration replay path which is safe.
|
|
228
|
+
*
|
|
229
|
+
* @param db - An open global cleo.db handle.
|
|
230
|
+
* @returns The schema_version string, or `null` if absent / unreadable.
|
|
231
|
+
* @task T9027
|
|
232
|
+
* @epic T9026
|
|
233
|
+
*/
|
|
234
|
+
function readAgentRegistrySchemaVersionSentinel(db) {
|
|
235
|
+
try {
|
|
236
|
+
const row = db
|
|
237
|
+
.prepare("SELECT value FROM _agent_registry_meta WHERE key = 'schema_version'")
|
|
238
|
+
.get();
|
|
239
|
+
return row?.value ?? null;
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Write the in-process schema version into `_agent_registry_meta`.
|
|
247
|
+
*
|
|
248
|
+
* Creates the meta table if missing and stamps the current version so the next
|
|
249
|
+
* process can short-circuit via {@link readAgentRegistrySchemaVersionSentinel}.
|
|
250
|
+
*
|
|
251
|
+
* @param db - An open global cleo.db handle (post-migration).
|
|
252
|
+
* @task T9027
|
|
253
|
+
* @epic T9026
|
|
254
|
+
*/
|
|
255
|
+
function writeAgentRegistrySchemaVersionSentinel(db) {
|
|
256
|
+
try {
|
|
257
|
+
db.exec(`CREATE TABLE IF NOT EXISTS _agent_registry_meta (
|
|
258
|
+
key TEXT PRIMARY KEY,
|
|
259
|
+
value TEXT NOT NULL,
|
|
260
|
+
updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
|
|
261
|
+
);
|
|
262
|
+
INSERT OR REPLACE INTO _agent_registry_meta (key, value, updated_at)
|
|
263
|
+
VALUES ('schema_version', '${GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION}', strftime('%s', 'now'));`);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
// Non-fatal: if the meta write fails, ensure() still succeeds. Next
|
|
267
|
+
// invocation will simply take the fall-through path (sentinel miss).
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Ensure the global Agent Registry tables exist inside the consolidated GLOBAL
|
|
272
|
+
* `cleo.db`. Creates the global cleo home directory if it doesn't exist.
|
|
273
|
+
* Idempotent — safe to call multiple times.
|
|
274
|
+
*
|
|
275
|
+
* Post-T11622 cutover: the prefixed `agent_registry_*` runtime tables are created
|
|
276
|
+
* by the consolidated cleo-global migration that `openDualScopeDb('global')` runs.
|
|
277
|
+
* This function then reconciles the legacy health-probe ledger via the
|
|
278
|
+
* drizzle-agent-registry migration. It no longer creates the bare-named tables.
|
|
279
|
+
*
|
|
280
|
+
* @returns Object with action ('created' | 'exists') and the database path.
|
|
281
|
+
* @task T346
|
|
282
|
+
* @task T1166
|
|
283
|
+
* @task T11622
|
|
284
|
+
* @epic T310
|
|
285
|
+
*/
|
|
286
|
+
export async function ensureGlobalAgentRegistryDb() {
|
|
287
|
+
const dbPath = getGlobalAgentRegistryDbPath();
|
|
288
|
+
const alreadyExists = existsSync(dbPath);
|
|
289
|
+
// ── Dual-scope chokepoint delegation (T11525 · E6-L5 / T11622 cutover) ────
|
|
290
|
+
// openDualScopeDb('global') applies the pragma SSoT, creates the directory,
|
|
291
|
+
// and runs the consolidated cleo-global migrations (which create the prefixed
|
|
292
|
+
// `agent_registry_*` tables + apply the 20260602000001_t11622 rename). We
|
|
293
|
+
// extract its native handle so we can reconcile the legacy health-probe ledger.
|
|
294
|
+
const dualHandle = await openDualScopeDb('global');
|
|
295
|
+
// Extract the underlying DatabaseSync. Drizzle exposes it via `$client`.
|
|
296
|
+
const nativeDb = dualHandle.db.$client ?? null;
|
|
297
|
+
if (!nativeDb) {
|
|
298
|
+
throw new Error('E6-L5: openDualScopeDb returned a handle without $client — ' +
|
|
299
|
+
'cannot extract DatabaseSync for the Agent Registry ledger reconcile.');
|
|
300
|
+
}
|
|
301
|
+
// Sentinel: the prefixed `agent_registry_agents` table (created by the
|
|
302
|
+
// consolidated migration) — the table this domain's runtime now reads/writes.
|
|
303
|
+
const hasSchema = (() => {
|
|
304
|
+
try {
|
|
305
|
+
const result = nativeDb
|
|
306
|
+
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='agent_registry_agents'")
|
|
307
|
+
.get();
|
|
308
|
+
return !!result;
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
})();
|
|
314
|
+
// T9027 — Schema-version sentinel fast path (epic T9026, CLI startup tax).
|
|
315
|
+
// If the consolidated schema is applied AND `_agent_registry_meta.schema_version`
|
|
316
|
+
// equals the in-process constant, skip the reconcile/migrate pass.
|
|
317
|
+
if (hasSchema &&
|
|
318
|
+
readAgentRegistrySchemaVersionSentinel(nativeDb) === GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION) {
|
|
319
|
+
_globalAgentRegistryNativeDb = nativeDb;
|
|
320
|
+
return { action: 'exists', path: dbPath };
|
|
321
|
+
}
|
|
322
|
+
// Reconcile + apply the drizzle-agent-registry health-probe ledger migration.
|
|
323
|
+
runAgentRegistryMigrations(nativeDb);
|
|
324
|
+
// Stamp schema_version sentinel so the next process can take the fast path.
|
|
325
|
+
writeAgentRegistrySchemaVersionSentinel(nativeDb);
|
|
326
|
+
// Store native handle for backup integration (getGlobalAgentRegistryNativeDb).
|
|
327
|
+
_globalAgentRegistryNativeDb = nativeDb;
|
|
328
|
+
return {
|
|
329
|
+
action: alreadyExists && hasSchema ? 'exists' : 'created',
|
|
330
|
+
path: dbPath,
|
|
331
|
+
};
|
|
332
|
+
// NOTE: We intentionally do NOT close the native handle — it is the SHARED
|
|
333
|
+
// dual-scope GLOBAL `cleo.db` handle (E6-L5), co-owned by the nexus / skills
|
|
334
|
+
// global domains. Its lifecycle is owned by `openDualScopeDb`.
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* @deprecated Use ensureGlobalAgentRegistryDb(). T310 is done (archived).
|
|
338
|
+
* Blocked from deletion: caller still uses this shim and requires migration:
|
|
339
|
+
* - packages/core/src/upgrade.ts calls ensureAgentRegistryDb(projectRootForMaint)
|
|
340
|
+
* (with cwd arg — will throw at runtime). Must migrate to ensureConduitDb(cwd).
|
|
341
|
+
* - packages/core/src/internal.ts re-exports this name.
|
|
342
|
+
* Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0.
|
|
343
|
+
*
|
|
344
|
+
* When called WITHOUT arguments: forwards to ensureGlobalAgentRegistryDb().
|
|
345
|
+
* When called WITH a non-undefined `cwd` argument: throws a migration error.
|
|
346
|
+
*
|
|
347
|
+
* @param cwd - Must be undefined. Any other value throws a migration error.
|
|
348
|
+
* @task T346
|
|
349
|
+
* @epic T310
|
|
350
|
+
*/
|
|
351
|
+
export async function ensureAgentRegistryDb(cwd) {
|
|
352
|
+
if (cwd !== undefined) {
|
|
353
|
+
throw new Error('ensureAgentRegistryDb(cwd) is removed as of T310 (v2026.4.12). ' +
|
|
354
|
+
'The global Agent Registry is now global-only. ' +
|
|
355
|
+
'Use ensureGlobalAgentRegistryDb() for global identity, or ' +
|
|
356
|
+
'ensureConduitDb(cwd) from conduit-sqlite.ts for project messaging (T344).');
|
|
357
|
+
}
|
|
358
|
+
return ensureGlobalAgentRegistryDb();
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Check global Agent Registry health: table count, WAL mode, schema version.
|
|
362
|
+
* Used by `cleo doctor` to verify global Agent Registry integrity.
|
|
363
|
+
*
|
|
364
|
+
* E6-L5 (T11525): reads against the SHARED consolidated GLOBAL `cleo.db` handle
|
|
365
|
+
* (via {@link ensureGlobalAgentRegistryDb}, which routes through
|
|
366
|
+
* {@link openDualScopeDb}('global')). The metrics describe the consolidated
|
|
367
|
+
* `cleo.db` that hosts the prefixed `agent_registry_*` tables.
|
|
368
|
+
*
|
|
369
|
+
* @returns Health report object, or object with exists=false if the DB does not exist.
|
|
370
|
+
* @task T346
|
|
371
|
+
* @task T11525
|
|
372
|
+
* @epic T310
|
|
373
|
+
* @epic T11249
|
|
374
|
+
*/
|
|
375
|
+
export async function checkGlobalAgentRegistryDbHealth() {
|
|
376
|
+
const dbPath = getGlobalAgentRegistryDbPath();
|
|
377
|
+
if (!existsSync(dbPath)) {
|
|
378
|
+
return {
|
|
379
|
+
exists: false,
|
|
380
|
+
path: dbPath,
|
|
381
|
+
tableCount: 0,
|
|
382
|
+
walMode: false,
|
|
383
|
+
schemaVersion: null,
|
|
384
|
+
foreignKeysEnabled: false,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
// Route through the dual-scope chokepoint to obtain the shared, fully-migrated
|
|
388
|
+
// consolidated `cleo.db` handle. ensureGlobalAgentRegistryDb() is idempotent and
|
|
389
|
+
// stores the handle in _globalAgentRegistryNativeDb.
|
|
390
|
+
await ensureGlobalAgentRegistryDb();
|
|
391
|
+
const nativeDb = _globalAgentRegistryNativeDb;
|
|
392
|
+
if (!nativeDb) {
|
|
393
|
+
/* c8 ignore next */
|
|
394
|
+
return {
|
|
395
|
+
exists: false,
|
|
396
|
+
path: dbPath,
|
|
397
|
+
tableCount: 0,
|
|
398
|
+
walMode: false,
|
|
399
|
+
schemaVersion: null,
|
|
400
|
+
foreignKeysEnabled: false,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
const tables = nativeDb
|
|
404
|
+
.prepare("SELECT COUNT(*) as count FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")
|
|
405
|
+
.get();
|
|
406
|
+
const journalMode = nativeDb.prepare('PRAGMA journal_mode').get();
|
|
407
|
+
const fkEnabled = nativeDb.prepare('PRAGMA foreign_keys').get();
|
|
408
|
+
// Schema version: check the __drizzle_migrations journal for evidence of
|
|
409
|
+
// migrations applied. Fallback to _agent_registry_meta for pre-T1166 DBs.
|
|
410
|
+
let schemaVersion = null;
|
|
411
|
+
try {
|
|
412
|
+
const journalRow = nativeDb
|
|
413
|
+
.prepare('SELECT COUNT(*) as cnt FROM "__drizzle_migrations"')
|
|
414
|
+
.get();
|
|
415
|
+
if (journalRow && journalRow.cnt > 0) {
|
|
416
|
+
schemaVersion = GLOBAL_AGENT_REGISTRY_SCHEMA_VERSION;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
// __drizzle_migrations does not exist yet — fall through to _agent_registry_meta
|
|
421
|
+
}
|
|
422
|
+
if (!schemaVersion) {
|
|
423
|
+
try {
|
|
424
|
+
const meta = nativeDb
|
|
425
|
+
.prepare("SELECT value FROM _agent_registry_meta WHERE key = 'schema_version'")
|
|
426
|
+
.get();
|
|
427
|
+
schemaVersion = meta?.value ?? null;
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
// _agent_registry_meta may not exist on very old or partially-initialized DBs
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return {
|
|
434
|
+
exists: true,
|
|
435
|
+
path: dbPath,
|
|
436
|
+
tableCount: tables.count,
|
|
437
|
+
walMode: journalMode.journal_mode === 'wal',
|
|
438
|
+
schemaVersion,
|
|
439
|
+
foreignKeysEnabled: fkEnabled.foreign_keys === 1,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* @deprecated Use checkGlobalAgentRegistryDbHealth(). T310 is done (archived).
|
|
444
|
+
* Retained only because packages/core/src/internal.ts re-exports this name.
|
|
445
|
+
* Removal blocked until internal.ts export is cleaned up.
|
|
446
|
+
* Tracking: T355 / T1508 P2-NEW-2 — remove in v2026.5.0.
|
|
447
|
+
*
|
|
448
|
+
* When called WITHOUT arguments: forwards to checkGlobalAgentRegistryDbHealth().
|
|
449
|
+
* When called WITH a non-undefined `cwd` argument: throws a migration error.
|
|
450
|
+
*
|
|
451
|
+
* @param cwd - Must be undefined. Any other value throws a migration error.
|
|
452
|
+
* @task T346
|
|
453
|
+
* @epic T310
|
|
454
|
+
*/
|
|
455
|
+
export async function checkAgentRegistryDbHealth(cwd) {
|
|
456
|
+
if (cwd !== undefined) {
|
|
457
|
+
throw new Error('checkAgentRegistryDbHealth(cwd) is removed as of T310 (v2026.4.12). ' +
|
|
458
|
+
'The global Agent Registry is now global-only. ' +
|
|
459
|
+
'Use checkGlobalAgentRegistryDbHealth() for global health, or ' +
|
|
460
|
+
'checkConduitDbHealth(cwd) from conduit-sqlite.ts for project conduit health (T344).');
|
|
461
|
+
}
|
|
462
|
+
return checkGlobalAgentRegistryDbHealth();
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Get the underlying node:sqlite DatabaseSync instance for the global Agent
|
|
466
|
+
* Registry (consolidated `cleo.db`). Returns the handle stored by the most recent
|
|
467
|
+
* ensureGlobalAgentRegistryDb() call, or null if not yet initialized in this
|
|
468
|
+
* process.
|
|
469
|
+
*
|
|
470
|
+
* Used by sqlite-backup.ts to activate the GLOBAL_SNAPSHOT_TARGET (spec §6.2, T310).
|
|
471
|
+
*
|
|
472
|
+
* @task T346
|
|
473
|
+
* @epic T310
|
|
474
|
+
*/
|
|
475
|
+
export function getGlobalAgentRegistryNativeDb() {
|
|
476
|
+
return _globalAgentRegistryNativeDb;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Reset the in-process global Agent Registry singleton.
|
|
480
|
+
* ONLY for use in test isolation — never call in production code.
|
|
481
|
+
*
|
|
482
|
+
* ## E6-L5 (T11525) — shared-handle close rule
|
|
483
|
+
*
|
|
484
|
+
* `_globalAgentRegistryNativeDb` is the SHARED consolidated GLOBAL `cleo.db` handle
|
|
485
|
+
* owned by {@link openDualScopeDb}('global') and co-owned by the nexus / skills
|
|
486
|
+
* global domains. This reset MUST NOT call `.close()` on it directly — doing so
|
|
487
|
+
* would tear the handle out from under nexus / skills (the exact bug class L4 fixed
|
|
488
|
+
* at `dual-scope-db.ts`). Instead it evicts the GLOBAL-scope entry from the
|
|
489
|
+
* dual-scope cache and drops the local reference. The next
|
|
490
|
+
* `ensureGlobalAgentRegistryDb()` re-opens a fresh consolidated handle.
|
|
491
|
+
*
|
|
492
|
+
* @task T346
|
|
493
|
+
* @task T11525
|
|
494
|
+
* @epic T310
|
|
495
|
+
* @epic T11249
|
|
496
|
+
*/
|
|
497
|
+
export function _resetGlobalAgentRegistryDb_TESTING_ONLY() {
|
|
498
|
+
_globalAgentRegistryNativeDb = null;
|
|
499
|
+
_resetDualScopeDbCache('global');
|
|
500
|
+
}
|
|
501
|
+
//# sourceMappingURL=agent-registry-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registry-store.js","sourceRoot":"","sources":["../../src/store/agent-registry-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,8EAA8E;AAC9E,0EAA0E;AAC1E,iFAAi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AC;QACtB,MAAM,IAAI,KAAK,CACb,sEAAsE;YACpE,gDAAgD;YAChD,+DAA+D;YAC/D,qFAAqF,CACxF,CAAC;IACJ,CAAC;IACD,OAAO,gCAAgC,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO,4BAA4B,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wCAAwC;IACtD,4BAA4B,GAAG,IAAI,CAAC;IACpC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Registry-backed agent resolver with 5-tier precedence.
|
|
3
3
|
*
|
|
4
4
|
* Lookup order (highest wins):
|
|
5
|
-
* 1. `project` — rows in global `
|
|
5
|
+
* 1. `project` — rows in global `agent_registry_agents` tagged
|
|
6
6
|
* `tier='project'` (attached from
|
|
7
7
|
* `<projectRoot>/.cleo/cant/agents/`).
|
|
8
8
|
* 2. `global` — rows tagged `tier='global'` installed from
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
* Wired into the spawn validator pre-flight by T1933
|
|
25
25
|
* (ADR-068 Decision 6 — supersedes ADR-055 D035).
|
|
26
26
|
*
|
|
27
|
-
* The GLOBAL `
|
|
28
|
-
* tier-aware metadata. The `
|
|
29
|
-
* whole table (see `
|
|
27
|
+
* The GLOBAL `agent_registry_agents` row is the single source of truth for
|
|
28
|
+
* tier-aware metadata. The `agent_registry_agents.agent_id` column is UNIQUE across the
|
|
29
|
+
* whole table (see `agent-registry-store.ts` schema), so a single row exists
|
|
30
30
|
* per agent — `tier` records which directory holds the canonical `.cant`.
|
|
31
31
|
*
|
|
32
32
|
* Orphan-row detection (doctor D-002): if the row's `cant_path` points at
|
|
@@ -101,7 +101,7 @@ export interface ResolveAgentOptions {
|
|
|
101
101
|
* Absolute path to the project root. Present in the envelope for callers
|
|
102
102
|
* that want to display where the resolved project-tier `.cant` lives, but
|
|
103
103
|
* the resolver does NOT perform its own filesystem walk inside the project
|
|
104
|
-
* — the global
|
|
104
|
+
* — the global cleo.db (Agent Registry) is consulted regardless of tier.
|
|
105
105
|
*/
|
|
106
106
|
projectRoot?: string;
|
|
107
107
|
/**
|
|
@@ -150,7 +150,7 @@ export interface ResolveAgentOptions {
|
|
|
150
150
|
* {@link AgentNotFoundError} — the error becomes genuinely exceptional
|
|
151
151
|
* (catastrophic missing base file) rather than a routine resolution miss.
|
|
152
152
|
*
|
|
153
|
-
* @param db - Open handle to global
|
|
153
|
+
* @param db - Open handle to global cleo.db (Agent Registry). Caller owns lifecycle.
|
|
154
154
|
* @param agentId - Business identifier of the agent to resolve.
|
|
155
155
|
* @param options - Optional lookup overrides (see {@link ResolveAgentOptions}).
|
|
156
156
|
* @returns The highest-precedence {@link ResolvedAgent} envelope.
|
|
@@ -168,7 +168,7 @@ export declare function resolveAgent(db: DatabaseSync, agentId: string, options?
|
|
|
168
168
|
* Any unexpected error from {@link resolveAgent} propagates. Only the
|
|
169
169
|
* structured "not found" envelope is collected as a per-id value.
|
|
170
170
|
*
|
|
171
|
-
* @param db - Open handle to global
|
|
171
|
+
* @param db - Open handle to global cleo.db (Agent Registry).
|
|
172
172
|
* @param agentIds - Business ids to resolve.
|
|
173
173
|
* @param options - Shared lookup options applied to every id.
|
|
174
174
|
* @returns Map keyed by agentId with the envelope or the not-found error.
|
|
@@ -186,7 +186,7 @@ export declare function resolveAgentsBatch(db: DatabaseSync, agentIds: string[],
|
|
|
186
186
|
* Lookup: `agents.agent_id = ?` → `agents.id` → junction `agent_skills` →
|
|
187
187
|
* `skills.slug`. Ordered by `attached_at DESC` (most-recent attachment first).
|
|
188
188
|
*
|
|
189
|
-
* @param db - Open handle to global
|
|
189
|
+
* @param db - Open handle to global cleo.db (Agent Registry).
|
|
190
190
|
* @param agentId - Business id of the agent whose skills to read.
|
|
191
191
|
* @returns Skill slugs, deduplicated. Returns `[]` when none attached.
|
|
192
192
|
* @task T889 / W2-4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-resolver.d.ts","sourceRoot":"","sources":["../../src/store/agent-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,KAAK,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpE,KAAK,YAAY,GAAG,iBAAiB,CAAC;AAWtC;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAMvD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAqB,CAAC;AAMtF;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAIzC,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE;IAJlC,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,QAAQ,MAAM;gBAEZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,SAAS,EAAE;CAQnC;AAMD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"agent-resolver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