@case-framework/survey-assistant 0.1.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 +212 -0
- package/dist/authoring-references-Cy8J-DWt.d.mts +48 -0
- package/dist/authoring-references-Cy8J-DWt.d.mts.map +1 -0
- package/dist/authoring-references-X6uRaWuf.mjs +68 -0
- package/dist/authoring-references-X6uRaWuf.mjs.map +1 -0
- package/dist/capabilities-B6tvE7fK.mjs +66 -0
- package/dist/capabilities-B6tvE7fK.mjs.map +1 -0
- package/dist/capabilities-DvSKtjAw.d.mts +182 -0
- package/dist/capabilities-DvSKtjAw.d.mts.map +1 -0
- package/dist/capabilities-default.d.mts +15 -0
- package/dist/capabilities-default.d.mts.map +1 -0
- package/dist/capabilities-default.mjs +347 -0
- package/dist/capabilities-default.mjs.map +1 -0
- package/dist/constants-CFUWrRtl.mjs +7 -0
- package/dist/constants-CFUWrRtl.mjs.map +1 -0
- package/dist/constants-Jw0k8ojS.d.mts +67 -0
- package/dist/constants-Jw0k8ojS.d.mts.map +1 -0
- package/dist/controller-proxy-BRDusFiO.d.mts +57 -0
- package/dist/controller-proxy-BRDusFiO.d.mts.map +1 -0
- package/dist/controller-proxy-Duxo2IFE.mjs +92 -0
- package/dist/controller-proxy-Duxo2IFE.mjs.map +1 -0
- package/dist/digest-BsoVq49o.d.mts +9 -0
- package/dist/digest-BsoVq49o.d.mts.map +1 -0
- package/dist/digest.d.mts +2 -0
- package/dist/digest.mjs +20 -0
- package/dist/digest.mjs.map +1 -0
- package/dist/engine-sPvuixWg.mjs +4857 -0
- package/dist/engine-sPvuixWg.mjs.map +1 -0
- package/dist/engine.d.mts +3 -0
- package/dist/engine.mjs +4 -0
- package/dist/index-BWNHkpkh.d.mts +187 -0
- package/dist/index-BWNHkpkh.d.mts.map +1 -0
- package/dist/index-CUqbBjkc.d.mts +641 -0
- package/dist/index-CUqbBjkc.d.mts.map +1 -0
- package/dist/index-MpEMQzTm.d.mts +123 -0
- package/dist/index-MpEMQzTm.d.mts.map +1 -0
- package/dist/index-TFtvBiSQ.d.mts +1149 -0
- package/dist/index-TFtvBiSQ.d.mts.map +1 -0
- package/dist/memory-thread-repository-CJkkVE2-.mjs +718 -0
- package/dist/memory-thread-repository-CJkkVE2-.mjs.map +1 -0
- package/dist/protocol-DV0ka9WT.mjs +1032 -0
- package/dist/protocol-DV0ka9WT.mjs.map +1 -0
- package/dist/protocol.d.mts +3 -0
- package/dist/protocol.mjs +2 -0
- package/dist/react-VuYe-cPh.mjs +521 -0
- package/dist/react-VuYe-cPh.mjs.map +1 -0
- package/dist/react-integration.d.mts +2 -0
- package/dist/react-integration.mjs +3 -0
- package/dist/react.d.mts +3 -0
- package/dist/react.mjs +4 -0
- package/dist/references/assistant-operations.md +287 -0
- package/dist/references/core-rules.md +11 -0
- package/dist/references/embedded-forms.md +80 -0
- package/dist/references/expressions.md +301 -0
- package/dist/references/item-types.md +364 -0
- package/dist/references/localization.md +25 -0
- package/dist/references/rich-text-content.md +193 -0
- package/dist/references/source-material-surveys.md +60 -0
- package/dist/references/survey-data-model.md +109 -0
- package/dist/references/survey-quality.md +23 -0
- package/dist/request-context-jcmXT_Q2.mjs +44 -0
- package/dist/request-context-jcmXT_Q2.mjs.map +1 -0
- package/dist/request-guardrails-C59IWnH8.mjs +73 -0
- package/dist/request-guardrails-C59IWnH8.mjs.map +1 -0
- package/dist/server-agent.d.mts +131 -0
- package/dist/server-agent.d.mts.map +1 -0
- package/dist/server-agent.mjs +229 -0
- package/dist/server-agent.mjs.map +1 -0
- package/dist/server-runtime.d.mts +123 -0
- package/dist/server-runtime.d.mts.map +1 -0
- package/dist/server-runtime.mjs +296 -0
- package/dist/server-runtime.mjs.map +1 -0
- package/dist/server-tasks.d.mts +78 -0
- package/dist/server-tasks.d.mts.map +1 -0
- package/dist/server-tasks.mjs +253 -0
- package/dist/server-tasks.mjs.map +1 -0
- package/dist/server-tools.d.mts +2 -0
- package/dist/server-tools.mjs +2 -0
- package/dist/server.d.mts +52 -0
- package/dist/server.d.mts.map +1 -0
- package/dist/server.mjs +6 -0
- package/dist/storage-postgres.d.mts +37 -0
- package/dist/storage-postgres.d.mts.map +1 -0
- package/dist/storage-postgres.mjs +167 -0
- package/dist/storage-postgres.mjs.map +1 -0
- package/dist/thread-documents-DamIq9Od.d.mts +91 -0
- package/dist/thread-documents-DamIq9Od.d.mts.map +1 -0
- package/dist/thread-handlers-DpynUc64.d.mts +112 -0
- package/dist/thread-handlers-DpynUc64.d.mts.map +1 -0
- package/dist/tools-Hz2p7vyv.mjs +1879 -0
- package/dist/tools-Hz2p7vyv.mjs.map +1 -0
- package/dist/ui.css +2 -0
- package/dist/ui.d.mts +63 -0
- package/dist/ui.d.mts.map +1 -0
- package/dist/ui.mjs +2238 -0
- package/dist/ui.mjs.map +1 -0
- package/package.json +166 -0
- package/ui.css.d.ts +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# CASE Survey Assistant
|
|
2
|
+
|
|
3
|
+
This workspace package exposes isolated protocol, engine, runtime, headless
|
|
4
|
+
React, and optional localized UI entry points:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import {
|
|
8
|
+
surveyChangeSetSchema,
|
|
9
|
+
surveyAssistantTurnFinalSchema,
|
|
10
|
+
type SurveyChangeSet,
|
|
11
|
+
} from "@case-framework/survey-assistant/protocol";
|
|
12
|
+
|
|
13
|
+
import { buildCapabilityDigest } from "@case-framework/survey-assistant/protocol/digest";
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
createSurveyAssistantEngineContext,
|
|
17
|
+
validateSurveyOperations,
|
|
18
|
+
} from "@case-framework/survey-assistant/engine";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
defaultSurveyAssistantCapabilities,
|
|
22
|
+
defaultSurveyAssistantCapabilitySet,
|
|
23
|
+
} from "@case-framework/survey-assistant/capabilities/default";
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
createSurveyAssistantChatHandler,
|
|
27
|
+
type SurveyAssistantAuthorize,
|
|
28
|
+
} from "@case-framework/survey-assistant/server";
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
createSurveyAssistantAgent,
|
|
32
|
+
type SurveyAssistantHistoryCompatibility,
|
|
33
|
+
} from "@case-framework/survey-assistant/server/agent";
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
SURVEY_ASSISTANT_TOOL_IDS,
|
|
37
|
+
surveyAssistantTools,
|
|
38
|
+
} from "@case-framework/survey-assistant/server/tools";
|
|
39
|
+
|
|
40
|
+
import {
|
|
41
|
+
createSurveyAssistantTaskAgent,
|
|
42
|
+
createSurveyAssistantTaskHandler,
|
|
43
|
+
} from "@case-framework/survey-assistant/server/tasks";
|
|
44
|
+
|
|
45
|
+
import {
|
|
46
|
+
createSurveyAssistantRuntime,
|
|
47
|
+
parseSurveyAssistantEnvironment,
|
|
48
|
+
} from "@case-framework/survey-assistant/server/runtime";
|
|
49
|
+
|
|
50
|
+
import {
|
|
51
|
+
createSurveyAssistantPostgresRuntime,
|
|
52
|
+
createSurveyAssistantPostgresThreadDocumentRepository,
|
|
53
|
+
initializeSurveyAssistantPostgresStorage,
|
|
54
|
+
} from "@case-framework/survey-assistant/storage/postgres";
|
|
55
|
+
|
|
56
|
+
import {
|
|
57
|
+
createSurveyAssistantControllerBridge,
|
|
58
|
+
createSurveyAssistantTaskClient,
|
|
59
|
+
createSurveyAssistantTaskExecutor,
|
|
60
|
+
} from "@case-framework/survey-assistant/react/integration";
|
|
61
|
+
|
|
62
|
+
import { useSurveyAssistantModelCatalog } from "@case-framework/survey-assistant/react";
|
|
63
|
+
|
|
64
|
+
import {
|
|
65
|
+
ConnectedSurveyAssistantPanel,
|
|
66
|
+
SurveyAssistantPanel,
|
|
67
|
+
} from "@case-framework/survey-assistant/ui";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`/protocol` is the browser-safe runtime owner for wire schemas and inferred
|
|
71
|
+
types. `/protocol/digest` keeps stable hashing independently tree-shakeable for
|
|
72
|
+
Survey UI consumers. `/engine` derives request-local survey context and owns
|
|
73
|
+
pure inspection, normalization, validation/simulation, expression compilation,
|
|
74
|
+
and turn collection. `/capabilities/default` provides the trusted, versioned
|
|
75
|
+
capabilities for the standard CASE item registry.
|
|
76
|
+
|
|
77
|
+
`/server` owns the lightweight framework-agnostic Web chat handler, required
|
|
78
|
+
host authorization contract, request guardrails and context, thread-attachment
|
|
79
|
+
repository and model-selected native replay, turn-final stream, error/metrics hooks, and packaged
|
|
80
|
+
Markdown authoring references. `/server/tools` owns the standard
|
|
81
|
+
request-context tools, and `/server/agent` owns their Agent,
|
|
82
|
+
instructions, thread-scoped Observational Memory defaults, and optional
|
|
83
|
+
history-compatibility policy for custom memory setups. `/server/runtime` is the
|
|
84
|
+
high-level composition layer: it parses an injected environment, resolves the
|
|
85
|
+
approved provider/model catalog (including optional Azure deployment
|
|
86
|
+
discovery), exposes standard Mastra agents and gateways, and creates the Web
|
|
87
|
+
handlers. The host still constructs the standard Mastra instance and owns
|
|
88
|
+
credentials, authorization, storage connection lifecycle, logging, and route
|
|
89
|
+
files.
|
|
90
|
+
|
|
91
|
+
`/react` owns the headless chat session, threads, validated
|
|
92
|
+
model-catalog loading, remembered model selection, and structural controller
|
|
93
|
+
proxy. `/react/integration` is the lightweight controller and one-shot task
|
|
94
|
+
entry for editor packages that do not need chat transport. `/ui` owns the
|
|
95
|
+
reusable panel, transcript, reasoning/tool presentation, prompt and attachment
|
|
96
|
+
controls, model picker, thread history, and complete English and Dutch defaults. `ConnectedSurveyAssistantPanel`
|
|
97
|
+
also owns model-catalog loading and remembered selection for the common case. Import
|
|
98
|
+
`@case-framework/survey-assistant/ui.css` once from the host root layout. The
|
|
99
|
+
stylesheet has no preflight and scopes generated utilities beneath the panel
|
|
100
|
+
root. A host can pass a partial localization catalog to extend or override the
|
|
101
|
+
defaults without supplying a complete catalog.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<ConnectedSurveyAssistantPanel
|
|
105
|
+
api="/api/survey-assistant/chat"
|
|
106
|
+
applyPolicy="auto"
|
|
107
|
+
controller={assistantController}
|
|
108
|
+
language={language}
|
|
109
|
+
localizations={assistantLocalizations}
|
|
110
|
+
onModelChange={setSelectedModelId}
|
|
111
|
+
resourceId={authenticatedUserId}
|
|
112
|
+
threadApi="/api/survey-assistant/threads"
|
|
113
|
+
/>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The browser-supplied `resourceId` is request metadata, not authorization. A
|
|
117
|
+
production host must derive user, survey, and thread ownership in the server
|
|
118
|
+
handler's required `authorize` callback.
|
|
119
|
+
|
|
120
|
+
`/protocol`, `/engine`, and `/capabilities/default` may not import React,
|
|
121
|
+
Next.js, Mastra, AI SDK, `survey-ui`, or Node-only storage. `/protocol` has only
|
|
122
|
+
Zod runtime dependencies; `/engine` may use `survey-core`. `/server` is
|
|
123
|
+
server-only and may import Mastra, AI SDK, and Node APIs, but never React,
|
|
124
|
+
Next.js, or `survey-ui`. The separate server entries prevent handler-only
|
|
125
|
+
consumers from eagerly loading Agent/Memory code. `@case-framework/survey-ui`
|
|
126
|
+
owns the optional live-editor bridge, snapshot/apply functions, and snapshot-backed
|
|
127
|
+
one-shot provider because those functions must operate on its editor instance
|
|
128
|
+
and item registry. The assistant package supplies the standard task Web handler
|
|
129
|
+
and browser executor adapter, so another host does not need to recreate Next
|
|
130
|
+
server actions or repeat the one-shot method mapping. This package never
|
|
131
|
+
imports `survey-ui`.
|
|
132
|
+
|
|
133
|
+
Custom item packages can define one capability implementation in a server-safe
|
|
134
|
+
module and attach it to the UI entry:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// rating-capability.ts (safe to import on the server)
|
|
138
|
+
import type { AssistantItemCapabilityAdapter } from "@case-framework/survey-assistant/engine";
|
|
139
|
+
|
|
140
|
+
export const ratingAssistantCapability = {
|
|
141
|
+
manifest: {
|
|
142
|
+
itemType: "ratingQuestion",
|
|
143
|
+
capabilityVersion: "1",
|
|
144
|
+
displayName: "Rating question",
|
|
145
|
+
create: "deterministic",
|
|
146
|
+
supportedOperations: [
|
|
147
|
+
"create-item",
|
|
148
|
+
"update-item-key",
|
|
149
|
+
"update-item-translation",
|
|
150
|
+
"patch-item-config",
|
|
151
|
+
],
|
|
152
|
+
contentSurfaces: [{ key: "title", role: "primary", format: "rich", requiredOnCreate: true }],
|
|
153
|
+
referenceTopics: ["rating-config"],
|
|
154
|
+
authoring: { configSummary: "Config has numeric min, max, and step fields." },
|
|
155
|
+
},
|
|
156
|
+
references: [
|
|
157
|
+
{
|
|
158
|
+
topic: "rating-config",
|
|
159
|
+
title: "Rating configuration",
|
|
160
|
+
markdown: "Use min < max and a positive step.",
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
} satisfies AssistantItemCapabilityAdapter;
|
|
164
|
+
|
|
165
|
+
// rating-entry.tsx (client/editor module)
|
|
166
|
+
import type { ItemRegistryEntry } from "@case-framework/survey-ui";
|
|
167
|
+
|
|
168
|
+
export const ratingQuestionEntry = {
|
|
169
|
+
itemType: "ratingQuestion",
|
|
170
|
+
constructor: RatingQuestionItemCore,
|
|
171
|
+
renderComponent: RatingQuestionRenderer,
|
|
172
|
+
editorComponent: RatingQuestionEditor,
|
|
173
|
+
infos: ratingQuestionInfos,
|
|
174
|
+
getInitialItem: createInitialRatingQuestion,
|
|
175
|
+
assistantCapability: ratingAssistantCapability,
|
|
176
|
+
} satisfies ItemRegistryEntry;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The composed editor registry validates and caches the attached capabilities
|
|
180
|
+
once. Server configuration imports `ratingAssistantCapability` directly and
|
|
181
|
+
adds it to the trusted capability set; it must not trust capability functions
|
|
182
|
+
received from a browser snapshot.
|
|
183
|
+
|
|
184
|
+
See [Custom item registration](../../docs/survey-assistant/survey-ui-bridge.md#custom-item-registration)
|
|
185
|
+
for the complete editor and server composition example.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
pnpm --filter @case-framework/survey-assistant check
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This typechecks and builds all entries, copies server references, then verifies
|
|
192
|
+
their source and built import graphs. The optional Postgres entry accepts a
|
|
193
|
+
host-owned `PostgresStore` or store configuration; it does not read environment
|
|
194
|
+
variables, create hidden singletons, or own connection shutdown.
|
|
195
|
+
|
|
196
|
+
## Integration Levels
|
|
197
|
+
|
|
198
|
+
Use the highest level that fits the host; the lower layers remain available for
|
|
199
|
+
custom authentication, provider policy, UI, or storage.
|
|
200
|
+
|
|
201
|
+
- **Standard server:** `parseSurveyAssistantEnvironment` plus
|
|
202
|
+
`createSurveyAssistantRuntime`, then register its `agents` and `gateways` in a
|
|
203
|
+
normal `Mastra` instance and call `runtime.createHandlers(...)`.
|
|
204
|
+
- **Custom server:** compose `createSurveyAssistantAgent`, individual chat,
|
|
205
|
+
task, thread, and model handlers, and a custom `resolveModel` directly.
|
|
206
|
+
- **Standard UI:** `ConnectedSurveyAssistantPanel` plus Survey UI's
|
|
207
|
+
`useSurveyEditorAssistantIntegration` bridge.
|
|
208
|
+
- **Custom UI:** use `useSurveyAssistantSession`, thread/model clients from
|
|
209
|
+
`/react`, and controller/task adapters from `/react/integration`.
|
|
210
|
+
|
|
211
|
+
The high-level APIs are thin composition helpers over the same exported
|
|
212
|
+
primitives. They do not introduce a second runtime or hide Mastra.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/server/authoring-references.d.ts
|
|
2
|
+
declare const surveyAuthoringReferenceTopics: readonly ["core-rules", "survey-data-model", "source-material-surveys", "localization", "rich-text-content", "item-types", "embedded-forms", "expressions", "assistant-operations", "survey-quality"];
|
|
3
|
+
type SurveyAuthoringReferenceTopic = (typeof surveyAuthoringReferenceTopics)[number];
|
|
4
|
+
declare const surveyAuthoringReferences: {
|
|
5
|
+
readonly "core-rules": {
|
|
6
|
+
readonly title: "Core authoring rules";
|
|
7
|
+
readonly content: string;
|
|
8
|
+
};
|
|
9
|
+
readonly "survey-data-model": {
|
|
10
|
+
readonly title: "Survey data model";
|
|
11
|
+
readonly content: string;
|
|
12
|
+
};
|
|
13
|
+
readonly "source-material-surveys": {
|
|
14
|
+
readonly title: "Source-material survey implementation";
|
|
15
|
+
readonly content: string;
|
|
16
|
+
};
|
|
17
|
+
readonly localization: {
|
|
18
|
+
readonly title: "Survey localization";
|
|
19
|
+
readonly content: string;
|
|
20
|
+
};
|
|
21
|
+
readonly "rich-text-content": {
|
|
22
|
+
readonly title: "Rich text content";
|
|
23
|
+
readonly content: string;
|
|
24
|
+
};
|
|
25
|
+
readonly "item-types": {
|
|
26
|
+
readonly title: "Item types";
|
|
27
|
+
readonly content: string;
|
|
28
|
+
};
|
|
29
|
+
readonly "embedded-forms": {
|
|
30
|
+
readonly title: "Choice option embedded forms";
|
|
31
|
+
readonly content: string;
|
|
32
|
+
};
|
|
33
|
+
readonly expressions: {
|
|
34
|
+
readonly title: "Expressions";
|
|
35
|
+
readonly content: string;
|
|
36
|
+
};
|
|
37
|
+
readonly "assistant-operations": {
|
|
38
|
+
readonly title: "Assistant operations";
|
|
39
|
+
readonly content: string;
|
|
40
|
+
};
|
|
41
|
+
readonly "survey-quality": {
|
|
42
|
+
readonly title: "Survey quality review";
|
|
43
|
+
readonly content: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { surveyAuthoringReferenceTopics as n, surveyAuthoringReferences as r, SurveyAuthoringReferenceTopic as t };
|
|
48
|
+
//# sourceMappingURL=authoring-references-Cy8J-DWt.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-references-Cy8J-DWt.d.mts","names":[],"sources":["../src/server/authoring-references.ts"],"mappings":";cAMa,8BAAA;AAAA,KAaD,6BAAA,WAAwC,8BAAA;AAAA,cAEvC,yBAAA;EAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import path, { resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
//#region ../../node_modules/.pnpm/tsdown@0.21.10_synckit@0.11.12_typescript@6.0.3/node_modules/tsdown/esm-shims.js
|
|
5
|
+
const getFilename = () => fileURLToPath(import.meta.url);
|
|
6
|
+
const getDirname = () => path.dirname(getFilename());
|
|
7
|
+
const __dirname = /* @__PURE__ */ getDirname();
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/server/authoring-references.ts
|
|
10
|
+
const loadReference = (fileName) => readFileSync(resolve(__dirname, "references", fileName), "utf8").trim();
|
|
11
|
+
const surveyAuthoringReferenceTopics = [
|
|
12
|
+
"core-rules",
|
|
13
|
+
"survey-data-model",
|
|
14
|
+
"source-material-surveys",
|
|
15
|
+
"localization",
|
|
16
|
+
"rich-text-content",
|
|
17
|
+
"item-types",
|
|
18
|
+
"embedded-forms",
|
|
19
|
+
"expressions",
|
|
20
|
+
"assistant-operations",
|
|
21
|
+
"survey-quality"
|
|
22
|
+
];
|
|
23
|
+
const surveyAuthoringReferences = {
|
|
24
|
+
"core-rules": {
|
|
25
|
+
title: "Core authoring rules",
|
|
26
|
+
content: loadReference("core-rules.md")
|
|
27
|
+
},
|
|
28
|
+
"survey-data-model": {
|
|
29
|
+
title: "Survey data model",
|
|
30
|
+
content: loadReference("survey-data-model.md")
|
|
31
|
+
},
|
|
32
|
+
"source-material-surveys": {
|
|
33
|
+
title: "Source-material survey implementation",
|
|
34
|
+
content: loadReference("source-material-surveys.md")
|
|
35
|
+
},
|
|
36
|
+
localization: {
|
|
37
|
+
title: "Survey localization",
|
|
38
|
+
content: loadReference("localization.md")
|
|
39
|
+
},
|
|
40
|
+
"rich-text-content": {
|
|
41
|
+
title: "Rich text content",
|
|
42
|
+
content: loadReference("rich-text-content.md")
|
|
43
|
+
},
|
|
44
|
+
"item-types": {
|
|
45
|
+
title: "Item types",
|
|
46
|
+
content: loadReference("item-types.md")
|
|
47
|
+
},
|
|
48
|
+
"embedded-forms": {
|
|
49
|
+
title: "Choice option embedded forms",
|
|
50
|
+
content: loadReference("embedded-forms.md")
|
|
51
|
+
},
|
|
52
|
+
expressions: {
|
|
53
|
+
title: "Expressions",
|
|
54
|
+
content: loadReference("expressions.md")
|
|
55
|
+
},
|
|
56
|
+
"assistant-operations": {
|
|
57
|
+
title: "Assistant operations",
|
|
58
|
+
content: loadReference("assistant-operations.md")
|
|
59
|
+
},
|
|
60
|
+
"survey-quality": {
|
|
61
|
+
title: "Survey quality review",
|
|
62
|
+
content: loadReference("survey-quality.md")
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { surveyAuthoringReferences as n, surveyAuthoringReferenceTopics as t };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=authoring-references-X6uRaWuf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-references-X6uRaWuf.mjs","names":[],"sources":["../../../node_modules/.pnpm/tsdown@0.21.10_synckit@0.11.12_typescript@6.0.3/node_modules/tsdown/esm-shims.js","../src/server/authoring-references.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst loadReference = (fileName: string) =>\n readFileSync(resolve(__dirname, \"references\", fileName), \"utf8\").trim();\n\nexport const surveyAuthoringReferenceTopics = [\n \"core-rules\",\n \"survey-data-model\",\n \"source-material-surveys\",\n \"localization\",\n \"rich-text-content\",\n \"item-types\",\n \"embedded-forms\",\n \"expressions\",\n \"assistant-operations\",\n \"survey-quality\",\n] as const;\n\nexport type SurveyAuthoringReferenceTopic = (typeof surveyAuthoringReferenceTopics)[number];\n\nexport const surveyAuthoringReferences = {\n \"core-rules\": {\n title: \"Core authoring rules\",\n content: loadReference(\"core-rules.md\"),\n },\n \"survey-data-model\": {\n title: \"Survey data model\",\n content: loadReference(\"survey-data-model.md\"),\n },\n \"source-material-surveys\": {\n title: \"Source-material survey implementation\",\n content: loadReference(\"source-material-surveys.md\"),\n },\n localization: {\n title: \"Survey localization\",\n content: loadReference(\"localization.md\"),\n },\n \"rich-text-content\": {\n title: \"Rich text content\",\n content: loadReference(\"rich-text-content.md\"),\n },\n \"item-types\": {\n title: \"Item types\",\n content: loadReference(\"item-types.md\"),\n },\n \"embedded-forms\": {\n title: \"Choice option embedded forms\",\n content: loadReference(\"embedded-forms.md\"),\n },\n expressions: {\n title: \"Expressions\",\n content: loadReference(\"expressions.md\"),\n },\n \"assistant-operations\": {\n title: \"Assistant operations\",\n content: loadReference(\"assistant-operations.md\"),\n },\n \"survey-quality\": {\n title: \"Survey quality review\",\n content: loadReference(\"survey-quality.md\"),\n },\n} as const satisfies Record<SurveyAuthoringReferenceTopic, { title: string; content: string }>;\n"],"x_google_ignoreList":[0],"mappings":";;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,IAAI;AACxD,MAAM,mBAAmB,KAAK,QAAQ,aAAa,CAAC;AAEpD,MAAa,YAA4B,4BAAY;;;ACJrD,MAAM,iBAAiB,aACrB,aAAa,QAAQ,WAAW,cAAc,SAAS,EAAE,OAAO,CAAC,MAAM;AAEzE,MAAa,iCAAiC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAID,MAAa,4BAA4B;CACvC,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,gBAAgB;EACxC;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC/C;CACD,2BAA2B;EACzB,OAAO;EACP,SAAS,cAAc,6BAA6B;EACrD;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,kBAAkB;EAC1C;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC/C;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,gBAAgB;EACxC;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC5C;CACD,aAAa;EACX,OAAO;EACP,SAAS,cAAc,iBAAiB;EACzC;CACD,wBAAwB;EACtB,OAAO;EACP,SAAS,cAAc,0BAA0B;EAClD;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC5C;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { W as assistantItemTypeManifestSchema } from "./protocol-DV0ka9WT.mjs";
|
|
2
|
+
import { buildCapabilityDigest } from "./digest.mjs";
|
|
3
|
+
//#region src/engine/capabilities.ts
|
|
4
|
+
const resolveAssistantCapabilityReference = ({ capabilities, itemType, topic }) => capabilities?.byItemType.get(itemType)?.references?.find((reference) => reference.topic === topic);
|
|
5
|
+
const inspectAssistantItem = ({ capabilities, item }) => capabilities?.byItemType.get(item.itemType)?.inspectItem?.(item);
|
|
6
|
+
const createSurveyAssistantCapabilities = (capabilities) => {
|
|
7
|
+
const byItemType = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const capability of capabilities) {
|
|
9
|
+
const manifest = assistantItemTypeManifestSchema.parse(capability.manifest);
|
|
10
|
+
const itemType = manifest.itemType;
|
|
11
|
+
if (byItemType.has(itemType)) throw new Error(`Duplicate survey assistant capability for item type "${itemType}".`);
|
|
12
|
+
if (manifest.create === "deterministic" && !manifest.supportedOperations.includes("create-item")) throw new Error(`Deterministically creatable item type "${itemType}" must support "create-item".`);
|
|
13
|
+
const declaredReferenceTopics = new Set(manifest.referenceTopics ?? []);
|
|
14
|
+
for (const reference of capability.references ?? []) if (!declaredReferenceTopics.has(reference.topic)) throw new Error(`Capability reference "${reference.topic}" for item type "${itemType}" is missing from manifest.referenceTopics.`);
|
|
15
|
+
byItemType.set(itemType, capability);
|
|
16
|
+
}
|
|
17
|
+
const manifestWithoutDigest = { itemTypes: Array.from(byItemType.values()).map((capability) => capability.manifest).sort((left, right) => left.itemType.localeCompare(right.itemType)) };
|
|
18
|
+
return {
|
|
19
|
+
manifest: {
|
|
20
|
+
...manifestWithoutDigest,
|
|
21
|
+
digest: buildCapabilityDigest(manifestWithoutDigest)
|
|
22
|
+
},
|
|
23
|
+
byItemType
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getDeterministicCreateItemTypes = (manifest) => manifest.itemTypes.filter((entry) => entry.create === "deterministic").map((entry) => entry.itemType);
|
|
27
|
+
const resolveAssistantItemCreation = ({ itemType, manifest, parentItemId }) => {
|
|
28
|
+
const capability = manifest.itemTypes.find((entry) => entry.itemType === itemType);
|
|
29
|
+
if (capability?.create === "deterministic") return { kind: "deterministic" };
|
|
30
|
+
if (capability?.create === "interactive-only") return {
|
|
31
|
+
kind: "ui-intent",
|
|
32
|
+
intent: {
|
|
33
|
+
kind: "open-create-item",
|
|
34
|
+
itemType,
|
|
35
|
+
parentItemId
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
kind: "unsupported",
|
|
40
|
+
reason: capability ? `Item type "${itemType}" does not support assistant creation.` : `Item type "${itemType}" is not installed.`
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const createUnsupportedItemCapability = ({ displayName, itemType }) => ({ manifest: {
|
|
44
|
+
itemType,
|
|
45
|
+
capabilityVersion: "unsupported-v1",
|
|
46
|
+
displayName,
|
|
47
|
+
create: "unsupported",
|
|
48
|
+
supportedOperations: [],
|
|
49
|
+
contentSurfaces: []
|
|
50
|
+
} });
|
|
51
|
+
var SurveyAssistantCapabilityMismatchError = class extends Error {
|
|
52
|
+
code = "survey-assistant-capability-mismatch";
|
|
53
|
+
constructor(message = "Survey assistant capabilities changed; start a fresh turn and retry.") {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = "SurveyAssistantCapabilityMismatchError";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const assertSurveyAssistantCapabilities = ({ manifest, trustedCapabilities, versionDigest }) => {
|
|
59
|
+
const { digest: claimedDigest, ...manifestWithoutDigest } = manifest;
|
|
60
|
+
if (claimedDigest !== buildCapabilityDigest(manifestWithoutDigest) || versionDigest !== claimedDigest) throw new SurveyAssistantCapabilityMismatchError();
|
|
61
|
+
if (trustedCapabilities && trustedCapabilities.manifest.digest !== claimedDigest) throw new SurveyAssistantCapabilityMismatchError("The editor and server use different survey assistant capabilities; refresh and retry.");
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { getDeterministicCreateItemTypes as a, resolveAssistantItemCreation as c, createUnsupportedItemCapability as i, assertSurveyAssistantCapabilities as n, inspectAssistantItem as o, createSurveyAssistantCapabilities as r, resolveAssistantCapabilityReference as s, SurveyAssistantCapabilityMismatchError as t };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=capabilities-B6tvE7fK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-B6tvE7fK.mjs","names":[],"sources":["../src/engine/capabilities.ts"],"sourcesContent":["import type { RawSurveyItem, ValueType } from \"@case-framework/survey-core\";\nimport type {\n AssistantItemTypeManifest,\n JsonValue,\n SurveyAssistantCapabilityManifest,\n SurveyOperation,\n SurveyValidationIssue,\n} from \"../protocol\";\nimport { assistantItemTypeManifestSchema } from \"../protocol\";\nimport { buildCapabilityDigest } from \"../protocol/digest\";\n\nexport interface AssistantCapabilityReference {\n topic: string;\n title?: string;\n markdown: string;\n}\n\nexport interface AssistantItemInspection {\n summary: string;\n details?: JsonValue;\n}\n\nexport interface AssistantItemCapabilityAdapter {\n manifest: AssistantItemTypeManifest;\n references?: AssistantCapabilityReference[];\n normalizeCreate?: (item: RawSurveyItem) => RawSurveyItem;\n validateItem?: (item: RawSurveyItem) => SurveyValidationIssue[];\n supportsOperation?: (operation: SurveyOperation) => boolean;\n deriveResponseSlots?: (item: RawSurveyItem) => Record<string, ValueType>;\n inspectItem?: (item: RawSurveyItem) => AssistantItemInspection;\n}\n\nexport interface SurveyAssistantCapabilitySet {\n manifest: SurveyAssistantCapabilityManifest;\n byItemType: ReadonlyMap<string, AssistantItemCapabilityAdapter>;\n}\n\nexport const resolveAssistantCapabilityReference = ({\n capabilities,\n itemType,\n topic,\n}: {\n capabilities: SurveyAssistantCapabilitySet | undefined;\n itemType: string;\n topic: string;\n}): AssistantCapabilityReference | undefined =>\n capabilities?.byItemType\n .get(itemType)\n ?.references?.find((reference) => reference.topic === topic);\n\nexport const inspectAssistantItem = ({\n capabilities,\n item,\n}: {\n capabilities: SurveyAssistantCapabilitySet | undefined;\n item: RawSurveyItem;\n}): AssistantItemInspection | undefined =>\n capabilities?.byItemType.get(item.itemType)?.inspectItem?.(item);\n\nexport type AssistantItemCreationResolution =\n | { kind: \"deterministic\" }\n | {\n kind: \"ui-intent\";\n intent: { kind: \"open-create-item\"; itemType: string; parentItemId?: string };\n }\n | { kind: \"unsupported\"; reason: string };\n\nexport const createSurveyAssistantCapabilities = (\n capabilities: readonly AssistantItemCapabilityAdapter[],\n): SurveyAssistantCapabilitySet => {\n const byItemType = new Map<string, AssistantItemCapabilityAdapter>();\n\n for (const capability of capabilities) {\n const manifest = assistantItemTypeManifestSchema.parse(capability.manifest);\n const itemType = manifest.itemType;\n if (byItemType.has(itemType)) {\n throw new Error(`Duplicate survey assistant capability for item type \"${itemType}\".`);\n }\n if (\n manifest.create === \"deterministic\" &&\n !manifest.supportedOperations.includes(\"create-item\")\n ) {\n throw new Error(\n `Deterministically creatable item type \"${itemType}\" must support \"create-item\".`,\n );\n }\n const declaredReferenceTopics = new Set(manifest.referenceTopics ?? []);\n for (const reference of capability.references ?? []) {\n if (!declaredReferenceTopics.has(reference.topic)) {\n throw new Error(\n `Capability reference \"${reference.topic}\" for item type \"${itemType}\" is missing from manifest.referenceTopics.`,\n );\n }\n }\n byItemType.set(itemType, capability);\n }\n\n const itemTypes = Array.from(byItemType.values())\n .map((capability) => capability.manifest)\n .sort((left, right) => left.itemType.localeCompare(right.itemType));\n const manifestWithoutDigest = { itemTypes };\n\n return {\n manifest: {\n ...manifestWithoutDigest,\n digest: buildCapabilityDigest(manifestWithoutDigest),\n },\n byItemType,\n };\n};\n\nexport const getDeterministicCreateItemTypes = (\n manifest: SurveyAssistantCapabilityManifest,\n): string[] =>\n manifest.itemTypes\n .filter((entry) => entry.create === \"deterministic\")\n .map((entry) => entry.itemType);\n\nexport const resolveAssistantItemCreation = ({\n itemType,\n manifest,\n parentItemId,\n}: {\n itemType: string;\n manifest: SurveyAssistantCapabilityManifest;\n parentItemId?: string;\n}): AssistantItemCreationResolution => {\n const capability = manifest.itemTypes.find((entry) => entry.itemType === itemType);\n if (capability?.create === \"deterministic\") {\n return { kind: \"deterministic\" };\n }\n if (capability?.create === \"interactive-only\") {\n return {\n kind: \"ui-intent\",\n intent: { kind: \"open-create-item\", itemType, parentItemId },\n };\n }\n return {\n kind: \"unsupported\",\n reason: capability\n ? `Item type \"${itemType}\" does not support assistant creation.`\n : `Item type \"${itemType}\" is not installed.`,\n };\n};\n\nexport const createUnsupportedItemCapability = ({\n displayName,\n itemType,\n}: {\n displayName: string;\n itemType: string;\n}): AssistantItemCapabilityAdapter => ({\n manifest: {\n itemType,\n capabilityVersion: \"unsupported-v1\",\n displayName,\n create: \"unsupported\",\n supportedOperations: [],\n contentSurfaces: [],\n },\n});\n\nexport class SurveyAssistantCapabilityMismatchError extends Error {\n readonly code = \"survey-assistant-capability-mismatch\";\n\n constructor(message = \"Survey assistant capabilities changed; start a fresh turn and retry.\") {\n super(message);\n this.name = \"SurveyAssistantCapabilityMismatchError\";\n }\n}\n\nexport const assertSurveyAssistantCapabilities = ({\n manifest,\n trustedCapabilities,\n versionDigest,\n}: {\n manifest: SurveyAssistantCapabilityManifest;\n trustedCapabilities?: SurveyAssistantCapabilitySet;\n versionDigest: string;\n}): void => {\n const { digest: claimedDigest, ...manifestWithoutDigest } = manifest;\n const computedDigest = buildCapabilityDigest(manifestWithoutDigest);\n if (claimedDigest !== computedDigest || versionDigest !== claimedDigest) {\n throw new SurveyAssistantCapabilityMismatchError();\n }\n\n if (trustedCapabilities && trustedCapabilities.manifest.digest !== claimedDigest) {\n throw new SurveyAssistantCapabilityMismatchError(\n \"The editor and server use different survey assistant capabilities; refresh and retry.\",\n );\n }\n};\n"],"mappings":";;;AAqCA,MAAa,uCAAuC,EAClD,cACA,UACA,YAMA,cAAc,WACX,IAAI,SAAS,EACZ,YAAY,MAAM,cAAc,UAAU,UAAU,MAAM;AAEhE,MAAa,wBAAwB,EACnC,cACA,WAKA,cAAc,WAAW,IAAI,KAAK,SAAS,EAAE,cAAc,KAAK;AAUlE,MAAa,qCACX,iBACiC;CACjC,MAAM,6BAAa,IAAI,KAA6C;AAEpE,MAAK,MAAM,cAAc,cAAc;EACrC,MAAM,WAAW,gCAAgC,MAAM,WAAW,SAAS;EAC3E,MAAM,WAAW,SAAS;AAC1B,MAAI,WAAW,IAAI,SAAS,CAC1B,OAAM,IAAI,MAAM,wDAAwD,SAAS,IAAI;AAEvF,MACE,SAAS,WAAW,mBACpB,CAAC,SAAS,oBAAoB,SAAS,cAAc,CAErD,OAAM,IAAI,MACR,0CAA0C,SAAS,+BACpD;EAEH,MAAM,0BAA0B,IAAI,IAAI,SAAS,mBAAmB,EAAE,CAAC;AACvE,OAAK,MAAM,aAAa,WAAW,cAAc,EAAE,CACjD,KAAI,CAAC,wBAAwB,IAAI,UAAU,MAAM,CAC/C,OAAM,IAAI,MACR,yBAAyB,UAAU,MAAM,mBAAmB,SAAS,6CACtE;AAGL,aAAW,IAAI,UAAU,WAAW;;CAMtC,MAAM,wBAAwB,EAAE,WAHd,MAAM,KAAK,WAAW,QAAQ,CAAC,CAC9C,KAAK,eAAe,WAAW,SAAS,CACxC,MAAM,MAAM,UAAU,KAAK,SAAS,cAAc,MAAM,SAAS,CAC3B,EAAE;AAE3C,QAAO;EACL,UAAU;GACR,GAAG;GACH,QAAQ,sBAAsB,sBAAsB;GACrD;EACD;EACD;;AAGH,MAAa,mCACX,aAEA,SAAS,UACN,QAAQ,UAAU,MAAM,WAAW,gBAAgB,CACnD,KAAK,UAAU,MAAM,SAAS;AAEnC,MAAa,gCAAgC,EAC3C,UACA,UACA,mBAKqC;CACrC,MAAM,aAAa,SAAS,UAAU,MAAM,UAAU,MAAM,aAAa,SAAS;AAClF,KAAI,YAAY,WAAW,gBACzB,QAAO,EAAE,MAAM,iBAAiB;AAElC,KAAI,YAAY,WAAW,mBACzB,QAAO;EACL,MAAM;EACN,QAAQ;GAAE,MAAM;GAAoB;GAAU;GAAc;EAC7D;AAEH,QAAO;EACL,MAAM;EACN,QAAQ,aACJ,cAAc,SAAS,0CACvB,cAAc,SAAS;EAC5B;;AAGH,MAAa,mCAAmC,EAC9C,aACA,gBAIqC,EACrC,UAAU;CACR;CACA,mBAAmB;CACnB;CACA,QAAQ;CACR,qBAAqB,EAAE;CACvB,iBAAiB,EAAE;CACpB,EACF;AAED,IAAa,yCAAb,cAA4D,MAAM;CAChE,OAAgB;CAEhB,YAAY,UAAU,wEAAwE;AAC5F,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,MAAa,qCAAqC,EAChD,UACA,qBACA,oBAKU;CACV,MAAM,EAAE,QAAQ,eAAe,GAAG,0BAA0B;AAE5D,KAAI,kBADmB,sBAAsB,sBACT,IAAI,kBAAkB,cACxD,OAAM,IAAI,wCAAwC;AAGpD,KAAI,uBAAuB,oBAAoB,SAAS,WAAW,cACjE,OAAM,IAAI,uCACR,wFACD"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/protocol/capabilities.d.ts
|
|
4
|
+
declare const assistantItemCreateModeSchema: z.ZodEnum<{
|
|
5
|
+
deterministic: "deterministic";
|
|
6
|
+
"interactive-only": "interactive-only";
|
|
7
|
+
unsupported: "unsupported";
|
|
8
|
+
}>;
|
|
9
|
+
declare const assistantContentSurfaceSchema: z.ZodObject<{
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
role: z.ZodEnum<{
|
|
12
|
+
validation: "validation";
|
|
13
|
+
primary: "primary";
|
|
14
|
+
secondary: "secondary";
|
|
15
|
+
option: "option";
|
|
16
|
+
field: "field";
|
|
17
|
+
}>;
|
|
18
|
+
format: z.ZodEnum<{
|
|
19
|
+
plain: "plain";
|
|
20
|
+
rich: "rich";
|
|
21
|
+
}>;
|
|
22
|
+
requiredOnCreate: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
pattern: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
declare const assistantResponseSlotSchema: z.ZodObject<{
|
|
27
|
+
key: z.ZodString;
|
|
28
|
+
valueType: z.ZodString;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
declare const assistantItemAuthoringSchema: z.ZodObject<{
|
|
31
|
+
configSummary: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const assistantItemTypeManifestSchema: z.ZodObject<{
|
|
34
|
+
itemType: z.ZodString;
|
|
35
|
+
capabilityVersion: z.ZodString;
|
|
36
|
+
displayName: z.ZodString;
|
|
37
|
+
description: z.ZodOptional<z.ZodString>;
|
|
38
|
+
defaultItemKeyPrefix: z.ZodOptional<z.ZodString>;
|
|
39
|
+
create: z.ZodEnum<{
|
|
40
|
+
deterministic: "deterministic";
|
|
41
|
+
"interactive-only": "interactive-only";
|
|
42
|
+
unsupported: "unsupported";
|
|
43
|
+
}>;
|
|
44
|
+
supportedOperations: z.ZodArray<z.ZodEnum<{
|
|
45
|
+
"create-item": "create-item";
|
|
46
|
+
"update-item-key": "update-item-key";
|
|
47
|
+
"update-item-label": "update-item-label";
|
|
48
|
+
"update-item-color": "update-item-color";
|
|
49
|
+
"update-item-translation": "update-item-translation";
|
|
50
|
+
"update-placed-image": "update-placed-image";
|
|
51
|
+
"patch-item-config": "patch-item-config";
|
|
52
|
+
"upsert-form-field-group": "upsert-form-field-group";
|
|
53
|
+
"remove-form-field-group": "remove-form-field-group";
|
|
54
|
+
"reorder-form-field-groups": "reorder-form-field-groups";
|
|
55
|
+
"upsert-form-field": "upsert-form-field";
|
|
56
|
+
"remove-form-field": "remove-form-field";
|
|
57
|
+
"move-form-field": "move-form-field";
|
|
58
|
+
"set-embedded-form": "set-embedded-form";
|
|
59
|
+
"remove-embedded-form": "remove-embedded-form";
|
|
60
|
+
"add-choice-option": "add-choice-option";
|
|
61
|
+
"update-choice-option-label": "update-choice-option-label";
|
|
62
|
+
"remove-choice-option": "remove-choice-option";
|
|
63
|
+
"reorder-choice-options": "reorder-choice-options";
|
|
64
|
+
"remove-item": "remove-item";
|
|
65
|
+
"move-item": "move-item";
|
|
66
|
+
"reorder-items": "reorder-items";
|
|
67
|
+
"update-survey-metadata": "update-survey-metadata";
|
|
68
|
+
"update-survey-pagination": "update-survey-pagination";
|
|
69
|
+
"update-survey-translation": "update-survey-translation";
|
|
70
|
+
"remove-survey-locale": "remove-survey-locale";
|
|
71
|
+
"set-image-asset": "set-image-asset";
|
|
72
|
+
"update-image-asset-metadata": "update-image-asset-metadata";
|
|
73
|
+
"remove-image-asset": "remove-image-asset";
|
|
74
|
+
"survey-json-patch": "survey-json-patch";
|
|
75
|
+
}>>;
|
|
76
|
+
contentSurfaces: z.ZodArray<z.ZodObject<{
|
|
77
|
+
key: z.ZodString;
|
|
78
|
+
role: z.ZodEnum<{
|
|
79
|
+
validation: "validation";
|
|
80
|
+
primary: "primary";
|
|
81
|
+
secondary: "secondary";
|
|
82
|
+
option: "option";
|
|
83
|
+
field: "field";
|
|
84
|
+
}>;
|
|
85
|
+
format: z.ZodEnum<{
|
|
86
|
+
plain: "plain";
|
|
87
|
+
rich: "rich";
|
|
88
|
+
}>;
|
|
89
|
+
requiredOnCreate: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
pattern: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
responseSlots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
key: z.ZodString;
|
|
95
|
+
valueType: z.ZodString;
|
|
96
|
+
}, z.core.$strip>>>;
|
|
97
|
+
referenceTopics: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
|
+
authoring: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
configSummary: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
declare const surveyAssistantCapabilityManifestSchema: z.ZodObject<{
|
|
103
|
+
digest: z.ZodString;
|
|
104
|
+
itemTypes: z.ZodArray<z.ZodObject<{
|
|
105
|
+
itemType: z.ZodString;
|
|
106
|
+
capabilityVersion: z.ZodString;
|
|
107
|
+
displayName: z.ZodString;
|
|
108
|
+
description: z.ZodOptional<z.ZodString>;
|
|
109
|
+
defaultItemKeyPrefix: z.ZodOptional<z.ZodString>;
|
|
110
|
+
create: z.ZodEnum<{
|
|
111
|
+
deterministic: "deterministic";
|
|
112
|
+
"interactive-only": "interactive-only";
|
|
113
|
+
unsupported: "unsupported";
|
|
114
|
+
}>;
|
|
115
|
+
supportedOperations: z.ZodArray<z.ZodEnum<{
|
|
116
|
+
"create-item": "create-item";
|
|
117
|
+
"update-item-key": "update-item-key";
|
|
118
|
+
"update-item-label": "update-item-label";
|
|
119
|
+
"update-item-color": "update-item-color";
|
|
120
|
+
"update-item-translation": "update-item-translation";
|
|
121
|
+
"update-placed-image": "update-placed-image";
|
|
122
|
+
"patch-item-config": "patch-item-config";
|
|
123
|
+
"upsert-form-field-group": "upsert-form-field-group";
|
|
124
|
+
"remove-form-field-group": "remove-form-field-group";
|
|
125
|
+
"reorder-form-field-groups": "reorder-form-field-groups";
|
|
126
|
+
"upsert-form-field": "upsert-form-field";
|
|
127
|
+
"remove-form-field": "remove-form-field";
|
|
128
|
+
"move-form-field": "move-form-field";
|
|
129
|
+
"set-embedded-form": "set-embedded-form";
|
|
130
|
+
"remove-embedded-form": "remove-embedded-form";
|
|
131
|
+
"add-choice-option": "add-choice-option";
|
|
132
|
+
"update-choice-option-label": "update-choice-option-label";
|
|
133
|
+
"remove-choice-option": "remove-choice-option";
|
|
134
|
+
"reorder-choice-options": "reorder-choice-options";
|
|
135
|
+
"remove-item": "remove-item";
|
|
136
|
+
"move-item": "move-item";
|
|
137
|
+
"reorder-items": "reorder-items";
|
|
138
|
+
"update-survey-metadata": "update-survey-metadata";
|
|
139
|
+
"update-survey-pagination": "update-survey-pagination";
|
|
140
|
+
"update-survey-translation": "update-survey-translation";
|
|
141
|
+
"remove-survey-locale": "remove-survey-locale";
|
|
142
|
+
"set-image-asset": "set-image-asset";
|
|
143
|
+
"update-image-asset-metadata": "update-image-asset-metadata";
|
|
144
|
+
"remove-image-asset": "remove-image-asset";
|
|
145
|
+
"survey-json-patch": "survey-json-patch";
|
|
146
|
+
}>>;
|
|
147
|
+
contentSurfaces: z.ZodArray<z.ZodObject<{
|
|
148
|
+
key: z.ZodString;
|
|
149
|
+
role: z.ZodEnum<{
|
|
150
|
+
validation: "validation";
|
|
151
|
+
primary: "primary";
|
|
152
|
+
secondary: "secondary";
|
|
153
|
+
option: "option";
|
|
154
|
+
field: "field";
|
|
155
|
+
}>;
|
|
156
|
+
format: z.ZodEnum<{
|
|
157
|
+
plain: "plain";
|
|
158
|
+
rich: "rich";
|
|
159
|
+
}>;
|
|
160
|
+
requiredOnCreate: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
pattern: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
responseSlots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
165
|
+
key: z.ZodString;
|
|
166
|
+
valueType: z.ZodString;
|
|
167
|
+
}, z.core.$strip>>>;
|
|
168
|
+
referenceTopics: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
169
|
+
authoring: z.ZodOptional<z.ZodObject<{
|
|
170
|
+
configSummary: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
}, z.core.$strip>;
|
|
174
|
+
type AssistantItemCreateMode = z.infer<typeof assistantItemCreateModeSchema>;
|
|
175
|
+
type AssistantContentSurface = z.infer<typeof assistantContentSurfaceSchema>;
|
|
176
|
+
type AssistantResponseSlot = z.infer<typeof assistantResponseSlotSchema>;
|
|
177
|
+
type AssistantItemAuthoring = z.infer<typeof assistantItemAuthoringSchema>;
|
|
178
|
+
type AssistantItemTypeManifest = z.infer<typeof assistantItemTypeManifestSchema>;
|
|
179
|
+
type SurveyAssistantCapabilityManifest = z.infer<typeof surveyAssistantCapabilityManifestSchema>;
|
|
180
|
+
//#endregion
|
|
181
|
+
export { AssistantResponseSlot as a, assistantItemAuthoringSchema as c, assistantResponseSlotSchema as d, surveyAssistantCapabilityManifestSchema as f, AssistantItemTypeManifest as i, assistantItemCreateModeSchema as l, AssistantItemAuthoring as n, SurveyAssistantCapabilityManifest as o, AssistantItemCreateMode as r, assistantContentSurfaceSchema as s, AssistantContentSurface as t, assistantItemTypeManifestSchema as u };
|
|
182
|
+
//# sourceMappingURL=capabilities-DvSKtjAw.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-DvSKtjAw.d.mts","names":[],"sources":["../src/protocol/capabilities.ts"],"mappings":";;;cAGa,6BAAA,EAA6B,CAAA,CAAA,OAAA;;;;;cAM7B,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;cAS7B,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;cAK3B,4BAAA,EAA4B,CAAA,CAAA,SAAA;;;cAI5B,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAc/B,uCAAA,EAAuC,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKxC,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,KACzC,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,KACzC,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,KACvC,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,4BAAA;AAAA,KACxC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAC3C,iCAAA,GAAoC,CAAA,CAAE,KAAA,QACzC,uCAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ft as SurveyAssistantCapabilitySet, jt as AssistantItemCapabilityAdapter } from "./index-CUqbBjkc.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/capabilities/default.d.ts
|
|
4
|
+
declare const rootItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
5
|
+
declare const groupItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
6
|
+
declare const pageBreakItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
7
|
+
declare const infoItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
8
|
+
declare const choiceItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
9
|
+
declare const formItemAssistantCapability: AssistantItemCapabilityAdapter;
|
|
10
|
+
declare const defaultSurveyAssistantCapabilities: readonly [AssistantItemCapabilityAdapter, AssistantItemCapabilityAdapter, AssistantItemCapabilityAdapter, AssistantItemCapabilityAdapter, AssistantItemCapabilityAdapter, AssistantItemCapabilityAdapter];
|
|
11
|
+
declare const defaultSurveyAssistantCapabilitySet: SurveyAssistantCapabilitySet;
|
|
12
|
+
declare const getDefaultSurveyAssistantCapability: (itemType: string) => AssistantItemCapabilityAdapter | undefined;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { choiceItemAssistantCapability, defaultSurveyAssistantCapabilities, defaultSurveyAssistantCapabilitySet, formItemAssistantCapability, getDefaultSurveyAssistantCapability, groupItemAssistantCapability, infoItemAssistantCapability, pageBreakItemAssistantCapability, rootItemAssistantCapability };
|
|
15
|
+
//# sourceMappingURL=capabilities-default.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-default.d.mts","names":[],"sources":["../src/capabilities/default.ts"],"mappings":";;;cAqIa,2BAAA,EAA6B,8BAAA;AAAA,cAY7B,4BAAA,EAA8B,8BAAA;AAAA,cAqB9B,gCAAA,EAAkC,8BAAA;AAAA,cAqBlC,2BAAA,EAA6B,8BAAA;AAAA,cA4B7B,6BAAA,EAA+B,8BAAA;AAAA,cA4E/B,2BAAA,EAA6B,8BAAA;AAAA,cAuD7B,kCAAA,YAAkC,8BAAA,EAAA,8BAAA,EAAA,8BAAA,EAAA,8BAAA,EAAA,8BAAA,EAAA,8BAAA;AAAA,cASlC,mCAAA,EAEZ,4BAAA;AAAA,cAEY,mCAAA,GACX,QAAA,aACC,8BAAA"}
|