@kontourai/survey 6.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/example-data/public-directory-review-resource.d.ts +3 -3
  2. package/dist/src/canonical-reviewed-trust-input.js +30 -1
  3. package/dist/src/console/review-console-server.js +22 -4
  4. package/dist/src/index.d.ts +3 -3
  5. package/dist/src/index.js +1 -1
  6. package/dist/src/mcp/review-mcp.js +139 -36
  7. package/dist/src/review-resource.d.ts +7 -0
  8. package/dist/src/review-session-file.d.ts +7 -0
  9. package/dist/src/review-workbench/audit-rows.d.ts +1 -1
  10. package/dist/src/review-workbench/audit-rows.js +1 -0
  11. package/dist/src/review-workbench/queue-binding.d.ts +45 -2
  12. package/dist/src/review-workbench/queue-binding.js +45 -0
  13. package/dist/src/review-workbench/review-presentation.d.ts +23 -0
  14. package/dist/src/review-workbench/review-presentation.js +51 -10
  15. package/dist/src/review-workbench/review-queue-session.d.ts +47 -4
  16. package/dist/src/review-workbench/review-queue-session.js +73 -8
  17. package/dist/src/review-workbench/review-session-replay.d.ts +11 -1
  18. package/dist/src/review-workbench/review-session-replay.js +35 -1
  19. package/dist/src/review-workbench/review-workbench-css.generated.js +94 -0
  20. package/dist/src/review-workbench/review-workbench-element.d.ts +10 -0
  21. package/dist/src/review-workbench/review-workbench-element.js +21 -3
  22. package/dist/src/review-workbench/review-workbench.css +94 -0
  23. package/dist/src/review-workbench/review-workbench.d.ts +28 -8
  24. package/dist/src/review-workbench/review-workbench.js +157 -62
  25. package/dist/src/review-workbench/review-workbench.standalone.css +94 -0
  26. package/dist/src/review-workbench/server-review-session.d.ts +18 -0
  27. package/dist/src/review-workbench/server-review-session.js +20 -2
  28. package/dist/src/surface-reviewed-extraction.d.ts +23 -0
  29. package/dist/src/surface-reviewed-extraction.js +64 -1
  30. package/dist/src/to-surface.js +32 -3
  31. package/package.json +1 -1
@@ -832,6 +832,100 @@
832
832
  font-size: 12px;
833
833
  }
834
834
 
835
+ /* A queue that came from an extraction import but was not checked against
836
+ it (unverified), or that does not match it (diverges, shown instead of the
837
+ queue). */
838
+ .survey-workbench-embed .queue-attestation{
839
+ display: flex;
840
+ align-items: flex-start;
841
+ gap: var(--k-space-2);
842
+ margin: 0 0 var(--k-space-3);
843
+ padding: var(--k-space-2) var(--k-space-3);
844
+ border-radius: 9px;
845
+ font-size: 13px;
846
+ line-height: 1.45;
847
+ color: var(--k-caution);
848
+ background: var(--k-caution-wash);
849
+ }
850
+
851
+ .survey-workbench-embed .queue-attestation svg{
852
+ flex: none;
853
+ margin-top: 2px;
854
+ }
855
+
856
+ .survey-workbench-embed .queue-attestation.diverges{
857
+ color: var(--k-negative);
858
+ background: var(--k-negative-wash);
859
+ }
860
+
861
+ /* Conflicting proposed values: each value is listed with its own choice
862
+ control until the field is decided, then marked chosen or not chosen. */
863
+ .survey-workbench-embed .conflict-values ul{
864
+ list-style: none;
865
+ margin: var(--k-space-2) 0 0;
866
+ padding: 0;
867
+ display: grid;
868
+ gap: var(--k-space-2);
869
+ }
870
+
871
+ .survey-workbench-embed .conflict-values li{
872
+ display: flex;
873
+ align-items: center;
874
+ justify-content: space-between;
875
+ gap: var(--k-space-3);
876
+ flex-wrap: wrap;
877
+ padding: var(--k-space-2) var(--k-space-3);
878
+ border: 1px solid var(--k-line);
879
+ border-radius: 9px;
880
+ }
881
+
882
+ .survey-workbench-embed .conflict-values li[data-chosen="true"]{
883
+ border-color: var(--k-positive);
884
+ background: var(--k-positive-wash);
885
+ }
886
+
887
+ .survey-workbench-embed .conflict-values .conflict-text{
888
+ display: inline-flex;
889
+ align-items: baseline;
890
+ gap: var(--k-space-2);
891
+ flex-wrap: wrap;
892
+ min-width: 0;
893
+ }
894
+
895
+ .survey-workbench-embed .conflict-values .vtext{
896
+ font-weight: 600;
897
+ overflow-wrap: anywhere;
898
+ }
899
+
900
+ .survey-workbench-embed .conflict-values q{
901
+ color: var(--k-muted);
902
+ font-size: 12.5px;
903
+ overflow-wrap: anywhere;
904
+ }
905
+
906
+ .survey-workbench-embed .conflict-values .btn.choose{
907
+ min-height: 36px;
908
+ padding: 0 14px;
909
+ font-size: 13px;
910
+ }
911
+
912
+ .survey-workbench-embed .choice-tag{
913
+ font-size: 12px;
914
+ font-weight: 600;
915
+ padding: 2px 8px;
916
+ border-radius: 999px;
917
+ }
918
+
919
+ .survey-workbench-embed .choice-tag.chosen{
920
+ color: var(--k-positive);
921
+ background: var(--k-positive-wash);
922
+ }
923
+
924
+ .survey-workbench-embed .choice-tag.not-chosen{
925
+ color: var(--k-muted);
926
+ background: var(--k-sunken);
927
+ }
928
+
835
929
  .survey-workbench-embed .excerpt-verification,
836
930
  .survey-workbench-embed .support-verification{
837
931
  margin: 0;
@@ -2,16 +2,25 @@ import { type ReviewQueueSessionState, type ReviewWorkbenchDecision, type Review
2
2
  import { type ReviewSessionReplayIssue, type ReviewSessionReplayWarning } from "./review-session-replay.js";
3
3
  import { type ReviewPresentationAdapter } from "./review-presentation.js";
4
4
  import { type ReviewCandidate, type ReviewDecision, type ReviewItem, type ReviewSession, type ReviewSessionEvent, type ReviewValueDescriptor } from "../review-resource.js";
5
+ import type { ExtractionEnvelopeImport, ExtractionEnvelopeImportResult } from "../extraction-envelope.js";
5
6
  export { reviewAuditRowKeys, type ReviewAuditRowKey } from "./audit-rows.js";
6
- export { assertReviewQueueAgainstExtractionImport, assertReviewQueueBinding, bindReviewQueue, hashReviewQueueSnapshot, UnattestedExtractionQueueError, UnattestedReviewQueueError, validateReviewQueueAgainstExtractionImport, validateReviewQueueBinding, type BindReviewQueueOptions, type ReviewQueueBinding, type ReviewQueueBindingIssue, type ReviewQueueBindingIssueCode, type ReviewQueueExtractionIssue, type ReviewQueueExtractionIssueCode, type ValidateReviewQueueBindingOptions, } from "./queue-binding.js";
7
+ export { assertReviewQueueAgainstExtractionImport, assertReviewQueueBinding, attestReviewQueueExtraction, bindReviewQueue, reviewItemCarriesExtractionBinding, unverifiedExtractionQueueSentence, hashReviewQueueSnapshot, UnattestedExtractionQueueError, UnattestedReviewQueueError, validateReviewQueueAgainstExtractionImport, validateReviewQueueBinding, type BindReviewQueueOptions, type ReviewQueueBinding, type ReviewQueueBindingIssue, type ReviewQueueBindingIssueCode, type ReviewQueueExtractionAttestation, type ReviewQueueExtractionIssue, type ReviewQueueExtractionIssueCode, type ValidateReviewQueueBindingOptions, } from "./queue-binding.js";
7
8
  export { buildExtractionInspectorModel, exportExtractionInspector, filterExtractionInspectorCandidates, mountExtractionInspector, type ExtractionAlignmentState, type ArtifactUnavailableCode, type BuiltExtractionInspectorCandidate, type BuiltExtractionInspectorModel, type ExtractionInspectorCandidate, type ExtractionInspectorEntry, type ExtractionInspectorExportOptions, type ExtractionInspectorFilters, type ExtractionInspectorInput, type ExtractionInspectorMountOptions, type ExtractionInspectorModel, type ExtractionInspectorSource, type ResolvedExtractionArtifact, } from "./extraction-inspector.js";
8
- export { buildReviewSessionEvents, buildReviewSessionEvent, buildReviewSessionResource, candidateForDecision, decisionCandidateId, decisionSelectsNoCandidate, keepActionDecision, currentReviewItem, currentReviewWorkbenchState, defaultReviewSessionName, deriveQueueRowStatus, initialReviewQueueSessionState, initialReviewWorkbenchState, nextUnresolvedItemName, replayReviewSessionEvents, reviewSessionSummary, reviewWorkbenchSessionStorageKey, selectedCandidateRole, workbenchDecisionDefinitions, type ReviewQueueRowStatus, type ReviewQueueSessionState, type ReviewSessionSummary, type ReviewWorkbenchDecision, type ReviewWorkbenchState, } from "./review-queue-session.js";
9
- export { buildReviewCandidatePresentation, buildReviewItemPresentation, buildReviewResultPresentation, humanizeIdentifier, type ReviewCandidatePresentation, type ReviewCandidatePresentationContext, type ReviewItemPresentation, type ReviewItemPresentationContext, type ReviewPresentationAdapter, type ReviewPresentationLink, type ReviewResultPresentation, type ReviewTracePresentationContext, type ReviewTraceRef, type ReviewValuePresentationContext, } from "./review-presentation.js";
9
+ export { buildReviewSessionEvents, buildReviewSessionEvent, buildReviewSessionResource, candidateForDecision, conflictSelectionIssue, unchosenProposedCandidates, decisionCandidateId, decisionSelectsNoCandidate, keepActionDecision, currentReviewItem, currentReviewWorkbenchState, defaultReviewSessionName, deriveQueueRowStatus, initialReviewQueueSessionState, initialReviewWorkbenchState, nextUnresolvedItemName, replayReviewSessionEvents, reviewSessionSummary, reviewWorkbenchSessionStorageKey, selectedCandidateRole, workbenchDecisionDefinitions, type ReviewQueueRowStatus, type ReviewQueueSessionState, type ReviewSessionSummary, type ReviewWorkbenchDecision, type ReviewWorkbenchState, } from "./review-queue-session.js";
10
+ export { buildReviewCandidatePresentation, buildReviewItemPresentation, buildReviewResultPresentation, humanizeIdentifier, type ExcludedProposalPresentation, type ExcludedProposalsUnreadable, type ReviewCandidatePresentation, type ReviewCandidatePresentationContext, type ReviewItemPresentation, type ReviewItemPresentationContext, type ReviewPresentationAdapter, type ReviewPresentationLink, type ReviewResultPresentation, type ReviewTracePresentationContext, type ReviewTraceRef, type ReviewValuePresentationContext, } from "./review-presentation.js";
10
11
  export { buildSurfaceProjectionPreview, type PreviewAuthorityTrace, type PreviewCandidateHistory, type PreviewClaim, type PreviewIntegrityPosture, type PreviewReviewEvent, type PreviewSourceAuthority, type PreviewSourceEvidence, type SurfaceProjectionPreview, } from "./review-surface-preview.js";
11
12
  export { reviewSessionReplayWarningsForSnapshot, validateReviewSessionEventsForSnapshot, type ReviewSessionReplayIssue, type ReviewSessionReplayIssueCode, type ReviewSessionReplayWarning, } from "./review-session-replay.js";
12
13
  export { checkEditedValueForItem, editedValueFromEditorText, type EditedValueCheck, } from "./edited-value.js";
13
14
  export { assertReviewDecisionModeAllows, DecisionModeViolationError, validateReviewDecisionMode, type ReviewDecisionModeIssue, type ReviewDecisionModeIssueCode, type ReviewDecisionModeResult, } from "./producer-decision-mode.js";
14
- export declare function buildReviewDecision(state: ReviewWorkbenchState): ReviewDecision | undefined;
15
+ /**
16
+ * Options for building review decisions. The decision prompt is rendered from
17
+ * the item when the decision is built, so pass the same presentation adapter
18
+ * the card used, or the recorded prompt renders values its own way.
19
+ */
20
+ export interface ReviewDecisionBuildOptions {
21
+ readonly presentationAdapter?: ReviewPresentationAdapter;
22
+ }
23
+ export declare function buildReviewDecision(state: ReviewWorkbenchState, options?: ReviewDecisionBuildOptions): ReviewDecision | undefined;
15
24
  export interface ReviewWorkbenchSessionExport {
16
25
  readonly session: ReviewSession;
17
26
  readonly events: readonly ReviewSessionEvent[];
@@ -31,6 +40,8 @@ export interface DeriveReviewSessionApplyResultForSnapshotOptions {
31
40
  readonly snapshot: ReviewQueueSessionState;
32
41
  readonly events: readonly ReviewSessionEvent[];
33
42
  readonly requiredResolvedItems?: ReviewSessionApplyResolutionRequirement;
43
+ /** The adapter the reviewer's card used; the recorded decision prompts render values with it. */
44
+ readonly presentationAdapter?: ReviewPresentationAdapter;
34
45
  }
35
46
  export type DeriveReviewSessionApplyResultForSnapshotResult = {
36
47
  readonly ok: true;
@@ -89,6 +100,13 @@ export interface PersistentReviewSessionEventStoreOptions {
89
100
  export interface MountReviewWorkbenchOptions {
90
101
  readonly eventStore?: ReviewSessionEventStore;
91
102
  readonly presentationAdapter?: ReviewPresentationAdapter;
103
+ /**
104
+ * The extraction import record the queue was built from, as stored beside
105
+ * it. When supplied, the workbench checks the queue against it and refuses to
106
+ * present a queue that diverges. When absent and the queue's items came from
107
+ * an extraction import, the workbench shows an "Unverified queue" notice.
108
+ */
109
+ readonly extractionImport?: ExtractionEnvelopeImport | ExtractionEnvelopeImportResult;
92
110
  /** Maximum review cards mounted at once. Defaults to 50 and is capped at 250. */
93
111
  readonly pageSize?: number;
94
112
  }
@@ -189,15 +207,15 @@ export interface MapReviewWorkbenchResultsToApplyActionsOptions<TAction> {
189
207
  readonly skip?: (context: ReviewApplyActionContext) => boolean;
190
208
  readonly map: (context: ReviewApplyActionContext) => TAction | readonly TAction[] | undefined;
191
209
  }
192
- export declare function buildReviewDecisionsFromSession(session: ReviewQueueSessionState): ReviewDecision[];
210
+ export declare function buildReviewDecisionsFromSession(session: ReviewQueueSessionState, options?: ReviewDecisionBuildOptions): ReviewDecision[];
193
211
  export declare function requireReviewResultForItem(item: ReviewItem, results: readonly ReviewWorkbenchResult[]): ReviewWorkbenchResult;
194
212
  export declare function assertReviewResultMatches(result: ReviewWorkbenchResult, expectation: ReviewApplyResultExpectation): void;
195
213
  export declare function mapReviewWorkbenchResultsToApplyActions<TAction>(options: MapReviewWorkbenchResultsToApplyActionsOptions<TAction>): ReviewApplyActionMapping<TAction>[];
196
214
  export declare const mapReviewApplyActions: typeof mapReviewWorkbenchResultsToApplyActions;
197
- export declare function buildReviewWorkbenchResultsFromSession(session: ReviewQueueSessionState): ReviewWorkbenchResult[];
198
- export declare function buildReviewWorkbenchSessionExport(session: ReviewQueueSessionState, events?: readonly ReviewSessionEvent[]): ReviewWorkbenchSessionExport;
215
+ export declare function buildReviewWorkbenchResultsFromSession(session: ReviewQueueSessionState, options?: ReviewDecisionBuildOptions): ReviewWorkbenchResult[];
216
+ export declare function buildReviewWorkbenchSessionExport(session: ReviewQueueSessionState, events?: readonly ReviewSessionEvent[], options?: ReviewDecisionBuildOptions): ReviewWorkbenchSessionExport;
199
217
  export declare function replayReviewSessionEventsForSnapshot(snapshot: ReviewQueueSessionState, events: readonly ReviewSessionEvent[]): ReviewQueueSessionState;
200
- export declare function buildReviewWorkbenchSessionExportForSnapshot(snapshot: ReviewQueueSessionState, events: readonly ReviewSessionEvent[]): ReviewWorkbenchSessionExport;
218
+ export declare function buildReviewWorkbenchSessionExportForSnapshot(snapshot: ReviewQueueSessionState, events: readonly ReviewSessionEvent[], options?: ReviewDecisionBuildOptions): ReviewWorkbenchSessionExport;
201
219
  export declare function deriveReviewSessionApplyResultForSnapshot(options: DeriveReviewSessionApplyResultForSnapshotOptions): DeriveReviewSessionApplyResultForSnapshotResult;
202
220
  export declare function createInMemoryReviewSessionEventStore(initialEvents?: readonly ReviewSessionEvent[]): ReviewSessionEventStore & {
203
221
  events(): readonly ReviewSessionEvent[];
@@ -210,6 +228,8 @@ export declare function createPersistentReviewSessionEventStore(options: Persist
210
228
  export declare function renderReviewWorkbenchHtml(state: ReviewWorkbenchState | ReviewQueueSessionState, _events?: readonly ReviewSessionEvent[], options?: {
211
229
  readonly presentationAdapter?: ReviewPresentationAdapter;
212
230
  readonly queueView?: Partial<ReviewQueueView>;
231
+ /** See {@link MountReviewWorkbenchOptions.extractionImport}. */
232
+ readonly extractionImport?: ExtractionEnvelopeImport | ExtractionEnvelopeImportResult;
213
233
  }): string;
214
234
  export declare function buildReviewQueueWindow(session: ReviewQueueSessionState, view?: Partial<ReviewQueueView>): ReviewQueueWindow;
215
235
  /**