@action-state-group/capsule-viewer 0.7.0 → 0.8.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/compliance-styles.js +7 -0
- package/dist/compliance-styles.js.map +1 -1
- package/dist/compliance-view.d.ts +4 -3
- package/dist/compliance-view.js +139 -88
- package/dist/compliance-view.js.map +1 -1
- package/dist/contract-report-wording.d.ts +2 -1
- package/dist/contract-report-wording.js +32 -3
- package/dist/contract-report-wording.js.map +1 -1
- package/dist/contract-report.d.ts +16 -1
- package/dist/contract-report.js +31 -3
- package/dist/contract-report.js.map +1 -1
- package/dist/core-strip.d.ts +1 -1
- package/dist/core-strip.js +7 -4
- package/dist/core-strip.js.map +1 -1
- package/dist/emitter-shell.html +16 -0
- package/dist/evidence-contract.d.ts +61 -0
- package/dist/evidence-contract.js +83 -0
- package/dist/evidence-contract.js.map +1 -0
- package/dist/evidence-graph-view.d.ts +10 -0
- package/dist/evidence-graph-view.js +35 -5
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +1657 -786
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/outcome-report-styles.js +9 -0
- package/dist/outcome-report-styles.js.map +1 -1
- package/dist/outcome-report-view.d.ts +19 -4
- package/dist/outcome-report-view.js +307 -127
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/presentation-builder.d.ts +14 -0
- package/dist/presentation-builder.js +45 -1
- package/dist/presentation-builder.js.map +1 -1
- package/dist/presentation-fragment.d.ts +3 -0
- package/dist/presentation-fragment.js +9 -0
- package/dist/presentation-fragment.js.map +1 -1
- package/dist/presentation-mount.d.ts +3 -0
- package/dist/presentation-mount.js +2 -0
- package/dist/presentation-mount.js.map +1 -1
- package/dist/report-legend.d.ts +6 -7
- package/dist/report-legend.js +16 -9
- package/dist/report-legend.js.map +1 -1
- package/dist/report-levels.js +2 -1
- package/dist/report-levels.js.map +1 -1
- package/dist/spot-check.js +10 -5
- package/dist/spot-check.js.map +1 -1
- package/dist/subject-history.d.ts +77 -0
- package/dist/subject-history.js +439 -0
- package/dist/subject-history.js.map +1 -0
- package/dist/viewer-build.js +1 -1
- package/dist/wording/contract-report-eu-ai-act.en.json +16 -1
- package/dist/wording/contract-report-outcomes.en.json +61 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import type { PresentationManifest } from "./presentation-registry.js";
|
|
|
3
3
|
import { type CountersignerSource } from "@action-state-group/agent-action-capsule";
|
|
4
4
|
import { type ContractReportInput } from "./contract-report.js";
|
|
5
5
|
import type { PresentationDepth, WordingPackInput } from "./presentation-fragment.js";
|
|
6
|
+
import { type ContractInput } from "./evidence-contract.js";
|
|
6
7
|
import { type RecordVoice } from "./record-page.js";
|
|
7
8
|
import { PresentationRegistry, type PresentationFormat, type PresentationModule, type PresentationRegistration, type PresentationResolution, type PresentationResolver, type PresentationRuntime } from "./presentation-registry.js";
|
|
8
9
|
/**
|
|
@@ -117,6 +118,15 @@ export interface RenderEvidenceGraphOptions {
|
|
|
117
118
|
* use the core's own labels and do not read it.
|
|
118
119
|
*/
|
|
119
120
|
readonly wording?: WordingPackInput;
|
|
121
|
+
/**
|
|
122
|
+
* The compiled Evidence Contract the page was built with (its exact text
|
|
123
|
+
* and `contract_sha256`). The contract-report module reads each row's
|
|
124
|
+
* requirement tier from it; the verification page states its id, version
|
|
125
|
+
* and digest. Checked again here: a contract that does not check is not
|
|
126
|
+
* read, the module draws the page as it does with none, and the
|
|
127
|
+
* verification page says why.
|
|
128
|
+
*/
|
|
129
|
+
readonly contract?: ContractInput;
|
|
120
130
|
/**
|
|
121
131
|
* Chart specs (docs/design/chart-spec.md), drawn in L1 in this order. Each
|
|
122
132
|
* is checked against the dataset the Result names before it is drawn; a
|
|
@@ -13,6 +13,7 @@ import { citesOneContract, renderContractReport, } from "./contract-report.js";
|
|
|
13
13
|
import { readOutcomeReportPresentation, } from "./outcome-report-presentation.js";
|
|
14
14
|
import { composedSectionModule } from "./composed-view.js";
|
|
15
15
|
import { DEFAULT_WORDS, contractReportWords, } from "./contract-report-wording.js";
|
|
16
|
+
import { checkContractInput, ContractError, } from "./evidence-contract.js";
|
|
16
17
|
import { RECORD_PAGE_CSS, renderRecordPage, } from "./record-page.js";
|
|
17
18
|
import { CORE_STRIP_ATTRIBUTE, coreStripModel, renderCoreStrip, } from "./core-strip.js";
|
|
18
19
|
import { RECORD_CONTENT_CSS, renderContent } from "./record-content.js";
|
|
@@ -749,7 +750,7 @@ function renderCheckLists(host, lists, verifierHint) {
|
|
|
749
750
|
// `applied` is the set of extension interpreters this rendering ran; an
|
|
750
751
|
// extension row says "interpreted by" only for one of them. `refused` is
|
|
751
752
|
// every module this runtime refused that matched (page, then section).
|
|
752
|
-
async function renderVerificationPage(root, context, styled, applied, refused, citedSigners, verifierHint, depth, stamps, charts, l3) {
|
|
753
|
+
async function renderVerificationPage(root, context, styled, applied, refused, citedSigners, verifierHint, depth, stamps, charts, contract, l3) {
|
|
753
754
|
const { bundle, verification: verified } = context;
|
|
754
755
|
const section = element("section");
|
|
755
756
|
section.dataset.page = "verification";
|
|
@@ -783,6 +784,14 @@ async function renderVerificationPage(root, context, styled, applied, refused, c
|
|
|
783
784
|
charts.forEach((chart, i) => appendValue(summary, `chart spec ${i + 1} sha256`, chart.refused === undefined
|
|
784
785
|
? chart.sha256
|
|
785
786
|
: `${chart.sha256} (not drawn: ${chart.refused})`));
|
|
787
|
+
// The contract the page read requirement tiers from, by its id, version
|
|
788
|
+
// and the SHA-256 of its exact bytes (presentation-builder-v0 section 1).
|
|
789
|
+
if (contract.checked !== undefined) {
|
|
790
|
+
appendValue(summary, "contract", `${contract.checked.id}@${contract.checked.version}`);
|
|
791
|
+
appendValue(summary, "contract sha256", contract.checked.sha256);
|
|
792
|
+
}
|
|
793
|
+
else if (contract.refused !== undefined)
|
|
794
|
+
appendValue(summary, "contract sha256", `${contract.refused.sha256} (not read: ${contract.refused.reason})`);
|
|
786
795
|
page.append(summary);
|
|
787
796
|
renderReceipts(page, model.receipts);
|
|
788
797
|
if (model.selfWitnessed) {
|
|
@@ -1646,7 +1655,7 @@ const resultOutcomeReportModule = {
|
|
|
1646
1655
|
render: async (model, host) => {
|
|
1647
1656
|
// The banner and the verification page take the card's look.
|
|
1648
1657
|
host.setChromeClass("oi");
|
|
1649
|
-
await renderContractReport(model.result, { grouping: "lines", options: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
|
|
1658
|
+
await renderContractReport(model.result, { grouping: "lines", options: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording, host.contract);
|
|
1650
1659
|
},
|
|
1651
1660
|
};
|
|
1652
1661
|
const resultComplianceModule = {
|
|
@@ -1662,7 +1671,7 @@ const resultComplianceModule = {
|
|
|
1662
1671
|
render: async (model, host) => {
|
|
1663
1672
|
// The card draws its own frame inside the page.
|
|
1664
1673
|
host.setChromeClass(COMPLIANCE_CHROME);
|
|
1665
|
-
await renderContractReport(model.result, { grouping: "groups", presentation: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
|
|
1674
|
+
await renderContractReport(model.result, { grouping: "groups", presentation: model.card }, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording, host.contract);
|
|
1666
1675
|
},
|
|
1667
1676
|
};
|
|
1668
1677
|
/**
|
|
@@ -1779,7 +1788,7 @@ const contractReportModule = {
|
|
|
1779
1788
|
// The report's banner takes its frame's look (a callout at the top);
|
|
1780
1789
|
// the outcome report's verification page takes its look too.
|
|
1781
1790
|
host.setChromeClass(model.input.grouping === "lines" ? OUTCOME_CHROME : COMPLIANCE_CHROME);
|
|
1782
|
-
await renderContractReport(model.result, model.input, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording);
|
|
1791
|
+
await renderContractReport(model.result, model.input, model.bundle, model.verification, { L0: host.L0, L1: host.L1, L2: host.L2, depth: host.depth }, host.wording, host.contract);
|
|
1783
1792
|
},
|
|
1784
1793
|
};
|
|
1785
1794
|
const resultModule = {
|
|
@@ -1913,6 +1922,25 @@ export function resolvePresentation(context, audience = DEFAULT_AUDIENCE, format
|
|
|
1913
1922
|
/** `"*"`: no particular audience, so only modules serving every audience. */
|
|
1914
1923
|
const DEFAULT_AUDIENCE = "*";
|
|
1915
1924
|
const DEFAULT_FORMAT = "html";
|
|
1925
|
+
async function pageContract(given) {
|
|
1926
|
+
if (given === undefined)
|
|
1927
|
+
return {};
|
|
1928
|
+
try {
|
|
1929
|
+
return { checked: await checkContractInput(given) };
|
|
1930
|
+
}
|
|
1931
|
+
catch (err) {
|
|
1932
|
+
if (!(err instanceof ContractError))
|
|
1933
|
+
throw err;
|
|
1934
|
+
return {
|
|
1935
|
+
refused: {
|
|
1936
|
+
sha256: /^[0-9a-f]{64}$/u.test(given.sha256)
|
|
1937
|
+
? given.sha256
|
|
1938
|
+
: "(not a SHA-256)",
|
|
1939
|
+
reason: err.message,
|
|
1940
|
+
},
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1916
1944
|
async function chartDigestsOf(charts) {
|
|
1917
1945
|
const out = [];
|
|
1918
1946
|
for (const spec of charts ?? []) {
|
|
@@ -2429,6 +2457,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2429
2457
|
let strip;
|
|
2430
2458
|
let chartsNode;
|
|
2431
2459
|
const chartDigests = await chartDigestsOf(options.charts);
|
|
2460
|
+
const contract = await pageContract(options.contract);
|
|
2432
2461
|
const charted = options.charts !== undefined && options.charts.length > 0;
|
|
2433
2462
|
if (verified) {
|
|
2434
2463
|
const result = await resultRootOf(context);
|
|
@@ -2744,6 +2773,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2744
2773
|
L2: regions.L2,
|
|
2745
2774
|
depth,
|
|
2746
2775
|
...(options.wording === undefined ? {} : { wording: options.wording }),
|
|
2776
|
+
...(contract.checked === undefined ? {} : { contract: contract.checked }),
|
|
2747
2777
|
setChromeClass(name) {
|
|
2748
2778
|
if (name !== OUTCOME_CHROME && name !== COMPLIANCE_CHROME)
|
|
2749
2779
|
throw new Error(`unknown chrome class ${JSON.stringify(name)}`);
|
|
@@ -2829,7 +2859,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2829
2859
|
if (ran !== undefined)
|
|
2830
2860
|
for (const id of moduleInterpreters(ran.module.manifest.id, context.bundle))
|
|
2831
2861
|
applied.add(id);
|
|
2832
|
-
const checkedLine = await renderVerificationPage(regions.core, context, chrome === OUTCOME_CHROME, applied, refused, refusal === undefined && citesCheckedSigners(selected), options.verifierHint, depth, stamps, chartDigests, verified
|
|
2862
|
+
const checkedLine = await renderVerificationPage(regions.core, context, chrome === OUTCOME_CHROME, applied, refused, refusal === undefined && citesCheckedSigners(selected), options.verifierHint, depth, stamps, chartDigests, contract, verified
|
|
2833
2863
|
? {
|
|
2834
2864
|
words: await contractReportWords(contractReportGroupingOf(bundle) ?? "lines", options.wording),
|
|
2835
2865
|
voice: options.voice ?? "shared",
|