@action-state-group/capsule-viewer 0.9.0 → 0.11.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.
- package/README.md +3 -1
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +15 -3
- package/dist/browser.js.map +1 -1
- package/dist/cadence-witness.d.ts +29 -0
- package/dist/cadence-witness.js +324 -0
- package/dist/cadence-witness.js.map +1 -0
- package/dist/card-signature.d.ts +18 -0
- package/dist/card-signature.js +39 -0
- package/dist/card-signature.js.map +1 -0
- package/dist/evidence-graph.iife.js +626 -333
- package/dist/payment-preimage.d.ts +12 -0
- package/dist/payment-preimage.js +46 -0
- package/dist/payment-preimage.js.map +1 -0
- package/dist/viewer-build.js +1 -1
- package/dist/viewer-build.js.map +1 -1
- package/package.json +1 -1
|
@@ -562,21 +562,21 @@ var EvidenceGraph = (() => {
|
|
|
562
562
|
function encodeUint(writer, token) {
|
|
563
563
|
return encodeUintValue(writer, 0, token.value);
|
|
564
564
|
}
|
|
565
|
-
function encodeUintValue(writer, major,
|
|
566
|
-
if (
|
|
567
|
-
const nuint = Number(
|
|
565
|
+
function encodeUintValue(writer, major, uint2) {
|
|
566
|
+
if (uint2 < uintBoundaries[0]) {
|
|
567
|
+
const nuint = Number(uint2);
|
|
568
568
|
writer.pushByte(major | nuint);
|
|
569
|
-
} else if (
|
|
570
|
-
const nuint = Number(
|
|
569
|
+
} else if (uint2 < uintBoundaries[1]) {
|
|
570
|
+
const nuint = Number(uint2);
|
|
571
571
|
writer.push([major | 24, nuint]);
|
|
572
|
-
} else if (
|
|
573
|
-
const nuint = Number(
|
|
572
|
+
} else if (uint2 < uintBoundaries[2]) {
|
|
573
|
+
const nuint = Number(uint2);
|
|
574
574
|
writer.push([major | 25, nuint >>> 8, nuint & 255]);
|
|
575
|
-
} else if (
|
|
576
|
-
const nuint = Number(
|
|
575
|
+
} else if (uint2 < uintBoundaries[3]) {
|
|
576
|
+
const nuint = Number(uint2);
|
|
577
577
|
writer.push([major | 26, nuint >>> 24 & 255, nuint >>> 16 & 255, nuint >>> 8 & 255, nuint & 255]);
|
|
578
578
|
} else {
|
|
579
|
-
const buint = BigInt(
|
|
579
|
+
const buint = BigInt(uint2);
|
|
580
580
|
if (buint < uintBoundaries[4]) {
|
|
581
581
|
const set = [major | 27, 0, 0, 0, 0, 0, 0, 0];
|
|
582
582
|
let lo = Number(buint & BigInt(4294967295));
|
|
@@ -610,17 +610,17 @@ var EvidenceGraph = (() => {
|
|
|
610
610
|
encodeUint.encodedSize = function encodedSize(token) {
|
|
611
611
|
return encodeUintValue.encodedSize(token.value);
|
|
612
612
|
};
|
|
613
|
-
encodeUintValue.encodedSize = function encodedSize2(
|
|
614
|
-
if (
|
|
613
|
+
encodeUintValue.encodedSize = function encodedSize2(uint2) {
|
|
614
|
+
if (uint2 < uintBoundaries[0]) {
|
|
615
615
|
return 1;
|
|
616
616
|
}
|
|
617
|
-
if (
|
|
617
|
+
if (uint2 < uintBoundaries[1]) {
|
|
618
618
|
return 2;
|
|
619
619
|
}
|
|
620
|
-
if (
|
|
620
|
+
if (uint2 < uintBoundaries[2]) {
|
|
621
621
|
return 3;
|
|
622
622
|
}
|
|
623
|
-
if (
|
|
623
|
+
if (uint2 < uintBoundaries[3]) {
|
|
624
624
|
return 5;
|
|
625
625
|
}
|
|
626
626
|
return 9;
|
|
@@ -1414,11 +1414,11 @@ var EvidenceGraph = (() => {
|
|
|
1414
1414
|
encoders[tokens.type.major](writer, tokens, options);
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
function directEncodeUintValue(writer, major,
|
|
1418
|
-
if (
|
|
1419
|
-
writer.pushByte(major | Number(
|
|
1417
|
+
function directEncodeUintValue(writer, major, uint2) {
|
|
1418
|
+
if (uint2 < 24) {
|
|
1419
|
+
writer.pushByte(major | Number(uint2));
|
|
1420
1420
|
} else {
|
|
1421
|
-
encodeUintValue(writer, major,
|
|
1421
|
+
encodeUintValue(writer, major, uint2);
|
|
1422
1422
|
}
|
|
1423
1423
|
}
|
|
1424
1424
|
function canDirectEncode(options) {
|
|
@@ -1977,11 +1977,11 @@ var EvidenceGraph = (() => {
|
|
|
1977
1977
|
if (Type.equals(token.type, Type.tag)) {
|
|
1978
1978
|
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
1979
1979
|
const decodeControl = createTagDecodeControl(tokeniser, options);
|
|
1980
|
-
const
|
|
1980
|
+
const result3 = options.tags[token.value](decodeControl);
|
|
1981
1981
|
if (!decodeControl._called) {
|
|
1982
1982
|
throw new Error(`${decodeErrPrefix} tag decoder must call decode() or entries()`);
|
|
1983
1983
|
}
|
|
1984
|
-
return
|
|
1984
|
+
return result3;
|
|
1985
1985
|
}
|
|
1986
1986
|
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
1987
1987
|
}
|
|
@@ -2172,7 +2172,7 @@ var EvidenceGraph = (() => {
|
|
|
2172
2172
|
return 2 * leaves - bits;
|
|
2173
2173
|
}
|
|
2174
2174
|
function peakPositions(size) {
|
|
2175
|
-
const
|
|
2175
|
+
const result3 = [];
|
|
2176
2176
|
let remaining = size, offset = 0, prevHeight = Number.POSITIVE_INFINITY;
|
|
2177
2177
|
while (remaining > 0) {
|
|
2178
2178
|
let h = 0;
|
|
@@ -2180,11 +2180,11 @@ var EvidenceGraph = (() => {
|
|
|
2180
2180
|
if (h >= prevHeight) break;
|
|
2181
2181
|
const mountain = 2 ** (h + 1) - 1;
|
|
2182
2182
|
offset += mountain;
|
|
2183
|
-
|
|
2183
|
+
result3.push(offset - 1);
|
|
2184
2184
|
remaining -= mountain;
|
|
2185
2185
|
prevHeight = h;
|
|
2186
2186
|
}
|
|
2187
|
-
return
|
|
2187
|
+
return result3;
|
|
2188
2188
|
}
|
|
2189
2189
|
function findContainingPeak(pos, peaks) {
|
|
2190
2190
|
for (let i = 0; i < peaks.length; i += 1) {
|
|
@@ -3232,14 +3232,14 @@ var EvidenceGraph = (() => {
|
|
|
3232
3232
|
throw new Error("expected non-negative bigint, got " + n);
|
|
3233
3233
|
return n === _0n ? 0 : n.toString(2).length;
|
|
3234
3234
|
}
|
|
3235
|
-
function validateObject(
|
|
3236
|
-
aobject2(
|
|
3235
|
+
function validateObject(object16, fields2 = {}, optFields = {}, title = "object") {
|
|
3236
|
+
aobject2(object16, title);
|
|
3237
3237
|
aobject2(fields2, "fields");
|
|
3238
3238
|
aobject2(optFields, "optFields");
|
|
3239
3239
|
function checkField(fieldName, expectedType, isOpt) {
|
|
3240
3240
|
const label = title === "object" ? `param "${String(fieldName)}"` : `"${title}.${String(fieldName)}"`;
|
|
3241
|
-
const val =
|
|
3242
|
-
if (!Object.hasOwn(
|
|
3241
|
+
const val = object16[fieldName];
|
|
3242
|
+
if (!Object.hasOwn(object16, fieldName) && (isOpt ? val !== void 0 : expectedType !== "function")) {
|
|
3243
3243
|
throw new TypeError(`${label} is invalid: expected own property`);
|
|
3244
3244
|
}
|
|
3245
3245
|
if (isOpt && val === void 0)
|
|
@@ -3277,8 +3277,8 @@ var EvidenceGraph = (() => {
|
|
|
3277
3277
|
function mod(a, b) {
|
|
3278
3278
|
if (b <= _0n2)
|
|
3279
3279
|
throw new Error("mod: expected positive modulus, got " + b);
|
|
3280
|
-
const
|
|
3281
|
-
return
|
|
3280
|
+
const result3 = a % b;
|
|
3281
|
+
return result3 >= _0n2 ? result3 : b + result3;
|
|
3282
3282
|
}
|
|
3283
3283
|
function pow(num, power, modulo) {
|
|
3284
3284
|
if (modulo <= _1n2)
|
|
@@ -5087,9 +5087,12 @@ var EvidenceGraph = (() => {
|
|
|
5087
5087
|
mountPresentation: () => mountPresentation,
|
|
5088
5088
|
mountPresentationFragment: () => mountPresentationFragment,
|
|
5089
5089
|
obligationStatus: () => obligationStatus,
|
|
5090
|
+
paymentPreimageCheck: () => paymentPreimageCheck,
|
|
5090
5091
|
placeholders: () => placeholders,
|
|
5091
5092
|
readWordingPack: () => readWordingPack,
|
|
5092
5093
|
readerAnchorWitness: () => readerAnchorWitness,
|
|
5094
|
+
readerCadenceWitness: () => readerCadenceWitness,
|
|
5095
|
+
readerCardSignature: () => readerCardSignature,
|
|
5093
5096
|
readerWitnessPolicy: () => readerWitnessPolicy,
|
|
5094
5097
|
registerPresentation: () => registerPresentation,
|
|
5095
5098
|
renderChecking: () => renderChecking,
|
|
@@ -5114,19 +5117,19 @@ var EvidenceGraph = (() => {
|
|
|
5114
5117
|
var CONTENT_TYPE = "application/agent-action-capsule-id";
|
|
5115
5118
|
var hex64 = /^[0-9a-f]{64}$/u;
|
|
5116
5119
|
function concat(...parts) {
|
|
5117
|
-
const
|
|
5120
|
+
const result3 = new Uint8Array(parts.reduce((length, part) => length + part.length, 0));
|
|
5118
5121
|
let offset = 0;
|
|
5119
5122
|
for (const part of parts) {
|
|
5120
|
-
|
|
5123
|
+
result3.set(part, offset);
|
|
5121
5124
|
offset += part.length;
|
|
5122
5125
|
}
|
|
5123
|
-
return
|
|
5126
|
+
return result3;
|
|
5124
5127
|
}
|
|
5125
5128
|
function hexToBytes(value) {
|
|
5126
|
-
const
|
|
5127
|
-
for (let i = 0; i <
|
|
5128
|
-
|
|
5129
|
-
return
|
|
5129
|
+
const result3 = new Uint8Array(value.length / 2);
|
|
5130
|
+
for (let i = 0; i < result3.length; i += 1)
|
|
5131
|
+
result3[i] = Number.parseInt(value.slice(i * 2, i * 2 + 2), 16);
|
|
5132
|
+
return result3;
|
|
5130
5133
|
}
|
|
5131
5134
|
function equalBytes(left, right) {
|
|
5132
5135
|
return left.length === right.length && left.every((byte, index) => byte === right[index]);
|
|
@@ -6017,10 +6020,10 @@ var EvidenceGraph = (() => {
|
|
|
6017
6020
|
var object2 = asJsonObject;
|
|
6018
6021
|
function decodeCapsuleJson(data) {
|
|
6019
6022
|
const value = decodeStrictJson(data);
|
|
6020
|
-
const
|
|
6021
|
-
if (
|
|
6023
|
+
const result3 = object2(value);
|
|
6024
|
+
if (result3 === void 0)
|
|
6022
6025
|
throw new TypeError("Capsule is not a JSON object");
|
|
6023
|
-
return
|
|
6026
|
+
return result3;
|
|
6024
6027
|
}
|
|
6025
6028
|
async function computeCapsuleId(capsule) {
|
|
6026
6029
|
if (capsule.format_version !== "4")
|
|
@@ -6057,7 +6060,7 @@ var EvidenceGraph = (() => {
|
|
|
6057
6060
|
function pathFind(value, predicate, limit, maxChars) {
|
|
6058
6061
|
const out = [];
|
|
6059
6062
|
const steps = [];
|
|
6060
|
-
const
|
|
6063
|
+
const walk2 = (node) => {
|
|
6061
6064
|
if (node instanceof JsonNumber) {
|
|
6062
6065
|
if (out.length < limit && predicate(node))
|
|
6063
6066
|
out.push(joinPath(steps, maxChars));
|
|
@@ -6066,7 +6069,7 @@ var EvidenceGraph = (() => {
|
|
|
6066
6069
|
if (Array.isArray(node)) {
|
|
6067
6070
|
for (let index = 0; index < node.length; index++) {
|
|
6068
6071
|
steps.push(index);
|
|
6069
|
-
|
|
6072
|
+
walk2(node[index]);
|
|
6070
6073
|
steps.pop();
|
|
6071
6074
|
}
|
|
6072
6075
|
return;
|
|
@@ -6076,11 +6079,11 @@ var EvidenceGraph = (() => {
|
|
|
6076
6079
|
return;
|
|
6077
6080
|
for (const key of Object.keys(record).sort(byCodePoint)) {
|
|
6078
6081
|
steps.push(key);
|
|
6079
|
-
|
|
6082
|
+
walk2(record[key]);
|
|
6080
6083
|
steps.pop();
|
|
6081
6084
|
}
|
|
6082
6085
|
};
|
|
6083
|
-
|
|
6086
|
+
walk2(value);
|
|
6084
6087
|
return out;
|
|
6085
6088
|
}
|
|
6086
6089
|
function joinPath(steps, maxChars) {
|
|
@@ -6976,11 +6979,11 @@ var EvidenceGraph = (() => {
|
|
|
6976
6979
|
const members = [];
|
|
6977
6980
|
for (const m of block.members) {
|
|
6978
6981
|
byId.set(m.id, m);
|
|
6979
|
-
const
|
|
6980
|
-
members.push(
|
|
6981
|
-
closureFindings.push(...
|
|
6982
|
-
failed2.push(...
|
|
6983
|
-
withheld.push(...
|
|
6982
|
+
const result3 = await verifyMember(m, missing.has(m.id), verifyMemberBundle);
|
|
6983
|
+
members.push(result3.member);
|
|
6984
|
+
closureFindings.push(...result3.closure);
|
|
6985
|
+
failed2.push(...result3.failed);
|
|
6986
|
+
withheld.push(...result3.withheld);
|
|
6984
6987
|
}
|
|
6985
6988
|
let compositionClosure;
|
|
6986
6989
|
const closureMissing = sortedUnique(block.missing);
|
|
@@ -7005,19 +7008,19 @@ var EvidenceGraph = (() => {
|
|
|
7005
7008
|
const corroborations = [];
|
|
7006
7009
|
for (const j of block.joins) {
|
|
7007
7010
|
const { derived, differences } = await derivedState(j, byId, missing);
|
|
7008
|
-
const
|
|
7011
|
+
const result3 = derived === void 0 ? "not_derivable" : derived === j.state ? "derived_matches" : "join_state_mismatch";
|
|
7009
7012
|
joins.push({
|
|
7010
7013
|
members: j.members,
|
|
7011
7014
|
basis: j.basis,
|
|
7012
7015
|
declared: j.state,
|
|
7013
7016
|
...derived === void 0 ? {} : { derived },
|
|
7014
|
-
result,
|
|
7017
|
+
result: result3,
|
|
7015
7018
|
differences
|
|
7016
7019
|
});
|
|
7017
7020
|
const pair = `${j.members[0]},${j.members[1]}`;
|
|
7018
|
-
if (
|
|
7021
|
+
if (result3 === "join_state_mismatch")
|
|
7019
7022
|
failed2.push(`join_state_mismatch:${pair}`);
|
|
7020
|
-
else if (
|
|
7023
|
+
else if (result3 === "not_derivable")
|
|
7021
7024
|
withheld.push(`join_not_derivable:${pair}`);
|
|
7022
7025
|
corroborations.push(corroboration(j, derived, byId, observers));
|
|
7023
7026
|
}
|
|
@@ -7383,8 +7386,8 @@ var EvidenceGraph = (() => {
|
|
|
7383
7386
|
};
|
|
7384
7387
|
try {
|
|
7385
7388
|
const signature2 = digitPairs(record.signature, "signature"), keyId = digitPairs(record.key_id, "key_id");
|
|
7386
|
-
const
|
|
7387
|
-
if (
|
|
7389
|
+
const result3 = await verifyProducerEnvelope(await recordCapsuleId(record), signature2);
|
|
7390
|
+
if (result3.ok && result3.publicKey !== void 0 && equalBytes(result3.publicKey, keyId))
|
|
7388
7391
|
return { verdict: "authored", messages: [] };
|
|
7389
7392
|
} catch (error) {
|
|
7390
7393
|
return {
|
|
@@ -7548,8 +7551,8 @@ var EvidenceGraph = (() => {
|
|
|
7548
7551
|
category_coverage_consistency: consistency(member, recordIds, inputs.recordCategories)
|
|
7549
7552
|
};
|
|
7550
7553
|
}
|
|
7551
|
-
function categoryCoverageFails(
|
|
7552
|
-
return
|
|
7554
|
+
function categoryCoverageFails(result3) {
|
|
7555
|
+
return result3 !== null && CATEGORY_COVERAGE_GATING.some((name) => result3[name] === "FAIL");
|
|
7553
7556
|
}
|
|
7554
7557
|
|
|
7555
7558
|
// node_modules/@action-state-group/agent-action-capsule/dist/cose-receipt.js
|
|
@@ -7599,27 +7602,27 @@ var EvidenceGraph = (() => {
|
|
|
7599
7602
|
var utf84 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
7600
7603
|
function decodeReceiptItem(data, topTag) {
|
|
7601
7604
|
const value = decodeCbor(data);
|
|
7602
|
-
const
|
|
7605
|
+
const walk2 = (item, depth) => {
|
|
7603
7606
|
if (typeof item === "bigint" && item < -(1n << 63n))
|
|
7604
7607
|
throw new SyntaxError("an integer below -2^63");
|
|
7605
7608
|
if (item instanceof CborTag) {
|
|
7606
7609
|
if (!(depth === 0 && topTag && item.tag === COSE_SIGN1_TAG))
|
|
7607
7610
|
throw new SyntaxError("a tag other than the outer tag 18");
|
|
7608
|
-
|
|
7611
|
+
walk2(item.value, depth + 1);
|
|
7609
7612
|
} else if (Array.isArray(item)) {
|
|
7610
7613
|
for (const inner of item)
|
|
7611
|
-
|
|
7614
|
+
walk2(inner, depth + 1);
|
|
7612
7615
|
} else if (item instanceof CborMap) {
|
|
7613
7616
|
for (const [key, inner] of item.entries) {
|
|
7614
7617
|
if (typeof key !== "bigint" && typeof key !== "string")
|
|
7615
7618
|
throw new SyntaxError("a map key that is not an integer or text");
|
|
7616
|
-
|
|
7617
|
-
|
|
7619
|
+
walk2(key, depth + 1);
|
|
7620
|
+
walk2(inner, depth + 1);
|
|
7618
7621
|
}
|
|
7619
7622
|
} else if (!(item === null || typeof item === "boolean" || typeof item === "bigint" || typeof item === "string" || item instanceof Uint8Array))
|
|
7620
7623
|
throw new SyntaxError("a float or a simple value");
|
|
7621
7624
|
};
|
|
7622
|
-
|
|
7625
|
+
walk2(value, 0);
|
|
7623
7626
|
return value;
|
|
7624
7627
|
}
|
|
7625
7628
|
function decodeCbor(data) {
|
|
@@ -7940,15 +7943,15 @@ var EvidenceGraph = (() => {
|
|
|
7940
7943
|
var P = 2n ** 256n - 2n ** 224n + 2n ** 192n + 2n ** 96n - 1n;
|
|
7941
7944
|
var B = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn;
|
|
7942
7945
|
function modPow(base, exponent) {
|
|
7943
|
-
let
|
|
7946
|
+
let result3 = 1n;
|
|
7944
7947
|
base %= P;
|
|
7945
7948
|
while (exponent > 0n) {
|
|
7946
7949
|
if (exponent & 1n)
|
|
7947
|
-
|
|
7950
|
+
result3 = result3 * base % P;
|
|
7948
7951
|
base = base * base % P;
|
|
7949
7952
|
exponent >>= 1n;
|
|
7950
7953
|
}
|
|
7951
|
-
return
|
|
7954
|
+
return result3;
|
|
7952
7955
|
}
|
|
7953
7956
|
function onP256(point) {
|
|
7954
7957
|
const rhs = (x) => ((x * x * x - 3n * x + B) % P + P) % P;
|
|
@@ -8126,7 +8129,7 @@ var EvidenceGraph = (() => {
|
|
|
8126
8129
|
reason: `not checked: ${reason}`,
|
|
8127
8130
|
notChecked: true
|
|
8128
8131
|
});
|
|
8129
|
-
var fromCoseResult = (
|
|
8132
|
+
var fromCoseResult = (result3) => result3.unavailable ? notChecked(result3.reason) : failed(result3.reason);
|
|
8130
8133
|
function gradeOf(label) {
|
|
8131
8134
|
return typeof label === "string" ? GRADES.get(label) ?? null : null;
|
|
8132
8135
|
}
|
|
@@ -8157,15 +8160,15 @@ var EvidenceGraph = (() => {
|
|
|
8157
8160
|
} catch {
|
|
8158
8161
|
return failed("receipt_b64 is not canonical base64");
|
|
8159
8162
|
}
|
|
8160
|
-
const
|
|
8161
|
-
if (!
|
|
8162
|
-
return fromCoseResult(
|
|
8163
|
-
const label =
|
|
8163
|
+
const result3 = await verifyCoseReceipt(receipt, hexToBytes(expected), key);
|
|
8164
|
+
if (!result3.ok)
|
|
8165
|
+
return fromCoseResult(result3);
|
|
8166
|
+
const label = result3.protectedHeaders.get(HDR_GRADE);
|
|
8164
8167
|
return {
|
|
8165
8168
|
ok: true,
|
|
8166
8169
|
reason: "ok",
|
|
8167
8170
|
grade: gradeOf(label),
|
|
8168
|
-
...registrationTimeOf(
|
|
8171
|
+
...registrationTimeOf(result3.protectedHeaders)
|
|
8169
8172
|
};
|
|
8170
8173
|
}
|
|
8171
8174
|
async function verifyScrapiReceipt(receipt, options) {
|
|
@@ -8173,15 +8176,15 @@ var EvidenceGraph = (() => {
|
|
|
8173
8176
|
return notChecked("no key pinned for this service");
|
|
8174
8177
|
try {
|
|
8175
8178
|
const leaf = hexToBytes(await sha256Hex(options.checkpointCose));
|
|
8176
|
-
const
|
|
8177
|
-
if (!
|
|
8178
|
-
return fromCoseResult(
|
|
8179
|
-
const label =
|
|
8179
|
+
const result3 = await verifyCoseReceipt(receipt, leaf, options.servicePublicKeySpki);
|
|
8180
|
+
if (!result3.ok)
|
|
8181
|
+
return fromCoseResult(result3);
|
|
8182
|
+
const label = result3.protectedHeaders.get(HDR_GRADE);
|
|
8180
8183
|
return {
|
|
8181
8184
|
ok: true,
|
|
8182
8185
|
reason: "ok",
|
|
8183
8186
|
grade: gradeOf(label) ?? GRADE_OBSERVED_ONLY,
|
|
8184
|
-
...registrationTimeOf(
|
|
8187
|
+
...registrationTimeOf(result3.protectedHeaders)
|
|
8185
8188
|
};
|
|
8186
8189
|
} catch (error) {
|
|
8187
8190
|
return failed(`unreadable receipt: ${String(error)}`);
|
|
@@ -8341,8 +8344,8 @@ ${body}
|
|
|
8341
8344
|
}
|
|
8342
8345
|
return true;
|
|
8343
8346
|
};
|
|
8344
|
-
async function verifyWitnessReceipts(
|
|
8345
|
-
if (!Array.isArray(
|
|
8347
|
+
async function verifyWitnessReceipts(receipts3, signed, cose, directory) {
|
|
8348
|
+
if (!Array.isArray(receipts3) || receipts3.length === 0)
|
|
8346
8349
|
return {
|
|
8347
8350
|
status: "withheld",
|
|
8348
8351
|
findings: ["witness_receipt_absent"],
|
|
@@ -8354,10 +8357,10 @@ ${body}
|
|
|
8354
8357
|
findings: ["checkpoint_unverified"],
|
|
8355
8358
|
receipts: []
|
|
8356
8359
|
};
|
|
8357
|
-
const findings =
|
|
8360
|
+
const findings = receipts3.flatMap((entry, index) => isRecord(entry) ? [] : [`witness_receipt_malformed:${index}`]);
|
|
8358
8361
|
const malformed = findings.length > 0;
|
|
8359
8362
|
const results = [];
|
|
8360
|
-
for (const record of
|
|
8363
|
+
for (const record of receipts3) {
|
|
8361
8364
|
if (!isRecord(record))
|
|
8362
8365
|
continue;
|
|
8363
8366
|
const tsUrl = record.ts_url;
|
|
@@ -8426,7 +8429,7 @@ ${body}
|
|
|
8426
8429
|
});
|
|
8427
8430
|
}
|
|
8428
8431
|
}
|
|
8429
|
-
const statuses = new Set(results.map((
|
|
8432
|
+
const statuses = new Set(results.map((result3) => result3.status));
|
|
8430
8433
|
return {
|
|
8431
8434
|
status: malformed || statuses.has("fail") ? "fail" : statuses.has("pass") ? "pass" : "withheld",
|
|
8432
8435
|
findings,
|
|
@@ -8552,17 +8555,17 @@ ${body}
|
|
|
8552
8555
|
const leaf = hexToBytes(anchorDigest);
|
|
8553
8556
|
let unavailable = false;
|
|
8554
8557
|
for (const { name, spki } of keys) {
|
|
8555
|
-
const
|
|
8556
|
-
if (
|
|
8558
|
+
const result3 = await verifyCoseReceipt(receipt, leaf, spki);
|
|
8559
|
+
if (result3.ok)
|
|
8557
8560
|
return report("PASS", name, parsed.time);
|
|
8558
|
-
if (
|
|
8561
|
+
if (result3.unavailable)
|
|
8559
8562
|
unavailable = true;
|
|
8560
8563
|
}
|
|
8561
8564
|
return report(unavailable ? "NOT_CHECKED" : "FAIL");
|
|
8562
8565
|
}
|
|
8563
|
-
async function checkAnchorWitnessed(anchorDigest,
|
|
8566
|
+
async function checkAnchorWitnessed(anchorDigest, receipts3, policy) {
|
|
8564
8567
|
const reports = [];
|
|
8565
|
-
for (const receipt of
|
|
8568
|
+
for (const receipt of receipts3)
|
|
8566
8569
|
reports.push(await checkAnchorReceipt(anchorDigest, receipt, policy));
|
|
8567
8570
|
const statuses = new Set(reports.map((r) => r.status));
|
|
8568
8571
|
const status2 = reports.length === 0 ? "NOT_PRESENT" : statuses.has("PASS") ? "PASS" : statuses.has("FAIL") ? "FAIL" : "NOT_CHECKED";
|
|
@@ -8749,11 +8752,11 @@ ${body}
|
|
|
8749
8752
|
continue;
|
|
8750
8753
|
const id = capsuleIdOf(record);
|
|
8751
8754
|
const { verdict: verdict2, messages } = await verifyRecordSignature(record);
|
|
8752
|
-
const
|
|
8755
|
+
const result3 = !seen.has(id) && Object.hasOwn(plain2.capsuleResults, id) ? plain2.capsuleResults[id] : void 0;
|
|
8753
8756
|
seen.add(id);
|
|
8754
8757
|
records.push({
|
|
8755
8758
|
capsuleId: id,
|
|
8756
|
-
identityOk:
|
|
8759
|
+
identityOk: result3?.ok === true && result3.capsuleId === id,
|
|
8757
8760
|
signature: verdict2,
|
|
8758
8761
|
keyId: typeof record.key_id === "string" ? record.key_id : null,
|
|
8759
8762
|
seq: seqs.get(id) ?? null,
|
|
@@ -8959,9 +8962,9 @@ ${body}
|
|
|
8959
8962
|
findings.push(`record_duplicate:${id}`);
|
|
8960
8963
|
continue;
|
|
8961
8964
|
}
|
|
8962
|
-
const
|
|
8963
|
-
results[id] =
|
|
8964
|
-
if (!
|
|
8965
|
+
const result3 = await verifyClass1(record);
|
|
8966
|
+
results[id] = result3;
|
|
8967
|
+
if (!result3.ok || result3.capsuleId !== id) {
|
|
8965
8968
|
findings.push(`record_identity_invalid:${id}`);
|
|
8966
8969
|
continue;
|
|
8967
8970
|
}
|
|
@@ -9471,8 +9474,8 @@ ${body}
|
|
|
9471
9474
|
perRecordMembership: { status: "fail", findings: [] }
|
|
9472
9475
|
} : plain2;
|
|
9473
9476
|
}
|
|
9474
|
-
function isProducerSelection(
|
|
9475
|
-
return
|
|
9477
|
+
function isProducerSelection(result3) {
|
|
9478
|
+
return result3.intervalCoverage.status === "withheld" && result3.intervalCoverage.findings.includes(SELECTION_NOT_CHECKABLE);
|
|
9476
9479
|
}
|
|
9477
9480
|
function isVerifiedBundleContext(value) {
|
|
9478
9481
|
return object8(value) && contexts.has(value);
|
|
@@ -9537,8 +9540,8 @@ ${body}
|
|
|
9537
9540
|
}
|
|
9538
9541
|
function resolveFromVerification(bundle, results, index) {
|
|
9539
9542
|
const status2 = /* @__PURE__ */ new Map();
|
|
9540
|
-
for (const
|
|
9541
|
-
status2.set(`${
|
|
9543
|
+
for (const result3 of results)
|
|
9544
|
+
status2.set(`${result3.capsuleId}\0${result3.member}`, result3.status);
|
|
9542
9545
|
const overlay = object8(bundle) && object8(bundle.disclosures) ? bundle.disclosures : {};
|
|
9543
9546
|
const resolved = /* @__PURE__ */ new Map();
|
|
9544
9547
|
const one = (id, field) => {
|
|
@@ -11032,12 +11035,12 @@ ${body}
|
|
|
11032
11035
|
}
|
|
11033
11036
|
return { withheld, mismatched, unreadable, invalid: invalid2, total };
|
|
11034
11037
|
}
|
|
11035
|
-
function caseRecord(
|
|
11038
|
+
function caseRecord(result3, claims, sourceCapsuleId) {
|
|
11036
11039
|
if (sourceCapsuleId === void 0)
|
|
11037
11040
|
return void 0;
|
|
11038
11041
|
for (const claim of claims)
|
|
11039
11042
|
for (const ref of claim.evidence) {
|
|
11040
|
-
const record =
|
|
11043
|
+
const record = result3.records.get(ref.digest);
|
|
11041
11044
|
if (record === void 0 || record.stated === void 0)
|
|
11042
11045
|
continue;
|
|
11043
11046
|
if (record.carriedCapsuleId === sourceCapsuleId || record.carriedCapsuleId === void 0 && record.bookRecordId === void 0 && record.capsuleId === sourceCapsuleId)
|
|
@@ -11127,7 +11130,7 @@ ${body}
|
|
|
11127
11130
|
];
|
|
11128
11131
|
});
|
|
11129
11132
|
}
|
|
11130
|
-
function findTranscript(
|
|
11133
|
+
function findTranscript(result3, conversationId, claims, sourceCapsuleId, caseFrom = "reports") {
|
|
11131
11134
|
const records = [];
|
|
11132
11135
|
const seen = /* @__PURE__ */ new Set();
|
|
11133
11136
|
for (const claim of claims)
|
|
@@ -11135,7 +11138,7 @@ ${body}
|
|
|
11135
11138
|
if (seen.has(ref.digest))
|
|
11136
11139
|
continue;
|
|
11137
11140
|
seen.add(ref.digest);
|
|
11138
|
-
const record =
|
|
11141
|
+
const record = result3.records.get(ref.digest);
|
|
11139
11142
|
if (record !== void 0)
|
|
11140
11143
|
records.push(record);
|
|
11141
11144
|
}
|
|
@@ -11193,10 +11196,10 @@ ${body}
|
|
|
11193
11196
|
reason: "a cited transcript does not commit to the same input as the case record the judge read"
|
|
11194
11197
|
};
|
|
11195
11198
|
}
|
|
11196
|
-
function groupClaims(
|
|
11199
|
+
function groupClaims(result3, terms) {
|
|
11197
11200
|
const order = checksById(terms);
|
|
11198
11201
|
const byConversation = /* @__PURE__ */ new Map();
|
|
11199
|
-
for (const claim of
|
|
11202
|
+
for (const claim of result3.claims) {
|
|
11200
11203
|
if (claim.type !== REQUIREMENT_CLAIM)
|
|
11201
11204
|
continue;
|
|
11202
11205
|
const grouping = parseClaimGrouping(claim);
|
|
@@ -11207,8 +11210,8 @@ ${body}
|
|
|
11207
11210
|
byConversation.set(grouping.conversationId, list2);
|
|
11208
11211
|
}
|
|
11209
11212
|
const contractRef = packRef(terms);
|
|
11210
|
-
const cited = new Set(
|
|
11211
|
-
const reserved = (
|
|
11213
|
+
const cited = new Set(result3.claims.map((claim) => JSON.stringify([claim.contractRef, claim.requirementRef])));
|
|
11214
|
+
const reserved = (result3.requirementsCovered ?? []).filter((ref) => !cited.has(JSON.stringify([ref.contractRef, ref.requirementRef])) && (ref.contractRef !== contractRef || criterionRef(ref.requirementRef) === void 0)).length;
|
|
11212
11215
|
const allLater2 = /* @__PURE__ */ new Set();
|
|
11213
11216
|
for (const [conversationId, claims] of byConversation) {
|
|
11214
11217
|
const drawn = terms.checks.flatMap((check) => check.criteria.flatMap((criterion2) => {
|
|
@@ -11226,7 +11229,7 @@ ${body}
|
|
|
11226
11229
|
if (!claims.some((candidate) => candidate.requirementRef === `${check.id}.${criterion2.id}`))
|
|
11227
11230
|
missing += 1;
|
|
11228
11231
|
}
|
|
11229
|
-
const missingVerdict = missing <=
|
|
11232
|
+
const missingVerdict = missing <= result3.coverage.excludedNotApplicable - reserved ? "not_applicable" : "no_claim";
|
|
11230
11233
|
const conversations = [];
|
|
11231
11234
|
const notYetInForce = [];
|
|
11232
11235
|
const byDay = /* @__PURE__ */ new Map();
|
|
@@ -11247,7 +11250,7 @@ ${body}
|
|
|
11247
11250
|
continue;
|
|
11248
11251
|
}
|
|
11249
11252
|
const target = claim.later && !claim.failed ? laterCriteria : criteria;
|
|
11250
|
-
const judgment = reportPayload(
|
|
11253
|
+
const judgment = reportPayload(result3.records, claim);
|
|
11251
11254
|
const rationale = judgment ? asString2(judgment.rationale) : void 0;
|
|
11252
11255
|
const reasonCode = judgment ? asString2(judgment.reason_code) : void 0;
|
|
11253
11256
|
const sourceCapsuleId = judgment ? asString2(judgment.source_capsule_id) : void 0;
|
|
@@ -11255,7 +11258,7 @@ ${body}
|
|
|
11255
11258
|
const clauseClaim = judgment !== void 0 && asString2(judgment.clause_id) === `${check.id}.${criterion2.id}` ? asString2(judgment.clause_claim) : void 0;
|
|
11256
11259
|
const { probabilities, confidence } = parseJudgeProbabilities(rationale);
|
|
11257
11260
|
const cited2 = claim.evidence[0]?.digest;
|
|
11258
|
-
const record = cited2 === void 0 ? void 0 :
|
|
11261
|
+
const record = cited2 === void 0 ? void 0 : result3.records.get(cited2);
|
|
11259
11262
|
target.push({
|
|
11260
11263
|
checkId: check.id,
|
|
11261
11264
|
criterionId: criterion2.id,
|
|
@@ -11269,13 +11272,13 @@ ${body}
|
|
|
11269
11272
|
...record?.bookRecordId === void 0 ? {} : { reportRecordId: record.bookRecordId },
|
|
11270
11273
|
...sourceCapsuleId === void 0 ? {} : { sourceCapsuleId },
|
|
11271
11274
|
...judgePinDigest === void 0 ? {} : { judgePinDigest },
|
|
11272
|
-
reportState: reportState(
|
|
11275
|
+
reportState: reportState(result3.records, claim),
|
|
11273
11276
|
...clauseClaim === void 0 || clauseClaim.trim() === "" ? {} : { clauseClaim }
|
|
11274
11277
|
});
|
|
11275
11278
|
}
|
|
11276
11279
|
}
|
|
11277
11280
|
const firstClaim = [...criteria, ...laterCriteria].find((c) => c.claim !== void 0)?.claim;
|
|
11278
|
-
const judgedDay = (firstClaim === void 0 ? void 0 : reportSealedDay(
|
|
11281
|
+
const judgedDay = (firstClaim === void 0 ? void 0 : reportSealedDay(result3.records, firstClaim)) ?? dayOf(void 0);
|
|
11279
11282
|
const checkVerdicts = /* @__PURE__ */ new Map();
|
|
11280
11283
|
for (const check of terms.checks) {
|
|
11281
11284
|
const forCheck = criteria.filter((c) => c.checkId === check.id);
|
|
@@ -11284,17 +11287,17 @@ ${body}
|
|
|
11284
11287
|
const sources = new Set([...criteria, ...laterCriteria].flatMap((c) => c.sourceCapsuleId === void 0 ? [] : [c.sourceCapsuleId]));
|
|
11285
11288
|
let caseFrom = "reports";
|
|
11286
11289
|
if (sources.size === 0) {
|
|
11287
|
-
const cited2 = claimsCitedCase(
|
|
11290
|
+
const cited2 = claimsCitedCase(result3.records, conversationId, claims, result3.claims);
|
|
11288
11291
|
if (cited2 !== void 0) {
|
|
11289
11292
|
sources.add(cited2);
|
|
11290
11293
|
caseFrom = "claims";
|
|
11291
11294
|
}
|
|
11292
11295
|
}
|
|
11293
|
-
const dated = conversationDate(caseRecord(
|
|
11296
|
+
const dated = conversationDate(caseRecord(result3, claims, sources.size === 1 ? [...sources][0] : void 0), judgedDay);
|
|
11294
11297
|
const date = dated.date;
|
|
11295
11298
|
const conversation = {
|
|
11296
11299
|
conversationId,
|
|
11297
|
-
transcript: findTranscript(
|
|
11300
|
+
transcript: findTranscript(result3, conversationId, claims, sources.size === 1 ? [...sources][0] : void 0, caseFrom),
|
|
11298
11301
|
...sources.size === 1 ? { sourceCapsuleId: [...sources][0], caseFrom } : {},
|
|
11299
11302
|
day: date,
|
|
11300
11303
|
dated,
|
|
@@ -11359,7 +11362,7 @@ ${body}
|
|
|
11359
11362
|
axes_digest: pin.axesDigest
|
|
11360
11363
|
};
|
|
11361
11364
|
}
|
|
11362
|
-
function buildRunInfo(
|
|
11365
|
+
function buildRunInfo(result3, conversations) {
|
|
11363
11366
|
const claimContracts = /* @__PURE__ */ new Set();
|
|
11364
11367
|
const reportContracts = /* @__PURE__ */ new Set();
|
|
11365
11368
|
const pins = /* @__PURE__ */ new Set();
|
|
@@ -11370,7 +11373,7 @@ ${body}
|
|
|
11370
11373
|
if (claim === void 0)
|
|
11371
11374
|
continue;
|
|
11372
11375
|
claimContracts.add(claim.contractRef);
|
|
11373
|
-
const payload = reportPayload(
|
|
11376
|
+
const payload = reportPayload(result3.records, claim);
|
|
11374
11377
|
const contract = asString2(payload?.contract_ref) ?? asString2(payload?.contract);
|
|
11375
11378
|
if (contract !== void 0)
|
|
11376
11379
|
reportContracts.add(contract);
|
|
@@ -11384,7 +11387,7 @@ ${body}
|
|
|
11384
11387
|
}
|
|
11385
11388
|
const contracts = claimContracts.size > 0 ? claimContracts : reportContracts;
|
|
11386
11389
|
const pinned = contracts.size <= 1 && pins.size <= 1 && components.size <= 1;
|
|
11387
|
-
const counted2 = withheldReports(
|
|
11390
|
+
const counted2 = withheldReports(result3.records, conversations.flatMap((c) => c.criteria.flatMap((cr) => cr.claim === void 0 ? [] : [cr.claim])));
|
|
11388
11391
|
return {
|
|
11389
11392
|
...counted2.withheld > 0 ? { reportsWithheld: counted2.withheld } : {},
|
|
11390
11393
|
...counted2.mismatched > 0 ? { reportsMismatched: counted2.mismatched } : {},
|
|
@@ -11408,8 +11411,8 @@ ${body}
|
|
|
11408
11411
|
}
|
|
11409
11412
|
return { ...runInfo, judgePinRecomputes: recomputes };
|
|
11410
11413
|
}
|
|
11411
|
-
function judgedCase(
|
|
11412
|
-
const citing =
|
|
11414
|
+
function judgedCase(result3, caseDigest) {
|
|
11415
|
+
const citing = result3.claims.filter((claim) => claim.type === REQUIREMENT_CLAIM && !claim.failed && claim.evidence.some((ref) => ref.digest === caseDigest));
|
|
11413
11416
|
const first = citing[0];
|
|
11414
11417
|
if (first === void 0)
|
|
11415
11418
|
return void 0;
|
|
@@ -11421,16 +11424,16 @@ ${body}
|
|
|
11421
11424
|
} : void 0;
|
|
11422
11425
|
}
|
|
11423
11426
|
var COUNTED_LABELS = /* @__PURE__ */ new Set(["met", "not_met"]);
|
|
11424
|
-
function buildCalibration(
|
|
11427
|
+
function buildCalibration(result3) {
|
|
11425
11428
|
const readings2 = [];
|
|
11426
|
-
for (const claim of
|
|
11429
|
+
for (const claim of result3.claims) {
|
|
11427
11430
|
if (claim.type !== "calibration")
|
|
11428
11431
|
continue;
|
|
11429
11432
|
const summaries = [];
|
|
11430
11433
|
const ratings = [];
|
|
11431
11434
|
let ratingsNotMatching = 0;
|
|
11432
11435
|
for (const digest of new Set(claim.evidence.map((ref) => ref.digest))) {
|
|
11433
|
-
const payload = citedPayload(
|
|
11436
|
+
const payload = citedPayload(result3.records, digest);
|
|
11434
11437
|
if (payload === void 0)
|
|
11435
11438
|
continue;
|
|
11436
11439
|
if (payload.record_version === CALIBRATION_SUMMARY_V1)
|
|
@@ -11441,7 +11444,7 @@ ${body}
|
|
|
11441
11444
|
ratingsNotMatching += 1;
|
|
11442
11445
|
continue;
|
|
11443
11446
|
}
|
|
11444
|
-
const judged = judgedCase(
|
|
11447
|
+
const judged = judgedCase(result3, rating.ratedCase.digest);
|
|
11445
11448
|
ratings.push({
|
|
11446
11449
|
digest,
|
|
11447
11450
|
rating,
|
|
@@ -11573,8 +11576,8 @@ ${body}
|
|
|
11573
11576
|
}
|
|
11574
11577
|
return out;
|
|
11575
11578
|
}
|
|
11576
|
-
function citedContract(
|
|
11577
|
-
for (const record of
|
|
11579
|
+
function citedContract(result3, contractRef) {
|
|
11580
|
+
for (const record of result3.records.values()) {
|
|
11578
11581
|
const input = record.carriedInput ?? record.agentInput;
|
|
11579
11582
|
if (input.state !== "disclosed" || !isObject2(input.payload))
|
|
11580
11583
|
continue;
|
|
@@ -11586,10 +11589,10 @@ ${body}
|
|
|
11586
11589
|
}
|
|
11587
11590
|
return void 0;
|
|
11588
11591
|
}
|
|
11589
|
-
function readOutcomeReportTerms(
|
|
11592
|
+
function readOutcomeReportTerms(result3) {
|
|
11590
11593
|
const checks = /* @__PURE__ */ new Map();
|
|
11591
11594
|
const contracts = /* @__PURE__ */ new Set();
|
|
11592
|
-
for (const claim of
|
|
11595
|
+
for (const claim of result3.claims) {
|
|
11593
11596
|
if (claim.type !== REQUIREMENT_CLAIM)
|
|
11594
11597
|
continue;
|
|
11595
11598
|
const grouping = parseClaimGrouping(claim);
|
|
@@ -11602,8 +11605,8 @@ ${body}
|
|
|
11602
11605
|
checks.set(grouping.checkId, criteria);
|
|
11603
11606
|
}
|
|
11604
11607
|
const contractRef = contracts.size === 1 ? [...contracts][0] : void 0;
|
|
11605
|
-
const contract = contractRef === void 0 ? void 0 : citedContract(
|
|
11606
|
-
const coveredRefs =
|
|
11608
|
+
const contract = contractRef === void 0 ? void 0 : citedContract(result3, contractRef);
|
|
11609
|
+
const coveredRefs = result3.requirementsCovered === void 0 ? contractCriteria(contract) : result3.requirementsCovered.filter((covered) => covered.contractRef === contractRef).map((covered) => covered.requirementRef);
|
|
11607
11610
|
for (const ref of coveredRefs) {
|
|
11608
11611
|
const split2 = criterionRef(ref);
|
|
11609
11612
|
if (split2 === void 0)
|
|
@@ -11638,13 +11641,13 @@ ${body}
|
|
|
11638
11641
|
reasonCodes: {}
|
|
11639
11642
|
};
|
|
11640
11643
|
}
|
|
11641
|
-
function notRunCriteria(
|
|
11642
|
-
const covered =
|
|
11644
|
+
function notRunCriteria(result3, terms) {
|
|
11645
|
+
const covered = result3.requirementsCovered;
|
|
11643
11646
|
const contractRef = packRef(terms);
|
|
11644
11647
|
if (covered === void 0 || contractRef === void 0)
|
|
11645
11648
|
return [];
|
|
11646
11649
|
const listed = new Set(covered.filter((ref) => ref.contractRef === contractRef).map((ref) => ref.requirementRef));
|
|
11647
|
-
return contractCriteria(citedContract(
|
|
11650
|
+
return contractCriteria(citedContract(result3, contractRef)).filter((id) => !listed.has(id));
|
|
11648
11651
|
}
|
|
11649
11652
|
function contractCriteria(contract) {
|
|
11650
11653
|
const ids = [];
|
|
@@ -11670,9 +11673,9 @@ ${body}
|
|
|
11670
11673
|
zoneNotStated: conversations.filter((c) => c.dated.zone === "not-stated").length
|
|
11671
11674
|
};
|
|
11672
11675
|
}
|
|
11673
|
-
function buildOutcomeReportModel(
|
|
11674
|
-
const terms = readOutcomeReportTerms(
|
|
11675
|
-
const { conversations, days, notYetInForce } = groupClaims(
|
|
11676
|
+
function buildOutcomeReportModel(result3, options) {
|
|
11677
|
+
const terms = readOutcomeReportTerms(result3);
|
|
11678
|
+
const { conversations, days, notYetInForce } = groupClaims(result3, terms);
|
|
11676
11679
|
const dayList = [...days.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([date, convos]) => ({
|
|
11677
11680
|
date,
|
|
11678
11681
|
// No evaluation-report/v1 record carries a day-level policy-change
|
|
@@ -11684,7 +11687,7 @@ ${body}
|
|
|
11684
11687
|
resolvedCount: convos.filter((c) => c.verdict === "met").length,
|
|
11685
11688
|
judgedDays: [...new Set(convos.map((c) => c.judgedDay))].sort()
|
|
11686
11689
|
}));
|
|
11687
|
-
const calibration = buildCalibration(
|
|
11690
|
+
const calibration = buildCalibration(result3);
|
|
11688
11691
|
const { held: held2, added } = heldAndAdded(calibration);
|
|
11689
11692
|
const checkPassCounts = /* @__PURE__ */ new Map();
|
|
11690
11693
|
for (const check of terms.checks)
|
|
@@ -11701,7 +11704,7 @@ ${body}
|
|
|
11701
11704
|
dating: buildDating(conversations),
|
|
11702
11705
|
conversations,
|
|
11703
11706
|
notYetInForce,
|
|
11704
|
-
runInfo: buildRunInfo(
|
|
11707
|
+
runInfo: buildRunInfo(result3, conversations),
|
|
11705
11708
|
calibration,
|
|
11706
11709
|
checkPassCounts,
|
|
11707
11710
|
missedReasons: missedReasonGroups(terms, conversations),
|
|
@@ -11715,8 +11718,8 @@ ${body}
|
|
|
11715
11718
|
notApplicableCount,
|
|
11716
11719
|
outOfScopeCount,
|
|
11717
11720
|
noClaimCount,
|
|
11718
|
-
notRun: notRunCriteria(
|
|
11719
|
-
capsuleId:
|
|
11721
|
+
notRun: notRunCriteria(result3, terms),
|
|
11722
|
+
capsuleId: result3.capsuleId
|
|
11720
11723
|
};
|
|
11721
11724
|
}
|
|
11722
11725
|
|
|
@@ -11833,12 +11836,12 @@ ${body}
|
|
|
11833
11836
|
return invalid2.has(id) ? [] : [id];
|
|
11834
11837
|
});
|
|
11835
11838
|
}
|
|
11836
|
-
function membershipProvenOrUnbound(
|
|
11837
|
-
return
|
|
11839
|
+
function membershipProvenOrUnbound(result3) {
|
|
11840
|
+
return result3.perRecordMembership.status === "pass" || result3.perRecordMembership.status === "fail" && result3.perRecordMembership.findings.length > 0 && result3.perRecordMembership.findings.length === unboundRecordIds(result3).length;
|
|
11838
11841
|
}
|
|
11839
|
-
function bundleVerified(
|
|
11840
|
-
const selected = isProducerSelection(
|
|
11841
|
-
return
|
|
11842
|
+
function bundleVerified(result3) {
|
|
11843
|
+
const selected = isProducerSelection(result3);
|
|
11844
|
+
return result3.graphClosure.status === "pass" && (selected || result3.intervalCoverage.status === "pass") && membershipProvenOrUnbound(result3) && Object.values(result3.capsuleResults).every((capsule) => capsule.ok) && result3.disclosures.every((disclosure) => disclosure.status === "disclosure_match" || disclosure.status === "withheld");
|
|
11842
11845
|
}
|
|
11843
11846
|
function nonUnboundFindings(verified) {
|
|
11844
11847
|
const names2 = [];
|
|
@@ -11999,12 +12002,12 @@ ${body}
|
|
|
11999
12002
|
const carried = fields(fields(bundle).checkpoint).witnesses;
|
|
12000
12003
|
const total = Array.isArray(carried) ? carried.length : 0;
|
|
12001
12004
|
const count2 = (prefix) => strict2.witnesses.findings.filter((f) => f.startsWith(prefix)).length;
|
|
12002
|
-
const
|
|
12005
|
+
const receipts3 = (n, plural, single) => total === 1 ? `the witness receipt ${single}` : `${n} of ${total} witness receipts ${plural}`;
|
|
12003
12006
|
const malformed = count2("witness_receipt_malformed:"), invalid2 = count2("witness_receipt_invalid:");
|
|
12004
12007
|
if (malformed > 0)
|
|
12005
|
-
named.push(`${
|
|
12008
|
+
named.push(`${receipts3(malformed, "are malformed", "is malformed")} (witness_receipt_malformed)`);
|
|
12006
12009
|
if (invalid2 > 0)
|
|
12007
|
-
named.push(`${
|
|
12010
|
+
named.push(`${receipts3(invalid2, "do not verify", "does not verify")} (witness_receipt_invalid)`);
|
|
12008
12011
|
}
|
|
12009
12012
|
sentences.push(unboundOnly ? uncheckpointed : `What failed: ${named.join("; ")}.`);
|
|
12010
12013
|
}
|
|
@@ -12217,7 +12220,7 @@ ${body}
|
|
|
12217
12220
|
const results = Object.values(capsuleResults);
|
|
12218
12221
|
if (results.length === 0)
|
|
12219
12222
|
return "not_checked";
|
|
12220
|
-
const failed2 = results.some((
|
|
12223
|
+
const failed2 = results.some((result3) => result3.findings.some((finding) => finding.severity === "error" && finding.check !== void 0 && checks.includes(finding.check)));
|
|
12221
12224
|
return failed2 ? "fail" : "pass";
|
|
12222
12225
|
}
|
|
12223
12226
|
function receiptGradeWord(value) {
|
|
@@ -13644,10 +13647,10 @@ ${body}
|
|
|
13644
13647
|
return invalid(`${what} is not {digest_alg: "SHA-256", digest: <64-hex>}`);
|
|
13645
13648
|
return value.digest;
|
|
13646
13649
|
}
|
|
13647
|
-
function resultDocument2(context,
|
|
13648
|
-
const member = disclosureOf(context,
|
|
13650
|
+
function resultDocument2(context, result3) {
|
|
13651
|
+
const member = disclosureOf(context, result3.capsuleId, result3.member);
|
|
13649
13652
|
if (member.state !== "disclosed" || !isObj3(member.payload)) return void 0;
|
|
13650
|
-
const document2 =
|
|
13653
|
+
const document2 = result3.form === "book" ? member.payload.statement : member.payload;
|
|
13651
13654
|
return isObj3(document2) ? document2 : void 0;
|
|
13652
13655
|
}
|
|
13653
13656
|
async function digestOf(value) {
|
|
@@ -13699,8 +13702,8 @@ ${body}
|
|
|
13699
13702
|
}
|
|
13700
13703
|
return found;
|
|
13701
13704
|
}
|
|
13702
|
-
async function chartDatasetOf(context,
|
|
13703
|
-
const document2 = resultDocument2(context,
|
|
13705
|
+
async function chartDatasetOf(context, result3) {
|
|
13706
|
+
const document2 = resultDocument2(context, result3);
|
|
13704
13707
|
if (document2 === void 0) return void 0;
|
|
13705
13708
|
const planRef = digestRef(document2.plan_ref, "the Result's plan_ref");
|
|
13706
13709
|
const datasetRef = digestRef(
|
|
@@ -14096,7 +14099,7 @@ ${s} [data-src="producer"]:not(.cv-src){font-style:italic}
|
|
|
14096
14099
|
const found = globalThis.CapsuleViewerShowEvidence;
|
|
14097
14100
|
return typeof found?.resolve === "function" && typeof found.render === "function" ? found : void 0;
|
|
14098
14101
|
}
|
|
14099
|
-
function evidenceAction(key, name, counted2,
|
|
14102
|
+
function evidenceAction(key, name, counted2, result3, w, summary = w.t("evidence.show")) {
|
|
14100
14103
|
if (counted2.length === 0) return void 0;
|
|
14101
14104
|
const claims = counted2.filter((c) => c !== void 0);
|
|
14102
14105
|
const cited = /* @__PURE__ */ new Set();
|
|
@@ -14162,7 +14165,7 @@ ${s} [data-src="producer"]:not(.cv-src){font-style:italic}
|
|
|
14162
14165
|
for (const claim of new Set(claims))
|
|
14163
14166
|
sides.append(
|
|
14164
14167
|
component.render(
|
|
14165
|
-
component.resolve(
|
|
14168
|
+
component.resolve(result3, claim),
|
|
14166
14169
|
details.ownerDocument
|
|
14167
14170
|
)
|
|
14168
14171
|
);
|
|
@@ -14728,10 +14731,10 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
14728
14731
|
details.append(body);
|
|
14729
14732
|
return details;
|
|
14730
14733
|
}
|
|
14731
|
-
function renderChart(chart, index,
|
|
14734
|
+
function renderChart(chart, index, sha2565, w) {
|
|
14732
14735
|
const figure = el3("figure", "cv-chart");
|
|
14733
14736
|
figure.setAttribute(CHART_ATTRIBUTE, String(index));
|
|
14734
|
-
figure.dataset.chartSha256 =
|
|
14737
|
+
figure.dataset.chartSha256 = sha2565;
|
|
14735
14738
|
figure.append(drawSvg(chart, index));
|
|
14736
14739
|
const caption = el3("figcaption");
|
|
14737
14740
|
const population2 = w.p("chart.population", chart.population);
|
|
@@ -14821,11 +14824,11 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
14821
14824
|
var isoOf = (ms) => new Date(ms).toISOString().slice(0, 10);
|
|
14822
14825
|
var weekdayOf = (day) => (new Date(utcMs(day)).getUTCDay() + 6) % 7;
|
|
14823
14826
|
var mondayOf = (day) => isoOf(utcMs(day) - weekdayOf(day) * DAY);
|
|
14824
|
-
function frame(view, index,
|
|
14827
|
+
function frame(view, index, sha2565, w, parts) {
|
|
14825
14828
|
const figure = el4("figure", "cv-view");
|
|
14826
14829
|
figure.setAttribute(CHART_ATTRIBUTE, String(index));
|
|
14827
14830
|
figure.dataset.view = view.view;
|
|
14828
|
-
figure.dataset.chartSha256 =
|
|
14831
|
+
figure.dataset.chartSha256 = sha2565;
|
|
14829
14832
|
const caption = el4(
|
|
14830
14833
|
"figcaption",
|
|
14831
14834
|
void 0,
|
|
@@ -15057,8 +15060,8 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15057
15060
|
}
|
|
15058
15061
|
return section;
|
|
15059
15062
|
}
|
|
15060
|
-
function renderCalendar(view, index,
|
|
15061
|
-
const figure = frame(view, index,
|
|
15063
|
+
function renderCalendar(view, index, sha2565, w) {
|
|
15064
|
+
const figure = frame(view, index, sha2565, w, view.lanes);
|
|
15062
15065
|
const first = view.lanes[0];
|
|
15063
15066
|
const notRun = new Set(
|
|
15064
15067
|
(first.chart.units ?? []).filter((u) => u.notRun).map((u) => u.unit)
|
|
@@ -15131,9 +15134,9 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15131
15134
|
rows: sum.rows,
|
|
15132
15135
|
runRows: []
|
|
15133
15136
|
});
|
|
15134
|
-
function renderByPeriod(view, index,
|
|
15137
|
+
function renderByPeriod(view, index, sha2565, w) {
|
|
15135
15138
|
const parts = [view.count, ...view.columns];
|
|
15136
|
-
const figure = frame(view, index,
|
|
15139
|
+
const figure = frame(view, index, sha2565, w, parts);
|
|
15137
15140
|
const keyOf2 = (chart) => chart.keys.find((k) => k !== "x");
|
|
15138
15141
|
const field = view.count.chart.channels[keyOf2(view.count.chart)].field;
|
|
15139
15142
|
const requirements = [];
|
|
@@ -15281,8 +15284,8 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15281
15284
|
const word = w.section3(`lane.${id}.title`);
|
|
15282
15285
|
return word ?? code(id);
|
|
15283
15286
|
}
|
|
15284
|
-
function renderTimeline(view, index,
|
|
15285
|
-
const figure = frame(view, index,
|
|
15287
|
+
function renderTimeline(view, index, sha2565, w) {
|
|
15288
|
+
const figure = frame(view, index, sha2565, w, view.lanes);
|
|
15286
15289
|
const units = view.lanes[0].chart.units ?? [];
|
|
15287
15290
|
const plotW = TL.w - TL.left - TL.right;
|
|
15288
15291
|
const band = plotW / Math.max(1, units.length);
|
|
@@ -15405,8 +15408,8 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15405
15408
|
figure.append(lists);
|
|
15406
15409
|
return figure;
|
|
15407
15410
|
}
|
|
15408
|
-
function renderCoFailure(view, index,
|
|
15409
|
-
const figure = frame(view, index,
|
|
15411
|
+
function renderCoFailure(view, index, sha2565, w) {
|
|
15412
|
+
const figure = frame(view, index, sha2565, w, [view.count]);
|
|
15410
15413
|
figure.append(
|
|
15411
15414
|
el4("p", "cv-cofail-total", w.p("cofail.failing", view.failing))
|
|
15412
15415
|
);
|
|
@@ -15462,26 +15465,26 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15462
15465
|
figure.append(scroll);
|
|
15463
15466
|
return figure;
|
|
15464
15467
|
}
|
|
15465
|
-
function renderView(view, index,
|
|
15468
|
+
function renderView(view, index, sha2565, w) {
|
|
15466
15469
|
switch (view.view) {
|
|
15467
15470
|
case "calendar":
|
|
15468
|
-
return renderCalendar(view, index,
|
|
15471
|
+
return renderCalendar(view, index, sha2565, w);
|
|
15469
15472
|
case "timeline":
|
|
15470
|
-
return renderTimeline(view, index,
|
|
15473
|
+
return renderTimeline(view, index, sha2565, w);
|
|
15471
15474
|
case "co-failure":
|
|
15472
|
-
return renderCoFailure(view, index,
|
|
15475
|
+
return renderCoFailure(view, index, sha2565, w);
|
|
15473
15476
|
case "by-period":
|
|
15474
|
-
return renderByPeriod(view, index,
|
|
15477
|
+
return renderByPeriod(view, index, sha2565, w);
|
|
15475
15478
|
}
|
|
15476
15479
|
}
|
|
15477
15480
|
|
|
15478
15481
|
// src/record-dating.ts
|
|
15479
15482
|
var STATED_DAY2 = /^(\d{4}-\d{2}-\d{2})/u;
|
|
15480
|
-
function caseRecord2(
|
|
15483
|
+
function caseRecord2(result3, claims, sourceCapsuleId) {
|
|
15481
15484
|
if (sourceCapsuleId === void 0) return void 0;
|
|
15482
15485
|
for (const claim of claims)
|
|
15483
15486
|
for (const ref of claim.evidence) {
|
|
15484
|
-
const record =
|
|
15487
|
+
const record = result3.records.get(ref.digest);
|
|
15485
15488
|
if (record === void 0 || record.stated === void 0) continue;
|
|
15486
15489
|
if (record.carriedCapsuleId === sourceCapsuleId || record.carriedCapsuleId === void 0 && record.bookRecordId === void 0 && record.capsuleId === sourceCapsuleId)
|
|
15487
15490
|
return record;
|
|
@@ -15575,8 +15578,8 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15575
15578
|
obligationKey: claim.requirementRef.slice(0, dot)
|
|
15576
15579
|
};
|
|
15577
15580
|
}
|
|
15578
|
-
function countedClaims(
|
|
15579
|
-
const parsed =
|
|
15581
|
+
function countedClaims(result3, presentation) {
|
|
15582
|
+
const parsed = result3.claims.flatMap((c) => {
|
|
15580
15583
|
const p = parseClaim(c);
|
|
15581
15584
|
return p === void 0 ? [] : [p];
|
|
15582
15585
|
});
|
|
@@ -15600,7 +15603,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15600
15603
|
pack: { id: NOT_STATED, version: NOT_STATED }
|
|
15601
15604
|
};
|
|
15602
15605
|
}
|
|
15603
|
-
function buildSessions(
|
|
15606
|
+
function buildSessions(result3, claims, testIds) {
|
|
15604
15607
|
const byConversation = /* @__PURE__ */ new Map();
|
|
15605
15608
|
for (const p of claims) {
|
|
15606
15609
|
const list2 = byConversation.get(p.conversationId) ?? [];
|
|
@@ -15630,18 +15633,18 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15630
15633
|
verdict: "not_yet_in_force",
|
|
15631
15634
|
tier: "not stated",
|
|
15632
15635
|
claim,
|
|
15633
|
-
reportState: reportState(
|
|
15636
|
+
reportState: reportState(result3.records, claim)
|
|
15634
15637
|
});
|
|
15635
15638
|
continue;
|
|
15636
15639
|
}
|
|
15637
|
-
const payload = reportPayload2(
|
|
15640
|
+
const payload = reportPayload2(result3.records, claim);
|
|
15638
15641
|
const rationale = asString2(payload?.rationale);
|
|
15639
15642
|
const contract = claim.contractRef || asString2(payload?.contract_ref) || asString2(payload?.contract);
|
|
15640
15643
|
const judgePinDigest = asString2(payload?.judge_pin_digest);
|
|
15641
15644
|
const source = asString2(payload?.source_capsule_id);
|
|
15642
15645
|
if (source !== void 0) sources.add(source);
|
|
15643
15646
|
if (judgedDay === NOT_STATED)
|
|
15644
|
-
judgedDay = reportSealedDay(
|
|
15647
|
+
judgedDay = reportSealedDay(result3.records, claim) ?? dayOf2(payload);
|
|
15645
15648
|
const reportDigest = claim.evidence[0]?.digest;
|
|
15646
15649
|
tests.push({
|
|
15647
15650
|
criterionId,
|
|
@@ -15654,16 +15657,16 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15654
15657
|
...rationale === void 0 ? {} : { rationale },
|
|
15655
15658
|
...contract === void 0 ? {} : { contract },
|
|
15656
15659
|
...judgePinDigest === void 0 ? {} : { judgePinDigest },
|
|
15657
|
-
reportState: reportState(
|
|
15660
|
+
reportState: reportState(result3.records, claim)
|
|
15658
15661
|
});
|
|
15659
15662
|
}
|
|
15660
15663
|
let caseFrom = "reports";
|
|
15661
15664
|
if (sources.size === 0) {
|
|
15662
15665
|
const cited = claimsCitedCase(
|
|
15663
|
-
|
|
15666
|
+
result3.records,
|
|
15664
15667
|
conversationId,
|
|
15665
15668
|
conversationClaims,
|
|
15666
|
-
|
|
15669
|
+
result3.claims
|
|
15667
15670
|
);
|
|
15668
15671
|
if (cited !== void 0) {
|
|
15669
15672
|
sources.add(cited);
|
|
@@ -15672,7 +15675,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15672
15675
|
}
|
|
15673
15676
|
const sourceCapsuleId = sources.size === 1 ? [...sources][0] : void 0;
|
|
15674
15677
|
const dated = conversationDate2(
|
|
15675
|
-
caseRecord2(
|
|
15678
|
+
caseRecord2(result3, conversationClaims, sourceCapsuleId),
|
|
15676
15679
|
judgedDay
|
|
15677
15680
|
);
|
|
15678
15681
|
sessions.push({
|
|
@@ -15683,7 +15686,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15683
15686
|
tests,
|
|
15684
15687
|
...sourceCapsuleId === void 0 ? {} : { sourceCapsuleId, caseFrom },
|
|
15685
15688
|
transcript: findTranscript(
|
|
15686
|
-
|
|
15689
|
+
result3,
|
|
15687
15690
|
conversationId,
|
|
15688
15691
|
conversationClaims,
|
|
15689
15692
|
sourceCapsuleId,
|
|
@@ -15696,11 +15699,11 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15696
15699
|
);
|
|
15697
15700
|
return sessions;
|
|
15698
15701
|
}
|
|
15699
|
-
function sealedWording(
|
|
15702
|
+
function sealedWording(result3, claims, criterionId) {
|
|
15700
15703
|
const texts = /* @__PURE__ */ new Set();
|
|
15701
15704
|
for (const p of claims) {
|
|
15702
15705
|
if (p.claim.requirementRef !== criterionId) continue;
|
|
15703
|
-
const text2 = asString2(reportPayload2(
|
|
15706
|
+
const text2 = asString2(reportPayload2(result3.records, p.claim)?.clause_claim);
|
|
15704
15707
|
if (text2 !== void 0) texts.add(text2);
|
|
15705
15708
|
}
|
|
15706
15709
|
if (texts.size === 1) return { text: [...texts][0], source: "sealed" };
|
|
@@ -15769,7 +15772,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15769
15772
|
rows
|
|
15770
15773
|
};
|
|
15771
15774
|
}
|
|
15772
|
-
function buildRunInfo2(
|
|
15775
|
+
function buildRunInfo2(result3, sessions) {
|
|
15773
15776
|
const contracts = /* @__PURE__ */ new Set();
|
|
15774
15777
|
const pins = /* @__PURE__ */ new Set();
|
|
15775
15778
|
for (const session of sessions)
|
|
@@ -15781,12 +15784,12 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15781
15784
|
...contracts.size === 1 ? { contract: [...contracts][0] } : {},
|
|
15782
15785
|
...pins.size === 1 ? { judgePinDigest: [...pins][0] } : {},
|
|
15783
15786
|
pinned: contracts.size <= 1 && pins.size <= 1,
|
|
15784
|
-
...withheldOf(
|
|
15787
|
+
...withheldOf(result3, sessions)
|
|
15785
15788
|
};
|
|
15786
15789
|
}
|
|
15787
|
-
function withheldOf(
|
|
15790
|
+
function withheldOf(result3, sessions) {
|
|
15788
15791
|
const counted2 = withheldReports(
|
|
15789
|
-
|
|
15792
|
+
result3.records,
|
|
15790
15793
|
sessions.flatMap(
|
|
15791
15794
|
(s) => s.tests.flatMap((t) => t.claim === void 0 ? [] : [t.claim])
|
|
15792
15795
|
)
|
|
@@ -15825,8 +15828,8 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15825
15828
|
...days.length === 0 ? {} : { from: days[0], to: days[days.length - 1] }
|
|
15826
15829
|
};
|
|
15827
15830
|
}
|
|
15828
|
-
function buildComplianceModel(
|
|
15829
|
-
const { claims, pack } = countedClaims(
|
|
15831
|
+
function buildComplianceModel(result3, presentation) {
|
|
15832
|
+
const { claims, pack } = countedClaims(result3, presentation);
|
|
15830
15833
|
const tests = /* @__PURE__ */ new Map();
|
|
15831
15834
|
for (const p of claims) {
|
|
15832
15835
|
const list2 = tests.get(p.obligationKey) ?? [];
|
|
@@ -15835,7 +15838,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15835
15838
|
tests.set(p.obligationKey, list2);
|
|
15836
15839
|
}
|
|
15837
15840
|
const testIds = [...tests.values()].flat();
|
|
15838
|
-
const sessions = buildSessions(
|
|
15841
|
+
const sessions = buildSessions(result3, claims, testIds);
|
|
15839
15842
|
const mappings = new Map(presentation.obligations.map((o) => [o.key, o]));
|
|
15840
15843
|
const obligations = [...tests.entries()].map(([key, ids]) => {
|
|
15841
15844
|
const mapping = mappings.get(key);
|
|
@@ -15849,7 +15852,7 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15849
15852
|
(id) => buildRow(
|
|
15850
15853
|
id,
|
|
15851
15854
|
rowMappings.get(id),
|
|
15852
|
-
sealedWording(
|
|
15855
|
+
sealedWording(result3, claims, id),
|
|
15853
15856
|
sessions
|
|
15854
15857
|
)
|
|
15855
15858
|
)
|
|
@@ -15863,9 +15866,9 @@ path.cv-tl-good{fill:var(--person)}path.cv-tl-bad{fill:var(--bad)}path.cv-tl-ope
|
|
|
15863
15866
|
findings: buildFindings(obligations),
|
|
15864
15867
|
totalSessions: sessions.length,
|
|
15865
15868
|
dating: complianceDating(sessions),
|
|
15866
|
-
runInfo: buildRunInfo2(
|
|
15869
|
+
runInfo: buildRunInfo2(result3, sessions),
|
|
15867
15870
|
qualityProtocol: presentation.qualityProtocol,
|
|
15868
|
-
capsuleId:
|
|
15871
|
+
capsuleId: result3.capsuleId
|
|
15869
15872
|
};
|
|
15870
15873
|
}
|
|
15871
15874
|
|
|
@@ -16618,13 +16621,13 @@ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:
|
|
|
16618
16621
|
}
|
|
16619
16622
|
function builtCommit() {
|
|
16620
16623
|
if (false) return void 0;
|
|
16621
|
-
return commitPrefix("
|
|
16624
|
+
return commitPrefix("60fb05dda0f3c2be341a9d5cccbb991bed45f0b9");
|
|
16622
16625
|
}
|
|
16623
16626
|
var commit = builtCommit();
|
|
16624
16627
|
var unreleased = false;
|
|
16625
16628
|
var VIEWER_BUILD = {
|
|
16626
16629
|
viewer: "@action-state-group/capsule-viewer",
|
|
16627
|
-
viewerVersion: "0.
|
|
16630
|
+
viewerVersion: "0.11.0",
|
|
16628
16631
|
verifier: "@action-state-group/agent-action-capsule",
|
|
16629
16632
|
verifierVersion: "0.13.0",
|
|
16630
16633
|
cllVersion: "0.3.0",
|
|
@@ -19479,7 +19482,7 @@ ${key}`);
|
|
|
19479
19482
|
if (Array.isArray(b.records))
|
|
19480
19483
|
cell2(w.t("front.check.records"), fmt3(b.records.length), "records");
|
|
19481
19484
|
section.append(anchors);
|
|
19482
|
-
const
|
|
19485
|
+
const receipts3 = witnessEntries(b.checkpoint).filter(
|
|
19483
19486
|
(entry) => !entry.stub && !entry.malformed
|
|
19484
19487
|
);
|
|
19485
19488
|
const steps = el6("ol", "steps");
|
|
@@ -19490,9 +19493,9 @@ ${key}`);
|
|
|
19490
19493
|
const compare2 = el6(
|
|
19491
19494
|
"li",
|
|
19492
19495
|
"",
|
|
19493
|
-
w.t(
|
|
19496
|
+
w.t(receipts3.length > 0 ? "front.check.s3.receipt" : "front.check.s3.none")
|
|
19494
19497
|
);
|
|
19495
|
-
compare2.dataset.receipt =
|
|
19498
|
+
compare2.dataset.receipt = receipts3.length > 0 ? "present" : "absent";
|
|
19496
19499
|
steps.append(compare2, el6("li", "", w.t("front.check.s4")));
|
|
19497
19500
|
section.append(steps);
|
|
19498
19501
|
return section;
|
|
@@ -20735,7 +20738,7 @@ ${key}`);
|
|
|
20735
20738
|
}
|
|
20736
20739
|
host.append(section);
|
|
20737
20740
|
}
|
|
20738
|
-
function renderRules(host, model, runInfo,
|
|
20741
|
+
function renderRules(host, model, runInfo, result3, w) {
|
|
20739
20742
|
const tierOf = model.gating?.tierOf;
|
|
20740
20743
|
const section = el8("section", "sec");
|
|
20741
20744
|
section.dataset.section = "rules";
|
|
@@ -20841,7 +20844,7 @@ ${key}`);
|
|
|
20841
20844
|
(cr) => cr.checkId === check.id && cr.criterionId === criterion2.id && pick(cr.verdict)
|
|
20842
20845
|
)?.claim
|
|
20843
20846
|
),
|
|
20844
|
-
|
|
20847
|
+
result3,
|
|
20845
20848
|
w
|
|
20846
20849
|
);
|
|
20847
20850
|
if (action !== void 0) cell4.append(action);
|
|
@@ -21330,13 +21333,13 @@ ${key}`);
|
|
|
21330
21333
|
section.append(toggle);
|
|
21331
21334
|
host.append(section);
|
|
21332
21335
|
}
|
|
21333
|
-
async function resultDocument3(
|
|
21336
|
+
async function resultDocument3(result3, bundle) {
|
|
21334
21337
|
try {
|
|
21335
21338
|
const context = await verifiedBundleContext(bundle);
|
|
21336
|
-
const member = disclosureOf(context,
|
|
21339
|
+
const member = disclosureOf(context, result3.capsuleId, result3.member);
|
|
21337
21340
|
if (member.state !== "disclosed") return void 0;
|
|
21338
21341
|
const payload = member.payload;
|
|
21339
|
-
return
|
|
21342
|
+
return result3.form === "book" && payload !== null && typeof payload === "object" ? payload.statement : payload;
|
|
21340
21343
|
} catch {
|
|
21341
21344
|
return void 0;
|
|
21342
21345
|
}
|
|
@@ -21382,8 +21385,8 @@ ${key}`);
|
|
|
21382
21385
|
page: "outcome-report",
|
|
21383
21386
|
css: OUTCOME_REPORT_CSS
|
|
21384
21387
|
};
|
|
21385
|
-
async function drawLines(levels,
|
|
21386
|
-
const built = buildOutcomeReportModel(
|
|
21388
|
+
async function drawLines(levels, result3, options, bundle, verified, w, tierOf) {
|
|
21389
|
+
const built = buildOutcomeReportModel(result3, options);
|
|
21387
21390
|
const model = tierOf === void 0 ? built : { ...built, gating: gating(built.conversations, tierOf) };
|
|
21388
21391
|
const runInfo = await verifyJudgePin(model.runInfo);
|
|
21389
21392
|
const claims = model.conversations.flatMap(
|
|
@@ -21399,7 +21402,7 @@ ${key}`);
|
|
|
21399
21402
|
if (notes.childElementCount > 0) pad.append(notes);
|
|
21400
21403
|
sheet.append(pad);
|
|
21401
21404
|
levels.L0.append(sheet);
|
|
21402
|
-
const slice2 = readSubjectHistory(await resultDocument3(
|
|
21405
|
+
const slice2 = readSubjectHistory(await resultDocument3(result3, bundle));
|
|
21403
21406
|
if (slice2 !== void 0) {
|
|
21404
21407
|
const subject = renderSubjectHistory(
|
|
21405
21408
|
subjectConversations(model, w),
|
|
@@ -21409,12 +21412,12 @@ ${key}`);
|
|
|
21409
21412
|
);
|
|
21410
21413
|
if (subject !== void 0) levels.L0.append(subject);
|
|
21411
21414
|
}
|
|
21412
|
-
renderRules(levels.L1, model, runInfo,
|
|
21415
|
+
renderRules(levels.L1, model, runInfo, result3, w);
|
|
21413
21416
|
leadWithProvenance(
|
|
21414
21417
|
levels.L1,
|
|
21415
21418
|
levels.L1.querySelector('[data-section="rules"]'),
|
|
21416
21419
|
renderProvenance(
|
|
21417
|
-
await provenanceLines(
|
|
21420
|
+
await provenanceLines(result3.records, claims, bundle, verified, w)
|
|
21418
21421
|
)
|
|
21419
21422
|
);
|
|
21420
21423
|
levels.L2.append(renderCheckYourself(bundle, w));
|
|
@@ -21701,7 +21704,7 @@ ${key}`);
|
|
|
21701
21704
|
...undecided
|
|
21702
21705
|
};
|
|
21703
21706
|
}
|
|
21704
|
-
function rowResult(row2, model,
|
|
21707
|
+
function rowResult(row2, model, result3, w) {
|
|
21705
21708
|
const cell2 = document.createElement("td");
|
|
21706
21709
|
const status2 = rowStatus(row2, w);
|
|
21707
21710
|
cell2.append(statusPill(status2.cls, status2.text));
|
|
@@ -21731,7 +21734,7 @@ ${key}`);
|
|
|
21731
21734
|
`test:${row2.criterionId}:${bucket}`,
|
|
21732
21735
|
`${row2.name} \xB7 ${word}: ${fmt4(ids.length)}`,
|
|
21733
21736
|
ids.map((id) => claimOf(model, id, row2.criterionId)),
|
|
21734
|
-
|
|
21737
|
+
result3,
|
|
21735
21738
|
w,
|
|
21736
21739
|
w.t("evidence.show.for", { what: word })
|
|
21737
21740
|
);
|
|
@@ -21749,7 +21752,7 @@ ${key}`);
|
|
|
21749
21752
|
]);
|
|
21750
21753
|
return model.sessions.filter((s) => !outside.has(s.conversationId)).map((s) => s.tests.find((t) => t.criterionId === row2.criterionId)?.claim);
|
|
21751
21754
|
}
|
|
21752
|
-
function renderSummary(host, model, presentation,
|
|
21755
|
+
function renderSummary(host, model, presentation, result3, w, tierOf) {
|
|
21753
21756
|
const section = el9("section", "");
|
|
21754
21757
|
section.dataset.section = "summary";
|
|
21755
21758
|
const regulation = maybeProducer(w, "p", "kicker", model.regulation, true);
|
|
@@ -21894,11 +21897,11 @@ ${key}`);
|
|
|
21894
21897
|
`test:${test.criterionId}:checked-in`,
|
|
21895
21898
|
`${test.name} \xB7 ${w.t("groups.summary.col.checked-in")}: ${count(w, "session", counted2)}`,
|
|
21896
21899
|
populationClaims(test, model),
|
|
21897
|
-
|
|
21900
|
+
result3,
|
|
21898
21901
|
w
|
|
21899
21902
|
);
|
|
21900
21903
|
if (action !== void 0) checkedIn.append(action);
|
|
21901
|
-
tr.append(nameCell, checkedIn, rowResult(test, model,
|
|
21904
|
+
tr.append(nameCell, checkedIn, rowResult(test, model, result3, w));
|
|
21902
21905
|
tbody.append(tr);
|
|
21903
21906
|
if (sessionIds.length > 0) {
|
|
21904
21907
|
const drillRow = el9("tr", "drill-row");
|
|
@@ -22358,8 +22361,8 @@ ${key}`);
|
|
|
22358
22361
|
page: "compliance",
|
|
22359
22362
|
css: COMPLIANCE_CSS
|
|
22360
22363
|
};
|
|
22361
|
-
async function drawGroups(levels,
|
|
22362
|
-
const model = buildComplianceModel(
|
|
22364
|
+
async function drawGroups(levels, result3, presentation, bundle, verified, w, tierOf) {
|
|
22365
|
+
const model = buildComplianceModel(result3, presentation);
|
|
22363
22366
|
const claims = model.sessions.flatMap(
|
|
22364
22367
|
(s) => s.tests.flatMap((t) => t.claim === void 0 ? [] : [t.claim])
|
|
22365
22368
|
);
|
|
@@ -22367,12 +22370,12 @@ ${key}`);
|
|
|
22367
22370
|
const sheet = el9("div", "l0-card");
|
|
22368
22371
|
renderHeader(sheet, model, w, tierOf);
|
|
22369
22372
|
levels.L0.append(sheet);
|
|
22370
|
-
renderSummary(levels.L1, model, presentation,
|
|
22373
|
+
renderSummary(levels.L1, model, presentation, result3, w, tierOf);
|
|
22371
22374
|
leadWithProvenance(
|
|
22372
22375
|
levels.L1,
|
|
22373
22376
|
levels.L1.querySelector('[data-section="summary"]'),
|
|
22374
22377
|
renderProvenance(
|
|
22375
|
-
await provenanceLines(
|
|
22378
|
+
await provenanceLines(result3.records, claims, bundle, verified, w)
|
|
22376
22379
|
)
|
|
22377
22380
|
);
|
|
22378
22381
|
renderFindings(levels.L1, model, w);
|
|
@@ -22382,18 +22385,18 @@ ${key}`);
|
|
|
22382
22385
|
|
|
22383
22386
|
// src/contract-report.ts
|
|
22384
22387
|
var FRAMES = { lines: LINES_FRAME, groups: GROUPS_FRAME };
|
|
22385
|
-
function tierReader(
|
|
22388
|
+
function tierReader(result3, contract) {
|
|
22386
22389
|
if (contract === void 0) return void 0;
|
|
22387
|
-
const single = citesOneContract(
|
|
22390
|
+
const single = citesOneContract(result3) ? result3.claims[0]?.contractRef : void 0;
|
|
22388
22391
|
return (contractRef, requirementRef) => rowTier(contract, contractRef ?? single ?? "", requirementRef);
|
|
22389
22392
|
}
|
|
22390
|
-
function citesOneContract(
|
|
22391
|
-
return new Set(
|
|
22393
|
+
function citesOneContract(result3) {
|
|
22394
|
+
return new Set(result3.claims.map((claim) => claim.contractRef)).size <= 1;
|
|
22392
22395
|
}
|
|
22393
|
-
async function renderContractReport(
|
|
22394
|
-
const tierOf = tierReader(
|
|
22396
|
+
async function renderContractReport(result3, input, bundle, verified, host, wording, contract) {
|
|
22397
|
+
const tierOf = tierReader(result3, contract);
|
|
22395
22398
|
const w = await contractReportWords(input.grouping, wording, {
|
|
22396
|
-
singleContract: citesOneContract(
|
|
22399
|
+
singleContract: citesOneContract(result3)
|
|
22397
22400
|
});
|
|
22398
22401
|
const frame2 = FRAMES[input.grouping];
|
|
22399
22402
|
const regions = (
|
|
@@ -22415,7 +22418,7 @@ ${key}`);
|
|
|
22415
22418
|
levels.L0.append(style);
|
|
22416
22419
|
const refused = refusedWordingNotice(w);
|
|
22417
22420
|
if (refused !== void 0) levels.L0.append(refused);
|
|
22418
|
-
if (tierOf !== void 0 &&
|
|
22421
|
+
if (tierOf !== void 0 && result3.claims.some(
|
|
22419
22422
|
(claim) => tierOf(claim.contractRef, claim.requirementRef) === "informational"
|
|
22420
22423
|
)) {
|
|
22421
22424
|
const note = document.createElement("p");
|
|
@@ -22425,11 +22428,11 @@ ${key}`);
|
|
|
22425
22428
|
levels.L0.append(note);
|
|
22426
22429
|
}
|
|
22427
22430
|
if (input.grouping === "lines")
|
|
22428
|
-
await drawLines(levels,
|
|
22431
|
+
await drawLines(levels, result3, input.options, bundle, verified, w, tierOf);
|
|
22429
22432
|
else
|
|
22430
22433
|
await drawGroups(
|
|
22431
22434
|
levels,
|
|
22432
|
-
|
|
22435
|
+
result3,
|
|
22433
22436
|
input.presentation,
|
|
22434
22437
|
bundle,
|
|
22435
22438
|
verified,
|
|
@@ -22441,18 +22444,18 @@ ${key}`);
|
|
|
22441
22444
|
regions.L2.append(levels.L2);
|
|
22442
22445
|
applyDepth({ ...levels, depth: regions.depth });
|
|
22443
22446
|
}
|
|
22444
|
-
function renderOutcomeReportPage(
|
|
22447
|
+
function renderOutcomeReportPage(result3, options, bundle, verified, root) {
|
|
22445
22448
|
return renderContractReport(
|
|
22446
|
-
|
|
22449
|
+
result3,
|
|
22447
22450
|
{ grouping: "lines", options },
|
|
22448
22451
|
bundle,
|
|
22449
22452
|
verified,
|
|
22450
22453
|
root
|
|
22451
22454
|
);
|
|
22452
22455
|
}
|
|
22453
|
-
function renderCompliancePage(
|
|
22456
|
+
function renderCompliancePage(result3, presentation, bundle, verified, root) {
|
|
22454
22457
|
return renderContractReport(
|
|
22455
|
-
|
|
22458
|
+
result3,
|
|
22456
22459
|
{ grouping: "groups", presentation },
|
|
22457
22460
|
bundle,
|
|
22458
22461
|
verified,
|
|
@@ -22579,7 +22582,7 @@ ${key}`);
|
|
|
22579
22582
|
}
|
|
22580
22583
|
}
|
|
22581
22584
|
function renderComposed(model, host, services) {
|
|
22582
|
-
const
|
|
22585
|
+
const result3 = model.result;
|
|
22583
22586
|
const section = element5("section");
|
|
22584
22587
|
section.dataset.section = "composition";
|
|
22585
22588
|
section.dataset.module = BUILTIN_MANIFEST_COMPOSED.id;
|
|
@@ -22587,11 +22590,11 @@ ${key}`);
|
|
|
22587
22590
|
style.textContent = COMPOSED_CSS;
|
|
22588
22591
|
section.append(style);
|
|
22589
22592
|
section.append(element5("h2", "Composition"));
|
|
22590
|
-
const status2 = element5("p", `composed/v1 check: ${
|
|
22591
|
-
status2.dataset.compositionStatus =
|
|
22593
|
+
const status2 = element5("p", `composed/v1 check: ${result3.status}`);
|
|
22594
|
+
status2.dataset.compositionStatus = result3.status;
|
|
22592
22595
|
section.append(status2);
|
|
22593
|
-
if (
|
|
22594
|
-
section.append(element5("p", `findings: ${
|
|
22596
|
+
if (result3.findings.length > 0)
|
|
22597
|
+
section.append(element5("p", `findings: ${result3.findings.join(", ")}`));
|
|
22595
22598
|
section.append(
|
|
22596
22599
|
element5(
|
|
22597
22600
|
"p",
|
|
@@ -22600,15 +22603,15 @@ ${key}`);
|
|
|
22600
22603
|
);
|
|
22601
22604
|
section.append(element5("h3", "Composed digest"));
|
|
22602
22605
|
const digest = element5("dl");
|
|
22603
|
-
digest.dataset.composedDigest =
|
|
22604
|
-
digest.dataset.matches = String(
|
|
22606
|
+
digest.dataset.composedDigest = result3.composedDigest.declared;
|
|
22607
|
+
digest.dataset.matches = String(result3.composedDigest.matches);
|
|
22605
22608
|
digest.append(
|
|
22606
22609
|
element5("dt", "declared"),
|
|
22607
|
-
element5("dd",
|
|
22610
|
+
element5("dd", result3.composedDigest.declared),
|
|
22608
22611
|
element5("dt", "recomputed"),
|
|
22609
|
-
element5("dd",
|
|
22612
|
+
element5("dd", result3.composedDigest.recomputed || "uncomputable"),
|
|
22610
22613
|
element5("dt", "matches"),
|
|
22611
|
-
element5("dd",
|
|
22614
|
+
element5("dd", result3.composedDigest.matches ? "yes" : "no")
|
|
22612
22615
|
);
|
|
22613
22616
|
section.append(digest);
|
|
22614
22617
|
section.append(element5("h3", "Members"));
|
|
@@ -22627,7 +22630,7 @@ ${key}`);
|
|
|
22627
22630
|
"refusal signature",
|
|
22628
22631
|
"findings"
|
|
22629
22632
|
],
|
|
22630
|
-
|
|
22633
|
+
result3.members.map((m) => {
|
|
22631
22634
|
const tr = row([
|
|
22632
22635
|
m.id,
|
|
22633
22636
|
m.observer,
|
|
@@ -22652,7 +22655,7 @@ ${key}`);
|
|
|
22652
22655
|
table2(
|
|
22653
22656
|
"composition-observers",
|
|
22654
22657
|
["observer", "role", "custody domain"],
|
|
22655
|
-
|
|
22658
|
+
result3.observers.map((o) => {
|
|
22656
22659
|
const tr = row([o.id, o.role, o.custodyDomain]);
|
|
22657
22660
|
tr.dataset.observerId = o.id;
|
|
22658
22661
|
return tr;
|
|
@@ -22668,18 +22671,18 @@ ${key}`);
|
|
|
22668
22671
|
section.append(element5("h3", "Composition closure"));
|
|
22669
22672
|
const closure = element5(
|
|
22670
22673
|
"p",
|
|
22671
|
-
`${
|
|
22674
|
+
`${result3.compositionClosure.status}; missing: ${result3.compositionClosure.missing.length === 0 ? "none" : result3.compositionClosure.missing.join(", ")}; findings: ${findingsText(result3.compositionClosure.findings)}`
|
|
22672
22675
|
);
|
|
22673
|
-
closure.dataset.closureStatus =
|
|
22676
|
+
closure.dataset.closureStatus = result3.compositionClosure.status;
|
|
22674
22677
|
section.append(closure);
|
|
22675
22678
|
section.append(element5("h3", "Joins"));
|
|
22676
|
-
if (
|
|
22679
|
+
if (result3.joins.length === 0) section.append(element5("p", "No joins."));
|
|
22677
22680
|
else {
|
|
22678
22681
|
section.append(
|
|
22679
22682
|
table2(
|
|
22680
22683
|
"composition-joins",
|
|
22681
22684
|
["members", "basis", "declared", "derived", "result"],
|
|
22682
|
-
|
|
22685
|
+
result3.joins.map((j) => {
|
|
22683
22686
|
const tr = row([
|
|
22684
22687
|
pairText(j.members),
|
|
22685
22688
|
j.basis,
|
|
@@ -22695,7 +22698,7 @@ ${key}`);
|
|
|
22695
22698
|
})
|
|
22696
22699
|
)
|
|
22697
22700
|
);
|
|
22698
|
-
for (const j of
|
|
22701
|
+
for (const j of result3.joins) {
|
|
22699
22702
|
if (j.differences.length === 0) continue;
|
|
22700
22703
|
const details = services.details(
|
|
22701
22704
|
`Differing values: ${pairText(j.members)}`
|
|
@@ -22710,7 +22713,7 @@ ${key}`);
|
|
|
22710
22713
|
table2(
|
|
22711
22714
|
"composition-agreement",
|
|
22712
22715
|
["members", "result"],
|
|
22713
|
-
|
|
22716
|
+
result3.corroboration.map((c) => {
|
|
22714
22717
|
const tr = row([pairText(c.members), corroborationText(c)]);
|
|
22715
22718
|
tr.dataset.agreementMembers = c.members.join(",");
|
|
22716
22719
|
tr.dataset.corroboration = c.result;
|
|
@@ -22727,12 +22730,12 @@ ${key}`);
|
|
|
22727
22730
|
manifest: BUILTIN_MANIFEST_COMPOSED,
|
|
22728
22731
|
canRender: (context) => composedResult(context) !== void 0,
|
|
22729
22732
|
buildModel: (context) => {
|
|
22730
|
-
const
|
|
22731
|
-
if (
|
|
22733
|
+
const result3 = composedResult(context);
|
|
22734
|
+
if (result3 === void 0)
|
|
22732
22735
|
throw new Error(
|
|
22733
22736
|
`${BUILTIN_MANIFEST_COMPOSED.id}: buildModel called although canRender was false`
|
|
22734
22737
|
);
|
|
22735
|
-
return { result };
|
|
22738
|
+
return { result: result3 };
|
|
22736
22739
|
},
|
|
22737
22740
|
render: renderComposed
|
|
22738
22741
|
};
|
|
@@ -22985,13 +22988,13 @@ ${key}`);
|
|
|
22985
22988
|
t("record.rung.6.gap"),
|
|
22986
22989
|
t("record.rung.6.sub")
|
|
22987
22990
|
);
|
|
22988
|
-
const
|
|
22989
|
-
const passed =
|
|
22991
|
+
const receipts3 = context.strict?.witnesses?.receipts ?? [];
|
|
22992
|
+
const passed = receipts3.filter((r) => r.status === "pass").length;
|
|
22990
22993
|
add2(
|
|
22991
22994
|
7,
|
|
22992
22995
|
"witness",
|
|
22993
|
-
|
|
22994
|
-
context.strict === void 0 ? t("record.rung.7.note-unread") :
|
|
22996
|
+
receipts3.length === 0 ? context.strict === void 0 ? "NOT_CHECKED" : "NOT_PRESENT" : receipts3.some((r) => r.status === "fail") ? "FAIL" : passed === receipts3.length ? "PASS" : "NOT_CHECKED",
|
|
22997
|
+
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 }),
|
|
22995
22998
|
t("record.rung.7.sub")
|
|
22996
22999
|
);
|
|
22997
23000
|
add2(
|
|
@@ -23014,11 +23017,11 @@ ${key}`);
|
|
|
23014
23017
|
refs.length === 0 ? void 0 : t("record.rung.9.count", { n: here, of: refs.length }),
|
|
23015
23018
|
t("record.rung.9.sub")
|
|
23016
23019
|
);
|
|
23017
|
-
const
|
|
23018
|
-
const citing =
|
|
23020
|
+
const result3 = input.result;
|
|
23021
|
+
const citing = result3 === void 0 ? 0 : result3.claims.filter(
|
|
23019
23022
|
(c) => c.evidence.some((e) => e.digest === capsuleId)
|
|
23020
23023
|
).length;
|
|
23021
|
-
const isResult =
|
|
23024
|
+
const isResult = result3?.capsuleId === capsuleId;
|
|
23022
23025
|
add2(
|
|
23023
23026
|
10,
|
|
23024
23027
|
"judgment",
|
|
@@ -23304,8 +23307,8 @@ ${key}`);
|
|
|
23304
23307
|
return node;
|
|
23305
23308
|
}
|
|
23306
23309
|
var fmt5 = (n) => n.toLocaleString("en-US");
|
|
23307
|
-
function mismatchMarker(
|
|
23308
|
-
const mismatch =
|
|
23310
|
+
function mismatchMarker(result3, field, w) {
|
|
23311
|
+
const mismatch = result3.countMismatches.find(
|
|
23309
23312
|
(entry) => entry.field === field
|
|
23310
23313
|
);
|
|
23311
23314
|
if (mismatch === void 0) return void 0;
|
|
@@ -23319,18 +23322,18 @@ ${key}`);
|
|
|
23319
23322
|
marker.dataset.recomputed = String(mismatch.recomputed);
|
|
23320
23323
|
return marker;
|
|
23321
23324
|
}
|
|
23322
|
-
function renderAggregate(
|
|
23325
|
+
function renderAggregate(result3, w) {
|
|
23323
23326
|
const out = document.createDocumentFragment();
|
|
23324
|
-
const stated =
|
|
23327
|
+
const stated = result3.statedCoverage;
|
|
23325
23328
|
const requirements = new Set(
|
|
23326
|
-
|
|
23329
|
+
result3.claims.filter((claim) => !claim.later).map(
|
|
23327
23330
|
(claim) => JSON.stringify([claim.contractRef, claim.requirementRef])
|
|
23328
23331
|
)
|
|
23329
23332
|
).size;
|
|
23330
23333
|
const line = el11("p", "agg-line");
|
|
23331
23334
|
const marked = (text2, field) => {
|
|
23332
23335
|
line.append(text2);
|
|
23333
|
-
const marker = mismatchMarker(
|
|
23336
|
+
const marker = mismatchMarker(result3, field, w);
|
|
23334
23337
|
if (marker !== void 0) line.append(" ", marker);
|
|
23335
23338
|
};
|
|
23336
23339
|
marked(
|
|
@@ -23358,7 +23361,7 @@ ${key}`);
|
|
|
23358
23361
|
"unknown_count"
|
|
23359
23362
|
);
|
|
23360
23363
|
const later = stated.notYetInForce;
|
|
23361
|
-
if (later !== void 0 ||
|
|
23364
|
+
if (later !== void 0 || result3.countMismatches.some((m) => m.field === "not_yet_in_force")) {
|
|
23362
23365
|
line.append(" \xB7 ");
|
|
23363
23366
|
marked(
|
|
23364
23367
|
w.p("front.agg.later", later ?? 0, { n: fmt5(later ?? 0) }),
|
|
@@ -23374,10 +23377,10 @@ ${key}`);
|
|
|
23374
23377
|
const buckets = el11("div", "agg-buckets");
|
|
23375
23378
|
const of = w.t("front.agg.of", { n: fmt5(stated.evaluatedPopulation) });
|
|
23376
23379
|
const entries = [
|
|
23377
|
-
["met",
|
|
23378
|
-
["not_met",
|
|
23379
|
-
["not_evaluable",
|
|
23380
|
-
["out_of_scope",
|
|
23380
|
+
["met", result3.buckets.met, "buckets.met"],
|
|
23381
|
+
["not_met", result3.buckets.notMet, "buckets.not_met"],
|
|
23382
|
+
["not_evaluable", result3.buckets.notEvaluable, "buckets.not_evaluable"],
|
|
23383
|
+
["out_of_scope", result3.buckets.outOfScope, "buckets.out_of_scope"]
|
|
23381
23384
|
];
|
|
23382
23385
|
for (const [verdict2, ids, field] of entries) {
|
|
23383
23386
|
if (ids === void 0) continue;
|
|
@@ -23393,17 +23396,17 @@ ${key}`);
|
|
|
23393
23396
|
el11("span", "agg-of", of)
|
|
23394
23397
|
);
|
|
23395
23398
|
box.append(caption);
|
|
23396
|
-
const marker = mismatchMarker(
|
|
23399
|
+
const marker = mismatchMarker(result3, field, w);
|
|
23397
23400
|
if (marker !== void 0) box.append(marker);
|
|
23398
23401
|
buckets.append(box);
|
|
23399
23402
|
}
|
|
23400
23403
|
out.append(buckets);
|
|
23401
|
-
const dated =
|
|
23402
|
-
const switched =
|
|
23404
|
+
const dated = result3.claims.some((claim) => claim.appliesFrom !== void 0);
|
|
23405
|
+
const switched = result3.buckets.outOfScope !== void 0;
|
|
23403
23406
|
if (dated || switched) {
|
|
23404
23407
|
const copied = el11("p", "agg-note");
|
|
23405
23408
|
if (dated) {
|
|
23406
|
-
const date = utcDateOf(
|
|
23409
|
+
const date = utcDateOf(result3.generatedAt) ?? result3.generatedAt;
|
|
23407
23410
|
copied.append(w.t("front.agg.as-of", { date }), " ");
|
|
23408
23411
|
copied.dataset.asOf = date;
|
|
23409
23412
|
}
|
|
@@ -23419,9 +23422,9 @@ ${key}`);
|
|
|
23419
23422
|
}
|
|
23420
23423
|
var shortDigest = (digest) => digest.length > 12 ? `${digest.slice(0, 4)}\u2026${digest.slice(-4)}` : digest;
|
|
23421
23424
|
function renderCoreIdentity(model) {
|
|
23422
|
-
const { result, words: w } = model;
|
|
23425
|
+
const { result: result3, words: w } = model;
|
|
23423
23426
|
const refs = [
|
|
23424
|
-
...new Set(
|
|
23427
|
+
...new Set(result3.claims.filter((c) => !c.later).map((c) => c.contractRef))
|
|
23425
23428
|
];
|
|
23426
23429
|
const kicker = [w.t("front.core.label")];
|
|
23427
23430
|
if (refs.length === 1) {
|
|
@@ -23434,11 +23437,11 @@ ${key}`);
|
|
|
23434
23437
|
);
|
|
23435
23438
|
} else if (refs.length > 1)
|
|
23436
23439
|
kicker.push(w.t("front.core.packs", { n: fmt5(refs.length) }));
|
|
23437
|
-
const generated = utcDateOf(
|
|
23440
|
+
const generated = utcDateOf(result3.generatedAt) === void 0 ? void 0 : result3.generatedAt;
|
|
23438
23441
|
if (generated !== void 0)
|
|
23439
23442
|
kicker.push(w.t("front.core.generated", { time: generated }));
|
|
23440
23443
|
const facts = [
|
|
23441
|
-
w.t("front.core.result", { digest: shortDigest(
|
|
23444
|
+
w.t("front.core.result", { digest: shortDigest(result3.capsuleId) })
|
|
23442
23445
|
];
|
|
23443
23446
|
if (model.pins.length === 1)
|
|
23444
23447
|
facts.push(w.t("front.core.pin", { digest: shortDigest(model.pins[0]) }));
|
|
@@ -23459,10 +23462,10 @@ ${key}`);
|
|
|
23459
23462
|
block.append(top, rest);
|
|
23460
23463
|
return block;
|
|
23461
23464
|
}
|
|
23462
|
-
async function coreStripModel(
|
|
23463
|
-
const tally = await tallyJudges(
|
|
23465
|
+
async function coreStripModel(result3, words) {
|
|
23466
|
+
const tally = await tallyJudges(result3.records, result3.claims);
|
|
23464
23467
|
return {
|
|
23465
|
-
result,
|
|
23468
|
+
result: result3,
|
|
23466
23469
|
words,
|
|
23467
23470
|
mock: judgedByMock(tally),
|
|
23468
23471
|
pins: tally.pins.map((pin) => pin.digest)
|
|
@@ -24296,14 +24299,14 @@ ${pad.repeat(depth)}`;
|
|
|
24296
24299
|
});
|
|
24297
24300
|
host.append(list2);
|
|
24298
24301
|
}
|
|
24299
|
-
function renderReceipts(host,
|
|
24302
|
+
function renderReceipts(host, receipts3) {
|
|
24300
24303
|
host.append(element6("h4", "Receipts"));
|
|
24301
|
-
if (
|
|
24304
|
+
if (receipts3.length === 0) {
|
|
24302
24305
|
host.append(element6("p", "no receipts disclosed"));
|
|
24303
24306
|
return;
|
|
24304
24307
|
}
|
|
24305
24308
|
const list2 = element6("ul");
|
|
24306
|
-
|
|
24309
|
+
receipts3.forEach((receipt) => {
|
|
24307
24310
|
const item = element6(
|
|
24308
24311
|
"li",
|
|
24309
24312
|
`${receipt.witness} \xB7 ${RECEIPT_GRADE_DISPLAY[receipt.grade]} \xB7 `
|
|
@@ -24431,9 +24434,9 @@ ${pad.repeat(depth)}`;
|
|
|
24431
24434
|
details.append(list2);
|
|
24432
24435
|
return details;
|
|
24433
24436
|
}
|
|
24434
|
-
async function recordEntries(context,
|
|
24437
|
+
async function recordEntries(context, result3) {
|
|
24435
24438
|
const read = /* @__PURE__ */ new Map();
|
|
24436
|
-
for (const record of
|
|
24439
|
+
for (const record of result3?.records.values() ?? []) {
|
|
24437
24440
|
const id = record.bookRecordId ?? record.capsuleId;
|
|
24438
24441
|
if (!read.has(id)) read.set(id, record);
|
|
24439
24442
|
}
|
|
@@ -24678,13 +24681,13 @@ ${pad.repeat(depth)}`;
|
|
|
24678
24681
|
const recordPageStyle = element6("style");
|
|
24679
24682
|
recordPageStyle.textContent = RECORD_PAGE_CSS;
|
|
24680
24683
|
page.append(recordPageStyle);
|
|
24681
|
-
let
|
|
24684
|
+
let result3;
|
|
24682
24685
|
try {
|
|
24683
|
-
|
|
24686
|
+
result3 = bundleVerified(verified) ? await resultRootOf(context) : void 0;
|
|
24684
24687
|
} catch {
|
|
24685
|
-
|
|
24688
|
+
result3 = void 0;
|
|
24686
24689
|
}
|
|
24687
|
-
const read = bundleVerified(verified) ? await recordEntries(context,
|
|
24690
|
+
const read = bundleVerified(verified) ? await recordEntries(context, result3) : /* @__PURE__ */ new Map();
|
|
24688
24691
|
const rawRecords = /* @__PURE__ */ new Map();
|
|
24689
24692
|
for (const raw of Array.isArray(object13(bundle).records) ? object13(bundle).records : [])
|
|
24690
24693
|
if (typeof object13(raw).capsule_id === "string")
|
|
@@ -24703,7 +24706,7 @@ ${pad.repeat(depth)}`;
|
|
|
24703
24706
|
if (l3 !== void 0 && context.recordIndex.has(id))
|
|
24704
24707
|
body.append(
|
|
24705
24708
|
renderRecordPage(
|
|
24706
|
-
{ context, capsuleId: id, stamps, result, voice: l3.voice },
|
|
24709
|
+
{ context, capsuleId: id, stamps, result: result3, voice: l3.voice },
|
|
24707
24710
|
l3.words
|
|
24708
24711
|
)
|
|
24709
24712
|
);
|
|
@@ -25072,8 +25075,8 @@ ${pad.repeat(depth)}`;
|
|
|
25072
25075
|
return list2;
|
|
25073
25076
|
}
|
|
25074
25077
|
var CLAIM_TYPE_LABEL = (claim) => claim.recognized ? claim.type : `unrecognized (${claim.type})`;
|
|
25075
|
-
function countMismatchMarker(
|
|
25076
|
-
const mismatch =
|
|
25078
|
+
function countMismatchMarker(result3, field) {
|
|
25079
|
+
const mismatch = result3.countMismatches.find(
|
|
25077
25080
|
(entry) => entry.field === field
|
|
25078
25081
|
);
|
|
25079
25082
|
if (mismatch === void 0) return void 0;
|
|
@@ -25107,7 +25110,7 @@ ${pad.repeat(depth)}`;
|
|
|
25107
25110
|
parent2.append(cell2);
|
|
25108
25111
|
return cell2;
|
|
25109
25112
|
}
|
|
25110
|
-
function renderClose(close,
|
|
25113
|
+
function renderClose(close, result3, host) {
|
|
25111
25114
|
host.append(element6("h4", "Close"));
|
|
25112
25115
|
const details = element6("dl");
|
|
25113
25116
|
if (close.period !== void 0)
|
|
@@ -25138,10 +25141,10 @@ ${pad.repeat(depth)}`;
|
|
|
25138
25141
|
}
|
|
25139
25142
|
host.append(details);
|
|
25140
25143
|
host.append(element6("h5", "Cited Close"));
|
|
25141
|
-
renderCitationList([close.closeRef],
|
|
25144
|
+
renderCitationList([close.closeRef], result3.records, host);
|
|
25142
25145
|
if (close.peerCloseRef !== void 0) {
|
|
25143
25146
|
host.append(element6("h5", "Peer record"));
|
|
25144
|
-
renderCitationList([close.peerCloseRef],
|
|
25147
|
+
renderCitationList([close.peerCloseRef], result3.records, host);
|
|
25145
25148
|
}
|
|
25146
25149
|
if (close.links.length > 0) {
|
|
25147
25150
|
host.append(element6("h5", "Links to the cited Close"));
|
|
@@ -25203,7 +25206,7 @@ ${pad.repeat(depth)}`;
|
|
|
25203
25206
|
parent2.append(cell2);
|
|
25204
25207
|
return cell2;
|
|
25205
25208
|
}
|
|
25206
|
-
function renderClaim(claim,
|
|
25209
|
+
function renderClaim(claim, result3, host) {
|
|
25207
25210
|
host.replaceChildren();
|
|
25208
25211
|
host.append(element6("h3", `Claim ${claim.id}`));
|
|
25209
25212
|
const details = element6("dl");
|
|
@@ -25229,7 +25232,7 @@ ${pad.repeat(depth)}`;
|
|
|
25229
25232
|
note.dataset.claimFailed = claim.failedOn ?? "close_state";
|
|
25230
25233
|
host.append(note);
|
|
25231
25234
|
}
|
|
25232
|
-
if (claim.close !== void 0) renderClose(claim.close,
|
|
25235
|
+
if (claim.close !== void 0) renderClose(claim.close, result3, host);
|
|
25233
25236
|
if (claim.support === "unsupported") {
|
|
25234
25237
|
const note = element6(
|
|
25235
25238
|
"p",
|
|
@@ -25251,7 +25254,7 @@ ${pad.repeat(depth)}`;
|
|
|
25251
25254
|
host.append(element6("h5", "Carrier evidence"));
|
|
25252
25255
|
const list2 = renderCitationList(
|
|
25253
25256
|
claim.presentation.evidence,
|
|
25254
|
-
|
|
25257
|
+
result3.records,
|
|
25255
25258
|
host
|
|
25256
25259
|
);
|
|
25257
25260
|
list2.dataset.carrierEvidence = String(claim.presentation.evidence.length);
|
|
@@ -25269,13 +25272,13 @@ ${pad.repeat(depth)}`;
|
|
|
25269
25272
|
}
|
|
25270
25273
|
host.append(element6("h4", "Evidence"));
|
|
25271
25274
|
for (const ref of claim.evidence) {
|
|
25272
|
-
const record =
|
|
25275
|
+
const record = result3.records.get(ref.digest);
|
|
25273
25276
|
if (record === void 0) {
|
|
25274
25277
|
const missing = element6("p", `${ref.digest} \xB7 not in this bundle`);
|
|
25275
25278
|
missing.dataset.evidence = "missing";
|
|
25276
25279
|
host.append(missing);
|
|
25277
25280
|
} else {
|
|
25278
|
-
renderCitedRecord(record,
|
|
25281
|
+
renderCitedRecord(record, result3.records, host);
|
|
25279
25282
|
}
|
|
25280
25283
|
}
|
|
25281
25284
|
}
|
|
@@ -25288,23 +25291,23 @@ ${pad.repeat(depth)}`;
|
|
|
25288
25291
|
];
|
|
25289
25292
|
var RESULT_COUNT_MARKS = `[${CORE_STRIP_ATTRIBUTE}], .cv-strip, [data-bucket], [data-bucket-count], [data-count-mismatch]`;
|
|
25290
25293
|
var CARD_UNFIT_NOTE = "This Result's claims don't fit the report layout, so every claim is listed below instead.";
|
|
25291
|
-
function renderResultPage(
|
|
25294
|
+
function renderResultPage(result3, root) {
|
|
25292
25295
|
const section = element6("section");
|
|
25293
25296
|
section.dataset.page = "result";
|
|
25294
25297
|
section.append(element6("h1", "Evidence result"));
|
|
25295
|
-
const later =
|
|
25296
|
-
const byId = new Map(
|
|
25298
|
+
const later = result3.claims.filter((claim) => claim.later);
|
|
25299
|
+
const byId = new Map(result3.claims.map((claim) => [claim.id, claim]));
|
|
25297
25300
|
const buckets = element6("section");
|
|
25298
25301
|
buckets.dataset.buckets = "verdict";
|
|
25299
25302
|
buckets.append(element6("h2", "Claims by verdict"));
|
|
25300
25303
|
for (const [key, label, field] of BUCKETS) {
|
|
25301
|
-
const ids =
|
|
25304
|
+
const ids = result3.buckets[key];
|
|
25302
25305
|
if (ids === void 0) continue;
|
|
25303
|
-
const count2 =
|
|
25306
|
+
const count2 = result3.bucketCounts[key] ?? 0;
|
|
25304
25307
|
const heading = element6("h3", `${label}: ${count2 === 0 ? "none" : count2}`);
|
|
25305
25308
|
heading.dataset.bucketCount = String(count2);
|
|
25306
25309
|
heading.dataset.bucketOf = key;
|
|
25307
|
-
const marker = countMismatchMarker(
|
|
25310
|
+
const marker = countMismatchMarker(result3, field);
|
|
25308
25311
|
if (marker !== void 0) heading.append(" ", marker);
|
|
25309
25312
|
buckets.append(heading);
|
|
25310
25313
|
if (ids.length === 0) {
|
|
@@ -25329,12 +25332,12 @@ ${pad.repeat(depth)}`;
|
|
|
25329
25332
|
}
|
|
25330
25333
|
const failedHeading = element6(
|
|
25331
25334
|
"h3",
|
|
25332
|
-
`failed: ${
|
|
25335
|
+
`failed: ${result3.bucketCounts.failed === 0 ? "none" : result3.bucketCounts.failed}`
|
|
25333
25336
|
);
|
|
25334
|
-
failedHeading.dataset.bucketCount = String(
|
|
25337
|
+
failedHeading.dataset.bucketCount = String(result3.bucketCounts.failed);
|
|
25335
25338
|
failedHeading.dataset.bucketOf = "failed";
|
|
25336
25339
|
buckets.append(failedHeading);
|
|
25337
|
-
const failedIds =
|
|
25340
|
+
const failedIds = result3.claims.filter((claim) => claim.failed).map((claim) => claim.id);
|
|
25338
25341
|
if (failedIds.length === 0) buckets.append(element6("p", "none"));
|
|
25339
25342
|
else {
|
|
25340
25343
|
const list2 = element6("ul");
|
|
@@ -25371,7 +25374,7 @@ ${pad.repeat(depth)}`;
|
|
|
25371
25374
|
const table3 = document.createElement("table");
|
|
25372
25375
|
table3.dataset.claims = "rows";
|
|
25373
25376
|
const detail = element6("section");
|
|
25374
|
-
for (const claim of
|
|
25377
|
+
for (const claim of result3.claims) {
|
|
25375
25378
|
const tr = document.createElement("tr");
|
|
25376
25379
|
tr.dataset.claimRow = claim.id;
|
|
25377
25380
|
tr.dataset.support = claim.support;
|
|
@@ -25384,7 +25387,7 @@ ${pad.repeat(depth)}`;
|
|
|
25384
25387
|
const button = element6("button", claim.id);
|
|
25385
25388
|
button.setAttribute("type", "button");
|
|
25386
25389
|
button.dataset.claimId = claim.id;
|
|
25387
|
-
button.addEventListener("click", () => renderClaim(claim,
|
|
25390
|
+
button.addEventListener("click", () => renderClaim(claim, result3, detail));
|
|
25388
25391
|
idCell.append(button);
|
|
25389
25392
|
tr.append(idCell, element6("td", claim.requirementRef));
|
|
25390
25393
|
appendSufficiency(tr, claim);
|
|
@@ -25406,7 +25409,7 @@ ${pad.repeat(depth)}`;
|
|
|
25406
25409
|
section.append(
|
|
25407
25410
|
table3,
|
|
25408
25411
|
detail,
|
|
25409
|
-
renderProvenance2(
|
|
25412
|
+
renderProvenance2(result3.capsuleId, result3.logCoordinates, result3)
|
|
25410
25413
|
);
|
|
25411
25414
|
root.append(section);
|
|
25412
25415
|
}
|
|
@@ -25541,15 +25544,15 @@ ${pad.repeat(depth)}`;
|
|
|
25541
25544
|
if (presentation !== void 0) return { grouping: "groups", presentation };
|
|
25542
25545
|
return void 0;
|
|
25543
25546
|
}
|
|
25544
|
-
function claimsFitCard(
|
|
25545
|
-
if (new Set(
|
|
25547
|
+
function claimsFitCard(result3, grouping) {
|
|
25548
|
+
if (new Set(result3.claims.map((c) => c.contractRef)).size > 1) return false;
|
|
25546
25549
|
const placed = grouping === "lines" ? new Set(
|
|
25547
|
-
readOutcomeReportTerms(
|
|
25550
|
+
readOutcomeReportTerms(result3).checks.flatMap(
|
|
25548
25551
|
(check) => check.criteria.map((criterion2) => `${check.id}.${criterion2.id}`)
|
|
25549
25552
|
)
|
|
25550
25553
|
) : void 0;
|
|
25551
25554
|
const seen = /* @__PURE__ */ new Set();
|
|
25552
|
-
for (const claim of
|
|
25555
|
+
for (const claim of result3.claims) {
|
|
25553
25556
|
if (claim.type !== REQUIREMENT_CLAIM) return false;
|
|
25554
25557
|
const sep = claim.id.indexOf("::");
|
|
25555
25558
|
if (sep <= 0) return false;
|
|
@@ -25569,16 +25572,16 @@ ${pad.repeat(depth)}`;
|
|
|
25569
25572
|
manifest: CONTRACT_REPORT_MANIFEST,
|
|
25570
25573
|
canRender: (context) => isResultRoot(context),
|
|
25571
25574
|
buildModel: async (context) => {
|
|
25572
|
-
const
|
|
25575
|
+
const result3 = defined(
|
|
25573
25576
|
await resultRootOf(context),
|
|
25574
25577
|
CONTRACT_REPORT_MANIFEST.id
|
|
25575
25578
|
);
|
|
25576
25579
|
const supported = contractReportInput(context.bundle);
|
|
25577
|
-
const input = supported !== void 0 && claimsFitCard(
|
|
25580
|
+
const input = supported !== void 0 && claimsFitCard(result3, supported.grouping) ? supported : void 0;
|
|
25578
25581
|
if (typeof context.bundle === "object" && context.bundle !== null)
|
|
25579
25582
|
contractReportDrawn.set(context.bundle, input ?? null);
|
|
25580
25583
|
return {
|
|
25581
|
-
result,
|
|
25584
|
+
result: result3,
|
|
25582
25585
|
...input === void 0 ? {} : { input },
|
|
25583
25586
|
...supported !== void 0 && input === void 0 ? { unfit: true } : {},
|
|
25584
25587
|
bundle: context.bundle,
|
|
@@ -25721,11 +25724,11 @@ ${pad.repeat(depth)}`;
|
|
|
25721
25724
|
}
|
|
25722
25725
|
return out;
|
|
25723
25726
|
}
|
|
25724
|
-
async function drawCharts(context,
|
|
25727
|
+
async function drawCharts(context, result3, charts, digests, words) {
|
|
25725
25728
|
let dataset;
|
|
25726
25729
|
let invalid2;
|
|
25727
25730
|
try {
|
|
25728
|
-
dataset =
|
|
25731
|
+
dataset = result3 === void 0 ? void 0 : await chartDatasetOf(context, result3);
|
|
25729
25732
|
} catch (err) {
|
|
25730
25733
|
if (!(err instanceof ChartRefusal)) throw err;
|
|
25731
25734
|
invalid2 = err;
|
|
@@ -26082,16 +26085,16 @@ ${pad.repeat(depth)}`;
|
|
|
26082
26085
|
const contract = await pageContract(options.contract);
|
|
26083
26086
|
const charted = options.charts !== void 0 && options.charts.length > 0;
|
|
26084
26087
|
if (verified) {
|
|
26085
|
-
const
|
|
26088
|
+
const result3 = await resultRootOf(context);
|
|
26086
26089
|
const grouping = contractReportGroupingOf(bundle) ?? "lines";
|
|
26087
|
-
const words =
|
|
26088
|
-
singleContract:
|
|
26090
|
+
const words = result3 === void 0 && !charted ? void 0 : await contractReportWords(grouping, options.wording, {
|
|
26091
|
+
singleContract: result3 !== void 0 && citesOneContract(result3)
|
|
26089
26092
|
});
|
|
26090
|
-
if (
|
|
26093
|
+
if (result3 !== void 0) strip = await coreStripModel(result3, words);
|
|
26091
26094
|
if (charted)
|
|
26092
26095
|
chartsNode = await drawCharts(
|
|
26093
26096
|
context,
|
|
26094
|
-
|
|
26097
|
+
result3,
|
|
26095
26098
|
options.charts,
|
|
26096
26099
|
chartDigests,
|
|
26097
26100
|
words
|
|
@@ -26506,7 +26509,7 @@ ${pad.repeat(depth)}`;
|
|
|
26506
26509
|
out[i] = Number.parseInt(hex5.slice(2 * i, 2 * i + 2), 16);
|
|
26507
26510
|
return out;
|
|
26508
26511
|
};
|
|
26509
|
-
async function readerAnchorWitness(anchor, checkpoint,
|
|
26512
|
+
async function readerAnchorWitness(anchor, checkpoint, receipts3) {
|
|
26510
26513
|
let same3 = "not_carried";
|
|
26511
26514
|
if (checkpoint !== null) {
|
|
26512
26515
|
try {
|
|
@@ -26522,17 +26525,17 @@ ${pad.repeat(depth)}`;
|
|
|
26522
26525
|
same3 = "unchecked";
|
|
26523
26526
|
}
|
|
26524
26527
|
}
|
|
26525
|
-
if (
|
|
26528
|
+
if (receipts3 === null || receipts3.length === 0 || same3 === "mismatch") {
|
|
26526
26529
|
return {
|
|
26527
26530
|
checkpoint: same3,
|
|
26528
|
-
status:
|
|
26531
|
+
status: receipts3 === null ? "NOT_PRESENT" : "NOT_CHECKED",
|
|
26529
26532
|
witness: null,
|
|
26530
26533
|
witnessed_time: null
|
|
26531
26534
|
};
|
|
26532
26535
|
}
|
|
26533
26536
|
const report = await checkAnchorWitnessed(
|
|
26534
26537
|
anchor,
|
|
26535
|
-
|
|
26538
|
+
receipts3.map(fromHex2),
|
|
26536
26539
|
readerWitnessPolicy()
|
|
26537
26540
|
);
|
|
26538
26541
|
return {
|
|
@@ -26542,6 +26545,296 @@ ${pad.repeat(depth)}`;
|
|
|
26542
26545
|
witnessed_time: report.witnessed_time
|
|
26543
26546
|
};
|
|
26544
26547
|
}
|
|
26548
|
+
|
|
26549
|
+
// src/payment-preimage.ts
|
|
26550
|
+
var PREIMAGE = /^[0-9a-fA-F]{64}$/u;
|
|
26551
|
+
var object14 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26552
|
+
async function paymentPreimageCheck(paymentRef, preimage) {
|
|
26553
|
+
if (object14(paymentRef) && paymentRef.type !== "ln.payment_hash")
|
|
26554
|
+
return "NOT_CHECKED";
|
|
26555
|
+
if (typeof preimage !== "string") return "NOT_PRESENT";
|
|
26556
|
+
const hash2 = object14(paymentRef) ? paymentRef.value : void 0;
|
|
26557
|
+
if (typeof hash2 !== "string" || hash2 === "") return "NOT_PRESENT";
|
|
26558
|
+
if (!PREIMAGE.test(preimage)) return "FAIL";
|
|
26559
|
+
const octets = new Uint8Array(new ArrayBuffer(32));
|
|
26560
|
+
for (let i = 0; i < 32; i += 1)
|
|
26561
|
+
octets[i] = Number.parseInt(preimage.slice(2 * i, 2 * i + 2), 16);
|
|
26562
|
+
let digest;
|
|
26563
|
+
try {
|
|
26564
|
+
digest = await globalThis.crypto.subtle.digest("SHA-256", octets);
|
|
26565
|
+
} catch {
|
|
26566
|
+
return "NOT_CHECKED";
|
|
26567
|
+
}
|
|
26568
|
+
const hex5 = Array.from(
|
|
26569
|
+
new Uint8Array(digest),
|
|
26570
|
+
(b) => b.toString(16).padStart(2, "0")
|
|
26571
|
+
).join("");
|
|
26572
|
+
return hex5 === hash2.toLowerCase() ? "PASS" : "FAIL";
|
|
26573
|
+
}
|
|
26574
|
+
|
|
26575
|
+
// src/cadence-witness.ts
|
|
26576
|
+
init_browser();
|
|
26577
|
+
var CADENCE_EXTENSIONS = [
|
|
26578
|
+
"x-cadence-witness/v0",
|
|
26579
|
+
"cadence-witness/v0",
|
|
26580
|
+
"x-deal-cadence-v0"
|
|
26581
|
+
];
|
|
26582
|
+
var CADENCE_DEPTH = 16;
|
|
26583
|
+
var object15 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26584
|
+
var result = (status2, finding = null, witness = null, witnessed_time = null) => ({ status: status2, finding, witness, witnessed_time });
|
|
26585
|
+
var fromHex3 = (value) => {
|
|
26586
|
+
if (typeof value !== "string" || !/^(?:[0-9a-fA-F]{2})*$/u.test(value))
|
|
26587
|
+
return void 0;
|
|
26588
|
+
const out = new Uint8Array(new ArrayBuffer(value.length / 2));
|
|
26589
|
+
for (let i = 0; i < out.length; i += 1)
|
|
26590
|
+
out[i] = Number.parseInt(value.slice(2 * i, 2 * i + 2), 16);
|
|
26591
|
+
return out;
|
|
26592
|
+
};
|
|
26593
|
+
var toHex4 = (bytes) => Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
26594
|
+
var hashList = (value) => {
|
|
26595
|
+
if (!Array.isArray(value)) return void 0;
|
|
26596
|
+
const out = value.map(fromHex3);
|
|
26597
|
+
return out.every((h) => h !== void 0) ? out : void 0;
|
|
26598
|
+
};
|
|
26599
|
+
var fromBase64Url = (value) => {
|
|
26600
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9_-]*$/u.test(value))
|
|
26601
|
+
return void 0;
|
|
26602
|
+
try {
|
|
26603
|
+
const binary = atob(value.replace(/-/gu, "+").replace(/_/gu, "/"));
|
|
26604
|
+
return Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
26605
|
+
} catch {
|
|
26606
|
+
return void 0;
|
|
26607
|
+
}
|
|
26608
|
+
};
|
|
26609
|
+
var uint = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
|
|
26610
|
+
var sha2564 = async (...parts) => {
|
|
26611
|
+
const joined = new Uint8Array(
|
|
26612
|
+
new ArrayBuffer(parts.reduce((n, p) => n + p.length, 0))
|
|
26613
|
+
);
|
|
26614
|
+
let at = 0;
|
|
26615
|
+
for (const p of parts) {
|
|
26616
|
+
joined.set(p, at);
|
|
26617
|
+
at += p.length;
|
|
26618
|
+
}
|
|
26619
|
+
return new Uint8Array(
|
|
26620
|
+
await globalThis.crypto.subtle.digest("SHA-256", joined)
|
|
26621
|
+
);
|
|
26622
|
+
};
|
|
26623
|
+
var cadenceLeaf = async (logId, size, checkpointSha256, salt) => sha2564(
|
|
26624
|
+
Uint8Array.of(0),
|
|
26625
|
+
jcs({ checkpoint_sha256: checkpointSha256, log_id: logId, salt, size })
|
|
26626
|
+
);
|
|
26627
|
+
var cadenceRoot = async (leaf, index, path2) => {
|
|
26628
|
+
let h = leaf;
|
|
26629
|
+
for (let level = 0; level < path2.length; level += 1)
|
|
26630
|
+
h = Math.floor(index / 2 ** level) % 2 === 0 ? await sha2564(Uint8Array.of(1), h, path2[level]) : await sha2564(Uint8Array.of(1), path2[level], h);
|
|
26631
|
+
return h;
|
|
26632
|
+
};
|
|
26633
|
+
var included = async (root, size, leafIndex, identity2, raw) => {
|
|
26634
|
+
if (!object15(raw) || raw.v !== 1 || raw.kind !== "inclusion") return false;
|
|
26635
|
+
const proofSize = uint(raw.size), proofIndex = uint(raw.leaf_index), witness = hashList(raw.witness), left = hashList(raw.peaks_left), right = hashList(raw.peaks_right);
|
|
26636
|
+
if (proofSize === void 0 || BigInt(proofSize) !== size || proofIndex !== leafIndex || !witness || !left || !right)
|
|
26637
|
+
return false;
|
|
26638
|
+
const flattened = [...witness];
|
|
26639
|
+
if (right.length) flattened.push(await rootFromPeaks2(right));
|
|
26640
|
+
flattened.push(...left.toReversed());
|
|
26641
|
+
return verifyHexInclusion2(root, size, BigInt(leafIndex), identity2, flattened);
|
|
26642
|
+
};
|
|
26643
|
+
var consistent = async (oldRoot, oldSize, newRoot, newSize, raw) => {
|
|
26644
|
+
if (!object15(raw) || raw.v !== 1 || raw.kind !== "consistency") return false;
|
|
26645
|
+
const from = uint(raw.old_size), to = uint(raw.new_size), oldPeaks = hashList(raw.old_peaks), newPeaks = hashList(raw.new_peaks), steps = Array.isArray(raw.witness) ? raw.witness.map(hashList) : void 0, a = fromHex3(oldRoot), b = fromHex3(newRoot);
|
|
26646
|
+
if (from === void 0 || to === void 0 || BigInt(from) !== oldSize || BigInt(to) !== newSize || !oldPeaks || !newPeaks || !steps || steps.some((s) => s === void 0) || !a || !b)
|
|
26647
|
+
return false;
|
|
26648
|
+
return verifyConsistency2(a, b, {
|
|
26649
|
+
oldSize,
|
|
26650
|
+
newSize,
|
|
26651
|
+
oldPeaks,
|
|
26652
|
+
witness: steps,
|
|
26653
|
+
newPeaks
|
|
26654
|
+
});
|
|
26655
|
+
};
|
|
26656
|
+
var signedOf = (cp) => ({
|
|
26657
|
+
log_id: cp.logId,
|
|
26658
|
+
mmr_size: Number(cp.size),
|
|
26659
|
+
root: cp.root,
|
|
26660
|
+
key_id: cp.keyId,
|
|
26661
|
+
timestamp: cp.timestamp,
|
|
26662
|
+
prev_size: Number(cp.previousSize),
|
|
26663
|
+
prev_root: cp.previousRoot
|
|
26664
|
+
});
|
|
26665
|
+
var chainOf = (bundle) => {
|
|
26666
|
+
const extensions2 = object15(bundle) ? bundle.extensions : void 0;
|
|
26667
|
+
if (!object15(extensions2)) return void 0;
|
|
26668
|
+
for (const name of CADENCE_EXTENSIONS)
|
|
26669
|
+
if (object15(extensions2[name])) return extensions2[name];
|
|
26670
|
+
return void 0;
|
|
26671
|
+
};
|
|
26672
|
+
async function walk(chain, dealCose) {
|
|
26673
|
+
const fail2 = (finding) => ({ status: "FAIL", finding });
|
|
26674
|
+
let dealStatement = dealCose;
|
|
26675
|
+
let deal = await checkpointMetadata(dealStatement);
|
|
26676
|
+
if (deal === void 0) return fail2("cadence_deal_checkpoint_malformed");
|
|
26677
|
+
if (chain.extent === "part") {
|
|
26678
|
+
const earlier = object15(chain.earlier) ? chain.earlier : {};
|
|
26679
|
+
const cp2 = object15(earlier.checkpoint) ? earlier.checkpoint : {};
|
|
26680
|
+
const statement = fromBase64Url(cp2.cose);
|
|
26681
|
+
if (statement === void 0)
|
|
26682
|
+
return fail2("cadence_earlier_checkpoint_malformed");
|
|
26683
|
+
const prior = await checkpointMetadata(statement);
|
|
26684
|
+
if (prior === void 0)
|
|
26685
|
+
return fail2("cadence_earlier_checkpoint_signature_invalid");
|
|
26686
|
+
if (prior.keyId !== deal.keyId || prior.logId !== deal.logId || prior.size >= deal.size)
|
|
26687
|
+
return fail2("cadence_earlier_checkpoint_not_this_deal");
|
|
26688
|
+
if (!await consistent(
|
|
26689
|
+
prior.root,
|
|
26690
|
+
prior.size,
|
|
26691
|
+
deal.root,
|
|
26692
|
+
deal.size,
|
|
26693
|
+
earlier.consistency_proof
|
|
26694
|
+
))
|
|
26695
|
+
return fail2("cadence_earlier_checkpoint_not_a_prefix");
|
|
26696
|
+
dealStatement = statement;
|
|
26697
|
+
deal = prior;
|
|
26698
|
+
}
|
|
26699
|
+
let logId = typeof chain.log_id === "string" ? chain.log_id : "";
|
|
26700
|
+
if (logId === "" && typeof chain.deal_log_id === "string")
|
|
26701
|
+
logId = chain.deal_log_id;
|
|
26702
|
+
const salt = typeof chain.salt === "string" ? chain.salt : "";
|
|
26703
|
+
const size = uint(chain.size), index = uint(chain.index);
|
|
26704
|
+
if (logId !== deal.logId || size === void 0 || BigInt(size) !== deal.size)
|
|
26705
|
+
return fail2("cadence_leaf_does_not_name_this_checkpoint");
|
|
26706
|
+
if (index === void 0 || index >= 2 ** CADENCE_DEPTH || salt === "")
|
|
26707
|
+
return fail2("cadence_leaf_malformed");
|
|
26708
|
+
const path2 = hashList(chain.path);
|
|
26709
|
+
if (!path2 || path2.length !== CADENCE_DEPTH || path2.some((h) => h.length !== 32))
|
|
26710
|
+
return fail2("cadence_path_malformed");
|
|
26711
|
+
const leaf = await cadenceLeaf(
|
|
26712
|
+
logId,
|
|
26713
|
+
size,
|
|
26714
|
+
toHex4(await sha2564(dealStatement)),
|
|
26715
|
+
salt
|
|
26716
|
+
);
|
|
26717
|
+
const root = await cadenceRoot(leaf, index, path2);
|
|
26718
|
+
const inner = object15(chain.cadence) ? chain.cadence : {};
|
|
26719
|
+
const cp = object15(inner.checkpoint) ? inner.checkpoint : {};
|
|
26720
|
+
const cose = fromBase64Url(cp.cose);
|
|
26721
|
+
if (cose === void 0) return fail2("cadence_checkpoint_malformed");
|
|
26722
|
+
const cadence = await checkpointMetadata(cose);
|
|
26723
|
+
if (cadence === void 0)
|
|
26724
|
+
return fail2("cadence_checkpoint_signature_invalid");
|
|
26725
|
+
if (cadence.keyId !== deal.keyId)
|
|
26726
|
+
return fail2("cadence_checkpoint_signer_differs");
|
|
26727
|
+
if (inner.log_id !== cadence.logId) return fail2("cadence_log_id_mismatch");
|
|
26728
|
+
const entry = uint(inner.entry_index);
|
|
26729
|
+
const cadenceRootBytes = fromHex3(cadence.root);
|
|
26730
|
+
if (entry === void 0 || !cadenceRootBytes || !await included(
|
|
26731
|
+
cadenceRootBytes,
|
|
26732
|
+
cadence.size,
|
|
26733
|
+
entry,
|
|
26734
|
+
toHex4(root),
|
|
26735
|
+
inner.inclusion_proof
|
|
26736
|
+
))
|
|
26737
|
+
return fail2("cadence_entry_not_included");
|
|
26738
|
+
return { cadence, cose, inner };
|
|
26739
|
+
}
|
|
26740
|
+
var RECORD_FIELDS2 = [
|
|
26741
|
+
"ts_url",
|
|
26742
|
+
"entry_hash",
|
|
26743
|
+
"receipt_b64",
|
|
26744
|
+
"leaf_index",
|
|
26745
|
+
"tree_size"
|
|
26746
|
+
];
|
|
26747
|
+
var isRecord2 = (entry) => {
|
|
26748
|
+
if (!object15(entry) || !RECORD_FIELDS2.every((name) => Object.hasOwn(entry, name)))
|
|
26749
|
+
return false;
|
|
26750
|
+
if (!["ts_url", "entry_hash", "receipt_b64"].every(
|
|
26751
|
+
(name) => typeof entry[name] === "string" && entry[name] !== ""
|
|
26752
|
+
))
|
|
26753
|
+
return false;
|
|
26754
|
+
try {
|
|
26755
|
+
base64Canonical(entry.receipt_b64);
|
|
26756
|
+
} catch {
|
|
26757
|
+
return false;
|
|
26758
|
+
}
|
|
26759
|
+
return true;
|
|
26760
|
+
};
|
|
26761
|
+
async function receipts2(entries, signed, cose) {
|
|
26762
|
+
if (!Array.isArray(entries) || entries.length === 0)
|
|
26763
|
+
return result("NOT_PRESENT");
|
|
26764
|
+
if (!entries.every(isRecord2)) return result("FAIL", "receipt_malformed");
|
|
26765
|
+
const keys = readerWitnessPolicy().witnesses.flatMap(
|
|
26766
|
+
({ name, keys: keys2 }) => keys2.map((key) => ({ name, key: fromHex3(key) }))
|
|
26767
|
+
);
|
|
26768
|
+
if (keys.length === 0) return result("NOT_CHECKED", "no_reader_witness");
|
|
26769
|
+
let failed2 = false;
|
|
26770
|
+
let chosen;
|
|
26771
|
+
for (const entry of entries) {
|
|
26772
|
+
if (entry.is_stub === true) continue;
|
|
26773
|
+
let passed;
|
|
26774
|
+
let unavailable = false;
|
|
26775
|
+
for (const { name, key } of keys) {
|
|
26776
|
+
const outcome = await verifyReceipt(signed, entry, key, cose);
|
|
26777
|
+
if (outcome.ok) {
|
|
26778
|
+
passed = { name, time: outcome.registrationTime };
|
|
26779
|
+
break;
|
|
26780
|
+
}
|
|
26781
|
+
if (outcome.notChecked) unavailable = true;
|
|
26782
|
+
}
|
|
26783
|
+
if (passed === void 0) {
|
|
26784
|
+
if (!unavailable) failed2 = true;
|
|
26785
|
+
continue;
|
|
26786
|
+
}
|
|
26787
|
+
if (chosen === void 0 || passed.time !== null && (chosen.time === null || passed.time < chosen.time))
|
|
26788
|
+
chosen = passed;
|
|
26789
|
+
}
|
|
26790
|
+
if (chosen !== void 0)
|
|
26791
|
+
return result("PASS", null, chosen.name, chosen.time);
|
|
26792
|
+
if (failed2) return result("FAIL", "receipt_not_verified");
|
|
26793
|
+
return result("NOT_CHECKED", "receipt_not_checked");
|
|
26794
|
+
}
|
|
26795
|
+
async function readerCadenceWitness(context) {
|
|
26796
|
+
if (!isVerifiedBundleContext(context))
|
|
26797
|
+
return result("NOT_CHECKED", "not_a_verified_context");
|
|
26798
|
+
const chain = chainOf(context.bundle);
|
|
26799
|
+
if (chain === void 0 || chain.state !== "witnessed")
|
|
26800
|
+
return result("NOT_PRESENT");
|
|
26801
|
+
if (context.strict?.checkpointAuthenticated !== true)
|
|
26802
|
+
return result("NOT_CHECKED", "checkpoint_unverified");
|
|
26803
|
+
try {
|
|
26804
|
+
const stated = context.bundle.checkpoint;
|
|
26805
|
+
const dealCose = fromBase64Url(stated.cose);
|
|
26806
|
+
if (dealCose === void 0)
|
|
26807
|
+
return result("NOT_CHECKED", "checkpoint_unverified");
|
|
26808
|
+
const walked = await walk(chain, dealCose);
|
|
26809
|
+
if (!("cadence" in walked)) return result(walked.status, walked.finding);
|
|
26810
|
+
return await receipts2(
|
|
26811
|
+
walked.inner.witnesses,
|
|
26812
|
+
signedOf(walked.cadence),
|
|
26813
|
+
walked.cose
|
|
26814
|
+
);
|
|
26815
|
+
} catch {
|
|
26816
|
+
return result("NOT_CHECKED", "check_unavailable");
|
|
26817
|
+
}
|
|
26818
|
+
}
|
|
26819
|
+
|
|
26820
|
+
// src/card-signature.ts
|
|
26821
|
+
var result2 = (status2, keyId = null) => ({ status: status2, key_id: keyId });
|
|
26822
|
+
async function readerCardSignature(context) {
|
|
26823
|
+
if (!isVerifiedBundleContext(context)) return result2("NOT_CHECKED");
|
|
26824
|
+
const record = context.strict?.records.find(
|
|
26825
|
+
(r) => r.capsuleId === context.root
|
|
26826
|
+
);
|
|
26827
|
+
if (record === void 0) return result2("NOT_CHECKED");
|
|
26828
|
+
switch (record.signature) {
|
|
26829
|
+
case "authored":
|
|
26830
|
+
return record.keyId === null ? result2("NOT_CHECKED") : result2("PASS", record.keyId);
|
|
26831
|
+
case "invalid":
|
|
26832
|
+
return result2("FAIL");
|
|
26833
|
+
case "unclaimed":
|
|
26834
|
+
return result2("NOT_PRESENT");
|
|
26835
|
+
}
|
|
26836
|
+
return result2("NOT_CHECKED");
|
|
26837
|
+
}
|
|
26545
26838
|
return __toCommonJS(browser_exports2);
|
|
26546
26839
|
})();
|
|
26547
26840
|
/*! Bundled license information:
|