@ai-matrx/rich-content 0.2.4 → 0.2.6

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 (381) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/code-block/CodeBlock.d.ts +44 -0
  3. package/dist/code-block/CodeBlock.js +449 -0
  4. package/dist/code-block/CodeBlockHeader.d.ts +63 -0
  5. package/dist/code-block/CodeBlockHeader.js +472 -0
  6. package/dist/code-block/CodeEditorLoading.d.ts +3 -0
  7. package/dist/code-block/CodeEditorLoading.js +34 -0
  8. package/dist/code-block/LanguageDisplay.d.ts +28 -0
  9. package/dist/code-block/LanguageDisplay.js +279 -0
  10. package/dist/code-block/SmallCodeEditor.d.ts +30 -0
  11. package/dist/code-block/SmallCodeEditor.js +22 -0
  12. package/dist/code-block/StickyButtons.d.ts +35 -0
  13. package/dist/code-block/StickyButtons.js +88 -0
  14. package/dist/code-block/highlight/ShikiCodeView.d.ts +26 -0
  15. package/dist/code-block/highlight/ShikiCodeView.js +134 -0
  16. package/dist/code-block/highlight/shiki-highlighter.d.ts +14 -0
  17. package/dist/code-block/highlight/shiki-highlighter.js +126 -0
  18. package/dist/code-block/highlight/useHighlightedLines.d.ts +18 -0
  19. package/dist/code-block/highlight/useHighlightedLines.js +142 -0
  20. package/dist/code-block/sticky-inset.d.ts +6 -0
  21. package/dist/code-block/sticky-inset.js +10 -0
  22. package/dist/display/block-interaction.d.ts +33 -0
  23. package/dist/display/block-interaction.js +13 -0
  24. package/dist/display/blocks/ChatCollapsibleWrapper.d.ts +13 -0
  25. package/dist/display/blocks/ChatCollapsibleWrapper.js +56 -0
  26. package/dist/display/blocks/buildMediaSource.d.ts +25 -0
  27. package/dist/display/blocks/buildMediaSource.js +43 -0
  28. package/dist/display/blocks/canvas-adaptive.d.ts +118 -0
  29. package/dist/display/blocks/canvas-adaptive.js +127 -0
  30. package/dist/display/blocks/canvas-fit.d.ts +24 -0
  31. package/dist/display/blocks/canvas-fit.js +19 -0
  32. package/dist/display/blocks/chart/ChartBlock.d.ts +8 -0
  33. package/dist/display/blocks/chart/ChartBlock.js +125 -0
  34. package/dist/display/blocks/chart/ChartCanvas.d.ts +18 -0
  35. package/dist/display/blocks/chart/ChartCanvas.js +159 -0
  36. package/dist/display/blocks/chart/TableChart.d.ts +25 -0
  37. package/dist/display/blocks/chart/TableChart.js +97 -0
  38. package/dist/display/blocks/chart/chart-spec.d.ts +39 -0
  39. package/dist/display/blocks/chart/chart-spec.js +128 -0
  40. package/dist/display/blocks/chart/labels.d.ts +20 -0
  41. package/dist/display/blocks/chart/labels.js +7 -0
  42. package/dist/display/blocks/chart/table-chart.d.ts +37 -0
  43. package/dist/display/blocks/chart/table-chart.js +231 -0
  44. package/dist/display/blocks/common/BlockHeaderWrapper.d.ts +56 -0
  45. package/dist/display/blocks/common/BlockHeaderWrapper.js +310 -0
  46. package/dist/display/blocks/common/ContentBlockWrapper.d.ts +40 -0
  47. package/dist/display/blocks/common/ContentBlockWrapper.js +214 -0
  48. package/dist/display/blocks/common/SandboxedHtml.d.ts +27 -0
  49. package/dist/display/blocks/common/SandboxedHtml.js +26 -0
  50. package/dist/display/blocks/diagram/DiagramLoadingVisualization.d.ts +6 -0
  51. package/dist/display/blocks/diagram/DiagramLoadingVisualization.js +190 -0
  52. package/dist/display/blocks/diagram/InteractiveDiagramBlock.d.ts +51 -0
  53. package/dist/display/blocks/diagram/InteractiveDiagramBlock.js +2415 -0
  54. package/dist/display/blocks/diagram/diagram-printer.d.ts +16 -0
  55. package/dist/display/blocks/diagram/diagram-printer.js +294 -0
  56. package/dist/display/blocks/diagram/diagram-visual-defaults.d.ts +116 -0
  57. package/dist/display/blocks/diagram/diagram-visual-defaults.js +400 -0
  58. package/dist/display/blocks/diagram/layout-utils.d.ts +90 -0
  59. package/dist/display/blocks/diagram/layout-utils.js +347 -0
  60. package/dist/display/blocks/diagram/parseDiagramJSON.d.ts +105 -0
  61. package/dist/display/blocks/diagram/parseDiagramJSON.js +296 -0
  62. package/dist/display/blocks/diagram/presentation-direction.d.ts +29 -0
  63. package/dist/display/blocks/diagram/presentation-direction.js +19 -0
  64. package/dist/display/blocks/diagram/ui-utils.d.ts +1 -0
  65. package/dist/display/blocks/diagram/ui-utils.js +18 -0
  66. package/dist/display/blocks/diff/DiffBlock.d.ts +10 -0
  67. package/dist/display/blocks/diff/DiffBlock.js +119 -0
  68. package/dist/display/blocks/diff/DiffCanvas.d.ts +15 -0
  69. package/dist/display/blocks/diff/DiffCanvas.js +20 -0
  70. package/dist/display/blocks/generic/GenericStructuredBlock.d.ts +24 -0
  71. package/dist/display/blocks/generic/GenericStructuredBlock.js +53 -0
  72. package/dist/display/blocks/generic/StructuredValueTabs.d.ts +21 -0
  73. package/dist/display/blocks/generic/StructuredValueTabs.js +124 -0
  74. package/dist/display/blocks/generic/tile-actions-slot.d.ts +39 -0
  75. package/dist/display/blocks/generic/tile-actions-slot.js +33 -0
  76. package/dist/display/blocks/images/ImageBlock.d.ts +8 -0
  77. package/dist/display/blocks/images/ImageBlock.js +265 -0
  78. package/dist/display/blocks/json/JsonBlock.d.ts +34 -0
  79. package/dist/display/blocks/json/JsonBlock.js +562 -0
  80. package/dist/display/blocks/json/JsonTableView.d.ts +10 -0
  81. package/dist/display/blocks/json/JsonTableView.js +173 -0
  82. package/dist/display/blocks/json/json-compact-stringify.d.ts +25 -0
  83. package/dist/display/blocks/json/json-compact-stringify.js +52 -0
  84. package/dist/display/blocks/json/json-tabular-utils.d.ts +65 -0
  85. package/dist/display/blocks/json/json-tabular-utils.js +121 -0
  86. package/dist/display/blocks/links/LinkComponent.d.ts +6 -0
  87. package/dist/display/blocks/links/LinkComponent.js +373 -0
  88. package/dist/display/blocks/links/LinkComponentWithFetch.d.ts +1 -0
  89. package/dist/display/blocks/links/LinkComponentWithFetch.js +0 -0
  90. package/dist/display/blocks/markdown/MarkdownKindBlock.d.ts +48 -0
  91. package/dist/display/blocks/markdown/MarkdownKindBlock.js +52 -0
  92. package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.d.ts +17 -0
  93. package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.js +70 -0
  94. package/dist/display/blocks/mermaid/MermaidBlock.d.ts +19 -0
  95. package/dist/display/blocks/mermaid/MermaidBlock.js +386 -0
  96. package/dist/display/blocks/search-replace/SearchReplaceBlock.d.ts +50 -0
  97. package/dist/display/blocks/search-replace/SearchReplaceBlock.js +71 -0
  98. package/dist/display/blocks/svg/SvgBlock.d.ts +8 -0
  99. package/dist/display/blocks/svg/SvgBlock.js +126 -0
  100. package/dist/display/blocks/table/StreamingTableRenderer.d.ts +53 -0
  101. package/dist/display/blocks/table/StreamingTableRenderer.js +907 -0
  102. package/dist/display/blocks/table/TableRenderPathDiagnostic.d.ts +21 -0
  103. package/dist/display/blocks/table/TableRenderPathDiagnostic.js +79 -0
  104. package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.d.ts +14 -0
  105. package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.js +15 -0
  106. package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.d.ts +13 -0
  107. package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.js +19 -0
  108. package/dist/display/blocks/thinking-reasoning/ThinkingTrace.d.ts +30 -0
  109. package/dist/display/blocks/thinking-reasoning/ThinkingTrace.js +75 -0
  110. package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.d.ts +13 -0
  111. package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.js +48 -0
  112. package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.d.ts +12 -0
  113. package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.js +19 -0
  114. package/dist/display/blocks/toml/TomlBlock.d.ts +7 -0
  115. package/dist/display/blocks/toml/TomlBlock.js +167 -0
  116. package/dist/display/blocks/tree/TreeBlock.d.ts +7 -0
  117. package/dist/display/blocks/tree/TreeBlock.js +163 -0
  118. package/dist/display/blocks/xml/XmlBlock.d.ts +23 -0
  119. package/dist/display/blocks/xml/XmlBlock.js +197 -0
  120. package/dist/display/blocks/xml/readXmlTag.d.ts +1 -0
  121. package/dist/display/blocks/xml/readXmlTag.js +1 -0
  122. package/dist/display/blocks/xml/xml-tokenize.d.ts +13 -0
  123. package/dist/display/blocks/xml/xml-tokenize.js +169 -0
  124. package/dist/display/blocks/yaml/YamlBlock.d.ts +7 -0
  125. package/dist/display/blocks/yaml/YamlBlock.js +191 -0
  126. package/dist/display/chat-markdown/BasicMarkdownContent.d.ts +29 -0
  127. package/dist/display/chat-markdown/BasicMarkdownContent.js +122 -0
  128. package/dist/display/chat-markdown/BlockRenderingContext.d.ts +23 -0
  129. package/dist/display/chat-markdown/BlockRenderingContext.js +17 -0
  130. package/dist/display/chat-markdown/ConfigurableMarkdownContent.d.ts +172 -0
  131. package/dist/display/chat-markdown/ConfigurableMarkdownContent.js +649 -0
  132. package/dist/display/chat-markdown/InlineCodeSnippet.d.ts +19 -0
  133. package/dist/display/chat-markdown/InlineCodeSnippet.js +146 -0
  134. package/dist/display/chat-markdown/InlineCodeSnippetKindGate.d.ts +11 -0
  135. package/dist/display/chat-markdown/InlineCodeSnippetKindGate.js +9 -0
  136. package/dist/display/chat-markdown/KindTextGate.d.ts +31 -0
  137. package/dist/display/chat-markdown/KindTextGate.js +60 -0
  138. package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.d.ts +6 -0
  139. package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.js +92 -0
  140. package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.d.ts +72 -0
  141. package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.js +94 -0
  142. package/dist/display/chat-markdown/block-registry/BlockRenderer.d.ts +126 -0
  143. package/dist/display/chat-markdown/block-registry/BlockRenderer.js +473 -0
  144. package/dist/display/chat-markdown/block-registry/block-dispatch.d.ts +410 -0
  145. package/dist/display/chat-markdown/block-registry/block-dispatch.js +495 -0
  146. package/dist/display/chat-markdown/block-registry/json-parse-utils.d.ts +13 -0
  147. package/dist/display/chat-markdown/block-registry/json-parse-utils.js +236 -0
  148. package/dist/display/chat-markdown/constants.d.ts +14 -0
  149. package/dist/display/chat-markdown/constants.js +317 -0
  150. package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.d.ts +31 -0
  151. package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.js +62 -0
  152. package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.d.ts +12 -0
  153. package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.js +18 -0
  154. package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.d.ts +22 -0
  155. package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.js +130 -0
  156. package/dist/display/chat-markdown/diff-blocks/diff-style-registry.d.ts +21 -0
  157. package/dist/display/chat-markdown/diff-blocks/diff-style-registry.js +91 -0
  158. package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.d.ts +26 -0
  159. package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.js +186 -0
  160. package/dist/display/chat-markdown/diff-blocks/types.d.ts +56 -0
  161. package/dist/display/chat-markdown/diff-blocks/types.js +0 -0
  162. package/dist/display/chat-markdown/internal-handlers/BlockFallback.d.ts +20 -0
  163. package/dist/display/chat-markdown/internal-handlers/BlockFallback.js +83 -0
  164. package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.d.ts +4 -0
  165. package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.js +16 -0
  166. package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.d.ts +17 -0
  167. package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.js +40 -0
  168. package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.d.ts +8 -0
  169. package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.js +91 -0
  170. package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.d.ts +20 -0
  171. package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.js +72 -0
  172. package/dist/display/chat-markdown/kind-source-view.d.ts +14 -0
  173. package/dist/display/chat-markdown/kind-source-view.js +14 -0
  174. package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.d.ts +28 -0
  175. package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.js +65 -0
  176. package/dist/display/chat-markdown/progressive-mount.d.ts +18 -0
  177. package/dist/display/chat-markdown/progressive-mount.js +90 -0
  178. package/dist/display/chat-markdown/render-block-to-content-block.d.ts +31 -0
  179. package/dist/display/chat-markdown/render-block-to-content-block.js +32 -0
  180. package/dist/display/chat-markdown/settle-stream-blocks.d.ts +50 -0
  181. package/dist/display/chat-markdown/settle-stream-blocks.js +26 -0
  182. package/dist/display/chat-markdown/stable-blocks.d.ts +15 -0
  183. package/dist/display/chat-markdown/stable-blocks.js +54 -0
  184. package/dist/display/chat-markdown/types.d.ts +11 -0
  185. package/dist/display/chat-markdown/types.js +26 -0
  186. package/dist/display/specimen/SpecimenContext.d.ts +26 -0
  187. package/dist/display/specimen/SpecimenContext.js +64 -0
  188. package/dist/display/tables/MarkdownTable.d.ts +23 -0
  189. package/dist/display/tables/MarkdownTable.js +769 -0
  190. package/dist/display/tables/MarkdownTableScrollArea.d.ts +12 -0
  191. package/dist/display/tables/MarkdownTableScrollArea.js +92 -0
  192. package/dist/display/tables/SendToGoogleSheetButton.d.ts +19 -0
  193. package/dist/display/tables/SendToGoogleSheetButton.js +93 -0
  194. package/dist/display/tables/SendToWorkbookButton.d.ts +24 -0
  195. package/dist/display/tables/SendToWorkbookButton.js +93 -0
  196. package/dist/display/tables/TableSaveToMenu.d.ts +16 -0
  197. package/dist/display/tables/TableSaveToMenu.js +98 -0
  198. package/dist/display/tables/TableWithSeparatedControls.d.ts +22 -0
  199. package/dist/display/tables/TableWithSeparatedControls.js +574 -0
  200. package/dist/display/tables/ViewTableModal.d.ts +14 -0
  201. package/dist/display/tables/ViewTableModal.js +67 -0
  202. package/dist/display/tables/editing/ColumnActionsMenu.d.ts +16 -0
  203. package/dist/display/tables/editing/ColumnActionsMenu.js +80 -0
  204. package/dist/display/tables/editing/RowActionsMenu.d.ts +16 -0
  205. package/dist/display/tables/editing/RowActionsMenu.js +80 -0
  206. package/dist/display/tables/editing/TableEditToolbar.d.ts +15 -0
  207. package/dist/display/tables/editing/TableEditToolbar.js +63 -0
  208. package/dist/display/tables/editing/tableMutations.d.ts +50 -0
  209. package/dist/display/tables/editing/tableMutations.js +148 -0
  210. package/dist/display/tables/editing/useDoubleClickEdit.d.ts +43 -0
  211. package/dist/display/tables/editing/useDoubleClickEdit.js +51 -0
  212. package/dist/display/tables/editing/useTableUndo.d.ts +25 -0
  213. package/dist/display/tables/editing/useTableUndo.js +17 -0
  214. package/dist/display/tables/table-action-row.d.ts +8 -0
  215. package/dist/display/tables/table-action-row.js +31 -0
  216. package/dist/display/tables/table-viewer.d.ts +13 -0
  217. package/dist/display/tables/table-viewer.js +18 -0
  218. package/dist/host/ErrorActions.d.ts +1 -1
  219. package/dist/host/ErrorNotice.d.ts +10 -0
  220. package/dist/host/ErrorNotice.js +19 -0
  221. package/dist/host/app-bindings.d.ts +155 -0
  222. package/dist/host/app-bindings.js +160 -0
  223. package/dist/host/diagnostics.d.ts +2 -2
  224. package/dist/host/diagnostics.js +2 -1
  225. package/dist/host/tables.d.ts +1 -6
  226. package/dist/host/types.d.ts +14 -7
  227. package/dist/levels/RichContent.d.ts +3 -0
  228. package/dist/levels/RichContent.js +102 -0
  229. package/dist/levels/RichContentInline.d.ts +28 -0
  230. package/dist/levels/RichContentInline.js +61 -0
  231. package/dist/levels/RichContentPreview.d.ts +12 -0
  232. package/dist/levels/RichContentPreview.js +39 -0
  233. package/dist/levels/RichContentStandardImpl.d.ts +12 -0
  234. package/dist/levels/RichContentStandardImpl.js +27 -0
  235. package/dist/levels/RichContentStaticProse.d.ts +46 -0
  236. package/dist/levels/RichContentStaticProse.js +100 -0
  237. package/dist/levels/depth.d.ts +18 -0
  238. package/dist/levels/depth.js +32 -0
  239. package/dist/levels/prose/inline-level-elements.d.ts +19 -0
  240. package/dist/levels/prose/inline-level-elements.js +103 -0
  241. package/dist/levels/prose/prose-block-elements.d.ts +25 -0
  242. package/dist/levels/prose/prose-block-elements.js +313 -0
  243. package/dist/levels/prose/prose-inline-elements.d.ts +13 -0
  244. package/dist/levels/prose/prose-inline-elements.js +143 -0
  245. package/dist/levels/prose/prose-prepare.d.ts +50 -0
  246. package/dist/levels/prose/prose-prepare.js +246 -0
  247. package/dist/levels/prose/remote-image-policy.d.ts +34 -0
  248. package/dist/levels/prose/remote-image-policy.js +153 -0
  249. package/dist/levels/prose/variant-root.d.ts +9 -0
  250. package/dist/levels/prose/variant-root.js +34 -0
  251. package/dist/levels/rich-content-types.d.ts +93 -0
  252. package/dist/levels/rich-content-types.js +4 -0
  253. package/dist/levels/server/DelimiterViolationReport.d.ts +7 -0
  254. package/dist/levels/server/DelimiterViolationReport.js +24 -0
  255. package/dist/levels/server/RichContentServer.d.ts +27 -0
  256. package/dist/levels/server/RichContentServer.js +97 -0
  257. package/dist/levels/standard/NestedRichContent.d.ts +7 -0
  258. package/dist/levels/standard/NestedRichContent.js +70 -0
  259. package/dist/levels/standard/StandardBlocks.d.ts +13 -0
  260. package/dist/levels/standard/StandardBlocks.js +239 -0
  261. package/dist/levels/standard/StandardKindRegion.d.ts +14 -0
  262. package/dist/levels/standard/StandardKindRegion.js +69 -0
  263. package/dist/levels/standard/standard-kind-region.d.ts +19 -0
  264. package/dist/levels/standard/standard-kind-region.js +21 -0
  265. package/dist/levels/standard/static-standard.d.ts +23 -0
  266. package/dist/levels/standard/static-standard.js +187 -0
  267. package/dist/levels/standard/stream-holdback.d.ts +2 -0
  268. package/dist/levels/standard/stream-holdback.js +77 -0
  269. package/dist/mermaid/MermaidFullscreen.d.ts +17 -0
  270. package/dist/mermaid/MermaidFullscreen.js +71 -0
  271. package/dist/mermaid/MermaidRenderer.d.ts +20 -0
  272. package/dist/mermaid/MermaidRenderer.js +267 -0
  273. package/dist/mermaid/MermaidView.d.ts +27 -0
  274. package/dist/mermaid/MermaidView.js +68 -0
  275. package/dist/mermaid/MermaidViewport.d.ts +75 -0
  276. package/dist/mermaid/MermaidViewport.js +286 -0
  277. package/dist/mermaid/adapters/er.d.ts +10 -0
  278. package/dist/mermaid/adapters/er.js +205 -0
  279. package/dist/mermaid/adapters/flowchart.d.ts +17 -0
  280. package/dist/mermaid/adapters/flowchart.js +634 -0
  281. package/dist/mermaid/adapters/journey.d.ts +9 -0
  282. package/dist/mermaid/adapters/journey.js +207 -0
  283. package/dist/mermaid/adapters/mindmap.d.ts +12 -0
  284. package/dist/mermaid/adapters/mindmap.js +252 -0
  285. package/dist/mermaid/adapters/pie.d.ts +7 -0
  286. package/dist/mermaid/adapters/pie.js +172 -0
  287. package/dist/mermaid/adapters/quadrant.d.ts +8 -0
  288. package/dist/mermaid/adapters/quadrant.js +231 -0
  289. package/dist/mermaid/adapters/register.d.ts +7 -0
  290. package/dist/mermaid/adapters/register.js +19 -0
  291. package/dist/mermaid/adapters/sequence.d.ts +8 -0
  292. package/dist/mermaid/adapters/sequence.js +251 -0
  293. package/dist/mermaid/adapters/state.d.ts +12 -0
  294. package/dist/mermaid/adapters/state.js +245 -0
  295. package/dist/mermaid/adapters/timeline.d.ts +8 -0
  296. package/dist/mermaid/adapters/timeline.js +245 -0
  297. package/dist/mermaid/catalog.d.ts +33 -0
  298. package/dist/mermaid/catalog.js +202 -0
  299. package/dist/mermaid/diagram-type.d.ts +39 -0
  300. package/dist/mermaid/diagram-type.js +89 -0
  301. package/dist/mermaid/export.d.ts +21 -0
  302. package/dist/mermaid/export.js +112 -0
  303. package/dist/mermaid/extract-fence.d.ts +15 -0
  304. package/dist/mermaid/extract-fence.js +22 -0
  305. package/dist/mermaid/lazy-draw.d.ts +40 -0
  306. package/dist/mermaid/lazy-draw.js +168 -0
  307. package/dist/mermaid/model/adapter.d.ts +28 -0
  308. package/dist/mermaid/model/adapter.js +16 -0
  309. package/dist/mermaid/model/ops.d.ts +282 -0
  310. package/dist/mermaid/model/ops.js +9 -0
  311. package/dist/mermaid/model/round-trip.d.ts +22 -0
  312. package/dist/mermaid/model/round-trip.js +45 -0
  313. package/dist/mermaid/model/types.d.ts +271 -0
  314. package/dist/mermaid/model/types.js +0 -0
  315. package/dist/mermaid/print-render.d.ts +9 -0
  316. package/dist/mermaid/print-render.js +39 -0
  317. package/dist/mermaid/runtime.d.ts +25 -0
  318. package/dist/mermaid/runtime.js +183 -0
  319. package/dist/mermaid/sanitize.d.ts +46 -0
  320. package/dist/mermaid/sanitize.js +234 -0
  321. package/dist/mermaid/types.d.ts +43 -0
  322. package/dist/mermaid/types.js +21 -0
  323. package/dist/mermaid/view/ViewModePane.d.ts +24 -0
  324. package/dist/mermaid/view/ViewModePane.js +9 -0
  325. package/dist/utils/client-lazy.d.ts +1 -1
  326. package/dist/utils/client-lazy.js +4 -1
  327. package/dist/utils/lifted/DiffView.d.ts +10 -0
  328. package/dist/utils/lifted/DiffView.js +26 -0
  329. package/dist/utils/lifted/IconButton.d.ts +24 -0
  330. package/dist/utils/lifted/IconButton.js +43 -0
  331. package/dist/utils/lifted/MatrxMiniLoader.d.ts +1 -0
  332. package/dist/utils/lifted/MatrxMiniLoader.js +8 -0
  333. package/dist/utils/lifted/ShimmerText.d.ts +5 -0
  334. package/dist/utils/lifted/ShimmerText.js +21 -0
  335. package/dist/utils/lifted/SuspenseLoader.d.ts +16 -0
  336. package/dist/utils/lifted/SuspenseLoader.js +42 -0
  337. package/dist/utils/lifted/Tooltip.d.ts +20 -0
  338. package/dist/utils/lifted/Tooltip.js +52 -0
  339. package/dist/utils/lifted/artifactId.d.ts +34 -0
  340. package/dist/utils/lifted/artifactId.js +15 -0
  341. package/dist/utils/lifted/canvasContent.d.ts +63 -0
  342. package/dist/utils/lifted/canvasContent.js +98 -0
  343. package/dist/utils/lifted/captureReactError.d.ts +24 -0
  344. package/dist/utils/lifted/captureReactError.js +28 -0
  345. package/dist/utils/lifted/chunk-load-recovery.d.ts +25 -0
  346. package/dist/utils/lifted/chunk-load-recovery.js +36 -0
  347. package/dist/utils/lifted/code-editor-agent-types.d.ts +6 -0
  348. package/dist/utils/lifted/code-editor-agent-types.js +0 -0
  349. package/dist/utils/lifted/code-editor-agents.d.ts +39 -0
  350. package/dist/utils/lifted/code-editor-agents.js +52 -0
  351. package/dist/utils/lifted/code-language-extension.d.ts +1 -0
  352. package/dist/utils/lifted/code-language-extension.js +60 -0
  353. package/dist/utils/lifted/custom-icons.d.ts +16 -0
  354. package/dist/utils/lifted/custom-icons.js +47 -0
  355. package/dist/utils/lifted/durability.d.ts +16 -0
  356. package/dist/utils/lifted/durability.js +45 -0
  357. package/dist/utils/lifted/errors.d.ts +30 -0
  358. package/dist/utils/lifted/errors.js +29 -0
  359. package/dist/utils/lifted/html-document.d.ts +1 -0
  360. package/dist/utils/lifted/html-document.js +12 -0
  361. package/dist/utils/lifted/languageOptions.d.ts +9 -0
  362. package/dist/utils/lifted/languageOptions.js +52 -0
  363. package/dist/utils/lifted/languages.d.ts +34 -0
  364. package/dist/utils/lifted/languages.js +175 -0
  365. package/dist/utils/lifted/loading-spinner.d.ts +18 -0
  366. package/dist/utils/lifted/loading-spinner.js +200 -0
  367. package/dist/utils/lifted/media-refs.d.ts +13 -0
  368. package/dist/utils/lifted/media-refs.js +27 -0
  369. package/dist/utils/lifted/scroll-root.d.ts +1 -0
  370. package/dist/utils/lifted/scroll-root.js +25 -0
  371. package/dist/utils/lifted/syntax-themes.d.ts +32 -0
  372. package/dist/utils/lifted/syntax-themes.js +100 -0
  373. package/dist/utils/lifted/url-utm.d.ts +24 -0
  374. package/dist/utils/lifted/url-utm.js +66 -0
  375. package/dist/utils/lifted/use-is-mounted.d.ts +24 -0
  376. package/dist/utils/lifted/use-is-mounted.js +21 -0
  377. package/dist/utils/lifted/useToastManager.d.ts +1 -0
  378. package/dist/utils/lifted/useToastManager.js +7 -0
  379. package/dist/utils/report-kind-at-raw-renderer.d.ts +19 -0
  380. package/dist/utils/report-kind-at-raw-renderer.js +32 -0
  381. package/package.json +32 -3
@@ -0,0 +1,34 @@
1
+ /**
2
+ * isMaterializedArtifactId — the R3 recognition primitive.
3
+ *
4
+ * An `<artifact>` (and every artifact renderer) carries an `id` that is EITHER:
5
+ * - a real `canvas_items` UUID → the artifact is MATERIALIZED (persisted). The
6
+ * UI renders the live row by id; data-touching types (tasks) can link/convert
7
+ * against the stable artifact id.
8
+ * - the model's own `artifact_N` (or a splitter fallback like `artifact-3`, or
9
+ * nothing) → NOT yet materialized → render inline; it's a materialization
10
+ * candidate, not a known artifact.
11
+ *
12
+ * This single UUID-shape test is what makes the whole system safe (vision R3):
13
+ * it does NOT matter whether the model ever learns to emit the shape — a
14
+ * non-UUID id is always treated as "new / unmaterialized", a UUID as "this exact
15
+ * persisted artifact." Used by the renderers (render-by-id vs inline) and by
16
+ * materialization (skip-already-materialized vs create-new).
17
+ *
18
+ * See `/Users/armanisadeghi/code/common-docs/systems/publish/artifacts/VISION.md` (R1–R3).
19
+ */
20
+ /** True only for a canonical UUID — i.e. a real, persisted `canvas_items.id`. */
21
+ export declare function isMaterializedArtifactId(id?: string | null): boolean;
22
+ /**
23
+ * readArtifactPointerId — the pointer-shape reader.
24
+ *
25
+ * A canvas item whose artifact has been MATERIALIZED stores only a POINTER in
26
+ * `content.data`: `{ artifactId }`. The body lives in the `canvas_items` row.
27
+ * Anything that consumes `content.data` (render, share, export) must recognise
28
+ * that shape instead of treating the pointer as the content — publishing a
29
+ * pointer produces a page with nothing in it.
30
+ *
31
+ * Returns the materialized artifact UUID, or undefined when `data` is real
32
+ * content (string, or an object that is not a pointer).
33
+ */
34
+ export declare function readArtifactPointerId(data: unknown): string | undefined;
@@ -0,0 +1,15 @@
1
+ import { isUuidShape } from "@ai-matrx/kit/uuid";
2
+ function isMaterializedArtifactId(id) {
3
+ return typeof id === "string" && isUuidShape(id.trim());
4
+ }
5
+ function readArtifactPointerId(data) {
6
+ if (typeof data !== "object" || data === null) return void 0;
7
+ if (!("artifactId" in data)) return void 0;
8
+ const id = data.artifactId;
9
+ if (typeof id !== "string") return void 0;
10
+ return isMaterializedArtifactId(id) ? id : void 0;
11
+ }
12
+ export {
13
+ isMaterializedArtifactId,
14
+ readArtifactPointerId
15
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The canvas CONTENT vocabulary: every artifact/surface type the canvas can
3
+ * show, which of them can be saved as an artifact, and the title helpers.
4
+ *
5
+ * Framework-light on purpose: openers import this without pulling in a single
6
+ * renderer. Each content type is registered as its own `@ai-matrx/canvas` kind
7
+ * (features/canvas/host/artifactKinds.tsx).
8
+ */
9
+ import { type ReactNode } from "react";
10
+ export type CanvasContentType = "quiz" | "presentation" | "iframe" | "html" | "code" | "image" | "diagram" | "comparison" | "timeline" | "research" | "troubleshooting" | "decision-tree" | "flashcards" | "recipe" | "resources" | "code_preview" | "code_edit_error" | "progress" | "math_problem" | "mermaid" | "svg" | "chart" | "map" | "stats" | "diff" | "questionnaire" | "react" | "table" | "transcript" | "structured_info" | "tree" | "tasks" | "cloud_browser" | "udt_document" | "sandbox" | "topical_map" | "kind_value";
11
+ /**
12
+ * Canvas content types that hold live, non-serializable runtime state —
13
+ * callbacks like `onApply` / `onDiscard` / `onCloseModal`. They are ephemeral
14
+ * editor surfaces, NOT artifacts. Persisting them serializes the callbacks to
15
+ * `null` and produces a corrupt, dead row that renders with no handlers, so
16
+ * saving them must be refused loudly rather than silently writing junk.
17
+ */
18
+ export declare const NON_PERSISTABLE_CANVAS_TYPES: ReadonlySet<string>;
19
+ export declare function isPersistableCanvasType(type: string): boolean;
20
+ /** Admin-visible trace from ensureArtifactPersisted / cloud sync. */
21
+ export interface ArtifactDebugTrace {
22
+ steps: string[];
23
+ errors: string[];
24
+ ensuredAt: number;
25
+ wasCreated: boolean;
26
+ }
27
+ export interface CanvasContent {
28
+ type: CanvasContentType;
29
+ data: any;
30
+ metadata?: {
31
+ title?: string | ReactNode;
32
+ subtitle?: string | ReactNode;
33
+ sourceMessageId?: string;
34
+ sourceTaskId?: string;
35
+ /** Optional chat linkage for canvas views (e.g. flashcards). */
36
+ conversationId?: string;
37
+ messageId?: string;
38
+ /** canvas_items row id when the open content is a persisted artifact —
39
+ * editors use it to save new versions instead of creating new rows. */
40
+ canvasItemId?: string;
41
+ /** Persisted artifact version when known (display chip). */
42
+ artifactVersion?: number;
43
+ /**
44
+ * `html_pages.id` when the item shows a published HTML page — its identity
45
+ * for agents (read + edit through the page), independent of the URL.
46
+ */
47
+ htmlPageId?: string;
48
+ /** Per-artifact mermaid render options + diagram identity. */
49
+ mermaid?: Record<string, unknown>;
50
+ };
51
+ }
52
+ /** Convert a possibly-ReactNode title to plain text for fallback uses. */
53
+ export declare function titleToString(title: string | ReactNode | undefined): string;
54
+ /** Canonical fallback titles per type. */
55
+ export declare function getDefaultTitle(type: string): string;
56
+ /**
57
+ * The display label for a stored canvas type, for badges and filters. Known
58
+ * types read their canvas title; anything else is humanized from its key
59
+ * (`structured_info` → "Structured info"), never shown raw.
60
+ */
61
+ export declare function getCanvasTypeLabel(type: string): string;
62
+ /** Short subtitle per type — surfaces as the kind-of-thing label. */
63
+ export declare function getSubtitle(type: string): string | undefined;
@@ -0,0 +1,98 @@
1
+ import { isValidElement } from "react";
2
+ const NON_PERSISTABLE_CANVAS_TYPES = /* @__PURE__ */ new Set([
3
+ "code_preview",
4
+ "code_edit_error",
5
+ // Live Cloud Browser: holds run/screenshot/controller/handoff state — a
6
+ // canvas_items row would freeze a dead pointer with no live session.
7
+ "cloud_browser",
8
+ // Live sandbox: a pty and a file tree against a running box. A canvas_items
9
+ // row would freeze a pointer to a box that is gone by the time it is read.
10
+ "sandbox",
11
+ // A cloud document owns its OWN append-only snapshot history
12
+ // (`udt_document_snapshots`) and saves itself as the user types. A
13
+ // `canvas_items` row would freeze a stale copy beside the live one, so the
14
+ // pane is a pointer and only a pointer. Unlike the other live surfaces it
15
+ // still HAS a real source — see `canvasSource.ts`.
16
+ "udt_document",
17
+ // A topical map pane is a pointer to live rows the workspace body reads; the
18
+ // rows are the truth and a frozen copy would drift on the next accepted
19
+ // proposal (see the type's comment above).
20
+ "topical_map"
21
+ ]);
22
+ function isPersistableCanvasType(type) {
23
+ return !NON_PERSISTABLE_CANVAS_TYPES.has(type);
24
+ }
25
+ function titleToString(title) {
26
+ if (!title) return "";
27
+ if (typeof title === "string") return title;
28
+ if (typeof title === "number") return String(title);
29
+ if (typeof title === "boolean") return String(title);
30
+ if (Array.isArray(title)) {
31
+ return title.map(titleToString).filter(Boolean).join(" ");
32
+ }
33
+ if (isValidElement(title)) {
34
+ const children = title.props?.children;
35
+ if (children) {
36
+ const extracted = titleToString(children);
37
+ if (extracted) return extracted;
38
+ }
39
+ return "Canvas Content";
40
+ }
41
+ return "Canvas Content";
42
+ }
43
+ function getDefaultTitle(type) {
44
+ const titles = {
45
+ quiz: "Quiz",
46
+ presentation: "Presentation",
47
+ iframe: "Web View",
48
+ html: "HTML View",
49
+ code: "Code Viewer",
50
+ image: "Image",
51
+ diagram: "Diagram",
52
+ comparison: "Comparison",
53
+ timeline: "Timeline",
54
+ research: "Research",
55
+ troubleshooting: "Troubleshooting",
56
+ "decision-tree": "Decision Tree",
57
+ flashcards: "Flashcards",
58
+ recipe: "Recipe",
59
+ resources: "Resources",
60
+ progress: "Progress Tracker",
61
+ math_problem: "Math Problem",
62
+ mermaid: "Diagram",
63
+ code_preview: "Code Preview",
64
+ code_edit_error: "Code Edit Error",
65
+ cloud_browser: "Cloud Browser",
66
+ sandbox: "Sandbox",
67
+ udt_document: "Document",
68
+ topical_map: "Topical map"
69
+ };
70
+ return titles[type] || "Canvas View";
71
+ }
72
+ function getCanvasTypeLabel(type) {
73
+ const title = getDefaultTitle(type);
74
+ if (title !== "Canvas View") return title;
75
+ const words = type.trim().split(/[\s_-]+/).filter(Boolean);
76
+ if (words.length === 0) return "Canvas";
77
+ const sentence = words.join(" ").toLowerCase();
78
+ return sentence.charAt(0).toUpperCase() + sentence.slice(1);
79
+ }
80
+ function getSubtitle(type) {
81
+ const subtitles = {
82
+ quiz: "Interactive quiz",
83
+ presentation: "Slideshow presentation",
84
+ code: "Code snippet",
85
+ diagram: "Interactive diagram",
86
+ mermaid: "Editable diagram",
87
+ math_problem: "Step-by-step solution"
88
+ };
89
+ return subtitles[type];
90
+ }
91
+ export {
92
+ NON_PERSISTABLE_CANVAS_TYPES,
93
+ getCanvasTypeLabel,
94
+ getDefaultTitle,
95
+ getSubtitle,
96
+ isPersistableCanvasType,
97
+ titleToString
98
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * captureReactError.ts
3
+ *
4
+ * Adapter for React render errors caught by an error boundary. Error
5
+ * boundaries SWALLOW the error (it never reaches `window` 'error'), so the
6
+ * global listener can't see it — a boundary must opt in by calling this.
7
+ *
8
+ * Any boundary in the app can adopt it: call `captureReactRenderError` from
9
+ * `componentDidCatch` and the failure shows up in the Error Inspector with the
10
+ * component stack. Wired into `OverlayErrorBoundary` today; other boundaries
11
+ * can follow the same one-liner.
12
+ */
13
+ interface ReactErrorContext {
14
+ /** A name for the boundary that caught it (e.g. "OverlayErrorBoundary"). */
15
+ boundary?: string;
16
+ /** React's component stack from `ErrorInfo`. */
17
+ componentStack?: string | null;
18
+ /** For lazy overlays: the dynamic-import module path that failed. */
19
+ modulePath?: string | null;
20
+ /** What failed — e.g. a message id, route name, or `tool:<name>`. */
21
+ relation?: string;
22
+ }
23
+ export declare function captureReactRenderError(error: unknown, ctx?: ReactErrorContext): void;
24
+ export {};
@@ -0,0 +1,28 @@
1
+ import { captureError } from "../../host/diagnostics.js";
2
+ import { extractErrorMessage } from "./errors.js";
3
+ function captureReactRenderError(error, ctx = {}) {
4
+ try {
5
+ captureError({
6
+ source: "react-render",
7
+ relation: ctx.relation ?? ctx.boundary ?? ctx.modulePath ?? void 0,
8
+ message: extractErrorMessage(error) || "React render error",
9
+ name: error instanceof Error ? error.name : void 0,
10
+ stack: error instanceof Error ? error.stack : void 0,
11
+ // The component stack is the "where in the tree" answer — surface it as
12
+ // the call-site, mirroring the Supabase call-site field.
13
+ callSite: ctx.componentStack ?? void 0,
14
+ raw: {
15
+ boundary: ctx.boundary,
16
+ modulePath: ctx.modulePath,
17
+ componentStack: ctx.componentStack,
18
+ name: error instanceof Error ? error.name : void 0,
19
+ message: extractErrorMessage(error),
20
+ stack: error instanceof Error ? error.stack : void 0
21
+ }
22
+ });
23
+ } catch {
24
+ }
25
+ }
26
+ export {
27
+ captureReactRenderError
28
+ };
@@ -0,0 +1,25 @@
1
+ /** Window event announcing a chunk-load failure. Detail: { message: string }. */
2
+ export declare const CHUNK_LOAD_ERROR_EVENT = "matrx:chunk-load-error";
3
+ /** Window flag set by NewVersionWatcher once React has booted. The boot
4
+ * script checks it to decide reload (pre-boot) vs event (post-boot). */
5
+ export declare const APP_BOOTED_FLAG = "__MATRX_APP_BOOTED__";
6
+ /**
7
+ * THE one pattern set for explicit chunk/module-fetch failures. Every detector
8
+ * in the app tests against this list. These signatures identify what failed;
9
+ * they do not assert why it failed.
10
+ *
11
+ * Do not add generic runtime-integrity messages such as Turbopack's "module
12
+ * factory is not available" here. They can happen on a fresh document load and
13
+ * provide no evidence of a stale deployment. Misclassifying them hides the real
14
+ * exception from the Error Inspector and shows users a false diagnosis.
15
+ */
16
+ export declare const CHUNK_LOAD_ERROR_PATTERNS: RegExp[];
17
+ /** True when `haystack` carries an explicit chunk/module-fetch signature. */
18
+ export declare function hasChunkLoadErrorSignature(haystack: string): boolean;
19
+ export declare function isChunkLoadError(error: unknown): boolean;
20
+ /**
21
+ * Announce a chunk-load failure so NewVersionWatcher can offer the user a
22
+ * refresh. Never reloads. Safe to call unconditionally — no-ops unless the
23
+ * error is chunk-shaped.
24
+ */
25
+ export declare function notifyChunkLoadError(error: unknown): void;
@@ -0,0 +1,36 @@
1
+ const CHUNK_LOAD_ERROR_EVENT = "matrx:chunk-load-error";
2
+ const APP_BOOTED_FLAG = "__MATRX_APP_BOOTED__";
3
+ const CHUNK_LOAD_ERROR_PATTERNS = [
4
+ /ChunkLoadError/i,
5
+ /Loading( CSS)? chunk [\w-]+ failed/i,
6
+ /Failed to load chunk/i,
7
+ /Failed to fetch dynamically imported module/i,
8
+ /error loading dynamically imported module/i,
9
+ /Importing a module script failed/i
10
+ ];
11
+ function hasChunkLoadErrorSignature(haystack) {
12
+ return CHUNK_LOAD_ERROR_PATTERNS.some((pattern) => pattern.test(haystack));
13
+ }
14
+ function isChunkLoadError(error) {
15
+ if (!error || typeof error !== "object") return false;
16
+ const e = error;
17
+ if (e.name === "ChunkLoadError") return true;
18
+ const msg = typeof e.message === "string" ? e.message : "";
19
+ return hasChunkLoadErrorSignature(msg);
20
+ }
21
+ function notifyChunkLoadError(error) {
22
+ if (typeof window === "undefined") return;
23
+ if (!isChunkLoadError(error)) return;
24
+ const message = error instanceof Error ? error.message : String(error ?? "ChunkLoadError");
25
+ window.dispatchEvent(
26
+ new CustomEvent(CHUNK_LOAD_ERROR_EVENT, { detail: { message } })
27
+ );
28
+ }
29
+ export {
30
+ APP_BOOTED_FLAG,
31
+ CHUNK_LOAD_ERROR_EVENT,
32
+ CHUNK_LOAD_ERROR_PATTERNS,
33
+ hasChunkLoadErrorSignature,
34
+ isChunkLoadError,
35
+ notifyChunkLoadError
36
+ };
@@ -0,0 +1,6 @@
1
+ import type { MandateKey } from "@ai-matrx/agents/mandates";
2
+ export interface CodeEditorAgentConfig {
3
+ mandateKey: MandateKey;
4
+ name: string;
5
+ codeVariableKey: string;
6
+ }
File without changes
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Code-editor agent configs — MANDATE KEYS, never agent ids.
3
+ *
4
+ * The code editor names WHICH JOB it is running (a `mandate_key`); the DATABASE
5
+ * decides which agent runs it (`agent.mandate` → system default, or the user's
6
+ * own binding). Every launch resolves the key at run time through the ONE
7
+ * launch funnel — `launchAgentExecution({ mandateKey })` /
8
+ * `useAgentLauncher().launchMandate` — which applies BOTH halves of the binding
9
+ * (agent AND `config_overrides`). Resolving a key yourself and passing the agent
10
+ * id into a launch silently drops the settings half; never do that. Recipe:
11
+ * `features/mandates/FEATURE.md` §"Migrating a hardcoded call site".
12
+ *
13
+ * All three mandates share provision `code_editor.session`, which offers
14
+ * `current_code` + `dynamic_context`; `codeVariableKey` names which of those
15
+ * the editor seeds on the first turn (the binding's consumption map decides what
16
+ * the bound agent actually consumes).
17
+ *
18
+ * **A raw agent UUID in this file is a defect.** Need a fourth editing job?
19
+ * Declare a mandate in aidream `services/mandates/client_mandates.py`, then add
20
+ * its key here.
21
+ */
22
+ import type { CodeEditorAgentConfig } from "./code-editor-agent-types.js";
23
+ export declare const GENERIC_CODE_EDITOR_AGENT: CodeEditorAgentConfig;
24
+ export declare const PROMPT_APP_UI_EDITOR_AGENT: CodeEditorAgentConfig;
25
+ export declare const DYNAMIC_CONTEXT_CODE_EDITOR_AGENT: CodeEditorAgentConfig;
26
+ /** Every code-editor mandate, generic first. */
27
+ export declare const CODE_EDITOR_AGENTS: CodeEditorAgentConfig[];
28
+ /** Default picker roster: prompt-app first when invoked from a prompt-app. */
29
+ export declare const PROMPT_APP_AGENT_PICKER: CodeEditorAgentConfig[];
30
+ /** Default picker roster: generic first when invoked from a generic editor. */
31
+ export declare const GENERIC_AGENT_PICKER: CodeEditorAgentConfig[];
32
+ /** The legacy `promptKey` strings older call sites still pass. */
33
+ export type CodeEditorPromptKey = "prompt-app-ui-editor" | "generic-code-editor" | "code-editor-dynamic-context";
34
+ /**
35
+ * Lookup by legacy `promptKey` (e.g. "prompt-app-ui-editor") OR by mandate key.
36
+ * Unknown values fall back to the generic editor (the same posture the old
37
+ * lookup had) — the mandate itself is still resolved loudly at launch.
38
+ */
39
+ export declare function agentForPromptKey(keyOrMandateKey: string | undefined): CodeEditorAgentConfig;
@@ -0,0 +1,52 @@
1
+ import { MANDATE_KEYS } from "@ai-matrx/agents/mandates";
2
+ const GENERIC_CODE_EDITOR_AGENT = {
3
+ mandateKey: MANDATE_KEYS.code_editor__code_edit,
4
+ name: "Code Editor",
5
+ codeVariableKey: "current_code"
6
+ };
7
+ const PROMPT_APP_UI_EDITOR_AGENT = {
8
+ mandateKey: MANDATE_KEYS.code_editor__prompt_app_ui_edit,
9
+ name: "Prompt App Code Editor",
10
+ codeVariableKey: "current_code"
11
+ };
12
+ const DYNAMIC_CONTEXT_CODE_EDITOR_AGENT = {
13
+ mandateKey: MANDATE_KEYS.code_editor__dynamic_context_edit,
14
+ name: "Code Editor (Dynamic Context)",
15
+ codeVariableKey: "dynamic_context"
16
+ };
17
+ const CODE_EDITOR_AGENTS = [
18
+ GENERIC_CODE_EDITOR_AGENT,
19
+ PROMPT_APP_UI_EDITOR_AGENT,
20
+ DYNAMIC_CONTEXT_CODE_EDITOR_AGENT
21
+ ];
22
+ const PROMPT_APP_AGENT_PICKER = [
23
+ PROMPT_APP_UI_EDITOR_AGENT,
24
+ GENERIC_CODE_EDITOR_AGENT
25
+ ];
26
+ const GENERIC_AGENT_PICKER = [
27
+ GENERIC_CODE_EDITOR_AGENT,
28
+ PROMPT_APP_UI_EDITOR_AGENT
29
+ ];
30
+ function agentForPromptKey(keyOrMandateKey) {
31
+ switch (keyOrMandateKey) {
32
+ case "prompt-app-ui-editor":
33
+ case PROMPT_APP_UI_EDITOR_AGENT.mandateKey:
34
+ return PROMPT_APP_UI_EDITOR_AGENT;
35
+ case "code-editor-dynamic-context":
36
+ case DYNAMIC_CONTEXT_CODE_EDITOR_AGENT.mandateKey:
37
+ return DYNAMIC_CONTEXT_CODE_EDITOR_AGENT;
38
+ case "generic-code-editor":
39
+ case GENERIC_CODE_EDITOR_AGENT.mandateKey:
40
+ default:
41
+ return GENERIC_CODE_EDITOR_AGENT;
42
+ }
43
+ }
44
+ export {
45
+ CODE_EDITOR_AGENTS,
46
+ DYNAMIC_CONTEXT_CODE_EDITOR_AGENT,
47
+ GENERIC_AGENT_PICKER,
48
+ GENERIC_CODE_EDITOR_AGENT,
49
+ PROMPT_APP_AGENT_PICKER,
50
+ PROMPT_APP_UI_EDITOR_AGENT,
51
+ agentForPromptKey
52
+ };
@@ -0,0 +1 @@
1
+ export declare function codeLanguageToExtension(language: string): string;
@@ -0,0 +1,60 @@
1
+ function codeLanguageToExtension(language) {
2
+ const lang = (language ?? "").toLowerCase().trim();
3
+ const MAP = {
4
+ javascript: ".js",
5
+ typescript: ".ts",
6
+ jsx: ".jsx",
7
+ tsx: ".tsx",
8
+ python: ".py",
9
+ ruby: ".rb",
10
+ rust: ".rs",
11
+ go: ".go",
12
+ java: ".java",
13
+ kotlin: ".kt",
14
+ swift: ".swift",
15
+ "c++": ".cpp",
16
+ cpp: ".cpp",
17
+ "c#": ".cs",
18
+ csharp: ".cs",
19
+ c: ".c",
20
+ php: ".php",
21
+ scala: ".scala",
22
+ shell: ".sh",
23
+ bash: ".sh",
24
+ sh: ".sh",
25
+ zsh: ".sh",
26
+ powershell: ".ps1",
27
+ html: ".html",
28
+ css: ".css",
29
+ scss: ".scss",
30
+ sass: ".sass",
31
+ less: ".less",
32
+ json: ".json",
33
+ yaml: ".yaml",
34
+ yml: ".yml",
35
+ toml: ".toml",
36
+ xml: ".xml",
37
+ markdown: ".md",
38
+ md: ".md",
39
+ sql: ".sql",
40
+ graphql: ".graphql",
41
+ dockerfile: ".dockerfile",
42
+ makefile: ".makefile",
43
+ r: ".r",
44
+ matlab: ".m",
45
+ lua: ".lua",
46
+ perl: ".pl",
47
+ elixir: ".ex",
48
+ erlang: ".erl",
49
+ haskell: ".hs",
50
+ clojure: ".clj",
51
+ dart: ".dart",
52
+ vue: ".vue",
53
+ svelte: ".svelte"
54
+ };
55
+ if (!lang) return ".txt";
56
+ return MAP[lang] ?? `.${lang}`;
57
+ }
58
+ export {
59
+ codeLanguageToExtension
60
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Custom SVG icons used by language-display + file-icon.
3
+ *
4
+ * Duplicated from components/DirectoryTree/custom-icons.tsx so features/code
5
+ * has no dependency on paths that are slated for deletion.
6
+ */
7
+ import React from "react";
8
+ interface TwoColorPythonIconProps {
9
+ size?: number;
10
+ className?: string;
11
+ primaryColor?: string;
12
+ secondaryColor?: string;
13
+ strokeWidth?: number;
14
+ }
15
+ export declare const TwoColorPythonIcon: React.FC<TwoColorPythonIconProps>;
16
+ export {};
@@ -0,0 +1,47 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ const TwoColorPythonIcon = ({
3
+ size = 18,
4
+ className = "",
5
+ primaryColor = "#4B8BBE",
6
+ secondaryColor = "#FFD43B",
7
+ strokeWidth = 2
8
+ }) => {
9
+ return /* @__PURE__ */ jsxs(
10
+ "svg",
11
+ {
12
+ xmlns: "http://www.w3.org/2000/svg",
13
+ width: size,
14
+ height: size,
15
+ viewBox: "0 0 24 24",
16
+ fill: "none",
17
+ strokeWidth,
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round",
20
+ className,
21
+ children: [
22
+ /* @__PURE__ */ jsxs("defs", { children: [
23
+ /* @__PURE__ */ jsx("clipPath", { id: "mx-code-py-top", children: /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "24", height: "12" }) }),
24
+ /* @__PURE__ */ jsx("clipPath", { id: "mx-code-py-bottom", children: /* @__PURE__ */ jsx("rect", { x: "0", y: "12", width: "24", height: "12" }) })
25
+ ] }),
26
+ /* @__PURE__ */ jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
27
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#mx-code-py-top)", stroke: primaryColor, children: [
28
+ /* @__PURE__ */ jsx("path", { d: "M12 9h-7a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h3" }),
29
+ /* @__PURE__ */ jsx("path", { d: "M12 15h7a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-3" }),
30
+ /* @__PURE__ */ jsx("path", { d: "M8 9v-4a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v5a2 2 0 0 1 -2 2h-4a2 2 0 0 0 -2 2v5a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4" }),
31
+ /* @__PURE__ */ jsx("path", { d: "M11 6l0 .01" }),
32
+ /* @__PURE__ */ jsx("path", { d: "M13 18l0 .01" })
33
+ ] }),
34
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#mx-code-py-bottom)", stroke: secondaryColor, children: [
35
+ /* @__PURE__ */ jsx("path", { d: "M12 9h-7a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h3" }),
36
+ /* @__PURE__ */ jsx("path", { d: "M12 15h7a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-3" }),
37
+ /* @__PURE__ */ jsx("path", { d: "M8 9v-4a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v5a2 2 0 0 1 -2 2h-4a2 2 0 0 0 -2 2v5a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4" }),
38
+ /* @__PURE__ */ jsx("path", { d: "M11 6l0 .01" }),
39
+ /* @__PURE__ */ jsx("path", { d: "M13 18l0 .01" })
40
+ ] })
41
+ ]
42
+ }
43
+ );
44
+ };
45
+ export {
46
+ TwoColorPythonIcon
47
+ };
@@ -0,0 +1,16 @@
1
+ import { classifyMediaUrl, isDurableMediaUrl, shareableMediaUrl, type MediaUrlKind } from "@ai-matrx/data/files";
2
+ export { classifyMediaUrl, isDurableMediaUrl, shareableMediaUrl };
3
+ export type { MediaUrlKind };
4
+ /**
5
+ * Recover the cld_files file_id from an our-own user-files signed S3 URL
6
+ * (`…/{user_id}/{file_id}?…`). Used to render via the handler (which
7
+ * re-mints) or to publish the file. Returns null for non-user-files URLs.
8
+ */
9
+ export declare function fileIdFromUserFilesUrl(url: string): string | null;
10
+ /**
11
+ * LOUD: log a durability violation. A non-public, expiring URL reaching
12
+ * `context` means the media was persisted wrong server-side. Returns true if
13
+ * it WAS a violation (so callers can trigger a heal), false otherwise. Never
14
+ * throws.
15
+ */
16
+ export declare function reportMediaDurabilityViolation(url: string | null | undefined, context: string): boolean;
@@ -0,0 +1,45 @@
1
+ import {
2
+ classifyMediaUrl,
3
+ createFileUrlRecognizer,
4
+ isDurableMediaUrl,
5
+ shareableMediaUrl
6
+ } from "@ai-matrx/data/files";
7
+ import { captureError } from "../../host/diagnostics.js";
8
+ const recognizer = createFileUrlRecognizer();
9
+ function fileIdFromUserFilesUrl(url) {
10
+ return recognizer.fileIdFromUserFilesUrl(url);
11
+ }
12
+ function reportMediaDurabilityViolation(url, context) {
13
+ if (classifyMediaUrl(url) !== "expiring") return false;
14
+ try {
15
+ captureError({
16
+ source: "media-durability",
17
+ relation: context,
18
+ message: `Expiring media URL reached "${context}" \u2014 should be public/durable`,
19
+ details: String(url).slice(0, 300),
20
+ raw: { context, url: String(url) }
21
+ });
22
+ } catch {
23
+ }
24
+ console.error(
25
+ `
26
+ ================ MEDIA-DURABILITY VIOLATION ================
27
+ A non-public, EXPIRING media URL reached "${context}".
28
+ This must never be persisted/rendered for public or owned media \u2014 it WILL
29
+ break when the signature expires. The media should have been saved PUBLIC
30
+ at generation (durable CDN/public-bucket URL), or rendered via the file
31
+ handler (<InlineMediaRef> + file_id, which re-mints). See the frontend
32
+ FOUND_DEFECTS.md \u2192 'Media durability'.
33
+ URL: ${String(url).slice(0, 180)}
34
+ ===========================================================
35
+ `
36
+ );
37
+ return true;
38
+ }
39
+ export {
40
+ classifyMediaUrl,
41
+ fileIdFromUserFilesUrl,
42
+ isDurableMediaUrl,
43
+ reportMediaDurabilityViolation,
44
+ shareableMediaUrl
45
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * utils/errors.ts — THE APP'S DOOR to the two halves of an error's audience.
3
+ *
4
+ * 🚨 THIS IS A DOOR, NOT A BODY. The bodies live in the packages and are
5
+ * re-exported here so this repo's ~500 `@/utils/errors` importers keep their
6
+ * import path:
7
+ * - `extractErrorMessage` (LOGS and the Error Inspector: every scrap of
8
+ * PostgREST detail) — `@ai-matrx/data/net`. The host body was deleted
9
+ * 2026-09-11 in the byte-size/error twins collapse.
10
+ * - `operationFailed`, `makeAssertData`, `stripTerminalCodes`,
11
+ * `humanizeBackendError` (what a PERSON reads) — `@ai-matrx/kit/errors`,
12
+ * moved 2026-10-01 (chat-package independence P12).
13
+ * Never re-grow a body here; a fix goes into the package and is adopted.
14
+ * Guard: `pnpm check:package-twins`.
15
+ *
16
+ * Handing `error.message` straight to a user is the defect
17
+ * `pnpm check:access-errors` counts. When the failure is a single-record READ,
18
+ * render `<AccessGate token id error/>` instead (features/access-gate/).
19
+ */
20
+ import { extractErrorMessage } from "@ai-matrx/data/net";
21
+ export { extractErrorMessage };
22
+ export { humanizeBackendError, makeAssertData, operationFailed, stripTerminalCodes, } from "@ai-matrx/kit/errors";
23
+ /**
24
+ * Postgres governance guards use a machine code before a sentence deliberately
25
+ * written for the person making the change. Preserve only the allow-listed
26
+ * codes; every other PostgREST failure keeps the calm generic action message.
27
+ * (Host-owned: it composes `@ai-matrx/data/net` with `@ai-matrx/kit/errors`,
28
+ * and kit may not import data.)
29
+ */
30
+ export declare function makeGovernedDataAsserter(action: string, governanceCode: RegExp): <T>(data: T | null, error: unknown, override?: string) => T;