@cleocode/core 2026.10.1 → 2026.10.2

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 (385) hide show
  1. package/dist/build-provenance.json +2 -2
  2. package/dist/cloud/journal.d.ts +9 -5
  3. package/dist/cloud/journal.d.ts.map +1 -1
  4. package/dist/cloud/journal.js +29 -8
  5. package/dist/cloud/journal.js.map +1 -1
  6. package/dist/cloud/manifest-check.d.ts +140 -4
  7. package/dist/cloud/manifest-check.d.ts.map +1 -1
  8. package/dist/cloud/manifest-check.js +309 -10
  9. package/dist/cloud/manifest-check.js.map +1 -1
  10. package/dist/cloud/nexus-attach.d.ts +25 -0
  11. package/dist/cloud/nexus-attach.d.ts.map +1 -1
  12. package/dist/cloud/nexus-attach.js +81 -6
  13. package/dist/cloud/nexus-attach.js.map +1 -1
  14. package/dist/cloud/nexus-cloud-activity.d.ts +37 -0
  15. package/dist/cloud/nexus-cloud-activity.d.ts.map +1 -0
  16. package/dist/cloud/nexus-cloud-activity.js +79 -0
  17. package/dist/cloud/nexus-cloud-activity.js.map +1 -0
  18. package/dist/cloud/nexus-cloud-status.d.ts.map +1 -1
  19. package/dist/cloud/nexus-cloud-status.js +36 -0
  20. package/dist/cloud/nexus-cloud-status.js.map +1 -1
  21. package/dist/cloud/nexus-device.d.ts +1 -1
  22. package/dist/cloud/nexus-enrol.d.ts.map +1 -1
  23. package/dist/cloud/nexus-enrol.js +5 -0
  24. package/dist/cloud/nexus-enrol.js.map +1 -1
  25. package/dist/cloud/nexus-home.d.ts +74 -0
  26. package/dist/cloud/nexus-home.d.ts.map +1 -0
  27. package/dist/cloud/nexus-home.js +97 -0
  28. package/dist/cloud/nexus-home.js.map +1 -0
  29. package/dist/cloud/nexus-vault-keys.d.ts +129 -0
  30. package/dist/cloud/nexus-vault-keys.d.ts.map +1 -0
  31. package/dist/cloud/nexus-vault-keys.js +277 -0
  32. package/dist/cloud/nexus-vault-keys.js.map +1 -0
  33. package/dist/cloud/nexus-vault-state.d.ts +121 -0
  34. package/dist/cloud/nexus-vault-state.d.ts.map +1 -0
  35. package/dist/cloud/nexus-vault-state.js +274 -0
  36. package/dist/cloud/nexus-vault-state.js.map +1 -0
  37. package/dist/cloud/nexus-vault.d.ts +160 -0
  38. package/dist/cloud/nexus-vault.d.ts.map +1 -0
  39. package/dist/cloud/nexus-vault.js +1733 -0
  40. package/dist/cloud/nexus-vault.js.map +1 -0
  41. package/dist/cloud/signing.d.ts +24 -8
  42. package/dist/cloud/signing.d.ts.map +1 -1
  43. package/dist/cloud/signing.js +61 -15
  44. package/dist/cloud/signing.js.map +1 -1
  45. package/dist/docs/export-document.js +8137 -3318
  46. package/dist/docs/export-document.js.map +3 -3
  47. package/dist/doctor/migrations.d.ts +75 -0
  48. package/dist/doctor/migrations.d.ts.map +1 -0
  49. package/dist/doctor/migrations.js +136 -0
  50. package/dist/doctor/migrations.js.map +1 -0
  51. package/dist/doctor/sync-sealer.d.ts +48 -0
  52. package/dist/doctor/sync-sealer.d.ts.map +1 -0
  53. package/dist/doctor/sync-sealer.js +109 -0
  54. package/dist/doctor/sync-sealer.js.map +1 -0
  55. package/dist/doctor/sync-triggers.d.ts +53 -0
  56. package/dist/doctor/sync-triggers.d.ts.map +1 -0
  57. package/dist/doctor/sync-triggers.js +157 -0
  58. package/dist/doctor/sync-triggers.js.map +1 -0
  59. package/dist/init.d.ts.map +1 -1
  60. package/dist/init.js +5 -1
  61. package/dist/init.js.map +1 -1
  62. package/dist/internal.d.ts +1 -1
  63. package/dist/internal.d.ts.map +1 -1
  64. package/dist/internal.js +1 -1
  65. package/dist/internal.js.map +1 -1
  66. package/dist/llm/plugin-facade.js +8442 -3623
  67. package/dist/llm/plugin-facade.js.map +3 -3
  68. package/dist/nexus/projects-clean.d.ts +3 -0
  69. package/dist/nexus/projects-clean.d.ts.map +1 -1
  70. package/dist/nexus/projects-clean.js +9 -3
  71. package/dist/nexus/projects-clean.js.map +1 -1
  72. package/dist/nexus/registry-roots.d.ts +3 -1
  73. package/dist/nexus/registry-roots.d.ts.map +1 -1
  74. package/dist/nexus/registry-roots.js +5 -2
  75. package/dist/nexus/registry-roots.js.map +1 -1
  76. package/dist/nexus/registry.d.ts +8 -1
  77. package/dist/nexus/registry.d.ts.map +1 -1
  78. package/dist/nexus/registry.js +24 -10
  79. package/dist/nexus/registry.js.map +1 -1
  80. package/dist/nexus/workspace.d.ts +4 -1
  81. package/dist/nexus/workspace.d.ts.map +1 -1
  82. package/dist/nexus/workspace.js +10 -4
  83. package/dist/nexus/workspace.js.map +1 -1
  84. package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
  85. package/dist/orchestrate/spawn-ops.js +7 -2
  86. package/dist/orchestrate/spawn-ops.js.map +1 -1
  87. package/dist/orchestrate/worker-verify.d.ts +121 -12
  88. package/dist/orchestrate/worker-verify.d.ts.map +1 -1
  89. package/dist/orchestrate/worker-verify.js +172 -21
  90. package/dist/orchestrate/worker-verify.js.map +1 -1
  91. package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
  92. package/dist/orchestration/spawn-prompt.js +15 -9
  93. package/dist/orchestration/spawn-prompt.js.map +1 -1
  94. package/dist/release/ci-evidence.d.ts +9 -0
  95. package/dist/release/ci-evidence.d.ts.map +1 -1
  96. package/dist/release/ci-evidence.js +9 -2
  97. package/dist/release/ci-evidence.js.map +1 -1
  98. package/dist/resources/backend.d.ts +15 -3
  99. package/dist/resources/backend.d.ts.map +1 -1
  100. package/dist/resources/backend.js +7 -3
  101. package/dist/resources/backend.js.map +1 -1
  102. package/dist/resources/darwin-backend.d.ts +142 -0
  103. package/dist/resources/darwin-backend.d.ts.map +1 -0
  104. package/dist/resources/darwin-backend.js +288 -0
  105. package/dist/resources/darwin-backend.js.map +1 -0
  106. package/dist/resources/governor.d.ts +44 -1
  107. package/dist/resources/governor.d.ts.map +1 -1
  108. package/dist/resources/governor.js +100 -36
  109. package/dist/resources/governor.js.map +1 -1
  110. package/dist/resources/heavy-command.d.ts +132 -0
  111. package/dist/resources/heavy-command.d.ts.map +1 -0
  112. package/dist/resources/heavy-command.js +768 -0
  113. package/dist/resources/heavy-command.js.map +1 -0
  114. package/dist/resources/monitor.d.ts +50 -1
  115. package/dist/resources/monitor.d.ts.map +1 -1
  116. package/dist/resources/monitor.js +83 -1
  117. package/dist/resources/monitor.js.map +1 -1
  118. package/dist/resources/run-admission.d.ts +303 -0
  119. package/dist/resources/run-admission.d.ts.map +1 -0
  120. package/dist/resources/run-admission.js +648 -0
  121. package/dist/resources/run-admission.js.map +1 -0
  122. package/dist/resources/run-class.d.ts +111 -0
  123. package/dist/resources/run-class.d.ts.map +1 -0
  124. package/dist/resources/run-class.js +658 -0
  125. package/dist/resources/run-class.js.map +1 -0
  126. package/dist/resources/run-governed.d.ts +158 -0
  127. package/dist/resources/run-governed.d.ts.map +1 -0
  128. package/dist/resources/run-governed.js +406 -0
  129. package/dist/resources/run-governed.js.map +1 -0
  130. package/dist/resources/slot-holder.d.ts +267 -0
  131. package/dist/resources/slot-holder.d.ts.map +1 -0
  132. package/dist/resources/slot-holder.js +505 -0
  133. package/dist/resources/slot-holder.js.map +1 -0
  134. package/dist/resources/tool-groups.d.ts +74 -0
  135. package/dist/resources/tool-groups.d.ts.map +1 -0
  136. package/dist/resources/tool-groups.js +118 -0
  137. package/dist/resources/tool-groups.js.map +1 -0
  138. package/dist/routing/build-command-groups.d.ts.map +1 -1
  139. package/dist/routing/build-command-groups.js +1 -0
  140. package/dist/routing/build-command-groups.js.map +1 -1
  141. package/dist/selfimprove/fix-gen.js +8446 -3627
  142. package/dist/selfimprove/fix-gen.js.map +3 -3
  143. package/dist/sentient/cross-project-hygiene.d.ts +3 -2
  144. package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
  145. package/dist/sentient/cross-project-hygiene.js +5 -2
  146. package/dist/sentient/cross-project-hygiene.js.map +1 -1
  147. package/dist/sentient/state.d.ts +7 -0
  148. package/dist/sentient/state.d.ts.map +1 -1
  149. package/dist/sentient/state.js.map +1 -1
  150. package/dist/sentient/tick.d.ts +14 -2
  151. package/dist/sentient/tick.d.ts.map +1 -1
  152. package/dist/sentient/tick.js +63 -4
  153. package/dist/sentient/tick.js.map +1 -1
  154. package/dist/store/backup-recover.d.ts.map +1 -1
  155. package/dist/store/backup-recover.js +5 -0
  156. package/dist/store/backup-recover.js.map +1 -1
  157. package/dist/store/data-accessor.d.ts +1 -0
  158. package/dist/store/data-accessor.d.ts.map +1 -1
  159. package/dist/store/data-accessor.js +7 -0
  160. package/dist/store/data-accessor.js.map +1 -1
  161. package/dist/store/dual-scope-db.d.ts +23 -1
  162. package/dist/store/dual-scope-db.d.ts.map +1 -1
  163. package/dist/store/dual-scope-db.js +126 -36
  164. package/dist/store/dual-scope-db.js.map +1 -1
  165. package/dist/store/exodus/recovery.d.ts.map +1 -1
  166. package/dist/store/exodus/recovery.js +15 -0
  167. package/dist/store/exodus/recovery.js.map +1 -1
  168. package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
  169. package/dist/store/legacy-tasks-lineage.js +5 -0
  170. package/dist/store/legacy-tasks-lineage.js.map +1 -1
  171. package/dist/store/lock.d.ts +8 -1
  172. package/dist/store/lock.d.ts.map +1 -1
  173. package/dist/store/lock.js +10 -2
  174. package/dist/store/lock.js.map +1 -1
  175. package/dist/store/migration-manager.d.ts +5 -0
  176. package/dist/store/migration-manager.d.ts.map +1 -1
  177. package/dist/store/migration-manager.js +11 -0
  178. package/dist/store/migration-manager.js.map +1 -1
  179. package/dist/store/migration-runner.d.ts +158 -0
  180. package/dist/store/migration-runner.d.ts.map +1 -0
  181. package/dist/store/migration-runner.js +493 -0
  182. package/dist/store/migration-runner.js.map +1 -0
  183. package/dist/store/portable-bundle-import.d.ts +15 -1
  184. package/dist/store/portable-bundle-import.d.ts.map +1 -1
  185. package/dist/store/portable-bundle-import.js +24 -4
  186. package/dist/store/portable-bundle-import.js.map +1 -1
  187. package/dist/store/portable-bundle-relocate.d.ts +43 -0
  188. package/dist/store/portable-bundle-relocate.d.ts.map +1 -1
  189. package/dist/store/portable-bundle-relocate.js +79 -5
  190. package/dist/store/portable-bundle-relocate.js.map +1 -1
  191. package/dist/store/portable-bundle-scan.d.ts +20 -0
  192. package/dist/store/portable-bundle-scan.d.ts.map +1 -1
  193. package/dist/store/portable-bundle-scan.js +38 -3
  194. package/dist/store/portable-bundle-scan.js.map +1 -1
  195. package/dist/store/portable-bundle.d.ts +33 -0
  196. package/dist/store/portable-bundle.d.ts.map +1 -1
  197. package/dist/store/portable-bundle.js +34 -7
  198. package/dist/store/portable-bundle.js.map +1 -1
  199. package/dist/store/row-identity-registry.d.ts +137 -7
  200. package/dist/store/row-identity-registry.d.ts.map +1 -1
  201. package/dist/store/row-identity-registry.js +364 -9
  202. package/dist/store/row-identity-registry.js.map +1 -1
  203. package/dist/store/row-identity.d.ts.map +1 -1
  204. package/dist/store/row-identity.js +9 -10
  205. package/dist/store/row-identity.js.map +1 -1
  206. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  207. package/dist/store/sqlite-data-accessor.js +10 -0
  208. package/dist/store/sqlite-data-accessor.js.map +1 -1
  209. package/dist/store/sqlite.d.ts +31 -0
  210. package/dist/store/sqlite.d.ts.map +1 -1
  211. package/dist/store/sqlite.js +5 -1
  212. package/dist/store/sqlite.js.map +1 -1
  213. package/dist/store/sync/capture.d.ts +203 -0
  214. package/dist/store/sync/capture.d.ts.map +1 -0
  215. package/dist/store/sync/capture.js +562 -0
  216. package/dist/store/sync/capture.js.map +1 -0
  217. package/dist/store/sync/clock-store.d.ts.map +1 -1
  218. package/dist/store/sync/clock-store.js +2 -0
  219. package/dist/store/sync/clock-store.js.map +1 -1
  220. package/dist/store/sync/fk-orphans.d.ts +133 -0
  221. package/dist/store/sync/fk-orphans.d.ts.map +1 -0
  222. package/dist/store/sync/fk-orphans.js +265 -0
  223. package/dist/store/sync/fk-orphans.js.map +1 -0
  224. package/dist/store/sync/flags.d.ts +7 -0
  225. package/dist/store/sync/flags.d.ts.map +1 -1
  226. package/dist/store/sync/flags.js +16 -0
  227. package/dist/store/sync/flags.js.map +1 -1
  228. package/dist/store/sync/hlc.d.ts.map +1 -1
  229. package/dist/store/sync/hlc.js +4 -0
  230. package/dist/store/sync/hlc.js.map +1 -1
  231. package/dist/store/sync/identity-fill.d.ts +45 -0
  232. package/dist/store/sync/identity-fill.d.ts.map +1 -0
  233. package/dist/store/sync/identity-fill.js +85 -0
  234. package/dist/store/sync/identity-fill.js.map +1 -0
  235. package/dist/store/sync/machinery.d.ts +27 -0
  236. package/dist/store/sync/machinery.d.ts.map +1 -0
  237. package/dist/store/sync/machinery.js +44 -0
  238. package/dist/store/sync/machinery.js.map +1 -0
  239. package/dist/store/sync/netting.d.ts +120 -0
  240. package/dist/store/sync/netting.d.ts.map +1 -0
  241. package/dist/store/sync/netting.js +336 -0
  242. package/dist/store/sync/netting.js.map +1 -0
  243. package/dist/store/sync/replica.d.ts +27 -2
  244. package/dist/store/sync/replica.d.ts.map +1 -1
  245. package/dist/store/sync/replica.js +47 -3
  246. package/dist/store/sync/replica.js.map +1 -1
  247. package/dist/store/sync/schema.d.ts +12 -0
  248. package/dist/store/sync/schema.d.ts.map +1 -1
  249. package/dist/store/sync/schema.js +21 -0
  250. package/dist/store/sync/schema.js.map +1 -1
  251. package/dist/store/sync/seal-backlog.d.ts +21 -0
  252. package/dist/store/sync/seal-backlog.d.ts.map +1 -0
  253. package/dist/store/sync/seal-backlog.js +24 -0
  254. package/dist/store/sync/seal-backlog.js.map +1 -0
  255. package/dist/store/sync/sealer-values.d.ts +34 -0
  256. package/dist/store/sync/sealer-values.d.ts.map +1 -0
  257. package/dist/store/sync/sealer-values.js +53 -0
  258. package/dist/store/sync/sealer-values.js.map +1 -0
  259. package/dist/store/sync/sealer.d.ts +145 -0
  260. package/dist/store/sync/sealer.d.ts.map +1 -0
  261. package/dist/store/sync/sealer.js +906 -0
  262. package/dist/store/sync/sealer.js.map +1 -0
  263. package/dist/store/sync/structural.d.ts +63 -0
  264. package/dist/store/sync/structural.d.ts.map +1 -0
  265. package/dist/store/sync/structural.js +180 -0
  266. package/dist/store/sync/structural.js.map +1 -0
  267. package/dist/store/sync/timestamps.d.ts +92 -0
  268. package/dist/store/sync/timestamps.d.ts.map +1 -0
  269. package/dist/store/sync/timestamps.js +228 -0
  270. package/dist/store/sync/timestamps.js.map +1 -0
  271. package/dist/store/sync/tombstones.d.ts +75 -0
  272. package/dist/store/sync/tombstones.d.ts.map +1 -0
  273. package/dist/store/sync/tombstones.js +103 -0
  274. package/dist/store/sync/tombstones.js.map +1 -0
  275. package/dist/store/sync/trigger-classes.d.ts +221 -0
  276. package/dist/store/sync/trigger-classes.d.ts.map +1 -0
  277. package/dist/store/sync/trigger-classes.js +441 -0
  278. package/dist/store/sync/trigger-classes.js.map +1 -0
  279. package/dist/store/sync/trigger-suspend-at-path.d.ts +23 -0
  280. package/dist/store/sync/trigger-suspend-at-path.d.ts.map +1 -0
  281. package/dist/store/sync/trigger-suspend-at-path.js +44 -0
  282. package/dist/store/sync/trigger-suspend-at-path.js.map +1 -0
  283. package/dist/store/sync/writer-version.d.ts +43 -0
  284. package/dist/store/sync/writer-version.d.ts.map +1 -0
  285. package/dist/store/sync/writer-version.js +90 -0
  286. package/dist/store/sync/writer-version.js.map +1 -0
  287. package/dist/store/table-classification.d.ts.map +1 -1
  288. package/dist/store/table-classification.js +102 -0
  289. package/dist/store/table-classification.js.map +1 -1
  290. package/dist/store/trigger-suspend-schema.d.ts +44 -0
  291. package/dist/store/trigger-suspend-schema.d.ts.map +1 -0
  292. package/dist/store/trigger-suspend-schema.js +25 -0
  293. package/dist/store/trigger-suspend-schema.js.map +1 -0
  294. package/dist/store/vault-manifest.d.ts +365 -0
  295. package/dist/store/vault-manifest.d.ts.map +1 -0
  296. package/dist/store/vault-manifest.js +812 -0
  297. package/dist/store/vault-manifest.js.map +1 -0
  298. package/dist/store/writer-lease.d.ts +31 -0
  299. package/dist/store/writer-lease.d.ts.map +1 -1
  300. package/dist/store/writer-lease.js +65 -2
  301. package/dist/store/writer-lease.js.map +1 -1
  302. package/dist/system/health.d.ts.map +1 -1
  303. package/dist/system/health.js +21 -0
  304. package/dist/system/health.js.map +1 -1
  305. package/dist/system/project-health.d.ts.map +1 -1
  306. package/dist/system/project-health.js +3 -1
  307. package/dist/system/project-health.js.map +1 -1
  308. package/dist/tasks/affected-packages.d.ts +58 -0
  309. package/dist/tasks/affected-packages.d.ts.map +1 -1
  310. package/dist/tasks/affected-packages.js +75 -6
  311. package/dist/tasks/affected-packages.js.map +1 -1
  312. package/dist/tasks/affected-scope.d.ts +150 -23
  313. package/dist/tasks/affected-scope.d.ts.map +1 -1
  314. package/dist/tasks/affected-scope.js +320 -32
  315. package/dist/tasks/affected-scope.js.map +1 -1
  316. package/dist/tasks/change-set.d.ts +96 -0
  317. package/dist/tasks/change-set.d.ts.map +1 -1
  318. package/dist/tasks/change-set.js +169 -4
  319. package/dist/tasks/change-set.js.map +1 -1
  320. package/dist/tasks/complete-ci.d.ts +115 -0
  321. package/dist/tasks/complete-ci.d.ts.map +1 -0
  322. package/dist/tasks/complete-ci.js +171 -0
  323. package/dist/tasks/complete-ci.js.map +1 -0
  324. package/dist/tasks/complete.d.ts.map +1 -1
  325. package/dist/tasks/complete.js +50 -17
  326. package/dist/tasks/complete.js.map +1 -1
  327. package/dist/tasks/compute-task-view.d.ts.map +1 -1
  328. package/dist/tasks/compute-task-view.js +7 -0
  329. package/dist/tasks/compute-task-view.js.map +1 -1
  330. package/dist/tasks/done-plan.d.ts.map +1 -1
  331. package/dist/tasks/done-plan.js +51 -30
  332. package/dist/tasks/done-plan.js.map +1 -1
  333. package/dist/tasks/done-record.d.ts +6 -0
  334. package/dist/tasks/done-record.d.ts.map +1 -1
  335. package/dist/tasks/done-record.js +9 -3
  336. package/dist/tasks/done-record.js.map +1 -1
  337. package/dist/tasks/evidence.d.ts +3 -2
  338. package/dist/tasks/evidence.d.ts.map +1 -1
  339. package/dist/tasks/evidence.js +143 -12
  340. package/dist/tasks/evidence.js.map +1 -1
  341. package/dist/tasks/gate-notes.d.ts +22 -0
  342. package/dist/tasks/gate-notes.d.ts.map +1 -0
  343. package/dist/tasks/gate-notes.js +33 -0
  344. package/dist/tasks/gate-notes.js.map +1 -0
  345. package/dist/tasks/index.d.ts +2 -1
  346. package/dist/tasks/index.d.ts.map +1 -1
  347. package/dist/tasks/index.js +2 -1
  348. package/dist/tasks/index.js.map +1 -1
  349. package/dist/tasks/test-run-binding.d.ts +117 -0
  350. package/dist/tasks/test-run-binding.d.ts.map +1 -0
  351. package/dist/tasks/test-run-binding.js +365 -0
  352. package/dist/tasks/test-run-binding.js.map +1 -0
  353. package/dist/tasks/tool-cache-env.d.ts +123 -0
  354. package/dist/tasks/tool-cache-env.d.ts.map +1 -0
  355. package/dist/tasks/tool-cache-env.js +287 -0
  356. package/dist/tasks/tool-cache-env.js.map +1 -0
  357. package/dist/tasks/tool-cache-failed-first.d.ts +155 -0
  358. package/dist/tasks/tool-cache-failed-first.d.ts.map +1 -0
  359. package/dist/tasks/tool-cache-failed-first.js +285 -0
  360. package/dist/tasks/tool-cache-failed-first.js.map +1 -0
  361. package/dist/tasks/tool-cache.d.ts +375 -55
  362. package/dist/tasks/tool-cache.d.ts.map +1 -1
  363. package/dist/tasks/tool-cache.js +912 -303
  364. package/dist/tasks/tool-cache.js.map +1 -1
  365. package/dist/tasks/tool-resolver.d.ts +4 -3
  366. package/dist/tasks/tool-resolver.d.ts.map +1 -1
  367. package/dist/tasks/tool-resolver.js +15 -4
  368. package/dist/tasks/tool-resolver.js.map +1 -1
  369. package/dist/tasks/tool-semaphore.d.ts +67 -7
  370. package/dist/tasks/tool-semaphore.d.ts.map +1 -1
  371. package/dist/tasks/tool-semaphore.js +134 -56
  372. package/dist/tasks/tool-semaphore.js.map +1 -1
  373. package/dist/upgrade.d.ts.map +1 -1
  374. package/dist/upgrade.js +4 -0
  375. package/dist/upgrade.js.map +1 -1
  376. package/dist/validation/engine-ops.d.ts +6 -0
  377. package/dist/validation/engine-ops.d.ts.map +1 -1
  378. package/dist/validation/engine-ops.js +8 -0
  379. package/dist/validation/engine-ops.js.map +1 -1
  380. package/migrations/drizzle-cleo-project/20260930170000_t12819-trigger-suspend-clause/migration.sql +367 -0
  381. package/migrations/sync-journal/20260930120000_t12343-capture/migration.sql +47 -0
  382. package/migrations/sync-journal/20261001170000_t12984-sealer/migration.sql +101 -0
  383. package/package.json +13 -13
  384. package/templates/CLEO-INJECTION.md +5 -5
  385. package/templates/CLEO-REFERENCE.md +8 -4
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Capture: persistent pure-SQL triggers that record every change to a
3
+ * sync-set row into `_sync_capture`, in the writing statement (journal spec
4
+ * §2.3; S2, `sync.capture`; T12343 AC1 / R4).
5
+ *
6
+ * Per sync-set table the generator emits up to five AFTER triggers, all
7
+ * carrying the `capture` suspension clause (§3.5 Rule 4):
8
+ *
9
+ * | Trigger | Fires on | Records |
10
+ * |---|---|---|
11
+ * | `_sync_cap_<t>_i` | INSERT | full image; identity read from the LIVE row (N4) |
12
+ * | `_sync_cap_<t>_u` | UPDATE OF captured columns, when one changed | changed columns `[old, new]` |
13
+ * | `_sync_cap_<t>_d` | DELETE | full before-image |
14
+ * | `_sync_cap_<t>_k` | UPDATE OF uid / birth_fp of a keyed row | the re-key (H5) |
15
+ * | `_sync_cap_<t>_f` | UPDATE OF uid / birth_fp from NULL | patches the latest live I capture (N4, N11) |
16
+ *
17
+ * - Values are `enc()`-encoded before any JSON function sees them (`quote()`,
18
+ * and `'r' || printf('%!.17g')` for REAL: `-0.0` becomes `0.0`, ±Inf is
19
+ * `Inf` / `-Inf`, L4).
20
+ * - A reference column records `[enc(local key), target uid]`, the uid read at
21
+ * write time (H5). JSON-array references are translated at seal time.
22
+ * - A secret column records only the `<changed>` marker, never its value
23
+ * (§2.7); before-images never hold secret values. `strip` columns are
24
+ * captured whole and stripped at seal. Local-only columns (claim leases)
25
+ * and identity columns never fire an update capture.
26
+ * - Full images are chunked `json_patch(json_object(≤60 pairs), …)` (L3); the
27
+ * update image uses a `UNION ALL` of per-column terms (no argument limit).
28
+ * - Each trigger also writes `_sync_undo` for the same seq, but only while
29
+ * `_sync_meta.undo_enabled` exists (push on, §3.5 Rule 2); S2 runs with it
30
+ * off (shadow mode). Append-only tables keep only `rk` and `uid` there.
31
+ * An update's undo holds only the changed columns, old and new (D5
32
+ * amendment); a delete's holds the full row.
33
+ * - I and D images omit NULL columns: the sender's column set is pinned by
34
+ * its trigger set, so an absent column is NULL.
35
+ *
36
+ * The open pass installs the triggers only to match the persisted
37
+ * `sync.capture` flag ({@link syncCaptureOpenPass}); the kill switch
38
+ * `CLEO_SYNC_CAPTURE=0` never touches them (M3). `accessor.transaction()`
39
+ * opens a frame ({@link openCaptureFrame}); finishing it labels the frame's
40
+ * captures with the connection, frame and kind in one UPDATE
41
+ * ({@link finishCaptureFrame}).
42
+ *
43
+ * @task T12343
44
+ * @module store/sync/capture
45
+ */
46
+ import type { DatabaseSync } from 'node:sqlite';
47
+ import type { TableScope } from '@cleocode/contracts';
48
+ /** How one table is captured. Built from the registries, or by tests. */
49
+ export interface CaptureTableDef {
50
+ readonly table: string;
51
+ /** Local key columns (the table's single-row identity on this device). */
52
+ readonly key: readonly string[];
53
+ /** Captured columns, in table order: every column except local-only ones. */
54
+ readonly columns: readonly string[];
55
+ /** Identity columns (recorded, read from the live row on insert; never fire U). */
56
+ readonly identity: readonly string[];
57
+ /** Secret columns: recorded as `<changed>` only. */
58
+ readonly secret: ReadonlySet<string>;
59
+ /** Reference columns: target table and its local key column. */
60
+ readonly refs: ReadonlyMap<string, {
61
+ table: string;
62
+ key: string;
63
+ }>;
64
+ /** Rows never change: undo keeps only `rk` and `uid`. */
65
+ readonly appendOnly: boolean;
66
+ }
67
+ /** One generated trigger. */
68
+ export interface CaptureTrigger {
69
+ readonly name: string;
70
+ readonly table: string;
71
+ readonly sql: string;
72
+ /** Every table the trigger's text references (SYNC_TRIGGER_REFS, N3). */
73
+ readonly refs: readonly string[];
74
+ }
75
+ /** Largest number of key/value pairs per `json_object` call (L3). */
76
+ export declare const JSON_OBJECT_CHUNK = 60;
77
+ /** The marker a secret column records instead of its value (§2.7). */
78
+ export declare const SECRET_MARKER = "<changed>";
79
+ /** `enc(v)`: lossless text for any SQLite value (§2.3). */
80
+ export declare function enc(expr: string): string;
81
+ /** Wall milliseconds from SQLite's clock, valid on every shipped SQLite (§1.2). */
82
+ export declare const AT_MS_SQL = "CAST((julianday('now') - 2440587.5) * 86400000 AS INTEGER)";
83
+ /** The sync set: portable, not frozen-legacy, declared in ROW_IDENTITY (§2.1). */
84
+ export declare function syncSetTables(scope: TableScope): string[];
85
+ /**
86
+ * The capture definition of a sync-set table in this store, or `undefined`
87
+ * when the table is absent or not in the sync set.
88
+ */
89
+ export declare function captureTableDef(db: DatabaseSync, scope: TableScope, table: string): CaptureTableDef | undefined;
90
+ /** `json_patch(json_object(≤60 pairs), …)` over `pairs` (L3). */
91
+ export declare function chunkedObject(pairs: ReadonlyArray<readonly [string, string]>): string;
92
+ /**
93
+ * Generate every capture trigger for one table. Pure: the same definition
94
+ * always yields the same text, so the open pass can compare live text.
95
+ */
96
+ export declare function captureTriggers(def: CaptureTableDef): CaptureTrigger[];
97
+ /**
98
+ * Re-mint captures (T12806 × S2): a captured write that CLEARED a row's
99
+ * identity (a snapshot-overwrite import: K old → NULL) is followed by a fill
100
+ * that mints the new uid outside capture (the open-time fill runs with the
101
+ * capture triggers dropped). For every such row, write the K that journals
102
+ * the new identity (NULL → new uid, and birth_fp), so the pair nets to
103
+ * old → new. Call inside the fill's bracket, after the fill.
104
+ *
105
+ * A row qualifies when its latest live K capture set the uid to NULL and the
106
+ * row now has a uid. Undo is written only while `undo_enabled` (Rule 2).
107
+ *
108
+ * @returns K captures written, per table.
109
+ */
110
+ export declare function captureRemints(db: DatabaseSync, scope: TableScope): Record<string, number>;
111
+ /** Every capture trigger for the store's sync set. */
112
+ export declare function generateCaptureTriggers(db: DatabaseSync, scope: TableScope): CaptureTrigger[];
113
+ /** SYNC_TRIGGER_REFS: trigger → every table its text references (N3). */
114
+ export declare function syncTriggerRefs(db: DatabaseSync, scope: TableScope): Map<string, readonly string[]>;
115
+ /** What {@link installCaptureTriggers} changed. */
116
+ export interface CaptureInstallReport {
117
+ readonly installed: string[];
118
+ readonly replaced: string[];
119
+ readonly dropped: string[];
120
+ }
121
+ /**
122
+ * Make the live capture triggers exactly the generated set: create the
123
+ * missing, replace the differing, drop the orphaned. Writes nothing when
124
+ * they already match. Requires the sync schema.
125
+ */
126
+ export declare function installCaptureTriggers(db: DatabaseSync, scope: TableScope): CaptureInstallReport;
127
+ /** Drop every capture trigger. Returns their names. */
128
+ export declare function dropCaptureTriggers(db: DatabaseSync): string[];
129
+ /**
130
+ * Install the provenance stamp on a chokepoint connection (§2.3). A
131
+ * persistent trigger cannot read a TEMP table, so the capture triggers write
132
+ * rows unlabelled; the labels (connection, frame, kind) are written ONCE per
133
+ * frame by {@link finishCaptureFrame}, over the frame's seq range. Writes are
134
+ * serialized by the write lock, so every capture from the frame's
135
+ * `first_seq` on belongs to it. This replaces a TEMP trigger that ran one
136
+ * UPDATE per capture (S2 insert-path ruling (a)). Also turns
137
+ * `recursive_triggers` on for this connection (M1; the REPLACE audit is
138
+ * T12787's zero-tolerance ban plus `recursive-triggers-audit.test.ts`).
139
+ *
140
+ * @returns This connection's id.
141
+ */
142
+ export declare function installCaptureStamp(db: DatabaseSync): string;
143
+ /** Remove the stamp (capture turned off, or the sync tables dropped). */
144
+ export declare function removeCaptureStamp(db: DatabaseSync): void;
145
+ /** Whether this connection carries the capture stamp. */
146
+ export declare function hasCaptureStamp(db: DatabaseSync): boolean;
147
+ /** The kinds a frame can have (§2.3). */
148
+ export type FrameKind = 'write' | 'apply' | 'rebase' | 'repair' | 'exodus' | 'import' | 'remint' | 'rekey';
149
+ /**
150
+ * Open a frame for the caller's transaction, right after its
151
+ * `BEGIN IMMEDIATE`: insert the `_sync_frame` row with the first seq its
152
+ * captures can take. A connection without the stamp (capture off) gets
153
+ * `null` and nothing is written.
154
+ */
155
+ export declare function openCaptureFrame(db: DatabaseSync, kind?: FrameKind, actor?: string | null): string | null;
156
+ /**
157
+ * Before COMMIT: label the frame's captures and undo rows (one UPDATE each
158
+ * over its seq range), drop the undo of an `apply` / `rebase` frame (D1), and
159
+ * delete the frame's row when no capture carries it, so a read-only
160
+ * transaction leaves nothing (N10). A transaction that commits without this
161
+ * call leaves its captures unframed, never mislabelled.
162
+ */
163
+ export declare function finishCaptureFrame(db: DatabaseSync, frame: string | null): void;
164
+ /**
165
+ * In `finally`: nothing is left to clear (the labels are written by
166
+ * {@link finishCaptureFrame}); kept so callers need not change.
167
+ */
168
+ export declare function clearCaptureFrame(_db: DatabaseSync, _frame: string | null): void;
169
+ /**
170
+ * `cleo sync capture on|off` (the storage primitive): persist the flag and
171
+ * install or drop the triggers, in one transaction.
172
+ */
173
+ export declare function setCaptureEnabled(db: DatabaseSync, scope: TableScope, on: boolean, options?: {
174
+ schemaRoot?: string;
175
+ }): CaptureInstallReport | {
176
+ dropped: string[];
177
+ };
178
+ /** What the capture open pass did. */
179
+ export type CaptureOpenResult = {
180
+ readonly capture: 'off';
181
+ readonly dropped: string[];
182
+ } | {
183
+ readonly capture: 'on';
184
+ readonly report: CaptureInstallReport;
185
+ readonly conn: string;
186
+ };
187
+ /**
188
+ * The capture step of the open pass, after migrations: triggers match the
189
+ * persisted flag. With the flag off and no trigger present it only reads.
190
+ */
191
+ export declare function syncCaptureOpenPass(db: DatabaseSync, scope: TableScope, options?: {
192
+ schemaRoot?: string;
193
+ }): CaptureOpenResult;
194
+ /**
195
+ * Migration-runner hooks (§2.3a rules 1 and 5): drop every capture trigger
196
+ * inside the bracket before a migration's statements, and regenerate them for
197
+ * the new schema before its COMMIT. Only when capture is on.
198
+ */
199
+ export declare function captureBracketHooks(db: DatabaseSync, scope: TableScope): {
200
+ suspendCapture?(db: DatabaseSync): void;
201
+ reinstallCapture?(db: DatabaseSync): void;
202
+ };
203
+ //# sourceMappingURL=capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/store/sync/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAoBtE,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,6BAA6B;AAC7B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,sEAAsE;AACtE,eA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