@kontourai/survey 0.5.1 → 0.6.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 +34 -7
- package/bin/survey-review-mcp.mjs +7 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +1 -0
- package/dist/src/mcp/review-mcp-bin.d.ts +1 -0
- package/dist/src/mcp/review-mcp-bin.js +2 -0
- package/dist/src/mcp/review-mcp.d.ts +1 -0
- package/dist/src/mcp/review-mcp.js +599 -0
- package/dist/src/review-authorizing.d.ts +39 -0
- package/dist/src/review-authorizing.js +125 -0
- package/dist/src/review-resource.d.ts +5 -1
- package/dist/src/review-workbench/review-workbench-css.generated.d.ts +2 -0
- package/dist/src/review-workbench/review-workbench-css.generated.js +1795 -0
- package/dist/src/review-workbench/review-workbench-element.d.ts +45 -0
- package/dist/src/review-workbench/review-workbench-element.js +215 -0
- package/dist/src/review-workbench/review-workbench.css +196 -14
- package/dist/src/review-workbench/review-workbench.js +141 -19
- package/dist/src/review-workbench/review-workbench.standalone.css +196 -14
- package/dist/src/types.d.ts +23 -0
- package/example-data/mcp-review-session.json +878 -0
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -89,16 +89,29 @@ One observation, one chain: the page it came from, what the extractor read, who
|
|
|
89
89
|
|
|
90
90
|
## The producer validation path
|
|
91
91
|
|
|
92
|
-
1. Build Survey observations
|
|
92
|
+
1. Build Survey observations covering each link in the evidence chain.
|
|
93
93
|
2. Call `buildSurveyTrustBundle` to project the Survey records into a Surface Trust Bundle.
|
|
94
94
|
3. Call Surface `validateTrustBundle` on the Trust Bundle.
|
|
95
95
|
4. Optionally call public Surface report APIs such as `buildTrustReport` to inspect claims, evidence, status, gaps, and metadata.
|
|
96
96
|
|
|
97
|
-
Keep producer operational state outside Survey. Queue status, reviewer form state, retries, source caches, and product policy decisions belong in the producer's own data model. Survey carries only the portable
|
|
97
|
+
Keep producer operational state outside Survey. Queue status, reviewer form state, retries, source caches, and product policy decisions belong in the producer's own data model. Survey carries only the portable evidence chain records needed by Surface.
|
|
98
98
|
|
|
99
99
|
## Review Workbench embed
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
**Web component** (shadow DOM, no framework required):
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<link rel="stylesheet" href="@kontourai/survey/review-workbench/standalone.css">
|
|
105
|
+
<survey-review-workbench theme="survey" color-scheme="dark"></survey-review-workbench>
|
|
106
|
+
<script type="module">
|
|
107
|
+
import "@kontourai/survey/review-workbench/element";
|
|
108
|
+
const el = document.querySelector("survey-review-workbench");
|
|
109
|
+
el.session = reviewQueueSession;
|
|
110
|
+
el.presentationAdapter = myAdapter;
|
|
111
|
+
</script>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Direct mount** into an existing element:
|
|
102
115
|
|
|
103
116
|
```ts
|
|
104
117
|
import {
|
|
@@ -117,15 +130,29 @@ const presentationAdapter = {
|
|
|
117
130
|
mountReviewWorkbench(element, reviewQueueSession, { presentationAdapter });
|
|
118
131
|
```
|
|
119
132
|
|
|
120
|
-
The stylesheet is scoped to `.survey-workbench-embed` and bundles
|
|
133
|
+
The embedded stylesheet is scoped to `.survey-workbench-embed` and bundles Console Kit tokens, so it will not rewrite the host application's `body` or `:root` styles. Mount into:
|
|
121
134
|
|
|
122
135
|
```html
|
|
123
136
|
<div class="survey-workbench-embed theme-survey"></div>
|
|
124
137
|
```
|
|
125
138
|
|
|
126
|
-
`@kontourai/survey/review-workbench/standalone.css` exists for pages Survey owns entirely.
|
|
139
|
+
`@kontourai/survey/review-workbench/standalone.css` exists for pages Survey owns entirely.
|
|
140
|
+
|
|
141
|
+
## Review MCP
|
|
142
|
+
|
|
143
|
+
Drive review-queue decisions from an MCP agent (Claude Desktop, Cursor, or any MCP host):
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
npx survey-review-mcp --session path/to/session.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Three tools: `survey_review_queue` (queue state), `survey_review_item` (item detail), and `survey_review_decide` (record a decision). Each queue and item call includes an embedded, fully self-contained review card with Accept / Hold / Reject buttons. See [docs/review-mcp.md](docs/review-mcp.md).
|
|
150
|
+
|
|
151
|
+
At viewports ≤ 980 px, the queue panel becomes a slide-in drawer with a compact progress bar. At narrow container widths, `cqi`-based type scaling keeps candidate values from overflowing at 360 px. CSS custom properties (`--k-*`) inherit through the shadow boundary so the host can theme either mode without forking styles.
|
|
152
|
+
|
|
153
|
+
Server code persisting browser-submitted review events should use `persistReviewSessionEvents`, then `deriveReviewSessionApplyResultForSnapshot` (or the composed `deriveServerReviewSessionApplyResult` from `@kontourai/survey/review-workbench/server-review-session`) before applying product policy — write results derive from pre-decision snapshots plus persisted events, never from browser-computed decisions.
|
|
127
154
|
|
|
128
|
-
The [Consumer Integration Guide](docs/consumer-integration-guide.md) covers the full path from `ReviewItem` construction through persisted review events, exported results,
|
|
155
|
+
The [Consumer Integration Guide](docs/consumer-integration-guide.md) covers the full path from `ReviewItem` construction through persisted review events, exported results, Surface projection, and the full `--k-*` theming token list. Test-covered examples are under [`examples/review-workbench/`](examples/review-workbench/). To run the standalone demo locally, see [Review Workbench Prototype](docs/review-workbench-prototype.md).
|
|
129
156
|
|
|
130
157
|
## Where Survey fits
|
|
131
158
|
|
|
@@ -155,7 +182,7 @@ Survey feeds Surface; Surface-shaped evidence feeds Flow gates; Flow's adversari
|
|
|
155
182
|
|
|
156
183
|
## Product boundary
|
|
157
184
|
|
|
158
|
-
Survey does not crawl pages, parse PDFs, rank candidates, decide review policy, or claim a value is true. Producers own acquisition, extraction, ranking, review UX, materiality, and domain policy. Survey gives those producers a consistent
|
|
185
|
+
Survey does not crawl pages, parse PDFs, rank candidates, decide review policy, or claim a value is true. Producers own acquisition, extraction, ranking, review UX, materiality, and domain policy. Survey gives those producers a consistent evidence chain contract before the records enter Surface.
|
|
159
186
|
|
|
160
187
|
## Contributor checks
|
|
161
188
|
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { CandidateSetStatus, Candidate, CandidateSet, ClaimTarget, EscalationDimension, EscalationRecord, Extraction, Interpretation, LocatorScheme, RawSource, RawSourceKind, ReviewOutcome, ReviewStatus, SurveyInput, } from "./types.js";
|
|
1
|
+
export type { CandidateSetStatus, Candidate, CandidateSet, ClaimTarget, EscalationDimension, EscalationRecord, Extraction, Interpretation, LocatorScheme, RawSource, RawSourceKind, ReviewAuthorizing, ReviewAuthorizingAuthorizedAction, ReviewAuthorizingExchange, ReviewAuthorizingExplicitStatement, ReviewAuthorizingKind, ReviewOutcome, ReviewStatus, SurveyInput, } from "./types.js";
|
|
2
2
|
export { reviewResourceApiVersion } from "./review-resource.js";
|
|
3
3
|
export type { CandidateRole, ClaimTargetHint, ExtractionReference, ResourceEnvelope, ResourceMetadata, ReviewActor, ReviewCandidate, ReviewDecision, ReviewDecisionSpec, ReviewDecisionStatus, ReviewItem, ReviewItemSpec, ReviewItemStatus, ReviewLocator, ReviewResource, ReviewResourceApiVersion, ReviewResourceKind, ReviewSession, ReviewSessionEvent, ReviewSessionEventSpec, ReviewSessionEventStatus, ReviewSessionEventType, ReviewSessionSpec, ReviewSessionStatus, SourceReference, SurveyRecordProjectionHint, } from "./review-resource.js";
|
|
4
4
|
export { candidateReviewRecord, SurveyInputBuilder } from "./builder.js";
|
|
@@ -31,3 +31,5 @@ export { referenceUtteranceExtractor, surveyAgentUtterance, utteranceToSurveyInp
|
|
|
31
31
|
export type { ExtractedStatement, StatementBadge, UtteranceClaimExtractor, UtteranceStatement, UtteranceStatementRecords, UtteranceTrustReport, } from "./agent-utterance.js";
|
|
32
32
|
export { mappingReviewToSurface, referenceSchemaExtractor, surveySchemaMapping, } from "./schema-mapping.js";
|
|
33
33
|
export type { MappingProposalRecord, ReviewedMapping, SchemaMappingExtractor, SchemaMappingOptions, SystemFieldRef, } from "./schema-mapping.js";
|
|
34
|
+
export { buildAuthorizedActionAuthorizing, isValidAuthorizing, validateAuthorizing } from "./review-authorizing.js";
|
|
35
|
+
export type { BuildAuthorizedActionAuthorizingInput, ReviewAuthorizingIssue, ReviewAuthorizingIssueCode, } from "./review-authorizing.js";
|
package/dist/src/index.js
CHANGED
|
@@ -14,3 +14,4 @@ export { apiRecordSource, manualEntrySource, policyStandardSource, uploadedDocum
|
|
|
14
14
|
export { applyAutoAcceptPolicy, applyMappingReview, buildMappingReviewItems, lookupMapping, lookupRejectedMapping, normalizeQuestion, proposalsToCandidateSet, referenceMappingProposer, resolveQuestion, } from "./inquiry-mapping.js";
|
|
15
15
|
export { referenceUtteranceExtractor, surveyAgentUtterance, utteranceToSurveyInput, } from "./agent-utterance.js";
|
|
16
16
|
export { mappingReviewToSurface, referenceSchemaExtractor, surveySchemaMapping, } from "./schema-mapping.js";
|
|
17
|
+
export { buildAuthorizedActionAuthorizing, isValidAuthorizing, validateAuthorizing } from "./review-authorizing.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runReviewMcp(args: string[]): Promise<void>;
|