@case-framework/survey-assistant 0.7.0 → 0.8.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 +58 -3
- package/dist/{attachments-B0hg3vpT.mjs → attachments-BuNni5vB.mjs} +1 -1
- package/dist/{attachments-B0hg3vpT.mjs.map → attachments-BuNni5vB.mjs.map} +1 -1
- package/dist/{authoring-references-BJQ_1nMX.mjs → authoring-references-DbuOKerg.mjs} +12 -3
- package/dist/authoring-references-DbuOKerg.mjs.map +1 -0
- package/dist/{capabilities-DVTfogjv.d.mts → capabilities-CmeeAjEc.d.mts} +3 -4
- package/dist/capabilities-CmeeAjEc.d.mts.map +1 -0
- package/dist/{capabilities-1KNnNO1_.mjs → capabilities-DCMA71PP.mjs} +4 -19
- package/dist/capabilities-DCMA71PP.mjs.map +1 -0
- package/dist/capabilities-default.d.mts +13 -12
- package/dist/capabilities-default.d.mts.map +1 -1
- package/dist/capabilities-default.mjs +2 -411
- package/dist/{constants-Be91Gay9.d.mts → constants-B6HzpEsx.d.mts} +7 -28
- package/dist/constants-B6HzpEsx.d.mts.map +1 -0
- package/dist/{constants-0UHGFcRJ.mjs → constants-Ct-vv9cu.mjs} +1 -1
- package/dist/{constants-0UHGFcRJ.mjs.map → constants-Ct-vv9cu.mjs.map} +1 -1
- package/dist/controller-proxy-D7uQfm5f.d.mts +65 -0
- package/dist/controller-proxy-D7uQfm5f.d.mts.map +1 -0
- package/dist/{controller-proxy-BH05e-C2.mjs → controller-proxy-DEeFl9IA.mjs} +10 -20
- package/dist/controller-proxy-DEeFl9IA.mjs.map +1 -0
- package/dist/default-fhSon2RM.mjs +760 -0
- package/dist/default-fhSon2RM.mjs.map +1 -0
- package/dist/{digest-SJmoYVaK.d.mts → digest-C39WyAWG.d.mts} +2 -3
- package/dist/digest-C39WyAWG.d.mts.map +1 -0
- package/dist/digest.d.mts +1 -1
- package/dist/digest.mjs.map +1 -1
- package/dist/{engine-Bo85Oyj0.mjs → engine-nXoCWYpQ.mjs} +755 -590
- package/dist/engine-nXoCWYpQ.mjs.map +1 -0
- package/dist/engine.d.mts +3 -3
- package/dist/engine.mjs +3 -3
- package/dist/{fair-guidance-CRYCRxQm.mjs → fair-guidance-BmO4PswW.mjs} +1 -1
- package/dist/{fair-guidance-CRYCRxQm.mjs.map → fair-guidance-BmO4PswW.mjs.map} +1 -1
- package/dist/{index-Tnqv-yKW.d.mts → index-Ciq7vHIs.d.mts} +80 -141
- package/dist/index-Ciq7vHIs.d.mts.map +1 -0
- package/dist/{index-nhrgbgO5.d.mts → index-D7wT6P3t.d.mts} +277 -60
- package/dist/index-D7wT6P3t.d.mts.map +1 -0
- package/dist/{index-l_EK4yK7.d.mts → index-WB5kfnz0.d.mts} +15 -71
- package/dist/index-WB5kfnz0.d.mts.map +1 -0
- package/dist/{index-x0qprHgK.d.mts → index-r5riv4md.d.mts} +33 -24
- package/dist/index-r5riv4md.d.mts.map +1 -0
- package/dist/{lifecycle-Bx0aq_4S.d.mts → lifecycle-Dm8u7QFh.d.mts} +34 -18
- package/dist/lifecycle-Dm8u7QFh.d.mts.map +1 -0
- package/dist/{memory-thread-repository-KWHQWFEW.mjs → memory-thread-repository-DAnOGIB3.mjs} +51 -27
- package/dist/memory-thread-repository-DAnOGIB3.mjs.map +1 -0
- package/dist/{protocol-BhzQbx81.mjs → protocol-CF4Bh_Ch.mjs} +118 -36
- package/dist/protocol-CF4Bh_Ch.mjs.map +1 -0
- package/dist/protocol.d.mts +4 -4
- package/dist/protocol.mjs +3 -3
- package/dist/{react-B3ybjJ-X.mjs → react-C_GY-Fsc.mjs} +146 -39
- package/dist/react-C_GY-Fsc.mjs.map +1 -0
- package/dist/react-integration.d.mts +2 -2
- package/dist/react-integration.mjs +2 -2
- package/dist/react.d.mts +3 -3
- package/dist/react.mjs +3 -3
- package/dist/references/assistant-operations.md +100 -31
- package/dist/references/core-rules.md +6 -3
- package/dist/references/embedded-forms.md +34 -14
- package/dist/references/expressions.md +220 -58
- package/dist/references/fair-by-design.md +9 -9
- package/dist/references/item-types.md +305 -71
- package/dist/references/response-variables.md +38 -0
- package/dist/references/source-material-surveys.md +4 -3
- package/dist/references/survey-data-model.md +23 -8
- package/dist/{request-context-CG4SWijt.mjs → request-context-Dg4jSwN1.mjs} +4 -10
- package/dist/request-context-Dg4jSwN1.mjs.map +1 -0
- package/dist/{request-guardrails-TmgQtqp4.mjs → request-guardrails-C0ugBOp0.mjs} +6 -5
- package/dist/request-guardrails-C0ugBOp0.mjs.map +1 -0
- package/dist/server-agent.d.mts +37 -39
- package/dist/server-agent.d.mts.map +1 -1
- package/dist/server-agent.mjs +45 -20
- package/dist/server-agent.mjs.map +1 -1
- package/dist/server-runtime.d.mts +23 -42
- package/dist/server-runtime.d.mts.map +1 -1
- package/dist/server-runtime.mjs +12 -12
- package/dist/server-runtime.mjs.map +1 -1
- package/dist/server-tasks.d.mts +2 -2
- package/dist/server-tasks.mjs +2 -313
- package/dist/server-tools.d.mts +1 -1
- package/dist/server-tools.mjs +1 -1
- package/dist/server.d.mts +13 -36
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +5 -5
- package/dist/server.mjs.map +1 -1
- package/dist/storage-postgres.d.mts +9 -25
- package/dist/storage-postgres.d.mts.map +1 -1
- package/dist/storage-postgres.mjs +5 -4
- package/dist/storage-postgres.mjs.map +1 -1
- package/dist/{tasks-CYqrcaRO.d.mts → tasks-B9h3LPam.d.mts} +18 -34
- package/dist/tasks-B9h3LPam.d.mts.map +1 -0
- package/dist/tasks-BZEiwgxA.mjs +396 -0
- package/dist/tasks-BZEiwgxA.mjs.map +1 -0
- package/dist/thread-documents-DrHbaXqP.d.mts +119 -0
- package/dist/thread-documents-DrHbaXqP.d.mts.map +1 -0
- package/dist/{thread-handlers-DBAaU7BA.d.mts → thread-handlers-Bef0td9N.d.mts} +8 -40
- package/dist/thread-handlers-Bef0td9N.d.mts.map +1 -0
- package/dist/{tools-BvSovehT.mjs → tools-CEsv-WoO.mjs} +296 -105
- package/dist/tools-CEsv-WoO.mjs.map +1 -0
- package/dist/ui.css +1 -1
- package/dist/ui.d.mts +15 -54
- package/dist/ui.d.mts.map +1 -1
- package/dist/ui.mjs +172 -137
- package/dist/ui.mjs.map +1 -1
- package/docs/integration.md +11 -1
- package/package.json +40 -35
- package/dist/authoring-references-BJQ_1nMX.mjs.map +0 -1
- package/dist/capabilities-1KNnNO1_.mjs.map +0 -1
- package/dist/capabilities-DVTfogjv.d.mts.map +0 -1
- package/dist/capabilities-default.mjs.map +0 -1
- package/dist/constants-Be91Gay9.d.mts.map +0 -1
- package/dist/controller-proxy-BH05e-C2.mjs.map +0 -1
- package/dist/controller-proxy-Bd0ZHBPF.d.mts +0 -85
- package/dist/controller-proxy-Bd0ZHBPF.d.mts.map +0 -1
- package/dist/digest-SJmoYVaK.d.mts.map +0 -1
- package/dist/engine-Bo85Oyj0.mjs.map +0 -1
- package/dist/index-Tnqv-yKW.d.mts.map +0 -1
- package/dist/index-l_EK4yK7.d.mts.map +0 -1
- package/dist/index-nhrgbgO5.d.mts.map +0 -1
- package/dist/index-x0qprHgK.d.mts.map +0 -1
- package/dist/lifecycle-Bx0aq_4S.d.mts.map +0 -1
- package/dist/memory-thread-repository-KWHQWFEW.mjs.map +0 -1
- package/dist/protocol-BhzQbx81.mjs.map +0 -1
- package/dist/react-B3ybjJ-X.mjs.map +0 -1
- package/dist/request-context-CG4SWijt.mjs.map +0 -1
- package/dist/request-guardrails-TmgQtqp4.mjs.map +0 -1
- package/dist/server-tasks.mjs.map +0 -1
- package/dist/tasks-CYqrcaRO.d.mts.map +0 -1
- package/dist/thread-documents-rmd6nyX9.d.mts +0 -107
- package/dist/thread-documents-rmd6nyX9.d.mts.map +0 -1
- package/dist/thread-handlers-DBAaU7BA.d.mts.map +0 -1
- package/dist/tools-BvSovehT.mjs.map +0 -1
|
@@ -1,411 +1,2 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
|
|
3
|
-
import { createChoiceItemConfig, getChoiceOptionEmbeddedFormResponseSlotPrefix, getChoiceResponseValueType } from "@case-framework/survey-items/choice";
|
|
4
|
-
//#region src/capabilities/default.ts
|
|
5
|
-
const COMMON_OPERATIONS = [
|
|
6
|
-
"create-item",
|
|
7
|
-
"update-item-key",
|
|
8
|
-
"update-item-label",
|
|
9
|
-
"update-item-color",
|
|
10
|
-
"update-item-translation",
|
|
11
|
-
"update-placed-image",
|
|
12
|
-
"patch-item-config",
|
|
13
|
-
"remove-item",
|
|
14
|
-
"move-item",
|
|
15
|
-
"survey-json-patch"
|
|
16
|
-
];
|
|
17
|
-
const QUESTION_CONTENT_SURFACES = [
|
|
18
|
-
{
|
|
19
|
-
key: "title",
|
|
20
|
-
role: "primary",
|
|
21
|
-
format: "rich",
|
|
22
|
-
requiredOnCreate: true,
|
|
23
|
-
aliases: [
|
|
24
|
-
"content",
|
|
25
|
-
"label",
|
|
26
|
-
"prompt",
|
|
27
|
-
"question",
|
|
28
|
-
"text"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
key: "subtitle",
|
|
33
|
-
role: "secondary",
|
|
34
|
-
format: "rich",
|
|
35
|
-
aliases: ["subheading", "subtext"]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: "topContent",
|
|
39
|
-
role: "secondary",
|
|
40
|
-
format: "rich",
|
|
41
|
-
aliases: ["preContent", "preResponse"]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
key: "bottomContent",
|
|
45
|
-
role: "secondary",
|
|
46
|
-
format: "rich",
|
|
47
|
-
aliases: ["postContent", "postResponse"]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
key: "cardFooter",
|
|
51
|
-
role: "secondary",
|
|
52
|
-
format: "rich",
|
|
53
|
-
aliases: ["footer"]
|
|
54
|
-
}
|
|
55
|
-
];
|
|
56
|
-
const FIELD_CONTENT_SURFACES = [
|
|
57
|
-
"label",
|
|
58
|
-
"description",
|
|
59
|
-
"error",
|
|
60
|
-
"placeholder",
|
|
61
|
-
"unit",
|
|
62
|
-
"checkedLabel",
|
|
63
|
-
"uncheckedLabel"
|
|
64
|
-
].map((key) => ({
|
|
65
|
-
key: `fields.<fieldId>.${key}`,
|
|
66
|
-
role: key === "error" ? "validation" : "field",
|
|
67
|
-
format: "rich",
|
|
68
|
-
pattern: true
|
|
69
|
-
}));
|
|
70
|
-
const createManifest = (manifest) => ({
|
|
71
|
-
capabilityVersion: "1",
|
|
72
|
-
...manifest
|
|
73
|
-
});
|
|
74
|
-
const STRUCTURE_REFERENCE = {
|
|
75
|
-
topic: "item-types",
|
|
76
|
-
markdown: "Groups are containers. Create a group without child ids, then create or move children through separate operations. Page breaks are standalone structural boundaries."
|
|
77
|
-
};
|
|
78
|
-
const QUESTION_REFERENCE = {
|
|
79
|
-
topic: "item-types",
|
|
80
|
-
markdown: "Question titles and supporting text are translations. Configuration stores response behavior; respondent-visible option and field labels use the declared dynamic content surfaces."
|
|
81
|
-
};
|
|
82
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
|
-
const withMaterializedConfig = (item, defaults) => ({
|
|
84
|
-
...item,
|
|
85
|
-
config: {
|
|
86
|
-
...defaults,
|
|
87
|
-
...isRecord(item.config) ? item.config : {}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
const materializeGroupCreate = (item) => withMaterializedConfig(item, {
|
|
91
|
-
items: [],
|
|
92
|
-
shuffleItems: false
|
|
93
|
-
});
|
|
94
|
-
const materializeEmptyConfigCreate = (item) => withMaterializedConfig(item, {});
|
|
95
|
-
const materializeChoiceCreate = (item) => {
|
|
96
|
-
const config = isRecord(item.config) ? item.config : {};
|
|
97
|
-
const defaults = createChoiceItemConfig(item.id);
|
|
98
|
-
return normalizeEmbeddedFormAuthoringModes({
|
|
99
|
-
...item,
|
|
100
|
-
config: {
|
|
101
|
-
...defaults,
|
|
102
|
-
...config,
|
|
103
|
-
id: item.id,
|
|
104
|
-
maxSelection: "maxSelection" in config ? config.maxSelection : defaults.maxSelection,
|
|
105
|
-
shuffleOptions: "shuffleOptions" in config ? config.shuffleOptions : defaults.shuffleOptions,
|
|
106
|
-
options: Array.isArray(config.options) ? config.options : defaults.options
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
const materializeFormCreate = (item) => ({
|
|
111
|
-
...item,
|
|
112
|
-
config: normalizeFormAuthoringConfig({
|
|
113
|
-
...createFormItemConfig(item.id),
|
|
114
|
-
...isRecord(item.config) ? item.config : {},
|
|
115
|
-
id: item.id
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
const deriveFormResponseSlots = (config, prefix) => {
|
|
119
|
-
if (!isRecord(config) || !Array.isArray(config.fieldGroups)) return {};
|
|
120
|
-
const slots = {};
|
|
121
|
-
for (const group of config.fieldGroups.filter(isRecord)) {
|
|
122
|
-
if (!Array.isArray(group.fields)) continue;
|
|
123
|
-
for (const field of group.fields.filter(isRecord)) {
|
|
124
|
-
if (typeof field.key !== "string" || field.key.length === 0) continue;
|
|
125
|
-
slots[prefix ? `${prefix}.${field.key}` : field.key] = getFormFieldValueType(field);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return slots;
|
|
129
|
-
};
|
|
130
|
-
const deriveChoiceResponseSlots = (item) => {
|
|
131
|
-
const config = isRecord(item.config) ? item.config : {};
|
|
132
|
-
const slots = { [typeof config.id === "string" && config.id.length > 0 ? config.id : item.id]: getChoiceResponseValueType(config.maxSelection === 1 ? 1 : null) };
|
|
133
|
-
if (Array.isArray(config.options)) for (const option of config.options.filter(isRecord)) {
|
|
134
|
-
if (typeof option.id !== "string" || !option.embeddedForm) continue;
|
|
135
|
-
Object.assign(slots, deriveFormResponseSlots(option.embeddedForm, getChoiceOptionEmbeddedFormResponseSlotPrefix(option.id)));
|
|
136
|
-
}
|
|
137
|
-
return slots;
|
|
138
|
-
};
|
|
139
|
-
const normalizeEmbeddedFormAuthoringModes = (item) => {
|
|
140
|
-
if (!isRecord(item.config) || !Array.isArray(item.config.options)) return item;
|
|
141
|
-
return {
|
|
142
|
-
...item,
|
|
143
|
-
config: {
|
|
144
|
-
...item.config,
|
|
145
|
-
options: item.config.options.map((option) => {
|
|
146
|
-
if (!isRecord(option) || !isRecord(option.embeddedForm)) return option;
|
|
147
|
-
return {
|
|
148
|
-
...option,
|
|
149
|
-
embeddedForm: normalizeFormAuthoringConfig(option.embeddedForm)
|
|
150
|
-
};
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
const getSimpleFormValidationIssues = (config, subject) => isValidSimpleFormConfig(config) ? [] : [{
|
|
156
|
-
severity: "error",
|
|
157
|
-
code: "invalid-simple-form-structure",
|
|
158
|
-
message: `${subject} with authoringMode "simple" must contain one single-column field group without group display behavior and exactly one supported field whose controller type matches the field type. Use authoringMode "custom" for any other structure.`
|
|
159
|
-
}];
|
|
160
|
-
const rootItemAssistantCapability = { manifest: createManifest({
|
|
161
|
-
itemType: "root",
|
|
162
|
-
displayName: "Survey root",
|
|
163
|
-
description: "The existing root container. A second root cannot be created.",
|
|
164
|
-
create: "unsupported",
|
|
165
|
-
supportedOperations: [
|
|
166
|
-
"update-item-key",
|
|
167
|
-
"update-item-label",
|
|
168
|
-
"update-item-color"
|
|
169
|
-
],
|
|
170
|
-
contentSurfaces: [],
|
|
171
|
-
referenceTopics: ["survey-data-model", "item-types"]
|
|
172
|
-
}) };
|
|
173
|
-
const groupItemAssistantCapability = {
|
|
174
|
-
manifest: createManifest({
|
|
175
|
-
itemType: "group",
|
|
176
|
-
displayName: "Group",
|
|
177
|
-
description: "A structural container whose children are created as separate items.",
|
|
178
|
-
defaultItemKeyPrefix: "group",
|
|
179
|
-
create: "deterministic",
|
|
180
|
-
supportedOperations: [...COMMON_OPERATIONS, "reorder-items"],
|
|
181
|
-
contentSurfaces: [{
|
|
182
|
-
key: "title",
|
|
183
|
-
role: "primary",
|
|
184
|
-
format: "rich",
|
|
185
|
-
aliases: [
|
|
186
|
-
"content",
|
|
187
|
-
"label",
|
|
188
|
-
"name",
|
|
189
|
-
"text"
|
|
190
|
-
]
|
|
191
|
-
}],
|
|
192
|
-
referenceTopics: ["survey-data-model", "item-types"]
|
|
193
|
-
}),
|
|
194
|
-
references: [STRUCTURE_REFERENCE],
|
|
195
|
-
normalizeCreate: materializeGroupCreate
|
|
196
|
-
};
|
|
197
|
-
const pageBreakItemAssistantCapability = {
|
|
198
|
-
manifest: createManifest({
|
|
199
|
-
itemType: "page-break",
|
|
200
|
-
displayName: "Page break",
|
|
201
|
-
description: "A structural page boundary.",
|
|
202
|
-
defaultItemKeyPrefix: "page",
|
|
203
|
-
create: "deterministic",
|
|
204
|
-
supportedOperations: COMMON_OPERATIONS,
|
|
205
|
-
contentSurfaces: [{
|
|
206
|
-
key: "title",
|
|
207
|
-
role: "primary",
|
|
208
|
-
format: "rich",
|
|
209
|
-
aliases: [
|
|
210
|
-
"content",
|
|
211
|
-
"label",
|
|
212
|
-
"name",
|
|
213
|
-
"text"
|
|
214
|
-
]
|
|
215
|
-
}],
|
|
216
|
-
referenceTopics: ["survey-data-model", "item-types"]
|
|
217
|
-
}),
|
|
218
|
-
references: [STRUCTURE_REFERENCE],
|
|
219
|
-
normalizeCreate: materializeEmptyConfigCreate
|
|
220
|
-
};
|
|
221
|
-
const infoItemAssistantCapability = {
|
|
222
|
-
manifest: createManifest({
|
|
223
|
-
itemType: "infoItem",
|
|
224
|
-
displayName: "Info",
|
|
225
|
-
description: "Display-only formatted content without a response slot.",
|
|
226
|
-
defaultItemKeyPrefix: "info",
|
|
227
|
-
create: "deterministic",
|
|
228
|
-
supportedOperations: COMMON_OPERATIONS,
|
|
229
|
-
contentSurfaces: [{
|
|
230
|
-
key: "content",
|
|
231
|
-
role: "primary",
|
|
232
|
-
format: "rich",
|
|
233
|
-
requiredOnCreate: true,
|
|
234
|
-
aliases: [
|
|
235
|
-
"body",
|
|
236
|
-
"label",
|
|
237
|
-
"prompt",
|
|
238
|
-
"question",
|
|
239
|
-
"text",
|
|
240
|
-
"title"
|
|
241
|
-
]
|
|
242
|
-
}],
|
|
243
|
-
referenceTopics: ["item-types", "rich-text-content"]
|
|
244
|
-
}),
|
|
245
|
-
references: [{
|
|
246
|
-
topic: "rich-text-content",
|
|
247
|
-
markdown: "Info content uses the rich `content` surface. Markdown strings are not parsed; send structured rich text when formatting matters."
|
|
248
|
-
}],
|
|
249
|
-
normalizeCreate: materializeEmptyConfigCreate
|
|
250
|
-
};
|
|
251
|
-
const choiceItemAssistantCapability = {
|
|
252
|
-
manifest: createManifest({
|
|
253
|
-
itemType: "choiceItem",
|
|
254
|
-
displayName: "Choice question",
|
|
255
|
-
description: "A single- or multiple-choice question with optional embedded forms.",
|
|
256
|
-
defaultItemKeyPrefix: "choice",
|
|
257
|
-
create: "deterministic",
|
|
258
|
-
supportedOperations: [
|
|
259
|
-
...COMMON_OPERATIONS,
|
|
260
|
-
"add-choice-option",
|
|
261
|
-
"update-choice-option-label",
|
|
262
|
-
"remove-choice-option",
|
|
263
|
-
"reorder-choice-options",
|
|
264
|
-
"upsert-form-field-group",
|
|
265
|
-
"remove-form-field-group",
|
|
266
|
-
"reorder-form-field-groups",
|
|
267
|
-
"upsert-form-field",
|
|
268
|
-
"remove-form-field",
|
|
269
|
-
"move-form-field",
|
|
270
|
-
"set-embedded-form",
|
|
271
|
-
"remove-embedded-form"
|
|
272
|
-
],
|
|
273
|
-
contentSurfaces: [
|
|
274
|
-
...QUESTION_CONTENT_SURFACES,
|
|
275
|
-
{
|
|
276
|
-
key: "options.<optionId>.label",
|
|
277
|
-
role: "option",
|
|
278
|
-
format: "rich",
|
|
279
|
-
pattern: true
|
|
280
|
-
},
|
|
281
|
-
...FIELD_CONTENT_SURFACES.map((surface) => ({
|
|
282
|
-
...surface,
|
|
283
|
-
key: `embeddedForms.<optionId>.${surface.key}`
|
|
284
|
-
})),
|
|
285
|
-
{
|
|
286
|
-
key: "embeddedForms.<optionId>.fields.<fieldId>.options.<optionId>.label",
|
|
287
|
-
role: "option",
|
|
288
|
-
format: "rich",
|
|
289
|
-
pattern: true
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
key: "embeddedForms.<optionId>.fields.<fieldId>.validations.<validationId>.message",
|
|
293
|
-
role: "validation",
|
|
294
|
-
format: "rich",
|
|
295
|
-
pattern: true
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
key: "embeddedForms.<optionId>.fieldGroups.<groupId>.title",
|
|
299
|
-
role: "field",
|
|
300
|
-
format: "rich",
|
|
301
|
-
pattern: true
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
key: "embeddedForms.<optionId>.fieldGroups.<groupId>.description",
|
|
305
|
-
role: "field",
|
|
306
|
-
format: "rich",
|
|
307
|
-
pattern: true
|
|
308
|
-
}
|
|
309
|
-
],
|
|
310
|
-
responseSlots: [{
|
|
311
|
-
key: "<responseId>",
|
|
312
|
-
valueType: "reference|referenceArray"
|
|
313
|
-
}],
|
|
314
|
-
referenceTopics: [
|
|
315
|
-
"item-types",
|
|
316
|
-
"embedded-forms",
|
|
317
|
-
"localization",
|
|
318
|
-
"expressions",
|
|
319
|
-
"rich-text-content"
|
|
320
|
-
],
|
|
321
|
-
authoring: {
|
|
322
|
-
compactHint: "presets choice.single=maxSelection 1; choice.multiple=maxSelection null; embedded one supported field=simple; embedded blank/structured=custom",
|
|
323
|
-
configSummary: "Config stores id, maxSelection, shuffleOptions, and options. Put every initial option and inline embeddedForm in create-item config; choice option operations edit only choice items already present in the live snapshot. Default an eligible one-field embedded form to authoringMode simple; use custom for blank or structured follow-ups. Embedded field content uses embeddedForms.<choiceOption.id> (case-sensitive), never the option key or embeddedForm id. Form layout values are column counts 1-4; one column makes a lone field full width."
|
|
324
|
-
}
|
|
325
|
-
}),
|
|
326
|
-
references: [QUESTION_REFERENCE],
|
|
327
|
-
normalizeCreate: materializeChoiceCreate,
|
|
328
|
-
validateItem: (item) => {
|
|
329
|
-
if (!isRecord(item.config) || !Array.isArray(item.config.options)) return [];
|
|
330
|
-
return item.config.options.flatMap((option) => isRecord(option) && isRecord(option.embeddedForm) ? getSimpleFormValidationIssues(option.embeddedForm, "An embedded form") : []);
|
|
331
|
-
},
|
|
332
|
-
deriveResponseSlots: deriveChoiceResponseSlots
|
|
333
|
-
};
|
|
334
|
-
const formItemAssistantCapability = {
|
|
335
|
-
manifest: createManifest({
|
|
336
|
-
itemType: "formItem",
|
|
337
|
-
displayName: "Form",
|
|
338
|
-
description: "A form with groups, typed fields, validations, and select options.",
|
|
339
|
-
defaultItemKeyPrefix: "form",
|
|
340
|
-
create: "deterministic",
|
|
341
|
-
supportedOperations: [
|
|
342
|
-
...COMMON_OPERATIONS,
|
|
343
|
-
"upsert-form-field-group",
|
|
344
|
-
"remove-form-field-group",
|
|
345
|
-
"reorder-form-field-groups",
|
|
346
|
-
"upsert-form-field",
|
|
347
|
-
"remove-form-field",
|
|
348
|
-
"move-form-field"
|
|
349
|
-
],
|
|
350
|
-
contentSurfaces: [
|
|
351
|
-
...QUESTION_CONTENT_SURFACES,
|
|
352
|
-
{
|
|
353
|
-
key: "fieldGroups.<groupId>.title",
|
|
354
|
-
role: "field",
|
|
355
|
-
format: "rich",
|
|
356
|
-
pattern: true
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
key: "fieldGroups.<groupId>.description",
|
|
360
|
-
role: "field",
|
|
361
|
-
format: "rich",
|
|
362
|
-
pattern: true
|
|
363
|
-
},
|
|
364
|
-
...FIELD_CONTENT_SURFACES,
|
|
365
|
-
{
|
|
366
|
-
key: "fields.<fieldId>.options.<optionId>.label",
|
|
367
|
-
role: "option",
|
|
368
|
-
format: "rich",
|
|
369
|
-
pattern: true
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
key: "fields.<fieldId>.validations.<validationId>.message",
|
|
373
|
-
role: "validation",
|
|
374
|
-
format: "rich",
|
|
375
|
-
pattern: true
|
|
376
|
-
}
|
|
377
|
-
],
|
|
378
|
-
responseSlots: [{
|
|
379
|
-
key: "<fieldKey>",
|
|
380
|
-
valueType: "field-dependent"
|
|
381
|
-
}],
|
|
382
|
-
referenceTopics: [
|
|
383
|
-
"item-types",
|
|
384
|
-
"localization",
|
|
385
|
-
"expressions",
|
|
386
|
-
"rich-text-content"
|
|
387
|
-
],
|
|
388
|
-
authoring: {
|
|
389
|
-
compactHint: "presets form.text=input|form.long-text=textarea|form.number=number|form.slider=slider|form.dropdown=select|form.date=datepicker|form.switch=switch; form.blank=custom",
|
|
390
|
-
configSummary: "Config stores authoringMode and fieldGroups with typed fields. Use authoringMode \"simple\" only for exactly one internal group with exactly one field: text=input, long text=textarea, number=number, slider=slider, dropdown=select, date=datepicker, switch=switch. Use \"custom\" for blank or multi-field forms. Structural changes are a one-way transition to custom. The controller type must match the field type; full date uses datepicker/year-month-day. Layout values are column counts 1-4, not spans."
|
|
391
|
-
}
|
|
392
|
-
}),
|
|
393
|
-
references: [QUESTION_REFERENCE],
|
|
394
|
-
normalizeCreate: materializeFormCreate,
|
|
395
|
-
validateItem: (item) => getSimpleFormValidationIssues(item.config, "A formItem"),
|
|
396
|
-
deriveResponseSlots: (item) => deriveFormResponseSlots(item.config)
|
|
397
|
-
};
|
|
398
|
-
const defaultSurveyAssistantCapabilities = [
|
|
399
|
-
rootItemAssistantCapability,
|
|
400
|
-
groupItemAssistantCapability,
|
|
401
|
-
pageBreakItemAssistantCapability,
|
|
402
|
-
infoItemAssistantCapability,
|
|
403
|
-
choiceItemAssistantCapability,
|
|
404
|
-
formItemAssistantCapability
|
|
405
|
-
];
|
|
406
|
-
const defaultSurveyAssistantCapabilitySet = createSurveyAssistantCapabilities(defaultSurveyAssistantCapabilities);
|
|
407
|
-
const getDefaultSurveyAssistantCapability = (itemType) => defaultSurveyAssistantCapabilitySet.byItemType.get(itemType);
|
|
408
|
-
//#endregion
|
|
409
|
-
export { choiceItemAssistantCapability, defaultSurveyAssistantCapabilities, defaultSurveyAssistantCapabilitySet, formItemAssistantCapability, getDefaultSurveyAssistantCapability, groupItemAssistantCapability, infoItemAssistantCapability, pageBreakItemAssistantCapability, rootItemAssistantCapability };
|
|
410
|
-
|
|
411
|
-
//# sourceMappingURL=capabilities-default.mjs.map
|
|
1
|
+
import { a as defaultSurveyAssistantCapabilitySet, c as getDefaultSurveyAssistantCapability, d as pageBreakItemAssistantCapability, f as rootItemAssistantCapability, i as defaultSurveyAssistantCapabilities, l as groupItemAssistantCapability, n as choiceMatrixAssistantCapability, o as formItemAssistantCapability, r as consentItemAssistantCapability, s as formMatrixAssistantCapability, t as choiceItemAssistantCapability, u as infoItemAssistantCapability } from "./default-fhSon2RM.mjs";
|
|
2
|
+
export { choiceItemAssistantCapability, choiceMatrixAssistantCapability, consentItemAssistantCapability, defaultSurveyAssistantCapabilities, defaultSurveyAssistantCapabilitySet, formItemAssistantCapability, formMatrixAssistantCapability, getDefaultSurveyAssistantCapability, groupItemAssistantCapability, infoItemAssistantCapability, pageBreakItemAssistantCapability, rootItemAssistantCapability };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import "./index-D7wT6P3t.mjs";
|
|
2
|
+
import { St as SurveyDocumentVersion, o as SurveyAssistantApplyOutcome, xt as SurveyDocumentSnapshot } from "./lifecycle-Dm8u7QFh.mjs";
|
|
3
|
+
import { Pt as SurveyAssistantEngineContext, qt as SurveyAssistantCapabilitySet, x as TurnSurveyDraft } from "./index-Ciq7vHIs.mjs";
|
|
4
|
+
import { r as SurveyAssistantModelAttachment, t as SurveyAssistantAttachmentAccess } from "./thread-documents-DrHbaXqP.mjs";
|
|
4
5
|
import { RequestContext } from "@mastra/core/request-context";
|
|
5
6
|
import { AgentExecutionOptions } from "@mastra/core/agent";
|
|
6
7
|
import { OpenAICompatibleConfig } from "@mastra/core/llm";
|
|
7
|
-
|
|
8
8
|
//#region src/server/request-context.d.ts
|
|
9
|
-
interface SurveyAssistantInvocationContext {
|
|
10
|
-
kind: "chat";
|
|
11
|
-
}
|
|
12
9
|
interface SurveyAssistantIdentityContext {
|
|
13
10
|
authority: "experimental-client-request" | "authenticated-host";
|
|
14
11
|
resourceId: string;
|
|
@@ -41,18 +38,13 @@ type SurveyAssistantDocumentTransition = {
|
|
|
41
38
|
capabilitiesChanged: boolean;
|
|
42
39
|
};
|
|
43
40
|
interface SurveyAssistantRequestContext {
|
|
44
|
-
invocation: SurveyAssistantInvocationContext;
|
|
45
41
|
turnId: string;
|
|
46
42
|
turnDraft: TurnSurveyDraft;
|
|
47
43
|
identity: SurveyAssistantIdentityContext;
|
|
48
|
-
authenticatedResourceId?: string;
|
|
49
|
-
authorizedThreadId?: string;
|
|
50
|
-
applyPolicy?: "auto" | "review" | "deny";
|
|
51
44
|
mastra__resourceId?: string;
|
|
52
45
|
mastra__threadId?: string;
|
|
53
46
|
documentTransition?: SurveyAssistantDocumentTransition;
|
|
54
47
|
engineContext?: SurveyAssistantEngineContext;
|
|
55
|
-
documentSnapshot?: SurveyDocumentSnapshot;
|
|
56
48
|
modelAttachments?: SurveyAssistantModelAttachment[];
|
|
57
49
|
attachmentAccess?: SurveyAssistantAttachmentAccess;
|
|
58
50
|
modelSelection?: SurveyAssistantModelSelection;
|
|
@@ -61,24 +53,11 @@ interface SurveyAssistantRequestContext {
|
|
|
61
53
|
declare const parseSurveyAssistantSnapshot: (value: unknown) => SurveyDocumentSnapshot | null;
|
|
62
54
|
declare const parseSurveyAssistantPreviousSettledVersion: (value: unknown) => SurveyDocumentVersion | null;
|
|
63
55
|
declare const parseSurveyAssistantPreviousApplyOutcome: (value: unknown) => SurveyAssistantApplyOutcome | null;
|
|
64
|
-
declare const deriveSurveyAssistantDocumentTransition: ({
|
|
65
|
-
current,
|
|
66
|
-
previous
|
|
67
|
-
}: {
|
|
56
|
+
declare const deriveSurveyAssistantDocumentTransition: ({ current, previous }: {
|
|
68
57
|
current: SurveyDocumentSnapshot | null;
|
|
69
58
|
previous: SurveyDocumentVersion | null;
|
|
70
59
|
}) => SurveyAssistantDocumentTransition | undefined;
|
|
71
|
-
declare const buildSurveyAssistantRequestContext: ({
|
|
72
|
-
turnDraft,
|
|
73
|
-
identity,
|
|
74
|
-
snapshot,
|
|
75
|
-
previousSettledVersion,
|
|
76
|
-
trustedCapabilities,
|
|
77
|
-
attachmentAccess,
|
|
78
|
-
modelAttachments,
|
|
79
|
-
modelSelection,
|
|
80
|
-
previousApplyOutcome
|
|
81
|
-
}: {
|
|
60
|
+
declare const buildSurveyAssistantRequestContext: ({ turnDraft, identity, snapshot, previousSettledVersion, trustedCapabilities, attachmentAccess, modelAttachments, modelSelection, previousApplyOutcome }: {
|
|
82
61
|
turnDraft: TurnSurveyDraft;
|
|
83
62
|
identity: SurveyAssistantIdentityContext;
|
|
84
63
|
snapshot: SurveyDocumentSnapshot | null;
|
|
@@ -99,4 +78,4 @@ declare const SURVEY_ASSISTANT_AGENT_ID = "survey-assistant-agent";
|
|
|
99
78
|
declare const SURVEY_ASSISTANT_TASK_AGENT_ID = "survey-assistant-task-agent";
|
|
100
79
|
//#endregion
|
|
101
80
|
export { SurveyAssistantModelSelection as a, deriveSurveyAssistantDocumentTransition as c, parseSurveyAssistantSnapshot as d, requireSurveyAssistantTurnState as f, SurveyAssistantIdentityContext as i, parseSurveyAssistantPreviousApplyOutcome as l, SURVEY_ASSISTANT_TASK_AGENT_ID as n, SurveyAssistantRequestContext as o, SurveyAssistantDocumentTransition as r, buildSurveyAssistantRequestContext as s, SURVEY_ASSISTANT_AGENT_ID as t, parseSurveyAssistantPreviousSettledVersion as u };
|
|
102
|
-
//# sourceMappingURL=constants-
|
|
81
|
+
//# sourceMappingURL=constants-B6HzpEsx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-B6HzpEsx.d.mts","names":[],"sources":["../src/server/request-context.ts","../src/server/constants.ts"],"mappings":";;;;;;;;UA2BiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA,gBAAgB;EAChB;EACA,kBAAkB;;KAGR;EACN;;EAEA;EACA;EACA;;EAGA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA,iBAAiB;EACjB;;UAGW;EACf;EACA,WAAW;EACX,UAAU;EACV;EACA;EACA,qBAAqB;EACrB,gBAAgB;EAChB,mBAAmB;EACnB,mBAAmB;EACnB,iBAAiB;EACjB,uBAAuB;;cAGZ,+BAAgC,mBAAiB;cAQjD,6CACX,mBACC;cAQU,2CACX,mBACC;cAQU,4CAA2C,SAAA;EAItD,SAAS;EACT,UAAU;MACR;cAqDS,uCAAsC,WAAA,UAAA,UAAA,wBAAA,qBAAA,kBAAA,kBAAA,gBAAA;EAWjD,WAAW;EACX,UAAU;EACV,UAAU;EACV,yBAAyB;EACzB,sBAAsB;EACtB,mBAAmB;EACnB,mBAAmB;EACnB,iBAAiB;EACjB,uBAAuB;MACrB,eAAe;cAiDN,kCACX,gBAAgB,eAAe;;;;;;cC1OpB;cACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants-
|
|
1
|
+
{"version":3,"file":"constants-Ct-vv9cu.mjs","names":[],"sources":["../src/server/constants.ts"],"sourcesContent":["export const SURVEY_ASSISTANT_AGENT_ID = \"survey-assistant-agent\";\nexport const SURVEY_ASSISTANT_TASK_AGENT_ID = \"survey-assistant-task-agent\";\n"],"mappings":";AAAA,MAAa,4BAA4B;AACzC,MAAa,iCAAiC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { G as SurveyAssistantThread, b as SurveyAssistantTranslateContentInput, c as SurveyAssistantSuggestItemLabelInput, d as SurveyAssistantSuggestResponseNameResult, f as SurveyAssistantSuggestResponseSettingsInput, g as SurveyAssistantTaskInvocationMode, h as SurveyAssistantTaskContext, l as SurveyAssistantSuggestItemLabelResult, p as SurveyAssistantSuggestResponseSettingsResult, u as SurveyAssistantSuggestResponseNameInput, x as SurveyAssistantTranslateContentResult } from "./index-D7wT6P3t.mjs";
|
|
2
|
+
import { Ct as SurveyEditorUIContext, h as SurveyChangeSet, m as SurveyBatchApplyResult, yt as SurveyAssistantSnapshot } from "./lifecycle-Dm8u7QFh.mjs";
|
|
3
|
+
import { FileUIPart } from "ai";
|
|
4
|
+
//#region src/react/thread-launcher.d.ts
|
|
5
|
+
type SurveyAssistantLaunchUIContext = Partial<Omit<SurveyEditorUIContext, "history">>;
|
|
6
|
+
interface SurveyAssistantThreadLaunch {
|
|
7
|
+
/** User-visible prompt submitted as the first message in the new thread. */
|
|
8
|
+
prompt: string;
|
|
9
|
+
files?: FileUIPart[];
|
|
10
|
+
/** Optional model used for the opening assistant turn. */
|
|
11
|
+
modelId?: string;
|
|
12
|
+
/** Optional manual thread title. The prompt-derived automatic title is used by default. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Turn-local editor context merged into the snapshot captured when the prompt is submitted. */
|
|
15
|
+
uiContext?: SurveyAssistantLaunchUIContext;
|
|
16
|
+
}
|
|
17
|
+
interface SurveyAssistantThreadLauncher {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new thread and submits its first prompt when a connected panel is ready.
|
|
20
|
+
* Calls made before the panel mounts are queued.
|
|
21
|
+
*/
|
|
22
|
+
startThread(input: SurveyAssistantThreadLaunch): Promise<SurveyAssistantThread>;
|
|
23
|
+
}
|
|
24
|
+
declare const createSurveyAssistantThreadLauncher: () => SurveyAssistantThreadLauncher;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/react/controller.d.ts
|
|
27
|
+
interface SurveyAssistantController {
|
|
28
|
+
/** Snapshot version.sessionId identifies the editor document session, independently of this wrapper's identity. */
|
|
29
|
+
getSnapshot(): SurveyAssistantSnapshot | null;
|
|
30
|
+
/** Applies the authorized turn, including a one-change turn, and returns one result per change. */
|
|
31
|
+
applyAssistantChanges(changes: SurveyChangeSet[]): SurveyBatchApplyResult;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/react/task-client.d.ts
|
|
35
|
+
interface SurveyAssistantTaskClientOptions {
|
|
36
|
+
api?: string;
|
|
37
|
+
resourceId?: string;
|
|
38
|
+
surveyId?: string;
|
|
39
|
+
}
|
|
40
|
+
interface SurveyAssistantTaskExecutionOptions {
|
|
41
|
+
mode?: SurveyAssistantTaskInvocationMode;
|
|
42
|
+
modelId?: string;
|
|
43
|
+
signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
interface SurveyAssistantTaskClient {
|
|
46
|
+
suggestResponseSettings(input: SurveyAssistantSuggestResponseSettingsInput, context: SurveyAssistantTaskContext, options?: SurveyAssistantTaskExecutionOptions): Promise<SurveyAssistantSuggestResponseSettingsResult>;
|
|
47
|
+
suggestResponseName(input: SurveyAssistantSuggestResponseNameInput, context: SurveyAssistantTaskContext, options?: SurveyAssistantTaskExecutionOptions): Promise<SurveyAssistantSuggestResponseNameResult>;
|
|
48
|
+
suggestItemLabel(input: SurveyAssistantSuggestItemLabelInput, context: SurveyAssistantTaskContext, options?: SurveyAssistantTaskExecutionOptions): Promise<SurveyAssistantSuggestItemLabelResult>;
|
|
49
|
+
translateContent(input: SurveyAssistantTranslateContentInput, context: SurveyAssistantTaskContext, options?: SurveyAssistantTaskExecutionOptions): Promise<SurveyAssistantTranslateContentResult>;
|
|
50
|
+
}
|
|
51
|
+
declare const createSurveyAssistantTaskClient: ({ api, resourceId, surveyId }?: SurveyAssistantTaskClientOptions) => SurveyAssistantTaskClient;
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/react/controller-proxy.d.ts
|
|
54
|
+
interface CreateSurveyAssistantControllerProxyOptions {
|
|
55
|
+
notReadyMessage?: string;
|
|
56
|
+
}
|
|
57
|
+
interface SurveyAssistantControllerBridge {
|
|
58
|
+
controller: SurveyAssistantController;
|
|
59
|
+
setController(controller: SurveyAssistantController | null | undefined): void;
|
|
60
|
+
}
|
|
61
|
+
declare const createSurveyAssistantControllerProxy: (getController: () => SurveyAssistantController | null | undefined, { notReadyMessage }?: CreateSurveyAssistantControllerProxyOptions) => SurveyAssistantController;
|
|
62
|
+
declare const createSurveyAssistantControllerBridge: (options?: CreateSurveyAssistantControllerProxyOptions) => SurveyAssistantControllerBridge;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { SurveyAssistantTaskClient as a, createSurveyAssistantTaskClient as c, SurveyAssistantThreadLaunch as d, SurveyAssistantThreadLauncher as f, createSurveyAssistantControllerProxy as i, SurveyAssistantController as l, SurveyAssistantControllerBridge as n, SurveyAssistantTaskClientOptions as o, createSurveyAssistantThreadLauncher as p, createSurveyAssistantControllerBridge as r, SurveyAssistantTaskExecutionOptions as s, CreateSurveyAssistantControllerProxyOptions as t, SurveyAssistantLaunchUIContext as u };
|
|
65
|
+
//# sourceMappingURL=controller-proxy-D7uQfm5f.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-proxy-D7uQfm5f.d.mts","names":[],"sources":["../src/react/thread-launcher.ts","../src/react/controller.ts","../src/react/task-client.ts","../src/react/controller-proxy.ts"],"mappings":";;;;KAOY,iCAAiC,QAAQ,KAAK;UAEzC;;EAEf;EACA,QAAQ;;EAER;;EAEA;;EAEA,YAAY;;UAGG;;;;;EAKf,YAAY,OAAO,8BAA8B,QAAQ;;cA6D9C,2CAA0C;;;UCrFtC;;EAEf,eAAe;;EAEf,sBAAsB,SAAS,oBAAoB;;;;UCcpC;EACf;EACA;EACA;;UAGe;EACf,OAAO;EACP;EACA,SAAS;;UAGM;EACf,wBACE,OAAO,6CACP,SAAS,4BACT,UAAU,sCACT,QAAQ;EACX,oBACE,OAAO,yCACP,SAAS,4BACT,UAAU,sCACT,QAAQ;EACX,iBACE,OAAO,sCACP,SAAS,4BACT,UAAU,sCACT,QAAQ;EACX,iBACE,OAAO,sCACP,SAAS,4BACT,UAAU,sCACT,QAAQ;;cAGA,oCAAmC,KAAA,YAAA,aAI7C,qCAAwC;;;UCxD1B;EACf;;UAGe;EACf,YAAY;EACZ,cAAc,YAAY;;cAWf,uCACX,qBAAqB,gDACrB,oBAEG,gDACF;cAWU,wCACX,UAAU,gDACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as surveyAssistantTranslateContentResultSchema, Ft as isSurveyAssistantErrorRetryable, It as parseSurveyAssistantError, S as surveyAssistantSuggestResponseSettingsResultSchema, b as surveyAssistantSuggestResponseNameResultSchema, v as surveyAssistantSuggestItemLabelResultSchema } from "./protocol-CF4Bh_Ch.mjs";
|
|
2
2
|
//#region src/react/client-error.ts
|
|
3
3
|
var SurveyAssistantClientError = class extends Error {
|
|
4
4
|
code;
|
|
@@ -109,9 +109,9 @@ const connectSurveyAssistantThreadLauncher = (launcher, handler) => {
|
|
|
109
109
|
};
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region src/react/task-client.ts
|
|
112
|
-
const createSurveyAssistantTaskClient = ({ api = "/api/survey-assistant/tasks",
|
|
112
|
+
const createSurveyAssistantTaskClient = ({ api = "/api/survey-assistant/tasks", resourceId, surveyId } = {}) => {
|
|
113
113
|
const run = async (taskId, input, context, options) => {
|
|
114
|
-
const modelId = options?.modelId
|
|
114
|
+
const modelId = options?.modelId;
|
|
115
115
|
return readSurveyAssistantJson(await fetch(api, {
|
|
116
116
|
body: JSON.stringify({
|
|
117
117
|
taskId,
|
|
@@ -128,8 +128,11 @@ const createSurveyAssistantTaskClient = ({ api = "/api/survey-assistant/tasks",
|
|
|
128
128
|
}), "The survey assistant task could not be completed.");
|
|
129
129
|
};
|
|
130
130
|
return {
|
|
131
|
-
async
|
|
132
|
-
return
|
|
131
|
+
async suggestResponseSettings(input, context, options) {
|
|
132
|
+
return surveyAssistantSuggestResponseSettingsResultSchema.parse(await run("suggest-response-settings", input, context, options));
|
|
133
|
+
},
|
|
134
|
+
async suggestResponseName(input, context, options) {
|
|
135
|
+
return surveyAssistantSuggestResponseNameResultSchema.parse(await run("suggest-response-name", input, context, options));
|
|
133
136
|
},
|
|
134
137
|
async suggestItemLabel(input, context, options) {
|
|
135
138
|
return surveyAssistantSuggestItemLabelResultSchema.parse(await run("suggest-item-label", input, context, options));
|
|
@@ -139,19 +142,6 @@ const createSurveyAssistantTaskClient = ({ api = "/api/survey-assistant/tasks",
|
|
|
139
142
|
}
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
|
-
const createSurveyAssistantTaskExecutor = (options = {}) => {
|
|
143
|
-
const client = createSurveyAssistantTaskClient(options);
|
|
144
|
-
const executionOptions = (request, cache) => ({
|
|
145
|
-
mode: request?.mode,
|
|
146
|
-
modelId: cache?.cacheScope,
|
|
147
|
-
signal: request?.signal
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
suggestItemKey: (input, context, request, cache) => client.suggestItemKey(input, context, executionOptions(request, cache)),
|
|
151
|
-
suggestItemLabel: (input, context, request, cache) => client.suggestItemLabel(input, context, executionOptions(request, cache)),
|
|
152
|
-
translateContent: (input, context, request, cache) => client.translateContent(input, context, executionOptions(request, cache))
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
145
|
//#endregion
|
|
156
146
|
//#region src/react/controller-proxy.ts
|
|
157
147
|
const failedResult = (change, message) => ({
|
|
@@ -179,6 +169,6 @@ const createSurveyAssistantControllerBridge = (options) => {
|
|
|
179
169
|
};
|
|
180
170
|
};
|
|
181
171
|
//#endregion
|
|
182
|
-
export {
|
|
172
|
+
export { connectSurveyAssistantThreadLauncher as a, readSurveyAssistantJson as c, applySurveyAssistantLaunchUIContext as i, createSurveyAssistantControllerProxy as n, createSurveyAssistantThreadLauncher as o, createSurveyAssistantTaskClient as r, SurveyAssistantClientError as s, createSurveyAssistantControllerBridge as t };
|
|
183
173
|
|
|
184
|
-
//# sourceMappingURL=controller-proxy-
|
|
174
|
+
//# sourceMappingURL=controller-proxy-DEeFl9IA.mjs.map
|