@cleocode/core 2026.9.20 → 2026.9.22

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 (961) hide show
  1. package/dist/adapters/discovery.d.ts.map +1 -1
  2. package/dist/adapters/discovery.js +3 -10
  3. package/dist/adapters/discovery.js.map +1 -1
  4. package/dist/adrs/link-pipeline.js +2 -2
  5. package/dist/adrs/link-pipeline.js.map +1 -1
  6. package/dist/adrs/parse.js +3 -3
  7. package/dist/adrs/parse.js.map +1 -1
  8. package/dist/agents/invoke-meta-agent.d.ts.map +1 -1
  9. package/dist/agents/invoke-meta-agent.js +8 -4
  10. package/dist/agents/invoke-meta-agent.js.map +1 -1
  11. package/dist/agents/scaffold.d.ts.map +1 -1
  12. package/dist/agents/scaffold.js +0 -1
  13. package/dist/agents/scaffold.js.map +1 -1
  14. package/dist/bootstrap.d.ts +5 -1
  15. package/dist/bootstrap.d.ts.map +1 -1
  16. package/dist/bootstrap.js +45 -21
  17. package/dist/bootstrap.js.map +1 -1
  18. package/dist/cloud/crypto.d.ts +47 -0
  19. package/dist/cloud/crypto.d.ts.map +1 -0
  20. package/dist/cloud/crypto.js +223 -0
  21. package/dist/cloud/crypto.js.map +1 -0
  22. package/dist/cloud/http.d.ts +52 -0
  23. package/dist/cloud/http.d.ts.map +1 -0
  24. package/dist/cloud/http.js +98 -0
  25. package/dist/cloud/http.js.map +1 -0
  26. package/dist/cloud/index.d.ts +19 -0
  27. package/dist/cloud/index.d.ts.map +1 -0
  28. package/dist/cloud/index.js +19 -0
  29. package/dist/cloud/index.js.map +1 -0
  30. package/dist/cloud/journal.d.ts +169 -0
  31. package/dist/cloud/journal.d.ts.map +1 -0
  32. package/dist/cloud/journal.js +428 -0
  33. package/dist/cloud/journal.js.map +1 -0
  34. package/dist/cloud/keys.d.ts +213 -0
  35. package/dist/cloud/keys.d.ts.map +1 -0
  36. package/dist/cloud/keys.js +362 -0
  37. package/dist/cloud/keys.js.map +1 -0
  38. package/dist/cloud/manifest-check.d.ts +36 -0
  39. package/dist/cloud/manifest-check.d.ts.map +1 -0
  40. package/dist/cloud/manifest-check.js +70 -0
  41. package/dist/cloud/manifest-check.js.map +1 -0
  42. package/dist/cloud/projects.d.ts +13 -0
  43. package/dist/cloud/projects.d.ts.map +1 -0
  44. package/dist/cloud/projects.js +11 -0
  45. package/dist/cloud/projects.js.map +1 -0
  46. package/dist/cloud/signing.d.ts +105 -0
  47. package/dist/cloud/signing.d.ts.map +1 -0
  48. package/dist/cloud/signing.js +117 -0
  49. package/dist/cloud/signing.js.map +1 -0
  50. package/dist/cloud/streams.d.ts +6 -0
  51. package/dist/cloud/streams.d.ts.map +1 -0
  52. package/dist/cloud/streams.js +5 -0
  53. package/dist/cloud/streams.js.map +1 -0
  54. package/dist/decide/audit.d.ts +131 -0
  55. package/dist/decide/audit.d.ts.map +1 -0
  56. package/dist/decide/audit.js +98 -0
  57. package/dist/decide/audit.js.map +1 -0
  58. package/dist/decide/budget.d.ts +91 -0
  59. package/dist/decide/budget.d.ts.map +1 -0
  60. package/dist/decide/budget.js +194 -0
  61. package/dist/decide/budget.js.map +1 -0
  62. package/dist/decide/cache.d.ts +49 -0
  63. package/dist/decide/cache.d.ts.map +1 -0
  64. package/dist/decide/cache.js +87 -0
  65. package/dist/decide/cache.js.map +1 -0
  66. package/dist/decide/client.d.ts +103 -0
  67. package/dist/decide/client.d.ts.map +1 -0
  68. package/dist/decide/client.js +262 -0
  69. package/dist/decide/client.js.map +1 -0
  70. package/dist/decide/credentials.d.ts +159 -0
  71. package/dist/decide/credentials.d.ts.map +1 -0
  72. package/dist/decide/credentials.js +383 -0
  73. package/dist/decide/credentials.js.map +1 -0
  74. package/dist/decide/index.d.ts +18 -0
  75. package/dist/decide/index.d.ts.map +1 -0
  76. package/dist/decide/index.js +18 -0
  77. package/dist/decide/index.js.map +1 -0
  78. package/dist/decide/jev-wire.d.ts +155 -0
  79. package/dist/decide/jev-wire.d.ts.map +1 -0
  80. package/dist/decide/jev-wire.js +420 -0
  81. package/dist/decide/jev-wire.js.map +1 -0
  82. package/dist/decide/operations.d.ts +152 -0
  83. package/dist/decide/operations.d.ts.map +1 -0
  84. package/dist/decide/operations.js +199 -0
  85. package/dist/decide/operations.js.map +1 -0
  86. package/dist/decide/provider.d.ts +90 -0
  87. package/dist/decide/provider.d.ts.map +1 -0
  88. package/dist/decide/provider.js +43 -0
  89. package/dist/decide/provider.js.map +1 -0
  90. package/dist/decide/site.d.ts +148 -0
  91. package/dist/decide/site.d.ts.map +1 -0
  92. package/dist/decide/site.js +181 -0
  93. package/dist/decide/site.js.map +1 -0
  94. package/dist/decide/transport.d.ts +67 -0
  95. package/dist/decide/transport.d.ts.map +1 -0
  96. package/dist/decide/transport.js +350 -0
  97. package/dist/decide/transport.js.map +1 -0
  98. package/dist/dispatch/mutate-projection.d.ts.map +1 -1
  99. package/dist/dispatch/mutate-projection.js +5 -0
  100. package/dist/dispatch/mutate-projection.js.map +1 -1
  101. package/dist/docs/docs-update.d.ts.map +1 -1
  102. package/dist/docs/docs-update.js +25 -9
  103. package/dist/docs/docs-update.js.map +1 -1
  104. package/dist/docs/export-document.js +5963 -2406
  105. package/dist/docs/export-document.js.map +3 -3
  106. package/dist/docs/index.d.ts +2 -2
  107. package/dist/docs/index.d.ts.map +1 -1
  108. package/dist/docs/index.js +1 -1
  109. package/dist/docs/index.js.map +1 -1
  110. package/dist/docs/projection.d.ts.map +1 -1
  111. package/dist/docs/projection.js +2 -3
  112. package/dist/docs/projection.js.map +1 -1
  113. package/dist/docs/publish-pr.d.ts +69 -1
  114. package/dist/docs/publish-pr.d.ts.map +1 -1
  115. package/dist/docs/publish-pr.js +112 -10
  116. package/dist/docs/publish-pr.js.map +1 -1
  117. package/dist/doctor/db-substrate.d.ts +13 -8
  118. package/dist/doctor/db-substrate.d.ts.map +1 -1
  119. package/dist/doctor/db-substrate.js +39 -26
  120. package/dist/doctor/db-substrate.js.map +1 -1
  121. package/dist/doctor/index.d.ts +2 -0
  122. package/dist/doctor/index.d.ts.map +1 -1
  123. package/dist/doctor/index.js +1 -0
  124. package/dist/doctor/index.js.map +1 -1
  125. package/dist/doctor/knowledge.d.ts +16 -1
  126. package/dist/doctor/knowledge.d.ts.map +1 -1
  127. package/dist/doctor/knowledge.js +58 -32
  128. package/dist/doctor/knowledge.js.map +1 -1
  129. package/dist/doctor/nexus-schema-residency.d.ts +1 -1
  130. package/dist/doctor/nexus-schema-residency.d.ts.map +1 -1
  131. package/dist/doctor/nexus-schema-residency.js +3 -0
  132. package/dist/doctor/nexus-schema-residency.js.map +1 -1
  133. package/dist/doctor/project-identity.d.ts +44 -1
  134. package/dist/doctor/project-identity.d.ts.map +1 -1
  135. package/dist/doctor/project-identity.js +237 -10
  136. package/dist/doctor/project-identity.js.map +1 -1
  137. package/dist/doctor/projects.d.ts +170 -0
  138. package/dist/doctor/projects.d.ts.map +1 -0
  139. package/dist/doctor/projects.js +1075 -0
  140. package/dist/doctor/projects.js.map +1 -0
  141. package/dist/doctor/twin-collapse.d.ts +97 -0
  142. package/dist/doctor/twin-collapse.d.ts.map +1 -0
  143. package/dist/doctor/twin-collapse.js +168 -0
  144. package/dist/doctor/twin-collapse.js.map +1 -0
  145. package/dist/doctor/worktree-orphans.d.ts.map +1 -1
  146. package/dist/doctor/worktree-orphans.js +13 -29
  147. package/dist/doctor/worktree-orphans.js.map +1 -1
  148. package/dist/doctor/worktree-stores.d.ts +128 -0
  149. package/dist/doctor/worktree-stores.d.ts.map +1 -0
  150. package/dist/doctor/worktree-stores.js +374 -0
  151. package/dist/doctor/worktree-stores.js.map +1 -0
  152. package/dist/engine/engine-ops.d.ts +36 -6
  153. package/dist/engine/engine-ops.d.ts.map +1 -1
  154. package/dist/engine/engine-ops.js +115 -14
  155. package/dist/engine/engine-ops.js.map +1 -1
  156. package/dist/error-catalog.d.ts.map +1 -1
  157. package/dist/error-catalog.js +21 -0
  158. package/dist/error-catalog.js.map +1 -1
  159. package/dist/error-registry.d.ts.map +1 -1
  160. package/dist/error-registry.js +40 -0
  161. package/dist/error-registry.js.map +1 -1
  162. package/dist/gateway-client/generated/types.gen.d.ts +1 -1
  163. package/dist/gc/cleanup.d.ts.map +1 -1
  164. package/dist/gc/cleanup.js +32 -19
  165. package/dist/gc/cleanup.js.map +1 -1
  166. package/dist/git/bounded-git.d.ts +170 -0
  167. package/dist/git/bounded-git.d.ts.map +1 -0
  168. package/dist/git/bounded-git.js +371 -0
  169. package/dist/git/bounded-git.js.map +1 -0
  170. package/dist/git/work-tree.d.ts +20 -0
  171. package/dist/git/work-tree.d.ts.map +1 -1
  172. package/dist/git/work-tree.js +20 -2
  173. package/dist/git/work-tree.js.map +1 -1
  174. package/dist/hooks/handlers/session-hooks.d.ts +11 -26
  175. package/dist/hooks/handlers/session-hooks.d.ts.map +1 -1
  176. package/dist/hooks/handlers/session-hooks.js +18 -47
  177. package/dist/hooks/handlers/session-hooks.js.map +1 -1
  178. package/dist/hooks/payload-schemas.d.ts +2 -2
  179. package/dist/index.d.ts +8 -5
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/index.js +6 -3
  182. package/dist/index.js.map +1 -1
  183. package/dist/init/engine-ops.d.ts.map +1 -1
  184. package/dist/init/engine-ops.js +23 -1
  185. package/dist/init/engine-ops.js.map +1 -1
  186. package/dist/init.d.ts +158 -1
  187. package/dist/init.d.ts.map +1 -1
  188. package/dist/init.js +578 -53
  189. package/dist/init.js.map +1 -1
  190. package/dist/inject/index.d.ts.map +1 -1
  191. package/dist/inject/index.js +8 -3
  192. package/dist/inject/index.js.map +1 -1
  193. package/dist/injection.d.ts +55 -0
  194. package/dist/injection.d.ts.map +1 -1
  195. package/dist/injection.js +102 -6
  196. package/dist/injection.js.map +1 -1
  197. package/dist/internal.d.ts +11 -7
  198. package/dist/internal.d.ts.map +1 -1
  199. package/dist/internal.js +9 -5
  200. package/dist/internal.js.map +1 -1
  201. package/dist/issue/diagnostics.d.ts.map +1 -1
  202. package/dist/issue/diagnostics.js +2 -1
  203. package/dist/issue/diagnostics.js.map +1 -1
  204. package/dist/lib/concurrency.d.ts +25 -0
  205. package/dist/lib/concurrency.d.ts.map +1 -0
  206. package/dist/lib/concurrency.js +43 -0
  207. package/dist/lib/concurrency.js.map +1 -0
  208. package/dist/lib/index.d.ts +1 -0
  209. package/dist/lib/index.d.ts.map +1 -1
  210. package/dist/lib/index.js +1 -0
  211. package/dist/lib/index.js.map +1 -1
  212. package/dist/lifecycle/engine-ops.d.ts.map +1 -1
  213. package/dist/lifecycle/engine-ops.js +4 -2
  214. package/dist/lifecycle/engine-ops.js.map +1 -1
  215. package/dist/lifecycle/stage-guidance.d.ts +5 -0
  216. package/dist/lifecycle/stage-guidance.d.ts.map +1 -1
  217. package/dist/lifecycle/stage-guidance.js +14 -4
  218. package/dist/lifecycle/stage-guidance.js.map +1 -1
  219. package/dist/llm/catalog-cache.d.ts +3 -2
  220. package/dist/llm/catalog-cache.d.ts.map +1 -1
  221. package/dist/llm/catalog-cache.js +5 -5
  222. package/dist/llm/catalog-cache.js.map +1 -1
  223. package/dist/llm/credentials.d.ts +4 -4
  224. package/dist/llm/credentials.js +6 -6
  225. package/dist/llm/credentials.js.map +1 -1
  226. package/dist/llm/plugin-facade.js +4400 -1801
  227. package/dist/llm/plugin-facade.js.map +3 -3
  228. package/dist/llm/stable-device-id.d.ts.map +1 -1
  229. package/dist/llm/stable-device-id.js +3 -5
  230. package/dist/llm/stable-device-id.js.map +1 -1
  231. package/dist/memory/attention.js +31 -31
  232. package/dist/memory/attention.js.map +1 -1
  233. package/dist/memory/decision-contradiction.d.ts +152 -0
  234. package/dist/memory/decision-contradiction.d.ts.map +1 -0
  235. package/dist/memory/decision-contradiction.js +273 -0
  236. package/dist/memory/decision-contradiction.js.map +1 -0
  237. package/dist/memory/decisions.d.ts +42 -11
  238. package/dist/memory/decisions.d.ts.map +1 -1
  239. package/dist/memory/decisions.js +153 -56
  240. package/dist/memory/decisions.js.map +1 -1
  241. package/dist/memory/dialectic-evaluator.d.ts +7 -0
  242. package/dist/memory/dialectic-evaluator.d.ts.map +1 -1
  243. package/dist/memory/dialectic-evaluator.js +23 -8
  244. package/dist/memory/dialectic-evaluator.js.map +1 -1
  245. package/dist/memory/dispatch-trace-format.d.ts +39 -0
  246. package/dist/memory/dispatch-trace-format.d.ts.map +1 -0
  247. package/dist/memory/dispatch-trace-format.js +54 -0
  248. package/dist/memory/dispatch-trace-format.js.map +1 -0
  249. package/dist/memory/dispatch-trace.d.ts.map +1 -1
  250. package/dist/memory/dispatch-trace.js +1 -27
  251. package/dist/memory/dispatch-trace.js.map +1 -1
  252. package/dist/memory/engine-compat.d.ts +2 -0
  253. package/dist/memory/engine-compat.d.ts.map +1 -1
  254. package/dist/memory/engine-compat.js +1 -0
  255. package/dist/memory/engine-compat.js.map +1 -1
  256. package/dist/memory/import-from-provider.js +3 -3
  257. package/dist/memory/import-from-provider.js.map +1 -1
  258. package/dist/memory/learnings.d.ts +2 -2
  259. package/dist/memory/observation-type-decision.d.ts +96 -0
  260. package/dist/memory/observation-type-decision.d.ts.map +1 -0
  261. package/dist/memory/observation-type-decision.js +218 -0
  262. package/dist/memory/observation-type-decision.js.map +1 -0
  263. package/dist/memory/redaction.js +2 -0
  264. package/dist/memory/redaction.js.map +1 -1
  265. package/dist/memory/retrieval/build-retrieval-bundle.d.ts +9 -2
  266. package/dist/memory/retrieval/build-retrieval-bundle.d.ts.map +1 -1
  267. package/dist/memory/retrieval/build-retrieval-bundle.js +42 -11
  268. package/dist/memory/retrieval/build-retrieval-bundle.js.map +1 -1
  269. package/dist/memory/retrieval/get-current-session-id.d.ts +5 -0
  270. package/dist/memory/retrieval/get-current-session-id.d.ts.map +1 -1
  271. package/dist/memory/retrieval/get-current-session-id.js +7 -2
  272. package/dist/memory/retrieval/get-current-session-id.js.map +1 -1
  273. package/dist/memory/retrieval/observe.d.ts.map +1 -1
  274. package/dist/memory/retrieval/observe.js +30 -29
  275. package/dist/memory/retrieval/observe.js.map +1 -1
  276. package/dist/nexus/analyze-orchestrator.d.ts +38 -0
  277. package/dist/nexus/analyze-orchestrator.d.ts.map +1 -1
  278. package/dist/nexus/analyze-orchestrator.js +136 -48
  279. package/dist/nexus/analyze-orchestrator.js.map +1 -1
  280. package/dist/nexus/assessment-projection.d.ts +76 -0
  281. package/dist/nexus/assessment-projection.d.ts.map +1 -0
  282. package/dist/nexus/assessment-projection.js +143 -0
  283. package/dist/nexus/assessment-projection.js.map +1 -0
  284. package/dist/nexus/assessment-store.d.ts +14 -2
  285. package/dist/nexus/assessment-store.d.ts.map +1 -1
  286. package/dist/nexus/assessment-store.js +21 -3
  287. package/dist/nexus/assessment-store.js.map +1 -1
  288. package/dist/nexus/checkout-nonce.d.ts +48 -0
  289. package/dist/nexus/checkout-nonce.d.ts.map +1 -0
  290. package/dist/nexus/checkout-nonce.js +84 -0
  291. package/dist/nexus/checkout-nonce.js.map +1 -0
  292. package/dist/nexus/devices.d.ts +93 -0
  293. package/dist/nexus/devices.d.ts.map +1 -0
  294. package/dist/nexus/devices.js +141 -0
  295. package/dist/nexus/devices.js.map +1 -0
  296. package/dist/nexus/freshness.d.ts.map +1 -1
  297. package/dist/nexus/freshness.js +25 -6
  298. package/dist/nexus/freshness.js.map +1 -1
  299. package/dist/nexus/git-state.d.ts +225 -0
  300. package/dist/nexus/git-state.d.ts.map +1 -0
  301. package/dist/nexus/git-state.js +677 -0
  302. package/dist/nexus/git-state.js.map +1 -0
  303. package/dist/nexus/graph-manifest.d.ts +20 -4
  304. package/dist/nexus/graph-manifest.d.ts.map +1 -1
  305. package/dist/nexus/graph-manifest.js +40 -5
  306. package/dist/nexus/graph-manifest.js.map +1 -1
  307. package/dist/nexus/identity.d.ts +68 -23
  308. package/dist/nexus/identity.d.ts.map +1 -1
  309. package/dist/nexus/identity.js +99 -22
  310. package/dist/nexus/identity.js.map +1 -1
  311. package/dist/nexus/index.d.ts +5 -2
  312. package/dist/nexus/index.d.ts.map +1 -1
  313. package/dist/nexus/index.js +10 -4
  314. package/dist/nexus/index.js.map +1 -1
  315. package/dist/nexus/knowledge.d.ts +5 -0
  316. package/dist/nexus/knowledge.d.ts.map +1 -1
  317. package/dist/nexus/knowledge.js +40 -5
  318. package/dist/nexus/knowledge.js.map +1 -1
  319. package/dist/nexus/legacy-alias.d.ts +60 -0
  320. package/dist/nexus/legacy-alias.d.ts.map +1 -0
  321. package/dist/nexus/legacy-alias.js +68 -0
  322. package/dist/nexus/legacy-alias.js.map +1 -0
  323. package/dist/nexus/migrate-json-to-sqlite.js +2 -2
  324. package/dist/nexus/migrate-json-to-sqlite.js.map +1 -1
  325. package/dist/nexus/ops.d.ts +1 -0
  326. package/dist/nexus/ops.d.ts.map +1 -1
  327. package/dist/nexus/path-map.d.ts +264 -20
  328. package/dist/nexus/path-map.d.ts.map +1 -1
  329. package/dist/nexus/path-map.js +580 -44
  330. package/dist/nexus/path-map.js.map +1 -1
  331. package/dist/nexus/projects-clean.d.ts +9 -1
  332. package/dist/nexus/projects-clean.d.ts.map +1 -1
  333. package/dist/nexus/projects-clean.js +126 -14
  334. package/dist/nexus/projects-clean.js.map +1 -1
  335. package/dist/nexus/projects-scan.d.ts +56 -1
  336. package/dist/nexus/projects-scan.d.ts.map +1 -1
  337. package/dist/nexus/projects-scan.js +144 -3
  338. package/dist/nexus/projects-scan.js.map +1 -1
  339. package/dist/nexus/registry-hygiene.d.ts +18 -2
  340. package/dist/nexus/registry-hygiene.d.ts.map +1 -1
  341. package/dist/nexus/registry-hygiene.js +37 -11
  342. package/dist/nexus/registry-hygiene.js.map +1 -1
  343. package/dist/nexus/registry-roots.d.ts +47 -0
  344. package/dist/nexus/registry-roots.d.ts.map +1 -0
  345. package/dist/nexus/registry-roots.js +79 -0
  346. package/dist/nexus/registry-roots.js.map +1 -0
  347. package/dist/nexus/registry.d.ts +50 -9
  348. package/dist/nexus/registry.d.ts.map +1 -1
  349. package/dist/nexus/registry.js +311 -156
  350. package/dist/nexus/registry.js.map +1 -1
  351. package/dist/nexus/stored-roots.d.ts +171 -0
  352. package/dist/nexus/stored-roots.d.ts.map +1 -0
  353. package/dist/nexus/stored-roots.js +253 -0
  354. package/dist/nexus/stored-roots.js.map +1 -0
  355. package/dist/nexus/transfer.d.ts.map +1 -1
  356. package/dist/nexus/transfer.js +3 -0
  357. package/dist/nexus/transfer.js.map +1 -1
  358. package/dist/nexus/user-profile-hygiene.d.ts +168 -0
  359. package/dist/nexus/user-profile-hygiene.d.ts.map +1 -0
  360. package/dist/nexus/user-profile-hygiene.js +305 -0
  361. package/dist/nexus/user-profile-hygiene.js.map +1 -0
  362. package/dist/nexus/user-profile.d.ts +53 -2
  363. package/dist/nexus/user-profile.d.ts.map +1 -1
  364. package/dist/nexus/user-profile.js +106 -4
  365. package/dist/nexus/user-profile.js.map +1 -1
  366. package/dist/orchestrate/lifecycle-ops.d.ts.map +1 -1
  367. package/dist/orchestrate/lifecycle-ops.js +4 -1
  368. package/dist/orchestrate/lifecycle-ops.js.map +1 -1
  369. package/dist/orchestrate/pivot.d.ts.map +1 -1
  370. package/dist/orchestrate/pivot.js +5 -1
  371. package/dist/orchestrate/pivot.js.map +1 -1
  372. package/dist/orchestrate/plan.d.ts.map +1 -1
  373. package/dist/orchestrate/plan.js +5 -2
  374. package/dist/orchestrate/plan.js.map +1 -1
  375. package/dist/orchestrate/query-ops.d.ts +7 -2
  376. package/dist/orchestrate/query-ops.d.ts.map +1 -1
  377. package/dist/orchestrate/query-ops.js +17 -6
  378. package/dist/orchestrate/query-ops.js.map +1 -1
  379. package/dist/orchestrate/spawn-ops.d.ts +12 -0
  380. package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
  381. package/dist/orchestrate/spawn-ops.js +157 -71
  382. package/dist/orchestrate/spawn-ops.js.map +1 -1
  383. package/dist/orchestration/bootstrap.d.ts.map +1 -1
  384. package/dist/orchestration/bootstrap.js +4 -2
  385. package/dist/orchestration/bootstrap.js.map +1 -1
  386. package/dist/orchestration/classify-readiness.d.ts +37 -1
  387. package/dist/orchestration/classify-readiness.d.ts.map +1 -1
  388. package/dist/orchestration/classify-readiness.js +48 -19
  389. package/dist/orchestration/classify-readiness.js.map +1 -1
  390. package/dist/orchestration/index.d.ts +4 -2
  391. package/dist/orchestration/index.d.ts.map +1 -1
  392. package/dist/orchestration/index.js +6 -4
  393. package/dist/orchestration/index.js.map +1 -1
  394. package/dist/orchestration/lead-rollup.d.ts +8 -5
  395. package/dist/orchestration/lead-rollup.d.ts.map +1 -1
  396. package/dist/orchestration/lead-rollup.js +32 -15
  397. package/dist/orchestration/lead-rollup.js.map +1 -1
  398. package/dist/orchestration/owner-decision-readiness.d.ts +88 -0
  399. package/dist/orchestration/owner-decision-readiness.d.ts.map +1 -0
  400. package/dist/orchestration/owner-decision-readiness.js +152 -0
  401. package/dist/orchestration/owner-decision-readiness.js.map +1 -0
  402. package/dist/orchestration/parallel.d.ts.map +1 -1
  403. package/dist/orchestration/parallel.js +10 -17
  404. package/dist/orchestration/parallel.js.map +1 -1
  405. package/dist/orchestration/psyche-memory-budget.d.ts +105 -0
  406. package/dist/orchestration/psyche-memory-budget.d.ts.map +1 -0
  407. package/dist/orchestration/psyche-memory-budget.js +383 -0
  408. package/dist/orchestration/psyche-memory-budget.js.map +1 -0
  409. package/dist/orchestration/spawn-prompt.d.ts +16 -2
  410. package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
  411. package/dist/orchestration/spawn-prompt.js +144 -181
  412. package/dist/orchestration/spawn-prompt.js.map +1 -1
  413. package/dist/orchestration/spawn.d.ts +7 -0
  414. package/dist/orchestration/spawn.d.ts.map +1 -1
  415. package/dist/orchestration/spawn.js +1 -0
  416. package/dist/orchestration/spawn.js.map +1 -1
  417. package/dist/orchestration/status.d.ts +8 -3
  418. package/dist/orchestration/status.d.ts.map +1 -1
  419. package/dist/orchestration/status.js +9 -6
  420. package/dist/orchestration/status.js.map +1 -1
  421. package/dist/orchestration/wave-topic.d.ts +54 -0
  422. package/dist/orchestration/wave-topic.d.ts.map +1 -0
  423. package/dist/orchestration/wave-topic.js +68 -0
  424. package/dist/orchestration/wave-topic.js.map +1 -0
  425. package/dist/orchestration/waves.d.ts +47 -8
  426. package/dist/orchestration/waves.d.ts.map +1 -1
  427. package/dist/orchestration/waves.js +152 -43
  428. package/dist/orchestration/waves.js.map +1 -1
  429. package/dist/paths.d.ts +24 -8
  430. package/dist/paths.d.ts.map +1 -1
  431. package/dist/paths.js +135 -71
  432. package/dist/paths.js.map +1 -1
  433. package/dist/phases/index.d.ts.map +1 -1
  434. package/dist/phases/index.js +6 -2
  435. package/dist/phases/index.js.map +1 -1
  436. package/dist/platform.d.ts +6 -1
  437. package/dist/platform.d.ts.map +1 -1
  438. package/dist/platform.js +8 -19
  439. package/dist/platform.js.map +1 -1
  440. package/dist/project-info.d.ts +18 -0
  441. package/dist/project-info.d.ts.map +1 -1
  442. package/dist/project-info.js +29 -1
  443. package/dist/project-info.js.map +1 -1
  444. package/dist/project-lifecycle.d.ts +91 -32
  445. package/dist/project-lifecycle.d.ts.map +1 -1
  446. package/dist/project-lifecycle.js +639 -75
  447. package/dist/project-lifecycle.js.map +1 -1
  448. package/dist/project-scope.d.ts +104 -4
  449. package/dist/project-scope.d.ts.map +1 -1
  450. package/dist/project-scope.js +263 -13
  451. package/dist/project-scope.js.map +1 -1
  452. package/dist/project-tombstone.d.ts +111 -0
  453. package/dist/project-tombstone.d.ts.map +1 -0
  454. package/dist/project-tombstone.js +220 -0
  455. package/dist/project-tombstone.js.map +1 -0
  456. package/dist/release/artifacts.d.ts.map +1 -1
  457. package/dist/release/artifacts.js +14 -9
  458. package/dist/release/artifacts.js.map +1 -1
  459. package/dist/release/ci-evidence.d.ts +233 -0
  460. package/dist/release/ci-evidence.d.ts.map +1 -0
  461. package/dist/release/ci-evidence.js +668 -0
  462. package/dist/release/ci-evidence.js.map +1 -0
  463. package/dist/release/engine-ops.d.ts.map +1 -1
  464. package/dist/release/engine-ops.js +3 -3
  465. package/dist/release/engine-ops.js.map +1 -1
  466. package/dist/release/github-pr.d.ts +30 -0
  467. package/dist/release/github-pr.d.ts.map +1 -1
  468. package/dist/release/github-pr.js +40 -0
  469. package/dist/release/github-pr.js.map +1 -1
  470. package/dist/release/plan.d.ts.map +1 -1
  471. package/dist/release/plan.js +11 -7
  472. package/dist/release/plan.js.map +1 -1
  473. package/dist/release/pr-evidence.d.ts +38 -0
  474. package/dist/release/pr-evidence.d.ts.map +1 -1
  475. package/dist/release/pr-evidence.js +79 -15
  476. package/dist/release/pr-evidence.js.map +1 -1
  477. package/dist/release/reconcile.d.ts.map +1 -1
  478. package/dist/release/reconcile.js +3 -2
  479. package/dist/release/reconcile.js.map +1 -1
  480. package/dist/release/release-manifest.d.ts +2 -1
  481. package/dist/release/release-manifest.d.ts.map +1 -1
  482. package/dist/release/release-manifest.js +6 -5
  483. package/dist/release/release-manifest.js.map +1 -1
  484. package/dist/render/nexus/graph/index.d.ts +4 -0
  485. package/dist/render/nexus/graph/index.d.ts.map +1 -1
  486. package/dist/render/nexus/graph/index.js +57 -0
  487. package/dist/render/nexus/graph/index.js.map +1 -1
  488. package/dist/resources/spawn-wrapper.d.ts +8 -1
  489. package/dist/resources/spawn-wrapper.d.ts.map +1 -1
  490. package/dist/resources/spawn-wrapper.js +42 -5
  491. package/dist/resources/spawn-wrapper.js.map +1 -1
  492. package/dist/routing/build-command-groups.d.ts.map +1 -1
  493. package/dist/routing/build-command-groups.js +1 -0
  494. package/dist/routing/build-command-groups.js.map +1 -1
  495. package/dist/sagas/index.d.ts +1 -1
  496. package/dist/sagas/index.d.ts.map +1 -1
  497. package/dist/sagas/index.js +1 -1
  498. package/dist/sagas/index.js.map +1 -1
  499. package/dist/sagas/reconcile.d.ts +24 -4
  500. package/dist/sagas/reconcile.d.ts.map +1 -1
  501. package/dist/sagas/reconcile.js +226 -100
  502. package/dist/sagas/reconcile.js.map +1 -1
  503. package/dist/scaffold/ensure-config.d.ts.map +1 -1
  504. package/dist/scaffold/ensure-config.js +31 -1
  505. package/dist/scaffold/ensure-config.js.map +1 -1
  506. package/dist/scaffold/project-identity.d.ts +2 -8
  507. package/dist/scaffold/project-identity.d.ts.map +1 -1
  508. package/dist/scaffold/project-identity.js +5 -21
  509. package/dist/scaffold/project-identity.js.map +1 -1
  510. package/dist/security/input-sanitization.d.ts +9 -1
  511. package/dist/security/input-sanitization.d.ts.map +1 -1
  512. package/dist/security/input-sanitization.js +20 -3
  513. package/dist/security/input-sanitization.js.map +1 -1
  514. package/dist/selfimprove/fix-gen.js +4409 -1810
  515. package/dist/selfimprove/fix-gen.js.map +3 -3
  516. package/dist/sentient/propose-tick.d.ts.map +1 -1
  517. package/dist/sentient/propose-tick.js +4 -2
  518. package/dist/sentient/propose-tick.js.map +1 -1
  519. package/dist/sequence/index.d.ts.map +1 -1
  520. package/dist/sequence/index.js +6 -23
  521. package/dist/sequence/index.js.map +1 -1
  522. package/dist/session/engine-ops.d.ts +15 -0
  523. package/dist/session/engine-ops.d.ts.map +1 -1
  524. package/dist/session/engine-ops.js +146 -22
  525. package/dist/session/engine-ops.js.map +1 -1
  526. package/dist/sessions/assumptions.d.ts.map +1 -1
  527. package/dist/sessions/assumptions.js +7 -4
  528. package/dist/sessions/assumptions.js.map +1 -1
  529. package/dist/sessions/briefing.d.ts +23 -0
  530. package/dist/sessions/briefing.d.ts.map +1 -1
  531. package/dist/sessions/briefing.js +59 -9
  532. package/dist/sessions/briefing.js.map +1 -1
  533. package/dist/sessions/decisions.d.ts +38 -3
  534. package/dist/sessions/decisions.d.ts.map +1 -1
  535. package/dist/sessions/decisions.js +235 -21
  536. package/dist/sessions/decisions.js.map +1 -1
  537. package/dist/sessions/drift-watchdog.d.ts.map +1 -1
  538. package/dist/sessions/drift-watchdog.js +8 -5
  539. package/dist/sessions/drift-watchdog.js.map +1 -1
  540. package/dist/sessions/focus-state-store.d.ts +89 -1
  541. package/dist/sessions/focus-state-store.d.ts.map +1 -1
  542. package/dist/sessions/focus-state-store.js +97 -1
  543. package/dist/sessions/focus-state-store.js.map +1 -1
  544. package/dist/sessions/index.d.ts +2 -2
  545. package/dist/sessions/index.d.ts.map +1 -1
  546. package/dist/sessions/index.js +34 -5
  547. package/dist/sessions/index.js.map +1 -1
  548. package/dist/sessions/session-drift.d.ts.map +1 -1
  549. package/dist/sessions/session-drift.js +4 -3
  550. package/dist/sessions/session-drift.js.map +1 -1
  551. package/dist/sessions/session-end-snapshot-entry.d.ts +26 -0
  552. package/dist/sessions/session-end-snapshot-entry.d.ts.map +1 -0
  553. package/dist/sessions/session-end-snapshot-entry.js +59 -0
  554. package/dist/sessions/session-end-snapshot-entry.js.map +1 -0
  555. package/dist/sessions/session-end-snapshot.d.ts +114 -0
  556. package/dist/sessions/session-end-snapshot.d.ts.map +1 -0
  557. package/dist/sessions/session-end-snapshot.js +446 -0
  558. package/dist/sessions/session-end-snapshot.js.map +1 -0
  559. package/dist/sessions/session-manifest-mirror.d.ts.map +1 -1
  560. package/dist/sessions/session-manifest-mirror.js +10 -17
  561. package/dist/sessions/session-manifest-mirror.js.map +1 -1
  562. package/dist/sessions/session-switch.d.ts.map +1 -1
  563. package/dist/sessions/session-switch.js +5 -3
  564. package/dist/sessions/session-switch.js.map +1 -1
  565. package/dist/sessions/snapshot.d.ts.map +1 -1
  566. package/dist/sessions/snapshot.js +5 -4
  567. package/dist/sessions/snapshot.js.map +1 -1
  568. package/dist/sessions/terminal-identity.d.ts +169 -0
  569. package/dist/sessions/terminal-identity.d.ts.map +1 -0
  570. package/dist/sessions/terminal-identity.js +273 -0
  571. package/dist/sessions/terminal-identity.js.map +1 -0
  572. package/dist/setup/sections/verification.d.ts +1 -1
  573. package/dist/setup/sections/verification.d.ts.map +1 -1
  574. package/dist/setup/sections/verification.js +11 -15
  575. package/dist/setup/sections/verification.js.map +1 -1
  576. package/dist/skills/discovery.d.ts +20 -3
  577. package/dist/skills/discovery.d.ts.map +1 -1
  578. package/dist/skills/discovery.js +41 -4
  579. package/dist/skills/discovery.js.map +1 -1
  580. package/dist/skills/dispatch.d.ts +5 -2
  581. package/dist/skills/dispatch.d.ts.map +1 -1
  582. package/dist/skills/dispatch.js +5 -2
  583. package/dist/skills/dispatch.js.map +1 -1
  584. package/dist/skills/doctor.d.ts.map +1 -1
  585. package/dist/skills/doctor.js +5 -1
  586. package/dist/skills/doctor.js.map +1 -1
  587. package/dist/skills/federated-search.js +2 -2
  588. package/dist/skills/federated-search.js.map +1 -1
  589. package/dist/skills/index.d.ts +3 -3
  590. package/dist/skills/index.d.ts.map +1 -1
  591. package/dist/skills/index.js +1 -1
  592. package/dist/skills/index.js.map +1 -1
  593. package/dist/skills/migration.d.ts +5 -5
  594. package/dist/skills/migration.d.ts.map +1 -1
  595. package/dist/skills/migration.js +7 -9
  596. package/dist/skills/migration.js.map +1 -1
  597. package/dist/skills/orchestrator/startup.d.ts.map +1 -1
  598. package/dist/skills/orchestrator/startup.js +14 -7
  599. package/dist/skills/orchestrator/startup.js.map +1 -1
  600. package/dist/skills/prune-bundled.d.ts +267 -0
  601. package/dist/skills/prune-bundled.d.ts.map +1 -0
  602. package/dist/skills/prune-bundled.js +536 -0
  603. package/dist/skills/prune-bundled.js.map +1 -0
  604. package/dist/skills/skill-paths.d.ts +30 -3
  605. package/dist/skills/skill-paths.d.ts.map +1 -1
  606. package/dist/skills/skill-paths.js +28 -9
  607. package/dist/skills/skill-paths.js.map +1 -1
  608. package/dist/skills/skill-root.d.ts +60 -11
  609. package/dist/skills/skill-root.d.ts.map +1 -1
  610. package/dist/skills/skill-root.js +100 -14
  611. package/dist/skills/skill-root.js.map +1 -1
  612. package/dist/skills/skills-guard.js +5 -5
  613. package/dist/skills/skills-guard.js.map +1 -1
  614. package/dist/skills/types.d.ts +32 -1
  615. package/dist/skills/types.d.ts.map +1 -1
  616. package/dist/skills/types.js +17 -34
  617. package/dist/skills/types.js.map +1 -1
  618. package/dist/spawn/agent-identity.d.ts +51 -2
  619. package/dist/spawn/agent-identity.d.ts.map +1 -1
  620. package/dist/spawn/agent-identity.js +89 -26
  621. package/dist/spawn/agent-identity.js.map +1 -1
  622. package/dist/spawn/branch-lock.d.ts.map +1 -1
  623. package/dist/spawn/branch-lock.js +80 -79
  624. package/dist/spawn/branch-lock.js.map +1 -1
  625. package/dist/spawn/index.d.ts +2 -2
  626. package/dist/spawn/index.d.ts.map +1 -1
  627. package/dist/spawn/index.js +1 -1
  628. package/dist/spawn/index.js.map +1 -1
  629. package/dist/spawn/worktree-lock-holder.d.ts +37 -0
  630. package/dist/spawn/worktree-lock-holder.d.ts.map +1 -0
  631. package/dist/spawn/worktree-lock-holder.js +41 -0
  632. package/dist/spawn/worktree-lock-holder.js.map +1 -0
  633. package/dist/stats/index.d.ts.map +1 -1
  634. package/dist/stats/index.js +4 -2
  635. package/dist/stats/index.js.map +1 -1
  636. package/dist/sticky/convert.d.ts.map +1 -1
  637. package/dist/sticky/convert.js +16 -4
  638. package/dist/sticky/convert.js.map +1 -1
  639. package/dist/store/attachment-store.d.ts +14 -0
  640. package/dist/store/attachment-store.d.ts.map +1 -1
  641. package/dist/store/attachment-store.js +11 -1
  642. package/dist/store/attachment-store.js.map +1 -1
  643. package/dist/store/backup-inspect.d.ts +7 -3
  644. package/dist/store/backup-inspect.d.ts.map +1 -1
  645. package/dist/store/backup-inspect.js +18 -7
  646. package/dist/store/backup-inspect.js.map +1 -1
  647. package/dist/store/backup-sidecar.d.ts +60 -0
  648. package/dist/store/backup-sidecar.d.ts.map +1 -0
  649. package/dist/store/backup-sidecar.js +96 -0
  650. package/dist/store/backup-sidecar.js.map +1 -0
  651. package/dist/store/data-accessor.d.ts +1 -1
  652. package/dist/store/data-accessor.d.ts.map +1 -1
  653. package/dist/store/data-accessor.js +6 -6
  654. package/dist/store/data-accessor.js.map +1 -1
  655. package/dist/store/data-safety-central.d.ts +13 -4
  656. package/dist/store/data-safety-central.d.ts.map +1 -1
  657. package/dist/store/data-safety-central.js +31 -4
  658. package/dist/store/data-safety-central.js.map +1 -1
  659. package/dist/store/dual-scope-db.d.ts.map +1 -1
  660. package/dist/store/dual-scope-db.js +10 -0
  661. package/dist/store/dual-scope-db.js.map +1 -1
  662. package/dist/store/exodus/__fixtures__/representative-fixture.d.ts.map +1 -1
  663. package/dist/store/exodus/__fixtures__/representative-fixture.js +4 -0
  664. package/dist/store/exodus/__fixtures__/representative-fixture.js.map +1 -1
  665. package/dist/store/exodus/migrate.js +1 -1
  666. package/dist/store/exodus/migrate.js.map +1 -1
  667. package/dist/store/exodus/reconcile.js +1 -1
  668. package/dist/store/exodus/reconcile.js.map +1 -1
  669. package/dist/store/exodus/runtime-targets.d.ts +4 -3
  670. package/dist/store/exodus/runtime-targets.d.ts.map +1 -1
  671. package/dist/store/exodus/runtime-targets.js +4 -3
  672. package/dist/store/exodus/runtime-targets.js.map +1 -1
  673. package/dist/store/import-logging.d.ts.map +1 -1
  674. package/dist/store/import-logging.js +5 -4
  675. package/dist/store/import-logging.js.map +1 -1
  676. package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
  677. package/dist/store/legacy-tasks-lineage.js +2 -7
  678. package/dist/store/legacy-tasks-lineage.js.map +1 -1
  679. package/dist/store/lock.d.ts +1 -0
  680. package/dist/store/lock.d.ts.map +1 -1
  681. package/dist/store/lock.js +1 -0
  682. package/dist/store/lock.js.map +1 -1
  683. package/dist/store/memory-accessor.d.ts +8 -3
  684. package/dist/store/memory-accessor.d.ts.map +1 -1
  685. package/dist/store/memory-accessor.js +29 -13
  686. package/dist/store/memory-accessor.js.map +1 -1
  687. package/dist/store/memory-sqlite.d.ts.map +1 -1
  688. package/dist/store/memory-sqlite.js +5 -0
  689. package/dist/store/memory-sqlite.js.map +1 -1
  690. package/dist/store/open-cleo-db.d.ts.map +1 -1
  691. package/dist/store/open-cleo-db.js +11 -6
  692. package/dist/store/open-cleo-db.js.map +1 -1
  693. package/dist/store/portable-bundle-relocate.d.ts +13 -8
  694. package/dist/store/portable-bundle-relocate.d.ts.map +1 -1
  695. package/dist/store/portable-bundle-relocate.js +75 -31
  696. package/dist/store/portable-bundle-relocate.js.map +1 -1
  697. package/dist/store/portable-bundle-scan.d.ts.map +1 -1
  698. package/dist/store/portable-bundle-scan.js +2 -1
  699. package/dist/store/portable-bundle-scan.js.map +1 -1
  700. package/dist/store/portable-bundle.d.ts.map +1 -1
  701. package/dist/store/portable-bundle.js +7 -3
  702. package/dist/store/portable-bundle.js.map +1 -1
  703. package/dist/store/pre-repair-snapshot.d.ts +77 -0
  704. package/dist/store/pre-repair-snapshot.d.ts.map +1 -0
  705. package/dist/store/pre-repair-snapshot.js +122 -0
  706. package/dist/store/pre-repair-snapshot.js.map +1 -0
  707. package/dist/store/regenerators.d.ts +2 -1
  708. package/dist/store/regenerators.d.ts.map +1 -1
  709. package/dist/store/regenerators.js +17 -3
  710. package/dist/store/regenerators.js.map +1 -1
  711. package/dist/store/relocated-store-guard.d.ts +71 -0
  712. package/dist/store/relocated-store-guard.d.ts.map +1 -0
  713. package/dist/store/relocated-store-guard.js +138 -0
  714. package/dist/store/relocated-store-guard.js.map +1 -0
  715. package/dist/store/safety-data-accessor.d.ts +2 -2
  716. package/dist/store/safety-data-accessor.d.ts.map +1 -1
  717. package/dist/store/safety-data-accessor.js +2 -2
  718. package/dist/store/safety-data-accessor.js.map +1 -1
  719. package/dist/store/schema/attachments.d.ts +2 -2
  720. package/dist/store/schema/audit.d.ts +5 -5
  721. package/dist/store/schema/background-jobs.d.ts +1 -1
  722. package/dist/store/schema/cleo-global/models-catalog.d.ts +1 -1
  723. package/dist/store/schema/cleo-global/nexus.d.ts +686 -0
  724. package/dist/store/schema/cleo-global/nexus.d.ts.map +1 -1
  725. package/dist/store/schema/cleo-global/nexus.js +175 -7
  726. package/dist/store/schema/cleo-global/nexus.js.map +1 -1
  727. package/dist/store/schema/cleo-global/skills.d.ts +2 -2
  728. package/dist/store/schema/cleo-project/audit.d.ts +5 -5
  729. package/dist/store/schema/cleo-project/docs.d.ts +3 -3
  730. package/dist/store/schema/cleo-project/lifecycle.d.ts +3 -3
  731. package/dist/store/schema/cleo-project/provenance-commits.d.ts +2 -2
  732. package/dist/store/schema/cleo-project/provenance-rest.d.ts +3 -3
  733. package/dist/store/schema/cleo-project/tasks-core-batch2.d.ts +1 -1
  734. package/dist/store/schema/cleo-project/tasks-core.d.ts +6 -6
  735. package/dist/store/schema/cleo-shared/brain.d.ts +26 -26
  736. package/dist/store/schema/lifecycle.d.ts +3 -3
  737. package/dist/store/schema/manifest.d.ts +1 -1
  738. package/dist/store/schema/memory-schema.d.ts +26 -26
  739. package/dist/store/schema/nexus-schema.d.ts +696 -2
  740. package/dist/store/schema/nexus-schema.d.ts.map +1 -1
  741. package/dist/store/schema/nexus-schema.js +175 -19
  742. package/dist/store/schema/nexus-schema.js.map +1 -1
  743. package/dist/store/schema/provenance/releases.d.ts +1 -1
  744. package/dist/store/schema/skills-schema.d.ts +2 -2
  745. package/dist/store/schema/tasks.d.ts +5 -5
  746. package/dist/store/session-binding-schema.d.ts +132 -0
  747. package/dist/store/session-binding-schema.d.ts.map +1 -0
  748. package/dist/store/session-binding-schema.js +53 -0
  749. package/dist/store/session-binding-schema.js.map +1 -0
  750. package/dist/store/session-store.d.ts +262 -4
  751. package/dist/store/session-store.d.ts.map +1 -1
  752. package/dist/store/session-store.js +486 -26
  753. package/dist/store/session-store.js.map +1 -1
  754. package/dist/store/skills-db.d.ts +17 -0
  755. package/dist/store/skills-db.d.ts.map +1 -1
  756. package/dist/store/skills-db.js +30 -0
  757. package/dist/store/skills-db.js.map +1 -1
  758. package/dist/store/snapshot-gate.d.ts +239 -0
  759. package/dist/store/snapshot-gate.d.ts.map +1 -0
  760. package/dist/store/snapshot-gate.js +401 -0
  761. package/dist/store/snapshot-gate.js.map +1 -0
  762. package/dist/store/split-brain-import.js +2 -2
  763. package/dist/store/split-brain-import.js.map +1 -1
  764. package/dist/store/sqlite-backup.d.ts +55 -13
  765. package/dist/store/sqlite-backup.d.ts.map +1 -1
  766. package/dist/store/sqlite-backup.js +414 -106
  767. package/dist/store/sqlite-backup.js.map +1 -1
  768. package/dist/store/sqlite-data-accessor.d.ts +15 -0
  769. package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
  770. package/dist/store/sqlite-data-accessor.js +73 -4
  771. package/dist/store/sqlite-data-accessor.js.map +1 -1
  772. package/dist/store/sqlite.d.ts +15 -1
  773. package/dist/store/sqlite.d.ts.map +1 -1
  774. package/dist/store/sqlite.js +75 -5
  775. package/dist/store/sqlite.js.map +1 -1
  776. package/dist/store/store-write-guard.d.ts +28 -0
  777. package/dist/store/store-write-guard.d.ts.map +1 -0
  778. package/dist/store/store-write-guard.js +50 -0
  779. package/dist/store/store-write-guard.js.map +1 -0
  780. package/dist/store/table-classification.d.ts +143 -0
  781. package/dist/store/table-classification.d.ts.map +1 -0
  782. package/dist/store/table-classification.js +1866 -0
  783. package/dist/store/table-classification.js.map +1 -0
  784. package/dist/store/task-version.d.ts +72 -0
  785. package/dist/store/task-version.d.ts.map +1 -0
  786. package/dist/store/task-version.js +93 -0
  787. package/dist/store/task-version.js.map +1 -0
  788. package/dist/store/tasks-schema.d.ts +1 -0
  789. package/dist/store/tasks-schema.d.ts.map +1 -1
  790. package/dist/store/tasks-schema.js +13 -0
  791. package/dist/store/tasks-schema.js.map +1 -1
  792. package/dist/store/tasks-sqlite.d.ts +10 -3
  793. package/dist/store/tasks-sqlite.d.ts.map +1 -1
  794. package/dist/store/tasks-sqlite.js +12 -3
  795. package/dist/store/tasks-sqlite.js.map +1 -1
  796. package/dist/store/twin-collapse.d.ts +320 -0
  797. package/dist/store/twin-collapse.d.ts.map +1 -0
  798. package/dist/store/twin-collapse.js +931 -0
  799. package/dist/store/twin-collapse.js.map +1 -0
  800. package/dist/store/umbrella-data-accessor.d.ts +2 -2
  801. package/dist/store/umbrella-data-accessor.d.ts.map +1 -1
  802. package/dist/store/umbrella-data-accessor.js +2 -2
  803. package/dist/store/umbrella-data-accessor.js.map +1 -1
  804. package/dist/store/validation-schemas.d.ts +63 -63
  805. package/dist/store/worktree-isolation-guard.d.ts +46 -24
  806. package/dist/store/worktree-isolation-guard.d.ts.map +1 -1
  807. package/dist/store/worktree-isolation-guard.js +71 -50
  808. package/dist/store/worktree-isolation-guard.js.map +1 -1
  809. package/dist/system/backup.d.ts.map +1 -1
  810. package/dist/system/backup.js +3 -67
  811. package/dist/system/backup.js.map +1 -1
  812. package/dist/system/cleo-link.d.ts +163 -0
  813. package/dist/system/cleo-link.d.ts.map +1 -0
  814. package/dist/system/cleo-link.js +246 -0
  815. package/dist/system/cleo-link.js.map +1 -0
  816. package/dist/system/dependencies.d.ts.map +1 -1
  817. package/dist/system/dependencies.js +3 -6
  818. package/dist/system/dependencies.js.map +1 -1
  819. package/dist/system/global-delivery.d.ts +205 -0
  820. package/dist/system/global-delivery.d.ts.map +1 -0
  821. package/dist/system/global-delivery.js +320 -0
  822. package/dist/system/global-delivery.js.map +1 -0
  823. package/dist/system/health.d.ts.map +1 -1
  824. package/dist/system/health.js +29 -6
  825. package/dist/system/health.js.map +1 -1
  826. package/dist/system/inject-generate.d.ts.map +1 -1
  827. package/dist/system/inject-generate.js +4 -4
  828. package/dist/system/inject-generate.js.map +1 -1
  829. package/dist/system/project-health.d.ts.map +1 -1
  830. package/dist/system/project-health.js +1 -20
  831. package/dist/system/project-health.js.map +1 -1
  832. package/dist/system/runtime.d.ts.map +1 -1
  833. package/dist/system/runtime.js +2 -12
  834. package/dist/system/runtime.js.map +1 -1
  835. package/dist/system/safestop.d.ts.map +1 -1
  836. package/dist/system/safestop.js +5 -2
  837. package/dist/system/safestop.js.map +1 -1
  838. package/dist/system/skill-fixtures.d.ts +200 -0
  839. package/dist/system/skill-fixtures.d.ts.map +1 -0
  840. package/dist/system/skill-fixtures.js +331 -0
  841. package/dist/system/skill-fixtures.js.map +1 -0
  842. package/dist/task-work/index.d.ts +6 -0
  843. package/dist/task-work/index.d.ts.map +1 -1
  844. package/dist/task-work/index.js +6 -3
  845. package/dist/task-work/index.js.map +1 -1
  846. package/dist/tasks/add.d.ts.map +1 -1
  847. package/dist/tasks/add.js +4 -2
  848. package/dist/tasks/add.js.map +1 -1
  849. package/dist/tasks/affected-packages.d.ts +218 -0
  850. package/dist/tasks/affected-packages.d.ts.map +1 -0
  851. package/dist/tasks/affected-packages.js +496 -0
  852. package/dist/tasks/affected-packages.js.map +1 -0
  853. package/dist/tasks/affected-scope.d.ts +59 -0
  854. package/dist/tasks/affected-scope.d.ts.map +1 -0
  855. package/dist/tasks/affected-scope.js +81 -0
  856. package/dist/tasks/affected-scope.js.map +1 -0
  857. package/dist/tasks/analyze.d.ts.map +1 -1
  858. package/dist/tasks/analyze.js +7 -2
  859. package/dist/tasks/analyze.js.map +1 -1
  860. package/dist/tasks/change-set.d.ts +175 -0
  861. package/dist/tasks/change-set.d.ts.map +1 -0
  862. package/dist/tasks/change-set.js +753 -0
  863. package/dist/tasks/change-set.js.map +1 -0
  864. package/dist/tasks/complete.d.ts +10 -0
  865. package/dist/tasks/complete.d.ts.map +1 -1
  866. package/dist/tasks/complete.js +59 -5
  867. package/dist/tasks/complete.js.map +1 -1
  868. package/dist/tasks/component-pr.d.ts +106 -0
  869. package/dist/tasks/component-pr.d.ts.map +1 -0
  870. package/dist/tasks/component-pr.js +190 -0
  871. package/dist/tasks/component-pr.js.map +1 -0
  872. package/dist/tasks/done-plan.d.ts +123 -0
  873. package/dist/tasks/done-plan.d.ts.map +1 -0
  874. package/dist/tasks/done-plan.js +696 -0
  875. package/dist/tasks/done-plan.js.map +1 -0
  876. package/dist/tasks/done-record.d.ts +127 -0
  877. package/dist/tasks/done-record.d.ts.map +1 -0
  878. package/dist/tasks/done-record.js +302 -0
  879. package/dist/tasks/done-record.js.map +1 -0
  880. package/dist/tasks/duplicate-detector.d.ts +68 -11
  881. package/dist/tasks/duplicate-detector.d.ts.map +1 -1
  882. package/dist/tasks/duplicate-detector.js +314 -58
  883. package/dist/tasks/duplicate-detector.js.map +1 -1
  884. package/dist/tasks/evidence-paths.d.ts +78 -0
  885. package/dist/tasks/evidence-paths.d.ts.map +1 -0
  886. package/dist/tasks/evidence-paths.js +150 -0
  887. package/dist/tasks/evidence-paths.js.map +1 -0
  888. package/dist/tasks/evidence.d.ts +101 -1
  889. package/dist/tasks/evidence.d.ts.map +1 -1
  890. package/dist/tasks/evidence.js +278 -31
  891. package/dist/tasks/evidence.js.map +1 -1
  892. package/dist/tasks/gate-preview.d.ts +5 -0
  893. package/dist/tasks/gate-preview.d.ts.map +1 -1
  894. package/dist/tasks/gate-preview.js +25 -21
  895. package/dist/tasks/gate-preview.js.map +1 -1
  896. package/dist/tasks/gate-result-cache.d.ts +205 -0
  897. package/dist/tasks/gate-result-cache.d.ts.map +1 -0
  898. package/dist/tasks/gate-result-cache.js +285 -0
  899. package/dist/tasks/gate-result-cache.js.map +1 -0
  900. package/dist/tasks/gate-runner.d.ts +126 -3
  901. package/dist/tasks/gate-runner.d.ts.map +1 -1
  902. package/dist/tasks/gate-runner.js +483 -28
  903. package/dist/tasks/gate-runner.js.map +1 -1
  904. package/dist/tasks/session-scope.d.ts +3 -1
  905. package/dist/tasks/session-scope.d.ts.map +1 -1
  906. package/dist/tasks/session-scope.js +18 -3
  907. package/dist/tasks/session-scope.js.map +1 -1
  908. package/dist/tasks/task-next.d.ts +4 -0
  909. package/dist/tasks/task-next.d.ts.map +1 -1
  910. package/dist/tasks/task-next.js +32 -28
  911. package/dist/tasks/task-next.js.map +1 -1
  912. package/dist/tasks/tool-resolver.d.ts +23 -6
  913. package/dist/tasks/tool-resolver.d.ts.map +1 -1
  914. package/dist/tasks/tool-resolver.js +146 -8
  915. package/dist/tasks/tool-resolver.js.map +1 -1
  916. package/dist/tasks/tool-vacuity.d.ts +71 -0
  917. package/dist/tasks/tool-vacuity.d.ts.map +1 -0
  918. package/dist/tasks/tool-vacuity.js +334 -0
  919. package/dist/tasks/tool-vacuity.js.map +1 -0
  920. package/dist/tasks/update.d.ts +8 -0
  921. package/dist/tasks/update.d.ts.map +1 -1
  922. package/dist/tasks/update.js +159 -78
  923. package/dist/tasks/update.js.map +1 -1
  924. package/dist/upgrade.d.ts.map +1 -1
  925. package/dist/upgrade.js +18 -2
  926. package/dist/upgrade.js.map +1 -1
  927. package/dist/validation/doctor/checks.d.ts +20 -2
  928. package/dist/validation/doctor/checks.d.ts.map +1 -1
  929. package/dist/validation/doctor/checks.js +64 -4
  930. package/dist/validation/doctor/checks.js.map +1 -1
  931. package/dist/validation/doctor/index.d.ts +1 -1
  932. package/dist/validation/doctor/index.d.ts.map +1 -1
  933. package/dist/validation/doctor/index.js +1 -1
  934. package/dist/validation/doctor/index.js.map +1 -1
  935. package/dist/validation/doctor/utils.d.ts.map +1 -1
  936. package/dist/validation/doctor/utils.js +7 -2
  937. package/dist/validation/doctor/utils.js.map +1 -1
  938. package/dist/validation/engine-ops.d.ts +24 -1
  939. package/dist/validation/engine-ops.d.ts.map +1 -1
  940. package/dist/validation/engine-ops.js +272 -98
  941. package/dist/validation/engine-ops.js.map +1 -1
  942. package/dist/validation/validate-ops.d.ts.map +1 -1
  943. package/dist/validation/validate-ops.js +9 -3
  944. package/dist/validation/validate-ops.js.map +1 -1
  945. package/dist/worktree/worktree-adopt.d.ts.map +1 -1
  946. package/dist/worktree/worktree-adopt.js +5 -2
  947. package/dist/worktree/worktree-adopt.js.map +1 -1
  948. package/migrations/drizzle-cleo-global/20260927000000_t12469-project-locations/migration.sql +121 -0
  949. package/migrations/drizzle-cleo-global/20260927010000_t12543-user-profile-project-scope/migration.sql +23 -0
  950. package/migrations/drizzle-cleo-global/20260928010000_t12470-location-candidates/migration.sql +72 -0
  951. package/migrations/drizzle-cleo-global/20260928020000_t12510-nexus-devices/migration.sql +34 -0
  952. package/migrations/drizzle-cleo-global/20260928030000_t12511-project-git-state/migration.sql +62 -0
  953. package/migrations/drizzle-cleo-project/20260927000000_t12499-session-terminal-bindings/migration.sql +34 -0
  954. package/migrations/drizzle-cleo-project/20260928000000_t12500-binding-provider-flag/migration.sql +15 -0
  955. package/package.json +23 -13
  956. package/schemas/config.schema.json +54 -0
  957. package/schemas/project-context.schema.json +51 -3
  958. package/schemas/project-info.schema.json +28 -1
  959. package/templates/CLEO-INJECTION.md +40 -332
  960. package/templates/CLEO-REFERENCE.md +303 -0
  961. package/templates/workflows/README.md +36 -14
@@ -0,0 +1,668 @@
1
+ /**
2
+ * `ci:<pr>` evidence — required CI green on a merged PR's MERGE COMMIT.
3
+ *
4
+ * Owner decision D11149: when every required check completed with `success`
5
+ * on the commit a PR actually merged as, that satisfies `testsPassed` and
6
+ * `qaPassed` for the task the PR closes. It replaces the post-merge local
7
+ * full-suite rerun, which was the single largest override driver. Opt-in via
8
+ * `evidence.ciSatisfies: true` in `.cleo/project-context.json`.
9
+ *
10
+ * Verified the way `pr:` provenance is:
11
+ *
12
+ * - the PR itself goes through {@link resolvePrEvidenceAtom} (merged, a real
13
+ * merge-commit identity), so a `ci:` atom can never outrun `pr:`;
14
+ * - the required-check list comes from the SAME resolver `pr:` uses
15
+ * (env → `release.prRequiredWorkflows` → branch protection), and an
16
+ * undetermined list refuses rather than accepting vacuously;
17
+ * - each required name is judged on the merge commit's own check runs and
18
+ * workflow runs (GitHub REST, by SHA). A run whose `head_sha` is anything
19
+ * else — the PR head included — never counts, and a required check found
20
+ * only there is named as such.
21
+ *
22
+ * Pending, failed, cancelled, skipped and missing required checks are each
23
+ * refused with the check's name and state.
24
+ *
25
+ * @task T12634
26
+ */
27
+ import { execFileSync } from 'node:child_process';
28
+ import { readFileSync } from 'node:fs';
29
+ import { join } from 'node:path';
30
+ import { isGitWorkTree } from '../git/work-tree.js';
31
+ import { checkPrTaskLinkage, isDocumentArtifact, linkedPrChange, } from '../tasks/evidence.js';
32
+ import { ghQueryTimeoutMs, isGhCliAvailable } from './github-pr.js';
33
+ import { describeRequiredWorkflowsSource, readRequiredCheckPins, resolvePrEvidenceAtom, resolveRequiredWorkflowsDetailed, } from './pr-evidence.js';
34
+ /** Parsed `.cleo/project-context.json` of the store root, or null. */
35
+ function readProjectContextFile(projectRoot) {
36
+ try {
37
+ const parsed = JSON.parse(readFileSync(join(projectRoot, '.cleo', 'project-context.json'), 'utf-8'));
38
+ return typeof parsed === 'object' && parsed !== null
39
+ ? parsed
40
+ : null;
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
46
+ /**
47
+ * Whether the project opted in to merge-commit CI as test/QA evidence
48
+ * (`evidence.ciSatisfies === true`; anything else, including a missing file,
49
+ * is `false`).
50
+ *
51
+ * @param projectRoot - CLEO store root.
52
+ * @returns True only for an explicit boolean `true`.
53
+ * @task T12634
54
+ */
55
+ export function readCiSatisfies(projectRoot) {
56
+ const evidence = readProjectContextFile(projectRoot)?.evidence;
57
+ return evidence?.ciSatisfies === true;
58
+ }
59
+ /**
60
+ * The checks that attest each gate (`evidence.ciChecks`, T12634).
61
+ *
62
+ * @param projectRoot - CLEO store root.
63
+ * @returns `tests` → testsPassed, `qa` → qaPassed; a missing list is absent.
64
+ * @task T12634
65
+ */
66
+ export function readCiChecks(projectRoot) {
67
+ const raw = readProjectContextFile(projectRoot)
68
+ ?.evidence?.ciChecks;
69
+ if (typeof raw !== 'object' || raw === null)
70
+ return {};
71
+ const list = (v) => Array.isArray(v) && v.every((x) => typeof x === 'string' && x.trim() !== '')
72
+ ? v.map((x) => x.trim())
73
+ : undefined;
74
+ const { tests, qa, jobs } = raw;
75
+ const jobLists = typeof jobs === 'object' && jobs !== null
76
+ ? jobs
77
+ : undefined;
78
+ const jobTests = list(jobLists?.tests);
79
+ const jobQa = list(jobLists?.qa);
80
+ return {
81
+ ...(list(tests) ? { tests: list(tests) } : {}),
82
+ ...(list(qa) ? { qa: list(qa) } : {}),
83
+ ...(jobTests || jobQa
84
+ ? { jobs: { ...(jobTests ? { tests: jobTests } : {}), ...(jobQa ? { qa: jobQa } : {}) } }
85
+ : {}),
86
+ };
87
+ }
88
+ /**
89
+ * Top-level directories whose files are code for the `ci:` skip decision even
90
+ * when they are Markdown or text: a `.md` under `packages/**` can be a runtime
91
+ * template (CLEO-INJECTION.md is injected into every agent), and the CI `code`
92
+ * path filter plus the scripts, crates and workflow filters cover these roots.
93
+ */
94
+ const CI_CODE_ROOTS = ['packages/', 'crates/', 'scripts/', '.github/'];
95
+ /**
96
+ * Stricter than `pr:`'s {@link isDocumentArtifact}: a documentation artifact
97
+ * that lives outside every code root. Only a diff made entirely of these may
98
+ * leave its test and typecheck jobs honestly skipped.
99
+ *
100
+ * @param path - Repo-relative changed path.
101
+ * @returns True when the path cannot affect code, tests or CI.
102
+ * @task T12634
103
+ */
104
+ export function isCiDocumentPath(path) {
105
+ return isDocumentArtifact(path) && !CI_CODE_ROOTS.some((root) => path.startsWith(root));
106
+ }
107
+ /** `*`-glob to an anchored regular expression. */
108
+ function globToRegExp(glob) {
109
+ return new RegExp(`^${glob
110
+ .split('*')
111
+ .map((part) => part.replace(/[.+?^${}()|[\]\\]/g, '\\$&'))
112
+ .join('.*')}$`);
113
+ }
114
+ /**
115
+ * Judge job globs on one SHA: every glob must match at least one job (check
116
+ * run) from the allowed workflows/app, and the latest run of each matched
117
+ * (job, event) must be `success` — a `skipped` job is refused by name.
118
+ *
119
+ * @param globs - Job-name globs for the gate.
120
+ * @param checks - Every check reported for the commit.
121
+ * @param sha - Commit being judged.
122
+ * @param scope - The app and workflow files the jobs must come from.
123
+ * @param onlyEvent - Restrict to runs of this event (the PR-head substitution).
124
+ * @returns The judged job names, or one reason per unmet glob.
125
+ * @task T12634
126
+ */
127
+ export function evaluateJobs(globs, checks, sha, scope, onlyEvent) {
128
+ const inScope = checks.filter((c) => c.source === 'check-run' &&
129
+ c.headSha === sha &&
130
+ (onlyEvent === undefined || c.event === onlyEvent) &&
131
+ c.workflowPath !== undefined &&
132
+ scope.workflows.includes(c.workflowPath) &&
133
+ (scope.app === undefined ||
134
+ (typeof scope.app === 'number' ? c.appId === scope.app : c.appSlug === scope.app)));
135
+ const reasons = [];
136
+ const jobs = [];
137
+ for (const glob of globs) {
138
+ const re = globToRegExp(glob);
139
+ const matched = inScope.filter((c) => re.test(c.name));
140
+ if (matched.length === 0) {
141
+ reasons.push(`job ${glob}: not found in ${scope.workflows.join(', ')} on ${sha.slice(0, 12)}`);
142
+ continue;
143
+ }
144
+ const latest = new Map();
145
+ for (const c of matched) {
146
+ const key = `${c.name}\u0000${c.event ?? ''}`;
147
+ const prev = latest.get(key);
148
+ if (!prev || c.id > prev.id)
149
+ latest.set(key, c);
150
+ }
151
+ const bad = [...latest.values()].find((c) => c.status !== 'completed' || c.conclusion !== 'success');
152
+ if (bad) {
153
+ reasons.push(`job ${bad.name}: ${bad.status !== 'completed' ? `pending (${bad.status})` : bad.conclusion} on ${sha.slice(0, 12)}`);
154
+ continue;
155
+ }
156
+ jobs.push(...new Set([...latest.values()].map((c) => c.name)));
157
+ }
158
+ return reasons.length > 0 ? { ok: false, reasons } : { ok: true, jobs };
159
+ }
160
+ function pinMatches(check, pin) {
161
+ if (!pin)
162
+ return true;
163
+ if (pin.app !== undefined) {
164
+ const ok = typeof pin.app === 'number' ? check.appId === pin.app : check.appSlug === pin.app;
165
+ if (!ok)
166
+ return false;
167
+ }
168
+ if (pin.workflow !== undefined && check.workflowPath !== pin.workflow)
169
+ return false;
170
+ return true;
171
+ }
172
+ function describeApp(check) {
173
+ return check.appSlug ?? (check.appId !== undefined ? `app ${check.appId}` : 'an unknown app');
174
+ }
175
+ /**
176
+ * Judge required checks on one merge commit. Pure.
177
+ *
178
+ * For each required name, runs are grouped by source (job / workflow) and
179
+ * triggering event, and within a group only the LATEST attempt counts; every
180
+ * group on the merge commit must be `completed`/`success`. A pinned name only
181
+ * considers runs from its pinned app/workflow. When `treeEquivalentSha` is
182
+ * given, that commit's `pull_request` runs (and only those) stand in for a
183
+ * merge-commit verdict that failed or is missing.
184
+ *
185
+ * @param required - Required check names.
186
+ * @param checks - Every check reported for the commits involved.
187
+ * @param mergeCommitSha - The merge commit being judged.
188
+ * @param opts - Tree-equivalent PR head and pins.
189
+ * @returns The judged checks, or one reason per unmet name.
190
+ * @task T12634
191
+ */
192
+ export function evaluateMergeCommitChecks(required, checks, mergeCommitSha, opts = {}) {
193
+ if (required.length === 0) {
194
+ return {
195
+ ok: false,
196
+ reasons: ['No required checks are configured, so merge-commit CI proves nothing.'],
197
+ };
198
+ }
199
+ const { treeEquivalentSha, pins = {} } = opts;
200
+ const reasons = [];
201
+ const matched = [];
202
+ for (const name of required) {
203
+ const named = checks.filter((c) => c.name === name);
204
+ const pinned = named.filter((c) => pinMatches(c, pins[name]));
205
+ const onMerge = judgeOnSha(pinned, mergeCommitSha);
206
+ if (onMerge.ok) {
207
+ matched.push(judged(name, onMerge.run, mergeCommitSha));
208
+ continue;
209
+ }
210
+ if (treeEquivalentSha !== undefined && treeEquivalentSha !== mergeCommitSha) {
211
+ const onHead = judgeOnSha(pinned, treeEquivalentSha, 'pull_request');
212
+ if (onHead.ok) {
213
+ matched.push(judged(name, onHead.run, treeEquivalentSha));
214
+ continue;
215
+ }
216
+ }
217
+ const impostor = named.find((c) => !pinMatches(c, pins[name]));
218
+ const elsewhere = pinned.find((c) => c.headSha !== mergeCommitSha && c.headSha !== treeEquivalentSha);
219
+ reasons.push(onMerge.verdict === 'missing' && impostor && pinned.length === 0
220
+ ? `${name}: posted by ${describeApp(impostor)}${impostor.workflowPath ? ` (${impostor.workflowPath})` : ''}, not the pinned ${describePin(pins[name])}`
221
+ : onMerge.verdict === 'missing' && elsewhere
222
+ ? `${name}: ran on ${elsewhere.headSha.slice(0, 12)}, not the merge commit ${mergeCommitSha.slice(0, 12)}`
223
+ : onMerge.verdict === 'missing'
224
+ ? `${name}: not found on merge commit ${mergeCommitSha.slice(0, 12)}`
225
+ : `${name}: ${onMerge.verdict} on merge commit ${mergeCommitSha.slice(0, 12)}`);
226
+ }
227
+ return reasons.length > 0 ? { ok: false, reasons } : { ok: true, checks: matched };
228
+ }
229
+ function describePin(pin) {
230
+ if (!pin)
231
+ return 'source';
232
+ return [
233
+ pin.app !== undefined ? `app ${pin.app}` : '',
234
+ pin.workflow ? `workflow ${pin.workflow}` : '',
235
+ ]
236
+ .filter(Boolean)
237
+ .join(' / ');
238
+ }
239
+ function judged(name, run, sha) {
240
+ return {
241
+ name,
242
+ conclusion: 'success',
243
+ sha,
244
+ ...(run.appSlug !== undefined
245
+ ? { app: run.appSlug }
246
+ : run.appId !== undefined
247
+ ? { app: String(run.appId) }
248
+ : {}),
249
+ ...(run.workflowPath ? { workflow: run.workflowPath } : {}),
250
+ ...(run.event ? { event: run.event } : {}),
251
+ };
252
+ }
253
+ /**
254
+ * Judge one required name on one SHA. Runs are grouped by (source, event) and
255
+ * the latest attempt of each group must have completed with `success`. With
256
+ * `onlyEvent`, only runs of that event are considered.
257
+ */
258
+ function judgeOnSha(named, sha, onlyEvent) {
259
+ const onSha = named.filter((c) => c.headSha === sha && (onlyEvent === undefined || c.event === onlyEvent));
260
+ if (onSha.length === 0)
261
+ return { ok: false, verdict: 'missing' };
262
+ const groups = new Map();
263
+ for (const c of onSha) {
264
+ const key = `${c.source}\u0000${c.event ?? ''}`;
265
+ const prev = groups.get(key);
266
+ if (!prev || c.id > prev.id)
267
+ groups.set(key, c);
268
+ }
269
+ const latest = [...groups.values()];
270
+ const bad = latest.find((c) => c.status !== 'completed' || c.conclusion !== 'success');
271
+ if (bad) {
272
+ return {
273
+ ok: false,
274
+ verdict: bad.status !== 'completed' ? `pending (${bad.status})` : (bad.conclusion ?? 'unknown'),
275
+ };
276
+ }
277
+ return { ok: true, run: latest.find((c) => c.source === 'workflow-run') ?? latest[0] };
278
+ }
279
+ /** Default {@link ResolveCiEvidenceOptions.treeOf}: `git rev-parse <sha>^{tree}`. */
280
+ function defaultTreeOf(sha, cwd) {
281
+ return gitRead(cwd, ['rev-parse', '--verify', '--quiet', `${sha}^{tree}`]);
282
+ }
283
+ function defaultIsAncestor(ancestor, descendant, cwd) {
284
+ return gitRead(cwd, ['merge-base', '--is-ancestor', ancestor, descendant]) !== null;
285
+ }
286
+ function defaultOnDefaultBranch(sha, cwd) {
287
+ // The forge is authoritative; a local origin/HEAD can be stale or unset.
288
+ const fromGh = ghDefaultBranch(cwd);
289
+ const symbolic = fromGh
290
+ ? null
291
+ : gitRead(cwd, ['symbolic-ref', '--quiet', 'refs/remotes/origin/HEAD']);
292
+ let ref = fromGh
293
+ ? `origin/${fromGh}`
294
+ : symbolic
295
+ ? symbolic.replace(/^refs\/remotes\//, '')
296
+ : null;
297
+ if (ref === null) {
298
+ for (const candidate of ['origin/main', 'origin/master']) {
299
+ if (gitRead(cwd, ['rev-parse', '--verify', '--quiet', `refs/remotes/${candidate}`]) !== null) {
300
+ ref = candidate;
301
+ break;
302
+ }
303
+ }
304
+ }
305
+ if (ref === null)
306
+ return { ref: null, landed: false };
307
+ return { ref, landed: defaultIsAncestor(sha, ref, cwd) };
308
+ }
309
+ /** Default branch name from `gh repo view --json defaultBranchRef`, or null. */
310
+ function ghDefaultBranch(cwd) {
311
+ if (!isGhCliAvailable())
312
+ return null;
313
+ try {
314
+ const name = execFileSync('gh', ['repo', 'view', '--json', 'defaultBranchRef', '--jq', '.defaultBranchRef.name'], { cwd, encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'], timeout: ghQueryTimeoutMs() }).trim();
315
+ return /^[A-Za-z0-9._/-]+$/.test(name) ? name : null;
316
+ }
317
+ catch {
318
+ return null;
319
+ }
320
+ }
321
+ function defaultFirstParentOf(sha, cwd) {
322
+ return gitRead(cwd, ['rev-parse', '--verify', '--quiet', `${sha}^1`]);
323
+ }
324
+ function gitRead(cwd, args) {
325
+ try {
326
+ return execFileSync('git', args, {
327
+ cwd,
328
+ encoding: 'utf-8',
329
+ stdio: ['ignore', 'pipe', 'ignore'],
330
+ }).trim();
331
+ }
332
+ catch {
333
+ return null;
334
+ }
335
+ }
336
+ /** Run one read-only `gh api` GET; `null` on failure. */
337
+ function ghApi(path, cwd) {
338
+ try {
339
+ return JSON.parse(execFileSync('gh', ['api', path], {
340
+ cwd,
341
+ encoding: 'utf-8',
342
+ stdio: ['ignore', 'pipe', 'pipe'],
343
+ maxBuffer: 32 * 1024 * 1024,
344
+ timeout: ghQueryTimeoutMs(),
345
+ }));
346
+ }
347
+ catch {
348
+ return null;
349
+ }
350
+ }
351
+ /**
352
+ * Default {@link ResolveCiEvidenceOptions.fetchChecks}: check runs + workflow
353
+ * runs for a SHA. Workflow runs carry their event and workflow file; a check
354
+ * run inherits both from the workflow run of its check suite.
355
+ */
356
+ async function defaultFetchChecks(sha, cwd) {
357
+ if (!isGitWorkTree(cwd) || !isGhCliAvailable()) {
358
+ return { ok: false, reason: `gh cannot query checks from ${cwd} (no work tree or gh CLI).` };
359
+ }
360
+ const wf = ghApi(`repos/{owner}/{repo}/actions/runs?head_sha=${sha}&per_page=100`, cwd);
361
+ if (wf === null)
362
+ return { ok: false, reason: `gh api workflow runs for ${sha} failed` };
363
+ const checks = [];
364
+ const bySuite = new Map();
365
+ for (const r of wf.workflow_runs ?? []) {
366
+ const event = typeof r.event === 'string' ? r.event : undefined;
367
+ const path = typeof r.path === 'string' ? r.path.replace(/@.*$/, '') : undefined;
368
+ if (typeof r.check_suite_id === 'number')
369
+ bySuite.set(r.check_suite_id, { event, path });
370
+ checks.push({
371
+ name: String(r.name ?? ''),
372
+ source: 'workflow-run',
373
+ status: String(r.status ?? ''),
374
+ conclusion: typeof r.conclusion === 'string' ? r.conclusion : null,
375
+ headSha: String(r.head_sha ?? ''),
376
+ id: Number(r.id ?? 0),
377
+ appSlug: 'github-actions',
378
+ ...(path ? { workflowPath: path } : {}),
379
+ ...(event ? { event } : {}),
380
+ });
381
+ }
382
+ for (let page = 1; page <= 10; page++) {
383
+ const body = ghApi(`repos/{owner}/{repo}/commits/${sha}/check-runs?per_page=100&page=${page}`, cwd);
384
+ if (body === null)
385
+ return { ok: false, reason: `gh api check-runs for ${sha} failed` };
386
+ const runs = body.check_runs ?? [];
387
+ for (const r of runs) {
388
+ const app = r.app;
389
+ const suite = r.check_suite?.id;
390
+ const origin = typeof suite === 'number' ? bySuite.get(suite) : undefined;
391
+ checks.push({
392
+ name: String(r.name ?? ''),
393
+ source: 'check-run',
394
+ status: String(r.status ?? ''),
395
+ conclusion: typeof r.conclusion === 'string' ? r.conclusion : null,
396
+ headSha: String(r.head_sha ?? ''),
397
+ id: Number(r.id ?? 0),
398
+ ...(typeof app?.slug === 'string' ? { appSlug: app.slug } : {}),
399
+ ...(typeof app?.id === 'number' ? { appId: app.id } : {}),
400
+ ...(origin?.path ? { workflowPath: origin.path } : {}),
401
+ ...(origin?.event ? { event: origin.event } : {}),
402
+ });
403
+ }
404
+ if (runs.length < 100)
405
+ break;
406
+ }
407
+ return { ok: true, checks };
408
+ }
409
+ /**
410
+ * Validate a `ci:<pr>` atom end to end.
411
+ *
412
+ * @param prNumber - The merged PR.
413
+ * @param roots - Store root (config, caches) and execution root (`gh` cwd).
414
+ * @param opts - Injectable PR resolution and check fetching.
415
+ * @returns The validated atom, or a refusal naming every unmet check.
416
+ * @example
417
+ * ```ts
418
+ * const r = await resolveCiEvidenceAtom(357, { storeRoot, executionRoot });
419
+ * ```
420
+ * @task T12634
421
+ */
422
+ export async function resolveCiEvidenceAtom(prNumber, roots, opts = {}) {
423
+ if (!readCiSatisfies(roots.storeRoot)) {
424
+ return {
425
+ ok: false,
426
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
427
+ reason: 'ci:<pr> evidence is disabled for this project (evidence.ciSatisfies is not true). Set "evidence": { "ciSatisfies": true } in ' +
428
+ ".cleo/project-context.json to accept required CI on a merged PR's merge commit for " +
429
+ 'testsPassed and qaPassed (D11149), or record tool:test / tool:lint results instead.',
430
+ };
431
+ }
432
+ const context = opts.context;
433
+ if (!context) {
434
+ return {
435
+ ok: false,
436
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
437
+ reason: 'CI evidence requires current task, gate and acceptance-criterion context.',
438
+ };
439
+ }
440
+ // T12634: which checks attest which gate is declared, never inferred.
441
+ const ciChecks = readCiChecks(roots.storeRoot);
442
+ const gateLists = context.gates
443
+ .filter((g) => g === 'testsPassed' || g === 'qaPassed')
444
+ .map((g) => ({
445
+ gate: g,
446
+ key: g === 'testsPassed' ? 'tests' : 'qa',
447
+ list: ciChecks[g === 'testsPassed' ? 'tests' : 'qa'],
448
+ }));
449
+ if (gateLists.length === 0) {
450
+ return {
451
+ ok: false,
452
+ codeName: 'E_EVIDENCE_INVALID',
453
+ reason: `ci:${prNumber} attests only testsPassed and qaPassed, not ${context.gates.join(', ')}.`,
454
+ };
455
+ }
456
+ const unconfigured = gateLists.filter((g) => !g.list || g.list.length === 0);
457
+ if (unconfigured.length > 0) {
458
+ return {
459
+ ok: false,
460
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
461
+ reason: `ci:${prNumber} cannot attest ${unconfigured.map((g) => g.gate).join(', ')}: set ` +
462
+ unconfigured.map((g) => `evidence.ciChecks.${g.key}`).join(' and ') +
463
+ ' in .cleo/project-context.json to the required checks that prove it.',
464
+ };
465
+ }
466
+ const projectContext = opts.projectContext ?? null;
467
+ const readOnly = opts.readOnly === true;
468
+ const pr = await (opts.resolvePr ?? ((n, r) => resolvePrEvidenceAtom(n, r, { projectContext, readOnly })))(prNumber, roots);
469
+ if (!pr.ok)
470
+ return { ok: false, reason: pr.reason, codeName: pr.codeName };
471
+ // T12634: the same task linkage `pr:` enforces — never any merged PR for any
472
+ // task. T12671: through the component PR when the atom names one.
473
+ const linked = await linkedPrChange(prNumber, pr, roots, opts.componentPrNumber, opts.viewComponentPr);
474
+ if (!linked.ok) {
475
+ return {
476
+ ok: false,
477
+ reason: linked.reason,
478
+ codeName: linked.codeName === 'E_EVIDENCE_CONTENT_MISMATCH'
479
+ ? 'E_EVIDENCE_CONTENT_MISMATCH'
480
+ : 'E_EVIDENCE_INSUFFICIENT',
481
+ };
482
+ }
483
+ const unlinked = checkPrTaskLinkage(linked.prNumber, linked.pr, context);
484
+ if (unlinked) {
485
+ return {
486
+ ok: false,
487
+ reason: unlinked.reason,
488
+ codeName: unlinked.codeName === 'E_EVIDENCE_CONTENT_MISMATCH'
489
+ ? 'E_EVIDENCE_CONTENT_MISMATCH'
490
+ : 'E_EVIDENCE_INSUFFICIENT',
491
+ };
492
+ }
493
+ // The work must have LANDED on the default branch: a PR merged into an
494
+ // integration branch counts once that branch reached the default branch
495
+ // (its merge commit is then an ancestor), and never before.
496
+ const onDefault = (opts.onDefaultBranch ?? defaultOnDefaultBranch)(pr.mergeCommitSha, roots.executionRoot);
497
+ if (onDefault.ref === null) {
498
+ return {
499
+ ok: false,
500
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
501
+ reason: `Cannot determine origin's default branch in ${roots.executionRoot}, so ci:${prNumber} cannot show the work landed (git remote set-head origin --auto).`,
502
+ };
503
+ }
504
+ if (!onDefault.landed) {
505
+ return {
506
+ ok: false,
507
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
508
+ reason: `PR #${prNumber}'s merge commit ${pr.mergeCommitSha.slice(0, 12)} is not on ${onDefault.ref}: the work has not landed on the default branch (git fetch origin, or wait until its integration branch merges).`,
509
+ };
510
+ }
511
+ const required = await resolveRequiredWorkflowsDetailed(roots, { projectContext, readOnly });
512
+ if (required.source.tier === 'unknown') {
513
+ return {
514
+ ok: false,
515
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
516
+ reason: `Cannot determine the required checks (${required.source.reason}); ci:${prNumber} cannot be judged.`,
517
+ };
518
+ }
519
+ const outside = gateLists.flatMap((g) => (g.list ?? []).filter((n) => !required.workflows.includes(n)).map((n) => `${g.key}:${n}`));
520
+ if (outside.length > 0) {
521
+ return {
522
+ ok: false,
523
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
524
+ reason: `evidence.ciChecks names checks that are not required (${outside.join(', ')}); required: ${required.workflows.join(', ')}.`,
525
+ };
526
+ }
527
+ // Pins: branch protection's app ids when that tier supplied the list,
528
+ // otherwise object entries of release.prRequiredWorkflows.
529
+ const pins = required.pins ?? readRequiredCheckPins(projectContext);
530
+ // Round 2 (MEDIUM): a check that attests a gate must be pinned to the app
531
+ // that posts it — an unpinned name would match a run from any app.
532
+ const mapped = [...new Set(gateLists.flatMap((g) => g.list ?? []))];
533
+ const unpinned = mapped.filter((name) => pins[name]?.app === undefined);
534
+ if (unpinned.length > 0) {
535
+ return {
536
+ ok: false,
537
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
538
+ reason: `ci:${prNumber} cannot trust unpinned check(s) ${unpinned.join(', ')}: declare each in ` +
539
+ 'release.prRequiredWorkflows as { "name": "<check>", "app": "<app slug or id>", ' +
540
+ '"workflow": ".github/workflows/<file>.yml" } (or pin it in branch protection).',
541
+ };
542
+ }
543
+ // Round 2: a pull_request run executes the PR's OWN edited workflow, so a PR
544
+ // that touches a pinned workflow file cannot vouch for itself.
545
+ const pinnedWorkflows = [
546
+ ...new Set(mapped.flatMap((name) => (pins[name]?.workflow ? [pins[name].workflow] : []))),
547
+ ];
548
+ const editedWorkflows = pinnedWorkflows.filter((w) => pr.changedPaths.includes(w));
549
+ if (editedWorkflows.length > 0) {
550
+ return {
551
+ ok: false,
552
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
553
+ reason: `PR #${prNumber} edits the pinned workflow ${editedWorkflows.join(', ')}, so its own CI ` +
554
+ 'cannot attest it. Record local results instead (tool:test, tool:lint, tool:typecheck).',
555
+ };
556
+ }
557
+ const fetchChecks = opts.fetchChecks ?? defaultFetchChecks;
558
+ const fetched = await fetchChecks(pr.mergeCommitSha, roots.executionRoot);
559
+ if (!fetched.ok)
560
+ return { ok: false, reason: fetched.reason, codeName: 'E_EVIDENCE_TOOL_FAILED' };
561
+ // T12634 (review): a pull_request run on head H tested merge(H, base-at-run).
562
+ // Tree equality alone is unsound — base can gain X, CI tests H+X, then base
563
+ // reverts X and the merge still equals H's tree. Requiring the merge's
564
+ // first parent to be an ANCESTOR of H closes it: base only advances, so
565
+ // every base-at-run was already in H and the tested merge IS H. GitHub
566
+ // deletes refs/pull/<n>/merge after merge, so H stands in for it.
567
+ const cwd = roots.executionRoot;
568
+ const treeOf = opts.treeOf ?? defaultTreeOf;
569
+ const mergeTree = treeOf(pr.mergeCommitSha, cwd);
570
+ const head = pr.headRefOid;
571
+ const headTree = head ? treeOf(head, cwd) : null;
572
+ const parent = (opts.firstParentOf ?? defaultFirstParentOf)(pr.mergeCommitSha, cwd);
573
+ const treeEqualHead = head &&
574
+ mergeTree !== null &&
575
+ headTree !== null &&
576
+ headTree === mergeTree &&
577
+ parent !== null &&
578
+ (opts.isAncestor ?? defaultIsAncestor)(parent, head, cwd)
579
+ ? head
580
+ : undefined;
581
+ let checks = fetched.checks;
582
+ if (treeEqualHead && treeEqualHead !== pr.mergeCommitSha) {
583
+ const onHead = await fetchChecks(treeEqualHead, cwd);
584
+ if (onHead.ok)
585
+ checks = [...checks, ...onHead.checks];
586
+ }
587
+ const judgedChecks = evaluateMergeCommitChecks(required.workflows, checks, pr.mergeCommitSha, {
588
+ ...(treeEqualHead ? { treeEquivalentSha: treeEqualHead } : {}),
589
+ pins,
590
+ });
591
+ if (!judgedChecks.ok) {
592
+ return {
593
+ ok: false,
594
+ codeName: 'E_EVIDENCE_TESTS_FAILED',
595
+ reason: `Required CI on PR #${prNumber}'s merge commit ${pr.mergeCommitSha.slice(0, 12)} is not green ` +
596
+ `(source: ${describeRequiredWorkflowsSource(required.source)}):\n - ${judgedChecks.reasons.join('\n - ')}`,
597
+ };
598
+ }
599
+ // Round 2 (skipped tests): the aggregate counts skipped jobs as a pass. For a
600
+ // CODE task every configured job glob must have actually run and succeeded
601
+ // in the pinned workflows; a docs/research task keeps the honest skip.
602
+ // A PR whose whole diff is documentation had nothing for the test and
603
+ // typecheck jobs to run on — the same judgement `pr:` makes when it refuses a
604
+ // docs-only PR as a code task's implementation — so its skip is honest too.
605
+ // Round 3: the DIFF alone decides — a task label is agent-editable
606
+ // (`cleo update --labels docs`) and must never excuse skipped jobs.
607
+ const docsOnlyDiff = pr.changedPaths.length > 0 && pr.changedPaths.every(isCiDocumentPath);
608
+ const isCode = !docsOnlyDiff;
609
+ const jobsByGate = {};
610
+ if (isCode) {
611
+ for (const g of gateLists) {
612
+ const globs = readCiChecks(roots.storeRoot).jobs?.[g.key];
613
+ if (!globs || globs.length === 0) {
614
+ return {
615
+ ok: false,
616
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
617
+ reason: `ci:${prNumber} cannot attest ${g.gate} for code task ${context.task.id}: set ` +
618
+ `evidence.ciChecks.jobs.${g.key} to the job names that must run (e.g. "Unit Tests*").`,
619
+ };
620
+ }
621
+ const scopeWorkflows = (g.list ?? []).flatMap((n) => pins[n]?.workflow ? [pins[n].workflow] : []);
622
+ const app = (g.list ?? []).map((n) => pins[n]?.app).find((a) => a !== undefined);
623
+ if (scopeWorkflows.length === 0) {
624
+ return {
625
+ ok: false,
626
+ codeName: 'E_EVIDENCE_INSUFFICIENT',
627
+ reason: `ci:${prNumber}: no workflow file is pinned for ${g.gate}'s checks, so its jobs cannot be scoped; add "workflow" to their release.prRequiredWorkflows entries.`,
628
+ };
629
+ }
630
+ const scope = { ...(app !== undefined ? { app } : {}), workflows: scopeWorkflows };
631
+ let judgedJobs = evaluateJobs(globs, checks, pr.mergeCommitSha, scope);
632
+ if (!judgedJobs.ok && treeEqualHead) {
633
+ const onHead = evaluateJobs(globs, checks, treeEqualHead, scope, 'pull_request');
634
+ if (onHead.ok)
635
+ judgedJobs = onHead;
636
+ }
637
+ if (!judgedJobs.ok) {
638
+ return {
639
+ ok: false,
640
+ codeName: 'E_EVIDENCE_TESTS_FAILED',
641
+ reason: `${g.gate} for code task ${context.task.id} needs its jobs to have run on PR #${prNumber}:\n - ` +
642
+ judgedJobs.reasons.join('\n - '),
643
+ };
644
+ }
645
+ jobsByGate[g.gate] = judgedJobs.jobs;
646
+ }
647
+ }
648
+ const gateChecks = {};
649
+ for (const g of gateLists)
650
+ gateChecks[g.gate] = [...(g.list ?? []), ...(jobsByGate[g.gate] ?? [])];
651
+ return {
652
+ ok: true,
653
+ atom: {
654
+ kind: 'ci',
655
+ prNumber,
656
+ mergeCommitSha: pr.mergeCommitSha,
657
+ checks: judgedChecks.checks,
658
+ ...(mergeTree !== null ? { testedTree: mergeTree } : {}),
659
+ requiredSource: required.source.tier,
660
+ taskId: context.task.id,
661
+ gateChecks,
662
+ ...(opts.componentPrNumber !== undefined
663
+ ? { componentPrNumber: opts.componentPrNumber }
664
+ : {}),
665
+ },
666
+ };
667
+ }
668
+ //# sourceMappingURL=ci-evidence.js.map