@case-framework/survey-assistant 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +8 -0
  2. package/dist/attachments-B0hg3vpT.mjs +11 -0
  3. package/dist/attachments-B0hg3vpT.mjs.map +1 -0
  4. package/dist/authoring-references-CW38pYzK.mjs +115 -0
  5. package/dist/authoring-references-CW38pYzK.mjs.map +1 -0
  6. package/dist/{capabilities-CnsVuJ1k.d.mts → capabilities-DVTfogjv.d.mts} +1 -1
  7. package/dist/{capabilities-CnsVuJ1k.d.mts.map → capabilities-DVTfogjv.d.mts.map} +1 -1
  8. package/dist/capabilities-default.d.mts +1 -1
  9. package/dist/capabilities-default.d.mts.map +1 -1
  10. package/dist/capabilities-default.mjs +39 -9
  11. package/dist/capabilities-default.mjs.map +1 -1
  12. package/dist/{constants-CFUWrRtl.mjs → constants-0UHGFcRJ.mjs} +1 -1
  13. package/dist/{constants-CFUWrRtl.mjs.map → constants-0UHGFcRJ.mjs.map} +1 -1
  14. package/dist/{constants-k1b_evIb.d.mts → constants-BMGTgfjv.d.mts} +4 -4
  15. package/dist/{constants-k1b_evIb.d.mts.map → constants-BMGTgfjv.d.mts.map} +1 -1
  16. package/dist/{controller-proxy-jWIPOZAv.mjs → controller-proxy-DMTqer6T.mjs} +1 -1
  17. package/dist/{controller-proxy-jWIPOZAv.mjs.map → controller-proxy-DMTqer6T.mjs.map} +1 -1
  18. package/dist/{controller-proxy-quQjtA7j.d.mts → controller-proxy-mRvez2qw.d.mts} +3 -3
  19. package/dist/{controller-proxy-quQjtA7j.d.mts.map → controller-proxy-mRvez2qw.d.mts.map} +1 -1
  20. package/dist/{digest-Dyjch_sC.d.mts → digest-SJmoYVaK.d.mts} +2 -2
  21. package/dist/{digest-Dyjch_sC.d.mts.map → digest-SJmoYVaK.d.mts.map} +1 -1
  22. package/dist/digest.d.mts +1 -1
  23. package/dist/{engine-BvfUx_Jx.mjs → engine-CQwOAcwK.mjs} +167 -24
  24. package/dist/engine-CQwOAcwK.mjs.map +1 -0
  25. package/dist/engine.d.mts +3 -3
  26. package/dist/engine.mjs +3 -3
  27. package/dist/{fair-guidance-CEdJYccK.mjs → fair-guidance-CRYCRxQm.mjs} +1 -1
  28. package/dist/{fair-guidance-CEdJYccK.mjs.map → fair-guidance-CRYCRxQm.mjs.map} +1 -1
  29. package/dist/{form-authoring-BQh40yDb.mjs → form-authoring-kQDgC5oz.mjs} +1 -1
  30. package/dist/{form-authoring-BQh40yDb.mjs.map → form-authoring-kQDgC5oz.mjs.map} +1 -1
  31. package/dist/{index-biZnRl-h.d.mts → index-B0lxsAzx.d.mts} +10 -6
  32. package/dist/index-B0lxsAzx.d.mts.map +1 -0
  33. package/dist/{index-BDp6S7r9.d.mts → index-BS-Xjk1h.d.mts} +4 -4
  34. package/dist/{index-BDp6S7r9.d.mts.map → index-BS-Xjk1h.d.mts.map} +1 -1
  35. package/dist/{index-r8HVcn5b.d.mts → index-D6nqkz0O.d.mts} +49 -8
  36. package/dist/{index-r8HVcn5b.d.mts.map → index-D6nqkz0O.d.mts.map} +1 -1
  37. package/dist/{index-8x1Eqlnz.d.mts → index-DvTqML-0.d.mts} +10 -5
  38. package/dist/index-DvTqML-0.d.mts.map +1 -0
  39. package/dist/{lifecycle-DWv5CiSu.d.mts → lifecycle-BmGAIUlv.d.mts} +2 -2
  40. package/dist/{lifecycle-DWv5CiSu.d.mts.map → lifecycle-BmGAIUlv.d.mts.map} +1 -1
  41. package/dist/{memory-thread-repository-xBZOog_q.mjs → memory-thread-repository-CjFGVNZh.mjs} +44 -13
  42. package/dist/{memory-thread-repository-xBZOog_q.mjs.map → memory-thread-repository-CjFGVNZh.mjs.map} +1 -1
  43. package/dist/protocol.d.mts +4 -4
  44. package/dist/protocol.mjs +2 -1
  45. package/dist/{react-CY6N7lVi.mjs → react-Dqlmasrs.mjs} +2 -2
  46. package/dist/{react-CY6N7lVi.mjs.map → react-Dqlmasrs.mjs.map} +1 -1
  47. package/dist/react-integration.d.mts +1 -1
  48. package/dist/react-integration.mjs +1 -1
  49. package/dist/react.d.mts +2 -2
  50. package/dist/react.mjs +2 -2
  51. package/dist/{request-context-DixY5DYu.mjs → request-context-BjTHNcDd.mjs} +2 -2
  52. package/dist/{request-context-DixY5DYu.mjs.map → request-context-BjTHNcDd.mjs.map} +1 -1
  53. package/dist/{request-guardrails-h4t6u8mP.mjs → request-guardrails-TmgQtqp4.mjs} +5 -12
  54. package/dist/request-guardrails-TmgQtqp4.mjs.map +1 -0
  55. package/dist/server-agent.d.mts +9 -7
  56. package/dist/server-agent.d.mts.map +1 -1
  57. package/dist/server-agent.mjs +8 -6
  58. package/dist/server-agent.mjs.map +1 -1
  59. package/dist/server-runtime.d.mts +28 -14
  60. package/dist/server-runtime.d.mts.map +1 -1
  61. package/dist/server-runtime.mjs +47 -8
  62. package/dist/server-runtime.mjs.map +1 -1
  63. package/dist/server-tasks.d.mts +1 -1
  64. package/dist/server-tasks.mjs +4 -4
  65. package/dist/server-tools.d.mts +1 -1
  66. package/dist/server-tools.mjs +1 -1
  67. package/dist/server.d.mts +7 -7
  68. package/dist/server.mjs +6 -6
  69. package/dist/storage-postgres.d.mts +1 -1
  70. package/dist/storage-postgres.mjs +4 -1
  71. package/dist/storage-postgres.mjs.map +1 -1
  72. package/dist/{tasks-BWmTMXoK.d.mts → tasks-DxzD25Zc.d.mts} +16 -4
  73. package/dist/tasks-DxzD25Zc.d.mts.map +1 -0
  74. package/dist/{thread-documents-Dvo6XS7o.d.mts → thread-documents-rmd6nyX9.d.mts} +1 -1
  75. package/dist/{thread-documents-Dvo6XS7o.d.mts.map → thread-documents-rmd6nyX9.d.mts.map} +1 -1
  76. package/dist/{thread-handlers-D8gkLfU6.d.mts → thread-handlers-AbQbt4sX.d.mts} +13 -6
  77. package/dist/{thread-handlers-D8gkLfU6.d.mts.map → thread-handlers-AbQbt4sX.d.mts.map} +1 -1
  78. package/dist/{tools-TXI8bfzZ.mjs → tools-CFh35R4d.mjs} +14 -6
  79. package/dist/tools-CFh35R4d.mjs.map +1 -0
  80. package/dist/ui.css +1 -1
  81. package/dist/ui.d.mts +3 -3
  82. package/dist/ui.d.mts.map +1 -1
  83. package/dist/ui.mjs +198 -83
  84. package/dist/ui.mjs.map +1 -1
  85. package/docs/integration.md +37 -3
  86. package/package.json +2 -2
  87. package/dist/authoring-references-yyYC4Ydi.mjs +0 -98
  88. package/dist/authoring-references-yyYC4Ydi.mjs.map +0 -1
  89. package/dist/engine-BvfUx_Jx.mjs.map +0 -1
  90. package/dist/index-8x1Eqlnz.d.mts.map +0 -1
  91. package/dist/index-biZnRl-h.d.mts.map +0 -1
  92. package/dist/request-guardrails-h4t6u8mP.mjs.map +0 -1
  93. package/dist/tasks-BWmTMXoK.d.mts.map +0 -1
  94. package/dist/tools-TXI8bfzZ.mjs.map +0 -1
@@ -122,6 +122,40 @@ Only the active provider's secret is required. `SURVEY_ASSISTANT_ENABLED` is an
122
122
  optional operational override; provider, model, role, memory, request-limit, and
123
123
  execution policy remains document-owned.
124
124
 
125
+ #### Optional experimental-identity rollout gate
126
+
127
+ Importing hosts can pass `requireExperimentalIdentityOptIn: true` as a third
128
+ argument to either configuration parser:
129
+
130
+ ```ts
131
+ const config = parseSurveyAssistantConfigurationDocument(document, process.env, {
132
+ requireExperimentalIdentityOptIn: true,
133
+ });
134
+ ```
135
+
136
+ This adds a second, explicit production rollout gate. Outside development, an
137
+ otherwise enabled assistant then remains disabled until the deployment also
138
+ sets:
139
+
140
+ ```dotenv
141
+ SURVEY_ASSISTANT_ALLOW_EXPERIMENTAL_IDENTITY=true
142
+ ```
143
+
144
+ The environment variable alone does not enable the assistant. Enablement must
145
+ still be requested by `enabled: true` in the configuration document or by
146
+ `SURVEY_ASSISTANT_ENABLED=true`; an explicit
147
+ `SURVEY_ASSISTANT_ENABLED=false` still disables it. In development, the extra
148
+ opt-in is not required.
149
+
150
+ Despite its historical name, this option does not select, create, or authorize
151
+ an identity. Request identity and access remain controlled by the host's
152
+ authorization callbacks. A production host with a complete authenticated-host
153
+ integration should normally omit the parser option, unless it deliberately
154
+ wants this additional deployment switch. Use it when a host still exposes an
155
+ experimental client-request identity path, or when that extra production
156
+ rollout gate is desired. If the parser option is omitted (the default),
157
+ `SURVEY_ASSISTANT_ALLOW_EXPERIMENTAL_IDENTITY` has no effect.
158
+
125
159
  The shared option keys are `parallelToolCalls`, `reasoningEffort`,
126
160
  `reasoningSummary`, `promptCacheKey`, `promptCacheRetention`, `serviceTier`, and
127
161
  `textVerbosity`. Provider validation rejects known-incompatible combinations;
@@ -282,9 +316,9 @@ bounded lifecycle evidence, not an authorization input.
282
316
 
283
317
  ## Attachments
284
318
 
285
- Uploads remain enabled by default for PDF, GIF, JPEG, PNG, and WebP. The server
286
- checks request size, count, per-file and total bytes, filename controls, data
287
- URL/media-type agreement, and common file signatures before provider use.
319
+ Uploads remain enabled by default for PDF, JPEG, and PNG. The server checks
320
+ request size, count, per-file and total bytes, filename controls,
321
+ data URL/media-type agreement, and common file signatures before provider use.
288
322
 
289
323
  Passing `threadDocuments` enables persistence and safe replay in later turns.
290
324
  Passing `false` to the lifecycle means only persistence/replay is disabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@case-framework/survey-assistant",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Shared protocol, engine, and runtime for the CASE survey assistant.",
5
5
  "license": "ISC",
6
6
  "files": [
@@ -131,7 +131,7 @@
131
131
  "ai": "^7.0.52",
132
132
  "react": ">=19.2.0",
133
133
  "react-dom": ">=19.2.0",
134
- "@case-framework/survey-core": "0.6.2"
134
+ "@case-framework/survey-core": "^0.6.2"
135
135
  },
136
136
  "peerDependenciesMeta": {
137
137
  "@mastra/ai-sdk": {
@@ -1,98 +0,0 @@
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
- },
45
- "survey-data-model": {
46
- title: "Survey data model",
47
- content: loadReference("survey-data-model.md")
48
- },
49
- "source-material-surveys": {
50
- title: "Source-material survey implementation",
51
- content: loadReference("source-material-surveys.md")
52
- },
53
- localization: {
54
- title: "Survey localization",
55
- content: loadReference("localization.md")
56
- },
57
- "rich-text-content": {
58
- title: "Rich text content",
59
- content: loadReference("rich-text-content.md")
60
- },
61
- "item-types": {
62
- title: "Item types",
63
- content: loadReference("item-types.md")
64
- },
65
- "embedded-forms": {
66
- title: "Choice option embedded forms",
67
- content: loadReference("embedded-forms.md")
68
- },
69
- expressions: {
70
- title: "Expressions",
71
- content: loadReference("expressions.md")
72
- },
73
- "assistant-operations": {
74
- title: "Assistant operations",
75
- content: loadReference("assistant-operations.md")
76
- },
77
- "fair-by-design": {
78
- title: "FAIR-by-design survey authoring",
79
- content: loadReference("fair-by-design.md")
80
- },
81
- "survey-quality": {
82
- title: "Survey quality review",
83
- content: loadReference("survey-quality.md")
84
- }
85
- };
86
- const getBuiltInItemTypeAuthoringReference = (itemType) => {
87
- const heading = ITEM_TYPE_SECTION_HEADINGS[itemType];
88
- if (!heading) return;
89
- const content = extractLevelTwoSection(surveyAuthoringReferences["item-types"].content, heading);
90
- return content ? {
91
- title: `${heading} item type`,
92
- content
93
- } : void 0;
94
- };
95
- //#endregion
96
- export { surveyAuthoringReferences as i, getBuiltInItemTypeAuthoringReference as n, surveyAuthoringReferenceTopics as r, builtInSurveyAuthoringItemTypes as t };
97
-
98
- //# sourceMappingURL=authoring-references-yyYC4Ydi.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-references-yyYC4Ydi.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\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 },\n \"survey-data-model\": {\n title: \"Survey data model\",\n content: loadReference(\"survey-data-model.md\"),\n },\n \"source-material-surveys\": {\n title: \"Source-material survey implementation\",\n content: loadReference(\"source-material-surveys.md\"),\n },\n localization: {\n title: \"Survey localization\",\n content: loadReference(\"localization.md\"),\n },\n \"rich-text-content\": {\n title: \"Rich text content\",\n content: loadReference(\"rich-text-content.md\"),\n },\n \"item-types\": {\n title: \"Item types\",\n content: loadReference(\"item-types.md\"),\n },\n \"embedded-forms\": {\n title: \"Choice option embedded forms\",\n content: loadReference(\"embedded-forms.md\"),\n },\n expressions: {\n title: \"Expressions\",\n content: loadReference(\"expressions.md\"),\n },\n \"assistant-operations\": {\n title: \"Assistant operations\",\n content: loadReference(\"assistant-operations.md\"),\n },\n \"fair-by-design\": {\n title: \"FAIR-by-design survey authoring\",\n content: loadReference(\"fair-by-design.md\"),\n },\n \"survey-quality\": {\n title: \"Survey quality review\",\n content: loadReference(\"survey-quality.md\"),\n },\n} as const satisfies Record<SurveyAuthoringReferenceTopic, { title: string; content: string }>;\n\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;AAID,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;EACxC;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC/C;CACD,2BAA2B;EACzB,OAAO;EACP,SAAS,cAAc,6BAA6B;EACrD;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,kBAAkB;EAC1C;CACD,qBAAqB;EACnB,OAAO;EACP,SAAS,cAAc,uBAAuB;EAC/C;CACD,cAAc;EACZ,OAAO;EACP,SAAS,cAAc,gBAAgB;EACxC;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC5C;CACD,aAAa;EACX,OAAO;EACP,SAAS,cAAc,iBAAiB;EACzC;CACD,wBAAwB;EACtB,OAAO;EACP,SAAS,cAAc,0BAA0B;EAClD;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC5C;CACD,kBAAkB;EAChB,OAAO;EACP,SAAS,cAAc,oBAAoB;EAC5C;CACF;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"}