@seed-ship/mcp-ui-solid 6.24.0 → 7.0.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 (353) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +61 -0
  3. package/dist/adapters/connector.cjs +3 -3
  4. package/dist/adapters/connector.cjs.map +1 -1
  5. package/dist/adapters/connector.d.cts +108 -0
  6. package/dist/adapters/connector.d.ts +1 -2
  7. package/dist/adapters/connector.js +3 -3
  8. package/dist/adapters/connector.js.map +1 -1
  9. package/dist/adapters/index.d.cts +21 -0
  10. package/dist/adapters/index.d.ts +6 -7
  11. package/dist/adapters/macro-run.d.cts +99 -0
  12. package/dist/adapters/macro-run.d.ts +1 -2
  13. package/dist/adapters/presentation.d.cts +1 -2
  14. package/dist/adapters/presentation.d.ts +1 -2
  15. package/dist/adapters.d.cts +1 -1
  16. package/dist/adapters.d.ts +1 -1
  17. package/dist/components/ActionGroupRenderer.cjs +6 -6
  18. package/dist/components/ActionGroupRenderer.cjs.map +1 -1
  19. package/dist/components/ActionGroupRenderer.d.cts +38 -0
  20. package/dist/components/ActionGroupRenderer.d.ts +1 -2
  21. package/dist/components/ActionGroupRenderer.js +6 -6
  22. package/dist/components/ActionGroupRenderer.js.map +1 -1
  23. package/dist/components/ActionRenderer.d.cts +9 -0
  24. package/dist/components/ActionRenderer.d.ts +0 -1
  25. package/dist/components/AgentCard.d.cts +19 -0
  26. package/dist/components/AgentCard.d.ts +1 -2
  27. package/dist/components/AgentHandoff.d.cts +11 -0
  28. package/dist/components/AgentHandoff.d.ts +1 -2
  29. package/dist/components/ArtifactRenderer.d.cts +11 -0
  30. package/dist/components/ArtifactRenderer.d.ts +0 -1
  31. package/dist/components/AutocompleteDropdown.cjs +6 -6
  32. package/dist/components/AutocompleteDropdown.cjs.map +1 -1
  33. package/dist/components/AutocompleteDropdown.d.cts +70 -0
  34. package/dist/components/AutocompleteDropdown.d.ts +1 -2
  35. package/dist/components/AutocompleteDropdown.js +6 -6
  36. package/dist/components/AutocompleteDropdown.js.map +1 -1
  37. package/dist/components/AutocompleteFormField.cjs +6 -5
  38. package/dist/components/AutocompleteFormField.cjs.map +1 -1
  39. package/dist/components/AutocompleteFormField.d.cts +51 -0
  40. package/dist/components/AutocompleteFormField.d.ts +1 -2
  41. package/dist/components/AutocompleteFormField.d.ts.map +1 -1
  42. package/dist/components/AutocompleteFormField.js +6 -5
  43. package/dist/components/AutocompleteFormField.js.map +1 -1
  44. package/dist/components/BriefingDiff.d.cts +11 -0
  45. package/dist/components/BriefingDiff.d.ts +1 -2
  46. package/dist/components/CarouselRenderer.d.cts +12 -0
  47. package/dist/components/CarouselRenderer.d.ts +1 -2
  48. package/dist/components/ChartJSRenderer.cjs +216 -6
  49. package/dist/components/ChartJSRenderer.cjs.map +1 -1
  50. package/dist/components/ChartJSRenderer.d.cts +62 -0
  51. package/dist/components/ChartJSRenderer.d.ts +1 -2
  52. package/dist/components/ChartJSRenderer.d.ts.map +1 -1
  53. package/dist/components/ChartJSRenderer.js +217 -7
  54. package/dist/components/ChartJSRenderer.js.map +1 -1
  55. package/dist/components/ChatPrompt.cjs +5 -5
  56. package/dist/components/ChatPrompt.cjs.map +1 -1
  57. package/dist/components/ChatPrompt.d.cts +69 -0
  58. package/dist/components/ChatPrompt.d.ts +1 -2
  59. package/dist/components/ChatPrompt.js +5 -5
  60. package/dist/components/ChatPrompt.js.map +1 -1
  61. package/dist/components/CodeBlockRenderer.d.cts +23 -0
  62. package/dist/components/CodeBlockRenderer.d.ts +1 -2
  63. package/dist/components/ComponentToolbar.cjs +5 -5
  64. package/dist/components/ComponentToolbar.cjs.map +1 -1
  65. package/dist/components/ComponentToolbar.d.cts +46 -0
  66. package/dist/components/ComponentToolbar.d.ts +0 -1
  67. package/dist/components/ComponentToolbar.js +5 -5
  68. package/dist/components/ComponentToolbar.js.map +1 -1
  69. package/dist/components/DataPreviewSection.d.cts +11 -0
  70. package/dist/components/DataPreviewSection.d.ts +1 -2
  71. package/dist/components/DegradedFallback.cjs +1 -1
  72. package/dist/components/DegradedFallback.cjs.map +1 -1
  73. package/dist/components/DegradedFallback.d.cts +43 -0
  74. package/dist/components/DegradedFallback.d.ts +0 -1
  75. package/dist/components/DegradedFallback.js +1 -1
  76. package/dist/components/DegradedFallback.js.map +1 -1
  77. package/dist/components/DraggableGridItem.d.cts +94 -0
  78. package/dist/components/DraggableGridItem.d.ts +1 -2
  79. package/dist/components/EditableLayoutContext.d.cts +4 -0
  80. package/dist/components/EditableLayoutContext.d.ts +0 -1
  81. package/dist/components/EditableUIResourceRenderer.d.cts +42 -0
  82. package/dist/components/EditableUIResourceRenderer.d.ts +1 -2
  83. package/dist/components/ElicitationForm.d.cts +67 -0
  84. package/dist/components/ElicitationForm.d.ts +1 -2
  85. package/dist/components/ExpandableWrapper.cjs +10 -7
  86. package/dist/components/ExpandableWrapper.cjs.map +1 -1
  87. package/dist/components/ExpandableWrapper.d.cts +49 -0
  88. package/dist/components/ExpandableWrapper.d.ts +0 -1
  89. package/dist/components/ExpandableWrapper.d.ts.map +1 -1
  90. package/dist/components/ExpandableWrapper.js +10 -7
  91. package/dist/components/ExpandableWrapper.js.map +1 -1
  92. package/dist/components/FeedbackInline.d.cts +70 -0
  93. package/dist/components/FeedbackInline.d.ts +0 -1
  94. package/dist/components/FooterRenderer.d.cts +15 -0
  95. package/dist/components/FooterRenderer.d.ts +0 -1
  96. package/dist/components/FormFieldRenderer.cjs +13 -12
  97. package/dist/components/FormFieldRenderer.cjs.map +1 -1
  98. package/dist/components/FormFieldRenderer.d.cts +19 -0
  99. package/dist/components/FormFieldRenderer.d.ts +1 -2
  100. package/dist/components/FormFieldRenderer.d.ts.map +1 -1
  101. package/dist/components/FormFieldRenderer.js +13 -12
  102. package/dist/components/FormFieldRenderer.js.map +1 -1
  103. package/dist/components/FormRenderer.cjs +1 -1
  104. package/dist/components/FormRenderer.cjs.map +1 -1
  105. package/dist/components/FormRenderer.d.cts +14 -0
  106. package/dist/components/FormRenderer.d.ts +1 -2
  107. package/dist/components/FormRenderer.js +1 -1
  108. package/dist/components/FormRenderer.js.map +1 -1
  109. package/dist/components/GenerativeUIErrorBoundary.cjs +1 -1
  110. package/dist/components/GenerativeUIErrorBoundary.cjs.map +1 -1
  111. package/dist/components/GenerativeUIErrorBoundary.d.cts +58 -0
  112. package/dist/components/GenerativeUIErrorBoundary.d.ts +1 -2
  113. package/dist/components/GenerativeUIErrorBoundary.default.d.cts +1 -0
  114. package/dist/components/GenerativeUIErrorBoundary.default.d.ts +1 -2
  115. package/dist/components/GenerativeUIErrorBoundary.js +1 -1
  116. package/dist/components/GenerativeUIErrorBoundary.js.map +1 -1
  117. package/dist/components/GhostText.cjs +2 -2
  118. package/dist/components/GhostText.cjs.map +1 -1
  119. package/dist/components/GhostText.d.cts +112 -0
  120. package/dist/components/GhostText.d.ts +0 -1
  121. package/dist/components/GhostText.js +2 -2
  122. package/dist/components/GhostText.js.map +1 -1
  123. package/dist/components/GraphRenderer.cjs +100 -29
  124. package/dist/components/GraphRenderer.cjs.map +1 -1
  125. package/dist/components/GraphRenderer.d.cts +66 -0
  126. package/dist/components/GraphRenderer.d.ts +2 -3
  127. package/dist/components/GraphRenderer.d.ts.map +1 -1
  128. package/dist/components/GraphRenderer.js +100 -29
  129. package/dist/components/GraphRenderer.js.map +1 -1
  130. package/dist/components/GridRenderer.d.cts +49 -0
  131. package/dist/components/GridRenderer.d.ts +1 -2
  132. package/dist/components/IframeFallbackLink.d.cts +22 -0
  133. package/dist/components/IframeFallbackLink.d.ts +0 -1
  134. package/dist/components/ImageGalleryRenderer.d.cts +22 -0
  135. package/dist/components/ImageGalleryRenderer.d.ts +1 -2
  136. package/dist/components/LightboxOverlay.d.cts +31 -0
  137. package/dist/components/LightboxOverlay.d.ts +1 -2
  138. package/dist/components/MapRenderer.d.cts +77 -0
  139. package/dist/components/MapRenderer.d.ts +1 -2
  140. package/dist/components/MissingValue.cjs +2 -2
  141. package/dist/components/MissingValue.cjs.map +1 -1
  142. package/dist/components/MissingValue.d.cts +26 -0
  143. package/dist/components/MissingValue.d.ts +0 -1
  144. package/dist/components/MissingValue.js +2 -2
  145. package/dist/components/MissingValue.js.map +1 -1
  146. package/dist/components/ModalRenderer.cjs +39 -31
  147. package/dist/components/ModalRenderer.cjs.map +1 -1
  148. package/dist/components/ModalRenderer.d.cts +66 -0
  149. package/dist/components/ModalRenderer.d.ts +1 -2
  150. package/dist/components/ModalRenderer.d.ts.map +1 -1
  151. package/dist/components/ModalRenderer.js +40 -32
  152. package/dist/components/ModalRenderer.js.map +1 -1
  153. package/dist/components/PortalDropdownMenu.cjs +6 -3
  154. package/dist/components/PortalDropdownMenu.cjs.map +1 -1
  155. package/dist/components/PortalDropdownMenu.d.cts +55 -0
  156. package/dist/components/PortalDropdownMenu.d.ts +0 -1
  157. package/dist/components/PortalDropdownMenu.d.ts.map +1 -1
  158. package/dist/components/PortalDropdownMenu.js +7 -4
  159. package/dist/components/PortalDropdownMenu.js.map +1 -1
  160. package/dist/components/PresentationFeedback.d.cts +112 -0
  161. package/dist/components/PresentationFeedback.d.ts +0 -1
  162. package/dist/components/RenderContext.d.cts +41 -0
  163. package/dist/components/RenderContext.d.ts +1 -2
  164. package/dist/components/ResizeHandle.d.cts +49 -0
  165. package/dist/components/ResizeHandle.d.ts +0 -1
  166. package/dist/components/SafeHtml.d.cts +45 -0
  167. package/dist/components/SafeHtml.d.ts +0 -1
  168. package/dist/components/ScratchpadPanel.cjs +38 -44
  169. package/dist/components/ScratchpadPanel.cjs.map +1 -1
  170. package/dist/components/ScratchpadPanel.d.cts +34 -0
  171. package/dist/components/ScratchpadPanel.d.ts +1 -2
  172. package/dist/components/ScratchpadPanel.d.ts.map +1 -1
  173. package/dist/components/ScratchpadPanel.js +38 -44
  174. package/dist/components/ScratchpadPanel.js.map +1 -1
  175. package/dist/components/SplitStepper.d.cts +11 -0
  176. package/dist/components/SplitStepper.d.ts +1 -2
  177. package/dist/components/StreamingUIRenderer.d.cts +58 -0
  178. package/dist/components/StreamingUIRenderer.d.ts +3 -4
  179. package/dist/components/UIResourceRenderer.cjs +20 -20
  180. package/dist/components/UIResourceRenderer.cjs.map +1 -1
  181. package/dist/components/UIResourceRenderer.d.cts +181 -0
  182. package/dist/components/UIResourceRenderer.d.ts +3 -4
  183. package/dist/components/UIResourceRenderer.default.d.cts +1 -0
  184. package/dist/components/UIResourceRenderer.default.d.ts +1 -2
  185. package/dist/components/UIResourceRenderer.js +20 -20
  186. package/dist/components/UIResourceRenderer.js.map +1 -1
  187. package/dist/components/VerifiedText.d.cts +22 -0
  188. package/dist/components/VerifiedText.d.ts +1 -2
  189. package/dist/components/VideoRenderer.d.cts +41 -0
  190. package/dist/components/VideoRenderer.d.ts +1 -2
  191. package/dist/components/chart-data-table.d.cts +68 -0
  192. package/dist/components/chart-data-table.d.ts +0 -1
  193. package/dist/components/chart-missing-plugin.cjs +4 -4
  194. package/dist/components/chart-missing-plugin.cjs.map +1 -1
  195. package/dist/components/chart-missing-plugin.d.cts +128 -0
  196. package/dist/components/chart-missing-plugin.d.ts +4 -3
  197. package/dist/components/chart-missing-plugin.d.ts.map +1 -1
  198. package/dist/components/chart-missing-plugin.js +4 -4
  199. package/dist/components/chart-missing-plugin.js.map +1 -1
  200. package/dist/components/index.d.cts +62 -0
  201. package/dist/components/index.d.ts +57 -58
  202. package/dist/components.d.cts +2 -2
  203. package/dist/components.d.ts +2 -2
  204. package/dist/context/AutocompleteContext.d.cts +76 -0
  205. package/dist/context/AutocompleteContext.d.ts +1 -2
  206. package/dist/context/MCPActionContext.d.cts +169 -0
  207. package/dist/context/MCPActionContext.d.ts +0 -1
  208. package/dist/context/MCPUIConfigContext.d.cts +201 -0
  209. package/dist/context/MCPUIConfigContext.d.ts +1 -2
  210. package/dist/context/MCPUIMathContext.d.cts +17 -0
  211. package/dist/context/MCPUIMathContext.d.ts +0 -1
  212. package/dist/context/MCPUIStringsContext.d.cts +802 -0
  213. package/dist/context/MCPUIStringsContext.d.ts +1 -2
  214. package/dist/context/MCPUITelemetryContext.d.cts +35 -0
  215. package/dist/context/MCPUITelemetryContext.d.ts +1 -2
  216. package/dist/context/index.d.cts +7 -0
  217. package/dist/context/index.d.ts +2 -3
  218. package/dist/hooks/createResponsiveGrid.d.cts +5 -0
  219. package/dist/hooks/createResponsiveGrid.d.ts +0 -1
  220. package/dist/hooks/index.d.cts +25 -0
  221. package/dist/hooks/index.d.ts +20 -21
  222. package/dist/hooks/useAction.d.cts +164 -0
  223. package/dist/hooks/useAction.d.ts +2 -3
  224. package/dist/hooks/useAutocomplete.d.cts +118 -0
  225. package/dist/hooks/useAutocomplete.d.ts +1 -2
  226. package/dist/hooks/useChatBus.d.cts +55 -0
  227. package/dist/hooks/useChatBus.d.ts +1 -2
  228. package/dist/hooks/useConditionalField.d.cts +34 -0
  229. package/dist/hooks/useConditionalField.d.ts +1 -2
  230. package/dist/hooks/useDataValidator.d.cts +41 -0
  231. package/dist/hooks/useDataValidator.d.ts +1 -2
  232. package/dist/hooks/useDragDrop.d.cts +99 -0
  233. package/dist/hooks/useDragDrop.d.ts +1 -2
  234. package/dist/hooks/useFormPersistence.d.cts +80 -0
  235. package/dist/hooks/useFormPersistence.d.ts +0 -1
  236. package/dist/hooks/useModal.d.cts +106 -0
  237. package/dist/hooks/useModal.d.ts +0 -1
  238. package/dist/hooks/useResize.d.cts +86 -0
  239. package/dist/hooks/useResize.d.ts +1 -2
  240. package/dist/hooks/useStreamingUI.d.cts +117 -0
  241. package/dist/hooks/useStreamingUI.d.ts +1 -2
  242. package/dist/hooks.d.cts +1 -1
  243. package/dist/hooks.d.ts +1 -1
  244. package/dist/index.d.cts +91 -92
  245. package/dist/index.d.ts +91 -92
  246. package/dist/plugins/duckdb.d.cts +1 -2
  247. package/dist/plugins/duckdb.d.ts +1 -2
  248. package/dist/plugins/groq.d.cts +12 -0
  249. package/dist/plugins/groq.d.ts +1 -2
  250. package/dist/plugins/index.d.cts +9 -0
  251. package/dist/plugins/index.d.ts +3 -4
  252. package/dist/plugins/katex.d.cts +1 -2
  253. package/dist/plugins/katex.d.ts +1 -2
  254. package/dist/plugins/rest.d.cts +12 -0
  255. package/dist/plugins/rest.d.ts +1 -2
  256. package/dist/plugins/supabase.d.cts +12 -0
  257. package/dist/plugins/supabase.d.ts +1 -2
  258. package/dist/services/chat-bus.d.cts +100 -0
  259. package/dist/services/chat-bus.d.ts +1 -2
  260. package/dist/services/chat-prompt-controller.d.cts +92 -0
  261. package/dist/services/chat-prompt-controller.d.ts +1 -2
  262. package/dist/services/component-registry.d.cts +119 -0
  263. package/dist/services/component-registry.d.ts +1 -2
  264. package/dist/services/data-validator.d.cts +27 -0
  265. package/dist/services/data-validator.d.ts +1 -2
  266. package/dist/services/index.d.cts +9 -0
  267. package/dist/services/index.d.ts +4 -5
  268. package/dist/services/telemetry.d.cts +86 -0
  269. package/dist/services/telemetry.d.ts +1 -2
  270. package/dist/services/validation.d.cts +169 -0
  271. package/dist/services/validation.d.ts +1 -2
  272. package/dist/stores/scratchpad-store.d.cts +109 -0
  273. package/dist/stores/scratchpad-store.d.ts +1 -2
  274. package/dist/stores/server-capabilities-store.d.cts +171 -0
  275. package/dist/stores/server-capabilities-store.d.ts +0 -1
  276. package/dist/test-setup.d.cts +5 -0
  277. package/dist/test-setup.d.ts +0 -1
  278. package/dist/testing/index.d.cts +34 -0
  279. package/dist/testing/index.d.ts +1 -2
  280. package/dist/types/chat-bus.d.cts +783 -0
  281. package/dist/types/chat-bus.d.ts +4 -5
  282. package/dist/types/index.d.cts +1616 -0
  283. package/dist/types/index.d.ts +0 -1
  284. package/dist/types-export.d.cts +1 -2
  285. package/dist/types-export.d.ts +1 -2
  286. package/dist/types.d.cts +1 -1
  287. package/dist/types.d.ts +1 -1
  288. package/dist/utils/degraded-projections.d.cts +119 -0
  289. package/dist/utils/degraded-projections.d.ts +0 -1
  290. package/dist/utils/duplicate-mount-registry.d.cts +83 -0
  291. package/dist/utils/duplicate-mount-registry.d.ts +0 -1
  292. package/dist/utils/escape-html.d.cts +12 -0
  293. package/dist/utils/escape-html.d.ts +0 -1
  294. package/dist/utils/format-string.d.cts +25 -0
  295. package/dist/utils/format-string.d.ts +0 -1
  296. package/dist/utils/iframe-coep.d.cts +53 -0
  297. package/dist/utils/iframe-coep.d.ts +1 -2
  298. package/dist/utils/logger.d.cts +57 -0
  299. package/dist/utils/logger.d.ts +0 -1
  300. package/dist/utils/math-markdown.cjs +1 -1
  301. package/dist/utils/math-markdown.cjs.map +1 -1
  302. package/dist/utils/math-markdown.d.cts +15 -0
  303. package/dist/utils/math-markdown.d.ts +1 -2
  304. package/dist/utils/math-markdown.js +1 -1
  305. package/dist/utils/math-markdown.js.map +1 -1
  306. package/dist/utils/missing-value.d.cts +78 -0
  307. package/dist/utils/missing-value.d.ts +0 -1
  308. package/dist/utils/pan-zoom.d.cts +234 -0
  309. package/dist/utils/pan-zoom.d.ts +0 -1
  310. package/dist/utils/perf.d.cts +18 -0
  311. package/dist/utils/perf.d.ts +0 -1
  312. package/dist/utils/safe-url.d.cts +33 -0
  313. package/dist/utils/safe-url.d.ts +0 -1
  314. package/dist/utils/sanitize-html.d.cts +142 -0
  315. package/dist/utils/sanitize-html.d.ts +0 -1
  316. package/dist/utils/stable-key.d.cts +32 -0
  317. package/dist/utils/stable-key.d.ts +0 -1
  318. package/dist/utils/theme.cjs +91 -0
  319. package/dist/utils/theme.cjs.map +1 -0
  320. package/dist/utils/theme.d.cts +10 -0
  321. package/dist/utils/theme.d.ts +10 -0
  322. package/dist/utils/theme.d.ts.map +1 -0
  323. package/dist/utils/theme.js +91 -0
  324. package/dist/utils/theme.js.map +1 -0
  325. package/dist/validation.d.cts +3 -4
  326. package/dist/validation.d.ts +3 -4
  327. package/docs/SECURITY-DEPENDENCIES.md +209 -0
  328. package/docs/THEMING.md +205 -0
  329. package/docs/ZOD4-STABLE-MIGRATION-2026-10-26.md +181 -0
  330. package/package.json +12 -9
  331. package/src/adapters/connector.ts +3 -3
  332. package/src/components/ActionGroupRenderer.tsx +6 -6
  333. package/src/components/AutocompleteDropdown.tsx +17 -17
  334. package/src/components/AutocompleteFormField.tsx +10 -9
  335. package/src/components/ChartJSRenderer.tsx +483 -239
  336. package/src/components/ChatPrompt.tsx +16 -16
  337. package/src/components/ComponentToolbar.tsx +5 -5
  338. package/src/components/DegradedFallback.tsx +9 -9
  339. package/src/components/ExpandableWrapper.tsx +15 -11
  340. package/src/components/FormFieldRenderer.tsx +52 -51
  341. package/src/components/FormRenderer.tsx +12 -12
  342. package/src/components/GenerativeUIErrorBoundary.tsx +6 -6
  343. package/src/components/GhostText.tsx +7 -7
  344. package/src/components/GraphRenderer.tsx +83 -67
  345. package/src/components/MissingValue.tsx +2 -2
  346. package/src/components/ModalRenderer.tsx +11 -5
  347. package/src/components/PortalDropdownMenu.tsx +6 -2
  348. package/src/components/ScratchpadPanel.tsx +144 -141
  349. package/src/components/UIResourceRenderer.tsx +101 -101
  350. package/src/components/chart-missing-plugin.ts +5 -3
  351. package/src/styles/autocomplete.css +53 -53
  352. package/src/utils/math-markdown.ts +1 -1
  353. package/src/utils/theme.ts +101 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,70 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [7.0.0] - Unreleased
9
+
10
+ ### Breaking — Zod types, not the Solid engine
11
+
12
+ - Use Zod 4.6.6 and Spec ^6.0.0 while retaining Solid 1 and the existing renderer,
13
+ peer range, engine loading, sanitizer and MCP wire contracts. Adapt connector
14
+ records and preserve application validation codes/paths; native Zod messages
15
+ can change. The paused Solid 2 preview is not resumed.
16
+ - Qualify emitted ESM/CJS declarations with a real packed-consumer TypeScript
17
+ gate and retain the existing resource-size behavior explicitly as a limitation.
18
+ - See `docs/ZOD4-STABLE-MIGRATION-2026-10-26.md` for compatibility and release gates.
19
+
20
+ ## Historical tooling follow-up before Zod 4
21
+
22
+ ### Security — development tooling only
23
+
24
+ - Pin Vite 6.4.5, Vitest 4.1.12 and `@vitest/ui` 4.1.12; the lockfile also
25
+ resolves `@vitest/mocker` 4.1.12. Keep Solid 1 and the existing compiler plugin.
26
+ - Runtime Zod remains 3.25.76 and its advisory remains open. No public schema,
27
+ runtime dependency or package version change is implied by these tooling fixes.
28
+ See `docs/SECURITY-DEPENDENCIES.md` for current evidence and the migration gate.
29
+
30
+ ## [6.25.1] - 2026-10-18
31
+
32
+ ### Security
33
+
34
+ - Raise the published DOMPurify floor to `^3.4.17` (lockfile: 3.4.17), covering
35
+ both reported `IN_PLACE` advisories and subsequent upstream hardening. The
36
+ library's existing string-based sanitization profiles remain unchanged.
37
+ - Update workspace Solid to 1.9.17 and Seroval/Seroval plugins to 1.6.11,
38
+ using Solid's supported 1.6.x dependency range instead of the stale 1.5.x
39
+ override. Add real asynchronous SSR and JSON serialization compatibility tests.
40
+ - Update build/test resolutions to `source-map-js` 1.2.2 and `brace-expansion`
41
+ 5.0.12. Audit falls from nine advisories to one remaining HIGH advisory in
42
+ the distinct, unpatched development dependency `braces` 3.0.3. No audit ignore
43
+ or advisory dismissal is added; see `docs/SECURITY-DEPENDENCIES.md`.
44
+ - Workspace overrides do not propagate to consuming applications. Hosts must
45
+ separately update their Solid/Seroval lockfiles; the public Solid peer range
46
+ and component APIs are unchanged.
47
+
48
+ ## [6.25.0] - 2026-10-18
49
+
50
+ ### Added
51
+
52
+ - Inherited `--mcp-ui-*` CSS theme tokens with per-use original color fallbacks
53
+ for prompts, resource/table chrome, scratchpads, form controls, autocomplete,
54
+ expanded dialogs, export menus and chart/graph chrome. No required provider,
55
+ new dependency, global root defaults or component prop changes.
56
+ - Body portal theme synchronization, including local `.dark`, live ancestor
57
+ token changes and removal; fullscreen content retains its original DOM.
58
+ - Scoped Chart.js/G6 series, grid, axis, label and tooltip tokens with live
59
+ updates and explicit caller color precedence; original engine defaults are
60
+ retained when no host tokens are supplied.
61
+ - Frozen 6.24.0 Chromium computed-style comparisons, host/portal regressions,
62
+ static Tailwind class checks and theming documentation with coverage limits.
63
+
64
+ ### Fixed
65
+
66
+ - Form input and autocomplete text respects the host foreground without a
67
+ `.dark` class, preserving inherited default colors and muted field states.
68
+ - Explicit point paints no longer block themed line/radar strokes. Live
69
+ Chart.js theme updates also refresh resolved shared point/bar colors without
70
+ replacing their options or changing caller-provided non-color settings.
71
+
8
72
  ## [6.24.0] - 2026-10-03
9
73
 
10
74
  Explicit missing values in charts and tables, and a unit per chart — lot 1 of
package/README.md CHANGED
@@ -1,10 +1,71 @@
1
1
  # @seed-ship/mcp-ui-solid
2
2
 
3
+ ## Prepared v7.0.0 — Zod 4, still Solid 1
4
+
5
+ This stable-line candidate uses Zod `4.6.6` and requires Spec `^6.0.0`.
6
+ The Solid peer remains `^1.9.0`; no Solid 2 renderer or visual redesign is
7
+ included. This conservative major marks the Spec 6 dependency/public-type
8
+ compatibility boundary, not a new Solid engine or a direct Solid-local Zod
9
+ schema-class export. JSON acceptance, absent optional fields and application
10
+ validation codes/paths are preserved; native Zod error messages can change.
11
+
12
+ This is not the paused `7.0.0-solid2.0` experiment. Do not consume its branch or
13
+ old archives for this release. See the [migration record](./docs/ZOD4-STABLE-MIGRATION-2026-10-26.md)
14
+ for SemVer, exact gates, resource-limit caveats and the separate publication
15
+ approval. A PR or staged upload is not a public npm release.
16
+
3
17
  SolidJS components + chat toolkit for MCP-generated UI. Part of the [MCP UI ecosystem](https://github.com/theseedship/mcp-ui).
4
18
 
5
19
  [![npm version](https://img.shields.io/npm/v/@seed-ship/mcp-ui-solid.svg)](https://www.npmjs.com/package/@seed-ship/mcp-ui-solid)
6
20
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
21
 
22
+ ## What's New in v6.25.1
23
+
24
+ DOMPurify now requires `^3.4.17`. The workspace uses the compatible Solid
25
+ 1.9.17 patch with corrected Seroval and build-tool dependency resolutions,
26
+ covered by a real server-rendering/serialization smoke test. These workspace
27
+ overrides do not update an application's own Solid/Seroval lockfile.
28
+ See [security dependency notes](./docs/SECURITY-DEPENDENCIES.md) for host
29
+ upgrade guidance and the remaining unpatched development-tooling advisory.
30
+
31
+ ## What's New in v6.25.0
32
+
33
+ Inherited `--mcp-ui-*` CSS tokens theme prompts, resource/table chrome,
34
+ scratchpads, form controls, autocomplete and chart/graph chrome. Body portals
35
+ follow their local host theme; mounted Chart.js/G6 instances update without
36
+ losing their identity. Existing colors remain the defaults.
37
+
38
+ ## Theming
39
+
40
+ Set variables on an ancestor; no provider or extra stylesheet is required
41
+ for the Tailwind-based components. Keep scanning this package's `src/**/*.{ts,tsx}`
42
+ with Tailwind v4 and your existing class-based `.dark` variant.
43
+
44
+ ```css
45
+ .app-theme {
46
+ --mcp-ui-surface: #ffffff;
47
+ --mcp-ui-surface-muted: #f1f5f9;
48
+ --mcp-ui-fg: #0f172a;
49
+ --mcp-ui-fg-muted: #475569;
50
+ --mcp-ui-border: #cbd5e1;
51
+ --mcp-ui-accent: #1d4ed8;
52
+ }
53
+ .dark .app-theme {
54
+ --mcp-ui-surface: #0f172a;
55
+ --mcp-ui-surface-muted: #1e293b;
56
+ --mcp-ui-fg: #f8fafc;
57
+ --mcp-ui-fg-muted: #cbd5e1;
58
+ --mcp-ui-border: #64748b;
59
+ --mcp-ui-accent: #93c5fd;
60
+ }
61
+ ```
62
+
63
+ The library deliberately does not redeclare public tokens on nested roots:
64
+ an ancestor's tokens keep inheriting. Each use falls back to its original
65
+ color, preserving the existing light/dark distinctions. Optional autocomplete
66
+ CSS is still imported as before. See [the complete token reference, portal
67
+ behavior, contrast limits and migration coverage](./docs/THEMING.md).
68
+
8
69
  ## What's New in v6.24.0
9
70
 
10
71
  Explicit missing values in charts and tables, and a `unit` per chart. A `null`
@@ -28,9 +28,9 @@ const LenientResultSchema = zod.z.object({
28
28
  query: zod.z.string(),
29
29
  queryHash: zod.z.string().optional(),
30
30
  intent: zod.z.string().optional(),
31
- primary: zod.z.record(zod.z.unknown()),
32
- supplemental: zod.z.array(zod.z.record(zod.z.unknown())).optional(),
33
- actions: zod.z.array(zod.z.record(zod.z.unknown())).optional()
31
+ primary: zod.z.record(zod.z.string(), zod.z.unknown()),
32
+ supplemental: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())).optional(),
33
+ actions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())).optional()
34
34
  });
35
35
  const DEFAULT_GRID = { columns: 12, gap: "1rem" };
36
36
  function withPosition(component) {
@@ -1 +1 @@
1
- {"version":3,"file":"connector.cjs","sources":["../../src/adapters/connector.ts"],"sourcesContent":["/**\n * Connector adapters — `ConnectorDynamicResultV1` → MCP-UI render structures.\n *\n * @since v6.6.0 (D5 / D6 of ROADMAP-opendata-macro-mcpui)\n *\n * ## Opt-in, pure\n *\n * These adapters are published under the dedicated subpath\n * `@seed-ship/mcp-ui-solid/adapters` — they are NEVER imported by the core\n * renderer path, so a consumer that does not emit connector results pays\n * nothing for them.\n *\n * Every adapter here is a **pure function** (D5) : same input → same\n * output, no `fetch`, no `localStorage`, no global state, no clock, no\n * randomness. This is what lets a host re-run an adapter deterministically\n * after presentation feedback (D1) and replay fixtures in tests.\n *\n * ## Unknown schema version — never throw (R2)\n *\n * `connectorResultToUILayout()` never throws on the runtime render path.\n * A payload it cannot read becomes an explicit degraded `UILayout` (a\n * visible notice), never a silent disappearance and never an exception.\n */\n\nimport type { UIComponent, UILayout, GridPosition } from '../types'\nimport {\n ConnectorDynamicResultV1Schema,\n CONNECTOR_DYNAMIC_RESULT_V1,\n type ConnectorAction,\n} from '@seed-ship/mcp-ui-spec'\nimport { z } from 'zod'\nimport { formatMCPUIString } from '../utils/format-string'\n\n// ─────────────────────────────────────────────────────────────\n// connectorActionsToActionGroup\n// ─────────────────────────────────────────────────────────────\n\nexport interface ConnectorActionsToActionGroupOptions {\n /** Component id. Default `'connector-actions'`. */\n id?: string\n /** Optional heading shown above the buttons. */\n title?: string\n /** Button row layout. Default `'horizontal'`. */\n layout?: 'horizontal' | 'vertical' | 'space-between' | 'end' | 'center'\n /** Gap between buttons. Default `'md'`. */\n gap?: 'none' | 'sm' | 'md' | 'lg'\n /** Grid position. Default full-width. */\n position?: GridPosition\n}\n\n/**\n * Wraps a connector's `actions` into an `action-group` `UIComponent`.\n *\n * `ConnectorAction` is the exact `action-group` action shape, so this is a\n * thin, pure envelope — no transformation of the actions themselves.\n */\nexport function connectorActionsToActionGroup(\n actions: ConnectorAction[],\n options: ConnectorActionsToActionGroupOptions = {}\n): UIComponent {\n return {\n id: options.id ?? 'connector-actions',\n type: 'action-group',\n position: options.position ?? { colStart: 1, colSpan: 12 },\n params: {\n actions,\n ...(options.title ? { title: options.title } : {}),\n layout: options.layout ?? 'horizontal',\n gap: options.gap ?? 'md',\n },\n } as UIComponent\n}\n\n// ─────────────────────────────────────────────────────────────\n// connectorResultToUILayout\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The visible wording of the two degraded states (R2).\n *\n * These paragraphs are rendered as `text` components, so unlike the payload\n * they are the LIBRARY's own chrome. They cannot go through\n * `MCPUIStrings` — the adapters are runtime-free and never import\n * `solid-js` — so a host localizes them through\n * `ConnectorResultToUILayoutOptions.messages` instead.\n *\n * Every field is a template resolved with `formatMCPUIString`.\n *\n * @since v6.20.0 — the defaults used to be hardcoded French.\n */\nexport interface ConnectorAdapterMessages {\n /**\n * Unreadable payload (tier 3). Template — `{versionSuffix}` is\n * `degradedVersionSuffix` when the payload carried a string\n * `schemaVersion`, and `''` otherwise.\n */\n degradedNotice: string\n /** Inserted into `degradedNotice`. Template — `{version}`. */\n degradedVersionSuffix: string\n /**\n * Usable envelope, unknown version (tier 2). Template — `{version}` = the\n * version read, `{expected}` = `CONNECTOR_DYNAMIC_RESULT_V1`.\n */\n versionWarning: string\n}\n\n/** English defaults for {@link ConnectorAdapterMessages}. */\nexport const DEFAULT_CONNECTOR_MESSAGES: ConnectorAdapterMessages = {\n degradedNotice:\n '### Result not rendered\\n\\nThe connector result could not be interpreted{versionSuffix}. This explicit state replaces a silent disappearance of the rendering.',\n degradedVersionSuffix: ' (schema: `{version}`)',\n versionWarning:\n '> \\u26A0 Unrecognized connector schema (`{version}`, expected `{expected}`). The rendering below is in degraded mode.',\n}\n\nexport interface ConnectorResultToUILayoutOptions {\n /** Layout id. Default derived from `connectorId` + `queryHash` / `toolName`. */\n id?: string\n /** Heading for the actions `action-group`. */\n actionsTitle?: string\n /**\n * Partial override of the degraded-state wording, merged over\n * {@link DEFAULT_CONNECTOR_MESSAGES}. Hosts that render in another\n * language pass their own paragraphs here.\n *\n * @since v6.20.0\n */\n messages?: Partial<ConnectorAdapterMessages>\n}\n\n/**\n * Lenient mirror of `ConnectorDynamicResultV1Schema` — `schemaVersion`\n * relaxed to any string. Used to tell apart \"unknown version but otherwise\n * a usable envelope\" (→ render with a warning, R2) from \"truly unreadable\"\n * (→ explicit error state).\n */\nconst LenientResultSchema = z.object({\n schemaVersion: z.string(),\n connectorId: z.string().min(1),\n toolName: z.string().min(1),\n query: z.string(),\n queryHash: z.string().optional(),\n intent: z.string().optional(),\n primary: z.record(z.unknown()),\n supplemental: z.array(z.record(z.unknown())).optional(),\n actions: z.array(z.record(z.unknown())).optional(),\n})\n\nconst DEFAULT_GRID = { columns: 12, gap: '1rem' } as const\n\nfunction withPosition(component: UIComponent): UIComponent {\n if (component && component.position) return component\n return { ...component, position: { colStart: 1, colSpan: 12 } }\n}\n\n/** A component is a UILayout when it carries a `components` array. */\nfunction isLayoutShape(value: Record<string, unknown>): boolean {\n return Array.isArray((value as { components?: unknown }).components)\n}\n\nfunction degradedTextComponent(id: string, message: string): UIComponent {\n return {\n id,\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: { markdown: true, content: message },\n } as UIComponent\n}\n\n/**\n * Assembles a `ConnectorDynamicResultV1` into a single `UILayout` :\n * `primary` + `supplemental[]` + (`actions` → an `action-group`).\n *\n * - When `primary` is itself a layout, its components are spread in.\n * - Raw data is never sacrificed — every supplied component is kept.\n * - Pure : no side effects, deterministic.\n *\n * ### Degraded behavior (R2)\n *\n * - Valid v1 payload → normal assembled layout.\n * - Unknown `schemaVersion` but an otherwise-usable envelope → the\n * components are still rendered, prefixed with a visible warning notice.\n * - Unreadable payload → an explicit error `UILayout` (a single `text`\n * notice). Never throws, never returns an empty layout silently.\n *\n * A degraded layout always has an `id` starting with `connector-degraded`,\n * so a host can detect it (e.g. for telemetry) without inspecting content.\n */\nexport function connectorResultToUILayout(\n result: unknown,\n options: ConnectorResultToUILayoutOptions = {}\n): UILayout {\n const strict = ConnectorDynamicResultV1Schema.safeParse(result)\n const messages: ConnectorAdapterMessages = { ...DEFAULT_CONNECTOR_MESSAGES, ...options.messages }\n\n // ── Tier 3 : unreadable ───────────────────────────────────\n if (!strict.success) {\n const lenient = LenientResultSchema.safeParse(result)\n if (!lenient.success) {\n const version =\n result && typeof result === 'object'\n ? (result as { schemaVersion?: unknown }).schemaVersion\n : undefined\n return {\n id: 'connector-degraded',\n components: [\n degradedTextComponent(\n 'connector-degraded-notice',\n formatMCPUIString(messages.degradedNotice, {\n versionSuffix:\n typeof version === 'string'\n ? formatMCPUIString(messages.degradedVersionSuffix, { version })\n : '',\n })\n ),\n ],\n grid: { ...DEFAULT_GRID },\n }\n }\n // ── Tier 2 : usable envelope, unknown version ───────────\n const r = lenient.data\n const components: UIComponent[] = [\n degradedTextComponent(\n 'connector-version-warning',\n formatMCPUIString(messages.versionWarning, {\n version: r.schemaVersion,\n expected: CONNECTOR_DYNAMIC_RESULT_V1,\n })\n ),\n ...collectComponents(r),\n ]\n return {\n id: options.id ?? `connector-degraded-${r.connectorId}`,\n components: components.map(withPosition),\n grid: { ...DEFAULT_GRID },\n }\n }\n\n // ── Tier 1 : valid v1 ─────────────────────────────────────\n const r = strict.data\n const components = collectComponents(r, options.actionsTitle).map(withPosition)\n return {\n id: options.id ?? layoutId(r.connectorId, r.queryHash ?? r.toolName),\n components,\n grid: { ...DEFAULT_GRID },\n }\n}\n\n/**\n * Flattens `primary` + `supplemental` + `actions` into a component list.\n * Shared by the valid and degraded-but-usable paths.\n */\nfunction collectComponents(\n r: {\n primary: Record<string, unknown>\n supplemental?: Record<string, unknown>[]\n actions?: unknown[]\n },\n actionsTitle?: string\n): UIComponent[] {\n const components: UIComponent[] = []\n\n if (isLayoutShape(r.primary)) {\n const inner = (r.primary as { components?: UIComponent[] }).components ?? []\n components.push(...inner)\n } else {\n components.push(r.primary as unknown as UIComponent)\n }\n\n if (r.supplemental) {\n components.push(...(r.supplemental as unknown as UIComponent[]))\n }\n\n if (Array.isArray(r.actions) && r.actions.length > 0) {\n components.push(\n connectorActionsToActionGroup(r.actions as ConnectorAction[], {\n id: 'connector-actions',\n title: actionsTitle,\n })\n )\n }\n\n return components\n}\n\nfunction layoutId(connectorId: string, suffix: string): string {\n return `connector-${connectorId}-${suffix}`\n}\n"],"names":["z","ConnectorDynamicResultV1Schema","formatMCPUIString","r","components","CONNECTOR_DYNAMIC_RESULT_V1"],"mappings":";;;;;AAwDO,SAAS,8BACd,SACA,UAAgD,IACnC;AACb,SAAO;AAAA,IACL,IAAI,QAAQ,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,UAAU,QAAQ,YAAY,EAAE,UAAU,GAAG,SAAS,GAAA;AAAA,IACtD,QAAQ;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAA,IAAU,CAAA;AAAA,MAC/C,QAAQ,QAAQ,UAAU;AAAA,MAC1B,KAAK,QAAQ,OAAO;AAAA,IAAA;AAAA,EACtB;AAEJ;AAoCO,MAAM,6BAAuD;AAAA,EAClE,gBACE;AAAA,EACF,uBAAuB;AAAA,EACvB,gBACE;AACJ;AAuBA,MAAM,sBAAsBA,IAAAA,EAAE,OAAO;AAAA,EACnC,eAAeA,IAAAA,EAAE,OAAA;AAAA,EACjB,aAAaA,IAAAA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B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,EAAE,QAAQ,SAAS,GAAG;AACpD,eAAW;AAAA,MACT,8BAA8B,EAAE,SAA8B;AAAA,QAC5D,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA,CACR;AAAA,IAAA;AAAA,EAEL;AAEA,SAAO;AACT;AAEA,SAAS,SAAS,aAAqB,QAAwB;AAC7D,SAAO,aAAa,WAAW,IAAI,MAAM;AAC3C;;;;"}
1
+ {"version":3,"file":"connector.cjs","sources":["../../src/adapters/connector.ts"],"sourcesContent":["/**\n * Connector adapters — `ConnectorDynamicResultV1` → MCP-UI render structures.\n *\n * @since v6.6.0 (D5 / D6 of ROADMAP-opendata-macro-mcpui)\n *\n * ## Opt-in, pure\n *\n * These adapters are published under the dedicated subpath\n * `@seed-ship/mcp-ui-solid/adapters` — they are NEVER imported by the core\n * renderer path, so a consumer that does not emit connector results pays\n * nothing for them.\n *\n * Every adapter here is a **pure function** (D5) : same input → same\n * output, no `fetch`, no `localStorage`, no global state, no clock, no\n * randomness. This is what lets a host re-run an adapter deterministically\n * after presentation feedback (D1) and replay fixtures in tests.\n *\n * ## Unknown schema version — never throw (R2)\n *\n * `connectorResultToUILayout()` never throws on the runtime render path.\n * A payload it cannot read becomes an explicit degraded `UILayout` (a\n * visible notice), never a silent disappearance and never an exception.\n */\n\nimport type { UIComponent, UILayout, GridPosition } from '../types'\nimport {\n ConnectorDynamicResultV1Schema,\n CONNECTOR_DYNAMIC_RESULT_V1,\n type ConnectorAction,\n} from '@seed-ship/mcp-ui-spec'\nimport { z } from 'zod'\nimport { formatMCPUIString } from '../utils/format-string'\n\n// ─────────────────────────────────────────────────────────────\n// connectorActionsToActionGroup\n// ─────────────────────────────────────────────────────────────\n\nexport interface ConnectorActionsToActionGroupOptions {\n /** Component id. Default `'connector-actions'`. */\n id?: string\n /** Optional heading shown above the buttons. */\n title?: string\n /** Button row layout. Default `'horizontal'`. */\n layout?: 'horizontal' | 'vertical' | 'space-between' | 'end' | 'center'\n /** Gap between buttons. Default `'md'`. */\n gap?: 'none' | 'sm' | 'md' | 'lg'\n /** Grid position. Default full-width. */\n position?: GridPosition\n}\n\n/**\n * Wraps a connector's `actions` into an `action-group` `UIComponent`.\n *\n * `ConnectorAction` is the exact `action-group` action shape, so this is a\n * thin, pure envelope — no transformation of the actions themselves.\n */\nexport function connectorActionsToActionGroup(\n actions: ConnectorAction[],\n options: ConnectorActionsToActionGroupOptions = {}\n): UIComponent {\n return {\n id: options.id ?? 'connector-actions',\n type: 'action-group',\n position: options.position ?? { colStart: 1, colSpan: 12 },\n params: {\n actions,\n ...(options.title ? { title: options.title } : {}),\n layout: options.layout ?? 'horizontal',\n gap: options.gap ?? 'md',\n },\n } as UIComponent\n}\n\n// ─────────────────────────────────────────────────────────────\n// connectorResultToUILayout\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The visible wording of the two degraded states (R2).\n *\n * These paragraphs are rendered as `text` components, so unlike the payload\n * they are the LIBRARY's own chrome. They cannot go through\n * `MCPUIStrings` — the adapters are runtime-free and never import\n * `solid-js` — so a host localizes them through\n * `ConnectorResultToUILayoutOptions.messages` instead.\n *\n * Every field is a template resolved with `formatMCPUIString`.\n *\n * @since v6.20.0 — the defaults used to be hardcoded French.\n */\nexport interface ConnectorAdapterMessages {\n /**\n * Unreadable payload (tier 3). Template — `{versionSuffix}` is\n * `degradedVersionSuffix` when the payload carried a string\n * `schemaVersion`, and `''` otherwise.\n */\n degradedNotice: string\n /** Inserted into `degradedNotice`. Template — `{version}`. */\n degradedVersionSuffix: string\n /**\n * Usable envelope, unknown version (tier 2). Template — `{version}` = the\n * version read, `{expected}` = `CONNECTOR_DYNAMIC_RESULT_V1`.\n */\n versionWarning: string\n}\n\n/** English defaults for {@link ConnectorAdapterMessages}. */\nexport const DEFAULT_CONNECTOR_MESSAGES: ConnectorAdapterMessages = {\n degradedNotice:\n '### Result not rendered\\n\\nThe connector result could not be interpreted{versionSuffix}. This explicit state replaces a silent disappearance of the rendering.',\n degradedVersionSuffix: ' (schema: `{version}`)',\n versionWarning:\n '> \\u26A0 Unrecognized connector schema (`{version}`, expected `{expected}`). The rendering below is in degraded mode.',\n}\n\nexport interface ConnectorResultToUILayoutOptions {\n /** Layout id. Default derived from `connectorId` + `queryHash` / `toolName`. */\n id?: string\n /** Heading for the actions `action-group`. */\n actionsTitle?: string\n /**\n * Partial override of the degraded-state wording, merged over\n * {@link DEFAULT_CONNECTOR_MESSAGES}. Hosts that render in another\n * language pass their own paragraphs here.\n *\n * @since v6.20.0\n */\n messages?: Partial<ConnectorAdapterMessages>\n}\n\n/**\n * Lenient mirror of `ConnectorDynamicResultV1Schema` — `schemaVersion`\n * relaxed to any string. Used to tell apart \"unknown version but otherwise\n * a usable envelope\" (→ render with a warning, R2) from \"truly unreadable\"\n * (→ explicit error state).\n */\nconst LenientResultSchema = z.object({\n schemaVersion: z.string(),\n connectorId: z.string().min(1),\n toolName: z.string().min(1),\n query: z.string(),\n queryHash: z.string().optional(),\n intent: z.string().optional(),\n primary: z.record(z.string(), z.unknown()),\n supplemental: z.array(z.record(z.string(), z.unknown())).optional(),\n actions: z.array(z.record(z.string(), z.unknown())).optional(),\n})\n\nconst DEFAULT_GRID = { columns: 12, gap: '1rem' } as const\n\nfunction withPosition(component: UIComponent): UIComponent {\n if (component && component.position) return component\n return { ...component, position: { colStart: 1, colSpan: 12 } }\n}\n\n/** A component is a UILayout when it carries a `components` array. */\nfunction isLayoutShape(value: Record<string, unknown>): boolean {\n return Array.isArray((value as { components?: unknown }).components)\n}\n\nfunction degradedTextComponent(id: string, message: string): UIComponent {\n return {\n id,\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: { markdown: true, content: message },\n } as UIComponent\n}\n\n/**\n * Assembles a `ConnectorDynamicResultV1` into a single `UILayout` :\n * `primary` + `supplemental[]` + (`actions` → an `action-group`).\n *\n * - When `primary` is itself a layout, its components are spread in.\n * - Raw data is never sacrificed — every supplied component is kept.\n * - Pure : no side effects, deterministic.\n *\n * ### Degraded behavior (R2)\n *\n * - Valid v1 payload → normal assembled layout.\n * - Unknown `schemaVersion` but an otherwise-usable envelope → the\n * components are still rendered, prefixed with a visible warning notice.\n * - Unreadable payload → an explicit error `UILayout` (a single `text`\n * notice). Never throws, never returns an empty layout silently.\n *\n * A degraded layout always has an `id` starting with `connector-degraded`,\n * so a host can detect it (e.g. for telemetry) without inspecting content.\n */\nexport function connectorResultToUILayout(\n result: unknown,\n options: ConnectorResultToUILayoutOptions = {}\n): UILayout {\n const strict = ConnectorDynamicResultV1Schema.safeParse(result)\n const messages: ConnectorAdapterMessages = { ...DEFAULT_CONNECTOR_MESSAGES, ...options.messages }\n\n // ── Tier 3 : unreadable ───────────────────────────────────\n if (!strict.success) {\n const lenient = LenientResultSchema.safeParse(result)\n if (!lenient.success) {\n const version =\n result && typeof result === 'object'\n ? (result as { schemaVersion?: unknown }).schemaVersion\n : undefined\n return {\n id: 'connector-degraded',\n components: [\n degradedTextComponent(\n 'connector-degraded-notice',\n formatMCPUIString(messages.degradedNotice, {\n versionSuffix:\n typeof version === 'string'\n ? formatMCPUIString(messages.degradedVersionSuffix, { version })\n : '',\n })\n ),\n ],\n grid: { ...DEFAULT_GRID },\n }\n }\n // ── Tier 2 : usable envelope, unknown version ───────────\n const r = lenient.data\n const components: UIComponent[] = [\n degradedTextComponent(\n 'connector-version-warning',\n formatMCPUIString(messages.versionWarning, {\n version: r.schemaVersion,\n expected: CONNECTOR_DYNAMIC_RESULT_V1,\n })\n ),\n ...collectComponents(r),\n ]\n return {\n id: options.id ?? `connector-degraded-${r.connectorId}`,\n components: components.map(withPosition),\n grid: { ...DEFAULT_GRID },\n }\n }\n\n // ── Tier 1 : valid v1 ─────────────────────────────────────\n const r = strict.data\n const components = collectComponents(r, options.actionsTitle).map(withPosition)\n return {\n id: options.id ?? layoutId(r.connectorId, r.queryHash ?? r.toolName),\n components,\n grid: { ...DEFAULT_GRID },\n }\n}\n\n/**\n * Flattens `primary` + `supplemental` + `actions` into a component list.\n * Shared by the valid and degraded-but-usable paths.\n */\nfunction collectComponents(\n r: {\n primary: Record<string, unknown>\n supplemental?: Record<string, unknown>[]\n actions?: unknown[]\n },\n actionsTitle?: string\n): UIComponent[] {\n const components: UIComponent[] = []\n\n if (isLayoutShape(r.primary)) {\n const inner = (r.primary as { components?: UIComponent[] }).components ?? []\n components.push(...inner)\n } else {\n components.push(r.primary as unknown as UIComponent)\n }\n\n if (r.supplemental) {\n components.push(...(r.supplemental as unknown as UIComponent[]))\n }\n\n if (Array.isArray(r.actions) && r.actions.length > 0) {\n components.push(\n connectorActionsToActionGroup(r.actions as ConnectorAction[], {\n id: 'connector-actions',\n title: actionsTitle,\n })\n )\n }\n\n return components\n}\n\nfunction layoutId(connectorId: string, suffix: string): string {\n return `connector-${connectorId}-${suffix}`\n}\n"],"names":["z","ConnectorDynamicResultV1Schema","formatMCPUIString","r","components","CONNECTOR_DYNAMIC_RESULT_V1"],"mappings":";;;;;AAwDO,SAAS,8BACd,SACA,UAAgD,IACnC;AACb,SAAO;AAAA,IACL,IAAI,QAAQ,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,UAAU,QAAQ,YAAY,EAAE,UAAU,GAAG,SAAS,GAAA;AAAA,IACtD,QAAQ;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAA,IAAU,CAAA;AAAA,MAC/C,QAAQ,QAAQ,UAAU;AAAA,MAC1B,KAAK,QAAQ,OAAO;AAAA,IAAA;AAAA,EACtB;AAEJ;AAoCO,MAAM,6BAAuD;AAAA,EAClE,gBACE;AAAA,EACF,uBAAuB;AAAA,EACvB,gBACE;AACJ;AAuBA,MAAM,sBAAsBA,IAAAA,EAAE,OAAO;AAAA,EACnC,eAAeA,IAAAA,EAAE,OAAA;AAAA,EACjB,aAAaA,IAAAA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,UAAUA,IAAAA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,OAAOA,IAAAA,EAAE,OAAA;AAAA,EACT,WA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AAQ,SAAS,GAAG;AACpD,eAAW;AAAA,MACT,8BAA8B,EAAE,SAA8B;AAAA,QAC5D,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA,CACR;AAAA,IAAA;AAAA,EAEL;AAEA,SAAO;AACT;AAEA,SAAS,SAAS,aAAqB,QAAwB;AAC7D,SAAO,aAAa,WAAW,IAAI,MAAM;AAC3C;;;;"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Connector adapters — `ConnectorDynamicResultV1` → MCP-UI render structures.
3
+ *
4
+ * @since v6.6.0 (D5 / D6 of ROADMAP-opendata-macro-mcpui)
5
+ *
6
+ * ## Opt-in, pure
7
+ *
8
+ * These adapters are published under the dedicated subpath
9
+ * `@seed-ship/mcp-ui-solid/adapters` — they are NEVER imported by the core
10
+ * renderer path, so a consumer that does not emit connector results pays
11
+ * nothing for them.
12
+ *
13
+ * Every adapter here is a **pure function** (D5) : same input → same
14
+ * output, no `fetch`, no `localStorage`, no global state, no clock, no
15
+ * randomness. This is what lets a host re-run an adapter deterministically
16
+ * after presentation feedback (D1) and replay fixtures in tests.
17
+ *
18
+ * ## Unknown schema version — never throw (R2)
19
+ *
20
+ * `connectorResultToUILayout()` never throws on the runtime render path.
21
+ * A payload it cannot read becomes an explicit degraded `UILayout` (a
22
+ * visible notice), never a silent disappearance and never an exception.
23
+ */
24
+ import type { UIComponent, UILayout, GridPosition } from "../types.cjs";
25
+ import { type ConnectorAction } from '@seed-ship/mcp-ui-spec';
26
+ export interface ConnectorActionsToActionGroupOptions {
27
+ /** Component id. Default `'connector-actions'`. */
28
+ id?: string;
29
+ /** Optional heading shown above the buttons. */
30
+ title?: string;
31
+ /** Button row layout. Default `'horizontal'`. */
32
+ layout?: 'horizontal' | 'vertical' | 'space-between' | 'end' | 'center';
33
+ /** Gap between buttons. Default `'md'`. */
34
+ gap?: 'none' | 'sm' | 'md' | 'lg';
35
+ /** Grid position. Default full-width. */
36
+ position?: GridPosition;
37
+ }
38
+ /**
39
+ * Wraps a connector's `actions` into an `action-group` `UIComponent`.
40
+ *
41
+ * `ConnectorAction` is the exact `action-group` action shape, so this is a
42
+ * thin, pure envelope — no transformation of the actions themselves.
43
+ */
44
+ export declare function connectorActionsToActionGroup(actions: ConnectorAction[], options?: ConnectorActionsToActionGroupOptions): UIComponent;
45
+ /**
46
+ * The visible wording of the two degraded states (R2).
47
+ *
48
+ * These paragraphs are rendered as `text` components, so unlike the payload
49
+ * they are the LIBRARY's own chrome. They cannot go through
50
+ * `MCPUIStrings` — the adapters are runtime-free and never import
51
+ * `solid-js` — so a host localizes them through
52
+ * `ConnectorResultToUILayoutOptions.messages` instead.
53
+ *
54
+ * Every field is a template resolved with `formatMCPUIString`.
55
+ *
56
+ * @since v6.20.0 — the defaults used to be hardcoded French.
57
+ */
58
+ export interface ConnectorAdapterMessages {
59
+ /**
60
+ * Unreadable payload (tier 3). Template — `{versionSuffix}` is
61
+ * `degradedVersionSuffix` when the payload carried a string
62
+ * `schemaVersion`, and `''` otherwise.
63
+ */
64
+ degradedNotice: string;
65
+ /** Inserted into `degradedNotice`. Template — `{version}`. */
66
+ degradedVersionSuffix: string;
67
+ /**
68
+ * Usable envelope, unknown version (tier 2). Template — `{version}` = the
69
+ * version read, `{expected}` = `CONNECTOR_DYNAMIC_RESULT_V1`.
70
+ */
71
+ versionWarning: string;
72
+ }
73
+ /** English defaults for {@link ConnectorAdapterMessages}. */
74
+ export declare const DEFAULT_CONNECTOR_MESSAGES: ConnectorAdapterMessages;
75
+ export interface ConnectorResultToUILayoutOptions {
76
+ /** Layout id. Default derived from `connectorId` + `queryHash` / `toolName`. */
77
+ id?: string;
78
+ /** Heading for the actions `action-group`. */
79
+ actionsTitle?: string;
80
+ /**
81
+ * Partial override of the degraded-state wording, merged over
82
+ * {@link DEFAULT_CONNECTOR_MESSAGES}. Hosts that render in another
83
+ * language pass their own paragraphs here.
84
+ *
85
+ * @since v6.20.0
86
+ */
87
+ messages?: Partial<ConnectorAdapterMessages>;
88
+ }
89
+ /**
90
+ * Assembles a `ConnectorDynamicResultV1` into a single `UILayout` :
91
+ * `primary` + `supplemental[]` + (`actions` → an `action-group`).
92
+ *
93
+ * - When `primary` is itself a layout, its components are spread in.
94
+ * - Raw data is never sacrificed — every supplied component is kept.
95
+ * - Pure : no side effects, deterministic.
96
+ *
97
+ * ### Degraded behavior (R2)
98
+ *
99
+ * - Valid v1 payload → normal assembled layout.
100
+ * - Unknown `schemaVersion` but an otherwise-usable envelope → the
101
+ * components are still rendered, prefixed with a visible warning notice.
102
+ * - Unreadable payload → an explicit error `UILayout` (a single `text`
103
+ * notice). Never throws, never returns an empty layout silently.
104
+ *
105
+ * A degraded layout always has an `id` starting with `connector-degraded`,
106
+ * so a host can detect it (e.g. for telemetry) without inspecting content.
107
+ */
108
+ export declare function connectorResultToUILayout(result: unknown, options?: ConnectorResultToUILayoutOptions): UILayout;
@@ -21,7 +21,7 @@
21
21
  * A payload it cannot read becomes an explicit degraded `UILayout` (a
22
22
  * visible notice), never a silent disappearance and never an exception.
23
23
  */
24
- import type { UIComponent, UILayout, GridPosition } from '../types';
24
+ import type { UIComponent, UILayout, GridPosition } from "../types.js";
25
25
  import { type ConnectorAction } from '@seed-ship/mcp-ui-spec';
26
26
  export interface ConnectorActionsToActionGroupOptions {
27
27
  /** Component id. Default `'connector-actions'`. */
@@ -106,4 +106,3 @@ export interface ConnectorResultToUILayoutOptions {
106
106
  * so a host can detect it (e.g. for telemetry) without inspecting content.
107
107
  */
108
108
  export declare function connectorResultToUILayout(result: unknown, options?: ConnectorResultToUILayoutOptions): UILayout;
109
- //# sourceMappingURL=connector.d.ts.map
@@ -26,9 +26,9 @@ const LenientResultSchema = z.object({
26
26
  query: z.string(),
27
27
  queryHash: z.string().optional(),
28
28
  intent: z.string().optional(),
29
- primary: z.record(z.unknown()),
30
- supplemental: z.array(z.record(z.unknown())).optional(),
31
- actions: z.array(z.record(z.unknown())).optional()
29
+ primary: z.record(z.string(), z.unknown()),
30
+ supplemental: z.array(z.record(z.string(), z.unknown())).optional(),
31
+ actions: z.array(z.record(z.string(), z.unknown())).optional()
32
32
  });
33
33
  const DEFAULT_GRID = { columns: 12, gap: "1rem" };
34
34
  function withPosition(component) {
@@ -1 +1 @@
1
- {"version":3,"file":"connector.js","sources":["../../src/adapters/connector.ts"],"sourcesContent":["/**\n * Connector adapters — `ConnectorDynamicResultV1` → MCP-UI render structures.\n *\n * @since v6.6.0 (D5 / D6 of ROADMAP-opendata-macro-mcpui)\n *\n * ## Opt-in, pure\n *\n * These adapters are published under the dedicated subpath\n * `@seed-ship/mcp-ui-solid/adapters` — they are NEVER imported by the core\n * renderer path, so a consumer that does not emit connector results pays\n * nothing for them.\n *\n * Every adapter here is a **pure function** (D5) : same input → same\n * output, no `fetch`, no `localStorage`, no global state, no clock, no\n * randomness. This is what lets a host re-run an adapter deterministically\n * after presentation feedback (D1) and replay fixtures in tests.\n *\n * ## Unknown schema version — never throw (R2)\n *\n * `connectorResultToUILayout()` never throws on the runtime render path.\n * A payload it cannot read becomes an explicit degraded `UILayout` (a\n * visible notice), never a silent disappearance and never an exception.\n */\n\nimport type { UIComponent, UILayout, GridPosition } from '../types'\nimport {\n ConnectorDynamicResultV1Schema,\n CONNECTOR_DYNAMIC_RESULT_V1,\n type ConnectorAction,\n} from '@seed-ship/mcp-ui-spec'\nimport { z } from 'zod'\nimport { formatMCPUIString } from '../utils/format-string'\n\n// ─────────────────────────────────────────────────────────────\n// connectorActionsToActionGroup\n// ─────────────────────────────────────────────────────────────\n\nexport interface ConnectorActionsToActionGroupOptions {\n /** Component id. Default `'connector-actions'`. */\n id?: string\n /** Optional heading shown above the buttons. */\n title?: string\n /** Button row layout. Default `'horizontal'`. */\n layout?: 'horizontal' | 'vertical' | 'space-between' | 'end' | 'center'\n /** Gap between buttons. Default `'md'`. */\n gap?: 'none' | 'sm' | 'md' | 'lg'\n /** Grid position. Default full-width. */\n position?: GridPosition\n}\n\n/**\n * Wraps a connector's `actions` into an `action-group` `UIComponent`.\n *\n * `ConnectorAction` is the exact `action-group` action shape, so this is a\n * thin, pure envelope — no transformation of the actions themselves.\n */\nexport function connectorActionsToActionGroup(\n actions: ConnectorAction[],\n options: ConnectorActionsToActionGroupOptions = {}\n): UIComponent {\n return {\n id: options.id ?? 'connector-actions',\n type: 'action-group',\n position: options.position ?? { colStart: 1, colSpan: 12 },\n params: {\n actions,\n ...(options.title ? { title: options.title } : {}),\n layout: options.layout ?? 'horizontal',\n gap: options.gap ?? 'md',\n },\n } as UIComponent\n}\n\n// ─────────────────────────────────────────────────────────────\n// connectorResultToUILayout\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The visible wording of the two degraded states (R2).\n *\n * These paragraphs are rendered as `text` components, so unlike the payload\n * they are the LIBRARY's own chrome. They cannot go through\n * `MCPUIStrings` — the adapters are runtime-free and never import\n * `solid-js` — so a host localizes them through\n * `ConnectorResultToUILayoutOptions.messages` instead.\n *\n * Every field is a template resolved with `formatMCPUIString`.\n *\n * @since v6.20.0 — the defaults used to be hardcoded French.\n */\nexport interface ConnectorAdapterMessages {\n /**\n * Unreadable payload (tier 3). Template — `{versionSuffix}` is\n * `degradedVersionSuffix` when the payload carried a string\n * `schemaVersion`, and `''` otherwise.\n */\n degradedNotice: string\n /** Inserted into `degradedNotice`. Template — `{version}`. */\n degradedVersionSuffix: string\n /**\n * Usable envelope, unknown version (tier 2). Template — `{version}` = the\n * version read, `{expected}` = `CONNECTOR_DYNAMIC_RESULT_V1`.\n */\n versionWarning: string\n}\n\n/** English defaults for {@link ConnectorAdapterMessages}. */\nexport const DEFAULT_CONNECTOR_MESSAGES: ConnectorAdapterMessages = {\n degradedNotice:\n '### Result not rendered\\n\\nThe connector result could not be interpreted{versionSuffix}. This explicit state replaces a silent disappearance of the rendering.',\n degradedVersionSuffix: ' (schema: `{version}`)',\n versionWarning:\n '> \\u26A0 Unrecognized connector schema (`{version}`, expected `{expected}`). The rendering below is in degraded mode.',\n}\n\nexport interface ConnectorResultToUILayoutOptions {\n /** Layout id. Default derived from `connectorId` + `queryHash` / `toolName`. */\n id?: string\n /** Heading for the actions `action-group`. */\n actionsTitle?: string\n /**\n * Partial override of the degraded-state wording, merged over\n * {@link DEFAULT_CONNECTOR_MESSAGES}. Hosts that render in another\n * language pass their own paragraphs here.\n *\n * @since v6.20.0\n */\n messages?: Partial<ConnectorAdapterMessages>\n}\n\n/**\n * Lenient mirror of `ConnectorDynamicResultV1Schema` — `schemaVersion`\n * relaxed to any string. Used to tell apart \"unknown version but otherwise\n * a usable envelope\" (→ render with a warning, R2) from \"truly unreadable\"\n * (→ explicit error state).\n */\nconst LenientResultSchema = z.object({\n schemaVersion: z.string(),\n connectorId: z.string().min(1),\n toolName: z.string().min(1),\n query: z.string(),\n queryHash: z.string().optional(),\n intent: z.string().optional(),\n primary: z.record(z.unknown()),\n supplemental: z.array(z.record(z.unknown())).optional(),\n actions: z.array(z.record(z.unknown())).optional(),\n})\n\nconst DEFAULT_GRID = { columns: 12, gap: '1rem' } as const\n\nfunction withPosition(component: UIComponent): UIComponent {\n if (component && component.position) return component\n return { ...component, position: { colStart: 1, colSpan: 12 } }\n}\n\n/** A component is a UILayout when it carries a `components` array. */\nfunction isLayoutShape(value: Record<string, unknown>): boolean {\n return Array.isArray((value as { components?: unknown }).components)\n}\n\nfunction degradedTextComponent(id: string, message: string): UIComponent {\n return {\n id,\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: { markdown: true, content: message },\n } as UIComponent\n}\n\n/**\n * Assembles a `ConnectorDynamicResultV1` into a single `UILayout` :\n * `primary` + `supplemental[]` + (`actions` → an `action-group`).\n *\n * - When `primary` is itself a layout, its components are spread in.\n * - Raw data is never sacrificed — every supplied component is kept.\n * - Pure : no side effects, deterministic.\n *\n * ### Degraded behavior (R2)\n *\n * - Valid v1 payload → normal assembled layout.\n * - Unknown `schemaVersion` but an otherwise-usable envelope → the\n * components are still rendered, prefixed with a visible warning notice.\n * - Unreadable payload → an explicit error `UILayout` (a single `text`\n * notice). Never throws, never returns an empty layout silently.\n *\n * A degraded layout always has an `id` starting with `connector-degraded`,\n * so a host can detect it (e.g. for telemetry) without inspecting content.\n */\nexport function connectorResultToUILayout(\n result: unknown,\n options: ConnectorResultToUILayoutOptions = {}\n): UILayout {\n const strict = ConnectorDynamicResultV1Schema.safeParse(result)\n const messages: ConnectorAdapterMessages = { ...DEFAULT_CONNECTOR_MESSAGES, ...options.messages }\n\n // ── Tier 3 : unreadable ───────────────────────────────────\n if (!strict.success) {\n const lenient = LenientResultSchema.safeParse(result)\n if (!lenient.success) {\n const version =\n result && typeof result === 'object'\n ? (result as { schemaVersion?: unknown }).schemaVersion\n : undefined\n return {\n id: 'connector-degraded',\n components: [\n degradedTextComponent(\n 'connector-degraded-notice',\n formatMCPUIString(messages.degradedNotice, {\n versionSuffix:\n typeof version === 'string'\n ? formatMCPUIString(messages.degradedVersionSuffix, { version })\n : '',\n })\n ),\n ],\n grid: { ...DEFAULT_GRID },\n }\n }\n // ── Tier 2 : usable envelope, unknown version ───────────\n const r = lenient.data\n const components: UIComponent[] = [\n degradedTextComponent(\n 'connector-version-warning',\n formatMCPUIString(messages.versionWarning, {\n version: r.schemaVersion,\n expected: CONNECTOR_DYNAMIC_RESULT_V1,\n })\n ),\n ...collectComponents(r),\n ]\n return {\n id: options.id ?? `connector-degraded-${r.connectorId}`,\n components: components.map(withPosition),\n grid: { ...DEFAULT_GRID },\n }\n }\n\n // ── Tier 1 : valid v1 ─────────────────────────────────────\n const r = strict.data\n const components = collectComponents(r, options.actionsTitle).map(withPosition)\n return {\n id: options.id ?? layoutId(r.connectorId, r.queryHash ?? r.toolName),\n components,\n grid: { ...DEFAULT_GRID },\n }\n}\n\n/**\n * Flattens `primary` + `supplemental` + `actions` into a component list.\n * Shared by the valid and degraded-but-usable paths.\n */\nfunction collectComponents(\n r: {\n primary: Record<string, unknown>\n supplemental?: Record<string, unknown>[]\n actions?: unknown[]\n },\n actionsTitle?: string\n): UIComponent[] {\n const components: UIComponent[] = []\n\n if (isLayoutShape(r.primary)) {\n const inner = (r.primary as { components?: UIComponent[] }).components ?? []\n components.push(...inner)\n } else {\n components.push(r.primary as unknown as UIComponent)\n }\n\n if (r.supplemental) {\n components.push(...(r.supplemental as unknown as UIComponent[]))\n }\n\n if (Array.isArray(r.actions) && r.actions.length > 0) {\n components.push(\n connectorActionsToActionGroup(r.actions as ConnectorAction[], {\n id: 'connector-actions',\n title: actionsTitle,\n })\n )\n }\n\n return components\n}\n\nfunction layoutId(connectorId: string, suffix: string): string {\n return `connector-${connectorId}-${suffix}`\n}\n"],"names":["r","components"],"mappings":";;;AAwDO,SAAS,8BACd,SACA,UAAgD,IACnC;AACb,SAAO;AAAA,IACL,IAAI,QAAQ,MAAM;AAAA,IAClB,MAAM;AAAA,IACN,UAAU,QAAQ,YAAY,EAAE,UAAU,GAAG,SAAS,GAAA;AAAA,IACtD,QAAQ;AAAA,MACN;AAAA,MACA,GAAI,QAAQ,QAAQ,EAAE,OAAO,QAAQ,MAAA,IAAU,CAAA;AAAA,MAC/C,QAAQ,QAAQ,UAAU;AAAA,MAC1B,KAAK,QAAQ,OAAO;AAAA,IAAA;AAAA,EACtB;AAEJ;AAoCO,MAAM,6BAAuD;AAAA,EAClE,gBACE;AAAA,EACF,uBAAuB;AAAA,EACvB,gBACE;AACJ;AAuBA,MAAM,sBAAsB,EAAE,OAAO;AAAA,EACnC,eAAe,EAAE,OAAA;AAAA,EACjB,aAAa,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,UAAU,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,OAAO,EAAE,OAAA;AAAA,EACT,WAAW,EAAE,OAAA,EAAS,SAAA;AAAA,EACtB,QAAQ,EAAE,OAAA,EAAS,SAAA;AAAA,EACnB,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,QAAA,CAAS,CAAC,EAAE,SAAA;AAAA,EAC7C,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,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AAA,MAEH,GAAG,kBAAkBA,EAAC;AAAA,IAAA;AAExB,WAAO;AAAA,MACL,IAAI,QAAQ,MAAM,sBAAsBA,GAAE,WAAW;AAAA,MACrD,YAAYC,YAAW,IAAI,YAAY;AAAA,MACvC,MAAM,EAAE,GAAG,aAAA;AAAA,IAAa;AAAA,EAE5B;AAGA,QAAM,IAAI,OAAO;AACjB,QAAM,aAAa,kBAAkB,GAAG,QAAQ,YAAY,EAAE,IAAI,YAAY;AAC9E,SAAO;AAAA,IACL,IAAI,QAAQ,MAAM,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ;AAAA,IACnE;AAAA,IACA,MAAM,EAAE,GAAG,aAAA;AAAA,EAAa;AAE5B;AAMA,SAAS,kBACP,GAKA,cACe;AACf,QAAM,aAA4B,CAAA;AAElC,MAAI,cAAc,EAAE,OAAO,GAAG;AAC5B,UAAM,QAAS,EAAE,QAA2C,cAAc,CAAA;AAC1E,eAAW,KAAK,GAAG,KAAK;AAAA,EAC1B,OAAO;AACL,eAAW,KAAK,EAAE,OAAiC;AAAA,EACrD;AAEA,MAAI,EAAE,cAAc;AAClB,eAAW,KAAK,GAAI,EAAE,YAAyC;AAAA,EACjE;AAEA,MAAI,MAAM,QAAQ,EAAE,OAAO,KAAK,EAAE,QAAQ,SAAS,GAAG;AACpD,eAAW;AAAA,MACT,8BAA8B,EAAE,SAA8B;AAAA,QAC5D,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA,CACR;AAAA,IAAA;AAAA,EAEL;AAEA,SAAO;AACT;AAEA,SAAS,SAAS,aAAqB,QAAwB;AAC7D,SAAO,aAAa,WAAW,IAAI,MAAM;AAC3C;"}
1
+ {"version":3,"file":"connector.js","sources":["../../src/adapters/connector.ts"],"sourcesContent":["/**\n * Connector adapters — `ConnectorDynamicResultV1` → MCP-UI render structures.\n *\n * @since v6.6.0 (D5 / D6 of ROADMAP-opendata-macro-mcpui)\n *\n * ## Opt-in, pure\n *\n * These adapters are published under the dedicated subpath\n * `@seed-ship/mcp-ui-solid/adapters` — they are NEVER imported by the core\n * renderer path, so a consumer that does not emit connector results pays\n * nothing for them.\n *\n * Every adapter here is a **pure function** (D5) : same input → same\n * output, no `fetch`, no `localStorage`, no global state, no clock, no\n * randomness. This is what lets a host re-run an adapter deterministically\n * after presentation feedback (D1) and replay fixtures in tests.\n *\n * ## Unknown schema version — never throw (R2)\n *\n * `connectorResultToUILayout()` never throws on the runtime render path.\n * A payload it cannot read becomes an explicit degraded `UILayout` (a\n * visible notice), never a silent disappearance and never an exception.\n */\n\nimport type { UIComponent, UILayout, GridPosition } from '../types'\nimport {\n ConnectorDynamicResultV1Schema,\n CONNECTOR_DYNAMIC_RESULT_V1,\n type ConnectorAction,\n} from '@seed-ship/mcp-ui-spec'\nimport { z } from 'zod'\nimport { formatMCPUIString } from '../utils/format-string'\n\n// ─────────────────────────────────────────────────────────────\n// connectorActionsToActionGroup\n// ─────────────────────────────────────────────────────────────\n\nexport interface ConnectorActionsToActionGroupOptions {\n /** Component id. Default `'connector-actions'`. */\n id?: string\n /** Optional heading shown above the buttons. */\n title?: string\n /** Button row layout. Default `'horizontal'`. */\n layout?: 'horizontal' | 'vertical' | 'space-between' | 'end' | 'center'\n /** Gap between buttons. Default `'md'`. */\n gap?: 'none' | 'sm' | 'md' | 'lg'\n /** Grid position. Default full-width. */\n position?: GridPosition\n}\n\n/**\n * Wraps a connector's `actions` into an `action-group` `UIComponent`.\n *\n * `ConnectorAction` is the exact `action-group` action shape, so this is a\n * thin, pure envelope — no transformation of the actions themselves.\n */\nexport function connectorActionsToActionGroup(\n actions: ConnectorAction[],\n options: ConnectorActionsToActionGroupOptions = {}\n): UIComponent {\n return {\n id: options.id ?? 'connector-actions',\n type: 'action-group',\n position: options.position ?? { colStart: 1, colSpan: 12 },\n params: {\n actions,\n ...(options.title ? { title: options.title } : {}),\n layout: options.layout ?? 'horizontal',\n gap: options.gap ?? 'md',\n },\n } as UIComponent\n}\n\n// ─────────────────────────────────────────────────────────────\n// connectorResultToUILayout\n// ─────────────────────────────────────────────────────────────\n\n/**\n * The visible wording of the two degraded states (R2).\n *\n * These paragraphs are rendered as `text` components, so unlike the payload\n * they are the LIBRARY's own chrome. They cannot go through\n * `MCPUIStrings` — the adapters are runtime-free and never import\n * `solid-js` — so a host localizes them through\n * `ConnectorResultToUILayoutOptions.messages` instead.\n *\n * Every field is a template resolved with `formatMCPUIString`.\n *\n * @since v6.20.0 — the defaults used to be hardcoded French.\n */\nexport interface ConnectorAdapterMessages {\n /**\n * Unreadable payload (tier 3). Template — `{versionSuffix}` is\n * `degradedVersionSuffix` when the payload carried a string\n * `schemaVersion`, and `''` otherwise.\n */\n degradedNotice: string\n /** Inserted into `degradedNotice`. Template — `{version}`. */\n degradedVersionSuffix: string\n /**\n * Usable envelope, unknown version (tier 2). Template — `{version}` = the\n * version read, `{expected}` = `CONNECTOR_DYNAMIC_RESULT_V1`.\n */\n versionWarning: string\n}\n\n/** English defaults for {@link ConnectorAdapterMessages}. */\nexport const DEFAULT_CONNECTOR_MESSAGES: ConnectorAdapterMessages = {\n degradedNotice:\n '### Result not rendered\\n\\nThe connector result could not be interpreted{versionSuffix}. This explicit state replaces a silent disappearance of the rendering.',\n degradedVersionSuffix: ' (schema: `{version}`)',\n versionWarning:\n '> \\u26A0 Unrecognized connector schema (`{version}`, expected `{expected}`). The rendering below is in degraded mode.',\n}\n\nexport interface ConnectorResultToUILayoutOptions {\n /** Layout id. Default derived from `connectorId` + `queryHash` / `toolName`. */\n id?: string\n /** Heading for the actions `action-group`. */\n actionsTitle?: string\n /**\n * Partial override of the degraded-state wording, merged over\n * {@link DEFAULT_CONNECTOR_MESSAGES}. Hosts that render in another\n * language pass their own paragraphs here.\n *\n * @since v6.20.0\n */\n messages?: Partial<ConnectorAdapterMessages>\n}\n\n/**\n * Lenient mirror of `ConnectorDynamicResultV1Schema` — `schemaVersion`\n * relaxed to any string. Used to tell apart \"unknown version but otherwise\n * a usable envelope\" (→ render with a warning, R2) from \"truly unreadable\"\n * (→ explicit error state).\n */\nconst LenientResultSchema = z.object({\n schemaVersion: z.string(),\n connectorId: z.string().min(1),\n toolName: z.string().min(1),\n query: z.string(),\n queryHash: z.string().optional(),\n intent: z.string().optional(),\n primary: z.record(z.string(), z.unknown()),\n supplemental: z.array(z.record(z.string(), z.unknown())).optional(),\n actions: z.array(z.record(z.string(), z.unknown())).optional(),\n})\n\nconst DEFAULT_GRID = { columns: 12, gap: '1rem' } as const\n\nfunction withPosition(component: UIComponent): UIComponent {\n if (component && component.position) return component\n return { ...component, position: { colStart: 1, colSpan: 12 } }\n}\n\n/** A component is a UILayout when it carries a `components` array. */\nfunction isLayoutShape(value: Record<string, unknown>): boolean {\n return Array.isArray((value as { components?: unknown }).components)\n}\n\nfunction degradedTextComponent(id: string, message: string): UIComponent {\n return {\n id,\n type: 'text',\n position: { colStart: 1, colSpan: 12 },\n params: { markdown: true, content: message },\n } as UIComponent\n}\n\n/**\n * Assembles a `ConnectorDynamicResultV1` into a single `UILayout` :\n * `primary` + `supplemental[]` + (`actions` → an `action-group`).\n *\n * - When `primary` is itself a layout, its components are spread in.\n * - Raw data is never sacrificed — every supplied component is kept.\n * - Pure : no side effects, deterministic.\n *\n * ### Degraded behavior (R2)\n *\n * - Valid v1 payload → normal assembled layout.\n * - Unknown `schemaVersion` but an otherwise-usable envelope → the\n * components are still rendered, prefixed with a visible warning notice.\n * - Unreadable payload → an explicit error `UILayout` (a single `text`\n * notice). Never throws, never returns an empty layout silently.\n *\n * A degraded layout always has an `id` starting with `connector-degraded`,\n * so a host can detect it (e.g. for telemetry) without inspecting content.\n */\nexport function connectorResultToUILayout(\n result: unknown,\n options: ConnectorResultToUILayoutOptions = {}\n): UILayout {\n const strict = ConnectorDynamicResultV1Schema.safeParse(result)\n const messages: ConnectorAdapterMessages = { ...DEFAULT_CONNECTOR_MESSAGES, ...options.messages }\n\n // ── Tier 3 : unreadable ───────────────────────────────────\n if (!strict.success) {\n const lenient = LenientResultSchema.safeParse(result)\n if (!lenient.success) {\n const version =\n result && typeof result === 'object'\n ? (result as { schemaVersion?: unknown }).schemaVersion\n : undefined\n return {\n id: 'connector-degraded',\n components: [\n degradedTextComponent(\n 'connector-degraded-notice',\n formatMCPUIString(messages.degradedNotice, {\n versionSuffix:\n typeof version === 'string'\n ? formatMCPUIString(messages.degradedVersionSuffix, { version })\n : '',\n })\n ),\n ],\n grid: { ...DEFAULT_GRID },\n }\n }\n // ── Tier 2 : usable envelope, unknown version ───────────\n const r = lenient.data\n const components: UIComponent[] = [\n degradedTextComponent(\n 'connector-version-warning',\n formatMCPUIString(messages.versionWarning, {\n version: r.schemaVersion,\n expected: CONNECTOR_DYNAMIC_RESULT_V1,\n })\n ),\n ...collectComponents(r),\n ]\n return {\n id: options.id ?? `connector-degraded-${r.connectorId}`,\n components: components.map(withPosition),\n grid: { ...DEFAULT_GRID },\n }\n }\n\n // ── Tier 1 : valid v1 ─────────────────────────────────────\n const r = strict.data\n const components = collectComponents(r, options.actionsTitle).map(withPosition)\n return {\n id: options.id ?? layoutId(r.connectorId, r.queryHash ?? r.toolName),\n components,\n grid: { ...DEFAULT_GRID },\n }\n}\n\n/**\n * Flattens `primary` + `supplemental` + `actions` into a component list.\n * Shared by the valid and degraded-but-usable paths.\n */\nfunction collectComponents(\n r: {\n primary: Record<string, unknown>\n supplemental?: Record<string, unknown>[]\n actions?: unknown[]\n },\n actionsTitle?: string\n): UIComponent[] {\n const components: UIComponent[] = []\n\n if (isLayoutShape(r.primary)) {\n const inner = (r.primary as { components?: UIComponent[] }).components ?? []\n components.push(...inner)\n } else {\n components.push(r.primary as unknown as UIComponent)\n }\n\n if (r.supplemental) {\n components.push(...(r.supplemental as unknown as UIComponent[]))\n }\n\n if (Array.isArray(r.actions) && r.actions.length > 0) {\n components.push(\n connectorActionsToActionGroup(r.actions as ConnectorAction[], {\n id: 'connector-actions',\n title: actionsTitle,\n })\n )\n }\n\n return components\n}\n\nfunction layoutId(connectorId: string, suffix: string): string {\n return `conn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,YAAY,EAAE,IAAI,YAAY;AAC9E,SAAO;AAAA,IACL,IAAI,QAAQ,MAAM,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ;AAAA,IACnE;AAAA,IACA,MAAM,EAAE,GAAG,aAAA;AAAA,EAAa;AAE5B;AAMA,SAAS,kBACP,GAKA,cACe;AACf,QAAM,aAA4B,CAAA;AAElC,MAAI,cAAc,EAAE,OAAO,GAAG;AAC5B,UAAM,QAAS,EAAE,QAA2C,cAAc,CAAA;AAC1E,eAAW,KAAK,GAAG,KAAK;AAAA,EAC1B,OAAO;AACL,eAAW,KAAK,EAAE,OAAiC;AAAA,EACrD;AAEA,MAAI,EAAE,cAAc;AAClB,eAAW,KAAK,GAAI,EAAE,YAAyC;AAAA,EACjE;AAEA,MAAI,MAAM,QAAQ,EAAE,OAAO,KAAK,EAAE,QAAQ,SAAS,GAAG;AACpD,eAAW;AAAA,MACT,8BAA8B,EAAE,SAA8B;AAAA,QAC5D,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA,CACR;AAAA,IAAA;AAAA,EAEL;AAEA,SAAO;AACT;AAEA,SAAS,SAAS,aAAqB,QAAwB;AAC7D,SAAO,aAAa,WAAW,IAAI,MAAM;AAC3C;"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @seed-ship/mcp-ui-solid/adapters
3
+ *
4
+ * Opt-in, pure adapters that turn connector / macro contracts into MCP-UI
5
+ * render structures. Published as a dedicated subpath so the core renderer
6
+ * path never depends on them.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { connectorResultToUILayout } from '@seed-ship/mcp-ui-solid/adapters'
11
+ *
12
+ * const layout = connectorResultToUILayout(connectorResult)
13
+ * // → <UIResourceRenderer content={layout} />
14
+ * ```
15
+ */
16
+ export { connectorResultToUILayout, connectorActionsToActionGroup, DEFAULT_CONNECTOR_MESSAGES, } from "./connector.cjs";
17
+ export type { ConnectorResultToUILayoutOptions, ConnectorActionsToActionGroupOptions, ConnectorAdapterMessages, } from "./connector.cjs";
18
+ export { macroRunToScratchpadState, macroInterrogationToChatPromptConfig, DEFAULT_MACRO_RUN_MESSAGES, } from "./macro-run.cjs";
19
+ export type { MacroRunAdapterMessages, MacroRunAdapterOptions } from "./macro-run.cjs";
20
+ export { createComparisonLayout, createGeographyLayout, createEvidenceLayout, } from "./presentation.cjs";
21
+ export type { ComparisonLayoutInput, GeographyLayoutInput, EvidenceLayoutInput, PresentationComponent, ChartComponent, TableComponent, MapComponent, MetricComponent, TextComponent, LinkComponent, } from "./presentation.cjs";
@@ -13,10 +13,9 @@
13
13
  * // → <UIResourceRenderer content={layout} />
14
14
  * ```
15
15
  */
16
- export { connectorResultToUILayout, connectorActionsToActionGroup, DEFAULT_CONNECTOR_MESSAGES, } from './connector';
17
- export type { ConnectorResultToUILayoutOptions, ConnectorActionsToActionGroupOptions, ConnectorAdapterMessages, } from './connector';
18
- export { macroRunToScratchpadState, macroInterrogationToChatPromptConfig, DEFAULT_MACRO_RUN_MESSAGES, } from './macro-run';
19
- export type { MacroRunAdapterMessages, MacroRunAdapterOptions } from './macro-run';
20
- export { createComparisonLayout, createGeographyLayout, createEvidenceLayout, } from './presentation';
21
- export type { ComparisonLayoutInput, GeographyLayoutInput, EvidenceLayoutInput, PresentationComponent, ChartComponent, TableComponent, MapComponent, MetricComponent, TextComponent, LinkComponent, } from './presentation';
22
- //# sourceMappingURL=index.d.ts.map
16
+ export { connectorResultToUILayout, connectorActionsToActionGroup, DEFAULT_CONNECTOR_MESSAGES, } from "./connector.js";
17
+ export type { ConnectorResultToUILayoutOptions, ConnectorActionsToActionGroupOptions, ConnectorAdapterMessages, } from "./connector.js";
18
+ export { macroRunToScratchpadState, macroInterrogationToChatPromptConfig, DEFAULT_MACRO_RUN_MESSAGES, } from "./macro-run.js";
19
+ export type { MacroRunAdapterMessages, MacroRunAdapterOptions } from "./macro-run.js";
20
+ export { createComparisonLayout, createGeographyLayout, createEvidenceLayout, } from "./presentation.js";
21
+ export type { ComparisonLayoutInput, GeographyLayoutInput, EvidenceLayoutInput, PresentationComponent, ChartComponent, TableComponent, MapComponent, MetricComponent, TextComponent, LinkComponent, } from "./presentation.js";
@@ -0,0 +1,99 @@
1
+ /**
2
+ * MacroRun adapters — `MacroRunV1` / `MacroInterrogationV1` → MCP-UI render
3
+ * primitives.
4
+ *
5
+ * @since v6.7.0 (MacroRun Phase 2 — contract consolidated in deposium_MCPs
6
+ * `docs/2026/briefs/2026-05-22-macro-run-runtime-contract-consolidation.md`)
7
+ *
8
+ * ## Opt-in, pure
9
+ *
10
+ * Published under the dedicated subpath `@seed-ship/mcp-ui-solid/adapters` —
11
+ * never imported by the core renderer path. Every function here is a **pure
12
+ * function**: same input → same output, no `fetch`, no SSE listener, no
13
+ * persistence, no global state, no clock, no randomness.
14
+ *
15
+ * ## Scope boundary
16
+ *
17
+ * These adapters only translate the agnostic `MacroRunV1` contract (defined
18
+ * in `@seed-ship/mcp-ui-spec`) into existing MCP-UI primitives — a
19
+ * `ScratchpadState` and a `ChatPromptConfig`. They do NOT:
20
+ *
21
+ * - emit or consume any SSE event (a `macro_run_snapshot` producer is a
22
+ * separate, later goal on the producing runtime repo);
23
+ * - perform any fetch, persistence or resume;
24
+ * - know anything about a specific runtime, host, corpus or domain;
25
+ * - touch the `action:'submit'` executors, nor mix MacroRun with the
26
+ * existing tool-call action path.
27
+ *
28
+ * The host owns all of the above — it feeds a `MacroRunV1` snapshot in and
29
+ * decides where to render the result.
30
+ */
31
+ import type { MacroRunV1, MacroInterrogationV1 } from '@seed-ship/mcp-ui-spec';
32
+ import type { ScratchpadState, ChatPromptConfig } from "../types/chat-bus.cjs";
33
+ /**
34
+ * The English wording this adapter produces on its own — section titles and
35
+ * the fallbacks used when the run (or the interrogation) carries none.
36
+ *
37
+ * The adapter is runtime-free by contract: no `solid-js`, no
38
+ * `MCPUIStringsContext`. Hosts that render in another language pass a
39
+ * partial override through `MacroRunAdapterOptions.messages`, exactly like
40
+ * `ConnectorResultToUILayoutOptions.messages`.
41
+ *
42
+ * @since v6.20.0
43
+ */
44
+ export interface MacroRunAdapterMessages {
45
+ /** Title of the always-present `agent_card` section. */
46
+ agentSectionTitle: string;
47
+ /** Title of the `stepper` / `split_stepper` section. */
48
+ progressSectionTitle: string;
49
+ /** Title of each result section. */
50
+ resultSectionTitle: string;
51
+ /** Error message of an aborted run that carries no `error`. */
52
+ runAborted: string;
53
+ /** Error message of a failed run that carries no `error`. */
54
+ runFailed: string;
55
+ /** Prompt body of an elicitation with no usable schema and no message. */
56
+ confirmDefault: string;
57
+ }
58
+ /** English defaults for {@link MacroRunAdapterMessages}. */
59
+ export declare const DEFAULT_MACRO_RUN_MESSAGES: MacroRunAdapterMessages;
60
+ /** Options shared by the MacroRun adapters. @since v6.20.0 */
61
+ export interface MacroRunAdapterOptions {
62
+ /**
63
+ * Partial override of the adapter's own wording, merged over
64
+ * {@link DEFAULT_MACRO_RUN_MESSAGES}.
65
+ */
66
+ messages?: Partial<MacroRunAdapterMessages>;
67
+ }
68
+ /**
69
+ * Convert a `MacroRunV1` snapshot into a `ScratchpadState`.
70
+ *
71
+ * Sections produced, in order:
72
+ * 1. `agent_card` — always (derived from `run.agent`, or from the macro
73
+ * identity when the run carries no agent, e.g. a non-interactive macro).
74
+ * 2. `stepper` — when the run has steps and none carry `parallel` branches.
75
+ * `split_stepper` instead when any step carries `parallel` (future model).
76
+ * 3. `prompt` — when `run.pendingInterrogation` is set; its content is the
77
+ * `ChatPromptConfig` produced by {@link macroInterrogationToChatPromptConfig}.
78
+ * 4. one section per `run.results` entry (`chart` / `map` / `data_preview` /
79
+ * `data`, by component type). Optional — the adapter works without results.
80
+ *
81
+ * Pure: no fetch, no SSE, no persistence. The host owns all wiring.
82
+ */
83
+ export declare function macroRunToScratchpadState(run: MacroRunV1, options?: MacroRunAdapterOptions): ScratchpadState;
84
+ /**
85
+ * Convert a `MacroInterrogationV1` into a `ChatPromptConfig`.
86
+ *
87
+ * - `choice` → `{ type: 'choice' }` (vertical layout).
88
+ * - `confirm` → `{ type: 'confirm' }`.
89
+ * - `form` → `{ type: 'form' }` (the opaque `fields` are passed through).
90
+ * - `elicitation` → routed through the existing `elicitationToPromptConfig()`
91
+ * helper. If the interrogation carries no usable elicitation JSON Schema,
92
+ * it degrades to a `confirm` prompt rather than throwing.
93
+ *
94
+ * Always returns a `ChatPromptConfig` — never an `ElicitationEvent` — so the
95
+ * host has a single entry point. Usable standalone or via
96
+ * {@link macroRunToScratchpadState} (which calls it for an embedded
97
+ * `pendingInterrogation`).
98
+ */
99
+ export declare function macroInterrogationToChatPromptConfig(q: MacroInterrogationV1, options?: MacroRunAdapterOptions): ChatPromptConfig;
@@ -29,7 +29,7 @@
29
29
  * decides where to render the result.
30
30
  */
31
31
  import type { MacroRunV1, MacroInterrogationV1 } from '@seed-ship/mcp-ui-spec';
32
- import type { ScratchpadState, ChatPromptConfig } from '../types/chat-bus';
32
+ import type { ScratchpadState, ChatPromptConfig } from "../types/chat-bus.js";
33
33
  /**
34
34
  * The English wording this adapter produces on its own — section titles and
35
35
  * the fallbacks used when the run (or the interrogation) carries none.
@@ -97,4 +97,3 @@ export declare function macroRunToScratchpadState(run: MacroRunV1, options?: Mac
97
97
  * `pendingInterrogation`).
98
98
  */
99
99
  export declare function macroInterrogationToChatPromptConfig(q: MacroInterrogationV1, options?: MacroRunAdapterOptions): ChatPromptConfig;
100
- //# sourceMappingURL=macro-run.d.ts.map
@@ -15,7 +15,7 @@
15
15
  * `src/adapters/presentation.subpath.test.ts` asserts the built ESM and CJS
16
16
  * artifacts contain no import/require at all.
17
17
  */
18
- import type { ChartComponentParams, GridPosition, MapComponentParams, MetricComponentParams, TableComponentParams, TextComponentParams, UIComponent, UILayout } from '../types';
18
+ import type { ChartComponentParams, GridPosition, MapComponentParams, MetricComponentParams, TableComponentParams, TextComponentParams, UIComponent, UILayout } from "../types.cjs";
19
19
  import type { LinkComponentParams } from '@seed-ship/mcp-ui-spec';
20
20
  type PresentationType = 'chart' | 'table' | 'map' | 'metric' | 'text' | 'link';
21
21
  /** A recipe owns the eventual grid position, so caller positions are optional. */
@@ -75,4 +75,3 @@ export declare function createGeographyLayout(input: GeographyLayoutInput): UILa
75
75
  */
76
76
  export declare function createEvidenceLayout(input: EvidenceLayoutInput): UILayout;
77
77
  export {};
78
- //# sourceMappingURL=presentation.d.ts.map
@@ -15,7 +15,7 @@
15
15
  * `src/adapters/presentation.subpath.test.ts` asserts the built ESM and CJS
16
16
  * artifacts contain no import/require at all.
17
17
  */
18
- import type { ChartComponentParams, GridPosition, MapComponentParams, MetricComponentParams, TableComponentParams, TextComponentParams, UIComponent, UILayout } from '../types';
18
+ import type { ChartComponentParams, GridPosition, MapComponentParams, MetricComponentParams, TableComponentParams, TextComponentParams, UIComponent, UILayout } from "../types.js";
19
19
  import type { LinkComponentParams } from '@seed-ship/mcp-ui-spec';
20
20
  type PresentationType = 'chart' | 'table' | 'map' | 'metric' | 'text' | 'link';
21
21
  /** A recipe owns the eventual grid position, so caller positions are optional. */
@@ -75,4 +75,3 @@ export declare function createGeographyLayout(input: GeographyLayoutInput): UILa
75
75
  */
76
76
  export declare function createEvidenceLayout(input: EvidenceLayoutInput): UILayout;
77
77
  export {};
78
- //# sourceMappingURL=presentation.d.ts.map
@@ -1 +1 @@
1
- export * from './adapters/index';
1
+ export * from "./adapters/index.cjs";
@@ -1 +1 @@
1
- export * from './adapters/index';
1
+ export * from "./adapters/index.js";