@action-state-group/capsule-viewer 0.1.0 → 0.4.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 +74 -2
- 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 +5 -2
- package/dist/browser.js +19 -5
- package/dist/browser.js.map +1 -1
- 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/chart-dataset.d.ts +23 -0
- package/dist/chart-dataset.js +191 -0
- package/dist/chart-dataset.js.map +1 -0
- package/dist/chart-spec.d.ts +130 -0
- package/dist/chart-spec.js +638 -0
- package/dist/chart-spec.js.map +1 -0
- package/dist/chart-view.d.ts +27 -0
- package/dist/chart-view.js +374 -0
- package/dist/chart-view.js.map +1 -0
- package/dist/compliance-styles.d.ts +1 -8
- package/dist/compliance-styles.js +40 -3
- package/dist/compliance-styles.js.map +1 -1
- package/dist/compliance-view.d.ts +41 -1
- package/dist/compliance-view.js +773 -303
- package/dist/compliance-view.js.map +1 -1
- package/dist/compliance.d.ts +33 -4
- package/dist/compliance.js +92 -13
- package/dist/compliance.js.map +1 -1
- 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 +1 -1
- package/dist/composed-view.js +9 -2
- package/dist/composed-view.js.map +1 -1
- package/dist/contract-report-wording.d.ts +195 -0
- package/dist/contract-report-wording.js +1177 -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/core-strip.d.ts +38 -0
- package/dist/core-strip.js +183 -0
- package/dist/core-strip.js.map +1 -0
- package/dist/emitter-shell.html +181 -3
- package/dist/emitter.d.ts +36 -0
- package/dist/emitter.js +77 -4
- package/dist/emitter.js.map +1 -1
- package/dist/evidence-graph-view.d.ts +66 -7
- package/dist/evidence-graph-view.js +1483 -127
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +17741 -6812
- 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 +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- 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 -16
- package/dist/outcome-report-styles.js +48 -45
- package/dist/outcome-report-styles.js.map +1 -1
- package/dist/outcome-report-view.d.ts +75 -2
- package/dist/outcome-report-view.js +1063 -436
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/presentation-builder.d.ts +70 -6
- package/dist/presentation-builder.js +198 -70
- package/dist/presentation-builder.js.map +1 -1
- 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 +4 -2
- package/dist/presentation-mount.js +2 -1
- package/dist/presentation-mount.js.map +1 -1
- 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 +43 -0
- package/dist/report-front-styles.js.map +1 -0
- package/dist/report-front.d.ts +56 -0
- package/dist/report-front.js +140 -0
- package/dist/report-front.js.map +1 -0
- package/dist/report-levels.d.ts +238 -0
- package/dist/report-levels.js +874 -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 +319 -0
- package/dist/wording/contract-report-outcomes.en.json +418 -0
- package/package.json +6 -3
|
@@ -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>>;
|