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