@kontourai/survey 0.4.3 → 0.4.4
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 +211 -9
- package/dist/examples/review-workbench/downstream-public-directory-adapter.d.ts +3 -0
- package/dist/examples/review-workbench/downstream-public-directory-adapter.js +262 -0
- package/dist/examples/review-workbench/review-queue-session.d.ts +54 -0
- package/dist/examples/review-workbench/review-queue-session.js +122 -0
- package/dist/examples/review-workbench/review-surface-preview.d.ts +55 -0
- package/dist/examples/review-workbench/review-surface-preview.js +104 -0
- package/dist/examples/review-workbench/review-workbench-data.d.ts +261 -0
- package/dist/examples/review-workbench/review-workbench-data.js +199 -0
- package/dist/examples/review-workbench/review-workbench.d.ts +7 -0
- package/dist/examples/review-workbench/review-workbench.js +488 -0
- package/dist/fixtures/downstream-public-directory-proposal.d.ts +100 -0
- package/dist/fixtures/downstream-public-directory-proposal.js +59 -0
- package/dist/fixtures/public-directory-review-resource.d.ts +156 -0
- package/dist/fixtures/public-directory-review-resource.js +157 -0
- package/dist/fixtures/regulated-document-review-resource.d.ts +121 -0
- package/dist/fixtures/regulated-document-review-resource.js +131 -0
- package/dist/src/builder.d.ts +4 -1
- package/dist/src/builder.js +7 -0
- package/dist/src/index.d.ts +8 -4
- package/dist/src/index.js +4 -2
- package/dist/src/learning-projections.d.ts +19 -0
- package/dist/src/learning-projections.js +77 -0
- package/dist/src/raw-source.d.ts +15 -0
- package/dist/src/raw-source.js +22 -0
- package/dist/src/review-proof.d.ts +28 -0
- package/dist/src/review-proof.js +58 -1
- package/dist/src/review-resource.d.ts +111 -0
- package/dist/src/review-resource.js +1 -0
- package/dist/src/to-surface.js +226 -13
- package/dist/src/types.d.ts +17 -1
- package/package.json +10 -4
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { reviewResourceApiVersion } from "../../src/review-resource.js";
|
|
2
|
+
// Browser-safe mirror of fixtures/public-directory-review-resource.ts.
|
|
3
|
+
// scripts/check-review-workbench.cjs fails if this data drifts from the canonical fixture.
|
|
4
|
+
export const publicDirectoryReviewItemFixture = {
|
|
5
|
+
apiVersion: reviewResourceApiVersion,
|
|
6
|
+
kind: "ReviewItem",
|
|
7
|
+
metadata: {
|
|
8
|
+
name: "public-directory-availability",
|
|
9
|
+
labels: {
|
|
10
|
+
domain: "public-directory",
|
|
11
|
+
},
|
|
12
|
+
producer: {
|
|
13
|
+
displayName: "Example Program",
|
|
14
|
+
slug: "example-program",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
spec: {
|
|
18
|
+
target: "availabilityStatus",
|
|
19
|
+
selectedCandidateId: "public-directory:candidate:current",
|
|
20
|
+
candidateSetStatus: "resolved",
|
|
21
|
+
rationale: "Reviewed public directory field and retained the current value.",
|
|
22
|
+
candidates: [
|
|
23
|
+
{
|
|
24
|
+
id: "public-directory:candidate:current",
|
|
25
|
+
role: "current",
|
|
26
|
+
value: "AVAILABLE",
|
|
27
|
+
confidence: 0.91,
|
|
28
|
+
source: {
|
|
29
|
+
sourceId: "public-field:source:approved-page",
|
|
30
|
+
sourceRef: "https://example.test/listings/example-program",
|
|
31
|
+
kind: "web-page",
|
|
32
|
+
observedAt: "2026-05-30T18:00:00.000Z",
|
|
33
|
+
fetchedAt: "2026-05-30T18:00:00.000Z",
|
|
34
|
+
locatorScheme: "html",
|
|
35
|
+
},
|
|
36
|
+
locator: {
|
|
37
|
+
scheme: "html",
|
|
38
|
+
locator: "html:field=availabilityStatus",
|
|
39
|
+
excerpt: "Availability is open for the example program.",
|
|
40
|
+
},
|
|
41
|
+
extraction: {
|
|
42
|
+
extractionId: "public-field:extraction:approved",
|
|
43
|
+
target: "availabilityStatus",
|
|
44
|
+
confidence: 0.91,
|
|
45
|
+
extractor: "example-field-review",
|
|
46
|
+
extractedAt: "2026-05-30T18:00:00.000Z",
|
|
47
|
+
},
|
|
48
|
+
claimTarget: {
|
|
49
|
+
claimId: "public-field.entity-123.availability-status.current",
|
|
50
|
+
subjectType: "public-record.entity",
|
|
51
|
+
subjectId: "entity-123",
|
|
52
|
+
surface: "public-record.profile",
|
|
53
|
+
claimType: "public-data.field",
|
|
54
|
+
fieldOrBehavior: "availabilityStatus",
|
|
55
|
+
impactLevel: "medium",
|
|
56
|
+
collectedBy: "example-field-review",
|
|
57
|
+
},
|
|
58
|
+
projection: {
|
|
59
|
+
rawSourceId: "public-field:source:approved-page",
|
|
60
|
+
extractionId: "public-field:extraction:approved",
|
|
61
|
+
candidateSetId: "public-field:candidates:current",
|
|
62
|
+
candidateId: "public-field:candidate:approved",
|
|
63
|
+
reviewOutcomeId: "public-field:review:approved",
|
|
64
|
+
claimId: "public-field.entity-123.availability-status.current",
|
|
65
|
+
},
|
|
66
|
+
producer: {
|
|
67
|
+
sourceAuthority: {
|
|
68
|
+
authorityClass: "public-directory-listing",
|
|
69
|
+
declaredBy: "Example Program public directory",
|
|
70
|
+
scope: "availabilityStatus field on entity-123",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "public-directory:candidate:proposed",
|
|
76
|
+
role: "proposed",
|
|
77
|
+
value: "WAITLIST",
|
|
78
|
+
confidence: 0.82,
|
|
79
|
+
source: {
|
|
80
|
+
sourceId: "public-field:source:proposal-page",
|
|
81
|
+
sourceRef: "https://example.test/listings/example-program",
|
|
82
|
+
kind: "web-page",
|
|
83
|
+
observedAt: "2026-05-31T15:00:00.000Z",
|
|
84
|
+
fetchedAt: "2026-05-31T15:00:00.000Z",
|
|
85
|
+
locatorScheme: "html",
|
|
86
|
+
},
|
|
87
|
+
locator: {
|
|
88
|
+
scheme: "html",
|
|
89
|
+
locator: "html:field=availabilityStatus",
|
|
90
|
+
excerpt: "Join the waitlist for this listing.",
|
|
91
|
+
},
|
|
92
|
+
extraction: {
|
|
93
|
+
extractionId: "public-field:extraction:proposal",
|
|
94
|
+
target: "availabilityStatus",
|
|
95
|
+
confidence: 0.82,
|
|
96
|
+
extractor: "example-crawl",
|
|
97
|
+
extractedAt: "2026-05-31T15:00:00.000Z",
|
|
98
|
+
},
|
|
99
|
+
claimTarget: {
|
|
100
|
+
claimId: "public-field.entity-123.availability-status.proposal-456",
|
|
101
|
+
subjectType: "public-record.entity",
|
|
102
|
+
subjectId: "entity-123",
|
|
103
|
+
surface: "public-record.profile",
|
|
104
|
+
claimType: "public-data.field-candidate",
|
|
105
|
+
fieldOrBehavior: "availabilityStatus",
|
|
106
|
+
impactLevel: "medium",
|
|
107
|
+
collectedBy: "example-crawl",
|
|
108
|
+
},
|
|
109
|
+
projection: {
|
|
110
|
+
rawSourceId: "public-field:source:proposal-page",
|
|
111
|
+
extractionId: "public-field:extraction:proposal",
|
|
112
|
+
candidateSetId: "public-field:candidates:proposal",
|
|
113
|
+
candidateId: "public-field:candidate:proposal",
|
|
114
|
+
claimId: "public-field.entity-123.availability-status.proposal-456",
|
|
115
|
+
},
|
|
116
|
+
producer: {
|
|
117
|
+
proposalId: "proposal-456",
|
|
118
|
+
oldValue: "AVAILABLE",
|
|
119
|
+
sourceAuthority: {
|
|
120
|
+
authorityClass: "public-directory-listing",
|
|
121
|
+
declaredBy: "Example Program public directory crawler",
|
|
122
|
+
scope: "availabilityStatus field on entity-123",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
status: {
|
|
129
|
+
observedCandidateCount: 2,
|
|
130
|
+
selectedCandidateId: "public-directory:candidate:current",
|
|
131
|
+
reviewDecisionName: "public-directory-availability-operator-decision",
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
function queueFixture(name, target, currentValue, proposedValue, candidateSetStatus, feedbackTags) {
|
|
135
|
+
return {
|
|
136
|
+
...publicDirectoryReviewItemFixture,
|
|
137
|
+
metadata: {
|
|
138
|
+
...publicDirectoryReviewItemFixture.metadata,
|
|
139
|
+
name,
|
|
140
|
+
},
|
|
141
|
+
spec: {
|
|
142
|
+
...publicDirectoryReviewItemFixture.spec,
|
|
143
|
+
target,
|
|
144
|
+
selectedCandidateId: `${name}:candidate:current`,
|
|
145
|
+
candidateSetStatus,
|
|
146
|
+
producerPolicy: {
|
|
147
|
+
feedbackTags,
|
|
148
|
+
},
|
|
149
|
+
rationale: `Fixture-backed local review queue item for ${target}.`,
|
|
150
|
+
candidates: publicDirectoryReviewItemFixture.spec.candidates.map((candidate) => {
|
|
151
|
+
const role = candidate.role ?? "candidate";
|
|
152
|
+
const value = role === "proposed" ? proposedValue : currentValue;
|
|
153
|
+
return {
|
|
154
|
+
...candidate,
|
|
155
|
+
id: `${name}:candidate:${role}`,
|
|
156
|
+
value,
|
|
157
|
+
source: {
|
|
158
|
+
...candidate.source,
|
|
159
|
+
sourceId: `${name}:source:${role}`,
|
|
160
|
+
},
|
|
161
|
+
extraction: {
|
|
162
|
+
...candidate.extraction,
|
|
163
|
+
extractionId: `${name}:extraction:${role}`,
|
|
164
|
+
target,
|
|
165
|
+
},
|
|
166
|
+
claimTarget: {
|
|
167
|
+
...candidate.claimTarget,
|
|
168
|
+
claimId: `public-field.entity-123.${target}.${role}`,
|
|
169
|
+
fieldOrBehavior: target,
|
|
170
|
+
},
|
|
171
|
+
projection: {
|
|
172
|
+
...candidate.projection,
|
|
173
|
+
rawSourceId: `${name}:source:${role}`,
|
|
174
|
+
extractionId: `${name}:extraction:${role}`,
|
|
175
|
+
candidateSetId: `${name}:candidate-set`,
|
|
176
|
+
candidateId: `${name}:projection:${role}`,
|
|
177
|
+
reviewOutcomeId: role === "current" && candidateSetStatus === "resolved" ? `${name}:review:resolved` : undefined,
|
|
178
|
+
claimId: `public-field.entity-123.${target}.${role}`,
|
|
179
|
+
},
|
|
180
|
+
producer: {
|
|
181
|
+
...candidate.producer,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}),
|
|
185
|
+
},
|
|
186
|
+
status: {
|
|
187
|
+
observedCandidateCount: publicDirectoryReviewItemFixture.status?.observedCandidateCount,
|
|
188
|
+
selectedCandidateId: `${name}:candidate:current`,
|
|
189
|
+
reviewDecisionName: candidateSetStatus === "resolved" ? `${name}-resolved-decision` : undefined,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export const reviewWorkbenchQueueFixtures = [
|
|
194
|
+
queueFixture("public-directory-hours", "hours", "Weekdays 9am-5pm", "Weekdays 8am-6pm", "needs-review", ["hours-change", "crawler-suggested"]),
|
|
195
|
+
queueFixture("public-directory-phone", "phoneNumber", "+1-555-0100", "+1-555-0199", "needs-review", ["contact-field", "source-conflict"]),
|
|
196
|
+
publicDirectoryReviewItemFixture,
|
|
197
|
+
queueFixture("public-directory-address", "streetAddress", "100 Main Street", "102 Main Street", "needs-review", ["address-change", "producer-escalation-candidate"]),
|
|
198
|
+
queueFixture("public-directory-license", "licenseStatus", "ACTIVE", "EXPIRED", "escalated", ["licensing", "manual-review-required"]),
|
|
199
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReviewQueueSessionState, type ReviewWorkbenchState } from "./review-queue-session.js";
|
|
2
|
+
import { type ReviewDecision } from "../../src/review-resource.js";
|
|
3
|
+
export { candidateForDecision, currentReviewItem, currentReviewWorkbenchState, deriveQueueRowStatus, initialReviewQueueSessionState, initialReviewWorkbenchState, nextUnresolvedItemName, reviewSessionSummary, selectedCandidateRole, workbenchDecisionDefinitions, type ReviewQueueRowStatus, type ReviewQueueSessionState, type ReviewSessionSummary, type ReviewWorkbenchDecision, type ReviewWorkbenchState, } from "./review-queue-session.js";
|
|
4
|
+
export { buildSurfaceProjectionPreview, type PreviewAuthorityTrace, type PreviewCandidateHistory, type PreviewClaim, type PreviewIntegrityPosture, type PreviewReviewEvent, type PreviewSourceAuthority, type PreviewSourceEvidence, type SurfaceProjectionPreview, } from "./review-surface-preview.js";
|
|
5
|
+
export declare function buildReviewDecision(state: ReviewWorkbenchState): ReviewDecision | undefined;
|
|
6
|
+
export declare function renderReviewWorkbenchHtml(state: ReviewWorkbenchState | ReviewQueueSessionState): string;
|
|
7
|
+
export declare function mountReviewWorkbench(root: HTMLElement, startState?: ReviewQueueSessionState | ReviewWorkbenchState): void;
|