@action-state-group/capsule-viewer 0.0.0 → 0.3.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/LICENSE +201 -0
- package/LICENSE-BSD-3-Clause +28 -0
- package/README.md +94 -1
- package/dist/alias-interpreters.d.ts +18 -0
- package/dist/alias-interpreters.js +50 -0
- package/dist/alias-interpreters.js.map +1 -0
- package/dist/browser.d.ts +7 -0
- package/dist/browser.js +25 -0
- package/dist/browser.js.map +1 -0
- package/dist/builtin-manifests.d.ts +51 -0
- package/dist/builtin-manifests.js +196 -0
- package/dist/builtin-manifests.js.map +1 -0
- package/dist/compliance-presentation.d.ts +51 -0
- package/dist/compliance-presentation.js +140 -0
- package/dist/compliance-presentation.js.map +1 -0
- package/dist/compliance-styles.d.ts +1 -0
- package/dist/compliance-styles.js +104 -0
- package/dist/compliance-styles.js.map +1 -0
- package/dist/compliance-view.d.ts +46 -0
- package/dist/compliance-view.js +828 -0
- package/dist/compliance-view.js.map +1 -0
- package/dist/compliance.d.ts +121 -0
- package/dist/compliance.js +412 -0
- package/dist/compliance.js.map +1 -0
- package/dist/composed-styles.d.ts +12 -0
- package/dist/composed-styles.js +20 -0
- package/dist/composed-styles.js.map +1 -0
- package/dist/composed-view.d.ts +24 -0
- package/dist/composed-view.js +186 -0
- package/dist/composed-view.js.map +1 -0
- package/dist/contract-report-wording.d.ts +195 -0
- package/dist/contract-report-wording.js +1141 -0
- package/dist/contract-report-wording.js.map +1 -0
- package/dist/contract-report.d.ts +92 -0
- package/dist/contract-report.js +63 -0
- package/dist/contract-report.js.map +1 -0
- package/dist/emitter-shell.html +310 -0
- package/dist/emitter.d.ts +105 -0
- package/dist/emitter.js +329 -0
- package/dist/emitter.js.map +1 -0
- package/dist/evidence-graph-view.d.ts +149 -0
- package/dist/evidence-graph-view.js +2718 -0
- package/dist/evidence-graph-view.js.map +1 -0
- package/dist/evidence-graph.iife.js +18159 -0
- package/dist/frame-tokens.generated.d.ts +3 -0
- package/dist/frame-tokens.generated.js +5 -0
- package/dist/frame-tokens.generated.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/outcome-report-presentation.d.ts +48 -0
- package/dist/outcome-report-presentation.js +90 -0
- package/dist/outcome-report-presentation.js.map +1 -0
- package/dist/outcome-report-styles.d.ts +1 -0
- package/dist/outcome-report-styles.js +228 -0
- package/dist/outcome-report-styles.js.map +1 -0
- package/dist/outcome-report-view.d.ts +78 -0
- package/dist/outcome-report-view.js +1488 -0
- package/dist/outcome-report-view.js.map +1 -0
- package/dist/presentation-builder.d.ts +296 -0
- package/dist/presentation-builder.js +646 -0
- package/dist/presentation-builder.js.map +1 -0
- package/dist/presentation-fragment.d.ts +129 -0
- package/dist/presentation-fragment.js +213 -0
- package/dist/presentation-fragment.js.map +1 -0
- package/dist/presentation-mount.d.ts +26 -0
- package/dist/presentation-mount.js +45 -0
- package/dist/presentation-mount.js.map +1 -0
- package/dist/presentation-registry.d.ts +277 -0
- package/dist/presentation-registry.js +416 -0
- package/dist/presentation-registry.js.map +1 -0
- package/dist/record-content.d.ts +68 -0
- package/dist/record-content.js +153 -0
- package/dist/record-content.js.map +1 -0
- package/dist/record-dating.d.ts +10 -0
- package/dist/record-dating.js +76 -0
- package/dist/record-dating.js.map +1 -0
- package/dist/report-front-styles.d.ts +9 -0
- package/dist/report-front-styles.js +55 -0
- package/dist/report-front-styles.js.map +1 -0
- package/dist/report-front.d.ts +78 -0
- package/dist/report-front.js +274 -0
- package/dist/report-front.js.map +1 -0
- package/dist/report-levels.d.ts +206 -0
- package/dist/report-levels.js +739 -0
- package/dist/report-levels.js.map +1 -0
- package/dist/report-provenance.d.ts +111 -0
- package/dist/report-provenance.js +535 -0
- package/dist/report-provenance.js.map +1 -0
- package/dist/viewer-build.d.ts +37 -0
- package/dist/viewer-build.js +29 -0
- package/dist/viewer-build.js.map +1 -0
- package/dist/wording/contract-report-eu-ai-act.en.json +295 -0
- package/dist/wording/contract-report-outcomes.en.json +394 -0
- package/package.json +48 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The composition section's own stylesheet, inserted as the first child of
|
|
3
|
+
* its `<section>` (composed-view.ts). Member, observer and pair cells carry
|
|
4
|
+
* unbroken 64-hex ids, which made the ten-column members table wider than
|
|
5
|
+
* the page at 1280px and in print (capsule-viewer#57). A value cell may
|
|
6
|
+
* break anywhere, so a table's narrowest width no longer includes a whole
|
|
7
|
+
* id; the full value is still the cell's text. On screen each table also
|
|
8
|
+
* sits in a container that scrolls sideways rather than widening the page;
|
|
9
|
+
* in print it does not scroll, so nothing is clipped. Every selector is
|
|
10
|
+
* scoped to the section.
|
|
11
|
+
*/
|
|
12
|
+
export declare const COMPOSED_CSS = "\n[data-section=composition] .cv-composed-table{max-width:100%}\n@media screen{[data-section=composition] .cv-composed-table{overflow-x:auto}}\n[data-section=composition] table{font-size:.875em}\n[data-section=composition] :is(th,td){text-align:left;vertical-align:top}\n[data-section=composition] :is(td,dd){overflow-wrap:anywhere}\n";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
/**
|
|
3
|
+
* The composition section's own stylesheet, inserted as the first child of
|
|
4
|
+
* its `<section>` (composed-view.ts). Member, observer and pair cells carry
|
|
5
|
+
* unbroken 64-hex ids, which made the ten-column members table wider than
|
|
6
|
+
* the page at 1280px and in print (capsule-viewer#57). A value cell may
|
|
7
|
+
* break anywhere, so a table's narrowest width no longer includes a whole
|
|
8
|
+
* id; the full value is still the cell's text. On screen each table also
|
|
9
|
+
* sits in a container that scrolls sideways rather than widening the page;
|
|
10
|
+
* in print it does not scroll, so nothing is clipped. Every selector is
|
|
11
|
+
* scoped to the section.
|
|
12
|
+
*/
|
|
13
|
+
export const COMPOSED_CSS = `
|
|
14
|
+
[data-section=composition] .cv-composed-table{max-width:100%}
|
|
15
|
+
@media screen{[data-section=composition] .cv-composed-table{overflow-x:auto}}
|
|
16
|
+
[data-section=composition] table{font-size:.875em}
|
|
17
|
+
[data-section=composition] :is(th,td){text-align:left;vertical-align:top}
|
|
18
|
+
[data-section=composition] :is(td,dd){overflow-wrap:anywhere}
|
|
19
|
+
`;
|
|
20
|
+
//# sourceMappingURL=composed-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-styles.js","sourceRoot":"","sources":["../src/composed-styles.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;CAM3B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ComposedResult } from "@action-state-group/agent-action-capsule";
|
|
2
|
+
import type { PresentationModule } from "./presentation-registry.js";
|
|
3
|
+
/**
|
|
4
|
+
* The composition section: a generic view of the `composed/v1` block's
|
|
5
|
+
* verification, as the verify core computed it (`composed.ts`). It reports
|
|
6
|
+
* what draft-mih-zhang-agent-disclosure-bundle-01 "Verifying composed/v1"
|
|
7
|
+
* says a verifier reports, separately: the composed digest, each member,
|
|
8
|
+
* composition closure, each join's declared and derived state, and per
|
|
9
|
+
* derived agreement whether it is redundant or corroborating on declared
|
|
10
|
+
* custody. It shows no product wording and names no party's business role;
|
|
11
|
+
* an observer's `role` is shown as the block declares it, uninterpreted.
|
|
12
|
+
*
|
|
13
|
+
* It never verifies: every value it shows is read from the context's one
|
|
14
|
+
* verification result.
|
|
15
|
+
*/
|
|
16
|
+
type Verified = Extract<ComposedResult, {
|
|
17
|
+
malformed: false;
|
|
18
|
+
}>;
|
|
19
|
+
export interface ComposedSectionModel {
|
|
20
|
+
readonly result: Verified;
|
|
21
|
+
}
|
|
22
|
+
/** The built-in composition section module (`aac.builtin.composed/v0`). */
|
|
23
|
+
export declare const composedSectionModule: PresentationModule<ComposedSectionModel>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { BUILTIN_MANIFEST_COMPOSED } from "./builtin-manifests.js";
|
|
2
|
+
import { COMPOSED_CSS } from "./composed-styles.js";
|
|
3
|
+
import { COMPOSED_KIND, } from "@action-state-group/agent-action-capsule";
|
|
4
|
+
/** The well-formed composed/v1 result the core verified, if there is one. */
|
|
5
|
+
function composedResult(context) {
|
|
6
|
+
const entry = context.verification.extensions.find((extension) => extension.kind === COMPOSED_KIND);
|
|
7
|
+
const composed = entry?.composed;
|
|
8
|
+
return composed !== undefined && !composed.malformed ? composed : undefined;
|
|
9
|
+
}
|
|
10
|
+
function element(tag, text) {
|
|
11
|
+
const node = document.createElement(tag);
|
|
12
|
+
if (text !== undefined)
|
|
13
|
+
node.textContent = text;
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
function row(cells, header = false) {
|
|
17
|
+
const tr = element("tr");
|
|
18
|
+
for (const cell of cells)
|
|
19
|
+
tr.append(element(header ? "th" : "td", cell));
|
|
20
|
+
return tr;
|
|
21
|
+
}
|
|
22
|
+
function table(name, columns, rows) {
|
|
23
|
+
const node = element("table");
|
|
24
|
+
node.setAttribute(`data-${name}`, "");
|
|
25
|
+
const head = element("thead");
|
|
26
|
+
head.append(row(columns, true));
|
|
27
|
+
const body = element("tbody");
|
|
28
|
+
body.append(...rows);
|
|
29
|
+
node.append(head, body);
|
|
30
|
+
const frame = element("div");
|
|
31
|
+
frame.className = "cv-composed-table";
|
|
32
|
+
frame.append(node);
|
|
33
|
+
return frame;
|
|
34
|
+
}
|
|
35
|
+
const NOT_APPLICABLE = "—";
|
|
36
|
+
const findingsText = (findings) => findings.length === 0 ? "none" : findings.join(", ");
|
|
37
|
+
const claimText = (claim) => claim === undefined
|
|
38
|
+
? NOT_APPLICABLE
|
|
39
|
+
: claim.findings.length === 0
|
|
40
|
+
? claim.status
|
|
41
|
+
: `${claim.status} (${claim.findings.join(", ")})`;
|
|
42
|
+
const pairText = (members) => `${members[0]} – ${members[1]}`;
|
|
43
|
+
// The values two members hold at one compare pointer, as text. No winner is
|
|
44
|
+
// named (draft "Joins": "names no winner").
|
|
45
|
+
function renderDifference(difference, host) {
|
|
46
|
+
const list = element("dl");
|
|
47
|
+
list.dataset.pointer = difference.pointer;
|
|
48
|
+
list.append(element("dt", difference.pointer));
|
|
49
|
+
for (const value of difference.values)
|
|
50
|
+
list.append(element("dd", value.resolved
|
|
51
|
+
? `${value.member}: ${JSON.stringify(value.value)}`
|
|
52
|
+
: `${value.member}: does not resolve`));
|
|
53
|
+
host.append(list);
|
|
54
|
+
}
|
|
55
|
+
// go/bundle/composed.go:102-114 and draft "Observers and Redundancy": a
|
|
56
|
+
// redundant pair is presented as "redundant, not corroborating" with its
|
|
57
|
+
// reason; a corroborating one is qualified as resting on declared custody.
|
|
58
|
+
function corroborationText(c) {
|
|
59
|
+
switch (c.result) {
|
|
60
|
+
case "redundant":
|
|
61
|
+
return `${c.report} (${c.reasons.join(", ")})`;
|
|
62
|
+
case "corroborating":
|
|
63
|
+
return "corroborating, on declared custody";
|
|
64
|
+
case "not_applicable":
|
|
65
|
+
return "not applicable: the join did not derive agree";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function renderComposed(model, host, services) {
|
|
69
|
+
const result = model.result;
|
|
70
|
+
const section = element("section");
|
|
71
|
+
section.dataset.section = "composition";
|
|
72
|
+
section.dataset.module = BUILTIN_MANIFEST_COMPOSED.id;
|
|
73
|
+
const style = element("style");
|
|
74
|
+
style.textContent = COMPOSED_CSS;
|
|
75
|
+
section.append(style);
|
|
76
|
+
section.append(element("h2", "Composition"));
|
|
77
|
+
const status = element("p", `composed/v1 check: ${result.status}`);
|
|
78
|
+
status.dataset.compositionStatus = result.status;
|
|
79
|
+
section.append(status);
|
|
80
|
+
if (result.findings.length > 0)
|
|
81
|
+
section.append(element("p", `findings: ${result.findings.join(", ")}`));
|
|
82
|
+
// capsule-cli internal/cli/composed.go:69, the same statement of scope.
|
|
83
|
+
section.append(element("p", "Composition closure covers the declared members only; it is not completeness of participation."));
|
|
84
|
+
section.append(element("h3", "Composed digest"));
|
|
85
|
+
const digest = element("dl");
|
|
86
|
+
digest.dataset.composedDigest = result.composedDigest.declared;
|
|
87
|
+
digest.dataset.matches = String(result.composedDigest.matches);
|
|
88
|
+
digest.append(element("dt", "declared"), element("dd", result.composedDigest.declared), element("dt", "recomputed"), element("dd", result.composedDigest.recomputed || "uncomputable"), element("dt", "matches"), element("dd", result.composedDigest.matches ? "yes" : "no"));
|
|
89
|
+
section.append(digest);
|
|
90
|
+
section.append(element("h3", "Members"));
|
|
91
|
+
section.append(table("composition-members", [
|
|
92
|
+
"member",
|
|
93
|
+
"observer",
|
|
94
|
+
"outcome",
|
|
95
|
+
"body",
|
|
96
|
+
"digest",
|
|
97
|
+
"graph closure",
|
|
98
|
+
"interval coverage",
|
|
99
|
+
"per-record membership",
|
|
100
|
+
"refusal signature",
|
|
101
|
+
"findings",
|
|
102
|
+
], result.members.map((m) => {
|
|
103
|
+
const tr = row([
|
|
104
|
+
m.id,
|
|
105
|
+
m.observer,
|
|
106
|
+
m.outcome,
|
|
107
|
+
m.body,
|
|
108
|
+
m.digest,
|
|
109
|
+
claimText(m.bundle?.graphClosure),
|
|
110
|
+
claimText(m.bundle?.intervalCoverage),
|
|
111
|
+
claimText(m.bundle?.perRecordMembership),
|
|
112
|
+
m.refusalSignature ?? NOT_APPLICABLE,
|
|
113
|
+
findingsText(m.findings),
|
|
114
|
+
]);
|
|
115
|
+
tr.dataset.memberId = m.id;
|
|
116
|
+
tr.dataset.body = m.body;
|
|
117
|
+
tr.dataset.digest = m.digest;
|
|
118
|
+
return tr;
|
|
119
|
+
})));
|
|
120
|
+
section.append(element("h3", "Observers"));
|
|
121
|
+
section.append(table("composition-observers", ["observer", "role", "custody domain"], result.observers.map((o) => {
|
|
122
|
+
const tr = row([o.id, o.role, o.custodyDomain]);
|
|
123
|
+
tr.dataset.observerId = o.id;
|
|
124
|
+
return tr;
|
|
125
|
+
})));
|
|
126
|
+
// Draft "Observers and Redundancy": custody labels can only downgrade.
|
|
127
|
+
section.append(element("p", "Custody domains are labels declared by whoever composed this block. Identical labels make an agreeing pair redundant; distinct labels do not establish that two observers are independent."));
|
|
128
|
+
section.append(element("h3", "Composition closure"));
|
|
129
|
+
const closure = element("p", `${result.compositionClosure.status}; missing: ${result.compositionClosure.missing.length === 0
|
|
130
|
+
? "none"
|
|
131
|
+
: result.compositionClosure.missing.join(", ")}; findings: ${findingsText(result.compositionClosure.findings)}`);
|
|
132
|
+
closure.dataset.closureStatus = result.compositionClosure.status;
|
|
133
|
+
section.append(closure);
|
|
134
|
+
section.append(element("h3", "Joins"));
|
|
135
|
+
if (result.joins.length === 0)
|
|
136
|
+
section.append(element("p", "No joins."));
|
|
137
|
+
else {
|
|
138
|
+
section.append(table("composition-joins", ["members", "basis", "declared", "derived", "result"], result.joins.map((j) => {
|
|
139
|
+
const tr = row([
|
|
140
|
+
pairText(j.members),
|
|
141
|
+
j.basis,
|
|
142
|
+
j.declared,
|
|
143
|
+
j.derived ?? "not derivable",
|
|
144
|
+
j.result,
|
|
145
|
+
]);
|
|
146
|
+
tr.dataset.joinMembers = j.members.join(",");
|
|
147
|
+
tr.dataset.joinDeclared = j.declared;
|
|
148
|
+
tr.dataset.joinDerived = j.derived ?? "not_derivable";
|
|
149
|
+
tr.dataset.joinResult = j.result;
|
|
150
|
+
return tr;
|
|
151
|
+
})));
|
|
152
|
+
for (const j of result.joins) {
|
|
153
|
+
if (j.differences.length === 0)
|
|
154
|
+
continue;
|
|
155
|
+
const details = services.details(`Differing values: ${pairText(j.members)}`);
|
|
156
|
+
details.dataset.joinDifferences = j.members.join(",");
|
|
157
|
+
for (const difference of j.differences)
|
|
158
|
+
renderDifference(difference, details);
|
|
159
|
+
section.append(details);
|
|
160
|
+
}
|
|
161
|
+
// Per pair, never combined into a count or a score.
|
|
162
|
+
section.append(element("h3", "Agreement"));
|
|
163
|
+
section.append(table("composition-agreement", ["members", "result"], result.corroboration.map((c) => {
|
|
164
|
+
const tr = row([pairText(c.members), corroborationText(c)]);
|
|
165
|
+
tr.dataset.agreementMembers = c.members.join(",");
|
|
166
|
+
tr.dataset.corroboration = c.result;
|
|
167
|
+
if (c.result === "redundant")
|
|
168
|
+
tr.dataset.reasons = c.reasons.join(",");
|
|
169
|
+
return tr;
|
|
170
|
+
})));
|
|
171
|
+
}
|
|
172
|
+
host.L1.append(section);
|
|
173
|
+
}
|
|
174
|
+
/** The built-in composition section module (`aac.builtin.composed/v0`). */
|
|
175
|
+
export const composedSectionModule = {
|
|
176
|
+
manifest: BUILTIN_MANIFEST_COMPOSED,
|
|
177
|
+
canRender: (context) => composedResult(context) !== undefined,
|
|
178
|
+
buildModel: (context) => {
|
|
179
|
+
const result = composedResult(context);
|
|
180
|
+
if (result === undefined)
|
|
181
|
+
throw new Error(`${BUILTIN_MANIFEST_COMPOSED.id}: buildModel called although canRender was false`);
|
|
182
|
+
return { result };
|
|
183
|
+
},
|
|
184
|
+
render: renderComposed,
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=composed-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-view.js","sourceRoot":"","sources":["../src/composed-view.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,aAAa,GAKd,MAAM,0CAA0C,CAAC;AA2BlD,6EAA6E;AAC7E,SAAS,cAAc,CAAC,OAA8B;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAChD,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,aAAa,CAChD,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,CAAC;IACjC,OAAO,QAAQ,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CA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C,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5D,EAAE,CAAC,OAAO,CAAC,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClD,EAAE,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;YACpC,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW;gBAC1B,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3C,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CACH,CACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAA6C;IAC7E,QAAQ,EAAE,yBAAyB;IACnC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,SAAS;IAC7D,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE;QACtB,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,MAAM,KAAK,SAAS;YACtB,MAAM,IAAI,KAAK,CACb,GAAG,yBAAyB,CAAC,EAAE,kDAAkD,CAClF,CAAC;QACJ,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IACD,MAAM,EAAE,cAAc;CACvB,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { type WordingPackInput } from "./presentation-fragment.js";
|
|
2
|
+
/**
|
|
3
|
+
* The words of the contract-report module (contract-report.ts), and the
|
|
4
|
+
* wording packs they come from.
|
|
5
|
+
*
|
|
6
|
+
* The module's own words on a contract report -- labels, headings, the
|
|
7
|
+
* plain-language lines, the verdict words -- are each an entry of an
|
|
8
|
+
* `aac.wording-pack/v0` pack (presentation contract section 7.4). Not
|
|
9
|
+
* every word on the page is the pack's: the bundle's own producer-supplied
|
|
10
|
+
* text and two lines agent-action-capsule's outcome model writes are not
|
|
11
|
+
* (report-levels.ts's and compliance-view.ts's own docs say which). The
|
|
12
|
+
* module ships two default packs, beside its code and never in a bundle
|
|
13
|
+
* (section 6: this module's own wording never comes from the bundle):
|
|
14
|
+
*
|
|
15
|
+
* wording/contract-report-outcomes.en.json the Outcomes report
|
|
16
|
+
* wording/contract-report-eu-ai-act.en.json the EU AI Act Results
|
|
17
|
+
*
|
|
18
|
+
* A host may hand a page a pack of its own (`renderEvidenceGraph`'s
|
|
19
|
+
* `wording`, the same pack the presentation builder carries), bound to its
|
|
20
|
+
* bytes by `wording_sha256`. Its entries replace the default pack's entry
|
|
21
|
+
* for the same key; keys this module does not know (a page title, another
|
|
22
|
+
* module's words) are left to their owners.
|
|
23
|
+
*
|
|
24
|
+
* A pack changes words only. It holds strings and nothing else; every count,
|
|
25
|
+
* verdict, digest and record id on the page is computed by the module and
|
|
26
|
+
* put into a pack's sentence through its `{placeholders}`, and a replacement
|
|
27
|
+
* entry must carry exactly the placeholders of the entry it replaces, so a
|
|
28
|
+
* pack can neither drop a count or a denominator nor invent one. The words
|
|
29
|
+
* for two different verdicts must stay different words, so a pack cannot
|
|
30
|
+
* fold one verdict into another. The lines that say what the page checked,
|
|
31
|
+
* what the bundle withholds, and what is the producer's rather than evidence
|
|
32
|
+
* are locked (LOCKED_ENTRIES): a pack cannot reword them. The raw verdict is
|
|
33
|
+
* always on the element as data, whatever the words say.
|
|
34
|
+
*
|
|
35
|
+
* Plurals are two entries, `<key>.one` and `<key>.other`, chosen by count.
|
|
36
|
+
*/
|
|
37
|
+
export declare const WORDING_PACK_VERSION = "aac.wording-pack/v0";
|
|
38
|
+
/** A wording pack, read and shape-checked. */
|
|
39
|
+
export interface WordingPack {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly locale: string;
|
|
42
|
+
readonly entries: Readonly<Record<string, string>>;
|
|
43
|
+
}
|
|
44
|
+
/** A pack that is not an `aac.wording-pack/v0` object, or does not fit this module. */
|
|
45
|
+
export declare class WordingPackError extends Error {
|
|
46
|
+
constructor(message: string);
|
|
47
|
+
}
|
|
48
|
+
/** Shape-check a parsed pack (contract 7.4): id, locale and non-empty string entries, nothing else. */
|
|
49
|
+
export declare function readWordingPack(pack: unknown): WordingPack;
|
|
50
|
+
/**
|
|
51
|
+
* Check a distributed pack against its digest (the exact bytes, hashed as
|
|
52
|
+
* given) and its shape, and read it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function checkWordingPackInput(wording: WordingPackInput): Promise<WordingPack>;
|
|
55
|
+
/**
|
|
56
|
+
* Every `{placeholder}` `text` uses, in the order it uses them, repeats and
|
|
57
|
+
* all: a count and a denominator in one entry are two placeholders, not one,
|
|
58
|
+
* and a replacement that reorders or drops a repeat changes what the
|
|
59
|
+
* sentence can say with them.
|
|
60
|
+
*/
|
|
61
|
+
export declare function placeholders(text: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* The enum values contract-report/v1 section 3 gives a word each, lowercased
|
|
64
|
+
* (agent-action-capsule's TIERS, GRADES, SUFFICIENCIES and EVIDENCE_STATUSES).
|
|
65
|
+
* The verdicts are the four Result v0 defines; this module's own extra drawn
|
|
66
|
+
* verdicts (failed, unsupported, not applicable) keep their grouping keys.
|
|
67
|
+
*/
|
|
68
|
+
export declare const SECTION3_ENUMS: Readonly<{
|
|
69
|
+
readonly verdict: readonly ["met", "not_met", "not_evaluable", "out_of_scope"];
|
|
70
|
+
readonly tier: string[];
|
|
71
|
+
readonly grade: string[];
|
|
72
|
+
readonly sufficiency: string[];
|
|
73
|
+
readonly status: string[];
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* A key whose meaning contract-report/v1 section 3 fixes. The module's own
|
|
77
|
+
* keys never use these prefixes (`report.`, `group.`, `row.`, `verdict.`,
|
|
78
|
+
* `sufficiency.`, `tier.`, `grade.`, `status.`, `applicability.`,
|
|
79
|
+
* `contract_fact.`); its own words sit under `card.`, `lines.`, `groups.`
|
|
80
|
+
* and the shared prefixes (`prov.`, `chat.`, `case.`, `judge.`).
|
|
81
|
+
*/
|
|
82
|
+
export declare const SECTION3_PREFIXES: readonly string[];
|
|
83
|
+
/** The two ways the module lays a report out; a pack names its own in `layout.grouping`. */
|
|
84
|
+
export type ContractReportGrouping = "lines" | "groups";
|
|
85
|
+
export declare const DEFAULT_PACKS: Readonly<Record<ContractReportGrouping, WordingPack>>;
|
|
86
|
+
/**
|
|
87
|
+
* Lines that state what this page checked or did not check, what the bundle
|
|
88
|
+
* does not carry or withholds, and which text is the producer's rather than
|
|
89
|
+
* sealed evidence. A pack may not reword them: they are the page's honesty,
|
|
90
|
+
* not its voice. A pack that carries one of these entries with any text but
|
|
91
|
+
* the default's is refused (a pack that repeats the default, as a copied
|
|
92
|
+
* file does, changes nothing and passes).
|
|
93
|
+
*/
|
|
94
|
+
export declare const LOCKED_ENTRIES: ReadonlySet<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Every problem with `pack` as a replacement for `defaults`: a locked line
|
|
97
|
+
* (LOCKED_ENTRIES) reworded, an entry whose placeholders differ from the
|
|
98
|
+
* entry it replaces, a `layout.grouping` that is
|
|
99
|
+
* not the default's, verdict words two verdicts would share (as read), a
|
|
100
|
+
* verdict worded as another verdict reads by default, a verdict word with
|
|
101
|
+
* nothing visible in it, and an entry of one GUARDED_CATEGORY reading like an
|
|
102
|
+
* entry of a different one (a met result like a missed one, an exceptions
|
|
103
|
+
* count like an undecided note, and so on). Entries the defaults do not have
|
|
104
|
+
* are not this module's and are not checked.
|
|
105
|
+
*/
|
|
106
|
+
export declare function wordingProblems(supplied: WordingPack, defaults: WordingPack): string[];
|
|
107
|
+
/**
|
|
108
|
+
* Where a card's words came from, for its proofs. `base` is this viewer's
|
|
109
|
+
* own default pack -- present whether or not a host supplied one, since
|
|
110
|
+
* contract-report/v1 §3 records every wording layer applied, including
|
|
111
|
+
* the one layer a default-only page still has; `sha256` is the digest of
|
|
112
|
+
* the pack actually named by `id`, absent only when a caller (a test) built
|
|
113
|
+
* `Words` from a pack it never hashed. `refused` is a host layer that did
|
|
114
|
+
* not check (§3: a refused layer contributes no words): the card is drawn
|
|
115
|
+
* with the base layer alone, and says so.
|
|
116
|
+
*/
|
|
117
|
+
export interface WordingSource {
|
|
118
|
+
readonly id: string;
|
|
119
|
+
readonly sha256?: string;
|
|
120
|
+
readonly base?: {
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly sha256: string;
|
|
123
|
+
};
|
|
124
|
+
readonly refused?: {
|
|
125
|
+
/** The digest the host gave the layer, as given. */
|
|
126
|
+
readonly sha256: string;
|
|
127
|
+
/** Why, as a reason code, never the pack's own text. */
|
|
128
|
+
readonly reason: "digest" | "shape" | "fit";
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* sha256 of each default pack exactly as this package ships it --
|
|
133
|
+
* `wording/contract-report-outcomes.en.json` and
|
|
134
|
+
* `wording/contract-report-eu-ai-act.en.json`, the literal file bytes, not
|
|
135
|
+
* a re-serialized form -- so the proofs line's digest is the one a reader
|
|
136
|
+
* who downloads this package and hashes the file themselves actually gets,
|
|
137
|
+
* the same canonical form a supplied pack's `wording_sha256` already uses
|
|
138
|
+
* (`checkWordingPackInput` hashes the bytes as given, never a re-encoding).
|
|
139
|
+
* contract-report.test.ts hashes the real files on disk and checks these
|
|
140
|
+
* still match; regenerate with `sha256sum ts/src/wording/*.en.json` after
|
|
141
|
+
* editing either file.
|
|
142
|
+
*/
|
|
143
|
+
export declare const DEFAULT_PACK_SHA256: Readonly<Record<ContractReportGrouping, string>>;
|
|
144
|
+
export interface Words {
|
|
145
|
+
/** Entry `key`, its `{placeholders}` filled from `vars`. */
|
|
146
|
+
t(key: string, vars?: Readonly<Record<string, string | number>>): string;
|
|
147
|
+
/** `key.one` when `count` is 1, else `key.other`; `{n}` is the count (as `toLocaleString()` writes it) unless `vars` gives it. */
|
|
148
|
+
p(key: string, count: number, vars?: Readonly<Record<string, string | number>>): string;
|
|
149
|
+
/**
|
|
150
|
+
* A contract-report/v1 section 3 word, after layering: the entry for the
|
|
151
|
+
* key `family` + `value` assemble to, or undefined when no layer has it or
|
|
152
|
+
* the assembled key is not a valid WordingKey (§3: the caller then shows
|
|
153
|
+
* the raw token or identifier, never a guess). `row` and `group` words
|
|
154
|
+
* apply only when every claim cites the same `contract_ref`: otherwise
|
|
155
|
+
* undefined, so a multi-contract Result shows raw identifiers.
|
|
156
|
+
*/
|
|
157
|
+
section3(key: string): string | undefined;
|
|
158
|
+
/** A section 3 enum word (`status`, `grade`, `sufficiency`, `tier`, `verdict`): the layered word for the lowercased value, or the raw value itself. */
|
|
159
|
+
enumWord(family: "status" | "grade" | "sufficiency" | "tier" | "verdict", value: string): string;
|
|
160
|
+
/** The `row.<ref>.<part>` word for this Result, or undefined (see `section3`). */
|
|
161
|
+
row(requirementRef: string, part: "label" | "detail" | "not_evaluable"): string | undefined;
|
|
162
|
+
/** The `group.<segment>.title` word for this Result, or undefined (see `section3`). */
|
|
163
|
+
group(segment: string): string | undefined;
|
|
164
|
+
readonly grouping: ContractReportGrouping;
|
|
165
|
+
readonly source: WordingSource;
|
|
166
|
+
}
|
|
167
|
+
/** How the Result a card draws bears on its words: whether the per-contract keys (`row.*`, `group.*`) apply. */
|
|
168
|
+
export interface WordsContext {
|
|
169
|
+
/** True when every claim cites the same `contract_ref` (contract-report/v1 §3). */
|
|
170
|
+
readonly singleContract: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The words over `defaults`, with `supplied`'s entries in place of the
|
|
174
|
+
* defaults' where it has them. `context` defaults closed
|
|
175
|
+
* (`singleContract: false`): a caller that has not checked
|
|
176
|
+
* `citesOneContract` itself gets raw identifiers for `row`/`group`, never a
|
|
177
|
+
* guess that a multi-contract Result is safe to label per-contract.
|
|
178
|
+
*/
|
|
179
|
+
export declare function wordsOf(defaults: WordingPack, supplied?: {
|
|
180
|
+
readonly pack: WordingPack;
|
|
181
|
+
readonly sha256?: string;
|
|
182
|
+
}, context?: WordsContext, refused?: WordingSource["refused"]): Words;
|
|
183
|
+
/**
|
|
184
|
+
* The words for a card laid out as `grouping`: the default pack, with the
|
|
185
|
+
* host's pack over it entry by entry once it checks against its digest and
|
|
186
|
+
* fits this module (contract-report/v1 §3 layering). A host layer that does
|
|
187
|
+
* not check is refused and contributes no words: the card is drawn with the
|
|
188
|
+
* default layer alone, and `source.refused` says why, so the page says so.
|
|
189
|
+
* A builder that must refuse to write such a page (§3 allows it) checks the
|
|
190
|
+
* pack itself first (`presentation-builder.ts` `checkWordingFits`), before
|
|
191
|
+
* this function ever runs.
|
|
192
|
+
*/
|
|
193
|
+
export declare function contractReportWords(grouping: ContractReportGrouping, wording?: WordingPackInput, context?: WordsContext): Promise<Words>;
|
|
194
|
+
/** The default words of one grouping, for the shared parts' callers that are handed none. */
|
|
195
|
+
export declare const DEFAULT_WORDS: Readonly<Record<ContractReportGrouping, Words>>;
|