@intentius/chant 0.124.109 → 0.124.110

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 (338) hide show
  1. package/dist/__golden__/wave-loop/fan-out-applied.json +12 -6
  2. package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
  3. package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
  4. package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
  5. package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
  6. package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
  7. package/dist/agent-facts.d.ts +130 -0
  8. package/dist/agent-facts.js +196 -0
  9. package/dist/change-risk.d.ts +216 -0
  10. package/dist/change-risk.js +304 -0
  11. package/dist/change-set.d.ts +8 -0
  12. package/dist/ci-agent-alert.d.ts +139 -0
  13. package/dist/ci-agent-alert.js +342 -0
  14. package/dist/ci-agent-triggers.d.ts +152 -0
  15. package/dist/ci-agent-triggers.js +232 -0
  16. package/dist/ci-agent-verify-failed.d.ts +149 -0
  17. package/dist/ci-agent-verify-failed.js +191 -0
  18. package/dist/ci-agent.d.ts +136 -8
  19. package/dist/ci-agent.js +353 -26
  20. package/dist/ci-comment-commands.d.ts +8 -0
  21. package/dist/ci-comment-commands.js +17 -1
  22. package/dist/ci-comment-reject.d.ts +70 -0
  23. package/dist/ci-comment-reject.js +135 -0
  24. package/dist/ci-comment-replies.d.ts +3 -1
  25. package/dist/ci-comment-replies.js +6 -0
  26. package/dist/ci-estate/delivery.d.ts +25 -3
  27. package/dist/ci-estate/delivery.js +28 -9
  28. package/dist/ci-estate/page.d.ts +7 -3
  29. package/dist/ci-estate/page.js +19 -4
  30. package/dist/ci-estate/rows.d.ts +14 -2
  31. package/dist/ci-estate/rows.js +9 -1
  32. package/dist/ci-estate.d.ts +5 -2
  33. package/dist/ci-estate.js +3 -2
  34. package/dist/ci-handover.d.ts +2 -7
  35. package/dist/ci-handover.js +3 -20
  36. package/dist/ci-jobs.d.ts +6 -0
  37. package/dist/ci-jobs.js +17 -0
  38. package/dist/ci-note-commands.d.ts +2 -0
  39. package/dist/ci-note-commands.js +12 -1
  40. package/dist/ci-product-words.d.ts +151 -1
  41. package/dist/ci-product-words.js +1390 -3
  42. package/dist/ci-product.d.ts +100 -4
  43. package/dist/ci-product.js +99 -3
  44. package/dist/ci-respond-run.d.ts +9 -0
  45. package/dist/ci-respond-run.js +35 -4
  46. package/dist/ci-respond-summary-env.d.ts +56 -0
  47. package/dist/ci-respond-summary-env.js +81 -0
  48. package/dist/ci-respond-summary.d.ts +103 -0
  49. package/dist/ci-respond-summary.js +243 -0
  50. package/dist/ci-respond.d.ts +4 -2
  51. package/dist/ci-respond.js +4 -2
  52. package/dist/cli/command-group.js +1 -1
  53. package/dist/cli/commands/lint.js +21 -3
  54. package/dist/cli/handlers/agent.js +49 -4
  55. package/dist/cli/handlers/approve.js +3 -1
  56. package/dist/cli/handlers/build.d.ts +97 -1
  57. package/dist/cli/handlers/build.js +251 -3
  58. package/dist/cli/handlers/fan-out.js +55 -0
  59. package/dist/cli/handlers/graph.d.ts +14 -0
  60. package/dist/cli/handlers/graph.js +58 -3
  61. package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
  62. package/dist/cli/handlers/lifecycle-health.js +47 -9
  63. package/dist/cli/handlers/lifecycle.js +4 -1
  64. package/dist/cli/handlers/notify-relay.d.ts +2 -2
  65. package/dist/cli/handlers/notify-relay.js +67 -7
  66. package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
  67. package/dist/cli/handlers/pipeline-agent.js +255 -0
  68. package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
  69. package/dist/cli/handlers/pipeline-artifacts.js +203 -0
  70. package/dist/cli/handlers/pipeline.d.ts +16 -0
  71. package/dist/cli/handlers/pipeline.js +112 -0
  72. package/dist/cli/handlers/pr-comment.js +4 -0
  73. package/dist/cli/handlers/pr-notes.js +4 -1
  74. package/dist/cli/handlers/pr.d.ts +20 -0
  75. package/dist/cli/handlers/pr.js +114 -11
  76. package/dist/cli/handlers/promote.js +792 -47
  77. package/dist/cli/handlers/reject.d.ts +84 -0
  78. package/dist/cli/handlers/reject.js +216 -0
  79. package/dist/cli/handlers/replan.d.ts +54 -0
  80. package/dist/cli/handlers/replan.js +177 -0
  81. package/dist/cli/handlers/run-generate.d.ts +5 -0
  82. package/dist/cli/handlers/run-generate.js +31 -4
  83. package/dist/cli/handlers/run-wave.js +15 -2
  84. package/dist/cli/handlers/run.js +4 -2
  85. package/dist/cli/handlers/stage.d.ts +35 -0
  86. package/dist/cli/handlers/stage.js +90 -0
  87. package/dist/cli/lsp/server.js +4 -0
  88. package/dist/cli/main.js +88 -8
  89. package/dist/cli/parse-args.js +35 -2
  90. package/dist/cli/registry.d.ts +12 -0
  91. package/dist/components/auto-release.d.ts +2 -0
  92. package/dist/components/auto-release.js +1 -0
  93. package/dist/components/capability.d.ts +40 -0
  94. package/dist/components/cli-support.d.ts +21 -1
  95. package/dist/components/cli-support.js +28 -6
  96. package/dist/components/component.d.ts +23 -4
  97. package/dist/components/component.schema.json +28 -0
  98. package/dist/components/declared-reads.d.ts +44 -4
  99. package/dist/components/declared-reads.js +80 -3
  100. package/dist/components/discover.d.ts +8 -0
  101. package/dist/components/discover.js +1 -1
  102. package/dist/components/driver.d.ts +13 -0
  103. package/dist/components/driver.js +23 -2
  104. package/dist/components/environment-sets.d.ts +229 -0
  105. package/dist/components/environment-sets.js +338 -0
  106. package/dist/components/fan-out-canary.d.ts +47 -0
  107. package/dist/components/fan-out-canary.js +58 -0
  108. package/dist/components/fan-out-run.d.ts +17 -0
  109. package/dist/components/fan-out-run.js +14 -1
  110. package/dist/components/fan-out-support.d.ts +7 -0
  111. package/dist/components/fan-out-support.js +1 -1
  112. package/dist/components/groups.d.ts +8 -1
  113. package/dist/components/groups.js +19 -1
  114. package/dist/components/index.d.ts +5 -2
  115. package/dist/components/index.js +4 -1
  116. package/dist/components/pr-cost.d.ts +28 -0
  117. package/dist/components/pr-cost.js +53 -0
  118. package/dist/components/pr-pipeline.d.ts +33 -0
  119. package/dist/components/pr-pipeline.js +32 -5
  120. package/dist/components/pr-policy.d.ts +33 -2
  121. package/dist/components/pr-policy.js +5 -2
  122. package/dist/components/pr-risk.d.ts +42 -0
  123. package/dist/components/pr-risk.js +74 -0
  124. package/dist/components/product-pipeline.d.ts +43 -0
  125. package/dist/components/product-pipeline.js +67 -1
  126. package/dist/components/promote.d.ts +6 -0
  127. package/dist/components/promote.js +13 -0
  128. package/dist/components/release-compile.js +3 -1
  129. package/dist/components/release-gate.d.ts +6 -1
  130. package/dist/components/release-gate.js +10 -2
  131. package/dist/components/step-environments.d.ts +236 -0
  132. package/dist/components/step-environments.js +392 -0
  133. package/dist/components/upstream-replan.d.ts +201 -0
  134. package/dist/components/upstream-replan.js +249 -0
  135. package/dist/components/verify-step.d.ts +30 -0
  136. package/dist/components/verify-step.js +27 -0
  137. package/dist/components/wave-plan.js +6 -2
  138. package/dist/config-environments.d.ts +4 -2
  139. package/dist/control/dispatch.d.ts +15 -0
  140. package/dist/control/dispatch.js +28 -4
  141. package/dist/cost-estimate.d.ts +188 -0
  142. package/dist/cost-estimate.js +363 -0
  143. package/dist/drift-record.d.ts +36 -0
  144. package/dist/drift-record.js +44 -0
  145. package/dist/engine-facts.d.ts +105 -0
  146. package/dist/engine-facts.js +111 -0
  147. package/dist/exit-codes.d.ts +4 -3
  148. package/dist/exit-codes.js +4 -3
  149. package/dist/flag-params.d.ts +2 -2
  150. package/dist/flag-params.js +9 -4
  151. package/dist/floor-table.data.js +53 -0
  152. package/dist/forge-token-vars.d.ts +12 -0
  153. package/dist/forge-token-vars.js +25 -0
  154. package/dist/gate-decision.d.ts +3 -1
  155. package/dist/gate-decision.js +3 -1
  156. package/dist/gated-waves.d.ts +2 -0
  157. package/dist/gated-waves.js +1 -0
  158. package/dist/graph-ir.d.ts +30 -0
  159. package/dist/graph-ir.js +33 -1
  160. package/dist/graph-refs.d.ts +26 -0
  161. package/dist/graph-refs.js +34 -3
  162. package/dist/graph-schema/graph.schema.json +136 -0
  163. package/dist/health.d.ts +65 -0
  164. package/dist/health.js +62 -0
  165. package/dist/lexicon.d.ts +188 -1
  166. package/dist/lifecycle/disruption.d.ts +14 -1
  167. package/dist/lifecycle/disruption.js +5 -1
  168. package/dist/lifecycle/gate-change-set.d.ts +8 -0
  169. package/dist/lifecycle/gate-change-set.js +2 -1
  170. package/dist/lifecycle/gate-ledger.d.ts +26 -0
  171. package/dist/lifecycle/gate-rejection.d.ts +82 -0
  172. package/dist/lifecycle/gate-rejection.js +93 -0
  173. package/dist/lifecycle/gate-seal.d.ts +3 -3
  174. package/dist/lifecycle/gate-seal.js +5 -5
  175. package/dist/lifecycle/observe.d.ts +17 -0
  176. package/dist/lifecycle/observe.js +10 -1
  177. package/dist/lifecycle/release-cut.js +4 -0
  178. package/dist/lifecycle/release-ledger.d.ts +8 -0
  179. package/dist/lifecycle/release-risk.d.ts +137 -0
  180. package/dist/lifecycle/release-risk.js +214 -0
  181. package/dist/lifecycle/release-store.d.ts +9 -0
  182. package/dist/lifecycle/release-store.js +4 -0
  183. package/dist/lifecycle/stage-log.d.ts +85 -0
  184. package/dist/lifecycle/stage-log.js +141 -0
  185. package/dist/lint/canary-checks.d.ts +31 -0
  186. package/dist/lint/canary-checks.js +45 -0
  187. package/dist/lint/rule.d.ts +1 -0
  188. package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
  189. package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
  190. package/dist/lint/rules/index.d.ts +1 -0
  191. package/dist/lint/rules/index.js +3 -0
  192. package/dist/notify-relay-repo.d.ts +54 -0
  193. package/dist/notify-relay-repo.js +84 -0
  194. package/dist/notify-relay.d.ts +53 -3
  195. package/dist/notify-relay.js +96 -3
  196. package/dist/notify.d.ts +57 -1
  197. package/dist/notify.js +7 -1
  198. package/dist/notify.schema.json +61 -3
  199. package/dist/observation.d.ts +34 -0
  200. package/dist/observation.js +14 -1
  201. package/dist/op/activities/review-agent.d.ts +39 -2
  202. package/dist/op/activities/review-agent.js +88 -5
  203. package/dist/op/agent-permit.d.ts +88 -0
  204. package/dist/op/agent-permit.js +97 -0
  205. package/dist/op/gate-approval-base.d.ts +8 -0
  206. package/dist/op/gate-approval-base.js +9 -0
  207. package/dist/op/gate-approval.d.ts +30 -1
  208. package/dist/op/gate-approval.js +23 -2
  209. package/dist/op/gate-quorum.d.ts +114 -8
  210. package/dist/op/gate-quorum.js +198 -21
  211. package/dist/op/gate-reject.d.ts +79 -0
  212. package/dist/op/gate-reject.js +96 -0
  213. package/dist/op/gate-summary.js +1 -1
  214. package/dist/op/gate.d.ts +28 -3
  215. package/dist/op/gate.js +55 -13
  216. package/dist/op/generate-pipeline.d.ts +15 -1
  217. package/dist/op/generate-pipeline.js +32 -5
  218. package/dist/op/index.d.ts +11 -6
  219. package/dist/op/index.js +10 -5
  220. package/dist/op/local-executor.d.ts +2 -0
  221. package/dist/op/local-executor.js +23 -4
  222. package/dist/op/op-waves-after-plan.d.ts +23 -0
  223. package/dist/op/op-waves-after-plan.js +12 -1
  224. package/dist/op/op-waves-capability-spec.d.ts +14 -0
  225. package/dist/op/op-waves-capability-spec.js +46 -6
  226. package/dist/op/op-waves-capability.d.ts +21 -13
  227. package/dist/op/op-waves-capability.js +22 -59
  228. package/dist/op/op-waves-environment-sets.d.ts +41 -0
  229. package/dist/op/op-waves-environment-sets.js +82 -0
  230. package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
  231. package/dist/op/op-waves-quorum-warnings.js +90 -0
  232. package/dist/op/op-waves-release-port.d.ts +7 -0
  233. package/dist/op/op-waves-release-port.js +15 -3
  234. package/dist/op/op-waves-release.d.ts +15 -0
  235. package/dist/op/op-waves-release.js +15 -0
  236. package/dist/op/op-waves-run.d.ts +37 -3
  237. package/dist/op/op-waves-run.js +141 -18
  238. package/dist/op/op-waves-soak.d.ts +57 -0
  239. package/dist/op/op-waves-soak.js +111 -0
  240. package/dist/op/op-waves-split.d.ts +4 -0
  241. package/dist/op/op-waves-split.js +4 -0
  242. package/dist/op/op-waves.d.ts +67 -4
  243. package/dist/op/op-waves.js +71 -3
  244. package/dist/pipeline/agent-ajv.d.ts +4 -0
  245. package/dist/pipeline/agent-ajv.js +14 -0
  246. package/dist/pipeline/agent-steps.d.ts +329 -0
  247. package/dist/pipeline/agent-steps.js +602 -0
  248. package/dist/pipeline/artifacts.d.ts +264 -0
  249. package/dist/pipeline/artifacts.js +425 -0
  250. package/dist/pipeline/diff.d.ts +45 -0
  251. package/dist/pipeline/diff.js +177 -0
  252. package/dist/pipeline/fold.d.ts +43 -0
  253. package/dist/pipeline/fold.js +140 -0
  254. package/dist/pipeline/generate.d.ts +52 -0
  255. package/dist/pipeline/generate.js +120 -0
  256. package/dist/pipeline/product.d.ts +225 -0
  257. package/dist/pipeline/product.js +257 -0
  258. package/dist/pipeline/promote.d.ts +404 -0
  259. package/dist/pipeline/promote.js +694 -0
  260. package/dist/pipeline/read.d.ts +37 -0
  261. package/dist/pipeline/read.js +58 -0
  262. package/dist/pipeline/rendered.d.ts +25 -0
  263. package/dist/pipeline/rendered.js +53 -0
  264. package/dist/pipeline/soak-checks.d.ts +80 -0
  265. package/dist/pipeline/soak-checks.js +254 -0
  266. package/dist/pipeline/soak-gate.d.ts +97 -0
  267. package/dist/pipeline/soak-gate.js +176 -0
  268. package/dist/pipeline/soak-sources.d.ts +17 -0
  269. package/dist/pipeline/soak-sources.js +42 -0
  270. package/dist/pipeline/soak.d.ts +260 -0
  271. package/dist/pipeline/soak.js +378 -0
  272. package/dist/pipeline/spec.d.ts +724 -0
  273. package/dist/pipeline/spec.js +567 -0
  274. package/dist/pipeline/stage-ledger.d.ts +187 -0
  275. package/dist/pipeline/stage-ledger.js +185 -0
  276. package/dist/pipeline/stage-waves.d.ts +114 -0
  277. package/dist/pipeline/stage-waves.js +161 -0
  278. package/dist/pipeline/stages.d.ts +64 -0
  279. package/dist/pipeline/stages.js +174 -0
  280. package/dist/pipeline/verify-rollback.d.ts +277 -0
  281. package/dist/pipeline/verify-rollback.js +393 -0
  282. package/dist/pipeline.d.ts +142 -0
  283. package/dist/pipeline.js +143 -0
  284. package/dist/pr-loop.d.ts +22 -0
  285. package/dist/pr-loop.js +8 -0
  286. package/dist/pr-plan-note.d.ts +15 -1
  287. package/dist/pr-plan-note.js +8 -0
  288. package/dist/pr-post.d.ts +31 -0
  289. package/dist/pr-post.js +89 -0
  290. package/dist/release-floors.d.ts +1 -1
  291. package/dist/release-floors.js +1 -1
  292. package/dist/report-store/audit.schema.json +50 -0
  293. package/dist/report-store/dora.schema.json +331 -0
  294. package/dist/report-store/estate.schema.json +96 -0
  295. package/dist/report-store/run.schema.json +14 -0
  296. package/dist/report-store.d.ts +151 -0
  297. package/dist/report-store.js +344 -0
  298. package/dist/run-event.d.ts +7 -2
  299. package/dist/wave-runtime.mjs +458 -404
  300. package/dist/workspace/catalog-edges.js +3 -3
  301. package/dist/workspace/change-set.schema.json +4 -0
  302. package/dist/workspace/ci-cloud-identity.d.ts +4 -0
  303. package/dist/workspace/ci-cloud-identity.js +30 -0
  304. package/dist/workspace/ci-run.js +17 -2
  305. package/dist/workspace/ci-secrets.d.ts +3 -1
  306. package/dist/workspace/ci-secrets.js +7 -1
  307. package/dist/workspace/compose-graph.d.ts +1 -1
  308. package/dist/workspace/compose-graph.js +3 -1
  309. package/dist/workspace/declaration.d.ts +27 -0
  310. package/dist/workspace/declaration.js +35 -0
  311. package/dist/workspace/declaration.schema.json +56 -0
  312. package/dist/workspace/graph-cli.js +26 -0
  313. package/dist/workspace/graph.schema.json +5 -1
  314. package/dist/workspace/identity-gate-rule.d.ts +4 -0
  315. package/dist/workspace/identity-gate-rule.js +2 -2
  316. package/dist/workspace/identity-reject-rule.d.ts +14 -0
  317. package/dist/workspace/identity-reject-rule.js +24 -0
  318. package/dist/workspace/identity.d.ts +3 -0
  319. package/dist/workspace/identity.js +2 -1
  320. package/dist/workspace/nested-graph.js +2 -0
  321. package/dist/workspace/pr-report.schema.json +65 -0
  322. package/dist/workspace/promotion-order.d.ts +19 -4
  323. package/dist/workspace/promotion-order.js +26 -4
  324. package/dist/workspace/release-train.d.ts +14 -0
  325. package/dist/workspace/release-train.js +32 -0
  326. package/dist/workspace/run-event.schema.json +2 -2
  327. package/dist/workspace/stack-read-edges.d.ts +19 -0
  328. package/dist/workspace/stack-read-edges.js +54 -0
  329. package/dist/workspace/status-gates.d.ts +51 -1
  330. package/dist/workspace/status-gates.js +60 -0
  331. package/dist/workspace/status-stages.d.ts +223 -0
  332. package/dist/workspace/status-stages.js +279 -0
  333. package/dist/workspace/status.d.ts +45 -1
  334. package/dist/workspace/status.js +109 -5
  335. package/dist/workspace/status.schema.json +283 -2
  336. package/dist/workspace/trust/seal.d.ts +7 -0
  337. package/dist/workspace/trust/seal.js +9 -0
  338. package/package.json +5 -1
@@ -167,7 +167,8 @@
167
167
  }
168
168
  ],
169
169
  "status": "applied",
170
- "approvedBy": "ana"
170
+ "approvedBy": "ana",
171
+ "settledAt": "2026-10-11T00:00:00.000Z"
171
172
  },
172
173
  {
173
174
  "wave": 2,
@@ -189,7 +190,8 @@
189
190
  }
190
191
  ],
191
192
  "status": "applied",
192
- "approvedBy": "ana"
193
+ "approvedBy": "ana",
194
+ "settledAt": "2026-10-11T00:00:00.000Z"
193
195
  },
194
196
  {
195
197
  "wave": 3,
@@ -206,7 +208,8 @@
206
208
  }
207
209
  ],
208
210
  "status": "applied",
209
- "approvedBy": "ana"
211
+ "approvedBy": "ana",
212
+ "settledAt": "2026-10-11T00:00:00.000Z"
210
213
  }
211
214
  ]
212
215
  },
@@ -428,7 +431,8 @@
428
431
  }
429
432
  ],
430
433
  "status": "applied",
431
- "approvedBy": "ana"
434
+ "approvedBy": "ana",
435
+ "settledAt": "2026-10-11T00:00:00.000Z"
432
436
  },
433
437
  {
434
438
  "wave": 2,
@@ -450,7 +454,8 @@
450
454
  }
451
455
  ],
452
456
  "status": "applied",
453
- "approvedBy": "ana"
457
+ "approvedBy": "ana",
458
+ "settledAt": "2026-10-11T00:00:00.000Z"
454
459
  },
455
460
  {
456
461
  "wave": 3,
@@ -467,7 +472,8 @@
467
472
  }
468
473
  ],
469
474
  "status": "applied",
470
- "approvedBy": "ana"
475
+ "approvedBy": "ana",
476
+ "settledAt": "2026-10-11T00:00:00.000Z"
471
477
  }
472
478
  ],
473
479
  "components": [
@@ -144,7 +144,8 @@
144
144
  }
145
145
  ],
146
146
  "status": "applied",
147
- "approvedBy": "ana"
147
+ "approvedBy": "ana",
148
+ "settledAt": "2026-10-11T00:00:00.000Z"
148
149
  },
149
150
  {
150
151
  "wave": 2,
@@ -171,7 +172,8 @@
171
172
  {
172
173
  "component": "a"
173
174
  }
174
- ]
175
+ ],
176
+ "settledAt": "2026-10-11T00:00:00.000Z"
175
177
  }
176
178
  ]
177
179
  },
@@ -346,7 +348,8 @@
346
348
  }
347
349
  ],
348
350
  "status": "applied",
349
- "approvedBy": "ana"
351
+ "approvedBy": "ana",
352
+ "settledAt": "2026-10-11T00:00:00.000Z"
350
353
  },
351
354
  {
352
355
  "wave": 2,
@@ -373,7 +376,8 @@
373
376
  {
374
377
  "component": "a"
375
378
  }
376
- ]
379
+ ],
380
+ "settledAt": "2026-10-11T00:00:00.000Z"
377
381
  }
378
382
  ],
379
383
  "components": [
@@ -255,7 +255,8 @@
255
255
  }
256
256
  ],
257
257
  "status": "applied",
258
- "approvedBy": "ana"
258
+ "approvedBy": "ana",
259
+ "settledAt": "2026-10-11T00:00:00.000Z"
259
260
  },
260
261
  {
261
262
  "wave": 2,
@@ -365,7 +366,8 @@
365
366
  }
366
367
  ],
367
368
  "status": "applied",
368
- "approvedBy": "ana"
369
+ "approvedBy": "ana",
370
+ "settledAt": "2026-10-11T00:00:00.000Z"
369
371
  },
370
372
  {
371
373
  "wave": 2,
@@ -167,7 +167,8 @@
167
167
  }
168
168
  ],
169
169
  "status": "applied",
170
- "approvedBy": "ana"
170
+ "approvedBy": "ana",
171
+ "settledAt": "2026-10-11T00:00:00.000Z"
171
172
  },
172
173
  {
173
174
  "wave": 2,
@@ -185,7 +186,8 @@
185
186
  }
186
187
  ],
187
188
  "status": "applied",
188
- "approvedBy": "ana"
189
+ "approvedBy": "ana",
190
+ "settledAt": "2026-10-11T00:00:00.000Z"
189
191
  },
190
192
  {
191
193
  "wave": 3,
@@ -202,7 +204,8 @@
202
204
  }
203
205
  ],
204
206
  "status": "applied",
205
- "approvedBy": "ana"
207
+ "approvedBy": "ana",
208
+ "settledAt": "2026-10-11T00:00:00.000Z"
206
209
  }
207
210
  ]
208
211
  },
@@ -424,7 +427,8 @@
424
427
  }
425
428
  ],
426
429
  "status": "applied",
427
- "approvedBy": "ana"
430
+ "approvedBy": "ana",
431
+ "settledAt": "2026-10-11T00:00:00.000Z"
428
432
  },
429
433
  {
430
434
  "wave": 2,
@@ -442,7 +446,8 @@
442
446
  }
443
447
  ],
444
448
  "status": "applied",
445
- "approvedBy": "ana"
449
+ "approvedBy": "ana",
450
+ "settledAt": "2026-10-11T00:00:00.000Z"
446
451
  },
447
452
  {
448
453
  "wave": 3,
@@ -459,7 +464,8 @@
459
464
  }
460
465
  ],
461
466
  "status": "applied",
462
- "approvedBy": "ana"
467
+ "approvedBy": "ana",
468
+ "settledAt": "2026-10-11T00:00:00.000Z"
463
469
  }
464
470
  ],
465
471
  "components": [
@@ -741,7 +747,8 @@
741
747
  "digest": "",
742
748
  "members": [],
743
749
  "status": "applied",
744
- "approvedBy": "ana"
750
+ "approvedBy": "ana",
751
+ "settledAt": "2026-10-11T00:00:00.000Z"
745
752
  },
746
753
  {
747
754
  "wave": 2,
@@ -846,7 +853,8 @@
846
853
  "digest": "",
847
854
  "members": [],
848
855
  "status": "applied",
849
- "approvedBy": "ana"
856
+ "approvedBy": "ana",
857
+ "settledAt": "2026-10-11T00:00:00.000Z"
850
858
  },
851
859
  {
852
860
  "wave": 2,
@@ -144,7 +144,8 @@
144
144
  }
145
145
  ],
146
146
  "status": "applied",
147
- "approvedBy": "ana"
147
+ "approvedBy": "ana",
148
+ "settledAt": "2026-10-11T00:00:00.000Z"
148
149
  },
149
150
  {
150
151
  "wave": 2,
@@ -168,7 +169,8 @@
168
169
  "error": "a cannot plan"
169
170
  }
170
171
  ],
171
- "approvedBy": "ana"
172
+ "approvedBy": "ana",
173
+ "settledAt": "2026-10-11T00:00:00.000Z"
172
174
  }
173
175
  ]
174
176
  },
@@ -305,7 +307,8 @@
305
307
  }
306
308
  ],
307
309
  "status": "applied",
308
- "approvedBy": "ana"
310
+ "approvedBy": "ana",
311
+ "settledAt": "2026-10-11T00:00:00.000Z"
309
312
  },
310
313
  {
311
314
  "wave": 2,
@@ -329,7 +332,8 @@
329
332
  "error": "a cannot plan"
330
333
  }
331
334
  ],
332
- "approvedBy": "ana"
335
+ "approvedBy": "ana",
336
+ "settledAt": "2026-10-11T00:00:00.000Z"
333
337
  }
334
338
  ],
335
339
  "components": [
@@ -137,7 +137,8 @@
137
137
  }
138
138
  ],
139
139
  "status": "applied",
140
- "approvedBy": "ana"
140
+ "approvedBy": "ana",
141
+ "settledAt": "2026-10-11T00:00:00.000Z"
141
142
  },
142
143
  {
143
144
  "wave": 2,
@@ -257,7 +258,8 @@
257
258
  }
258
259
  ],
259
260
  "status": "applied",
260
- "approvedBy": "ana"
261
+ "approvedBy": "ana",
262
+ "settledAt": "2026-10-11T00:00:00.000Z"
261
263
  },
262
264
  {
263
265
  "wave": 2,
@@ -0,0 +1,130 @@
1
+ /**
2
+ * The facts that start an agent job from outside a pull request (#5329).
3
+ *
4
+ * A production alert reaches `chant notify relay`, which checks it and
5
+ * writes one fact per alert under `_alerts/` on `chant/lifecycle`, signed
6
+ * with the relay key (`CHANT_RELAY_KEY`). The relay then starts the agent's
7
+ * workflow with no inputs, and the scheduled run of the same workflow picks
8
+ * up any fact a start missed. The agent job reads the facts itself, checks
9
+ * each signature with the same key, and starts one run for the oldest group
10
+ * of new facts. Nothing a caller passes to the workflow is read.
11
+ *
12
+ * The file is `_alerts/<trigger>.jsonl` at the repository's ledger root, one
13
+ * fact per line. A fact is trigger-neutral: `trigger` names what wrote it.
14
+ * A failed apply (#5357) writes `_alerts/apply-failed.jsonl` with the same
15
+ * key, and the same reading and joining apply. A scheduled run's fact is
16
+ * the run itself and is not written here (`./ci-agent-triggers.ts`).
17
+ *
18
+ * - A fact is recorded once. A second delivery with the same `key` (the
19
+ * source's own id) or the same `idempotencyKey` (the delivery's
20
+ * `Idempotency-Key` header) is a duplicate and is not appended.
21
+ * - Facts for the same member close together join one run: the run takes
22
+ * every new fact for its member received within the join window of the
23
+ * first, and a fact for that member received later inside the same window
24
+ * joins the run already made instead of starting another.
25
+ * - A run record carries the ids of the facts it took (`outcomes.agent.facts`)
26
+ * and its window, so the next read knows which facts are spent.
27
+ */
28
+ import type { OpRunRecord } from "./op/runtime.js";
29
+ /** The directory on `chant/lifecycle` the facts are kept under. */
30
+ export declare const AGENT_FACTS_DIR = "_alerts";
31
+ /** How long after a member's first fact a later one joins the same run, in minutes, unless the agent's `window` names another. */
32
+ export declare const AGENT_JOIN_WINDOW_MINUTES = 15;
33
+ /** How old a fact may be when the agent job reads it: older ones start nothing. */
34
+ export declare const AGENT_FACT_MAX_AGE_MS: number;
35
+ /** One fact that can start an agent run. */
36
+ export interface AgentFact {
37
+ v: 1;
38
+ /** `sha256:` of `trigger` and `key`. */
39
+ id: string;
40
+ /** What wrote it: `alert` or `apply-failed`; `schedule` for the fact a scheduled run makes of itself. */
41
+ trigger: string;
42
+ /** The workspace member it is for; "" for the repository. */
43
+ member: string;
44
+ /** The source's own id for what happened, such as `pagerduty:Q1ABC`. A second fact with the same key is a duplicate. */
45
+ key: string;
46
+ /** The delivery's `Idempotency-Key` header, when it had one. */
47
+ idempotencyKey?: string;
48
+ /** When the source says it happened. */
49
+ at: string;
50
+ /** When the fact was recorded. */
51
+ received: string;
52
+ /** The principal that recorded it, such as `<product>-relay`. */
53
+ by: string;
54
+ /** The trigger's own record, as data. */
55
+ data: Record<string, unknown>;
56
+ /** HMAC-SHA256 of the rest, hex, with the relay key. */
57
+ sig: string;
58
+ }
59
+ export type UnsignedAgentFact = Omit<AgentFact, "v" | "id" | "sig">;
60
+ /** The fact, its id minted and signed with the relay key. */
61
+ export declare function signAgentFact(relayKey: string, f: UnsignedAgentFact): AgentFact;
62
+ /** Whether the relay key signed `fact`, and its id is the one its trigger and key give. */
63
+ export declare function verifyAgentFact(relayKey: string | undefined, fact: AgentFact): boolean;
64
+ /** The file a trigger's facts are kept in under {@link AGENT_FACTS_DIR}. */
65
+ export declare function agentFactFile(trigger: string): string;
66
+ /** The facts in one file's text, oldest first. A line that is not a fact is skipped and counted. */
67
+ export declare function parseAgentFacts(content: string): {
68
+ facts: AgentFact[];
69
+ malformed: number;
70
+ };
71
+ /** A trigger's facts on the ledger, oldest first. */
72
+ export declare function readAgentFacts(trigger: string, opts?: {
73
+ cwd?: string;
74
+ }): Promise<AgentFact[]>;
75
+ /** Whether `f` is the same delivery as one of `seen`: the same key, or the same idempotency key. */
76
+ export declare function duplicateOf(f: Pick<AgentFact, "key" | "idempotencyKey">, seen: readonly Pick<AgentFact, "key" | "idempotencyKey">[]): boolean;
77
+ /**
78
+ * Append the facts that are not duplicates to their trigger's file, in one
79
+ * commit, with the ledger's compare-and-swap retry. Does not push: the
80
+ * caller pushes `chant/lifecycle` after, as every ledger here does.
81
+ */
82
+ export declare function recordAgentFacts(facts: readonly AgentFact[], opts?: {
83
+ cwd?: string;
84
+ }): Promise<{
85
+ recorded: AgentFact[];
86
+ duplicates: AgentFact[];
87
+ }>;
88
+ /** What a run record keeps of the facts it took, under `outcomes.agent`. */
89
+ export interface AgentFactRun {
90
+ facts?: string[];
91
+ member?: string;
92
+ /** The join window the run opened: facts for `member` received inside it are the run's. */
93
+ window?: {
94
+ from: string;
95
+ until: string;
96
+ };
97
+ }
98
+ /** The facts one run takes: one member's, the first and those received within the window after it. */
99
+ export interface AgentFactGroup {
100
+ member: string;
101
+ facts: AgentFact[];
102
+ window: {
103
+ from: string;
104
+ until: string;
105
+ };
106
+ }
107
+ /** What a run record says about facts, read defensively. */
108
+ export declare function factRunOf(record: Pick<OpRunRecord, "outcomes">): AgentFactRun;
109
+ /**
110
+ * The new facts, grouped into runs, oldest group first, and the facts set
111
+ * aside with why. A fact is set aside when the relay key did not sign it,
112
+ * when it is older than `maxAgeMs`, or when a run took it already or its
113
+ * member's window was open when it arrived (it joined that run).
114
+ */
115
+ export declare function pendingAgentFacts(o: {
116
+ facts: readonly AgentFact[];
117
+ runs: readonly Pick<OpRunRecord, "outcomes">[];
118
+ relayKey: string | undefined;
119
+ /** How a fact is checked, in place of the relay key's signature: a schedule's fact is the run's own (#5357). */
120
+ verify?: (f: AgentFact) => boolean;
121
+ now: Date;
122
+ windowMs: number;
123
+ maxAgeMs?: number;
124
+ }): {
125
+ groups: AgentFactGroup[];
126
+ setAside: Array<{
127
+ id: string;
128
+ reason: "unsigned" | "stale" | "taken" | "joined";
129
+ }>;
130
+ };
@@ -0,0 +1,196 @@
1
+ /**
2
+ * The facts that start an agent job from outside a pull request (#5329).
3
+ *
4
+ * A production alert reaches `chant notify relay`, which checks it and
5
+ * writes one fact per alert under `_alerts/` on `chant/lifecycle`, signed
6
+ * with the relay key (`CHANT_RELAY_KEY`). The relay then starts the agent's
7
+ * workflow with no inputs, and the scheduled run of the same workflow picks
8
+ * up any fact a start missed. The agent job reads the facts itself, checks
9
+ * each signature with the same key, and starts one run for the oldest group
10
+ * of new facts. Nothing a caller passes to the workflow is read.
11
+ *
12
+ * The file is `_alerts/<trigger>.jsonl` at the repository's ledger root, one
13
+ * fact per line. A fact is trigger-neutral: `trigger` names what wrote it.
14
+ * A failed apply (#5357) writes `_alerts/apply-failed.jsonl` with the same
15
+ * key, and the same reading and joining apply. A scheduled run's fact is
16
+ * the run itself and is not written here (`./ci-agent-triggers.ts`).
17
+ *
18
+ * - A fact is recorded once. A second delivery with the same `key` (the
19
+ * source's own id) or the same `idempotencyKey` (the delivery's
20
+ * `Idempotency-Key` header) is a duplicate and is not appended.
21
+ * - Facts for the same member close together join one run: the run takes
22
+ * every new fact for its member received within the join window of the
23
+ * first, and a fact for that member received later inside the same window
24
+ * joins the run already made instead of starting another.
25
+ * - A run record carries the ids of the facts it took (`outcomes.agent.facts`)
26
+ * and its window, so the next read knows which facts are spent.
27
+ */
28
+ import { createHash, createHmac, timingSafeEqual } from "node:crypto";
29
+ import { readBlobBySha, readBlobFromPath, readPathSha, RefCASConflictError, writeBlobToPath } from "./lifecycle/git.js";
30
+ import { sortedJsonReplacer } from "./sorted-json.js";
31
+ /** The directory on `chant/lifecycle` the facts are kept under. */
32
+ export const AGENT_FACTS_DIR = "_alerts";
33
+ /** How long after a member's first fact a later one joins the same run, in minutes, unless the agent's `window` names another. */
34
+ export const AGENT_JOIN_WINDOW_MINUTES = 15;
35
+ /** How old a fact may be when the agent job reads it: older ones start nothing. */
36
+ export const AGENT_FACT_MAX_AGE_MS = 24 * 60 * 60 * 1000;
37
+ /** The facts are read and written at the repository's ledger root, whichever member's directory the job stands in. */
38
+ const ROOT = { ledgerPrefix: "" };
39
+ const factId = (trigger, key) => `sha256:${createHash("sha256").update(`${trigger}\n${key}`).digest("hex")}`;
40
+ const factMac = (key, fact) => createHmac("sha256", key).update(`chant-agent-fact.${JSON.stringify(fact, sortedJsonReplacer)}`, "utf8").digest("hex");
41
+ /** The fact, its id minted and signed with the relay key. */
42
+ export function signAgentFact(relayKey, f) {
43
+ if (!relayKey)
44
+ throw new Error("an agent fact is signed with the relay key, and none was given");
45
+ const unsigned = { v: 1, id: factId(f.trigger, f.key), ...f };
46
+ return { ...unsigned, sig: factMac(relayKey, unsigned) };
47
+ }
48
+ /** Whether the relay key signed `fact`, and its id is the one its trigger and key give. */
49
+ export function verifyAgentFact(relayKey, fact) {
50
+ if (!relayKey || typeof fact.sig !== "string" || !/^[0-9a-f]{64}$/.test(fact.sig))
51
+ return false;
52
+ if (fact.id !== factId(fact.trigger, fact.key))
53
+ return false;
54
+ const { sig, ...rest } = fact;
55
+ const want = Buffer.from(factMac(relayKey, rest));
56
+ const got = Buffer.from(sig);
57
+ return want.length === got.length && timingSafeEqual(want, got);
58
+ }
59
+ /** The file a trigger's facts are kept in under {@link AGENT_FACTS_DIR}. */
60
+ export function agentFactFile(trigger) {
61
+ if (!/^[a-z][a-z0-9-]{0,39}$/.test(trigger))
62
+ throw new Error(`${JSON.stringify(trigger)} is not a trigger name`);
63
+ return `${trigger}.jsonl`;
64
+ }
65
+ const isString = (v) => typeof v === "string";
66
+ /** The facts in one file's text, oldest first. A line that is not a fact is skipped and counted. */
67
+ export function parseAgentFacts(content) {
68
+ const facts = [];
69
+ let malformed = 0;
70
+ for (const line of content.split("\n").map((l) => l.trim()).filter(Boolean)) {
71
+ try {
72
+ const f = JSON.parse(line);
73
+ if (f.v !== 1 || ![f.id, f.trigger, f.member, f.key, f.at, f.received, f.by, f.sig].every(isString) || typeof f.data !== "object" || f.data === null || (f.idempotencyKey !== undefined && !isString(f.idempotencyKey))) {
74
+ malformed++;
75
+ continue;
76
+ }
77
+ facts.push(f);
78
+ }
79
+ catch {
80
+ malformed++;
81
+ }
82
+ }
83
+ return { facts, malformed };
84
+ }
85
+ /** A trigger's facts on the ledger, oldest first. */
86
+ export async function readAgentFacts(trigger, opts = {}) {
87
+ const content = await readBlobFromPath(AGENT_FACTS_DIR, agentFactFile(trigger), { ...ROOT, ...opts });
88
+ return content ? parseAgentFacts(content).facts : [];
89
+ }
90
+ /** Whether `f` is the same delivery as one of `seen`: the same key, or the same idempotency key. */
91
+ export function duplicateOf(f, seen) {
92
+ return seen.some((s) => s.key === f.key || (f.idempotencyKey !== undefined && s.idempotencyKey === f.idempotencyKey));
93
+ }
94
+ /**
95
+ * Append the facts that are not duplicates to their trigger's file, in one
96
+ * commit, with the ledger's compare-and-swap retry. Does not push: the
97
+ * caller pushes `chant/lifecycle` after, as every ledger here does.
98
+ */
99
+ export async function recordAgentFacts(facts, opts = {}) {
100
+ const triggers = [...new Set(facts.map((f) => f.trigger))];
101
+ if (triggers.length > 1)
102
+ throw new Error("one call records the facts of one trigger");
103
+ if (facts.length === 0)
104
+ return { recorded: [], duplicates: [] };
105
+ const file = agentFactFile(triggers[0]);
106
+ const where = { ...ROOT, ...opts };
107
+ let lastErr;
108
+ for (let attempt = 1; attempt <= 5; attempt++) {
109
+ const priorSha = await readPathSha(AGENT_FACTS_DIR, file, where);
110
+ const existing = priorSha ? ((await readBlobBySha(priorSha, opts)) ?? "") : "";
111
+ const seen = parseAgentFacts(existing).facts;
112
+ const recorded = [];
113
+ const duplicates = [];
114
+ for (const f of facts) {
115
+ if (duplicateOf(f, seen))
116
+ duplicates.push(f);
117
+ else {
118
+ recorded.push(f);
119
+ seen.push(f);
120
+ }
121
+ }
122
+ if (recorded.length === 0)
123
+ return { recorded, duplicates };
124
+ const lines = recorded.map((f) => JSON.stringify(f, sortedJsonReplacer)).join("\n");
125
+ const content = `${existing ? `${existing.replace(/\n$/, "")}\n` : ""}${lines}\n`;
126
+ try {
127
+ await writeBlobToPath(AGENT_FACTS_DIR, file, content, `Agent facts: ${recorded.length} ${triggers[0]}`, { ...where, expectPriorPathSha: priorSha });
128
+ return { recorded, duplicates };
129
+ }
130
+ catch (err) {
131
+ if (!(err instanceof RefCASConflictError))
132
+ throw err;
133
+ lastErr = err;
134
+ }
135
+ }
136
+ throw lastErr;
137
+ }
138
+ /** What a run record says about facts, read defensively. */
139
+ export function factRunOf(record) {
140
+ const a = record.outcomes?.agent;
141
+ if (!a || typeof a !== "object")
142
+ return {};
143
+ const facts = Array.isArray(a.facts) ? a.facts.filter(isString) : undefined;
144
+ const w = a.window;
145
+ return {
146
+ ...(facts ? { facts } : {}),
147
+ ...(isString(a.member) ? { member: a.member } : {}),
148
+ ...(w && isString(w.from) && isString(w.until) ? { window: { from: w.from, until: w.until } } : {}),
149
+ };
150
+ }
151
+ /**
152
+ * The new facts, grouped into runs, oldest group first, and the facts set
153
+ * aside with why. A fact is set aside when the relay key did not sign it,
154
+ * when it is older than `maxAgeMs`, or when a run took it already or its
155
+ * member's window was open when it arrived (it joined that run).
156
+ */
157
+ export function pendingAgentFacts(o) {
158
+ const setAside = [];
159
+ const runs = o.runs.map(factRunOf);
160
+ const taken = new Set(runs.flatMap((r) => r.facts ?? []));
161
+ const windows = runs.filter((r) => r.window && r.member !== undefined).map((r) => ({ member: r.member, from: Date.parse(r.window.from), until: Date.parse(r.window.until) }));
162
+ const maxAge = o.maxAgeMs ?? AGENT_FACT_MAX_AGE_MS;
163
+ const now = o.now.getTime();
164
+ const fresh = [];
165
+ const seen = [];
166
+ for (const f of o.facts) {
167
+ if (!(o.verify ? o.verify(f) : verifyAgentFact(o.relayKey, f))) {
168
+ setAside.push({ id: f.id, reason: "unsigned" });
169
+ continue;
170
+ }
171
+ // A duplicate line that reached the file anyway is the same fact.
172
+ if (duplicateOf(f, seen))
173
+ continue;
174
+ seen.push(f);
175
+ const received = Date.parse(f.received);
176
+ if (taken.has(f.id))
177
+ setAside.push({ id: f.id, reason: "taken" });
178
+ else if (!Number.isFinite(received) || now - received > maxAge)
179
+ setAside.push({ id: f.id, reason: "stale" });
180
+ else if (windows.some((w) => w.member === f.member && received >= w.from && received <= w.until))
181
+ setAside.push({ id: f.id, reason: "joined" });
182
+ else
183
+ fresh.push(f);
184
+ }
185
+ fresh.sort((a, b) => Date.parse(a.received) - Date.parse(b.received));
186
+ const groups = [];
187
+ for (const f of fresh) {
188
+ const t = Date.parse(f.received);
189
+ const open = groups.find((g) => g.member === f.member && t <= Date.parse(g.window.until));
190
+ if (open)
191
+ open.facts.push(f);
192
+ else
193
+ groups.push({ member: f.member, facts: [f], window: { from: f.received, until: new Date(t + o.windowMs).toISOString() } });
194
+ }
195
+ return { groups, setAside };
196
+ }