@case-framework/survey-assistant 0.8.0 → 0.9.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/dist/{authoring-references-DbuOKerg.mjs → authoring-references-CmwLc_C8.mjs} +40 -32
  2. package/dist/authoring-references-CmwLc_C8.mjs.map +1 -0
  3. package/dist/capabilities-D55dq-fO.mjs +582 -0
  4. package/dist/capabilities-D55dq-fO.mjs.map +1 -0
  5. package/dist/capabilities-default.d.mts +4 -12
  6. package/dist/capabilities-default.d.mts.map +1 -1
  7. package/dist/capabilities-default.mjs +2 -2
  8. package/dist/capabilities-z95e1mti.d.mts +117 -0
  9. package/dist/capabilities-z95e1mti.d.mts.map +1 -0
  10. package/dist/{constants-B6HzpEsx.d.mts → constants-HL_klgJl.d.mts} +4 -4
  11. package/dist/{constants-B6HzpEsx.d.mts.map → constants-HL_klgJl.d.mts.map} +1 -1
  12. package/dist/{controller-proxy-DEeFl9IA.mjs → controller-proxy-BQ1YsVxJ.mjs} +4 -3
  13. package/dist/controller-proxy-BQ1YsVxJ.mjs.map +1 -0
  14. package/dist/{controller-proxy-D7uQfm5f.d.mts → controller-proxy-Cmzdr9tV.d.mts} +4 -4
  15. package/dist/{controller-proxy-D7uQfm5f.d.mts.map → controller-proxy-Cmzdr9tV.d.mts.map} +1 -1
  16. package/dist/default-D22AKTqE.mjs +233 -0
  17. package/dist/default-D22AKTqE.mjs.map +1 -0
  18. package/dist/{digest-C39WyAWG.d.mts → digest-FnTTDBq2.d.mts} +2 -2
  19. package/dist/digest-FnTTDBq2.d.mts.map +1 -0
  20. package/dist/digest.d.mts +1 -1
  21. package/dist/engine-D950TfvC.mjs +3098 -0
  22. package/dist/engine-D950TfvC.mjs.map +1 -0
  23. package/dist/engine.d.mts +4 -3
  24. package/dist/engine.mjs +3 -3
  25. package/dist/{index-WB5kfnz0.d.mts → index-B8TLBd1G.d.mts} +8 -6
  26. package/dist/index-B8TLBd1G.d.mts.map +1 -0
  27. package/dist/index-CaX3hZmr.d.mts +23813 -0
  28. package/dist/index-CaX3hZmr.d.mts.map +1 -0
  29. package/dist/{index-r5riv4md.d.mts → index-CeUlGkoU.d.mts} +27 -6
  30. package/dist/index-CeUlGkoU.d.mts.map +1 -0
  31. package/dist/{index-D7wT6P3t.d.mts → index-DYHdvSE8.d.mts} +83 -41
  32. package/dist/index-DYHdvSE8.d.mts.map +1 -0
  33. package/dist/lifecycle-DFzxVxpq.d.mts +54346 -0
  34. package/dist/lifecycle-DFzxVxpq.d.mts.map +1 -0
  35. package/dist/{memory-thread-repository-DAnOGIB3.mjs → memory-thread-repository-DmLadygY.mjs} +15 -9
  36. package/dist/{memory-thread-repository-DAnOGIB3.mjs.map → memory-thread-repository-DmLadygY.mjs.map} +1 -1
  37. package/dist/protocol-BQ7uIDYT.mjs +569 -0
  38. package/dist/protocol-BQ7uIDYT.mjs.map +1 -0
  39. package/dist/protocol.d.mts +4 -4
  40. package/dist/protocol.mjs +3 -2
  41. package/dist/{react-C_GY-Fsc.mjs → react-DybJ5pWw.mjs} +17 -11
  42. package/dist/react-DybJ5pWw.mjs.map +1 -0
  43. package/dist/react-integration.d.mts +1 -1
  44. package/dist/react-integration.mjs +1 -1
  45. package/dist/react.d.mts +2 -2
  46. package/dist/react.mjs +2 -2
  47. package/dist/references/assistant-operations.md +190 -215
  48. package/dist/references/core-rules.md +2 -2
  49. package/dist/references/element-types.md +189 -0
  50. package/dist/references/expressions.md +215 -238
  51. package/dist/references/follow-ups.md +151 -0
  52. package/dist/references/localization.md +26 -12
  53. package/dist/references/response-variables.md +3 -3
  54. package/dist/references/rich-text-content.md +22 -43
  55. package/dist/references/source-material-surveys.md +20 -25
  56. package/dist/references/survey-data-model.md +36 -117
  57. package/dist/{request-context-Dg4jSwN1.mjs → request-context-KVh8VjgH.mjs} +4 -4
  58. package/dist/request-context-KVh8VjgH.mjs.map +1 -0
  59. package/dist/server-agent.d.mts +28 -7
  60. package/dist/server-agent.d.mts.map +1 -1
  61. package/dist/server-agent.mjs +33 -25
  62. package/dist/server-agent.mjs.map +1 -1
  63. package/dist/server-runtime.d.mts +6 -5
  64. package/dist/server-runtime.d.mts.map +1 -1
  65. package/dist/server-runtime.mjs +3 -3
  66. package/dist/server-tasks.d.mts +1 -1
  67. package/dist/server-tasks.mjs +1 -1
  68. package/dist/server-tools.d.mts +1 -1
  69. package/dist/server-tools.mjs +1 -1
  70. package/dist/server.d.mts +7 -6
  71. package/dist/server.d.mts.map +1 -1
  72. package/dist/server.mjs +3 -3
  73. package/dist/{tasks-BZEiwgxA.mjs → tasks-Coh5N027.mjs} +16 -15
  74. package/dist/tasks-Coh5N027.mjs.map +1 -0
  75. package/dist/{tasks-B9h3LPam.d.mts → tasks-wb9M-bak.d.mts} +11 -11
  76. package/dist/{tasks-B9h3LPam.d.mts.map → tasks-wb9M-bak.d.mts.map} +1 -1
  77. package/dist/{thread-handlers-Bef0td9N.d.mts → thread-handlers-C3Iya92v.d.mts} +6 -5
  78. package/dist/thread-handlers-C3Iya92v.d.mts.map +1 -0
  79. package/dist/{tools-CEsv-WoO.mjs → tools-D0KBDolR.mjs} +435 -408
  80. package/dist/tools-D0KBDolR.mjs.map +1 -0
  81. package/dist/turn-survey-draft-B34lggSG.d.mts +185 -0
  82. package/dist/turn-survey-draft-B34lggSG.d.mts.map +1 -0
  83. package/dist/ui.d.mts +3 -3
  84. package/dist/ui.d.mts.map +1 -1
  85. package/dist/ui.mjs +35 -23
  86. package/dist/ui.mjs.map +1 -1
  87. package/package.json +7 -7
  88. package/dist/authoring-references-DbuOKerg.mjs.map +0 -1
  89. package/dist/capabilities-CmeeAjEc.d.mts +0 -192
  90. package/dist/capabilities-CmeeAjEc.d.mts.map +0 -1
  91. package/dist/capabilities-DCMA71PP.mjs +0 -58
  92. package/dist/capabilities-DCMA71PP.mjs.map +0 -1
  93. package/dist/controller-proxy-DEeFl9IA.mjs.map +0 -1
  94. package/dist/default-fhSon2RM.mjs +0 -760
  95. package/dist/default-fhSon2RM.mjs.map +0 -1
  96. package/dist/digest-C39WyAWG.d.mts.map +0 -1
  97. package/dist/engine-nXoCWYpQ.mjs +0 -6888
  98. package/dist/engine-nXoCWYpQ.mjs.map +0 -1
  99. package/dist/index-Ciq7vHIs.d.mts +0 -716
  100. package/dist/index-Ciq7vHIs.d.mts.map +0 -1
  101. package/dist/index-D7wT6P3t.d.mts.map +0 -1
  102. package/dist/index-WB5kfnz0.d.mts.map +0 -1
  103. package/dist/index-r5riv4md.d.mts.map +0 -1
  104. package/dist/lifecycle-Dm8u7QFh.d.mts +0 -545
  105. package/dist/lifecycle-Dm8u7QFh.d.mts.map +0 -1
  106. package/dist/protocol-CF4Bh_Ch.mjs +0 -1255
  107. package/dist/protocol-CF4Bh_Ch.mjs.map +0 -1
  108. package/dist/react-C_GY-Fsc.mjs.map +0 -1
  109. package/dist/references/embedded-forms.md +0 -146
  110. package/dist/references/item-types.md +0 -641
  111. package/dist/request-context-Dg4jSwN1.mjs.map +0 -1
  112. package/dist/tasks-BZEiwgxA.mjs.map +0 -1
  113. package/dist/thread-handlers-Bef0td9N.d.mts.map +0 -1
  114. package/dist/tools-CEsv-WoO.mjs.map +0 -1
@@ -0,0 +1,233 @@
1
+ import { V as jsonValueSchema, r as assistantElementTypeManifestSchema } from "./capabilities-D55dq-fO.mjs";
2
+ import { buildCapabilityDigest, stableStringify } from "./digest.mjs";
3
+ import { generateId } from "@case-framework/survey-core";
4
+ import { createBuiltInElement, createChoiceMatrixPreset, defaultElementRegistry } from "@case-framework/survey-items";
5
+ import { allocateCopiedResponseNames } from "@case-framework/survey-core/editor";
6
+ import { choiceMatrixConfigSchema, getChoiceMatrixConfigIssues } from "@case-framework/survey-items/choice-matrix";
7
+ //#region src/engine/capabilities.ts
8
+ const resolveAssistantCapabilityReference = ({ capabilities, elementType, topic }) => capabilities?.byElementType.get(elementType)?.references?.find((reference) => reference.topic === topic);
9
+ const inspectAssistantElement = ({ capabilities, element }) => {
10
+ const capability = capabilities?.byElementType.get(element.elementType);
11
+ if (!capabilities || !capability?.inspectElement) return void 0;
12
+ const parsed = capabilities.registry.get(element.elementType).schema.safeParse(element);
13
+ if (!parsed.success) return {
14
+ summary: `${capability.manifest.displayName} configuration needs repair.`,
15
+ details: { issues: parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`) }
16
+ };
17
+ return capability.inspectElement(parsed.data);
18
+ };
19
+ function createSurveyAssistantCapabilities(registry, capabilities) {
20
+ const supplied = /* @__PURE__ */ new Map();
21
+ for (const capability of capabilities) {
22
+ const manifest = assistantElementTypeManifestSchema.parse(capability.manifest);
23
+ if (supplied.has(manifest.elementType)) throw new Error(`Duplicate survey assistant capability for element type "${manifest.elementType}".`);
24
+ registry.get(manifest.elementType);
25
+ if (manifest.create === "deterministic" && !manifest.supportedOperations.includes("create-item")) throw new Error(`Deterministically creatable element "${manifest.elementType}" must support creation inside a content item.`);
26
+ if (manifest.creationPresets?.length && !capability.materializePreset) throw new Error(`Element "${manifest.elementType}" declares presets without a trusted materializer.`);
27
+ const topics = new Set(manifest.referenceTopics ?? []);
28
+ for (const reference of capability.references ?? []) if (!topics.has(reference.topic)) throw new Error(`Capability reference "${reference.topic}" for "${manifest.elementType}" is not declared.`);
29
+ supplied.set(manifest.elementType, {
30
+ ...capability,
31
+ manifest
32
+ });
33
+ }
34
+ const byElementType = new Map(registry.definitions.map((definition) => [definition.elementType, supplied.get(definition.elementType) ?? createUnsupportedElementCapability({
35
+ elementType: definition.elementType,
36
+ displayName: definition.labelByLocale?.en ?? Object.values(definition.labelByLocale ?? {})[0] ?? definition.elementType
37
+ })]));
38
+ const elementTypes = [...byElementType.values()].map((adapter) => structuredClone(adapter.manifest)).sort((a, b) => a.elementType.localeCompare(b.elementType));
39
+ return {
40
+ registry,
41
+ byElementType,
42
+ manifest: {
43
+ elementTypes,
44
+ digest: buildCapabilityDigest({ elementTypes })
45
+ }
46
+ };
47
+ }
48
+ const getDeterministicCreateElementTypes = (manifest) => manifest.elementTypes.filter((entry) => entry.create === "deterministic").map((entry) => entry.elementType);
49
+ const createUnsupportedElementCapability = ({ displayName, elementType }) => ({ manifest: {
50
+ elementType,
51
+ displayName,
52
+ capabilityVersion: "unsupported-v1",
53
+ create: "unsupported",
54
+ supportedOperations: []
55
+ } });
56
+ var SurveyAssistantCapabilityMismatchError = class extends Error {
57
+ code = "survey-assistant-capability-mismatch";
58
+ constructor(message = "Survey assistant capabilities changed; start a fresh turn and retry.") {
59
+ super(message);
60
+ this.name = "SurveyAssistantCapabilityMismatchError";
61
+ }
62
+ };
63
+ const assertSurveyAssistantCapabilities = ({ manifest, trustedCapabilities, versionDigest }) => {
64
+ const { digest, ...body } = manifest;
65
+ if (digest !== buildCapabilityDigest(body) || versionDigest !== digest) throw new SurveyAssistantCapabilityMismatchError();
66
+ if (trustedCapabilities && stableStringify(body.elementTypes) !== stableStringify(trustedCapabilities.manifest.elementTypes)) throw new SurveyAssistantCapabilityMismatchError("The editor and server use different survey assistant capabilities; refresh and retry.");
67
+ };
68
+ //#endregion
69
+ //#region src/capabilities/matrix-inspection.ts
70
+ const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
71
+ const PREVIEW_LIMIT = 12;
72
+ const describeList = (name, values) => `${name}: ${values.length}; ${JSON.stringify(values.slice(0, PREVIEW_LIMIT))}${values.length > PREVIEW_LIMIT ? " (first 12 shown; inspect full details for the rest)" : ""}.`;
73
+ /** Summarize authored state, not the model's claimed intent or respondent visibility. */
74
+ const summarizeMatrixState = (elementType, config) => {
75
+ if (elementType !== "formMatrix" && elementType !== "choiceMatrix" || !isRecord(config) || !Array.isArray(config.rows)) return "";
76
+ const rows = config.rows.map((row) => isRecord(row) ? {
77
+ id: row.id,
78
+ rowName: row.rowName
79
+ } : row);
80
+ const lines = ["Current authored matrix state (IDs/coding names, configured order):", describeList("Rows", rows)];
81
+ if (elementType === "formMatrix" && Array.isArray(config.columns) && Array.isArray(config.cells)) lines.push(describeList("Columns", config.columns.map((column) => isRecord(column) ? {
82
+ id: column.id,
83
+ columnName: column.columnName
84
+ } : column)), `Cells: ${config.cells.length}.`, describeList("Explicit cell overrides", config.cells.flatMap((cell) => isRecord(cell) && isRecord(cell.fieldOverride) ? [{
85
+ cellId: cell.id,
86
+ rowId: cell.rowId,
87
+ columnId: cell.columnId,
88
+ type: cell.fieldOverride.type,
89
+ ...cell.fieldOverride.type === "date" ? { precision: cell.fieldOverride.precision } : {}
90
+ }] : [])));
91
+ else if (elementType === "choiceMatrix" && Array.isArray(config.options)) {
92
+ lines.push(describeList("Regular option columns", config.options.map((option) => isRecord(option) ? option.id : option)));
93
+ for (const position of ["leading", "trailing"]) {
94
+ const option = config[`${position}NonScoring`];
95
+ lines.push(`${position} non-scoring option ID: ${isRecord(option) ? JSON.stringify(option.id) : "none"}.`);
96
+ }
97
+ }
98
+ return lines.join(" ");
99
+ };
100
+ //#endregion
101
+ //#region src/capabilities/default.ts
102
+ const commonOperations = [
103
+ "create-item",
104
+ "insert-element",
105
+ "insert-blocks",
106
+ "insert-preset",
107
+ "move-element",
108
+ "move-block",
109
+ "remove-content",
110
+ "update-layout",
111
+ "patch-element-config",
112
+ "update-response-settings",
113
+ "update-content",
114
+ "update-placed-image",
115
+ "patch-item-config",
116
+ "remove-item",
117
+ "move-item",
118
+ "reorder-items",
119
+ "survey-json-patch"
120
+ ];
121
+ const presets = {
122
+ "information.default": "information",
123
+ "text.short": "text",
124
+ "text.long": "longText",
125
+ "number.input": "number",
126
+ "number.slider": "slider",
127
+ "date.default": "date",
128
+ "boolean.radio": "boolean",
129
+ "boolean.switch": "switch",
130
+ "choice.radio": "radio",
131
+ "choice.checkbox": "checkbox",
132
+ "choice.dropdown": "dropdown",
133
+ "consent.default": "consent",
134
+ "formMatrix.default": "formMatrix"
135
+ };
136
+ const descriptions = {
137
+ information: { hint: "Rich content with no response slot. Use the body content role." },
138
+ text: { hint: "Short or long text input; use a label or an unambiguous enclosing title." },
139
+ number: { hint: "Localized numeric input or slider, with optional unit and constraints." },
140
+ date: { hint: "Calendar input with year, year-month or year-month-day precision; keep regional formatting separate." },
141
+ boolean: { hint: "Yes/no radio or switch. Appearance does not change the boolean response domain." },
142
+ choice: { hint: "Radio and checkbox lists are full-width and may own option-inline follow-ups. Dropdowns are compact and cannot own follow-ups." },
143
+ consent: { hint: "Explicit boolean decision with inline or dialog information and own/inherited semantic heading context." },
144
+ choiceMatrix: { hint: "Categorical row slots plus persisted score/sum slot IDs. Codes, option labels and scores are separate; preserve non-scoring options." },
145
+ formMatrix: { hint: "Independent cell slots with column defaults and per-cell overrides. Preserve row/column naming, date precision and cell-specific UI." }
146
+ };
147
+ const configSummaries = {
148
+ information: "Display-only element with empty config and rich body role. Use actual document content, not a placeholder or a description of absent content. Load rich-text-content for formatting and source-material-surveys when implementing supplied documents.",
149
+ text: "Config: slotId, variableName, presentation short|long; optional purpose text|email|tel|url|password, required, rows, autocomplete and validations. Roles label/help/placeholder/message; individual validation IDs own message. Use an explicit label or unambiguous enclosing title. A placeholder is not a label. Preserve source constraints and create real inputs for respondent blanks.",
150
+ number: "Config: slotId, variableName, presentation input|slider; optional step, min, max, showValue, required and validations (integer). min/max are a number or {expression, fallback?}; a missing expression value leaves the bound unapplied unless it has a fallback, and slider expression bounds need one. Roles label/help/placeholder/message/unit. Units are localized wording, not part of the numeric answer. Preserve requested bounds and step; do not invent domain limits. Slider and input share numeric semantics.",
151
+ date: "Config: slotId, variableName, precision year|year-month|year-month-day; optional required, min and max. Calendar values are YYYY, YYYY-MM or YYYY-MM-DD, never timestamps. Display format is independent of language and precision. min/max are a calendar string or {expression, fallback?}; a missing expression value leaves the bound unapplied unless it has a fallback. Use survey_expression for expression bounds and preserve precision.",
152
+ boolean: "Config: slotId, variableName, presentation radio|switch; optional required and validations. Roles include label/help/yesLabel/noLabel/message. False is a defined answer. Use get compared with true/false for conditions about the answer; isDefined means either answer exists. Do not substitute a switch for the consent document/decision experience.",
153
+ choice: "Config: slotId, variableName, presentation radio|checkbox|dropdown, options, optional required/shuffleOptions; checkbox maxSelection null=unlimited or positive cap. Options own label/description and optional visibility/disabled. Radio/checkbox may own followUp bodies, never dropdowns; load follow-ups for the complete example. Put option, body and owner-role translations in one creation/config edit. Use fresh IDs for new owners and preserve inspected IDs on edits. Response types: radio/dropdown reference, checkbox reference[]. Codes, labels and IDs are separate. Disabled selections remain active; use visibility for inapplicability and avoid self-locking exclusivity.",
154
+ consent: "Config: slotId, variableName, presentation inline|dialog, subtitleMode inherit|custom|none. Element label overrides the nearest semantic title; custom subtitle uses the element subtitle role. Body must contain actual terms, not a document description. Preserve supplied terms; otherwise draft proactively and report assumptions/gaps afterward. Optional acceptLabel/declineLabel, unansweredLabel/acceptedLabel/declinedLabel, reviewLabel/changeLabel override UI wording. True=agree, false=decline, absent=unanswered; isDefined does not mean accepted. No required setting or effects list. Load element-types for complete content and interaction guidance.",
155
+ choiceMatrix: "Config: prefix, rows with id/rowName/scoreSlotId, options with id/code/score, sumSlotId, layout. Presets are editable starting points; match anchors to the construct. Scores are all present or all absent; zero is a defined score. Leading/trailing non-scoring options are single objects, not arrays. Use row/option owner labels and element startLabel/endLabel for bipolar anchors. Preserve IDs on edits; reverse score values without reordering labels. Naming derives from prefix/rowName, never hand-rename computed slots. Load element-types before structural/scoring edits.",
156
+ formMatrix: "Config: prefix, rows, columns and complete persistent cells rectangle; field types text/number/date/dropdown/boolean/static/empty. Each cell has id/rowId/columnId and optional complete field override. Dates use mode; number unit is config text. Add/remove rows or columns with all associated cells in one patch. Duplicate every override with fresh nested IDs and copy all locale content; resetting an override restores column defaults. Preserve surviving IDs. Naming derives from prefix/rowName/columnName. Load element-types for effective field, ownership and duplication rules."
157
+ };
158
+ function createCapability(elementType) {
159
+ const info = Object.entries(descriptions).find(([type]) => type === elementType)?.[1];
160
+ const configSummary = Object.entries(configSummaries).find(([type]) => type === elementType)?.[1];
161
+ if (!info || !configSummary) throw new Error(`Missing built-in assistant guidance for ${elementType}`);
162
+ const available = elementType === "choiceMatrix" ? [
163
+ "yesNo",
164
+ "fivePoint",
165
+ "sevenPoint",
166
+ "bipolarFive"
167
+ ].map((id) => `choiceMatrix.${id}`) : Object.entries(presets).filter(([, type]) => (type === "longText" ? "text" : type === "slider" ? "number" : type === "switch" ? "boolean" : type === "radio" || type === "checkbox" || type === "dropdown" ? "choice" : type) === elementType).map(([id]) => id);
168
+ return {
169
+ manifest: {
170
+ elementType,
171
+ capabilityVersion: "composition-v1",
172
+ displayName: defaultElementRegistry.get(elementType).labelByLocale?.en ?? elementType,
173
+ description: info.hint,
174
+ create: "deterministic",
175
+ referenceTopics: [
176
+ "element-types",
177
+ "response-variables",
178
+ "expressions",
179
+ "localization",
180
+ "rich-text-content",
181
+ ...elementType === "choice" ? ["follow-ups"] : []
182
+ ],
183
+ supportedOperations: commonOperations,
184
+ creationPresets: available.map((id) => ({ id })),
185
+ authoring: {
186
+ compactHint: info.hint,
187
+ configSummary
188
+ }
189
+ },
190
+ materializePreset(presetId, locale, usedNames) {
191
+ if (!available.includes(presetId)) throw new Error(`Unknown preset "${presetId}" for "${elementType}".`);
192
+ let element;
193
+ let content;
194
+ if (elementType === "choiceMatrix") {
195
+ const name = presetId.slice(13);
196
+ if (name !== "yesNo" && name !== "fivePoint" && name !== "sevenPoint" && name !== "bipolarFive") throw new Error("Unknown matrix preset");
197
+ const preset = createChoiceMatrixPreset(name, locale);
198
+ element = {
199
+ id: generateId(),
200
+ kind: "element",
201
+ elementType,
202
+ config: preset.config
203
+ };
204
+ content = preset.content;
205
+ } else element = createBuiltInElement(presets[presetId], usedNames);
206
+ return {
207
+ element: allocateCopiedResponseNames(defaultElementRegistry.elementSchema, element, defaultElementRegistry, usedNames),
208
+ ...content ? { content } : {}
209
+ };
210
+ },
211
+ inspectElement(element) {
212
+ const config = jsonValueSchema.parse(element.config);
213
+ return {
214
+ summary: [summarizeMatrixState(elementType, config), info.hint].filter(Boolean).join(" ") + (elementType === "choice" ? config !== null && typeof config === "object" && !Array.isArray(config) && config.shuffleOptions === true ? " Options are listed in configured order; respondents see shuffled order." : " Option positions match respondent-visible order, with hidden options omitted." : ""),
215
+ details: config
216
+ };
217
+ },
218
+ ...elementType === "choiceMatrix" ? { validateElement(element) {
219
+ return getChoiceMatrixConfigIssues(choiceMatrixConfigSchema.parse(element.config)).map((message) => ({
220
+ severity: "error",
221
+ code: "invalid-matrix",
222
+ message
223
+ }));
224
+ } } : {}
225
+ };
226
+ }
227
+ const defaultSurveyAssistantCapabilities = defaultElementRegistry.definitions.map((definition) => createCapability(definition.elementType));
228
+ const defaultSurveyAssistantCapabilitySet = createSurveyAssistantCapabilities(defaultElementRegistry, defaultSurveyAssistantCapabilities);
229
+ const getDefaultSurveyAssistantCapability = (elementType) => defaultSurveyAssistantCapabilitySet.byElementType.get(elementType);
230
+ //#endregion
231
+ export { assertSurveyAssistantCapabilities as a, getDeterministicCreateElementTypes as c, SurveyAssistantCapabilityMismatchError as i, inspectAssistantElement as l, defaultSurveyAssistantCapabilitySet as n, createSurveyAssistantCapabilities as o, getDefaultSurveyAssistantCapability as r, createUnsupportedElementCapability as s, defaultSurveyAssistantCapabilities as t, resolveAssistantCapabilityReference as u };
232
+
233
+ //# sourceMappingURL=default-D22AKTqE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-D22AKTqE.mjs","names":[],"sources":["../src/engine/capabilities.ts","../src/capabilities/matrix-inspection.ts","../src/capabilities/default.ts"],"sourcesContent":["import type { ElementRegistry, RuntimeElement, Content } from \"@case-framework/survey-core\";\nimport type {\n AssistantElementTypeManifest,\n JsonValue,\n SurveyAssistantCapabilityManifest,\n SurveyOperation,\n SurveyValidationIssue,\n} from \"../protocol\";\nimport { assistantElementTypeManifestSchema } from \"../protocol/capabilities\";\nimport { buildCapabilityDigest, stableStringify } from \"../protocol/digest\";\n\nexport interface AssistantCapabilityReference {\n topic: string;\n title?: string;\n markdown: string;\n}\nexport interface AssistantElementInspection {\n summary: string;\n details?: JsonValue;\n}\n/** Authoring policy supplements the registry; it never supplies a substitute slot/ownership schema. */\nexport interface AssistantElementCapabilityAdapter {\n manifest: AssistantElementTypeManifest;\n references?: AssistantCapabilityReference[];\n materializePreset?: (\n presetId: string,\n locale: string,\n usedNames: ReadonlySet<string>,\n ) => {\n element: RuntimeElement;\n content?: Record<string, Record<string, Content>>;\n };\n /** Deterministic element diagnostics. New errors block edits; unchanged errors\n * on the same element/type may remain during repair. Removed nodes are not\n * validated. Use supportedOperations/supportsOperation to restrict mutations.\n */\n validateElement?: (element: RuntimeElement) => SurveyValidationIssue[];\n supportsOperation?: (operation: SurveyOperation) => boolean;\n /** Receives a node validated by inspectAssistantElement with the active trusted registry. */\n inspectElement?: (element: RuntimeElement) => AssistantElementInspection;\n}\nexport interface SurveyAssistantCapabilitySet {\n manifest: SurveyAssistantCapabilityManifest;\n registry: ElementRegistry;\n byElementType: ReadonlyMap<string, AssistantElementCapabilityAdapter>;\n}\nexport const resolveAssistantCapabilityReference = ({\n capabilities,\n elementType,\n topic,\n}: {\n capabilities: SurveyAssistantCapabilitySet | undefined;\n elementType: string;\n topic: string;\n}) =>\n capabilities?.byElementType\n .get(elementType)\n ?.references?.find((reference) => reference.topic === topic);\nexport const inspectAssistantElement = ({\n capabilities,\n element,\n}: {\n capabilities: SurveyAssistantCapabilitySet | undefined;\n element: RuntimeElement;\n}): AssistantElementInspection | undefined => {\n const capability = capabilities?.byElementType.get(element.elementType);\n if (!capabilities || !capability?.inspectElement) return undefined;\n const parsed = capabilities.registry.get(element.elementType).schema.safeParse(element);\n if (!parsed.success)\n return {\n summary: `${capability.manifest.displayName} configuration needs repair.`,\n details: {\n issues: parsed.error.issues.map((issue) => `${issue.path.join(\".\")}: ${issue.message}`),\n },\n };\n return capability.inspectElement(parsed.data);\n};\n\nexport function createSurveyAssistantCapabilities(\n registry: ElementRegistry,\n capabilities: readonly AssistantElementCapabilityAdapter[],\n): SurveyAssistantCapabilitySet {\n const supplied = new Map<string, AssistantElementCapabilityAdapter>();\n for (const capability of capabilities) {\n const manifest = assistantElementTypeManifestSchema.parse(capability.manifest);\n if (supplied.has(manifest.elementType))\n throw new Error(\n `Duplicate survey assistant capability for element type \"${manifest.elementType}\".`,\n );\n registry.get(manifest.elementType); // Never install executable behavior from a serialized manifest.\n if (\n manifest.create === \"deterministic\" &&\n !manifest.supportedOperations.includes(\"create-item\")\n )\n throw new Error(\n `Deterministically creatable element \"${manifest.elementType}\" must support creation inside a content item.`,\n );\n if (manifest.creationPresets?.length && !capability.materializePreset)\n throw new Error(\n `Element \"${manifest.elementType}\" declares presets without a trusted materializer.`,\n );\n const topics = new Set(manifest.referenceTopics ?? []);\n for (const reference of capability.references ?? [])\n if (!topics.has(reference.topic))\n throw new Error(\n `Capability reference \"${reference.topic}\" for \"${manifest.elementType}\" is not declared.`,\n );\n supplied.set(manifest.elementType, { ...capability, manifest });\n }\n const byElementType = new Map(\n registry.definitions.map((definition) => [\n definition.elementType,\n supplied.get(definition.elementType) ??\n createUnsupportedElementCapability({\n elementType: definition.elementType,\n displayName:\n definition.labelByLocale?.en ??\n Object.values(definition.labelByLocale ?? {})[0] ??\n definition.elementType,\n }),\n ]),\n );\n const elementTypes = [...byElementType.values()]\n .map((adapter) => structuredClone(adapter.manifest))\n .sort((a, b) => a.elementType.localeCompare(b.elementType));\n return {\n registry,\n byElementType,\n manifest: { elementTypes, digest: buildCapabilityDigest({ elementTypes }) },\n };\n}\nexport const getDeterministicCreateElementTypes = (manifest: SurveyAssistantCapabilityManifest) =>\n manifest.elementTypes\n .filter((entry) => entry.create === \"deterministic\")\n .map((entry) => entry.elementType);\nexport const createUnsupportedElementCapability = ({\n displayName,\n elementType,\n}: {\n displayName: string;\n elementType: string;\n}): AssistantElementCapabilityAdapter => ({\n manifest: {\n elementType,\n displayName,\n capabilityVersion: \"unsupported-v1\",\n create: \"unsupported\",\n supportedOperations: [],\n },\n});\nexport class SurveyAssistantCapabilityMismatchError extends Error {\n readonly code = \"survey-assistant-capability-mismatch\";\n constructor(message = \"Survey assistant capabilities changed; start a fresh turn and retry.\") {\n super(message);\n this.name = \"SurveyAssistantCapabilityMismatchError\";\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, ...body } = manifest;\n if (digest !== buildCapabilityDigest(body) || versionDigest !== digest)\n throw new SurveyAssistantCapabilityMismatchError();\n // A browser cannot grant operations or claim server presets. Both sides share\n // the same complete trusted capability contract, including preset identifiers.\n if (\n trustedCapabilities &&\n stableStringify(body.elementTypes) !==\n stableStringify(trustedCapabilities.manifest.elementTypes)\n )\n throw new SurveyAssistantCapabilityMismatchError(\n \"The editor and server use different survey assistant capabilities; refresh and retry.\",\n );\n};\n","import type { JsonValue } from \"../protocol\";\n\nconst isRecord = (value: JsonValue | undefined): value is Record<string, JsonValue> =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\nconst PREVIEW_LIMIT = 12;\nconst describeList = (name: string, values: JsonValue[]) =>\n `${name}: ${values.length}; ${JSON.stringify(values.slice(0, PREVIEW_LIMIT))}${values.length > PREVIEW_LIMIT ? \" (first 12 shown; inspect full details for the rest)\" : \"\"}.`;\n\n/** Summarize authored state, not the model's claimed intent or respondent visibility. */\nexport const summarizeMatrixState = (elementType: string, config: JsonValue): string => {\n if (\n (elementType !== \"formMatrix\" && elementType !== \"choiceMatrix\") ||\n !isRecord(config) ||\n !Array.isArray(config.rows)\n )\n return \"\";\n const rows = config.rows.map((row) =>\n isRecord(row) ? { id: row.id, rowName: row.rowName } : row,\n );\n const lines = [\n \"Current authored matrix state (IDs/coding names, configured order):\",\n describeList(\"Rows\", rows),\n ];\n if (\n elementType === \"formMatrix\" &&\n Array.isArray(config.columns) &&\n Array.isArray(config.cells)\n ) {\n lines.push(\n describeList(\n \"Columns\",\n config.columns.map((column) =>\n isRecord(column) ? { id: column.id, columnName: column.columnName } : column,\n ),\n ),\n `Cells: ${config.cells.length}.`,\n describeList(\n \"Explicit cell overrides\",\n config.cells.flatMap((cell) =>\n isRecord(cell) && isRecord(cell.fieldOverride)\n ? [\n {\n cellId: cell.id,\n rowId: cell.rowId,\n columnId: cell.columnId,\n type: cell.fieldOverride.type,\n ...(cell.fieldOverride.type === \"date\"\n ? { precision: cell.fieldOverride.precision }\n : {}),\n },\n ]\n : [],\n ),\n ),\n );\n } else if (elementType === \"choiceMatrix\" && Array.isArray(config.options)) {\n lines.push(\n describeList(\n \"Regular option columns\",\n config.options.map((option) => (isRecord(option) ? option.id : option)),\n ),\n );\n for (const position of [\"leading\", \"trailing\"]) {\n const option = config[`${position}NonScoring`];\n lines.push(\n `${position} non-scoring option ID: ${isRecord(option) ? JSON.stringify(option.id) : \"none\"}.`,\n );\n }\n }\n return lines.join(\" \");\n};\n","import { generateId, type RuntimeElement } from \"@case-framework/survey-core\";\nimport { allocateCopiedResponseNames } from \"@case-framework/survey-core/editor\";\nimport {\n choiceMatrixConfigSchema,\n getChoiceMatrixConfigIssues,\n} from \"@case-framework/survey-items/choice-matrix\";\nimport {\n createBuiltInElement,\n createChoiceMatrixPreset,\n defaultElementRegistry,\n type BuiltInPresetType,\n type BuiltInElementType,\n} from \"@case-framework/survey-items\";\nimport {\n createSurveyAssistantCapabilities,\n type AssistantElementCapabilityAdapter,\n} from \"../engine/capabilities\";\nimport { jsonValueSchema } from \"../protocol/content\";\nimport type { AssistantElementTypeManifest } from \"../protocol/capabilities\";\nimport { summarizeMatrixState } from \"./matrix-inspection\";\n\nconst commonOperations = [\n \"create-item\",\n \"insert-element\",\n \"insert-blocks\",\n \"insert-preset\",\n \"move-element\",\n \"move-block\",\n \"remove-content\",\n \"update-layout\",\n \"patch-element-config\",\n \"update-response-settings\",\n \"update-content\",\n \"update-placed-image\",\n \"patch-item-config\",\n \"remove-item\",\n \"move-item\",\n \"reorder-items\",\n \"survey-json-patch\",\n] satisfies AssistantElementTypeManifest[\"supportedOperations\"];\nconst presets: Record<string, BuiltInPresetType> = {\n \"information.default\": \"information\",\n \"text.short\": \"text\",\n \"text.long\": \"longText\",\n \"number.input\": \"number\",\n \"number.slider\": \"slider\",\n \"date.default\": \"date\",\n \"boolean.radio\": \"boolean\",\n \"boolean.switch\": \"switch\",\n \"choice.radio\": \"radio\",\n \"choice.checkbox\": \"checkbox\",\n \"choice.dropdown\": \"dropdown\",\n \"consent.default\": \"consent\",\n \"formMatrix.default\": \"formMatrix\",\n};\nconst descriptions = {\n information: {\n hint: \"Rich content with no response slot. Use the body content role.\",\n },\n text: {\n hint: \"Short or long text input; use a label or an unambiguous enclosing title.\",\n },\n number: {\n hint: \"Localized numeric input or slider, with optional unit and constraints.\",\n },\n date: {\n hint: \"Calendar input with year, year-month or year-month-day precision; keep regional formatting separate.\",\n },\n boolean: {\n hint: \"Yes/no radio or switch. Appearance does not change the boolean response domain.\",\n },\n choice: {\n hint: \"Radio and checkbox lists are full-width and may own option-inline follow-ups. Dropdowns are compact and cannot own follow-ups.\",\n },\n consent: {\n hint: \"Explicit boolean decision with inline or dialog information and own/inherited semantic heading context.\",\n },\n choiceMatrix: {\n hint: \"Categorical row slots plus persisted score/sum slot IDs. Codes, option labels and scores are separate; preserve non-scoring options.\",\n },\n formMatrix: {\n hint: \"Independent cell slots with column defaults and per-cell overrides. Preserve row/column naming, date precision and cell-specific UI.\",\n },\n} satisfies Record<BuiltInElementType, { hint: string }>;\nconst configSummaries = {\n information:\n \"Display-only element with empty config and rich body role. Use actual document content, not a placeholder or a description of absent content. Load rich-text-content for formatting and source-material-surveys when implementing supplied documents.\",\n text: \"Config: slotId, variableName, presentation short|long; optional purpose text|email|tel|url|password, required, rows, autocomplete and validations. Roles label/help/placeholder/message; individual validation IDs own message. Use an explicit label or unambiguous enclosing title. A placeholder is not a label. Preserve source constraints and create real inputs for respondent blanks.\",\n number:\n \"Config: slotId, variableName, presentation input|slider; optional step, min, max, showValue, required and validations (integer). min/max are a number or {expression, fallback?}; a missing expression value leaves the bound unapplied unless it has a fallback, and slider expression bounds need one. Roles label/help/placeholder/message/unit. Units are localized wording, not part of the numeric answer. Preserve requested bounds and step; do not invent domain limits. Slider and input share numeric semantics.\",\n date: \"Config: slotId, variableName, precision year|year-month|year-month-day; optional required, min and max. Calendar values are YYYY, YYYY-MM or YYYY-MM-DD, never timestamps. Display format is independent of language and precision. min/max are a calendar string or {expression, fallback?}; a missing expression value leaves the bound unapplied unless it has a fallback. Use survey_expression for expression bounds and preserve precision.\",\n boolean:\n \"Config: slotId, variableName, presentation radio|switch; optional required and validations. Roles include label/help/yesLabel/noLabel/message. False is a defined answer. Use get compared with true/false for conditions about the answer; isDefined means either answer exists. Do not substitute a switch for the consent document/decision experience.\",\n choice:\n \"Config: slotId, variableName, presentation radio|checkbox|dropdown, options, optional required/shuffleOptions; checkbox maxSelection null=unlimited or positive cap. Options own label/description and optional visibility/disabled. Radio/checkbox may own followUp bodies, never dropdowns; load follow-ups for the complete example. Put option, body and owner-role translations in one creation/config edit. Use fresh IDs for new owners and preserve inspected IDs on edits. Response types: radio/dropdown reference, checkbox reference[]. Codes, labels and IDs are separate. Disabled selections remain active; use visibility for inapplicability and avoid self-locking exclusivity.\",\n consent:\n \"Config: slotId, variableName, presentation inline|dialog, subtitleMode inherit|custom|none. Element label overrides the nearest semantic title; custom subtitle uses the element subtitle role. Body must contain actual terms, not a document description. Preserve supplied terms; otherwise draft proactively and report assumptions/gaps afterward. Optional acceptLabel/declineLabel, unansweredLabel/acceptedLabel/declinedLabel, reviewLabel/changeLabel override UI wording. True=agree, false=decline, absent=unanswered; isDefined does not mean accepted. No required setting or effects list. Load element-types for complete content and interaction guidance.\",\n choiceMatrix:\n \"Config: prefix, rows with id/rowName/scoreSlotId, options with id/code/score, sumSlotId, layout. Presets are editable starting points; match anchors to the construct. Scores are all present or all absent; zero is a defined score. Leading/trailing non-scoring options are single objects, not arrays. Use row/option owner labels and element startLabel/endLabel for bipolar anchors. Preserve IDs on edits; reverse score values without reordering labels. Naming derives from prefix/rowName, never hand-rename computed slots. Load element-types before structural/scoring edits.\",\n formMatrix:\n \"Config: prefix, rows, columns and complete persistent cells rectangle; field types text/number/date/dropdown/boolean/static/empty. Each cell has id/rowId/columnId and optional complete field override. Dates use mode; number unit is config text. Add/remove rows or columns with all associated cells in one patch. Duplicate every override with fresh nested IDs and copy all locale content; resetting an override restores column defaults. Preserve surviving IDs. Naming derives from prefix/rowName/columnName. Load element-types for effective field, ownership and duplication rules.\",\n} satisfies Record<BuiltInElementType, string>;\nfunction createCapability(elementType: string): AssistantElementCapabilityAdapter {\n const info = Object.entries(descriptions).find(([type]) => type === elementType)?.[1];\n const configSummary = Object.entries(configSummaries).find(([type]) => type === elementType)?.[1];\n if (!info || !configSummary)\n throw new Error(`Missing built-in assistant guidance for ${elementType}`);\n const available =\n elementType === \"choiceMatrix\"\n ? [\"yesNo\", \"fivePoint\", \"sevenPoint\", \"bipolarFive\"].map((id) => `choiceMatrix.${id}`)\n : Object.entries(presets)\n .filter(\n ([, type]) =>\n (type === \"longText\"\n ? \"text\"\n : type === \"slider\"\n ? \"number\"\n : type === \"switch\"\n ? \"boolean\"\n : type === \"radio\" || type === \"checkbox\" || type === \"dropdown\"\n ? \"choice\"\n : type) === elementType,\n )\n .map(([id]) => id);\n return {\n manifest: {\n elementType,\n capabilityVersion: \"composition-v1\",\n displayName: defaultElementRegistry.get(elementType).labelByLocale?.en ?? elementType,\n description: info.hint,\n create: \"deterministic\",\n referenceTopics: [\n \"element-types\",\n \"response-variables\",\n \"expressions\",\n \"localization\",\n \"rich-text-content\",\n ...(elementType === \"choice\" ? [\"follow-ups\"] : []),\n ],\n supportedOperations: commonOperations,\n creationPresets: available.map((id) => ({ id })),\n authoring: { compactHint: info.hint, configSummary },\n },\n materializePreset(presetId, locale, usedNames) {\n if (!available.includes(presetId))\n throw new Error(`Unknown preset \"${presetId}\" for \"${elementType}\".`);\n let element: RuntimeElement;\n let content: ReturnType<typeof createChoiceMatrixPreset>[\"content\"] | undefined;\n if (elementType === \"choiceMatrix\") {\n const name = presetId.slice(\"choiceMatrix.\".length);\n if (\n name !== \"yesNo\" &&\n name !== \"fivePoint\" &&\n name !== \"sevenPoint\" &&\n name !== \"bipolarFive\"\n )\n throw new Error(\"Unknown matrix preset\");\n const preset = createChoiceMatrixPreset(name, locale);\n element = { id: generateId(), kind: \"element\", elementType, config: preset.config };\n content = preset.content;\n } else element = createBuiltInElement(presets[presetId], usedNames);\n return {\n element: allocateCopiedResponseNames(\n defaultElementRegistry.elementSchema,\n element,\n defaultElementRegistry,\n usedNames,\n ),\n ...(content ? { content } : {}),\n };\n },\n inspectElement(element) {\n // Inspection receives the active document's parsed nodes. Re-parsing a choice\n // with the default registry would reject custom elements in its follow-ups.\n const config = jsonValueSchema.parse(element.config);\n return {\n summary:\n [summarizeMatrixState(elementType, config), info.hint].filter(Boolean).join(\" \") +\n (elementType === \"choice\"\n ? config !== null &&\n typeof config === \"object\" &&\n !Array.isArray(config) &&\n config.shuffleOptions === true\n ? \" Options are listed in configured order; respondents see shuffled order.\"\n : \" Option positions match respondent-visible order, with hidden options omitted.\"\n : \"\"),\n details: config,\n };\n },\n ...(elementType === \"choiceMatrix\"\n ? {\n validateElement(element: RuntimeElement) {\n return getChoiceMatrixConfigIssues(choiceMatrixConfigSchema.parse(element.config)).map(\n (message) => ({ severity: \"error\" as const, code: \"invalid-matrix\", message }),\n );\n },\n }\n : {}),\n };\n}\nexport const defaultSurveyAssistantCapabilities = defaultElementRegistry.definitions.map(\n (definition) => createCapability(definition.elementType),\n);\nexport const defaultSurveyAssistantCapabilitySet = createSurveyAssistantCapabilities(\n defaultElementRegistry,\n defaultSurveyAssistantCapabilities,\n);\nexport const getDefaultSurveyAssistantCapability = (elementType: string) =>\n defaultSurveyAssistantCapabilitySet.byElementType.get(elementType);\n"],"mappings":";;;;;;;AA8CA,MAAa,uCAAuC,EAClD,cACA,aACA,YAMA,cAAc,cACX,IAAI,WAAW,CAAC,EACf,YAAY,MAAM,cAAc,U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K,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAC9E,gBAAgB,WACb,WAAW,QACX,OAAO,WAAW,YAClB,CAAC,MAAM,QAAQ,MAAM,KACrB,OAAO,mBAAmB,OACxB,6EACA,mFACF;IACN,SAAS;GACX;EACF;EACA,GAAI,gBAAgB,iBAChB,EACE,gBAAgB,SAAyB;GACvC,OAAO,4BAA4B,yBAAyB,MAAM,QAAQ,MAAM,CAAC,CAAC,CAAC,KAChF,aAAa;IAAE,UAAU;IAAkB,MAAM;IAAkB;GAAQ,EAC9E;EACF,EACF,IACA,CAAC;CACP;AACF;AACA,MAAa,qCAAqC,uBAAuB,YAAY,KAClF,eAAe,iBAAiB,WAAW,WAAW,CACzD;AACA,MAAa,sCAAsC,kCACjD,wBACA,kCACF;AACA,MAAa,uCAAuC,gBAClD,oCAAoC,cAAc,IAAI,WAAW"}
@@ -1,8 +1,8 @@
1
- import { o as SurveyAssistantCapabilityManifest } from "./capabilities-CmeeAjEc.mjs";
1
+ import { i as SurveyAssistantCapabilityManifest } from "./capabilities-z95e1mti.mjs";
2
2
  //#region src/protocol/digest.d.ts
3
3
  declare const stableStringify: (value: unknown) => string;
4
4
  declare const hashString: (input: string) => string;
5
5
  declare const buildCapabilityDigest: (manifest: Omit<SurveyAssistantCapabilityManifest, "digest">) => string;
6
6
  //#endregion
7
7
  export { hashString as n, stableStringify as r, buildCapabilityDigest as t };
8
- //# sourceMappingURL=digest-C39WyAWG.d.mts.map
8
+ //# sourceMappingURL=digest-FnTTDBq2.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest-FnTTDBq2.d.mts","names":[],"sources":["../src/protocol/digest.ts"],"mappings":";;cAEa,kBAAmB;cAcnB,aAAc;cASd,wBACX,UAAU,KAAK"}
package/dist/digest.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as hashString, r as stableStringify, t as buildCapabilityDigest } from "./digest-C39WyAWG.mjs";
1
+ import { n as hashString, r as stableStringify, t as buildCapabilityDigest } from "./digest-FnTTDBq2.mjs";
2
2
  export { buildCapabilityDigest, hashString, stableStringify };