@action-state-group/capsule-viewer 0.1.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/README.md +73 -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/compliance-styles.d.ts +1 -8
- package/dist/compliance-styles.js +41 -3
- package/dist/compliance-styles.js.map +1 -1
- package/dist/compliance-view.d.ts +41 -1
- package/dist/compliance-view.js +737 -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 +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 +176 -2
- package/dist/emitter.d.ts +36 -0
- package/dist/emitter.js +64 -1
- package/dist/emitter.js.map +1 -1
- package/dist/evidence-graph-view.d.ts +60 -7
- package/dist/evidence-graph-view.js +1344 -106
- package/dist/evidence-graph-view.js.map +1 -1
- package/dist/evidence-graph.iife.js +12410 -5624
- 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 +1039 -436
- package/dist/outcome-report-view.js.map +1 -1
- package/dist/presentation-builder.d.ts +55 -6
- package/dist/presentation-builder.js +163 -69
- 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 +2 -2
- package/dist/presentation-mount.js +1 -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 +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 +3 -2
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { buildOutcomeReportModel, NOT_STATED, verifyJudgePin, } from "@action-state-group/agent-action-capsule";
|
|
2
2
|
import { OUTCOME_REPORT_CSS } from "./outcome-report-styles.js";
|
|
3
|
+
import { judgedOf, lazyBody, levelToggle, proofList, conversationFold, ruleWord, wordPill, caseParts, judgeNote, assuranceRow, reportSummary, } from "./report-levels.js";
|
|
3
4
|
import { buildVerificationPageModel } from "@action-state-group/agent-action-capsule";
|
|
5
|
+
import { provenanceLines, renderProvenance, tallyJudges, } from "./report-provenance.js";
|
|
6
|
+
import { expandableRow, leadWithProvenance, placeMockMark, renderAggregate, renderCheckYourself, renderMockJudgeLine, } from "./report-front.js";
|
|
4
7
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The contract-report module's `lines` grouping (contract-report.ts): a
|
|
9
|
+
* report read as result lines, results rule by rule, day by day and human
|
|
10
|
+
* spot checks, rendered from a verified `ResultRoot`. The Outcomes report is
|
|
11
|
+
* this grouping with the Outcomes wording pack. Drawn by the module in place
|
|
12
|
+
* of `renderResultPage` when the bundle's `outcome-report/v1` extension opts
|
|
13
|
+
* in (see `readOutcomeReportPresentation`) -- after the same verify-first
|
|
14
|
+
* gate every other root family goes through: nothing here ever runs on a
|
|
15
|
+
* bundle that did not verify.
|
|
11
16
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* Every word on it is the wording pack's (`w`); nothing here chooses a word.
|
|
18
|
+
*
|
|
19
|
+
* The card renders into the host's three regions, one `.oi`-classed
|
|
20
|
+
* wrapper in each; the L0 wrapper holds its `<style>` (`OUTCOME_REPORT_CSS`)
|
|
21
|
+
* as its first child. Every selector in that stylesheet is scoped under
|
|
22
|
+
* `.oi`, so it can never affect, or be affected by, the rest of the page
|
|
23
|
+
* (the core's verification section, which opens L2 before the card's own
|
|
24
|
+
* L2 detail, or the generic Result page this bundle opted out of).
|
|
17
25
|
* No external reference of any kind: no `<link>`, no web font, no image.
|
|
18
26
|
*/
|
|
19
27
|
function element(tag, text) {
|
|
@@ -84,102 +92,70 @@ function icon(name) {
|
|
|
84
92
|
return svg;
|
|
85
93
|
}
|
|
86
94
|
const fmtCount = (n) => n.toLocaleString();
|
|
87
|
-
function fmtShare(count, total, percentages) {
|
|
95
|
+
function fmtShare(count, total, percentages, w) {
|
|
88
96
|
if (percentages)
|
|
89
|
-
return total === 0
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
unknown: "tier unknown — no claims observed",
|
|
96
|
-
mixed: "tier differs across conversations",
|
|
97
|
-
};
|
|
98
|
-
const VERDICT_TEXT = {
|
|
99
|
-
met: "met",
|
|
100
|
-
not_met: "not met",
|
|
101
|
-
not_evaluable: "not evaluable",
|
|
102
|
-
failed: "failed verification",
|
|
103
|
-
unsupported: "unsupported",
|
|
104
|
-
not_applicable: "not applicable",
|
|
105
|
-
};
|
|
106
|
-
/** `tau2:airline:task-20:trial-0` reads "task 20"; any other id is shown whole. */
|
|
107
|
-
function caseLabel(conversationId) {
|
|
108
|
-
const match = /task-([0-9]+)/u.exec(conversationId);
|
|
109
|
-
return match === null ? conversationId : `task ${match[1]}`;
|
|
97
|
+
return total === 0
|
|
98
|
+
? "–"
|
|
99
|
+
: w.t("lines.share.percent", {
|
|
100
|
+
p: String(Math.round((count / total) * 100)),
|
|
101
|
+
});
|
|
102
|
+
return w.t("lines.share", { count: fmtCount(count), total: fmtCount(total) });
|
|
110
103
|
}
|
|
111
|
-
|
|
104
|
+
const tierLabel = (tier, w) => w.t(`lines.tier.${tier}`);
|
|
105
|
+
/**
|
|
106
|
+
* A rule's name and wording. The name is the pack's `row.<check>.<rule>.label`
|
|
107
|
+
* when it sets one (contract-report/v1 section 3), else the contract's label.
|
|
108
|
+
*/
|
|
109
|
+
function criterionLabel(model, checkId, criterionId, w) {
|
|
112
110
|
const check = model.terms.checks.find((c) => c.id === checkId);
|
|
113
111
|
const criterion = check?.criteria.find((c) => c.id === criterionId);
|
|
114
112
|
const wording = model.criterionWording.get(`${checkId}.${criterionId}`);
|
|
115
113
|
return {
|
|
116
|
-
label:
|
|
114
|
+
label: w.row(`${checkId}.${criterionId}`, "label") ??
|
|
115
|
+
criterion?.label ??
|
|
116
|
+
`${checkId}.${criterionId}`,
|
|
117
117
|
text: wording?.text ?? criterion?.text ?? "",
|
|
118
118
|
question: check?.question ?? checkId,
|
|
119
119
|
source: wording?.source ?? "unstated",
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
/** The label a criterion's wording carries when it is NOT the sealed text. */
|
|
123
|
-
const
|
|
124
|
-
sealed: "",
|
|
125
|
-
unstated: "Wording not stated: no report in this bundle states it.",
|
|
126
|
-
mixed: "Wording not shown: the reports in this bundle state different wordings.",
|
|
127
|
-
};
|
|
123
|
+
const wordingFallback = (source, w) => w.t(`lines.wording.${source}`);
|
|
128
124
|
/** One sentence on where the criterion wording on this page comes from. */
|
|
129
|
-
function wordingNote(model) {
|
|
130
|
-
const sources = new Set([...model.criterionWording.values()].map((
|
|
125
|
+
function wordingNote(model, w) {
|
|
126
|
+
const sources = new Set([...model.criterionWording.values()].map((c) => c.source));
|
|
131
127
|
if (sources.size === 1 && sources.has("sealed"))
|
|
132
|
-
return "
|
|
128
|
+
return w.t("lines.wording-note.sealed");
|
|
133
129
|
if (!sources.has("sealed"))
|
|
134
|
-
return "
|
|
135
|
-
return "
|
|
130
|
+
return w.t("lines.wording-note.unstated");
|
|
131
|
+
return w.t("lines.wording-note.partly");
|
|
136
132
|
}
|
|
137
133
|
/** The producer's "edited" badge for a criterion, when its presentation
|
|
138
134
|
* extension marks one -- presentation text, titled as such, never evidence. */
|
|
139
|
-
function editedBadge(model, ref) {
|
|
135
|
+
function editedBadge(model, ref, w) {
|
|
140
136
|
const edited = model.options.editedCriteria?.find((e) => e.criterion === ref);
|
|
141
137
|
if (edited === undefined)
|
|
142
138
|
return undefined;
|
|
143
139
|
const badge = el("span", "edited", edited.badge);
|
|
144
140
|
badge.dataset.edited = ref;
|
|
145
|
-
badge.title = "
|
|
141
|
+
badge.title = w.t("lines.edited.title");
|
|
146
142
|
return badge;
|
|
147
143
|
}
|
|
148
|
-
function renderProducerNote(host, model) {
|
|
144
|
+
function renderProducerNote(host, model, w) {
|
|
149
145
|
const note = model.options.producerNote;
|
|
150
146
|
if (note === undefined)
|
|
151
147
|
return;
|
|
152
148
|
const box = el("aside", "pnote");
|
|
153
149
|
box.dataset.producerNote = "true";
|
|
154
|
-
box.append(el("div", "pn-k", "
|
|
150
|
+
box.append(el("div", "pn-k", w.t("lines.producer-note.kicker")));
|
|
155
151
|
box.append(el("h2", "pn-t", note.title));
|
|
156
152
|
const list = el("ul", "pn-l");
|
|
157
153
|
for (const line of note.lines)
|
|
158
154
|
list.append(element("li", line));
|
|
159
155
|
box.append(list);
|
|
160
|
-
box.append(el("p", "pn-src", "
|
|
156
|
+
box.append(el("p", "pn-src", w.t("lines.producer-note.source")));
|
|
161
157
|
host.append(box);
|
|
162
158
|
}
|
|
163
|
-
function isMiss(verdict) {
|
|
164
|
-
return (verdict === "not_met" || verdict === "failed" || verdict === "unsupported");
|
|
165
|
-
}
|
|
166
|
-
function pill(verdict) {
|
|
167
|
-
const text = verdict === "resolved"
|
|
168
|
-
? "resolved"
|
|
169
|
-
: verdict === "missed"
|
|
170
|
-
? "missed"
|
|
171
|
-
: VERDICT_TEXT[verdict];
|
|
172
|
-
const tone = verdict === "met" || verdict === "resolved"
|
|
173
|
-
? "ok"
|
|
174
|
-
: verdict === "not_applicable"
|
|
175
|
-
? "na"
|
|
176
|
-
: verdict === "not_evaluable"
|
|
177
|
-
? "ne"
|
|
178
|
-
: "bad";
|
|
179
|
-
const value = el("span", `pill ${tone}`, text);
|
|
180
|
-
value.dataset.pill = verdict;
|
|
181
|
-
return value;
|
|
182
|
-
}
|
|
183
159
|
const fmtP = (p) => p.toFixed(2);
|
|
184
160
|
/** The probability the judge gave the verdict it returned, from the sealed rationale text; undefined when the text carries none. */
|
|
185
161
|
function verdictProbability(criterion) {
|
|
@@ -189,271 +165,675 @@ function verdictProbability(criterion) {
|
|
|
189
165
|
const key = criterion.claim?.verdict ?? criterion.verdict;
|
|
190
166
|
return probs[key];
|
|
191
167
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
168
|
+
/** The raw verdict names, kept for the proofs (what the sealed record says). */
|
|
169
|
+
const verdictText = (verdict, w) => w.t(`lines.pf.verdict.${verdict}`);
|
|
170
|
+
/** A rule result the judge returned as not met. A failed or unsupported claim is not one: its verdict was never drawn (see `isUnverified`). */
|
|
171
|
+
function isMiss(verdict) {
|
|
172
|
+
return verdict === "not_met";
|
|
173
|
+
}
|
|
174
|
+
/** A claim that failed verification, or whose cited evidence this bundle does not resolve: the records do not say whether the rule was met or not. */
|
|
175
|
+
function isUnverified(verdict) {
|
|
176
|
+
return verdict === "failed" || verdict === "unsupported";
|
|
177
|
+
}
|
|
178
|
+
/** A rule that did not apply: not applicable, or judged out of scope ("did not arise", Result v0 section 4.2). Never met; out of scope is still counted on its own. */
|
|
179
|
+
function notApplying(verdict) {
|
|
180
|
+
return verdict === "not_applicable" || verdict === "out_of_scope";
|
|
181
|
+
}
|
|
182
|
+
export function conversationStatus(conversation) {
|
|
183
|
+
if (conversation.verdict === "met")
|
|
184
|
+
return "resolved";
|
|
185
|
+
if (conversation.criteria.some((c) => isMiss(c.verdict)))
|
|
186
|
+
return "missed";
|
|
187
|
+
if (conversation.criteria.some((c) => isUnverified(c.verdict)))
|
|
188
|
+
return "unverified";
|
|
189
|
+
if (conversation.verdict === "not_met")
|
|
190
|
+
return "missed";
|
|
191
|
+
return conversation.criteria.length > 0 &&
|
|
192
|
+
conversation.criteria.every((c) => notApplying(c.verdict))
|
|
193
|
+
? "nothing-applied"
|
|
194
|
+
: "undecided";
|
|
195
|
+
}
|
|
196
|
+
// Result words never come from the bundle (presentation contract section
|
|
197
|
+
// 6): they are the card's wording pack's.
|
|
198
|
+
export function statusWord(status, conversation, w) {
|
|
199
|
+
if (status === "resolved")
|
|
200
|
+
return { word: w.t("lines.status.resolved"), tone: "ok" };
|
|
201
|
+
if (status === "missed")
|
|
202
|
+
return { word: w.t("lines.status.missed"), tone: "bad" };
|
|
203
|
+
if (status === "unverified")
|
|
204
|
+
return { word: w.t("lines.status.unverified"), tone: "ne" };
|
|
205
|
+
if (status === "nothing-applied")
|
|
206
|
+
return { word: w.t("lines.status.nothing-applied"), tone: "na" };
|
|
207
|
+
// Three-valued: a judge ran on an undecided rule, none did, or the
|
|
208
|
+
// withheld reports cannot say which. Since e1a44e0 the default pack gives
|
|
209
|
+
// all of these the same plain word ("could not decide"); only the key
|
|
210
|
+
// tells them apart.
|
|
211
|
+
// A `no_claim` rule is undecided with no judge run on it (no claim, so no
|
|
212
|
+
// report): it counts as unjudged.
|
|
213
|
+
const judged = conversation.criteria
|
|
214
|
+
.filter((c) => c.verdict === "not_evaluable" || c.verdict === "no_claim")
|
|
215
|
+
.map((c) => c.verdict === "no_claim"
|
|
216
|
+
? "no"
|
|
217
|
+
: judgedOf(c.reportState, c.judgePinDigest));
|
|
218
|
+
if (judged.includes("yes"))
|
|
219
|
+
return { word: w.t("lines.status.undecided.judged"), tone: "ne" };
|
|
220
|
+
if (judged.length > 0 && judged.every((j) => j === "no"))
|
|
221
|
+
return { word: w.t("lines.status.undecided.unjudged"), tone: "ne" };
|
|
222
|
+
// No rule result at all for this conversation (no not_evaluable criterion
|
|
223
|
+
// to point to a report state): the plain word set's own bare "could not
|
|
224
|
+
// decide", never a report-specific claim this conversation's records
|
|
225
|
+
// don't support.
|
|
226
|
+
if (judged.length === 0)
|
|
227
|
+
return { word: w.t("lines.status.undecided.none"), tone: "ne" };
|
|
228
|
+
// "withheld" only when every report that would say is withheld; a report
|
|
229
|
+
// in the bundle that cannot be read as sealed is never called withheld.
|
|
230
|
+
return judged.every((j) => j === "withheld" || j === "no")
|
|
231
|
+
? { word: w.t("lines.status.undecided.withheld"), tone: "ne" }
|
|
232
|
+
: { word: w.t("lines.status.undecided.unavailable"), tone: "ne" };
|
|
233
|
+
}
|
|
234
|
+
function criterionWord(c, w) {
|
|
235
|
+
// agent-action-capsule 0.8.0's `no_claim` (a missing claim the Result's
|
|
236
|
+
// exclusions do not account for) is a gap that rolls up as not_evaluable,
|
|
237
|
+
// so it takes not_evaluable's words. It carries no claim and so no report:
|
|
238
|
+
// no judge ran on it, which is not_evaluable's unjudged word.
|
|
239
|
+
return c.verdict === "no_claim"
|
|
240
|
+
? ruleWord("not_evaluable", "no", w)
|
|
241
|
+
: ruleWord(c.verdict, judgedOf(c.reportState, c.judgePinDigest), w);
|
|
242
|
+
}
|
|
243
|
+
/** The plain note for a rule whose report carries no rationale: why there is none. */
|
|
244
|
+
function noNoteText(c, w) {
|
|
245
|
+
switch (c.reportState) {
|
|
246
|
+
case "withheld":
|
|
247
|
+
case "mismatch":
|
|
248
|
+
case "unreadable":
|
|
249
|
+
case "invalid":
|
|
250
|
+
return w.t(`lines.no-note.${c.reportState}`);
|
|
251
|
+
default:
|
|
252
|
+
return w.t("lines.no-note.none");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function names(model, list, w) {
|
|
256
|
+
return list
|
|
257
|
+
.map((c) => criterionLabel(model, c.checkId, c.criterionId, w).label)
|
|
258
|
+
.join(", ");
|
|
259
|
+
}
|
|
260
|
+
/** A count in words up to twelve, in digits above. */
|
|
261
|
+
function countWord(n, w) {
|
|
262
|
+
return Number.isInteger(n) && n >= 0 && n <= 12
|
|
263
|
+
? w.t(`lines.count.${n}`)
|
|
264
|
+
: String(n);
|
|
265
|
+
}
|
|
266
|
+
/** The rules whose claim failed verification or whose evidence is missing, as one sentence: their verdict was never drawn. */
|
|
267
|
+
function unverifiedClause(model, list, w, lower = false) {
|
|
268
|
+
const failed = list.filter((c) => c.verdict === "failed");
|
|
269
|
+
const unsupported = list.filter((c) => c.verdict === "unsupported");
|
|
270
|
+
const parts = [];
|
|
271
|
+
if (failed.length > 0)
|
|
272
|
+
parts.push(w.t("lines.sentence.unverified.failed", {
|
|
273
|
+
names: names(model, failed, w),
|
|
225
274
|
}));
|
|
226
|
-
|
|
227
|
-
|
|
275
|
+
if (unsupported.length > 0)
|
|
276
|
+
parts.push(w.t("lines.sentence.unverified.unsupported", {
|
|
277
|
+
names: names(model, unsupported, w),
|
|
278
|
+
}));
|
|
279
|
+
const text = `${parts.join(", and ")}, so the records do not say whether ${w.p("lines.word.that-rule-was", list.length)} met.`;
|
|
280
|
+
return lower ? text : text.charAt(0).toUpperCase() + text.slice(1);
|
|
228
281
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
282
|
+
/** One plain sentence: the conversation's result and the rules behind it. */
|
|
283
|
+
function resultSentence(conversation, model, w) {
|
|
284
|
+
const all = conversation.criteria;
|
|
285
|
+
const applied = all.filter((c) => !notApplying(c.verdict));
|
|
286
|
+
const outOfScope = all.filter((c) => c.verdict === "out_of_scope").length;
|
|
287
|
+
const na = all.length - applied.length - outOfScope;
|
|
288
|
+
const misses = all.filter((c) => isMiss(c.verdict));
|
|
289
|
+
const unverified = all.filter((c) => isUnverified(c.verdict));
|
|
290
|
+
// Undecided rules a judge could not decide, and gaps (`no_claim`): rules
|
|
291
|
+
// the Result holds no claim for, which no judge ran on.
|
|
292
|
+
const undecided = all.filter((c) => c.verdict === "not_evaluable");
|
|
293
|
+
const gaps = all.filter((c) => c.verdict === "no_claim");
|
|
294
|
+
const gapNote = gaps.length > 0
|
|
295
|
+
? w.t("lines.sentence.undecided.gap-note", {
|
|
296
|
+
names: names(model, gaps, w),
|
|
297
|
+
})
|
|
298
|
+
: "";
|
|
299
|
+
const naText = `${na > 0 ? ` ${w.t("lines.sentence.na", { n: String(na) })}` : ""}${outOfScope > 0
|
|
300
|
+
? ` ${w.t("lines.sentence.out-of-scope", { n: String(outOfScope) })}`
|
|
301
|
+
: ""}`;
|
|
302
|
+
const unverifiedText = unverified.length > 0 ? ` ${unverifiedClause(model, unverified, w)}` : "";
|
|
303
|
+
switch (conversationStatus(conversation)) {
|
|
304
|
+
case "resolved":
|
|
305
|
+
return `${w.p("lines.sentence.resolved", applied.length, { n: String(applied.length) })}${naText}`;
|
|
306
|
+
case "missed":
|
|
307
|
+
return `${w.t("lines.sentence.missed", {
|
|
308
|
+
misses: String(misses.length),
|
|
309
|
+
applied: String(applied.length),
|
|
310
|
+
rule: w.p("lines.word.rule", applied.length),
|
|
311
|
+
was: w.p("lines.word.was", misses.length),
|
|
312
|
+
names: names(model, misses, w),
|
|
313
|
+
})}${unverifiedText}${naText}`;
|
|
314
|
+
case "unverified":
|
|
315
|
+
return `${w.t("lines.sentence.unverified", {
|
|
316
|
+
clause: unverifiedClause(model, unverified, w, true),
|
|
317
|
+
undecidedNote: `${undecided.length > 0
|
|
318
|
+
? w.t("lines.sentence.unverified.undecided-note", {
|
|
319
|
+
names: names(model, undecided, w),
|
|
320
|
+
})
|
|
321
|
+
: ""}${gapNote}`,
|
|
322
|
+
})}${naText}`;
|
|
323
|
+
case "undecided":
|
|
324
|
+
return undecided.length > 0
|
|
325
|
+
? `${w.t("lines.sentence.undecided", {
|
|
326
|
+
names: names(model, undecided, w),
|
|
327
|
+
thatRuleWas: w.p("lines.word.that-rule-was", undecided.length),
|
|
328
|
+
})}${gapNote}${naText}`
|
|
329
|
+
: gaps.length > 0
|
|
330
|
+
? `${w.t("lines.sentence.undecided.gaps", {
|
|
331
|
+
names: names(model, gaps, w),
|
|
332
|
+
})}${naText}`
|
|
333
|
+
: w.t("lines.sentence.undecided.none");
|
|
334
|
+
case "nothing-applied":
|
|
335
|
+
return w.t("lines.sentence.nothing-applied");
|
|
238
336
|
}
|
|
239
|
-
wrap.append(el("p", "small", `Sealed in record ${t.transcriptRecordId}. Its content digest equals what the judged case capsule ${conversation.sourceCapsuleId} committed to (${t.inputDigest}), checked on this page: this is the conversation the judge read. ${t.turns.length} messages, in order.`));
|
|
240
|
-
const list = el("ol", "turns");
|
|
241
|
-
t.turns.forEach((turn, index) => {
|
|
242
|
-
const item = el("li", `turn ${turn.role === "user" || turn.role === "assistant" || turn.role === "tool" ? turn.role : "other"}`);
|
|
243
|
-
item.dataset.turn = String(index);
|
|
244
|
-
item.dataset.role = turn.role;
|
|
245
|
-
const head = el("div", "who", `msg[${index}] ${turn.role}`);
|
|
246
|
-
item.append(head);
|
|
247
|
-
if (turn.content !== undefined && turn.content.length > 0)
|
|
248
|
-
item.append(el(turn.role === "tool" ? "pre" : "div", "say", turn.content));
|
|
249
|
-
for (const call of turn.toolCalls) {
|
|
250
|
-
const callEl = el("pre", "call", `${call.name}(${call.arguments})`);
|
|
251
|
-
callEl.dataset.toolCall = call.name;
|
|
252
|
-
item.append(callEl);
|
|
253
|
-
}
|
|
254
|
-
list.append(item);
|
|
255
|
-
});
|
|
256
|
-
wrap.append(list);
|
|
257
|
-
return wrap;
|
|
258
337
|
}
|
|
259
|
-
|
|
260
|
-
|
|
338
|
+
/**
|
|
339
|
+
* One conversation, in place inside a level-1 toggle: a header line (case,
|
|
340
|
+
* result, why, model) and its body right below it, never a toggle of its
|
|
341
|
+
* own. The body is built when it scrolls near the view (`lazyBody`).
|
|
342
|
+
*/
|
|
343
|
+
function renderConversation(conversation, model, runInfo, w) {
|
|
344
|
+
const status = conversationStatus(conversation);
|
|
345
|
+
const item = el("article", "conv");
|
|
346
|
+
item.dataset.conversation = conversation.conversationId;
|
|
347
|
+
item.dataset.conversationVerdict = conversation.verdict;
|
|
348
|
+
item.dataset.status = status;
|
|
349
|
+
const head = el("div", "conv-h");
|
|
350
|
+
const parts = caseParts(conversation.conversationId, w);
|
|
351
|
+
head.append(el("span", "cid", parts.label));
|
|
352
|
+
head.append(wordPill(statusWord(status, conversation, w), status));
|
|
353
|
+
const misses = conversation.criteria.filter((c) => isMiss(c.verdict));
|
|
354
|
+
const unverified = conversation.criteria.filter((c) => isUnverified(c.verdict));
|
|
355
|
+
const undecided = conversation.criteria.filter((c) => c.verdict === "not_evaluable" || c.verdict === "no_claim");
|
|
356
|
+
const outOfScope = conversation.criteria.filter((c) => c.verdict === "out_of_scope");
|
|
357
|
+
head.append(el("span", "cwhy", status === "missed"
|
|
358
|
+
? w.t("lines.why.missed", { names: names(model, misses, w) })
|
|
359
|
+
: status === "unverified"
|
|
360
|
+
? w.t("lines.why.unverified", { names: names(model, unverified, w) })
|
|
361
|
+
: status === "undecided"
|
|
362
|
+
? undecided.length === 0
|
|
363
|
+
? w.t("lines.why.undecided.none")
|
|
364
|
+
: w.t("lines.why.undecided", {
|
|
365
|
+
names: names(model, undecided, w),
|
|
366
|
+
})
|
|
367
|
+
: status === "nothing-applied"
|
|
368
|
+
? w.t("lines.why.nothing-applied")
|
|
369
|
+
: outOfScope.length === 0
|
|
370
|
+
? w.t("lines.why.resolved")
|
|
371
|
+
: w.p("lines.why.resolved-out-of-scope", conversation.criteria.length - outOfScope.length, {
|
|
372
|
+
n: fmtCount(conversation.criteria.length - outOfScope.length),
|
|
373
|
+
oos: fmtCount(outOfScope.length),
|
|
374
|
+
})));
|
|
375
|
+
head.append(el("span", "cmodel", parts.model ?? ""));
|
|
376
|
+
item.append(head);
|
|
377
|
+
const body = el("div", "conv-slot");
|
|
378
|
+
item.append(body);
|
|
379
|
+
lazyBody(body, () => conversationBody(conversation, model, runInfo, w));
|
|
380
|
+
return item;
|
|
381
|
+
}
|
|
382
|
+
function conversationBody(conversation, model, runInfo, w) {
|
|
261
383
|
const body = el("div", "conv-b");
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
body.append(
|
|
265
|
-
//
|
|
266
|
-
body.append(el("h4", "", "
|
|
267
|
-
|
|
268
|
-
|
|
384
|
+
const sentence = el("p", "verdict-line", resultSentence(conversation, model, w));
|
|
385
|
+
sentence.dataset.why = conversationStatus(conversation);
|
|
386
|
+
body.append(sentence);
|
|
387
|
+
// Rule by rule, in plain words
|
|
388
|
+
body.append(el("h4", "", w.t("lines.h.rule-by-rule")));
|
|
389
|
+
// The judge's notes and the rule wording are shown per rule only when the
|
|
390
|
+
// bundle carries them; otherwise one line says so, not one per rule.
|
|
391
|
+
const hasNotes = conversation.criteria.some((c) => c.rationale !== undefined);
|
|
392
|
+
const wordings = conversation.criteria.map((c) => criterionLabel(model, c.checkId, c.criterionId, w).source);
|
|
393
|
+
const anyWording = wordings.some((source) => source === "sealed");
|
|
269
394
|
const table = el("table", "crit");
|
|
270
395
|
table.dataset.criteriaTable = conversation.conversationId;
|
|
271
396
|
const head = element("thead");
|
|
272
397
|
const headRow = element("tr");
|
|
273
|
-
headRow.append(element("th",
|
|
398
|
+
headRow.append(element("th", w.t("lines.col.rule")), element("th", w.t("lines.col.result")));
|
|
399
|
+
if (hasNotes)
|
|
400
|
+
headRow.append(element("th", w.t("lines.col.note")));
|
|
274
401
|
head.append(headRow);
|
|
275
402
|
table.append(head);
|
|
276
403
|
const tbody = element("tbody");
|
|
277
404
|
for (const criterion of conversation.criteria) {
|
|
405
|
+
const ref = `${criterion.checkId}.${criterion.criterionId}`;
|
|
278
406
|
const tr = element("tr");
|
|
279
|
-
tr.dataset.crit =
|
|
407
|
+
tr.dataset.crit = ref;
|
|
280
408
|
tr.dataset.critVerdict = criterion.verdict;
|
|
281
|
-
const
|
|
409
|
+
const label = criterionLabel(model, criterion.checkId, criterion.criterionId, w);
|
|
282
410
|
const nameCell = el("td", "cn");
|
|
283
|
-
nameCell.append(el("b", "",
|
|
284
|
-
const rowBadge = editedBadge(model,
|
|
411
|
+
nameCell.append(el("b", "", label.label));
|
|
412
|
+
const rowBadge = editedBadge(model, ref, w);
|
|
285
413
|
if (rowBadge !== undefined)
|
|
286
414
|
nameCell.append(rowBadge);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
415
|
+
if (label.source === "sealed") {
|
|
416
|
+
const wording = el("small", "", label.text);
|
|
417
|
+
wording.dataset.wording = label.source;
|
|
418
|
+
nameCell.append(wording);
|
|
419
|
+
}
|
|
420
|
+
else if (anyWording) {
|
|
421
|
+
const wording = el("small", "wsrc", wordingFallback(label.source, w));
|
|
422
|
+
wording.dataset.wording = label.source;
|
|
423
|
+
nameCell.append(wording);
|
|
424
|
+
}
|
|
292
425
|
tr.append(nameCell);
|
|
293
426
|
const verdictCell = element("td");
|
|
294
|
-
verdictCell.append(
|
|
427
|
+
verdictCell.append(wordPill(criterionWord(criterion, w), criterion.verdict));
|
|
295
428
|
tr.append(verdictCell);
|
|
429
|
+
if (!hasNotes) {
|
|
430
|
+
tbody.append(tr);
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const noteCell = el("td", "rat");
|
|
434
|
+
if (criterion.verdict === "not_applicable")
|
|
435
|
+
noteCell.append(el("span", "muted", w.t("lines.note.not-applicable")));
|
|
436
|
+
else if (criterion.rationale !== undefined)
|
|
437
|
+
noteCell.append(el("span", "sealed", judgeNote(criterion.rationale, criterion.claim?.verdict ?? criterion.verdict, w)));
|
|
438
|
+
else
|
|
439
|
+
noteCell.append(el("span", "muted", noNoteText(criterion, w)));
|
|
440
|
+
tr.append(noteCell);
|
|
441
|
+
tbody.append(tr);
|
|
442
|
+
}
|
|
443
|
+
table.append(tbody);
|
|
444
|
+
const scroll = el("div", "tscroll");
|
|
445
|
+
scroll.append(table);
|
|
446
|
+
body.append(scroll);
|
|
447
|
+
const gaps = [];
|
|
448
|
+
if (!anyWording)
|
|
449
|
+
gaps.push(w.t(wordings.includes("mixed")
|
|
450
|
+
? "lines.gap.wording.mixed"
|
|
451
|
+
: "lines.gap.wording.none"));
|
|
452
|
+
if (!hasNotes)
|
|
453
|
+
gaps.push(notesGap(conversation.criteria.flatMap((c) => c.claim === undefined ? [] : [c.reportState]), w));
|
|
454
|
+
if (gaps.length > 0) {
|
|
455
|
+
const gap = el("p", "small", gaps.join(" "));
|
|
456
|
+
gap.dataset.gaps = "true";
|
|
457
|
+
body.append(gap);
|
|
458
|
+
}
|
|
459
|
+
// The conversation itself
|
|
460
|
+
body.append(conversationFold(conversation.transcript, conversation.sourceCapsuleId, w));
|
|
461
|
+
// Toggle 2: the proofs
|
|
462
|
+
body.append(levelToggle(2, w.t("card.proofs.toggle"), () => conversationProofs(conversation, model, runInfo, w), { className: "proofs" }));
|
|
463
|
+
return body;
|
|
464
|
+
}
|
|
465
|
+
/** Why a conversation or session shows no judge's notes, from its reports' states. */
|
|
466
|
+
export function notesGap(states, w) {
|
|
467
|
+
const set = new Set(states);
|
|
468
|
+
return w.t(set.size === 1 && set.has("withheld")
|
|
469
|
+
? "card.gap.notes.withheld"
|
|
470
|
+
: set.has("mismatch") || set.has("unreadable") || set.has("invalid")
|
|
471
|
+
? "card.gap.notes.unread"
|
|
472
|
+
: set.has("withheld")
|
|
473
|
+
? "card.gap.notes.some-withheld"
|
|
474
|
+
: "card.gap.notes.none");
|
|
475
|
+
}
|
|
476
|
+
/** The proofs rows for a case's transcript, shared by both groupings. */
|
|
477
|
+
export function transcriptRows(t, w) {
|
|
478
|
+
if (t.state === "verified")
|
|
479
|
+
return [
|
|
480
|
+
[w.t("card.pf.transcript-record"), t.transcriptRecordId],
|
|
481
|
+
[
|
|
482
|
+
w.t("card.pf.input-digest"),
|
|
483
|
+
w.t("card.pf.input-digest.verified", { digest: t.inputDigest }),
|
|
484
|
+
],
|
|
485
|
+
];
|
|
486
|
+
if (t.state === "cited")
|
|
487
|
+
return [
|
|
488
|
+
[w.t("card.pf.transcript-record"), t.transcriptRecordId],
|
|
489
|
+
[
|
|
490
|
+
w.t("card.pf.input-digest"),
|
|
491
|
+
w.t("card.pf.input-digest.cited", { digest: t.inputDigest }),
|
|
492
|
+
],
|
|
493
|
+
];
|
|
494
|
+
return [
|
|
495
|
+
[
|
|
496
|
+
w.t("card.pf.transcript"),
|
|
497
|
+
t.state === "absent"
|
|
498
|
+
? w.t("card.pf.transcript.absent")
|
|
499
|
+
: w.t("card.pf.transcript.not-shown", {
|
|
500
|
+
reason: t.reason ?? w.t("card.pf.transcript.default-reason"),
|
|
501
|
+
}),
|
|
502
|
+
],
|
|
503
|
+
];
|
|
504
|
+
}
|
|
505
|
+
/** How a case is dated, in the proofs: the date as given, its zone, and the basis. */
|
|
506
|
+
export function datedText(dated, w) {
|
|
507
|
+
return w.t(dated.zone === "not-stated" ? "card.pf.dated.no-zone" : "card.pf.dated", { date: dated.stated ?? dated.date, basis: basisText(dated.basis, w) });
|
|
508
|
+
}
|
|
509
|
+
function conversationProofs(conversation, model, runInfo, w) {
|
|
510
|
+
const box = el("div", "pf-b");
|
|
511
|
+
box.dataset.proofsFor = conversation.conversationId;
|
|
512
|
+
const rows = [];
|
|
513
|
+
rows.push([w.t("lines.pf.case"), conversation.conversationId]);
|
|
514
|
+
rows.push([
|
|
515
|
+
w.t("card.pf.case-record"),
|
|
516
|
+
conversation.sourceCapsuleId === undefined
|
|
517
|
+
? w.t("card.pf.case-record.not-stated")
|
|
518
|
+
: conversation.caseFrom === "claims"
|
|
519
|
+
? w.t("lines.pf.case-record.from-claims", {
|
|
520
|
+
record: conversation.sourceCapsuleId,
|
|
521
|
+
})
|
|
522
|
+
: conversation.sourceCapsuleId,
|
|
523
|
+
]);
|
|
524
|
+
const dated = conversation.dated;
|
|
525
|
+
if (dated.basis !== "judged") {
|
|
526
|
+
rows.push([
|
|
527
|
+
w.t("lines.pf.dated-by"),
|
|
528
|
+
datedText(dated, w),
|
|
529
|
+
{ dated: dated.basis },
|
|
530
|
+
]);
|
|
531
|
+
if (dated.importedAt !== undefined)
|
|
532
|
+
rows.push([w.t("card.pf.imported"), dated.importedAt]);
|
|
533
|
+
rows.push([w.t("card.pf.judged-sealed"), conversation.judgedDay]);
|
|
534
|
+
}
|
|
535
|
+
rows.push([w.t("card.pf.result-capsule"), model.capsuleId]);
|
|
536
|
+
rows.push(...transcriptRows(conversation.transcript, w));
|
|
537
|
+
rows.push([
|
|
538
|
+
w.t("lines.pf.judge-pin"),
|
|
539
|
+
runInfo.judgePinDigest === undefined
|
|
540
|
+
? pinNotShown(runInfo, w)
|
|
541
|
+
: runInfo.judgePinRecomputes === true && runInfo.judgePin !== undefined
|
|
542
|
+
? w.t("lines.pf.judge-pin.recomputed", {
|
|
543
|
+
digest: runInfo.judgePinDigest,
|
|
544
|
+
model: runInfo.judgePin.modelId,
|
|
545
|
+
prompt: runInfo.judgePin.promptDigest,
|
|
546
|
+
axes: runInfo.judgePin.axesDigest,
|
|
547
|
+
})
|
|
548
|
+
: runInfo.judgePinDigest,
|
|
549
|
+
]);
|
|
550
|
+
const dl = proofList(rows);
|
|
551
|
+
dl.dataset.checkIt = conversation.conversationId;
|
|
552
|
+
box.append(dl);
|
|
553
|
+
box.append(el("h5", "", w.t("lines.pf.h.each-report")));
|
|
554
|
+
const table = el("table", "crit pft");
|
|
555
|
+
const head = element("thead");
|
|
556
|
+
const headRow = element("tr");
|
|
557
|
+
headRow.append(element("th", w.t("lines.pf.col.rule")), element("th", w.t("lines.pf.col.verdict")), el("th", "n", w.t("lines.pf.col.p")), element("th", w.t("lines.pf.col.report")), element("th", w.t("lines.pf.col.rationale")), element("th", w.t("card.pf.assurance")));
|
|
558
|
+
head.append(headRow);
|
|
559
|
+
table.append(head);
|
|
560
|
+
const tbody = element("tbody");
|
|
561
|
+
for (const criterion of conversation.criteria) {
|
|
562
|
+
const tr = element("tr");
|
|
563
|
+
tr.dataset.proofCrit = `${criterion.checkId}.${criterion.criterionId}`;
|
|
564
|
+
// The sealed verdict as data, whatever the pack's word for it.
|
|
565
|
+
tr.dataset.verdict = criterion.verdict;
|
|
566
|
+
tr.append(element("td", criterionLabel(model, criterion.checkId, criterion.criterionId, w)
|
|
567
|
+
.label), element("td", verdictText(criterion.verdict, w)));
|
|
296
568
|
const p = verdictProbability(criterion);
|
|
297
569
|
const pCell = el("td", "n", p === undefined ? "–" : fmtP(p));
|
|
298
570
|
if (p !== undefined)
|
|
299
571
|
pCell.dataset.p = fmtP(p);
|
|
300
572
|
tr.append(pCell);
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
573
|
+
tr.append(el("td", "mono", criterion.claim === undefined
|
|
574
|
+
? w.t("lines.pf.no-claim")
|
|
575
|
+
: `${criterion.reportCapsuleId ?? w.t("lines.pf.not-cited")}${criterion.reportRecordId === undefined ? "" : ` (${criterion.reportRecordId})`}`));
|
|
576
|
+
const rationale = el("td", "rat");
|
|
577
|
+
if (criterion.rationale !== undefined) {
|
|
306
578
|
const sealed = el("code", "sealed", criterion.rationale);
|
|
307
579
|
sealed.dataset.rationale = "sealed";
|
|
308
|
-
|
|
580
|
+
rationale.append(sealed);
|
|
309
581
|
}
|
|
582
|
+
else
|
|
583
|
+
rationale.append(el("span", "muted", "–"));
|
|
584
|
+
tr.append(rationale);
|
|
585
|
+
// contract-report/v1 section 2: assurance stays on the claim.
|
|
586
|
+
if (criterion.claim === undefined)
|
|
587
|
+
tr.append(el("td", "muted", "–"));
|
|
310
588
|
else {
|
|
311
|
-
|
|
589
|
+
const [, text, data] = assuranceRow(criterion.claim, w);
|
|
590
|
+
const cell = element("td", text);
|
|
591
|
+
for (const [key, value] of Object.entries(data))
|
|
592
|
+
cell.dataset[key] = value;
|
|
593
|
+
tr.append(cell);
|
|
312
594
|
}
|
|
313
|
-
tr.append(rationaleCell);
|
|
314
595
|
tbody.append(tr);
|
|
315
596
|
}
|
|
316
597
|
table.append(tbody);
|
|
317
598
|
const scroll = el("div", "tscroll");
|
|
318
599
|
scroll.append(table);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
|
|
600
|
+
box.append(scroll);
|
|
601
|
+
// "Derived from its probabilities" holds only when every sealed rationale
|
|
602
|
+
// is the judge backend's own synthesized line; any other rationale is
|
|
603
|
+
// shown as sealed, and `judgeNote` passes it through unchanged.
|
|
604
|
+
const rationales = conversation.criteria
|
|
605
|
+
.map((c) => c.rationale)
|
|
606
|
+
.filter((r) => r !== undefined);
|
|
607
|
+
if (rationales.length > 0 &&
|
|
608
|
+
rationales.every((r) => /^jev choice:/u.test(r))) {
|
|
609
|
+
const derived = el("p", "", w.t("lines.pf.derived"));
|
|
610
|
+
derived.dataset.rationaleLabel = "derived";
|
|
611
|
+
box.append(derived);
|
|
330
612
|
}
|
|
331
|
-
else {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const item = element("li", `${names.label} (${names.question}): ${VERDICT_TEXT[criterion.verdict]}${p === undefined ? "" : `, P ${fmtP(p)}`}${criterion.confidence === undefined ? "" : `, confidence ${fmtP(criterion.confidence)}`}.`);
|
|
336
|
-
item.dataset.whyCriterion = `${criterion.checkId}.${criterion.criterionId}`;
|
|
337
|
-
why.append(item);
|
|
338
|
-
}
|
|
613
|
+
else if (rationales.length > 0) {
|
|
614
|
+
const shown = el("p", "", w.t("lines.pf.sealed-rationale"));
|
|
615
|
+
shown.dataset.rationaleLabel = "sealed";
|
|
616
|
+
box.append(shown);
|
|
339
617
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
body.append(check);
|
|
375
|
-
body.append(el("p", "small", "To recompute: read each report above from the book, check its digest, and take the AND of the nine verdicts (not applicable passes). To re-judge, run the pinned judge on the case record and compare."));
|
|
376
|
-
return body;
|
|
618
|
+
box.append(el("p", "", w.t("lines.pf.recompute", {
|
|
619
|
+
verdicts: w.p("lines.pf.verdicts", conversation.criteria.length, {
|
|
620
|
+
n: countWord(conversation.criteria.length, w),
|
|
621
|
+
}),
|
|
622
|
+
})));
|
|
623
|
+
return box;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* The reasons a judge pin is not in the bundle, shared by both groupings:
|
|
627
|
+
* withheld reports are not the same as an unstated pin, and a mismatched
|
|
628
|
+
* report is neither. Empty when there is no such reason.
|
|
629
|
+
*/
|
|
630
|
+
export function pinAbsence(info, w) {
|
|
631
|
+
const unread = (info.reportsMismatched ?? 0) +
|
|
632
|
+
(info.reportsUnreadable ?? 0) +
|
|
633
|
+
(info.reportsInvalid ?? 0);
|
|
634
|
+
const cited = fmtCount(info.reportsCited ?? 0);
|
|
635
|
+
const parts = [];
|
|
636
|
+
if (info.reportsWithheld !== undefined)
|
|
637
|
+
parts.push(w.t("card.pin.withheld", {
|
|
638
|
+
count: fmtCount(info.reportsWithheld),
|
|
639
|
+
total: cited,
|
|
640
|
+
}));
|
|
641
|
+
if (unread > 0)
|
|
642
|
+
parts.push(w.t("card.pin.unread", { count: fmtCount(unread), total: cited }));
|
|
643
|
+
return parts.length === 0
|
|
644
|
+
? undefined
|
|
645
|
+
: w.t("card.pin.not-in-bundle", { reasons: parts.join("; ") });
|
|
646
|
+
}
|
|
647
|
+
/** What a page says when no judge pin is drawn. */
|
|
648
|
+
function pinNotShown(runInfo, w) {
|
|
649
|
+
if (!runInfo.pinned)
|
|
650
|
+
return w.t("lines.pin.differs");
|
|
651
|
+
return pinAbsence(runInfo, w) ?? w.t("lines.pin.not-stated");
|
|
377
652
|
}
|
|
378
|
-
function renderConversationList(conversations, model, runInfo, key) {
|
|
653
|
+
function renderConversationList(conversations, model, runInfo, key, w) {
|
|
379
654
|
const list = el("div", "convs");
|
|
380
655
|
list.dataset.conversationsFor = key;
|
|
381
656
|
list.dataset.conversationCount = String(conversations.length);
|
|
382
657
|
if (conversations.length === 0)
|
|
383
|
-
list.append(el("p", "small", "
|
|
658
|
+
list.append(el("p", "small", w.t("lines.list.empty")));
|
|
384
659
|
for (const conversation of conversations)
|
|
385
|
-
list.append(renderConversation(conversation, model, runInfo));
|
|
660
|
+
list.append(renderConversation(conversation, model, runInfo, w));
|
|
386
661
|
return list;
|
|
387
662
|
}
|
|
388
|
-
|
|
389
|
-
|
|
663
|
+
/** Toggle 1 on a summary line: the conversations behind it, listed in place, built on open. */
|
|
664
|
+
function drill(label, build, key) {
|
|
665
|
+
const details = levelToggle(1, label, build, { className: "line" });
|
|
390
666
|
details.dataset.drill = key;
|
|
391
|
-
details.append(el("summary", "", label));
|
|
392
|
-
details.append(renderConversationList(conversations, model, runInfo, key));
|
|
393
667
|
return details;
|
|
394
668
|
}
|
|
669
|
+
function conversationsDrill(label, conversations, model, runInfo, key, w) {
|
|
670
|
+
return drill(label, () => renderConversationList(conversations, model, runInfo, key, w), key);
|
|
671
|
+
}
|
|
672
|
+
/** A criterion's label for a missed-reason group, from the terms; the id itself when the terms don't name it. */
|
|
673
|
+
function missedReasonLabel(terms, checkId, criterionId, w) {
|
|
674
|
+
const check = terms.checks.find((c) => c.id === checkId);
|
|
675
|
+
const criterion = check?.criteria.find((c) => c.id === criterionId);
|
|
676
|
+
return check === undefined || criterion === undefined
|
|
677
|
+
? `${checkId}.${criterionId}`
|
|
678
|
+
: `${w?.row(`${checkId}.${criterionId}`, "label") ?? criterion.label} (${w === undefined ? check.question : groupTitle(check, w)})`;
|
|
679
|
+
}
|
|
680
|
+
/** A rule group's heading: the pack's `group.<check>.title` when it sets one (contract-report/v1 section 3), else the contract's question. */
|
|
681
|
+
function groupTitle(check, w) {
|
|
682
|
+
return w.group(check.id) ?? check.question;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Group missed conversations by THIS view's own reason: the first criterion
|
|
686
|
+
* where `isMiss` is true -- never AAC's `missedReasonGroups`, whose notion of
|
|
687
|
+
* "missed" still includes `failed`/`unsupported` (0.5.0's `missedReasonGroups`
|
|
688
|
+
* picks the first not_met/failed/unsupported criterion in criteria order, so
|
|
689
|
+
* a conversation with [c1 failed, c2 not_met] files under c1, though this
|
|
690
|
+
* view counts it missed only for c2's sake -- see `isMiss`, `isUnverified`).
|
|
691
|
+
* A reason is the producer's sealed reason code when the terms give it a
|
|
692
|
+
* label (`terms.reasonCodes`), else the first rule not met; a raw code is
|
|
693
|
+
* never shown.
|
|
694
|
+
*/
|
|
695
|
+
export function groupMissedReasons(missed, terms, w) {
|
|
696
|
+
const labelledReasonCode = (code) => code === undefined ? undefined : terms.reasonCodes[code];
|
|
697
|
+
const groups = new Map();
|
|
698
|
+
const structured = new Map();
|
|
699
|
+
const labels = new Map();
|
|
700
|
+
for (const conversation of missed) {
|
|
701
|
+
const first = conversation.criteria.find((c) => isMiss(c.verdict));
|
|
702
|
+
if (first === undefined)
|
|
703
|
+
continue;
|
|
704
|
+
const label = labelledReasonCode(first.reasonCode);
|
|
705
|
+
const key = label !== undefined
|
|
706
|
+
? first.reasonCode
|
|
707
|
+
: `${first.checkId}.${first.criterionId}`;
|
|
708
|
+
const list = groups.get(key) ?? [];
|
|
709
|
+
list.push(conversation);
|
|
710
|
+
groups.set(key, list);
|
|
711
|
+
structured.set(key, label !== undefined);
|
|
712
|
+
labels.set(key, label ?? missedReasonLabel(terms, first.checkId, first.criterionId, w));
|
|
713
|
+
}
|
|
714
|
+
return [...groups.entries()]
|
|
715
|
+
.map(([key, conversations]) => ({
|
|
716
|
+
key,
|
|
717
|
+
label: labels.get(key),
|
|
718
|
+
structured: structured.get(key),
|
|
719
|
+
conversations,
|
|
720
|
+
}))
|
|
721
|
+
.sort((a, b) => b.conversations.length - a.conversations.length);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* The missed line's toggle: why conversations missed, then the missed
|
|
725
|
+
* conversations under each reason, in place. A reason is the producer's
|
|
726
|
+
* sealed reason code when the terms give it a label (`terms.reasonCodes`),
|
|
727
|
+
* else the first rule not met; a raw code is never shown. Content of the
|
|
728
|
+
* one level-1 toggle, never a level of its own.
|
|
729
|
+
*/
|
|
730
|
+
function whyMissed(missed, model, runInfo, w) {
|
|
731
|
+
const box = el("div", "why-missed");
|
|
732
|
+
box.dataset.section = "why-missed";
|
|
733
|
+
const groups = groupMissedReasons(missed, model.terms, w);
|
|
734
|
+
box.dataset.reasons = String(groups.length);
|
|
735
|
+
box.append(el("h5", "", w.t("lines.why-missed.h")));
|
|
736
|
+
const table = element("table");
|
|
737
|
+
const tbody = element("tbody");
|
|
738
|
+
for (const group of groups) {
|
|
739
|
+
const tr = element("tr");
|
|
740
|
+
tr.dataset.reasonKey = group.key;
|
|
741
|
+
tr.dataset.reasonStructured = String(group.structured);
|
|
742
|
+
tr.dataset.count = String(group.conversations.length);
|
|
743
|
+
tr.append(element("td", group.label), el("td", "n", fmtCount(group.conversations.length)));
|
|
744
|
+
tbody.append(tr);
|
|
745
|
+
}
|
|
746
|
+
table.append(tbody);
|
|
747
|
+
box.append(table);
|
|
748
|
+
const anyStructured = groups.some((g) => g.structured);
|
|
749
|
+
box.append(el("p", "small", w.t(anyStructured
|
|
750
|
+
? "lines.why-missed.structured"
|
|
751
|
+
: "lines.why-missed.unstructured")));
|
|
752
|
+
for (const group of groups) {
|
|
753
|
+
const head = el("div", "rsn-h", w.t("lines.why-missed.reason", {
|
|
754
|
+
reason: group.label,
|
|
755
|
+
count: fmtCount(group.conversations.length),
|
|
756
|
+
}));
|
|
757
|
+
head.dataset.reasonFor = group.key;
|
|
758
|
+
box.append(head);
|
|
759
|
+
box.append(renderConversationList(group.conversations, model, runInfo, `reason:${group.key}`, w));
|
|
760
|
+
}
|
|
761
|
+
return box;
|
|
762
|
+
}
|
|
395
763
|
// ---------------------------------------------------------------------------
|
|
396
764
|
// The sheet: header meta, report lines, stamp, tamper note
|
|
397
765
|
// ---------------------------------------------------------------------------
|
|
398
766
|
/** The pack and version as one line: both come from the claims' `contract_ref` (see `readOutcomeReportTerms`), or read "not stated". */
|
|
399
|
-
function packLine(model) {
|
|
767
|
+
function packLine(model, w) {
|
|
400
768
|
const { id, version } = model.terms.pack;
|
|
401
|
-
return id === NOT_STATED
|
|
769
|
+
return id === NOT_STATED
|
|
770
|
+
? w.t("card.not-stated")
|
|
771
|
+
: w.t("lines.pack-line", { id, version });
|
|
402
772
|
}
|
|
403
773
|
// ---------------------------------------------------------------------------
|
|
404
774
|
// Dating: which date the calendar and period count a conversation under, and
|
|
405
775
|
// the plain label that says so (see `ConversationDate`)
|
|
406
776
|
// ---------------------------------------------------------------------------
|
|
407
|
-
function span(days) {
|
|
777
|
+
export function span(days, w) {
|
|
408
778
|
const first = days[0];
|
|
409
779
|
const last = days[days.length - 1];
|
|
410
780
|
if (first === undefined || last === undefined)
|
|
411
|
-
return "unknown";
|
|
412
|
-
return first === last ? first :
|
|
781
|
+
return w.t("card.span.unknown");
|
|
782
|
+
return first === last ? first : w.t("card.span", { from: first, to: last });
|
|
413
783
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
record: "the case record's own timestamp",
|
|
417
|
-
judged: "the day the judgments were sealed (no case record date to read)",
|
|
418
|
-
};
|
|
784
|
+
/** What a case's date is, in words. */
|
|
785
|
+
export const basisText = (basis, w) => w.t(`card.basis.${basis}`);
|
|
419
786
|
/** The page's one plain statement of what its dates are, or undefined when every conversation is dated by the day it was judged (the card's behaviour before record dating). */
|
|
420
|
-
function datingNote(model) {
|
|
421
|
-
|
|
787
|
+
function datingNote(model, w) {
|
|
788
|
+
return datingStatement(model.dating, model.totalCount, w);
|
|
789
|
+
}
|
|
790
|
+
/** `datingNote` over any card's dating (both groupings share it), `total` being the conversations it counts. */
|
|
791
|
+
export function datingStatement(dating, total, w) {
|
|
792
|
+
const { basis, counts, judgedDays, zoneNotStated } = dating;
|
|
422
793
|
if (basis === "judged")
|
|
423
794
|
return undefined;
|
|
424
|
-
const sealed =
|
|
795
|
+
const sealed = w.t("card.dating.sealed", { span: span(judgedDays, w) });
|
|
425
796
|
const parts = [];
|
|
426
797
|
if (basis === "source")
|
|
427
|
-
parts.push(
|
|
798
|
+
parts.push(w.t("card.dating.source"));
|
|
428
799
|
else if (basis === "record")
|
|
429
|
-
parts.push("
|
|
800
|
+
parts.push(w.t("card.dating.record"));
|
|
430
801
|
else {
|
|
431
|
-
parts.push("
|
|
802
|
+
parts.push(w.t("card.dating.mixed"));
|
|
432
803
|
if (counts.source > 0)
|
|
433
|
-
parts.push(
|
|
804
|
+
parts.push(w.t("card.dating.mixed.source", { n: String(counts.source) }));
|
|
434
805
|
if (counts.record > 0)
|
|
435
|
-
parts.push(
|
|
806
|
+
parts.push(w.t("card.dating.mixed.record", { n: String(counts.record) }));
|
|
436
807
|
if (counts.judged > 0)
|
|
437
|
-
parts.push(
|
|
808
|
+
parts.push(w.t("card.dating.mixed.judged", { n: String(counts.judged) }));
|
|
438
809
|
}
|
|
439
810
|
parts.push(sealed);
|
|
440
811
|
if (counts.source > 0)
|
|
441
|
-
parts.push("
|
|
812
|
+
parts.push(w.t("card.dating.self-attested"));
|
|
442
813
|
if (zoneNotStated > 0)
|
|
443
|
-
parts.push(
|
|
814
|
+
parts.push(w.t("card.dating.tz", {
|
|
815
|
+
count: String(zoneNotStated),
|
|
816
|
+
total: String(total),
|
|
817
|
+
}));
|
|
444
818
|
return parts.join(" ");
|
|
445
819
|
}
|
|
446
|
-
function renderMeta(host, model) {
|
|
820
|
+
function renderMeta(host, model, w, notes) {
|
|
447
821
|
const section = el("section", "");
|
|
448
822
|
section.dataset.section = "meta";
|
|
449
823
|
const row1 = el("div", "ih-row");
|
|
450
824
|
const bill = el("div", "party");
|
|
451
|
-
bill.append(el("div", "k", "
|
|
452
|
-
bill.append(el("div", "v", packLine(model)));
|
|
825
|
+
bill.append(el("div", "k", w.t("lines.meta.pack")));
|
|
826
|
+
bill.append(el("div", "v", packLine(model, w)));
|
|
453
827
|
row1.append(bill);
|
|
454
828
|
const title = el("div", "ih-title");
|
|
455
|
-
title.append(el("h1", "inv-title", "
|
|
456
|
-
|
|
829
|
+
title.append(el("h1", "inv-title", w.t("lines.title")));
|
|
830
|
+
const summary = reportSummary(w);
|
|
831
|
+
if (summary !== undefined)
|
|
832
|
+
title.append(summary);
|
|
833
|
+
// No Evidence Contract field states when the terms were locked; the line
|
|
834
|
+
// is drawn only when one does, never as a standing "not stated".
|
|
835
|
+
if (model.terms.pack.locked !== NOT_STATED)
|
|
836
|
+
title.append(el("div", "inv-sub", w.t("lines.meta.locked", { locked: model.terms.pack.locked })));
|
|
457
837
|
row1.append(title);
|
|
458
838
|
section.append(row1);
|
|
459
839
|
const row2 = el("div", "ih-row");
|
|
@@ -465,29 +845,41 @@ function renderMeta(host, model) {
|
|
|
465
845
|
line.append(element("span", label), element("span", value));
|
|
466
846
|
details.append(line);
|
|
467
847
|
};
|
|
468
|
-
metaRow("
|
|
469
|
-
? "no
|
|
470
|
-
:
|
|
471
|
-
|
|
848
|
+
metaRow(w.t("lines.meta.period"), first === undefined || last === undefined
|
|
849
|
+
? w.t("lines.meta.no-conversations")
|
|
850
|
+
: first === last
|
|
851
|
+
? first
|
|
852
|
+
: w.t("card.span", { from: first, to: last }));
|
|
853
|
+
const note = datingNote(model, w);
|
|
472
854
|
if (note !== undefined) {
|
|
473
|
-
metaRow("
|
|
855
|
+
metaRow(w.t("lines.meta.sealed"), span(model.dating.judgedDays, w));
|
|
474
856
|
details.lastElementChild.setAttribute("data-sealed", "");
|
|
475
857
|
}
|
|
476
|
-
metaRow("
|
|
477
|
-
|
|
478
|
-
|
|
858
|
+
metaRow(w.t("lines.meta.conversations"), fmtCount(model.totalCount));
|
|
859
|
+
const checked = el("div", "party");
|
|
860
|
+
const rules = model.terms.checks.reduce((n, c) => n + c.criteria.length, 0);
|
|
861
|
+
checked.append(el("div", "k", w.t("lines.meta.what-checked")));
|
|
862
|
+
const groups = model.terms.checks.length;
|
|
863
|
+
const what = el("div", "d", w.t("lines.meta.what-checked.text", {
|
|
864
|
+
rules: w.p("lines.meta.rules", rules, { n: String(rules) }),
|
|
865
|
+
groups: w.p("lines.meta.groups", groups, { n: String(groups) }),
|
|
866
|
+
questions: model.terms.checks.map((c) => groupTitle(c, w)).join(" · "),
|
|
867
|
+
}));
|
|
868
|
+
what.dataset.whatChecked = String(rules);
|
|
869
|
+
checked.append(what);
|
|
870
|
+
row2.append(checked, details);
|
|
479
871
|
section.append(row2);
|
|
480
872
|
if (note !== undefined) {
|
|
481
873
|
const label = el("p", "date-note", note);
|
|
482
874
|
label.dataset.dateNote = model.dating.basis;
|
|
483
|
-
|
|
875
|
+
notes.append(label);
|
|
484
876
|
}
|
|
485
877
|
host.append(section);
|
|
486
878
|
}
|
|
487
879
|
// ---------------------------------------------------------------------------
|
|
488
|
-
//
|
|
880
|
+
// Summary: report lines
|
|
489
881
|
// ---------------------------------------------------------------------------
|
|
490
|
-
function renderLines(host, model, runInfo) {
|
|
882
|
+
function renderLines(host, model, runInfo, w, notes) {
|
|
491
883
|
const section = el("section", "");
|
|
492
884
|
section.dataset.section = "lines";
|
|
493
885
|
const table = document.createElement("table");
|
|
@@ -495,91 +887,232 @@ function renderLines(host, model, runInfo) {
|
|
|
495
887
|
table.dataset.rows = "report-lines";
|
|
496
888
|
const thead = document.createElement("thead");
|
|
497
889
|
const headRow = document.createElement("tr");
|
|
498
|
-
headRow.append(element("th", "
|
|
890
|
+
headRow.append(element("th", w.t("lines.col.result")), el("th", "n", w.t("lines.lines.col.conversations")));
|
|
499
891
|
thead.append(headRow);
|
|
500
892
|
table.append(thead);
|
|
501
893
|
const tbody = document.createElement("tbody");
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
894
|
+
const byStatus = (status) => model.conversations.filter((c) => conversationStatus(c) === status);
|
|
895
|
+
const resolved = byStatus("resolved");
|
|
896
|
+
const missed = byStatus("missed");
|
|
897
|
+
const unverified = byStatus("unverified");
|
|
898
|
+
const undecided = [...byStatus("undecided"), ...byStatus("nothing-applied")];
|
|
899
|
+
const share = (n) => fmtShare(n, model.totalCount, model.options.percentages, w);
|
|
900
|
+
const line = (key, count, shown, behind) => ({
|
|
901
|
+
key,
|
|
902
|
+
label: w.t(`lines.line.${key}`),
|
|
903
|
+
help: w.t(`lines.line.${key}.help`),
|
|
904
|
+
count,
|
|
905
|
+
shown,
|
|
906
|
+
...(behind === undefined ? {} : { behind }),
|
|
907
|
+
});
|
|
505
908
|
const lines = [
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
"Conversations resolved correctly",
|
|
509
|
-
model.resolvedCount,
|
|
510
|
-
fmtShare(model.resolvedCount, model.totalCount, model.options.percentages),
|
|
511
|
-
],
|
|
512
|
-
[
|
|
513
|
-
"missed",
|
|
514
|
-
"Conversations missed",
|
|
515
|
-
model.missedCount,
|
|
516
|
-
fmtShare(model.missedCount, model.totalCount, model.options.percentages),
|
|
517
|
-
],
|
|
518
|
-
[
|
|
519
|
-
"held",
|
|
520
|
-
"Held pending adjudication",
|
|
521
|
-
model.heldCount,
|
|
522
|
-
fmtCount(model.heldCount),
|
|
523
|
-
],
|
|
524
|
-
[
|
|
525
|
-
"added",
|
|
526
|
-
"Added after adjudication",
|
|
527
|
-
model.addedCount,
|
|
528
|
-
fmtCount(model.addedCount),
|
|
529
|
-
],
|
|
530
|
-
[
|
|
531
|
-
"not-applicable",
|
|
532
|
-
"Criterion judgments not applicable",
|
|
533
|
-
model.notApplicableCount,
|
|
534
|
-
fmtCount(model.notApplicableCount),
|
|
535
|
-
],
|
|
909
|
+
line("resolved", resolved.length, share(resolved.length), resolved),
|
|
910
|
+
line("missed", missed.length, share(missed.length), missed),
|
|
536
911
|
];
|
|
537
|
-
|
|
912
|
+
if (unverified.length > 0)
|
|
913
|
+
lines.push(line("unverified", unverified.length, share(unverified.length), unverified));
|
|
914
|
+
if (undecided.length > 0)
|
|
915
|
+
lines.push(line("undecided", undecided.length, share(undecided.length), undecided));
|
|
916
|
+
// A person's re-grades are lines only when this bundle has one; their
|
|
917
|
+
// absence is said where the re-grade records are (renderHumanChecks).
|
|
918
|
+
if (model.heldCount > 0)
|
|
919
|
+
lines.push(line("held", model.heldCount, fmtCount(model.heldCount)));
|
|
920
|
+
if (model.addedCount > 0)
|
|
921
|
+
lines.push(line("added", model.addedCount, fmtCount(model.addedCount)));
|
|
922
|
+
for (const line of lines) {
|
|
538
923
|
const tr = document.createElement("tr");
|
|
539
|
-
tr.dataset.line = key;
|
|
540
|
-
tr.dataset.count = String(count);
|
|
924
|
+
tr.dataset.line = line.key;
|
|
925
|
+
tr.dataset.count = String(line.count);
|
|
541
926
|
const desc = el("td", "desc");
|
|
542
|
-
desc.append(el("b", "", label));
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
927
|
+
desc.append(el("b", "", line.label));
|
|
928
|
+
desc.append(el("small", "", line.help));
|
|
929
|
+
if (line.behind !== undefined && line.behind.length > 0) {
|
|
930
|
+
const label = w.p("lines.drill.show", line.behind.length, {
|
|
931
|
+
n: fmtCount(line.behind.length),
|
|
932
|
+
});
|
|
933
|
+
const behind = line.behind;
|
|
934
|
+
desc.append(line.key === "missed"
|
|
935
|
+
? drill(label, () => whyMissed(behind, model, runInfo, w), line.key)
|
|
936
|
+
: conversationsDrill(label, behind, model, runInfo, line.key, w));
|
|
937
|
+
}
|
|
938
|
+
tr.append(desc, el("td", "n", line.shown));
|
|
553
939
|
tbody.append(tr);
|
|
554
940
|
}
|
|
555
941
|
table.append(tbody);
|
|
556
942
|
section.append(table);
|
|
943
|
+
const na = el("p", "na-note", w.p("lines.na-note", model.notApplicableCount, {
|
|
944
|
+
n: fmtCount(model.notApplicableCount),
|
|
945
|
+
}));
|
|
946
|
+
na.dataset.line = "not-applicable";
|
|
947
|
+
na.dataset.count = String(model.notApplicableCount);
|
|
948
|
+
notes.append(na);
|
|
949
|
+
// Result v0 section 4.2: out of scope is counted on its own, never as not
|
|
950
|
+
// applicable and never as met; said only when a bundle has one.
|
|
951
|
+
if (model.outOfScopeCount > 0) {
|
|
952
|
+
const oos = el("p", "na-note", w.p("lines.oos-note", model.outOfScopeCount, {
|
|
953
|
+
n: fmtCount(model.outOfScopeCount),
|
|
954
|
+
}));
|
|
955
|
+
oos.dataset.line = "out-of-scope";
|
|
956
|
+
oos.dataset.count = String(model.outOfScopeCount);
|
|
957
|
+
notes.append(oos);
|
|
958
|
+
}
|
|
959
|
+
host.append(section);
|
|
960
|
+
}
|
|
961
|
+
// ---------------------------------------------------------------------------
|
|
962
|
+
// Summary: results rule by rule
|
|
963
|
+
// ---------------------------------------------------------------------------
|
|
964
|
+
function renderRules(host, model, runInfo, w) {
|
|
965
|
+
const section = el("section", "sec");
|
|
966
|
+
section.dataset.section = "rules";
|
|
967
|
+
section.append(el("h2", "", w.t("lines.rules.h")));
|
|
968
|
+
section.append(el("p", "lede", w.t("lines.rules.lede")));
|
|
969
|
+
const table = el("table", "rules");
|
|
970
|
+
table.dataset.rows = "rules";
|
|
971
|
+
const thead = element("thead");
|
|
972
|
+
const headRow = element("tr");
|
|
973
|
+
// Not met leads; "did not apply" is in each row's expansion, and "could
|
|
974
|
+
// not decide" stays on the row as its own count (Result v0 section 3).
|
|
975
|
+
headRow.append(element("th", w.t("lines.col.rule")), el("th", "n", ruleWord("not_met", "yes", w).word), el("th", "n", ruleWord("met", "yes", w).word), el("th", "n", w.t("lines.rules.col.undecided")));
|
|
976
|
+
// A claim that failed verification or whose evidence is missing has its
|
|
977
|
+
// own column, never folded into "not met"; drawn only when a bundle has
|
|
978
|
+
// one.
|
|
979
|
+
const anyUnverified = model.conversations.some((c) => c.criteria.some((cr) => isUnverified(cr.verdict)));
|
|
980
|
+
if (anyUnverified)
|
|
981
|
+
headRow.append(el("th", "n", w.t("lines.rules.col.unverified")));
|
|
982
|
+
// Judged out of scope (Result v0 section 4.2) is its own column, never
|
|
983
|
+
// folded into "did not apply" or "met"; drawn only when a bundle has one.
|
|
984
|
+
const anyOutOfScope = model.outOfScopeCount > 0;
|
|
985
|
+
if (anyOutOfScope)
|
|
986
|
+
headRow.append(el("th", "n", ruleWord("out_of_scope", "yes", w).word));
|
|
987
|
+
const columns = String(4 + (anyUnverified ? 1 : 0) + (anyOutOfScope ? 1 : 0));
|
|
988
|
+
thead.append(headRow);
|
|
989
|
+
table.append(thead);
|
|
990
|
+
const tbody = element("tbody");
|
|
991
|
+
for (const check of model.terms.checks) {
|
|
992
|
+
const group = el("tr", "grp");
|
|
993
|
+
group.dataset.checkId = check.id;
|
|
994
|
+
group.dataset.passCount = String(model.checkPassCounts.get(check.id) ?? 0);
|
|
995
|
+
const cell = el("td", "", groupTitle(check, w));
|
|
996
|
+
cell.setAttribute("colspan", columns);
|
|
997
|
+
group.append(cell);
|
|
998
|
+
tbody.append(group);
|
|
999
|
+
for (const criterion of check.criteria) {
|
|
1000
|
+
const ref = `${check.id}.${criterion.id}`;
|
|
1001
|
+
const of = (pick) => model.conversations.filter((c) => c.criteria.some((cr) => cr.checkId === check.id &&
|
|
1002
|
+
cr.criterionId === criterion.id &&
|
|
1003
|
+
pick(cr.verdict)));
|
|
1004
|
+
const met = of((v) => v === "met");
|
|
1005
|
+
const notMet = of(isMiss);
|
|
1006
|
+
const unverifiedHere = of(isUnverified);
|
|
1007
|
+
const na = of((v) => v === "not_applicable");
|
|
1008
|
+
const outOfScopeHere = of((v) => v === "out_of_scope");
|
|
1009
|
+
const undecided = of((v) => v === "not_evaluable" || v === "no_claim");
|
|
1010
|
+
const tr = el("tr", "rule");
|
|
1011
|
+
tr.dataset.rule = ref;
|
|
1012
|
+
tr.dataset.tier = model.criterionTiers.get(ref) ?? "unknown";
|
|
1013
|
+
const label = criterionLabel(model, check.id, criterion.id, w);
|
|
1014
|
+
const nameCell = el("td", "cn");
|
|
1015
|
+
const ruleName = el("b", "", label.label);
|
|
1016
|
+
nameCell.append(ruleName);
|
|
1017
|
+
const badge = editedBadge(model, ref, w);
|
|
1018
|
+
if (badge !== undefined)
|
|
1019
|
+
nameCell.append(badge);
|
|
1020
|
+
if (label.source === "sealed")
|
|
1021
|
+
nameCell.append(el("small", "", label.text));
|
|
1022
|
+
// contract-report/v1 section 3: the pack's explanation of the rule,
|
|
1023
|
+
// and its note for a rule whose claims could not be decided.
|
|
1024
|
+
const detail = w.row(ref, "detail");
|
|
1025
|
+
if (detail !== undefined) {
|
|
1026
|
+
const line = el("small", "rdet", detail);
|
|
1027
|
+
line.dataset.wording = "pack";
|
|
1028
|
+
nameCell.append(line);
|
|
1029
|
+
}
|
|
1030
|
+
const undecidedNote = w.row(ref, "not_evaluable");
|
|
1031
|
+
if (undecidedNote !== undefined && undecided.length > 0) {
|
|
1032
|
+
const line = el("small", "rdet", undecidedNote);
|
|
1033
|
+
line.dataset.wording = "pack";
|
|
1034
|
+
line.dataset.note = "not-evaluable";
|
|
1035
|
+
nameCell.append(line);
|
|
1036
|
+
}
|
|
1037
|
+
const problems = [
|
|
1038
|
+
...notMet,
|
|
1039
|
+
...unverifiedHere.filter((c) => !notMet.includes(c)),
|
|
1040
|
+
...undecided.filter((c) => !notMet.includes(c) && !unverifiedHere.includes(c)),
|
|
1041
|
+
];
|
|
1042
|
+
tr.append(nameCell, el("td", `n${notMet.length > 0 ? " bad" : ""}`, fmtCount(notMet.length)), el("td", "n ok", fmtCount(met.length)), el("td", "n", fmtCount(undecided.length)));
|
|
1043
|
+
if (anyUnverified)
|
|
1044
|
+
tr.append(el("td", "n", fmtCount(unverifiedHere.length)));
|
|
1045
|
+
if (anyOutOfScope)
|
|
1046
|
+
tr.append(el("td", "n", fmtCount(outOfScopeHere.length)));
|
|
1047
|
+
tbody.append(tr);
|
|
1048
|
+
// The row opens: a full-width row below it holds how many
|
|
1049
|
+
// conversations the rule did not apply to and the conversations
|
|
1050
|
+
// behind its problems, each read at the table's width. A rule with
|
|
1051
|
+
// neither has nothing to open.
|
|
1052
|
+
if (problems.length === 0 && na.length === 0)
|
|
1053
|
+
continue;
|
|
1054
|
+
const drillRow = el("tr", "drill-row");
|
|
1055
|
+
drillRow.dataset.drillFor = ref;
|
|
1056
|
+
const cell = element("td");
|
|
1057
|
+
cell.setAttribute("colspan", columns);
|
|
1058
|
+
drillRow.append(cell);
|
|
1059
|
+
// The not-applicable count is drawn now, so a static page (which runs
|
|
1060
|
+
// no script to build a body) still shows it when the row opens.
|
|
1061
|
+
if (na.length > 0) {
|
|
1062
|
+
const naLine = el("p", "rule-na", w.p("lines.rules.expand.na", na.length, {
|
|
1063
|
+
n: fmtCount(na.length),
|
|
1064
|
+
}));
|
|
1065
|
+
naLine.dataset.count = String(na.length);
|
|
1066
|
+
cell.append(naLine);
|
|
1067
|
+
}
|
|
1068
|
+
const toggle = expandableRow(tr, ruleName, drillRow, () => problems.length > 0
|
|
1069
|
+
? renderConversationList(problems, model, runInfo, `rule:${ref}`, w)
|
|
1070
|
+
: document.createDocumentFragment(), `rule-${ref}`);
|
|
1071
|
+
toggle.dataset.drill = `rule:${ref}`;
|
|
1072
|
+
tbody.append(drillRow);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
// Requirements of the cited contract the run did not cover (Result v0
|
|
1076
|
+
// section 3, `requirements_covered`): one row each, "not covered", under a group
|
|
1077
|
+
// of their own. They are in no conversation, count or column above: the
|
|
1078
|
+
// run never judged them, so no number on this page speaks for them.
|
|
1079
|
+
if (model.notRun.length > 0) {
|
|
1080
|
+
const group = el("tr", "grp");
|
|
1081
|
+
group.dataset.group = "not-run";
|
|
1082
|
+
const heading = el("td", "", w.t("lines.rules.not-run.h"));
|
|
1083
|
+
heading.setAttribute("colspan", columns);
|
|
1084
|
+
group.append(heading);
|
|
1085
|
+
tbody.append(group);
|
|
1086
|
+
for (const ref of model.notRun) {
|
|
1087
|
+
const [checkId = "", ...rest] = ref.split(".");
|
|
1088
|
+
const label = criterionLabel(model, checkId, rest.join("."), w);
|
|
1089
|
+
const tr = el("tr", "rule not-run");
|
|
1090
|
+
tr.dataset.rule = ref;
|
|
1091
|
+
tr.dataset.notRun = "true";
|
|
1092
|
+
const nameCell = el("td", "cn");
|
|
1093
|
+
nameCell.append(el("b", "", label.label));
|
|
1094
|
+
const status = el("td", "nr", w.t("lines.rules.not-run"));
|
|
1095
|
+
status.setAttribute("colspan", String(Number(columns) - 1));
|
|
1096
|
+
tr.append(nameCell, status);
|
|
1097
|
+
tbody.append(tr);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
table.append(tbody);
|
|
1101
|
+
const scroll = el("div", "tscroll");
|
|
1102
|
+
scroll.append(table);
|
|
1103
|
+
section.append(scroll);
|
|
557
1104
|
host.append(section);
|
|
558
|
-
const stamps = el("div", "stamps inl");
|
|
559
|
-
const stamp = el("div", "stamp rec", "Verified · recomputed from the sealed bundle");
|
|
560
|
-
stamp.append(el("small", "", "every count and share above is recomputed from result.claims and the records they cite, never read from a stated total"));
|
|
561
|
-
stamps.append(stamp);
|
|
562
|
-
host.append(stamps);
|
|
563
|
-
const tamper = el("p", "tamper-note", 'This card only ever renders a bundle that already verified: there is no interactive "try tampering" control here, because this viewer never shows content first and checks second. Tamper with any claim, record, or checkpoint in the underlying bundle and the whole page — this card included — is replaced by the verification-failed banner, before anything here is drawn.');
|
|
564
|
-
tamper.dataset.tamperNote = "verify-first";
|
|
565
|
-
host.append(tamper);
|
|
566
1105
|
}
|
|
567
1106
|
// ---------------------------------------------------------------------------
|
|
568
1107
|
// Day by day
|
|
569
1108
|
// ---------------------------------------------------------------------------
|
|
570
|
-
function renderCalendar(host, model) {
|
|
1109
|
+
function renderCalendar(host, model, w) {
|
|
571
1110
|
const section = el("section", "sec");
|
|
572
1111
|
section.dataset.section = "calendar";
|
|
573
|
-
section.append(el("h2", "", "
|
|
574
|
-
const note = datingNote(model);
|
|
575
|
-
section.append(el("p", "lede", note === undefined
|
|
576
|
-
|
|
577
|
-
: "Resolved conversations per day, by each conversation's own date, cited by this bundle's claims."));
|
|
578
|
-
if (note !== undefined) {
|
|
579
|
-
const label = el("p", "date-note", note);
|
|
580
|
-
label.dataset.dateNote = model.dating.basis;
|
|
581
|
-
section.append(label);
|
|
582
|
-
}
|
|
1112
|
+
section.append(el("h2", "", w.t("lines.cal.h")));
|
|
1113
|
+
const note = datingNote(model, w);
|
|
1114
|
+
section.append(el("p", "lede", w.t(note === undefined ? "lines.cal.lede" : "lines.cal.lede.dated")));
|
|
1115
|
+
// The dating note itself is said once, in the sheet's footnotes.
|
|
583
1116
|
const list = el("div", "cal");
|
|
584
1117
|
list.dataset.days = String(model.days.length);
|
|
585
1118
|
for (const day of model.days) {
|
|
@@ -591,18 +1124,18 @@ function renderCalendar(host, model) {
|
|
|
591
1124
|
if (note !== undefined) {
|
|
592
1125
|
const bases = new Set(day.conversations.map((c) => c.dated.basis));
|
|
593
1126
|
if (bases.has("source")) {
|
|
594
|
-
const chip = el("div", "src-says", "source
|
|
1127
|
+
const chip = el("div", "src-says", w.t("lines.cal.source-says"));
|
|
595
1128
|
chip.dataset.sourceSays = String(day.conversations.filter((c) => c.dated.basis === "source").length);
|
|
596
1129
|
item.append(chip);
|
|
597
1130
|
}
|
|
598
1131
|
const notStated = day.conversations.filter((c) => c.dated.zone === "not-stated").length;
|
|
599
1132
|
if (notStated > 0) {
|
|
600
|
-
const tz = el("div", "tz", "
|
|
1133
|
+
const tz = el("div", "tz", w.t("lines.cal.tz"));
|
|
601
1134
|
tz.dataset.tzMarker = "not-stated";
|
|
602
1135
|
item.append(tz);
|
|
603
1136
|
}
|
|
604
1137
|
}
|
|
605
|
-
item.append(el("div", "v", fmtShare(day.resolvedCount, day.conversations.length, model.options.percentages)));
|
|
1138
|
+
item.append(el("div", "v", fmtShare(day.resolvedCount, day.conversations.length, model.options.percentages, w)));
|
|
606
1139
|
const mini = el("div", "mini");
|
|
607
1140
|
const share = day.conversations.length === 0
|
|
608
1141
|
? 0
|
|
@@ -612,12 +1145,12 @@ function renderCalendar(host, model) {
|
|
|
612
1145
|
mini.append(fill);
|
|
613
1146
|
item.append(mini);
|
|
614
1147
|
if (note !== undefined) {
|
|
615
|
-
const sealed = el("div", "sealed",
|
|
1148
|
+
const sealed = el("div", "sealed", w.t("lines.cal.sealed", { span: span(day.judgedDays, w) }));
|
|
616
1149
|
sealed.dataset.sealed = day.judgedDays.join(" ");
|
|
617
1150
|
item.append(sealed);
|
|
618
1151
|
}
|
|
619
1152
|
if (day.policyChanged !== null) {
|
|
620
|
-
const flag = el("div", "flag", "policy
|
|
1153
|
+
const flag = el("div", "flag", w.t("lines.cal.policy-changed"));
|
|
621
1154
|
flag.dataset.policyChanged = day.policyChanged;
|
|
622
1155
|
item.append(flag);
|
|
623
1156
|
}
|
|
@@ -629,13 +1162,13 @@ function renderCalendar(host, model) {
|
|
|
629
1162
|
// ---------------------------------------------------------------------------
|
|
630
1163
|
// Human spot checks
|
|
631
1164
|
// ---------------------------------------------------------------------------
|
|
632
|
-
function renderHumanChecks(host, calibration) {
|
|
1165
|
+
function renderHumanChecks(host, calibration, w) {
|
|
633
1166
|
const section = el("section", "sec");
|
|
634
1167
|
section.dataset.section = "human-checks";
|
|
635
|
-
section.append(el("h2", "", "
|
|
636
|
-
section.append(el("p", "lede", "
|
|
1168
|
+
section.append(el("h2", "", w.t("lines.hc.h")));
|
|
1169
|
+
section.append(el("p", "lede", w.t("lines.hc.lede")));
|
|
637
1170
|
if (calibration.length === 0) {
|
|
638
|
-
section.append(el("p", "", "
|
|
1171
|
+
section.append(el("p", "", w.t("lines.hc.none")));
|
|
639
1172
|
host.append(section);
|
|
640
1173
|
return;
|
|
641
1174
|
}
|
|
@@ -644,7 +1177,7 @@ function renderHumanChecks(host, calibration) {
|
|
|
644
1177
|
table.dataset.weeks = String(calibration.length);
|
|
645
1178
|
const thead = document.createElement("thead");
|
|
646
1179
|
const headRow = document.createElement("tr");
|
|
647
|
-
headRow.append(element("th", "
|
|
1180
|
+
headRow.append(element("th", w.t("lines.hc.col.week")), el("th", "n", w.t("lines.hc.col.agreed")), el("th", "n", w.t("lines.hc.col.held")), el("th", "n", w.t("lines.hc.col.added")));
|
|
648
1181
|
thead.append(headRow);
|
|
649
1182
|
table.append(thead);
|
|
650
1183
|
const tbody = document.createElement("tbody");
|
|
@@ -654,7 +1187,7 @@ function renderHumanChecks(host, calibration) {
|
|
|
654
1187
|
tr.dataset.k = String(week.k);
|
|
655
1188
|
tr.dataset.n = String(week.n);
|
|
656
1189
|
tr.append(el("td", "", week.weekId));
|
|
657
|
-
tr.append(el("td", "n",
|
|
1190
|
+
tr.append(el("td", "n", w.t("lines.hc.agreed", { k: String(week.k), n: String(week.n) })));
|
|
658
1191
|
const held = week.sample.filter((s) => s.aiVerdict === "met" && s.humanVerdict !== "met").length;
|
|
659
1192
|
const added = week.sample.filter((s) => s.aiVerdict !== "met" && s.humanVerdict === "met").length;
|
|
660
1193
|
const heldCell = el("td", "n", String(held));
|
|
@@ -669,54 +1202,17 @@ function renderHumanChecks(host, calibration) {
|
|
|
669
1202
|
host.append(section);
|
|
670
1203
|
}
|
|
671
1204
|
// ---------------------------------------------------------------------------
|
|
672
|
-
// Why conversations missed
|
|
673
|
-
// ---------------------------------------------------------------------------
|
|
674
|
-
function renderWhyMissed(host, model, runInfo) {
|
|
675
|
-
const section = el("section", "sec");
|
|
676
|
-
section.dataset.section = "why-missed";
|
|
677
|
-
section.append(el("h2", "", "Why conversations missed"));
|
|
678
|
-
const bars = el("div", "bars");
|
|
679
|
-
bars.dataset.checkBars = "true";
|
|
680
|
-
for (const check of model.terms.checks) {
|
|
681
|
-
const count = model.checkPassCounts.get(check.id) ?? 0;
|
|
682
|
-
const item = el("div", "bar");
|
|
683
|
-
item.dataset.checkId = check.id;
|
|
684
|
-
item.dataset.passCount = String(count);
|
|
685
|
-
const nm = el("div", "nm", check.question);
|
|
686
|
-
const track = el("div", "track");
|
|
687
|
-
const share = model.totalCount === 0 ? 0 : count / model.totalCount;
|
|
688
|
-
const fill = element("i");
|
|
689
|
-
fill.style.width = `${Math.round(share * 100)}%`;
|
|
690
|
-
track.append(fill);
|
|
691
|
-
const num = el("div", "num", fmtShare(count, model.totalCount, model.options.percentages));
|
|
692
|
-
item.append(nm, track, num);
|
|
693
|
-
bars.append(item);
|
|
694
|
-
}
|
|
695
|
-
section.append(bars);
|
|
696
|
-
const reasons = el("div", "reasons");
|
|
697
|
-
reasons.dataset.reasons = String(model.missedReasons.length);
|
|
698
|
-
for (const group of model.missedReasons) {
|
|
699
|
-
const item = el("details", "rsn-d");
|
|
700
|
-
item.dataset.reasonKey = group.key;
|
|
701
|
-
item.dataset.reasonStructured = String(group.structured);
|
|
702
|
-
item.dataset.count = String(group.conversations.length);
|
|
703
|
-
const row = el("summary", "rsn");
|
|
704
|
-
row.append(element("span", group.label), el("span", "c", `${fmtCount(group.conversations.length)} · see them ›`));
|
|
705
|
-
item.append(row);
|
|
706
|
-
item.append(renderConversationList(group.conversations, model, runInfo, `reason:${group.key}`));
|
|
707
|
-
reasons.append(item);
|
|
708
|
-
}
|
|
709
|
-
section.append(reasons);
|
|
710
|
-
host.append(section);
|
|
711
|
-
}
|
|
712
|
-
// ---------------------------------------------------------------------------
|
|
713
1205
|
// The terms
|
|
714
1206
|
// ---------------------------------------------------------------------------
|
|
715
|
-
function renderTerms(host, model) {
|
|
716
|
-
const section = el("
|
|
1207
|
+
function renderTerms(host, model, w) {
|
|
1208
|
+
const section = el("div", "rp-s");
|
|
717
1209
|
section.dataset.section = "terms";
|
|
718
|
-
section.append(el("
|
|
719
|
-
const lede = el("p", "lede",
|
|
1210
|
+
section.append(el("h3", "", w.t("lines.terms.h")));
|
|
1211
|
+
const lede = el("p", "lede", model.terms.pack.agreement === NOT_STATED
|
|
1212
|
+
? w.t("lines.terms.lede")
|
|
1213
|
+
: w.t("lines.terms.lede.agreed", {
|
|
1214
|
+
agreement: model.terms.pack.agreement,
|
|
1215
|
+
}));
|
|
720
1216
|
lede.dataset.termsSource = "bundle";
|
|
721
1217
|
section.append(lede);
|
|
722
1218
|
const pack = el("div", "pack");
|
|
@@ -725,11 +1221,14 @@ function renderTerms(host, model) {
|
|
|
725
1221
|
box.append(el("div", "k", label), el("div", "v", value));
|
|
726
1222
|
pack.append(box);
|
|
727
1223
|
};
|
|
728
|
-
packField("
|
|
729
|
-
packField("
|
|
730
|
-
?
|
|
731
|
-
:
|
|
732
|
-
|
|
1224
|
+
packField(w.t("lines.meta.pack"), model.terms.pack.id);
|
|
1225
|
+
packField(w.t("lines.terms.version"), model.terms.pack.version === NOT_STATED
|
|
1226
|
+
? w.t("card.not-stated")
|
|
1227
|
+
: w.t("lines.terms.version.value", {
|
|
1228
|
+
version: model.terms.pack.version,
|
|
1229
|
+
}));
|
|
1230
|
+
if (model.terms.pack.locked !== NOT_STATED)
|
|
1231
|
+
packField(w.t("lines.terms.locked"), model.terms.pack.locked);
|
|
733
1232
|
section.append(pack);
|
|
734
1233
|
const outcome = el("div", "outcome");
|
|
735
1234
|
const outcomeIcon = el("div", "oic");
|
|
@@ -738,7 +1237,7 @@ function renderTerms(host, model) {
|
|
|
738
1237
|
outcomeIcon.append(target);
|
|
739
1238
|
outcome.append(outcomeIcon);
|
|
740
1239
|
const outcomeBody = element("div");
|
|
741
|
-
outcomeBody.append(el("div", "t", "
|
|
1240
|
+
outcomeBody.append(el("div", "t", w.t("lines.terms.outcome")));
|
|
742
1241
|
outcomeBody.append(el("div", "v", model.terms.pack.outcomeStatement));
|
|
743
1242
|
outcome.append(outcomeBody);
|
|
744
1243
|
section.append(outcome);
|
|
@@ -752,7 +1251,7 @@ function renderTerms(host, model) {
|
|
|
752
1251
|
if (drawn !== undefined)
|
|
753
1252
|
checkIcon.append(drawn);
|
|
754
1253
|
card.append(checkIcon);
|
|
755
|
-
card.append(el("div", "q", check
|
|
1254
|
+
card.append(el("div", "q", groupTitle(check, w)));
|
|
756
1255
|
card.append(el("div", "d", check.description));
|
|
757
1256
|
const criteria = el("ul", "subs");
|
|
758
1257
|
for (const criterion of check.criteria) {
|
|
@@ -766,21 +1265,24 @@ function renderTerms(host, model) {
|
|
|
766
1265
|
source: "unstated",
|
|
767
1266
|
};
|
|
768
1267
|
item.dataset.wording = wording.source;
|
|
769
|
-
const label = el("b", "", criterion.label);
|
|
770
|
-
const termsBadge = editedBadge(model, ref);
|
|
1268
|
+
const label = el("b", "", w.row(ref, "label") ?? criterion.label);
|
|
1269
|
+
const termsBadge = editedBadge(model, ref, w);
|
|
771
1270
|
if (termsBadge !== undefined)
|
|
772
1271
|
label.append(termsBadge);
|
|
773
1272
|
item.append(label);
|
|
774
|
-
item.append(element("span",
|
|
1273
|
+
item.append(element("span", w.t("lines.terms.criterion", {
|
|
1274
|
+
text: wording.text,
|
|
1275
|
+
tier: tierLabel(tier, w),
|
|
1276
|
+
})));
|
|
775
1277
|
if (wording.source !== "sealed")
|
|
776
|
-
item.append(el("small", "wsrc",
|
|
1278
|
+
item.append(el("small", "wsrc", wordingFallback(wording.source, w)));
|
|
777
1279
|
criteria.append(item);
|
|
778
1280
|
}
|
|
779
1281
|
card.append(criteria);
|
|
780
1282
|
checks.append(card);
|
|
781
1283
|
}
|
|
782
1284
|
section.append(checks);
|
|
783
|
-
const note = el("p", "small", wordingNote(model));
|
|
1285
|
+
const note = el("p", "small", wordingNote(model, w));
|
|
784
1286
|
note.dataset.wordingNote = "true";
|
|
785
1287
|
section.append(note);
|
|
786
1288
|
section.append(el("div", "rule", model.terms.pack.resolutionRule));
|
|
@@ -789,10 +1291,10 @@ function renderTerms(host, model) {
|
|
|
789
1291
|
// ---------------------------------------------------------------------------
|
|
790
1292
|
// What ran
|
|
791
1293
|
// ---------------------------------------------------------------------------
|
|
792
|
-
function renderWhatRan(host, runInfo) {
|
|
793
|
-
const section = el("
|
|
1294
|
+
function renderWhatRan(host, runInfo, w) {
|
|
1295
|
+
const section = el("div", "rp-s");
|
|
794
1296
|
section.dataset.section = "what-ran";
|
|
795
|
-
section.append(el("
|
|
1297
|
+
section.append(el("h3", "", w.t("lines.ran.h")));
|
|
796
1298
|
const ran = el("div", "ran");
|
|
797
1299
|
ran.dataset.pinned = String(runInfo.pinned);
|
|
798
1300
|
if (runInfo.judgePinRecomputes !== undefined)
|
|
@@ -808,30 +1310,33 @@ function renderWhatRan(host, runInfo) {
|
|
|
808
1310
|
// digest (verifyJudgePin); otherwise they are "not stated", never shown
|
|
809
1311
|
// beside a digest they do not produce.
|
|
810
1312
|
const pin = runInfo.judgePinRecomputes === true ? runInfo.judgePin : undefined;
|
|
811
|
-
|
|
812
|
-
box("
|
|
813
|
-
|
|
1313
|
+
const notStated = w.t("card.not-stated");
|
|
1314
|
+
box(w.t("lines.ran.contract"), runInfo.contract ?? notStated, "contract");
|
|
1315
|
+
box(w.t("lines.ran.judge-model"), pin === undefined
|
|
1316
|
+
? notStated
|
|
814
1317
|
: pin.modelVersion === undefined
|
|
815
1318
|
? pin.modelId
|
|
816
1319
|
: `${pin.modelId} ${pin.modelVersion}`, "judge-model");
|
|
817
|
-
box("
|
|
818
|
-
?
|
|
1320
|
+
box(w.t("lines.ran.judge-pin"), runInfo.judgePinDigest === undefined
|
|
1321
|
+
? pinNotShown(runInfo, w)
|
|
819
1322
|
: pin === undefined
|
|
820
1323
|
? runInfo.judgePinDigest
|
|
821
|
-
:
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
box("
|
|
1324
|
+
: w.t("lines.ran.judge-pin.recomputed", {
|
|
1325
|
+
digest: runInfo.judgePinDigest,
|
|
1326
|
+
}), "judge-pin-digest");
|
|
1327
|
+
box(w.t("lines.ran.judge-prompt"), pin?.promptDigest ?? notStated, "judge-prompt-digest");
|
|
1328
|
+
box(w.t("lines.ran.judge-axes"), pin?.axesDigest ?? notStated, "judge-axes-digest");
|
|
1329
|
+
box(w.t("lines.ran.agent"), w.t("lines.ran.agent.value"), "agent");
|
|
825
1330
|
section.append(ran);
|
|
826
1331
|
if (runInfo.judgePinRecomputes === false) {
|
|
827
|
-
const warning = el("p", "", "
|
|
1332
|
+
const warning = el("p", "", w.t("lines.ran.components-mismatch"));
|
|
828
1333
|
warning.dataset.pinComponentsMismatch = "true";
|
|
829
1334
|
section.append(warning);
|
|
830
1335
|
}
|
|
831
|
-
const lock = el("div", "lock", "
|
|
1336
|
+
const lock = el("div", "lock", w.t("lines.ran.lock"));
|
|
832
1337
|
section.append(lock);
|
|
833
1338
|
if (!runInfo.pinned) {
|
|
834
|
-
const warning = el("p", "", "
|
|
1339
|
+
const warning = el("p", "", w.t("lines.ran.pin-mismatch"));
|
|
835
1340
|
warning.dataset.pinMismatch = "true";
|
|
836
1341
|
section.append(warning);
|
|
837
1342
|
}
|
|
@@ -840,46 +1345,144 @@ function renderWhatRan(host, runInfo) {
|
|
|
840
1345
|
// ---------------------------------------------------------------------------
|
|
841
1346
|
// Verification details
|
|
842
1347
|
// ---------------------------------------------------------------------------
|
|
843
|
-
function renderVerificationDetails(host, bundle, verified) {
|
|
844
|
-
const section = el("
|
|
1348
|
+
function renderVerificationDetails(host, bundle, verified, w) {
|
|
1349
|
+
const section = el("div", "rp-s");
|
|
845
1350
|
section.dataset.section = "verification-details";
|
|
846
|
-
section.append(el("
|
|
847
|
-
section.append(el("p", "lede", "
|
|
1351
|
+
section.append(el("h3", "", w.t("card.vd.h")));
|
|
1352
|
+
section.append(el("p", "lede", w.t("lines.vd.lede")));
|
|
848
1353
|
const model = buildVerificationPageModel(bundle, verified);
|
|
849
1354
|
const tech = el("div", "tech");
|
|
850
1355
|
const field = (label, value) => {
|
|
851
1356
|
tech.append(el("div", "k", label), el("div", "v", value));
|
|
852
1357
|
};
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
field("Checkpoint size", String(model.checkpointSize ?? "absent"));
|
|
1358
|
+
for (const [label, value] of verificationRows(model, w))
|
|
1359
|
+
field(label, value);
|
|
856
1360
|
section.append(tech);
|
|
857
|
-
const note = el("p", "note", "
|
|
1361
|
+
const note = el("p", "note", w.t("lines.vd.note"));
|
|
858
1362
|
note.dataset.checkpointKind = "mmr";
|
|
859
1363
|
section.append(note);
|
|
860
1364
|
host.append(section);
|
|
861
1365
|
}
|
|
862
|
-
|
|
1366
|
+
// ---------------------------------------------------------------------------
|
|
1367
|
+
// Proofs for the whole report: one toggle at the foot of the page
|
|
1368
|
+
// ---------------------------------------------------------------------------
|
|
1369
|
+
/** The bundle's digest and checkpoint, for the report proofs of either grouping. */
|
|
1370
|
+
export function verificationRows(model, w) {
|
|
1371
|
+
return [
|
|
1372
|
+
[
|
|
1373
|
+
w.t("card.vd.bundle-digest"),
|
|
1374
|
+
model.bundleDigest ?? w.t("card.vd.uncomputable"),
|
|
1375
|
+
],
|
|
1376
|
+
[
|
|
1377
|
+
w.t("card.vd.checkpoint-root"),
|
|
1378
|
+
model.checkpointRoot ?? w.t("card.vd.absent"),
|
|
1379
|
+
],
|
|
1380
|
+
[
|
|
1381
|
+
w.t("card.vd.checkpoint-size"),
|
|
1382
|
+
model.checkpointSize === undefined
|
|
1383
|
+
? w.t("card.vd.absent")
|
|
1384
|
+
: String(model.checkpointSize),
|
|
1385
|
+
],
|
|
1386
|
+
];
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Which wording pack drew this card, in its report proofs: every layer
|
|
1390
|
+
* applied, by digest, not only the final one -- the base layer's digest is
|
|
1391
|
+
* named even on a default-only page (contract-report/v1 §3 records every
|
|
1392
|
+
* layer applied).
|
|
1393
|
+
*/
|
|
1394
|
+
export function wordingRow(w) {
|
|
1395
|
+
const refused = w.source.refused;
|
|
1396
|
+
return [
|
|
1397
|
+
w.t("card.pf.wording"),
|
|
1398
|
+
refused !== undefined
|
|
1399
|
+
? w.t("card.pf.wording.refused", {
|
|
1400
|
+
sha256: refused.sha256,
|
|
1401
|
+
reason: w.t(`card.wording.refused.${refused.reason}`),
|
|
1402
|
+
baseId: w.source.base?.id ?? w.source.id,
|
|
1403
|
+
baseSha256: w.source.base?.sha256 ?? w.source.sha256 ?? "",
|
|
1404
|
+
})
|
|
1405
|
+
: w.source.base === undefined
|
|
1406
|
+
? w.t("card.pf.wording.default", {
|
|
1407
|
+
id: w.source.id,
|
|
1408
|
+
sha256: w.source.sha256 ?? "",
|
|
1409
|
+
})
|
|
1410
|
+
: w.t("card.pf.wording.supplied.layered", {
|
|
1411
|
+
id: w.source.id,
|
|
1412
|
+
sha256: w.source.sha256 ?? "",
|
|
1413
|
+
baseId: w.source.base.id,
|
|
1414
|
+
baseSha256: w.source.base.sha256,
|
|
1415
|
+
}),
|
|
1416
|
+
];
|
|
1417
|
+
}
|
|
1418
|
+
function renderReportProofs(host, model, runInfo, bundle, verified, w) {
|
|
1419
|
+
const section = el("section", "sec rp");
|
|
1420
|
+
section.dataset.section = "report-proofs";
|
|
1421
|
+
// Built on first open, like every other toggle.
|
|
1422
|
+
const toggle = levelToggle(2, w.t("lines.rp.toggle"), () => {
|
|
1423
|
+
const box = el("div", "pf-b");
|
|
1424
|
+
const ids = proofList([
|
|
1425
|
+
[w.t("card.pf.result-capsule"), model.capsuleId],
|
|
1426
|
+
[w.t("lines.meta.pack"), packLine(model, w)],
|
|
1427
|
+
wordingRow(w),
|
|
1428
|
+
]);
|
|
1429
|
+
ids.dataset.reportIds = "true";
|
|
1430
|
+
box.append(ids);
|
|
1431
|
+
renderTerms(box, model, w);
|
|
1432
|
+
renderWhatRan(box, runInfo, w);
|
|
1433
|
+
renderVerificationDetails(box, bundle, verified, w);
|
|
1434
|
+
const tamper = el("p", "tamper-note", w.t("lines.rp.tamper"));
|
|
1435
|
+
tamper.dataset.tamperNote = "verify-first";
|
|
1436
|
+
box.append(tamper);
|
|
1437
|
+
return box;
|
|
1438
|
+
}, { className: "proofs" });
|
|
1439
|
+
section.append(toggle);
|
|
1440
|
+
host.append(section);
|
|
1441
|
+
}
|
|
1442
|
+
/** The `lines` grouping's page wrapper: its element, class, page name and stylesheet. */
|
|
1443
|
+
export const LINES_FRAME = {
|
|
1444
|
+
tag: "section",
|
|
1445
|
+
className: "oi",
|
|
1446
|
+
page: "outcome-report",
|
|
1447
|
+
css: OUTCOME_REPORT_CSS,
|
|
1448
|
+
};
|
|
1449
|
+
/**
|
|
1450
|
+
* Draw the `lines` grouping into `wrapper` (contract-report.ts made it and
|
|
1451
|
+
* put its stylesheet in it). Every word is `w`'s.
|
|
1452
|
+
*/
|
|
1453
|
+
export async function drawLines(levels, result, options, bundle, verified, w) {
|
|
863
1454
|
const model = buildOutcomeReportModel(result, options);
|
|
864
1455
|
const runInfo = await verifyJudgePin(model.runInfo);
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
wrapper.append(style);
|
|
870
|
-
renderProducerNote(wrapper, model);
|
|
1456
|
+
const claims = model.conversations.flatMap((c) => c.criteria.flatMap((cr) => (cr.claim === undefined ? [] : [cr.claim])));
|
|
1457
|
+
// L0, what matters: the header with the mock-judge mark (D5 b), the
|
|
1458
|
+
// sealed aggregate, then the per-conversation lines, each opening its list.
|
|
1459
|
+
const mock = renderMockJudgeLine(await tallyJudges(result.records, claims), w);
|
|
871
1460
|
const sheet = el("div", "sheet");
|
|
872
1461
|
const pad = el("div", "pad");
|
|
873
|
-
|
|
874
|
-
|
|
1462
|
+
// Notes that explain a figure sit under the sheet, in small type, never
|
|
1463
|
+
// between the reader and the figures.
|
|
1464
|
+
const notes = el("aside", "footnotes");
|
|
1465
|
+
notes.dataset.section = "footnotes";
|
|
1466
|
+
renderMeta(pad, model, w, notes);
|
|
1467
|
+
const title = pad.querySelector(".ih-title");
|
|
1468
|
+
if (title !== null)
|
|
1469
|
+
placeMockMark(title, mock);
|
|
1470
|
+
else if (mock !== undefined)
|
|
1471
|
+
pad.prepend(mock);
|
|
1472
|
+
pad.append(renderAggregate(result, w));
|
|
1473
|
+
renderLines(pad, model, runInfo, w, notes);
|
|
1474
|
+
if (notes.childElementCount > 0)
|
|
1475
|
+
pad.append(notes);
|
|
875
1476
|
sheet.append(pad);
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1477
|
+
levels.L0.append(sheet);
|
|
1478
|
+
// L1, why: rule by rule, led by who judged, who witnessed, what verified.
|
|
1479
|
+
renderRules(levels.L1, model, runInfo, w);
|
|
1480
|
+
leadWithProvenance(levels.L1, levels.L1.querySelector('[data-section="rules"]'), renderProvenance(await provenanceLines(result.records, claims, bundle, verified, w)));
|
|
1481
|
+
// L2, module detail after the core's verification section.
|
|
1482
|
+
levels.L2.append(renderCheckYourself(bundle, w));
|
|
1483
|
+
renderCalendar(levels.L2, model, w);
|
|
1484
|
+
renderHumanChecks(levels.L2, model.calibration, w);
|
|
1485
|
+
renderProducerNote(levels.L2, model, w);
|
|
1486
|
+
renderReportProofs(levels.L2, model, runInfo, bundle, verified, w);
|
|
884
1487
|
}
|
|
885
1488
|
//# sourceMappingURL=outcome-report-view.js.map
|