@cleocode/core 2026.10.4 → 2026.10.5

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 (1260) hide show
  1. package/dist/bootstrap.d.ts.map +1 -1
  2. package/dist/bootstrap.js +7 -37
  3. package/dist/bootstrap.js.map +1 -1
  4. package/dist/build-provenance.json +2 -2
  5. package/dist/caamp/adapter.d.ts.map +1 -1
  6. package/dist/caamp/adapter.js +5 -2
  7. package/dist/caamp/adapter.js.map +1 -1
  8. package/dist/changesets/parse-frontmatter.d.ts +1 -1
  9. package/dist/changesets/parse-frontmatter.d.ts.map +1 -1
  10. package/dist/changesets/parse-frontmatter.js +2 -1
  11. package/dist/changesets/parse-frontmatter.js.map +1 -1
  12. package/dist/changesets/parser.d.ts +1 -1
  13. package/dist/changesets/parser.d.ts.map +1 -1
  14. package/dist/changesets/parser.js +2 -1
  15. package/dist/changesets/parser.js.map +1 -1
  16. package/dist/changesets/writer.d.ts +8 -1
  17. package/dist/changesets/writer.d.ts.map +1 -1
  18. package/dist/changesets/writer.js +56 -5
  19. package/dist/changesets/writer.js.map +1 -1
  20. package/dist/cloud/keys.d.ts +9 -0
  21. package/dist/cloud/keys.d.ts.map +1 -1
  22. package/dist/cloud/keys.js +11 -0
  23. package/dist/cloud/keys.js.map +1 -1
  24. package/dist/cloud/nexus-attach.d.ts +17 -0
  25. package/dist/cloud/nexus-attach.d.ts.map +1 -1
  26. package/dist/cloud/nexus-attach.js +30 -9
  27. package/dist/cloud/nexus-attach.js.map +1 -1
  28. package/dist/cloud/nexus-auth.d.ts +7 -1
  29. package/dist/cloud/nexus-auth.d.ts.map +1 -1
  30. package/dist/cloud/nexus-auth.js +7 -1
  31. package/dist/cloud/nexus-auth.js.map +1 -1
  32. package/dist/cloud/nexus-cloud-activity.d.ts.map +1 -1
  33. package/dist/cloud/nexus-cloud-activity.js +2 -1
  34. package/dist/cloud/nexus-cloud-activity.js.map +1 -1
  35. package/dist/cloud/nexus-cloud-conflicts.d.ts +48 -0
  36. package/dist/cloud/nexus-cloud-conflicts.d.ts.map +1 -0
  37. package/dist/cloud/nexus-cloud-conflicts.js +68 -0
  38. package/dist/cloud/nexus-cloud-conflicts.js.map +1 -0
  39. package/dist/cloud/nexus-cloud-status.d.ts +42 -6
  40. package/dist/cloud/nexus-cloud-status.d.ts.map +1 -1
  41. package/dist/cloud/nexus-cloud-status.js +233 -19
  42. package/dist/cloud/nexus-cloud-status.js.map +1 -1
  43. package/dist/cloud/nexus-cloud.d.ts +18 -1
  44. package/dist/cloud/nexus-cloud.d.ts.map +1 -1
  45. package/dist/cloud/nexus-cloud.js +56 -2
  46. package/dist/cloud/nexus-cloud.js.map +1 -1
  47. package/dist/cloud/nexus-credentials.d.ts +1 -1
  48. package/dist/cloud/nexus-credentials.d.ts.map +1 -1
  49. package/dist/cloud/nexus-credentials.js +1 -1
  50. package/dist/cloud/nexus-credentials.js.map +1 -1
  51. package/dist/cloud/nexus-enrol.d.ts +1 -1
  52. package/dist/cloud/nexus-enrol.d.ts.map +1 -1
  53. package/dist/cloud/nexus-enrol.js +2 -1
  54. package/dist/cloud/nexus-enrol.js.map +1 -1
  55. package/dist/cloud/nexus-first-run.d.ts +6 -2
  56. package/dist/cloud/nexus-first-run.d.ts.map +1 -1
  57. package/dist/cloud/nexus-first-run.js +8 -2
  58. package/dist/cloud/nexus-first-run.js.map +1 -1
  59. package/dist/cloud/nexus-link.d.ts +35 -4
  60. package/dist/cloud/nexus-link.d.ts.map +1 -1
  61. package/dist/cloud/nexus-link.js +172 -7
  62. package/dist/cloud/nexus-link.js.map +1 -1
  63. package/dist/cloud/nexus-presence-refresh.d.ts +65 -0
  64. package/dist/cloud/nexus-presence-refresh.d.ts.map +1 -0
  65. package/dist/cloud/nexus-presence-refresh.js +122 -0
  66. package/dist/cloud/nexus-presence-refresh.js.map +1 -0
  67. package/dist/cloud/nexus-project-history.d.ts +54 -0
  68. package/dist/cloud/nexus-project-history.d.ts.map +1 -0
  69. package/dist/cloud/nexus-project-history.js +108 -0
  70. package/dist/cloud/nexus-project-history.js.map +1 -0
  71. package/dist/cloud/nexus-vault-keys.d.ts.map +1 -1
  72. package/dist/cloud/nexus-vault-keys.js +12 -6
  73. package/dist/cloud/nexus-vault-keys.js.map +1 -1
  74. package/dist/cloud/nexus-vault.d.ts +7 -3
  75. package/dist/cloud/nexus-vault.d.ts.map +1 -1
  76. package/dist/cloud/nexus-vault.js +176 -29
  77. package/dist/cloud/nexus-vault.js.map +1 -1
  78. package/dist/cloud/presence.d.ts +1 -1
  79. package/dist/cloud/presence.d.ts.map +1 -1
  80. package/dist/cloud/presence.js +1 -1
  81. package/dist/cloud/presence.js.map +1 -1
  82. package/dist/cloud/projects.d.ts +7 -4
  83. package/dist/cloud/projects.d.ts.map +1 -1
  84. package/dist/cloud/projects.js +10 -1
  85. package/dist/cloud/projects.js.map +1 -1
  86. package/dist/cloud/signing.d.ts +14 -0
  87. package/dist/cloud/signing.d.ts.map +1 -1
  88. package/dist/cloud/signing.js +9 -0
  89. package/dist/cloud/signing.js.map +1 -1
  90. package/dist/conduit/cloud-endpoint.d.ts +96 -0
  91. package/dist/conduit/cloud-endpoint.d.ts.map +1 -0
  92. package/dist/conduit/cloud-endpoint.js +191 -0
  93. package/dist/conduit/cloud-endpoint.js.map +1 -0
  94. package/dist/conduit/conduit-client.d.ts.map +1 -1
  95. package/dist/conduit/conduit-client.js +2 -1
  96. package/dist/conduit/conduit-client.js.map +1 -1
  97. package/dist/conduit/factory.d.ts +4 -0
  98. package/dist/conduit/factory.d.ts.map +1 -1
  99. package/dist/conduit/factory.js +7 -1
  100. package/dist/conduit/factory.js.map +1 -1
  101. package/dist/conduit/http-transport.d.ts +12 -7
  102. package/dist/conduit/http-transport.d.ts.map +1 -1
  103. package/dist/conduit/http-transport.js +18 -11
  104. package/dist/conduit/http-transport.js.map +1 -1
  105. package/dist/conduit/index.d.ts +3 -1
  106. package/dist/conduit/index.d.ts.map +1 -1
  107. package/dist/conduit/index.js +3 -1
  108. package/dist/conduit/index.js.map +1 -1
  109. package/dist/conduit/sse-transport.d.ts +5 -1
  110. package/dist/conduit/sse-transport.d.ts.map +1 -1
  111. package/dist/conduit/sse-transport.js +10 -2
  112. package/dist/conduit/sse-transport.js.map +1 -1
  113. package/dist/config/registry.js +1 -1
  114. package/dist/config/registry.js.map +1 -1
  115. package/dist/core-paths.d.ts +13 -0
  116. package/dist/core-paths.d.ts.map +1 -0
  117. package/dist/core-paths.js +13 -0
  118. package/dist/core-paths.js.map +1 -0
  119. package/dist/decide/bench/source.js +1 -1
  120. package/dist/decide/bench/source.js.map +1 -1
  121. package/dist/decide/client.d.ts +1 -1
  122. package/dist/decide/client.d.ts.map +1 -1
  123. package/dist/decide/client.js +1 -1
  124. package/dist/decide/client.js.map +1 -1
  125. package/dist/decide/credentials.d.ts +1 -1
  126. package/dist/decide/credentials.d.ts.map +1 -1
  127. package/dist/decide/credentials.js +1 -1
  128. package/dist/decide/credentials.js.map +1 -1
  129. package/dist/decide/jev-wire.d.ts +1 -1
  130. package/dist/decide/jev-wire.d.ts.map +1 -1
  131. package/dist/decide/jev-wire.js +1 -1
  132. package/dist/decide/jev-wire.js.map +1 -1
  133. package/dist/decide/operations.d.ts +1 -1
  134. package/dist/decide/operations.d.ts.map +1 -1
  135. package/dist/decide/operations.js +1 -1
  136. package/dist/decide/operations.js.map +1 -1
  137. package/dist/decide/providers.d.ts +1 -1
  138. package/dist/decide/providers.d.ts.map +1 -1
  139. package/dist/decide/providers.js +1 -1
  140. package/dist/decide/providers.js.map +1 -1
  141. package/dist/decide/wizard.d.ts.map +1 -1
  142. package/dist/decide/wizard.js +1 -1
  143. package/dist/decide/wizard.js.map +1 -1
  144. package/dist/dispatch/config-domain-handler.d.ts +1 -1
  145. package/dist/dispatch/config-domain-handler.d.ts.map +1 -1
  146. package/dist/dispatch/config-domain-handler.js +1 -1
  147. package/dist/dispatch/config-domain-handler.js.map +1 -1
  148. package/dist/dispatch/contracts/ensures-schema.d.ts +1 -1
  149. package/dist/dispatch/contracts/ensures-schema.d.ts.map +1 -1
  150. package/dist/dispatch/contracts/ensures-schema.js +1 -1
  151. package/dist/dispatch/contracts/ensures-schema.js.map +1 -1
  152. package/dist/dispatch/contracts/input-contracts.d.ts +1 -1
  153. package/dist/dispatch/contracts/input-contracts.d.ts.map +1 -1
  154. package/dist/dispatch/contracts/input-contracts.js +3 -1
  155. package/dist/dispatch/contracts/input-contracts.js.map +1 -1
  156. package/dist/dispatch/describe-operation.d.ts +1 -1
  157. package/dist/dispatch/describe-operation.d.ts.map +1 -1
  158. package/dist/dispatch/describe-operation.js +1 -1
  159. package/dist/dispatch/describe-operation.js.map +1 -1
  160. package/dist/docs/display-alias.js +1 -1
  161. package/dist/docs/display-alias.js.map +1 -1
  162. package/dist/docs/docs-update.d.ts +1 -1
  163. package/dist/docs/docs-update.d.ts.map +1 -1
  164. package/dist/docs/docs-update.js +2 -1
  165. package/dist/docs/docs-update.js.map +1 -1
  166. package/dist/docs/export-document.js +14 -58300
  167. package/dist/docs/export-document.js.map +3 -3
  168. package/dist/docs/publish-pr.js +1 -1
  169. package/dist/docs/publish-pr.js.map +1 -1
  170. package/dist/docs/supersede.js +1 -1
  171. package/dist/docs/supersede.js.map +1 -1
  172. package/dist/docs/validate-body.d.ts +1 -1
  173. package/dist/docs/validate-body.d.ts.map +1 -1
  174. package/dist/docs/validate-body.js +1 -1
  175. package/dist/docs/validate-body.js.map +1 -1
  176. package/dist/docs/writer-registry.js +1 -1
  177. package/dist/docs/writer-registry.js.map +1 -1
  178. package/dist/doctor/acceptance-drift.js +1 -1
  179. package/dist/doctor/acceptance-drift.js.map +1 -1
  180. package/dist/doctor/db-substrate.d.ts +1 -1
  181. package/dist/doctor/db-substrate.d.ts.map +1 -1
  182. package/dist/doctor/db-substrate.js +1 -1
  183. package/dist/doctor/db-substrate.js.map +1 -1
  184. package/dist/doctor/invariant-audit.js +1 -1
  185. package/dist/doctor/invariant-audit.js.map +1 -1
  186. package/dist/doctor/malformed-task-ids.js +1 -1
  187. package/dist/doctor/malformed-task-ids.js.map +1 -1
  188. package/dist/doctor/row-identity-refill.d.ts +43 -0
  189. package/dist/doctor/row-identity-refill.d.ts.map +1 -0
  190. package/dist/doctor/row-identity-refill.js +186 -0
  191. package/dist/doctor/row-identity-refill.js.map +1 -0
  192. package/dist/doctor/superseded-store.d.ts.map +1 -1
  193. package/dist/doctor/superseded-store.js +51 -2
  194. package/dist/doctor/superseded-store.js.map +1 -1
  195. package/dist/doctor/sync-repair.d.ts +39 -0
  196. package/dist/doctor/sync-repair.d.ts.map +1 -0
  197. package/dist/doctor/sync-repair.js +71 -0
  198. package/dist/doctor/sync-repair.js.map +1 -0
  199. package/dist/doctor/sync-triggers.d.ts +63 -4
  200. package/dist/doctor/sync-triggers.d.ts.map +1 -1
  201. package/dist/doctor/sync-triggers.js +352 -9
  202. package/dist/doctor/sync-triggers.js.map +1 -1
  203. package/dist/doctor/twin-collapse.js +1 -1
  204. package/dist/doctor/twin-collapse.js.map +1 -1
  205. package/dist/engine/engine-ops.d.ts.map +1 -1
  206. package/dist/engine/engine-ops.js +7 -1
  207. package/dist/engine/engine-ops.js.map +1 -1
  208. package/dist/engine-result.d.ts +1 -1
  209. package/dist/engine-result.d.ts.map +1 -1
  210. package/dist/engine-result.js +1 -1
  211. package/dist/engine-result.js.map +1 -1
  212. package/dist/error-registry.d.ts +1 -1
  213. package/dist/error-registry.d.ts.map +1 -1
  214. package/dist/error-registry.js +1 -1
  215. package/dist/error-registry.js.map +1 -1
  216. package/dist/errors-to-engine.d.ts +20 -0
  217. package/dist/errors-to-engine.d.ts.map +1 -1
  218. package/dist/errors-to-engine.js +37 -0
  219. package/dist/errors-to-engine.js.map +1 -1
  220. package/dist/gc/janitor.d.ts +23 -4
  221. package/dist/gc/janitor.d.ts.map +1 -1
  222. package/dist/gc/janitor.js +71 -11
  223. package/dist/gc/janitor.js.map +1 -1
  224. package/dist/goal/continuation.d.ts +1 -1
  225. package/dist/goal/continuation.d.ts.map +1 -1
  226. package/dist/goal/continuation.js +1 -1
  227. package/dist/goal/continuation.js.map +1 -1
  228. package/dist/goal/judge.d.ts.map +1 -1
  229. package/dist/goal/judge.js +2 -1
  230. package/dist/goal/judge.js.map +1 -1
  231. package/dist/hooks/handlers/session-hooks.d.ts.map +1 -1
  232. package/dist/hooks/handlers/session-hooks.js +1 -1
  233. package/dist/hooks/handlers/session-hooks.js.map +1 -1
  234. package/dist/init/engine-ops.js +1 -1
  235. package/dist/init/engine-ops.js.map +1 -1
  236. package/dist/init.d.ts.map +1 -1
  237. package/dist/init.js +10 -41
  238. package/dist/init.js.map +1 -1
  239. package/dist/inject/index.js +1 -1
  240. package/dist/inject/index.js.map +1 -1
  241. package/dist/injection.d.ts.map +1 -1
  242. package/dist/injection.js +13 -0
  243. package/dist/injection.js.map +1 -1
  244. package/dist/internal.d.ts +4 -3
  245. package/dist/internal.d.ts.map +1 -1
  246. package/dist/internal.js +7 -4
  247. package/dist/internal.js.map +1 -1
  248. package/dist/issue/create.js +1 -1
  249. package/dist/issue/create.js.map +1 -1
  250. package/dist/json-schema-validator.js +1 -1
  251. package/dist/json-schema-validator.js.map +1 -1
  252. package/dist/lifecycle/index.d.ts +2 -23
  253. package/dist/lifecycle/index.d.ts.map +1 -1
  254. package/dist/lifecycle/index.js +5 -112
  255. package/dist/lifecycle/index.js.map +1 -1
  256. package/dist/lifecycle/kind-requirements.d.ts +1 -1
  257. package/dist/lifecycle/kind-requirements.d.ts.map +1 -1
  258. package/dist/lifecycle/kind-requirements.js +1 -1
  259. package/dist/lifecycle/kind-requirements.js.map +1 -1
  260. package/dist/lifecycle/pipeline.js +1 -1
  261. package/dist/lifecycle/pipeline.js.map +1 -1
  262. package/dist/lifecycle/resume.js +2 -2
  263. package/dist/lifecycle/resume.js.map +1 -1
  264. package/dist/lifecycle/state-machine.js +1 -1
  265. package/dist/lifecycle/state-machine.js.map +1 -1
  266. package/dist/lifecycle/status.d.ts +46 -0
  267. package/dist/lifecycle/status.d.ts.map +1 -0
  268. package/dist/lifecycle/status.js +147 -0
  269. package/dist/lifecycle/status.js.map +1 -0
  270. package/dist/lifecycle/verification/satisfies-validator.js +1 -1
  271. package/dist/lifecycle/verification/satisfies-validator.js.map +1 -1
  272. package/dist/llm/catalog-seeder.d.ts +1 -1
  273. package/dist/llm/catalog-seeder.d.ts.map +1 -1
  274. package/dist/llm/catalog-seeder.js +1 -1
  275. package/dist/llm/catalog-seeder.js.map +1 -1
  276. package/dist/llm/cli-ops.d.ts +1 -2
  277. package/dist/llm/cli-ops.d.ts.map +1 -1
  278. package/dist/llm/cli-ops.js +2 -1
  279. package/dist/llm/cli-ops.js.map +1 -1
  280. package/dist/llm/credential-seeders/claude-code-seeder.js +1 -1
  281. package/dist/llm/credential-seeders/claude-code-seeder.js.map +1 -1
  282. package/dist/llm/credential-seeders/cleo-pkce-seeder.js +1 -1
  283. package/dist/llm/credential-seeders/cleo-pkce-seeder.js.map +1 -1
  284. package/dist/llm/credential-writeback.js +1 -1
  285. package/dist/llm/credential-writeback.js.map +1 -1
  286. package/dist/llm/entity-ops.d.ts +1 -1
  287. package/dist/llm/entity-ops.d.ts.map +1 -1
  288. package/dist/llm/entity-ops.js +2 -1
  289. package/dist/llm/entity-ops.js.map +1 -1
  290. package/dist/llm/llm-queue-admit.d.ts +1 -1
  291. package/dist/llm/llm-queue-admit.d.ts.map +1 -1
  292. package/dist/llm/llm-queue-admit.js +2 -1
  293. package/dist/llm/llm-queue-admit.js.map +1 -1
  294. package/dist/llm/onboarding/login-engine.js +1 -1
  295. package/dist/llm/onboarding/login-engine.js.map +1 -1
  296. package/dist/llm/pi/pi-errors.d.ts +1 -1
  297. package/dist/llm/pi/pi-errors.d.ts.map +1 -1
  298. package/dist/llm/pi/pi-errors.js +1 -1
  299. package/dist/llm/pi/pi-errors.js.map +1 -1
  300. package/dist/llm/plugin-facade.d.ts.map +1 -1
  301. package/dist/llm/plugin-facade.js +14 -93552
  302. package/dist/llm/plugin-facade.js.map +3 -3
  303. package/dist/llm/system-key.d.ts +1 -1
  304. package/dist/llm/system-key.d.ts.map +1 -1
  305. package/dist/llm/system-key.js +1 -1
  306. package/dist/llm/system-key.js.map +1 -1
  307. package/dist/llm/system-of-use-registry.d.ts +1 -1
  308. package/dist/llm/system-of-use-registry.d.ts.map +1 -1
  309. package/dist/llm/system-of-use-registry.js +1 -1
  310. package/dist/llm/system-of-use-registry.js.map +1 -1
  311. package/dist/llm/system-resolver.js +1 -1
  312. package/dist/llm/system-resolver.js.map +1 -1
  313. package/dist/memory/brain-host.d.ts +71 -0
  314. package/dist/memory/brain-host.d.ts.map +1 -0
  315. package/dist/memory/brain-host.js +84 -0
  316. package/dist/memory/brain-host.js.map +1 -0
  317. package/dist/memory/brain-writer-handlers.d.ts.map +1 -1
  318. package/dist/memory/brain-writer-handlers.js +24 -7
  319. package/dist/memory/brain-writer-handlers.js.map +1 -1
  320. package/dist/memory/brain-writer-thread.d.ts +66 -6
  321. package/dist/memory/brain-writer-thread.d.ts.map +1 -1
  322. package/dist/memory/brain-writer-thread.js +67 -10
  323. package/dist/memory/brain-writer-thread.js.map +1 -1
  324. package/dist/memory/brain-writer-worker.js +7 -0
  325. package/dist/memory/brain-writer-worker.js.map +1 -1
  326. package/dist/memory/decisions.js +2 -1
  327. package/dist/memory/decisions.js.map +1 -1
  328. package/dist/memory/embedding-backfill.d.ts +70 -0
  329. package/dist/memory/embedding-backfill.d.ts.map +1 -0
  330. package/dist/memory/embedding-backfill.js +110 -0
  331. package/dist/memory/embedding-backfill.js.map +1 -0
  332. package/dist/memory/index.js +1 -1
  333. package/dist/memory/index.js.map +1 -1
  334. package/dist/memory/manifest-identity.js +1 -1
  335. package/dist/memory/manifest-identity.js.map +1 -1
  336. package/dist/memory/retrieval/observe.d.ts +23 -0
  337. package/dist/memory/retrieval/observe.d.ts.map +1 -1
  338. package/dist/memory/retrieval/observe.js +82 -36
  339. package/dist/memory/retrieval/observe.js.map +1 -1
  340. package/dist/metrics/model-provider-registry.d.ts.map +1 -1
  341. package/dist/metrics/model-provider-registry.js +6 -0
  342. package/dist/metrics/model-provider-registry.js.map +1 -1
  343. package/dist/metrics/token-service.d.ts +17 -0
  344. package/dist/metrics/token-service.d.ts.map +1 -1
  345. package/dist/metrics/token-service.js +17 -0
  346. package/dist/metrics/token-service.js.map +1 -1
  347. package/dist/migration/index.js +1 -1
  348. package/dist/migration/index.js.map +1 -1
  349. package/dist/migration/manual/T10165-backfill-adr-index.js +1 -1
  350. package/dist/migration/manual/T10165-backfill-adr-index.js.map +1 -1
  351. package/dist/nexus/assessment-projection.d.ts +1 -1
  352. package/dist/nexus/assessment-projection.d.ts.map +1 -1
  353. package/dist/nexus/assessment-projection.js +1 -1
  354. package/dist/nexus/assessment-projection.js.map +1 -1
  355. package/dist/nexus/deps.d.ts +1 -1
  356. package/dist/nexus/deps.d.ts.map +1 -1
  357. package/dist/nexus/deps.js +1 -1
  358. package/dist/nexus/deps.js.map +1 -1
  359. package/dist/nexus/fleet-status.d.ts +1 -1
  360. package/dist/nexus/fleet-status.d.ts.map +1 -1
  361. package/dist/nexus/fleet-status.js +1 -1
  362. package/dist/nexus/fleet-status.js.map +1 -1
  363. package/dist/nexus/identity.js +1 -1
  364. package/dist/nexus/identity.js.map +1 -1
  365. package/dist/nexus/permissions.d.ts +1 -1
  366. package/dist/nexus/permissions.d.ts.map +1 -1
  367. package/dist/nexus/permissions.js +1 -1
  368. package/dist/nexus/permissions.js.map +1 -1
  369. package/dist/nexus/query-dsl.js +1 -1
  370. package/dist/nexus/query-dsl.js.map +1 -1
  371. package/dist/nexus/query.d.ts +1 -2
  372. package/dist/nexus/query.d.ts.map +1 -1
  373. package/dist/nexus/query.js +1 -1
  374. package/dist/nexus/query.js.map +1 -1
  375. package/dist/nexus/registry-errors.js +1 -1
  376. package/dist/nexus/registry-errors.js.map +1 -1
  377. package/dist/nexus/registry.d.ts +1 -1
  378. package/dist/nexus/registry.d.ts.map +1 -1
  379. package/dist/nexus/registry.js +1 -1
  380. package/dist/nexus/registry.js.map +1 -1
  381. package/dist/nexus/workspace.js +1 -1
  382. package/dist/nexus/workspace.js.map +1 -1
  383. package/dist/orchestrate/pivot.d.ts.map +1 -1
  384. package/dist/orchestrate/pivot.js +2 -1
  385. package/dist/orchestrate/pivot.js.map +1 -1
  386. package/dist/orchestrate/query-ops.js +1 -1
  387. package/dist/orchestrate/query-ops.js.map +1 -1
  388. package/dist/orchestrate/spawn-ops.js +1 -1
  389. package/dist/orchestrate/spawn-ops.js.map +1 -1
  390. package/dist/orchestration/atomicity.d.ts +1 -1
  391. package/dist/orchestration/atomicity.d.ts.map +1 -1
  392. package/dist/orchestration/atomicity.js +1 -1
  393. package/dist/orchestration/atomicity.js.map +1 -1
  394. package/dist/orchestration/classify.js +1 -1
  395. package/dist/orchestration/classify.js.map +1 -1
  396. package/dist/orchestration/index.js +1 -1
  397. package/dist/orchestration/index.js.map +1 -1
  398. package/dist/orchestration/parallel.js +1 -1
  399. package/dist/orchestration/parallel.js.map +1 -1
  400. package/dist/orchestration/protocol-validators.d.ts +1 -1
  401. package/dist/orchestration/protocol-validators.d.ts.map +1 -1
  402. package/dist/orchestration/protocol-validators.js +1 -1
  403. package/dist/orchestration/protocol-validators.js.map +1 -1
  404. package/dist/orchestration/skill-ops.js +1 -1
  405. package/dist/orchestration/skill-ops.js.map +1 -1
  406. package/dist/orchestration/spawn-prompt.d.ts +9 -0
  407. package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
  408. package/dist/orchestration/spawn-prompt.js +13 -2
  409. package/dist/orchestration/spawn-prompt.js.map +1 -1
  410. package/dist/orchestration/spawn.js +1 -1
  411. package/dist/orchestration/spawn.js.map +1 -1
  412. package/dist/paths.d.ts +3 -1
  413. package/dist/paths.d.ts.map +1 -1
  414. package/dist/paths.js +3 -1
  415. package/dist/paths.js.map +1 -1
  416. package/dist/phases/deps.js +1 -1
  417. package/dist/phases/deps.js.map +1 -1
  418. package/dist/phases/index.js +1 -1
  419. package/dist/phases/index.js.map +1 -1
  420. package/dist/project-lifecycle.js +3 -3
  421. package/dist/project-lifecycle.js.map +1 -1
  422. package/dist/registrations.d.ts +30 -0
  423. package/dist/registrations.d.ts.map +1 -0
  424. package/dist/registrations.js +30 -0
  425. package/dist/registrations.js.map +1 -0
  426. package/dist/release/changesets-aggregator.js +1 -1
  427. package/dist/release/changesets-aggregator.js.map +1 -1
  428. package/dist/release/ci-evidence.d.ts +68 -2
  429. package/dist/release/ci-evidence.d.ts.map +1 -1
  430. package/dist/release/ci-evidence.js +203 -39
  431. package/dist/release/ci-evidence.js.map +1 -1
  432. package/dist/release/invariants/archive-reason-invariant.d.ts +1 -1
  433. package/dist/release/invariants/archive-reason-invariant.d.ts.map +1 -1
  434. package/dist/release/invariants/archive-reason-invariant.js +1 -1
  435. package/dist/release/invariants/archive-reason-invariant.js.map +1 -1
  436. package/dist/release/invariants/registry.d.ts +1 -1
  437. package/dist/release/invariants/registry.d.ts.map +1 -1
  438. package/dist/release/invariants/registry.js +1 -1
  439. package/dist/release/invariants/registry.js.map +1 -1
  440. package/dist/release/open.d.ts +1 -1
  441. package/dist/release/open.d.ts.map +1 -1
  442. package/dist/release/open.js +3 -1
  443. package/dist/release/open.js.map +1 -1
  444. package/dist/release/plan.d.ts +1 -2
  445. package/dist/release/plan.d.ts.map +1 -1
  446. package/dist/release/plan.js +4 -1
  447. package/dist/release/plan.js.map +1 -1
  448. package/dist/release/pr-evidence.d.ts +1 -1
  449. package/dist/release/pr-evidence.d.ts.map +1 -1
  450. package/dist/release/pr-evidence.js +2 -2
  451. package/dist/release/pr-evidence.js.map +1 -1
  452. package/dist/release/preflight-skip.d.ts +5 -0
  453. package/dist/release/preflight-skip.d.ts.map +1 -1
  454. package/dist/release/preflight-skip.js +60 -1
  455. package/dist/release/preflight-skip.js.map +1 -1
  456. package/dist/release/reconcile.d.ts +1 -1
  457. package/dist/release/reconcile.d.ts.map +1 -1
  458. package/dist/release/reconcile.js +19 -3
  459. package/dist/release/reconcile.js.map +1 -1
  460. package/dist/release/version-bump.d.ts +1 -1
  461. package/dist/release/version-bump.d.ts.map +1 -1
  462. package/dist/release/version-bump.js +1 -1
  463. package/dist/release/version-bump.js.map +1 -1
  464. package/dist/resources/admission-ledger.d.ts +587 -0
  465. package/dist/resources/admission-ledger.d.ts.map +1 -0
  466. package/dist/resources/admission-ledger.js +1401 -0
  467. package/dist/resources/admission-ledger.js.map +1 -0
  468. package/dist/resources/backend.d.ts +37 -1
  469. package/dist/resources/backend.d.ts.map +1 -1
  470. package/dist/resources/backend.js +1 -1
  471. package/dist/resources/darwin-backend.d.ts +152 -26
  472. package/dist/resources/darwin-backend.d.ts.map +1 -1
  473. package/dist/resources/darwin-backend.js +217 -34
  474. package/dist/resources/darwin-backend.js.map +1 -1
  475. package/dist/resources/governor.d.ts +36 -39
  476. package/dist/resources/governor.d.ts.map +1 -1
  477. package/dist/resources/governor.js +140 -49
  478. package/dist/resources/governor.js.map +1 -1
  479. package/dist/resources/pressure-gate.d.ts +148 -0
  480. package/dist/resources/pressure-gate.d.ts.map +1 -0
  481. package/dist/resources/pressure-gate.js +273 -0
  482. package/dist/resources/pressure-gate.js.map +1 -0
  483. package/dist/resources/run-admission.d.ts +33 -45
  484. package/dist/resources/run-admission.d.ts.map +1 -1
  485. package/dist/resources/run-admission.js +50 -118
  486. package/dist/resources/run-admission.js.map +1 -1
  487. package/dist/resources/run-class.d.ts +60 -4
  488. package/dist/resources/run-class.d.ts.map +1 -1
  489. package/dist/resources/run-class.js +473 -6
  490. package/dist/resources/run-class.js.map +1 -1
  491. package/dist/resources/run-governed.d.ts +43 -11
  492. package/dist/resources/run-governed.d.ts.map +1 -1
  493. package/dist/resources/run-governed.js +139 -99
  494. package/dist/resources/run-governed.js.map +1 -1
  495. package/dist/resources/slot-holder.d.ts +12 -4
  496. package/dist/resources/slot-holder.d.ts.map +1 -1
  497. package/dist/resources/slot-holder.js +19 -14
  498. package/dist/resources/slot-holder.js.map +1 -1
  499. package/dist/resources/spawn-wrapper.js +1 -1
  500. package/dist/resources/spawn-wrapper.js.map +1 -1
  501. package/dist/resources/supervisor-admit.d.ts +1 -1
  502. package/dist/resources/supervisor-admit.d.ts.map +1 -1
  503. package/dist/resources/supervisor-admit.js +2 -1
  504. package/dist/resources/supervisor-admit.js.map +1 -1
  505. package/dist/runtime/openapi/generate-openapi.d.ts +1 -1
  506. package/dist/runtime/openapi/generate-openapi.d.ts.map +1 -1
  507. package/dist/runtime/openapi/generate-openapi.js +1 -1
  508. package/dist/runtime/openapi/generate-openapi.js.map +1 -1
  509. package/dist/sagas/index.d.ts +3 -1
  510. package/dist/sagas/index.d.ts.map +1 -1
  511. package/dist/sagas/index.js +2 -5
  512. package/dist/sagas/index.js.map +1 -1
  513. package/dist/scaffold/project-identity.js +1 -1
  514. package/dist/scaffold/project-identity.js.map +1 -1
  515. package/dist/sdk/validator-attest.d.ts +1 -1
  516. package/dist/sdk/validator-attest.d.ts.map +1 -1
  517. package/dist/sdk/validator-attest.js +1 -1
  518. package/dist/sdk/validator-attest.js.map +1 -1
  519. package/dist/sdk/validator-reject.d.ts +1 -1
  520. package/dist/sdk/validator-reject.d.ts.map +1 -1
  521. package/dist/sdk/validator-reject.js +1 -1
  522. package/dist/sdk/validator-reject.js.map +1 -1
  523. package/dist/security/input-sanitization.js +2 -1
  524. package/dist/security/input-sanitization.js.map +1 -1
  525. package/dist/security/override-cap.js +1 -1
  526. package/dist/security/override-cap.js.map +1 -1
  527. package/dist/security/owner-override-auth.js +1 -1
  528. package/dist/security/owner-override-auth.js.map +1 -1
  529. package/dist/security/shared-evidence-tracker.js +1 -1
  530. package/dist/security/shared-evidence-tracker.js.map +1 -1
  531. package/dist/selfimprove/fix-gen.js +35 -93037
  532. package/dist/selfimprove/fix-gen.js.map +3 -3
  533. package/dist/sentient/daemon.d.ts.map +1 -1
  534. package/dist/sentient/daemon.js +3 -0
  535. package/dist/sentient/daemon.js.map +1 -1
  536. package/dist/sentient/tick.d.ts +7 -0
  537. package/dist/sentient/tick.d.ts.map +1 -1
  538. package/dist/sentient/tick.js +11 -0
  539. package/dist/sentient/tick.js.map +1 -1
  540. package/dist/sequence/index.js +1 -1
  541. package/dist/sequence/index.js.map +1 -1
  542. package/dist/session/engine-ops.d.ts +3 -45
  543. package/dist/session/engine-ops.d.ts.map +1 -1
  544. package/dist/session/engine-ops.js +63 -112
  545. package/dist/session/engine-ops.js.map +1 -1
  546. package/dist/session/status-op.d.ts +40 -0
  547. package/dist/session/status-op.d.ts.map +1 -0
  548. package/dist/session/status-op.js +71 -0
  549. package/dist/session/status-op.js.map +1 -0
  550. package/dist/session/task-current.d.ts +31 -0
  551. package/dist/session/task-current.d.ts.map +1 -0
  552. package/dist/session/task-current.js +59 -0
  553. package/dist/session/task-current.js.map +1 -0
  554. package/dist/sessions/assumptions.d.ts +1 -1
  555. package/dist/sessions/assumptions.d.ts.map +1 -1
  556. package/dist/sessions/assumptions.js +1 -1
  557. package/dist/sessions/assumptions.js.map +1 -1
  558. package/dist/sessions/context-inject.js +1 -1
  559. package/dist/sessions/context-inject.js.map +1 -1
  560. package/dist/sessions/decisions.d.ts +1 -1
  561. package/dist/sessions/decisions.d.ts.map +1 -1
  562. package/dist/sessions/decisions.js +1 -1
  563. package/dist/sessions/decisions.js.map +1 -1
  564. package/dist/sessions/focus-state-store.d.ts.map +1 -1
  565. package/dist/sessions/focus-state-store.js +2 -1
  566. package/dist/sessions/focus-state-store.js.map +1 -1
  567. package/dist/sessions/handoff.js +1 -1
  568. package/dist/sessions/handoff.js.map +1 -1
  569. package/dist/sessions/index.d.ts +1 -2
  570. package/dist/sessions/index.d.ts.map +1 -1
  571. package/dist/sessions/index.js +3 -2
  572. package/dist/sessions/index.js.map +1 -1
  573. package/dist/sessions/session-drift.js +1 -1
  574. package/dist/sessions/session-drift.js.map +1 -1
  575. package/dist/sessions/session-end-snapshot-entry.d.ts +4 -0
  576. package/dist/sessions/session-end-snapshot-entry.d.ts.map +1 -1
  577. package/dist/sessions/session-end-snapshot-entry.js +11 -0
  578. package/dist/sessions/session-end-snapshot-entry.js.map +1 -1
  579. package/dist/sessions/session-end-snapshot.d.ts.map +1 -1
  580. package/dist/sessions/session-end-snapshot.js +4 -0
  581. package/dist/sessions/session-end-snapshot.js.map +1 -1
  582. package/dist/sessions/session-enforcement.js +1 -1
  583. package/dist/sessions/session-enforcement.js.map +1 -1
  584. package/dist/sessions/session-show.d.ts +1 -2
  585. package/dist/sessions/session-show.d.ts.map +1 -1
  586. package/dist/sessions/session-show.js +1 -1
  587. package/dist/sessions/session-show.js.map +1 -1
  588. package/dist/sessions/session-stats.js +1 -1
  589. package/dist/sessions/session-stats.js.map +1 -1
  590. package/dist/sessions/session-suspend.d.ts +1 -2
  591. package/dist/sessions/session-suspend.d.ts.map +1 -1
  592. package/dist/sessions/session-suspend.js +1 -1
  593. package/dist/sessions/session-suspend.js.map +1 -1
  594. package/dist/sessions/session-switch.js +1 -1
  595. package/dist/sessions/session-switch.js.map +1 -1
  596. package/dist/sessions/snapshot.js +1 -1
  597. package/dist/sessions/snapshot.js.map +1 -1
  598. package/dist/sessions/terminal-identity.d.ts +1 -1
  599. package/dist/sessions/terminal-identity.d.ts.map +1 -1
  600. package/dist/sessions/terminal-identity.js +1 -1
  601. package/dist/sessions/terminal-identity.js.map +1 -1
  602. package/dist/setup/sections/integrations.d.ts.map +1 -1
  603. package/dist/setup/sections/integrations.js +9 -0
  604. package/dist/setup/sections/integrations.js.map +1 -1
  605. package/dist/setup/sections/models-roles.js +1 -1
  606. package/dist/setup/sections/models-roles.js.map +1 -1
  607. package/dist/setup/sections/verification.d.ts.map +1 -1
  608. package/dist/setup/sections/verification.js +8 -2
  609. package/dist/setup/sections/verification.js.map +1 -1
  610. package/dist/shutdown.d.ts +24 -0
  611. package/dist/shutdown.d.ts.map +1 -1
  612. package/dist/shutdown.js +30 -1
  613. package/dist/shutdown.js.map +1 -1
  614. package/dist/skills/agents/install.d.ts +46 -6
  615. package/dist/skills/agents/install.d.ts.map +1 -1
  616. package/dist/skills/agents/install.js +86 -17
  617. package/dist/skills/agents/install.js.map +1 -1
  618. package/dist/skills/injection/subagent.js +1 -1
  619. package/dist/skills/injection/subagent.js.map +1 -1
  620. package/dist/skills/manifests/research.d.ts.map +1 -1
  621. package/dist/skills/manifests/research.js +2 -1
  622. package/dist/skills/manifests/research.js.map +1 -1
  623. package/dist/skills/orchestrator/spawn.js +1 -1
  624. package/dist/skills/orchestrator/spawn.js.map +1 -1
  625. package/dist/skills/orchestrator/validator.js +1 -1
  626. package/dist/skills/orchestrator/validator.js.map +1 -1
  627. package/dist/snapshot/index.d.ts.map +1 -1
  628. package/dist/snapshot/index.js +13 -0
  629. package/dist/snapshot/index.js.map +1 -1
  630. package/dist/spawn/agent-identity.js +1 -1
  631. package/dist/spawn/agent-identity.js.map +1 -1
  632. package/dist/stats/index.d.ts.map +1 -1
  633. package/dist/stats/index.js +2 -1
  634. package/dist/stats/index.js.map +1 -1
  635. package/dist/store/agent-install.d.ts.map +1 -1
  636. package/dist/store/agent-install.js +2 -1
  637. package/dist/store/agent-install.js.map +1 -1
  638. package/dist/store/agent-registry-accessor.d.ts +1 -0
  639. package/dist/store/agent-registry-accessor.d.ts.map +1 -1
  640. package/dist/store/agent-registry-accessor.js +3 -1
  641. package/dist/store/agent-registry-accessor.js.map +1 -1
  642. package/dist/store/atomic.js +1 -1
  643. package/dist/store/atomic.js.map +1 -1
  644. package/dist/store/attachment-store.js +1 -1
  645. package/dist/store/attachment-store.js.map +1 -1
  646. package/dist/store/audit-log-schema.d.ts +645 -0
  647. package/dist/store/audit-log-schema.d.ts.map +1 -0
  648. package/dist/store/audit-log-schema.js +30 -0
  649. package/dist/store/audit-log-schema.js.map +1 -0
  650. package/dist/store/background-ops.d.ts +26 -0
  651. package/dist/store/background-ops.d.ts.map +1 -1
  652. package/dist/store/background-ops.js +46 -0
  653. package/dist/store/background-ops.js.map +1 -1
  654. package/dist/store/backup-recover.d.ts +36 -1
  655. package/dist/store/backup-recover.d.ts.map +1 -1
  656. package/dist/store/backup-recover.js +99 -1
  657. package/dist/store/backup-recover.js.map +1 -1
  658. package/dist/store/backup-verify.d.ts +1 -1
  659. package/dist/store/backup-verify.d.ts.map +1 -1
  660. package/dist/store/backup-verify.js +6 -1
  661. package/dist/store/backup-verify.js.map +1 -1
  662. package/dist/store/backup.js +1 -1
  663. package/dist/store/backup.js.map +1 -1
  664. package/dist/store/conduit-sqlite.d.ts.map +1 -1
  665. package/dist/store/conduit-sqlite.js +2 -26
  666. package/dist/store/conduit-sqlite.js.map +1 -1
  667. package/dist/store/converters.js +1 -1
  668. package/dist/store/converters.js.map +1 -1
  669. package/dist/store/db-helpers.js +1 -1
  670. package/dist/store/db-helpers.js.map +1 -1
  671. package/dist/store/dependency-cycles.js +1 -1
  672. package/dist/store/dependency-cycles.js.map +1 -1
  673. package/dist/store/display-id-alias.d.ts +2 -2
  674. package/dist/store/display-id-alias.d.ts.map +1 -1
  675. package/dist/store/display-id-alias.js +5 -28
  676. package/dist/store/display-id-alias.js.map +1 -1
  677. package/dist/store/drizzle-node-sqlite.d.ts +56 -0
  678. package/dist/store/drizzle-node-sqlite.d.ts.map +1 -0
  679. package/dist/store/drizzle-node-sqlite.js +87 -0
  680. package/dist/store/drizzle-node-sqlite.js.map +1 -0
  681. package/dist/store/dual-scope-db.d.ts +26 -33
  682. package/dist/store/dual-scope-db.d.ts.map +1 -1
  683. package/dist/store/dual-scope-db.js +416 -127
  684. package/dist/store/dual-scope-db.js.map +1 -1
  685. package/dist/store/exodus/abort-events.d.ts +134 -0
  686. package/dist/store/exodus/abort-events.d.ts.map +1 -1
  687. package/dist/store/exodus/abort-events.js +201 -0
  688. package/dist/store/exodus/abort-events.js.map +1 -1
  689. package/dist/store/exodus/migrate.d.ts +7 -0
  690. package/dist/store/exodus/migrate.d.ts.map +1 -1
  691. package/dist/store/exodus/migrate.js +156 -118
  692. package/dist/store/exodus/migrate.js.map +1 -1
  693. package/dist/store/exodus/on-open.d.ts +36 -0
  694. package/dist/store/exodus/on-open.d.ts.map +1 -1
  695. package/dist/store/exodus/on-open.js +102 -27
  696. package/dist/store/exodus/on-open.js.map +1 -1
  697. package/dist/store/exodus/prior-recoveries.d.ts +75 -0
  698. package/dist/store/exodus/prior-recoveries.d.ts.map +1 -0
  699. package/dist/store/exodus/prior-recoveries.js +122 -0
  700. package/dist/store/exodus/prior-recoveries.js.map +1 -0
  701. package/dist/store/exodus/reconcile.d.ts.map +1 -1
  702. package/dist/store/exodus/reconcile.js +188 -24
  703. package/dist/store/exodus/reconcile.js.map +1 -1
  704. package/dist/store/exodus/runtime-targets.d.ts +3 -3
  705. package/dist/store/exodus/runtime-targets.js +3 -3
  706. package/dist/store/exodus/task-id-collision-sql.d.ts +52 -0
  707. package/dist/store/exodus/task-id-collision-sql.d.ts.map +1 -0
  708. package/dist/store/exodus/task-id-collision-sql.js +97 -0
  709. package/dist/store/exodus/task-id-collision-sql.js.map +1 -0
  710. package/dist/store/exodus/task-id-remap.d.ts +113 -0
  711. package/dist/store/exodus/task-id-remap.d.ts.map +1 -0
  712. package/dist/store/exodus/task-id-remap.js +301 -0
  713. package/dist/store/exodus/task-id-remap.js.map +1 -0
  714. package/dist/store/exodus/verify-migration.js +1 -1
  715. package/dist/store/exodus/verify-migration.js.map +1 -1
  716. package/dist/store/exodus/write-guard.d.ts +136 -0
  717. package/dist/store/exodus/write-guard.d.ts.map +1 -0
  718. package/dist/store/exodus/write-guard.js +289 -0
  719. package/dist/store/exodus/write-guard.js.map +1 -0
  720. package/dist/store/identity-share.d.ts +31 -0
  721. package/dist/store/identity-share.d.ts.map +1 -0
  722. package/dist/store/identity-share.js +54 -0
  723. package/dist/store/identity-share.js.map +1 -0
  724. package/dist/store/import-remap.js +1 -1
  725. package/dist/store/import-remap.js.map +1 -1
  726. package/dist/store/import-sort.js +1 -1
  727. package/dist/store/import-sort.js.map +1 -1
  728. package/dist/store/json.js +1 -1
  729. package/dist/store/json.js.map +1 -1
  730. package/dist/store/legacy-tasks-lineage.js +3 -3
  731. package/dist/store/legacy-tasks-lineage.js.map +1 -1
  732. package/dist/store/lock.d.ts +17 -0
  733. package/dist/store/lock.d.ts.map +1 -1
  734. package/dist/store/lock.js +18 -1
  735. package/dist/store/lock.js.map +1 -1
  736. package/dist/store/memory-sqlite.d.ts.map +1 -1
  737. package/dist/store/memory-sqlite.js +2 -25
  738. package/dist/store/memory-sqlite.js.map +1 -1
  739. package/dist/store/migration-files.d.ts +30 -0
  740. package/dist/store/migration-files.d.ts.map +1 -0
  741. package/dist/store/migration-files.js +59 -0
  742. package/dist/store/migration-files.js.map +1 -0
  743. package/dist/store/migration-manager.d.ts.map +1 -1
  744. package/dist/store/migration-manager.js +14 -14
  745. package/dist/store/migration-manager.js.map +1 -1
  746. package/dist/store/migration-runner.d.ts.map +1 -1
  747. package/dist/store/migration-runner.js +2 -2
  748. package/dist/store/migration-runner.js.map +1 -1
  749. package/dist/store/migration-sqlite.d.ts +1 -1
  750. package/dist/store/migration-sqlite.d.ts.map +1 -1
  751. package/dist/store/migration-sqlite.js +290 -355
  752. package/dist/store/migration-sqlite.js.map +1 -1
  753. package/dist/store/open-cleo-db.d.ts.map +1 -1
  754. package/dist/store/open-cleo-db.js +4 -2
  755. package/dist/store/open-cleo-db.js.map +1 -1
  756. package/dist/store/pid-alive.d.ts +15 -0
  757. package/dist/store/pid-alive.d.ts.map +1 -0
  758. package/dist/store/pid-alive.js +24 -0
  759. package/dist/store/pid-alive.js.map +1 -0
  760. package/dist/store/portable-bundle-scan.d.ts +1 -1
  761. package/dist/store/portable-bundle-scan.d.ts.map +1 -1
  762. package/dist/store/portable-bundle-scan.js +1 -1
  763. package/dist/store/portable-bundle-scan.js.map +1 -1
  764. package/dist/store/portable-bundle.d.ts +10 -1
  765. package/dist/store/portable-bundle.d.ts.map +1 -1
  766. package/dist/store/portable-bundle.js +10 -1
  767. package/dist/store/portable-bundle.js.map +1 -1
  768. package/dist/store/recover-malformed-db.d.ts +1 -1
  769. package/dist/store/recover-malformed-db.d.ts.map +1 -1
  770. package/dist/store/recover-malformed-db.js +1 -1
  771. package/dist/store/recover-malformed-db.js.map +1 -1
  772. package/dist/store/repair-malformed-dbs.d.ts +1 -1
  773. package/dist/store/repair-malformed-dbs.d.ts.map +1 -1
  774. package/dist/store/repair-malformed-dbs.js +1 -1
  775. package/dist/store/repair-malformed-dbs.js.map +1 -1
  776. package/dist/store/restore-marker.d.ts +89 -0
  777. package/dist/store/restore-marker.d.ts.map +1 -0
  778. package/dist/store/restore-marker.js +197 -0
  779. package/dist/store/restore-marker.js.map +1 -0
  780. package/dist/store/restore-store.d.ts +85 -0
  781. package/dist/store/restore-store.d.ts.map +1 -0
  782. package/dist/store/restore-store.js +391 -0
  783. package/dist/store/restore-store.js.map +1 -0
  784. package/dist/store/row-identity.d.ts +123 -1
  785. package/dist/store/row-identity.d.ts.map +1 -1
  786. package/dist/store/row-identity.js +454 -80
  787. package/dist/store/row-identity.js.map +1 -1
  788. package/dist/store/schema/agent-registry-schema.d.ts +1 -1
  789. package/dist/store/schema/agent-registry-schema.d.ts.map +1 -1
  790. package/dist/store/schema/agent-registry-schema.js +5 -1
  791. package/dist/store/schema/agent-registry-schema.js.map +1 -1
  792. package/dist/store/schema/cleo-global/agent-registry.d.ts +1 -1
  793. package/dist/store/schema/cleo-global/agent-registry.d.ts.map +1 -1
  794. package/dist/store/schema/cleo-global/agent-registry.js +9 -5
  795. package/dist/store/schema/cleo-global/agent-registry.js.map +1 -1
  796. package/dist/store/schema/cleo-global/models-catalog.js +1 -1
  797. package/dist/store/schema/cleo-global/models-catalog.js.map +1 -1
  798. package/dist/store/schema/cleo-global/nexus.js +1 -1
  799. package/dist/store/schema/cleo-global/nexus.js.map +1 -1
  800. package/dist/store/schema/cleo-project/provenance-commits.d.ts +1 -1
  801. package/dist/store/schema/cleo-project/provenance-orphans.d.ts +1 -1
  802. package/dist/store/schema/cleo-project/provenance-orphans.d.ts.map +1 -1
  803. package/dist/store/schema/cleo-project/provenance-orphans.js +9 -2
  804. package/dist/store/schema/cleo-project/provenance-orphans.js.map +1 -1
  805. package/dist/store/schema/cleo-project/provenance-rest.d.ts +1 -1
  806. package/dist/store/schema/cleo-project/provenance-rest.js +1 -1
  807. package/dist/store/schema/cleo-project/provenance-rest.js.map +1 -1
  808. package/dist/store/schema/cleo-shared/brain.js +1 -1
  809. package/dist/store/schema/cleo-shared/brain.js.map +1 -1
  810. package/dist/store/schema/memory-schema.d.ts +1 -1
  811. package/dist/store/schema/memory-schema.d.ts.map +1 -1
  812. package/dist/store/schema/memory-schema.js +1 -1
  813. package/dist/store/schema/memory-schema.js.map +1 -1
  814. package/dist/store/schema/nexus-schema.js +1 -1
  815. package/dist/store/schema/nexus-schema.js.map +1 -1
  816. package/dist/store/service-host-matcher.d.ts +1 -1
  817. package/dist/store/service-host-matcher.d.ts.map +1 -1
  818. package/dist/store/service-host-matcher.js +1 -1
  819. package/dist/store/service-host-matcher.js.map +1 -1
  820. package/dist/store/service-oauth.js +1 -1
  821. package/dist/store/service-oauth.js.map +1 -1
  822. package/dist/store/session-store.d.ts.map +1 -1
  823. package/dist/store/session-store.js +7 -1
  824. package/dist/store/session-store.js.map +1 -1
  825. package/dist/store/sqlite-backup.d.ts +1 -1
  826. package/dist/store/sqlite-backup.d.ts.map +1 -1
  827. package/dist/store/sqlite-backup.js +1 -1
  828. package/dist/store/sqlite-backup.js.map +1 -1
  829. package/dist/store/sqlite-data-accessor.d.ts +52 -1
  830. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  831. package/dist/store/sqlite-data-accessor.js +95 -22
  832. package/dist/store/sqlite-data-accessor.js.map +1 -1
  833. package/dist/store/sqlite-native.d.ts.map +1 -1
  834. package/dist/store/sqlite-native.js +9 -9
  835. package/dist/store/sqlite-native.js.map +1 -1
  836. package/dist/store/sqlite-pragmas.d.ts +12 -5
  837. package/dist/store/sqlite-pragmas.d.ts.map +1 -1
  838. package/dist/store/sqlite-pragmas.js +13 -2
  839. package/dist/store/sqlite-pragmas.js.map +1 -1
  840. package/dist/store/sqlite.d.ts.map +1 -1
  841. package/dist/store/sqlite.js +7 -32
  842. package/dist/store/sqlite.js.map +1 -1
  843. package/dist/store/status-registry.d.ts +1 -1
  844. package/dist/store/status-registry.d.ts.map +1 -1
  845. package/dist/store/status-registry.js +1 -1
  846. package/dist/store/status-registry.js.map +1 -1
  847. package/dist/store/sync/apply/applier.d.ts +119 -0
  848. package/dist/store/sync/apply/applier.d.ts.map +1 -0
  849. package/dist/store/sync/apply/applier.js +1239 -0
  850. package/dist/store/sync/apply/applier.js.map +1 -0
  851. package/dist/store/sync/apply/fk.d.ts +47 -0
  852. package/dist/store/sync/apply/fk.d.ts.map +1 -0
  853. package/dist/store/sync/apply/fk.js +89 -0
  854. package/dist/store/sync/apply/fk.js.map +1 -0
  855. package/dist/store/sync/apply/footprints.d.ts +60 -0
  856. package/dist/store/sync/apply/footprints.d.ts.map +1 -0
  857. package/dist/store/sync/apply/footprints.js +235 -0
  858. package/dist/store/sync/apply/footprints.js.map +1 -0
  859. package/dist/store/sync/apply/frame.d.ts +80 -0
  860. package/dist/store/sync/apply/frame.d.ts.map +1 -0
  861. package/dist/store/sync/apply/frame.js +127 -0
  862. package/dist/store/sync/apply/frame.js.map +1 -0
  863. package/dist/store/sync/apply/index.d.ts +11 -0
  864. package/dist/store/sync/apply/index.d.ts.map +1 -0
  865. package/dist/store/sync/apply/index.js +11 -0
  866. package/dist/store/sync/apply/index.js.map +1 -0
  867. package/dist/store/sync/apply/parent-delete.d.ts +38 -0
  868. package/dist/store/sync/apply/parent-delete.d.ts.map +1 -0
  869. package/dist/store/sync/apply/parent-delete.js +41 -0
  870. package/dist/store/sync/apply/parent-delete.js.map +1 -0
  871. package/dist/store/sync/apply/post-apply.d.ts +67 -0
  872. package/dist/store/sync/apply/post-apply.d.ts.map +1 -0
  873. package/dist/store/sync/apply/post-apply.js +118 -0
  874. package/dist/store/sync/apply/post-apply.js.map +1 -0
  875. package/dist/store/sync/apply/refs.d.ts +60 -0
  876. package/dist/store/sync/apply/refs.d.ts.map +1 -0
  877. package/dist/store/sync/apply/refs.js +90 -0
  878. package/dist/store/sync/apply/refs.js.map +1 -0
  879. package/dist/store/sync/apply/write-api.d.ts +195 -0
  880. package/dist/store/sync/apply/write-api.d.ts.map +1 -0
  881. package/dist/store/sync/apply/write-api.js +416 -0
  882. package/dist/store/sync/apply/write-api.js.map +1 -0
  883. package/dist/store/sync/apply-intent.d.ts +117 -0
  884. package/dist/store/sync/apply-intent.d.ts.map +1 -0
  885. package/dist/store/sync/apply-intent.js +225 -0
  886. package/dist/store/sync/apply-intent.js.map +1 -0
  887. package/dist/store/sync/capture.d.ts +32 -2
  888. package/dist/store/sync/capture.d.ts.map +1 -1
  889. package/dist/store/sync/capture.js +47 -13
  890. package/dist/store/sync/capture.js.map +1 -1
  891. package/dist/store/sync/conflicts.d.ts +81 -0
  892. package/dist/store/sync/conflicts.d.ts.map +1 -0
  893. package/dist/store/sync/conflicts.js +98 -0
  894. package/dist/store/sync/conflicts.js.map +1 -0
  895. package/dist/store/sync/field-leave.d.ts +146 -0
  896. package/dist/store/sync/field-leave.d.ts.map +1 -0
  897. package/dist/store/sync/field-leave.js +241 -0
  898. package/dist/store/sync/field-leave.js.map +1 -0
  899. package/dist/store/sync/flags.d.ts +119 -0
  900. package/dist/store/sync/flags.d.ts.map +1 -1
  901. package/dist/store/sync/flags.js +360 -0
  902. package/dist/store/sync/flags.js.map +1 -1
  903. package/dist/store/sync/held.d.ts +197 -0
  904. package/dist/store/sync/held.d.ts.map +1 -0
  905. package/dist/store/sync/held.js +314 -0
  906. package/dist/store/sync/held.js.map +1 -0
  907. package/dist/store/sync/identity-fill.d.ts.map +1 -1
  908. package/dist/store/sync/identity-fill.js +10 -2
  909. package/dist/store/sync/identity-fill.js.map +1 -1
  910. package/dist/store/sync/inbox.d.ts +114 -0
  911. package/dist/store/sync/inbox.d.ts.map +1 -0
  912. package/dist/store/sync/inbox.js +222 -0
  913. package/dist/store/sync/inbox.js.map +1 -0
  914. package/dist/store/sync/inherit.d.ts +36 -0
  915. package/dist/store/sync/inherit.d.ts.map +1 -0
  916. package/dist/store/sync/inherit.js +38 -0
  917. package/dist/store/sync/inherit.js.map +1 -0
  918. package/dist/store/sync/merge/engine.d.ts +114 -0
  919. package/dist/store/sync/merge/engine.d.ts.map +1 -0
  920. package/dist/store/sync/merge/engine.js +698 -0
  921. package/dist/store/sync/merge/engine.js.map +1 -0
  922. package/dist/store/sync/merge/index.d.ts +11 -0
  923. package/dist/store/sync/merge/index.d.ts.map +1 -0
  924. package/dist/store/sync/merge/index.js +11 -0
  925. package/dist/store/sync/merge/index.js.map +1 -0
  926. package/dist/store/sync/merge/rules.d.ts +91 -0
  927. package/dist/store/sync/merge/rules.d.ts.map +1 -0
  928. package/dist/store/sync/merge/rules.js +151 -0
  929. package/dist/store/sync/merge/rules.js.map +1 -0
  930. package/dist/store/sync/merge/types.d.ts +206 -0
  931. package/dist/store/sync/merge/types.d.ts.map +1 -0
  932. package/dist/store/sync/merge/types.js +15 -0
  933. package/dist/store/sync/merge/types.js.map +1 -0
  934. package/dist/store/sync/migration-hooks.d.ts +47 -0
  935. package/dist/store/sync/migration-hooks.d.ts.map +1 -0
  936. package/dist/store/sync/migration-hooks.js +74 -0
  937. package/dist/store/sync/migration-hooks.js.map +1 -0
  938. package/dist/store/sync/netting.d.ts +5 -0
  939. package/dist/store/sync/netting.d.ts.map +1 -1
  940. package/dist/store/sync/netting.js +29 -2
  941. package/dist/store/sync/netting.js.map +1 -1
  942. package/dist/store/sync/remap.d.ts +72 -0
  943. package/dist/store/sync/remap.d.ts.map +1 -0
  944. package/dist/store/sync/remap.js +209 -0
  945. package/dist/store/sync/remap.js.map +1 -0
  946. package/dist/store/sync/repair.d.ts +180 -0
  947. package/dist/store/sync/repair.d.ts.map +1 -0
  948. package/dist/store/sync/repair.js +499 -0
  949. package/dist/store/sync/repair.js.map +1 -0
  950. package/dist/store/sync/replica-registry.d.ts +54 -0
  951. package/dist/store/sync/replica-registry.d.ts.map +1 -1
  952. package/dist/store/sync/replica-registry.js +72 -2
  953. package/dist/store/sync/replica-registry.js.map +1 -1
  954. package/dist/store/sync/replica.d.ts +71 -9
  955. package/dist/store/sync/replica.d.ts.map +1 -1
  956. package/dist/store/sync/replica.js +95 -11
  957. package/dist/store/sync/replica.js.map +1 -1
  958. package/dist/store/sync/row-meta.d.ts +148 -0
  959. package/dist/store/sync/row-meta.d.ts.map +1 -0
  960. package/dist/store/sync/row-meta.js +200 -0
  961. package/dist/store/sync/row-meta.js.map +1 -0
  962. package/dist/store/sync/schema.d.ts +13 -5
  963. package/dist/store/sync/schema.d.ts.map +1 -1
  964. package/dist/store/sync/schema.js +34 -7
  965. package/dist/store/sync/schema.js.map +1 -1
  966. package/dist/store/sync/sealer-values.d.ts.map +1 -1
  967. package/dist/store/sync/sealer-values.js +1 -0
  968. package/dist/store/sync/sealer-values.js.map +1 -1
  969. package/dist/store/sync/sealer.d.ts +96 -0
  970. package/dist/store/sync/sealer.d.ts.map +1 -1
  971. package/dist/store/sync/sealer.js +532 -58
  972. package/dist/store/sync/sealer.js.map +1 -1
  973. package/dist/store/sync/sequencing.d.ts +175 -0
  974. package/dist/store/sync/sequencing.d.ts.map +1 -0
  975. package/dist/store/sync/sequencing.js +295 -0
  976. package/dist/store/sync/sequencing.js.map +1 -0
  977. package/dist/store/sync/structural.d.ts +30 -2
  978. package/dist/store/sync/structural.d.ts.map +1 -1
  979. package/dist/store/sync/structural.js +64 -2
  980. package/dist/store/sync/structural.js.map +1 -1
  981. package/dist/store/sync/timestamp-canon.d.ts +44 -0
  982. package/dist/store/sync/timestamp-canon.d.ts.map +1 -0
  983. package/dist/store/sync/timestamp-canon.js +102 -0
  984. package/dist/store/sync/timestamp-canon.js.map +1 -0
  985. package/dist/store/sync/timestamps.d.ts +1 -30
  986. package/dist/store/sync/timestamps.d.ts.map +1 -1
  987. package/dist/store/sync/timestamps.js +2 -89
  988. package/dist/store/sync/timestamps.js.map +1 -1
  989. package/dist/store/sync/trigger-classes.d.ts +8 -0
  990. package/dist/store/sync/trigger-classes.d.ts.map +1 -1
  991. package/dist/store/sync/trigger-classes.js +13 -0
  992. package/dist/store/sync/trigger-classes.js.map +1 -1
  993. package/dist/store/sync/write-actor.d.ts +58 -0
  994. package/dist/store/sync/write-actor.d.ts.map +1 -0
  995. package/dist/store/sync/write-actor.js +67 -0
  996. package/dist/store/sync/write-actor.js.map +1 -0
  997. package/dist/store/table-classification.d.ts.map +1 -1
  998. package/dist/store/table-classification.js +84 -0
  999. package/dist/store/table-classification.js.map +1 -1
  1000. package/dist/store/task-claim.d.ts +1 -1
  1001. package/dist/store/task-claim.d.ts.map +1 -1
  1002. package/dist/store/task-claim.js +1 -1
  1003. package/dist/store/task-claim.js.map +1 -1
  1004. package/dist/store/task-reference-columns.d.ts +27 -0
  1005. package/dist/store/task-reference-columns.d.ts.map +1 -0
  1006. package/dist/store/task-reference-columns.js +65 -0
  1007. package/dist/store/task-reference-columns.js.map +1 -0
  1008. package/dist/store/task-version.d.ts +1 -1
  1009. package/dist/store/task-version.d.ts.map +1 -1
  1010. package/dist/store/task-version.js +1 -1
  1011. package/dist/store/task-version.js.map +1 -1
  1012. package/dist/store/tasks-schema.d.ts +2 -1
  1013. package/dist/store/tasks-schema.d.ts.map +1 -1
  1014. package/dist/store/tasks-schema.js +5 -4
  1015. package/dist/store/tasks-schema.js.map +1 -1
  1016. package/dist/store/tasks-sqlite.d.ts +1 -1
  1017. package/dist/store/tasks-sqlite.d.ts.map +1 -1
  1018. package/dist/store/tasks-sqlite.js +3 -1
  1019. package/dist/store/tasks-sqlite.js.map +1 -1
  1020. package/dist/store/twin-collapse.d.ts +43 -14
  1021. package/dist/store/twin-collapse.d.ts.map +1 -1
  1022. package/dist/store/twin-collapse.js +373 -32
  1023. package/dist/store/twin-collapse.js.map +1 -1
  1024. package/dist/store/validation-schemas.d.ts +44 -674
  1025. package/dist/store/validation-schemas.d.ts.map +1 -1
  1026. package/dist/store/validation-schemas.js +2 -22
  1027. package/dist/store/validation-schemas.js.map +1 -1
  1028. package/dist/store/vault-manifest.d.ts +1 -1
  1029. package/dist/store/vault-manifest.d.ts.map +1 -1
  1030. package/dist/store/vault-manifest.js +1 -1
  1031. package/dist/store/vault-manifest.js.map +1 -1
  1032. package/dist/store/worktree-build-guard.js +1 -1
  1033. package/dist/store/worktree-build-guard.js.map +1 -1
  1034. package/dist/store/worktree-isolation-guard.js +1 -1
  1035. package/dist/store/worktree-isolation-guard.js.map +1 -1
  1036. package/dist/store/writer-lease.d.ts.map +1 -1
  1037. package/dist/store/writer-lease.js +1 -11
  1038. package/dist/store/writer-lease.js.map +1 -1
  1039. package/dist/store/zod-schema-factory.d.ts +16 -0
  1040. package/dist/store/zod-schema-factory.d.ts.map +1 -0
  1041. package/dist/store/zod-schema-factory.js +23 -0
  1042. package/dist/store/zod-schema-factory.js.map +1 -0
  1043. package/dist/system/backup.d.ts +106 -0
  1044. package/dist/system/backup.d.ts.map +1 -1
  1045. package/dist/system/backup.js +295 -19
  1046. package/dist/system/backup.js.map +1 -1
  1047. package/dist/system/cleanup.js +1 -1
  1048. package/dist/system/cleanup.js.map +1 -1
  1049. package/dist/system/labels.js +1 -1
  1050. package/dist/system/labels.js.map +1 -1
  1051. package/dist/system/migrate.js +1 -1
  1052. package/dist/system/migrate.js.map +1 -1
  1053. package/dist/system/safestop.d.ts.map +1 -1
  1054. package/dist/system/safestop.js +1 -1
  1055. package/dist/system/safestop.js.map +1 -1
  1056. package/dist/task-work/current.d.ts +34 -0
  1057. package/dist/task-work/current.d.ts.map +1 -0
  1058. package/dist/task-work/current.js +34 -0
  1059. package/dist/task-work/current.js.map +1 -0
  1060. package/dist/task-work/index.d.ts +2 -19
  1061. package/dist/task-work/index.d.ts.map +1 -1
  1062. package/dist/task-work/index.js +6 -20
  1063. package/dist/task-work/index.js.map +1 -1
  1064. package/dist/tasks/ac-identity.d.ts +28 -0
  1065. package/dist/tasks/ac-identity.d.ts.map +1 -0
  1066. package/dist/tasks/ac-identity.js +43 -0
  1067. package/dist/tasks/ac-identity.js.map +1 -0
  1068. package/dist/tasks/ac-immutability.d.ts +1 -1
  1069. package/dist/tasks/ac-immutability.d.ts.map +1 -1
  1070. package/dist/tasks/ac-immutability.js +1 -1
  1071. package/dist/tasks/ac-immutability.js.map +1 -1
  1072. package/dist/tasks/ac-table.d.ts +2 -14
  1073. package/dist/tasks/ac-table.d.ts.map +1 -1
  1074. package/dist/tasks/ac-table.js +6 -29
  1075. package/dist/tasks/ac-table.js.map +1 -1
  1076. package/dist/tasks/acceptance-input.js +1 -1
  1077. package/dist/tasks/acceptance-input.js.map +1 -1
  1078. package/dist/tasks/add.d.ts.map +1 -1
  1079. package/dist/tasks/add.js +3 -1
  1080. package/dist/tasks/add.js.map +1 -1
  1081. package/dist/tasks/affected-packages.d.ts +80 -12
  1082. package/dist/tasks/affected-packages.d.ts.map +1 -1
  1083. package/dist/tasks/affected-packages.js +130 -19
  1084. package/dist/tasks/affected-packages.js.map +1 -1
  1085. package/dist/tasks/archive.d.ts.map +1 -1
  1086. package/dist/tasks/archive.js +1 -1
  1087. package/dist/tasks/archive.js.map +1 -1
  1088. package/dist/tasks/axis-filters.d.ts.map +1 -1
  1089. package/dist/tasks/axis-filters.js +2 -1
  1090. package/dist/tasks/axis-filters.js.map +1 -1
  1091. package/dist/tasks/child-disposition.js +1 -1
  1092. package/dist/tasks/child-disposition.js.map +1 -1
  1093. package/dist/tasks/collection.js +1 -1
  1094. package/dist/tasks/collection.js.map +1 -1
  1095. package/dist/tasks/complete.d.ts.map +1 -1
  1096. package/dist/tasks/complete.js +2 -1
  1097. package/dist/tasks/complete.js.map +1 -1
  1098. package/dist/tasks/decompose.js +1 -1
  1099. package/dist/tasks/decompose.js.map +1 -1
  1100. package/dist/tasks/delete.js +1 -1
  1101. package/dist/tasks/delete.js.map +1 -1
  1102. package/dist/tasks/done-plan.d.ts +2 -1
  1103. package/dist/tasks/done-plan.d.ts.map +1 -1
  1104. package/dist/tasks/done-plan.js +10 -20
  1105. package/dist/tasks/done-plan.js.map +1 -1
  1106. package/dist/tasks/done-record.d.ts +1 -1
  1107. package/dist/tasks/done-record.d.ts.map +1 -1
  1108. package/dist/tasks/done-record.js +1 -1
  1109. package/dist/tasks/done-record.js.map +1 -1
  1110. package/dist/tasks/enforcement.d.ts +2 -1
  1111. package/dist/tasks/enforcement.d.ts.map +1 -1
  1112. package/dist/tasks/enforcement.js +1 -1
  1113. package/dist/tasks/enforcement.js.map +1 -1
  1114. package/dist/tasks/engine-wrap-ops.js +1 -1
  1115. package/dist/tasks/engine-wrap-ops.js.map +1 -1
  1116. package/dist/tasks/engine-wrap.d.ts.map +1 -1
  1117. package/dist/tasks/engine-wrap.js +7 -3
  1118. package/dist/tasks/engine-wrap.js.map +1 -1
  1119. package/dist/tasks/epic-enforcement.js +1 -1
  1120. package/dist/tasks/epic-enforcement.js.map +1 -1
  1121. package/dist/tasks/evidence.d.ts.map +1 -1
  1122. package/dist/tasks/evidence.js +41 -19
  1123. package/dist/tasks/evidence.js.map +1 -1
  1124. package/dist/tasks/find.js +1 -1
  1125. package/dist/tasks/find.js.map +1 -1
  1126. package/dist/tasks/gate-result-cache.js +1 -1
  1127. package/dist/tasks/gate-result-cache.js.map +1 -1
  1128. package/dist/tasks/gate-runner.d.ts.map +1 -1
  1129. package/dist/tasks/gate-runner.js +1 -1
  1130. package/dist/tasks/gate-runner.js.map +1 -1
  1131. package/dist/tasks/heavy-tool-env.d.ts +79 -11
  1132. package/dist/tasks/heavy-tool-env.d.ts.map +1 -1
  1133. package/dist/tasks/heavy-tool-env.js +111 -14
  1134. package/dist/tasks/heavy-tool-env.js.map +1 -1
  1135. package/dist/tasks/index.d.ts +1 -1
  1136. package/dist/tasks/index.d.ts.map +1 -1
  1137. package/dist/tasks/index.js +2 -2
  1138. package/dist/tasks/index.js.map +1 -1
  1139. package/dist/tasks/labels.js +1 -1
  1140. package/dist/tasks/labels.js.map +1 -1
  1141. package/dist/tasks/nexus-impact-gate.js +1 -1
  1142. package/dist/tasks/nexus-impact-gate.js.map +1 -1
  1143. package/dist/tasks/pipeline-stage.js +1 -1
  1144. package/dist/tasks/pipeline-stage.js.map +1 -1
  1145. package/dist/tasks/population.js +1 -1
  1146. package/dist/tasks/population.js.map +1 -1
  1147. package/dist/tasks/ranking-audit.js +1 -1
  1148. package/dist/tasks/ranking-audit.js.map +1 -1
  1149. package/dist/tasks/reconcile-scope.js +1 -1
  1150. package/dist/tasks/reconcile-scope.js.map +1 -1
  1151. package/dist/tasks/relates.js +1 -1
  1152. package/dist/tasks/relates.js.map +1 -1
  1153. package/dist/tasks/req.d.ts.map +1 -1
  1154. package/dist/tasks/req.js +2 -1
  1155. package/dist/tasks/req.js.map +1 -1
  1156. package/dist/tasks/severity-attestation.d.ts +1 -1
  1157. package/dist/tasks/severity-attestation.d.ts.map +1 -1
  1158. package/dist/tasks/severity-attestation.js +1 -1
  1159. package/dist/tasks/severity-attestation.js.map +1 -1
  1160. package/dist/tasks/show.d.ts.map +1 -1
  1161. package/dist/tasks/show.js +47 -3
  1162. package/dist/tasks/show.js.map +1 -1
  1163. package/dist/tasks/task-import.js +1 -1
  1164. package/dist/tasks/task-import.js.map +1 -1
  1165. package/dist/tasks/task-reparent.d.ts.map +1 -1
  1166. package/dist/tasks/task-reparent.js +2 -1
  1167. package/dist/tasks/task-reparent.js.map +1 -1
  1168. package/dist/tasks/test-run-binding.d.ts.map +1 -1
  1169. package/dist/tasks/test-run-binding.js +9 -2
  1170. package/dist/tasks/test-run-binding.js.map +1 -1
  1171. package/dist/tasks/tool-cache.d.ts +23 -8
  1172. package/dist/tasks/tool-cache.d.ts.map +1 -1
  1173. package/dist/tasks/tool-cache.js +57 -16
  1174. package/dist/tasks/tool-cache.js.map +1 -1
  1175. package/dist/tasks/tool-resolver.d.ts +8 -0
  1176. package/dist/tasks/tool-resolver.d.ts.map +1 -1
  1177. package/dist/tasks/tool-resolver.js +15 -1
  1178. package/dist/tasks/tool-resolver.js.map +1 -1
  1179. package/dist/tasks/tool-runner-guard.d.ts +131 -0
  1180. package/dist/tasks/tool-runner-guard.d.ts.map +1 -0
  1181. package/dist/tasks/tool-runner-guard.js +141 -0
  1182. package/dist/tasks/tool-runner-guard.js.map +1 -0
  1183. package/dist/tasks/tool-semaphore.d.ts +103 -342
  1184. package/dist/tasks/tool-semaphore.d.ts.map +1 -1
  1185. package/dist/tasks/tool-semaphore.js +131 -619
  1186. package/dist/tasks/tool-semaphore.js.map +1 -1
  1187. package/dist/tasks/update.d.ts.map +1 -1
  1188. package/dist/tasks/update.js +2 -1
  1189. package/dist/tasks/update.js.map +1 -1
  1190. package/dist/upgrade.d.ts.map +1 -1
  1191. package/dist/upgrade.js +5 -34
  1192. package/dist/upgrade.js.map +1 -1
  1193. package/dist/validation/doctor/checks.d.ts +24 -0
  1194. package/dist/validation/doctor/checks.d.ts.map +1 -1
  1195. package/dist/validation/doctor/checks.js +168 -0
  1196. package/dist/validation/doctor/checks.js.map +1 -1
  1197. package/dist/validation/doctor/index.d.ts +1 -1
  1198. package/dist/validation/doctor/index.d.ts.map +1 -1
  1199. package/dist/validation/doctor/index.js +1 -1
  1200. package/dist/validation/doctor/index.js.map +1 -1
  1201. package/dist/validation/engine-ops.js +1 -1
  1202. package/dist/validation/engine-ops.js.map +1 -1
  1203. package/dist/validation/engine.d.ts +1 -1
  1204. package/dist/validation/engine.d.ts.map +1 -1
  1205. package/dist/validation/engine.js +2 -1
  1206. package/dist/validation/engine.js.map +1 -1
  1207. package/dist/validation/index.d.ts +1 -1
  1208. package/dist/validation/index.d.ts.map +1 -1
  1209. package/dist/validation/index.js +1 -1
  1210. package/dist/validation/index.js.map +1 -1
  1211. package/dist/validation/operation-gate-validators.js +1 -1
  1212. package/dist/validation/operation-gate-validators.js.map +1 -1
  1213. package/dist/validation/protocol-common.js +1 -1
  1214. package/dist/validation/protocol-common.js.map +1 -1
  1215. package/dist/validation/protocols/_shared.js +1 -1
  1216. package/dist/validation/protocols/_shared.js.map +1 -1
  1217. package/dist/validation/validate-ops.js +1 -1
  1218. package/dist/validation/validate-ops.js.map +1 -1
  1219. package/dist/validation/verification.js +1 -1
  1220. package/dist/validation/verification.js.map +1 -1
  1221. package/dist/workgraph/index.d.ts +1 -1
  1222. package/dist/workgraph/index.d.ts.map +1 -1
  1223. package/dist/workgraph/index.js +1 -1
  1224. package/dist/workgraph/index.js.map +1 -1
  1225. package/dist/workgraph/reparent-preflight.d.ts +1 -2
  1226. package/dist/workgraph/reparent-preflight.d.ts.map +1 -1
  1227. package/dist/workgraph/reparent-preflight.js +1 -1
  1228. package/dist/workgraph/reparent-preflight.js.map +1 -1
  1229. package/dist/workgraph/scaffold-validate.js +1 -1
  1230. package/dist/workgraph/scaffold-validate.js.map +1 -1
  1231. package/dist/worktree/force-unlock.d.ts +1 -1
  1232. package/dist/worktree/force-unlock.d.ts.map +1 -1
  1233. package/dist/worktree/force-unlock.js +1 -1
  1234. package/dist/worktree/force-unlock.js.map +1 -1
  1235. package/dist/worktree/isolation.d.ts +1 -1
  1236. package/dist/worktree/isolation.d.ts.map +1 -1
  1237. package/dist/worktree/isolation.js +1 -1
  1238. package/dist/worktree/isolation.js.map +1 -1
  1239. package/dist/worktree/list.d.ts +1 -1
  1240. package/dist/worktree/list.d.ts.map +1 -1
  1241. package/dist/worktree/list.js +1 -1
  1242. package/dist/worktree/list.js.map +1 -1
  1243. package/dist/worktree/prune.d.ts +1 -1
  1244. package/dist/worktree/prune.d.ts.map +1 -1
  1245. package/dist/worktree/prune.js +1 -1
  1246. package/dist/worktree/prune.js.map +1 -1
  1247. package/dist/worktree/worktree-adopt.d.ts +1 -2
  1248. package/dist/worktree/worktree-adopt.d.ts.map +1 -1
  1249. package/dist/worktree/worktree-adopt.js +1 -1
  1250. package/dist/worktree/worktree-adopt.js.map +1 -1
  1251. package/migrations/sync-journal/20261004120000_t12757-apply-intent/migration.sql +21 -0
  1252. package/migrations/sync-journal/20261005120000_t12344-inbox/migration.sql +67 -0
  1253. package/migrations/sync-journal/20261006120000_t13193-rebase-undo/migration.sql +51 -0
  1254. package/migrations/sync-journal/20261006130000_t13193-rebase-state/migration.sql +17 -0
  1255. package/migrations/sync-journal/20261006140000_t13193-held-rows/migration.sql +24 -0
  1256. package/package.json +13 -13
  1257. package/schemas/project-context.schema.json +14 -0
  1258. package/templates/CLEO-INJECTION.md +11 -11
  1259. package/templates/CLEO-REFERENCE.md +2 -2
  1260. package/templates/workflows/release-prepare.yml.tmpl +10 -10
@@ -1,669 +1,181 @@
1
1
  /**
2
- * Cross-process global concurrency limit for evidence-tool runs (T1534 / ADR-061).
2
+ * Machine-wide admission for evidence-tool runs (T1534 / ADR-061, T13133).
3
3
  *
4
4
  * The cache layer ({@link runToolCached}) coalesces *identical* parallel runs
5
- * via a per-key file lock — when 10 sibling tasks against the same git HEAD
6
- * call `tool:test`, only one spawns. But orchestrator-spawned worktree
7
- * agents each operate on a *different* HEAD (one branch per worktree per
8
- * ADR-055), so their cache keys differ and the per-key lock does NOT
9
- * coalesce them. Without an additional bound, N worktree agents would each
10
- * spawn the full toolchain, multiplying CPU and resident memory by N.
11
- *
12
- * This module bounds *total* concurrent runs of a canonical tool across
13
- * the whole machine — independent of which project, worktree, or PID
14
- * issues the call. It uses a slot directory under
15
- * `~/.local/share/cleo/locks/tool-<canonical>/` with `slot-0.lock` …
16
- * `slot-(N-1).lock` files; each slot is held by `proper-lockfile` so a
17
- * crashed process auto-releases via the standard stale-lock recovery.
18
- *
19
- * Defaults (configurable via env):
20
- *
21
- * | Tool | Default | Binding constraint |
22
- * |-----------------|----------------------------------------------|-----------------------------|
23
- * | test, build | min(RAM/24GiB, cpus/4), min 1 | MEMORY (each run forks) |
24
- * | typecheck, lint | min(RAM/2 ÷ (heap + 2GiB), cpus/2), min 1 | MEMORY (one TS program) |
25
- * | audit | max(2, cpus/2) | network-bound, small RAM |
26
- * | security-scan | max(2, cpus/2) | network-bound, small RAM |
27
- *
28
- * On darwin `test`/`build` default to ONE slot machine-wide (T12963), and
29
- * `typecheck`/`lint` to at most {@link DARWIN_MEMORY_BOUND_SLOTS} (T13123):
30
- * concurrent agents on a laptop are the common case there. Memory-bound runs
31
- * shrink under pressure ({@link pressureScaleSlots}). Heavy runs additionally
32
- * take a slot of the matching {@link ResourceGovernor} class (`test` →
33
- * `test-run`, `build` → `scoped-build`), so evidence runs and other governed
34
- * heavy work share one machine-wide budget. `typecheck`/`lint` take no governor
35
- * class of their own: cross-surface admission belongs to the single
36
- * footprint-based scheduler (T13132), not to one more class.
37
- *
38
- * T12091: `test`/`build` were `max(1, cpus/4)` — 6 slots on a 24-core box. Since
39
- * each `pnpm run test` is itself allowed 6 vitest forks × 4 GiB, the two bounds
40
- * composed to 144 GiB of permitted heap on 62 GiB of RAM. Neither layer was
41
- * individually violated, which is exactly why the machine froze without any
42
- * guard firing. Heavy tools are now bounded by the dimension that actually
43
- * limits them — see {@link defaultMaxConcurrent}.
44
- *
45
- * Override via `CLEO_TOOL_CONCURRENCY_<CANONICAL>` (e.g.
46
- * `CLEO_TOOL_CONCURRENCY_TEST=2`). Set to `0` or a negative number to
47
- * disable the limit for that tool — which also disables the RAM bound, so it is
48
- * the one setting that can still oversubscribe the machine.
5
+ * via a per-key file lock. Orchestrator-spawned worktree agents each operate
6
+ * on a *different* HEAD, so their cache keys differ and the per-key lock does
7
+ * not coalesce them; without a machine-wide bound, N worktree agents would
8
+ * each spawn the full toolchain, multiplying CPU and resident memory by N.
9
+ *
10
+ * Since T13133 that bound is the admission ledger (`resources/admission-ledger.ts`):
11
+ * one budget in bytes and one FIFO queue shared by every evidence run, every
12
+ * `cleo run` job and the vitest project probe, machine-wide. An evidence run
13
+ * asks for its footprint (`footprintForTool`: a heavy test/build run is
14
+ * charged its worker count × 6 GiB, typecheck and lint their planned heap plus
15
+ * 2 GiB, audit and scans 1 GiB),
16
+ * waits its turn, and exports the grant's `CLEO_ADMISSION` token to the tool
17
+ * it spawns, so a `cleo verify` or `cleo run` the tool starts rides the grant
18
+ * instead of waiting for the budget its own ancestor holds.
19
+ *
20
+ * What it replaced: per-tool slot directories under `<cleoHome>/locks/tool-*`,
21
+ * core- and RAM-derived slot counts (`defaultMaxConcurrent`), PSI slot scaling
22
+ * (`pressureScaleSlots`), the darwin one-slot rule (T12963) and a second,
23
+ * separate governor slot taken after the tool slot, the order that could
24
+ * deadlock against `cleo run` (T13133). Memory pressure now narrows the one
25
+ * budget, and the memory gate (T13127) refuses heavy work outright while
26
+ * memory is short; a waiting run says so on stderr with the readings.
27
+ *
28
+ * `CLEO_TOOL_CONCURRENCY_<TOOL>` no longer counts runs: `0` (or below) still
29
+ * bypasses admission for that tool, any other value is ignored, and either
30
+ * prints one deprecation line per process on stderr. `CLEO_RESOURCES_MODE=off`
31
+ * is the supported switch.
49
32
  *
50
33
  * @task T1534
51
34
  * @task T12091
52
35
  * @task T12963
53
36
  * @task T13123
37
+ * @task T13127
38
+ * @task T13133
54
39
  * @adr ADR-061
55
40
  */
56
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
57
- import { availableParallelism, hostname, totalmem } from 'node:os';
58
- import { join } from 'node:path';
59
- import lockfile from 'proper-lockfile';
60
- import { getCleoHome } from '../paths.js';
61
- import { governor } from '../resources/governor.js';
62
- import { ResourceMonitor } from '../resources/monitor.js';
63
- import { assessSlotHolder, currentLockId, ownProcessStartedAt, reapSlotIfHolderDead, recordToolGroupsWhileHeld, SLOT_LOCK_STALE_MS, writeHolderRecord, } from '../resources/slot-holder.js';
64
- import { defaultSingleProcessHeapMb, GIB_PER_WORKER, HEAVY_TOOL_HEAP_MB, isMemoryBoundTool, MAX_HEAVY_WORKERS, } from './heavy-tool-env.js';
65
- // ---------------------------------------------------------------------------
66
- // Concurrency-limit defaults + override resolution
67
- // ---------------------------------------------------------------------------
68
- /**
69
- * Worst-case resident footprint of ONE `tool:test` / `tool:build` invocation,
70
- * in GiB.
71
- *
72
- * This is not a guess. The heavy-tool overlay permits at most
73
- * `MAX_HEAVY_WORKERS` (6) workers × `HEAVY_TOOL_HEAP_MB` (4096) — the largest
74
- * run budget (T13122) — so a single `pnpm run test` may legitimately hold
75
- * ~24 GiB before any guard fires. Derived from those constants since T13123,
76
- * so the two can no longer drift apart.
77
- *
78
- * @task T12091
79
- */
80
- export const HEAVY_TOOL_FOOTPRINT_GIB = (MAX_HEAVY_WORKERS * HEAVY_TOOL_HEAP_MB) / 1024;
81
- /**
82
- * Share of total RAM all concurrent `typecheck`/`lint` runs together may hold
83
- * (T13123). The other half is for the test/build budget, the OS and whatever
84
- * the operator is running.
85
- */
86
- export const MEMORY_BOUND_RAM_FRACTION = 0.5;
87
- /**
88
- * Resident memory one Node process holds beyond its V8 heap ceiling, in MiB:
89
- * code, native allocations, buffers. The same allowance the heavy worker count
90
- * makes (`GIB_PER_WORKER` minus the heap).
91
- */
92
- export const PROCESS_OVERHEAD_MB = GIB_PER_WORKER * 1024 - HEAVY_TOOL_HEAP_MB;
93
- /**
94
- * Most concurrent `typecheck`/`lint` runs on darwin, however large the Mac
95
- * (T13123). A small fixed number, like the single darwin test slot (T12963).
96
- */
97
- export const DARWIN_MEMORY_BOUND_SLOTS = 2;
98
- /**
99
- * Machine-wide slot count for a single-process memory-bound tool
100
- * (`typecheck`, `lint`): as many runs as fit in {@link MEMORY_BOUND_RAM_FRACTION}
101
- * of RAM at `heap + PROCESS_OVERHEAD_MB` each, at most half the cores, at most
102
- * {@link DARWIN_MEMORY_BOUND_SLOTS} on darwin, never fewer than one. A
103
- * non-finite input fails closed to one slot: a NaN count would read as "no
104
- * bound" in {@link acquireGlobalSlot}.
105
- *
106
- * `lint` is sized like `tsc`: a canonical-level approximation, since `biome`
107
- * is a small native binary while type-aware `eslint` builds a TS program.
108
- *
109
- * Each acquirer sizes the shared slot directory from its own heap, so with
110
- * mixed heaps the bound is as tight as the most permissive acquirer (one large
111
- * run can be over), and a large-heap acquirer, eligible for fewer slots, waits
112
- * longer under steady small-heap load — pressure until T13132's footprint
113
- * scheduler, never a deadlock (the wait times out naming the holders).
114
- */
115
- function memoryBoundSlots(cpus, totalRamGib, platform, heapMb) {
116
- const byRam = Math.floor((totalRamGib * 1024 * MEMORY_BOUND_RAM_FRACTION) / (Math.max(0, heapMb) + PROCESS_OVERHEAD_MB));
117
- const byCpu = Math.floor(cpus / 2);
118
- const slots = Math.min(byRam, byCpu);
119
- if (!Number.isFinite(slots) || slots < 1)
120
- return 1;
121
- return platform === 'darwin' ? Math.min(DARWIN_MEMORY_BOUND_SLOTS, slots) : slots;
41
+ import { admissionCapacityBytes, admit, describeAdmissionIoError, footprintForTool, } from '../resources/admission-ledger.js';
42
+ import { memoryGateReporter } from '../resources/pressure-gate.js';
43
+ /** The default {@link AcquireSlotOptions.notice}: one stderr line. */
44
+ function stderrNotice(line) {
45
+ process.stderr.write(`[cleo] ${line}\n`); // json-stream-hygiene-allowed: progress while waiting; stdout carries the envelope
122
46
  }
47
+ /** Tools whose deprecated `CLEO_TOOL_CONCURRENCY_<TOOL>` notice was printed in this process. */
48
+ const _deprecationNoticed = new Set();
123
49
  /**
124
- * Compute the default max-concurrency for a canonical tool.
125
- *
126
- * ## Why this is RAM-derived, not core-derived (T12091)
127
- *
128
- * This returned `floor(cpus / 4)` for `test`/`build`, which on a 24-core box is
129
- * **6 concurrent full test suites**. Each of those is itself allowed 6 vitest
130
- * forks × a 4 GiB heap cap, so the composed permission was
131
- *
132
- * 6 runs × 6 forks × 4 GiB = 144 GiB
50
+ * The deprecated `CLEO_TOOL_CONCURRENCY_<TOOL>` override: `bypass` for `0` or
51
+ * below, `ignored` for any other number, `null` when unset. Prints one
52
+ * deprecation line per tool per process on stderr, never on stdout.
133
53
  *
134
- * on a 62 GiB machine. Both layers were individually "bounded" and their
135
- * composition was 2.3× the hardware — which is precisely how this box froze
136
- * repeatedly: no single guard was violated. The per-invocation cap (T12087) and
137
- * this cross-invocation cap were written independently and never multiplied out.
54
+ * @param canonical - the canonical tool.
55
+ * @param notice - where the line goes.
56
+ * @returns what the override does now.
138
57
  *
139
- * The dimensional error is the root of it: what limits a test run is MEMORY, and
140
- * core count says nothing about memory. A 24-core/16 GiB VM got the same 6 slots
141
- * as a 24-core/256 GiB server. So heavy tools now divide TOTAL RAM by
142
- * {@link HEAVY_TOOL_FOOTPRINT_GIB} and are additionally capped by cores, never
143
- * exceeding what the machine can actually hold.
144
- *
145
- * Reactive pressure scaling ({@link pressureScaleSlots}) is not a substitute:
146
- * PSI `some avg10` is a ten-second average, and a fork fleet can exhaust RAM
147
- * faster than that window can report it. Admission has to be right up front.
148
- *
149
- * `typecheck` and `lint` are single processes but not light ones (T13123): one
150
- * TypeScript program on a large monorepo holds 2–5 GB, and the half-of-cores
151
- * budget they had was nine slots on an 18-core box — 45 GB of `tsc`. They are
152
- * RAM-derived now too ({@link MEMORY_BOUND_RAM_FRACTION} of RAM at the run's
153
- * heap plus {@link PROCESS_OVERHEAD_MB} each), capped by half the cores. Only
154
- * `audit` and `security-scan` keep the core-derived budget.
155
- *
156
- * ## Why darwin gets one heavy slot (T12963)
157
- *
158
- * Linux shrinks the heavy budget under memory pressure through PSI
159
- * ({@link pressureScaleSlots}). macOS exposes no PSI, so that reactive layer
160
- * never fires there, and a 64 GiB Mac would admit two full suites with nothing
161
- * to back them off. Concurrent agents on a laptop are the common case, so the
162
- * default is one heavy run at a time; `CLEO_TOOL_CONCURRENCY_TEST` /
163
- * `_BUILD` still raise it.
164
- *
165
- * @param canonical - the canonical tool class.
166
- * @param cpuCount - logical cores available.
167
- * @param totalRamGib - total machine RAM in GiB; defaults to a live reading.
168
- * @param platform - OS platform; defaults to `process.platform`.
169
- * @param heapMb - heap ceiling of the run, for `typecheck`/`lint`; defaults to
170
- * {@link defaultSingleProcessHeapMb} for `totalRamGib`.
171
- * @returns the machine-wide slot count, always ≥ 1.
172
- *
173
- * @example
174
- * ```ts
175
- * // 24 cores, 62 GiB → floor(62/24) = 2 (was 6, permitting 144 GiB of heap)
176
- * defaultMaxConcurrent('test', 24, 62); // → 2
177
- * // 24 cores, 16 GiB → 1: one suite is already more than this box can hold
178
- * defaultMaxConcurrent('test', 24, 16); // → 1
179
- * // macOS: no PSI to back off with, so one heavy run at a time
180
- * defaultMaxConcurrent('test', 12, 64, 'darwin'); // → 1
181
- * // 18 cores, 48 GiB: ⌊24576 / (4096 + 2048)⌋ = 4 typechecks (was 9); 2 on darwin
182
- * defaultMaxConcurrent('typecheck', 18, 48, 'linux'); // → 4
183
- * defaultMaxConcurrent('typecheck', 18, 48, 'darwin'); // → 2
184
- * // 4 cores, 8 GiB: one at a time
185
- * defaultMaxConcurrent('typecheck', 4, 8, 'linux'); // → 1
186
- * ```
187
- *
188
- * @task T1534
189
- * @task T12091
190
- * @task T12963
191
- * @task T13123
192
- */
193
- export function defaultMaxConcurrent(canonical, cpuCount, totalRamGib = totalmem() / 1024 ** 3, platform = process.platform, heapMb = defaultSingleProcessHeapMb(totalRamGib)) {
194
- const cpus = Number.isFinite(cpuCount) ? Math.max(1, cpuCount) : 1;
195
- switch (canonical) {
196
- case 'test':
197
- case 'build': {
198
- if (platform === 'darwin')
199
- return 1;
200
- const byRam = Math.floor(totalRamGib / HEAVY_TOOL_FOOTPRINT_GIB);
201
- const byCpu = Math.floor(cpus / 4);
202
- return Math.max(1, Math.min(byRam, byCpu));
203
- }
204
- case 'lint':
205
- case 'typecheck':
206
- return memoryBoundSlots(cpus, totalRamGib, platform, heapMb);
207
- case 'audit':
208
- case 'security-scan':
209
- return Math.max(2, Math.floor(cpus / 2));
210
- default:
211
- return 1;
212
- }
213
- }
214
- /**
215
- * Resolve the active per-tool concurrency limit, honouring the
216
- * `CLEO_TOOL_CONCURRENCY_<CANONICAL>` env override when set. A value of
217
- * `0` (or any non-positive number) disables the bound and returns
218
- * `Number.POSITIVE_INFINITY`, in which case {@link acquireGlobalSlot}
219
- * returns a no-op release.
220
- *
221
- * @task T1534
222
- * @task T12963
223
- * @task T13123
58
+ * @task T13133
224
59
  */
225
- export function resolveMaxConcurrent(canonical, cpuCount, totalRamGib, platform, heapMb) {
226
- const envKey = `CLEO_TOOL_CONCURRENCY_${canonical.toUpperCase().replace(/-/g, '_')}`;
227
- const raw = process.env[envKey];
228
- if (raw !== undefined && raw !== '') {
229
- const parsed = Number.parseInt(raw, 10);
230
- if (Number.isFinite(parsed)) {
231
- if (parsed <= 0)
232
- return Number.POSITIVE_INFINITY;
233
- return parsed;
234
- }
235
- }
236
- const ram = totalRamGib ?? totalmem() / 1024 ** 3;
237
- return defaultMaxConcurrent(canonical, cpuCount ?? availableParallelism(), ram, platform ?? process.platform, heapMb ?? defaultSingleProcessHeapMb(ram));
238
- }
239
- /**
240
- * Whether a canonical tool's slot budget shrinks under memory pressure: every
241
- * memory-bound tool — `test`, `build`, and since T13123 `typecheck` and `lint`.
242
- * `audit` and `security-scan` are network-bound and keep their static budget.
243
- */
244
- function isPressureSensitive(canonical) {
245
- // Delegates rather than repeating the literal. This was the third
246
- // independent definition of "heavy"; all three agreed by coincidence, and a
247
- // fifth heavy tool would have needed three coordinated edits — with a missed
248
- // one producing a SILENT asymmetry (a tool granted the long deadline and the
249
- // worker caps but not a semaphore slot, or the reverse).
250
- return isMemoryBoundTool(canonical);
251
- }
252
- /**
253
- * Scale a static slot budget down under memory pressure (T12001 · choke-point
254
- * #6). Mirrors the governor's `test-run` budget: halve when `some avg10` exceeds
255
- * the hold threshold, floor to 1 when it exceeds the backoff/floor threshold.
256
- * Recovers automatically as pressure clears. `full-build` is not represented as
257
- * a canonical tool here; the dedicated `full-build` governor class (T11999)
258
- * pins that to one machine-wide slot.
259
- *
260
- * @task T12001
261
- */
262
- export function pressureScaleSlots(canonical, staticMax, sample, thresholds = {}) {
263
- if (!Number.isFinite(staticMax) || !isPressureSensitive(canonical))
264
- return staticMax;
265
- const hold = thresholds.holdSomeAvg10 ?? 10;
266
- const floor = thresholds.floorSomeAvg10 ?? 25;
267
- const some = sample.globalPressure?.some?.avg10 ?? sample.slicePressure?.some?.avg10 ?? 0;
268
- if (some > floor)
269
- return 1;
270
- if (some > hold)
271
- return Math.max(1, Math.floor(staticMax / 2));
272
- return staticMax;
273
- }
274
- /**
275
- * Best-effort point-sample for slot scaling. NEVER throws — on any error (no
276
- * `/proc`, non-Linux, read failure) returns `null` so the caller fails open to
277
- * the static slot count. The PSI + meminfo reads are sub-5ms.
278
- */
279
- async function samplePressureSafe() {
280
- try {
281
- return await new ResourceMonitor().sample();
282
- }
283
- catch {
60
+ export function legacyConcurrencyOverride(canonical, notice = stderrNotice) {
61
+ const key = `CLEO_TOOL_CONCURRENCY_${canonical.toUpperCase().replace(/-/g, '_')}`;
62
+ const raw = process.env[key];
63
+ if (raw === undefined || raw === '')
284
64
  return null;
285
- }
286
- }
287
- /**
288
- * Whether an explicit `CLEO_TOOL_CONCURRENCY_<TOOL>` override is set — when so,
289
- * the operator's intent is authoritative and pressure scaling is bypassed.
290
- */
291
- function hasConcurrencyOverride(canonical) {
292
- const raw = process.env[`CLEO_TOOL_CONCURRENCY_${canonical.toUpperCase().replace(/-/g, '_')}`];
293
- return raw !== undefined && raw !== '';
294
- }
295
- /**
296
- * The {@link ResourceGovernor} class a heavy tool run is admitted under, or
297
- * `null` for the rest. `test` and `build` are the classes the governor
298
- * budgets as `test-run` / `scoped-build` (T12963).
299
- */
300
- export function governorClassFor(canonical) {
301
- if (canonical === 'test')
302
- return 'test-run';
303
- if (canonical === 'build')
304
- return 'scoped-build';
305
- return null;
306
- }
307
- /**
308
- * Take the governor slot for a heavy run that already holds its tool slot.
309
- * Returns the grant's release, a no-op when no admission applies, or throws
310
- * when the governor defers within the remaining wait budget.
311
- *
312
- * Skipped under an explicit `CLEO_TOOL_CONCURRENCY_<TOOL>` override: the
313
- * operator's count is authoritative, and the governor's own budget would
314
- * silently cap it.
315
- */
316
- async function admitThroughGovernor(canonical, opts, remainingMs) {
317
- const cls = governorClassFor(canonical);
318
- if (cls === null || opts.skipGovernor === true || hasConcurrencyOverride(canonical)) {
319
- return NOOP_RELEASE;
320
- }
321
- const admission = await governor.acquire(cls, {
322
- timeoutMs: Math.max(1, remainingMs),
323
- ...(opts.pollMs !== undefined ? { pollMs: opts.pollMs } : {}),
324
- ...(opts.cpuCount !== undefined ? { cpuCount: opts.cpuCount } : {}),
325
- ...(opts.totalRamGib !== undefined ? { totalMemBytes: opts.totalRamGib * 1024 ** 3 } : {}),
326
- ...(opts.pressureSample ? { sample: opts.pressureSample } : {}),
327
- });
328
- if (admission.deferred) {
329
- // @sync-invariant none:local-only machine-wide admission timeout; no store write
330
- throw new Error(`Timed out waiting for the '${cls}' resource budget for a '${canonical}' run: ` +
331
- `${admission.reason}. Override with ` +
332
- `CLEO_TOOL_CONCURRENCY_${canonical.toUpperCase().replace(/-/g, '_')}=<n>.`);
333
- }
334
- return admission.release;
335
- }
336
- // ---------------------------------------------------------------------------
337
- // Slot-directory layout
338
- // ---------------------------------------------------------------------------
339
- /**
340
- * Path to the global slot directory for a canonical tool. Sits under
341
- * `getCleoHome()/locks/tool-<canonical>/` so all CLEO-driven processes
342
- * on a machine share the same semaphore — across projects, worktrees,
343
- * and PIDs.
344
- *
345
- * @task T1534
346
- */
347
- export function semaphoreDir(canonical) {
348
- return join(getCleoHome(), 'locks', `tool-${canonical}`);
349
- }
350
- /**
351
- * Path of the sidecar holder record for a slot.
352
- *
353
- * Deliberately a SIBLING of the lock rather than a file inside it:
354
- * `proper-lockfile` removes its lock directory with `rmdir`, which fails if we
355
- * have put anything inside it.
356
- *
357
- * @internal
358
- * @task T12113 (gh#1222)
359
- */
360
- function holderPath(slotPath) {
361
- return `${slotPath}.holder.json`;
362
- }
363
- /**
364
- * Record who holds a slot, and keep the record listing every tool group this
365
- * process starts while it holds the slot (T12963). Best-effort: a failure here
366
- * must never fail an acquire that has already succeeded, because the slot IS
367
- * held at that point and throwing would leak it.
368
- *
369
- * @returns Stops recording tool groups; call it on release.
370
- *
371
- * @internal
372
- * @task T12113 (gh#1222)
373
- * @task T12963
374
- */
375
- function writeHolder(slotPath, canonical) {
376
- let holder;
377
- const recording = recordToolGroupsWhileHeld(slotPath, () => holder);
378
- holder = {
379
- pid: process.pid,
380
- host: hostname(),
381
- acquiredAt: new Date().toISOString(),
382
- canonical,
383
- slot: slotPath,
384
- startedAt: ownProcessStartedAt(),
385
- lockId: currentLockId(slotPath),
386
- toolGroups: [...recording.groups],
387
- };
388
- writeHolderRecord(slotPath, holder);
389
- return recording.stop;
390
- }
391
- /**
392
- * Read a slot's holder record. Returns `null` when absent or unparseable —
393
- * both mean "we cannot say who holds this", which is treated as alive.
394
- *
395
- * @internal
396
- * @task T12113 (gh#1222)
397
- */
398
- export function readHolder(slotPath) {
399
- try {
400
- const parsed = JSON.parse(readFileSync(holderPath(slotPath), 'utf-8'));
401
- if (typeof parsed.pid !== 'number' || typeof parsed.host !== 'string')
402
- return null;
403
- return parsed;
404
- }
405
- catch {
65
+ const parsed = Number.parseInt(raw, 10);
66
+ if (!Number.isFinite(parsed))
406
67
  return null;
68
+ const effect = parsed <= 0 ? 'bypass' : 'ignored';
69
+ if (!_deprecationNoticed.has(key)) {
70
+ _deprecationNoticed.add(key);
71
+ notice(`${key} is deprecated: heavy runs now share one machine-wide memory budget and no ` +
72
+ `longer count slots (T13133). ${effect === 'bypass' ? `${key}=${raw} still bypasses admission for now;` : `${key}=${raw} is ignored;`} ` +
73
+ 'use CLEO_RESOURCES_MODE=off to turn admission off.');
407
74
  }
75
+ return effect;
408
76
  }
409
- /**
410
- * Is a slot's recorded holder still running?
411
- *
412
- * Fails SAFE: an unknown holder, a holder on another host, or any error is
413
- * reported as ALIVE. Reaping a live holder's slot would let two heavy suites
414
- * run against one bound — the exact oversubscription the semaphore exists to
415
- * prevent — so uncertainty must never authorise a reap. A holder whose pid is
416
- * gone but whose tool group still has a member is ALIVE (T12963).
417
- *
418
- * @param holder - Holder record, or `null` when none could be read.
419
- * @param slotPath - The slot the record belongs to. With it, a record that
420
- * does not describe the slot's current lock (or one written before T12963,
421
- * which names no lock) is alive, and a recycled pid is dead.
422
- * @returns `true` when the slot must be treated as legitimately held.
423
- *
424
- * @task T12113 (gh#1222)
425
- * @task T12963
426
- */
427
- export function isHolderAlive(holder, slotPath) {
428
- return assessSlotHolder(holder, slotPath) !== 'dead';
77
+ /** Forget which deprecation notices were printed. Tests only. @internal */
78
+ export function _resetToolSemaphoreForTest() {
79
+ _deprecationNoticed.clear();
429
80
  }
430
81
  /**
431
- * Release a slot whose recorded holder is gone.
82
+ * {@link acquireGlobalSlot} gave up: the run was not admitted within its
83
+ * timeout. `refusal` says why (memory pressure, or the budget in use) and who
84
+ * holds the budget.
432
85
  *
433
- * Removes `proper-lockfile`'s lock directory directly — the same thing its own
434
- * stale recovery does, but decided by process liveness instead of by a 10
435
- * minute mtime timeout. Since T12963 the holder's tool groups must be gone
436
- * too, the record must describe the current lock, and the reap runs under a
437
- * per-slot guard ({@link reapSlotIfHolderDead}).
438
- *
439
- * @param slotPath - Slot lock file path.
440
- * @param staleMs - The slot's `proper-lockfile` stale threshold.
441
- * @returns `true` when an orphaned slot was actually reaped.
442
- *
443
- * @task T12113 (gh#1222)
444
- * @task T12963
86
+ * @task T13133
445
87
  */
446
- export function reapSlotIfOrphaned(slotPath, staleMs = SLOT_LOCK_STALE_MS) {
447
- return reapSlotIfHolderDead(slotPath, readHolder, { staleMs });
448
- }
449
- /**
450
- * Enumerate every slot of a canonical tool with its holder and liveness.
451
- *
452
- * Backs the operator-facing lock inspection surface requested in gh#1222 —
453
- * "who is holding this, and is it even alive?" — which previously required
454
- * reading `~/.local/share/cleo/locks/` by hand.
455
- *
456
- * @param canonical - Canonical tool name.
457
- * @returns One row per existing slot file.
458
- *
459
- * @task T12113 (gh#1222)
460
- */
461
- export function listSlotHolders(canonical) {
462
- const dir = semaphoreDir(canonical);
463
- if (!existsSync(dir))
464
- return [];
465
- const rows = [];
466
- for (let i = 0;; i++) {
467
- const slotPath = join(dir, `slot-${i}.lock`);
468
- if (!existsSync(slotPath))
469
- break;
470
- const holder = readHolder(slotPath);
471
- rows.push({
472
- slot: slotPath,
473
- held: existsSync(`${slotPath}.lock`),
474
- holder,
475
- alive: isHolderAlive(holder, slotPath),
476
- });
88
+ export class AdmissionTimeoutError extends Error {
89
+ /** Why the run was not admitted, with the holders. */
90
+ refusal;
91
+ /**
92
+ * @param canonical - the tool whose run waited.
93
+ * @param refusal - the ledger's refusal.
94
+ */
95
+ constructor(canonical, refusal) {
96
+ super(`Timed out waiting for admission of a '${canonical}' run: ${refusal.reason}.` +
97
+ (refusal.holders.length > 0 ? ` Current holders — ${refusal.holders.join('; ')}.` : '') +
98
+ ' Use CI as test evidence (ci:<pr>), narrow the run, or set CLEO_RESOURCES_MODE=off to turn admission off.');
99
+ this.name = 'AdmissionTimeoutError';
100
+ this.refusal = refusal;
477
101
  }
478
- return rows;
479
102
  }
480
- /**
481
- * Reap every orphaned slot of a canonical tool.
482
- *
483
- * @param canonical - Canonical tool name.
484
- * @returns Paths of the slots actually reaped.
485
- *
486
- * @task T12113 (gh#1222)
487
- */
488
- export function reapOrphanedSlots(canonical) {
489
- const reaped = [];
490
- for (const row of listSlotHolders(canonical)) {
491
- if (row.held && !row.alive && reapSlotIfOrphaned(row.slot))
492
- reaped.push(row.slot);
493
- }
494
- return reaped;
103
+ function withAdmission(release, admission) {
104
+ return Object.assign(release, { admission });
495
105
  }
496
- function ensureSlotFiles(dir, count) {
497
- if (!existsSync(dir)) {
498
- mkdirSync(dir, { recursive: true });
499
- }
500
- const paths = [];
501
- for (let i = 0; i < count; i++) {
502
- const p = join(dir, `slot-${i}.lock`);
503
- if (!existsSync(p)) {
504
- writeFileSync(p, '', 'utf-8');
505
- }
506
- paths.push(p);
507
- }
508
- return paths;
509
- }
510
- // ---------------------------------------------------------------------------
511
- // Acquire / release
512
- // ---------------------------------------------------------------------------
513
- const NOOP_RELEASE = async () => {
514
- /* no-op when concurrency is disabled */
515
- };
106
+ const NOOP_RELEASE = withAdmission(async () => {
107
+ /* nothing was admitted */
108
+ }, '');
516
109
  /**
517
- * Acquire one slot from the global semaphore for a canonical tool. Blocks
518
- * until a slot becomes free or `timeoutMs` elapses.
110
+ * Wait for admission of one evidence run of a canonical tool, machine-wide.
111
+ * Blocks until the ledger admits it or `timeoutMs` elapses.
519
112
  *
520
- * Implementation detail: tries each slot file in turn with `retries: 0`
521
- * (proper-lockfile non-blocking acquire). When all are busy, sleeps for
522
- * `pollMs` and retries. This avoids the thundering-herd cost of having
523
- * many retriers wake at the exact same moment.
113
+ * Re-entrant: inside an admitted run's process tree (a `cleo verify` that a
114
+ * `cleo run` job or another evidence run started) it is admitted at once on
115
+ * that grant. While it waits on memory pressure it says so through
116
+ * {@link AcquireSlotOptions.notice}, and after a minute it names the holders.
524
117
  *
525
118
  * @param canonical - Canonical tool name from the resolver.
526
119
  * @param opts - Acquisition options.
527
- * @returns A release function. Idempotent.
528
- * @throws When `timeoutMs` elapses without acquiring a slot.
120
+ * @returns A release function carrying the `CLEO_ADMISSION` token. Idempotent.
121
+ * @throws When `timeoutMs` elapses without admission, naming the reason and
122
+ * the holders.
529
123
  *
530
124
  * @example
531
125
  * ```ts
532
126
  * const release = await acquireGlobalSlot('test');
533
127
  * try {
534
- * await runTheTool();
128
+ * await runTheTool({ env: { CLEO_ADMISSION: release.admission } });
535
129
  * } finally {
536
130
  * await release();
537
131
  * }
538
132
  * ```
539
133
  *
540
134
  * @task T1534
135
+ * @task T13133
541
136
  */
542
137
  export async function acquireGlobalSlot(canonical, opts = {}) {
543
- const max = resolveMaxConcurrent(canonical, opts.cpuCount, opts.totalRamGib, opts.platform, opts.heapMb);
544
- if (!Number.isFinite(max) || max <= 0) {
138
+ const notice = opts.notice ?? stderrNotice;
139
+ if (opts.skipAdmission === true || legacyConcurrencyOverride(canonical, notice) === 'bypass') {
545
140
  return NOOP_RELEASE;
546
141
  }
547
- // T12001 / choke-point #6: shrink the EFFECTIVE slot count for the
548
- // memory-bound classes under memory pressure so builds/tests/typechecks can't
549
- // co-schedule into an OOM. The static slot FILES are still created (stable dir across
550
- // pressure swings) — only the acquirable window shrinks, and it recovers as
551
- // pressure clears. An explicit CLEO_TOOL_CONCURRENCY_* override is honored
552
- // verbatim, and any sampling failure fails OPEN to the static count.
553
- let effectiveMax = max;
554
- if (isPressureSensitive(canonical) && !hasConcurrencyOverride(canonical)) {
555
- const sample = opts.pressureSample !== undefined ? opts.pressureSample : await samplePressureSafe();
556
- if (sample)
557
- effectiveMax = pressureScaleSlots(canonical, max, sample);
558
- }
559
- const dir = semaphoreDir(canonical);
560
- // Create the full static slot set so the directory is stable; only the first
561
- // `effectiveMax` are eligible this acquire.
562
- const slots = ensureSlotFiles(dir, max);
563
- const usableSlots = slots.slice(0, Math.max(1, effectiveMax));
564
- const timeoutMs = opts.timeoutMs ?? 3_600_000;
565
- const pollMs = opts.pollMs ?? 100;
566
- const staleMs = opts.staleMs ?? 600_000;
567
- const startedAt = Date.now();
568
- // Randomise slot order so concurrent acquirers don't collide on slot 0.
569
- // The Fisher–Yates shuffle is fine for small N.
570
- const order = [...usableSlots.keys()];
571
- for (let i = order.length - 1; i > 0; i--) {
572
- const j = Math.floor(Math.random() * (i + 1));
573
- const a = order[i];
574
- const b = order[j];
575
- if (a !== undefined && b !== undefined) {
576
- order[i] = b;
577
- order[j] = a;
578
- }
142
+ const totalBytes = opts.totalRamGib !== undefined ? opts.totalRamGib * 1024 ** 3 : undefined;
143
+ const fixed = opts.pressureSample;
144
+ const outcome = await admit({
145
+ label: `tool:${canonical}`,
146
+ footprintBytes: opts.footprintBytes ?? footprintForTool(canonical, totalBytes, opts.heapMb),
147
+ // T13237: an evidence build is the project's whole build (`pnpm run
148
+ // build`): it takes the machine-wide full-build slot, like
149
+ // `cleo run --class full-build`.
150
+ ...(canonical === 'build' ? { exclusive: true } : {}),
151
+ ...(opts.scope !== undefined ? { scope: opts.scope } : {}),
152
+ ...(opts.task !== undefined ? { task: opts.task } : {}),
153
+ }, {
154
+ wait: true,
155
+ timeoutMs: opts.timeoutMs ?? 3_600_000,
156
+ ...(opts.pollMs !== undefined ? { pollMs: opts.pollMs } : {}),
157
+ ...(totalBytes !== undefined ? { capacityBytes: admissionCapacityBytes(totalBytes) } : {}),
158
+ // A fixed sample (or none) when given; otherwise the ledger's default.
159
+ ...(fixed === undefined
160
+ ? {}
161
+ : {
162
+ sample: async () => {
163
+ if (fixed === null)
164
+ throw new Error('pressure disabled');
165
+ return fixed;
166
+ },
167
+ }),
168
+ memoryPressure: memoryGateReporter(notice, `'${canonical}' run`),
169
+ notice,
170
+ });
171
+ if (!outcome.admitted) {
172
+ // @sync-invariant none:local-only machine-wide admission timeout; no store write
173
+ throw new AdmissionTimeoutError(canonical, outcome.refusal);
579
174
  }
580
- while (Date.now() - startedAt < timeoutMs) {
581
- for (const idx of order) {
582
- const path = slots[idx];
583
- if (!path)
584
- continue;
585
- let acquired = null;
586
- try {
587
- acquired = await lockfile.lock(path, { retries: 0, stale: staleMs, realpath: false });
588
- }
589
- catch {
590
- // gh#1222: the slot is held — but by whom? proper-lockfile decides
591
- // staleness from mtime, so a process that died without releasing
592
- // holds the slot for the full staleMs (10 min) and is
593
- // indistinguishable from a legitimately slow suite. Ask the holder
594
- // record instead: a dead pid on this host is orphaned NOW. Fails
595
- // safe — an unknown or remote holder is treated as alive.
596
- if (reapSlotIfOrphaned(path, staleMs)) {
597
- try {
598
- acquired = await lockfile.lock(path, { retries: 0, stale: staleMs, realpath: false });
599
- }
600
- catch {
601
- acquired = null; // someone else won the race for the reaped slot
602
- }
603
- }
604
- }
605
- if (acquired) {
606
- const release = acquired;
607
- const stopRecording = writeHolder(path, canonical);
608
- const releaseSlot = async () => {
609
- stopRecording();
610
- // Record first, lock second: once the lock is gone the next holder
611
- // writes its own record, which ours must not delete (T12963).
612
- try {
613
- rmSync(holderPath(path), { force: true });
614
- }
615
- catch {
616
- /* best-effort — a stale holder record is only ever advisory */
617
- }
618
- try {
619
- await release();
620
- }
621
- catch {
622
- // proper-lockfile throws if the lock was already released
623
- // (e.g. via stale recovery). Swallow — the post-condition
624
- // is "slot is free", which is true either way.
625
- }
626
- };
627
- // T12963: the governor slot is taken AFTER the tool slot, so a run
628
- // queued on the tool semaphore holds no governor budget while it waits.
629
- let releaseGrant;
630
- try {
631
- releaseGrant = await admitThroughGovernor(canonical, opts, timeoutMs - (Date.now() - startedAt));
632
- }
633
- catch (err) {
634
- await releaseSlot();
635
- throw err;
636
- }
637
- let released = false;
638
- return async () => {
639
- if (released)
640
- return;
641
- released = true;
642
- await releaseGrant();
643
- await releaseSlot();
644
- };
645
- }
646
- }
647
- // All slots busy — sleep and retry.
648
- await sleep(pollMs);
175
+ const { grant } = outcome;
176
+ if (grant.ungoverned) {
177
+ notice(`${describeAdmissionIoError(grant.ungoverned)}: running the '${canonical}' run ungoverned`);
649
178
  }
650
- // gh#1222: name the holders. "Everything is busy" with no way to see WHO is
651
- // what made an orphaned slot look like a broken semaphore.
652
- const holders = listSlotHolders(canonical)
653
- .filter((r) => r.held)
654
- .map((r) => {
655
- const h = r.holder;
656
- if (!h)
657
- return `${r.slot}: holder unknown`;
658
- const groups = h.toolGroups?.length ? ` with tool group(s) ${h.toolGroups.join(',')}` : '';
659
- return `${r.slot}: pid ${h.pid} on ${h.host}${groups} since ${h.acquiredAt}${r.alive ? '' : ' (DEAD)'}`;
660
- });
661
- throw new Error(`Timed out after ${timeoutMs}ms waiting for a free '${canonical}' tool slot ` +
662
- `(max ${max} concurrent).` +
663
- (holders.length > 0 ? ` Current holders — ${holders.join('; ')}.` : '') +
664
- ` Override with CLEO_TOOL_CONCURRENCY_${canonical.toUpperCase().replace(/-/g, '_')}=<n>.`);
665
- }
666
- function sleep(ms) {
667
- return new Promise((r) => setTimeout(r, ms));
179
+ return withAdmission(() => grant.release(), grant.token);
668
180
  }
669
181
  //# sourceMappingURL=tool-semaphore.js.map