@intentius/chant 0.122.0 → 0.124.0

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 (203) hide show
  1. package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
  2. package/dist/cli/commands/lint.d.ts.map +1 -1
  3. package/dist/cli/handlers/gate-resume.d.ts +1 -1
  4. package/dist/cli/handlers/gate-resume.d.ts.map +1 -1
  5. package/dist/cli/handlers/operator.d.ts +1 -1
  6. package/dist/cli/handlers/operator.d.ts.map +1 -1
  7. package/dist/cli/handlers/override-approve.d.ts +17 -0
  8. package/dist/cli/handlers/override-approve.d.ts.map +1 -0
  9. package/dist/cli/handlers/run-wave.d.ts.map +1 -1
  10. package/dist/cli/main.d.ts.map +1 -1
  11. package/dist/cli/registry.d.ts +4 -0
  12. package/dist/cli/registry.d.ts.map +1 -1
  13. package/dist/config-import.d.ts +1 -1
  14. package/dist/gate-decision.d.ts +157 -0
  15. package/dist/gate-decision.d.ts.map +1 -0
  16. package/dist/lifecycle/gate-applied.d.ts +75 -0
  17. package/dist/lifecycle/gate-applied.d.ts.map +1 -0
  18. package/dist/lifecycle/gate-audit.d.ts +145 -0
  19. package/dist/lifecycle/gate-audit.d.ts.map +1 -0
  20. package/dist/lifecycle/gate-ledger-select.d.ts +54 -0
  21. package/dist/lifecycle/gate-ledger-select.d.ts.map +1 -0
  22. package/dist/lifecycle/gate-ledger.d.ts +1 -45
  23. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  24. package/dist/lifecycle/override-ledger.d.ts +34 -0
  25. package/dist/lifecycle/override-ledger.d.ts.map +1 -0
  26. package/dist/lifecycle/rollback.d.ts.map +1 -1
  27. package/dist/lifecycle/work-item-id.d.ts +22 -0
  28. package/dist/lifecycle/work-item-id.d.ts.map +1 -0
  29. package/dist/lifecycle/work-lease.d.ts +2 -2
  30. package/dist/lifecycle/work-lease.d.ts.map +1 -1
  31. package/dist/lint/policy-import.d.ts +1 -1
  32. package/dist/lint/post-synth.d.ts +20 -1
  33. package/dist/lint/post-synth.d.ts.map +1 -1
  34. package/dist/notify-verify.d.ts +62 -0
  35. package/dist/notify-verify.d.ts.map +1 -0
  36. package/dist/notify-verify.js +76 -0
  37. package/dist/notify.d.ts +202 -0
  38. package/dist/notify.d.ts.map +1 -0
  39. package/dist/notify.js +307 -0
  40. package/dist/op/__fixtures__/decide-stub-backend.d.ts +1 -1
  41. package/dist/op/activities/activity-contracts.d.ts +4 -4
  42. package/dist/op/activities/gh-host.d.ts +37 -0
  43. package/dist/op/activities/gh-host.d.ts.map +1 -0
  44. package/dist/op/activities/lexicon-upgrade.d.ts +11 -0
  45. package/dist/op/activities/lexicon-upgrade.d.ts.map +1 -1
  46. package/dist/op/activities/propose-upgrade.d.ts.map +1 -1
  47. package/dist/op/activities/reconcile.d.ts +74 -76
  48. package/dist/op/activities/reconcile.d.ts.map +1 -1
  49. package/dist/op/gate-approval.d.ts +17 -1
  50. package/dist/op/gate-approval.d.ts.map +1 -1
  51. package/dist/op/gate-name.d.ts +8 -1
  52. package/dist/op/gate-name.d.ts.map +1 -1
  53. package/dist/op/gate-resume.d.ts +4 -2
  54. package/dist/op/gate-resume.d.ts.map +1 -1
  55. package/dist/op/gate-review.d.ts +2 -1
  56. package/dist/op/gate-review.d.ts.map +1 -1
  57. package/dist/op/gate.d.ts +43 -6
  58. package/dist/op/gate.d.ts.map +1 -1
  59. package/dist/op/index.d.ts +8 -6
  60. package/dist/op/index.d.ts.map +1 -1
  61. package/dist/op/op-waves-notify.d.ts +31 -0
  62. package/dist/op/op-waves-notify.d.ts.map +1 -0
  63. package/dist/op/op-waves-run.d.ts +218 -16
  64. package/dist/op/op-waves-run.d.ts.map +1 -1
  65. package/dist/op/op-waves.d.ts +113 -2
  66. package/dist/op/op-waves.d.ts.map +1 -1
  67. package/dist/op/operator.d.ts +15 -0
  68. package/dist/op/operator.d.ts.map +1 -1
  69. package/dist/op/work-lease-decl.d.ts.map +1 -1
  70. package/dist/op/work-lease-run.d.ts.map +1 -1
  71. package/dist/override-gate.d.ts +224 -0
  72. package/dist/override-gate.d.ts.map +1 -0
  73. package/dist/pr-forge.d.ts +225 -19
  74. package/dist/pr-forge.d.ts.map +1 -1
  75. package/dist/workspace/conformance/__fixtures__/reference-broker.d.ts +1 -1
  76. package/dist/workspace/conformance/broker.d.ts +1 -1
  77. package/dist/workspace/status-gates.d.ts +1 -0
  78. package/dist/workspace/status-gates.d.ts.map +1 -1
  79. package/dist/workspace/trust/gate-seal.d.ts +96 -0
  80. package/dist/workspace/trust/gate-seal.d.ts.map +1 -0
  81. package/dist/workspace/trust/policy.d.ts +2 -41
  82. package/dist/workspace/trust/policy.d.ts.map +1 -1
  83. package/dist/workspace/trust/seal.d.ts +2 -27
  84. package/dist/workspace/trust/seal.d.ts.map +1 -1
  85. package/dist/workspace/trust/trust-files.d.ts +57 -0
  86. package/dist/workspace/trust/trust-files.d.ts.map +1 -0
  87. package/dist/workspace/work-cli.d.ts.map +1 -1
  88. package/package.json +15 -2
  89. package/src/cli/commands/build.ts +1 -1
  90. package/src/cli/commands/check-lexicon.ts +3 -1
  91. package/src/cli/commands/lint-post-synth.e2e.test.ts +117 -0
  92. package/src/cli/commands/lint.test.ts +4 -109
  93. package/src/cli/commands/lint.ts +5 -2
  94. package/src/cli/discovery-skip.e2e.test.ts +18 -3
  95. package/src/cli/handlers/__snapshots__/build-member.test.ts.snap +2 -2
  96. package/src/cli/handlers/gate-resume.ts +3 -2
  97. package/src/cli/handlers/operator.test.ts +12 -1
  98. package/src/cli/handlers/operator.ts +25 -13
  99. package/src/cli/handlers/override-approve.test.ts +87 -0
  100. package/src/cli/handlers/override-approve.ts +103 -0
  101. package/src/cli/handlers/run-wave.ts +10 -2
  102. package/src/cli/main.test.ts +8 -0
  103. package/src/cli/main.ts +15 -0
  104. package/src/cli/registry.ts +4 -0
  105. package/src/config-import.ts +1 -1
  106. package/src/discovery/sandbox/run.test.ts +1 -1
  107. package/src/gate-decision-bundle.test.ts +56 -0
  108. package/src/gate-decision.test.ts +237 -0
  109. package/src/gate-decision.ts +321 -0
  110. package/src/lifecycle/gate-applied.ts +115 -0
  111. package/src/lifecycle/gate-audit-bundle.test.ts +47 -0
  112. package/src/lifecycle/gate-audit.test.ts +134 -0
  113. package/src/lifecycle/gate-audit.ts +438 -0
  114. package/src/lifecycle/gate-ledger-select.ts +113 -0
  115. package/src/lifecycle/gate-ledger.test.ts +22 -0
  116. package/src/lifecycle/gate-ledger.ts +9 -104
  117. package/src/lifecycle/override-ledger.test.ts +63 -0
  118. package/src/lifecycle/override-ledger.ts +69 -0
  119. package/src/lifecycle/rollback.ts +5 -1
  120. package/src/lifecycle/work-item-id.test.ts +71 -0
  121. package/src/lifecycle/work-item-id.ts +35 -0
  122. package/src/lifecycle/work-lease.ts +4 -5
  123. package/src/lint/policy-import.ts +1 -1
  124. package/src/lint/post-synth.test.ts +29 -0
  125. package/src/lint/post-synth.ts +21 -2
  126. package/src/notify-bundle.test.ts +50 -0
  127. package/src/notify-plain-node.e2e.test.ts +68 -0
  128. package/src/notify-verify.test.ts +59 -0
  129. package/src/notify-verify.ts +93 -0
  130. package/src/notify.schema.json +72 -0
  131. package/src/notify.test.ts +279 -0
  132. package/src/notify.ts +398 -0
  133. package/src/op/__fixtures__/decide-stub-backend.ts +1 -1
  134. package/src/op/activities/gh-host.test.ts +130 -0
  135. package/src/op/activities/gh-host.ts +79 -0
  136. package/src/op/activities/lexicon-upgrade.ts +22 -1
  137. package/src/op/activities/propose-upgrade.ts +5 -1
  138. package/src/op/activities/reconcile.test.ts +284 -280
  139. package/src/op/activities/reconcile.ts +128 -131
  140. package/src/op/gate-approval.test.ts +175 -7
  141. package/src/op/gate-approval.ts +27 -1
  142. package/src/op/gate-name.ts +10 -2
  143. package/src/op/gate-resume.ts +6 -3
  144. package/src/op/gate-review.ts +4 -7
  145. package/src/op/gate.ts +117 -16
  146. package/src/op/index.ts +36 -5
  147. package/src/op/op-waves-notify.test.ts +127 -0
  148. package/src/op/op-waves-notify.ts +101 -0
  149. package/src/op/op-waves-run.ts +908 -123
  150. package/src/op/op-waves.test.ts +543 -3
  151. package/src/op/op-waves.ts +215 -6
  152. package/src/op/operator.test.ts +29 -0
  153. package/src/op/operator.ts +27 -2
  154. package/src/op/run-context.test.ts +2 -2
  155. package/src/op/work-lease-decl.ts +4 -4
  156. package/src/op/work-lease-run.test.ts +5 -0
  157. package/src/op/work-lease-run.ts +4 -3
  158. package/src/override-gate-bundle.test.ts +47 -0
  159. package/src/override-gate.test.ts +239 -0
  160. package/src/override-gate.ts +395 -0
  161. package/src/pr-forge-bundle.test.ts +40 -0
  162. package/src/pr-forge.test.ts +378 -0
  163. package/src/pr-forge.ts +546 -47
  164. package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +1 -1
  165. package/src/workspace/conformance/__fixtures__/reference-broker.ts +1 -1
  166. package/src/workspace/conformance/broker.ts +1 -1
  167. package/src/workspace/records-write-contract.test.ts +3 -2
  168. package/src/workspace/records-write.e2e.test.ts +1 -1
  169. package/src/workspace/status-gates.ts +7 -4
  170. package/src/workspace/trust/gate-seal.test.ts +156 -0
  171. package/src/workspace/trust/gate-seal.ts +254 -0
  172. package/src/workspace/trust/policy.ts +10 -165
  173. package/src/workspace/trust/seal.ts +19 -34
  174. package/src/workspace/trust/trust-files.test.ts +50 -0
  175. package/src/workspace/trust/trust-files.ts +245 -0
  176. package/src/workspace/work-cli.ts +5 -3
  177. package/src/workspace/work-history.test.ts +7 -0
  178. /package/src/audit/{catalog.test.ts → catalog.e2e.test.ts} +0 -0
  179. /package/src/audit/{discover.test.ts → discover.e2e.test.ts} +0 -0
  180. /package/src/audit/{remote-discovery.test.ts → remote-discovery.e2e.test.ts} +0 -0
  181. /package/src/audit/{rules-doc.test.ts → rules-doc.e2e.test.ts} +0 -0
  182. /package/src/{bench.test.ts → bench.e2e.test.ts} +0 -0
  183. /package/src/cli/commands/{check-lexicon-doc-drift.test.ts → check-lexicon-doc-drift.e2e.test.ts} +0 -0
  184. /package/src/cli/commands/{import.test.ts → import.e2e.test.ts} +0 -0
  185. /package/src/cli/{component-security-boundary.test.ts → component-security-boundary.e2e.test.ts} +0 -0
  186. /package/src/cli/mcp/{workspace-tools.test.ts → workspace-tools.e2e.test.ts} +0 -0
  187. /package/src/cli/{security-boundary.test.ts → security-boundary.e2e.test.ts} +0 -0
  188. /package/src/cli/{serve-mcp-workspace.test.ts → serve-mcp-workspace.e2e.test.ts} +0 -0
  189. /package/src/cli/{static-config-read.test.ts → static-config-read.e2e.test.ts} +0 -0
  190. /package/src/codegen/{json-schema-to-ts.test.ts → json-schema-to-ts.e2e.test.ts} +0 -0
  191. /package/src/{lexicon-seams.test.ts → lexicon-seams.e2e.test.ts} +0 -0
  192. /package/src/meta/{declared-imports.test.ts → declared-imports.e2e.test.ts} +0 -0
  193. /package/src/op/{command-gate.test.ts → command-gate.e2e.test.ts} +0 -0
  194. /package/src/op/{steward-beside.test.ts → steward-beside.e2e.test.ts} +0 -0
  195. /package/src/op/{steward-points.test.ts → steward-points.e2e.test.ts} +0 -0
  196. /package/src/workspace/{checks.test.ts → checks.e2e.test.ts} +0 -0
  197. /package/src/workspace/{intent-reviews.test.ts → intent-reviews.e2e.test.ts} +0 -0
  198. /package/src/workspace/{profiles.test.ts → profiles.e2e.test.ts} +0 -0
  199. /package/src/workspace/{read-contract.test.ts → read-contract.e2e.test.ts} +0 -0
  200. /package/src/workspace/{records-contract.test.ts → records-contract.e2e.test.ts} +0 -0
  201. /package/src/workspace/{records-since.test.ts → records-since.e2e.test.ts} +0 -0
  202. /package/src/workspace/{records-write.test.ts → records-write-commands.e2e.test.ts} +0 -0
  203. /package/src/workspace/{work-size.test.ts → work-size.e2e.test.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate-ledger-select.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE7E,oEAAoE;AACpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvF;AAED,mMAAmM;AACnM,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,IAAI,EAAE,MAAM,GACX,iBAAiB,GAAG,SAAS,CAO/B;AAED,uOAAuO;AACvO,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,EAAE,EAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,oBAAoB,GAAG,SAAS,CASlC;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,qFAAqF;IACrF,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,oBAAoB,EAAE,EAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,mBAAmB,CAuBrB"}
@@ -1,6 +1,7 @@
1
1
  import { type GateOrigin } from "./gate-origin.js";
2
2
  import type { GateApprover, GatePolicyDecision, ResolvedGateApproval } from "../op/gate-approval.js";
3
3
  import type { GateRunLocator } from "../op/gate-resume.js";
4
+ export { isPendingGateExpired, latestPendingGate, latestResolutionForPlan, latestResolutionSince, type PlanBoundResolution, } from "./gate-ledger-select.js";
4
5
  /** The directory on the `chant/lifecycle` branch that holds gate ledgers, under a member's prefix when it has one. */
5
6
  export declare const GATES_DIR = "_gates";
6
7
  /**
@@ -260,8 +261,6 @@ export type PendingGateInput = Omit<PendingGateRecord, "version" | "kind">;
260
261
  export type GateLedgerRecord = GateResolutionRecord | PendingGateRecord;
261
262
  /** The default a gate's pending fact expires after when its `GateStep` declares no `timeout` — the same 48h `GateStep.timeout` documents as its own default. */
262
263
  export declare const DEFAULT_GATE_EXPIRY = "48h";
263
- /** Whether a pending fact has aged out of relevance at `nowIso`. */
264
- export declare function isPendingGateExpired(record: PendingGateRecord, nowIso: string): boolean;
265
264
  /**
266
265
  * Where an Op's gate ledger lives, as a path a human can go and read:
267
266
  * `_gates/<op>.jsonl` on the `chant/lifecycle` orphan branch. Exported so a
@@ -320,47 +319,4 @@ export declare function readGateResolutions(op: string, opts?: {
320
319
  records: GateResolutionRecord[];
321
320
  malformed: number;
322
321
  }>;
323
- /** The most recent pending fact for `gate`, expired or not — the anchor {@link latestResolutionSince} measures a resolution against. `undefined` when the gate has never been recorded pending. */
324
- export declare function latestPendingGate(records: PendingGateRecord[], gate: string): PendingGateRecord | undefined;
325
- /** The most recent resolution for `gate` recorded after `sinceIso` (a gated tick's own timestamp) — what `chant operator status` uses to tell a resolved gate from a still-pending one. `undefined` when no such resolution exists. */
326
- export declare function latestResolutionSince(records: GateResolutionRecord[], gate: string, sinceIso: string): GateResolutionRecord | undefined;
327
- /** What {@link latestResolutionForPlan} found for the plan a run is holding. */
328
- export interface PlanBoundResolution {
329
- /** The resolution that answers this gate for this plan. Absent when nothing does. */
330
- resolution?: GateResolutionRecord;
331
- /**
332
- * Present instead of {@link PlanBoundResolution.resolution} when a
333
- * resolution stands for this gate but for a different plan — the newest
334
- * such record, so a refusal can name who approved what and when. Its
335
- * `planDigest` is `undefined` for a record written before #2300.
336
- */
337
- mismatched?: GateResolutionRecord;
338
- }
339
- /**
340
- * The resolution that answers `gate` for the plan `planDigest` identifies
341
- * (#2300).
342
- *
343
- * The criterion is the digest; recency is only the tiebreak between several
344
- * resolutions that all match it. That inversion is the whole point of the
345
- * issue: {@link latestResolutionSince} asks "is there a newer approval",
346
- * which a run answers yes to no matter what has changed since, and this asks
347
- * "is there an approval of *this*".
348
- *
349
- * - `planDigest` `undefined` — the gate binds no plan (an Op `gate` step
350
- * authored with no `plan`). Falls straight through to
351
- * {@link latestResolutionSince}: gates that never claimed to bind a plan
352
- * behave exactly as they did before #2300.
353
- * - A resolution whose `planDigest` equals `planDigest` answers the gate.
354
- * - A resolution for a different plan does not, and comes back as
355
- * `mismatched` so the caller can name both digests.
356
- * - A resolution with no `planDigest` at all — every record written before
357
- * #2300 — does not either, and comes back as `mismatched` with an absent
358
- * `planDigest`. This is the safe reading of the migration: such a record
359
- * proves someone approved something, and nothing about what. Accepting it
360
- * once would silently apply the very change this check exists to catch, on
361
- * exactly the estates that have been running longest. The cost is one
362
- * further `chant approve` per gate after the upgrade, which the refusal
363
- * says out loud.
364
- */
365
- export declare function latestResolutionForPlan(records: GateResolutionRecord[], gate: string, sinceIso: string, planDigest: string | undefined): PlanBoundResolution;
366
322
  //# sourceMappingURL=gate-ledger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gate-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger.ts"],"names":[],"mappings":"AA8CA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD,sHAAsH;AACtH,eAAO,MAAM,SAAS,WAAM,CAAC;AAG7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAY3F;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE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E,MAAM,GACd;IAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAmD1F;AAED,oNAAoN;AACpN,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAGjE"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The override gate's lines on `chant/lifecycle` (#3760): read the denials,
3
+ * overrides and applied records, record a denial, and record that a run
4
+ * applied under an override, which spends it. The decision is
5
+ * `../override-gate.ts`'s, which bundles without this module's git code.
6
+ *
7
+ * Denials and overrides share `_gates/policy-override.jsonl` with the
8
+ * ordinary gate line shapes, so `chant approve`, `chant operator status` and
9
+ * the audit reader read them as they read any gate. Applied records live in
10
+ * `_gates/policy-override/applied.jsonl`, which no gate reader lists.
11
+ */
12
+ import { type GateResolutionRecord, type PendingGateRecord } from "./gate-ledger.js";
13
+ import { type AppliedOverrideRecord, type OverridePendingInput, type OverridePendingRecord } from "../override-gate.js";
14
+ export interface OverrideLedger {
15
+ resolutions: GateResolutionRecord[];
16
+ pending: PendingGateRecord[];
17
+ applied: AppliedOverrideRecord[];
18
+ }
19
+ /** The override ledger and its applied records, oldest first. Empty when nothing is recorded. */
20
+ export declare function readOverrideLedger(opts?: {
21
+ cwd?: string;
22
+ }): Promise<OverrideLedger>;
23
+ /** Append a denial's pending fact ({@link overridePending}). Does not push. */
24
+ export declare function recordOverrideDenial(input: OverridePendingInput, opts?: {
25
+ cwd?: string;
26
+ }): Promise<{
27
+ commit: string;
28
+ record: OverridePendingRecord;
29
+ }>;
30
+ /** Append applied records, spending the overrides they name. Write them before applying; a write that fails should stop the run. Does not push. */
31
+ export declare function recordOverridesApplied(records: readonly AppliedOverrideRecord[], opts?: {
32
+ cwd?: string;
33
+ }): Promise<string | undefined>;
34
+ //# sourceMappingURL=override-ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"override-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/override-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAqC,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAErH,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,OAAO,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAED,iGAAiG;AACjG,wBAAsB,kBAAkB,CAAC,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAIzF;AAED,+EAA+E;AAC/E,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAC,CAI3J;AAED,mJAAmJ;AACnJ,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,EAAE,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmB5I"}
@@ -1 +1 @@
1
- {"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/lifecycle/rollback.ts"],"names":[],"mappings":"AAiBA,2CAA2C;AA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E,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAO5F;AAED,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,cAAc,CAAC,CAqD1B"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * What a work item id has to be to key a work lease (#2815). The id lands in
3
+ * refs (`refs/chant/lease/work/<id>`, `refs/chant/kept/.../<item>/<token>`,
4
+ * the work branch `chant/work/.../<id>`) and in a file name
5
+ * (`_leases/<id>.jsonl`), so it has to be a valid ref path segment under
6
+ * `git check-ref-format`, and git's check is stricter than a character class.
7
+ *
8
+ * Kept free of imports so `Op()`, `declareSteward` and the CLI can all call it
9
+ * without loading the lease machinery.
10
+ */
11
+ /** The characters an id may use: letters, digits, ".", "_" and "-", starting with a letter or digit, at most 100. */
12
+ export declare const WORK_ITEM_ID_PATTERN: RegExp;
13
+ /**
14
+ * Why `id` can't key a work lease, or `undefined` when it can. On top of
15
+ * {@link WORK_ITEM_ID_PATTERN}, git refuses a ref component that has `..`,
16
+ * ends in `.`, or ends in `.lock` (git's own lock file for the ref; matched
17
+ * case-insensitively here since a case-folding filesystem would collide).
18
+ */
19
+ export declare function workItemIdProblem(id: unknown): string | undefined;
20
+ /** Whether `id` can key a work lease. */
21
+ export declare function isWorkItemId(id: unknown): id is string;
22
+ //# sourceMappingURL=work-item-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-item-id.d.ts","sourceRoot":"","sources":["../../src/lifecycle/work-item-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,qHAAqH;AACrH,eAAO,MAAM,oBAAoB,QAAsC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CASjE;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,MAAM,CAEtD"}
@@ -1,11 +1,11 @@
1
+ import { WORK_ITEM_ID_PATTERN, isWorkItemId, workItemIdProblem } from "./work-item-id.js";
1
2
  /** The key prefix of a work lease under the operator lease's ref namespace. */
2
3
  export declare const WORK_LEASE_KEY_PREFIX = "work/";
3
4
  /** The directory on `chant/lifecycle` that holds lease histories, under a member's prefix when it has one. */
4
5
  export declare const LEASES_DIR = "_leases";
5
6
  /** How long a claim lasts unless renewed: chud's default, which its dispatcher renews at a third of. */
6
7
  export declare const DEFAULT_WORK_LEASE_TTL_MS: number;
7
- /** A work item id a lease can be keyed by: one ref path segment and one file name. */
8
- export declare const WORK_ITEM_ID_PATTERN: RegExp;
8
+ export { WORK_ITEM_ID_PATTERN, isWorkItemId, workItemIdProblem };
9
9
  /** The lease key of work item `id`. */
10
10
  export declare function workLeaseKey(id: string): string;
11
11
  /** The lease ref of work item `id` in the ledger with `memberPrefix`. */
@@ -1 +1 @@
1
- {"version":3,"file":"work-lease.d.ts","sourceRoot":"","sources":["../../src/lifecycle/work-lease.ts"],"names":[],"mappings":"AAqDA,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAE7C,8GAA8G;AAC9G,eAAO,MAAM,UAAU,YAAY,CAAC;AAEpC,wGAAwG;AACxG,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD,sFAAsF;AACtF,eAAO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eAAe,CAAC,CAY1B;AAuBD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,gBAAgB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E,OAAO,CAAC,eAAe,CAAC,CAqC1B;AAmCD,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAiBvG;AAED,8GAA8G;AAC9G,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAIvI;AAaD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAyBvH;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAa,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CASxH"}
@@ -7,7 +7,7 @@
7
7
  * `importConfigModule` (`chant.config.ts`): one narrow module whose only job is
8
8
  * "execute project-authored code here", so that "did any project code run in
9
9
  * this process?" has one place to look and one place to instrument — see
10
- * `examples/sandbox-execution-boundary.test.ts`, which spies on all three.
10
+ * `examples/sandbox-execution-boundary.e2e.test.ts`, which spies on all three.
11
11
  *
12
12
  * Before chant #1131 `./policy.ts` called `await import(resolved)` inline,
13
13
  * which is why the corpus boundary gate could not see it even after #1113 put
@@ -61,6 +61,21 @@ export interface PostSynthContext {
61
61
  * hand-built context. OTEL118 runs only when it is set.
62
62
  */
63
63
  readonly telemetry?: TelemetryAttribution;
64
+ /**
65
+ * The directory of the project config the build loaded (#3751): where a
66
+ * relative `sourceDir` resolves, and so where a check looks for a file the
67
+ * project keeps beside its source (the sql lexicon's `sql-types.d.ts`).
68
+ * Set by `chant build` and `chant lint`; absent from a hand-built context,
69
+ * where a check that reads the disk stays silent.
70
+ */
71
+ readonly projectDir?: string;
72
+ /**
73
+ * The project config the build loaded (#3751), as source lint rules get it
74
+ * in `LintContext.projectConfig`. A check that renders output again, as the
75
+ * sql lexicon's does for `sql-types.d.ts`, needs the settings the build ran
76
+ * with. Absent from a hand-built context.
77
+ */
78
+ readonly projectConfig?: Record<string, unknown>;
64
79
  /** Raw build result object */
65
80
  buildResult: {
66
81
  outputs: Map<string, string | SerializerResult>;
@@ -189,10 +204,14 @@ export declare function isPostSynthCheck(value: unknown): value is PostSynthChec
189
204
  * into the context so a check can branch on the current environment/stack, and
190
205
  * `opts.activityContracts` (chant #2101) carries the build's cross-lexicon
191
206
  * activity-contract map to the checks that validate Op steps against it.
192
- * `opts.telemetry` is the build's resolved telemetry attribution.
207
+ * `opts.telemetry` is the build's resolved telemetry attribution, and
208
+ * `opts.projectDir` and `opts.projectConfig` the config the build loaded and
209
+ * its directory.
193
210
  */
194
211
  export declare function runPostSynthChecks(checks: PostSynthCheck[], buildResult: PostSynthContext["buildResult"], env?: string, opts?: {
195
212
  activityContracts?: ReadonlyMap<string, ActivityContract>;
196
213
  telemetry?: TelemetryAttribution;
214
+ projectDir?: string;
215
+ projectConfig?: Record<string, unknown>;
197
216
  }): PostSynthDiagnostic[];
198
217
  //# sourceMappingURL=post-synth.d.ts.map
@@ -1 +1 @@
1
- {"version":3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AQ,EAAE,QAAQ,CAAC;IACnB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE;QACR,kEAAkE;QAClE,IAAI,EAAE,MAAM,CAAC;QACb,0DAA0D;QAC1D,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,KAAK,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IACpD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAQxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EAAE,EACxB,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAC5C,GAAG,CAAC,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACnK,mBAAmB,EAAE,CAqBvB"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Signing and checking a notify event (#3761). This module needs only
3
+ * `node:crypto`, so a receiver can import it alone and bundle nothing else:
4
+ *
5
+ * ```ts
6
+ * import { verifyWebhook } from "@intentius/chant/notify-verify";
7
+ *
8
+ * const checked = verifyWebhook({ body, headers: req.headers, key: process.env.CHANT_WEBHOOK_KEY });
9
+ * if (!checked.ok) return reply(401, checked.reason);
10
+ * handle(checked.event);
11
+ * ```
12
+ *
13
+ * The signature is HMAC-SHA256, keyed with the shared secret, over
14
+ * `<timestamp>.<body>`: the timestamp header (seconds since the epoch), a
15
+ * dot, and the request body exactly as sent. It travels as
16
+ * `x-chant-signature: sha256=<hex>`. Signing the timestamp with the body lets
17
+ * a receiver refuse a delivery replayed later; {@link verifyWebhook} refuses
18
+ * one more than five minutes from now by default. This is SQL Yodeler's
19
+ * scheme (#3756), with the header prefix a product can keep as its own.
20
+ */
21
+ /** The header names' default prefix. A product passes its own (`x-yodel`, `x-terragucci`) to keep its receivers working. */
22
+ export declare const DEFAULT_HEADER_PREFIX = "x-chant";
23
+ /** The four headers a delivery carries, under `prefix`. */
24
+ export declare function webhookHeaderNames(prefix?: string): {
25
+ signature: string;
26
+ timestamp: string;
27
+ event: string;
28
+ delivery: string;
29
+ };
30
+ /** How far from now a delivery's timestamp {@link verifyWebhook} still accepts, in seconds. */
31
+ export declare const DEFAULT_TOLERANCE_SECONDS = 300;
32
+ /** `sha256=<hex>` of `<timestamp>.<body>`, keyed with `key`. */
33
+ export declare function signWebhook(key: string, timestamp: number | string, body: string): string;
34
+ export type WebhookHeaders = Record<string, string | readonly string[] | undefined> | Headers;
35
+ export interface VerifyWebhookInput {
36
+ /** The request body exactly as received, before any JSON parsing. */
37
+ body: string | Uint8Array;
38
+ /** The request's headers; names match without regard to case. */
39
+ headers: WebhookHeaders;
40
+ /** The shared secret. An empty or missing key never verifies. */
41
+ key: string | undefined;
42
+ /** Now, in seconds since the epoch. Default: the clock. */
43
+ now?: number;
44
+ /** How far from now the timestamp may be, in seconds. Default {@link DEFAULT_TOLERANCE_SECONDS}. */
45
+ toleranceSeconds?: number;
46
+ /** The header names' prefix the sender used. Default {@link DEFAULT_HEADER_PREFIX}. */
47
+ prefix?: string;
48
+ }
49
+ export type VerifyWebhookResult = {
50
+ ok: true;
51
+ event: unknown;
52
+ } | {
53
+ ok: false;
54
+ reason: string;
55
+ };
56
+ /**
57
+ * Whether a delivery was signed with `key` and is recent: the signature
58
+ * header matches (compared in constant time) and the timestamp is within the
59
+ * tolerance either side of now. On success, the parsed event.
60
+ */
61
+ export declare function verifyWebhook(input: VerifyWebhookInput): VerifyWebhookResult;
62
+ //# sourceMappingURL=notify-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify-verify.d.ts","sourceRoot":"","sources":["../src/notify-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,4HAA4H;AAC5H,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,MAA8B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAGpJ;AAED,+FAA+F;AAC/F,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzF;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC;AAE9F,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,iEAAiE;IACjE,OAAO,EAAE,cAAc,CAAC;IACxB,iEAAiE;IACjE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oGAAoG;IACpG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAW/F;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,CAmB5E"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Signing and checking a notify event (#3761). This module needs only
3
+ * `node:crypto`, so a receiver can import it alone and bundle nothing else:
4
+ *
5
+ * ```ts
6
+ * import { verifyWebhook } from "@intentius/chant/notify-verify";
7
+ *
8
+ * const checked = verifyWebhook({ body, headers: req.headers, key: process.env.CHANT_WEBHOOK_KEY });
9
+ * if (!checked.ok) return reply(401, checked.reason);
10
+ * handle(checked.event);
11
+ * ```
12
+ *
13
+ * The signature is HMAC-SHA256, keyed with the shared secret, over
14
+ * `<timestamp>.<body>`: the timestamp header (seconds since the epoch), a
15
+ * dot, and the request body exactly as sent. It travels as
16
+ * `x-chant-signature: sha256=<hex>`. Signing the timestamp with the body lets
17
+ * a receiver refuse a delivery replayed later; {@link verifyWebhook} refuses
18
+ * one more than five minutes from now by default. This is SQL Yodeler's
19
+ * scheme (#3756), with the header prefix a product can keep as its own.
20
+ */
21
+ import { createHmac, timingSafeEqual } from "node:crypto";
22
+ /** The header names' default prefix. A product passes its own (`x-yodel`, `x-terragucci`) to keep its receivers working. */
23
+ export const DEFAULT_HEADER_PREFIX = "x-chant";
24
+ /** The four headers a delivery carries, under `prefix`. */
25
+ export function webhookHeaderNames(prefix = DEFAULT_HEADER_PREFIX) {
26
+ const p = prefix.toLowerCase();
27
+ return { signature: `${p}-signature`, timestamp: `${p}-timestamp`, event: `${p}-event`, delivery: `${p}-delivery` };
28
+ }
29
+ /** How far from now a delivery's timestamp {@link verifyWebhook} still accepts, in seconds. */
30
+ export const DEFAULT_TOLERANCE_SECONDS = 300;
31
+ /** `sha256=<hex>` of `<timestamp>.<body>`, keyed with `key`. */
32
+ export function signWebhook(key, timestamp, body) {
33
+ return `sha256=${createHmac("sha256", key).update(`${String(timestamp)}.${body}`, "utf8").digest("hex")}`;
34
+ }
35
+ function header(headers, name) {
36
+ if (typeof headers.get === "function")
37
+ return headers.get(name) ?? undefined;
38
+ for (const [k, v] of Object.entries(headers)) {
39
+ if (k.toLowerCase() !== name)
40
+ continue;
41
+ return Array.isArray(v) ? v[0] : v;
42
+ }
43
+ return undefined;
44
+ }
45
+ /**
46
+ * Whether a delivery was signed with `key` and is recent: the signature
47
+ * header matches (compared in constant time) and the timestamp is within the
48
+ * tolerance either side of now. On success, the parsed event.
49
+ */
50
+ export function verifyWebhook(input) {
51
+ if (!input.key)
52
+ return { ok: false, reason: "no key to verify with" };
53
+ const names = webhookHeaderNames(input.prefix);
54
+ const body = typeof input.body === "string" ? input.body : Buffer.from(input.body).toString("utf8");
55
+ const signature = header(input.headers, names.signature);
56
+ const timestamp = header(input.headers, names.timestamp);
57
+ if (!signature)
58
+ return { ok: false, reason: `no ${names.signature} header` };
59
+ if (!timestamp || !/^\d+$/.test(timestamp))
60
+ return { ok: false, reason: `no ${names.timestamp} header, or not a number of seconds` };
61
+ const expected = Buffer.from(signWebhook(input.key, timestamp, body));
62
+ const given = Buffer.from(signature);
63
+ if (given.length !== expected.length || !timingSafeEqual(given, expected))
64
+ return { ok: false, reason: "the signature does not match" };
65
+ const now = input.now ?? Math.floor(Date.now() / 1000);
66
+ const tolerance = input.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;
67
+ if (Math.abs(now - Number(timestamp)) > tolerance)
68
+ return { ok: false, reason: `the timestamp is more than ${String(tolerance)}s from now` };
69
+ try {
70
+ return { ok: true, event: JSON.parse(body) };
71
+ }
72
+ catch {
73
+ return { ok: false, reason: "the body is not JSON" };
74
+ }
75
+ }
76
+ //# sourceMappingURL=notify-verify.js.map
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Notify (#3761): tell people that a wave waits for an approval, that a run
3
+ * was refused or failed, or that drift was found.
4
+ *
5
+ * terragucci and SQL Yodeler each carried a copy of this (#3756). chant owns
6
+ * the event, its signing and the Slack and Teams posting; a product decides
7
+ * when to send and what its summary says. One event shape,
8
+ * `chant.notify/v1` (`./notify.schema.json`), carries what both send: the
9
+ * wave or environment, the targets concerned, the plan digest, the command
10
+ * that approves it and the run's link.
11
+ *
12
+ * ```ts
13
+ * import { makeNotifyEvent, sendNotify } from "@intentius/chant/notify";
14
+ *
15
+ * const event = makeNotifyEvent({ source: "sql-yodeler", event: "waiting", summary: "prod waits for an approval", targets: ["0007_add_index"], digest, approve: { command } });
16
+ * await sendNotify({ webhook: "YODEL_WEBHOOK_URL", key: "YODEL_WEBHOOK_KEY", slack: "SLACK_WEBHOOK_URL" }, event);
17
+ * ```
18
+ *
19
+ * The configuration names environment variables, never URLs or keys, and
20
+ * nothing here prints a URL or a key. The generic webhook gets the event as
21
+ * JSON, signed over `<timestamp>.<body>` (`./notify-verify.ts`); it is never
22
+ * posted unsigned. Slack and Teams incoming webhooks get a message rendered
23
+ * from the event, unsigned, since neither checks a signature. A delivery that
24
+ * fails is logged and returned; {@link sendNotify} never throws, so a
25
+ * caller's exit code never depends on it.
26
+ *
27
+ * Bundle-safe: this module reaches only `node:crypto` and
28
+ * `./notify-verify.ts` (`./notify-bundle.test.ts`).
29
+ */
30
+ export { DEFAULT_HEADER_PREFIX, DEFAULT_TOLERANCE_SECONDS, signWebhook, verifyWebhook, webhookHeaderNames } from "./notify-verify.js";
31
+ export type { VerifyWebhookInput, VerifyWebhookResult, WebhookHeaders } from "./notify-verify.js";
32
+ /** The event's `schema` value. A field is only ever added within a version. */
33
+ export declare const NOTIFY_SCHEMA = "chant.notify/v1";
34
+ /** The JSON Schema's `$id`. */
35
+ export declare const NOTIFY_SCHEMA_ID = "https://intentius.io/chant/schemas/notify/v1/notify.schema.json";
36
+ /** What happened. */
37
+ export declare const NOTIFY_EVENTS: readonly ["waiting", "refused", "failed", "drift"];
38
+ export type NotifyEventKind = (typeof NOTIFY_EVENTS)[number];
39
+ /** Where the run is: the CI run's page, the forge, the repository and commit. */
40
+ export interface NotifyRun {
41
+ url?: string;
42
+ forge?: "github" | "gitlab" | "forgejo";
43
+ /** owner/name on GitHub and Forgejo, the project path on GitLab. */
44
+ repository?: string;
45
+ commit?: string;
46
+ /** The pull or merge request the run is for, when there is one. */
47
+ pr?: number;
48
+ }
49
+ /** `chant.notify/v1`. The JSON Schema is `./notify.schema.json`. */
50
+ export interface NotifyEvent {
51
+ schema: typeof NOTIFY_SCHEMA;
52
+ /** The same for every send of one event about one digest (or drift fingerprint, or commit), so a receiver can drop a repeat. Random when there is none. */
53
+ id: string;
54
+ event: NotifyEventKind;
55
+ /** When it was sent, ISO 8601 UTC. */
56
+ at: string;
57
+ /** The product that sent it: `chant`, `terragucci`, `sql-yodeler`. */
58
+ source: string;
59
+ /** What the run belongs to: the repository, or a name the product gives. */
60
+ project: string;
61
+ /** One line a person can read. */
62
+ summary: string;
63
+ /** The wave, for a product that applies in waves. */
64
+ wave?: {
65
+ number: number;
66
+ name?: string;
67
+ gate?: string;
68
+ };
69
+ /** The environment, for a product that applies per environment. */
70
+ environment?: string;
71
+ /** What the event concerns: the wave's roots or runs, the pending migrations. Empty when the product names none. */
72
+ targets: string[];
73
+ /** The plan digest an approval binds. */
74
+ digest?: string;
75
+ /** On `waiting`: how a person approves it. */
76
+ approve?: {
77
+ /** The command to run, as the product prints it. */
78
+ command: string;
79
+ /** chant's own command for the same approval, when the product's differs. */
80
+ chant?: string;
81
+ /** Under `pr-review`: the pull request whose approving review would approve it. */
82
+ review?: {
83
+ pr: number;
84
+ url: string;
85
+ };
86
+ };
87
+ /** The product's own word for the outcome (`gated`, `denied`, `incomplete`). */
88
+ status?: string;
89
+ /** On `refused` and `failed`: why. */
90
+ reason?: string;
91
+ /** The exit code the run ended with. */
92
+ exitCode?: number;
93
+ /** On `drift`: what moved. */
94
+ drift?: {
95
+ changed: string[];
96
+ missing?: string[];
97
+ failed?: string[];
98
+ fingerprint?: string;
99
+ };
100
+ run?: NotifyRun;
101
+ /** A report page for the run. */
102
+ reportUrl?: string;
103
+ /** The product's own record of the outcome, carried whole for programs that know it. */
104
+ detail?: Record<string, unknown>;
105
+ }
106
+ /** What a product fills in; {@link makeNotifyEvent} adds the rest. */
107
+ export type NotifyFields = Omit<NotifyEvent, "schema" | "id" | "at" | "project" | "targets" | "run"> & {
108
+ id?: string;
109
+ project?: string;
110
+ targets?: string[];
111
+ run?: NotifyRun;
112
+ };
113
+ /** The CI run, from its environment: GitHub Actions, Forgejo Actions or GitLab CI. */
114
+ export declare function ciRun(env: NodeJS.ProcessEnv): NotifyRun;
115
+ /**
116
+ * A whole event: the fields, with the schema, the time, the CI run (the
117
+ * product's own `run` fields win) and an id. The id is a hash over the
118
+ * source, project, event, wave, environment and digest (else the drift
119
+ * fingerprint, else the commit), so a re-run sends the same id; with none of
120
+ * the three it is random.
121
+ */
122
+ export declare function makeNotifyEvent(fields: NotifyFields, options?: {
123
+ env?: NodeJS.ProcessEnv;
124
+ now?: Date;
125
+ }): NotifyEvent;
126
+ /** The first line of every chat message: `<source>: <summary>`, or what happened to what when there is no summary. */
127
+ export declare function notifyHeadline(e: NotifyEvent): string;
128
+ /** A Slack incoming webhook's body: one mrkdwn text, with the approve command as code and the links as links. */
129
+ export declare function slackMessage(e: NotifyEvent): {
130
+ text: string;
131
+ };
132
+ /** A Teams incoming webhook's body (a Workflows webhook): one Adaptive Card, with buttons that open the review page and the run. */
133
+ export declare function teamsMessage(e: NotifyEvent): Record<string, unknown>;
134
+ /** Where events go. Each value is the NAME of an environment variable; the configuration never holds a URL or a key. */
135
+ export interface NotifyConfig {
136
+ /** The variable holding the generic webhook's URL. */
137
+ webhook?: string;
138
+ /** The variable holding the key the webhook's events are signed with. Required with `webhook`. */
139
+ key?: string;
140
+ /** The variable holding a Slack incoming webhook's URL. */
141
+ slack?: string;
142
+ /** The variable holding a Microsoft Teams incoming webhook's (Workflows) URL. */
143
+ teams?: string;
144
+ /** The events to send. Default: all of them. */
145
+ events?: NotifyEventKind[];
146
+ }
147
+ /** The first problem with a {@link NotifyConfig}, or undefined. `where` prefixes the message. */
148
+ export declare function notifyConfigProblem(value: unknown, where?: string): string | undefined;
149
+ /** The environment variables a configuration names, for a pipeline to map its secrets into. */
150
+ export declare function notifyVariables(config: NotifyConfig | undefined): string[];
151
+ /** The request {@link sendNotify} posts to the webhook: the event as JSON, signed with `key` over `<timestamp>.<body>`. */
152
+ export declare function webhookRequest(event: NotifyEvent, key: string, options?: {
153
+ now?: number;
154
+ prefix?: string;
155
+ userAgent?: string;
156
+ }): {
157
+ headers: Record<string, string>;
158
+ body: string;
159
+ };
160
+ /** The part of `fetch` {@link sendNotify} uses. Tests pass their own. */
161
+ export type NotifyFetch = (url: string, init: {
162
+ method: string;
163
+ headers: Record<string, string>;
164
+ body: string;
165
+ signal?: AbortSignal;
166
+ }) => Promise<{
167
+ ok: boolean;
168
+ status: number;
169
+ }>;
170
+ export interface NotifyDelivery {
171
+ target: "webhook" | "slack" | "teams";
172
+ ok: boolean;
173
+ /** `delivered`, the HTTP status, or why there was none. Never a URL or a key. */
174
+ detail: string;
175
+ }
176
+ export interface SendNotifyOptions {
177
+ env?: NodeJS.ProcessEnv;
178
+ fetch?: NotifyFetch;
179
+ /** Tries per target. A 4xx is not retried. Default 3. */
180
+ attempts?: number;
181
+ /** Waits between tries. Default `setTimeout`, 500 ms times the try. */
182
+ sleep?: (ms: number) => Promise<void>;
183
+ /** Where a failed delivery is written. Default stderr. */
184
+ log?: (line: string) => void;
185
+ /** The webhook headers' prefix. Default `x-chant`. */
186
+ prefix?: string;
187
+ userAgent?: string;
188
+ /** A product's own Slack or Teams body (terragucci's relay buttons), in place of {@link slackMessage} and {@link teamsMessage}. */
189
+ render?: {
190
+ slack?: (e: NotifyEvent) => unknown;
191
+ teams?: (e: NotifyEvent) => unknown;
192
+ };
193
+ /** Seconds since the epoch, for the signature's timestamp. Default: the clock. */
194
+ now?: number;
195
+ }
196
+ /**
197
+ * Sends `event` to what `config` names, reading the URLs and the key from
198
+ * the environment at send time. Never throws: each delivery's outcome is
199
+ * returned, and a failed one is logged without its URL.
200
+ */
201
+ export declare function sendNotify(config: NotifyConfig | undefined, event: NotifyEvent | undefined, options?: SendNotifyOptions): Promise<NotifyDelivery[]>;
202
+ //# sourceMappingURL=notify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACnI,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/F,+EAA+E;AAC/E,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,+BAA+B;AAC/B,eAAO,MAAM,gBAAgB,oEAAoE,CAAC;AAElG,qBAAqB;AACrB,eAAO,MAAM,aAAa,YAAI,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAChF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IA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