@action-state-group/capsule-viewer 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -1
- 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 +145 -90
- package/dist/compliance-view.js.map +1 -1
- package/dist/contract-report-wording.d.ts +2 -1
- package/dist/contract-report-wording.js +41 -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 +48 -26
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +2872 -1289
- 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 +21 -6
- package/dist/outcome-report-view.js +350 -154
- 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/reader-witnesses.d.ts +39 -0
- package/dist/reader-witnesses.js +111 -0
- package/dist/reader-witnesses.js.map +1 -0
- 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.d.ts +11 -0
- package/dist/report-levels.js +24 -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 +2 -2
- package/dist/wording/contract-report-eu-ai-act.en.json +18 -1
- package/dist/wording/contract-report-outcomes.en.json +73 -6
- package/package.json +2 -2
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
import { sha256Hex } from "@action-state-group/agent-action-capsule";
|
|
3
|
+
/** The tiers in the order their sections are drawn. */
|
|
4
|
+
export const ROW_TIERS = [
|
|
5
|
+
"must_have",
|
|
6
|
+
"informational",
|
|
7
|
+
"unstated",
|
|
8
|
+
];
|
|
9
|
+
const REQUIREMENT_TIERS = ["must_have", "informational"];
|
|
10
|
+
/** A contract whose bytes, digest or shape do not check. */
|
|
11
|
+
export class ContractError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "ContractError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18
|
+
/**
|
|
19
|
+
* Check a contract against its digest (the exact bytes, hashed as given)
|
|
20
|
+
* and its shape, and read it. The shape is what the page reads: a string
|
|
21
|
+
* `id` and `version`, and `requirements`, a list of objects with unique
|
|
22
|
+
* string `id`s and an optional `tier` of `must_have` or `informational`.
|
|
23
|
+
* Every other member is the contract's own and is not read.
|
|
24
|
+
*/
|
|
25
|
+
export async function checkContractInput(contract) {
|
|
26
|
+
if (!/^[0-9a-f]{64}$/u.test(contract.sha256))
|
|
27
|
+
throw new ContractError("contract sha256 is not a lowercase hex SHA-256");
|
|
28
|
+
const digest = await sha256Hex(new TextEncoder().encode(contract.text));
|
|
29
|
+
if (digest !== contract.sha256)
|
|
30
|
+
throw new ContractError("contract bytes do not hash to its contract_sha256");
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = JSON.parse(contract.text);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
throw new ContractError("contract is not JSON");
|
|
37
|
+
}
|
|
38
|
+
const bad = (why) => {
|
|
39
|
+
throw new ContractError(`contract is not a compiled Evidence Contract: ${why}`);
|
|
40
|
+
};
|
|
41
|
+
if (!isObject(parsed))
|
|
42
|
+
return bad("not a JSON object");
|
|
43
|
+
const { id, version, requirements } = parsed;
|
|
44
|
+
if (typeof id !== "string" || id === "")
|
|
45
|
+
return bad("id is not a non-empty string");
|
|
46
|
+
if (typeof version !== "string" || version === "")
|
|
47
|
+
return bad("version is not a non-empty string");
|
|
48
|
+
if (!Array.isArray(requirements))
|
|
49
|
+
return bad("requirements is not a list");
|
|
50
|
+
const tiers = new Map();
|
|
51
|
+
requirements.forEach((requirement, i) => {
|
|
52
|
+
if (!isObject(requirement))
|
|
53
|
+
return bad(`requirement ${i + 1} is not an object`);
|
|
54
|
+
const rid = requirement.id;
|
|
55
|
+
if (typeof rid !== "string" || rid === "")
|
|
56
|
+
return bad(`requirement ${i + 1} id is not a non-empty string`);
|
|
57
|
+
if (tiers.has(rid))
|
|
58
|
+
return bad(`requirement id ${JSON.stringify(rid)} is listed twice`);
|
|
59
|
+
const tier = requirement.tier;
|
|
60
|
+
if (tier !== undefined &&
|
|
61
|
+
(typeof tier !== "string" || !REQUIREMENT_TIERS.includes(tier)))
|
|
62
|
+
return bad(`requirement ${JSON.stringify(rid)} tier is not must_have or informational`);
|
|
63
|
+
tiers.set(rid, tier);
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
id,
|
|
67
|
+
version,
|
|
68
|
+
ref: `${id}@${version}`,
|
|
69
|
+
sha256: contract.sha256,
|
|
70
|
+
tiers,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A row's tier: the given contract's, when the row's `contract_ref` is that
|
|
75
|
+
* contract and the contract lists the requirement with a tier. Anything
|
|
76
|
+
* else is `unstated`, never `must_have`.
|
|
77
|
+
*/
|
|
78
|
+
export function rowTier(contract, contractRef, requirementRef) {
|
|
79
|
+
if (contract === undefined || contractRef !== contract.ref)
|
|
80
|
+
return "unstated";
|
|
81
|
+
return contract.tiers.get(requirementRef) ?? "unstated";
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=evidence-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-contract.js","sourceRoot":"","sources":["../src/evidence-contract.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAyCrE,uDAAuD;AACvD,MAAM,CAAC,MAAM,SAAS,GAAuB;IAC3C,WAAW;IACX,eAAe;IACf,UAAU;CACX,CAAC;AAEF,MAAM,iBAAiB,GAAsB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AAa5E,4DAA4D;AAC5D,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAuB;IAEvB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC1C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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) {
|
|
@@ -866,33 +875,25 @@ function renderCalibration(calibration) {
|
|
|
866
875
|
section.append(element("p", "no human-check data"));
|
|
867
876
|
return section;
|
|
868
877
|
}
|
|
878
|
+
if (!calibration.matchesSchema) {
|
|
879
|
+
section.append(element("p", "does not match calibration-summary/v1"));
|
|
880
|
+
return section;
|
|
881
|
+
}
|
|
882
|
+
// The record's own figures, per clause, each printed as "k of n"; no rate
|
|
883
|
+
// is computed from them here.
|
|
869
884
|
const details = element("dl");
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
885
|
+
for (const clause of calibration.summary.clauses) {
|
|
886
|
+
appendCount(details, `${clause.clauseRef} agreement`, clause.agreement);
|
|
887
|
+
appendCount(details, `${clause.clauseRef} drift`, clause.drift);
|
|
888
|
+
}
|
|
874
889
|
section.append(details);
|
|
875
890
|
return section;
|
|
876
891
|
}
|
|
877
|
-
// A calibration figure is printed as the integers it is made of, "k of n";
|
|
878
|
-
// no rate is computed from them here, and a figure the producer stated only
|
|
879
|
-
// as a rate is said to be that, not converted.
|
|
880
892
|
function appendCount(parent, label, count) {
|
|
881
893
|
parent.append(element("dt", label));
|
|
882
|
-
const cell = element("dd");
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
cell.dataset.count = "not-stated";
|
|
886
|
-
}
|
|
887
|
-
else if ("rate" in count) {
|
|
888
|
-
cell.textContent = "rate given, k and n not stated";
|
|
889
|
-
cell.dataset.count = "not-stated";
|
|
890
|
-
}
|
|
891
|
-
else {
|
|
892
|
-
cell.textContent = `${count.k} of ${count.n}`;
|
|
893
|
-
cell.dataset.k = String(count.k);
|
|
894
|
-
cell.dataset.n = String(count.n);
|
|
895
|
-
}
|
|
894
|
+
const cell = element("dd", `${count.k} of ${count.n}`);
|
|
895
|
+
cell.dataset.k = String(count.k);
|
|
896
|
+
cell.dataset.n = String(count.n);
|
|
896
897
|
parent.append(cell);
|
|
897
898
|
}
|
|
898
899
|
// Both of a record's times are shown, each labelled and each as written. The
|
|
@@ -1646,7 +1647,7 @@ const resultOutcomeReportModule = {
|
|
|
1646
1647
|
render: async (model, host) => {
|
|
1647
1648
|
// The banner and the verification page take the card's look.
|
|
1648
1649
|
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);
|
|
1650
|
+
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
1651
|
},
|
|
1651
1652
|
};
|
|
1652
1653
|
const resultComplianceModule = {
|
|
@@ -1662,7 +1663,7 @@ const resultComplianceModule = {
|
|
|
1662
1663
|
render: async (model, host) => {
|
|
1663
1664
|
// The card draws its own frame inside the page.
|
|
1664
1665
|
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);
|
|
1666
|
+
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
1667
|
},
|
|
1667
1668
|
};
|
|
1668
1669
|
/**
|
|
@@ -1779,7 +1780,7 @@ const contractReportModule = {
|
|
|
1779
1780
|
// The report's banner takes its frame's look (a callout at the top);
|
|
1780
1781
|
// the outcome report's verification page takes its look too.
|
|
1781
1782
|
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);
|
|
1783
|
+
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
1784
|
},
|
|
1784
1785
|
};
|
|
1785
1786
|
const resultModule = {
|
|
@@ -1913,6 +1914,25 @@ export function resolvePresentation(context, audience = DEFAULT_AUDIENCE, format
|
|
|
1913
1914
|
/** `"*"`: no particular audience, so only modules serving every audience. */
|
|
1914
1915
|
const DEFAULT_AUDIENCE = "*";
|
|
1915
1916
|
const DEFAULT_FORMAT = "html";
|
|
1917
|
+
async function pageContract(given) {
|
|
1918
|
+
if (given === undefined)
|
|
1919
|
+
return {};
|
|
1920
|
+
try {
|
|
1921
|
+
return { checked: await checkContractInput(given) };
|
|
1922
|
+
}
|
|
1923
|
+
catch (err) {
|
|
1924
|
+
if (!(err instanceof ContractError))
|
|
1925
|
+
throw err;
|
|
1926
|
+
return {
|
|
1927
|
+
refused: {
|
|
1928
|
+
sha256: /^[0-9a-f]{64}$/u.test(given.sha256)
|
|
1929
|
+
? given.sha256
|
|
1930
|
+
: "(not a SHA-256)",
|
|
1931
|
+
reason: err.message,
|
|
1932
|
+
},
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1916
1936
|
async function chartDigestsOf(charts) {
|
|
1917
1937
|
const out = [];
|
|
1918
1938
|
for (const spec of charts ?? []) {
|
|
@@ -2429,6 +2449,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2429
2449
|
let strip;
|
|
2430
2450
|
let chartsNode;
|
|
2431
2451
|
const chartDigests = await chartDigestsOf(options.charts);
|
|
2452
|
+
const contract = await pageContract(options.contract);
|
|
2432
2453
|
const charted = options.charts !== undefined && options.charts.length > 0;
|
|
2433
2454
|
if (verified) {
|
|
2434
2455
|
const result = await resultRootOf(context);
|
|
@@ -2744,6 +2765,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2744
2765
|
L2: regions.L2,
|
|
2745
2766
|
depth,
|
|
2746
2767
|
...(options.wording === undefined ? {} : { wording: options.wording }),
|
|
2768
|
+
...(contract.checked === undefined ? {} : { contract: contract.checked }),
|
|
2747
2769
|
setChromeClass(name) {
|
|
2748
2770
|
if (name !== OUTCOME_CHROME && name !== COMPLIANCE_CHROME)
|
|
2749
2771
|
throw new Error(`unknown chrome class ${JSON.stringify(name)}`);
|
|
@@ -2829,7 +2851,7 @@ async function renderVerifiedContext(context, root, options) {
|
|
|
2829
2851
|
if (ran !== undefined)
|
|
2830
2852
|
for (const id of moduleInterpreters(ran.module.manifest.id, context.bundle))
|
|
2831
2853
|
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
|
|
2854
|
+
const checkedLine = await renderVerificationPage(regions.core, context, chrome === OUTCOME_CHROME, applied, refused, refusal === undefined && citesCheckedSigners(selected), options.verifierHint, depth, stamps, chartDigests, contract, verified
|
|
2833
2855
|
? {
|
|
2834
2856
|
words: await contractReportWords(contractReportGroupingOf(bundle) ?? "lines", options.wording),
|
|
2835
2857
|
voice: options.voice ?? "shared",
|