@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.
Files changed (102) hide show
  1. package/README.md +74 -2
  2. package/dist/alias-interpreters.d.ts +18 -0
  3. package/dist/alias-interpreters.js +50 -0
  4. package/dist/alias-interpreters.js.map +1 -0
  5. package/dist/browser.d.ts +5 -2
  6. package/dist/browser.js +19 -5
  7. package/dist/browser.js.map +1 -1
  8. package/dist/builtin-manifests.d.ts +51 -0
  9. package/dist/builtin-manifests.js +196 -0
  10. package/dist/builtin-manifests.js.map +1 -0
  11. package/dist/chart-dataset.d.ts +23 -0
  12. package/dist/chart-dataset.js +191 -0
  13. package/dist/chart-dataset.js.map +1 -0
  14. package/dist/chart-spec.d.ts +130 -0
  15. package/dist/chart-spec.js +638 -0
  16. package/dist/chart-spec.js.map +1 -0
  17. package/dist/chart-view.d.ts +27 -0
  18. package/dist/chart-view.js +374 -0
  19. package/dist/chart-view.js.map +1 -0
  20. package/dist/compliance-styles.d.ts +1 -8
  21. package/dist/compliance-styles.js +40 -3
  22. package/dist/compliance-styles.js.map +1 -1
  23. package/dist/compliance-view.d.ts +41 -1
  24. package/dist/compliance-view.js +773 -303
  25. package/dist/compliance-view.js.map +1 -1
  26. package/dist/compliance.d.ts +33 -4
  27. package/dist/compliance.js +92 -13
  28. package/dist/compliance.js.map +1 -1
  29. package/dist/composed-styles.d.ts +12 -0
  30. package/dist/composed-styles.js +20 -0
  31. package/dist/composed-styles.js.map +1 -0
  32. package/dist/composed-view.d.ts +1 -1
  33. package/dist/composed-view.js +9 -2
  34. package/dist/composed-view.js.map +1 -1
  35. package/dist/contract-report-wording.d.ts +195 -0
  36. package/dist/contract-report-wording.js +1177 -0
  37. package/dist/contract-report-wording.js.map +1 -0
  38. package/dist/contract-report.d.ts +92 -0
  39. package/dist/contract-report.js +63 -0
  40. package/dist/contract-report.js.map +1 -0
  41. package/dist/core-strip.d.ts +38 -0
  42. package/dist/core-strip.js +183 -0
  43. package/dist/core-strip.js.map +1 -0
  44. package/dist/emitter-shell.html +181 -3
  45. package/dist/emitter.d.ts +36 -0
  46. package/dist/emitter.js +77 -4
  47. package/dist/emitter.js.map +1 -1
  48. package/dist/evidence-graph-view.d.ts +66 -7
  49. package/dist/evidence-graph-view.js +1483 -127
  50. package/dist/evidence-graph-view.js.map +1 -1
  51. package/dist/evidence-graph.iife.js +17741 -6812
  52. package/dist/frame-tokens.generated.d.ts +3 -0
  53. package/dist/frame-tokens.generated.js +5 -0
  54. package/dist/frame-tokens.generated.js.map +1 -0
  55. package/dist/index.d.ts +3 -0
  56. package/dist/index.js +5 -0
  57. package/dist/index.js.map +1 -1
  58. package/dist/outcome-report-presentation.d.ts +48 -0
  59. package/dist/outcome-report-presentation.js +90 -0
  60. package/dist/outcome-report-presentation.js.map +1 -0
  61. package/dist/outcome-report-styles.d.ts +1 -16
  62. package/dist/outcome-report-styles.js +48 -45
  63. package/dist/outcome-report-styles.js.map +1 -1
  64. package/dist/outcome-report-view.d.ts +75 -2
  65. package/dist/outcome-report-view.js +1063 -436
  66. package/dist/outcome-report-view.js.map +1 -1
  67. package/dist/presentation-builder.d.ts +70 -6
  68. package/dist/presentation-builder.js +198 -70
  69. package/dist/presentation-builder.js.map +1 -1
  70. package/dist/presentation-fragment.d.ts +129 -0
  71. package/dist/presentation-fragment.js +213 -0
  72. package/dist/presentation-fragment.js.map +1 -0
  73. package/dist/presentation-mount.d.ts +4 -2
  74. package/dist/presentation-mount.js +2 -1
  75. package/dist/presentation-mount.js.map +1 -1
  76. package/dist/presentation-registry.d.ts +277 -0
  77. package/dist/presentation-registry.js +416 -0
  78. package/dist/presentation-registry.js.map +1 -0
  79. package/dist/record-content.d.ts +68 -0
  80. package/dist/record-content.js +153 -0
  81. package/dist/record-content.js.map +1 -0
  82. package/dist/record-dating.d.ts +10 -0
  83. package/dist/record-dating.js +76 -0
  84. package/dist/record-dating.js.map +1 -0
  85. package/dist/report-front-styles.d.ts +9 -0
  86. package/dist/report-front-styles.js +43 -0
  87. package/dist/report-front-styles.js.map +1 -0
  88. package/dist/report-front.d.ts +56 -0
  89. package/dist/report-front.js +140 -0
  90. package/dist/report-front.js.map +1 -0
  91. package/dist/report-levels.d.ts +238 -0
  92. package/dist/report-levels.js +874 -0
  93. package/dist/report-levels.js.map +1 -0
  94. package/dist/report-provenance.d.ts +111 -0
  95. package/dist/report-provenance.js +535 -0
  96. package/dist/report-provenance.js.map +1 -0
  97. package/dist/viewer-build.d.ts +37 -0
  98. package/dist/viewer-build.js +29 -0
  99. package/dist/viewer-build.js.map +1 -0
  100. package/dist/wording/contract-report-eu-ai-act.en.json +319 -0
  101. package/dist/wording/contract-report-outcomes.en.json +418 -0
  102. package/package.json +6 -3
@@ -0,0 +1,238 @@
1
+ import { type ConversationTranscript, type ReportState, type ResultClaim, type ResultRoot } from "@action-state-group/agent-action-capsule";
2
+ import type { Words } from "./contract-report-wording.js";
3
+ /**
4
+ * A level-1 or level-2 toggle. `summary` is what the closed toggle says;
5
+ * `build` makes the body on first open (or at once with `eager`).
6
+ */
7
+ export declare function levelToggle(level: 1 | 2, summary: string | HTMLElement, build: () => Node, options?: {
8
+ className?: string;
9
+ eager?: boolean;
10
+ }): HTMLDetailsElement;
11
+ /**
12
+ * A <details> whose body is built the first time it opens, or at once with
13
+ * `eager`, into the toggle itself or into `into` (a table row's detail cell). Until then it is marked `data-body="pending"`, and
14
+ * `fillPendingBodies` can build it without opening it.
15
+ */
16
+ export declare function deferBody(details: HTMLDetailsElement, build: () => Node, eager?: boolean, into?: HTMLElement): void;
17
+ /**
18
+ * Builds every body under `root` that `selector` names and is still
19
+ * pending -- toggle bodies and conversation bodies alike, and the ones those
20
+ * bodies bring -- leaving every toggle open or closed as it was. The static
21
+ * package builds every body this way (`fillForNoScript`), so a toggle a
22
+ * reader opens on a page that runs no script is not empty. Returns how
23
+ * many bodies it built.
24
+ */
25
+ export declare function fillPendingBodies(root: ParentNode, selector?: string): number;
26
+ /**
27
+ * For a page that runs no script (the static package,
28
+ * presentation-builder.ts): builds every body still pending under `root`,
29
+ * and the ones those bodies bring, so opening any toggle shows what it
30
+ * shows where script runs (capsule-viewer#67). Each conversation is kept
31
+ * once, in the core's records section: a card's conversation becomes a
32
+ * link to it (`linkConversations`), including the conversations a body
33
+ * brings when it is built. Every toggle stays open or closed as it was,
34
+ * except where the host opened a region to L2, as on the scripted page.
35
+ * Returns how many bodies it built; a body with no fill registered here
36
+ * stays pending, for the caller to report.
37
+ */
38
+ export declare function fillForNoScript(root: ParentNode): number;
39
+ /**
40
+ * The one nesting rule for every report page (SEAMS ruling 11): a level-2
41
+ * toggle may sit inside a level-1 toggle, and nothing deeper. Returns every
42
+ * breach in `root`, by the summary text of the offending toggle: a toggle
43
+ * inside two others, a level-1 toggle inside another toggle, or a level-2
44
+ * toggle inside anything but a level-1 toggle (another level 2, say).
45
+ * Empty when the page keeps the rule. Run it over a page with every toggle
46
+ * opened, so lazily built bodies are counted.
47
+ */
48
+ export declare function nestingProblems(root: ParentNode): string[];
49
+ /**
50
+ * At depth L2 everything is open (presentation contract section 9.1),
51
+ * including the toggles a body holds when it is built after the page was
52
+ * drawn: inside a region the host opened to L2 (`data-open-all`), a newly
53
+ * built body's toggles open too.
54
+ */
55
+ export declare function openBuiltToDepth(body: HTMLElement): void;
56
+ /** Opens a toggle and builds its body now (tests, print). */
57
+ export declare function openToggle(details: HTMLDetailsElement): void;
58
+ /**
59
+ * A conversation's body inside an open level-1 toggle, in place (never a
60
+ * toggle). Built when it comes within a screen or so of the view; where the
61
+ * browser has no IntersectionObserver it is built at once. `beforeprint`
62
+ * builds every pending body so a printed page is whole.
63
+ */
64
+ export declare function lazyBody(host: HTMLElement, build: () => Node): void;
65
+ /**
66
+ * Result words never come from the bundle: presentation contract section 6
67
+ * forbids a bundle-carried setting from choosing wording. They come from the
68
+ * card's wording pack (contract-report-wording.ts), which ships with the
69
+ * viewer. The default packs speak the plain set (met, not met, did not
70
+ * apply, could not decide); a pack may speak the grade ladder (established,
71
+ * failed, not present, inconclusive, not checked) instead, and so tell the
72
+ * three undecided cases apart.
73
+ */
74
+ export type RuleVerdict = "met" | "not_met" | "not_evaluable" | "failed" | "unsupported" | "not_applicable" | "out_of_scope" | "not_yet_in_force";
75
+ export type Tone = "ok" | "bad" | "na" | "ne";
76
+ export interface Worded {
77
+ readonly word: string;
78
+ readonly tone: Tone;
79
+ }
80
+ /**
81
+ * Whether a judge ran on one rule, as far as the bundle shows: `yes` when
82
+ * its disclosed report states a judge pin, `no` when the disclosed report
83
+ * states none, `withheld` when the bundle withholds the report, `unknown`
84
+ * when the report is supplied but does not match what was sealed, cannot be
85
+ * read or does not check out, or is not carried at all. In every case but
86
+ * `yes` and `no` the bundle cannot say.
87
+ */
88
+ export type Judged = "yes" | "no" | "withheld" | "unknown";
89
+ export declare function judgedOf(reportState: ReportState | undefined, judgePinDigest: string | undefined): Judged;
90
+ /**
91
+ * One rule's result in words, from the card's own grouping prefix
92
+ * (`lines.verdict.*` or `groups.verdict.*`: the bare `verdict.*` namespace
93
+ * stays contract-report/v1 §3's). `judged` picks among the pack's four
94
+ * words for a rule nobody could decide: a judge ran and could not decide
95
+ * (`.not_evaluable.judged`), none ran (`.unjudged`), the bundle
96
+ * withholds the report that would say which (`.withheld`), or a judge's
97
+ * report is cited but this bundle does not carry a readable copy of it --
98
+ * mismatched, unreadable, invalid, or simply not carried (`.unavailable`),
99
+ * never `.withheld`, which would claim more than those states show. A
100
+ * failed or unsupported claim failed verification, or its evidence is
101
+ * missing; it is never "not checked".
102
+ */
103
+ export declare function ruleWord(verdict: RuleVerdict, judged: Judged, w: Words): Worded;
104
+ /**
105
+ * The judge's note in plain words. A sealed rationale that is the judge
106
+ * backend's own synthesized line ("jev choice: not_met (probabilities={...},
107
+ * confidence=...)") reads "The judge was 78% sure." (`judge.note.sure`); any
108
+ * other rationale (a recomputed check's own explanation) is shown as sealed.
109
+ * Display only: the proofs always carry the rationale exactly as sealed.
110
+ */
111
+ export declare function judgeNote(rationale: string, verdict: string, w: Words): string;
112
+ export declare function wordPill(worded: Worded, key: string): HTMLElement;
113
+ /**
114
+ * `tau2:airline:<model>:task-20:trial-1` reads "task 20, trial 1" with the
115
+ * model beside it; the older `tau2:airline:task-20:trial-0` reads "task 20,
116
+ * trial 0"; any other id is shown whole.
117
+ */
118
+ export declare function caseParts(conversationId: string, w: Words): {
119
+ label: string;
120
+ model?: string;
121
+ };
122
+ /**
123
+ * A sealed tool result, shown verbatim. It is indented for
124
+ * reading only when doing so changes nothing but whitespace: JSON.parse then
125
+ * JSON.stringify must give back exactly the original once whitespace outside
126
+ * strings is set aside. A number JSON cannot hold exactly
127
+ * (`{"id":12345678901234567890}`), a duplicate key, an escape written
128
+ * differently: any of these, and the original text is shown as it is.
129
+ */
130
+ export declare function exactText(text: string): {
131
+ text: string;
132
+ indented: boolean;
133
+ };
134
+ /**
135
+ * The conversation as a chat: who said what, and each tool the agent called
136
+ * with its arguments. The words come from the transcript the caller has
137
+ * already tied to the judged case by digest (`verified`), or to the case
138
+ * every claim cites when the reports are withheld (`cited`, said as such);
139
+ * nothing is reworded. Returns the "not in this bundle" note otherwise.
140
+ */
141
+ export declare function renderChat(transcript: ConversationTranscript, caseRecord: string | undefined, w: Words): HTMLElement;
142
+ /**
143
+ * The turns of a conversation as a chat, and nothing else: who said what,
144
+ * each tool call with its arguments, each tool result as sealed. It states
145
+ * nothing about where the turns came from or what was checked; its caller
146
+ * does (renderChat for a card, the core's record entry for a record).
147
+ */
148
+ export declare function renderTurns(turns: NonNullable<ConversationTranscript["turns"]>, w: Words): HTMLElement;
149
+ /** The address of a record in the core's records section (evidence-graph-view.ts). */
150
+ export declare function recordAddress(recordId: string): string;
151
+ /** The address of a number on the page, beside `recordAddress`: the core's "Cited by" links point here. */
152
+ export declare function numberAddress(key: string): string;
153
+ /**
154
+ * Show evidence for one number: what a count counts, as records.
155
+ * `counted` holds one entry per thing the number counts: the claim behind
156
+ * it, or undefined where the page counted it with no claim (a conversation
157
+ * no claim judged on this rule). Every cited digest comes from the claims'
158
+ * own `evidence[]` as agent-action-capsule's Result reader resolved it; this
159
+ * page infers no citation.
160
+ *
161
+ * - A number that counts nothing draws nothing: there is nothing to show.
162
+ * - A number whose claims cite at least one record in this bundle draws a
163
+ * `<details>` at the number's address (`numberAddress`): "Show evidence"
164
+ * (or `summary`, where one cell holds more than one number), and under it the cited records, each a link to its entry in the core's
165
+ * records section, then each cited digest the bundle does not carry, said
166
+ * so, how many were counted from a claim that cites nothing, and how many
167
+ * with no claim. The list is built at once,
168
+ * so a page that runs no script (the static package) carries it as it is.
169
+ * Where a host loaded the Show-evidence component, opening the toggle also
170
+ * draws each claim side by side under the list.
171
+ * - A number with no record to show draws a label instead: "unsupported"
172
+ * when it counts claims whose evidence is not disclosed in this bundle, or
173
+ * that cite none,
174
+ * "interpretation" when no claim stands behind it at all.
175
+ *
176
+ * The toggle counts as level 2 (the proofs' level) and holds no other
177
+ * toggle. It is not an `lv` toggle, so depth L1 leaves it closed; depth L2
178
+ * opens it with everything else (report-front.ts `applyDepth`). The core's "Cited by"
179
+ * lists (evidence-graph-view.ts) read `data-cites` and `data-evidence-name`
180
+ * back from it.
181
+ */
182
+ export declare function evidenceAction(key: string, name: string, counted: readonly (ResultClaim | undefined)[], result: ResultRoot, w: Words, summary?: string): HTMLElement | undefined;
183
+ /**
184
+ * A conversation in place in its card: a level-2 toggle whose body is the
185
+ * chat, built when it opens, with a close control and a link to the record
186
+ * in the core's records section above and below it. The in-place copy
187
+ * carries no address; only the records section's entry does.
188
+ *
189
+ * Beside the toggle sits the same link worded for a page that runs no
190
+ * script, hidden: the static package (presentation-builder.ts) keeps one
191
+ * copy of each conversation, in the records section, and swaps the toggle
192
+ * for that link when the record is there (`linkConversations`).
193
+ */
194
+ export declare function conversationFold(transcript: ConversationTranscript, caseRecord: string | undefined, w: Words): HTMLElement;
195
+ /**
196
+ * Opens a record's entry in the core's records section, and every toggle
197
+ * around it, so the link's target is in view when the browser scrolls to
198
+ * it. A browser that opens a closed <details> for a fragment does the same
199
+ * on a page that runs no script.
200
+ */
201
+ export declare function revealRecord(from: Node, recordId: string): void;
202
+ /**
203
+ * Where script runs: a page opened at a record's address (`#record-<id>`),
204
+ * or whose address changes to one, opens that record's entry and every
205
+ * fold around it, as a link to it does (`revealRecord`). One listener per
206
+ * document.
207
+ */
208
+ export declare function revealRecordsByHash(doc: Document): void;
209
+ /**
210
+ * For a page that runs no script: every in-place conversation whose record
211
+ * the core's records section holds becomes a link to it, so the page keeps
212
+ * one copy of each conversation however many cards cite it, built or not.
213
+ * A conversation whose record is not there (none is stated, or its
214
+ * transcript is absent or does not check) keeps its toggle and its state
215
+ * note. Returns how many it linked.
216
+ */
217
+ export declare function linkConversations(root: ParentNode): number;
218
+ /**
219
+ * The pack's `report.summary` line under the card's title, or nothing: the
220
+ * module has no summary of its own, so a pack that sets none shows none.
221
+ */
222
+ export declare function reportSummary(w: Words): HTMLElement | undefined;
223
+ /**
224
+ * One claim's assurance, as sealed on it (contract-report/v1 section 2:
225
+ * assurance stays on the claim): its tier, grade, sufficiency and carrier
226
+ * status, each in the layered section 3 word, or its raw value when no layer
227
+ * has one. The raw values ride on the element as data.
228
+ */
229
+ export declare function assuranceRow(claim: ResultClaim, w: Words): [string, string, Record<string, string>];
230
+ /**
231
+ * A wording layer the host supplied was refused (contract-report/v1 section
232
+ * 3): one line at the top of the card, so a reader never takes the default
233
+ * words for the ones the page was built to show.
234
+ */
235
+ export declare function refusedWordingNotice(w: Words): HTMLElement | undefined;
236
+ export declare function proofList(rows: readonly (readonly [string, string] | readonly [string, string, Readonly<Record<string, string>>])[]): HTMLElement;
237
+ /** The toggles', chat's and proofs' styles, scoped under the card's class. */
238
+ export declare function levelCss(scope: string): string;