@action-state-group/capsule-viewer 0.4.0 → 0.6.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 +1 -1
- package/dist/browser.js +4 -2
- package/dist/browser.js.map +1 -1
- package/dist/chart-dataset.js +5 -1
- package/dist/chart-dataset.js.map +1 -1
- package/dist/chart-spec.d.ts +12 -1
- package/dist/chart-spec.js +9 -1
- package/dist/chart-spec.js.map +1 -1
- package/dist/chart-view.d.ts +9 -2
- package/dist/chart-view.js +16 -1
- package/dist/chart-view.js.map +1 -1
- package/dist/contract-report-wording.js +15 -2
- package/dist/contract-report-wording.js.map +1 -1
- package/dist/emitter-shell.html +5 -0
- package/dist/evidence-graph-view.js +52 -17
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +1069 -458
- package/dist/outcome-report-view.js +29 -0
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/report-provenance.d.ts +28 -0
- package/dist/report-provenance.js +60 -11
- package/dist/report-provenance.js.map +1 -1
- package/dist/report-view-render.d.ts +13 -0
- package/dist/report-view-render.js +280 -0
- package/dist/report-view-render.js.map +1 -0
- package/dist/report-view.d.ts +29 -0
- package/dist/report-view.js +170 -0
- package/dist/report-view.js.map +1 -0
- package/dist/viewer-build.js +1 -1
- package/dist/wording/contract-report-eu-ai-act.en.json +13 -1
- package/dist/wording/contract-report-outcomes.en.json +19 -1
- package/package.json +1 -1
|
@@ -7,12 +7,15 @@ import { digestCapability, JcsFloatError, JcsUnsafeIntegerError, jsonDigest, } f
|
|
|
7
7
|
import { chartDatasetOf } from "./chart-dataset.js";
|
|
8
8
|
import { ChartRefusal, checkChart } from "./chart-spec.js";
|
|
9
9
|
import { renderChart, renderChartRefused, renderCharts } from "./chart-view.js";
|
|
10
|
+
import { checkView, isView } from "./report-view.js";
|
|
11
|
+
import { renderView } from "./report-view-render.js";
|
|
10
12
|
import { citesOneContract, renderContractReport, } from "./contract-report.js";
|
|
11
13
|
import { readOutcomeReportPresentation, } from "./outcome-report-presentation.js";
|
|
12
14
|
import { composedSectionModule } from "./composed-view.js";
|
|
13
15
|
import { DEFAULT_WORDS, contractReportWords, } from "./contract-report-wording.js";
|
|
14
16
|
import { CORE_STRIP_ATTRIBUTE, coreStripModel, renderCoreStrip, } from "./core-strip.js";
|
|
15
17
|
import { RECORD_CONTENT_CSS, renderContent } from "./record-content.js";
|
|
18
|
+
import { WITNESS_NOTICE_LINES, witnessNotice, } from "./report-provenance.js";
|
|
16
19
|
import { deferBody, recordAddress, revealRecord, revealRecordsByHash, } from "./report-levels.js";
|
|
17
20
|
import { readCompliancePresentation, } from "./compliance-presentation.js";
|
|
18
21
|
import { readPresentationBlock } from "@action-state-group/agent-action-capsule";
|
|
@@ -76,7 +79,9 @@ const recordsWord = (count) => `${count} ${count === 1 ? "record" : "records"}`;
|
|
|
76
79
|
// signature. Its line is the core's fixed text for the state; the details
|
|
77
80
|
// line under the bar names the findings. The bar also says, from the
|
|
78
81
|
// verification section, how many checks passed, and links down to it.
|
|
79
|
-
|
|
82
|
+
// `witness` is the notice drawn under the bar when no witness receipt was
|
|
83
|
+
// checked (bannerWitnessNotice): the pill alone would read as checked.
|
|
84
|
+
function renderVerificationBanner(root, model, coverage, witness) {
|
|
80
85
|
const bar = element("div");
|
|
81
86
|
// A failed bundle's bar is a callout on every page, with or without a
|
|
82
87
|
// report's frame (the shell's .cv-failed); in a report's frame an
|
|
@@ -124,6 +129,14 @@ function renderVerificationBanner(root, model, coverage) {
|
|
|
124
129
|
detail.dataset.bannerDetail = "";
|
|
125
130
|
root.append(detail);
|
|
126
131
|
}
|
|
132
|
+
if (witness !== undefined) {
|
|
133
|
+
const notice = element("p", WITNESS_NOTICE_LINES[witness]);
|
|
134
|
+
// In the warning colour, as an incomplete banner: the bundle checks,
|
|
135
|
+
// but only against its holder's own signatures.
|
|
136
|
+
notice.className = "cv-banner-detail cv-witness-notice";
|
|
137
|
+
notice.dataset.witnessNotice = witness;
|
|
138
|
+
root.append(notice);
|
|
139
|
+
}
|
|
127
140
|
if (model.refusal === undefined)
|
|
128
141
|
return bar;
|
|
129
142
|
const refusal = element("p", model.refusal);
|
|
@@ -131,6 +144,21 @@ function renderVerificationBanner(root, model, coverage) {
|
|
|
131
144
|
root.append(refusal);
|
|
132
145
|
return bar;
|
|
133
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* The witness notice a banner carries (capsule-viewer#162, from
|
|
149
|
+
* evidencebook#209): only on a verified or incomplete banner whose
|
|
150
|
+
* checkpoint signature verified, since a failed banner already says the
|
|
151
|
+
* witness check failed and with no signed checkpoint there is nothing for a
|
|
152
|
+
* witness to cover. Which notice, from AAC's strict witness status, is
|
|
153
|
+
* `witnessNotice`'s, the decision the "Witnessed by" line draws from too.
|
|
154
|
+
*/
|
|
155
|
+
function bannerWitnessNotice(model, bundle, verification) {
|
|
156
|
+
if (model.state !== "verified" && model.state !== "incomplete")
|
|
157
|
+
return undefined;
|
|
158
|
+
if (model.checkpoint !== "verified")
|
|
159
|
+
return undefined;
|
|
160
|
+
return witnessNotice(bundle, verification);
|
|
161
|
+
}
|
|
134
162
|
/**
|
|
135
163
|
* Draw the `checking` state into `root`, replacing what it held: the
|
|
136
164
|
* banner alone, with no verdict and no row, until the checks finish
|
|
@@ -1911,7 +1939,9 @@ async function drawCharts(context, result, charts, digests, words) {
|
|
|
1911
1939
|
try {
|
|
1912
1940
|
if (invalid !== undefined)
|
|
1913
1941
|
throw invalid;
|
|
1914
|
-
return
|
|
1942
|
+
return isView(spec)
|
|
1943
|
+
? renderView(checkView(spec, dataset), i, digests[i].sha256, words)
|
|
1944
|
+
: renderChart(checkChart(spec, dataset), i, digests[i].sha256, words);
|
|
1915
1945
|
}
|
|
1916
1946
|
catch (err) {
|
|
1917
1947
|
if (!(err instanceof ChartRefusal))
|
|
@@ -2430,7 +2460,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2430
2460
|
root.replaceChildren();
|
|
2431
2461
|
root.classList.remove("cv-shell-chrome");
|
|
2432
2462
|
renderPresentationHeader(root, bundle);
|
|
2433
|
-
bar = renderVerificationBanner(root, bannerModel, coverage);
|
|
2463
|
+
bar = renderVerificationBanner(root, bannerModel, coverage, bannerWitnessNotice(bannerModel, bundle, withStrict(context)));
|
|
2434
2464
|
const L2 = region("L2");
|
|
2435
2465
|
const core = region("L2-core");
|
|
2436
2466
|
const L2module = region("L2-module");
|
|
@@ -2460,10 +2490,11 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2460
2490
|
root.insertBefore(note, regions.core.parentElement);
|
|
2461
2491
|
};
|
|
2462
2492
|
drawFrame();
|
|
2463
|
-
// The banner
|
|
2464
|
-
// 6.2). A module that, while it renders, changes
|
|
2465
|
-
// attributes, hides or moves them, puts anything
|
|
2466
|
-
// core's own header, or draws a second banner, is
|
|
2493
|
+
// The banner, its details line and its witness notice are the core's
|
|
2494
|
+
// (contract sections 3 and 6.2). A module that, while it renders, changes
|
|
2495
|
+
// their words, structure or attributes, hides or moves them, puts anything
|
|
2496
|
+
// before them but the core's own header, or draws a second banner, is
|
|
2497
|
+
// discarded for the
|
|
2467
2498
|
// refusal like one that throws. The bar's summary line is empty until the
|
|
2468
2499
|
// verification section fills it, after every module has rendered. These
|
|
2469
2500
|
// checks catch a module's mistakes; they do not hold against module code
|
|
@@ -2627,12 +2658,15 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2627
2658
|
// The core strip (core-strip.ts) is held to the same rules as the
|
|
2628
2659
|
// banner: its words, structure and look are the core's, and it stays the
|
|
2629
2660
|
// first thing in L0, right after the banner.
|
|
2661
|
+
// The frame is the bar, then its details line and its witness notice
|
|
2662
|
+
// when it has them, in that order.
|
|
2630
2663
|
const frameOf = () => {
|
|
2631
|
-
const
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2664
|
+
const parts = [bar];
|
|
2665
|
+
for (const mark of ["data-banner-detail", "data-witness-notice"]) {
|
|
2666
|
+
const next = parts[parts.length - 1].nextElementSibling;
|
|
2667
|
+
if (next?.hasAttribute(mark))
|
|
2668
|
+
parts.push(next);
|
|
2669
|
+
}
|
|
2636
2670
|
const held = [...parts, ...(stripNode === undefined ? [] : [stripNode])];
|
|
2637
2671
|
return {
|
|
2638
2672
|
parts,
|
|
@@ -2663,10 +2697,11 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2663
2697
|
};
|
|
2664
2698
|
const assertFrameIntact = () => {
|
|
2665
2699
|
const at = frame;
|
|
2666
|
-
const [top,
|
|
2700
|
+
const [top, ...below] = at.parts;
|
|
2701
|
+
const last = at.parts[at.parts.length - 1];
|
|
2667
2702
|
const pill = top.querySelector("[data-verify]");
|
|
2668
|
-
const banners = root.querySelectorAll("[data-verify], [data-banner-detail]");
|
|
2669
|
-
const expected = [pill, ...
|
|
2703
|
+
const banners = root.querySelectorAll("[data-verify], [data-banner-detail], [data-witness-notice]");
|
|
2704
|
+
const expected = [pill, ...below];
|
|
2670
2705
|
if (pill === null ||
|
|
2671
2706
|
banners.length !== expected.length ||
|
|
2672
2707
|
expected.some((part, i) => banners[i] !== part) ||
|
|
@@ -2675,10 +2710,10 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2675
2710
|
root.firstChild !== (at.header ?? top) ||
|
|
2676
2711
|
top.previousSibling !== at.header ||
|
|
2677
2712
|
(at.header !== null && at.header.parentNode !== root) ||
|
|
2678
|
-
(
|
|
2713
|
+
below.some((part, i) => part.previousElementSibling !== at.parts[i]) ||
|
|
2679
2714
|
top.parentNode !== root ||
|
|
2680
2715
|
top.hidden ||
|
|
2681
|
-
!stripIntact(
|
|
2716
|
+
!stripIntact(last) ||
|
|
2682
2717
|
snapshot(at.held) !== at.words ||
|
|
2683
2718
|
!sameLook(looks(at.held, root.classList.contains("cv-shell-chrome")), root.classList.contains("cv-shell-chrome")
|
|
2684
2719
|
? at.looks.chrome
|