@intentius/chant 0.124.25 → 0.124.26

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 (104) hide show
  1. package/dist/cli/commands/build.d.ts.map +1 -1
  2. package/dist/cli/commands/build.js +4 -2
  3. package/dist/cli/commands/lint.d.ts.map +1 -1
  4. package/dist/cli/commands/lint.js +4 -2
  5. package/dist/cli/handlers/approve.d.ts.map +1 -1
  6. package/dist/cli/handlers/approve.js +39 -4
  7. package/dist/gate-decision.d.ts +1 -1
  8. package/dist/gate-decision.d.ts.map +1 -1
  9. package/dist/gate-decision.js +1 -1
  10. package/dist/lifecycle/gate-audit.d.ts +7 -1
  11. package/dist/lifecycle/gate-audit.d.ts.map +1 -1
  12. package/dist/lifecycle/gate-audit.js +40 -3
  13. package/dist/lifecycle/gate-checkpoint.d.ts +78 -0
  14. package/dist/lifecycle/gate-checkpoint.d.ts.map +1 -0
  15. package/dist/lifecycle/gate-checkpoint.js +103 -0
  16. package/dist/lifecycle/gate-ledger.d.ts +41 -0
  17. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  18. package/dist/lifecycle/gate-ledger.js +18 -0
  19. package/dist/lifecycle/run-ledger.d.ts +2 -0
  20. package/dist/lifecycle/run-ledger.d.ts.map +1 -1
  21. package/dist/lifecycle/run-ledger.js +2 -0
  22. package/dist/lint/rules/op/index.d.ts +6 -2
  23. package/dist/lint/rules/op/index.d.ts.map +1 -1
  24. package/dist/lint/rules/op/index.js +7 -3
  25. package/dist/lint/rules/op/ops016-gate-resume.d.ts +14 -0
  26. package/dist/lint/rules/op/ops016-gate-resume.d.ts.map +1 -0
  27. package/dist/lint/rules/op/ops016-gate-resume.js +31 -0
  28. package/dist/lint/rules/op/ops017-gate-alias.d.ts +30 -0
  29. package/dist/lint/rules/op/ops017-gate-alias.d.ts.map +1 -0
  30. package/dist/lint/rules/op/ops017-gate-alias.js +67 -0
  31. package/dist/op/activity-contract.d.ts +14 -0
  32. package/dist/op/activity-contract.d.ts.map +1 -1
  33. package/dist/op/activity-contract.js +16 -0
  34. package/dist/op/builders.d.ts +7 -0
  35. package/dist/op/builders.d.ts.map +1 -1
  36. package/dist/op/builders.js +13 -0
  37. package/dist/op/gate-alias.d.ts +57 -0
  38. package/dist/op/gate-alias.d.ts.map +1 -0
  39. package/dist/op/gate-alias.js +127 -0
  40. package/dist/op/gate-checkpoint.d.ts +123 -0
  41. package/dist/op/gate-checkpoint.d.ts.map +1 -0
  42. package/dist/op/gate-checkpoint.js +280 -0
  43. package/dist/op/gate.d.ts +54 -2
  44. package/dist/op/gate.d.ts.map +1 -1
  45. package/dist/op/gate.js +142 -1
  46. package/dist/op/index.d.ts +4 -1
  47. package/dist/op/index.d.ts.map +1 -1
  48. package/dist/op/index.js +2 -1
  49. package/dist/op/local-executor.d.ts +57 -2
  50. package/dist/op/local-executor.d.ts.map +1 -1
  51. package/dist/op/local-executor.js +136 -6
  52. package/dist/op/local-output.d.ts.map +1 -1
  53. package/dist/op/local-output.js +20 -2
  54. package/dist/op/op-ir.d.ts +4 -0
  55. package/dist/op/op-ir.d.ts.map +1 -1
  56. package/dist/op/op-ir.js +4 -0
  57. package/dist/op/runtime.d.ts +15 -0
  58. package/dist/op/runtime.d.ts.map +1 -1
  59. package/dist/op/runtimes/local.d.ts.map +1 -1
  60. package/dist/op/runtimes/local.js +5 -0
  61. package/dist/op/types.d.ts +31 -0
  62. package/dist/op/types.d.ts.map +1 -1
  63. package/dist/wave-runtime.mjs +214 -212
  64. package/dist/workspace/trust/gate-seal.d.ts +32 -1
  65. package/dist/workspace/trust/gate-seal.d.ts.map +1 -1
  66. package/dist/workspace/trust/gate-seal.js +41 -2
  67. package/dist/workspace/trust/seal.d.ts +1 -1
  68. package/dist/workspace/trust/seal.d.ts.map +1 -1
  69. package/dist/workspace/trust/seal.js +1 -1
  70. package/package.json +1 -1
  71. package/src/cli/commands/build.ts +9 -2
  72. package/src/cli/commands/lint.ts +4 -2
  73. package/src/cli/handlers/approve.ts +46 -4
  74. package/src/cli/handlers/operator.test.ts +91 -0
  75. package/src/gate-decision.ts +2 -0
  76. package/src/lifecycle/gate-audit.ts +41 -4
  77. package/src/lifecycle/gate-checkpoint.test.ts +128 -0
  78. package/src/lifecycle/gate-checkpoint.ts +133 -0
  79. package/src/lifecycle/gate-ledger.ts +61 -0
  80. package/src/lifecycle/run-ledger.ts +4 -0
  81. package/src/lint/rules/op/index.ts +9 -3
  82. package/src/lint/rules/op/ops016-gate-resume.test.ts +53 -0
  83. package/src/lint/rules/op/ops016-gate-resume.ts +48 -0
  84. package/src/lint/rules/op/ops017-gate-alias.test.ts +85 -0
  85. package/src/lint/rules/op/ops017-gate-alias.ts +89 -0
  86. package/src/op/activity-contract.ts +22 -1
  87. package/src/op/builders.ts +21 -1
  88. package/src/op/gate-alias.e2e.test.ts +78 -0
  89. package/src/op/gate-alias.test.ts +350 -0
  90. package/src/op/gate-alias.ts +137 -0
  91. package/src/op/gate-checkpoint.test.ts +284 -0
  92. package/src/op/gate-checkpoint.ts +322 -0
  93. package/src/op/gate.ts +198 -4
  94. package/src/op/index.ts +4 -1
  95. package/src/op/local-executor.ts +180 -7
  96. package/src/op/local-output.ts +18 -2
  97. package/src/op/op-ir.test.ts +25 -0
  98. package/src/op/op-ir.ts +8 -0
  99. package/src/op/runtime.ts +8 -0
  100. package/src/op/runtimes/local.ts +5 -0
  101. package/src/op/types.ts +32 -0
  102. package/src/workspace/trust/gate-seal.test.ts +29 -2
  103. package/src/workspace/trust/gate-seal.ts +46 -2
  104. package/src/workspace/trust/seal.ts +1 -1
@@ -37,9 +37,42 @@ export interface SealedGateApproval {
37
37
  /** Who relayed the approval for `resolvedBy` (#3402), when someone did. */
38
38
  relayedBy?: string;
39
39
  timestamp: string;
40
+ /** The checkpoint the approval lets a run resume from (#3947), when it carries one. */
41
+ checkpointDigest?: string;
42
+ /** The line a carried approval came from (#3949): the names and time its seal was made under. */
43
+ carriedFrom?: { op: string; gate: string; timestamp: string; checkpointDigest?: string };
40
44
  seal?: unknown;
41
45
  }
42
46
 
47
+ /**
48
+ * The approval as it was sealed (#3949). A carried approval is recorded
49
+ * under a gate's new name and the time it was carried, and its seal was
50
+ * made over the line it came from, so its op, gate, time and checkpoint
51
+ * digest are read off `carriedFrom`. Any other approval is returned as it is.
52
+ */
53
+ export function sealedFieldsOf(a: SealedGateApproval): SealedGateApproval {
54
+ const from = a.carriedFrom;
55
+ if (from === undefined) return a;
56
+ const { carriedFrom: _from, checkpointDigest: _checkpoint, ...rest } = a;
57
+ return {
58
+ ...rest,
59
+ op: from.op,
60
+ gate: from.gate,
61
+ timestamp: from.timestamp,
62
+ ...(from.checkpointDigest !== undefined ? { checkpointDigest: from.checkpointDigest } : {}),
63
+ };
64
+ }
65
+
66
+ /**
67
+ * The version of a seal over `a` (#3947): 2 when the approval carries a
68
+ * checkpoint digest, which the payload signs, and 1 otherwise. `chant approve
69
+ * --sign` records 2 on the seal; a seal records no version for 1.
70
+ */
71
+ export function gateSealVersion(a: Pick<SealedGateApproval, "checkpointDigest" | "carriedFrom">): 1 | 2 {
72
+ const checkpoint = a.carriedFrom !== undefined ? a.carriedFrom.checkpointDigest : a.checkpointDigest;
73
+ return checkpoint !== undefined ? 2 : 1;
74
+ }
75
+
43
76
  /**
44
77
  * The bytes a gate approval's seal signs (#3163): the op (or component), the
45
78
  * gate, the environment, the plan digest, the approver and the time, joined
@@ -48,10 +81,21 @@ export interface SealedGateApproval {
48
81
  * `relayed-by <principal>`, so the relay can't be added, changed or removed
49
82
  * after sealing; an approval nobody relayed signs the six lines it always did,
50
83
  * so seals made before #3402 still verify.
84
+ *
85
+ * Seal version 2 (#3947) adds the checkpoint a resumed run carries its step
86
+ * outputs from: an approval with a `checkpointDigest` signs one more line,
87
+ * `checkpoint <digest>`, last. The values the steps after the gate read are
88
+ * then covered by the seal too, and removing or swapping the digest stops it
89
+ * verifying. An approval with none signs what a version 1 seal signed.
90
+ *
91
+ * A carried approval (#3949) signs what the line it came from signed: see
92
+ * {@link sealedFieldsOf}.
51
93
  */
52
- export function gateSealPayload(a: SealedGateApproval): Buffer {
94
+ export function gateSealPayload(approval: SealedGateApproval): Buffer {
95
+ const a = sealedFieldsOf(approval);
53
96
  const relay = a.relayedBy !== undefined ? `\nrelayed-by ${a.relayedBy}` : "";
54
- return Buffer.from(`${a.op}\n${a.gate}\n${a.environment ?? ""}\n${a.planDigest ?? ""}\n${a.resolvedBy}\n${a.timestamp}${relay}`, "utf-8");
97
+ const checkpoint = gateSealVersion(a) === 2 ? `\ncheckpoint ${a.checkpointDigest}` : "";
98
+ return Buffer.from(`${a.op}\n${a.gate}\n${a.environment ?? ""}\n${a.planDigest ?? ""}\n${a.resolvedBy}\n${a.timestamp}${relay}${checkpoint}`, "utf-8");
55
99
  }
56
100
 
57
101
  // ── SSHSIG ───────────────────────────────────────────────────────────────
@@ -32,7 +32,7 @@ import type { Signer } from "./trust-files";
32
32
  import { sshKeygen, verifySshSignature } from "./ssh-commit";
33
33
  import { GATE_SEAL_NAMESPACE, gateSealPayload, namespaceAllowed, sshSignatureKey, verifySshSignatureWith, type SealedGateApproval } from "./gate-seal";
34
34
 
35
- export { GATE_SEAL_NAMESPACE, gateSealPayload, type SealedGateApproval } from "./gate-seal";
35
+ export { GATE_SEAL_NAMESPACE, gateSealPayload, gateSealVersion, sealedFieldsOf, type SealedGateApproval } from "./gate-seal";
36
36
 
37
37
  /** The ssh signature namespace of a verdict seal. */
38
38
  export const REVIEW_SEAL_NAMESPACE = "chant-review";