@case-framework/survey-assistant 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +9 -4
  2. package/dist/attachments-B0hg3vpT.mjs +11 -0
  3. package/dist/attachments-B0hg3vpT.mjs.map +1 -0
  4. package/dist/authoring-references-BJQ_1nMX.mjs +115 -0
  5. package/dist/authoring-references-BJQ_1nMX.mjs.map +1 -0
  6. package/dist/capabilities-1KNnNO1_.mjs +73 -0
  7. package/dist/capabilities-1KNnNO1_.mjs.map +1 -0
  8. package/dist/{capabilities-CnsVuJ1k.d.mts → capabilities-DVTfogjv.d.mts} +1 -1
  9. package/dist/{capabilities-CnsVuJ1k.d.mts.map → capabilities-DVTfogjv.d.mts.map} +1 -1
  10. package/dist/capabilities-default.d.mts +1 -1
  11. package/dist/capabilities-default.d.mts.map +1 -1
  12. package/dist/capabilities-default.mjs +47 -20
  13. package/dist/capabilities-default.mjs.map +1 -1
  14. package/dist/{constants-CFUWrRtl.mjs → constants-0UHGFcRJ.mjs} +1 -1
  15. package/dist/{constants-CFUWrRtl.mjs.map → constants-0UHGFcRJ.mjs.map} +1 -1
  16. package/dist/{constants-DbrJxxOh.d.mts → constants-Be91Gay9.d.mts} +4 -4
  17. package/dist/{constants-DbrJxxOh.d.mts.map → constants-Be91Gay9.d.mts.map} +1 -1
  18. package/dist/{controller-proxy-jWIPOZAv.mjs → controller-proxy-BH05e-C2.mjs} +21 -8
  19. package/dist/controller-proxy-BH05e-C2.mjs.map +1 -0
  20. package/dist/{controller-proxy-BdKF2yrq.d.mts → controller-proxy-Bd0ZHBPF.d.mts} +11 -11
  21. package/dist/controller-proxy-Bd0ZHBPF.d.mts.map +1 -0
  22. package/dist/{digest-Dyjch_sC.d.mts → digest-SJmoYVaK.d.mts} +2 -2
  23. package/dist/{digest-Dyjch_sC.d.mts.map → digest-SJmoYVaK.d.mts.map} +1 -1
  24. package/dist/digest.d.mts +1 -1
  25. package/dist/{engine-DcSdLRle.mjs → engine-Bo85Oyj0.mjs} +3129 -2435
  26. package/dist/engine-Bo85Oyj0.mjs.map +1 -0
  27. package/dist/engine.d.mts +3 -3
  28. package/dist/engine.mjs +3 -3
  29. package/dist/{fair-guidance-CEdJYccK.mjs → fair-guidance-CRYCRxQm.mjs} +1 -1
  30. package/dist/{fair-guidance-CEdJYccK.mjs.map → fair-guidance-CRYCRxQm.mjs.map} +1 -1
  31. package/dist/{index-Da_Hb9-1.d.mts → index-Tnqv-yKW.d.mts} +73 -67
  32. package/dist/index-Tnqv-yKW.d.mts.map +1 -0
  33. package/dist/index-l_EK4yK7.d.mts +404 -0
  34. package/dist/index-l_EK4yK7.d.mts.map +1 -0
  35. package/dist/{index-BApnIiCI.d.mts → index-nhrgbgO5.d.mts} +24 -5
  36. package/dist/index-nhrgbgO5.d.mts.map +1 -0
  37. package/dist/{index-DhNQKOwr.d.mts → index-x0qprHgK.d.mts} +19 -7
  38. package/dist/index-x0qprHgK.d.mts.map +1 -0
  39. package/dist/{lifecycle-DWv5CiSu.d.mts → lifecycle-Bx0aq_4S.d.mts} +8 -2
  40. package/dist/{lifecycle-DWv5CiSu.d.mts.map → lifecycle-Bx0aq_4S.d.mts.map} +1 -1
  41. package/dist/{memory-thread-repository-CvYZwni6.mjs → memory-thread-repository-KWHQWFEW.mjs} +45 -14
  42. package/dist/memory-thread-repository-KWHQWFEW.mjs.map +1 -0
  43. package/dist/{protocol-DJUP4gc0.mjs → protocol-BhzQbx81.mjs} +66 -16
  44. package/dist/protocol-BhzQbx81.mjs.map +1 -0
  45. package/dist/protocol.d.mts +4 -4
  46. package/dist/protocol.mjs +3 -2
  47. package/dist/react-B3ybjJ-X.mjs +1620 -0
  48. package/dist/react-B3ybjJ-X.mjs.map +1 -0
  49. package/dist/react-integration.d.mts +1 -1
  50. package/dist/react-integration.mjs +1 -1
  51. package/dist/react.d.mts +3 -3
  52. package/dist/react.mjs +3 -3
  53. package/dist/references/assistant-operations.md +45 -39
  54. package/dist/references/expressions.md +28 -0
  55. package/dist/references/item-types.md +1 -1
  56. package/dist/references/localization.md +5 -4
  57. package/dist/references/rich-text-content.md +60 -27
  58. package/dist/references/source-material-surveys.md +9 -2
  59. package/dist/references/survey-data-model.md +9 -1
  60. package/dist/{request-context-D1sC54ZA.mjs → request-context-CG4SWijt.mjs} +3 -3
  61. package/dist/{request-context-D1sC54ZA.mjs.map → request-context-CG4SWijt.mjs.map} +1 -1
  62. package/dist/{request-guardrails-h4t6u8mP.mjs → request-guardrails-TmgQtqp4.mjs} +5 -12
  63. package/dist/request-guardrails-TmgQtqp4.mjs.map +1 -0
  64. package/dist/server-agent.d.mts +19 -8
  65. package/dist/server-agent.d.mts.map +1 -1
  66. package/dist/server-agent.mjs +11 -13
  67. package/dist/server-agent.mjs.map +1 -1
  68. package/dist/server-runtime.d.mts +12 -6
  69. package/dist/server-runtime.d.mts.map +1 -1
  70. package/dist/server-runtime.mjs +9 -4
  71. package/dist/server-runtime.mjs.map +1 -1
  72. package/dist/server-tasks.d.mts +1 -1
  73. package/dist/server-tasks.mjs +5 -5
  74. package/dist/server-tools.d.mts +1 -1
  75. package/dist/server-tools.mjs +1 -1
  76. package/dist/server.d.mts +7 -7
  77. package/dist/server.mjs +6 -6
  78. package/dist/storage-postgres.d.mts +1 -1
  79. package/dist/storage-postgres.mjs +1 -1
  80. package/dist/{tasks-CCtxjhwh.d.mts → tasks-CYqrcaRO.d.mts} +16 -4
  81. package/dist/tasks-CYqrcaRO.d.mts.map +1 -0
  82. package/dist/{thread-documents-Dvo6XS7o.d.mts → thread-documents-rmd6nyX9.d.mts} +1 -1
  83. package/dist/{thread-documents-Dvo6XS7o.d.mts.map → thread-documents-rmd6nyX9.d.mts.map} +1 -1
  84. package/dist/{thread-handlers-Bt9cDo-F.d.mts → thread-handlers-DBAaU7BA.d.mts} +7 -5
  85. package/dist/thread-handlers-DBAaU7BA.d.mts.map +1 -0
  86. package/dist/{tools-3tq-XqI0.mjs → tools-BvSovehT.mjs} +433 -495
  87. package/dist/tools-BvSovehT.mjs.map +1 -0
  88. package/dist/ui.css +1 -1
  89. package/dist/ui.d.mts +5 -4
  90. package/dist/ui.d.mts.map +1 -1
  91. package/dist/ui.mjs +744 -131
  92. package/dist/ui.mjs.map +1 -1
  93. package/docs/integration.md +43 -3
  94. package/package.json +21 -19
  95. package/dist/authoring-references-yyYC4Ydi.mjs +0 -98
  96. package/dist/authoring-references-yyYC4Ydi.mjs.map +0 -1
  97. package/dist/controller-proxy-BdKF2yrq.d.mts.map +0 -1
  98. package/dist/controller-proxy-jWIPOZAv.mjs.map +0 -1
  99. package/dist/engine-DcSdLRle.mjs.map +0 -1
  100. package/dist/form-authoring-BQh40yDb.mjs +0 -155
  101. package/dist/form-authoring-BQh40yDb.mjs.map +0 -1
  102. package/dist/index-BApnIiCI.d.mts.map +0 -1
  103. package/dist/index-Da_Hb9-1.d.mts.map +0 -1
  104. package/dist/index-DhNQKOwr.d.mts.map +0 -1
  105. package/dist/index-dV6df0W3.d.mts +0 -224
  106. package/dist/index-dV6df0W3.d.mts.map +0 -1
  107. package/dist/memory-thread-repository-CvYZwni6.mjs.map +0 -1
  108. package/dist/protocol-DJUP4gc0.mjs.map +0 -1
  109. package/dist/react-CY6N7lVi.mjs +0 -768
  110. package/dist/react-CY6N7lVi.mjs.map +0 -1
  111. package/dist/request-guardrails-h4t6u8mP.mjs.map +0 -1
  112. package/dist/tasks-CCtxjhwh.d.mts.map +0 -1
  113. package/dist/thread-handlers-Bt9cDo-F.d.mts.map +0 -1
  114. package/dist/tools-3tq-XqI0.mjs.map +0 -1
package/README.md CHANGED
@@ -188,7 +188,8 @@ metadata.
188
188
  `/protocol`, `/engine`, and `/capabilities/default` may not import React,
189
189
  Next.js, Mastra, AI SDK, `survey-ui`, or Node-only storage. `/protocol` has Zod
190
190
  plus the narrow browser-safe `survey-core/editor/colors` runtime dependency;
191
- `/engine` may use the full `survey-core` API. `/server` is
191
+ `/engine` and `/capabilities/default` may use the headless `survey-items`
192
+ domain and the full `survey-core` API. `/server` is
192
193
  server-only and may import Mastra, AI SDK, and Node APIs, but never React,
193
194
  Next.js, or `survey-ui`. The separate server entries prevent handler-only
194
195
  consumers from eagerly loading Agent/Memory code. `@case-framework/survey-editor-ui`
@@ -253,13 +254,17 @@ received from a browser snapshot.
253
254
  ```bash
254
255
  pnpm --filter @case-framework/survey-assistant check
255
256
  pnpm --filter @case-framework/survey-assistant check:release
257
+ pnpm benchmark:survey-assistant-operations
256
258
  ```
257
259
 
258
260
  `check` typechecks and builds all entries, copies server references, verifies
259
261
  their source and built import graphs, and runs unit tests. `check:release` also
260
- builds the clean Next host fixture. The optional Postgres entry accepts a
261
- host-owned `PostgresStore` or store configuration; it does not read environment
262
- variables, create hidden singletons, or own connection shutdown.
262
+ builds the clean Next host fixture. `benchmark:survey-assistant-operations`
263
+ uses the current built engine output to profile maximum-size typed validation
264
+ and the raw-patch path against a synthetic 5,002-item survey; run `build` first
265
+ when source has changed. The optional Postgres entry accepts a host-owned
266
+ `PostgresStore` or store configuration; it does not read environment variables,
267
+ create hidden singletons, or own connection shutdown.
263
268
 
264
269
  ## Integration Levels
265
270
 
@@ -0,0 +1,11 @@
1
+ //#region src/protocol/attachments.ts
2
+ const SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES = [
3
+ "application/pdf",
4
+ "image/png",
5
+ "image/jpeg"
6
+ ];
7
+ const isSurveyAssistantAttachmentMediaType = (mediaType) => SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES.includes(mediaType.toLowerCase());
8
+ //#endregion
9
+ export { isSurveyAssistantAttachmentMediaType as n, SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES as t };
10
+
11
+ //# sourceMappingURL=attachments-B0hg3vpT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments-B0hg3vpT.mjs","names":[],"sources":["../src/protocol/attachments.ts"],"sourcesContent":["export const SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES = [\n \"application/pdf\",\n \"image/png\",\n \"image/jpeg\",\n] as const;\n\nexport type SurveyAssistantAttachmentMediaType =\n (typeof SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES)[number];\n\nexport const isSurveyAssistantAttachmentMediaType = (\n mediaType: string,\n): mediaType is SurveyAssistantAttachmentMediaType =>\n (SURVEY_ASSISTANT_ATTACHMENT_MEDIA_TYPES as readonly string[]).includes(mediaType.toLowerCase());\n"],"mappings":";AAAA,MAAa,0CAA0C;CACrD;CACA;CACA;CACD;AAKD,MAAa,wCACX,cAEC,wCAA8D,SAAS,UAAU,aAAa,CAAC"}
@@ -0,0 +1,115 @@
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.13_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
+ "fair-by-design",
22
+ "survey-quality"
23
+ ];
24
+ const ITEM_TYPE_SECTION_HEADINGS = {
25
+ group: "group",
26
+ "page-break": "page-break",
27
+ infoItem: "infoItem",
28
+ choiceItem: "choiceItem",
29
+ formItem: "formItem"
30
+ };
31
+ const builtInSurveyAuthoringItemTypes = Object.freeze(Object.keys(ITEM_TYPE_SECTION_HEADINGS));
32
+ const extractLevelTwoSection = (markdown, heading) => {
33
+ const lines = markdown.split("\n");
34
+ const sectionStart = lines.findIndex((line) => line.trim() === `## ${heading}`);
35
+ if (sectionStart < 0) return;
36
+ const nextSectionOffset = lines.slice(sectionStart + 1).findIndex((line) => line.startsWith("## "));
37
+ const sectionEnd = nextSectionOffset < 0 ? lines.length : sectionStart + 1 + nextSectionOffset;
38
+ return lines.slice(sectionStart, sectionEnd).join("\n").trim();
39
+ };
40
+ const surveyAuthoringReferences = {
41
+ "core-rules": {
42
+ title: "Core authoring rules",
43
+ content: loadReference("core-rules.md"),
44
+ loadWhen: "Load when the task depends on canonical tool choice, validation/apply semantics, identifier handling, or another cross-cutting authoring rule that the current turn has not already established."
45
+ },
46
+ "survey-data-model": {
47
+ title: "Survey data model",
48
+ content: loadReference("survey-data-model.md"),
49
+ loadWhen: "Load before reasoning about raw survey storage, hierarchy, ids, translation maps, assets, template values, or any direct survey-json-patch path whose exact location has not already been inspected and documented in the current turn."
50
+ },
51
+ "source-material-surveys": {
52
+ title: "Source-material survey implementation",
53
+ content: loadReference("source-material-surveys.md"),
54
+ loadWhen: "Load before implementing or adapting a questionnaire, document, image, or other supplied source material so completeness, respondent-input mapping, meaningful layout, language, and digital adaptation rules are available before the first mutation."
55
+ },
56
+ localization: {
57
+ title: "Survey localization",
58
+ content: loadReference("localization.md"),
59
+ loadWhen: "Load before adding, removing, translating, or assessing a survey locale, including requests for localization completeness or locale lifecycle changes."
60
+ },
61
+ "rich-text-content": {
62
+ title: "Rich text content",
63
+ content: loadReference("rich-text-content.md"),
64
+ loadWhen: "Load before authoring or changing meaningful formatting, links, images, headings, lists, info boxes, separators, footnotes, or existing structured rich-text content; do not load it for ordinary unformatted plain text."
65
+ },
66
+ "item-types": {
67
+ title: "Item types",
68
+ content: loadReference("item-types.md"),
69
+ loadWhen: "Load with itemType before creating or changing an item when its configuration, response behavior, or content surfaces are not already fully specified by the current capability and focused operation contract; omit itemType only for a genuine cross-type comparison."
70
+ },
71
+ "embedded-forms": {
72
+ title: "Choice option embedded forms",
73
+ content: loadReference("embedded-forms.md"),
74
+ loadWhen: "Load before creating or changing a choice-option follow-up or embedded form, including \"Other, specify\", option-specific inputs, embedded field groups, or embedded-form layout and translations."
75
+ },
76
+ expressions: {
77
+ title: "Expressions",
78
+ content: loadReference("expressions.md"),
79
+ loadWhen: "Load before the first survey_expression prepare call for expression, condition, validation-expression, prefill, or template-value work unless the exact relevant JsonExpression and mutation shapes were already supplied by a current-turn authoring reference. survey_expression context supplies currently available runtime references and value types, but it does not replace the grammar reference. Expressions are not assumed to be survey-response-only; use the references and variable sources supported by the current runtime and reference."
80
+ },
81
+ "assistant-operations": {
82
+ title: "Assistant operations",
83
+ content: loadReference("assistant-operations.md"),
84
+ loadWhen: "Load with operationKind before the first survey_change call when the exact canonical fields of that operation are not already present in the current turn; add itemType when item-specific configuration or capability guidance is needed. Prefer compact detail and use full only for protocol debugging."
85
+ },
86
+ "fair-by-design": {
87
+ title: "FAIR-by-design survey authoring",
88
+ content: loadReference("fair-by-design.md"),
89
+ loadWhen: "Load before advising or editing when FAIR, interoperability, harmonization, cross-study reuse, stable coding, value sets, missingness semantics, metadata, provenance, versioning, standard instruments, controlled vocabularies, or machine-readable export is material; do not impose it on ordinary authoring."
90
+ },
91
+ "survey-quality": {
92
+ title: "Survey quality review",
93
+ content: loadReference("survey-quality.md"),
94
+ loadWhen: "Load before a substantive questionnaire-quality critique, wording or flow review, respondent-burden assessment, or recommendations about measurement quality; it is not required for a purely technical defect check."
95
+ }
96
+ };
97
+ const formatSurveyAuthoringReferenceRoutingInstructions = () => [
98
+ "Authoring-reference routing rules:",
99
+ "Load a relevant focused reference before the first affected mutation or substantive advice, not after guessing a payload or learning through validator failures. Do not reload a reference when its exact relevant contract is already present in the current turn. References define stable authoring conventions and payload grammar; current survey state and currently available runtime references still come from inspection and context tools.",
100
+ "For installed capability-specific references, use the capability manifest's advertised reference topics. Load a relevant topic with itemType before changing unfamiliar capability configuration or behavior.",
101
+ ...surveyAuthoringReferenceTopics.map((topic) => `- ${topic}: ${surveyAuthoringReferences[topic].loadWhen}`)
102
+ ].join("\n");
103
+ const getBuiltInItemTypeAuthoringReference = (itemType) => {
104
+ const heading = ITEM_TYPE_SECTION_HEADINGS[itemType];
105
+ if (!heading) return;
106
+ const content = extractLevelTwoSection(surveyAuthoringReferences["item-types"].content, heading);
107
+ return content ? {
108
+ title: `${heading} item type`,
109
+ content
110
+ } : void 0;
111
+ };
112
+ //#endregion
113
+ export { surveyAuthoringReferences as a, surveyAuthoringReferenceTopics as i, formatSurveyAuthoringReferenceRoutingInstructions as n, getBuiltInItemTypeAuthoringReference as r, builtInSurveyAuthoringItemTypes as t };
114
+
115
+ //# sourceMappingURL=authoring-references-BJQ_1nMX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-references-BJQ_1nMX.mjs","names":[],"sources":["../../../node_modules/.pnpm/tsdown@0.21.10_synckit@0.11.13_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 \"fair-by-design\",\n \"survey-quality\",\n] as const;\n\nexport type SurveyAuthoringReferenceTopic = (typeof surveyAuthoringReferenceTopics)[number];\n\ntype SurveyAuthoringReferenceEntry = {\n title: string;\n content: string;\n loadWhen: string;\n};\n\nconst ITEM_TYPE_SECTION_HEADINGS: Readonly<Record<string, string>> = {\n group: \"group\",\n \"page-break\": \"page-break\",\n infoItem: \"infoItem\",\n choiceItem: \"choiceItem\",\n formItem: \"formItem\",\n};\n\nexport const builtInSurveyAuthoringItemTypes = Object.freeze(\n Object.keys(ITEM_TYPE_SECTION_HEADINGS),\n);\n\nconst extractLevelTwoSection = (markdown: string, heading: string): string | undefined => {\n const lines = markdown.split(\"\\n\");\n const sectionStart = lines.findIndex((line) => line.trim() === `## ${heading}`);\n if (sectionStart < 0) {\n return undefined;\n }\n\n const nextSectionOffset = lines\n .slice(sectionStart + 1)\n .findIndex((line) => line.startsWith(\"## \"));\n const sectionEnd = nextSectionOffset < 0 ? lines.length : sectionStart + 1 + nextSectionOffset;\n\n return lines.slice(sectionStart, sectionEnd).join(\"\\n\").trim();\n};\n\nexport const surveyAuthoringReferences = {\n \"core-rules\": {\n title: \"Core authoring rules\",\n content: loadReference(\"core-rules.md\"),\n loadWhen:\n \"Load when the task depends on canonical tool choice, validation/apply semantics, identifier handling, or another cross-cutting authoring rule that the current turn has not already established.\",\n },\n \"survey-data-model\": {\n title: \"Survey data model\",\n content: loadReference(\"survey-data-model.md\"),\n loadWhen:\n \"Load before reasoning about raw survey storage, hierarchy, ids, translation maps, assets, template values, or any direct survey-json-patch path whose exact location has not already been inspected and documented in the current turn.\",\n },\n \"source-material-surveys\": {\n title: \"Source-material survey implementation\",\n content: loadReference(\"source-material-surveys.md\"),\n loadWhen:\n \"Load before implementing or adapting a questionnaire, document, image, or other supplied source material so completeness, respondent-input mapping, meaningful layout, language, and digital adaptation rules are available before the first mutation.\",\n },\n localization: {\n title: \"Survey localization\",\n content: loadReference(\"localization.md\"),\n loadWhen:\n \"Load before adding, removing, translating, or assessing a survey locale, including requests for localization completeness or locale lifecycle changes.\",\n },\n \"rich-text-content\": {\n title: \"Rich text content\",\n content: loadReference(\"rich-text-content.md\"),\n loadWhen:\n \"Load before authoring or changing meaningful formatting, links, images, headings, lists, info boxes, separators, footnotes, or existing structured rich-text content; do not load it for ordinary unformatted plain text.\",\n },\n \"item-types\": {\n title: \"Item types\",\n content: loadReference(\"item-types.md\"),\n loadWhen:\n \"Load with itemType before creating or changing an item when its configuration, response behavior, or content surfaces are not already fully specified by the current capability and focused operation contract; omit itemType only for a genuine cross-type comparison.\",\n },\n \"embedded-forms\": {\n title: \"Choice option embedded forms\",\n content: loadReference(\"embedded-forms.md\"),\n loadWhen:\n 'Load before creating or changing a choice-option follow-up or embedded form, including \"Other, specify\", option-specific inputs, embedded field groups, or embedded-form layout and translations.',\n },\n expressions: {\n title: \"Expressions\",\n content: loadReference(\"expressions.md\"),\n loadWhen:\n \"Load before the first survey_expression prepare call for expression, condition, validation-expression, prefill, or template-value work unless the exact relevant JsonExpression and mutation shapes were already supplied by a current-turn authoring reference. survey_expression context supplies currently available runtime references and value types, but it does not replace the grammar reference. Expressions are not assumed to be survey-response-only; use the references and variable sources supported by the current runtime and reference.\",\n },\n \"assistant-operations\": {\n title: \"Assistant operations\",\n content: loadReference(\"assistant-operations.md\"),\n loadWhen:\n \"Load with operationKind before the first survey_change call when the exact canonical fields of that operation are not already present in the current turn; add itemType when item-specific configuration or capability guidance is needed. Prefer compact detail and use full only for protocol debugging.\",\n },\n \"fair-by-design\": {\n title: \"FAIR-by-design survey authoring\",\n content: loadReference(\"fair-by-design.md\"),\n loadWhen:\n \"Load before advising or editing when FAIR, interoperability, harmonization, cross-study reuse, stable coding, value sets, missingness semantics, metadata, provenance, versioning, standard instruments, controlled vocabularies, or machine-readable export is material; do not impose it on ordinary authoring.\",\n },\n \"survey-quality\": {\n title: \"Survey quality review\",\n content: loadReference(\"survey-quality.md\"),\n loadWhen:\n \"Load before a substantive questionnaire-quality critique, wording or flow review, respondent-burden assessment, or recommendations about measurement quality; it is not required for a purely technical defect check.\",\n },\n} as const satisfies Record<SurveyAuthoringReferenceTopic, SurveyAuthoringReferenceEntry>;\n\nexport const formatSurveyAuthoringReferenceRoutingInstructions = (): string =>\n [\n \"Authoring-reference routing rules:\",\n \"Load a relevant focused reference before the first affected mutation or substantive advice, not after guessing a payload or learning through validator failures. Do not reload a reference when its exact relevant contract is already present in the current turn. References define stable authoring conventions and payload grammar; current survey state and currently available runtime references still come from inspection and context tools.\",\n \"For installed capability-specific references, use the capability manifest's advertised reference topics. Load a relevant topic with itemType before changing unfamiliar capability configuration or behavior.\",\n ...surveyAuthoringReferenceTopics.map(\n (topic) => `- ${topic}: ${surveyAuthoringReferences[topic].loadWhen}`,\n ),\n ].join(\"\\n\");\n\nexport const getBuiltInItemTypeAuthoringReference = (\n itemType: string,\n): { title: string; content: string } | undefined => {\n const heading = ITEM_TYPE_SECTION_HEADINGS[itemType];\n if (!heading) {\n return undefined;\n }\n\n const content = extractLevelTwoSection(surveyAuthoringReferences[\"item-types\"].content, heading);\n return content ? { title: `${heading} item type`, content } : undefined;\n};\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;CACA;CACD;AAUD,MAAM,6BAA+D;CACnE,OAAO;CACP,cAAc;CACd,UAAU;CACV,YAAY;CACZ,UAAU;CACX;AAED,MAAa,kCAAkC,OAAO,OACpD,OAAO,KAAK,2BAA2B,CACxC;AAED,MAAM,0BAA0B,UAAkB,YAAwC;CACxF,MAAM,QAAQ,SAAS,MAAM,KAAK;CAClC,MAAM,eAAe,MAAM,WAAW,SAAS,KAAK,MAAM,KAAK,MAAM,UAAU;AAC/E,KAAI,eAAe,EACjB;CAGF,MAAM,oBAAoB,MACvB,MAAM,eAAe,EAAE,CACvB,WAAW,SAAS,KAAK,WAAW,MAAM,CAAC;CAC9C,MAAM,aAAa,oBAAoB,IAAI,MAAM,SAAS,eAAe,IAAI;AAE7E,QAAO,MAAM,MAAM,cAAc,WAAW,CAAC,KAAK,KAAK,CAAC,MAAM;;AAGhE,MAAa,4BAA4B;CACvC,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,gBAAgB;EACvC,UACE;EACH;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC9C,UACE;EACH;CACD,2BAA2B;EACzB,OAAO;EACP,SAAS,cAAc,6BAA6B;EACpD,UACE;EACH;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,kBAAkB;EACzC,UACE;EACH;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC9C,UACE;EACH;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,gBAAgB;EACvC,UACE;EACH;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC3C,UACE;EACH;CACD,aAAa;EACX,OAAO;EACP,SAAS,cAAc,iBAAiB;EACxC,UACE;EACH;CACD,wBAAwB;EACtB,OAAO;EACP,SAAS,cAAc,0BAA0B;EACjD,UACE;EACH;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC3C,UACE;EACH;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC3C,UACE;EACH;CACF;AAED,MAAa,0DACX;CACE;CACA;CACA;CACA,GAAG,+BAA+B,KAC/B,UAAU,KAAK,MAAM,IAAI,0BAA0B,OAAO,WAC5D;CACF,CAAC,KAAK,KAAK;AAEd,MAAa,wCACX,aACmD;CACnD,MAAM,UAAU,2BAA2B;AAC3C,KAAI,CAAC,QACH;CAGF,MAAM,UAAU,uBAAuB,0BAA0B,cAAc,SAAS,QAAQ;AAChG,QAAO,UAAU;EAAE,OAAO,GAAG,QAAQ;EAAa;EAAS,GAAG,KAAA"}
@@ -0,0 +1,73 @@
1
+ import { q as assistantItemTypeManifestSchema } from "./protocol-BhzQbx81.mjs";
2
+ import { buildCapabilityDigest, stableStringify } 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
+ const normalizedManifests = [];
9
+ for (const capability of capabilities) {
10
+ const manifest = assistantItemTypeManifestSchema.parse(capability.manifest);
11
+ const itemType = manifest.itemType;
12
+ if (byItemType.has(itemType)) throw new Error(`Duplicate survey assistant capability for item type "${itemType}".`);
13
+ if (manifest.create === "deterministic" && !manifest.supportedOperations.includes("create-item")) throw new Error(`Deterministically creatable item type "${itemType}" must support "create-item".`);
14
+ const declaredReferenceTopics = new Set(manifest.referenceTopics ?? []);
15
+ 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.`);
16
+ byItemType.set(itemType, capability);
17
+ normalizedManifests.push(assistantItemTypeManifestSchema.parse(JSON.parse(JSON.stringify(manifest))));
18
+ }
19
+ const manifestWithoutDigest = { itemTypes: normalizedManifests.sort((left, right) => left.itemType.localeCompare(right.itemType)) };
20
+ return {
21
+ manifest: {
22
+ ...manifestWithoutDigest,
23
+ digest: buildCapabilityDigest(manifestWithoutDigest)
24
+ },
25
+ byItemType
26
+ };
27
+ };
28
+ const getDeterministicCreateItemTypes = (manifest) => manifest.itemTypes.filter((entry) => entry.create === "deterministic").map((entry) => entry.itemType);
29
+ const resolveAssistantItemCreation = ({ itemType, manifest, parentItemId }) => {
30
+ const capability = manifest.itemTypes.find((entry) => entry.itemType === itemType);
31
+ if (capability?.create === "deterministic") return { kind: "deterministic" };
32
+ if (capability?.create === "interactive-only") return {
33
+ kind: "ui-intent",
34
+ intent: {
35
+ kind: "open-create-item",
36
+ itemType,
37
+ parentItemId
38
+ }
39
+ };
40
+ return {
41
+ kind: "unsupported",
42
+ reason: capability ? `Item type "${itemType}" does not support assistant creation.` : `Item type "${itemType}" is not installed.`
43
+ };
44
+ };
45
+ const createUnsupportedItemCapability = ({ displayName, itemType }) => ({ manifest: {
46
+ itemType,
47
+ capabilityVersion: "unsupported-v1",
48
+ displayName,
49
+ create: "unsupported",
50
+ supportedOperations: [],
51
+ contentSurfaces: []
52
+ } });
53
+ var SurveyAssistantCapabilityMismatchError = class extends Error {
54
+ code = "survey-assistant-capability-mismatch";
55
+ constructor(message = "Survey assistant capabilities changed; start a fresh turn and retry.") {
56
+ super(message);
57
+ this.name = "SurveyAssistantCapabilityMismatchError";
58
+ }
59
+ };
60
+ const assertSurveyAssistantCapabilities = ({ manifest, trustedCapabilities, versionDigest }) => {
61
+ const { digest: claimedDigest, ...manifestWithoutDigest } = manifest;
62
+ if (claimedDigest !== buildCapabilityDigest(manifestWithoutDigest) || versionDigest !== claimedDigest) throw new SurveyAssistantCapabilityMismatchError();
63
+ if (trustedCapabilities) {
64
+ const withoutContextualPresets = ({ creationPresets: _creationPresets, ...capability }) => capability;
65
+ const claimedBaseCapabilities = manifest.itemTypes.map(withoutContextualPresets);
66
+ const trustedBaseCapabilities = trustedCapabilities.manifest.itemTypes.map(withoutContextualPresets);
67
+ if (stableStringify(claimedBaseCapabilities) !== stableStringify(trustedBaseCapabilities)) throw new SurveyAssistantCapabilityMismatchError("The editor and server use different survey assistant capabilities; refresh and retry.");
68
+ }
69
+ };
70
+ //#endregion
71
+ 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 };
72
+
73
+ //# sourceMappingURL=capabilities-1KNnNO1_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities-1KNnNO1_.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, stableStringify } 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 const normalizedManifests: AssistantItemTypeManifest[] = [];\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 normalizedManifests.push(\n assistantItemTypeManifestSchema.parse(JSON.parse(JSON.stringify(manifest))),\n );\n }\n\n const itemTypes = normalizedManifests.sort((left, right) =>\n left.itemType.localeCompare(right.itemType),\n );\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) {\n const withoutContextualPresets = ({\n creationPresets: _creationPresets,\n ...capability\n }: AssistantItemTypeManifest): Omit<AssistantItemTypeManifest, \"creationPresets\"> => capability;\n const claimedBaseCapabilities = manifest.itemTypes.map(withoutContextualPresets);\n const trustedBaseCapabilities =\n trustedCapabilities.manifest.itemTypes.map(withoutContextualPresets);\n\n // Creation presets are editor-registry context for the model. They do not\n // grant operations or install executable adapters, so the server validates\n // the stable capability contract while retaining its own trusted adapters.\n if (stableStringify(claimedBaseCapabilities) !== stableStringify(trustedBaseCapabilities)) {\n throw new SurveyAssistantCapabilityMismatchError(\n \"The editor and server use different survey assistant capabilities; refresh and retry.\",\n );\n }\n }\n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AKqC;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,qBAAqB;EACvB,MAAM,4BAA4B,EAChC,iBAAiB,kBACjB,GAAG,iBACgF;EACrF,MAAM,0BAA0B,SAAS,UAAU,IAAI,yBAAyB;EAChF,MAAM,0BACJ,oBAAoB,SAAS,UAAU,IAAI,yBAAyB;AAKtE,MAAI,gBAAgB,wBAAwB,KAAK,gBAAgB,wBAAwB,CACvF,OAAM,IAAI,uCACR,wFACD"}
@@ -190,4 +190,4 @@ type AssistantItemTypeManifest = z.infer<typeof assistantItemTypeManifestSchema>
190
190
  type SurveyAssistantCapabilityManifest = z.infer<typeof surveyAssistantCapabilityManifestSchema>;
191
191
  //#endregion
192
192
  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 };
193
- //# sourceMappingURL=capabilities-CnsVuJ1k.d.mts.map
193
+ //# sourceMappingURL=capabilities-DVTfogjv.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-CnsVuJ1k.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;;;;cAS5B,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAe/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,KAExC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAC3C,iCAAA,GAAoC,CAAA,CAAE,KAAA,QACzC,uCAAA"}
1
+ {"version":3,"file":"capabilities-DVTfogjv.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;;;;cAS5B,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAe/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,KAExC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAC3C,iCAAA,GAAoC,CAAA,CAAE,KAAA,QACzC,uCAAA"}
@@ -1,4 +1,4 @@
1
- import { Ut as SurveyAssistantCapabilitySet, zt as AssistantItemCapabilityAdapter } from "./index-Da_Hb9-1.mjs";
1
+ import { Ut as AssistantItemCapabilityAdapter, qt as SurveyAssistantCapabilitySet } from "./index-Tnqv-yKW.mjs";
2
2
 
3
3
  //#region src/capabilities/default.d.ts
4
4
  declare const rootItemAssistantCapability: AssistantItemCapabilityAdapter;
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-default.d.mts","names":[],"sources":["../src/capabilities/default.ts"],"mappings":";;;cAuKa,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,cAyF/B,2BAAA,EAA6B,8BAAA;AAAA,cA8D7B,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"}
1
+ {"version":3,"file":"capabilities-default.d.mts","names":[],"sources":["../src/capabilities/default.ts"],"mappings":";;;cAoNa,2BAAA,EAA6B,8BAAA;AAAA,cAY7B,4BAAA,EAA8B,8BAAA;AAAA,cAsB9B,gCAAA,EAAkC,8BAAA;AAAA,cAsBlC,2BAAA,EAA6B,8BAAA;AAAA,cA6B7B,6BAAA,EAA+B,8BAAA;AAAA,cAyF/B,2BAAA,EAA6B,8BAAA;AAAA,cA2D7B,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"}
@@ -1,5 +1,6 @@
1
- import { a as normalizeFormAuthoringConfig, i as isValidSimpleFormConfig, l as createSurveyAssistantCapabilities } from "./form-authoring-BQh40yDb.mjs";
2
- import { ValueType } from "@case-framework/survey-core";
1
+ import { r as createSurveyAssistantCapabilities } from "./capabilities-1KNnNO1_.mjs";
2
+ import { createFormItemConfig, getFormFieldValueType, isValidSimpleFormConfig, normalizeFormAuthoringConfig } from "@case-framework/survey-items/form";
3
+ import { createChoiceItemConfig, getChoiceOptionEmbeddedFormResponseSlotPrefix, getChoiceResponseValueType } from "@case-framework/survey-items/choice";
3
4
  //#region src/capabilities/default.ts
4
5
  const COMMON_OPERATIONS = [
5
6
  "create-item",
@@ -79,15 +80,41 @@ const QUESTION_REFERENCE = {
79
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."
80
81
  };
81
82
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
82
- const getFieldValueType = (field) => {
83
- switch (field.type) {
84
- case "number":
85
- case "slider": return ValueType.number;
86
- case "datepicker": return ValueType.date;
87
- case "switch": return ValueType.boolean;
88
- default: return ValueType.string;
83
+ const withMaterializedConfig = (item, defaults) => ({
84
+ ...item,
85
+ config: {
86
+ ...defaults,
87
+ ...isRecord(item.config) ? item.config : {}
89
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
+ });
90
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
+ });
91
118
  const deriveFormResponseSlots = (config, prefix) => {
92
119
  if (!isRecord(config) || !Array.isArray(config.fieldGroups)) return {};
93
120
  const slots = {};
@@ -95,17 +122,17 @@ const deriveFormResponseSlots = (config, prefix) => {
95
122
  if (!Array.isArray(group.fields)) continue;
96
123
  for (const field of group.fields.filter(isRecord)) {
97
124
  if (typeof field.key !== "string" || field.key.length === 0) continue;
98
- slots[prefix ? `${prefix}.${field.key}` : field.key] = getFieldValueType(field);
125
+ slots[prefix ? `${prefix}.${field.key}` : field.key] = getFormFieldValueType(field);
99
126
  }
100
127
  }
101
128
  return slots;
102
129
  };
103
130
  const deriveChoiceResponseSlots = (item) => {
104
131
  const config = isRecord(item.config) ? item.config : {};
105
- const slots = { [typeof config.id === "string" && config.id.length > 0 ? config.id : item.id]: config.maxSelection === 1 ? ValueType.reference : ValueType.referenceArray };
132
+ const slots = { [typeof config.id === "string" && config.id.length > 0 ? config.id : item.id]: getChoiceResponseValueType(config.maxSelection === 1 ? 1 : null) };
106
133
  if (Array.isArray(config.options)) for (const option of config.options.filter(isRecord)) {
107
134
  if (typeof option.id !== "string" || !option.embeddedForm) continue;
108
- Object.assign(slots, deriveFormResponseSlots(option.embeddedForm, `embedded.${option.id}`));
135
+ Object.assign(slots, deriveFormResponseSlots(option.embeddedForm, getChoiceOptionEmbeddedFormResponseSlotPrefix(option.id)));
109
136
  }
110
137
  return slots;
111
138
  };
@@ -164,7 +191,8 @@ const groupItemAssistantCapability = {
164
191
  }],
165
192
  referenceTopics: ["survey-data-model", "item-types"]
166
193
  }),
167
- references: [STRUCTURE_REFERENCE]
194
+ references: [STRUCTURE_REFERENCE],
195
+ normalizeCreate: materializeGroupCreate
168
196
  };
169
197
  const pageBreakItemAssistantCapability = {
170
198
  manifest: createManifest({
@@ -187,7 +215,8 @@ const pageBreakItemAssistantCapability = {
187
215
  }],
188
216
  referenceTopics: ["survey-data-model", "item-types"]
189
217
  }),
190
- references: [STRUCTURE_REFERENCE]
218
+ references: [STRUCTURE_REFERENCE],
219
+ normalizeCreate: materializeEmptyConfigCreate
191
220
  };
192
221
  const infoItemAssistantCapability = {
193
222
  manifest: createManifest({
@@ -216,7 +245,8 @@ const infoItemAssistantCapability = {
216
245
  references: [{
217
246
  topic: "rich-text-content",
218
247
  markdown: "Info content uses the rich `content` surface. Markdown strings are not parsed; send structured rich text when formatting matters."
219
- }]
248
+ }],
249
+ normalizeCreate: materializeEmptyConfigCreate
220
250
  };
221
251
  const choiceItemAssistantCapability = {
222
252
  manifest: createManifest({
@@ -294,7 +324,7 @@ const choiceItemAssistantCapability = {
294
324
  }
295
325
  }),
296
326
  references: [QUESTION_REFERENCE],
297
- normalizeCreate: normalizeEmbeddedFormAuthoringModes,
327
+ normalizeCreate: materializeChoiceCreate,
298
328
  validateItem: (item) => {
299
329
  if (!isRecord(item.config) || !Array.isArray(item.config.options)) return [];
300
330
  return item.config.options.flatMap((option) => isRecord(option) && isRecord(option.embeddedForm) ? getSimpleFormValidationIssues(option.embeddedForm, "An embedded form") : []);
@@ -361,10 +391,7 @@ const formItemAssistantCapability = {
361
391
  }
362
392
  }),
363
393
  references: [QUESTION_REFERENCE],
364
- normalizeCreate: (item) => ({
365
- ...item,
366
- config: normalizeFormAuthoringConfig(item.config) ?? item.config
367
- }),
394
+ normalizeCreate: materializeFormCreate,
368
395
  validateItem: (item) => getSimpleFormValidationIssues(item.config, "A formItem"),
369
396
  deriveResponseSlots: (item) => deriveFormResponseSlots(item.config)
370
397
  };
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-default.mjs","names":[],"sources":["../src/capabilities/default.ts"],"sourcesContent":["import type { AssistantContentSurface, AssistantItemTypeManifest } from \"../protocol\";\nimport { ValueType, type RawSurveyItem } from \"@case-framework/survey-core\";\nimport {\n createSurveyAssistantCapabilities,\n type AssistantItemCapabilityAdapter,\n} from \"../engine/capabilities\";\nimport { isValidSimpleFormConfig, normalizeFormAuthoringConfig } from \"../engine/form-authoring\";\n\nconst COMMON_OPERATIONS = [\n \"create-item\",\n \"update-item-key\",\n \"update-item-label\",\n \"update-item-color\",\n \"update-item-translation\",\n \"update-placed-image\",\n \"patch-item-config\",\n \"remove-item\",\n \"move-item\",\n \"survey-json-patch\",\n] satisfies AssistantItemTypeManifest[\"supportedOperations\"];\n\nconst QUESTION_CONTENT_SURFACES: AssistantContentSurface[] = [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n requiredOnCreate: true,\n aliases: [\"content\", \"label\", \"prompt\", \"question\", \"text\"],\n },\n {\n key: \"subtitle\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"subheading\", \"subtext\"],\n },\n {\n key: \"topContent\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"preContent\", \"preResponse\"],\n },\n {\n key: \"bottomContent\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"postContent\", \"postResponse\"],\n },\n {\n key: \"cardFooter\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"footer\"],\n },\n];\n\nconst FIELD_CONTENT_SURFACES: AssistantContentSurface[] = [\n \"label\",\n \"description\",\n \"error\",\n \"placeholder\",\n \"unit\",\n \"checkedLabel\",\n \"uncheckedLabel\",\n].map((key) => ({\n key: `fields.<fieldId>.${key}`,\n role: key === \"error\" ? \"validation\" : \"field\",\n format: \"rich\",\n pattern: true,\n}));\n\nconst createManifest = (\n manifest: Omit<AssistantItemTypeManifest, \"capabilityVersion\">,\n): AssistantItemTypeManifest => ({ capabilityVersion: \"1\", ...manifest });\n\nconst STRUCTURE_REFERENCE = {\n topic: \"item-types\",\n markdown:\n \"Groups are containers. Create a group without child ids, then create or move children through separate operations. Page breaks are standalone structural boundaries.\",\n};\nconst QUESTION_REFERENCE = {\n topic: \"item-types\",\n markdown:\n \"Question titles and supporting text are translations. Configuration stores response behavior; respondent-visible option and field labels use the declared dynamic content surfaces.\",\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getFieldValueType = (field: Record<string, unknown>): ValueType => {\n switch (field.type) {\n case \"number\":\n case \"slider\":\n return ValueType.number;\n case \"datepicker\":\n return ValueType.date;\n case \"switch\":\n return ValueType.boolean;\n default:\n return ValueType.string;\n }\n};\n\nconst deriveFormResponseSlots = (config: unknown, prefix?: string): Record<string, ValueType> => {\n if (!isRecord(config) || !Array.isArray(config.fieldGroups)) {\n return {};\n }\n\n const slots: Record<string, ValueType> = {};\n for (const group of config.fieldGroups.filter(isRecord)) {\n if (!Array.isArray(group.fields)) continue;\n for (const field of group.fields.filter(isRecord)) {\n if (typeof field.key !== \"string\" || field.key.length === 0) continue;\n slots[prefix ? `${prefix}.${field.key}` : field.key] = getFieldValueType(field);\n }\n }\n return slots;\n};\n\nconst deriveChoiceResponseSlots = (item: RawSurveyItem): Record<string, ValueType> => {\n const config = isRecord(item.config) ? item.config : {};\n const responseId = typeof config.id === \"string\" && config.id.length > 0 ? config.id : item.id;\n const slots: Record<string, ValueType> = {\n [responseId]: config.maxSelection === 1 ? ValueType.reference : ValueType.referenceArray,\n };\n\n if (Array.isArray(config.options)) {\n for (const option of config.options.filter(isRecord)) {\n if (typeof option.id !== \"string\" || !option.embeddedForm) continue;\n Object.assign(slots, deriveFormResponseSlots(option.embeddedForm, `embedded.${option.id}`));\n }\n }\n return slots;\n};\n\nconst normalizeEmbeddedFormAuthoringModes = (item: RawSurveyItem): RawSurveyItem => {\n if (!isRecord(item.config) || !Array.isArray(item.config.options)) {\n return item;\n }\n\n return {\n ...item,\n config: {\n ...item.config,\n options: item.config.options.map((option) => {\n if (!isRecord(option) || !isRecord(option.embeddedForm)) {\n return option;\n }\n return {\n ...option,\n embeddedForm: normalizeFormAuthoringConfig(option.embeddedForm),\n };\n }),\n },\n };\n};\n\nconst getSimpleFormValidationIssues = (config: unknown, subject: string) =>\n isValidSimpleFormConfig(config)\n ? []\n : [\n {\n severity: \"error\" as const,\n code: \"invalid-simple-form-structure\",\n 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.`,\n },\n ];\n\nexport const rootItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"root\",\n displayName: \"Survey root\",\n description: \"The existing root container. A second root cannot be created.\",\n create: \"unsupported\",\n supportedOperations: [\"update-item-key\", \"update-item-label\", \"update-item-color\"],\n contentSurfaces: [],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n};\n\nexport const groupItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"group\",\n displayName: \"Group\",\n description: \"A structural container whose children are created as separate items.\",\n defaultItemKeyPrefix: \"group\",\n create: \"deterministic\",\n supportedOperations: [...COMMON_OPERATIONS, \"reorder-items\"],\n contentSurfaces: [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n aliases: [\"content\", \"label\", \"name\", \"text\"],\n },\n ],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n references: [STRUCTURE_REFERENCE],\n};\n\nexport const pageBreakItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"page-break\",\n displayName: \"Page break\",\n description: \"A structural page boundary.\",\n defaultItemKeyPrefix: \"page\",\n create: \"deterministic\",\n supportedOperations: COMMON_OPERATIONS,\n contentSurfaces: [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n aliases: [\"content\", \"label\", \"name\", \"text\"],\n },\n ],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n references: [STRUCTURE_REFERENCE],\n};\n\nexport const infoItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"infoItem\",\n displayName: \"Info\",\n description: \"Display-only formatted content without a response slot.\",\n defaultItemKeyPrefix: \"info\",\n create: \"deterministic\",\n supportedOperations: COMMON_OPERATIONS,\n contentSurfaces: [\n {\n key: \"content\",\n role: \"primary\",\n format: \"rich\",\n requiredOnCreate: true,\n aliases: [\"body\", \"label\", \"prompt\", \"question\", \"text\", \"title\"],\n },\n ],\n referenceTopics: [\"item-types\", \"rich-text-content\"],\n }),\n references: [\n {\n topic: \"rich-text-content\",\n markdown:\n \"Info content uses the rich `content` surface. Markdown strings are not parsed; send structured rich text when formatting matters.\",\n },\n ],\n};\n\nexport const choiceItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"choiceItem\",\n displayName: \"Choice question\",\n description: \"A single- or multiple-choice question with optional embedded forms.\",\n defaultItemKeyPrefix: \"choice\",\n create: \"deterministic\",\n supportedOperations: [\n ...COMMON_OPERATIONS,\n \"add-choice-option\",\n \"update-choice-option-label\",\n \"remove-choice-option\",\n \"reorder-choice-options\",\n \"upsert-form-field-group\",\n \"remove-form-field-group\",\n \"reorder-form-field-groups\",\n \"upsert-form-field\",\n \"remove-form-field\",\n \"move-form-field\",\n \"set-embedded-form\",\n \"remove-embedded-form\",\n ],\n contentSurfaces: [\n ...QUESTION_CONTENT_SURFACES,\n {\n key: \"options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n ...FIELD_CONTENT_SURFACES.map((surface) => ({\n ...surface,\n key: `embeddedForms.<optionId>.${surface.key}`,\n })),\n {\n key: \"embeddedForms.<optionId>.fields.<fieldId>.options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fields.<fieldId>.validations.<validationId>.message\",\n role: \"validation\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fieldGroups.<groupId>.title\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fieldGroups.<groupId>.description\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n ],\n responseSlots: [{ key: \"<responseId>\", valueType: \"reference|referenceArray\" }],\n referenceTopics: [\n \"item-types\",\n \"embedded-forms\",\n \"localization\",\n \"expressions\",\n \"rich-text-content\",\n ],\n authoring: {\n compactHint:\n \"presets choice.single=maxSelection 1; choice.multiple=maxSelection null; embedded one supported field=simple; embedded blank/structured=custom\",\n configSummary:\n \"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.\",\n },\n }),\n references: [QUESTION_REFERENCE],\n normalizeCreate: normalizeEmbeddedFormAuthoringModes,\n validateItem: (item) => {\n if (!isRecord(item.config) || !Array.isArray(item.config.options)) {\n return [];\n }\n return item.config.options.flatMap((option) =>\n isRecord(option) && isRecord(option.embeddedForm)\n ? getSimpleFormValidationIssues(option.embeddedForm, \"An embedded form\")\n : [],\n );\n },\n deriveResponseSlots: deriveChoiceResponseSlots,\n};\n\nexport const formItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"formItem\",\n displayName: \"Form\",\n description: \"A form with groups, typed fields, validations, and select options.\",\n defaultItemKeyPrefix: \"form\",\n create: \"deterministic\",\n supportedOperations: [\n ...COMMON_OPERATIONS,\n \"upsert-form-field-group\",\n \"remove-form-field-group\",\n \"reorder-form-field-groups\",\n \"upsert-form-field\",\n \"remove-form-field\",\n \"move-form-field\",\n ],\n contentSurfaces: [\n ...QUESTION_CONTENT_SURFACES,\n {\n key: \"fieldGroups.<groupId>.title\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"fieldGroups.<groupId>.description\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n ...FIELD_CONTENT_SURFACES,\n {\n key: \"fields.<fieldId>.options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"fields.<fieldId>.validations.<validationId>.message\",\n role: \"validation\",\n format: \"rich\",\n pattern: true,\n },\n ],\n responseSlots: [{ key: \"<fieldKey>\", valueType: \"field-dependent\" }],\n referenceTopics: [\"item-types\", \"localization\", \"expressions\", \"rich-text-content\"],\n authoring: {\n compactHint:\n \"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\",\n configSummary:\n '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.',\n },\n }),\n references: [QUESTION_REFERENCE],\n normalizeCreate: (item) => ({\n ...item,\n config: normalizeFormAuthoringConfig(item.config) ?? item.config,\n }),\n validateItem: (item) => getSimpleFormValidationIssues(item.config, \"A formItem\"),\n deriveResponseSlots: (item) => deriveFormResponseSlots(item.config),\n};\n\nexport const defaultSurveyAssistantCapabilities = [\n rootItemAssistantCapability,\n groupItemAssistantCapability,\n pageBreakItemAssistantCapability,\n infoItemAssistantCapability,\n choiceItemAssistantCapability,\n formItemAssistantCapability,\n] as const;\n\nexport const defaultSurveyAssistantCapabilitySet = createSurveyAssistantCapabilities(\n defaultSurveyAssistantCapabilities,\n);\n\nexport const getDefaultSurveyAssistantCapability = (\n itemType: string,\n): AssistantItemCapabilityAdapter | undefined =>\n defaultSurveyAssistantCapabilitySet.byItemType.get(itemType);\n"],"mappings":";;;AAQA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,4BAAuD;CAC3D;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,kBAAkB;EAClB,SAAS;GAAC;GAAW;GAAS;GAAU;GAAY;GAAO;EAC5D;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,cAAc,UAAU;EACnC;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,cAAc,cAAc;EACvC;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,eAAe,eAAe;EACzC;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,SAAS;EACpB;CACF;AAED,MAAM,yBAAoD;CACxD;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,KAAK,SAAS;CACd,KAAK,oBAAoB;CACzB,MAAM,QAAQ,UAAU,eAAe;CACvC,QAAQ;CACR,SAAS;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
1
+ {"version":3,"file":"capabilities-default.mjs","names":[],"sources":["../src/capabilities/default.ts"],"sourcesContent":["import type { AssistantContentSurface, AssistantItemTypeManifest } from \"../protocol\";\nimport { ValueType, type RawSurveyItem } from \"@case-framework/survey-core\";\nimport {\n createChoiceItemConfig,\n getChoiceOptionEmbeddedFormResponseSlotPrefix,\n getChoiceResponseValueType,\n} from \"@case-framework/survey-items/choice\";\nimport {\n createSurveyAssistantCapabilities,\n type AssistantItemCapabilityAdapter,\n} from \"../engine/capabilities\";\nimport {\n createFormItemConfig,\n getFormFieldValueType,\n isValidSimpleFormConfig,\n normalizeFormAuthoringConfig,\n} from \"@case-framework/survey-items/form\";\n\nconst COMMON_OPERATIONS = [\n \"create-item\",\n \"update-item-key\",\n \"update-item-label\",\n \"update-item-color\",\n \"update-item-translation\",\n \"update-placed-image\",\n \"patch-item-config\",\n \"remove-item\",\n \"move-item\",\n \"survey-json-patch\",\n] satisfies AssistantItemTypeManifest[\"supportedOperations\"];\n\nconst QUESTION_CONTENT_SURFACES: AssistantContentSurface[] = [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n requiredOnCreate: true,\n aliases: [\"content\", \"label\", \"prompt\", \"question\", \"text\"],\n },\n {\n key: \"subtitle\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"subheading\", \"subtext\"],\n },\n {\n key: \"topContent\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"preContent\", \"preResponse\"],\n },\n {\n key: \"bottomContent\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"postContent\", \"postResponse\"],\n },\n {\n key: \"cardFooter\",\n role: \"secondary\",\n format: \"rich\",\n aliases: [\"footer\"],\n },\n];\n\nconst FIELD_CONTENT_SURFACES: AssistantContentSurface[] = [\n \"label\",\n \"description\",\n \"error\",\n \"placeholder\",\n \"unit\",\n \"checkedLabel\",\n \"uncheckedLabel\",\n].map((key) => ({\n key: `fields.<fieldId>.${key}`,\n role: key === \"error\" ? \"validation\" : \"field\",\n format: \"rich\",\n pattern: true,\n}));\n\nconst createManifest = (\n manifest: Omit<AssistantItemTypeManifest, \"capabilityVersion\">,\n): AssistantItemTypeManifest => ({ capabilityVersion: \"1\", ...manifest });\n\nconst STRUCTURE_REFERENCE = {\n topic: \"item-types\",\n markdown:\n \"Groups are containers. Create a group without child ids, then create or move children through separate operations. Page breaks are standalone structural boundaries.\",\n};\nconst QUESTION_REFERENCE = {\n topic: \"item-types\",\n markdown:\n \"Question titles and supporting text are translations. Configuration stores response behavior; respondent-visible option and field labels use the declared dynamic content surfaces.\",\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst withMaterializedConfig = (\n item: RawSurveyItem,\n defaults: Record<string, unknown>,\n): RawSurveyItem => ({\n ...item,\n config: {\n ...defaults,\n ...(isRecord(item.config) ? item.config : {}),\n },\n});\n\nconst materializeGroupCreate = (item: RawSurveyItem): RawSurveyItem =>\n withMaterializedConfig(item, { items: [], shuffleItems: false });\n\nconst materializeEmptyConfigCreate = (item: RawSurveyItem): RawSurveyItem =>\n withMaterializedConfig(item, {});\n\nconst materializeChoiceCreate = (item: RawSurveyItem): RawSurveyItem => {\n const config = isRecord(item.config) ? item.config : {};\n const defaults = createChoiceItemConfig(item.id);\n\n return normalizeEmbeddedFormAuthoringModes({\n ...item,\n config: {\n ...defaults,\n ...config,\n id: item.id,\n maxSelection: \"maxSelection\" in config ? config.maxSelection : defaults.maxSelection,\n shuffleOptions: \"shuffleOptions\" in config ? config.shuffleOptions : defaults.shuffleOptions,\n options: Array.isArray(config.options) ? config.options : defaults.options,\n },\n });\n};\n\nconst materializeFormCreate = (item: RawSurveyItem): RawSurveyItem => ({\n ...item,\n config: normalizeFormAuthoringConfig({\n ...createFormItemConfig(item.id),\n ...(isRecord(item.config) ? item.config : {}),\n id: item.id,\n }),\n});\n\nconst deriveFormResponseSlots = (config: unknown, prefix?: string): Record<string, ValueType> => {\n if (!isRecord(config) || !Array.isArray(config.fieldGroups)) {\n return {};\n }\n\n const slots: Record<string, ValueType> = {};\n for (const group of config.fieldGroups.filter(isRecord)) {\n if (!Array.isArray(group.fields)) continue;\n for (const field of group.fields.filter(isRecord)) {\n if (typeof field.key !== \"string\" || field.key.length === 0) continue;\n slots[prefix ? `${prefix}.${field.key}` : field.key] = getFormFieldValueType(field);\n }\n }\n return slots;\n};\n\nconst deriveChoiceResponseSlots = (item: RawSurveyItem): Record<string, ValueType> => {\n const config = isRecord(item.config) ? item.config : {};\n const responseId = typeof config.id === \"string\" && config.id.length > 0 ? config.id : item.id;\n const slots: Record<string, ValueType> = {\n [responseId]: getChoiceResponseValueType(config.maxSelection === 1 ? 1 : null),\n };\n\n if (Array.isArray(config.options)) {\n for (const option of config.options.filter(isRecord)) {\n if (typeof option.id !== \"string\" || !option.embeddedForm) continue;\n Object.assign(\n slots,\n deriveFormResponseSlots(\n option.embeddedForm,\n getChoiceOptionEmbeddedFormResponseSlotPrefix(option.id),\n ),\n );\n }\n }\n return slots;\n};\n\nconst normalizeEmbeddedFormAuthoringModes = (item: RawSurveyItem): RawSurveyItem => {\n if (!isRecord(item.config) || !Array.isArray(item.config.options)) {\n return item;\n }\n\n return {\n ...item,\n config: {\n ...item.config,\n options: item.config.options.map((option) => {\n if (!isRecord(option) || !isRecord(option.embeddedForm)) {\n return option;\n }\n return {\n ...option,\n embeddedForm: normalizeFormAuthoringConfig(option.embeddedForm),\n };\n }),\n },\n };\n};\n\nconst getSimpleFormValidationIssues = (config: unknown, subject: string) =>\n isValidSimpleFormConfig(config)\n ? []\n : [\n {\n severity: \"error\" as const,\n code: \"invalid-simple-form-structure\",\n 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.`,\n },\n ];\n\nexport const rootItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"root\",\n displayName: \"Survey root\",\n description: \"The existing root container. A second root cannot be created.\",\n create: \"unsupported\",\n supportedOperations: [\"update-item-key\", \"update-item-label\", \"update-item-color\"],\n contentSurfaces: [],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n};\n\nexport const groupItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"group\",\n displayName: \"Group\",\n description: \"A structural container whose children are created as separate items.\",\n defaultItemKeyPrefix: \"group\",\n create: \"deterministic\",\n supportedOperations: [...COMMON_OPERATIONS, \"reorder-items\"],\n contentSurfaces: [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n aliases: [\"content\", \"label\", \"name\", \"text\"],\n },\n ],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n references: [STRUCTURE_REFERENCE],\n normalizeCreate: materializeGroupCreate,\n};\n\nexport const pageBreakItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"page-break\",\n displayName: \"Page break\",\n description: \"A structural page boundary.\",\n defaultItemKeyPrefix: \"page\",\n create: \"deterministic\",\n supportedOperations: COMMON_OPERATIONS,\n contentSurfaces: [\n {\n key: \"title\",\n role: \"primary\",\n format: \"rich\",\n aliases: [\"content\", \"label\", \"name\", \"text\"],\n },\n ],\n referenceTopics: [\"survey-data-model\", \"item-types\"],\n }),\n references: [STRUCTURE_REFERENCE],\n normalizeCreate: materializeEmptyConfigCreate,\n};\n\nexport const infoItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"infoItem\",\n displayName: \"Info\",\n description: \"Display-only formatted content without a response slot.\",\n defaultItemKeyPrefix: \"info\",\n create: \"deterministic\",\n supportedOperations: COMMON_OPERATIONS,\n contentSurfaces: [\n {\n key: \"content\",\n role: \"primary\",\n format: \"rich\",\n requiredOnCreate: true,\n aliases: [\"body\", \"label\", \"prompt\", \"question\", \"text\", \"title\"],\n },\n ],\n referenceTopics: [\"item-types\", \"rich-text-content\"],\n }),\n references: [\n {\n topic: \"rich-text-content\",\n markdown:\n \"Info content uses the rich `content` surface. Markdown strings are not parsed; send structured rich text when formatting matters.\",\n },\n ],\n normalizeCreate: materializeEmptyConfigCreate,\n};\n\nexport const choiceItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"choiceItem\",\n displayName: \"Choice question\",\n description: \"A single- or multiple-choice question with optional embedded forms.\",\n defaultItemKeyPrefix: \"choice\",\n create: \"deterministic\",\n supportedOperations: [\n ...COMMON_OPERATIONS,\n \"add-choice-option\",\n \"update-choice-option-label\",\n \"remove-choice-option\",\n \"reorder-choice-options\",\n \"upsert-form-field-group\",\n \"remove-form-field-group\",\n \"reorder-form-field-groups\",\n \"upsert-form-field\",\n \"remove-form-field\",\n \"move-form-field\",\n \"set-embedded-form\",\n \"remove-embedded-form\",\n ],\n contentSurfaces: [\n ...QUESTION_CONTENT_SURFACES,\n {\n key: \"options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n ...FIELD_CONTENT_SURFACES.map((surface) => ({\n ...surface,\n key: `embeddedForms.<optionId>.${surface.key}`,\n })),\n {\n key: \"embeddedForms.<optionId>.fields.<fieldId>.options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fields.<fieldId>.validations.<validationId>.message\",\n role: \"validation\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fieldGroups.<groupId>.title\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"embeddedForms.<optionId>.fieldGroups.<groupId>.description\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n ],\n responseSlots: [{ key: \"<responseId>\", valueType: \"reference|referenceArray\" }],\n referenceTopics: [\n \"item-types\",\n \"embedded-forms\",\n \"localization\",\n \"expressions\",\n \"rich-text-content\",\n ],\n authoring: {\n compactHint:\n \"presets choice.single=maxSelection 1; choice.multiple=maxSelection null; embedded one supported field=simple; embedded blank/structured=custom\",\n configSummary:\n \"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.\",\n },\n }),\n references: [QUESTION_REFERENCE],\n normalizeCreate: materializeChoiceCreate,\n validateItem: (item) => {\n if (!isRecord(item.config) || !Array.isArray(item.config.options)) {\n return [];\n }\n return item.config.options.flatMap((option) =>\n isRecord(option) && isRecord(option.embeddedForm)\n ? getSimpleFormValidationIssues(option.embeddedForm, \"An embedded form\")\n : [],\n );\n },\n deriveResponseSlots: deriveChoiceResponseSlots,\n};\n\nexport const formItemAssistantCapability: AssistantItemCapabilityAdapter = {\n manifest: createManifest({\n itemType: \"formItem\",\n displayName: \"Form\",\n description: \"A form with groups, typed fields, validations, and select options.\",\n defaultItemKeyPrefix: \"form\",\n create: \"deterministic\",\n supportedOperations: [\n ...COMMON_OPERATIONS,\n \"upsert-form-field-group\",\n \"remove-form-field-group\",\n \"reorder-form-field-groups\",\n \"upsert-form-field\",\n \"remove-form-field\",\n \"move-form-field\",\n ],\n contentSurfaces: [\n ...QUESTION_CONTENT_SURFACES,\n {\n key: \"fieldGroups.<groupId>.title\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"fieldGroups.<groupId>.description\",\n role: \"field\",\n format: \"rich\",\n pattern: true,\n },\n ...FIELD_CONTENT_SURFACES,\n {\n key: \"fields.<fieldId>.options.<optionId>.label\",\n role: \"option\",\n format: \"rich\",\n pattern: true,\n },\n {\n key: \"fields.<fieldId>.validations.<validationId>.message\",\n role: \"validation\",\n format: \"rich\",\n pattern: true,\n },\n ],\n responseSlots: [{ key: \"<fieldKey>\", valueType: \"field-dependent\" }],\n referenceTopics: [\"item-types\", \"localization\", \"expressions\", \"rich-text-content\"],\n authoring: {\n compactHint:\n \"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\",\n configSummary:\n '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.',\n },\n }),\n references: [QUESTION_REFERENCE],\n normalizeCreate: materializeFormCreate,\n validateItem: (item) => getSimpleFormValidationIssues(item.config, \"A formItem\"),\n deriveResponseSlots: (item) => deriveFormResponseSlots(item.config),\n};\n\nexport const defaultSurveyAssistantCapabilities = [\n rootItemAssistantCapability,\n groupItemAssistantCapability,\n pageBreakItemAssistantCapability,\n infoItemAssistantCapability,\n choiceItemAssistantCapability,\n formItemAssistantCapability,\n] as const;\n\nexport const defaultSurveyAssistantCapabilitySet = createSurveyAssistantCapabilities(\n defaultSurveyAssistantCapabilities,\n);\n\nexport const getDefaultSurveyAssistantCapability = (\n itemType: string,\n): AssistantItemCapabilityAdapter | undefined =>\n defaultSurveyAssistantCapabilitySet.byItemType.get(itemType);\n"],"mappings":";;;;AAkBA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,4BAAuD;CAC3D;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,kBAAkB;EAClB,SAAS;GAAC;GAAW;GAAS;GAAU;GAAY;GAAO;EAC5D;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,cAAc,UAAU;EACnC;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,cAAc,cAAc;EACvC;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;EACR,SAAS,CAAC,eAAe,eAAe;EACzC;CACD;EACE,KAAK;EAC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;CACtB;AAED,MAAa,8BAA8D;CACzE,UAAU,eAAe;EACvB,UAAU;EACV,aAAa;EACb,aAAa;EACb,sBAAsB;EACtB,QAAQ;EACR,qBAAqB;GACnB,GAAG;GACH;GACA;GACA;GACA;GACA;GACA;GACD;EACD,iBAAiB;GACf,GAAG;GACH;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACD,GAAG;GACH;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACF;EACD,eAAe,CAAC;GAAE,KAAK;GAAc,WAAW;GAAmB,CAAC;EACpE,iBAAiB;GAAC;GAAc;GAAgB;GAAe;GAAoB;EACnF,WAAW;GACT,aACE;GACF,eACE;GACH;EACF,CAAC;CACF,YAAY,CAAC,mBAAmB;CAChC,iBAAiB;CACjB,eAAe,SAAS,8BAA8B,KAAK,QAAQ,aAAa;CAChF,sBAAsB,SAAS,wBAAwB,KAAK,OAAO;CACpE;AAED,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,sCAAsC,kCACjD,mCACD;AAED,MAAa,uCACX,aAEA,oCAAoC,WAAW,IAAI,SAAS"}
@@ -4,4 +4,4 @@ const SURVEY_ASSISTANT_TASK_AGENT_ID = "survey-assistant-task-agent";
4
4
  //#endregion
5
5
  export { SURVEY_ASSISTANT_TASK_AGENT_ID as n, SURVEY_ASSISTANT_AGENT_ID as t };
6
6
 
7
- //# sourceMappingURL=constants-CFUWrRtl.mjs.map
7
+ //# sourceMappingURL=constants-0UHGFcRJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants-CFUWrRtl.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"}
1
+ {"version":3,"file":"constants-0UHGFcRJ.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"}
@@ -1,6 +1,6 @@
1
- import { Ct as SurveyDocumentSnapshot, o as SurveyAssistantApplyOutcome, wt as SurveyDocumentVersion } from "./lifecycle-DWv5CiSu.mjs";
2
- import { Ut as SurveyAssistantCapabilitySet, b as TurnSurveyDraft, kt as SurveyAssistantEngineContext } from "./index-Da_Hb9-1.mjs";
3
- import { n as SurveyAssistantModelAttachment, t as SurveyAssistantAttachmentAccess } from "./thread-documents-Dvo6XS7o.mjs";
1
+ import { Ct as SurveyDocumentSnapshot, o as SurveyAssistantApplyOutcome, wt as SurveyDocumentVersion } from "./lifecycle-Bx0aq_4S.mjs";
2
+ import { Nt as SurveyAssistantEngineContext, qt as SurveyAssistantCapabilitySet, x as TurnSurveyDraft } from "./index-Tnqv-yKW.mjs";
3
+ import { n as SurveyAssistantModelAttachment, t as SurveyAssistantAttachmentAccess } from "./thread-documents-rmd6nyX9.mjs";
4
4
  import { RequestContext } from "@mastra/core/request-context";
5
5
  import { AgentExecutionOptions } from "@mastra/core/agent";
6
6
  import { OpenAICompatibleConfig } from "@mastra/core/llm";
@@ -99,4 +99,4 @@ declare const SURVEY_ASSISTANT_AGENT_ID = "survey-assistant-agent";
99
99
  declare const SURVEY_ASSISTANT_TASK_AGENT_ID = "survey-assistant-task-agent";
100
100
  //#endregion
101
101
  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-DbrJxxOh.d.mts.map
102
+ //# sourceMappingURL=constants-Be91Gay9.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants-DbrJxxOh.d.mts","names":[],"sources":["../src/server/request-context.ts","../src/server/constants.ts"],"mappings":";;;;;;;;UA2BiB,gCAAA;EACf,IAAA;AAAA;AAAA,UAGe,8BAAA;EACf,SAAA;EACA,UAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,UAGe,6BAAA;EACf,EAAA;EACA,KAAA,WAAgB,sBAAA;EAChB,YAAA;EACA,eAAA,GAAkB,qBAAA;AAAA;AAAA,KAGR,iCAAA;EACN,MAAA;AAAA;EAEA,MAAA;EACA,oBAAA;EACA,mBAAA;AAAA;EAGA,MAAA;EACA,oBAAA;EACA,mBAAA;EACA,mBAAA;AAAA;EAGA,MAAA;EACA,oBAAA;EACA,mBAAA;EACA,gBAAA;EACA,eAAA,EAAiB,KAAA;EACjB,mBAAA;AAAA;AAAA,UAGW,6BAAA;EACf,UAAA,EAAY,gCAAA;EACZ,MAAA;EACA,SAAA,EAAW,eAAA;EACX,QAAA,EAAU,8BAAA;EACV,uBAAA;EACA,kBAAA;EACA,WAAA;EACA,kBAAA;EACA,gBAAA;EACA,kBAAA,GAAqB,iCAAA;EACrB,aAAA,GAAgB,4BAAA;EAChB,gBAAA,GAAmB,sBAAA;EACnB,gBAAA,GAAmB,8BAAA;EACnB,gBAAA,GAAmB,+BAAA;EACnB,cAAA,GAAiB,6BAAA;EACjB,oBAAA,GAAuB,2BAAA;AAAA;AAAA,cAGZ,4BAAA,GAAgC,KAAA,cAAiB,sBAAA;AAAA,cAQjD,0CAAA,GACX,KAAA,cACC,qBAAA;AAAA,cAQU,wCAAA,GACX,KAAA,cACC,2BAAA;AAAA,cAQU,uCAAA;EAA2C,OAAA;EAAA;AAAA;EAItD,OAAA,EAAS,sBAAA;EACT,QAAA,EAAU,qBAAA;AAAA,MACR,iCAAA;AAAA,cAqDS,kCAAA;EAAsC,SAAA;EAAA,QAAA;EAAA,QAAA;EAAA,sBAAA;EAAA,mBAAA;EAAA,gBAAA;EAAA,gBAAA;EAAA,cAAA;EAAA;AAAA;EAWjD,SAAA,EAAW,eAAA;EACX,QAAA,EAAU,8BAAA;EACV,QAAA,EAAU,sBAAA;EACV,sBAAA,GAAyB,qBAAA;EACzB,mBAAA,GAAsB,4BAAA;EACtB,gBAAA,GAAmB,+BAAA;EACnB,gBAAA,GAAmB,8BAAA;EACnB,cAAA,GAAiB,6BAAA;EACjB,oBAAA,GAAuB,2BAAA;AAAA,MACrB,cAAA,CAAe,6BAAA;AAAA,cAuDN,+BAAA,GACX,cAAA,EAAgB,cAAA,CAAe,6BAAA;;;;;;cCzPpB,yBAAA;AAAA,cACA,8BAAA"}
1
+ {"version":3,"file":"constants-Be91Gay9.d.mts","names":[],"sources":["../src/server/request-context.ts","../src/server/constants.ts"],"mappings":";;;;;;;;UA2BiB,gCAAA;EACf,IAAA;AAAA;AAAA,UAGe,8BAAA;EACf,SAAA;EACA,UAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,UAGe,6BAAA;EACf,EAAA;EACA,KAAA,WAAgB,sBAAA;EAChB,YAAA;EACA,eAAA,GAAkB,qBAAA;AAAA;AAAA,KAGR,iCAAA;EACN,MAAA;AAAA;EAEA,MAAA;EACA,oBAAA;EACA,mBAAA;AAAA;EAGA,MAAA;EACA,oBAAA;EACA,mBAAA;EACA,mBAAA;AAAA;EAGA,MAAA;EACA,oBAAA;EACA,mBAAA;EACA,gBAAA;EACA,eAAA,EAAiB,KAAA;EACjB,mBAAA;AAAA;AAAA,UAGW,6BAAA;EACf,UAAA,EAAY,gCAAA;EACZ,MAAA;EAC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