@action-state-group/capsule-viewer 0.12.0 → 0.13.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.
@@ -24,7 +24,7 @@ var EvidenceGraph = (() => {
24
24
  }
25
25
  return to;
26
26
  };
27
- var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
27
+ var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3);
28
28
 
29
29
  // node_modules/cborg/lib/is.js
30
30
  function is(value) {
@@ -1546,13 +1546,13 @@ var EvidenceGraph = (() => {
1546
1546
  }
1547
1547
  return quickBytes;
1548
1548
  }
1549
- const encoder3 = encoders[tokens.type.major];
1550
- if (encoder3.encodedSize) {
1551
- const size = encoder3.encodedSize(tokens, options);
1549
+ const encoder5 = encoders[tokens.type.major];
1550
+ if (encoder5.encodedSize) {
1551
+ const size = encoder5.encodedSize(tokens, options);
1552
1552
  if (!hasDest) {
1553
1553
  writeTo = new Bl(size);
1554
1554
  }
1555
- encoder3(writeTo, tokens, options);
1555
+ encoder5(writeTo, tokens, options);
1556
1556
  if (writeTo.chunks.length !== 1) {
1557
1557
  throw new Error(`Unexpected error: pre-calculated length for ${tokens} was wrong`);
1558
1558
  }
@@ -2673,37 +2673,37 @@ var EvidenceGraph = (() => {
2673
2673
  abytes(bytes);
2674
2674
  if (hasHexBuiltin)
2675
2675
  return bytes.toHex();
2676
- let hex5 = "";
2676
+ let hex6 = "";
2677
2677
  for (let i = 0; i < bytes.length; i++) {
2678
- hex5 += hexes[bytes[i]];
2678
+ hex6 += hexes[bytes[i]];
2679
2679
  }
2680
- return hex5;
2680
+ return hex6;
2681
2681
  }
2682
2682
  function asciiToBase16(ch) {
2683
2683
  return ch >= 48 && ch <= 57 ? ch - 48 : ch >= 65 && ch <= 70 ? ch - (65 - 10) : ch >= 97 && ch <= 102 ? ch - (97 - 10) : void 0;
2684
2684
  }
2685
- function hexToBytes2(hex5) {
2686
- if (typeof hex5 !== "string")
2687
- throw new TypeError("hex string expected, got " + typeof hex5);
2685
+ function hexToBytes2(hex6) {
2686
+ if (typeof hex6 !== "string")
2687
+ throw new TypeError("hex string expected, got " + typeof hex6);
2688
2688
  if (hasHexBuiltin) {
2689
2689
  try {
2690
- return Uint8Array.fromHex(hex5);
2690
+ return Uint8Array.fromHex(hex6);
2691
2691
  } catch (error) {
2692
2692
  if (error instanceof SyntaxError)
2693
2693
  throw new RangeError(error.message);
2694
2694
  throw error;
2695
2695
  }
2696
2696
  }
2697
- const hl = hex5.length;
2697
+ const hl = hex6.length;
2698
2698
  const al = hl / 2;
2699
2699
  if (hl % 2)
2700
2700
  throw new RangeError("hex string expected, got unpadded hex of length " + hl);
2701
2701
  const array2 = new Uint8Array(al);
2702
2702
  for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
2703
- const n1 = asciiToBase16(hex5.charCodeAt(hi));
2704
- const n2 = asciiToBase16(hex5.charCodeAt(hi + 1));
2703
+ const n1 = asciiToBase16(hex6.charCodeAt(hi));
2704
+ const n2 = asciiToBase16(hex6.charCodeAt(hi + 1));
2705
2705
  if (n1 === void 0 || n2 === void 0) {
2706
- const char = hex5[hi] + hex5[hi + 1];
2706
+ const char = hex6[hi] + hex6[hi + 1];
2707
2707
  throw new RangeError('hex string expected, got non-hex character "' + char + '" at index ' + hi);
2708
2708
  }
2709
2709
  array2[ai] = n1 * 16 + n2;
@@ -3189,10 +3189,10 @@ var EvidenceGraph = (() => {
3189
3189
  throw new RangeError(prefix + "expected safe integer, got " + value);
3190
3190
  }
3191
3191
  }
3192
- function hexToNumber(hex5) {
3193
- if (typeof hex5 !== "string")
3194
- throw new TypeError("hex string expected, got " + typeof hex5);
3195
- return hex5 === "" ? _0n : BigInt("0x" + hex5);
3192
+ function hexToNumber(hex6) {
3193
+ if (typeof hex6 !== "string")
3194
+ throw new TypeError("hex string expected, got " + typeof hex6);
3195
+ return hex6 === "" ? _0n : BigInt("0x" + hex6);
3196
3196
  }
3197
3197
  function bytesToNumberBE(bytes) {
3198
3198
  return hexToNumber(bytesToHex(bytes));
@@ -3206,10 +3206,10 @@ var EvidenceGraph = (() => {
3206
3206
  throw new Error("zero output length is invalid");
3207
3207
  n = abignumber(n);
3208
3208
  const expectedLen = len * 2;
3209
- const hex5 = n.toString(16);
3210
- if (hex5.length > expectedLen)
3209
+ const hex6 = n.toString(16);
3210
+ if (hex6.length > expectedLen)
3211
3211
  throw new RangeError("number is too large");
3212
- return hexToBytes2(hex5.padStart(expectedLen, "0"));
3212
+ return hexToBytes2(hex6.padStart(expectedLen, "0"));
3213
3213
  }
3214
3214
  function numberToBytesLE(n, len) {
3215
3215
  return numberToBytesBE(n, len).reverse();
@@ -3260,7 +3260,7 @@ var EvidenceGraph = (() => {
3260
3260
  anumber2 = anumber;
3261
3261
  bytesToHex2 = bytesToHex;
3262
3262
  concatBytes2 = (...arrays) => concatBytes(...arrays);
3263
- hexToBytes3 = (hex5) => hexToBytes2(hex5);
3263
+ hexToBytes3 = (hex6) => hexToBytes2(hex6);
3264
3264
  isBytes2 = isBytes;
3265
3265
  randomBytes2 = (bytesLength) => randomBytes(bytesLength);
3266
3266
  _0n = /* @__PURE__ */ BigInt(0);
@@ -3384,13 +3384,13 @@ var EvidenceGraph = (() => {
3384
3384
  assertIsSquare(F, root, n);
3385
3385
  return root;
3386
3386
  }
3387
- function sqrt9mod16(P2) {
3388
- const Fp_ = Field(P2);
3389
- const tn = tonelliShanks(P2);
3387
+ function sqrt9mod16(P3) {
3388
+ const Fp_ = Field(P3);
3389
+ const tn = tonelliShanks(P3);
3390
3390
  const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));
3391
3391
  const c2 = tn(Fp_, c1);
3392
3392
  const c3 = tn(Fp_, Fp_.neg(c1));
3393
- const c4 = (P2 + _7n) / _16n;
3393
+ const c4 = (P3 + _7n) / _16n;
3394
3394
  return ((Fp2, n) => {
3395
3395
  const F = Fp2;
3396
3396
  let tv1 = F.pow(n, c4);
@@ -3407,18 +3407,18 @@ var EvidenceGraph = (() => {
3407
3407
  return root;
3408
3408
  });
3409
3409
  }
3410
- function tonelliShanks(P2) {
3411
- if (P2 < _3n)
3410
+ function tonelliShanks(P3) {
3411
+ if (P3 < _3n)
3412
3412
  throw new Error("sqrt is not defined for small field");
3413
- aoddModulus(P2, "tonelliShanks");
3414
- let Q = P2 - _1n2;
3413
+ aoddModulus(P3, "tonelliShanks");
3414
+ let Q = P3 - _1n2;
3415
3415
  let S = 0;
3416
3416
  while (Q % _2n === _0n2) {
3417
3417
  Q /= _2n;
3418
3418
  S++;
3419
3419
  }
3420
3420
  let Z = _2n;
3421
- const _Fp = Field(P2);
3421
+ const _Fp = Field(P3);
3422
3422
  while (FpLegendre(_Fp, Z) === 1) {
3423
3423
  if (Z++ > 1e3)
3424
3424
  throw new Error("Cannot find square root: probably non-prime P");
@@ -3458,15 +3458,15 @@ var EvidenceGraph = (() => {
3458
3458
  return R;
3459
3459
  };
3460
3460
  }
3461
- function FpSqrt(P2) {
3462
- aoddModulus(P2, "Fp.sqrt");
3463
- if (P2 % _4n === _3n)
3461
+ function FpSqrt(P3) {
3462
+ aoddModulus(P3, "Fp.sqrt");
3463
+ if (P3 % _4n === _3n)
3464
3464
  return sqrt3mod4;
3465
- if (P2 % _8n === _5n)
3465
+ if (P3 % _8n === _5n)
3466
3466
  return sqrt5mod8;
3467
- if (P2 % _16n === _9n)
3468
- return sqrt9mod16(P2);
3469
- return tonelliShanks(P2);
3467
+ if (P3 % _16n === _9n)
3468
+ return sqrt9mod16(P3);
3469
+ return tonelliShanks(P3);
3470
3470
  }
3471
3471
  function validateField(field) {
3472
3472
  aobject2(field, "field");
@@ -3765,8 +3765,8 @@ var EvidenceGraph = (() => {
3765
3765
  throw new Error("invalid scalar at index " + i);
3766
3766
  });
3767
3767
  }
3768
- function getWindowSize(P2) {
3769
- return pointWindowSizes.get(P2) || 1;
3768
+ function getWindowSize(P3) {
3769
+ return pointWindowSizes.get(P3) || 1;
3770
3770
  }
3771
3771
  function oddMultiples(p, size) {
3772
3772
  const dbl = p.double();
@@ -4206,8 +4206,8 @@ var EvidenceGraph = (() => {
4206
4206
  x = Fp2.neg(x);
4207
4207
  return Point2.fromAffine({ x, y });
4208
4208
  }
4209
- static fromHex(hex5, zip215 = false) {
4210
- return Point2.fromBytes(hexToBytes3(hex5), zip215);
4209
+ static fromHex(hex6, zip215 = false) {
4210
+ return Point2.fromBytes(hexToBytes3(hex6), zip215);
4211
4211
  }
4212
4212
  get x() {
4213
4213
  return this.toAffine().x;
@@ -4564,19 +4564,19 @@ var EvidenceGraph = (() => {
4564
4564
  // node_modules/@noble/curves/ed25519.js
4565
4565
  function ed25519_pow_2_252_3(x) {
4566
4566
  const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);
4567
- const P2 = ed25519_CURVE_p;
4568
- const x2 = x * x % P2;
4569
- const b2 = x2 * x % P2;
4570
- const b4 = pow2(b2, _2n3, P2) * b2 % P2;
4571
- const b5 = pow2(b4, _1n5, P2) * x % P2;
4572
- const b10 = pow2(b5, _5n2, P2) * b5 % P2;
4573
- const b20 = pow2(b10, _10n, P2) * b10 % P2;
4574
- const b40 = pow2(b20, _20n, P2) * b20 % P2;
4575
- const b80 = pow2(b40, _40n, P2) * b40 % P2;
4576
- const b160 = pow2(b80, _80n, P2) * b80 % P2;
4577
- const b240 = pow2(b160, _80n, P2) * b80 % P2;
4578
- const b250 = pow2(b240, _10n, P2) * b10 % P2;
4579
- const pow_p_5_8 = pow2(b250, _2n3, P2) * x % P2;
4567
+ const P3 = ed25519_CURVE_p;
4568
+ const x2 = x * x % P3;
4569
+ const b2 = x2 * x % P3;
4570
+ const b4 = pow2(b2, _2n3, P3) * b2 % P3;
4571
+ const b5 = pow2(b4, _1n5, P3) * x % P3;
4572
+ const b10 = pow2(b5, _5n2, P3) * b5 % P3;
4573
+ const b20 = pow2(b10, _10n, P3) * b10 % P3;
4574
+ const b40 = pow2(b20, _20n, P3) * b20 % P3;
4575
+ const b80 = pow2(b40, _40n, P3) * b40 % P3;
4576
+ const b160 = pow2(b80, _80n, P3) * b80 % P3;
4577
+ const b240 = pow2(b160, _80n, P3) * b80 % P3;
4578
+ const b250 = pow2(b240, _10n, P3) * b10 % P3;
4579
+ const pow_p_5_8 = pow2(b250, _2n3, P3) * x % P3;
4580
4580
  return { pow_p_5_8, b2 };
4581
4581
  }
4582
4582
  function adjustScalarBytes(bytes) {
@@ -4586,23 +4586,23 @@ var EvidenceGraph = (() => {
4586
4586
  return bytes;
4587
4587
  }
4588
4588
  function uvRatio(u, v) {
4589
- const P2 = ed25519_CURVE_p;
4590
- const v3 = mod(v * v * v, P2);
4591
- const v7 = mod(v3 * v3 * v, P2);
4589
+ const P3 = ed25519_CURVE_p;
4590
+ const v3 = mod(v * v * v, P3);
4591
+ const v7 = mod(v3 * v3 * v, P3);
4592
4592
  const pow3 = ed25519_pow_2_252_3(u * v7).pow_p_5_8;
4593
- let x = mod(u * v3 * pow3, P2);
4594
- const vx2 = mod(v * x * x, P2);
4593
+ let x = mod(u * v3 * pow3, P3);
4594
+ const vx2 = mod(v * x * x, P3);
4595
4595
  const root1 = x;
4596
- const root2 = mod(x * ED25519_SQRT_M1, P2);
4596
+ const root2 = mod(x * ED25519_SQRT_M1, P3);
4597
4597
  const useRoot1 = vx2 === u;
4598
- const useRoot2 = vx2 === mod(-u, P2);
4599
- const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P2);
4598
+ const useRoot2 = vx2 === mod(-u, P3);
4599
+ const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P3);
4600
4600
  if (useRoot1)
4601
4601
  x = root1;
4602
4602
  if (useRoot2 || noRoot)
4603
4603
  x = root2;
4604
- if (isNegativeLE(x, P2))
4605
- x = mod(-x, P2);
4604
+ if (isNegativeLE(x, P3))
4605
+ x = mod(-x, P3);
4606
4606
  return { isValid: useRoot1 || useRoot2, value: x };
4607
4607
  }
4608
4608
  function toMontgomery(point) {
@@ -5179,8 +5179,8 @@ var EvidenceGraph = (() => {
5179
5179
  const y = Uint8Array.from(encoded);
5180
5180
  y[31] &= 127;
5181
5181
  const canonical = !(y[0] >= 237 && y.subarray(1, 31).every((b) => b === 255) && y[31] === 127);
5182
- const hex5 = Array.from(y, (b) => b.toString(16).padStart(2, "0")).join("");
5183
- return canonical && !SMALL_ORDER_Y.includes(hex5);
5182
+ const hex6 = Array.from(y, (b) => b.toString(16).padStart(2, "0")).join("");
5183
+ return canonical && !SMALL_ORDER_Y.includes(hex6);
5184
5184
  }
5185
5185
  function strictEd25519(publicKey, signature2) {
5186
5186
  if (publicKey.length !== 32 || signature2.length !== 64)
@@ -5876,21 +5876,21 @@ var EvidenceGraph = (() => {
5876
5876
  "retained_until",
5877
5877
  "not_retained_after"
5878
5878
  ];
5879
- function retentionFindings(raw, path2, add2) {
5879
+ function retentionFindings(raw, path2, add3) {
5880
5880
  const retention = asJsonObject(raw);
5881
5881
  if (retention === void 0) {
5882
- add2("field_not_object", `${path2} MUST be a JSON object when present (\xA75.5.5)`, 1);
5882
+ add3("field_not_object", `${path2} MUST be a JSON object when present (\xA75.5.5)`, 1);
5883
5883
  return;
5884
5884
  }
5885
5885
  for (const field of RETENTION_STRING_MEMBERS) {
5886
5886
  const present = Object.hasOwn(retention, field);
5887
5887
  if (field === "declarant" && (!present || retention[field] === null))
5888
- add2("missing_required_field", `${path2}.declarant is REQUIRED (\xA75.5.5)`, 1);
5888
+ add3("missing_required_field", `${path2}.declarant is REQUIRED (\xA75.5.5)`, 1);
5889
5889
  else if (present && typeof retention[field] !== "string")
5890
- add2("field_not_string", `${path2}.${field} MUST be a string when present (\xA75.5.5)`, 1);
5890
+ add3("field_not_string", `${path2}.${field} MUST be a string when present (\xA75.5.5)`, 1);
5891
5891
  }
5892
5892
  if (!Object.hasOwn(retention, "retained_until") && !Object.hasOwn(retention, "not_retained_after"))
5893
- add2("retention_empty", `${path2} MUST carry retained_until or not_retained_after (\xA75.5.5)`, 1);
5893
+ add3("retention_empty", `${path2} MUST carry retained_until or not_retained_after (\xA75.5.5)`, 1);
5894
5894
  }
5895
5895
  function referenceFindings(capsule, purposes) {
5896
5896
  if (capsule.format_version !== "4")
@@ -5898,11 +5898,11 @@ var EvidenceGraph = (() => {
5898
5898
  if (!("references" in capsule))
5899
5899
  return [];
5900
5900
  const findings = [];
5901
- const add2 = (code2, detail, check, severity = "error") => {
5901
+ const add3 = (code2, detail, check, severity = "error") => {
5902
5902
  findings.push({ code: code2, detail, check, severity });
5903
5903
  };
5904
5904
  if (!Array.isArray(capsule.references)) {
5905
- add2("references_malformed", "references MUST be an array (\xA75.5.5)", 1);
5905
+ add3("references_malformed", "references MUST be an array (\xA75.5.5)", 1);
5906
5906
  return findings;
5907
5907
  }
5908
5908
  const parent2 = asJsonObject(capsule.chain)?.parent_capsule_id;
@@ -5910,40 +5910,40 @@ var EvidenceGraph = (() => {
5910
5910
  const path2 = `references[${i}]`;
5911
5911
  const ref = asJsonObject(raw);
5912
5912
  if (ref === void 0) {
5913
- add2("reference_malformed", `${path2} MUST be an object (\xA75.5.5)`, 1);
5913
+ add3("reference_malformed", `${path2} MUST be an object (\xA75.5.5)`, 1);
5914
5914
  continue;
5915
5915
  }
5916
5916
  for (const field of ["type", "digest_alg", "digest"]) {
5917
5917
  if (typeof ref[field] !== "string" || ref[field] === "") {
5918
- add2("reference_malformed", `${path2}.${field} MUST be a non-empty string (\xA75.5.5)`, 1);
5918
+ add3("reference_malformed", `${path2}.${field} MUST be a non-empty string (\xA75.5.5)`, 1);
5919
5919
  }
5920
5920
  }
5921
5921
  if (ref.type === "agent-action-capsule" && ref.digest_alg === "SHA-256") {
5922
5922
  if (typeof ref.digest === "string" && ref.digest !== "" && !isHex64(ref.digest)) {
5923
- add2("reference_malformed", `${path2}.digest MUST be an AAC Capsule ID for agent-action-capsule/SHA-256 (\xA75.5.5)`, 1);
5923
+ add3("reference_malformed", `${path2}.digest MUST be an AAC Capsule ID for agent-action-capsule/SHA-256 (\xA75.5.5)`, 1);
5924
5924
  }
5925
5925
  if (typeof parent2 === "string" && parent2 !== "" && ref.digest === parent2) {
5926
- add2("reference_duplicates_chain_parent", `${path2} duplicates chain.parent_capsule_id (\xA75.5.5)`, 6);
5926
+ add3("reference_duplicates_chain_parent", `${path2} duplicates chain.parent_capsule_id (\xA75.5.5)`, 6);
5927
5927
  }
5928
5928
  }
5929
5929
  if ("citation_purpose" in ref) {
5930
5930
  if (typeof ref.citation_purpose !== "string" || ref.citation_purpose === "") {
5931
- add2("reference_malformed", `${path2}.citation_purpose MUST be a non-empty string (\xA75.5.5)`, 1);
5931
+ add3("reference_malformed", `${path2}.citation_purpose MUST be a non-empty string (\xA75.5.5)`, 1);
5932
5932
  } else if (!purposes.has(ref.citation_purpose)) {
5933
- add2("unknown_registry_value", `${path2}.citation_purpose is not seeded; informational, not rejected (\xA712)`, 8, "info");
5933
+ add3("unknown_registry_value", `${path2}.citation_purpose is not seeded; informational, not rejected (\xA712)`, 8, "info");
5934
5934
  }
5935
5935
  }
5936
5936
  if (ref.retention !== void 0)
5937
- retentionFindings(ref.retention, `${path2}.retention`, add2);
5937
+ retentionFindings(ref.retention, `${path2}.retention`, add3);
5938
5938
  if ("log_coordinates" in ref) {
5939
5939
  const coordinates = asJsonObject(ref.log_coordinates);
5940
5940
  if (coordinates === void 0) {
5941
- add2("reference_log_coordinates_malformed", `${path2}.log_coordinates MUST be an object (\xA75.5.5)`, 1);
5941
+ add3("reference_log_coordinates_malformed", `${path2}.log_coordinates MUST be an object (\xA75.5.5)`, 1);
5942
5942
  continue;
5943
5943
  }
5944
5944
  for (const field of ["log_id", "leaf_index", "inclusion_proof"]) {
5945
5945
  if (!(field in coordinates) || coordinates[field] === null) {
5946
- add2("reference_log_coordinates_malformed", `${path2}.log_coordinates requires ${field} (\xA75.5.5)`, 1);
5946
+ add3("reference_log_coordinates_malformed", `${path2}.log_coordinates requires ${field} (\xA75.5.5)`, 1);
5947
5947
  }
5948
5948
  }
5949
5949
  }
@@ -6121,7 +6121,7 @@ var EvidenceGraph = (() => {
6121
6121
  ];
6122
6122
  async function verifyClass1(capsule, store, extensions2 = {}) {
6123
6123
  const findings = [];
6124
- const add2 = (code2, detail, check, severity = "error") => {
6124
+ const add3 = (code2, detail, check, severity = "error") => {
6125
6125
  findings.push(check === void 0 ? { code: code2, detail, severity } : { code: code2, detail, severity, check });
6126
6126
  };
6127
6127
  if (nestedTooDeep(capsule))
@@ -6165,20 +6165,20 @@ var EvidenceGraph = (() => {
6165
6165
  "timestamp"
6166
6166
  ]) {
6167
6167
  if (!(field in top))
6168
- add2("missing_required_field", `${field} is REQUIRED (\xA75.1)`, 1);
6168
+ add3("missing_required_field", `${field} is REQUIRED (\xA75.1)`, 1);
6169
6169
  else if (typeof top[field] !== "string")
6170
- add2("field_not_string", `${field} MUST be a string (\xA75.1)`, 1);
6170
+ add3("field_not_string", `${field} MUST be a string (\xA75.1)`, 1);
6171
6171
  }
6172
6172
  const carriedId = typeof top.capsule_id === "string" && isHex64(top.capsule_id) ? top.capsule_id : void 0;
6173
6173
  if (typeof top.capsule_id === "string" && carriedId === void 0)
6174
- add2("capsule_id_malformed", "capsule_id MUST be 64 lowercase hex (\xA75.1)", 1);
6174
+ add3("capsule_id_malformed", "capsule_id MUST be 64 lowercase hex (\xA75.1)", 1);
6175
6175
  if (typeof top.action_type === "string" && top.action_type !== "fyi" && top.action_type !== "decide")
6176
- add2("action_type_invalid", "action_type MUST be 'fyi' or 'decide' (\xA75.1)", 1);
6176
+ add3("action_type_invalid", "action_type MUST be 'fyi' or 'decide' (\xA75.1)", 1);
6177
6177
  if (typeof top.format_version === "string") {
6178
6178
  if (top.format_version === "4" && top.canonicalization_id !== "jcs")
6179
- add2(!("canonicalization_id" in top) ? "canonicalization_id_missing" : typeof top.canonicalization_id === "string" ? "canonicalization_profile_mismatch" : "canonicalization_id_not_string", 'format_version "4" REQUIRES canonicalization_id="jcs" (\xA75.1)', 1);
6179
+ add3(!("canonicalization_id" in top) ? "canonicalization_id_missing" : typeof top.canonicalization_id === "string" ? "canonicalization_profile_mismatch" : "canonicalization_id_not_string", 'format_version "4" REQUIRES canonicalization_id="jcs" (\xA75.1)', 1);
6180
6180
  else if (top.format_version !== "4")
6181
- add2("unsupported_format_version", `format_version ${JSON.stringify(top.format_version)} is not supported; expected "4" (\xA75.1)`, 1);
6181
+ add3("unsupported_format_version", `format_version ${JSON.stringify(top.format_version)} is not supported; expected "4" (\xA75.1)`, 1);
6182
6182
  }
6183
6183
  for (const field of [
6184
6184
  "effect",
@@ -6190,37 +6190,37 @@ var EvidenceGraph = (() => {
6190
6190
  "provenance_mode"
6191
6191
  ])
6192
6192
  if (field in top && object2(top[field]) === void 0)
6193
- add2("block_not_object", `${field} MUST be a JSON object when present`, 1);
6193
+ add3("block_not_object", `${field} MUST be a JSON object when present`, 1);
6194
6194
  for (const field of ["domain", "provenance"])
6195
6195
  if (field in top && typeof top[field] !== "string")
6196
- add2(`${field}_not_string`, `${field} MUST be a string when present (\xA7-02)`, 1);
6196
+ add3(`${field}_not_string`, `${field} MUST be a string when present (\xA7-02)`, 1);
6197
6197
  if ("constraints" in top && !Array.isArray(top.constraints))
6198
- add2("constraints_not_array", "constraints MUST be an array when present (\xA78.1)", 1);
6198
+ add3("constraints_not_array", "constraints MUST be an array when present (\xA78.1)", 1);
6199
6199
  for (const path2 of pathFind(top, (n) => /[.eE]/u.test(n.raw), MAX_PATH_FINDINGS, MAX_PATH_CHARS))
6200
- add2("float_in_digest_field", `floating-point value at ${path2}; \xA75.1 forbids it`, 1);
6200
+ add3("float_in_digest_field", `floating-point value at ${path2}; \xA75.1 forbids it`, 1);
6201
6201
  for (const path2 of pathFind(top, (n) => !/[.eE]/u.test(n.raw) && (BigInt(n.raw) > 9007199254740991n || BigInt(n.raw) < -9007199254740991n), MAX_PATH_FINDINGS, MAX_PATH_CHARS))
6202
- add2("unsafe_integer_in_digest_field", `integer outside the JS-safe range (+/-9007199254740991) at ${path2}`, 1);
6202
+ add3("unsafe_integer_in_digest_field", `integer outside the JS-safe range (+/-9007199254740991) at ${path2}`, 1);
6203
6203
  const disposition = object2(top.disposition);
6204
6204
  if (disposition !== void 0) {
6205
6205
  if (disposition.approver === void 0 || disposition.approver === null)
6206
- add2("missing_required_field", "disposition.approver is REQUIRED (\xA75.4)", 1);
6206
+ add3("missing_required_field", "disposition.approver is REQUIRED (\xA75.4)", 1);
6207
6207
  else if (typeof disposition.approver !== "string")
6208
- add2("field_not_string", "disposition.approver MUST be a string (\xA75.4)", 1);
6208
+ add3("field_not_string", "disposition.approver MUST be a string (\xA75.4)", 1);
6209
6209
  else if (!["human", "policy", "counterparty"].includes(disposition.approver))
6210
- add2("approver_invalid", "disposition.approver has an invalid value (\xA75.4)", 1);
6210
+ add3("approver_invalid", "disposition.approver has an invalid value (\xA75.4)", 1);
6211
6211
  if (!("decision" in disposition))
6212
- add2("missing_required_field", "disposition.decision is REQUIRED (\xA75.4)", 1);
6212
+ add3("missing_required_field", "disposition.decision is REQUIRED (\xA75.4)", 1);
6213
6213
  if (typeof disposition.human_disposed !== "boolean")
6214
- add2("field_not_bool", "disposition.human_disposed MUST be boolean (\xA75.4)", 1);
6214
+ add3("field_not_bool", "disposition.human_disposed MUST be boolean (\xA75.4)", 1);
6215
6215
  if (disposition.human_disposed === true && disposition.approver !== "human")
6216
- add2("dishonest_human_disposed", "human_disposed=true with non-human approver (\xA75.4)", void 0, "warning");
6216
+ add3("dishonest_human_disposed", "human_disposed=true with non-human approver (\xA75.4)", void 0, "warning");
6217
6217
  }
6218
6218
  if (Object.hasOwn(top, "epoch_id") && typeof top.epoch_id !== "string")
6219
- add2("field_not_string", "epoch_id MUST be a string when present (\xA75.1)", 1);
6219
+ add3("field_not_string", "epoch_id MUST be a string when present (\xA75.1)", 1);
6220
6220
  for (const [block, member] of STRING_MEMBERS) {
6221
6221
  const members = object2(top[block]);
6222
6222
  if (members !== void 0 && Object.hasOwn(members, member) && typeof members[member] !== "string")
6223
- add2("field_not_string", `${block}.${member} MUST be a string when present (\xA76 check 1)`, 1);
6223
+ add3("field_not_string", `${block}.${member} MUST be a string when present (\xA76 check 1)`, 1);
6224
6224
  }
6225
6225
  findings.push(...references.filter((finding) => finding.check === 1));
6226
6226
  let recomputed;
@@ -6229,16 +6229,16 @@ var EvidenceGraph = (() => {
6229
6229
  try {
6230
6230
  recomputed = await computeCapsuleId(top);
6231
6231
  if (recomputed !== carriedId)
6232
- add2("capsule_id_mismatch", `recomputed ${recomputed} != carried ${carriedId}`, 2);
6232
+ add3("capsule_id_mismatch", `recomputed ${recomputed} != carried ${carriedId}`, 2);
6233
6233
  } catch (error) {
6234
6234
  if (!(error instanceof JcsFloatError) && !(error instanceof JcsUnsafeIntegerError))
6235
- add2("capsule_id_uncomputable", String(error), 2);
6235
+ add3("capsule_id_uncomputable", String(error), 2);
6236
6236
  }
6237
6237
  }
6238
6238
  const effect = object2(top.effect);
6239
6239
  const status2 = typeof effect?.status === "string" ? effect.status : "";
6240
6240
  if (status2 === "confirmed" && !(typeof effect?.response_digest === "string" && isHex64(effect.response_digest)))
6241
- add2("confirmed_without_response", "effect.status 'confirmed' requires 64-hex response_digest (\xA75.2)", 3);
6241
+ add3("confirmed_without_response", "effect.status 'confirmed' requires 64-hex response_digest (\xA75.2)", 3);
6242
6242
  const effectMode = effect === void 0 || status2 === "planned" ? "not_applicable" : status2 === "confirmed" && typeof effect.response_digest === "string" && isHex64(effect.response_digest) ? "confirmed" : "dispatched_unconfirmed";
6243
6243
  const verdict2 = typeof disposition?.verdict_class === "string" ? disposition.verdict_class : "";
6244
6244
  if ((/* @__PURE__ */ new Set([
@@ -6252,23 +6252,23 @@ var EvidenceGraph = (() => {
6252
6252
  "escalated",
6253
6253
  "resolved"
6254
6254
  ])).has(verdict2) && effectMode !== "not_applicable")
6255
- add2("verdict_effect_conflict", `verdict_class ${JSON.stringify(verdict2)} requires effect_mode "not_applicable" (\xA75.4.2)`, 4);
6255
+ add3("verdict_effect_conflict", `verdict_class ${JSON.stringify(verdict2)} requires effect_mode "not_applicable" (\xA75.4.2)`, 4);
6256
6256
  if (effectMode === "not_applicable" && effect?.effect_attestation !== void 0 && effect.effect_attestation !== null)
6257
- add2("effect_attestation_present", "effect_attestation MUST be absent for effect_mode 'not_applicable' (\xA75.2)", 5);
6257
+ add3("effect_attestation_present", "effect_attestation MUST be absent for effect_mode 'not_applicable' (\xA75.2)", 5);
6258
6258
  if (effect !== void 0 && status2 !== "planned" && (effect.effect_attestation === void 0 || effect.effect_attestation === null))
6259
- add2("effect_attestation_missing", "dispatched effect requires effect_attestation (\xA75.2)", 5);
6259
+ add3("effect_attestation_missing", "dispatched effect requires effect_attestation (\xA75.2)", 5);
6260
6260
  const chain = object2(top.chain);
6261
6261
  if (chain !== void 0) {
6262
6262
  if (!(typeof chain.parent_capsule_id === "string" && isHex64(chain.parent_capsule_id)))
6263
- add2("chain_parent_malformed", "chain.parent_capsule_id MUST be 64-hex capsule_id (\xA75.4.4)", 6);
6263
+ add3("chain_parent_malformed", "chain.parent_capsule_id MUST be 64-hex capsule_id (\xA75.4.4)", 6);
6264
6264
  if (!("relation" in chain))
6265
- add2("missing_required_field", "chain.relation is REQUIRED when chain block is present (\xA75.4.4)", 6);
6265
+ add3("missing_required_field", "chain.relation is REQUIRED when chain block is present (\xA75.4.4)", 6);
6266
6266
  if (store === void 0)
6267
- add2("chain_check_store_level", "chain parent-existence and concurrent-supersedes are store-level checks (\xA76); not run without store", 6, "info");
6267
+ add3("chain_check_store_level", "chain parent-existence and concurrent-supersedes are store-level checks (\xA76); not run without store", 6, "info");
6268
6268
  else {
6269
6269
  const ids = store instanceof Set ? store : new Set(store.map((item) => typeof item === "string" ? item : object2(item)?.capsule_id).filter((id) => typeof id === "string"));
6270
6270
  if (typeof chain.parent_capsule_id === "string" && !ids.has(chain.parent_capsule_id))
6271
- add2("chain_parent_missing", `chain parent ${chain.parent_capsule_id} not found in store (\xA76)`, 6);
6271
+ add3("chain_parent_missing", `chain parent ${chain.parent_capsule_id} not found in store (\xA76)`, 6);
6272
6272
  }
6273
6273
  }
6274
6274
  findings.push(...references.filter((finding) => finding.check === 6));
@@ -6289,13 +6289,13 @@ var EvidenceGraph = (() => {
6289
6289
  confirmed: 1
6290
6290
  };
6291
6291
  if (typeof stated?.effect_mode === "string" && (rank[stated.effect_mode] ?? -1) > rank[effectMode])
6292
- add2("assurance_overclaim", `claimed effect_mode ${JSON.stringify(stated.effect_mode)} but verifier derived ${JSON.stringify(effectMode)} (\xA75.3)`, 7);
6292
+ add3("assurance_overclaim", `claimed effect_mode ${JSON.stringify(stated.effect_mode)} but verifier derived ${JSON.stringify(effectMode)} (\xA75.3)`, 7);
6293
6293
  const attestationRank = {
6294
6294
  self_attested: 0,
6295
6295
  anchored: 1
6296
6296
  };
6297
6297
  if (typeof stated?.attestation_mode === "string" && (attestationRank[stated.attestation_mode] ?? -1) > attestationRank.self_attested)
6298
- add2("assurance_overclaim", `claimed attestation_mode ${JSON.stringify(stated.attestation_mode)} but verifier derived "self_attested" (\xA75.3)`, 7, "info");
6298
+ add3("assurance_overclaim", `claimed attestation_mode ${JSON.stringify(stated.attestation_mode)} but verifier derived "self_attested" (\xA75.3)`, 7, "info");
6299
6299
  const ledgerRank = {
6300
6300
  standalone: 0,
6301
6301
  chained: 1,
@@ -6303,14 +6303,14 @@ var EvidenceGraph = (() => {
6303
6303
  };
6304
6304
  const ledgerMode = chain === void 0 ? "standalone" : "chained";
6305
6305
  if (typeof stated?.ledger_mode === "string" && (ledgerRank[stated.ledger_mode] ?? -1) > ledgerRank[ledgerMode])
6306
- add2("assurance_overclaim", `claimed ledger_mode ${JSON.stringify(stated.ledger_mode)} but verifier derived ${JSON.stringify(ledgerMode)} (\xA75.3)`, 7, "info");
6306
+ add3("assurance_overclaim", `claimed ledger_mode ${JSON.stringify(stated.ledger_mode)} but verifier derived ${JSON.stringify(ledgerMode)} (\xA75.3)`, 7, "info");
6307
6307
  const crossRank = {
6308
6308
  unilateral_fallback: 0,
6309
6309
  acknowledged_receipt: 1,
6310
6310
  full_bilateral: 2
6311
6311
  };
6312
6312
  if (typeof stated?.cross_party_rung === "string" && (crossRank[stated.cross_party_rung] ?? -1) > crossRank[crossPartyRung ?? "unilateral_fallback"])
6313
- add2("assurance_overclaim", `claimed cross_party_rung ${JSON.stringify(stated.cross_party_rung)} but verifier derived ${JSON.stringify(crossPartyRung ?? "unilateral_fallback")} (\xA75.3 Cross-party assurance)`, 7, "info");
6313
+ add3("assurance_overclaim", `claimed cross_party_rung ${JSON.stringify(stated.cross_party_rung)} but verifier derived ${JSON.stringify(crossPartyRung ?? "unilateral_fallback")} (\xA75.3 Cross-party assurance)`, 7, "info");
6314
6314
  const fields2 = [
6315
6315
  ["verdict_class", disposition, "verdict_class"],
6316
6316
  ["disposition.decision", disposition, "decision"],
@@ -6328,16 +6328,16 @@ var EvidenceGraph = (() => {
6328
6328
  if (typeof value === "string" && !accepted.has(value)) {
6329
6329
  const provisional = provisionalClass(registry, value);
6330
6330
  if (provisional !== void 0) {
6331
- add2("known_provisional_registry_value", `${member}=${JSON.stringify(value)} resolves known status 'provisional' via vendored CPB registry (payload class ${JSON.stringify(provisional)}); informational, not rejected (\xA712)`, 8, "info");
6331
+ add3("known_provisional_registry_value", `${member}=${JSON.stringify(value)} resolves known status 'provisional' via vendored CPB registry (payload class ${JSON.stringify(provisional)}); informational, not rejected (\xA712)`, 8, "info");
6332
6332
  continue;
6333
6333
  }
6334
- add2("unknown_registry_value", `${member}=${JSON.stringify(value)} is not a seeded ${registry} value; informational, not rejected (\xA712)`, 8, "info");
6334
+ add3("unknown_registry_value", `${member}=${JSON.stringify(value)} is not a seeded ${registry} value; informational, not rejected (\xA712)`, 8, "info");
6335
6335
  if (registry === "effect_attestation")
6336
- add2("effect_attestation_graded_floor", "unknown effect_attestation is graded no stronger than 'runtime_claimed' (\xA75.2)", 8, "info");
6336
+ add3("effect_attestation_graded_floor", "unknown effect_attestation is graded no stronger than 'runtime_claimed' (\xA75.2)", 8, "info");
6337
6337
  }
6338
6338
  }
6339
6339
  findings.push(...references.filter((finding) => finding.check === 8));
6340
- provenanceModeFindings(top, add2, assurance);
6340
+ provenanceModeFindings(top, add3, assurance);
6341
6341
  return {
6342
6342
  ok: !findings.some((finding) => finding.severity === "error"),
6343
6343
  findings,
@@ -6353,7 +6353,7 @@ var EvidenceGraph = (() => {
6353
6353
  ];
6354
6354
  var nonEmptyString2 = (value) => typeof value === "string" && value !== "";
6355
6355
  var shown = (value) => value instanceof JsonNumber ? value.raw : JSON.stringify(value ?? null);
6356
- function provenanceModeFindings(top, add2, assurance) {
6356
+ function provenanceModeFindings(top, add3, assurance) {
6357
6357
  const pm = object2(top.provenance_mode);
6358
6358
  if (pm === void 0)
6359
6359
  return;
@@ -6361,42 +6361,42 @@ var EvidenceGraph = (() => {
6361
6361
  if (mode === "backfilled" || mode === "contemporaneous")
6362
6362
  assurance.provenance_mode = mode;
6363
6363
  else
6364
- add2("provenance_mode_invalid", `provenance_mode.mode MUST be one of backfilled|contemporaneous (\xA75.3(bis) Provenance mode); got ${shown(mode)}`, 9);
6364
+ add3("provenance_mode_invalid", `provenance_mode.mode MUST be one of backfilled|contemporaneous (\xA75.3(bis) Provenance mode); got ${shown(mode)}`, 9);
6365
6365
  if (mode === "backfilled") {
6366
6366
  for (const field of PROVENANCE_BACKFILLED_FIELDS) {
6367
6367
  const value = pm[field];
6368
6368
  if (value === void 0 || value === null || value === "")
6369
- add2("provenance_mode_missing_required_field", `provenance_mode.${field} is REQUIRED when mode='backfilled' (\xA75.3(bis) Provenance mode)`, 9);
6369
+ add3("provenance_mode_missing_required_field", `provenance_mode.${field} is REQUIRED when mode='backfilled' (\xA75.3(bis) Provenance mode)`, 9);
6370
6370
  }
6371
6371
  if (Object.hasOwn(pm, "source_ref")) {
6372
6372
  const sourceRef = object2(pm.source_ref);
6373
6373
  if (sourceRef === void 0)
6374
- add2("provenance_mode_source_ref_malformed", "provenance_mode.source_ref MUST be a JSON object when present (\xA75.3(bis) Provenance mode)", 9);
6374
+ add3("provenance_mode_source_ref_malformed", "provenance_mode.source_ref MUST be a JSON object when present (\xA75.3(bis) Provenance mode)", 9);
6375
6375
  else
6376
6376
  for (const field of ["type", "digest_alg", "digest"])
6377
6377
  if (!nonEmptyString2(sourceRef[field]))
6378
- add2("provenance_mode_source_ref_malformed", `provenance_mode.source_ref.${field} MUST be a non-empty string (\xA75.3(bis) Provenance mode)`, 9);
6378
+ add3("provenance_mode_source_ref_malformed", `provenance_mode.source_ref.${field} MUST be a non-empty string (\xA75.3(bis) Provenance mode)`, 9);
6379
6379
  }
6380
6380
  if (typeof pm.imported_at === "string" && typeof pm.source_asserted_at === "string" && pm.imported_at === pm.source_asserted_at)
6381
- add2("provenance_time_laundering_shape", "provenance_mode.imported_at equals source_asserted_at on a backfilled record; this is the shape a laundering producer would construct to make an import look contemporaneous (\xA75.3(bis) Provenance mode)", 9);
6381
+ add3("provenance_time_laundering_shape", "provenance_mode.imported_at equals source_asserted_at on a backfilled record; this is the shape a laundering producer would construct to make an import look contemporaneous (\xA75.3(bis) Provenance mode)", 9);
6382
6382
  let timeRung;
6383
6383
  const rawRung = pm.time_rung;
6384
6384
  if (rawRung === "self_attested" || rawRung === "witnessed")
6385
6385
  timeRung = rawRung;
6386
6386
  else if (rawRung !== void 0 && rawRung !== null)
6387
- add2("provenance_mode_invalid", `provenance_mode.time_rung MUST be one of self_attested|witnessed (\xA75.3(bis) Provenance mode); got ${shown(rawRung)}`, 9);
6387
+ add3("provenance_mode_invalid", `provenance_mode.time_rung MUST be one of self_attested|witnessed (\xA75.3(bis) Provenance mode); got ${shown(rawRung)}`, 9);
6388
6388
  const references = Array.isArray(top.references) ? top.references : [];
6389
6389
  const corroborated = references.some((raw) => {
6390
6390
  const reference = object2(raw);
6391
6391
  return reference !== void 0 && reference.citation_purpose === "corroborates_source_time" && nonEmptyString2(reference.type) && nonEmptyString2(reference.digest_alg) && nonEmptyString2(reference.digest);
6392
6392
  });
6393
6393
  if (timeRung === "witnessed" && !corroborated)
6394
- add2("provenance_time_rung_overclaim", "provenance_mode.time_rung='witnessed' claimed without a well-formed references[] entry citing citation_purpose='corroborates_source_time' (\xA75.3(bis) Provenance mode)", 9);
6394
+ add3("provenance_time_rung_overclaim", "provenance_mode.time_rung='witnessed' claimed without a well-formed references[] entry citing citation_purpose='corroborates_source_time' (\xA75.3(bis) Provenance mode)", 9);
6395
6395
  assurance.provenance_time_rung = corroborated ? "witnessed" : "self_attested";
6396
6396
  } else if (mode === "contemporaneous") {
6397
6397
  const orphaned = [...PROVENANCE_BACKFILLED_FIELDS, "time_rung"].filter((field) => pm[field] !== void 0 && pm[field] !== null);
6398
6398
  if (orphaned.length)
6399
- add2("provenance_mode_invalid", `provenance_mode fields [${orphaned.join(" ")}] are meaningful only when mode='backfilled' (\xA75.3(bis) Provenance mode)`, 9);
6399
+ add3("provenance_mode_invalid", `provenance_mode fields [${orphaned.join(" ")}] are meaningful only when mode='backfilled' (\xA75.3(bis) Provenance mode)`, 9);
6400
6400
  }
6401
6401
  }
6402
6402
 
@@ -6450,6 +6450,585 @@ var EvidenceGraph = (() => {
6450
6450
  // node_modules/@action-state-group/agent-action-capsule/dist/bundle.js
6451
6451
  init_browser();
6452
6452
 
6453
+ // node_modules/@action-state-group/agent-action-capsule/dist/bip340.js
6454
+ var P = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;
6455
+ var N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
6456
+ var GX = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n;
6457
+ var GY = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n;
6458
+ var mod2 = (a, m) => (a % m + m) % m;
6459
+ function modPow(base, exponent, m) {
6460
+ let result3 = 1n;
6461
+ let b = mod2(base, m);
6462
+ for (let e = exponent; e > 0n; e >>= 1n) {
6463
+ if (e & 1n)
6464
+ result3 = result3 * b % m;
6465
+ b = b * b % m;
6466
+ }
6467
+ return result3;
6468
+ }
6469
+ function invert2(a, m) {
6470
+ let [r0, r1] = [mod2(a, m), m];
6471
+ let [s0, s1] = [1n, 0n];
6472
+ while (r1 !== 0n) {
6473
+ const q = r0 / r1;
6474
+ [r0, r1] = [r1, r0 - q * r1];
6475
+ [s0, s1] = [s1, s0 - q * s1];
6476
+ }
6477
+ return mod2(s0, m);
6478
+ }
6479
+ function add2(a, b) {
6480
+ if (a === null)
6481
+ return b;
6482
+ if (b === null)
6483
+ return a;
6484
+ const [x1, y1] = a;
6485
+ const [x2, y2] = b;
6486
+ let lambda;
6487
+ if (x1 === x2) {
6488
+ if (mod2(y1 + y2, P) === 0n)
6489
+ return null;
6490
+ lambda = mod2(3n * x1 * x1 * invert2(2n * y1, P), P);
6491
+ } else
6492
+ lambda = mod2((y2 - y1) * invert2(x2 - x1, P), P);
6493
+ const x3 = mod2(lambda * lambda - x1 - x2, P);
6494
+ return [x3, mod2(lambda * (x1 - x3) - y1, P)];
6495
+ }
6496
+ function multiply(point, scalar) {
6497
+ let result3 = null;
6498
+ let addend = point;
6499
+ for (let k = scalar; k > 0n; k >>= 1n) {
6500
+ if (k & 1n)
6501
+ result3 = add2(result3, addend);
6502
+ addend = add2(addend, addend);
6503
+ }
6504
+ return result3;
6505
+ }
6506
+ var bytesToInt = (bytes) => bytes.reduce((n, byte) => n << 8n | BigInt(byte), 0n);
6507
+ function hexBytes(hex6) {
6508
+ if (!/^(?:[0-9a-f]{2})*$/iu.test(hex6))
6509
+ return void 0;
6510
+ const out = new Uint8Array(hex6.length / 2);
6511
+ for (let i = 0; i < out.length; i++)
6512
+ out[i] = parseInt(hex6.slice(2 * i, 2 * i + 2), 16);
6513
+ return out;
6514
+ }
6515
+ var encoder3 = new TextEncoder();
6516
+ function taggedHash(tag, ...parts) {
6517
+ const tagHash = sha256(encoder3.encode(tag));
6518
+ const data = new Uint8Array(64 + parts.reduce((total, part) => total + part.length, 0));
6519
+ data.set(tagHash, 0);
6520
+ data.set(tagHash, 32);
6521
+ let offset = 64;
6522
+ for (const part of parts) {
6523
+ data.set(part, offset);
6524
+ offset += part.length;
6525
+ }
6526
+ return sha256(data);
6527
+ }
6528
+ function verifyBip340(keyHex, message, signatureHex) {
6529
+ const key = hexBytes(keyHex);
6530
+ const signature2 = hexBytes(signatureHex);
6531
+ if (key === void 0 || signature2 === void 0 || key.length !== 32 || signature2.length !== 64 || message.length !== 32)
6532
+ return false;
6533
+ const x = bytesToInt(key);
6534
+ if (x >= P)
6535
+ return false;
6536
+ const ySquared = mod2(x * x * x + 7n, P);
6537
+ let y = modPow(ySquared, (P + 1n) / 4n, P);
6538
+ if (mod2(y * y, P) !== ySquared)
6539
+ return false;
6540
+ if (y & 1n)
6541
+ y = P - y;
6542
+ const r = bytesToInt(signature2.subarray(0, 32));
6543
+ const s = bytesToInt(signature2.subarray(32));
6544
+ if (r >= P || s >= N)
6545
+ return false;
6546
+ const e = mod2(bytesToInt(taggedHash("BIP0340/challenge", signature2.subarray(0, 32), key, message)), N);
6547
+ const sG = multiply([GX, GY], s);
6548
+ const eP = multiply([x, y], e);
6549
+ const result3 = add2(sG, eP === null ? null : [eP[0], mod2(-eP[1], P)]);
6550
+ return result3 !== null && (result3[1] & 1n) === 0n && result3[0] === r;
6551
+ }
6552
+
6553
+ // node_modules/@action-state-group/agent-action-capsule/dist/controller-binding.js
6554
+ var BINDING_VERSION = "controller-binding/0";
6555
+ var REVOCATION_VERSION = "controller-binding-revocation/0";
6556
+ var REVOCATION_METHOD = "revocation_statement/0";
6557
+ var CLAIM_SAME_CONTROLLER = "same_controller_asserted";
6558
+ var CLAIM_DELEGATED_BY = "delegated_by";
6559
+ var CLAIM_SAME_ORGANIZATION = "same_organization_credentialed";
6560
+ var METHOD_DUAL_SIGNATURE = "dual_signature/0";
6561
+ var METHOD_DUAL_SIGNATURE_CREDENTIAL = "dual_signature_credential/0";
6562
+ var KEY_ED25519 = "ed25519";
6563
+ var KEY_BIP340 = "bip340";
6564
+ var NOSTR_KIND = 3374;
6565
+ var MAX_CREATED_AT = 2n ** 53n - 1n;
6566
+ var PROPERTY_FORM = "controller_binding_form";
6567
+ var PROPERTY_SIGNATURES = "controller_binding_signatures";
6568
+ var PROPERTY_WINDOW = "controller_binding_window";
6569
+ var PROPERTY_REVOCATION = "controller_binding_revocation";
6570
+ var PROPERTY_CREDENTIAL = "controller_binding_credential";
6571
+ var STATUS_PASS = "PASS";
6572
+ var STATUS_FAIL = "FAIL";
6573
+ var STATUS_NOT_PRESENT = "NOT_PRESENT";
6574
+ var STATUS_NOT_CHECKED = "NOT_CHECKED";
6575
+ var STATUS_INCONCLUSIVE = "INCONCLUSIVE";
6576
+ var PROVES_CONTROL = "control of both keys at the ceremony";
6577
+ var PROVES_CREDENTIALED = "a trusted issuer key states that both keys are held within one organization";
6578
+ var CLAIMS = {
6579
+ [CLAIM_SAME_CONTROLLER]: {
6580
+ method: METHOD_DUAL_SIGNATURE,
6581
+ added: "",
6582
+ states: "both key holders state that one controller holds both keys"
6583
+ },
6584
+ [CLAIM_DELEGATED_BY]: {
6585
+ method: METHOD_DUAL_SIGNATURE,
6586
+ added: "delegator",
6587
+ states: "both key holders state that the delegator delegated to the other key"
6588
+ },
6589
+ [CLAIM_SAME_ORGANIZATION]: {
6590
+ method: METHOD_DUAL_SIGNATURE_CREDENTIAL,
6591
+ added: "credential",
6592
+ states: "both key holders state that both keys are held within one organization"
6593
+ }
6594
+ };
6595
+ var COMMON = [
6596
+ "binding_version",
6597
+ "claim",
6598
+ "method",
6599
+ "keys",
6600
+ "issued_at",
6601
+ "not_before",
6602
+ "not_after",
6603
+ "revocation",
6604
+ "nonce",
6605
+ "sigs"
6606
+ ];
6607
+ var HEX128 = /^[0-9a-f]{128}$/u;
6608
+ var HEX64 = /^[0-9a-f]{64}$/u;
6609
+ var NONCE32 = /^[0-9a-f]{32,}$/u;
6610
+ var PROFILE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/u;
6611
+ var RECORD_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?Z$/u;
6612
+ var NS = 1000000000n;
6613
+ function daysFromCivil(y, m, d) {
6614
+ const year = m <= 2 ? y - 1 : y;
6615
+ const era = Math.floor(year / 400);
6616
+ const yoe = year - era * 400;
6617
+ const doy = Math.floor((153 * (m + (m > 2 ? -3 : 9)) + 2) / 5) + d - 1;
6618
+ const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
6619
+ return era * 146097 + doe - 719468;
6620
+ }
6621
+ function daysInMonth(y, m) {
6622
+ if (m === 2)
6623
+ return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 ? 29 : 28;
6624
+ return [4, 6, 9, 11].includes(m) ? 30 : 31;
6625
+ }
6626
+ function parseTime(text2, form) {
6627
+ if (typeof text2 !== "string")
6628
+ return void 0;
6629
+ const match = form.exec(text2);
6630
+ if (match === null)
6631
+ return void 0;
6632
+ const [y, mo, d, h, mi, s] = match.slice(1, 7).map(Number);
6633
+ if (mo < 1 || mo > 12 || d < 1 || d > daysInMonth(y, mo) || h > 23 || mi > 59 || s > 59)
6634
+ return void 0;
6635
+ const seconds = BigInt(daysFromCivil(y, mo, d)) * 86400n + BigInt(h * 3600 + mi * 60 + s);
6636
+ const fraction = (match[7] ?? "").slice(0, 9).padEnd(9, "0");
6637
+ return seconds * NS + BigInt(fraction);
6638
+ }
6639
+ var parseProfileTime = (text2) => parseTime(text2, PROFILE_TIME);
6640
+ var parseRecordTime = (text2) => parseTime(text2, RECORD_TIME);
6641
+ var isObject = (value) => asJsonObject(value) !== void 0;
6642
+ var isKey = (value) => typeof value === "string" && HEX64.test(value);
6643
+ function hasMembers(value, names2) {
6644
+ const own = Object.keys(value);
6645
+ return own.length === names2.length && names2.every((n) => Object.hasOwn(value, n));
6646
+ }
6647
+ function without(value, name) {
6648
+ const out = {};
6649
+ for (const [k, v] of Object.entries(value))
6650
+ if (k !== name)
6651
+ Object.defineProperty(out, k, {
6652
+ value: v,
6653
+ writable: true,
6654
+ enumerable: true,
6655
+ configurable: true
6656
+ });
6657
+ return out;
6658
+ }
6659
+ var hex2 = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
6660
+ function hexToBytes4(text2) {
6661
+ const out = new Uint8Array(text2.length / 2);
6662
+ for (let i = 0; i < out.length; i++)
6663
+ out[i] = parseInt(text2.slice(2 * i, 2 * i + 2), 16);
6664
+ return out;
6665
+ }
6666
+ var encoder4 = new TextEncoder();
6667
+ var toBytes = (value) => typeof value === "string" ? encoder4.encode(value) : value;
6668
+ var DECLARATION_MEMBERS = [
6669
+ "profile",
6670
+ "asserted_by",
6671
+ "binding",
6672
+ "list_digest",
6673
+ "as_of",
6674
+ "max_age"
6675
+ ];
6676
+ function parseDeclaration(octets) {
6677
+ const d = {
6678
+ profile: "",
6679
+ assertedBy: "",
6680
+ binding: "",
6681
+ listDigest: "",
6682
+ asOf: "",
6683
+ maxAge: 0n
6684
+ };
6685
+ let value;
6686
+ try {
6687
+ value = decodeStrictJson(octets);
6688
+ } catch (error) {
6689
+ return {
6690
+ declaration: d,
6691
+ error: `the declaration is not one JSON value: ${String(error)}`
6692
+ };
6693
+ }
6694
+ if (!isObject(value))
6695
+ return { declaration: d, error: "the declaration is not a JSON object" };
6696
+ if (typeof value.profile === "string")
6697
+ d.profile = value.profile;
6698
+ if (typeof value.asserted_by === "string")
6699
+ d.assertedBy = value.asserted_by;
6700
+ if (typeof value.as_of === "string")
6701
+ d.asOf = value.as_of;
6702
+ if (!hasMembers(value, DECLARATION_MEMBERS))
6703
+ return {
6704
+ declaration: d,
6705
+ error: "the declaration does not have exactly profile, asserted_by, binding, list_digest, as_of and max_age"
6706
+ };
6707
+ if (typeof value.profile !== "string")
6708
+ return { declaration: d, error: "profile is not a text string" };
6709
+ if (typeof value.asserted_by !== "string")
6710
+ return { declaration: d, error: "asserted_by is not a text string" };
6711
+ const binding = typeof value.binding === "string" ? value.binding : "";
6712
+ const listDigest = typeof value.list_digest === "string" ? value.list_digest : "";
6713
+ const out = { ...d, binding, listDigest };
6714
+ if (!HEX64.test(binding) || !HEX64.test(listDigest))
6715
+ return {
6716
+ declaration: out,
6717
+ error: "binding or list_digest is not 64 lowercase hex characters"
6718
+ };
6719
+ if (parseProfileTime(value.as_of) === void 0)
6720
+ return { declaration: out, error: "as_of is not a time" };
6721
+ const number = value.max_age;
6722
+ if (!(number instanceof JsonNumber) || !/^-?[0-9]+$/u.test(number.raw))
6723
+ return { declaration: out, error: "max_age is not an integer" };
6724
+ const maxAge = BigInt(number.raw);
6725
+ if (maxAge < 0n || maxAge > MAX_CREATED_AT)
6726
+ return {
6727
+ declaration: out,
6728
+ error: "max_age is not an integer from 0 to 2^53 - 1"
6729
+ };
6730
+ return { declaration: { ...out, maxAge } };
6731
+ }
6732
+ function wellFormed(r) {
6733
+ const claim = r.claim;
6734
+ if (typeof claim !== "string" || !Object.hasOwn(CLAIMS, claim))
6735
+ return false;
6736
+ const spec = CLAIMS[claim];
6737
+ const names2 = [...COMMON];
6738
+ if (spec.added !== "")
6739
+ names2.push(spec.added);
6740
+ if (Object.hasOwn(r, "key_types"))
6741
+ names2.push("key_types");
6742
+ if (!hasMembers(r, names2) || r.binding_version !== BINDING_VERSION)
6743
+ return false;
6744
+ const method = r.method;
6745
+ if (typeof method !== "string")
6746
+ return false;
6747
+ for (const other of Object.values(CLAIMS))
6748
+ if (other.method === method && method !== spec.method)
6749
+ return false;
6750
+ const keys = r.keys;
6751
+ if (!Array.isArray(keys) || keys.length !== 2 || !isKey(keys[0]) || !isKey(keys[1]) || keys[0] >= keys[1])
6752
+ return false;
6753
+ const issued = parseProfileTime(r.issued_at);
6754
+ const notBefore = parseProfileTime(r.not_before);
6755
+ const notAfter = parseProfileTime(r.not_after);
6756
+ if (issued === void 0 || notBefore === void 0 || notAfter === void 0 || notBefore > issued || !(issued < notAfter))
6757
+ return false;
6758
+ if (r.revocation !== REVOCATION_METHOD)
6759
+ return false;
6760
+ const nonce = r.nonce;
6761
+ if (typeof nonce !== "string")
6762
+ return false;
6763
+ if (Object.hasOwn(r, "key_types")) {
6764
+ const list2 = r.key_types;
6765
+ if (!Array.isArray(list2) || list2.length !== 2 || typeof list2[0] !== "string" || typeof list2[1] !== "string")
6766
+ return false;
6767
+ if (list2.includes(KEY_BIP340) && !NONCE32.test(nonce))
6768
+ return false;
6769
+ }
6770
+ if (!Array.isArray(r.sigs))
6771
+ return false;
6772
+ for (const entry of r.sigs)
6773
+ if (!isObject(entry) || !hasMembers(entry, ["key_id", "sig"]))
6774
+ return false;
6775
+ if (spec.added === "delegator")
6776
+ return r.delegator === keys[0] || r.delegator === keys[1];
6777
+ if (spec.added === "credential") {
6778
+ const c = r.credential;
6779
+ return isObject(c) && hasMembers(c, ["issuer", "method", "digest"]) && isKey(c.issuer) && typeof c.method === "string" && isKey(c.digest);
6780
+ }
6781
+ return true;
6782
+ }
6783
+ function keyTypes(r) {
6784
+ const list2 = r.key_types;
6785
+ if (!Array.isArray(list2))
6786
+ return [KEY_ED25519, KEY_ED25519];
6787
+ return [list2[0], list2[1]];
6788
+ }
6789
+ async function verifyHex(key, sig, message) {
6790
+ if (typeof sig !== "string" || !HEX128.test(sig) || !HEX64.test(key))
6791
+ return false;
6792
+ return verifyEd25519Strict(hexToBytes4(key), hexToBytes4(sig), message);
6793
+ }
6794
+ function verifyNostr(key, sig, version, signed) {
6795
+ if (!isObject(sig) || !hasMembers(sig, ["created_at", "sig"]))
6796
+ return false;
6797
+ const text2 = sig.sig;
6798
+ if (typeof text2 !== "string" || !HEX128.test(text2))
6799
+ return false;
6800
+ const number = sig.created_at;
6801
+ if (!(number instanceof JsonNumber) || !/^-?[0-9]+$/u.test(number.raw))
6802
+ return false;
6803
+ const createdAt = BigInt(number.raw);
6804
+ if (createdAt < 0n || createdAt > MAX_CREATED_AT)
6805
+ return false;
6806
+ if (!HEX64.test(key))
6807
+ return false;
6808
+ const event = `[0,"${key}",${createdAt},${NOSTR_KIND},[],"${version}:${hex2(sha256(signed))}"]`;
6809
+ return verifyBip340(key, sha256(encoder4.encode(event)), text2);
6810
+ }
6811
+ async function verifySig(key, keyType, sig, version, signed) {
6812
+ if (keyType === KEY_ED25519)
6813
+ return verifyHex(key, sig, signed);
6814
+ if (keyType === KEY_BIP340)
6815
+ return verifyNostr(key, sig, version, signed);
6816
+ return false;
6817
+ }
6818
+ async function signatures(r, keys, types) {
6819
+ if (r.method !== CLAIMS[r.claim].method)
6820
+ return STATUS_NOT_CHECKED;
6821
+ for (const t of types)
6822
+ if (t !== KEY_ED25519 && t !== KEY_BIP340)
6823
+ return STATUS_NOT_CHECKED;
6824
+ let input;
6825
+ try {
6826
+ input = jcs(without(r, "sigs"));
6827
+ } catch {
6828
+ return STATUS_FAIL;
6829
+ }
6830
+ const sigs = r.sigs;
6831
+ if (sigs.length !== 2)
6832
+ return STATUS_FAIL;
6833
+ for (let i = 0; i < 2; i++) {
6834
+ const entry = sigs[i];
6835
+ if (entry.key_id !== keys[i] || !await verifySig(keys[i], types[i], entry.sig, BINDING_VERSION, input))
6836
+ return STATUS_FAIL;
6837
+ }
6838
+ return STATUS_PASS;
6839
+ }
6840
+ async function revocation(digest, keys, types, ts, statements) {
6841
+ for (const octets of statements) {
6842
+ let s;
6843
+ try {
6844
+ s = decodeStrictJson(octets);
6845
+ } catch {
6846
+ continue;
6847
+ }
6848
+ if (!isObject(s) || !hasMembers(s, [
6849
+ "revocation_version",
6850
+ "binding",
6851
+ "key_id",
6852
+ "revoked_at",
6853
+ "sig"
6854
+ ]) || s.revocation_version !== REVOCATION_VERSION || s.binding !== digest || s.key_id !== keys[0] && s.key_id !== keys[1])
6855
+ continue;
6856
+ const keyType = s.key_id === keys[1] ? types[1] : types[0];
6857
+ let signed;
6858
+ try {
6859
+ signed = jcs(without(s, "sig"));
6860
+ } catch {
6861
+ continue;
6862
+ }
6863
+ if (!await verifySig(s.key_id, keyType, s.sig, REVOCATION_VERSION, signed))
6864
+ continue;
6865
+ const revokedAt = parseProfileTime(s.revoked_at);
6866
+ if (revokedAt === void 0)
6867
+ continue;
6868
+ for (const t of ts)
6869
+ if (revokedAt <= t)
6870
+ return STATUS_FAIL;
6871
+ }
6872
+ return STATUS_NOT_CHECKED;
6873
+ }
6874
+ function listEntries(list2) {
6875
+ let value;
6876
+ try {
6877
+ value = decodeStrictJson(list2);
6878
+ } catch {
6879
+ return void 0;
6880
+ }
6881
+ if (!Array.isArray(value))
6882
+ return void 0;
6883
+ const entries = [];
6884
+ for (const item of value)
6885
+ try {
6886
+ entries.push(jcs(item));
6887
+ } catch {
6888
+ }
6889
+ return entries;
6890
+ }
6891
+ var floorSeconds = (t) => t >= 0n ? t / NS : -((-t + NS - 1n) / NS);
6892
+ function whyNot(declared, received, l, digest, ts) {
6893
+ if (declared.error !== void 0)
6894
+ return declared.error;
6895
+ const d = declared.declaration;
6896
+ if (d.binding !== digest)
6897
+ return "the declaration names another binding";
6898
+ if (d.listDigest !== received)
6899
+ return "list_digest is not the digest of the list received";
6900
+ if (listEntries(l.list) === void 0)
6901
+ return "the list is not a JSON array";
6902
+ if (ts.length === 0)
6903
+ return "no time T was asked about";
6904
+ const asOf = parseProfileTime(d.asOf);
6905
+ for (const t of ts)
6906
+ if (asOf < t)
6907
+ return "as_of is earlier than a time asked about";
6908
+ if (asOf > l.evaluatedAt)
6909
+ return "as_of is later than the evaluation time";
6910
+ if (floorSeconds(l.evaluatedAt) - floorSeconds(asOf) > d.maxAge)
6911
+ return "the evaluation time is more than max_age after as_of";
6912
+ return "";
6913
+ }
6914
+ function listReport(l, digest, ts) {
6915
+ const received = hex2(sha256(toBytes(l.list)));
6916
+ const declared = parseDeclaration(l.declaration);
6917
+ const d = declared.declaration;
6918
+ const reason = whyNot(declared, received, l, digest, ts);
6919
+ return {
6920
+ profile: d.profile,
6921
+ assertedBy: d.assertedBy,
6922
+ listDigest: received,
6923
+ asOf: d.asOf,
6924
+ counts: reason === "",
6925
+ ...reason === "" ? {} : { reason }
6926
+ };
6927
+ }
6928
+ async function credentialStatus(c, keys, opts) {
6929
+ if (opts.credential === void 0)
6930
+ return STATUS_NOT_PRESENT;
6931
+ const verify = opts.credentialVerifiers?.[c.method];
6932
+ if (verify === void 0 || !Object.hasOwn(opts.credentialVerifiers, c.method))
6933
+ return STATUS_NOT_CHECKED;
6934
+ const octets = toBytes(opts.credential);
6935
+ if (hex2(sha256(octets)) !== c.digest)
6936
+ return STATUS_FAIL;
6937
+ const status2 = await verify(octets, c, keys);
6938
+ return status2 === STATUS_PASS || status2 === STATUS_FAIL || status2 === STATUS_INCONCLUSIVE ? status2 : STATUS_FAIL;
6939
+ }
6940
+ async function verifyBinding(record, ts, opts = {}) {
6941
+ const properties = {};
6942
+ const proves = [];
6943
+ let value;
6944
+ try {
6945
+ value = decodeStrictJson(record);
6946
+ } catch {
6947
+ properties[PROPERTY_FORM] = STATUS_FAIL;
6948
+ return { properties, proves };
6949
+ }
6950
+ if (!isObject(value)) {
6951
+ properties[PROPERTY_FORM] = STATUS_FAIL;
6952
+ return { properties, proves };
6953
+ }
6954
+ const r = value;
6955
+ let bindingDigest2;
6956
+ try {
6957
+ bindingDigest2 = hex2(sha256(jcs(without(r, "sigs"))));
6958
+ } catch {
6959
+ }
6960
+ const claim = typeof r.claim === "string" ? r.claim : void 0;
6961
+ let named;
6962
+ if (Array.isArray(r.keys) && r.keys.length === 2 && typeof r.keys[0] === "string" && typeof r.keys[1] === "string")
6963
+ named = [r.keys[0], r.keys[1]];
6964
+ const head2 = {
6965
+ ...claim === void 0 ? {} : { claim },
6966
+ ...named === void 0 ? {} : { keys: named },
6967
+ ...bindingDigest2 === void 0 ? {} : { bindingDigest: bindingDigest2 }
6968
+ };
6969
+ if (!wellFormed(r)) {
6970
+ properties[PROPERTY_FORM] = STATUS_FAIL;
6971
+ return { ...head2, properties, proves };
6972
+ }
6973
+ properties[PROPERTY_FORM] = STATUS_PASS;
6974
+ const keys = named;
6975
+ const delegator = typeof r.delegator === "string" ? r.delegator : void 0;
6976
+ const notBeforeText = r.not_before;
6977
+ const notAfterText = r.not_after;
6978
+ const types = keyTypes(r);
6979
+ properties[PROPERTY_SIGNATURES] = await signatures(r, keys, types);
6980
+ properties[PROPERTY_WINDOW] = ts.length === 0 ? STATUS_NOT_CHECKED : STATUS_PASS;
6981
+ const notBefore = parseProfileTime(notBeforeText);
6982
+ const notAfter = parseProfileTime(notAfterText);
6983
+ for (const t of ts)
6984
+ if (t < notBefore || !(t < notAfter))
6985
+ properties[PROPERTY_WINDOW] = STATUS_FAIL;
6986
+ let statements = (opts.revocations ?? []).map(toBytes);
6987
+ if (opts.revocationList !== void 0)
6988
+ statements = [
6989
+ ...statements,
6990
+ ...listEntries(opts.revocationList.list) ?? []
6991
+ ];
6992
+ properties[PROPERTY_REVOCATION] = await revocation(bindingDigest2 ?? "", keys, types, ts, statements);
6993
+ let list2;
6994
+ if (opts.revocationList !== void 0) {
6995
+ list2 = listReport(opts.revocationList, bindingDigest2 ?? "", ts);
6996
+ if (list2.counts && properties[PROPERTY_REVOCATION] !== STATUS_FAIL)
6997
+ properties[PROPERTY_REVOCATION] = STATUS_PASS;
6998
+ }
6999
+ if (claim === CLAIM_SAME_ORGANIZATION) {
7000
+ const c = r.credential;
7001
+ properties[PROPERTY_CREDENTIAL] = await credentialStatus({
7002
+ issuer: c.issuer,
7003
+ method: c.method,
7004
+ digest: c.digest
7005
+ }, keys, opts);
7006
+ }
7007
+ if (properties[PROPERTY_SIGNATURES] === STATUS_PASS) {
7008
+ proves.push(PROVES_CONTROL, CLAIMS[claim].states);
7009
+ if (properties[PROPERTY_CREDENTIAL] === STATUS_PASS)
7010
+ proves.push(PROVES_CREDENTIALED);
7011
+ }
7012
+ return {
7013
+ ...head2,
7014
+ ...delegator === void 0 ? {} : { delegator },
7015
+ notBefore: notBeforeText,
7016
+ notAfter: notAfterText,
7017
+ properties,
7018
+ proves,
7019
+ ...list2 === void 0 ? {} : { revocationList: list2 }
7020
+ };
7021
+ }
7022
+ function bindingApplies(report) {
7023
+ const p = report.properties;
7024
+ return p[PROPERTY_FORM] === STATUS_PASS && p[PROPERTY_SIGNATURES] === STATUS_PASS && p[PROPERTY_WINDOW] === STATUS_PASS && p[PROPERTY_REVOCATION] !== STATUS_FAIL;
7025
+ }
7026
+ function bindingBindsPair(report, a, b) {
7027
+ const keys = report.keys;
7028
+ return keys !== void 0 && (keys[0] === a && keys[1] === b || keys[0] === b && keys[1] === a);
7029
+ }
7030
+ var bindingAppliesTo = (report, a, b) => bindingBindsPair(report, a, b) && bindingApplies(report);
7031
+
6453
7032
  // node_modules/@action-state-group/agent-action-capsule/dist/composed.js
6454
7033
  var COMPOSED_KIND = "composed/v1";
6455
7034
  var object3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
@@ -6465,7 +7044,8 @@ var EvidenceGraph = (() => {
6465
7044
  "pre_agreed_identifier",
6466
7045
  "shared_artifact_digest",
6467
7046
  "issued_receipt",
6468
- "same_interval"
7047
+ "same_interval",
7048
+ "controller_binding"
6469
7049
  ]);
6470
7050
  var JOIN_STATES = /* @__PURE__ */ new Set(["agree", "mismatch", "unjoined", "one_sided"]);
6471
7051
  var ok2 = (value) => ({ ok: true, value });
@@ -6628,7 +7208,10 @@ var EvidenceGraph = (() => {
6628
7208
  compareCarried
6629
7209
  });
6630
7210
  }
6631
- var joinKey = (j) => `${j.members[0]}\0${j.members[1]}\0${j.basis}\0${j.pointer ?? ""}`;
7211
+ var joinKey = (j) => {
7212
+ const key = `${j.members[0]}\0${j.members[1]}\0${j.basis}`;
7213
+ return j.pointer === void 0 ? key : `${key}\0${j.pointer}`;
7214
+ };
6632
7215
  function parseComposed(raw) {
6633
7216
  if (!object3(raw))
6634
7217
  return bad("not_an_object");
@@ -6671,9 +7254,7 @@ var EvidenceGraph = (() => {
6671
7254
  const parsed = parseJoin(rawJoin, memberIds);
6672
7255
  if (!parsed.ok)
6673
7256
  return bad(`join:${i}:${parsed.reason}`);
6674
- let key = joinKey(parsed.value);
6675
- if (parsed.value.pointer === void 0)
6676
- key += "\0absent";
7257
+ const key = joinKey(parsed.value);
6677
7258
  if (seen.has(key))
6678
7259
  return bad(`join_duplicate:${i}`);
6679
7260
  seen.add(key);
@@ -6773,16 +7354,143 @@ var EvidenceGraph = (() => {
6773
7354
  return false;
6774
7355
  return await sha256Hex(utf82.encode(value.value)) === digest;
6775
7356
  }
6776
- async function derivedState(j, byId, missing) {
7357
+ var isEmptyHistory = (body) => Array.isArray(body.records) && body.records.length === 0 && !Object.hasOwn(body, "root");
7358
+ function recordSide(record, pointer) {
7359
+ const resolved = resolvePointer(record, pointer);
7360
+ return {
7361
+ key: resolved.ok && isString(resolved.value) ? resolved.value : void 0,
7362
+ at: parseRecordTime(record.timestamp)
7363
+ };
7364
+ }
7365
+ function ed25519Keys(record) {
7366
+ if (!Object.hasOwn(record, "key_types"))
7367
+ return true;
7368
+ const types = record.key_types;
7369
+ return Array.isArray(types) && types.length === 2 && types[0] === "ed25519" && types[1] === "ed25519";
7370
+ }
7371
+ function implemented(record) {
7372
+ const want = record.claim === "same_organization_credentialed" ? "dual_signature_credential/0" : "dual_signature/0";
7373
+ return record.method === want && ed25519Keys(record);
7374
+ }
7375
+ var SIGNATURE_HEX = /^[0-9a-f]{128}$/u;
7376
+ async function bindingReport(record, times, statements) {
7377
+ let octets;
7378
+ try {
7379
+ octets = jcs(record);
7380
+ } catch {
7381
+ const types = record.key_types;
7382
+ const shaped = !Object.hasOwn(record, "key_types") || Array.isArray(types) && types.length === 2 && isString(types[0]) && isString(types[1]);
7383
+ if (!shaped || ed25519Keys(record))
7384
+ return { wellFormed: false };
7385
+ const standin = { ...record };
7386
+ if (Array.isArray(record.sigs))
7387
+ standin.sigs = record.sigs.map((e) => object3(e) && Object.hasOwn(e, "sig") ? { ...e, sig: "" } : e);
7388
+ try {
7389
+ jcs(standin);
7390
+ } catch {
7391
+ return { wellFormed: false };
7392
+ }
7393
+ return bindingReport(standin, times, statements);
7394
+ }
7395
+ const report = await verifyBinding(octets, times, {
7396
+ revocations: statements
7397
+ });
7398
+ if (Object.hasOwn(record, "key_types")) {
7399
+ const list2 = record.key_types;
7400
+ if (!Array.isArray(list2) || list2.length !== 2 || !isString(list2[0]) || !isString(list2[1]))
7401
+ return { report, wellFormed: false };
7402
+ }
7403
+ if (!isString(record.nonce) || record.nonce === "")
7404
+ return { report, wellFormed: false };
7405
+ if (Array.isArray(record.sigs) && ed25519Keys(record)) {
7406
+ for (const entry of record.sigs)
7407
+ if (!object3(entry) || !isString(entry.sig) || !SIGNATURE_HEX.test(entry.sig))
7408
+ return { report, wellFormed: false };
7409
+ }
7410
+ let formReport = report;
7411
+ if (!ed25519Keys(record)) {
7412
+ const subject = { ...record };
7413
+ delete subject.key_types;
7414
+ try {
7415
+ formReport = await verifyBinding(jcs(subject), [], {});
7416
+ } catch {
7417
+ return { report, wellFormed: false };
7418
+ }
7419
+ }
7420
+ return {
7421
+ report,
7422
+ wellFormed: formReport.properties[PROPERTY_FORM] === STATUS_PASS
7423
+ };
7424
+ }
7425
+ async function bindingDigest(record) {
7426
+ const { sigs: _sigs, ...rest } = record;
7427
+ try {
7428
+ return await sha256Hex(jcs(rest));
7429
+ } catch {
7430
+ return void 0;
7431
+ }
7432
+ }
7433
+ async function controllerBindingLink(j, a, b, options) {
7434
+ if (j.identifier === void 0)
7435
+ return { linked: false, derivable: false };
7436
+ const times = a.at !== void 0 && b.at !== void 0 ? [a.at, b.at] : [];
7437
+ const statements = [];
7438
+ for (const statement of options.bindingRevocations ?? [])
7439
+ try {
7440
+ statements.push(jcs(statement));
7441
+ } catch {
7442
+ }
7443
+ let derivable = false;
7444
+ for (const record of options.controllerBindings ?? []) {
7445
+ if (!object3(record))
7446
+ continue;
7447
+ if (await bindingDigest(record) !== j.identifier)
7448
+ continue;
7449
+ const { report, wellFormed: wellFormed3 } = await bindingReport(record, times, statements);
7450
+ if (!wellFormed3) {
7451
+ derivable = true;
7452
+ continue;
7453
+ }
7454
+ if (!implemented(record))
7455
+ continue;
7456
+ derivable = true;
7457
+ if (report !== void 0 && a.key !== void 0 && b.key !== void 0 && bindingAppliesTo(report, a.key, b.key))
7458
+ return { linked: true, derivable: true };
7459
+ }
7460
+ return { linked: false, derivable };
7461
+ }
7462
+ async function derivedState(j, byId, missing, checkpoints, options) {
6777
7463
  const a = byId.get(j.members[0]);
6778
7464
  const b = byId.get(j.members[1]);
6779
- const artifacts = [a, b].filter((m) => m.outcome === "artifact").length;
6780
- if (artifacts === 0)
6781
- return { derived: "unjoined", differences: [] };
6782
- if (artifacts === 1)
6783
- return { derived: "one_sided", differences: [] };
6784
- if (missing.has(a.id) || missing.has(b.id))
7465
+ if ([a, b].some((m) => m.outcome === "artifact" && missing.has(m.id) && m.body === void 0))
6785
7466
  return { differences: [] };
7467
+ const withRecords = [];
7468
+ const empty = [];
7469
+ for (const m of [a, b]) {
7470
+ if (m.outcome !== "artifact")
7471
+ continue;
7472
+ if (m.body !== void 0 && isEmptyHistory(m.body))
7473
+ empty.push(m);
7474
+ else
7475
+ withRecords.push(m);
7476
+ }
7477
+ if (withRecords.length === 0)
7478
+ return { derived: "unjoined", differences: [] };
7479
+ if (withRecords.length === 1) {
7480
+ if (empty.length === 0 || j.basis !== "controller_binding")
7481
+ return { derived: "one_sided", differences: [] };
7482
+ const full = withRecords[0];
7483
+ if (j.pointer === void 0)
7484
+ return { differences: [] };
7485
+ const record = rootRecord(full);
7486
+ const checkpoint = checkpoints.get(empty[0].id);
7487
+ if (record === void 0 || checkpoint === void 0)
7488
+ return { differences: [] };
7489
+ const { linked: linked2, derivable } = await controllerBindingLink(j, recordSide(record, j.pointer), { key: checkpoint.keyId, at: parseRecordTime(checkpoint.timestamp) }, options);
7490
+ if (!derivable)
7491
+ return { differences: [] };
7492
+ return { derived: linked2 ? "one_sided" : "unjoined", differences: [] };
7493
+ }
6786
7494
  const ra = rootRecord(a);
6787
7495
  const rb = rootRecord(b);
6788
7496
  if (ra === void 0 || rb === void 0)
@@ -6797,6 +7505,13 @@ var EvidenceGraph = (() => {
6797
7505
  const vb = resolvePointer(rb, j.pointer);
6798
7506
  linked = va.ok && vb.ok && isString(va.value) && isString(vb.value) && va.value === vb.value;
6799
7507
  }
7508
+ } else if (j.basis === "controller_binding") {
7509
+ if (j.pointer === void 0)
7510
+ return { differences: [] };
7511
+ const link = await controllerBindingLink(j, recordSide(ra, j.pointer), recordSide(rb, j.pointer), options);
7512
+ if (!link.derivable)
7513
+ return { differences: [] };
7514
+ linked = link.linked;
6800
7515
  } else {
6801
7516
  return { differences: [] };
6802
7517
  }
@@ -6832,6 +7547,8 @@ var EvidenceGraph = (() => {
6832
7547
  const keyB = rootRecord(b)?.key_id;
6833
7548
  if (isString(keyA) && isString(keyB) && keyA === keyB)
6834
7549
  reasons.push("same_key_id");
7550
+ if (j.basis === "controller_binding")
7551
+ reasons.push("controller_binding");
6835
7552
  if (reasons.length > 0)
6836
7553
  return {
6837
7554
  members: j.members,
@@ -6846,7 +7563,7 @@ var EvidenceGraph = (() => {
6846
7563
  qualifier: "custody_declared"
6847
7564
  };
6848
7565
  }
6849
- async function verifyMember(m, declaredMissing, verifyMemberBundle) {
7566
+ async function verifyMember(m, declaredMissing, verifyMemberBundle, checkpoints) {
6850
7567
  const closure = [];
6851
7568
  const failed2 = [];
6852
7569
  const withheld = [];
@@ -6884,8 +7601,11 @@ var EvidenceGraph = (() => {
6884
7601
  bundle = {
6885
7602
  graphClosure: verification.graphClosure,
6886
7603
  intervalCoverage: verification.intervalCoverage,
6887
- perRecordMembership: verification.perRecordMembership
7604
+ perRecordMembership: verification.perRecordMembership,
7605
+ ...verification.history === void 0 ? {} : { history: verification.history }
6888
7606
  };
7607
+ if (verification.emptyHistoryCheckpoint !== void 0)
7608
+ checkpoints.set(m.id, verification.emptyHistoryCheckpoint);
6889
7609
  if (m.response !== void 0) {
6890
7610
  if (m.response.request_digest !== m.requestDigest) {
6891
7611
  findings.push("response_request_digest_mismatch");
@@ -6941,7 +7661,7 @@ var EvidenceGraph = (() => {
6941
7661
  function sortedUnique(values) {
6942
7662
  return [...new Set(values)].sort(octetCompare);
6943
7663
  }
6944
- async function verifyComposed(raw, verifyMemberBundle) {
7664
+ async function verifyComposed(raw, verifyMemberBundle, options = {}) {
6945
7665
  const parsed = parseComposed(raw);
6946
7666
  if (!parsed.ok)
6947
7667
  return {
@@ -6976,10 +7696,11 @@ var EvidenceGraph = (() => {
6976
7696
  closureFindings.push(`missing_names_undeclared_member:${id}`);
6977
7697
  }
6978
7698
  const byId = /* @__PURE__ */ new Map();
7699
+ const checkpoints = /* @__PURE__ */ new Map();
6979
7700
  const members = [];
6980
7701
  for (const m of block.members) {
6981
7702
  byId.set(m.id, m);
6982
- const result3 = await verifyMember(m, missing.has(m.id), verifyMemberBundle);
7703
+ const result3 = await verifyMember(m, missing.has(m.id), verifyMemberBundle, checkpoints);
6983
7704
  members.push(result3.member);
6984
7705
  closureFindings.push(...result3.closure);
6985
7706
  failed2.push(...result3.failed);
@@ -7007,7 +7728,7 @@ var EvidenceGraph = (() => {
7007
7728
  const joins = [];
7008
7729
  const corroborations = [];
7009
7730
  for (const j of block.joins) {
7010
- const { derived, differences } = await derivedState(j, byId, missing);
7731
+ const { derived, differences } = await derivedState(j, byId, missing, checkpoints, options);
7011
7732
  const result3 = derived === void 0 ? "not_derivable" : derived === j.state ? "derived_matches" : "join_state_mismatch";
7012
7733
  joins.push({
7013
7734
  members: j.members,
@@ -7150,16 +7871,16 @@ var EvidenceGraph = (() => {
7150
7871
  * A definite-length argument of any width in its shortest form, refusing
7151
7872
  * indefinite lengths and an argument a narrower head could carry.
7152
7873
  */
7153
- argument(add2) {
7154
- if (add2 < 24)
7155
- return BigInt(add2);
7156
- const width = add2 === 24 ? 1 : add2 === 25 ? 2 : add2 === 26 ? 4 : add2 === 27 ? 8 : 0;
7874
+ argument(add3) {
7875
+ if (add3 < 24)
7876
+ return BigInt(add3);
7877
+ const width = add3 === 24 ? 1 : add3 === 25 ? 2 : add3 === 26 ? 4 : add3 === 27 ? 8 : 0;
7157
7878
  if (width === 0)
7158
7879
  throw new SyntaxError("unsupported or indefinite CBOR length");
7159
7880
  let value = 0n;
7160
7881
  for (let i = 0; i < width; i += 1)
7161
7882
  value = value << 8n | BigInt(this.byte());
7162
- if (value < [24n, 1n << 8n, 1n << 16n, 1n << 32n][add2 - 24])
7883
+ if (value < [24n, 1n << 8n, 1n << 16n, 1n << 32n][add3 - 24])
7163
7884
  throw new SyntaxError("CBOR argument is not in its shortest form");
7164
7885
  return value;
7165
7886
  }
@@ -7174,22 +7895,22 @@ var EvidenceGraph = (() => {
7174
7895
  item(depth = 0) {
7175
7896
  if (depth > 8)
7176
7897
  throw new SyntaxError("CBOR nesting too deep");
7177
- const first = this.byte(), major = first >>> 5, add2 = first & 31;
7898
+ const first = this.byte(), major = first >>> 5, add3 = first & 31;
7178
7899
  if (major === 7) {
7179
- if (add2 >= 28)
7900
+ if (add3 >= 28)
7180
7901
  throw new SyntaxError("reserved or break CBOR value");
7181
7902
  const start = this.offset - 1;
7182
- if (add2 === 24 && this.byte() < 32)
7903
+ if (add3 === 24 && this.byte() < 32)
7183
7904
  throw new SyntaxError("non-preferred CBOR simple value");
7184
- if (add2 > 24) {
7185
- const raw = this.take(add2 === 25 ? 2 : add2 === 26 ? 4 : 8);
7905
+ if (add3 > 24) {
7906
+ const raw = this.take(add3 === 25 ? 2 : add3 === 26 ? 4 : 8);
7186
7907
  const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
7187
- if (add2 === 26 ? notShortest(view.getFloat32(0), fitsHalf) : add2 === 27 && notShortest(view.getFloat64(0), (v) => Math.fround(v) === v))
7908
+ if (add3 === 26 ? notShortest(view.getFloat32(0), fitsHalf) : add3 === 27 && notShortest(view.getFloat64(0), (v) => Math.fround(v) === v))
7188
7909
  throw new SyntaxError("CBOR float is not in its shortest form");
7189
7910
  }
7190
7911
  return { opaque: `s${this.data.subarray(start, this.offset).join()}` };
7191
7912
  }
7192
- const argument = this.argument(add2);
7913
+ const argument = this.argument(add3);
7193
7914
  if (major === 0 || major === 1)
7194
7915
  return { int: major === 0 ? argument : -1n - argument };
7195
7916
  const length = Number(argument);
@@ -7420,7 +8141,7 @@ var EvidenceGraph = (() => {
7420
8141
  "category_coverage_consistency"
7421
8142
  ];
7422
8143
  var object6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof JsonNumber);
7423
- var HEX128 = /^[0-9a-f]{128}$/u;
8144
+ var HEX1282 = /^[0-9a-f]{128}$/u;
7424
8145
  var ABSOLUTE_URI = /^[A-Za-z][A-Za-z0-9+.-]*:(?:[A-Za-z0-9._~!$&'()*+,;=:@/?-]|%[0-9A-Fa-f]{2})*$/u;
7425
8146
  var PRIVATE_SET = "x-";
7426
8147
  var CONTRADICTED_BY_A_RECORD = ["ABSENT", "WITHHELD"];
@@ -7436,7 +8157,7 @@ var EvidenceGraph = (() => {
7436
8157
  });
7437
8158
  return jcs({ category_coverage: unsigned, root });
7438
8159
  }
7439
- function wellFormed(member) {
8160
+ function wellFormed2(member) {
7440
8161
  if (!object6(member))
7441
8162
  return false;
7442
8163
  if (typeof member.set !== "string" || member.set === "")
@@ -7462,7 +8183,7 @@ var EvidenceGraph = (() => {
7462
8183
  const signer = member.signer;
7463
8184
  if (!object6(signer) || !isHex64(signer.key_id))
7464
8185
  return false;
7465
- if (typeof member.signature !== "string" || !HEX128.test(member.signature))
8186
+ if (typeof member.signature !== "string" || !HEX1282.test(member.signature))
7466
8187
  return false;
7467
8188
  }
7468
8189
  return true;
@@ -7533,7 +8254,7 @@ var EvidenceGraph = (() => {
7533
8254
  if (!Object.hasOwn(bundle, "category_coverage"))
7534
8255
  return null;
7535
8256
  const member = bundle.category_coverage;
7536
- if (!wellFormed(member))
8257
+ if (!wellFormed2(member))
7537
8258
  return {
7538
8259
  category_coverage_form: "FAIL",
7539
8260
  category_coverage_signature: "NOT_CHECKED",
@@ -7640,52 +8361,52 @@ var EvidenceGraph = (() => {
7640
8361
  offset += Number(length);
7641
8362
  return value2;
7642
8363
  };
7643
- const argument = (add2) => {
7644
- if (add2 < 24)
7645
- return BigInt(add2);
7646
- const width = [1, 2, 4, 8][add2 - 24];
8364
+ const argument = (add3) => {
8365
+ if (add3 < 24)
8366
+ return BigInt(add3);
8367
+ const width = [1, 2, 4, 8][add3 - 24];
7647
8368
  if (width === void 0)
7648
8369
  throw new SyntaxError("indefinite or reserved CBOR length");
7649
8370
  let value2 = 0n;
7650
8371
  for (let i = 0; i < width; i += 1)
7651
8372
  value2 = value2 << 8n | BigInt(byte());
7652
- if (value2 < [24n, 1n << 8n, 1n << 16n, 1n << 32n][add2 - 24])
8373
+ if (value2 < [24n, 1n << 8n, 1n << 16n, 1n << 32n][add3 - 24])
7653
8374
  throw new SyntaxError("CBOR argument is not in its shortest form");
7654
8375
  return value2;
7655
8376
  };
7656
8377
  const item = (depth) => {
7657
8378
  if (depth > MAX_RECEIPT_DEPTH)
7658
8379
  throw new SyntaxError("CBOR nesting too deep");
7659
- const first = byte(), major = first >>> 5, add2 = first & 31;
8380
+ const first = byte(), major = first >>> 5, add3 = first & 31;
7660
8381
  if (major === 7) {
7661
- if (add2 === 20)
8382
+ if (add3 === 20)
7662
8383
  return false;
7663
- if (add2 === 21)
8384
+ if (add3 === 21)
7664
8385
  return true;
7665
- if (add2 === 22)
8386
+ if (add3 === 22)
7666
8387
  return null;
7667
- if (add2 === 23)
8388
+ if (add3 === 23)
7668
8389
  return void 0;
7669
- if (add2 < 20)
7670
- return new CborSimple(add2);
7671
- if (add2 === 24) {
8390
+ if (add3 < 20)
8391
+ return new CborSimple(add3);
8392
+ if (add3 === 24) {
7672
8393
  const value3 = byte();
7673
8394
  if (value3 < 32)
7674
8395
  throw new SyntaxError("non-preferred simple value");
7675
8396
  return new CborSimple(value3);
7676
8397
  }
7677
- if (add2 >= 28)
8398
+ if (add3 >= 28)
7678
8399
  throw new SyntaxError("reserved or break CBOR value");
7679
- const raw = take(add2 === 25 ? 2n : add2 === 26 ? 4n : 8n);
8400
+ const raw = take(add3 === 25 ? 2n : add3 === 26 ? 4n : 8n);
7680
8401
  const view = new DataView(raw.buffer, raw.byteOffset, raw.byteLength);
7681
- if (add2 === 25)
8402
+ if (add3 === 25)
7682
8403
  return halfFloat(view.getUint16(0));
7683
- const value2 = add2 === 26 ? view.getFloat32(0) : view.getFloat64(0);
7684
- if (Number.isNaN(value2) || fitsHalf2(value2) || add2 === 27 && Math.fround(value2) === value2)
8404
+ const value2 = add3 === 26 ? view.getFloat32(0) : view.getFloat64(0);
8405
+ if (Number.isNaN(value2) || fitsHalf2(value2) || add3 === 27 && Math.fround(value2) === value2)
7685
8406
  throw new SyntaxError("CBOR float is not in its shortest form");
7686
8407
  return value2;
7687
8408
  }
7688
- const length = argument(add2);
8409
+ const length = argument(add3);
7689
8410
  if (major === 0)
7690
8411
  return length;
7691
8412
  if (major === 1)
@@ -7935,36 +8656,36 @@ var EvidenceGraph = (() => {
7935
8656
  }
7936
8657
 
7937
8658
  // node_modules/@action-state-group/agent-action-capsule/dist/spki.js
7938
- var hex2 = (value) => Uint8Array.from(value.match(/../gu), (byte) => Number.parseInt(byte, 16));
8659
+ var hex3 = (value) => Uint8Array.from(value.match(/../gu), (byte) => Number.parseInt(byte, 16));
7939
8660
  var equal = (a, b) => a.length === b.length && a.every((byte, i) => byte === b[i]);
7940
8661
  var big = (bytes) => bytes.reduce((value, byte) => value << 8n | BigInt(byte), 0n);
7941
- var ED25519_ALGORITHM2 = hex2("06032b6570");
7942
- var P256_ALGORITHM2 = hex2("06072a8648ce3d020106082a8648ce3d030107");
7943
- var P = 2n ** 256n - 2n ** 224n + 2n ** 192n + 2n ** 96n - 1n;
8662
+ var ED25519_ALGORITHM2 = hex3("06032b6570");
8663
+ var P256_ALGORITHM2 = hex3("06072a8648ce3d020106082a8648ce3d030107");
8664
+ var P2 = 2n ** 256n - 2n ** 224n + 2n ** 192n + 2n ** 96n - 1n;
7944
8665
  var B = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn;
7945
- function modPow(base, exponent) {
8666
+ function modPow2(base, exponent) {
7946
8667
  let result3 = 1n;
7947
- base %= P;
8668
+ base %= P2;
7948
8669
  while (exponent > 0n) {
7949
8670
  if (exponent & 1n)
7950
- result3 = result3 * base % P;
7951
- base = base * base % P;
8671
+ result3 = result3 * base % P2;
8672
+ base = base * base % P2;
7952
8673
  exponent >>= 1n;
7953
8674
  }
7954
8675
  return result3;
7955
8676
  }
7956
8677
  function onP256(point) {
7957
- const rhs = (x) => ((x * x * x - 3n * x + B) % P + P) % P;
8678
+ const rhs = (x) => ((x * x * x - 3n * x + B) % P2 + P2) % P2;
7958
8679
  if (point[0] === 4 && point.length === 65) {
7959
8680
  const x = big(point.subarray(1, 33)), y = big(point.subarray(33));
7960
- return x < P && y < P && y * y % P === rhs(x);
8681
+ return x < P2 && y < P2 && y * y % P2 === rhs(x);
7961
8682
  }
7962
8683
  if ((point[0] === 2 || point[0] === 3) && point.length === 33) {
7963
8684
  const x = big(point.subarray(1));
7964
- if (x >= P)
8685
+ if (x >= P2)
7965
8686
  return false;
7966
8687
  const value = rhs(x);
7967
- return value === 0n || modPow(value, (P - 1n) / 2n) === 1n;
8688
+ return value === 0n || modPow2(value, (P2 - 1n) / 2n) === 1n;
7968
8689
  }
7969
8690
  return false;
7970
8691
  }
@@ -8055,7 +8776,7 @@ var EvidenceGraph = (() => {
8055
8776
  }
8056
8777
  var ED25519_SPKI_PREFIX = hexToBytes("302a300506032b6570032100");
8057
8778
  var ed25519Spki = (raw) => concat(ED25519_SPKI_PREFIX, raw);
8058
- var hex3 = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
8779
+ var hex4 = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
8059
8780
  function fromHex(value) {
8060
8781
  if (typeof value !== "string" || !/^(?:\s*[0-9A-Fa-f]{2})*\s*$/u.test(value))
8061
8782
  throw new TypeError("not hex");
@@ -8088,7 +8809,7 @@ var EvidenceGraph = (() => {
8088
8809
  continue;
8089
8810
  byId.set(await sha256Hex(der), der);
8090
8811
  if (der.length === 44 && der.subarray(0, 12).every((b, i) => b === ED25519_SPKI_PREFIX[i]))
8091
- byId.set(hex3(der.subarray(12)), der);
8812
+ byId.set(hex4(der.subarray(12)), der);
8092
8813
  }
8093
8814
  const keys = [];
8094
8815
  for (const keyId of keyIds) {
@@ -8598,7 +9319,7 @@ ${body}
8598
9319
  });
8599
9320
  var object8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof JsonNumber);
8600
9321
  var integer = (value) => typeof value === "number" && Number.isSafeInteger(value);
8601
- var hex4 = (value) => Uint8Array.from(value.match(/../gu), (byte) => Number.parseInt(byte, 16));
9322
+ var hex5 = (value) => Uint8Array.from(value.match(/../gu), (byte) => Number.parseInt(byte, 16));
8602
9323
  function base64UrlDecode(value) {
8603
9324
  const padded = `${value}${"=".repeat((4 - value.length % 4) % 4)}`;
8604
9325
  const binary = atob(padded.replaceAll("-", "+").replaceAll("_", "/"));
@@ -8696,14 +9417,39 @@ ${body}
8696
9417
  } catch {
8697
9418
  }
8698
9419
  const collected = await collectRecords(bundle.records);
8699
- const [intervalCoverage, perRecordMembership] = await completeness(bundle, collected.records);
9420
+ let graphClosure;
9421
+ let intervalCoverage;
9422
+ let perRecordMembership;
9423
+ let history;
9424
+ let emptyHistoryCheckpoint;
9425
+ if (emptyHistory(bundle)) {
9426
+ graphClosure = emptyHistoryForm(bundle);
9427
+ const noRecords = {
9428
+ status: "withheld",
9429
+ findings: ["no_records"]
9430
+ };
9431
+ [intervalCoverage, perRecordMembership] = [noRecords, noRecords];
9432
+ const signed = (await strictCheckpoint(object8(bundle.checkpoint) ? bundle.checkpoint : {}, object8(bundle.completeness_certificate) ? bundle.completeness_certificate : {})).signed;
9433
+ if (signed !== void 0)
9434
+ emptyHistoryCheckpoint = {
9435
+ keyId: signed.key_id,
9436
+ timestamp: signed.timestamp
9437
+ };
9438
+ if (graphClosure.status === "pass")
9439
+ history = { state: "none", since: signed?.timestamp ?? null };
9440
+ } else {
9441
+ graphClosure = graph(bundle, collected.records, collected.findings);
9442
+ [intervalCoverage, perRecordMembership] = await completeness(bundle, collected.records);
9443
+ }
8700
9444
  return {
8701
9445
  ...digest === void 0 ? {} : { bundleDigest: digest },
8702
- graphClosure: graph(bundle, collected.records, collected.findings),
9446
+ graphClosure,
8703
9447
  intervalCoverage,
8704
9448
  perRecordMembership,
9449
+ ...history === void 0 ? {} : { history },
9450
+ ...emptyHistoryCheckpoint === void 0 ? {} : { emptyHistoryCheckpoint },
8705
9451
  disclosures: await disclosures(Object.hasOwn(bundle, "disclosures") ? bundle.disclosures : {}, collected.records),
8706
- extensions: await extensions(bundle, digest !== void 0),
9452
+ extensions: await extensions(bundle, digest !== void 0, options),
8707
9453
  countersignatures: Array.isArray(bundle.countersignatures) ? bundle.countersignatures.map((value) => ({
8708
9454
  value,
8709
9455
  status: "unverified"
@@ -8770,7 +9516,7 @@ ${body}
8770
9516
  ...invalidSignatures.map((r) => `producer_signature_invalid:${r.capsuleId}`),
8771
9517
  ...unclaimed.map((r) => `producer_signature_unclaimed:${r.capsuleId}`)
8772
9518
  ];
8773
- const signatures = invalidSignatures.length || unclaimed.length && options.requireSignature === true || !records.length ? fail(...signatureFindings) : {
9519
+ const signatures2 = invalidSignatures.length || unclaimed.length && options.requireSignature === true || !records.length ? fail(...signatureFindings) : {
8774
9520
  status: unclaimed.length ? "withheld" : "pass",
8775
9521
  findings: signatureFindings
8776
9522
  };
@@ -8794,7 +9540,7 @@ ${body}
8794
9540
  }
8795
9541
  const claims = [
8796
9542
  { name: "records", ...identity2 },
8797
- { name: "signatures", ...signatures },
9543
+ { name: "signatures", ...signatures2 },
8798
9544
  { name: "graph_closure", ...plain2.graphClosure },
8799
9545
  { name: "checkpoint", ...checkpoint.claim },
8800
9546
  { name: "interval_coverage", ...intervalCoverage },
@@ -8835,6 +9581,26 @@ ${body}
8835
9581
  }
8836
9582
  };
8837
9583
  }
9584
+ function emptyHistory(bundle) {
9585
+ return Array.isArray(bundle.records) && bundle.records.length === 0 && !Object.hasOwn(bundle, "root");
9586
+ }
9587
+ function emptyHistoryForm(bundle) {
9588
+ const findings = [];
9589
+ if (bundle.bundle_version !== "2" || bundle.bundle_kind !== "evidence-bundle/v2")
9590
+ findings.push("bundle_version_or_kind_invalid");
9591
+ const complete = object8(bundle.completeness) ? bundle.completeness : {};
9592
+ const missing = complete.missing;
9593
+ if (!object8(bundle.completeness) || complete.records_mode !== "complete" || complete.payloads_mode !== "none" || Object.hasOwn(complete, "missing") && (!Array.isArray(missing) || missing.length !== 0))
9594
+ findings.push("empty_history_completeness_invalid");
9595
+ for (const name of [
9596
+ "completeness_certificate",
9597
+ "disclosures",
9598
+ "disclosure_record"
9599
+ ])
9600
+ if (Object.hasOwn(bundle, name))
9601
+ findings.push(`empty_history_carries:${name}`);
9602
+ return findings.length > 0 ? fail(...findings) : pass();
9603
+ }
8838
9604
  var capsuleIdOf = (record) => typeof record.capsule_id === "string" ? record.capsule_id : "";
8839
9605
  function byCodePoint2(a, b) {
8840
9606
  const left = Array.from(a, (c) => c.codePointAt(0)), right = Array.from(b, (c) => c.codePointAt(0));
@@ -8906,7 +9672,7 @@ ${body}
8906
9672
  const members = object8(certificate) ? certificate.memberships : void 0;
8907
9673
  if (!object8(certificate) || !object8(members) || Object.hasOwn(certificate, "non_record_leaves") || certificate.range_root !== rootHex || certificate.log_id !== logId || typeof logId !== "string" || !isHex64(rootHex) || !integer(size))
8908
9674
  return fail("completeness_certificate_invalid");
8909
- const root = hex4(rootHex);
9675
+ const root = hex5(rootHex);
8910
9676
  const ids = (Array.isArray(bundle.records) ? bundle.records : []).filter(object8).map(capsuleIdOf);
8911
9677
  const findings = [], seen = /* @__PURE__ */ new Set();
8912
9678
  for (const id of ids) {
@@ -9075,7 +9841,7 @@ ${body}
9075
9841
  const membership = await selectedMembership(bundle, checkpoint.root, checkpoint.mmr_size, checkpoint.log_id);
9076
9842
  if (membership.status !== "pass")
9077
9843
  return [interval, membership];
9078
- const status2 = await authenticateCheckpoint(checkpoint, checkpoint.log_id, hex4(checkpoint.root), checkpoint.mmr_size);
9844
+ const status2 = await authenticateCheckpoint(checkpoint, checkpoint.log_id, hex5(checkpoint.root), checkpoint.mmr_size);
9079
9845
  if (status2 === "invalid")
9080
9846
  return [interval, fail("checkpoint_authentication_invalid")];
9081
9847
  return [
@@ -9115,7 +9881,7 @@ ${body}
9115
9881
  return void 0;
9116
9882
  const { fromSeq, toSeq, size, fromIndex, toIndex, witness } = range;
9117
9883
  return {
9118
- root: hex4(rootHex),
9884
+ root: hex5(rootHex),
9119
9885
  logId,
9120
9886
  firstSeq,
9121
9887
  lastSeq,
@@ -9149,7 +9915,7 @@ ${body}
9149
9915
  const raw = certificate.body_digests;
9150
9916
  if (leaves === void 0 || leaves !== BigInt(last) || proof.fromSeq !== first || proof.toSeq !== last || proof.fromIndex !== first - 1 || proof.toIndex !== last - 1 || !Array.isArray(raw) || raw.length !== last - first + 1 || !raw.every(isHex64))
9151
9917
  return false;
9152
- return verifyRange2(root, BigInt(proof.size), BigInt(proof.fromIndex), BigInt(proof.toIndex), raw.map(hex4), proof.proof);
9918
+ return verifyRange2(root, BigInt(proof.size), BigInt(proof.fromIndex), BigInt(proof.toIndex), raw.map(hex5), proof.proof);
9153
9919
  }
9154
9920
  async function memberships(root, logId, first, last, certificate, records, completeness2, checkpointSize) {
9155
9921
  const raw = certificate.memberships;
@@ -9272,10 +10038,10 @@ ${body}
9272
10038
  } : void 0;
9273
10039
  }
9274
10040
  async function verifyProof(root, identity2, proof, leafIndex = proof.leaf_index) {
9275
- const flattened = proof.witness.map(hex4);
10041
+ const flattened = proof.witness.map(hex5);
9276
10042
  if (proof.peaks_right.length)
9277
- flattened.push(await rootFromPeaks2(proof.peaks_right.map(hex4)));
9278
- flattened.push(...proof.peaks_left.map(hex4).toReversed());
10043
+ flattened.push(await rootFromPeaks2(proof.peaks_right.map(hex5)));
10044
+ flattened.push(...proof.peaks_left.map(hex5).toReversed());
9279
10045
  return verifyHexInclusion2(root, BigInt(proof.size), BigInt(leafIndex), identity2, flattened);
9280
10046
  }
9281
10047
  async function disclosures(raw, records) {
@@ -9328,14 +10094,19 @@ ${body}
9328
10094
  }
9329
10095
  return findings;
9330
10096
  }
9331
- async function extensions(bundle, covered) {
10097
+ async function extensions(bundle, covered, options) {
9332
10098
  const raw = bundle.extensions;
9333
10099
  if (!object8(raw))
9334
10100
  return [];
9335
10101
  const results = [];
9336
10102
  for (const kind of Object.keys(raw).sort()) {
9337
10103
  const interpreter = extensionInterpreter(kind, bundle);
9338
- const composed = kind === COMPOSED_KIND ? { composed: await verifyComposed(raw[kind], verifyBundle) } : {};
10104
+ const composed = kind === COMPOSED_KIND ? {
10105
+ composed: await verifyComposed(raw[kind], (member) => verifyBundle(member, { ...options, strict: false }), {
10106
+ controllerBindings: options.controllerBindings ?? [],
10107
+ bindingRevocations: options.bindingRevocations ?? []
10108
+ })
10109
+ } : {};
9339
10110
  results.push(interpreter === void 0 ? {
9340
10111
  kind,
9341
10112
  status: "uninterpreted",
@@ -9572,7 +10343,7 @@ ${body}
9572
10343
  }
9573
10344
 
9574
10345
  // node_modules/@action-state-group/agent-action-capsule/dist/calibration-summary.js
9575
- var isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
10346
+ var isObject2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
9576
10347
  var asString = (value) => typeof value === "string" ? value : void 0;
9577
10348
  var CALIBRATION_SUMMARY_V1 = "calibration-summary/v1";
9578
10349
  var HUMAN_RATING_V1 = "human-rating/v1";
@@ -9587,7 +10358,7 @@ ${body}
9587
10358
  };
9588
10359
  var isCount = (value) => Number.isSafeInteger(value) && value >= 0;
9589
10360
  var readKOfN = (value) => {
9590
- if (!isObject(value) || !hasExactly(value, ["k", "n"]))
10361
+ if (!isObject2(value) || !hasExactly(value, ["k", "n"]))
9591
10362
  return void 0;
9592
10363
  if (!isCount(value.k) || !isCount(value.n))
9593
10364
  return void 0;
@@ -9596,7 +10367,7 @@ ${body}
9596
10367
  return k <= n ? { k, n } : void 0;
9597
10368
  };
9598
10369
  var readCitation = (value, purpose) => {
9599
- if (!isObject(value) || !hasExactly(value, ["type", "digest_alg", "digest", "citation_purpose"]))
10370
+ if (!isObject2(value) || !hasExactly(value, ["type", "digest_alg", "digest", "citation_purpose"]))
9600
10371
  return void 0;
9601
10372
  const type = nonEmpty(value.type);
9602
10373
  const digest = asString(value.digest);
@@ -9605,7 +10376,7 @@ ${body}
9605
10376
  return { type, digest };
9606
10377
  };
9607
10378
  var readClause = (value) => {
9608
- if (!isObject(value) || !hasExactly(value, ["clause_ref", "agreement", "drift"]))
10379
+ if (!isObject2(value) || !hasExactly(value, ["clause_ref", "agreement", "drift"]))
9609
10380
  return void 0;
9610
10381
  const clauseRef = nonEmpty(value.clause_ref);
9611
10382
  const agreement = readKOfN(value.agreement);
@@ -9615,7 +10386,7 @@ ${body}
9615
10386
  return { clauseRef, agreement, drift };
9616
10387
  };
9617
10388
  function readCalibrationSummary(value) {
9618
- if (!isObject(value) || !hasExactly(value, [
10389
+ if (!isObject2(value) || !hasExactly(value, [
9619
10390
  "record_version",
9620
10391
  "record_id",
9621
10392
  "epistemic_type",
@@ -9639,7 +10410,7 @@ ${body}
9639
10410
  return { recordId, computedAt, judgePin, clauses };
9640
10411
  }
9641
10412
  function readHumanRating(value) {
9642
- if (!isObject(value) || !hasExactly(value, [
10413
+ if (!isObject2(value) || !hasExactly(value, [
9643
10414
  "record_version",
9644
10415
  "record_id",
9645
10416
  "epistemic_type",
@@ -9664,10 +10435,10 @@ ${body}
9664
10435
  var zoneStatement = (value) => /^\d{4}-\d{2}-\d{2}$/u.test(value) ? "date-only" : /^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:[Zz]|[+-]\d{2}:\d{2})$/u.test(value) ? "stated" : "not-stated";
9665
10436
  var EvidenceGraphError = class extends Error {
9666
10437
  };
9667
- var isObject2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
10438
+ var isObject3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
9668
10439
  var asString2 = (value) => typeof value === "string" ? value : void 0;
9669
10440
  var asNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
9670
- var objectOrEmpty = (value) => isObject2(value) ? value : {};
10441
+ var objectOrEmpty = (value) => isObject3(value) ? value : {};
9671
10442
  var calendarDay = (date) => {
9672
10443
  const match = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?([Zz]|[+-]\d{2}:\d{2})?)?$/u.exec(date);
9673
10444
  if (match === null)
@@ -9700,7 +10471,7 @@ ${body}
9700
10471
  var committedDigest = (record, field) => asString2(objectOrEmpty(objectOrEmpty(record.model_attestation).compute_attestation)[`${field}_digest`]);
9701
10472
  var logCoordinates = (memberships2, capsuleId) => {
9702
10473
  const membership = memberships2[capsuleId];
9703
- if (!isObject2(membership) || !isObject2(membership.log_coordinates))
10474
+ if (!isObject3(membership) || !isObject3(membership.log_coordinates))
9704
10475
  return void 0;
9705
10476
  const coordinates = membership.log_coordinates;
9706
10477
  const logId = asString2(coordinates.log_id);
@@ -9710,7 +10481,7 @@ ${body}
9710
10481
  };
9711
10482
  var status = (value) => value === "pass" || value === "fail" || value === "not_applicable" || value === "unjudgeable" ? value : void 0;
9712
10483
  var verdict = (value) => value === "pass" || value === "fail" || value === "unsure" ? value : void 0;
9713
- var actedOnReferences = (record) => Array.isArray(record.references) ? record.references.flatMap((reference) => isObject2(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" ? asString2(reference.digest) === void 0 ? [] : [asString2(reference.digest)] : []) : [];
10484
+ var actedOnReferences = (record) => Array.isArray(record.references) ? record.references.flatMap((reference) => isObject3(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" ? asString2(reference.digest) === void 0 ? [] : [asString2(reference.digest)] : []) : [];
9714
10485
  var committedDigests = (record) => {
9715
10486
  const agentInputDigest = committedDigest(record, "agent_input");
9716
10487
  const agentOutputDigest = committedDigest(record, "agent_output");
@@ -9722,17 +10493,17 @@ ${body}
9722
10493
  async function buildEvidenceGraph(input) {
9723
10494
  const context = await verifiedBundleContext(input);
9724
10495
  const bundle = context.bundle;
9725
- if (!isObject2(bundle) || !Array.isArray(bundle.records) || !isObject2(bundle.disclosures)) {
10496
+ if (!isObject3(bundle) || !Array.isArray(bundle.records) || !isObject3(bundle.disclosures)) {
9726
10497
  throw new EvidenceGraphError("bundle must contain records and disclosures");
9727
10498
  }
9728
10499
  const records = context.records;
9729
10500
  const rootRecord2 = context.root === void 0 ? void 0 : context.recordIndex.get(context.root);
9730
10501
  if (rootRecord2 === void 0) {
9731
- throw new EvidenceGraphError(bundle.records.some((record) => isObject2(record) && record.capsule_id === context.root) ? "root aggregate payload is not disclosed" : "root aggregate payload not disclosed");
10502
+ throw new EvidenceGraphError(bundle.records.some((record) => isObject3(record) && record.capsule_id === context.root) ? "root aggregate payload is not disclosed" : "root aggregate payload not disclosed");
9732
10503
  }
9733
10504
  const payloadOf = (record) => verifiedPayload(context, record.capsule_id, "agent_input");
9734
10505
  const rootPayload = payloadOf(rootRecord2);
9735
- if (!isObject2(rootPayload) || rootPayload.spec_version !== "evaluation-summary/v1") {
10506
+ if (!isObject3(rootPayload) || rootPayload.spec_version !== "evaluation-summary/v1") {
9736
10507
  throw new EvidenceGraphError("root aggregate payload is not disclosed");
9737
10508
  }
9738
10509
  const memberships2 = context.completeness.memberships;
@@ -9742,7 +10513,7 @@ ${body}
9742
10513
  crossCaseAggregation: asString2(rootPayload.cross_case_aggregation)
9743
10514
  },
9744
10515
  ...Object.hasOwn(rootPayload, "per_axis") ? { perAxis: rootPayload.per_axis } : {},
9745
- ...isObject2(rootPayload.counts) && asNumber(rootPayload.counts.reports) !== void 0 && asNumber(rootPayload.counts.unique_cases) !== void 0 ? {
10516
+ ...isObject3(rootPayload.counts) && asNumber(rootPayload.counts.reports) !== void 0 && asNumber(rootPayload.counts.unique_cases) !== void 0 ? {
9746
10517
  counts: {
9747
10518
  reports: asNumber(rootPayload.counts.reports),
9748
10519
  uniqueCases: asNumber(rootPayload.counts.unique_cases)
@@ -9762,7 +10533,7 @@ ${body}
9762
10533
  if (referenced === void 0)
9763
10534
  continue;
9764
10535
  const payload = payloadOf(referenced);
9765
- if (!isObject2(payload))
10536
+ if (!isObject3(payload))
9766
10537
  continue;
9767
10538
  if (payload.spec_version === "evaluation-report/v1")
9768
10539
  reportIds.add(id);
@@ -9775,7 +10546,7 @@ ${body}
9775
10546
  for (const reportId of reportIds) {
9776
10547
  const record = recordsById.get(reportId);
9777
10548
  const payload = payloadOf(record);
9778
- if (!isObject2(payload) || payload.spec_version !== "evaluation-report/v1")
10549
+ if (!isObject3(payload) || payload.spec_version !== "evaluation-report/v1")
9779
10550
  continue;
9780
10551
  const date = asString2(payload.date);
9781
10552
  if (date === void 0)
@@ -9789,7 +10560,7 @@ ${body}
9789
10560
  continue;
9790
10561
  const input2 = disclosureOf(context, actRecord.capsule_id, "agent_input");
9791
10562
  const output = disclosureOf(context, actRecord.capsule_id, "agent_output");
9792
- const inputCase = isObject2(input2.payload) && isObject2(input2.payload.case) ? input2.payload.case : {};
10563
+ const inputCase = isObject3(input2.payload) && isObject3(input2.payload.case) ? input2.payload.case : {};
9793
10564
  const caseId = asString2(inputCase.conversation_id);
9794
10565
  const turnIdx = asNumber(inputCase.turn_idx);
9795
10566
  const actResolvedLogCoordinates = logCoordinates(memberships2, actRecord.capsule_id);
@@ -9797,7 +10568,7 @@ ${body}
9797
10568
  capsuleId: actRecord.capsule_id,
9798
10569
  caseId: caseId ?? actRecord.capsule_id,
9799
10570
  turnIdx: turnIdx ?? Number.MAX_SAFE_INTEGER,
9800
- ...isObject2(input2.payload) ? { agentInput: input2.payload } : {},
10571
+ ...isObject3(input2.payload) ? { agentInput: input2.payload } : {},
9801
10572
  ...output.state === "disclosed" ? { agentOutput: output.payload } : {},
9802
10573
  agentInputDisclosure: input2.state,
9803
10574
  agentOutputDisclosure: output.state,
@@ -9809,19 +10580,19 @@ ${body}
9809
10580
  });
9810
10581
  }
9811
10582
  const cases = reportCases.flatMap((casePayload) => {
9812
- if (!isObject2(casePayload))
10583
+ if (!isObject3(casePayload))
9813
10584
  return [];
9814
10585
  const taskId = asString2(casePayload.task_id);
9815
10586
  const trial = asNumber(casePayload.trial);
9816
10587
  if (taskId === void 0 || trial === void 0)
9817
10588
  return [];
9818
10589
  const matchingActs = acts.filter((act) => {
9819
- const actCase = isObject2(act.agentInput) && isObject2(act.agentInput.case) ? act.agentInput.case : {};
10590
+ const actCase = isObject3(act.agentInput) && isObject3(act.agentInput.case) ? act.agentInput.case : {};
9820
10591
  return actCase.task_id === taskId && actCase.trial === trial;
9821
10592
  });
9822
10593
  const caseId = matchingActs[0]?.caseId ?? `${taskId}:${trial}`;
9823
10594
  const judgments = (Array.isArray(casePayload.axis_judgments) ? casePayload.axis_judgments : []).flatMap((judgment) => {
9824
- if (!isObject2(judgment))
10595
+ if (!isObject3(judgment))
9825
10596
  return [];
9826
10597
  const axisId = asString2(judgment.axis_id), outcomeId = asString2(judgment.outcome_id), judgmentStatus = status(judgment.status), rationale = asString2(judgment.rationale);
9827
10598
  return axisId === void 0 || outcomeId === void 0 || judgmentStatus === void 0 || rationale === void 0 ? [] : [
@@ -9845,7 +10616,7 @@ ${body}
9845
10616
  }
9846
10617
  ];
9847
10618
  });
9848
- const outcomes = (Array.isArray(payload.outcomes) ? payload.outcomes : []).flatMap((outcome) => isObject2(outcome) && asString2(outcome.outcome_id) !== void 0 && (outcome.role === "required" || outcome.role === "optional") ? [
10619
+ const outcomes = (Array.isArray(payload.outcomes) ? payload.outcomes : []).flatMap((outcome) => isObject3(outcome) && asString2(outcome.outcome_id) !== void 0 && (outcome.role === "required" || outcome.role === "optional") ? [
9849
10620
  {
9850
10621
  outcomeId: asString2(outcome.outcome_id),
9851
10622
  role: outcome.role,
@@ -9880,13 +10651,13 @@ ${body}
9880
10651
  report.day = position - origin + 1;
9881
10652
  }
9882
10653
  for (const record of records) {
9883
- if (!isObject2(record.chain) || record.chain.relation !== "io.evaluation.human_rates")
10654
+ if (!isObject3(record.chain) || record.chain.relation !== "io.evaluation.human_rates")
9884
10655
  continue;
9885
10656
  const reportId = asString2(record.chain.parent_capsule_id);
9886
10657
  if (reportId === void 0)
9887
10658
  continue;
9888
10659
  const payload = payloadOf(record);
9889
- const ratingVerdict = isObject2(payload) ? verdict(payload.verdict) : void 0;
10660
+ const ratingVerdict = isObject3(payload) ? verdict(payload.verdict) : void 0;
9890
10661
  const report = reports.find((candidate) => candidate.capsuleId === reportId);
9891
10662
  if (report !== void 0 && ratingVerdict !== void 0)
9892
10663
  report.ratings.push({
@@ -9898,7 +10669,7 @@ ${body}
9898
10669
  let calibration;
9899
10670
  for (const record of records) {
9900
10671
  const payload = payloadOf(record);
9901
- if (!isObject2(payload) || payload.record_version !== CALIBRATION_SUMMARY_V1)
10672
+ if (!isObject3(payload) || payload.record_version !== CALIBRATION_SUMMARY_V1)
9902
10673
  continue;
9903
10674
  const summary = readCalibrationSummary(payload);
9904
10675
  calibration = summary === void 0 ? { capsuleId: record.capsule_id, matchesSchema: false } : { capsuleId: record.capsule_id, matchesSchema: true, summary };
@@ -9992,6 +10763,7 @@ ${body}
9992
10763
  var REQUIREMENT_CLAIM = "requirement";
9993
10764
  var CLOSE_CLAIM = "close";
9994
10765
  var RECONCILE_CLAIM = "reconcile";
10766
+ var CALIBRATION_CLAIM = "calibration";
9995
10767
  var RECONCILE_TALLY_KEYS = Object.freeze([
9996
10768
  "matched",
9997
10769
  "a_only",
@@ -10013,7 +10785,7 @@ ${body}
10013
10785
  var UNVERIFIED_KEY_LABEL = "stated key_id (not verified)";
10014
10786
  function statedTimes(capsule) {
10015
10787
  const timestamp = asString2(capsule.timestamp);
10016
- const provenanceMode = isObject2(capsule.provenance_mode) ? capsule.provenance_mode : void 0;
10788
+ const provenanceMode = isObject3(capsule.provenance_mode) ? capsule.provenance_mode : void 0;
10017
10789
  return {
10018
10790
  ...timestamp === void 0 ? {} : { timestamp },
10019
10791
  ...provenanceMode === void 0 ? {} : { provenanceMode }
@@ -10024,7 +10796,7 @@ ${body}
10024
10796
  var CONTRACT_REF = /^[^@\s]+@[^@\s]+$/u;
10025
10797
  var nonNegativeInteger = (value) => Number.isSafeInteger(value) && value >= 0;
10026
10798
  function digestRefFindings(path2, value) {
10027
- if (!isObject2(value))
10799
+ if (!isObject3(value))
10028
10800
  return [`${path2}: not an object`];
10029
10801
  const findings = [];
10030
10802
  if (value.digest_alg !== "SHA-256")
@@ -10034,7 +10806,7 @@ ${body}
10034
10806
  return findings;
10035
10807
  }
10036
10808
  function presentationFindings(path2, value) {
10037
- if (!isObject2(value))
10809
+ if (!isObject3(value))
10038
10810
  return [`${path2}: not an object`];
10039
10811
  const findings = [];
10040
10812
  switch (value.kind) {
@@ -10119,7 +10891,7 @@ ${body}
10119
10891
  return later;
10120
10892
  }
10121
10893
  function claimFindings(path2, value) {
10122
- if (!isObject2(value))
10894
+ if (!isObject3(value))
10123
10895
  return [`${path2}: not an object`];
10124
10896
  const findings = [];
10125
10897
  for (const member of CLAIM_REQUIRED)
@@ -10154,7 +10926,7 @@ ${body}
10154
10926
  findings.push(`${path2}.verdict: out_of_scope where the requirement does not allow it`);
10155
10927
  if (Object.hasOwn(value, "type") && value.type !== REQUIREMENT_CLAIM)
10156
10928
  findings.push(`${path2}.verdict: out_of_scope on a ${String(value.type)} claim`);
10157
- if (isObject2(value.presentation) && value.presentation.status === "NOT_APPLICABLE")
10929
+ if (isObject3(value.presentation) && value.presentation.status === "NOT_APPLICABLE")
10158
10930
  findings.push(`${path2}.presentation.status: NOT_APPLICABLE on an out_of_scope claim`);
10159
10931
  }
10160
10932
  if (!Array.isArray(value.evidence))
@@ -10167,14 +10939,14 @@ ${body}
10167
10939
  value.proofs.forEach((item, index) => {
10168
10940
  const itemPath = `${path2}.proofs[${index}]`;
10169
10941
  findings.push(...digestRefFindings(itemPath, item));
10170
- if (isObject2(item) && !oneOf(PROOF_KINDS, item.kind))
10942
+ if (isObject3(item) && !oneOf(PROOF_KINDS, item.kind))
10171
10943
  findings.push(`${itemPath}.kind`);
10172
10944
  });
10173
10945
  findings.push(...presentationFindings(`${path2}.presentation`, value.presentation));
10174
10946
  return findings;
10175
10947
  }
10176
10948
  function validateEvidenceResult(value) {
10177
- if (!isObject2(value))
10949
+ if (!isObject3(value))
10178
10950
  return ["result: not an object"];
10179
10951
  const findings = [];
10180
10952
  for (const key of Object.keys(value))
@@ -10188,10 +10960,10 @@ ${body}
10188
10960
  findings.push("claims: not a non-empty array");
10189
10961
  else
10190
10962
  value.claims.forEach((claim, index) => findings.push(...claimFindings(`claims[${index}]`, claim)));
10191
- const aggregate = isObject2(value.aggregate) ? value.aggregate : void 0;
10963
+ const aggregate = isObject3(value.aggregate) ? value.aggregate : void 0;
10192
10964
  if (aggregate === void 0)
10193
10965
  findings.push("aggregate: not an object");
10194
- const coverage = isObject2(aggregate?.coverage) ? aggregate.coverage : void 0;
10966
+ const coverage = isObject3(aggregate?.coverage) ? aggregate.coverage : void 0;
10195
10967
  if (coverage === void 0)
10196
10968
  findings.push("aggregate.coverage: not an object");
10197
10969
  else
@@ -10204,14 +10976,14 @@ ${body}
10204
10976
  findings.push(`aggregate.coverage.${member}: not a non-negative integer`);
10205
10977
  if (coverage !== void 0 && Object.hasOwn(coverage, "not_yet_in_force") && !nonNegativeInteger(coverage.not_yet_in_force))
10206
10978
  findings.push("aggregate.coverage.not_yet_in_force: not a non-negative integer");
10207
- if (coverage !== void 0 && Object.hasOwn(coverage, "requirements_covered") && (!Array.isArray(coverage.requirements_covered) || !coverage.requirements_covered.every((entry) => isObject2(entry) && typeof entry.contract_ref === "string" && CONTRACT_REF.test(entry.contract_ref) && nonEmptyString3(entry.requirement_ref))))
10979
+ if (coverage !== void 0 && Object.hasOwn(coverage, "requirements_covered") && (!Array.isArray(coverage.requirements_covered) || !coverage.requirements_covered.every((entry) => isObject3(entry) && typeof entry.contract_ref === "string" && CONTRACT_REF.test(entry.contract_ref) && nonEmptyString3(entry.requirement_ref))))
10208
10980
  findings.push("aggregate.coverage.requirements_covered: not an array of (contract_ref, requirement_ref) pairs");
10209
10981
  for (const member of ["plan_ref", "dataset_ref"])
10210
10982
  if (Object.hasOwn(value, member))
10211
10983
  findings.push(...digestRefFindings(member, value[member]));
10212
10984
  if (Object.hasOwn(value, "plan_ref") !== Object.hasOwn(value, "dataset_ref"))
10213
10985
  findings.push("plan_ref, dataset_ref: one is present without the other");
10214
- const buckets = isObject2(aggregate?.buckets) ? aggregate.buckets : void 0;
10986
+ const buckets = isObject3(aggregate?.buckets) ? aggregate.buckets : void 0;
10215
10987
  if (buckets === void 0)
10216
10988
  findings.push("aggregate.buckets: not an object");
10217
10989
  else {
@@ -10366,10 +11138,10 @@ ${body}
10366
11138
  }
10367
11139
  function reconcileBody(raw) {
10368
11140
  const body = raw.reconcile;
10369
- if (!isObject2(body))
11141
+ if (!isObject3(body))
10370
11142
  return void 0;
10371
11143
  const { join_key, peer, period, tallies, state_of_record } = body;
10372
- if (!nonEmptyString3(join_key) || !nonEmptyString3(peer) || !isObject2(period) || typeof period.start !== "string" || typeof period.end !== "string" || !isObject2(tallies) || !RECONCILE_TALLY_KEYS.every((key) => nonNegativeInteger(tallies[key])) || !oneOf(STATES_OF_RECORD, state_of_record))
11144
+ if (!nonEmptyString3(join_key) || !nonEmptyString3(peer) || !isObject3(period) || typeof period.start !== "string" || typeof period.end !== "string" || !isObject3(tallies) || !RECONCILE_TALLY_KEYS.every((key) => nonNegativeInteger(tallies[key])) || !oneOf(STATES_OF_RECORD, state_of_record))
10373
11145
  return void 0;
10374
11146
  return {
10375
11147
  joinKey: join_key,
@@ -10381,7 +11153,7 @@ ${body}
10381
11153
  }
10382
11154
  function closeBody(raw) {
10383
11155
  const body = raw.close;
10384
- if (!isObject2(body) || !oneOf(CLOSE_STATES, body.close_state) || !isObject2(body.close_ref) || !isHex64(body.close_ref.digest))
11156
+ if (!isObject3(body) || !oneOf(CLOSE_STATES, body.close_state) || !isObject3(body.close_ref) || !isHex64(body.close_ref.digest))
10385
11157
  return void 0;
10386
11158
  return body;
10387
11159
  }
@@ -10389,12 +11161,12 @@ ${body}
10389
11161
  const inbound = /* @__PURE__ */ new Map();
10390
11162
  for (const record of context.records) {
10391
11163
  const header = verifiedPayload(context, record.capsule_id, "agent_input");
10392
- if (!isObject2(header) || !Array.isArray(header.links))
11164
+ if (!isObject3(header) || !Array.isArray(header.links))
10393
11165
  continue;
10394
11166
  const bookId = asString2(header.book_id);
10395
11167
  const signer = await signerOf(record);
10396
11168
  for (const link of header.links) {
10397
- if (!isObject2(link) || !oneOf(CLOSE_LINK_TYPES, link.type))
11169
+ if (!isObject3(link) || !oneOf(CLOSE_LINK_TYPES, link.type))
10398
11170
  continue;
10399
11171
  const target = asString2(link.target);
10400
11172
  if (target === void 0)
@@ -10450,7 +11222,7 @@ ${body}
10450
11222
  }
10451
11223
  return { links, ignored };
10452
11224
  }
10453
- var actedOnReferences2 = (record) => Array.isArray(record.references) ? record.references.flatMap((reference) => isObject2(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" && typeof reference.digest === "string" ? [reference.digest] : []) : [];
11225
+ var actedOnReferences2 = (record) => Array.isArray(record.references) ? record.references.flatMap((reference) => isObject3(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" && typeof reference.digest === "string" ? [reference.digest] : []) : [];
10454
11226
  function resultDocument(context, root) {
10455
11227
  return resultCarriers(context, root)[0];
10456
11228
  }
@@ -10458,7 +11230,7 @@ ${body}
10458
11230
  const carriers = [];
10459
11231
  for (const member of ["agent_output", "agent_input"]) {
10460
11232
  const payload = verifiedPayload(context, record.capsule_id, member);
10461
- if (!isObject2(payload))
11233
+ if (!isObject3(payload))
10462
11234
  continue;
10463
11235
  if (payload.result_version === RESULT_VERSION)
10464
11236
  carriers.push({ member, form: "payload", document: payload });
@@ -10469,13 +11241,13 @@ ${body}
10469
11241
  }
10470
11242
  function nonResultDescription(context, root) {
10471
11243
  const header = verifiedPayload(context, root.capsule_id, "agent_input");
10472
- const recordType = isObject2(header) ? header.record_type : void 0;
11244
+ const recordType = isObject3(header) ? header.record_type : void 0;
10473
11245
  return typeof recordType === "string" ? `agent_input is a book record header of record_type ${JSON.stringify(recordType)}, not ${JSON.stringify(RESULT_RECORD_TYPE)}` : `no disclosed member carries an ${RESULT_VERSION} document or an ${RESULT_RECORD_TYPE} record header`;
10474
11246
  }
10475
11247
  async function isResultRoot(input) {
10476
11248
  const context = await verifiedBundleContext(input);
10477
11249
  const bundle = context.bundle;
10478
- if (!isObject2(bundle) || !Array.isArray(bundle.records) || !isObject2(bundle.disclosures))
11250
+ if (!isObject3(bundle) || !Array.isArray(bundle.records) || !isObject3(bundle.disclosures))
10479
11251
  return false;
10480
11252
  return carriesResultDocument(context);
10481
11253
  }
@@ -10512,7 +11284,7 @@ ${body}
10512
11284
  return typeof payload === "string" ? void 0 : payload;
10513
11285
  }
10514
11286
  async function carriedCapsuleId(header, payloads) {
10515
- if (!isObject2(header) || header.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
11287
+ if (!isObject3(header) || header.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
10516
11288
  return void 0;
10517
11289
  const commitments = Array.isArray(header.payload_commitments) ? header.payload_commitments.filter(isHex64) : [];
10518
11290
  const capsuleDigest = commitments[0];
@@ -10546,7 +11318,7 @@ ${body}
10546
11318
  } : void 0;
10547
11319
  }
10548
11320
  async function resolveCarriedInput(header, payloads, originals = {}) {
10549
- if (!isObject2(header) || header.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
11321
+ if (!isObject3(header) || header.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
10550
11322
  return void 0;
10551
11323
  const commitments = Array.isArray(header.payload_commitments) ? header.payload_commitments.filter(isHex64) : [];
10552
11324
  const capsuleDigest = commitments[0];
@@ -10622,12 +11394,12 @@ ${body}
10622
11394
  async function buildResultRoot(input) {
10623
11395
  const context = await verifiedBundleContext(input);
10624
11396
  const bundle = context.bundle;
10625
- if (!isObject2(bundle) || !Array.isArray(bundle.records) || !isObject2(bundle.disclosures))
11397
+ if (!isObject3(bundle) || !Array.isArray(bundle.records) || !isObject3(bundle.disclosures))
10626
11398
  throw new EvidenceGraphError("bundle must contain records and disclosures");
10627
11399
  const records = context.records;
10628
11400
  const rootRecord2 = context.root === void 0 ? void 0 : context.recordIndex.get(context.root);
10629
11401
  if (rootRecord2 === void 0)
10630
- throw new EvidenceGraphError(bundle.records.some((record) => isObject2(record) && record.capsule_id === context.root) ? "root record failed verification" : "root record not supplied");
11402
+ throw new EvidenceGraphError(bundle.records.some((record) => isObject3(record) && record.capsule_id === context.root) ? "root record failed verification" : "root record not supplied");
10631
11403
  const rootCarriers = resultCarriers(context, rootRecord2);
10632
11404
  const carried = rootCarriers[0];
10633
11405
  if (carried === void 0)
@@ -10640,7 +11412,7 @@ ${body}
10640
11412
  otherCarriers.push(record.capsule_id);
10641
11413
  if (otherCarriers.length > 0)
10642
11414
  throw new EvidenceGraphError(`bundle carries ${otherCarriers.length + 1} Result v0 documents: root ${rootRecord2.capsule_id} and ${otherCarriers.join(", ")}; a bundle has exactly one headline document`);
10643
- const findings = carried.form === "book" ? isObject2(carried.document) ? validateEvidenceResult(carried.document).map((finding) => `agent_input.statement.${finding}`) : [
11415
+ const findings = carried.form === "book" ? isObject3(carried.document) ? validateEvidenceResult(carried.document).map((finding) => `agent_input.statement.${finding}`) : [
10644
11416
  `agent_input.statement: ${carried.document === void 0 ? "absent" : "not an object"} on the ${RESULT_RECORD_TYPE} record header`
10645
11417
  ] : validateEvidenceResult(carried.document);
10646
11418
  if (findings.length > 0)
@@ -10648,15 +11420,15 @@ ${body}
10648
11420
  const document2 = carried.document;
10649
11421
  const memberships2 = context.completeness.memberships;
10650
11422
  const recordsById = context.recordIndex;
10651
- const bookPayloads = isObject2(bundle.extensions) && isObject2(bundle.extensions[BOOK_PAYLOADS_EXTENSION]) ? bundle.extensions[BOOK_PAYLOADS_EXTENSION] : {};
10652
- const inputOriginals = isObject2(bundle.extensions) && isObject2(bundle.extensions[AGENT_INPUT_ORIGINALS_EXTENSION]) ? bundle.extensions[AGENT_INPUT_ORIGINALS_EXTENSION] : {};
11423
+ const bookPayloads = isObject3(bundle.extensions) && isObject3(bundle.extensions[BOOK_PAYLOADS_EXTENSION]) ? bundle.extensions[BOOK_PAYLOADS_EXTENSION] : {};
11424
+ const inputOriginals = isObject3(bundle.extensions) && isObject3(bundle.extensions[AGENT_INPUT_ORIGINALS_EXTENSION]) ? bundle.extensions[AGENT_INPUT_ORIGINALS_EXTENSION] : {};
10653
11425
  let carriersById;
10654
11426
  const bookCarrier = async (id) => {
10655
11427
  if (carriersById === void 0) {
10656
11428
  carriersById = /* @__PURE__ */ new Map();
10657
11429
  for (const record of records) {
10658
11430
  const header = disclosureOf(context, record.capsule_id, "agent_input");
10659
- if (header.state !== "disclosed" || !isObject2(header.payload) || header.payload.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
11431
+ if (header.state !== "disclosed" || !isObject3(header.payload) || header.payload.record_type !== PUBLISHED_CAPSULE_RECORD_TYPE)
10660
11432
  continue;
10661
11433
  const carried2 = await carriedCapsuleId(header.payload, bookPayloads);
10662
11434
  if (carried2 !== void 0 && !recordsById.has(carried2.id))
@@ -10689,7 +11461,7 @@ ${body}
10689
11461
  carriedInputDigest: carriedCapsule.inputDigest,
10690
11462
  ...carriedCapsule.actionId === void 0 ? {} : { carriedActionId: carriedCapsule.actionId }
10691
11463
  },
10692
- ...carriedCapsule !== void 0 ? { stated: carriedCapsule.stated } : agentInput.state === "disclosed" && isObject2(agentInput.payload) && agentInput.payload.record_type === PUBLISHED_CAPSULE_RECORD_TYPE ? {} : { stated: statedTimes(record) },
11464
+ ...carriedCapsule !== void 0 ? { stated: carriedCapsule.stated } : agentInput.state === "disclosed" && isObject3(agentInput.payload) && agentInput.payload.record_type === PUBLISHED_CAPSULE_RECORD_TYPE ? {} : { stated: statedTimes(record) },
10693
11465
  agentOutput: disclosureOf(context, record.capsule_id, "agent_output"),
10694
11466
  ...agentInputDigest === void 0 ? {} : { agentInputDigest },
10695
11467
  ...agentOutputDigest === void 0 ? {} : { agentOutputDigest },
@@ -10727,15 +11499,15 @@ ${body}
10727
11499
  const supplied = closeRecord !== void 0;
10728
11500
  const peer = asString2(body.peer);
10729
11501
  const closeHeader = closeRecord === void 0 ? void 0 : verifiedPayload(context, closeRecord.capsule_id, "agent_input");
10730
- const closeBookId = isObject2(closeHeader) ? asString2(closeHeader.book_id) : void 0;
11502
+ const closeBookId = isObject3(closeHeader) ? asString2(closeHeader.book_id) : void 0;
10731
11503
  const closeSigner = closeRecord === void 0 ? {} : await signerOf(closeRecord);
10732
11504
  const { links, ignored } = counterpartyLinks({
10733
11505
  ...closeBookId === void 0 ? {} : { bookId: closeBookId },
10734
11506
  ...closeSigner
10735
11507
  }, peer, inbound.get(closeRef) ?? []);
10736
11508
  const derived = supplied && closeSigner.keyNotChecked !== true ? deriveCloseState(links) : void 0;
10737
- const peerCloseRef = isObject2(body.peer_close_ref) ? asString2(body.peer_close_ref.digest) : void 0;
10738
- const period = isObject2(body.period) ? {
11509
+ const peerCloseRef = isObject3(body.peer_close_ref) ? asString2(body.peer_close_ref.digest) : void 0;
11510
+ const period = isObject3(body.period) ? {
10739
11511
  start: asString2(body.period.start) ?? "",
10740
11512
  end: asString2(body.period.end) ?? ""
10741
11513
  } : void 0;
@@ -10782,7 +11554,7 @@ ${body}
10782
11554
  claims.push({
10783
11555
  id: raw.id,
10784
11556
  type,
10785
- recognized: type === REQUIREMENT_CLAIM || body !== void 0 || reconcile !== void 0,
11557
+ recognized: type === REQUIREMENT_CLAIM || type === CALIBRATION_CLAIM || body !== void 0 || reconcile !== void 0,
10786
11558
  contractRef: raw.contract_ref,
10787
11559
  requirementRef: raw.requirement_ref,
10788
11560
  tier: raw.tier,
@@ -10934,7 +11706,7 @@ ${body}
10934
11706
  const input = record.carriedInput ?? record.agentInput;
10935
11707
  if (input.state !== "disclosed")
10936
11708
  return void 0;
10937
- return isObject2(input.payload) ? input.payload : void 0;
11709
+ return isObject3(input.payload) ? input.payload : void 0;
10938
11710
  }
10939
11711
  function dayOf(payload) {
10940
11712
  const period = asString2(payload?.period);
@@ -10964,7 +11736,7 @@ ${body}
10964
11736
  const input = record.carriedInput ?? record.agentInput;
10965
11737
  switch (input.state) {
10966
11738
  case "disclosed":
10967
- return isObject2(input.payload) ? "disclosed" : "unreadable";
11739
+ return isObject3(input.payload) ? "disclosed" : "unreadable";
10968
11740
  case "withheld":
10969
11741
  return record.carriedInput !== void 0 && record.carriedCapsuleId === void 0 ? "invalid" : "withheld";
10970
11742
  case "disclosure_mismatch":
@@ -11094,7 +11866,7 @@ ${body}
11094
11866
  return "met";
11095
11867
  }
11096
11868
  function sealedCaseIds(payload) {
11097
- const c = isObject2(payload.case) ? payload.case : void 0;
11869
+ const c = isObject3(payload.case) ? payload.case : void 0;
11098
11870
  if (c === void 0)
11099
11871
  return [];
11100
11872
  const parts = [c.benchmark, c.domain, c.task_id, c.trial].map((v) => typeof v === "string" || typeof v === "number" ? String(v) : void 0);
@@ -11107,11 +11879,11 @@ ${body}
11107
11879
  return ids;
11108
11880
  }
11109
11881
  function transcriptTurns(payload) {
11110
- const interaction = isObject2(payload.agent_interaction) ? payload.agent_interaction : void 0;
11882
+ const interaction = isObject3(payload.agent_interaction) ? payload.agent_interaction : void 0;
11111
11883
  if (interaction === void 0 || !Array.isArray(interaction.messages))
11112
11884
  return void 0;
11113
11885
  return interaction.messages.flatMap((m) => {
11114
- if (!isObject2(m))
11886
+ if (!isObject3(m))
11115
11887
  return [];
11116
11888
  const role = asString2(m.role) ?? "unknown";
11117
11889
  const content = asString2(m.content);
@@ -11120,7 +11892,7 @@ ${body}
11120
11892
  {
11121
11893
  role,
11122
11894
  ...content === void 0 ? {} : { content },
11123
- toolCalls: calls.flatMap((call) => isObject2(call) ? [
11895
+ toolCalls: calls.flatMap((call) => isObject3(call) ? [
11124
11896
  {
11125
11897
  name: asString2(call.name) ?? "unnamed",
11126
11898
  arguments: JSON.stringify(call.arguments ?? null)
@@ -11142,7 +11914,7 @@ ${body}
11142
11914
  if (record !== void 0)
11143
11915
  records.push(record);
11144
11916
  }
11145
- const carriers = records.filter((r) => r.carriedInput?.state === "disclosed" && isObject2(r.carriedInput.payload) && transcriptTurns(r.carriedInput.payload) !== void 0);
11917
+ const carriers = records.filter((r) => r.carriedInput?.state === "disclosed" && isObject3(r.carriedInput.payload) && transcriptTurns(r.carriedInput.payload) !== void 0);
11146
11918
  if (carriers.length === 0)
11147
11919
  return { state: "absent" };
11148
11920
  if (sourceCapsuleId === void 0)
@@ -11337,7 +12109,7 @@ ${body}
11337
12109
  return tiers;
11338
12110
  }
11339
12111
  function pinComponents(value) {
11340
- if (!isObject2(value))
12112
+ if (!isObject3(value))
11341
12113
  return void 0;
11342
12114
  const modelId = asString2(value.model_id);
11343
12115
  const promptDigest = asString2(value.prompt_digest);
@@ -11350,7 +12122,7 @@ ${body}
11350
12122
  ...modelVersion === void 0 ? {} : { modelVersion },
11351
12123
  promptDigest,
11352
12124
  axesDigest,
11353
- ...isObject2(value.sampling_params) ? { samplingParams: value.sampling_params } : {}
12125
+ ...isObject3(value.sampling_params) ? { samplingParams: value.sampling_params } : {}
11354
12126
  };
11355
12127
  }
11356
12128
  function pinPreimage(pin) {
@@ -11475,17 +12247,17 @@ ${body}
11475
12247
  continue;
11476
12248
  }
11477
12249
  const recomputable = ratingsNotMatching === 0 && ratings.every((entry) => entry.judged !== void 0);
11478
- const clauses = summary.clauses.map((tally) => {
11479
- const bound = recomputable ? ratings.filter((entry) => entry.judged.requirementRef === tally.clauseRef && entry.agrees !== void 0) : [];
12250
+ const clauses = summary.clauses.map((tally2) => {
12251
+ const bound = recomputable ? ratings.filter((entry) => entry.judged.requirementRef === tally2.clauseRef && entry.agrees !== void 0) : [];
11480
12252
  if (bound.length === 0)
11481
- return { ...tally, agreementCheck: "not_recomputable" };
12253
+ return { ...tally2, agreementCheck: "not_recomputable" };
11482
12254
  const recomputed = {
11483
12255
  k: bound.filter((entry) => entry.agrees === true).length,
11484
12256
  n: bound.length
11485
12257
  };
11486
- const stated = tally.agreement;
12258
+ const stated = tally2.agreement;
11487
12259
  const agreementCheck = recomputed.k > stated.k || recomputed.n - recomputed.k > stated.n - stated.k ? "mismatch" : recomputed.k === stated.k && recomputed.n === stated.n ? "matches" : "not_recomputable";
11488
- return { ...tally, recomputedAgreement: recomputed, agreementCheck };
12260
+ return { ...tally2, recomputedAgreement: recomputed, agreementCheck };
11489
12261
  });
11490
12262
  const clauseRefs = new Set(summary.clauses.map((c) => c.clauseRef));
11491
12263
  const ratingsOutsideClauses = ratings.filter((entry) => entry.judged !== void 0 && !clauseRefs.has(entry.judged.requirementRef)).length;
@@ -11579,7 +12351,7 @@ ${body}
11579
12351
  function citedContract(result3, contractRef) {
11580
12352
  for (const record of result3.records.values()) {
11581
12353
  const input = record.carriedInput ?? record.agentInput;
11582
- if (input.state !== "disclosed" || !isObject2(input.payload))
12354
+ if (input.state !== "disclosed" || !isObject3(input.payload))
11583
12355
  continue;
11584
12356
  const doc = input.payload;
11585
12357
  const id = asString2(doc.id);
@@ -11617,7 +12389,7 @@ ${body}
11617
12389
  checks.set(split2.checkId, criteria);
11618
12390
  }
11619
12391
  const at = contractRef?.lastIndexOf("@") ?? -1;
11620
- const outcome = Array.isArray(contract?.requirements) ? contract.requirements.find((r) => isObject2(r) && r.profile === "outcome" && asString2(r.statement) !== void 0) : void 0;
12392
+ const outcome = Array.isArray(contract?.requirements) ? contract.requirements.find((r) => isObject3(r) && r.profile === "outcome" && asString2(r.statement) !== void 0) : void 0;
11621
12393
  return {
11622
12394
  pack: {
11623
12395
  id: contractRef === void 0 || at <= 0 ? NOT_STATED : contractRef.slice(0, at),
@@ -11652,7 +12424,7 @@ ${body}
11652
12424
  function contractCriteria(contract) {
11653
12425
  const ids = [];
11654
12426
  for (const requirement of contract?.requirements ?? []) {
11655
- const id = isObject2(requirement) ? asString2(requirement.id) : void 0;
12427
+ const id = isObject3(requirement) ? asString2(requirement.id) : void 0;
11656
12428
  if (id !== void 0 && criterionRef(id) !== void 0 && !ids.includes(id))
11657
12429
  ids.push(id);
11658
12430
  }
@@ -11724,24 +12496,24 @@ ${body}
11724
12496
  }
11725
12497
 
11726
12498
  // node_modules/@action-state-group/agent-action-capsule/dist/report-rows.js
11727
- var rowCitationDigests = (row2) => Array.isArray(row2.references) ? row2.references.flatMap((reference) => isObject2(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" ? asString2(reference.digest) === void 0 ? [] : [asString2(reference.digest)] : []) : [];
12499
+ var rowCitationDigests = (row2) => Array.isArray(row2.references) ? row2.references.flatMap((reference) => isObject3(reference) && reference.type === "agent-action-capsule" && reference.citation_purpose === "acted_on" ? asString2(reference.digest) === void 0 ? [] : [asString2(reference.digest)] : []) : [];
11728
12500
  async function buildReportRows(input) {
11729
12501
  const context = await verifiedBundleContext(input);
11730
12502
  const bundle = context.bundle;
11731
- if (!isObject2(bundle) || !Array.isArray(bundle.records) || !isObject2(bundle.disclosures)) {
12503
+ if (!isObject3(bundle) || !Array.isArray(bundle.records) || !isObject3(bundle.disclosures)) {
11732
12504
  return void 0;
11733
12505
  }
11734
12506
  const rootRecord2 = context.root === void 0 ? void 0 : context.recordIndex.get(context.root);
11735
12507
  if (rootRecord2 === void 0)
11736
12508
  return void 0;
11737
12509
  const rootPayload = verifiedPayload(context, rootRecord2.capsule_id, "agent_input");
11738
- if (!isObject2(rootPayload) || rootPayload.spec_version !== "report/v1")
12510
+ if (!isObject3(rootPayload) || rootPayload.spec_version !== "report/v1")
11739
12511
  return void 0;
11740
12512
  const memberships2 = context.completeness.memberships;
11741
12513
  const recordsById = context.recordIndex;
11742
12514
  const rows = [];
11743
12515
  for (const raw of Array.isArray(rootPayload.rows) ? rootPayload.rows : []) {
11744
- if (!isObject2(raw))
12516
+ if (!isObject3(raw))
11745
12517
  continue;
11746
12518
  const rowId = asString2(raw.row_id);
11747
12519
  const label = asString2(raw.label);
@@ -12171,10 +12943,10 @@ ${body}
12171
12943
  const strict2 = inputs.strict;
12172
12944
  if (strict2?.kindOk === true) {
12173
12945
  const claim = (name) => strict2.claims.find((entry) => entry.name === name);
12174
- const signatures = claim("signatures");
12175
- if (signatures?.status === "pass")
12946
+ const signatures2 = claim("signatures");
12947
+ if (signatures2?.status === "pass")
12176
12948
  ran("producer-signatures", true);
12177
- else if (signatures?.findings.some((f) => f.startsWith("producer_signature_invalid:")))
12949
+ else if (signatures2?.findings.some((f) => f.startsWith("producer_signature_invalid:")))
12178
12950
  ran("producer-signatures", false);
12179
12951
  const checkpoint = claim("checkpoint");
12180
12952
  if (checkpoint?.status === "pass")
@@ -13637,13 +14409,13 @@ ${body}
13637
14409
  var isObj3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
13638
14410
  var RECORD_HEADER_MEMBER = "evidence_record_header";
13639
14411
  var DATASET_VERSION = "evidence-dataset-v0";
13640
- var HEX64 = /^[0-9a-f]{64}$/u;
14412
+ var HEX642 = /^[0-9a-f]{64}$/u;
13641
14413
  var invalid = (message) => {
13642
14414
  throw new ChartRefusal("chart-dataset-invalid", message);
13643
14415
  };
13644
14416
  function digestRef(value, what) {
13645
14417
  if (value === void 0) return void 0;
13646
- if (!isObj3(value) || value.digest_alg !== "SHA-256" || typeof value.digest !== "string" || !HEX64.test(value.digest))
14418
+ if (!isObj3(value) || value.digest_alg !== "SHA-256" || typeof value.digest !== "string" || !HEX642.test(value.digest))
13647
14419
  return invalid(`${what} is not {digest_alg: "SHA-256", digest: <64-hex>}`);
13648
14420
  return value.digest;
13649
14421
  }
@@ -13725,7 +14497,7 @@ ${body}
13725
14497
  const rows = [];
13726
14498
  let last = -1;
13727
14499
  for (const raw of dataset.rows) {
13728
- if (!isObj3(raw) || Object.keys(raw).sort().join(",") !== "digest,digest_alg,record_type,seq" || !Number.isSafeInteger(raw.seq) || raw.seq <= last || typeof raw.record_type !== "string" || raw.digest_alg !== "SHA-256" || typeof raw.digest !== "string" || !HEX64.test(raw.digest))
14500
+ if (!isObj3(raw) || Object.keys(raw).sort().join(",") !== "digest,digest_alg,record_type,seq" || !Number.isSafeInteger(raw.seq) || raw.seq <= last || typeof raw.record_type !== "string" || raw.digest_alg !== "SHA-256" || typeof raw.digest !== "string" || !HEX642.test(raw.digest))
13729
14501
  return invalid(
13730
14502
  "a dataset row is not {seq, record_type, digest_alg, digest}, in seq order"
13731
14503
  );
@@ -14876,12 +15648,12 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
14876
15648
  var laneOf = (view, role) => view.lanes.find((l) => l.role === role);
14877
15649
  var keyOf = (chart) => chart.keys.find((k) => k !== "x");
14878
15650
  function tallyOf(lane, day) {
14879
- const tally = { good: 0, bad: 0, open: 0 };
15651
+ const tally2 = { good: 0, bad: 0, open: 0 };
14880
15652
  for (const g of groupsOn(lane.chart, day)) {
14881
15653
  const cls = lane.classes[String(g.key[keyOf(lane.chart)])];
14882
- tally[cls] += g.value ?? 0;
15654
+ tally2[cls] += g.value ?? 0;
14883
15655
  }
14884
- return tally;
15656
+ return tally2;
14885
15657
  }
14886
15658
  var sumOf = (lane, day) => groupsOn(lane.chart, day).reduce((n, g) => n + (g.value ?? 0), 0);
14887
15659
  function scaleOf(t) {
@@ -15547,7 +16319,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
15547
16319
  if (record === void 0) return void 0;
15548
16320
  const input = record.carriedInput ?? record.agentInput;
15549
16321
  if (input.state !== "disclosed") return void 0;
15550
- return isObject2(input.payload) ? input.payload : void 0;
16322
+ return isObject3(input.payload) ? input.payload : void 0;
15551
16323
  }
15552
16324
  function dayOf2(payload) {
15553
16325
  const period = asString2(payload?.period);
@@ -16006,7 +16778,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16006
16778
  `;
16007
16779
 
16008
16780
  // src/subject-history.ts
16009
- var HEX642 = /^[0-9a-f]{64}$/u;
16781
+ var HEX643 = /^[0-9a-f]{64}$/u;
16010
16782
  var BAND = /^e\+(\d{1,2})$/u;
16011
16783
  var MAX_LABELS = 8;
16012
16784
  var MAX_LABEL = 60;
@@ -16046,7 +16818,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16046
16818
  let followUpOf;
16047
16819
  if (grouped) {
16048
16820
  if (value.customer_handle !== void 0) {
16049
- if (typeof value.customer_handle !== "string" || !HEX642.test(value.customer_handle))
16821
+ if (typeof value.customer_handle !== "string" || !HEX643.test(value.customer_handle))
16050
16822
  return void 0;
16051
16823
  handle = value.customer_handle;
16052
16824
  }
@@ -16640,15 +17412,15 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16640
17412
  }
16641
17413
  function builtCommit() {
16642
17414
  if (false) return void 0;
16643
- return commitPrefix("0e00716a96b9bad56001701a414493867678703d");
17415
+ return commitPrefix("f2d81949dc581616086404b72071594aa5f7ea57");
16644
17416
  }
16645
17417
  var commit = builtCommit();
16646
17418
  var unreleased = false;
16647
17419
  var VIEWER_BUILD = {
16648
17420
  viewer: "@action-state-group/capsule-viewer",
16649
- viewerVersion: "0.12.0",
17421
+ viewerVersion: "0.13.0",
16650
17422
  verifier: "@action-state-group/agent-action-capsule",
16651
- verifierVersion: "0.13.0",
17423
+ verifierVersion: "0.13.1",
16652
17424
  cllVersion: "0.3.0",
16653
17425
  ...commit === void 0 ? {} : { commit },
16654
17426
  ...unreleased ? { unreleased: true } : {}
@@ -16710,12 +17482,12 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16710
17482
  "module_sha256",
16711
17483
  "bundle"
16712
17484
  ]);
16713
- var isObject3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
17485
+ var isObject4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
16714
17486
  function checkPresentationFragment(value) {
16715
17487
  const fail2 = (why) => {
16716
17488
  throw new FragmentDecodeError(`presentation fragment: ${why}`);
16717
17489
  };
16718
- if (!isObject3(value)) fail2("not a JSON object");
17490
+ if (!isObject4(value)) fail2("not a JSON object");
16719
17491
  const v = value;
16720
17492
  for (const key of Object.keys(v))
16721
17493
  if (!FRAGMENT_MEMBERS.has(key))
@@ -16734,12 +17506,12 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16734
17506
  fail2("theme_css is not a string");
16735
17507
  if (v.wording !== void 0) {
16736
17508
  const w = v.wording;
16737
- if (!isObject3(w) || Object.keys(w).some((k) => k !== "pack" && k !== "sha256") || typeof w.pack !== "string" || !isHex64(w.sha256))
17509
+ if (!isObject4(w) || Object.keys(w).some((k) => k !== "pack" && k !== "sha256") || typeof w.pack !== "string" || !isHex64(w.sha256))
16738
17510
  fail2("wording is not {pack, sha256}");
16739
17511
  }
16740
17512
  if (v.contract !== void 0) {
16741
17513
  const c = v.contract;
16742
- if (!isObject3(c) || Object.keys(c).some((k) => k !== "text" && k !== "sha256") || typeof c.text !== "string" || !isHex64(c.sha256))
17514
+ if (!isObject4(c) || Object.keys(c).some((k) => k !== "text" && k !== "sha256") || typeof c.text !== "string" || !isHex64(c.sha256))
16743
17515
  fail2("contract is not {text, sha256}");
16744
17516
  }
16745
17517
  if (!isHex64(v.core_runtime_sha256))
@@ -16901,6 +17673,10 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
16901
17673
  "lines.headline.nothing-applied": "{n} had no rule that applied.",
16902
17674
  "lines.drill.show.one": "Show the {n} conversation",
16903
17675
  "lines.drill.show.other": "Show the {n} conversations",
17676
+ "lines.fn.records": "\xB9 Records are the sealed items in this bundle ({records}); a conversation is the report's subject, made of one or more records ({n}).",
17677
+ "lines.fn.resolved.tiered": "\xB2 Resolved means every rule that applied was met, and at least one applied. A rule the contract marks informational never changes the answer.",
17678
+ "lines.fn.resolved": "\xB2 Resolved means every rule that applied was met, and at least one applied.",
17679
+ "lines.fn.readonly": "\xB3 This page is read-only: it records nothing the reader does. A disagreement leaves the page as an evidence request or a dispute.",
16904
17680
  "lines.na-note.one": "{n} rule check did not apply to the conversation and count as met beside a met rule.",
16905
17681
  "lines.na-note.other": "{n} rule checks did not apply to the conversation and count as met beside a met rule.",
16906
17682
  "lines.rules.h": "Results rule by rule",
@@ -17161,6 +17937,8 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
17161
17937
  "front.agg.requirements.other": "{n} requirements",
17162
17938
  "front.agg.unknown.one": "{n} evaluation with an unknown result",
17163
17939
  "front.agg.unknown.other": "{n} evaluations with an unknown result",
17940
+ "front.agg.calibration.one": "{n} calibration check of the judge, not counted as evaluations",
17941
+ "front.agg.calibration.other": "{n} calibration checks of the judge, not counted as evaluations",
17164
17942
  "front.agg.later.one": "{n} evaluation not yet in force",
17165
17943
  "front.agg.later.other": "{n} evaluations not yet in force",
17166
17944
  "front.agg.mismatch": "count mismatch: the claims give {recomputed}",
@@ -17509,6 +18287,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
17509
18287
  "groups.summary.h": "What was checked and what we found",
17510
18288
  "groups.summary.lede": "Each session (one conversation with the agent) was checked against {tests} under {obligations}. Results are counts of sessions: there is no overall score. Open a test to read the sessions behind its exceptions.",
17511
18289
  "groups.summary.basis": `Every count and result is read from the sealed claims and reports in this bundle, or marked "not stated". The regulation named above, obligation titles, test names, the article, the plain-language summary, applicability, method, finding ids, severities, recommendations and the notes on undecided tests and quality checks are the producer's mapping, set in italics: carried beside the signed records, not in them.`,
18290
+ "groups.summary.basis.pack-titles": `Every count and result is read from the sealed claims and reports in this bundle, or marked "not stated". The regulation named above, test names, the article, the plain-language summary, applicability, method, finding ids, severities, recommendations and the notes on undecided tests and quality checks are the producer's mapping, set in italics: carried beside the signed records, not in them. Obligation titles are the Act's article headings, from this page's wording pack.`,
17512
18291
  "groups.summary.col.test": "Obligation and test",
17513
18292
  "groups.summary.col.checked-in": "Checked in",
17514
18293
  "groups.summary.col.result": "Result",
@@ -17533,6 +18312,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
17533
18312
  "groups.rp.toggle": "Proofs for this report: method, test wording, what ran, and how to verify the whole bundle",
17534
18313
  "groups.od.h": "Method and the wording each test ran",
17535
18314
  "groups.od.mapped": "Title, article, summary, method, test names and the undecided-session note: the producer's mapping, in italics, not a sealed record.",
18315
+ "groups.od.mapped.pack-titles": "Article, summary, method, test names and the undecided-session note: the producer's mapping, in italics, not a sealed record. The title is the Act's article heading, from this page's wording pack.",
17536
18316
  "groups.od.unmapped": "The producer's extension does not map this obligation: article, summary and method not stated.",
17537
18317
  "groups.od.judged-terms": "Judged terms: ",
17538
18318
  "groups.od.wording.sealed": "Wording run (sealed): {text}",
@@ -17752,6 +18532,8 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
17752
18532
  "front.agg.requirements.other": "{n} requirements",
17753
18533
  "front.agg.unknown.one": "{n} evaluation with an unknown result",
17754
18534
  "front.agg.unknown.other": "{n} evaluations with an unknown result",
18535
+ "front.agg.calibration.one": "{n} calibration check of the judge, not counted as evaluations",
18536
+ "front.agg.calibration.other": "{n} calibration checks of the judge, not counted as evaluations",
17755
18537
  "front.agg.later.one": "{n} evaluation not yet in force",
17756
18538
  "front.agg.later.other": "{n} evaluations not yet in force",
17757
18539
  "front.agg.mismatch": "count mismatch: the claims give {recomputed}",
@@ -17991,68 +18773,530 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
17991
18773
  }
17992
18774
  };
17993
18775
 
17994
- // src/contract-report-wording.ts
17995
- var WORDING_PACK_VERSION = "aac.wording-pack/v0";
17996
- var WORDING_KEY = /^[a-z0-9][a-z0-9._-]*$/u;
17997
- var LOCALE = /^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$/u;
17998
- var PLACEHOLDER = /\{([a-zA-Z][a-zA-Z0-9_]*)\}/gu;
17999
- var INVISIBLE = /[\p{Cf}\p{Default_Ignorable_Code_Point}]/u;
18000
- var WordingPackError = class extends Error {
18001
- constructor(message) {
18002
- super(message);
18003
- this.name = "WordingPackError";
18004
- }
18005
- };
18006
- function readWordingPack(pack) {
18007
- const p = pack;
18008
- const entries = p?.entries;
18009
- if (pack === null || typeof pack !== "object" || Array.isArray(pack) || Object.keys(p).some(
18010
- (k) => !["wording_pack_version", "id", "locale", "entries"].includes(k)
18011
- ) || p.wording_pack_version !== WORDING_PACK_VERSION || typeof p.id !== "string" || INVISIBLE.test(p.id) || typeof p.locale !== "string" || !LOCALE.test(p.locale) || entries === null || typeof entries !== "object" || Array.isArray(entries) || Object.keys(entries).length === 0 || Object.entries(entries).some(
18012
- ([k, v]) => !WORDING_KEY.test(k) || typeof v !== "string" || v === ""
18013
- ))
18014
- throw new WordingPackError(
18015
- `wording pack is not an ${WORDING_PACK_VERSION} object`
18016
- );
18017
- return {
18018
- id: p.id,
18019
- locale: p.locale,
18020
- entries
18021
- };
18022
- }
18023
- async function checkWordingPackInput(wording) {
18024
- if (!/^[0-9a-f]{64}$/u.test(wording.sha256))
18025
- throw new WordingPackError("wording sha256 is not a lowercase hex SHA-256");
18026
- const digest = await sha256Hex(new TextEncoder().encode(wording.pack));
18027
- if (digest !== wording.sha256)
18028
- throw new WordingPackError(
18029
- "wording pack bytes do not hash to its wording_sha256"
18030
- );
18031
- let parsed;
18032
- try {
18033
- parsed = JSON.parse(wording.pack);
18034
- } catch {
18035
- throw new WordingPackError("wording pack is not JSON");
18036
- }
18037
- return readWordingPack(parsed);
18038
- }
18039
- function placeholders(text2) {
18040
- return [...text2.matchAll(PLACEHOLDER)].map((m) => m[1]);
18041
- }
18042
- function placeholderGaps(text2) {
18043
- const matches = [...text2.matchAll(PLACEHOLDER)];
18044
- const gaps = [];
18045
- for (let i = 1; i < matches.length; i++)
18046
- gaps.push(
18047
- text2.slice(
18048
- matches[i - 1].index + matches[i - 1][0].length,
18049
- matches[i].index
18050
- )
18051
- );
18052
- return gaps;
18053
- }
18054
- var HAS_NON_SPACE = /\S/u;
18055
- var HAS_LETTER = /\p{L}/u;
18776
+ // src/wording/contract-report-generic.en.json
18777
+ var contract_report_generic_en_default = {
18778
+ wording_pack_version: "aac.wording-pack/v0",
18779
+ id: "capsule-viewer/contract-report/generic@1",
18780
+ locale: "en",
18781
+ entries: {
18782
+ "layout.grouping": "generic",
18783
+ "judge.note.sure": "The judge gave this verdict a probability of {p}%.",
18784
+ "case.label": "task {task}",
18785
+ "case.label.trial": "task {task}, trial {trial}",
18786
+ "chat.role.user": "User",
18787
+ "chat.role.assistant": "Agent",
18788
+ "chat.role.tool": "Tool result",
18789
+ "chat.role.system": "Instructions given to the agent",
18790
+ "chat.absent": "The conversation is not in this bundle. It is sealed in the case record {record}, which this report does not disclose, so this page cannot show it.",
18791
+ "chat.record.not-stated": "(not stated)",
18792
+ "chat.not-shown": "The conversation is not shown: {reason}.",
18793
+ "chat.not-shown.default-reason": "the transcript in this bundle does not check against the case the judge read",
18794
+ "chat.lede": "{messages} messages, {calls}. {state} Tool results are shown as sealed; JSON is only indented, and only where indenting changes nothing else. Tool arguments are shown as the report model hands them over, re-serialised, so a number JSON cannot hold exactly may already be rounded.",
18795
+ "chat.calls.one": "{n} tool call",
18796
+ "chat.calls.other": "{n} tool calls",
18797
+ "chat.state.cited": "The conversation of the case every claim cites. The judge's reports are withheld, so which conversation the judge read is not shown.",
18798
+ "chat.state.verified": "The exact conversation the judge read, checked on this page (see the proofs).",
18799
+ "chat.called": "called ",
18800
+ "chat.close": "Close the conversation",
18801
+ "chat.in-records": "In the records",
18802
+ "chat.read": "Read the conversation",
18803
+ "spot.toggle": "Spot check, side by side",
18804
+ "spot.col.happened": "What happened",
18805
+ "spot.col.happened.counted": "What happened \xB7 {turns}, {calls}",
18806
+ "spot.turns.one": "{n} message",
18807
+ "spot.turns.other": "{n} messages",
18808
+ "spot.col.criterion": "The criterion",
18809
+ "spot.col.verdict": "The verdict \xB7 why",
18810
+ "spot.term": "The rule, as the judge was given it",
18811
+ "spot.term.unstated": "The rule's wording is not in this bundle: no report in it states the wording.",
18812
+ "spot.term.mixed": "The rule's wording is not shown: the reports in this bundle state different wordings.",
18813
+ "spot.says": "The judge's words",
18814
+ "spot.confidence": "confidence {c}",
18815
+ "spot.gap.produced": "Who produced each message (model, tools used, effects) is not in this bundle: a message here carries only who spoke, what was said and the tool calls.",
18816
+ "spot.gap.when": "This report states only each rule's wording, not when it counts as met or when it cannot be decided.",
18817
+ "spot.gap.adjudication": "This card does not show whether a second, blind judge checked these verdicts.",
18818
+ "card.not-stated": "not stated",
18819
+ "card.span": "{from} \u2013 {to}",
18820
+ "card.span.unknown": "unknown",
18821
+ "card.basis.source": "source says (backfilled record; the source's own timestamp, self-attested)",
18822
+ "card.basis.record": "the case record's own timestamp",
18823
+ "card.basis.judged": "the day the judgments were sealed (no case record date to read)",
18824
+ "card.dating.sealed": "Sealed {span}.",
18825
+ "card.dating.source": `Dates are the source's own timestamps for backfilled records ("source says"), as given, not when the records were sealed.`,
18826
+ "card.dating.record": "The period is when the conversations happened (each case record's own time, as given), not when they were judged.",
18827
+ "card.dating.mixed": "Dates are each conversation's own date, as given, not when the judgments were sealed:",
18828
+ "card.dating.mixed.source": `{n} backfilled by the source's own timestamp ("source says");`,
18829
+ "card.dating.mixed.record": "{n} by the case record's own timestamp;",
18830
+ "card.dating.mixed.judged": "{n} with no case record date to read, by the day they were judged.",
18831
+ "card.dating.self-attested": "A backfilled record's source time is self-attested: carrying it does not make it witnessed.",
18832
+ "card.dating.tz": "Timezone not stated on {count} of {total}; no zone is assumed.",
18833
+ "card.h.conversation": "The conversation",
18834
+ "card.proofs.toggle": "Proofs: record ids, digests and the judge pin",
18835
+ "card.gap.notes.withheld": "The judge's notes are not in this bundle: its reports are withheld.",
18836
+ "card.gap.notes.unread": "The judge's notes are not shown: some reports in this bundle do not match what was sealed, cannot be read, or do not check out.",
18837
+ "card.gap.notes.some-withheld": "The judge's notes are not in this bundle: some of its reports are withheld.",
18838
+ "card.gap.notes.none": "The judge left no notes.",
18839
+ "card.pf.case-record": "Case record",
18840
+ "card.pf.case-record.not-stated": "not stated by the reports",
18841
+ "card.pf.dated": "{date}: {basis}",
18842
+ "card.pf.dated.no-zone": "{date} (timezone not stated): {basis}",
18843
+ "card.pf.imported": "Imported",
18844
+ "card.pf.judged-sealed": "Judged and sealed",
18845
+ "card.pf.result-capsule": "Result capsule",
18846
+ "card.pf.transcript-record": "Transcript record",
18847
+ "card.pf.input-digest": "Case input digest",
18848
+ "card.pf.input-digest.verified": "{digest} (the transcript's digest equals what the judged case committed to, checked on this page)",
18849
+ "card.pf.input-digest.cited": "{digest} (the case every claim cites; the judge's reports are withheld, so which conversation the judge read is not shown)",
18850
+ "card.pf.transcript": "Transcript",
18851
+ "card.pf.transcript.absent": "not in this bundle",
18852
+ "card.pf.transcript.not-shown": "not shown: {reason}",
18853
+ "card.pf.transcript.default-reason": "does not check",
18854
+ "card.pf.wording": "Words",
18855
+ "card.pf.wording.default": "wording pack {id}, built into this viewer (wording_sha256 {sha256})",
18856
+ "card.pf.wording.supplied.layered": "wording pack {id} (wording_sha256 {sha256}), supplied with the page over the built-in {baseId} (wording_sha256 {baseSha256})",
18857
+ "card.pin.withheld": "the judge's reports that state it are withheld ({count} of {total})",
18858
+ "card.pin.unread": "{count} of {total} reports in this bundle do not match what was sealed, cannot be read, or do not check out",
18859
+ "card.pin.not-in-bundle": "not in this bundle: {reasons}",
18860
+ "card.vd.h": "Verification details",
18861
+ "card.vd.bundle-digest": "Bundle digest",
18862
+ "card.vd.checkpoint-root": "Checkpoint root",
18863
+ "card.vd.checkpoint-size": "Checkpoint size",
18864
+ "card.vd.uncomputable": "uncomputable",
18865
+ "card.vd.absent": "absent",
18866
+ "prov.of": "{count} of {total}",
18867
+ "prov.judge.label": "Judged by",
18868
+ "prov.judge.none": "not stated: no result in this bundle cites a report",
18869
+ "prov.judge.model.does-not-recompute": "model not shown (the model the reports state does not recompute to the pin)",
18870
+ "prov.judge.model.differs": "model not shown (the reports with this pin state different models)",
18871
+ "prov.judge.model.partly-stated": "model not shown (some reports with this pin state no model)",
18872
+ "prov.judge.model.not-stated": "model not stated",
18873
+ "prov.judge.pin": "{model}, pinned, pin {pin} ({of} results)",
18874
+ "prov.judge.all-withheld": "not in this bundle: the judge's reports are withheld ({of})",
18875
+ "prov.judge.some-withheld": "the reports for {of} results are withheld, so their judge is not in this bundle",
18876
+ "prov.judge.not-carried": "the reports for {of} results are not in this bundle, so their judge is not stated",
18877
+ "prov.judge.unread": "{of} reports do not match what was sealed, cannot be read, or do not check out",
18878
+ "prov.judge.checker": "{checker} ({count})",
18879
+ "prov.judge.checker-not-stated": "checker not stated ({count})",
18880
+ "prov.judge.recomputed": "{of} results recomputed, not judged: {by}",
18881
+ "prov.judge.unnamed": "judge not stated for {of} results",
18882
+ "prov.judge.nothing": "not stated in this bundle",
18883
+ "prov.witness.label": "Witnessed by",
18884
+ "prov.witness.stated": "{witnesses}: stated by the bundle, not checked here.",
18885
+ "prov.witness.verified": "{witnesses}: receipt checked here, and it verifies.",
18886
+ "prov.witness.invalid": "not witnessed: the witness check failed.",
18887
+ "prov.witness.failed": "{witnesses}: checked here, and does not verify.",
18888
+ "prov.witness.invalid.findings": "The check states: {findings}.",
18889
+ "prov.witness.failed-entry": "{witness} (reason: {reason})",
18890
+ "prov.witness.invalid.unreadable.one": "{n} entry in its witness list cannot be read.",
18891
+ "prov.witness.invalid.unreadable.other": "{n} entries in its witness list cannot be read.",
18892
+ "prov.witness.none": "not stated in this bundle: it carries no witness receipt for its checkpoint.",
18893
+ "prov.witness.entry": "{witness} (tree size {size})",
18894
+ "prov.witness.receipt-not-stated": "a receipt, witness not stated",
18895
+ "prov.witness.stubs.one": "{n} placeholder, not receipts",
18896
+ "prov.witness.stubs.other": "{n} placeholders, not receipts",
18897
+ "prov.witness.malformed.one": "{n} entry that cannot be read",
18898
+ "prov.witness.malformed.other": "{n} entries that cannot be read",
18899
+ "prov.witness.besides": "It also carries {others}.",
18900
+ "prov.witness.both": "{a} and {b}",
18901
+ "prov.witness.log": "log {log}",
18902
+ "prov.witness.size": "size {size}",
18903
+ "prov.witness.root": "root {root}",
18904
+ "prov.witness.about": "The checkpoint: {facts}.",
18905
+ "prov.witness.about.unchecked": "The checkpoint: {facts}; this page did not check its signature.",
18906
+ "prov.witness.about.unsigned": "The checkpoint: {facts}; the bundle carries no signature for it.",
18907
+ "prov.verifier.label": "Verified by",
18908
+ "prov.brief.judge.stated": "judge pinned",
18909
+ "prov.brief.judge.mixed": "several judge pins",
18910
+ "prov.brief.judge.withheld": "judge withheld",
18911
+ "prov.brief.judge.not-stated": "judge not stated",
18912
+ "prov.brief.judge.mock": "mock judge",
18913
+ "prov.brief.witness.stated": "witness receipt in this bundle",
18914
+ "prov.brief.witness.verified": "witness receipt checked here",
18915
+ "prov.brief.witness.partly-checked": "witness receipts partly checked here",
18916
+ "prov.brief.witness.invalid": "witness check failed",
18917
+ "prov.brief.witness.mixed": "witness receipts partly unreadable",
18918
+ "prov.brief.witness.not-stated": "no witness receipt in this bundle",
18919
+ "prov.brief.verifier.stated": "checked by this page",
18920
+ "prov.brief.verifier.not-stated": "checker not stated",
18921
+ "prov.verifier.text": "{ran}. {built}",
18922
+ "prov.verifier.ran": "this page's code: {viewer} {viewerVersion} at {commit}, verifier {verifier} {verifierVersion}",
18923
+ "prov.verifier.ran.cll": "this page's code: {viewer} {viewerVersion} at {commit}, verifier {verifier} {verifierVersion} with cll {cll}",
18924
+ "prov.verifier.commit.not-stated": "commit not stated",
18925
+ "prov.verifier.ran.not-stated": "this page's code; its viewer and verifier versions are not stated",
18926
+ "prov.verifier.built.not-stated": "The tool that built this bundle is not stated in it.",
18927
+ "prov.verifier.built": "The bundle's own report, which this page does not check, names the tool that built it as {producer}, {version}.",
18928
+ "prov.verifier.version": "version {version}",
18929
+ "prov.verifier.version.not-stated": "version not stated",
18930
+ "grade.self-attested": "self-attested",
18931
+ "grade.witnessed": "witnessed",
18932
+ "grade.countersigned": "countersigned",
18933
+ "sufficiency.satisfied": "satisfied",
18934
+ "sufficiency.gap": "gap",
18935
+ "sufficiency.insufficient": "insufficient",
18936
+ "sufficiency.unknown": "unknown",
18937
+ "status.satisfied": "satisfied",
18938
+ "status.insufficient": "insufficient",
18939
+ "status.not_found": "not found",
18940
+ "status.not_committed": "not committed",
18941
+ "status.withheld": "withheld",
18942
+ "status.contradicted": "contradicted",
18943
+ "status.not_applicable": "not applicable",
18944
+ "status.unknown": "unknown",
18945
+ "requirement_tier.must_have": "Must-have",
18946
+ "requirement_tier.informational": "Informational",
18947
+ "requirement_tier.unstated": "Tier not stated",
18948
+ "card.pf.assurance": "Assurance (as sealed on the claim)",
18949
+ "card.pf.assurance.line": "tier {tier} \xB7 grade {grade} \xB7 sufficiency {sufficiency} \xB7 carrier status {status}",
18950
+ "card.mark.withheld": "Withheld by the holder",
18951
+ "card.mark.withheld.cited": "Withheld by the holder \xB7 cites {digests}",
18952
+ "card.wording.refused": "The wording pack supplied with this page was refused, so this card is drawn with the viewer's built-in words only.",
18953
+ "card.pf.wording.refused": "a wording pack supplied with the page (wording_sha256 {sha256}) was refused: {reason}. Only the built-in {baseId} (wording_sha256 {baseSha256}) was applied.",
18954
+ "card.wording.refused.digest": "its bytes do not hash to its wording_sha256",
18955
+ "card.wording.refused.shape": "it is not an aac.wording-pack/v0 object",
18956
+ "card.wording.refused.fit": "it does not fit this card's words",
18957
+ "front.mock": "Verdicts are from a mock judge and are placeholders.",
18958
+ "front.agg.evaluated": "{evaluations} of {requirements}",
18959
+ "front.agg.evaluations.one": "{n} evaluation",
18960
+ "front.agg.evaluations.other": "{n} evaluations",
18961
+ "front.agg.requirements.one": "{n} requirement",
18962
+ "front.agg.requirements.other": "{n} requirements",
18963
+ "front.agg.unknown.one": "{n} evaluation with an unknown result",
18964
+ "front.agg.unknown.other": "{n} evaluations with an unknown result",
18965
+ "front.agg.calibration.one": "{n} calibration check of the judge, not counted as evaluations",
18966
+ "front.agg.calibration.other": "{n} calibration checks of the judge, not counted as evaluations",
18967
+ "front.agg.later.one": "{n} evaluation not yet in force",
18968
+ "front.agg.later.other": "{n} evaluations not yet in force",
18969
+ "front.agg.mismatch": "count mismatch: the claims give {recomputed}",
18970
+ "front.agg.as-of": "In force as of {date}.",
18971
+ "front.agg.copied.both": "The dates and the out-of-scope switch are copied from the contract, not re-checked here.",
18972
+ "front.agg.copied.dates": "The dates are copied from the contract, not re-checked here.",
18973
+ "front.agg.copied.switch": "The out-of-scope switch is copied from the contract, not re-checked here.",
18974
+ "prov.brief.judge.partial": "judge pinned for some results",
18975
+ "front.agg.excluded": "{excluded} excluded as not applicable",
18976
+ "front.agg.bucket.met": "Met",
18977
+ "front.agg.bucket.not_met": "Not met",
18978
+ "front.agg.bucket.not_evaluable": "Could not decide",
18979
+ "front.agg.bucket.out_of_scope": "Out of scope",
18980
+ "front.agg.of": "of {n} evaluations",
18981
+ "front.core.label": "CORE",
18982
+ "front.core.pack": "{id} v{version}",
18983
+ "front.core.packs": "{n} packs",
18984
+ "front.core.generated": "generated {time}",
18985
+ "front.core.result": "Result {digest}",
18986
+ "front.core.pin": "judge pin {digest}",
18987
+ "front.core.pins": "{n} judge pins",
18988
+ "front.check.h": "Check this report yourself",
18989
+ "front.check.key": "Producer key",
18990
+ "front.check.log": "Log",
18991
+ "front.check.root": "Checkpoint root \xB7 size",
18992
+ "front.check.records": "Records in this bundle",
18993
+ "front.check.s1": "Keep a copy of the bundle this page shows.",
18994
+ "front.check.s2": "Run the open-source verifier on it, offline.",
18995
+ "front.check.s3.receipt": "Compare the checkpoint root above with the root the witness receipt in this bundle names.",
18996
+ "front.check.s3.none": "This bundle carries no witness receipt. If you can get the log's checkpoint for this size on your own, compare its root with the one above.",
18997
+ "front.check.s4": "Open any row above to see the sealed records it cites.",
18998
+ "front.findings.label": "Producer's findings \xB7 presentation text, not evidence",
18999
+ "evidence.show": "Show evidence",
19000
+ "evidence.show.for": "Show evidence: {what}",
19001
+ "evidence.records": "The records the claims behind this number cite, each a link to its entry in this bundle's records",
19002
+ "evidence.not-in-bundle": "not disclosed in this bundle; this page does not fetch it",
19003
+ "evidence.no-evidence.one": "{n} counted from a claim that cites no evidence",
19004
+ "evidence.no-evidence.other": "{n} counted from claims that cite no evidence",
19005
+ "chart.population.one": "{n} record",
19006
+ "chart.population.other": "{n} records",
19007
+ "chart.window": "{from} to {to} (UTC)",
19008
+ "chart.derived": "Derived from this report's records, not evidence itself",
19009
+ "chart.not_run": "Not run",
19010
+ "chart.no_runs": "This report's plan does not say which days ran, so a day with no records reads 0",
19011
+ "chart.table.caption": "The values in this chart",
19012
+ "chart.count": "Count",
19013
+ "chart.sum": "Sum of",
19014
+ "chart.evidence.records": "The records this value counts, each a link to its entry in this bundle's records",
19015
+ "chart.evidence.none": "Nothing counted: no record in this report's data falls here",
19016
+ "chart.refused": "This chart was not drawn: its spec does not match the report's data ({reason}).",
19017
+ "calendar.weekday.1": "Mon",
19018
+ "calendar.weekday.2": "Tue",
19019
+ "calendar.weekday.3": "Wed",
19020
+ "calendar.weekday.4": "Thu",
19021
+ "calendar.weekday.5": "Fri",
19022
+ "calendar.weekday.6": "Sat",
19023
+ "calendar.weekday.7": "Sun",
19024
+ "period.week": "Week of {date}",
19025
+ "period.not_run_days.one": "{n} day not run",
19026
+ "period.not_run_days.other": "{n} days not run",
19027
+ "view.unplaced.one": "{n} record is dated on a day that did not run, so it is in no cell",
19028
+ "view.unplaced.other": "{n} records are dated on days that did not run, so they are in no cell",
19029
+ "calendar.weekday.long.1": "Monday",
19030
+ "calendar.weekday.long.2": "Tuesday",
19031
+ "calendar.weekday.long.3": "Wednesday",
19032
+ "calendar.weekday.long.4": "Thursday",
19033
+ "calendar.weekday.long.5": "Friday",
19034
+ "calendar.weekday.long.6": "Saturday",
19035
+ "calendar.weekday.long.7": "Sunday",
19036
+ "calendar.month.1": "January",
19037
+ "calendar.month.2": "February",
19038
+ "calendar.month.3": "March",
19039
+ "calendar.month.4": "April",
19040
+ "calendar.month.5": "May",
19041
+ "calendar.month.6": "June",
19042
+ "calendar.month.7": "July",
19043
+ "calendar.month.8": "August",
19044
+ "calendar.month.9": "September",
19045
+ "calendar.month.10": "October",
19046
+ "calendar.month.11": "November",
19047
+ "calendar.month.12": "December",
19048
+ "calendar.day.heading": "{weekday}, {month} {day}",
19049
+ "calendar.day.time": "Time (UTC)",
19050
+ "calendar.day.record": "Record",
19051
+ "calendar.day.counts": "Counts for this day",
19052
+ "calendar.activity.one": "{n} case",
19053
+ "calendar.activity.other": "{n} cases",
19054
+ "calendar.judged": "judged",
19055
+ "calendar.class.good": "{n} met",
19056
+ "calendar.class.bad": "{n} not met",
19057
+ "calendar.class.open": "{n} undecided",
19058
+ "calendar.adj.recorded.one": "{n} adjudication recorded",
19059
+ "calendar.adj.recorded.other": "{n} adjudications recorded",
19060
+ "calendar.adj.concur": "all concur",
19061
+ "calendar.adj.differ.one": "{n} differs from the judge",
19062
+ "calendar.adj.differ.other": "{n} differ from the judge",
19063
+ "calendar.adj.open": "{n} not yet ruled",
19064
+ "calendar.legend.good": "all, or all but one, met",
19065
+ "calendar.legend.some": "some not met or undecided",
19066
+ "calendar.legend.most": "most not met",
19067
+ "calendar.legend.adjudication": "adjudications recorded that day",
19068
+ "cofail.failing.one": "{n} case did not meet at least one requirement",
19069
+ "cofail.failing.other": "{n} cases did not meet at least one requirement",
19070
+ "evidence.uncited.one": "{n} counted with no claim: this page's own reading, with no evidence to show",
19071
+ "evidence.uncited.other": "{n} counted with no claim: this page's own reading, with no evidence to show",
19072
+ "evidence.label.unsupported": "Unsupported: no record its claims cite is disclosed in this bundle",
19073
+ "evidence.label.no-evidence": "Unsupported: its claims cite no evidence",
19074
+ "evidence.label.interpretation": "Interpretation: this page's own reading; no claim cites evidence for it",
19075
+ "front.findings.h": "Findings",
19076
+ "legend.toggle.open": "open, by the view's depth",
19077
+ "legend.toggle.closed": "closed, the reader opens it",
19078
+ "legend.toggle.core": "no toggle, the core always draws it",
19079
+ "legend.toggle.note": "Every toggle's glyph sits at the left edge of the line it opens. Opening is a click; the page records nothing about it.",
19080
+ "legend.src.lead": "Where every word comes from",
19081
+ "legend.src.core": "core",
19082
+ "legend.src.core.is": "the viewer's own words",
19083
+ "legend.src.pack": "wording pack",
19084
+ "legend.src.pack.is": "the report's words",
19085
+ "legend.src.field": "capsule field",
19086
+ "legend.src.field.is": "a field as recorded, with its path",
19087
+ "legend.src.payload": "payload",
19088
+ "legend.src.payload.is": "the record's content",
19089
+ "legend.src.producer": "producer",
19090
+ "legend.src.producer.is": "quoted, with whose words",
19091
+ "legend.src.unmarked": "Unmarked text is the viewer's or the report's own words.",
19092
+ "record.banner.own": "Core \xB7 L3 \xB7 the lowest level. Opened from a card's \u201CProofs\u201D or from \u201CRecords in this bundle\u201D. Shown for one record, {action}; every record in this bundle has the same page. What is below this is the bytes, as you hold them.",
19093
+ "record.banner.shared": "Core \xB7 L3 \xB7 the lowest level. Opened from a card's \u201CProofs\u201D or from \u201CRecords in this bundle\u201D. Shown for one record, {action}; every record in this bundle has the same page. What is below this is the bytes, as the holder shared them.",
19094
+ "record.envelope.title": "The producer envelope \xB7 COSE_Sign1 (tag 18) \xB7 what is signed is the capsule's identity, not its JSON",
19095
+ "record.envelope.none": "This record carries no producer envelope: it is not signed, which is not the same as a bad signature.",
19096
+ "record.envelope.unreadable": "This record carries an envelope this page could not read as a COSE_Sign1.",
19097
+ "record.envelope.foot.own": "A capsule may carry zero, one or several envelopes; each verifies on its own; none is in the id's preimage, so adding a signer never changes capsule_id. Verifying an envelope proves the key signed this id. It does not prove the key was allowed to act for the operator: that is rung 8.",
19098
+ "record.envelope.foot.shared": "A capsule may carry zero, one or several envelopes; each verifies on its own; none is in the id's preimage, so adding a signer never changes capsule_id. Verifying an envelope proves the key signed this id. It does not prove the key was allowed to act for the operator: that is rung 8.",
19099
+ "record.env.protected": "protected header",
19100
+ "record.env.covered": "covered by the signature",
19101
+ "record.env.not-signed": "not signed",
19102
+ "record.env.alg": "1 \xB7 alg",
19103
+ "record.env.alg.other": "an algorithm this page does not name",
19104
+ "record.env.content-type": "3 \xB7 content type",
19105
+ "record.env.kid": "4 \xB7 kid",
19106
+ "record.env.kid.value": "{kid} \xB7 the raw {bytes}-byte public key \xB7 the signing key",
19107
+ "record.env.unprotected": "unprotected header",
19108
+ "record.env.unprotected.empty": "empty by rule in a bare envelope; nothing here is ever evidence. A registrar's receipt is a separate Signed Statement (rung 7), never a header on this one.",
19109
+ "record.env.unprotected.entries": "{n} entries, none of them signed and none of them evidence. A registrar's receipt is a separate Signed Statement (rung 7), never a header on this one.",
19110
+ "record.env.payload": "payload",
19111
+ "record.env.payload.is-id": "the raw {bytes} bytes of capsule_id = SHA-256 over the JCS form of the capsule JSON (minus the id field itself). This is the digest. Change one byte of the capsule and it no longer matches.",
19112
+ "record.env.payload.other": "the payload is not the capsule_id this record names.",
19113
+ "record.env.signature": 'signature \xB7 {bytes} bytes \xB7 Ed25519 over Sig_structure("Signature1", protected header, external AAD = empty, payload)',
19114
+ "record.capsule.title": "The capsule JSON \xB7 format 4 \xB7 fields in clear vs committed by digest",
19115
+ "record.capsule.recomputed": "recomputed, never trusted as carried",
19116
+ "record.tag.clear": "clear",
19117
+ "record.tag.digest-only": "digest only",
19118
+ "record.tag.bodies-by-digest": "bodies by digest",
19119
+ "record.tag.commitment": "commitment",
19120
+ "record.ladder.title": "The ladder: what each proof proves, and its status on this page",
19121
+ "record.ladder.col.n": "Rung",
19122
+ "record.ladder.col.proof": "Proof",
19123
+ "record.ladder.col.proves": "What it proves \xB7 what it does not",
19124
+ "record.ladder.col.status": "Status here",
19125
+ "record.ladder.col.check": "Check it yourself",
19126
+ "record.rung.1.title": "Payload digest",
19127
+ "record.rung.1.sub": "capsule_id recomputed",
19128
+ "record.rung.1.proves.own": "The capsule JSON you hold is the one this id names. Not: that its contents are true.",
19129
+ "record.rung.1.proves.shared": "The capsule JSON in this file is the one this id names. Not: that its contents are true.",
19130
+ "record.rung.1.check": "agent-action-capsule verify capsule.json",
19131
+ "record.rung.2.title": "Content digests",
19132
+ "record.rung.2.sub": "agent_input and agent_output",
19133
+ "record.rung.2.proves.own": "The turns and tool bodies this page shows are the ones the capsule committed to. Not: that they are complete; absent content shows as withheld.",
19134
+ "record.rung.2.proves.shared": "The turns and tool bodies this page shows are the ones the capsule committed to. Not: that they are complete; absent content shows as withheld.",
19135
+ "record.rung.2.check": "sha256 over the disclosed body = the field",
19136
+ "record.rung.2.none": "this record commits to no input or output",
19137
+ "record.rung.2.count": "{n} of {of} committed members disclosed",
19138
+ "record.rung.3.title": "Producer envelope",
19139
+ "record.rung.3.sub": "Ed25519 over the id",
19140
+ "record.rung.3.proves.own": "Whoever holds the key in the header signed this id. Not: that the key may act for the operator (rung 8).",
19141
+ "record.rung.3.proves.shared": "Whoever holds the key in the header signed this id. Not: that the key may act for the operator (rung 8).",
19142
+ "record.rung.3.check": "capsulectl verify --profile NAME --capsule capsule.json",
19143
+ "record.rung.3.unchecked": "this page could not run it here (no Ed25519 in this browser); check it offline",
19144
+ "record.rung.4.title": "Chain",
19145
+ "record.rung.4.sub": "parent_capsule_id {parent} \xB7 relation",
19146
+ "record.rung.4.sub.none": "parent_capsule_id \xB7 relation",
19147
+ "record.rung.4.proves.own": "This record names a parent that is a record in this bundle. Not: how the two are ordered in the log, that no record supersedes it, or anything about other books (that is references[]).",
19148
+ "record.rung.4.proves.shared": "This record names a parent that is a record in this bundle. Not: how the two are ordered in the log, that no record supersedes it, or anything about other books (that is references[]).",
19149
+ "record.rung.4.check": "agent-action-capsule verify --store DIR",
19150
+ "record.rung.4.parent-absent": "the parent is not a record of this bundle",
19151
+ "record.rung.5.title": "Inclusion",
19152
+ "record.rung.5.sub": "leaf {leaf} \xB7 seq {seq}",
19153
+ "record.rung.5.sub.none": "no log coordinates for this record",
19154
+ "record.rung.5.proves.own": "This record is in the book at that position, under the checkpoint root. Not: that the book was not rewritten before the checkpoint (rung 6).",
19155
+ "record.rung.5.proves.shared": "This record is in the book at that position, under the checkpoint root. Not: that the book was not rewritten before the checkpoint (rung 6).",
19156
+ "record.rung.5.check": "capsulectl cll verify --profile NAME --proof PROOF.json",
19157
+ "record.rung.6.title": "Checkpoint consistency",
19158
+ "record.rung.6.sub": "retained head \u2192 this root",
19159
+ "record.rung.6.proves.own": "The book only grew between the head you kept and this one; nothing was replaced. Not: anything if you kept no head (first contact).",
19160
+ "record.rung.6.proves.shared": "The book only grew between the head the reader kept and this one; nothing was replaced. Not: anything if the reader kept no head (first contact).",
19161
+ "record.rung.6.check": "not yet available (agent-action-capsule#513)",
19162
+ "record.rung.6.gap": "this page does not run it: a bundle carries no earlier head to compare against",
19163
+ "record.rung.7.title": "Witness receipt \xB7 registration",
19164
+ "record.rung.7.sub": "SCITT Signed Statement + Receipt",
19165
+ "record.rung.7.proves.own": "A third party saw this checkpoint and the id was registered on a transparency log. Together they make attestation_mode: anchored. Not: that the witness read the contents.",
19166
+ "record.rung.7.proves.shared": "A third party saw this checkpoint and the id was registered on a transparency log. Together they make attestation_mode: anchored. Not: that the witness read the contents.",
19167
+ "record.rung.7.check": "agent-action-capsule verify --transparent STATEMENT --issuer-key PEM --log-key PEM",
19168
+ "record.rung.7.none": "this bundle carries no witness receipt",
19169
+ "record.rung.7.count": "{n} of {of} receipts verified",
19170
+ "record.rung.8.title": "Controller binding",
19171
+ "record.rung.8.sub": "key \u2192 controller",
19172
+ "record.rung.8.proves.own": "The controller declared that this key acts for it, in a record of its own, witnessed. Not: that the controller is who they say (that is your trust root or a registry).",
19173
+ "record.rung.8.proves.shared": "The controller declared that this key acts for it, in a record of its own, witnessed. Not: that the controller is who they say (that is the reader's trust root or a registry).",
19174
+ "record.rung.8.check": "not yet available (agent-action-capsule#514)",
19175
+ "record.rung.8.gap": "this page does not run it yet: it reads no controller binding record",
19176
+ "record.rung.9.title": "References \xB7 the other side",
19177
+ "record.rung.9.sub": "cited records",
19178
+ "record.rung.9.proves.own": "The cited records are in this bundle. Not: that they cite back, or the other book's consistency unless you hold its proof material.",
19179
+ "record.rung.9.proves.shared": "The cited records are in this bundle. Not: that they cite back, or the other book's consistency unless the reader holds its proof material.",
19180
+ "record.rung.9.check": "ask for subject: record with proof material",
19181
+ "record.rung.9.count": "{n} of {of} cited records are in this bundle",
19182
+ "record.rung.10.title": "Judgment and adjudication",
19183
+ "record.rung.10.sub": "the sealed Result",
19184
+ "record.rung.10.proves.own": "The sealed Result in this bundle cites this record, and the verdict on the card is the one it carries. Not: that the verdict is right.",
19185
+ "record.rung.10.proves.shared": "The sealed Result in this bundle cites this record, and the verdict on the card is the one it carries. Not: that the verdict is right.",
19186
+ "record.rung.10.check": "capsulectl verify --bundle bundle.json",
19187
+ "record.rung.10.is-result": "this is the sealed Result",
19188
+ "record.rung.10.count": "cited by {n} claims of the sealed Result",
19189
+ "record.rung.11.title": "Countersign",
19190
+ "record.rung.11.sub": "the other party's signature over the Result",
19191
+ "record.rung.11.proves.own": "The other party to the contract accepted this Result's figures as the record of the month. Not: agreement with every verdict.",
19192
+ "record.rung.11.proves.shared": "The other party to the contract accepted this Result's figures as the record of the month. Not: agreement with every verdict.",
19193
+ "record.rung.11.check": "capsulectl countersign verify --profile NAME --directory URL_OR_FILE bundle.json",
19194
+ "record.foot.order.k": "Why the order.",
19195
+ "record.foot.order": "Each rung assumes the one below: an envelope is over an id, an id is over the JSON, inclusion is of an id, a checkpoint is over inclusions, a witness is of a checkpoint, a judgment is over verified records.",
19196
+ "record.foot.status.k": "What a status means here.",
19197
+ "record.foot.status": "PASS the check ran and held \xB7 FAIL it ran and did not \xB7 NOT_PRESENT the material is not in the bundle \xB7 NOT_CHECKED the page did not run it (offline, no key, no adapter) \xB7 INCONCLUSIVE it ran and could not decide.",
19198
+ "record.foot.sdk.k": "Who else checks this.",
19199
+ "record.foot.sdk": "Four implementations, in Go, Rust, Python and TypeScript, pass one vector corpus.",
19200
+ "record.rung.7.note-unread": "this page could not read the witness receipts here",
19201
+ "record.rung.5.other": "the bundle's membership claim did not hold, and its findings do not name this record",
19202
+ "record.rung.5.unanchored": "the checkpoint is not authenticated on this page",
19203
+ "generic.title": "Evidence result",
19204
+ "generic.counts.claims.one": "{n} claim",
19205
+ "generic.counts.claims.other": "{n} claims",
19206
+ "generic.counts.rows.one": "{n} requirement",
19207
+ "generic.counts.rows.other": "{n} requirements",
19208
+ "generic.verdict.met": "met",
19209
+ "generic.verdict.not_met": "not met",
19210
+ "generic.verdict.not_evaluable": "could not be decided",
19211
+ "generic.verdict.out_of_scope": "out of scope",
19212
+ "generic.verdict.failed": "failed verification",
19213
+ "generic.verdict.unsupported": "unsupported claim",
19214
+ "generic.tier.recomputed": "recomputed",
19215
+ "generic.tier.judged": "judged",
19216
+ "generic.tally": "{n} of {total} claims",
19217
+ "generic.claims.h": "Claims",
19218
+ "generic.contract.h": "Contract",
19219
+ "generic.rtier.must_have.title": "Must-have requirements \xB7 {n}",
19220
+ "generic.rtier.must_have.note": "These count in the answer.",
19221
+ "generic.rtier.informational.title": "Informational requirements \xB7 {n}",
19222
+ "generic.rtier.informational.note": "Reported, never in the answer: a requirement not met here changes nothing above it.",
19223
+ "generic.rtier.unstated.title": "Requirements with no stated tier \xB7 {n}",
19224
+ "generic.rtier.unstated.note": "The contract given for this page states no tier for these, so they stay in the answer.",
19225
+ "generic.rtier.sealed-note": "The sealed result counts informational requirements too; the counts this report derives leave them out.",
19226
+ "generic.later.title": "Not yet in force \xB7 {n}",
19227
+ "generic.later.readiness": "readiness",
19228
+ "generic.later.note": "Applies from {date}, as the producer copied it from the contract, not re-checked here: readiness only, not counted.",
19229
+ "generic.producer.note": "Requirement names, groups and claim ids are the producer's identifiers, shown as written unless a wording pack names them; they are not sealed evidence.",
19230
+ "generic.claim.type": "Claim type",
19231
+ "generic.claim.unrecognized": "unrecognized claim type {type}",
19232
+ "generic.claim.contract": "Contract",
19233
+ "generic.claim.requirement": "Requirement",
19234
+ "generic.claim.failure": "Why it failed verification"
19235
+ }
19236
+ };
19237
+
19238
+ // src/contract-report-wording.ts
19239
+ var WORDING_PACK_VERSION = "aac.wording-pack/v0";
19240
+ var WORDING_KEY = /^[a-z0-9][a-z0-9._-]*$/u;
19241
+ var LOCALE = /^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$/u;
19242
+ var PLACEHOLDER = /\{([a-zA-Z][a-zA-Z0-9_]*)\}/gu;
19243
+ var INVISIBLE = /[\p{Cf}\p{Default_Ignorable_Code_Point}]/u;
19244
+ var WordingPackError = class extends Error {
19245
+ constructor(message) {
19246
+ super(message);
19247
+ this.name = "WordingPackError";
19248
+ }
19249
+ };
19250
+ function readWordingPack(pack) {
19251
+ const p = pack;
19252
+ const entries = p?.entries;
19253
+ if (pack === null || typeof pack !== "object" || Array.isArray(pack) || Object.keys(p).some(
19254
+ (k) => !["wording_pack_version", "id", "locale", "entries"].includes(k)
19255
+ ) || p.wording_pack_version !== WORDING_PACK_VERSION || typeof p.id !== "string" || INVISIBLE.test(p.id) || typeof p.locale !== "string" || !LOCALE.test(p.locale) || entries === null || typeof entries !== "object" || Array.isArray(entries) || Object.keys(entries).length === 0 || Object.entries(entries).some(
19256
+ ([k, v]) => !WORDING_KEY.test(k) || typeof v !== "string" || v === ""
19257
+ ))
19258
+ throw new WordingPackError(
19259
+ `wording pack is not an ${WORDING_PACK_VERSION} object`
19260
+ );
19261
+ return {
19262
+ id: p.id,
19263
+ locale: p.locale,
19264
+ entries
19265
+ };
19266
+ }
19267
+ async function checkWordingPackInput(wording) {
19268
+ if (!/^[0-9a-f]{64}$/u.test(wording.sha256))
19269
+ throw new WordingPackError("wording sha256 is not a lowercase hex SHA-256");
19270
+ const digest = await sha256Hex(new TextEncoder().encode(wording.pack));
19271
+ if (digest !== wording.sha256)
19272
+ throw new WordingPackError(
19273
+ "wording pack bytes do not hash to its wording_sha256"
19274
+ );
19275
+ let parsed;
19276
+ try {
19277
+ parsed = JSON.parse(wording.pack);
19278
+ } catch {
19279
+ throw new WordingPackError("wording pack is not JSON");
19280
+ }
19281
+ return readWordingPack(parsed);
19282
+ }
19283
+ function placeholders(text2) {
19284
+ return [...text2.matchAll(PLACEHOLDER)].map((m) => m[1]);
19285
+ }
19286
+ function placeholderGaps(text2) {
19287
+ const matches = [...text2.matchAll(PLACEHOLDER)];
19288
+ const gaps = [];
19289
+ for (let i = 1; i < matches.length; i++)
19290
+ gaps.push(
19291
+ text2.slice(
19292
+ matches[i - 1].index + matches[i - 1][0].length,
19293
+ matches[i].index
19294
+ )
19295
+ );
19296
+ return gaps;
19297
+ }
19298
+ var HAS_NON_SPACE = /\S/u;
19299
+ var HAS_LETTER = /\p{L}/u;
18056
19300
  var DIGIT_LIKE = /[oil]/gu;
18057
19301
  var CORE_STRIP_KEY = /^front\.agg\./u;
18058
19302
  var PERCENT = /[%٪‰]|per\s*cent|percentage/iu;
@@ -18114,6 +19358,15 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18114
19358
  "verdict.out_of_scope": ["groups.verdict.out_of_scope"],
18115
19359
  "tier.recomputed": ["groups.tier.recomputed"],
18116
19360
  "tier.judged": ["groups.tier.judged"]
19361
+ },
19362
+ generic: {
19363
+ "report.title": ["generic.title"],
19364
+ "verdict.met": ["generic.verdict.met"],
19365
+ "verdict.not_met": ["generic.verdict.not_met"],
19366
+ "verdict.not_evaluable": ["generic.verdict.not_evaluable"],
19367
+ "verdict.out_of_scope": ["generic.verdict.out_of_scope"],
19368
+ "tier.recomputed": ["generic.tier.recomputed"],
19369
+ "tier.judged": ["generic.tier.judged"]
18117
19370
  }
18118
19371
  });
18119
19372
  function expandSection3(pack, grouping) {
@@ -18127,9 +19380,13 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18127
19380
  }
18128
19381
  return { ...pack, entries };
18129
19382
  }
19383
+ function isGrouping(value) {
19384
+ return value === "lines" || value === "groups" || value === "generic";
19385
+ }
18130
19386
  var DEFAULT_PACKS = Object.freeze({
18131
19387
  lines: readWordingPack(contract_report_outcomes_en_default),
18132
- groups: readWordingPack(contract_report_eu_ai_act_en_default)
19388
+ groups: readWordingPack(contract_report_eu_ai_act_en_default),
19389
+ generic: readWordingPack(contract_report_generic_en_default)
18133
19390
  });
18134
19391
  var DISTINCT = [
18135
19392
  // This module's own rule verdict words (contract-report.ts: the bare
@@ -18165,6 +19422,15 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18165
19422
  "groups.verdict.not_evaluable.unavailable"
18166
19423
  ]
18167
19424
  ],
19425
+ [
19426
+ "generic.verdict.met",
19427
+ "generic.verdict.not_met",
19428
+ "generic.verdict.failed",
19429
+ "generic.verdict.unsupported",
19430
+ "generic.verdict.out_of_scope",
19431
+ "generic.verdict.not_evaluable"
19432
+ ],
19433
+ ["generic.tier.judged", "generic.tier.recomputed"],
18168
19434
  [
18169
19435
  "lines.status.resolved",
18170
19436
  "lines.status.missed",
@@ -18255,12 +19521,20 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18255
19521
  "groups.rtier.must_have.title",
18256
19522
  "groups.rtier.informational.title",
18257
19523
  "groups.rtier.unstated.title"
19524
+ ],
19525
+ [
19526
+ "generic.rtier.must_have.title",
19527
+ "generic.rtier.informational.title",
19528
+ "generic.rtier.unstated.title"
18258
19529
  ]
18259
19530
  ];
18260
19531
  var GUARDED_CATEGORY = {
18261
19532
  // met/clean: a rule was met, a row resolved, or nothing exceptioned.
18262
19533
  "lines.verdict.met": "clean",
18263
19534
  "groups.verdict.met": "clean",
19535
+ "generic.verdict.met": "clean",
19536
+ "generic.later.title": "later",
19537
+ "generic.later.readiness": "later",
18264
19538
  "lines.pf.verdict.met": "clean",
18265
19539
  "lines.line.resolved": "clean",
18266
19540
  "lines.status.resolved": "clean",
@@ -18274,6 +19548,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18274
19548
  // obligation's red exceptions count.
18275
19549
  "lines.verdict.not_met": "exception",
18276
19550
  "groups.verdict.not_met": "exception",
19551
+ "generic.verdict.not_met": "exception",
18277
19552
  "lines.pf.verdict.not_met": "exception",
18278
19553
  "lines.line.missed": "exception",
18279
19554
  "lines.status.missed": "exception",
@@ -18307,6 +19582,10 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18307
19582
  "lines.verdict.failed": "unverifiable",
18308
19583
  "lines.verdict.unsupported": "unverifiable",
18309
19584
  "groups.verdict.failed": "unverifiable",
19585
+ "generic.verdict.failed": "unverifiable",
19586
+ "generic.verdict.unsupported": "unverifiable",
19587
+ "generic.verdict.not_evaluable": "undecided",
19588
+ "generic.verdict.out_of_scope": "not-applicable",
18310
19589
  "groups.verdict.unsupported": "unverifiable",
18311
19590
  "lines.pf.verdict.failed": "unverifiable",
18312
19591
  "lines.pf.verdict.unsupported": "unverifiable",
@@ -18345,10 +19624,12 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18345
19624
  // recomputed tier: a fixed check anyone can repeat from the records.
18346
19625
  "lines.tier.recomputed": "tier.recomputed",
18347
19626
  "groups.tier.recomputed": "tier.recomputed",
19627
+ "generic.tier.recomputed": "tier.recomputed",
18348
19628
  // judged tier: a judgement, which must never read like the recomputed
18349
19629
  // tier above.
18350
19630
  "lines.tier.judged": "tier.judged",
18351
- "groups.tier.judged": "tier.judged"
19631
+ "groups.tier.judged": "tier.judged",
19632
+ "generic.tier.judged": "tier.judged"
18352
19633
  };
18353
19634
  var CATEGORY_LABEL = {
18354
19635
  clean: "a met/clean result",
@@ -18384,6 +19665,13 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18384
19665
  "groups.rtier.unstated.note",
18385
19666
  "lines.rtier.sealed-note",
18386
19667
  "groups.rtier.sealed-note",
19668
+ "generic.rtier.unstated.note",
19669
+ "generic.rtier.sealed-note",
19670
+ // The generic page's honesty lines: what its names and ids are, and what a
19671
+ // claim not yet in force counts as.
19672
+ "generic.producer.note",
19673
+ "generic.later.note",
19674
+ "generic.claim.failure",
18387
19675
  // The shared front (report-front.ts): the mock-judge line, what the
18388
19676
  // aggregate's unknown count is, what the page and the bundle carry, and
18389
19677
  // the producer's findings label.
@@ -18709,6 +19997,8 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18709
19997
  "lines.pf.verdicts.one",
18710
19998
  "lines.na-note.one",
18711
19999
  "lines.na-note.other",
20000
+ // The canvas's footnote that says what the page does not do.
20001
+ "lines.fn.readonly",
18712
20002
  "lines.sentence.undecided.none",
18713
20003
  "lines.why.undecided.none",
18714
20004
  "lines.sentence.nothing-applied",
@@ -18732,6 +20022,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18732
20022
  "groups.ob.ok.found",
18733
20023
  "groups.ob.ok.unverified",
18734
20024
  "groups.summary.basis",
20025
+ "groups.summary.basis.pack-titles",
18735
20026
  "groups.summary.lede",
18736
20027
  "groups.pf.case-record.from-claims",
18737
20028
  "groups.pf.no-claim",
@@ -18740,6 +20031,7 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
18740
20031
  "groups.pin.none",
18741
20032
  "groups.pin.differs",
18742
20033
  "groups.od.mapped",
20034
+ "groups.od.mapped.pack-titles",
18743
20035
  "groups.od.unmapped",
18744
20036
  "groups.od.wording.sealed",
18745
20037
  "groups.od.wording.mixed",
@@ -18858,9 +20150,9 @@ ${key}`);
18858
20150
  }
18859
20151
  function wordingProblems(supplied, defaults) {
18860
20152
  const grouping = defaults.entries["layout.grouping"];
18861
- const pack = grouping === "lines" || grouping === "groups" ? expandSection3(supplied, grouping) : supplied;
20153
+ const pack = isGrouping(grouping) ? expandSection3(supplied, grouping) : supplied;
18862
20154
  const problems = [];
18863
- if (grouping === "lines" || grouping === "groups") {
20155
+ if (isGrouping(grouping)) {
18864
20156
  for (const [key, targets] of Object.entries(SECTION3_ALIASES[grouping]))
18865
20157
  if (Object.hasOwn(supplied.entries, key)) {
18866
20158
  for (const target of targets)
@@ -18965,8 +20257,9 @@ ${key}`);
18965
20257
  return problems.map((p) => `${pack.id}: ${p}`);
18966
20258
  }
18967
20259
  var DEFAULT_PACK_SHA256 = Object.freeze({
18968
- lines: "0448c4e5d6fa4b59cccdc5ed98b089946d9b217a76042dec222c5bd074ce4b45",
18969
- groups: "90ded4f81aed5f5335cd85d71a930f6af31571d19eeb07e50f710d415420a768"
20260
+ lines: "c8e7c5313deee0137654878727c8a79760286cc165b46c316b5956f498a83d80",
20261
+ groups: "7527077ae3637ff772bc311878a76c8f25e1d16314244f9b5dc80cf1b8e131e0",
20262
+ generic: "2b2de4e046cab88633f09b96729f18a12e0331708e13920a84f6c67f32302f77"
18970
20263
  });
18971
20264
  function fill(key, text2, vars) {
18972
20265
  return text2.replace(PLACEHOLDER, (whole, name) => {
@@ -18979,7 +20272,7 @@ ${key}`);
18979
20272
  const declared = defaults.entries["layout.grouping"];
18980
20273
  const entries = supplied === void 0 ? defaults.entries : {
18981
20274
  ...defaults.entries,
18982
- ...(declared === "lines" || declared === "groups" ? expandSection3(supplied.pack, declared) : supplied.pack).entries
20275
+ ...(isGrouping(declared) ? expandSection3(supplied.pack, declared) : supplied.pack).entries
18983
20276
  };
18984
20277
  const t = (key, vars = {}) => {
18985
20278
  const text2 = Object.hasOwn(entries, key) ? entries[key] : void 0;
@@ -18989,7 +20282,7 @@ ${key}`);
18989
20282
  };
18990
20283
  const section3 = (key) => WORDING_KEY.test(key) && Object.hasOwn(entries, key) ? entries[key] : void 0;
18991
20284
  const grouping = entries["layout.grouping"];
18992
- if (grouping !== "lines" && grouping !== "groups")
20285
+ if (!isGrouping(grouping))
18993
20286
  throw new WordingPackError(
18994
20287
  `${defaults.id}: layout.grouping is ${JSON.stringify(grouping)}`
18995
20288
  );
@@ -19043,7 +20336,8 @@ ${key}`);
19043
20336
  }
19044
20337
  var DEFAULT_WORDS = Object.freeze({
19045
20338
  lines: wordsOf(DEFAULT_PACKS.lines),
19046
- groups: wordsOf(DEFAULT_PACKS.groups)
20339
+ groups: wordsOf(DEFAULT_PACKS.groups),
20340
+ generic: wordsOf(DEFAULT_PACKS.generic)
19047
20341
  });
19048
20342
 
19049
20343
  // src/report-provenance.ts
@@ -19054,10 +20348,10 @@ ${key}`);
19054
20348
  if (record === void 0) return void 0;
19055
20349
  const input = record.carriedInput ?? record.agentInput;
19056
20350
  if (input.state !== "disclosed") return void 0;
19057
- return isObject2(input.payload) ? input.payload : void 0;
20351
+ return isObject3(input.payload) ? input.payload : void 0;
19058
20352
  }
19059
20353
  function pinComponents2(value) {
19060
- if (!isObject2(value)) return void 0;
20354
+ if (!isObject3(value)) return void 0;
19061
20355
  const modelId = asString2(value.model_id);
19062
20356
  const promptDigest = asString2(value.prompt_digest);
19063
20357
  const axesDigest = asString2(value.axes_digest);
@@ -19069,7 +20363,7 @@ ${key}`);
19069
20363
  ...modelVersion === void 0 ? {} : { modelVersion },
19070
20364
  promptDigest,
19071
20365
  axesDigest,
19072
- ...isObject2(value.sampling_params) ? { samplingParams: value.sampling_params } : {}
20366
+ ...isObject3(value.sampling_params) ? { samplingParams: value.sampling_params } : {}
19073
20367
  };
19074
20368
  }
19075
20369
  async function tallyJudges(records, claims) {
@@ -19164,15 +20458,15 @@ ${key}`);
19164
20458
  var quoted = (value) => JSON.stringify(value.length > 120 ? `${value.slice(0, 120)}\u2026` : value);
19165
20459
  var HEX_DIGEST2 = /^[0-9a-f]+$/iu;
19166
20460
  var short = (digest) => HEX_DIGEST2.test(digest) ? digest.length > 12 ? `${digest.slice(0, 12)}\u2026` : digest : quoted(digest);
19167
- function judgedByMock(tally) {
19168
- return tally.pins.some(
20461
+ function judgedByMock(tally2) {
20462
+ return tally2.pins.some(
19169
20463
  (pin) => pin.model !== void 0 && /\bmock\b/i.test(pin.model)
19170
20464
  );
19171
20465
  }
19172
- function judgeLine(tally, w = DEFAULT_WORDS.lines) {
20466
+ function judgeLine(tally2, w = DEFAULT_WORDS.lines) {
19173
20467
  const label = w.t("prov.judge.label");
19174
- const of = (n) => w.t("prov.of", { count: fmt2(n), total: fmt2(tally.cited) });
19175
- if (tally.cited === 0)
20468
+ const of = (n) => w.t("prov.of", { count: fmt2(n), total: fmt2(tally2.cited) });
20469
+ if (tally2.cited === 0)
19176
20470
  return {
19177
20471
  key: "judge",
19178
20472
  label,
@@ -19181,7 +20475,7 @@ ${key}`);
19181
20475
  state: "not-stated"
19182
20476
  };
19183
20477
  const parts = [];
19184
- for (const pin of tally.pins) {
20478
+ for (const pin of tally2.pins) {
19185
20479
  const model = pin.model ?? w.t(
19186
20480
  pin.modelNotShown === "does_not_recompute" ? "prov.judge.model.does-not-recompute" : pin.modelNotShown === "differs" ? "prov.judge.model.differs" : pin.modelNotShown === "partly_stated" ? "prov.judge.model.partly-stated" : "prov.judge.model.not-stated"
19187
20481
  );
@@ -19193,39 +20487,39 @@ ${key}`);
19193
20487
  })
19194
20488
  );
19195
20489
  }
19196
- if (tally.withheld > 0)
20490
+ if (tally2.withheld > 0)
19197
20491
  parts.push(
19198
20492
  w.t(
19199
- tally.withheld === tally.cited ? "prov.judge.all-withheld" : "prov.judge.some-withheld",
19200
- { of: of(tally.withheld) }
20493
+ tally2.withheld === tally2.cited ? "prov.judge.all-withheld" : "prov.judge.some-withheld",
20494
+ { of: of(tally2.withheld) }
19201
20495
  )
19202
20496
  );
19203
- if (tally.notCarried > 0)
19204
- parts.push(w.t("prov.judge.not-carried", { of: of(tally.notCarried) }));
19205
- if (tally.unread > 0)
19206
- parts.push(w.t("prov.judge.unread", { of: of(tally.unread) }));
19207
- const recomputed = tally.checkers.reduce((n, c) => n + c.count, 0) + tally.recomputedUnnamed;
20497
+ if (tally2.notCarried > 0)
20498
+ parts.push(w.t("prov.judge.not-carried", { of: of(tally2.notCarried) }));
20499
+ if (tally2.unread > 0)
20500
+ parts.push(w.t("prov.judge.unread", { of: of(tally2.unread) }));
20501
+ const recomputed = tally2.checkers.reduce((n, c) => n + c.count, 0) + tally2.recomputedUnnamed;
19208
20502
  if (recomputed > 0) {
19209
- const by = tally.checkers.map(
20503
+ const by = tally2.checkers.map(
19210
20504
  (c) => w.t("prov.judge.checker", {
19211
20505
  checker: quoted(c.ref),
19212
20506
  count: fmt2(c.count)
19213
20507
  })
19214
20508
  );
19215
- if (tally.recomputedUnnamed > 0)
20509
+ if (tally2.recomputedUnnamed > 0)
19216
20510
  by.push(
19217
20511
  w.t("prov.judge.checker-not-stated", {
19218
- count: fmt2(tally.recomputedUnnamed)
20512
+ count: fmt2(tally2.recomputedUnnamed)
19219
20513
  })
19220
20514
  );
19221
20515
  parts.push(
19222
20516
  w.t("prov.judge.recomputed", { of: of(recomputed), by: by.join(", ") })
19223
20517
  );
19224
20518
  }
19225
- if (tally.unnamed > 0)
19226
- parts.push(w.t("prov.judge.unnamed", { of: of(tally.unnamed) }));
19227
- const judged = tally.pins.length;
19228
- const state = tally.withheld === tally.cited ? "withheld" : judged > 1 || judged === 1 && (tally.withheld > 0 || tally.notCarried > 0 || tally.unread > 0 || tally.unnamed > 0) ? "mixed" : judged === 1 ? "stated" : "not-stated";
20519
+ if (tally2.unnamed > 0)
20520
+ parts.push(w.t("prov.judge.unnamed", { of: of(tally2.unnamed) }));
20521
+ const judged = tally2.pins.length;
20522
+ const state = tally2.withheld === tally2.cited ? "withheld" : judged > 1 || judged === 1 && (tally2.withheld > 0 || tally2.notCarried > 0 || tally2.unread > 0 || tally2.unnamed > 0) ? "mixed" : judged === 1 ? "stated" : "not-stated";
19229
20523
  if (parts.length === 0) parts.push(w.t("prov.judge.nothing"));
19230
20524
  return {
19231
20525
  key: "judge",
@@ -19236,7 +20530,7 @@ ${key}`);
19236
20530
  // A mock judge is said once, by the L0 mark (report-front.ts,
19237
20531
  // decision D5 (b)); the brief leaves the judge out rather than say it
19238
20532
  // again. The judge's full line stays in the opened block.
19239
- brief: judgedByMock(tally) ? "" : w.t(
20533
+ brief: judgedByMock(tally2) ? "" : w.t(
19240
20534
  state === "mixed" && judged === 1 ? "prov.brief.judge.partial" : `prov.brief.judge.${state}`
19241
20535
  ),
19242
20536
  state
@@ -19250,10 +20544,10 @@ ${key}`);
19250
20544
  "tree_size"
19251
20545
  ];
19252
20546
  function isReceipt(value) {
19253
- return isObject2(value) && typeof value.ts_url === "string" && RECEIPT_FIELDS.every((name) => Object.hasOwn(value, name));
20547
+ return isObject3(value) && typeof value.ts_url === "string" && RECEIPT_FIELDS.every((name) => Object.hasOwn(value, name));
19254
20548
  }
19255
20549
  function witnessEntries(checkpoint) {
19256
- if (!isObject2(checkpoint) || !Array.isArray(checkpoint.witnesses)) return [];
20550
+ if (!isObject3(checkpoint) || !Array.isArray(checkpoint.witnesses)) return [];
19257
20551
  return checkpoint.witnesses.map((w) => {
19258
20552
  if (!isReceipt(w)) return { stub: false, malformed: true };
19259
20553
  if (w.is_stub === true) return { stub: true, malformed: false };
@@ -19275,7 +20569,7 @@ ${key}`);
19275
20569
  function witnessStatus(bundle, verified) {
19276
20570
  const aac = verified.strict?.witnesses ?? void 0;
19277
20571
  if (aac?.status === "fail") return "invalid";
19278
- const checkpoint = isObject2(bundle) ? bundle.checkpoint : void 0;
20572
+ const checkpoint = isObject3(bundle) ? bundle.checkpoint : void 0;
19279
20573
  const entries = checkedWitnessEntries(witnessEntries(checkpoint), aac);
19280
20574
  if (entries.length === 0) return "absent";
19281
20575
  return entries.some((e) => e.passed) ? "verified" : "not-checked";
@@ -19290,9 +20584,9 @@ ${key}`);
19290
20584
  return verified.strict === void 0 ? "witness-unreported" : "not-witnessed";
19291
20585
  }
19292
20586
  function witnessLine(bundle, verified, w = DEFAULT_WORDS.lines) {
19293
- const checkpoint = isObject2(bundle) ? bundle.checkpoint : void 0;
20587
+ const checkpoint = isObject3(bundle) ? bundle.checkpoint : void 0;
19294
20588
  const page = buildVerificationPageModel(bundle, verified);
19295
- const logId = isObject2(checkpoint) ? asString2(checkpoint.log_id) : void 0;
20589
+ const logId = isObject3(checkpoint) ? asString2(checkpoint.log_id) : void 0;
19296
20590
  const facts = [];
19297
20591
  if (logId !== void 0)
19298
20592
  facts.push(w.t("prov.witness.log", { log: quoted(logId) }));
@@ -19306,7 +20600,7 @@ ${key}`);
19306
20600
  ].some((claim) => claim.findings.includes("checkpoint_unverified"));
19307
20601
  const about = facts.length === 0 ? [] : [
19308
20602
  w.t(
19309
- isObject2(checkpoint) && typeof checkpoint.cose === "string" ? unchecked ? "prov.witness.about.unchecked" : "prov.witness.about" : "prov.witness.about.unsigned",
20603
+ isObject3(checkpoint) && typeof checkpoint.cose === "string" ? unchecked ? "prov.witness.about.unchecked" : "prov.witness.about" : "prov.witness.about.unsigned",
19310
20604
  { facts: facts.join(", ") }
19311
20605
  )
19312
20606
  ];
@@ -19406,7 +20700,7 @@ ${key}`);
19406
20700
  ...build.cllVersion === void 0 ? {} : { cll: build.cllVersion }
19407
20701
  }
19408
20702
  );
19409
- const report = isObject2(bundle) && isObject2(bundle.verification) ? bundle.verification : void 0;
20703
+ const report = isObject3(bundle) && isObject3(bundle.verification) ? bundle.verification : void 0;
19410
20704
  const producer = asString2(report?.producer);
19411
20705
  const version = asString2(report?.version) ?? asString2(report?.producer_version);
19412
20706
  const built = producer === void 0 ? w.t("prov.verifier.built.not-stated") : w.t("prov.verifier.built", {
@@ -19708,7 +21002,7 @@ ${key}`);
19708
21002
  this.name = "ContractError";
19709
21003
  }
19710
21004
  };
19711
- var isObject4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
21005
+ var isObject5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
19712
21006
  async function checkContractInput(contract) {
19713
21007
  if (!/^[0-9a-f]{64}$/u.test(contract.sha256))
19714
21008
  throw new ContractError("contract sha256 is not a lowercase hex SHA-256");
@@ -19728,7 +21022,7 @@ ${key}`);
19728
21022
  `contract is not a compiled Evidence Contract: ${why}`
19729
21023
  );
19730
21024
  };
19731
- if (!isObject4(parsed)) return bad2("not a JSON object");
21025
+ if (!isObject5(parsed)) return bad2("not a JSON object");
19732
21026
  const { id, version, requirements } = parsed;
19733
21027
  if (typeof id !== "string" || id === "")
19734
21028
  return bad2("id is not a non-empty string");
@@ -19737,7 +21031,7 @@ ${key}`);
19737
21031
  if (!Array.isArray(requirements)) return bad2("requirements is not a list");
19738
21032
  const tiers = /* @__PURE__ */ new Map();
19739
21033
  requirements.forEach((requirement, i) => {
19740
- if (!isObject4(requirement))
21034
+ if (!isObject5(requirement))
19741
21035
  return bad2(`requirement ${i + 1} is not an object`);
19742
21036
  const rid = requirement.id;
19743
21037
  if (typeof rid !== "string" || rid === "")
@@ -21406,6 +22700,29 @@ ${key}`);
21406
22700
  page: "outcome-report",
21407
22701
  css: OUTCOME_REPORT_CSS
21408
22702
  };
22703
+ function renderCanvasNotes(notes, model, bundle, w) {
22704
+ const records = bundle?.records;
22705
+ const note = (key, text2) => {
22706
+ const p = el8("p", "", text2);
22707
+ p.dataset.footnote = key;
22708
+ notes.append(p);
22709
+ };
22710
+ if (Array.isArray(records))
22711
+ note(
22712
+ "records",
22713
+ w.t("lines.fn.records", {
22714
+ records: fmtCount(records.length),
22715
+ n: fmtCount(model.totalCount)
22716
+ })
22717
+ );
22718
+ note(
22719
+ "resolved",
22720
+ w.t(
22721
+ model.gating === void 0 ? "lines.fn.resolved" : "lines.fn.resolved.tiered"
22722
+ )
22723
+ );
22724
+ note("readonly", w.t("lines.fn.readonly"));
22725
+ }
21409
22726
  async function drawLines(levels, result3, options, bundle, verified, w, tierOf) {
21410
22727
  const built = buildOutcomeReportModel(result3, options);
21411
22728
  const model = tierOf === void 0 ? built : { ...built, gating: gating(built.conversations, tierOf) };
@@ -21420,6 +22737,7 @@ ${key}`);
21420
22737
  notes.dataset.section = "footnotes";
21421
22738
  renderMeta(pad, model, w, notes);
21422
22739
  renderLines(pad, model, runInfo, w, notes);
22740
+ renderCanvasNotes(notes, model, bundle, w);
21423
22741
  if (notes.childElementCount > 0) pad.append(notes);
21424
22742
  sheet.append(pad);
21425
22743
  levels.L0.append(sheet);
@@ -21514,6 +22832,9 @@ ${key}`);
21514
22832
  return [article, packWord("span", "", ` \xB7 ${title}`)];
21515
22833
  return obligation.mapped ? [producerText(w, article, ` \xB7 ${obligation.title}`)] : [article, element4("span", ` \xB7 ${obligation.title}`)];
21516
22834
  }
22835
+ function packTitlesOnPage(model, w) {
22836
+ return model.obligations.length > 0 && model.obligations.every((o) => w.group(o.key) !== void 0);
22837
+ }
21517
22838
  function testNames(model, w) {
21518
22839
  const rows = new Map(
21519
22840
  model.obligations.flatMap(
@@ -21948,7 +23269,13 @@ ${key}`);
21948
23269
  section.append(table3);
21949
23270
  const notes = el9("aside", "footnotes");
21950
23271
  notes.dataset.section = "footnotes";
21951
- const basis = el9("p", "", w.t("groups.summary.basis"));
23272
+ const basis = el9(
23273
+ "p",
23274
+ "",
23275
+ w.t(
23276
+ packTitlesOnPage(model, w) ? "groups.summary.basis.pack-titles" : "groups.summary.basis"
23277
+ )
23278
+ );
21952
23279
  basis.dataset.basis = "terms";
21953
23280
  notes.append(basis);
21954
23281
  section.append(notes);
@@ -22268,7 +23595,9 @@ ${key}`);
22268
23595
  el9(
22269
23596
  "p",
22270
23597
  "na",
22271
- w.t(obligation.mapped ? "groups.od.mapped" : "groups.od.unmapped")
23598
+ w.t(
23599
+ obligation.mapped ? packTitlesOnPage(model, w) ? "groups.od.mapped.pack-titles" : "groups.od.mapped" : "groups.od.unmapped"
23600
+ )
22272
23601
  )
22273
23602
  );
22274
23603
  if (obligation.judgedTerms.length > 0) {
@@ -22404,8 +23733,304 @@ ${key}`);
22404
23733
  renderReportProofs2(levels.L2, model, bundle, verified, w);
22405
23734
  }
22406
23735
 
23736
+ // src/generic-report-view.ts
23737
+ var GENERIC_FRAME = {
23738
+ tag: "div",
23739
+ className: "gr",
23740
+ page: "contract-report",
23741
+ css: `
23742
+ .gr{${COMPLIANCE_FRAME_VARS}
23743
+ font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Helvetica,Arial,sans-serif;color:var(--ink);background:#fff;display:block;max-width:1080px;margin:26px auto;padding:0 28px}
23744
+ .gr *{box-sizing:border-box}
23745
+ .gr h1,.gr h2,.gr h3{font-family:Georgia,"Iowan Old Style",Cambria,serif;color:var(--navy);margin:0}
23746
+ .gr h1{font-size:28px;margin:6px 0 4px}
23747
+ .gr h2{font-size:21px;margin:0 0 6px}
23748
+ .gr h3{font-size:17px;margin:18px 0 6px}
23749
+ .gr .rsum,.gr .counts{color:var(--slate);margin:0 0 8px}
23750
+ .gr .rnote{font-size:12.5px;color:var(--slate);margin:2px 0 8px}
23751
+ .gr .tally{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:13px;margin:4px 0}
23752
+ .gr .rname{font-weight:600;color:var(--navy)}
23753
+ .gr .rname code,.gr .cid{font-family:ui-monospace,Menlo,monospace;font-size:12.5px;word-break:break-all}
23754
+ .gr ul.claims{list-style:none;margin:6px 0 0;padding:0}
23755
+ .gr .tier-note{font-size:12.5px;color:var(--slate)}
23756
+ ` + levelCss("gr") + frontCss(".gr")
23757
+ };
23758
+ var VERDICT_TONE = {
23759
+ met: "ok",
23760
+ not_met: "bad",
23761
+ not_evaluable: "ne",
23762
+ out_of_scope: "na",
23763
+ failed: "bad",
23764
+ unsupported: "ne"
23765
+ };
23766
+ function shownVerdict(claim) {
23767
+ if (claim.failed) return "failed";
23768
+ return claim.support === "supported" ? claim.verdict : "unsupported";
23769
+ }
23770
+ function el10(tag, className, text2) {
23771
+ const node = document.createElement(tag);
23772
+ if (className !== "") node.className = className;
23773
+ if (text2 !== void 0) node.textContent = text2;
23774
+ return node;
23775
+ }
23776
+ function rowsOf(claims) {
23777
+ const rows = /* @__PURE__ */ new Map();
23778
+ for (const claim of claims) {
23779
+ const key = JSON.stringify([claim.contractRef, claim.requirementRef]);
23780
+ const row2 = rows.get(key);
23781
+ if (row2 === void 0)
23782
+ rows.set(key, {
23783
+ contractRef: claim.contractRef,
23784
+ requirementRef: claim.requirementRef,
23785
+ claims: [claim]
23786
+ });
23787
+ else row2.claims.push(claim);
23788
+ }
23789
+ return [...rows.values()];
23790
+ }
23791
+ function groupOf2(requirementRef) {
23792
+ const dot = requirementRef.indexOf(".");
23793
+ return dot <= 0 ? void 0 : requirementRef.slice(0, dot);
23794
+ }
23795
+ function verdictPill(verdict2, w) {
23796
+ const word = w.enumWord("verdict", verdict2);
23797
+ const shown2 = verdict2 === "failed" || verdict2 === "unsupported" ? w.t(`generic.verdict.${verdict2}`) : word;
23798
+ const pill = wordPill(
23799
+ { word: shown2, tone: VERDICT_TONE[verdict2] ?? "na" },
23800
+ verdict2
23801
+ );
23802
+ pill.dataset.verdict = verdict2;
23803
+ return pill;
23804
+ }
23805
+ function tally(row2, w, later) {
23806
+ const counts = /* @__PURE__ */ new Map();
23807
+ for (const claim of row2.claims) {
23808
+ const verdict2 = shownVerdict(claim);
23809
+ counts.set(verdict2, (counts.get(verdict2) ?? 0) + 1);
23810
+ }
23811
+ const box = el10("div", "tally");
23812
+ for (const [verdict2, n] of counts) {
23813
+ const part = el10("span", "");
23814
+ part.dataset.tally = verdict2;
23815
+ if (later) part.append(w.t("generic.later.readiness"), " ");
23816
+ part.append(verdictPill(verdict2, w), " ");
23817
+ part.append(
23818
+ w.t("generic.tally", {
23819
+ n: n.toLocaleString(),
23820
+ total: row2.claims.length.toLocaleString()
23821
+ })
23822
+ );
23823
+ box.append(part);
23824
+ }
23825
+ return box;
23826
+ }
23827
+ function claimProofs(claim, w) {
23828
+ const body = el10("div", "pf-b");
23829
+ const rows = [
23830
+ [w.t("generic.claim.contract"), claim.contractRef],
23831
+ [w.t("generic.claim.requirement"), claim.requirementRef],
23832
+ assuranceRow(claim, w)
23833
+ ];
23834
+ if (claim.type !== "requirement")
23835
+ rows.push([
23836
+ w.t("generic.claim.type"),
23837
+ claim.recognized ? claim.type : w.t("generic.claim.unrecognized", { type: claim.type })
23838
+ ]);
23839
+ if (claim.failed && claim.failure !== void 0)
23840
+ rows.push([w.t("generic.claim.failure"), claim.failure]);
23841
+ body.append(proofList(rows));
23842
+ const mark = withheldMark(claim, w);
23843
+ if (mark !== void 0) body.append(mark);
23844
+ return body;
23845
+ }
23846
+ function claimItem(claim, w) {
23847
+ const item = el10("li", "");
23848
+ item.dataset.claimRef = claim.id;
23849
+ const head2 = el10("span", "");
23850
+ const id = tagSource(el10("code", "cid", claim.id), "producer");
23851
+ head2.append(id, " ", verdictPill(shownVerdict(claim), w));
23852
+ item.append(
23853
+ levelToggle(2, head2, () => claimProofs(claim, w), { className: "claim" })
23854
+ );
23855
+ return item;
23856
+ }
23857
+ function rowItem(row2, w, later, tierOf) {
23858
+ const label = w.row(row2.requirementRef, "label");
23859
+ const name = el10("span", "rname");
23860
+ if (label !== void 0)
23861
+ name.append(tagSource(el10("span", "", label), "pack"));
23862
+ else name.append(tagSource(el10("code", "", row2.requirementRef), "producer"));
23863
+ const summary = el10("span", "");
23864
+ summary.append(name);
23865
+ const tier = tierOf?.(row2.contractRef, row2.requirementRef);
23866
+ if (tier !== void 0) {
23867
+ const chip = el10("span", "rtier", w.t(`requirement_tier.${tier}`));
23868
+ chip.dataset.requirementTier = tier;
23869
+ summary.append(" ", chip);
23870
+ }
23871
+ summary.append(tally(row2, w, later));
23872
+ const toggle = levelToggle(
23873
+ 1,
23874
+ summary,
23875
+ () => {
23876
+ const body = el10("div", "row-b");
23877
+ const detail = w.row(row2.requirementRef, "detail");
23878
+ if (detail !== void 0) body.append(el10("p", "", detail));
23879
+ const undecided = row2.claims.some(
23880
+ (claim) => !claim.failed && claim.verdict === "not_evaluable"
23881
+ );
23882
+ const note = w.row(row2.requirementRef, "not_evaluable");
23883
+ if (undecided && note !== void 0) body.append(el10("p", "rnote", note));
23884
+ if (later)
23885
+ for (const date of new Set(
23886
+ row2.claims.flatMap(
23887
+ (claim) => claim.appliesFrom === void 0 ? [] : [claim.appliesFrom]
23888
+ )
23889
+ ))
23890
+ body.append(el10("p", "rnote", w.t("generic.later.note", { date })));
23891
+ const list2 = el10("ul", "claims");
23892
+ for (const claim of row2.claims) list2.append(claimItem(claim, w));
23893
+ body.append(el10("h3", "", w.t("generic.claims.h")), list2);
23894
+ return body;
23895
+ },
23896
+ { className: "row" }
23897
+ );
23898
+ toggle.dataset.row = row2.requirementRef;
23899
+ toggle.dataset.contract = row2.contractRef;
23900
+ return toggle;
23901
+ }
23902
+ function groupedRows(rows, w, later, tierOf) {
23903
+ const box = el10("div", "groups");
23904
+ const order = [];
23905
+ const byGroup = /* @__PURE__ */ new Map();
23906
+ for (const row2 of rows) {
23907
+ const group = groupOf2(row2.requirementRef);
23908
+ if (!byGroup.has(group)) {
23909
+ byGroup.set(group, []);
23910
+ order.push(group);
23911
+ }
23912
+ byGroup.get(group).push(row2);
23913
+ }
23914
+ order.sort((a, b) => Number(a === void 0) - Number(b === void 0));
23915
+ for (const group of order) {
23916
+ const part = el10("div", "group");
23917
+ if (group !== void 0) {
23918
+ part.dataset.group = group;
23919
+ const title = w.group(group);
23920
+ const heading = el10("h3", "");
23921
+ heading.append(
23922
+ title !== void 0 ? tagSource(el10("span", "", title), "pack") : tagSource(el10("span", "", group), "producer")
23923
+ );
23924
+ part.append(heading);
23925
+ }
23926
+ for (const row2 of byGroup.get(group))
23927
+ part.append(rowItem(row2, w, later, tierOf));
23928
+ box.append(part);
23929
+ }
23930
+ return box;
23931
+ }
23932
+ function contractHeading(contract, w) {
23933
+ const heading = el10("h2", "", w.t("generic.contract.h"));
23934
+ heading.append(" ", tagSource(el10("code", "", contract), "producer"));
23935
+ return heading;
23936
+ }
23937
+ function byContract(rows, w, later, tierOf) {
23938
+ const contracts = [...new Set(rows.map((row2) => row2.contractRef))];
23939
+ if (contracts.length <= 1) return groupedRows(rows, w, later, tierOf);
23940
+ const box = el10("div", "contracts");
23941
+ for (const contract of contracts) {
23942
+ const part = el10("div", "contract");
23943
+ part.dataset.contract = contract;
23944
+ part.append(
23945
+ contractHeading(contract, w),
23946
+ groupedRows(
23947
+ rows.filter((row2) => row2.contractRef === contract),
23948
+ w,
23949
+ later,
23950
+ tierOf
23951
+ )
23952
+ );
23953
+ box.append(part);
23954
+ }
23955
+ return box;
23956
+ }
23957
+ async function drawGeneric(levels, result3, bundle, verified, w, tierOf) {
23958
+ const tierFor = (claim) => tierOf === void 0 ? "unstated" : tierOf(claim.contractRef, claim.requirementRef);
23959
+ const inForce = result3.claims.filter((claim) => !claim.later);
23960
+ const later = result3.claims.filter((claim) => claim.later);
23961
+ const counted2 = inForce.filter(
23962
+ (claim) => !(tierOf !== void 0 && tierFor(claim) === "informational")
23963
+ );
23964
+ const sheet = el10("div", "l0-card front-card");
23965
+ sheet.append(el10("h1", "", w.t("generic.title")));
23966
+ const summary = reportSummary(w);
23967
+ if (summary !== void 0) sheet.append(summary);
23968
+ const counts = el10(
23969
+ "p",
23970
+ "counts",
23971
+ `${w.p("generic.counts.claims", counted2.length)} \xB7 ${w.p(
23972
+ "generic.counts.rows",
23973
+ rowsOf(counted2).length
23974
+ )}`
23975
+ );
23976
+ counts.dataset.counts = "";
23977
+ sheet.append(counts);
23978
+ levels.L0.append(sheet);
23979
+ const section = el10("section", "front-card");
23980
+ section.dataset.section = "rows";
23981
+ const rows = rowsOf(inForce);
23982
+ if (tierOf === void 0) section.append(byContract(rows, w, false));
23983
+ else
23984
+ for (const tier of ROW_TIERS) {
23985
+ const inTier = rows.filter(
23986
+ (row2) => tierOf(row2.contractRef, row2.requirementRef) === tier
23987
+ );
23988
+ if (inTier.length === 0) continue;
23989
+ const part = el10("div", "tier-section");
23990
+ part.dataset.tierSection = tier;
23991
+ part.append(
23992
+ el10(
23993
+ "h2",
23994
+ "",
23995
+ w.t(`generic.rtier.${tier}.title`, {
23996
+ n: inTier.length.toLocaleString()
23997
+ })
23998
+ ),
23999
+ el10("p", "rnote", w.t(`generic.rtier.${tier}.note`)),
24000
+ byContract(inTier, w, false, tierOf)
24001
+ );
24002
+ section.append(part);
24003
+ }
24004
+ if (later.length > 0) {
24005
+ const part = el10("div", "later-section");
24006
+ part.dataset.section = "not-yet-in-force";
24007
+ const laterRows = rowsOf(later);
24008
+ part.append(
24009
+ el10(
24010
+ "h2",
24011
+ "",
24012
+ w.t("generic.later.title", { n: later.length.toLocaleString() })
24013
+ ),
24014
+ byContract(laterRows, w, true, tierOf)
24015
+ );
24016
+ section.append(part);
24017
+ }
24018
+ section.append(
24019
+ tagSource(el10("p", "rnote", w.t("generic.producer.note")), "core")
24020
+ );
24021
+ levels.L1.append(section);
24022
+ leadWithProvenance(
24023
+ levels.L1,
24024
+ section,
24025
+ renderProvenance(
24026
+ await provenanceLines(result3.records, result3.claims, bundle, verified, w)
24027
+ )
24028
+ );
24029
+ levels.L2.append(renderCheckYourself(bundle, w));
24030
+ }
24031
+
22407
24032
  // src/contract-report.ts
22408
- var FRAMES = { lines: LINES_FRAME, groups: GROUPS_FRAME };
24033
+ var FRAMES = { lines: LINES_FRAME, groups: GROUPS_FRAME, generic: GENERIC_FRAME };
22409
24034
  function tierReader(result3, contract) {
22410
24035
  if (contract === void 0) return void 0;
22411
24036
  const single = citesOneContract(result3) ? result3.claims[0]?.contractRef : void 0;
@@ -22450,7 +24075,7 @@ ${key}`);
22450
24075
  }
22451
24076
  if (input.grouping === "lines")
22452
24077
  await drawLines(levels, result3, input.options, bundle, verified, w, tierOf);
22453
- else
24078
+ else if (input.grouping === "groups")
22454
24079
  await drawGroups(
22455
24080
  levels,
22456
24081
  result3,
@@ -22460,6 +24085,7 @@ ${key}`);
22460
24085
  w,
22461
24086
  tierOf
22462
24087
  );
24088
+ else await drawGeneric(levels, result3, bundle, verified, w, tierOf);
22463
24089
  regions.L0.append(levels.L0);
22464
24090
  regions.L1.append(levels.L1);
22465
24091
  regions.L2.append(levels.L2);
@@ -22820,10 +24446,10 @@ ${key}`);
22820
24446
  }
22821
24447
  }
22822
24448
  var toHex3 = (bytes) => [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
22823
- function readEnvelope(hex5) {
22824
- if (hex5.length % 2 !== 0 || !ANY_HEX.test(hex5)) return void 0;
24449
+ function readEnvelope(hex6) {
24450
+ if (hex6.length % 2 !== 0 || !ANY_HEX.test(hex6)) return void 0;
22825
24451
  const bytes = Uint8Array.from(
22826
- hex5.match(/../gu).map((pair) => parseInt(pair, 16))
24452
+ hex6.match(/../gu).map((pair) => parseInt(pair, 16))
22827
24453
  );
22828
24454
  const tagged = bytes[0] === 210;
22829
24455
  if (!tagged) return void 0;
@@ -22906,7 +24532,7 @@ ${key}`);
22906
24532
  function fieldRows(record) {
22907
24533
  const drawn = /* @__PURE__ */ new Set();
22908
24534
  const rows = [];
22909
- const add2 = (members) => {
24535
+ const add3 = (members) => {
22910
24536
  const present = members.filter((m) => Object.hasOwn(record, m));
22911
24537
  if (present.length === 0) return;
22912
24538
  for (const m of present) drawn.add(m);
@@ -22917,9 +24543,9 @@ ${key}`);
22917
24543
  ...present[0] === "capsule_id" ? { note: "recomputed" } : {}
22918
24544
  });
22919
24545
  };
22920
- for (const members of FIELD_ROWS) add2(members);
24546
+ for (const members of FIELD_ROWS) add3(members);
22921
24547
  for (const key of Object.keys(record))
22922
- if (!drawn.has(key) && !ENVELOPE_MEMBERS.has(key)) add2([key]);
24548
+ if (!drawn.has(key) && !ENVELOPE_MEMBERS.has(key)) add3([key]);
22923
24549
  return rows;
22924
24550
  }
22925
24551
  var REF_TYPE = "agent-action-capsule";
@@ -22929,7 +24555,7 @@ ${key}`);
22929
24555
  const strict2 = context.strict?.records.find((r) => r.capsuleId === capsuleId);
22930
24556
  const t = (key, vars) => w.t(key, vars);
22931
24557
  const rungs = [];
22932
- const add2 = (n, key, status2, note, sub) => {
24558
+ const add3 = (n, key, status2, note, sub) => {
22933
24559
  rungs.push({
22934
24560
  n,
22935
24561
  key,
@@ -22938,7 +24564,7 @@ ${key}`);
22938
24564
  ...note === void 0 ? {} : { note }
22939
24565
  });
22940
24566
  };
22941
- add2(
24567
+ add3(
22942
24568
  1,
22943
24569
  "payload",
22944
24570
  context.recordIndex.has(capsuleId) && (strict2 === void 0 || strict2.identityOk) ? "PASS" : "FAIL",
@@ -22954,7 +24580,7 @@ ${key}`);
22954
24580
  );
22955
24581
  const matched = states.filter((s) => s === "disclosed").length;
22956
24582
  const mismatched = states.filter((s) => s === "disclosure_mismatch").length;
22957
- add2(
24583
+ add3(
22958
24584
  2,
22959
24585
  "content",
22960
24586
  mismatched > 0 ? "FAIL" : matched > 0 ? "PASS" : "NOT_PRESENT",
@@ -22962,7 +24588,7 @@ ${key}`);
22962
24588
  t("record.rung.2.sub")
22963
24589
  );
22964
24590
  const envelope = raw.signature !== void 0;
22965
- add2(
24591
+ add3(
22966
24592
  3,
22967
24593
  "envelope",
22968
24594
  strict2 === void 0 ? envelope ? "NOT_CHECKED" : "NOT_PRESENT" : strict2.signature === "authored" ? "PASS" : strict2.signature === "invalid" ? "FAIL" : "NOT_PRESENT",
@@ -22971,7 +24597,7 @@ ${key}`);
22971
24597
  );
22972
24598
  const chain = object11(raw.chain);
22973
24599
  const parent2 = typeof chain.parent_capsule_id === "string" ? chain.parent_capsule_id : void 0;
22974
- add2(
24600
+ add3(
22975
24601
  4,
22976
24602
  "chain",
22977
24603
  parent2 === void 0 ? "NOT_PRESENT" : context.recordIndex.has(parent2) ? "PASS" : "NOT_CHECKED",
@@ -22995,14 +24621,14 @@ ${key}`);
22995
24621
  if (named) inclusion = "FAIL";
22996
24622
  else inclusionNote = t("record.rung.5.other");
22997
24623
  }
22998
- add2(
24624
+ add3(
22999
24625
  5,
23000
24626
  "inclusion",
23001
24627
  inclusion,
23002
24628
  inclusionNote,
23003
24629
  at === void 0 ? t("record.rung.5.sub.none") : t("record.rung.5.sub", { leaf: at.leafIndex, seq: at.seq })
23004
24630
  );
23005
- add2(
24631
+ add3(
23006
24632
  6,
23007
24633
  "consistency",
23008
24634
  "NOT_CHECKED",
@@ -23011,14 +24637,14 @@ ${key}`);
23011
24637
  );
23012
24638
  const receipts3 = context.strict?.witnesses?.receipts ?? [];
23013
24639
  const passed = receipts3.filter((r) => r.status === "pass").length;
23014
- add2(
24640
+ add3(
23015
24641
  7,
23016
24642
  "witness",
23017
24643
  receipts3.length === 0 ? context.strict === void 0 ? "NOT_CHECKED" : "NOT_PRESENT" : receipts3.some((r) => r.status === "fail") ? "FAIL" : passed === receipts3.length ? "PASS" : "NOT_CHECKED",
23018
24644
  context.strict === void 0 ? t("record.rung.7.note-unread") : receipts3.length === 0 ? t("record.rung.7.none") : t("record.rung.7.count", { n: passed, of: receipts3.length }),
23019
24645
  t("record.rung.7.sub")
23020
24646
  );
23021
- add2(
24647
+ add3(
23022
24648
  8,
23023
24649
  "controller",
23024
24650
  "NOT_CHECKED",
@@ -23031,7 +24657,7 @@ ${key}`);
23031
24657
  const here = refs.filter(
23032
24658
  (r) => context.recordIndex.has(object11(r).digest)
23033
24659
  ).length;
23034
- add2(
24660
+ add3(
23035
24661
  9,
23036
24662
  "references",
23037
24663
  refs.length === 0 ? "NOT_PRESENT" : here === refs.length ? "PASS" : "NOT_CHECKED",
@@ -23043,7 +24669,7 @@ ${key}`);
23043
24669
  (c) => c.evidence.some((e) => e.digest === capsuleId)
23044
24670
  ).length;
23045
24671
  const isResult = result3?.capsuleId === capsuleId;
23046
- add2(
24672
+ add3(
23047
24673
  10,
23048
24674
  "judgment",
23049
24675
  isResult || citing > 0 ? "PASS" : "NOT_PRESENT",
@@ -23052,7 +24678,7 @@ ${key}`);
23052
24678
  );
23053
24679
  const stamps = input.stamps;
23054
24680
  const kinds = new Set(stamps.map((s) => s.kind));
23055
- add2(
24681
+ add3(
23056
24682
  11,
23057
24683
  "countersign",
23058
24684
  stamps.length === 0 || kinds.size === 1 && kinds.has("hollow") ? "NOT_PRESENT" : kinds.has("invalid") ? "FAIL" : stamps.every(
@@ -23063,7 +24689,7 @@ ${key}`);
23063
24689
  );
23064
24690
  return rungs;
23065
24691
  }
23066
- function el10(tag, className, text2) {
24692
+ function el11(tag, className, text2) {
23067
24693
  const node = document.createElement(tag);
23068
24694
  if (className !== void 0) node.className = className;
23069
24695
  if (text2 !== void 0) node.textContent = text2;
@@ -23076,36 +24702,36 @@ ${key}`);
23076
24702
  const { context, capsuleId } = input;
23077
24703
  const voice = input.voice;
23078
24704
  const raw = object11(context.recordIndex.get(capsuleId));
23079
- const card2 = el10("section", "l3-card");
24705
+ const card2 = el11("section", "l3-card");
23080
24706
  card2.dataset.l3 = "envelope";
23081
- card2.append(el10("h4", "l3-k", w.t("record.envelope.title")));
23082
- const hex5 = typeof raw.signature === "string" ? raw.signature : void 0;
23083
- const view = hex5 === void 0 ? void 0 : readEnvelope(hex5);
23084
- if (hex5 === void 0) {
23085
- const none = el10("p", "l3-note", w.t("record.envelope.none"));
24707
+ card2.append(el11("h4", "l3-k", w.t("record.envelope.title")));
24708
+ const hex6 = typeof raw.signature === "string" ? raw.signature : void 0;
24709
+ const view = hex6 === void 0 ? void 0 : readEnvelope(hex6);
24710
+ if (hex6 === void 0) {
24711
+ const none = el11("p", "l3-note", w.t("record.envelope.none"));
23086
24712
  none.dataset.l3 = "no-envelope";
23087
24713
  card2.append(none);
23088
24714
  } else if (view === void 0) {
23089
- const bad2 = el10("p", "l3-note", w.t("record.envelope.unreadable"));
24715
+ const bad2 = el11("p", "l3-note", w.t("record.envelope.unreadable"));
23090
24716
  bad2.dataset.l3 = "unreadable-envelope";
23091
24717
  card2.append(bad2);
23092
24718
  } else {
23093
24719
  const covered = (cls, tag) => {
23094
- const chip = el10("span", `l3-chip ${cls}`, tag);
24720
+ const chip = el11("span", `l3-chip ${cls}`, tag);
23095
24721
  return chip;
23096
24722
  };
23097
- const prot = el10("div", "l3-box l3-prot");
24723
+ const prot = el11("div", "l3-box l3-prot");
23098
24724
  prot.dataset.l3 = "protected";
23099
- const ph = el10("p", "l3-h");
24725
+ const ph = el11("p", "l3-h");
23100
24726
  ph.append(
23101
- el10("b", "", w.t("record.env.protected")),
24727
+ el11("b", "", w.t("record.env.protected")),
23102
24728
  " ",
23103
24729
  covered("l3-green", w.t("record.env.covered"))
23104
24730
  );
23105
24731
  prot.append(ph);
23106
- const dl = el10("dl", "l3-kv");
24732
+ const dl = el11("dl", "l3-kv");
23107
24733
  const row2 = (k, v) => {
23108
- dl.append(el10("dt", "", k), el10("dd", "", v));
24734
+ dl.append(el11("dt", "", k), el11("dd", "", v));
23109
24735
  };
23110
24736
  if (view.alg !== void 0)
23111
24737
  row2(
@@ -23123,17 +24749,17 @@ ${key}`);
23123
24749
  })
23124
24750
  );
23125
24751
  prot.append(dl);
23126
- const un = el10("div", "l3-box l3-unprot");
24752
+ const un = el11("div", "l3-box l3-unprot");
23127
24753
  un.dataset.l3 = "unprotected";
23128
- const uh = el10("p", "l3-h");
24754
+ const uh = el11("p", "l3-h");
23129
24755
  uh.append(
23130
- el10("b", "", w.t("record.env.unprotected")),
24756
+ el11("b", "", w.t("record.env.unprotected")),
23131
24757
  " ",
23132
24758
  covered("l3-grey", w.t("record.env.not-signed"))
23133
24759
  );
23134
24760
  un.append(
23135
24761
  uh,
23136
- el10(
24762
+ el11(
23137
24763
  "p",
23138
24764
  "",
23139
24765
  view.unprotectedEntries === 0 ? w.t("record.env.unprotected.empty") : w.t("record.env.unprotected.entries", {
@@ -23141,17 +24767,17 @@ ${key}`);
23141
24767
  })
23142
24768
  )
23143
24769
  );
23144
- const pay = el10("div", "l3-box l3-payload");
24770
+ const pay = el11("div", "l3-box l3-payload");
23145
24771
  pay.dataset.l3 = "payload";
23146
- const yh = el10("p", "l3-h");
24772
+ const yh = el11("p", "l3-h");
23147
24773
  yh.append(
23148
- el10("b", "", w.t("record.env.payload")),
24774
+ el11("b", "", w.t("record.env.payload")),
23149
24775
  " ",
23150
24776
  covered("l3-green", w.t("record.env.covered"))
23151
24777
  );
23152
24778
  pay.append(
23153
24779
  yh,
23154
- el10(
24780
+ el11(
23155
24781
  "p",
23156
24782
  "",
23157
24783
  view.payloadHex !== void 0 && view.payloadHex === capsuleId ? w.t("record.env.payload.is-id", {
@@ -23159,14 +24785,14 @@ ${key}`);
23159
24785
  }) : w.t("record.env.payload.other")
23160
24786
  )
23161
24787
  );
23162
- const sig = el10("div", "l3-box l3-sig");
24788
+ const sig = el11("div", "l3-box l3-sig");
23163
24789
  sig.dataset.l3 = "signature";
23164
24790
  sig.append(
23165
- el10("p", "", w.t("record.env.signature", { bytes: view.signatureBytes }))
24791
+ el11("p", "", w.t("record.env.signature", { bytes: view.signatureBytes }))
23166
24792
  );
23167
24793
  card2.append(prot, un, pay, sig);
23168
24794
  }
23169
- card2.append(el10("p", "l3-note", w.t(`record.envelope.foot.${voice}`)));
24795
+ card2.append(el11("p", "l3-note", w.t(`record.envelope.foot.${voice}`)));
23170
24796
  return card2;
23171
24797
  }
23172
24798
  function tagWord(tag, w) {
@@ -23174,18 +24800,18 @@ ${key}`);
23174
24800
  }
23175
24801
  function capsuleCard(input, w) {
23176
24802
  const raw = object11(input.context.recordIndex.get(input.capsuleId));
23177
- const card2 = el10("section", "l3-card");
24803
+ const card2 = el11("section", "l3-card");
23178
24804
  card2.dataset.l3 = "capsule";
23179
- card2.append(el10("h4", "l3-k", w.t("record.capsule.title")));
23180
- const dl = el10("dl", "l3-fields");
24805
+ card2.append(el11("h4", "l3-k", w.t("record.capsule.title")));
24806
+ const dl = el11("dl", "l3-fields");
23181
24807
  for (const row2 of fieldRows(raw)) {
23182
- const dt = el10("dt", "", row2.label);
23183
- const dd = el10("dd");
24808
+ const dt = el11("dt", "", row2.label);
24809
+ const dd = el11("dd");
23184
24810
  dd.append(row2.value);
23185
24811
  if (row2.note === "recomputed")
23186
24812
  dd.append(" \xB7 ", w.t("record.capsule.recomputed"));
23187
24813
  for (const tag of row2.tags) {
23188
- const chip = el10("span", `l3-chip l3-tag-${tag}`, tagWord(tag, w));
24814
+ const chip = el11("span", `l3-chip l3-tag-${tag}`, tagWord(tag, w));
23189
24815
  chip.dataset.tag = tag;
23190
24816
  dd.append(" ", chip);
23191
24817
  }
@@ -23196,11 +24822,11 @@ ${key}`);
23196
24822
  }
23197
24823
  function ladderCard(input, w) {
23198
24824
  const voice = input.voice;
23199
- const card2 = el10("section", "l3-card l3-ladder");
24825
+ const card2 = el11("section", "l3-card l3-ladder");
23200
24826
  card2.dataset.l3 = "ladder";
23201
- card2.append(el10("h3", "l3-title", w.t("record.ladder.title")));
23202
- const table3 = el10("table", "l3-table");
23203
- const head2 = el10("tr");
24827
+ card2.append(el11("h3", "l3-title", w.t("record.ladder.title")));
24828
+ const table3 = el11("table", "l3-table");
24829
+ const head2 = el11("tr");
23204
24830
  for (const key of [
23205
24831
  "record.ladder.col.n",
23206
24832
  "record.ladder.col.proof",
@@ -23208,28 +24834,28 @@ ${key}`);
23208
24834
  "record.ladder.col.status",
23209
24835
  "record.ladder.col.check"
23210
24836
  ])
23211
- head2.append(el10("th", "", w.t(key)));
23212
- const thead = el10("thead");
24837
+ head2.append(el11("th", "", w.t(key)));
24838
+ const thead = el11("thead");
23213
24839
  thead.append(head2);
23214
24840
  table3.append(thead);
23215
- const body = el10("tbody");
24841
+ const body = el11("tbody");
23216
24842
  for (const rung of ladder(input, w)) {
23217
- const tr = el10("tr");
24843
+ const tr = el11("tr");
23218
24844
  tr.dataset.rung = String(rung.n);
23219
24845
  tr.dataset.rungStatus = rung.status;
23220
- tr.append(el10("td", "l3-n", String(rung.n)));
23221
- const name = el10("td");
24846
+ tr.append(el11("td", "l3-n", String(rung.n)));
24847
+ const name = el11("td");
23222
24848
  name.append(
23223
- el10("b", "", w.t(`record.rung.${rung.n}.title`)),
23224
- el10("div", "l3-sub", rung.sub)
24849
+ el11("b", "", w.t(`record.rung.${rung.n}.title`)),
24850
+ el11("div", "l3-sub", rung.sub)
23225
24851
  );
23226
- tr.append(name, el10("td", "", w.t(`record.rung.${rung.n}.proves.${voice}`)));
23227
- const status2 = el10("td");
23228
- const chip = el10("span", `l3-status l3-s-${rung.status}`, rung.status);
24852
+ tr.append(name, el11("td", "", w.t(`record.rung.${rung.n}.proves.${voice}`)));
24853
+ const status2 = el11("td");
24854
+ const chip = el11("span", `l3-status l3-s-${rung.status}`, rung.status);
23229
24855
  chip.dataset.status = rung.status;
23230
24856
  status2.append(chip);
23231
24857
  if (rung.note !== void 0) status2.append(" ", rung.note);
23232
- tr.append(status2, el10("td", "l3-cmd", w.t(`record.rung.${rung.n}.check`)));
24858
+ tr.append(status2, el11("td", "l3-cmd", w.t(`record.rung.${rung.n}.check`)));
23233
24859
  body.append(tr);
23234
24860
  }
23235
24861
  table3.append(body);
@@ -23237,12 +24863,12 @@ ${key}`);
23237
24863
  return card2;
23238
24864
  }
23239
24865
  function footer(w) {
23240
- const foot = el10("section", "l3-card l3-foot");
24866
+ const foot = el11("section", "l3-card l3-foot");
23241
24867
  foot.dataset.l3 = "foot";
23242
24868
  for (const key of ["order", "status", "sdk"]) {
23243
- const col = el10("p");
24869
+ const col = el11("p");
23244
24870
  col.append(
23245
- el10("b", "", w.t(`record.foot.${key}.k`)),
24871
+ el11("b", "", w.t(`record.foot.${key}.k`)),
23246
24872
  ` ${w.t(`record.foot.${key}`)}`
23247
24873
  );
23248
24874
  foot.append(col);
@@ -23251,19 +24877,19 @@ ${key}`);
23251
24877
  }
23252
24878
  function renderRecordPage(input, w) {
23253
24879
  const raw = object11(input.context.recordIndex.get(input.capsuleId));
23254
- const page = el10("div", "cv-l3");
24880
+ const page = el11("div", "cv-l3");
23255
24881
  page.dataset.level = "3";
23256
24882
  page.dataset.recordPage = input.capsuleId;
23257
24883
  page.dataset.voice = input.voice;
23258
24884
  const actionId = typeof raw.action_id === "string" ? raw.action_id : "";
23259
24885
  page.append(
23260
- el10(
24886
+ el11(
23261
24887
  "p",
23262
24888
  "l3-banner",
23263
24889
  w.t(`record.banner.${input.voice}`, { action: actionId })
23264
24890
  )
23265
24891
  );
23266
- const cols = el10("div", "l3-cols");
24892
+ const cols = el11("div", "l3-cols");
23267
24893
  cols.append(envelopeCard(input, w), capsuleCard(input, w));
23268
24894
  page.append(cols, ladderCard(input, w), footer(w));
23269
24895
  return page;
@@ -23314,6 +24940,7 @@ ${key}`);
23314
24940
  .cv-strip .agg-bucket b{font-family:Georgia,"Iowan Old Style",Cambria,serif;font-size:28px;line-height:1.1;font-variant-numeric:tabular-nums}
23315
24941
  .cv-strip .agg-bucket span{font-size:12.5px;color:var(--slate);overflow-wrap:anywhere}
23316
24942
  .cv-strip .count.mismatch{font-size:12px;font-weight:600;color:var(--bad)}
24943
+ .cv-strip .agg-calibration{font-size:13px;color:var(--slate);margin:-6px 0 12px}
23317
24944
  .cv-strip .agg-note{font-size:12.5px;color:var(--slate);margin:6px 0 0}
23318
24945
  .cv-strip .agg-bucket.met b{color:var(--ok)}
23319
24946
  .cv-strip .agg-bucket.not_met b{color:var(--bad)}
@@ -23321,40 +24948,74 @@ ${key}`);
23321
24948
  @media (max-width:640px){.cv-strip .agg-buckets{grid-template-columns:minmax(0,1fr)}.cv-strip .agg-bucket{flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:4px 10px}.cv-strip .agg-bucket b{font-size:22px}}
23322
24949
  @media print{.cv-strip{break-inside:avoid}}
23323
24950
  `;
23324
- function el11(tag, className, text2) {
24951
+ function el12(tag, className, text2) {
23325
24952
  const node = document.createElement(tag);
23326
24953
  if (className !== "") node.className = className;
23327
24954
  if (text2 !== void 0) node.textContent = text2;
23328
24955
  return node;
23329
24956
  }
23330
24957
  var fmt5 = (n) => n.toLocaleString("en-US");
23331
- function mismatchMarker(result3, field, w) {
23332
- const mismatch = result3.countMismatches.find(
23333
- (entry) => entry.field === field
23334
- );
23335
- if (mismatch === void 0) return void 0;
23336
- const marker = el11(
24958
+ var CALIBRATION_CLAIM2 = "calibration";
24959
+ var isCalibration = (claim) => claim.type === CALIBRATION_CLAIM2;
24960
+ function fieldCount(result3, field, sealed, bucketIds) {
24961
+ const mismatch = result3.countMismatches.find((e) => e.field === field);
24962
+ const recomputed = mismatch === void 0 ? sealed : mismatch.recomputed;
24963
+ const calibration = result3.claims.filter((c) => isCalibration(c) && !c.later);
24964
+ const counted2 = (c) => field === "evaluated_population" ? true : field === "unknown_count" ? c.sufficiency === "UNKNOWN" : field !== "not_yet_in_force" && c.verdict === field.slice("buckets.".length);
24965
+ const sealedSide = calibration.filter(
24966
+ (c) => field === "evaluated_population" || (bucketIds === void 0 ? counted2(c) : bucketIds.includes(c.id))
24967
+ ).length;
24968
+ const claimsSide = calibration.filter(
24969
+ (c) => (field === "evaluated_population" || !c.failed) && counted2(c)
24970
+ ).length;
24971
+ return {
24972
+ drawn: sealed >= sealedSide ? sealed - sealedSide : sealed,
24973
+ recomputed: recomputed >= claimsSide ? recomputed - claimsSide : recomputed,
24974
+ gap: sealed - sealedSide !== recomputed - claimsSide
24975
+ };
24976
+ }
24977
+ function mismatchMarker(count2, field, w) {
24978
+ if (!count2.gap) return void 0;
24979
+ const marker = el12(
23337
24980
  "span",
23338
24981
  "count mismatch",
23339
- w.t("front.agg.mismatch", { recomputed: fmt5(mismatch.recomputed) })
24982
+ w.t("front.agg.mismatch", { recomputed: fmt5(count2.recomputed) })
23340
24983
  );
23341
24984
  marker.dataset.countMismatch = field;
23342
- marker.dataset.stated = String(mismatch.stated);
23343
- marker.dataset.recomputed = String(mismatch.recomputed);
24985
+ marker.dataset.stated = String(count2.drawn);
24986
+ marker.dataset.recomputed = String(count2.recomputed);
23344
24987
  return marker;
23345
24988
  }
23346
24989
  function renderAggregate(result3, w) {
23347
24990
  const out = document.createDocumentFragment();
23348
- const stated = result3.statedCoverage;
24991
+ const sealed = result3.statedCoverage;
24992
+ const calibrationInForce = result3.claims.filter(
24993
+ (c) => isCalibration(c) && !c.later
24994
+ );
24995
+ const population2 = fieldCount(
24996
+ result3,
24997
+ "evaluated_population",
24998
+ sealed.evaluatedPopulation
24999
+ );
25000
+ const unknown = fieldCount(result3, "unknown_count", sealed.unknownCount);
25001
+ const laterCount = fieldCount(
25002
+ result3,
25003
+ "not_yet_in_force",
25004
+ sealed.notYetInForce ?? 0
25005
+ );
25006
+ const stated = {
25007
+ evaluatedPopulation: population2.drawn,
25008
+ excludedNotApplicable: sealed.excludedNotApplicable
25009
+ };
23349
25010
  const requirements = new Set(
23350
- result3.claims.filter((claim) => !claim.later).map(
25011
+ result3.claims.filter((claim) => !claim.later && !isCalibration(claim)).map(
23351
25012
  (claim) => JSON.stringify([claim.contractRef, claim.requirementRef])
23352
25013
  )
23353
25014
  ).size;
23354
- const line = el11("p", "agg-line");
23355
- const marked = (text2, field) => {
25015
+ const line = el12("p", "agg-line");
25016
+ const marked = (text2, field, figure) => {
23356
25017
  line.append(text2);
23357
- const marker = mismatchMarker(result3, field, w);
25018
+ const marker = mismatchMarker(figure, field, w);
23358
25019
  if (marker !== void 0) line.append(" ", marker);
23359
25020
  };
23360
25021
  marked(
@@ -23366,7 +25027,8 @@ ${key}`);
23366
25027
  n: fmt5(requirements)
23367
25028
  })
23368
25029
  }),
23369
- "evaluated_population"
25030
+ "evaluated_population",
25031
+ population2
23370
25032
  );
23371
25033
  line.append(
23372
25034
  " \xB7 ",
@@ -23376,26 +25038,39 @@ ${key}`);
23376
25038
  " \xB7 "
23377
25039
  );
23378
25040
  marked(
23379
- w.p("front.agg.unknown", stated.unknownCount, {
23380
- n: fmt5(stated.unknownCount)
25041
+ w.p("front.agg.unknown", unknown.drawn, {
25042
+ n: fmt5(unknown.drawn)
23381
25043
  }),
23382
- "unknown_count"
25044
+ "unknown_count",
25045
+ unknown
23383
25046
  );
23384
- const later = stated.notYetInForce;
25047
+ const later = sealed.notYetInForce;
23385
25048
  if (later !== void 0 || result3.countMismatches.some((m) => m.field === "not_yet_in_force")) {
23386
25049
  line.append(" \xB7 ");
23387
25050
  marked(
23388
- w.p("front.agg.later", later ?? 0, { n: fmt5(later ?? 0) }),
23389
- "not_yet_in_force"
25051
+ w.p("front.agg.later", laterCount.drawn, { n: fmt5(laterCount.drawn) }),
25052
+ "not_yet_in_force",
25053
+ laterCount
23390
25054
  );
23391
- line.dataset.notYetInForce = String(later ?? 0);
25055
+ line.dataset.notYetInForce = String(laterCount.drawn);
23392
25056
  }
23393
25057
  line.dataset.evaluated = String(stated.evaluatedPopulation);
23394
25058
  line.dataset.requirements = String(requirements);
23395
25059
  line.dataset.excluded = String(stated.excludedNotApplicable);
23396
- line.dataset.unknown = String(stated.unknownCount);
25060
+ line.dataset.unknown = String(unknown.drawn);
23397
25061
  out.append(line);
23398
- const buckets = el11("div", "agg-buckets");
25062
+ if (calibrationInForce.length > 0) {
25063
+ const calibration = el12(
25064
+ "p",
25065
+ "agg-calibration",
25066
+ w.p("front.agg.calibration", calibrationInForce.length, {
25067
+ n: fmt5(calibrationInForce.length)
25068
+ })
25069
+ );
25070
+ calibration.dataset.calibration = String(calibrationInForce.length);
25071
+ out.append(calibration);
25072
+ }
25073
+ const buckets = el12("div", "agg-buckets");
23399
25074
  const of = w.t("front.agg.of", { n: fmt5(stated.evaluatedPopulation) });
23400
25075
  const entries = [
23401
25076
  ["met", result3.buckets.met, "buckets.met"],
@@ -23405,19 +25080,20 @@ ${key}`);
23405
25080
  ];
23406
25081
  for (const [verdict2, ids, field] of entries) {
23407
25082
  if (ids === void 0) continue;
23408
- const box = el11("div", `agg-bucket ${verdict2}`);
25083
+ const figure = fieldCount(result3, field, ids.length, ids);
25084
+ const box = el12("div", `agg-bucket ${verdict2}`);
23409
25085
  box.dataset.bucket = verdict2;
23410
- box.dataset.count = String(ids.length);
25086
+ box.dataset.count = String(figure.drawn);
23411
25087
  box.dataset.of = String(stated.evaluatedPopulation);
23412
- box.append(el11("b", "", fmt5(ids.length)));
23413
- const caption = el11("div", "agg-cap");
25088
+ box.append(el12("b", "", fmt5(figure.drawn)));
25089
+ const caption = el12("div", "agg-cap");
23414
25090
  caption.append(
23415
- tagSource(el11("span", "", w.t(`front.agg.bucket.${verdict2}`)), "pack"),
25091
+ tagSource(el12("span", "", w.t(`front.agg.bucket.${verdict2}`)), "pack"),
23416
25092
  document.createTextNode(" \xB7 "),
23417
- el11("span", "agg-of", of)
25093
+ el12("span", "agg-of", of)
23418
25094
  );
23419
25095
  box.append(caption);
23420
- const marker = mismatchMarker(result3, field, w);
25096
+ const marker = mismatchMarker(figure, field, w);
23421
25097
  if (marker !== void 0) box.append(marker);
23422
25098
  buckets.append(box);
23423
25099
  }
@@ -23425,7 +25101,7 @@ ${key}`);
23425
25101
  const dated = result3.claims.some((claim) => claim.appliesFrom !== void 0);
23426
25102
  const switched = result3.buckets.outOfScope !== void 0;
23427
25103
  if (dated || switched) {
23428
- const copied = el11("p", "agg-note");
25104
+ const copied = el12("p", "agg-note");
23429
25105
  if (dated) {
23430
25106
  const date = utcDateOf(result3.generatedAt) ?? result3.generatedAt;
23431
25107
  copied.append(w.t("front.agg.as-of", { date }), " ");
@@ -23468,15 +25144,15 @@ ${key}`);
23468
25144
  facts.push(w.t("front.core.pin", { digest: shortDigest(model.pins[0]) }));
23469
25145
  else if (model.pins.length > 1)
23470
25146
  facts.push(w.t("front.core.pins", { n: fmt5(model.pins.length) }));
23471
- const block = el11("div", "core-id");
25147
+ const block = el12("div", "core-id");
23472
25148
  block.dataset.section = "core-identity";
23473
25149
  const top = tagSource(
23474
- el11("p", "agg-note core-kicker", kicker.join(" \xB7 ")),
25150
+ el12("p", "agg-note core-kicker", kicker.join(" \xB7 ")),
23475
25151
  "core"
23476
25152
  );
23477
25153
  top.dataset.coreKicker = "";
23478
25154
  const rest = tagSource(
23479
- el11("p", "agg-note core-facts", facts.join(" \xB7 ")),
25155
+ el12("p", "agg-note core-facts", facts.join(" \xB7 ")),
23480
25156
  "core"
23481
25157
  );
23482
25158
  rest.dataset.coreFacts = "";
@@ -23484,23 +25160,23 @@ ${key}`);
23484
25160
  return block;
23485
25161
  }
23486
25162
  async function coreStripModel(result3, words) {
23487
- const tally = await tallyJudges(result3.records, result3.claims);
25163
+ const tally2 = await tallyJudges(result3.records, result3.claims);
23488
25164
  return {
23489
25165
  result: result3,
23490
25166
  words,
23491
- mock: judgedByMock(tally),
23492
- pins: tally.pins.map((pin) => pin.digest)
25167
+ mock: judgedByMock(tally2),
25168
+ pins: tally2.pins.map((pin) => pin.digest)
23493
25169
  };
23494
25170
  }
23495
25171
  function renderCoreStrip(model) {
23496
- const strip = el11("section", "cv-strip");
25172
+ const strip = el12("section", "cv-strip");
23497
25173
  strip.setAttribute(CORE_STRIP_ATTRIBUTE, "");
23498
25174
  strip.dataset.section = "aggregate";
23499
25175
  const style = document.createElement("style");
23500
25176
  style.textContent = CORE_STRIP_CSS;
23501
25177
  strip.append(style);
23502
25178
  if (model.mock) {
23503
- const mark = el11("p", "mockmark", model.words.t("front.mock"));
25179
+ const mark = el12("p", "mockmark", model.words.t("front.mock"));
23504
25180
  mark.dataset.section = "mock-judge";
23505
25181
  strip.append(mark);
23506
25182
  }
@@ -23510,7 +25186,7 @@ ${key}`);
23510
25186
  }
23511
25187
 
23512
25188
  // src/record-content.ts
23513
- var isObject5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
25189
+ var isObject6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
23514
25190
  function canonicalJson(value, indent) {
23515
25191
  const pad = indent === void 0 ? "" : " ".repeat(indent);
23516
25192
  const write = (v, depth) => {
@@ -23521,7 +25197,7 @@ ${pad.repeat(depth)}`;
23521
25197
  const colon = pad === "" ? ":" : ": ";
23522
25198
  if (Array.isArray(v))
23523
25199
  return v.length === 0 ? "[]" : `[${v.map((item) => open + write(item, depth + 1)).join(",")}${close}]`;
23524
- if (isObject5(v)) {
25200
+ if (isObject6(v)) {
23525
25201
  const keys = Object.keys(v).sort(byCodeUnits);
23526
25202
  return keys.length === 0 ? "{}" : `{${keys.map(
23527
25203
  (key) => `${open}${JSON.stringify(key)}${colon}${write(v[key], depth + 1)}`
@@ -23535,12 +25211,12 @@ ${pad.repeat(depth)}`;
23535
25211
  return a < b ? -1 : a > b ? 1 : 0;
23536
25212
  }
23537
25213
  function conversationTurns(content) {
23538
- if (!isObject5(content)) return void 0;
23539
- const interaction = isObject5(content.agent_interaction) ? content.agent_interaction : void 0;
25214
+ if (!isObject6(content)) return void 0;
25215
+ const interaction = isObject6(content.agent_interaction) ? content.agent_interaction : void 0;
23540
25216
  if (interaction === void 0 || !Array.isArray(interaction.messages))
23541
25217
  return void 0;
23542
25218
  return interaction.messages.flatMap((m) => {
23543
- if (!isObject5(m)) return [];
25219
+ if (!isObject6(m)) return [];
23544
25220
  const role = typeof m.role === "string" ? m.role : "unknown";
23545
25221
  const text2 = typeof m.content === "string" ? m.content : void 0;
23546
25222
  const calls = Array.isArray(m.tool_calls) ? m.tool_calls : [];
@@ -23549,7 +25225,7 @@ ${pad.repeat(depth)}`;
23549
25225
  role,
23550
25226
  ...text2 === void 0 ? {} : { content: text2 },
23551
25227
  toolCalls: calls.flatMap(
23552
- (call) => isObject5(call) ? [
25228
+ (call) => isObject6(call) ? [
23553
25229
  {
23554
25230
  name: typeof call.name === "string" ? call.name : "unnamed",
23555
25231
  // Re-serialised as there, but in canonical member order,
@@ -24215,14 +25891,14 @@ ${pad.repeat(depth)}`;
24215
25891
  if (failed2 === 0 && (pageFailed > 0 || !verified) && notRun > 0)
24216
25892
  leads.push(`${notRun} of ${total} checks not run`);
24217
25893
  const parts = [...leads, recordsWord2(model.records.length)];
24218
- const signatures = model.checkLists.notChecked.flatMap((id) => {
25894
+ const signatures2 = model.checkLists.notChecked.flatMap((id) => {
24219
25895
  const words = SIGNATURE_CHECKS.get(id);
24220
25896
  return words === void 0 ? [] : [words];
24221
25897
  });
24222
- const others = model.checkLists.notChecked.length - signatures.length;
24223
- if (signatures.length > 0)
25898
+ const others = model.checkLists.notChecked.length - signatures2.length;
25899
+ if (signatures2.length > 0)
24224
25900
  parts.push(
24225
- `${signatures.length === 1 ? signatures[0] : `${signatures.slice(0, -1).join(", ")} and ${signatures.at(-1)}`} not checked here`
25901
+ `${signatures2.length === 1 ? signatures2[0] : `${signatures2.slice(0, -1).join(", ")} and ${signatures2.at(-1)}`} not checked here`
24226
25902
  );
24227
25903
  if (others > 0)
24228
25904
  parts.push(
@@ -25196,11 +26872,11 @@ ${pad.repeat(depth)}`;
25196
26872
  host.append(list2);
25197
26873
  }
25198
26874
  }
25199
- function shownVerdict(claim) {
26875
+ function shownVerdict2(claim) {
25200
26876
  return claim.failed ? "failed" : claim.support === "supported" ? claim.verdict : "unsupported";
25201
26877
  }
25202
26878
  function appendVerdict(parent2, claim) {
25203
- const shown2 = shownVerdict(claim);
26879
+ const shown2 = shownVerdict2(claim);
25204
26880
  const cell2 = element6(
25205
26881
  parent2.tagName === "TR" ? "td" : "dd",
25206
26882
  claim.later ? `${shown2} (readiness)` : shown2
@@ -25381,7 +27057,7 @@ ${pad.repeat(depth)}`;
25381
27057
  for (const claim of later) {
25382
27058
  const item = element6(
25383
27059
  "li",
25384
- `${claim.id} \xB7 applies from ${claim.appliesFrom ?? ""} \xB7 readiness: ${shownVerdict(claim)}`
27060
+ `${claim.id} \xB7 applies from ${claim.appliesFrom ?? ""} \xB7 readiness: ${shownVerdict2(claim)}`
25385
27061
  );
25386
27062
  item.dataset.claimRef = claim.id;
25387
27063
  if (claim.failed) item.className = "claim-failed";
@@ -25556,7 +27232,7 @@ ${pad.repeat(depth)}`;
25556
27232
  id: "capsuleviewer.contract-report/v0"
25557
27233
  });
25558
27234
  function contractReportGroupingOf(bundle) {
25559
- return contractReportInput(bundle)?.grouping;
27235
+ return contractReportInput(bundle)?.grouping ?? "generic";
25560
27236
  }
25561
27237
  function contractReportInput(bundle) {
25562
27238
  const options = readOutcomeReportPresentation(bundle);
@@ -25598,9 +27274,12 @@ ${pad.repeat(depth)}`;
25598
27274
  CONTRACT_REPORT_MANIFEST.id
25599
27275
  );
25600
27276
  const supported = contractReportInput(context.bundle);
25601
- const input = supported !== void 0 && claimsFitCard(result3, supported.grouping) ? supported : void 0;
27277
+ const input = supported === void 0 ? { grouping: "generic" } : claimsFitCard(result3, supported.grouping) ? supported : void 0;
25602
27278
  if (typeof context.bundle === "object" && context.bundle !== null)
25603
- contractReportDrawn.set(context.bundle, input ?? null);
27279
+ contractReportDrawn.set(
27280
+ context.bundle,
27281
+ input === void 0 || input.grouping === "generic" ? null : input
27282
+ );
25604
27283
  return {
25605
27284
  result: result3,
25606
27285
  ...input === void 0 ? {} : { input },
@@ -25619,9 +27298,10 @@ ${pad.repeat(depth)}`;
25619
27298
  renderResultPage(model.result, host.L1);
25620
27299
  return;
25621
27300
  }
25622
- host.setChromeClass(
25623
- model.input.grouping === "lines" ? OUTCOME_CHROME : COMPLIANCE_CHROME
25624
- );
27301
+ if (model.input.grouping !== "generic")
27302
+ host.setChromeClass(
27303
+ model.input.grouping === "lines" ? OUTCOME_CHROME : COMPLIANCE_CHROME
27304
+ );
25625
27305
  await renderContractReport(
25626
27306
  model.result,
25627
27307
  model.input,
@@ -26107,7 +27787,7 @@ ${pad.repeat(depth)}`;
26107
27787
  const charted = options.charts !== void 0 && options.charts.length > 0;
26108
27788
  if (verified) {
26109
27789
  const result3 = await resultRootOf(context);
26110
- const grouping = contractReportGroupingOf(bundle) ?? "lines";
27790
+ const grouping = contractReportGroupingOf(bundle);
26111
27791
  const words = result3 === void 0 && !charted ? void 0 : await contractReportWords(grouping, options.wording, {
26112
27792
  singleContract: result3 !== void 0 && citesOneContract(result3)
26113
27793
  });
@@ -26412,7 +28092,7 @@ ${pad.repeat(depth)}`;
26412
28092
  contract,
26413
28093
  verified ? {
26414
28094
  words: await contractReportWords(
26415
- contractReportGroupingOf(bundle) ?? "lines",
28095
+ contractReportGroupingOf(bundle),
26416
28096
  options.wording
26417
28097
  ),
26418
28098
  voice: options.voice ?? "shared"
@@ -26524,10 +28204,10 @@ ${pad.repeat(depth)}`;
26524
28204
  held = parsed;
26525
28205
  return true;
26526
28206
  }
26527
- var fromHex2 = (hex5) => {
26528
- const out = new Uint8Array(new ArrayBuffer(hex5.length / 2));
28207
+ var fromHex2 = (hex6) => {
28208
+ const out = new Uint8Array(new ArrayBuffer(hex6.length / 2));
26529
28209
  for (let i = 0; i < out.length; i += 1)
26530
- out[i] = Number.parseInt(hex5.slice(2 * i, 2 * i + 2), 16);
28210
+ out[i] = Number.parseInt(hex6.slice(2 * i, 2 * i + 2), 16);
26531
28211
  return out;
26532
28212
  };
26533
28213
  async function readerAnchorWitness(anchor, checkpoint, receipts3) {
@@ -26586,11 +28266,11 @@ ${pad.repeat(depth)}`;
26586
28266
  } catch {
26587
28267
  return "NOT_CHECKED";
26588
28268
  }
26589
- const hex5 = Array.from(
28269
+ const hex6 = Array.from(
26590
28270
  new Uint8Array(digest),
26591
28271
  (b) => b.toString(16).padStart(2, "0")
26592
28272
  ).join("");
26593
- return hex5 === hash2.toLowerCase() ? "PASS" : "FAIL";
28273
+ return hex6 === hash2.toLowerCase() ? "PASS" : "FAIL";
26594
28274
  }
26595
28275
 
26596
28276
  // src/cadence-witness.ts