@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,153 @@
1
+ import { renderTurns } from "./report-levels.js";
2
+ const isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
3
+ /**
4
+ * JSON text of the value with every object's members in canonical order
5
+ * (RFC 8785 JCS: by key, compared as UTF-16 code units), indented by
6
+ * `indent` spaces when given. A record commits to its content's canonical
7
+ * form, and the same content reaches the page with its members in a
8
+ * different order depending on how the bundle was packaged; drawing the
9
+ * canonical order shows every packaging the same text, in the order that
10
+ * was sealed.
11
+ *
12
+ * Written out here rather than by re-ordering an object for JSON.stringify:
13
+ * an object puts integer-like keys ("9", "10") first in numeric order
14
+ * whatever order they are added in, and assigning a member named
15
+ * `__proto__` would set the object's prototype instead of keeping the
16
+ * member. Strings and numbers are written by JSON.stringify, so a number
17
+ * JSON cannot hold exactly was already rounded when the payload was parsed.
18
+ */
19
+ export function canonicalJson(value, indent) {
20
+ const pad = indent === undefined ? "" : " ".repeat(indent);
21
+ const write = (v, depth) => {
22
+ const open = pad === "" ? "" : `\n${pad.repeat(depth + 1)}`;
23
+ const close = pad === "" ? "" : `\n${pad.repeat(depth)}`;
24
+ const colon = pad === "" ? ":" : ": ";
25
+ if (Array.isArray(v))
26
+ return v.length === 0
27
+ ? "[]"
28
+ : `[${v.map((item) => open + write(item, depth + 1)).join(",")}${close}]`;
29
+ if (isObject(v)) {
30
+ const keys = Object.keys(v).sort(byCodeUnits);
31
+ return keys.length === 0
32
+ ? "{}"
33
+ : `{${keys
34
+ .map((key) => `${open}${JSON.stringify(key)}${colon}${write(v[key], depth + 1)}`)
35
+ .join(",")}${close}}`;
36
+ }
37
+ return JSON.stringify(v) ?? "null";
38
+ };
39
+ return write(value, 0);
40
+ }
41
+ /** Orders strings by UTF-16 code units, as JCS does. */
42
+ function byCodeUnits(a, b) {
43
+ return a < b ? -1 : a > b ? 1 : 0;
44
+ }
45
+ /**
46
+ * The turns of a conversation payload, or undefined when the content is not
47
+ * one. Mirrors agent-action-capsule `ts/src/outcome-report.ts`
48
+ * `transcriptTurns` (0.6.0), which that package does not export: an
49
+ * `agent_interaction.messages` array, each message's `role`, `content` and
50
+ * `tool_calls`, the call arguments re-serialised (there with JSON.stringify,
51
+ * here in canonical member order). Keep the two in step.
52
+ */
53
+ export function conversationTurns(content) {
54
+ if (!isObject(content))
55
+ return undefined;
56
+ const interaction = isObject(content.agent_interaction)
57
+ ? content.agent_interaction
58
+ : undefined;
59
+ if (interaction === undefined || !Array.isArray(interaction.messages))
60
+ return undefined;
61
+ return interaction.messages.flatMap((m) => {
62
+ if (!isObject(m))
63
+ return [];
64
+ const role = typeof m.role === "string" ? m.role : "unknown";
65
+ const text = typeof m.content === "string" ? m.content : undefined;
66
+ const calls = Array.isArray(m.tool_calls) ? m.tool_calls : [];
67
+ return [
68
+ {
69
+ role,
70
+ ...(text === undefined ? {} : { content: text }),
71
+ toolCalls: calls.flatMap((call) => isObject(call)
72
+ ? [
73
+ {
74
+ name: typeof call.name === "string" ? call.name : "unnamed",
75
+ // Re-serialised as there, but in canonical member order,
76
+ // so every packaging shows the same text.
77
+ arguments: canonicalJson(call.arguments ?? null),
78
+ },
79
+ ]
80
+ : []),
81
+ },
82
+ ];
83
+ });
84
+ }
85
+ /** A conversation, drawn as a chat (renderChat): who said what, each tool call and its result. */
86
+ export const conversationModule = {
87
+ id: "conversation",
88
+ matches: (content) => conversationTurns(content) !== undefined,
89
+ // Content only: what was checked is the core's to say, beside the block
90
+ // (presentation contract section 6.1).
91
+ render(content, w) {
92
+ const wrap = document.createElement("div");
93
+ wrap.className = "chat";
94
+ wrap.append(renderTurns(conversationTurns(content) ?? [], w));
95
+ return wrap;
96
+ },
97
+ };
98
+ /** The content modules the core picks from, in order. */
99
+ export const CONTENT_MODULES = [conversationModule];
100
+ /** The first module that takes this content, or undefined. */
101
+ export function pickContentModule(content, modules = CONTENT_MODULES) {
102
+ return modules.find((module) => module.matches(content));
103
+ }
104
+ /**
105
+ * Disclosed content in its content block: by its module when one takes it,
106
+ * otherwise as recorded: the verifier's parsed payload in canonical member
107
+ * order, indented. Indenting adds whitespace only; a number JSON cannot
108
+ * hold exactly was already rounded when the payload was parsed.
109
+ */
110
+ export function renderContent(content, w, modules = CONTENT_MODULES) {
111
+ const block = document.createElement("div");
112
+ block.className = "cv-content";
113
+ const module = pickContentModule(content, modules);
114
+ if (module !== undefined) {
115
+ block.dataset.contentModule = module.id;
116
+ block.append(module.render(content, w));
117
+ return block;
118
+ }
119
+ block.dataset.contentModule = "as-recorded";
120
+ const pre = document.createElement("pre");
121
+ let text;
122
+ try {
123
+ text = canonicalJson(content, 2);
124
+ }
125
+ catch {
126
+ text = String(content);
127
+ }
128
+ pre.textContent = text;
129
+ pre.dataset.exact = "as-parsed";
130
+ block.append(pre);
131
+ return block;
132
+ }
133
+ /**
134
+ * The content block's own stylesheet, scoped to `.cv-content`: the records
135
+ * section is the core's, drawn on every page, inside no module's frame, so
136
+ * a chat or a JSON value there cannot lean on a module's styles. Inserted
137
+ * once per page by the core (evidence-graph-view.ts) and listed in
138
+ * CORE_RUNTIME_STYLES, so the CSP carries its hash.
139
+ */
140
+ export const RECORD_CONTENT_CSS = `
141
+ .cv-content pre{margin:4px 0;white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,Menlo,monospace;font-size:12px;max-height:420px;overflow:auto}
142
+ .cv-content .chat .chat-k{font-size:12.5px;margin:4px 0 6px}
143
+ .cv-content .chat ol.turns{list-style:none;margin:0;padding:10px;display:grid;gap:6px;max-height:620px;overflow:auto;border:1px solid #E3DED3;border-radius:10px;background:#FAF8F4}
144
+ .cv-content .chat li.turn{border-radius:10px;padding:6px 10px;max-width:86%;background:#fff;border:1px solid #E3DED3;font-size:13.5px}
145
+ .cv-content .chat li.turn.user{justify-self:end;background:#ECE8F7;border-color:transparent}
146
+ .cv-content .chat li.turn.assistant{justify-self:start}
147
+ .cv-content .chat li.turn.tool,.cv-content .chat li.turn.system{justify-self:center;max-width:96%;border-style:dashed}
148
+ .cv-content .chat li.turn .who{font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;margin-bottom:2px}
149
+ .cv-content .chat li.turn .say{white-space:pre-wrap;word-break:break-word}
150
+ .cv-content .chat li.turn pre.say{margin:0;font-size:11.5px;max-height:180px}
151
+ .cv-content .chat .call{margin-top:4px;font-size:12.5px;background:#FBEFD9;border-radius:6px;padding:3px 8px;word-break:break-word}
152
+ `;
153
+ //# sourceMappingURL=record-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-content.js","sourceRoot":"","sources":["../src/record-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAsBjD,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;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,MAAe;IAC3D,MAAM,GAAG,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC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;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;CAYjC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type CitedRecord, type ConversationDate, type OutcomeReportDating, type ResultClaim, type ResultRoot } from "@action-state-group/agent-action-capsule";
2
+ /** The case record the reports name, when this bundle cites it and its capsule checks out. */
3
+ export declare function caseRecord(result: ResultRoot, claims: readonly ResultClaim[], sourceCapsuleId: string | undefined): CitedRecord | undefined;
4
+ /** See `ConversationDate`: source (backfilled), record (own timestamp), else the judged day. */
5
+ export declare function conversationDate(record: CitedRecord | undefined, judgedDay: string): ConversationDate;
6
+ /** How a set of dated conversations is dated as a whole. */
7
+ export declare function buildDating(conversations: readonly {
8
+ readonly dated: ConversationDate;
9
+ readonly judgedDay: string;
10
+ }[]): OutcomeReportDating;
@@ -0,0 +1,76 @@
1
+ // SPDX-License-Identifier: BSD-3-Clause
2
+ import { asString, zoneStatement, } from "@action-state-group/agent-action-capsule";
3
+ // The outcome card's record-dating rule (agent-action-capsule
4
+ // ts/src/outcome-report.ts: caseRecord, conversationDate, buildDating),
5
+ // repeated here so the obligations card dates a session the same way.
6
+ // Copied from ts/v0.5.0, where the three are identical to these. Neither
7
+ // the published 0.5.0 package nor agent-action-capsule's main exports them
8
+ // (checked 2026-10-21), and no agent-action-capsule issue tracks exporting
9
+ // them yet: this file tracks that export, listed as a follow-up on this
10
+ // pull request. Once a release exports them, import them instead and
11
+ // delete this file.
12
+ const STATED_DAY = /^(\d{4}-\d{2}-\d{2})/u;
13
+ /** The case record the reports name, when this bundle cites it and its capsule checks out. */
14
+ export function caseRecord(result, claims, sourceCapsuleId) {
15
+ if (sourceCapsuleId === undefined)
16
+ return undefined;
17
+ for (const claim of claims)
18
+ for (const ref of claim.evidence) {
19
+ const record = result.records.get(ref.digest);
20
+ if (record === undefined || record.stated === undefined)
21
+ continue;
22
+ if (record.carriedCapsuleId === sourceCapsuleId ||
23
+ (record.carriedCapsuleId === undefined &&
24
+ record.bookRecordId === undefined &&
25
+ record.capsuleId === sourceCapsuleId))
26
+ return record;
27
+ }
28
+ return undefined;
29
+ }
30
+ /** See `ConversationDate`: source (backfilled), record (own timestamp), else the judged day. */
31
+ export function conversationDate(record, judgedDay) {
32
+ const judged = { basis: "judged", date: judgedDay };
33
+ const stated = record?.stated;
34
+ if (stated === undefined)
35
+ return judged;
36
+ const mode = stated.provenanceMode;
37
+ if (asString(mode?.mode) === "backfilled") {
38
+ const source = asString(mode?.source_asserted_at);
39
+ const day = source === undefined ? undefined : STATED_DAY.exec(source)?.[1];
40
+ if (source === undefined || day === undefined)
41
+ return judged;
42
+ const importedAt = asString(mode?.imported_at);
43
+ return {
44
+ basis: "source",
45
+ date: day,
46
+ stated: source,
47
+ zone: zoneStatement(source),
48
+ ...(importedAt === undefined ? {} : { importedAt }),
49
+ };
50
+ }
51
+ const timestamp = stated.timestamp;
52
+ const day = timestamp === undefined ? undefined : STATED_DAY.exec(timestamp)?.[1];
53
+ if (timestamp === undefined || day === undefined)
54
+ return judged;
55
+ return {
56
+ basis: "record",
57
+ date: day,
58
+ stated: timestamp,
59
+ zone: zoneStatement(timestamp),
60
+ };
61
+ }
62
+ /** How a set of dated conversations is dated as a whole. */
63
+ export function buildDating(conversations) {
64
+ const counts = { source: 0, record: 0, judged: 0 };
65
+ for (const c of conversations)
66
+ counts[c.dated.basis] += 1;
67
+ const used = Object.keys(counts).filter((basis) => counts[basis] > 0);
68
+ return {
69
+ basis: used.length === 1 ? used[0] : used.length === 0 ? "judged" : "mixed",
70
+ counts,
71
+ judgedDays: [...new Set(conversations.map((c) => c.judgedDay))].sort(),
72
+ zoneNotStated: conversations.filter((c) => c.dated.zone === "not-stated")
73
+ .length,
74
+ };
75
+ }
76
+ //# sourceMappingURL=record-dating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-dating.js","sourceRoot":"","sources":["../src/record-dating.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EACL,QAAQ,EACR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,IAAI,aAAa;QAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAiC,CAAC,MAAM,CACtE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAC7B,CAAC;IACF,OAAO;QACL,KAAK,EACH,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;QACvE,MAAM;QACN,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;QACtE,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC;aACtE,MAAM;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Styles for the pieces report-front.ts draws (the footnotes, the folded
3
+ * provenance line, rows that
4
+ * open, "Check this report yourself", the provenance row that opens
5
+ * L1, and the card that holds it when no section does), scoped under a grouping's frame class (`.oi` for
6
+ * Outcomes, `.cc` for the EU AI Act). Each frame's stylesheet appends this,
7
+ * so the CSP hashes of the frame stylesheets cover it.
8
+ */
9
+ export declare function frontCss(scope: string): string;
@@ -0,0 +1,43 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Styles for the pieces report-front.ts draws (the footnotes, the folded
4
+ * provenance line, rows that
5
+ * open, "Check this report yourself", the provenance row that opens
6
+ * L1, and the card that holds it when no section does), scoped under a grouping's frame class (`.oi` for
7
+ * Outcomes, `.cc` for the EU AI Act). Each frame's stylesheet appends this,
8
+ * so the CSP hashes of the frame stylesheets cover it.
9
+ */
10
+ export function frontCss(scope) {
11
+ const s = scope;
12
+ return `
13
+ ${s}{--inset:clamp(20px,5vw,56px)}
14
+ ${s} .front-card{background:#fff;max-width:1080px;margin:0 auto 16px;border:1px solid var(--line);border-radius:var(--r);padding:32px var(--inset)}
15
+ ${s} .prov-row{padding-bottom:16px;margin-bottom:12px;border-bottom:1px solid var(--line)}
16
+ ${s} .front-card > .prov-row:last-child{padding-bottom:0;margin-bottom:0;border-bottom:0}
17
+ ${s} .findings{border:1px solid var(--line);border-left:4px solid var(--gold,#E8A33D);background:#FFFBF2;border-radius:var(--r);padding:32px calc(var(--inset) - 3px);margin:0 0 16px}
18
+ ${s} .findings h2{font-size:19px;margin:4px 0 10px}
19
+ ${s} .plabel{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#8A5A0B}
20
+ ${s} .footnotes{margin:22px 0 0;font-size:12.5px;color:var(--slate);display:grid;gap:4px}
21
+ ${s} details.prov-fold{border:0;margin:0;background:transparent}
22
+ ${s} details.prov-fold > summary{padding:2px 0;font-weight:500;color:var(--ink)}
23
+ ${s} details.prov-fold .prov-brief{font-size:13.5px}
24
+ ${s} tr.x{cursor:pointer}
25
+ ${s} tr.x:hover > td{background:#FAF8F4}
26
+ ${s} tr.x-detail{display:none}
27
+ ${s} tr.x:has(details.rx[open]) + tr.x-detail{display:table-row}
28
+ ${s} tr.x-detail > td{padding:0 10px 12px;border-bottom:1px solid var(--line)}
29
+ ${s} details.rx{display:inline;border:0;margin:0;padding:0;background:transparent}
30
+ ${s} details.rx > summary{display:inline;padding:0;font-size:inherit;font-weight:inherit;color:inherit}
31
+ ${s} table tr.x td details.rx > summary > *{display:inline}
32
+ ${s} details.rx > summary:focus-visible{outline:2px solid var(--navy);outline-offset:2px;border-radius:3px}
33
+ ${s} .rule-na{font-size:12.5px;color:var(--slate);margin:4px 0 8px}
34
+ ${s} .check h2{font-size:19px;margin:0 0 10px}
35
+ ${s} .anchors{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}
36
+ ${s} .anchor{background:var(--cream);border-radius:8px;padding:8px 10px;font-size:12px;min-width:0}
37
+ ${s} .anchor .k{display:block;color:var(--slate);margin-bottom:2px}
38
+ ${s} .anchor code{font-size:11px;word-break:break-all}
39
+ ${s} .check .steps{margin:12px 0 0;padding-left:20px;font-size:14px;line-height:1.6}
40
+ @media (max-width:640px){${s} .front-card{padding:24px var(--inset)}}
41
+ `;
42
+ }
43
+ //# sourceMappingURL=report-front-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-front-styles.js","sourceRoot":"","sources":["../src/report-front-styles.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,MAAM,CAAC,GAAG,KAAK,CAAC;IAChB,OAAO;EACP,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;EACD,CAAC;2BACwB,CAAC;CAC3B,CAAC;AACF,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The pieces of a contract report that every grouping shares, placed by the
3
+ * contract-report layout note (docs/design/contract-report-layout.md):
4
+ *
5
+ * - L0 opens with the core's strip (core-strip.ts): the mock-judge mark and
6
+ * the sealed aggregate are the core's, never a grouping's.
7
+ * - Rows that open in place (expandableRow).
8
+ * - L2, after the core's verification section: "Check this report
9
+ * yourself", the bundle's anchors and the steps to re-check them.
10
+ * - The host's depth applied to the module's own toggles (presentation
11
+ * contract section 9.1). The core's section is never touched here.
12
+ */
13
+ import type { Words } from "./contract-report-wording.js";
14
+ /** The three host regions a contract report writes into, and the host's depth. */
15
+ export interface ReportLevels {
16
+ readonly L0: HTMLElement;
17
+ readonly L1: HTMLElement;
18
+ readonly L2: HTMLElement;
19
+ readonly depth: "L0" | "L1" | "L2";
20
+ }
21
+ /**
22
+ * The folded provenance line opens L1: it becomes the first row of the
23
+ * section card that holds the report's rows, ruled off from them. Without
24
+ * that section it keeps a card of its own.
25
+ */
26
+ export declare function leadWithProvenance(host: HTMLElement, section: Element | null, provenance: HTMLElement): void;
27
+ /**
28
+ * "Check this report yourself": the bundle's own anchors (producer key,
29
+ * log, checkpoint root and size, record count) and the steps to re-check
30
+ * them. Module detail: it goes in L2 after the core's verification section,
31
+ * never in its place. The comparison step is drawn as a comparison only
32
+ * when the bundle carries a witness receipt; otherwise it says only that
33
+ * the bundle carries none, never that no outside checkpoint exists.
34
+ */
35
+ export declare function renderCheckYourself(bundle: unknown, w: Words): HTMLElement;
36
+ /**
37
+ * A table row that opens its full-width detail row, with no script needed:
38
+ * the row's name (the rule, test or obligation it opens) becomes the
39
+ * summary of a level-1 disclosure in its first cell, and the stylesheet
40
+ * shows the detail row while that disclosure is open. The row stays a
41
+ * table row and the disclosure takes its name from the row's own words.
42
+ * The detail's body is built when it first opens (or at once with
43
+ * `eager`); a click anywhere on the row opens it too. `key` names the
44
+ * detail row's id from what the row is, so every packaging of one bundle
45
+ * draws the same ids.
46
+ */
47
+ export declare function expandableRow(row: HTMLElement, name: HTMLElement, detail: HTMLElement, build: () => Node, key: string, eager?: boolean): HTMLDetailsElement;
48
+ /** A front card: the frame's centred white card, for blocks outside the sheet. */
49
+ export declare function frontCard(...children: HTMLElement[]): HTMLElement;
50
+ /**
51
+ * Open the module's own toggles to the host's depth (presentation contract
52
+ * section 9.1): at L0 none; at L1 the toggles in the L1 region; at L2 every
53
+ * toggle in every region, including the ones a toggle builds when it opens
54
+ * (see `openBuiltToDepth`). The core's section is the core's.
55
+ */
56
+ export declare function applyDepth(levels: ReportLevels): void;
@@ -0,0 +1,140 @@
1
+ import { deferBody, openToggle } from "./report-levels.js";
2
+ import { witnessEntries } from "./report-provenance.js";
3
+ function el(tag, className, text) {
4
+ const node = document.createElement(tag);
5
+ if (className !== "")
6
+ node.className = className;
7
+ if (text !== undefined)
8
+ node.textContent = text;
9
+ return node;
10
+ }
11
+ /**
12
+ * The folded provenance line opens L1: it becomes the first row of the
13
+ * section card that holds the report's rows, ruled off from them. Without
14
+ * that section it keeps a card of its own.
15
+ */
16
+ export function leadWithProvenance(host, section, provenance) {
17
+ const row = el("div", "prov-row");
18
+ row.append(provenance);
19
+ if (section === null)
20
+ host.prepend(frontCard(row));
21
+ else
22
+ section.prepend(row);
23
+ }
24
+ const fmt = (n) => n.toLocaleString("en-US");
25
+ function bundleObject(bundle) {
26
+ return typeof bundle === "object" && bundle !== null && !Array.isArray(bundle)
27
+ ? bundle
28
+ : {};
29
+ }
30
+ /**
31
+ * "Check this report yourself": the bundle's own anchors (producer key,
32
+ * log, checkpoint root and size, record count) and the steps to re-check
33
+ * them. Module detail: it goes in L2 after the core's verification section,
34
+ * never in its place. The comparison step is drawn as a comparison only
35
+ * when the bundle carries a witness receipt; otherwise it says only that
36
+ * the bundle carries none, never that no outside checkpoint exists.
37
+ */
38
+ export function renderCheckYourself(bundle, w) {
39
+ const b = bundleObject(bundle);
40
+ const section = el("section", "check front-card");
41
+ section.dataset.section = "check-yourself";
42
+ section.append(el("h2", "", w.t("front.check.h")));
43
+ const anchors = el("div", "anchors");
44
+ const cell = (label, value, key) => {
45
+ const box = el("div", "anchor");
46
+ box.dataset.anchor = key;
47
+ box.append(el("span", "k", label), el("code", "", value));
48
+ anchors.append(box);
49
+ };
50
+ const extensions = bundleObject(b.extensions);
51
+ const producerKey = bundleObject(extensions["producer-key/v1"]).public_key;
52
+ if (typeof producerKey === "string")
53
+ cell(w.t("front.check.key"), producerKey, "producer-key");
54
+ const checkpoint = bundleObject(b.checkpoint);
55
+ if (typeof checkpoint.log_id === "string")
56
+ cell(w.t("front.check.log"), checkpoint.log_id, "log");
57
+ if (typeof checkpoint.root === "string" &&
58
+ typeof checkpoint.mmr_size === "number")
59
+ cell(w.t("front.check.root"), `${checkpoint.root} · ${fmt(checkpoint.mmr_size)}`, "checkpoint");
60
+ if (Array.isArray(b.records))
61
+ cell(w.t("front.check.records"), fmt(b.records.length), "records");
62
+ section.append(anchors);
63
+ const receipts = witnessEntries(b.checkpoint).filter((entry) => !entry.stub && !entry.malformed);
64
+ const steps = el("ol", "steps");
65
+ steps.append(el("li", "", w.t("front.check.s1")), el("li", "", w.t("front.check.s2")));
66
+ const compare = el("li", "", w.t(receipts.length > 0 ? "front.check.s3.receipt" : "front.check.s3.none"));
67
+ compare.dataset.receipt = receipts.length > 0 ? "present" : "absent";
68
+ steps.append(compare, el("li", "", w.t("front.check.s4")));
69
+ section.append(steps);
70
+ return section;
71
+ }
72
+ /**
73
+ * A table row that opens its full-width detail row, with no script needed:
74
+ * the row's name (the rule, test or obligation it opens) becomes the
75
+ * summary of a level-1 disclosure in its first cell, and the stylesheet
76
+ * shows the detail row while that disclosure is open. The row stays a
77
+ * table row and the disclosure takes its name from the row's own words.
78
+ * The detail's body is built when it first opens (or at once with
79
+ * `eager`); a click anywhere on the row opens it too. `key` names the
80
+ * detail row's id from what the row is, so every packaging of one bundle
81
+ * draws the same ids.
82
+ */
83
+ export function expandableRow(row, name, detail, build, key, eager = false) {
84
+ row.classList.add("x");
85
+ detail.classList.add("x-detail");
86
+ detail.id = `cr-x-${key.replace(/[^A-Za-z0-9_.-]/gu, "_")}`;
87
+ const cell = detail.firstElementChild;
88
+ const toggle = document.createElement("details");
89
+ toggle.className = "lv lv1 rx";
90
+ toggle.dataset.level = "1";
91
+ const summary = document.createElement("summary");
92
+ summary.setAttribute("aria-controls", detail.id);
93
+ name.replaceWith(toggle);
94
+ summary.append(name);
95
+ toggle.append(summary);
96
+ deferBody(toggle, build, eager, cell);
97
+ // The summary's own click toggles natively; anywhere else on the row
98
+ // does the same.
99
+ row.addEventListener("click", (event) => {
100
+ // Nor does a click on a link or in a number's Show-evidence toggle
101
+ // (report-levels.ts `evidenceAction`): reading a number's evidence
102
+ // leaves the row as it was.
103
+ if (event.target.closest("summary, a, .cv-ev") !== null)
104
+ return;
105
+ if (toggle.open)
106
+ toggle.open = false;
107
+ else
108
+ openToggle(toggle);
109
+ });
110
+ return toggle;
111
+ }
112
+ /** A front card: the frame's centred white card, for blocks outside the sheet. */
113
+ export function frontCard(...children) {
114
+ const card = el("div", "front-card");
115
+ card.append(...children);
116
+ return card;
117
+ }
118
+ /**
119
+ * Open the module's own toggles to the host's depth (presentation contract
120
+ * section 9.1): at L0 none; at L1 the toggles in the L1 region; at L2 every
121
+ * toggle in every region, including the ones a toggle builds when it opens
122
+ * (see `openBuiltToDepth`). The core's section is the core's.
123
+ */
124
+ export function applyDepth(levels) {
125
+ if (levels.depth === "L0")
126
+ return;
127
+ const regions = levels.depth === "L1" ? [levels.L1] : [levels.L0, levels.L1, levels.L2];
128
+ for (const region of regions) {
129
+ if (levels.depth === "L2")
130
+ region.dataset.openAll = "";
131
+ for (const toggle of region.querySelectorAll("details.lv"))
132
+ openToggle(toggle);
133
+ // A number's Show-evidence list (report-levels.ts `evidenceAction`) is
134
+ // the proofs' level: open at L2 only.
135
+ if (levels.depth === "L2")
136
+ for (const toggle of region.querySelectorAll("details.cv-ev"))
137
+ toggle.open = true;
138
+ }
139
+ }
140
+ //# sourceMappingURL=report-front.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-front.js","sourceRoot":"","sources":["../src/report-front.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAUxD,SAAS,EAAE,CAAC,GAAW,EAAE,SAAiB,EAAE,IAAa;IACvD,MAAM,IA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