@cleocode/core 2026.5.134 → 2026.6.1

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.
Files changed (557) hide show
  1. package/binaries/README.md +49 -27
  2. package/dist/agents/{agent-registry.d.ts → agent-capacity-tracker.d.ts} +2 -2
  3. package/dist/agents/agent-capacity-tracker.d.ts.map +1 -0
  4. package/dist/agents/{agent-registry.js → agent-capacity-tracker.js} +2 -2
  5. package/dist/agents/agent-capacity-tracker.js.map +1 -0
  6. package/dist/agents/index.d.ts +1 -1
  7. package/dist/agents/index.d.ts.map +1 -1
  8. package/dist/agents/index.js +4 -2
  9. package/dist/agents/index.js.map +1 -1
  10. package/dist/agents/seed-install.d.ts +1 -1
  11. package/dist/agents/seed-install.d.ts.map +1 -1
  12. package/dist/agents/seed-install.js +42 -36
  13. package/dist/agents/seed-install.js.map +1 -1
  14. package/dist/caamp-export.d.ts +18 -0
  15. package/dist/caamp-export.d.ts.map +1 -0
  16. package/dist/caamp-export.js +18 -0
  17. package/dist/caamp-export.js.map +1 -0
  18. package/dist/conduit/http-transport.d.ts +7 -13
  19. package/dist/conduit/http-transport.d.ts.map +1 -1
  20. package/dist/conduit/http-transport.js +12 -59
  21. package/dist/conduit/http-transport.js.map +1 -1
  22. package/dist/conduit/local-transport.d.ts +1 -1
  23. package/dist/conduit/local-transport.d.ts.map +1 -1
  24. package/dist/conduit/local-transport.js +69 -43
  25. package/dist/conduit/local-transport.js.map +1 -1
  26. package/dist/dispatch/mutate-projection.d.ts.map +1 -1
  27. package/dist/dispatch/mutate-projection.js +11 -0
  28. package/dist/dispatch/mutate-projection.js.map +1 -1
  29. package/dist/docs/docs-read-model.d.ts +7 -0
  30. package/dist/docs/docs-read-model.d.ts.map +1 -1
  31. package/dist/docs/docs-read-model.js +5 -0
  32. package/dist/docs/docs-read-model.js.map +1 -1
  33. package/dist/docs/export-document.js +40526 -281
  34. package/dist/docs/export-document.js.map +6 -1
  35. package/dist/docs/supersede.d.ts.map +1 -1
  36. package/dist/docs/supersede.js +12 -7
  37. package/dist/docs/supersede.js.map +1 -1
  38. package/dist/doctor/db-substrate.d.ts.map +1 -1
  39. package/dist/doctor/db-substrate.js +10 -9
  40. package/dist/doctor/db-substrate.js.map +1 -1
  41. package/dist/git-shim-export.d.ts +18 -0
  42. package/dist/git-shim-export.d.ts.map +1 -0
  43. package/dist/git-shim-export.js +18 -0
  44. package/dist/git-shim-export.js.map +1 -0
  45. package/dist/hooks/payload-schemas.d.ts +2 -2
  46. package/dist/init.d.ts.map +1 -1
  47. package/dist/init.js +39 -32
  48. package/dist/init.js.map +1 -1
  49. package/dist/internal.d.ts +11 -3
  50. package/dist/internal.d.ts.map +1 -1
  51. package/dist/internal.js +14 -5
  52. package/dist/internal.js.map +1 -1
  53. package/dist/lafs-export.d.ts +18 -0
  54. package/dist/lafs-export.d.ts.map +1 -0
  55. package/dist/lafs-export.js +18 -0
  56. package/dist/lafs-export.js.map +1 -0
  57. package/dist/lifecycle/effective-stage.js +1 -1
  58. package/dist/lifecycle/index.js +1 -1
  59. package/dist/lifecycle/index.js.map +1 -1
  60. package/dist/lifecycle/rollup.js +1 -1
  61. package/dist/llm/credential-pool.d.ts +17 -0
  62. package/dist/llm/credential-pool.d.ts.map +1 -1
  63. package/dist/llm/credential-pool.js +40 -1
  64. package/dist/llm/credential-pool.js.map +1 -1
  65. package/dist/llm/plugin-facade.d.ts.map +1 -1
  66. package/dist/llm/plugin-facade.js +43392 -354
  67. package/dist/llm/plugin-facade.js.map +6 -1
  68. package/dist/llm/role-executor.d.ts +8 -0
  69. package/dist/llm/role-executor.d.ts.map +1 -1
  70. package/dist/llm/role-executor.js +96 -4
  71. package/dist/llm/role-executor.js.map +1 -1
  72. package/dist/llm/role-resolver.d.ts.map +1 -1
  73. package/dist/llm/role-resolver.js +56 -1
  74. package/dist/llm/role-resolver.js.map +1 -1
  75. package/dist/llm/transports/codex-oauth-headers.d.ts +51 -0
  76. package/dist/llm/transports/codex-oauth-headers.d.ts.map +1 -0
  77. package/dist/llm/transports/codex-oauth-headers.js +89 -0
  78. package/dist/llm/transports/codex-oauth-headers.js.map +1 -0
  79. package/dist/memory/claude-mem-migration.d.ts.map +1 -1
  80. package/dist/memory/claude-mem-migration.js +1 -3
  81. package/dist/memory/claude-mem-migration.js.map +1 -1
  82. package/dist/memory/decisions.d.ts.map +1 -1
  83. package/dist/memory/decisions.js +77 -23
  84. package/dist/memory/decisions.js.map +1 -1
  85. package/dist/memory/graph-memory-bridge.d.ts.map +1 -1
  86. package/dist/memory/graph-memory-bridge.js +12 -6
  87. package/dist/memory/graph-memory-bridge.js.map +1 -1
  88. package/dist/memory/learnings.d.ts +2 -2
  89. package/dist/memory/nexus-plasticity.d.ts +21 -9
  90. package/dist/memory/nexus-plasticity.d.ts.map +1 -1
  91. package/dist/memory/nexus-plasticity.js +44 -22
  92. package/dist/memory/nexus-plasticity.js.map +1 -1
  93. package/dist/memory/patterns.d.ts +2 -2
  94. package/dist/memory/redaction.d.ts +19 -3
  95. package/dist/memory/redaction.d.ts.map +1 -1
  96. package/dist/memory/redaction.js +64 -129
  97. package/dist/memory/redaction.js.map +6 -1
  98. package/dist/metrics/token-service.d.ts +8 -2
  99. package/dist/metrics/token-service.d.ts.map +1 -1
  100. package/dist/metrics/token-service.js +1 -1
  101. package/dist/metrics/token-service.js.map +1 -1
  102. package/dist/nexus/analyze-orchestrator.d.ts.map +1 -1
  103. package/dist/nexus/analyze-orchestrator.js +6 -8
  104. package/dist/nexus/analyze-orchestrator.js.map +1 -1
  105. package/dist/nexus/api-extractors/http-extractor.d.ts.map +1 -1
  106. package/dist/nexus/api-extractors/http-extractor.js +3 -3
  107. package/dist/nexus/api-extractors/http-extractor.js.map +1 -1
  108. package/dist/nexus/clusters.d.ts.map +1 -1
  109. package/dist/nexus/clusters.js +3 -2
  110. package/dist/nexus/clusters.js.map +1 -1
  111. package/dist/nexus/context.d.ts.map +1 -1
  112. package/dist/nexus/context.js +10 -16
  113. package/dist/nexus/context.js.map +1 -1
  114. package/dist/nexus/diff.d.ts.map +1 -1
  115. package/dist/nexus/diff.js +6 -4
  116. package/dist/nexus/diff.js.map +1 -1
  117. package/dist/nexus/export.d.ts.map +1 -1
  118. package/dist/nexus/export.js +7 -4
  119. package/dist/nexus/export.js.map +1 -1
  120. package/dist/nexus/flows.d.ts.map +1 -1
  121. package/dist/nexus/flows.js +3 -1
  122. package/dist/nexus/flows.js.map +1 -1
  123. package/dist/nexus/impact.d.ts +1 -1
  124. package/dist/nexus/impact.d.ts.map +1 -1
  125. package/dist/nexus/impact.js +31 -17
  126. package/dist/nexus/impact.js.map +1 -1
  127. package/dist/nexus/living-brain.d.ts.map +1 -1
  128. package/dist/nexus/living-brain.js +27 -15
  129. package/dist/nexus/living-brain.js.map +1 -1
  130. package/dist/nexus/nexus-bridge.d.ts.map +1 -1
  131. package/dist/nexus/nexus-bridge.js +28 -29
  132. package/dist/nexus/nexus-bridge.js.map +1 -1
  133. package/dist/nexus/plasticity-queries.d.ts +4 -2
  134. package/dist/nexus/plasticity-queries.d.ts.map +1 -1
  135. package/dist/nexus/plasticity-queries.js +27 -15
  136. package/dist/nexus/plasticity-queries.js.map +1 -1
  137. package/dist/nexus/query.d.ts.map +1 -1
  138. package/dist/nexus/query.js +6 -2
  139. package/dist/nexus/query.js.map +1 -1
  140. package/dist/nexus/registry.d.ts.map +1 -1
  141. package/dist/nexus/registry.js +65 -30
  142. package/dist/nexus/registry.js.map +1 -1
  143. package/dist/nexus/route-analysis.d.ts +3 -2
  144. package/dist/nexus/route-analysis.d.ts.map +1 -1
  145. package/dist/nexus/route-analysis.js +11 -10
  146. package/dist/nexus/route-analysis.js.map +1 -1
  147. package/dist/nexus/sigil.d.ts.map +1 -1
  148. package/dist/nexus/sigil.js +60 -13
  149. package/dist/nexus/sigil.js.map +1 -1
  150. package/dist/nexus/user-profile.d.ts +2 -1
  151. package/dist/nexus/user-profile.d.ts.map +1 -1
  152. package/dist/nexus/user-profile.js +8 -4
  153. package/dist/nexus/user-profile.js.map +1 -1
  154. package/dist/orchestrate/index.d.ts +1 -1
  155. package/dist/orchestrate/index.d.ts.map +1 -1
  156. package/dist/orchestrate/index.js +1 -1
  157. package/dist/orchestrate/index.js.map +1 -1
  158. package/dist/orchestrate/plan.d.ts +3 -3
  159. package/dist/orchestrate/plan.d.ts.map +1 -1
  160. package/dist/orchestrate/plan.js +7 -7
  161. package/dist/orchestrate/plan.js.map +1 -1
  162. package/dist/orchestrate/spawn-ops.js +2 -2
  163. package/dist/orchestrate/spawn-ops.js.map +1 -1
  164. package/dist/orchestration/classify.d.ts +2 -2
  165. package/dist/orchestration/classify.js +3 -3
  166. package/dist/orchestration/classify.js.map +1 -1
  167. package/dist/orchestration/validate-spawn.d.ts.map +1 -1
  168. package/dist/orchestration/validate-spawn.js +5 -5
  169. package/dist/orchestration/validate-spawn.js.map +1 -1
  170. package/dist/paths-export.d.ts +18 -0
  171. package/dist/paths-export.d.ts.map +1 -0
  172. package/dist/paths-export.js +18 -0
  173. package/dist/paths-export.js.map +1 -0
  174. package/dist/paths.d.ts.map +1 -1
  175. package/dist/paths.js +24 -11
  176. package/dist/paths.js.map +1 -1
  177. package/dist/playbooks/index.d.ts +1 -0
  178. package/dist/playbooks/index.d.ts.map +1 -1
  179. package/dist/playbooks/index.js +4 -0
  180. package/dist/playbooks/index.js.map +1 -1
  181. package/dist/playbooks/skill-node-executor.d.ts +155 -0
  182. package/dist/playbooks/skill-node-executor.d.ts.map +1 -0
  183. package/dist/playbooks/skill-node-executor.js +156 -0
  184. package/dist/playbooks/skill-node-executor.js.map +1 -0
  185. package/dist/repair.d.ts +3 -7
  186. package/dist/repair.d.ts.map +1 -1
  187. package/dist/repair.js +5 -43
  188. package/dist/repair.js.map +1 -1
  189. package/dist/sagas/migrate-containment.js +7 -7
  190. package/dist/sagas/migrate-containment.js.map +1 -1
  191. package/dist/scaffold/ensure-dirs.d.ts +8 -2
  192. package/dist/scaffold/ensure-dirs.d.ts.map +1 -1
  193. package/dist/scaffold/ensure-dirs.js +24 -11
  194. package/dist/scaffold/ensure-dirs.js.map +1 -1
  195. package/dist/scaffold/project-detection.d.ts +5 -1
  196. package/dist/scaffold/project-detection.d.ts.map +1 -1
  197. package/dist/scaffold/project-detection.js +9 -5
  198. package/dist/scaffold/project-detection.js.map +1 -1
  199. package/dist/sentient/hygiene-scan.js +6 -6
  200. package/dist/sentient/hygiene-scan.js.map +1 -1
  201. package/dist/sentient/proposal-dedup.js +2 -2
  202. package/dist/sentient/proposal-rate-limiter.js +1 -1
  203. package/dist/sentient/propose-tick.js +5 -5
  204. package/dist/sentient/propose-tick.js.map +1 -1
  205. package/dist/sentient/stage-drift-tick.js +3 -3
  206. package/dist/sentient/stage-drift-tick.js.map +1 -1
  207. package/dist/sequence/index.d.ts.map +1 -1
  208. package/dist/sequence/index.js +6 -2
  209. package/dist/sequence/index.js.map +1 -1
  210. package/dist/sessions/briefing.d.ts.map +1 -1
  211. package/dist/sessions/briefing.js +18 -4
  212. package/dist/sessions/briefing.js.map +1 -1
  213. package/dist/setup/sections/verification.js +2 -2
  214. package/dist/setup/sections/verification.js.map +1 -1
  215. package/dist/shutdown.d.ts +91 -0
  216. package/dist/shutdown.d.ts.map +1 -0
  217. package/dist/shutdown.js +120 -0
  218. package/dist/shutdown.js.map +1 -0
  219. package/dist/skills/index.d.ts +2 -0
  220. package/dist/skills/index.d.ts.map +1 -1
  221. package/dist/skills/index.js +1 -0
  222. package/dist/skills/index.js.map +1 -1
  223. package/dist/skills/skill-executor-adapter.d.ts +136 -0
  224. package/dist/skills/skill-executor-adapter.d.ts.map +1 -0
  225. package/dist/skills/skill-executor-adapter.js +137 -0
  226. package/dist/skills/skill-executor-adapter.js.map +1 -0
  227. package/dist/skills/usage-recorder.d.ts.map +1 -1
  228. package/dist/skills/usage-recorder.js +30 -0
  229. package/dist/skills/usage-recorder.js.map +1 -1
  230. package/dist/skills-export.d.ts +23 -0
  231. package/dist/skills-export.d.ts.map +1 -0
  232. package/dist/skills-export.js +23 -0
  233. package/dist/skills-export.js.map +1 -0
  234. package/dist/stats/index.d.ts.map +1 -1
  235. package/dist/stats/index.js +8 -3
  236. package/dist/stats/index.js.map +1 -1
  237. package/dist/store/agent-doctor.d.ts +3 -3
  238. package/dist/store/agent-doctor.d.ts.map +1 -1
  239. package/dist/store/agent-doctor.js +18 -13
  240. package/dist/store/agent-doctor.js.map +1 -1
  241. package/dist/store/agent-install.d.ts +6 -5
  242. package/dist/store/agent-install.d.ts.map +1 -1
  243. package/dist/store/agent-install.js +20 -16
  244. package/dist/store/agent-install.js.map +1 -1
  245. package/dist/store/agent-registry-accessor.d.ts +66 -28
  246. package/dist/store/agent-registry-accessor.d.ts.map +1 -1
  247. package/dist/store/agent-registry-accessor.js +248 -167
  248. package/dist/store/agent-registry-accessor.js.map +1 -1
  249. package/dist/store/agent-registry-store.d.ts +242 -0
  250. package/dist/store/agent-registry-store.d.ts.map +1 -0
  251. package/dist/store/agent-registry-store.js +501 -0
  252. package/dist/store/agent-registry-store.js.map +1 -0
  253. package/dist/store/agent-resolver.d.ts +8 -8
  254. package/dist/store/agent-resolver.d.ts.map +1 -1
  255. package/dist/store/agent-resolver.js +19 -17
  256. package/dist/store/agent-resolver.js.map +1 -1
  257. package/dist/store/backup-pack.d.ts.map +1 -1
  258. package/dist/store/backup-pack.js +24 -8
  259. package/dist/store/backup-pack.js.map +1 -1
  260. package/dist/store/conduit-sqlite.d.ts +181 -74
  261. package/dist/store/conduit-sqlite.d.ts.map +1 -1
  262. package/dist/store/conduit-sqlite.js +307 -528
  263. package/dist/store/conduit-sqlite.js.map +1 -1
  264. package/dist/store/cross-db-cleanup.d.ts +5 -5
  265. package/dist/store/cross-db-cleanup.d.ts.map +1 -1
  266. package/dist/store/cross-db-cleanup.js +12 -10
  267. package/dist/store/cross-db-cleanup.js.map +1 -1
  268. package/dist/store/data-accessor.d.ts +4 -4
  269. package/dist/store/data-accessor.js +5 -5
  270. package/dist/store/data-accessor.js.map +1 -1
  271. package/dist/store/data-safety-central.d.ts +83 -1
  272. package/dist/store/data-safety-central.d.ts.map +1 -1
  273. package/dist/store/data-safety-central.js +257 -0
  274. package/dist/store/data-safety-central.js.map +1 -1
  275. package/dist/store/db-helpers.d.ts +8 -2
  276. package/dist/store/db-helpers.d.ts.map +1 -1
  277. package/dist/store/db-helpers.js +6 -2
  278. package/dist/store/db-helpers.js.map +1 -1
  279. package/dist/store/dual-scope-db.d.ts +46 -4
  280. package/dist/store/dual-scope-db.d.ts.map +1 -1
  281. package/dist/store/dual-scope-db.js +103 -9
  282. package/dist/store/dual-scope-db.js.map +1 -1
  283. package/dist/store/exodus/__fixtures__/representative-fixture.d.ts +116 -0
  284. package/dist/store/exodus/__fixtures__/representative-fixture.d.ts.map +1 -0
  285. package/dist/store/exodus/__fixtures__/representative-fixture.js +274 -0
  286. package/dist/store/exodus/__fixtures__/representative-fixture.js.map +1 -0
  287. package/dist/store/exodus/index.d.ts +3 -1
  288. package/dist/store/exodus/index.d.ts.map +1 -1
  289. package/dist/store/exodus/index.js +3 -1
  290. package/dist/store/exodus/index.js.map +1 -1
  291. package/dist/store/exodus/migrate.d.ts +120 -1
  292. package/dist/store/exodus/migrate.d.ts.map +1 -1
  293. package/dist/store/exodus/migrate.js +923 -119
  294. package/dist/store/exodus/migrate.js.map +1 -1
  295. package/dist/store/exodus/on-open.d.ts +189 -0
  296. package/dist/store/exodus/on-open.d.ts.map +1 -0
  297. package/dist/store/exodus/on-open.js +464 -0
  298. package/dist/store/exodus/on-open.js.map +1 -0
  299. package/dist/store/exodus/table-name-map.d.ts +173 -0
  300. package/dist/store/exodus/table-name-map.d.ts.map +1 -0
  301. package/dist/store/exodus/table-name-map.js +660 -0
  302. package/dist/store/exodus/table-name-map.js.map +1 -0
  303. package/dist/store/exodus/verify-migration.d.ts +72 -0
  304. package/dist/store/exodus/verify-migration.d.ts.map +1 -0
  305. package/dist/store/exodus/verify-migration.js +678 -0
  306. package/dist/store/exodus/verify-migration.js.map +1 -0
  307. package/dist/store/exodus/verify.d.ts +32 -8
  308. package/dist/store/exodus/verify.d.ts.map +1 -1
  309. package/dist/store/exodus/verify.js +48 -142
  310. package/dist/store/exodus/verify.js.map +1 -1
  311. package/dist/store/index.d.ts +2 -3
  312. package/dist/store/index.d.ts.map +1 -1
  313. package/dist/store/index.js +2 -3
  314. package/dist/store/index.js.map +1 -1
  315. package/dist/store/memory-accessor.d.ts +31 -0
  316. package/dist/store/memory-accessor.d.ts.map +1 -1
  317. package/dist/store/memory-accessor.js +38 -0
  318. package/dist/store/memory-accessor.js.map +1 -1
  319. package/dist/store/memory-sqlite.d.ts +86 -13
  320. package/dist/store/memory-sqlite.d.ts.map +1 -1
  321. package/dist/store/memory-sqlite.js +326 -528
  322. package/dist/store/memory-sqlite.js.map +1 -1
  323. package/dist/store/migrate-signaldock-to-conduit.d.ts +1 -1
  324. package/dist/store/migrate-signaldock-to-conduit.d.ts.map +1 -1
  325. package/dist/store/migrate-signaldock-to-conduit.js +126 -35
  326. package/dist/store/migrate-signaldock-to-conduit.js.map +1 -1
  327. package/dist/store/migration-manager.d.ts +49 -0
  328. package/dist/store/migration-manager.d.ts.map +1 -1
  329. package/dist/store/migration-manager.js +167 -67
  330. package/dist/store/migration-manager.js.map +1 -1
  331. package/dist/store/migration-sqlite.d.ts +1 -1
  332. package/dist/store/migration-sqlite.d.ts.map +1 -1
  333. package/dist/store/migration-sqlite.js +32 -3
  334. package/dist/store/migration-sqlite.js.map +1 -1
  335. package/dist/store/nexus-sqlite.d.ts +152 -29
  336. package/dist/store/nexus-sqlite.d.ts.map +1 -1
  337. package/dist/store/nexus-sqlite.js +496 -177
  338. package/dist/store/nexus-sqlite.js.map +1 -1
  339. package/dist/store/nexus-validation-schemas.d.ts +32 -32
  340. package/dist/store/open-cleo-db.d.ts +37 -40
  341. package/dist/store/open-cleo-db.d.ts.map +1 -1
  342. package/dist/store/open-cleo-db.js +76 -153
  343. package/dist/store/open-cleo-db.js.map +1 -1
  344. package/dist/store/role-accessors-impl.d.ts +4 -4
  345. package/dist/store/role-accessors-impl.d.ts.map +1 -1
  346. package/dist/store/role-accessors-impl.js +18 -15
  347. package/dist/store/role-accessors-impl.js.map +1 -1
  348. package/dist/store/schema/{signaldock-schema.d.ts → agent-registry-schema.d.ts} +15 -5
  349. package/dist/store/schema/agent-registry-schema.d.ts.map +1 -0
  350. package/dist/store/schema/{signaldock-schema.js → agent-registry-schema.js} +15 -5
  351. package/dist/store/schema/agent-registry-schema.js.map +1 -0
  352. package/dist/store/schema/agent-schema.d.ts +1 -1
  353. package/dist/store/schema/agent-schema.js +4 -4
  354. package/dist/store/schema/agent-schema.js.map +1 -1
  355. package/dist/store/schema/attachments.d.ts +1 -1
  356. package/dist/store/schema/audit.d.ts +15 -5
  357. package/dist/store/schema/audit.d.ts.map +1 -1
  358. package/dist/store/schema/audit.js +12 -2
  359. package/dist/store/schema/audit.js.map +1 -1
  360. package/dist/store/schema/background-jobs.d.ts +1 -1
  361. package/dist/store/schema/cleo-global/{signaldock.d.ts → agent-registry.d.ts} +277 -271
  362. package/dist/store/schema/cleo-global/agent-registry.d.ts.map +1 -0
  363. package/dist/store/schema/cleo-global/{signaldock.js → agent-registry.js} +136 -125
  364. package/dist/store/schema/cleo-global/agent-registry.js.map +1 -0
  365. package/dist/store/schema/cleo-global/index.d.ts +29 -22
  366. package/dist/store/schema/cleo-global/index.d.ts.map +1 -1
  367. package/dist/store/schema/cleo-global/index.js +29 -22
  368. package/dist/store/schema/cleo-global/index.js.map +1 -1
  369. package/dist/store/schema/cleo-global/nexus.d.ts +36 -1034
  370. package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
  371. package/dist/store/schema/cleo-global/nexus.js +32 -337
  372. package/dist/store/schema/cleo-global/nexus.js.map +1 -1
  373. package/dist/store/schema/cleo-global/skills.d.ts +16 -0
  374. package/dist/store/schema/cleo-global/skills.d.ts.map +1 -1
  375. package/dist/store/schema/cleo-global/skills.js +11 -0
  376. package/dist/store/schema/cleo-global/skills.js.map +1 -1
  377. package/dist/store/schema/{cleo-project → cleo-global}/telemetry.d.ts +33 -17
  378. package/dist/store/schema/cleo-global/telemetry.d.ts.map +1 -0
  379. package/dist/store/schema/{cleo-project → cleo-global}/telemetry.js +30 -18
  380. package/dist/store/schema/cleo-global/telemetry.js.map +1 -0
  381. package/dist/store/schema/cleo-project/audit.d.ts +8 -8
  382. package/dist/store/schema/cleo-project/audit.d.ts.map +1 -1
  383. package/dist/store/schema/cleo-project/audit.js +2 -6
  384. package/dist/store/schema/cleo-project/audit.js.map +1 -1
  385. package/dist/store/schema/cleo-project/docs.d.ts +1 -1
  386. package/dist/store/schema/cleo-project/index.d.ts +29 -12
  387. package/dist/store/schema/cleo-project/index.d.ts.map +1 -1
  388. package/dist/store/schema/cleo-project/index.js +29 -12
  389. package/dist/store/schema/cleo-project/index.js.map +1 -1
  390. package/dist/store/schema/cleo-project/lifecycle.d.ts +2 -2
  391. package/dist/store/schema/cleo-project/nexus-graph.d.ts +1067 -0
  392. package/dist/store/schema/cleo-project/nexus-graph.d.ts.map +1 -0
  393. package/dist/store/schema/cleo-project/nexus-graph.js +407 -0
  394. package/dist/store/schema/cleo-project/nexus-graph.js.map +1 -0
  395. package/dist/store/schema/cleo-project/provenance-orphans.d.ts +385 -0
  396. package/dist/store/schema/cleo-project/provenance-orphans.d.ts.map +1 -0
  397. package/dist/store/schema/cleo-project/provenance-orphans.js +142 -0
  398. package/dist/store/schema/cleo-project/provenance-orphans.js.map +1 -0
  399. package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
  400. package/dist/store/schema/cleo-project/runtime.d.ts +1 -1
  401. package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts +1 -1
  402. package/dist/store/schema/cleo-project/tasks-core.d.ts +3 -3
  403. package/dist/store/schema/cleo-shared/brain.d.ts +711 -494
  404. package/dist/store/schema/cleo-shared/brain.d.ts.map +1 -1
  405. package/dist/store/schema/cleo-shared/brain.js +215 -134
  406. package/dist/store/schema/cleo-shared/brain.js.map +1 -1
  407. package/dist/store/schema/conduit-schema.d.ts +63 -51
  408. package/dist/store/schema/conduit-schema.d.ts.map +1 -1
  409. package/dist/store/schema/conduit-schema.js +23 -11
  410. package/dist/store/schema/conduit-schema.js.map +1 -1
  411. package/dist/store/schema/goal.d.ts +3 -2
  412. package/dist/store/schema/goal.d.ts.map +1 -1
  413. package/dist/store/schema/goal.js +3 -2
  414. package/dist/store/schema/goal.js.map +1 -1
  415. package/dist/store/schema/index.d.ts +1 -0
  416. package/dist/store/schema/index.d.ts.map +1 -1
  417. package/dist/store/schema/index.js +1 -0
  418. package/dist/store/schema/index.js.map +1 -1
  419. package/dist/store/schema/lifecycle.d.ts +2 -2
  420. package/dist/store/schema/memory-schema.d.ts +2 -2
  421. package/dist/store/schema/nexus-schema.d.ts +174 -115
  422. package/dist/store/schema/nexus-schema.d.ts.map +1 -1
  423. package/dist/store/schema/nexus-schema.js +175 -55
  424. package/dist/store/schema/nexus-schema.js.map +1 -1
  425. package/dist/store/schema/provenance/releases.d.ts +1 -1
  426. package/dist/store/schema/schema-utils.d.ts +78 -0
  427. package/dist/store/schema/schema-utils.d.ts.map +1 -0
  428. package/dist/store/schema/schema-utils.js +49 -0
  429. package/dist/store/schema/schema-utils.js.map +1 -0
  430. package/dist/store/schema/skills-schema.d.ts +81 -44
  431. package/dist/store/schema/skills-schema.d.ts.map +1 -1
  432. package/dist/store/schema/skills-schema.js +49 -16
  433. package/dist/store/schema/skills-schema.js.map +1 -1
  434. package/dist/store/schema/tasks.d.ts +3 -3
  435. package/dist/store/skills-db.d.ts +90 -50
  436. package/dist/store/skills-db.d.ts.map +1 -1
  437. package/dist/store/skills-db.js +132 -146
  438. package/dist/store/skills-db.js.map +1 -1
  439. package/dist/store/sqlite-backup.d.ts +2 -2
  440. package/dist/store/sqlite-backup.d.ts.map +1 -1
  441. package/dist/store/sqlite-backup.js +11 -10
  442. package/dist/store/sqlite-backup.js.map +1 -1
  443. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  444. package/dist/store/sqlite-data-accessor.js +25 -18
  445. package/dist/store/sqlite-data-accessor.js.map +1 -1
  446. package/dist/store/sqlite.d.ts +72 -12
  447. package/dist/store/sqlite.d.ts.map +1 -1
  448. package/dist/store/sqlite.js +153 -89
  449. package/dist/store/sqlite.js.map +1 -1
  450. package/dist/store/tasks-schema.d.ts +4 -0
  451. package/dist/store/tasks-schema.d.ts.map +1 -1
  452. package/dist/store/tasks-schema.js +60 -0
  453. package/dist/store/tasks-schema.js.map +1 -1
  454. package/dist/store/tasks-sqlite.d.ts +2 -2
  455. package/dist/store/tasks-sqlite.d.ts.map +1 -1
  456. package/dist/store/tasks-sqlite.js +10 -5
  457. package/dist/store/tasks-sqlite.js.map +1 -1
  458. package/dist/store/umbrella-data-accessor.d.ts +17 -6
  459. package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
  460. package/dist/store/umbrella-data-accessor.js +8 -8
  461. package/dist/store/umbrella-data-accessor.js.map +1 -1
  462. package/dist/store/validation-schemas.d.ts +241 -208
  463. package/dist/store/validation-schemas.d.ts.map +1 -1
  464. package/dist/system/health.d.ts.map +1 -1
  465. package/dist/system/health.js +11 -6
  466. package/dist/system/health.js.map +1 -1
  467. package/dist/system/project-health.d.ts.map +1 -1
  468. package/dist/system/project-health.js +58 -12
  469. package/dist/system/project-health.js.map +1 -1
  470. package/dist/tasks/add.d.ts +8 -0
  471. package/dist/tasks/add.d.ts.map +1 -1
  472. package/dist/tasks/add.js +101 -0
  473. package/dist/tasks/add.js.map +1 -1
  474. package/dist/tasks/cancelled-child-waiver-audit.d.ts +47 -0
  475. package/dist/tasks/cancelled-child-waiver-audit.d.ts.map +1 -0
  476. package/dist/tasks/cancelled-child-waiver-audit.js +34 -0
  477. package/dist/tasks/cancelled-child-waiver-audit.js.map +1 -0
  478. package/dist/tasks/complete.d.ts +22 -2
  479. package/dist/tasks/complete.d.ts.map +1 -1
  480. package/dist/tasks/complete.js +71 -6
  481. package/dist/tasks/complete.js.map +1 -1
  482. package/dist/tasks/compute-task-view.js +1 -1
  483. package/dist/tasks/session-scope.d.ts +5 -0
  484. package/dist/tasks/session-scope.d.ts.map +1 -1
  485. package/dist/tasks/session-scope.js +4 -0
  486. package/dist/tasks/session-scope.js.map +1 -1
  487. package/dist/tools/guard.d.ts +71 -1
  488. package/dist/tools/guard.d.ts.map +1 -1
  489. package/dist/tools/guard.js +73 -1
  490. package/dist/tools/guard.js.map +1 -1
  491. package/dist/tools/index.d.ts +21 -0
  492. package/dist/tools/index.d.ts.map +1 -1
  493. package/dist/tools/index.js +25 -0
  494. package/dist/tools/index.js.map +1 -1
  495. package/dist/upgrade.d.ts.map +1 -1
  496. package/dist/upgrade.js +22 -13
  497. package/dist/upgrade.js.map +1 -1
  498. package/dist/workgraph/containment.js +18 -18
  499. package/dist/workgraph/relations.js +2 -2
  500. package/dist/worktree/list.d.ts +1 -1
  501. package/dist/worktree/list.d.ts.map +1 -1
  502. package/dist/worktree/list.js +19 -21
  503. package/dist/worktree/list.js.map +1 -1
  504. package/dist/worktree-export.d.ts +18 -0
  505. package/dist/worktree-export.d.ts.map +1 -0
  506. package/dist/worktree-export.js +18 -0
  507. package/dist/worktree-export.js.map +1 -0
  508. package/migrations/drizzle-agent-registry/20260412000000_initial-global-agent-registry/migration.sql +29 -0
  509. package/migrations/drizzle-brain/20260601000001_t11522-brain-task-observations/migration.sql +28 -0
  510. package/migrations/drizzle-brain/20260601000002_t11522-inline-only-brain-tables/migration.sql +75 -0
  511. package/migrations/drizzle-cleo-global/20260531000001_t11363-consolidation-cleo-global/migration.sql +49 -144
  512. package/migrations/drizzle-cleo-global/20260531000001_t11363-consolidation-cleo-global/snapshot.json +8 -8
  513. package/migrations/drizzle-cleo-global/20260531000002_t11546-brain-usage-log/migration.sql +16 -0
  514. package/migrations/drizzle-cleo-global/20260601000001_t11544-skills-usage-project-id/migration.sql +12 -0
  515. package/migrations/drizzle-cleo-global/20260602000001_t11622-agent-registry-rename/migration.sql +80 -0
  516. package/migrations/drizzle-cleo-project/20260531000001_t11363-consolidation-cleo-project/migration.sql +26 -167
  517. package/migrations/drizzle-cleo-project/20260531000001_t11363-consolidation-cleo-project/snapshot.json +8 -8
  518. package/migrations/drizzle-cleo-project/20260531000002_t11546-brain-usage-log/migration.sql +21 -0
  519. package/migrations/drizzle-cleo-project/20260601000001_t11549-agent-credentials-brain-release-links/migration.sql +49 -0
  520. package/migrations/drizzle-cleo-project/20260601000002_t11538-project-nexus-graph/migration.sql +140 -0
  521. package/migrations/drizzle-cleo-project/20260602000002_t11649-token-usage-transport-mcp/migration.sql +146 -0
  522. package/migrations/drizzle-conduit/20260601000003_t11523-conduit-inline-schema/migration.sql +82 -0
  523. package/migrations/drizzle-nexus/20260421200001_t1165-baseline-reset/migration.sql +26 -8
  524. package/migrations/drizzle-nexus/20260601000001_t11545-nexus-relation-weights-partition/migration.sql +97 -0
  525. package/package.json +45 -13
  526. package/scripts/install-supervisor-binary.mjs +50 -201
  527. package/scripts/napi-binary-picker.mjs +267 -0
  528. package/dist/agents/agent-registry.d.ts.map +0 -1
  529. package/dist/agents/agent-registry.js.map +0 -1
  530. package/dist/store/data-safety.d.ts +0 -92
  531. package/dist/store/data-safety.d.ts.map +0 -1
  532. package/dist/store/data-safety.js +0 -274
  533. package/dist/store/data-safety.js.map +0 -1
  534. package/dist/store/schema/cleo-global/signaldock.d.ts.map +0 -1
  535. package/dist/store/schema/cleo-global/signaldock.js.map +0 -1
  536. package/dist/store/schema/cleo-project/telemetry.d.ts.map +0 -1
  537. package/dist/store/schema/cleo-project/telemetry.js.map +0 -1
  538. package/dist/store/schema/signaldock-schema.d.ts.map +0 -1
  539. package/dist/store/schema/signaldock-schema.js.map +0 -1
  540. package/dist/store/signaldock-sqlite.d.ts +0 -173
  541. package/dist/store/signaldock-sqlite.d.ts.map +0 -1
  542. package/dist/store/signaldock-sqlite.js +0 -445
  543. package/dist/store/signaldock-sqlite.js.map +0 -1
  544. package/migrations/drizzle-nexus/20260318205558_initial/migration.sql +0 -46
  545. package/migrations/drizzle-nexus/20260412000001_t529-nexus-graph-tables/migration.sql +0 -49
  546. package/migrations/drizzle-nexus/20260415000001_t622-project-registry-paths/migration.sql +0 -12
  547. package/migrations/drizzle-nexus/20260419000001_t998-nexus-plasticity/migration.sql +0 -13
  548. package/migrations/drizzle-nexus/20260423052640_t1077-add-user-profile-table/migration.sql +0 -16
  549. package/migrations/drizzle-nexus/20260423052640_t1077-add-user-profile-table/snapshot.json +0 -1531
  550. package/migrations/drizzle-nexus/20260424140538_t1148-add-sigils-table/migration.sql +0 -13
  551. package/migrations/drizzle-nexus/20260424140538_t1148-add-sigils-table/snapshot.json +0 -1652
  552. package/migrations/drizzle-nexus/20260504000001_t1839-fts5-nexus-symbols/migration.sql +0 -68
  553. package/migrations/drizzle-nexus/20260507135519_t9163-nexus-is-external/migration.sql +0 -20
  554. package/migrations/drizzle-nexus/20260507135519_t9163-nexus-is-external/snapshot.json +0 -1652
  555. package/migrations/drizzle-nexus/20260526222449_t11025-project-id-aliases/migration.sql +0 -16
  556. package/migrations/drizzle-signaldock/20260412000000_initial-global-signaldock/migration.sql +0 -209
  557. package/migrations/drizzle-signaldock/20260412000000_initial-global-signaldock/snapshot.json +0 -2060
@@ -1,32 +1,41 @@
1
1
  /**
2
- * Per-user skills.db lifecycle module — opener, migrations, helpers.
2
+ * Per-user skills registry lifecycle module — opener, helpers.
3
3
  *
4
- * `skills.db` is a global-tier SQLite database that lives next to `tasks.db`
5
- * and `brain.db` under `getCleoHome()` (e.g. `~/.local/share/cleo/skills.db`).
6
- * It stores the per-user skills registry described in
4
+ * The per-user skills registry is a global-tier domain described in
7
5
  * `docs/architecture/SG-CLEO-SKILLS-architecture-v3.md` §4.
8
6
  *
9
- * ## Chokepoint compliance (ADR-068 + D003)
10
- *
11
- * Every CLEO SQLite open MUST flow through `openCleoDb(role, cwd)`. This
12
- * module implements the `'skills'` branch of that chokepoint — it is the
13
- * ONLY place a raw `new DatabaseSync(...)` is permitted for skills.db,
14
- * because it sits under `packages/core/src/store/` which is allowlisted by
15
- * `scripts/lint-no-raw-db-opens.mjs`.
16
- *
17
- * ## Why not in conduit.db / signaldock.db?
18
- *
19
- * Per architecture v3 §1, the database boundaries are intentional:
20
- * - `signaldock.db` — cross-project AGENT identity (global)
21
- * - `tasks.db` — per-project task tracking
22
- * - `brain.db` per-project memory
23
- * - `skills.db` per-user SKILL registry (this module, global)
24
- *
25
- * Skills are user-scoped (a single Claude install is one user), so they
26
- * live under `getCleoHome()` never inside a project's `.cleo/` folder.
7
+ * ## E6-L5 thin-facade migration (T11525)
8
+ *
9
+ * `openSkillsDb()` is now a thin facade that delegates the database open to
10
+ * {@link openDualScopeDb}('global') the canonical dual-scope chokepoint
11
+ * (E3/E4 · T11512/T11517) already adopted by the tasks (E6-L1), brain (E6-L2),
12
+ * conduit (E6-L3), and nexus (E6-L4) domains. The skills registry tables now
13
+ * live inside the consolidated GLOBAL `cleo.db` under `getCleoHome()`, sharing
14
+ * the SAME native handle the nexus / signaldock global domains use — NOT a
15
+ * separate `skills.db` file.
16
+ *
17
+ * ## Why prefixed `skills_*` tables (no establishLegacy rebuild)
18
+ *
19
+ * Unlike nexus (E6-L4), the skills registry does NOT run its legacy
20
+ * `drizzle-skills` migration on the shared handle. That migration created BARE
21
+ * `skills` / `skill_usage` / … tables and the bare `skills` name COLLIDES with
22
+ * the signaldock domain's own legacy `skills` slug-catalog now that both share
23
+ * one `cleo.db`. The consolidated `drizzle-cleo-global` migration already creates
24
+ * the registry tables under the domain-prefixed names (`skills_skills`,
25
+ * `skills_skill_usage`, …), column-identical to the legacy shape plus additive
26
+ * enum/timestamp/boolean CHECK constraints that ACCEPT every value the runtime
27
+ * writers produce (ISO-8601 text, 0/1 booleans — verified). So skills-db simply
28
+ * binds the (now prefix-renamed) `skillsSchema` drizzle queries to those
29
+ * already-created consolidated tables. No drop+rebuild is needed because there is
30
+ * no consolidated-vs-legacy shape incompatibility (the L4 precondition is absent).
31
+ *
32
+ * The residency MOVE of skills global→project and the exodus data copy from the
33
+ * legacy standalone `skills.db` are SEPARATE later tasks (T11553 / T11538).
27
34
  *
28
35
  * @task T9651
36
+ * @task T11525 - E6-L5: route openSkillsDb through openDualScopeDb('global') (SG-DB-SUBSTRATE-V2)
29
37
  * @epic T9571
38
+ * @epic T11249
30
39
  * @saga T9560
31
40
  * @adr ADR-068, ADR-069
32
41
  * @architecture docs/architecture/SG-CLEO-SKILLS-architecture-v3.md §4
@@ -35,46 +44,58 @@ import type { DatabaseSync } from 'node:sqlite';
35
44
  import type { NodeSQLiteDatabase } from 'drizzle-orm/node-sqlite';
36
45
  import * as skillsSchema from './schema/skills-schema.js';
37
46
  import { type NewSkillRow, type SkillRow, type SkillSourceType } from './schema/skills-schema.js';
38
- /** Database file name within `getCleoHome()`. */
47
+ /**
48
+ * Legacy standalone skills.db file name within `getCleoHome()`.
49
+ *
50
+ * E6-L5 (T11525): the live skills registry now consolidates into the shared
51
+ * GLOBAL `cleo.db`; this literal is retained only for the backup/exodus paths
52
+ * that still read the pre-cutover standalone file.
53
+ */
39
54
  export declare const SKILLS_DB_FILENAME = "skills.db";
40
- /** Schema version stamped into `_skills_meta`. Bump on every schema change. */
55
+ /** Schema version constant. Retained for compatibility with external re-exporters. */
41
56
  export declare const SKILLS_SCHEMA_VERSION = "2026.5.81";
42
57
  /**
43
- * Resolve the canonical filesystem path for `skills.db`.
58
+ * Resolve the canonical filesystem path for the skills registry DB.
44
59
  *
45
- * Always returns a path under `getCleoHome()`. Throws if the resolved path
46
- * somehow escapes that prefix that would indicate a regression in
47
- * `getCleoHome()` itself and MUST be fixed at the source, not silently
48
- * tolerated.
60
+ * E6-L5 (T11525): resolves `getCleoHome()` + `cleo.db` the consolidated GLOBAL
61
+ * `cleo.db` that now hosts the `skills_*` registry tables (the same path
62
+ * {@link openDualScopeDb}('global') opens). Always returns a path under
63
+ * `getCleoHome()`. Throws if the resolved path somehow escapes that prefix — that
64
+ * would indicate a regression in `getCleoHome()` itself and MUST be fixed at the
65
+ * source, not silently tolerated.
49
66
  *
50
- * @returns Absolute path to `skills.db`.
67
+ * @returns Absolute path to the consolidated `cleo.db`.
51
68
  * @throws {Error} If the resolved path is not under `getCleoHome()`.
52
69
  */
53
70
  export declare function getDefaultSkillsDbPath(): string;
54
- /**
55
- * Resolve the absolute path to the `drizzle-skills` migrations folder.
56
- *
57
- * Delegates to {@link resolveCorePackageMigrationsFolder} which handles the
58
- * three install layouts (workspace dev, bundled dist, global install) via
59
- * `import.meta.resolve()` with a `createRequire().resolve()` fallback.
60
- */
61
- export declare function resolveSkillsMigrationsFolder(): string;
62
71
  /**
63
72
  * Options for {@link openSkillsDb}.
64
73
  */
65
74
  export interface OpenSkillsDbOptions {
66
75
  /**
67
76
  * Override the on-disk path. Used by tests; production callers should
68
- * leave this `undefined` to let the module resolve `getDefaultSkillsDbPath()`.
77
+ * leave this `undefined` to let the module resolve {@link getDefaultSkillsDbPath}.
78
+ *
79
+ * E6-L5 (T11525): the override path is opened as a consolidated GLOBAL
80
+ * `cleo.db` (the prefixed `skills_*` tables are created by the consolidated
81
+ * migration) via {@link openDualScopeDbAtPath}, so a test passing
82
+ * `<tmpdir>/skills.db` materialises an isolated consolidated DB at that exact
83
+ * path — distinct cache key from the canonical `cleo.db`.
69
84
  */
70
85
  path?: string;
71
86
  }
72
87
  /**
73
- * Open (or first-time materialise) `skills.db` and return the Drizzle handle.
74
- *
75
- * Idempotent: repeated calls with the same effective path return the cached
76
- * singleton. Concurrent callers share a single in-flight init promise so
77
- * migrations never race.
88
+ * Open (or first-time materialise) the skills registry and return the Drizzle
89
+ * handle bound to the prefixed `skills_*` tables.
90
+ *
91
+ * E6-L5 (T11525): delegates the physical open to {@link openDualScopeDb}('global')
92
+ * (or {@link openDualScopeDbAtPath} for the test `{ path }` override) — the
93
+ * canonical dual-scope chokepoint — and re-wraps its native handle with the
94
+ * prefix-renamed `skillsSchema` drizzle instance. The consolidated
95
+ * `drizzle-cleo-global` migration creates the `skills_*` tables; this module does
96
+ * NOT run the legacy `drizzle-skills` migration (which would create the
97
+ * signaldock-colliding bare `skills` table). Idempotent: repeated calls with the
98
+ * same effective path return the cached singleton.
78
99
  *
79
100
  * @example
80
101
  * ```typescript
@@ -85,21 +106,40 @@ export interface OpenSkillsDbOptions {
85
106
  * ```
86
107
  *
87
108
  * @param options - Override the default path (test-only).
88
- * @returns A Drizzle ORM handle bound to the four skills.db tables.
109
+ * @returns A Drizzle ORM handle bound to the four `skills_*` registry tables.
89
110
  *
90
111
  * @task T9651
112
+ * @task T11525
91
113
  */
92
114
  export declare function openSkillsDb(options?: OpenSkillsDbOptions): Promise<NodeSQLiteDatabase<typeof skillsSchema>>;
93
115
  /**
94
- * Close the singleton handle and release the underlying native DB.
116
+ * Drop the skills-domain singleton references and trigger the coordinated close
117
+ * of the shared GLOBAL `cleo.db` handle via the dual-scope cache.
118
+ *
119
+ * ## E6-L5 (T11525) — shared-handle close rule
120
+ *
121
+ * `_skillsNativeDb` is the SHARED consolidated GLOBAL `cleo.db` handle owned by
122
+ * {@link openDualScopeDb}('global') and co-owned by the nexus / signaldock global
123
+ * domains. This function MUST NOT call `.close()` on it directly — doing so would
124
+ * tear the handle out from under those siblings (the exact bug class L4 fixed at
125
+ * `dual-scope-db.ts`). Instead it evicts the GLOBAL-scope entry from the
126
+ * dual-scope cache (a single coordinated close) and drops the local references.
95
127
  *
96
- * Safe to call multiple times. Used by `cleo backup restore skills.db` and
97
- * tests that mkdtemp a fresh location between cases.
128
+ * Safe to call multiple times. Used by `cleo backup restore` and tests that
129
+ * mkdtemp a fresh location between cases.
130
+ *
131
+ * @task T9651
132
+ * @task T11525
98
133
  */
99
134
  export declare function closeSkillsDb(): void;
100
135
  /**
101
- * Reset singleton state WITHOUT closing — used between tests to force a
102
- * re-open against a new tmpdir.
136
+ * Reset singleton state — used between tests to force a re-open against a new
137
+ * tmpdir. E6-L5: identical to {@link closeSkillsDb} (both go through the
138
+ * scope-filtered dual-scope cache reset; neither closes the shared handle
139
+ * directly).
140
+ *
141
+ * @task T9651
142
+ * @task T11525
103
143
  */
104
144
  export declare function resetSkillsDbState(): void;
105
145
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"skills-db.d.ts","sourceRoot":"","sources":["../../src/store/skills-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAGnC,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAejD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAW/C;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAyFD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAChC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,OAAO,YAAY,CAAC,CAAC,CA6ClD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAapC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,GAAG,IAAI,CAEvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEnD;AAMD;;;;;;;G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,67 @@
1
1
  /**
2
- * Per-user skills.db lifecycle module — opener, migrations, helpers.
2
+ * Per-user skills registry lifecycle module — opener, helpers.
3
3
  *
4
- * `skills.db` is a global-tier SQLite database that lives next to `tasks.db`
5
- * and `brain.db` under `getCleoHome()` (e.g. `~/.local/share/cleo/skills.db`).
6
- * It stores the per-user skills registry described in
4
+ * The per-user skills registry is a global-tier domain described in
7
5
  * `docs/architecture/SG-CLEO-SKILLS-architecture-v3.md` §4.
8
6
  *
9
- * ## Chokepoint compliance (ADR-068 + D003)
10
- *
11
- * Every CLEO SQLite open MUST flow through `openCleoDb(role, cwd)`. This
12
- * module implements the `'skills'` branch of that chokepoint — it is the
13
- * ONLY place a raw `new DatabaseSync(...)` is permitted for skills.db,
14
- * because it sits under `packages/core/src/store/` which is allowlisted by
15
- * `scripts/lint-no-raw-db-opens.mjs`.
16
- *
17
- * ## Why not in conduit.db / signaldock.db?
18
- *
19
- * Per architecture v3 §1, the database boundaries are intentional:
20
- * - `signaldock.db` — cross-project AGENT identity (global)
21
- * - `tasks.db` — per-project task tracking
22
- * - `brain.db` per-project memory
23
- * - `skills.db` per-user SKILL registry (this module, global)
24
- *
25
- * Skills are user-scoped (a single Claude install is one user), so they
26
- * live under `getCleoHome()` never inside a project's `.cleo/` folder.
7
+ * ## E6-L5 thin-facade migration (T11525)
8
+ *
9
+ * `openSkillsDb()` is now a thin facade that delegates the database open to
10
+ * {@link openDualScopeDb}('global') the canonical dual-scope chokepoint
11
+ * (E3/E4 · T11512/T11517) already adopted by the tasks (E6-L1), brain (E6-L2),
12
+ * conduit (E6-L3), and nexus (E6-L4) domains. The skills registry tables now
13
+ * live inside the consolidated GLOBAL `cleo.db` under `getCleoHome()`, sharing
14
+ * the SAME native handle the nexus / signaldock global domains use — NOT a
15
+ * separate `skills.db` file.
16
+ *
17
+ * ## Why prefixed `skills_*` tables (no establishLegacy rebuild)
18
+ *
19
+ * Unlike nexus (E6-L4), the skills registry does NOT run its legacy
20
+ * `drizzle-skills` migration on the shared handle. That migration created BARE
21
+ * `skills` / `skill_usage` / … tables and the bare `skills` name COLLIDES with
22
+ * the signaldock domain's own legacy `skills` slug-catalog now that both share
23
+ * one `cleo.db`. The consolidated `drizzle-cleo-global` migration already creates
24
+ * the registry tables under the domain-prefixed names (`skills_skills`,
25
+ * `skills_skill_usage`, …), column-identical to the legacy shape plus additive
26
+ * enum/timestamp/boolean CHECK constraints that ACCEPT every value the runtime
27
+ * writers produce (ISO-8601 text, 0/1 booleans — verified). So skills-db simply
28
+ * binds the (now prefix-renamed) `skillsSchema` drizzle queries to those
29
+ * already-created consolidated tables. No drop+rebuild is needed because there is
30
+ * no consolidated-vs-legacy shape incompatibility (the L4 precondition is absent).
31
+ *
32
+ * The residency MOVE of skills global→project and the exodus data copy from the
33
+ * legacy standalone `skills.db` are SEPARATE later tasks (T11553 / T11538).
27
34
  *
28
35
  * @task T9651
36
+ * @task T11525 - E6-L5: route openSkillsDb through openDualScopeDb('global') (SG-DB-SUBSTRATE-V2)
29
37
  * @epic T9571
38
+ * @epic T11249
30
39
  * @saga T9560
31
40
  * @adr ADR-068, ADR-069
32
41
  * @architecture docs/architecture/SG-CLEO-SKILLS-architecture-v3.md §4
33
42
  */
34
- import { existsSync, mkdirSync } from 'node:fs';
35
- import { dirname, join } from 'node:path';
43
+ import { join } from 'node:path';
36
44
  import { and, eq } from 'drizzle-orm';
37
- import { readMigrationFiles } from 'drizzle-orm/migrator';
38
45
  import { drizzle } from 'drizzle-orm/node-sqlite';
39
46
  import { getCleoHome } from '../paths.js';
40
47
  import { getCurrentWriteOrigin } from '../sentient/skill-provenance.js';
41
- import { migrateWithRetry, reconcileJournal, tableExists } from './migration-manager.js';
42
- import { resolveCorePackageMigrationsFolder } from './resolve-migrations-folder.js';
48
+ // E6-L5 (T11525): dual-scope chokepoint the skills registry opens the
49
+ // consolidated GLOBAL `cleo.db` through here. openDualScopeDb manages the
50
+ // DatabaseSync lifecycle, pragmas, and consolidated migrations (which create the
51
+ // prefixed `skills_*` tables). We extract the native handle and re-wrap it with
52
+ // the prefix-renamed skills schema so existing callers compile unchanged.
53
+ import { _resetDualScopeDbCache, openDualScopeDb, openDualScopeDbAtPath } from './dual-scope-db.js';
43
54
  import * as skillsSchema from './schema/skills-schema.js';
44
55
  import { skills as skillsTable, } from './schema/skills-schema.js';
45
- import { isSqliteBusy, openNativeDatabase } from './sqlite.js';
46
- /** Database file name within `getCleoHome()`. */
56
+ /**
57
+ * Legacy standalone skills.db file name within `getCleoHome()`.
58
+ *
59
+ * E6-L5 (T11525): the live skills registry now consolidates into the shared
60
+ * GLOBAL `cleo.db`; this literal is retained only for the backup/exodus paths
61
+ * that still read the pre-cutover standalone file.
62
+ */
47
63
  export const SKILLS_DB_FILENAME = 'skills.db';
48
- /** Schema version stamped into `_skills_meta`. Bump on every schema change. */
64
+ /** Schema version constant. Retained for compatibility with external re-exporters. */
49
65
  export const SKILLS_SCHEMA_VERSION = '2026.5.81';
50
66
  // ---------------------------------------------------------------------------
51
67
  // Singleton state — one open handle per process, reset across tests.
@@ -58,110 +74,46 @@ let _skillsInitPromise = null;
58
74
  // Path resolution
59
75
  // ---------------------------------------------------------------------------
60
76
  /**
61
- * Resolve the canonical filesystem path for `skills.db`.
77
+ * Resolve the canonical filesystem path for the skills registry DB.
62
78
  *
63
- * Always returns a path under `getCleoHome()`. Throws if the resolved path
64
- * somehow escapes that prefix that would indicate a regression in
65
- * `getCleoHome()` itself and MUST be fixed at the source, not silently
66
- * tolerated.
79
+ * E6-L5 (T11525): resolves `getCleoHome()` + `cleo.db` the consolidated GLOBAL
80
+ * `cleo.db` that now hosts the `skills_*` registry tables (the same path
81
+ * {@link openDualScopeDb}('global') opens). Always returns a path under
82
+ * `getCleoHome()`. Throws if the resolved path somehow escapes that prefix — that
83
+ * would indicate a regression in `getCleoHome()` itself and MUST be fixed at the
84
+ * source, not silently tolerated.
67
85
  *
68
- * @returns Absolute path to `skills.db`.
86
+ * @returns Absolute path to the consolidated `cleo.db`.
69
87
  * @throws {Error} If the resolved path is not under `getCleoHome()`.
70
88
  */
71
89
  export function getDefaultSkillsDbPath() {
90
+ // Resolve via THIS module's getCleoHome binding so the path and the guard are
91
+ // self-consistent — see the same note on signaldock-sqlite.getGlobalAgentRegistryDbPath
92
+ // (T11525). resolveDualScopeDbPath('global') builds the identical path but binds
93
+ // getCleoHome through dual-scope-db's module graph, which can diverge under
94
+ // per-test vi.doMock timing.
72
95
  const cleoHome = getCleoHome();
73
- const dbPath = join(cleoHome, SKILLS_DB_FILENAME);
96
+ const dbPath = join(cleoHome, 'cleo.db');
74
97
  if (!dbPath.startsWith(cleoHome)) {
98
+ /* c8 ignore next 6 — unreachable: dbPath is built FROM cleoHome above. */
75
99
  throw new Error(`BUG: getDefaultSkillsDbPath() resolved to "${dbPath}" which is NOT under ` +
76
- `getCleoHome() ("${cleoHome}"). skills.db is global-only per ` +
100
+ `getCleoHome() ("${cleoHome}"). The skills registry is global-only per ` +
77
101
  `SG-CLEO-SKILLS-architecture-v3.md §4. Fix the caller, do not suppress.`);
78
102
  }
79
103
  return dbPath;
80
104
  }
81
105
  /**
82
- * Resolve the absolute path to the `drizzle-skills` migrations folder.
83
- *
84
- * Delegates to {@link resolveCorePackageMigrationsFolder} which handles the
85
- * three install layouts (workspace dev, bundled dist, global install) via
86
- * `import.meta.resolve()` with a `createRequire().resolve()` fallback.
87
- */
88
- export function resolveSkillsMigrationsFolder() {
89
- return resolveCorePackageMigrationsFolder('drizzle-skills');
90
- }
91
- // ---------------------------------------------------------------------------
92
- // Migration runner
93
- // ---------------------------------------------------------------------------
94
- /**
95
- * Apply the drizzle journal + pending migrations to the open `skills.db`.
96
- *
97
- * Uses the same retry-on-BUSY loop as `nexus-sqlite.ts` so concurrent CLI
98
- * invocations don't trip over each other during first-install bootstrap.
99
- *
100
- * @task T9651
101
- */
102
- function runSkillsMigrations(nativeDb, db) {
103
- const migrationsFolder = resolveSkillsMigrationsFolder();
104
- // Bootstrap: if the table exists from a prior bare-SQL apply but the
105
- // drizzle journal hasn't been seeded, mark the initial migration as
106
- // already applied. This mirrors the nexus-sqlite Scenario-1 bootstrap.
107
- if (tableExists(nativeDb, 'skills') && !tableExists(nativeDb, '__drizzle_migrations')) {
108
- const migrations = readMigrationFiles({ migrationsFolder });
109
- const baseline = migrations[0];
110
- if (baseline) {
111
- nativeDb
112
- .prepare(`CREATE TABLE IF NOT EXISTS "__drizzle_migrations" (id INTEGER PRIMARY KEY AUTOINCREMENT, hash text NOT NULL, created_at numeric)`)
113
- .run();
114
- nativeDb
115
- .prepare(`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES ('${baseline.hash}', ${baseline.folderMillis})`)
116
- .run();
117
- }
118
- }
119
- // Reconcile any partial / out-of-band migrations before the regular run.
120
- reconcileJournal(nativeDb, migrationsFolder, 'skills', 'skills');
121
- const MAX_RETRIES = 5;
122
- const BASE_DELAY_MS = 100;
123
- const MAX_DELAY_MS = 2000;
124
- let lastError;
125
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
126
- try {
127
- migrateWithRetry(db, migrationsFolder, nativeDb, 'skills', 'skills');
128
- return;
129
- }
130
- catch (err) {
131
- if (!isSqliteBusy(err) || attempt === MAX_RETRIES)
132
- throw err;
133
- lastError = err;
134
- const delay = Math.min(BASE_DELAY_MS * 2 ** (attempt - 1) * (1 + Math.random() * 0.5), MAX_DELAY_MS);
135
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, Math.round(delay));
136
- }
137
- }
138
- /* c8 ignore next */
139
- throw lastError;
140
- }
141
- /**
142
- * Stamp the `_skills_meta.schema_version` sentinel so the next process can
143
- * take a fast-path through `ensureSkillsDb`.
144
- */
145
- function writeSkillsSchemaVersionSentinel(nativeDb) {
146
- try {
147
- nativeDb.exec(`CREATE TABLE IF NOT EXISTS _skills_meta (
148
- key TEXT PRIMARY KEY,
149
- value TEXT NOT NULL,
150
- updated_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now'))
151
- );
152
- INSERT OR REPLACE INTO _skills_meta (key, value, updated_at)
153
- VALUES ('schema_version', '${SKILLS_SCHEMA_VERSION}', strftime('%s', 'now'));`);
154
- }
155
- catch {
156
- // Non-fatal — the next open will simply take the fall-through path.
157
- }
158
- }
159
- /**
160
- * Open (or first-time materialise) `skills.db` and return the Drizzle handle.
161
- *
162
- * Idempotent: repeated calls with the same effective path return the cached
163
- * singleton. Concurrent callers share a single in-flight init promise so
164
- * migrations never race.
106
+ * Open (or first-time materialise) the skills registry and return the Drizzle
107
+ * handle bound to the prefixed `skills_*` tables.
108
+ *
109
+ * E6-L5 (T11525): delegates the physical open to {@link openDualScopeDb}('global')
110
+ * (or {@link openDualScopeDbAtPath} for the test `{ path }` override) — the
111
+ * canonical dual-scope chokepoint — and re-wraps its native handle with the
112
+ * prefix-renamed `skillsSchema` drizzle instance. The consolidated
113
+ * `drizzle-cleo-global` migration creates the `skills_*` tables; this module does
114
+ * NOT run the legacy `drizzle-skills` migration (which would create the
115
+ * signaldock-colliding bare `skills` table). Idempotent: repeated calls with the
116
+ * same effective path return the cached singleton.
165
117
  *
166
118
  * @example
167
119
  * ```typescript
@@ -172,9 +124,10 @@ function writeSkillsSchemaVersionSentinel(nativeDb) {
172
124
  * ```
173
125
  *
174
126
  * @param options - Override the default path (test-only).
175
- * @returns A Drizzle ORM handle bound to the four skills.db tables.
127
+ * @returns A Drizzle ORM handle bound to the four `skills_*` registry tables.
176
128
  *
177
129
  * @task T9651
130
+ * @task T11525
178
131
  */
179
132
  export async function openSkillsDb(options) {
180
133
  // Fast-path: if no explicit override was requested AND a singleton already
@@ -182,7 +135,7 @@ export async function openSkillsDb(options) {
182
135
  // is important for tests that open the DB at a tmpdir via `{path:...}` and
183
136
  // then exercise helpers that call `openSkillsDb()` with no args; without
184
137
  // this guard the helper call would swap the singleton over to the real
185
- // user-home path and leak writes outside the test sandbox.
138
+ // consolidated cleo.db path and leak writes outside the test sandbox.
186
139
  if (_skillsDb && !options?.path)
187
140
  return _skillsDb;
188
141
  const requestedPath = options?.path ?? getDefaultSkillsDbPath();
@@ -190,21 +143,39 @@ export async function openSkillsDb(options) {
190
143
  if (_skillsDb && _skillsDbPath !== requestedPath) {
191
144
  resetSkillsDbState();
192
145
  }
146
+ // Liveness guard (T11525): the skills registry SHARES the consolidated GLOBAL
147
+ // `cleo.db` handle with the nexus / signaldock domains. A sibling may have
148
+ // closed + re-opened the shared handle while our singleton still references the
149
+ // now-closed one. Detect a stale (closed) handle and drop the singleton so we
150
+ // re-derive from the live dual-scope cache below.
151
+ if (_skillsDb && (_skillsNativeDb === null || !_skillsNativeDb.isOpen)) {
152
+ resetSkillsDbState();
153
+ }
193
154
  if (_skillsDb)
194
155
  return _skillsDb;
195
156
  if (_skillsInitPromise)
196
157
  return _skillsInitPromise;
197
158
  _skillsInitPromise = (async () => {
198
159
  _skillsDbPath = requestedPath;
199
- // Ensure the parent directory exists before SQLite tries to create the file.
200
- if (!existsSync(dirname(requestedPath))) {
201
- mkdirSync(dirname(requestedPath), { recursive: true });
160
+ // ── Dual-scope chokepoint delegation (T11525 · E6-L5) ───────────────────
161
+ // openDualScopeDb('global') applies the pragma SSoT, creates the directory,
162
+ // runs the consolidated cleo-global migrations (which create the prefixed
163
+ // `skills_*` tables), and manages the singleton cache. The `{ path }` test
164
+ // override routes through the path-aware sibling against an isolated file.
165
+ const dualHandle = options?.path
166
+ ? await openDualScopeDbAtPath('global', options.path)
167
+ : await openDualScopeDb('global');
168
+ // Extract the underlying DatabaseSync. Drizzle exposes it via `$client`.
169
+ const nativeDb = dualHandle.db.$client ?? null;
170
+ if (!nativeDb) {
171
+ throw new Error('E6-L5: openDualScopeDb returned a handle without $client — ' +
172
+ 'cannot extract DatabaseSync for the skills-schema wrapping.');
202
173
  }
203
- const nativeDb = openNativeDatabase(requestedPath);
204
174
  _skillsNativeDb = nativeDb;
175
+ // Wrap the native handle with the prefix-renamed skills schema so existing
176
+ // callers (skillsSchema.* queries) bind to the consolidated `skills_*`
177
+ // tables the dual-scope migration already created.
205
178
  const db = drizzle({ client: nativeDb, schema: skillsSchema });
206
- runSkillsMigrations(nativeDb, db);
207
- writeSkillsSchemaVersionSentinel(nativeDb);
208
179
  _skillsDb = db;
209
180
  return db;
210
181
  })();
@@ -216,33 +187,48 @@ export async function openSkillsDb(options) {
216
187
  }
217
188
  }
218
189
  /**
219
- * Close the singleton handle and release the underlying native DB.
190
+ * Drop the skills-domain singleton references and trigger the coordinated close
191
+ * of the shared GLOBAL `cleo.db` handle via the dual-scope cache.
192
+ *
193
+ * ## E6-L5 (T11525) — shared-handle close rule
220
194
  *
221
- * Safe to call multiple times. Used by `cleo backup restore skills.db` and
222
- * tests that mkdtemp a fresh location between cases.
195
+ * `_skillsNativeDb` is the SHARED consolidated GLOBAL `cleo.db` handle owned by
196
+ * {@link openDualScopeDb}('global') and co-owned by the nexus / signaldock global
197
+ * domains. This function MUST NOT call `.close()` on it directly — doing so would
198
+ * tear the handle out from under those siblings (the exact bug class L4 fixed at
199
+ * `dual-scope-db.ts`). Instead it evicts the GLOBAL-scope entry from the
200
+ * dual-scope cache (a single coordinated close) and drops the local references.
201
+ *
202
+ * Safe to call multiple times. Used by `cleo backup restore` and tests that
203
+ * mkdtemp a fresh location between cases.
204
+ *
205
+ * @task T9651
206
+ * @task T11525
223
207
  */
224
208
  export function closeSkillsDb() {
225
- if (_skillsNativeDb) {
226
- try {
227
- if (_skillsNativeDb.isOpen) {
228
- _skillsNativeDb.close();
229
- }
230
- }
231
- catch {
232
- // Ignore — the singleton is about to be reset.
233
- }
234
- _skillsNativeDb = null;
235
- }
209
+ // Drop only the local references. The scope-filtered cache reset performs the
210
+ // single coordinated close of the shared GLOBAL handle.
211
+ _skillsNativeDb = null;
236
212
  _skillsDb = null;
237
213
  _skillsDbPath = null;
214
+ _skillsInitPromise = null;
215
+ _resetDualScopeDbCache('global');
238
216
  }
239
217
  /**
240
- * Reset singleton state WITHOUT closing — used between tests to force a
241
- * re-open against a new tmpdir.
218
+ * Reset singleton state — used between tests to force a re-open against a new
219
+ * tmpdir. E6-L5: identical to {@link closeSkillsDb} (both go through the
220
+ * scope-filtered dual-scope cache reset; neither closes the shared handle
221
+ * directly).
222
+ *
223
+ * @task T9651
224
+ * @task T11525
242
225
  */
243
226
  export function resetSkillsDbState() {
244
- closeSkillsDb();
227
+ _skillsNativeDb = null;
228
+ _skillsDb = null;
229
+ _skillsDbPath = null;
245
230
  _skillsInitPromise = null;
231
+ _resetDualScopeDbCache('global');
246
232
  }
247
233
  /**
248
234
  * Return the raw `node:sqlite` handle for the open skills.db (or null if
@@ -1 +1 @@
1
- {"version":3,"file":"skills-db.js","sourceRoot":"","sources":["../../src/store/skills-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAIL,MAAM,IAAI,WAAW,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/D,iDAAiD;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,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MAAM,CAAC,WAAW,CAAC;SACnB,MAAM,CAAC,GAAG,CAAC;SACX,kBAAkB,CAAC;QAClB,MAAM,EAAE,WAAW,CAAC,IAAI;QACxB,GAAG,EAAE,SAAS;KACf,CAAC;SACD,GAAG,EAAE,CAAC;IAET,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,oBAAoB;QACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,CAAC,IAAI,yBAAyB,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,UAA2B,EAC3B,OAA8D;IAE9D,MAAM,EAAE,GAAG,MAAM,YAAY,EAAE,CAAC;IAChC,MAAM,eAAe,GAAG,OAAO,EAAE,cAAc;QAC7C,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC;QACxD,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,SAAS,GAAG,eAAe;QAC/B,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,eAAe,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3C,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;AACxF,CAAC;AAOD,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -46,7 +46,7 @@ import { type DbInventoryEntry, type DbRole } from '@cleocode/contracts';
46
46
  *
47
47
  * - `chokepoint-opener` — role has a canonical opener (`getDb`,
48
48
  * `getBrainDb`, `ensureConduitDb`,
49
- * `getNexusDb`, `ensureGlobalSignaldockDb`,
49
+ * `getNexusDb`, `ensureGlobalAgentRegistryDb`,
50
50
  * `getTelemetryDb`, `openSkillsDb`).
51
51
  * - `raw-file-vacuum-readonly` — role has NO live opener; the file is
52
52
  * opened read-only via a one-shot
@@ -78,7 +78,7 @@ export interface VacuumOptions {
78
78
  *
79
79
  * Debounced by default (30s). Pass `force: true` to bypass debounce. This
80
80
  * function is retained for backward compatibility with existing call sites
81
- * in `data-safety.ts` / `data-safety-central.ts` that only snapshot tasks.db.
81
+ * in `data-safety-central.ts` that only snapshot tasks.db.
82
82
  *
83
83
  * Prefer {@link vacuumIntoBackupAll} for new code — it snapshots every
84
84
  * inventory-registered database and shares the same debounce + rotation