@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
@@ -5,11 +5,26 @@
5
5
  * moved here, so terragucci and plywood generate the same jobs in their own
6
6
  * words.
7
7
  *
8
- * Two triggers. `comment`: `/<product> agent <ask>` on a pull request
8
+ * Six triggers. `comment`: `/<product> agent <ask>` on a pull request
9
9
  * (`parseProductComment`), answered with a commit pushed to the pull
10
10
  * request's branch. `drift`: a scheduled Op whose run exits with chant's
11
11
  * `drift` code, answered with a pull request from the agent's own branch,
12
- * opened the first time and updated after.
12
+ * opened the first time and updated after. `alert` (#5329): a production
13
+ * alert the relay recorded as a signed fact (`./agent-facts.ts`,
14
+ * `./ci-agent-alert.ts`), answered the way drift is, from a branch per
15
+ * member. `apply-failed` and `schedule` (#5357): a failed apply's fact and
16
+ * the agent's own cron, on the same intake as alerts
17
+ * (`./ci-agent-triggers.ts`), answered the same way. `verify-failed`
18
+ * (#5339): a failed verify step or a failing soak check, which chant
19
+ * records itself as a signed fact (`./ci-agent-verify-failed.ts`),
20
+ * answered the same way.
21
+ *
22
+ * Every trigger reads the agent's settings and caps from the default
23
+ * branch (#5357): the generated command lines carry a digest of the
24
+ * settings (`--digest`), the variables must match it, and the job's commit
25
+ * must be on the default branch ({@link checkAgentBase}). A pull request
26
+ * that changes the agent's workflow, or a pipeline variable that names
27
+ * another cap, does not change the agent that runs.
13
28
  *
14
29
  * Two jobs, so the model never shares a job with a token that can write:
15
30
  *
@@ -34,14 +49,31 @@
34
49
  */
35
50
  import { type CommentAllow, type CommentAllowReads } from "./ci-comment-allow.js";
36
51
  import { type CiProductWords } from "./ci-product-words.js";
52
+ import { type AgentFact } from "./agent-facts.js";
37
53
  import type { OpRunRecord, OpRunRecordInput } from "./op/runtime.js";
38
54
  import type { RunOrigin } from "./lifecycle/release-ledger.js";
39
55
  import type { PrForge } from "./pr-forge.js";
40
56
  /** The first chant with the agent job and the scheduled Op spec's `agent` and `runner` (#4616). Products feature-detect on it. */
41
57
  export declare const CI_AGENT_FLOOR = "0.124.55";
42
58
  /** What starts an agent run. */
43
- export type AgentTrigger = "comment" | "drift";
59
+ export type AgentTrigger = "comment" | "drift" | "alert" | "apply-failed" | "schedule" | "verify-failed";
44
60
  export declare const AGENT_TRIGGERS: readonly AgentTrigger[];
61
+ /** The triggers answered from a branch of the agent's own, with a pull request it opens and updates. */
62
+ export declare const AGENT_BRANCH_TRIGGERS: readonly AgentTrigger[];
63
+ /**
64
+ * The triggers on the facts intake (#5329, #5357, #5339): the agent is a workflow
65
+ * of its own, started by hand or by its schedule, and reads its facts
66
+ * itself; facts for one member close together join one run.
67
+ */
68
+ export declare const AGENT_FACT_TRIGGERS: readonly AgentTrigger[];
69
+ /** The fact triggers whose facts are read from the ledger and checked with the relay key. A schedule's fact is the run itself. */
70
+ export declare const AGENT_SIGNED_TRIGGERS: readonly AgentTrigger[];
71
+ /** Whether `on` reads facts: {@link AGENT_FACT_TRIGGERS}. */
72
+ export declare const isFactTrigger: (on: AgentTrigger) => boolean;
73
+ /** The variable the alert agent's jobs read the relay key from, to check the facts' signatures. */
74
+ export declare const AGENT_RELAY_KEY_ENV = "CHANT_RELAY_KEY";
75
+ /** How often the alert agent's workflow runs on its own, to pick up a fact whose start did not arrive. The failed-apply agent's schedule too. */
76
+ export declare const AGENT_ALERT_SCHEDULE = "*/15 * * * *";
45
77
  /**
46
78
  * The trigger a run record names (#4817): one of chant's {@link AgentTrigger}s,
47
79
  * or a product's own word for a model run it records on the same ledger, such
@@ -54,7 +86,14 @@ export type AgentRunTrigger = AgentTrigger | (string & {});
54
86
  * writes. With `on: "comment"` the spec is the agent's own workflow,
55
87
  * answering `comment` on a pull request, and its trigger is not read. With
56
88
  * `on: "drift"` the jobs follow the Op's own job and run when its run exits
57
- * with chant's `drift` code.
89
+ * with chant's `drift` code. With `on: "alert"` (#5329) the spec is the
90
+ * agent's own workflow, started by the relay after it records an alert and
91
+ * by its own schedule, and the jobs read the alert facts themselves. With
92
+ * `on: "apply-failed"` and `on: "schedule"` (#5357) the spec is the agent's
93
+ * own workflow too: started by hand and by its schedule, reading the
94
+ * failed applies' facts, or taking the scheduled run as its fact. With
95
+ * `on: "verify-failed"` (#5339) the same, reading the facts a failed verify
96
+ * step or a failing soak check recorded.
58
97
  */
59
98
  export interface OpAgentSpec {
60
99
  on: AgentTrigger;
@@ -82,8 +121,19 @@ export interface OpAgentSpec {
82
121
  tokenEnv?: string;
83
122
  /** Paths beyond chant's own that the agent may not change: a product's config files and directories (a trailing `/`). */
84
123
  guarded?: string[];
85
- /** The agent's branch, for `on: "drift"`. Default `<product>/agent/<name>`. */
124
+ /** The agent's branch, for every trigger but `comment`. Default `<product>/agent/<name>`; facts for a member add `-<member>`. */
86
125
  branch?: string;
126
+ /**
127
+ * For the fact triggers, `alert`, `apply-failed` and `schedule` (#5329,
128
+ * #5357): the minutes after a member's first fact in which later facts
129
+ * for that member join the same run. Default
130
+ * {@link AGENT_JOIN_WINDOW_MINUTES}.
131
+ */
132
+ window?: number;
133
+ /** For `on: "alert"` and `on: "apply-failed"`: the secret (GitHub, Forgejo) or variable (GitLab) holding the relay key the facts are signed with. Default `CHANT_RELAY_KEY`. */
134
+ relayKeyEnv?: string;
135
+ /** For `on: "schedule"` (#5357): what the agent does on each run, in the maintainers' words. Required there. */
136
+ task?: string;
87
137
  /** The ledger environment the runs are recorded under. Default `local`, the rule every Op follows (#4551 ruling A). */
88
138
  env?: string;
89
139
  /**
@@ -110,6 +160,12 @@ export interface AgentSettings {
110
160
  maxTurns: number;
111
161
  guarded: string[];
112
162
  branch?: string;
163
+ /** See {@link OpAgentSpec.window}: minutes, for the fact triggers. */
164
+ window?: number;
165
+ /** See {@link OpAgentSpec.relayKeyEnv}, for `alert` and `apply-failed`. */
166
+ relayKeyEnv?: string;
167
+ /** See {@link OpAgentSpec.task}, for `schedule`. */
168
+ task?: string;
113
169
  env: string;
114
170
  /** See {@link OpAgentSpec.commentAllow}. */
115
171
  commentAllow?: CommentAllow;
@@ -143,6 +199,8 @@ export declare const AGENT_ENV: {
143
199
  readonly maxTurns: "CHANT_AGENT_MAX_TURNS";
144
200
  readonly guarded: "CHANT_AGENT_GUARDED";
145
201
  readonly branch: "CHANT_AGENT_BRANCH";
202
+ readonly window: "CHANT_AGENT_WINDOW";
203
+ readonly task: "CHANT_AGENT_TASK";
146
204
  readonly env: "CHANT_AGENT_ENV";
147
205
  };
148
206
  /** GitLab starts no pipeline on a note: a pipeline of the target branch started with these runs the comment agent. */
@@ -189,8 +247,39 @@ export declare function resolveAgentSpec(name: string, spec: OpAgentSpec, produc
189
247
  export declare function agentSettingsEnv(s: AgentSettings): Record<string, string>;
190
248
  /** The settings back from the job's variables, checked as {@link resolveAgentSpec} checks a spec. */
191
249
  export declare function agentSettingsFromEnv(env: Record<string, string | undefined>, product?: string): AgentSettings;
250
+ /**
251
+ * The digest of an agent's settings as its jobs carry them: `sha256:` of
252
+ * {@link agentSettingsEnv}'s variables, keys sorted. The generator writes it
253
+ * on each command line (`--digest`), where a pipeline variable cannot
254
+ * replace it, and the command refuses variables that do not match it.
255
+ */
256
+ export declare function agentSettingsDigest(s: AgentSettings): string;
257
+ /** Undefined when the settings read from the variables are the ones the command line's digest names, else why not. */
258
+ export declare function agentDigestProblem(s: AgentSettings, digest: string | undefined): string | undefined;
259
+ /**
260
+ * The default branch: from the run's event on GitHub and Forgejo, else the
261
+ * `origin/HEAD` the generated checkout noted from the remote, else the
262
+ * remote itself.
263
+ */
264
+ export declare function agentDefaultBranch(git: AgentGit, env: Record<string, string | undefined>, event: unknown): string | undefined;
265
+ /**
266
+ * Whether the job runs on the default branch (#5357): its commit is the
267
+ * default branch's tip or an earlier commit of it, so the workflow file the
268
+ * job's settings came from is one the default branch held. A run on a pull
269
+ * request's branch, whose workflow the pull request could have changed, is
270
+ * refused.
271
+ */
272
+ export declare function checkAgentBase(git: AgentGit, env: Record<string, string | undefined>, event: unknown): {
273
+ ok: true;
274
+ branch: string;
275
+ } | {
276
+ ok: false;
277
+ reason: string;
278
+ };
192
279
  /** The paths an agent's change may not touch: chant's, and the product's `guarded` (a trailing `/` names a directory). Matched without regard to case. */
193
280
  export declare function agentForbiddenPaths(paths: readonly string[], guarded?: readonly string[]): string[];
281
+ /** The guarded paths as the prompt names them. */
282
+ export declare function guardedSentence(guarded: readonly string[]): string;
194
283
  /** The prompt for `/<product> agent <ask>`: the ask quoted as data, and the rules the push job enforces either way. */
195
284
  export declare function agentAskPrompt(o: {
196
285
  product: string;
@@ -239,6 +328,17 @@ export interface AgentDecision {
239
328
  branch?: string;
240
329
  user?: string;
241
330
  ask?: string;
331
+ /** For the fact triggers: no new fact, so nothing ran and nothing is recorded. */
332
+ idle?: boolean;
333
+ /** For the fact triggers: the ids of the facts the run took. */
334
+ facts?: string[];
335
+ /** For the fact triggers: the member the facts are for, "" for the repository. */
336
+ member?: string;
337
+ /** For the fact triggers: the join window the run opened. */
338
+ window?: {
339
+ from: string;
340
+ until: string;
341
+ };
242
342
  started: string;
243
343
  }
244
344
  export declare function readDecision(dir: string): AgentDecision | undefined;
@@ -305,6 +405,8 @@ export interface PrepareInput {
305
405
  teams?: CommentAllowReads;
306
406
  /** The agent's earlier run records on the ledger. */
307
407
  readRuns: () => Promise<OpRunRecord[]>;
408
+ /** For `on: "alert"` and `on: "apply-failed"`: the trigger's facts on the ledger. */
409
+ readFacts?: () => Promise<AgentFact[]>;
308
410
  git: AgentGit;
309
411
  now: Date;
310
412
  }
@@ -335,7 +437,7 @@ export declare function runAgent(i: RunInput): Promise<{
335
437
  changed: boolean;
336
438
  }>;
337
439
  /** How a run ended, as its record says. */
338
- export type AgentResult = "pushed" | "opened" | "updated" | "refused" | "stopped" | "failed";
440
+ export type AgentResult = "pushed" | "opened" | "updated" | "summarized" | "answered" | "refused" | "stopped" | "failed" | "idle";
339
441
  export interface LandOutcome {
340
442
  result: AgentResult;
341
443
  reason: string;
@@ -364,6 +466,8 @@ export interface LandInput {
364
466
  lease?: string;
365
467
  }) => void;
366
468
  readRuns: () => Promise<OpRunRecord[]>;
469
+ /** For `on: "alert"` and `on: "apply-failed"`: the trigger's facts on the ledger, which this job checks the decision's against. */
470
+ readFacts?: () => Promise<AgentFact[]>;
367
471
  /** Append the run's record to the ledger and push it. */
368
472
  record: (input: OpRunRecordInput) => Promise<void>;
369
473
  now: () => Date;
@@ -392,6 +496,29 @@ export declare function agentRunRecordInput(o: {
392
496
  usage?: AgentUsage;
393
497
  gitSha?: string;
394
498
  runOrigin?: RunOrigin;
499
+ /** For the fact triggers (#5329, #5357): the facts the run took, their member and window, and each alert's source and id. */
500
+ facts?: string[];
501
+ member?: string;
502
+ window?: {
503
+ from: string;
504
+ until: string;
505
+ };
506
+ alerts?: Array<{
507
+ source: string;
508
+ sourceId: string;
509
+ }>;
510
+ /** For `on: "apply-failed"` (#5357): the op and member of each failed apply the run answers. */
511
+ failures?: Array<{
512
+ op: string;
513
+ member: string;
514
+ }>;
515
+ /** For `on: "verify-failed"` (#5339): the stage, kind, check and member of each failed verify or soak the run answers. */
516
+ verifies?: Array<{
517
+ stage: string;
518
+ kind: "verify" | "soak";
519
+ check: string;
520
+ member: string;
521
+ }>;
395
522
  }): OpRunRecordInput;
396
523
  /**
397
524
  * `chant agent land`: from the agent job's patch to a pushed commit and a
@@ -401,12 +528,13 @@ export declare function agentRunRecordInput(o: {
401
528
  */
402
529
  export declare function landAgentChange(i: LandInput): Promise<LandOutcome>;
403
530
  /**
404
- * The three commands of the agent jobs, through the product's bin. `dir` is
531
+ * The three commands of the agent jobs, through the product's bin, with
532
+ * the settings' digest ({@link agentSettingsDigest}) when given. `dir` is
405
533
  * the agent directory from the job's directory, {@link AGENT_DIR} unless a
406
534
  * workspace member's drift Op left its output under the member's directory
407
535
  * (#4619): GitLab keeps the artifact at its path from the repository root.
408
536
  */
409
- export declare function agentCommandLines(forge: "github" | "gitlab" | "forgejo", bin?: string, dir?: string): {
537
+ export declare function agentCommandLines(forge: "github" | "gitlab" | "forgejo", bin?: string, dir?: string, digest?: string): {
410
538
  prepare: string;
411
539
  run: string;
412
540
  land: string;