@kontourai/survey 0.4.12 → 0.4.14
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.
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* Bundled, scoped Survey Review Workbench styles for downstream embeds. */
|
|
2
|
-
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700;9..144,900&family=Hanken+Grotesk:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap");
|
|
3
|
-
|
|
1
|
+
/* Bundled, scoped Survey Review Workbench styles for downstream embeds. Font loading is left to the host app. */
|
|
4
2
|
.survey-workbench-embed{
|
|
5
3
|
color-scheme: dark;
|
|
6
4
|
|
|
@@ -773,7 +771,7 @@
|
|
|
773
771
|
|
|
774
772
|
.survey-workbench-embed .candidate-card{
|
|
775
773
|
display: grid;
|
|
776
|
-
grid-template-rows: auto auto minmax(0, 1fr);
|
|
774
|
+
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
|
777
775
|
gap: 11px;
|
|
778
776
|
min-height: auto;
|
|
779
777
|
padding: 14px;
|
|
@@ -819,7 +817,7 @@
|
|
|
819
817
|
color: var(--paper-faint);
|
|
820
818
|
font-size: 10px;
|
|
821
819
|
letter-spacing: 0.1em;
|
|
822
|
-
text-transform:
|
|
820
|
+
text-transform: uppercase;
|
|
823
821
|
overflow-wrap: anywhere;
|
|
824
822
|
word-break: break-word;
|
|
825
823
|
}
|
|
@@ -1112,6 +1110,44 @@
|
|
|
1112
1110
|
color: var(--paper-faint);
|
|
1113
1111
|
}
|
|
1114
1112
|
|
|
1113
|
+
.survey-workbench-embed .reference-details{
|
|
1114
|
+
margin-top: 10px;
|
|
1115
|
+
border-top: 1px solid var(--line);
|
|
1116
|
+
padding-top: 8px;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.survey-workbench-embed .reference-details summary{
|
|
1120
|
+
cursor: pointer;
|
|
1121
|
+
color: var(--paper-faint);
|
|
1122
|
+
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
|
1123
|
+
font-size: 10px;
|
|
1124
|
+
font-weight: 600;
|
|
1125
|
+
letter-spacing: 0.08em;
|
|
1126
|
+
text-transform: uppercase;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
.survey-workbench-embed .reference-details summary::-webkit-details-marker{
|
|
1130
|
+
display: none;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.survey-workbench-embed .reference-details summary::before{
|
|
1134
|
+
content: "› ";
|
|
1135
|
+
color: var(--paper-faint);
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
.survey-workbench-embed .reference-details[open] summary{
|
|
1139
|
+
color: var(--accent);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
.survey-workbench-embed .reference-details[open] summary::before{
|
|
1143
|
+
content: "⌄ ";
|
|
1144
|
+
color: var(--accent);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.survey-workbench-embed .reference-details .field-stack{
|
|
1148
|
+
margin-top: 8px;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1115
1151
|
/* ---- Decision payload: terminal readout, intentionally demoted -------- */
|
|
1116
1152
|
|
|
1117
1153
|
.survey-workbench-embed .payload-panel{
|
|
@@ -530,11 +530,12 @@ function renderSurfacePreviewSections(preview) {
|
|
|
530
530
|
].join("");
|
|
531
531
|
}
|
|
532
532
|
function renderCanonicalClaim(preview) {
|
|
533
|
-
return renderPreviewSection("Selected
|
|
534
|
-
["Candidate", preview.canonicalClaim.candidateId],
|
|
535
|
-
["Claim", preview.canonicalClaim.claimId],
|
|
533
|
+
return renderPreviewSection("Selected claim", "surface-canonical-claim", [
|
|
536
534
|
["Value", preview.canonicalClaim.value],
|
|
537
535
|
["Review status", preview.canonicalClaim.status],
|
|
536
|
+
], undefined, [
|
|
537
|
+
["Candidate ID", preview.canonicalClaim.candidateId],
|
|
538
|
+
["Claim ID", preview.canonicalClaim.claimId],
|
|
538
539
|
]);
|
|
539
540
|
}
|
|
540
541
|
function renderReviewEvent(preview) {
|
|
@@ -548,10 +549,11 @@ function renderReviewEvent(preview) {
|
|
|
548
549
|
}
|
|
549
550
|
function renderIntegrityPosture(preview) {
|
|
550
551
|
return renderPreviewSection("Integrity posture", "surface-integrity-posture", [
|
|
551
|
-
["Candidate set", preview.integrityPosture.candidateSetId],
|
|
552
|
-
["Raw source", preview.integrityPosture.rawSourceId],
|
|
553
|
-
["Extraction", preview.integrityPosture.extractionId],
|
|
554
552
|
["Checksum", preview.integrityPosture.checksum],
|
|
553
|
+
], undefined, [
|
|
554
|
+
["Candidate set ID", preview.integrityPosture.candidateSetId],
|
|
555
|
+
["Raw source ID", preview.integrityPosture.rawSourceId],
|
|
556
|
+
["Extraction ID", preview.integrityPosture.extractionId],
|
|
555
557
|
]);
|
|
556
558
|
}
|
|
557
559
|
function renderAuthorityTrace(preview) {
|
|
@@ -565,35 +567,50 @@ function renderCandidateHistory(preview) {
|
|
|
565
567
|
? [["History", "No unselected candidates."]]
|
|
566
568
|
: preview.candidateHistory.flatMap((candidate) => [
|
|
567
569
|
["History", candidate.historyLabel],
|
|
568
|
-
["Candidate", candidate.candidateId],
|
|
569
570
|
["Value", candidate.value],
|
|
570
571
|
]);
|
|
571
|
-
|
|
572
|
+
const references = preview.candidateHistory.flatMap((candidate) => [
|
|
573
|
+
["Candidate ID", candidate.candidateId],
|
|
574
|
+
]);
|
|
575
|
+
return renderPreviewSection("Unselected candidate history", "surface-candidate-history", rows, undefined, references);
|
|
572
576
|
}
|
|
573
577
|
function renderSourceEvidence(preview) {
|
|
574
578
|
const rows = [
|
|
575
579
|
["Source URL", preview.sourceEvidence.sourceRef],
|
|
576
|
-
["Source ref", preview.sourceEvidence.sourceId],
|
|
577
580
|
["Excerpt", preview.sourceEvidence.excerpt],
|
|
578
|
-
["Extraction", preview.sourceEvidence.extractionId],
|
|
579
581
|
["Extractor", preview.sourceEvidence.extractor],
|
|
580
582
|
["Observed", preview.sourceEvidence.observedAt],
|
|
581
583
|
];
|
|
584
|
+
const references = [
|
|
585
|
+
["Source ID", preview.sourceEvidence.sourceId],
|
|
586
|
+
["Extraction ID", preview.sourceEvidence.extractionId],
|
|
587
|
+
];
|
|
582
588
|
if (preview.sourceEvidence.sourceAuthority) {
|
|
583
589
|
rows.push(["Source authority class", preview.sourceEvidence.sourceAuthority.authorityClass], ["Declared by", preview.sourceEvidence.sourceAuthority.declaredBy], ["Authority scope", preview.sourceEvidence.sourceAuthority.scope]);
|
|
584
590
|
}
|
|
585
591
|
return renderPreviewSection("Source evidence", "surface-source-evidence", rows);
|
|
586
592
|
}
|
|
587
|
-
function renderPreviewSection(title, testId, rows, extraClass = "") {
|
|
593
|
+
function renderPreviewSection(title, testId, rows, extraClass = "", references = []) {
|
|
588
594
|
return `
|
|
589
595
|
<section class="preview-section${extraClass}" data-testid="${testId}">
|
|
590
596
|
<h3>${escapeHtml(title)}</h3>
|
|
591
597
|
<dl class="field-stack compact">
|
|
592
598
|
${rows.map(([label, value]) => fieldItem(label, value)).join("")}
|
|
593
599
|
</dl>
|
|
600
|
+
${references.length > 0 ? renderReferenceDetails(references) : ""}
|
|
594
601
|
</section>
|
|
595
602
|
`;
|
|
596
603
|
}
|
|
604
|
+
function renderReferenceDetails(references) {
|
|
605
|
+
return `
|
|
606
|
+
<details class="reference-details">
|
|
607
|
+
<summary>IDs and trace links</summary>
|
|
608
|
+
<dl class="field-stack compact">
|
|
609
|
+
${references.map(([label, value]) => fieldItem(label, value)).join("")}
|
|
610
|
+
</dl>
|
|
611
|
+
</details>
|
|
612
|
+
`;
|
|
613
|
+
}
|
|
597
614
|
export function mountReviewWorkbench(root, startState = initialReviewQueueSessionState(), options = {}) {
|
|
598
615
|
const controller = createReviewWorkbenchController(root, startState, options);
|
|
599
616
|
controller.renderCurrentState();
|
|
@@ -807,7 +824,7 @@ function renderCandidateCard(candidate, state) {
|
|
|
807
824
|
<article class="candidate-card${cssState}" data-testid="candidate-${escapeHtml(candidate.role ?? candidate.id)}" data-outcome="${candidateState}">
|
|
808
825
|
<div class="card-head">
|
|
809
826
|
<div>
|
|
810
|
-
<p class="eyebrow">${escapeHtml(candidate.
|
|
827
|
+
<p class="eyebrow">${escapeHtml(candidate.role === "proposed" ? "incoming value" : candidate.role === "current" ? "existing value" : "candidate")}</p>
|
|
811
828
|
<h2 class="role">${escapeHtml(titleCase(candidate.role ?? "candidate"))}</h2>
|
|
812
829
|
</div>
|
|
813
830
|
<span class="state-label">${escapeHtml(candidateState)}</span>
|
|
@@ -818,13 +835,19 @@ function renderCandidateCard(candidate, state) {
|
|
|
818
835
|
</div>
|
|
819
836
|
<dl class="field-stack">
|
|
820
837
|
${fieldItem("Source URL", candidate.source.sourceRef)}
|
|
821
|
-
${fieldItem("Source ref", candidate.source.sourceId ?? candidate.source.sourceRef)}
|
|
822
838
|
${fieldItem("Locator", candidate.locator?.locator ?? candidate.locator?.scheme ?? "none")}
|
|
823
839
|
${fieldItem("Excerpt", candidate.locator?.excerpt ?? "none", "excerpt")}
|
|
824
840
|
${fieldItem("Extraction confidence", confidence === undefined ? "unknown" : formatConfidence(confidence))}
|
|
825
841
|
${fieldItem("Extractor", candidate.extraction.extractor ?? "unknown")}
|
|
826
|
-
${fieldItem("Claim", candidate.claimTarget.claimId ?? candidate.claimTarget.fieldOrBehavior)}
|
|
827
842
|
</dl>
|
|
843
|
+
<details class="reference-details">
|
|
844
|
+
<summary>IDs and trace links</summary>
|
|
845
|
+
<dl class="field-stack compact">
|
|
846
|
+
${fieldItem("Candidate ID", candidate.id)}
|
|
847
|
+
${fieldItem("Source ID", candidate.source.sourceId ?? candidate.source.sourceRef)}
|
|
848
|
+
${fieldItem("Claim ID", candidate.claimTarget.claimId ?? candidate.claimTarget.fieldOrBehavior)}
|
|
849
|
+
</dl>
|
|
850
|
+
</details>
|
|
828
851
|
</article>
|
|
829
852
|
`;
|
|
830
853
|
}
|
|
@@ -621,7 +621,7 @@ h1 {
|
|
|
621
621
|
|
|
622
622
|
.candidate-card {
|
|
623
623
|
display: grid;
|
|
624
|
-
grid-template-rows: auto auto minmax(0, 1fr);
|
|
624
|
+
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
|
625
625
|
gap: 11px;
|
|
626
626
|
min-height: auto;
|
|
627
627
|
padding: 14px;
|
|
@@ -667,7 +667,7 @@ h1 {
|
|
|
667
667
|
color: var(--paper-faint);
|
|
668
668
|
font-size: 10px;
|
|
669
669
|
letter-spacing: 0.1em;
|
|
670
|
-
text-transform:
|
|
670
|
+
text-transform: uppercase;
|
|
671
671
|
overflow-wrap: anywhere;
|
|
672
672
|
word-break: break-word;
|
|
673
673
|
}
|
|
@@ -960,6 +960,44 @@ textarea:focus {
|
|
|
960
960
|
color: var(--paper-faint);
|
|
961
961
|
}
|
|
962
962
|
|
|
963
|
+
.reference-details {
|
|
964
|
+
margin-top: 10px;
|
|
965
|
+
border-top: 1px solid var(--line);
|
|
966
|
+
padding-top: 8px;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.reference-details summary {
|
|
970
|
+
cursor: pointer;
|
|
971
|
+
color: var(--paper-faint);
|
|
972
|
+
font-family: "IBM Plex Mono", ui-monospace, monospace;
|
|
973
|
+
font-size: 10px;
|
|
974
|
+
font-weight: 600;
|
|
975
|
+
letter-spacing: 0.08em;
|
|
976
|
+
text-transform: uppercase;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.reference-details summary::-webkit-details-marker {
|
|
980
|
+
display: none;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.reference-details summary::before {
|
|
984
|
+
content: "› ";
|
|
985
|
+
color: var(--paper-faint);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
.reference-details[open] summary {
|
|
989
|
+
color: var(--accent);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.reference-details[open] summary::before {
|
|
993
|
+
content: "⌄ ";
|
|
994
|
+
color: var(--accent);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
.reference-details .field-stack {
|
|
998
|
+
margin-top: 8px;
|
|
999
|
+
}
|
|
1000
|
+
|
|
963
1001
|
/* ---- Decision payload: terminal readout, intentionally demoted -------- */
|
|
964
1002
|
|
|
965
1003
|
.payload-panel {
|
package/package.json
CHANGED