@ai-matrx/rich-content 0.2.4 → 0.2.7
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.
- package/CHANGELOG.md +25 -0
- package/dist/code-block/CodeBlock.d.ts +44 -0
- package/dist/code-block/CodeBlock.js +449 -0
- package/dist/code-block/CodeBlockHeader.d.ts +63 -0
- package/dist/code-block/CodeBlockHeader.js +472 -0
- package/dist/code-block/CodeEditorLoading.d.ts +3 -0
- package/dist/code-block/CodeEditorLoading.js +34 -0
- package/dist/code-block/LanguageDisplay.d.ts +28 -0
- package/dist/code-block/LanguageDisplay.js +279 -0
- package/dist/code-block/SmallCodeEditor.d.ts +30 -0
- package/dist/code-block/SmallCodeEditor.js +22 -0
- package/dist/code-block/StickyButtons.d.ts +35 -0
- package/dist/code-block/StickyButtons.js +88 -0
- package/dist/code-block/highlight/ShikiCodeView.d.ts +26 -0
- package/dist/code-block/highlight/ShikiCodeView.js +134 -0
- package/dist/code-block/highlight/shiki-highlighter.d.ts +14 -0
- package/dist/code-block/highlight/shiki-highlighter.js +126 -0
- package/dist/code-block/highlight/useHighlightedLines.d.ts +18 -0
- package/dist/code-block/highlight/useHighlightedLines.js +142 -0
- package/dist/code-block/sticky-inset.d.ts +6 -0
- package/dist/code-block/sticky-inset.js +10 -0
- package/dist/display/block-interaction.d.ts +33 -0
- package/dist/display/block-interaction.js +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.d.ts +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.js +56 -0
- package/dist/display/blocks/buildMediaSource.d.ts +25 -0
- package/dist/display/blocks/buildMediaSource.js +43 -0
- package/dist/display/blocks/canvas-adaptive.d.ts +118 -0
- package/dist/display/blocks/canvas-adaptive.js +127 -0
- package/dist/display/blocks/canvas-fit.d.ts +24 -0
- package/dist/display/blocks/canvas-fit.js +19 -0
- package/dist/display/blocks/chart/ChartBlock.d.ts +8 -0
- package/dist/display/blocks/chart/ChartBlock.js +125 -0
- package/dist/display/blocks/chart/ChartCanvas.d.ts +18 -0
- package/dist/display/blocks/chart/ChartCanvas.js +159 -0
- package/dist/display/blocks/chart/TableChart.d.ts +25 -0
- package/dist/display/blocks/chart/TableChart.js +97 -0
- package/dist/display/blocks/chart/chart-spec.d.ts +39 -0
- package/dist/display/blocks/chart/chart-spec.js +128 -0
- package/dist/display/blocks/chart/labels.d.ts +20 -0
- package/dist/display/blocks/chart/labels.js +7 -0
- package/dist/display/blocks/chart/table-chart.d.ts +37 -0
- package/dist/display/blocks/chart/table-chart.js +231 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.d.ts +56 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.js +310 -0
- package/dist/display/blocks/common/ContentBlockWrapper.d.ts +40 -0
- package/dist/display/blocks/common/ContentBlockWrapper.js +214 -0
- package/dist/display/blocks/common/SandboxedHtml.d.ts +27 -0
- package/dist/display/blocks/common/SandboxedHtml.js +26 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.d.ts +6 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.js +190 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.d.ts +51 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.js +2415 -0
- package/dist/display/blocks/diagram/diagram-printer.d.ts +16 -0
- package/dist/display/blocks/diagram/diagram-printer.js +294 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.d.ts +116 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.js +400 -0
- package/dist/display/blocks/diagram/layout-utils.d.ts +90 -0
- package/dist/display/blocks/diagram/layout-utils.js +347 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.d.ts +105 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.js +296 -0
- package/dist/display/blocks/diagram/presentation-direction.d.ts +29 -0
- package/dist/display/blocks/diagram/presentation-direction.js +19 -0
- package/dist/display/blocks/diagram/ui-utils.d.ts +1 -0
- package/dist/display/blocks/diagram/ui-utils.js +18 -0
- package/dist/display/blocks/diff/DiffBlock.d.ts +10 -0
- package/dist/display/blocks/diff/DiffBlock.js +119 -0
- package/dist/display/blocks/diff/DiffCanvas.d.ts +15 -0
- package/dist/display/blocks/diff/DiffCanvas.js +20 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.d.ts +24 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.js +53 -0
- package/dist/display/blocks/generic/StructuredValueTabs.d.ts +21 -0
- package/dist/display/blocks/generic/StructuredValueTabs.js +124 -0
- package/dist/display/blocks/generic/tile-actions-slot.d.ts +39 -0
- package/dist/display/blocks/generic/tile-actions-slot.js +33 -0
- package/dist/display/blocks/images/ImageBlock.d.ts +8 -0
- package/dist/display/blocks/images/ImageBlock.js +265 -0
- package/dist/display/blocks/json/JsonBlock.d.ts +34 -0
- package/dist/display/blocks/json/JsonBlock.js +562 -0
- package/dist/display/blocks/json/JsonTableView.d.ts +10 -0
- package/dist/display/blocks/json/JsonTableView.js +173 -0
- package/dist/display/blocks/json/json-compact-stringify.d.ts +25 -0
- package/dist/display/blocks/json/json-compact-stringify.js +52 -0
- package/dist/display/blocks/json/json-tabular-utils.d.ts +65 -0
- package/dist/display/blocks/json/json-tabular-utils.js +121 -0
- package/dist/display/blocks/links/LinkComponent.d.ts +6 -0
- package/dist/display/blocks/links/LinkComponent.js +373 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.d.ts +1 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.js +0 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.d.ts +48 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.js +52 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.d.ts +17 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.js +70 -0
- package/dist/display/blocks/mermaid/MermaidBlock.d.ts +19 -0
- package/dist/display/blocks/mermaid/MermaidBlock.js +386 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.d.ts +50 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.js +71 -0
- package/dist/display/blocks/svg/SvgBlock.d.ts +8 -0
- package/dist/display/blocks/svg/SvgBlock.js +126 -0
- package/dist/display/blocks/table/StreamingTableRenderer.d.ts +53 -0
- package/dist/display/blocks/table/StreamingTableRenderer.js +907 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.d.ts +21 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.js +79 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.d.ts +14 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.js +15 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.js +19 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.d.ts +30 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.js +75 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.js +48 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.d.ts +12 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.js +19 -0
- package/dist/display/blocks/toml/TomlBlock.d.ts +7 -0
- package/dist/display/blocks/toml/TomlBlock.js +167 -0
- package/dist/display/blocks/tree/TreeBlock.d.ts +7 -0
- package/dist/display/blocks/tree/TreeBlock.js +163 -0
- package/dist/display/blocks/xml/XmlBlock.d.ts +23 -0
- package/dist/display/blocks/xml/XmlBlock.js +197 -0
- package/dist/display/blocks/xml/readXmlTag.d.ts +1 -0
- package/dist/display/blocks/xml/readXmlTag.js +1 -0
- package/dist/display/blocks/xml/xml-tokenize.d.ts +13 -0
- package/dist/display/blocks/xml/xml-tokenize.js +169 -0
- package/dist/display/blocks/yaml/YamlBlock.d.ts +7 -0
- package/dist/display/blocks/yaml/YamlBlock.js +191 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.d.ts +29 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.js +122 -0
- package/dist/display/chat-markdown/BlockRenderingContext.d.ts +23 -0
- package/dist/display/chat-markdown/BlockRenderingContext.js +17 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.d.ts +172 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.js +649 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.d.ts +19 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.js +146 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.d.ts +11 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.js +9 -0
- package/dist/display/chat-markdown/KindTextGate.d.ts +31 -0
- package/dist/display/chat-markdown/KindTextGate.js +60 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.d.ts +6 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.js +92 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.d.ts +72 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.js +94 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.d.ts +126 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.js +473 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.d.ts +410 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.js +495 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.d.ts +13 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.js +236 -0
- package/dist/display/chat-markdown/constants.d.ts +14 -0
- package/dist/display/chat-markdown/constants.js +317 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.d.ts +31 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.js +62 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.d.ts +12 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.js +18 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.d.ts +22 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.js +130 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.d.ts +21 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.js +91 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.d.ts +26 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.js +186 -0
- package/dist/display/chat-markdown/diff-blocks/types.d.ts +56 -0
- package/dist/display/chat-markdown/diff-blocks/types.js +0 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.js +83 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.d.ts +4 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.js +16 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.d.ts +17 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.js +40 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.d.ts +8 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.js +91 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.js +72 -0
- package/dist/display/chat-markdown/kind-source-view.d.ts +14 -0
- package/dist/display/chat-markdown/kind-source-view.js +14 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.d.ts +28 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.js +65 -0
- package/dist/display/chat-markdown/progressive-mount.d.ts +18 -0
- package/dist/display/chat-markdown/progressive-mount.js +90 -0
- package/dist/display/chat-markdown/render-block-to-content-block.d.ts +31 -0
- package/dist/display/chat-markdown/render-block-to-content-block.js +32 -0
- package/dist/display/chat-markdown/settle-stream-blocks.d.ts +50 -0
- package/dist/display/chat-markdown/settle-stream-blocks.js +26 -0
- package/dist/display/chat-markdown/stable-blocks.d.ts +15 -0
- package/dist/display/chat-markdown/stable-blocks.js +54 -0
- package/dist/display/chat-markdown/types.d.ts +11 -0
- package/dist/display/chat-markdown/types.js +26 -0
- package/dist/display/specimen/SpecimenContext.d.ts +26 -0
- package/dist/display/specimen/SpecimenContext.js +64 -0
- package/dist/display/tables/MarkdownTable.d.ts +23 -0
- package/dist/display/tables/MarkdownTable.js +769 -0
- package/dist/display/tables/MarkdownTableScrollArea.d.ts +12 -0
- package/dist/display/tables/MarkdownTableScrollArea.js +92 -0
- package/dist/display/tables/SendToGoogleSheetButton.d.ts +19 -0
- package/dist/display/tables/SendToGoogleSheetButton.js +93 -0
- package/dist/display/tables/SendToWorkbookButton.d.ts +24 -0
- package/dist/display/tables/SendToWorkbookButton.js +93 -0
- package/dist/display/tables/TableSaveToMenu.d.ts +16 -0
- package/dist/display/tables/TableSaveToMenu.js +98 -0
- package/dist/display/tables/TableWithSeparatedControls.d.ts +22 -0
- package/dist/display/tables/TableWithSeparatedControls.js +574 -0
- package/dist/display/tables/ViewTableModal.d.ts +14 -0
- package/dist/display/tables/ViewTableModal.js +67 -0
- package/dist/display/tables/editing/ColumnActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/ColumnActionsMenu.js +80 -0
- package/dist/display/tables/editing/RowActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/RowActionsMenu.js +80 -0
- package/dist/display/tables/editing/TableEditToolbar.d.ts +15 -0
- package/dist/display/tables/editing/TableEditToolbar.js +63 -0
- package/dist/display/tables/editing/tableMutations.d.ts +50 -0
- package/dist/display/tables/editing/tableMutations.js +148 -0
- package/dist/display/tables/editing/useDoubleClickEdit.d.ts +43 -0
- package/dist/display/tables/editing/useDoubleClickEdit.js +51 -0
- package/dist/display/tables/editing/useTableUndo.d.ts +25 -0
- package/dist/display/tables/editing/useTableUndo.js +17 -0
- package/dist/display/tables/table-action-row.d.ts +8 -0
- package/dist/display/tables/table-action-row.js +31 -0
- package/dist/display/tables/table-viewer.d.ts +13 -0
- package/dist/display/tables/table-viewer.js +18 -0
- package/dist/host/ErrorActions.d.ts +1 -1
- package/dist/host/ErrorNotice.d.ts +10 -0
- package/dist/host/ErrorNotice.js +19 -0
- package/dist/host/app-bindings.d.ts +155 -0
- package/dist/host/app-bindings.js +160 -0
- package/dist/host/diagnostics.d.ts +2 -2
- package/dist/host/diagnostics.js +2 -1
- package/dist/host/tables.d.ts +1 -6
- package/dist/host/types.d.ts +14 -7
- package/dist/levels/RichContent.d.ts +3 -0
- package/dist/levels/RichContent.js +102 -0
- package/dist/levels/RichContentInline.d.ts +28 -0
- package/dist/levels/RichContentInline.js +61 -0
- package/dist/levels/RichContentPreview.d.ts +12 -0
- package/dist/levels/RichContentPreview.js +39 -0
- package/dist/levels/RichContentStandardImpl.d.ts +12 -0
- package/dist/levels/RichContentStandardImpl.js +27 -0
- package/dist/levels/RichContentStaticProse.d.ts +46 -0
- package/dist/levels/RichContentStaticProse.js +100 -0
- package/dist/levels/depth.d.ts +18 -0
- package/dist/levels/depth.js +32 -0
- package/dist/levels/prose/inline-level-elements.d.ts +19 -0
- package/dist/levels/prose/inline-level-elements.js +103 -0
- package/dist/levels/prose/prose-block-elements.d.ts +25 -0
- package/dist/levels/prose/prose-block-elements.js +313 -0
- package/dist/levels/prose/prose-inline-elements.d.ts +13 -0
- package/dist/levels/prose/prose-inline-elements.js +143 -0
- package/dist/levels/prose/prose-prepare.d.ts +50 -0
- package/dist/levels/prose/prose-prepare.js +246 -0
- package/dist/levels/prose/remote-image-policy.d.ts +34 -0
- package/dist/levels/prose/remote-image-policy.js +153 -0
- package/dist/levels/prose/variant-root.d.ts +9 -0
- package/dist/levels/prose/variant-root.js +34 -0
- package/dist/levels/rich-content-types.d.ts +93 -0
- package/dist/levels/rich-content-types.js +4 -0
- package/dist/levels/server/DelimiterViolationReport.d.ts +7 -0
- package/dist/levels/server/DelimiterViolationReport.js +24 -0
- package/dist/levels/server/RichContentServer.d.ts +27 -0
- package/dist/levels/server/RichContentServer.js +97 -0
- package/dist/levels/standard/NestedRichContent.d.ts +7 -0
- package/dist/levels/standard/NestedRichContent.js +70 -0
- package/dist/levels/standard/StandardBlocks.d.ts +13 -0
- package/dist/levels/standard/StandardBlocks.js +239 -0
- package/dist/levels/standard/StandardKindRegion.d.ts +14 -0
- package/dist/levels/standard/StandardKindRegion.js +69 -0
- package/dist/levels/standard/standard-kind-region.d.ts +19 -0
- package/dist/levels/standard/standard-kind-region.js +21 -0
- package/dist/levels/standard/static-standard.d.ts +23 -0
- package/dist/levels/standard/static-standard.js +187 -0
- package/dist/levels/standard/stream-holdback.d.ts +2 -0
- package/dist/levels/standard/stream-holdback.js +77 -0
- package/dist/mermaid/MermaidFullscreen.d.ts +17 -0
- package/dist/mermaid/MermaidFullscreen.js +71 -0
- package/dist/mermaid/MermaidRenderer.d.ts +20 -0
- package/dist/mermaid/MermaidRenderer.js +267 -0
- package/dist/mermaid/MermaidView.d.ts +27 -0
- package/dist/mermaid/MermaidView.js +68 -0
- package/dist/mermaid/MermaidViewport.d.ts +75 -0
- package/dist/mermaid/MermaidViewport.js +286 -0
- package/dist/mermaid/adapters/er.d.ts +10 -0
- package/dist/mermaid/adapters/er.js +205 -0
- package/dist/mermaid/adapters/flowchart.d.ts +17 -0
- package/dist/mermaid/adapters/flowchart.js +634 -0
- package/dist/mermaid/adapters/journey.d.ts +9 -0
- package/dist/mermaid/adapters/journey.js +207 -0
- package/dist/mermaid/adapters/mindmap.d.ts +12 -0
- package/dist/mermaid/adapters/mindmap.js +252 -0
- package/dist/mermaid/adapters/pie.d.ts +7 -0
- package/dist/mermaid/adapters/pie.js +172 -0
- package/dist/mermaid/adapters/quadrant.d.ts +8 -0
- package/dist/mermaid/adapters/quadrant.js +231 -0
- package/dist/mermaid/adapters/register.d.ts +7 -0
- package/dist/mermaid/adapters/register.js +19 -0
- package/dist/mermaid/adapters/sequence.d.ts +8 -0
- package/dist/mermaid/adapters/sequence.js +251 -0
- package/dist/mermaid/adapters/state.d.ts +12 -0
- package/dist/mermaid/adapters/state.js +245 -0
- package/dist/mermaid/adapters/timeline.d.ts +8 -0
- package/dist/mermaid/adapters/timeline.js +245 -0
- package/dist/mermaid/catalog.d.ts +33 -0
- package/dist/mermaid/catalog.js +202 -0
- package/dist/mermaid/diagram-type.d.ts +39 -0
- package/dist/mermaid/diagram-type.js +89 -0
- package/dist/mermaid/export.d.ts +21 -0
- package/dist/mermaid/export.js +112 -0
- package/dist/mermaid/extract-fence.d.ts +15 -0
- package/dist/mermaid/extract-fence.js +22 -0
- package/dist/mermaid/lazy-draw.d.ts +40 -0
- package/dist/mermaid/lazy-draw.js +168 -0
- package/dist/mermaid/model/adapter.d.ts +28 -0
- package/dist/mermaid/model/adapter.js +16 -0
- package/dist/mermaid/model/ops.d.ts +282 -0
- package/dist/mermaid/model/ops.js +9 -0
- package/dist/mermaid/model/round-trip.d.ts +22 -0
- package/dist/mermaid/model/round-trip.js +45 -0
- package/dist/mermaid/model/types.d.ts +271 -0
- package/dist/mermaid/model/types.js +0 -0
- package/dist/mermaid/print-render.d.ts +9 -0
- package/dist/mermaid/print-render.js +39 -0
- package/dist/mermaid/runtime.d.ts +25 -0
- package/dist/mermaid/runtime.js +183 -0
- package/dist/mermaid/sanitize.d.ts +46 -0
- package/dist/mermaid/sanitize.js +234 -0
- package/dist/mermaid/types.d.ts +43 -0
- package/dist/mermaid/types.js +21 -0
- package/dist/mermaid/view/ViewModePane.d.ts +24 -0
- package/dist/mermaid/view/ViewModePane.js +9 -0
- package/dist/utils/client-lazy.d.ts +1 -1
- package/dist/utils/client-lazy.js +4 -1
- package/dist/utils/lifted/DiffView.d.ts +10 -0
- package/dist/utils/lifted/DiffView.js +26 -0
- package/dist/utils/lifted/IconButton.d.ts +24 -0
- package/dist/utils/lifted/IconButton.js +43 -0
- package/dist/utils/lifted/MatrxMiniLoader.d.ts +1 -0
- package/dist/utils/lifted/MatrxMiniLoader.js +8 -0
- package/dist/utils/lifted/ShimmerText.d.ts +5 -0
- package/dist/utils/lifted/ShimmerText.js +21 -0
- package/dist/utils/lifted/SuspenseLoader.d.ts +16 -0
- package/dist/utils/lifted/SuspenseLoader.js +42 -0
- package/dist/utils/lifted/Tooltip.d.ts +20 -0
- package/dist/utils/lifted/Tooltip.js +52 -0
- package/dist/utils/lifted/artifactId.d.ts +34 -0
- package/dist/utils/lifted/artifactId.js +15 -0
- package/dist/utils/lifted/canvasContent.d.ts +63 -0
- package/dist/utils/lifted/canvasContent.js +98 -0
- package/dist/utils/lifted/captureReactError.d.ts +24 -0
- package/dist/utils/lifted/captureReactError.js +28 -0
- package/dist/utils/lifted/chunk-load-recovery.d.ts +25 -0
- package/dist/utils/lifted/chunk-load-recovery.js +36 -0
- package/dist/utils/lifted/code-editor-agent-types.d.ts +6 -0
- package/dist/utils/lifted/code-editor-agent-types.js +0 -0
- package/dist/utils/lifted/code-editor-agents.d.ts +39 -0
- package/dist/utils/lifted/code-editor-agents.js +52 -0
- package/dist/utils/lifted/code-language-extension.d.ts +1 -0
- package/dist/utils/lifted/code-language-extension.js +60 -0
- package/dist/utils/lifted/custom-icons.d.ts +16 -0
- package/dist/utils/lifted/custom-icons.js +47 -0
- package/dist/utils/lifted/durability.d.ts +16 -0
- package/dist/utils/lifted/durability.js +45 -0
- package/dist/utils/lifted/errors.d.ts +30 -0
- package/dist/utils/lifted/errors.js +29 -0
- package/dist/utils/lifted/html-document.d.ts +1 -0
- package/dist/utils/lifted/html-document.js +12 -0
- package/dist/utils/lifted/languageOptions.d.ts +9 -0
- package/dist/utils/lifted/languageOptions.js +52 -0
- package/dist/utils/lifted/languages.d.ts +34 -0
- package/dist/utils/lifted/languages.js +175 -0
- package/dist/utils/lifted/loading-spinner.d.ts +18 -0
- package/dist/utils/lifted/loading-spinner.js +200 -0
- package/dist/utils/lifted/media-refs.d.ts +13 -0
- package/dist/utils/lifted/media-refs.js +27 -0
- package/dist/utils/lifted/scroll-root.d.ts +1 -0
- package/dist/utils/lifted/scroll-root.js +25 -0
- package/dist/utils/lifted/syntax-themes.d.ts +32 -0
- package/dist/utils/lifted/syntax-themes.js +100 -0
- package/dist/utils/lifted/url-utm.d.ts +24 -0
- package/dist/utils/lifted/url-utm.js +66 -0
- package/dist/utils/lifted/use-is-mounted.d.ts +24 -0
- package/dist/utils/lifted/use-is-mounted.js +21 -0
- package/dist/utils/lifted/useToastManager.d.ts +1 -0
- package/dist/utils/lifted/useToastManager.js +7 -0
- package/dist/utils/report-kind-at-raw-renderer.d.ts +19 -0
- package/dist/utils/report-kind-at-raw-renderer.js +32 -0
- package/package.json +48 -10
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { NestedRichContent } from "../../../levels/standard/NestedRichContent.js";
|
|
4
|
+
import { BlockComponents } from "./BlockComponentRegistry.js";
|
|
5
|
+
import { InlineStatusIndicator } from "../internal-handlers/InlineStatusIndicator.js";
|
|
6
|
+
import { EXPERT_WORKING_LABEL } from "../../block-interaction.js";
|
|
7
|
+
import { looksLikeDiff } from "../diff-blocks/diff-style-registry.js";
|
|
8
|
+
import { InlineCodeSnippet } from "../InlineCodeSnippet.js";
|
|
9
|
+
import { isQuotedSourceXmlBlock } from "@ai-matrx/content-ir/surfaces";
|
|
10
|
+
import {
|
|
11
|
+
GENERIC_STRUCTURED_COMPONENT_KEY
|
|
12
|
+
} from "../../../kinds/react/kind-route.js";
|
|
13
|
+
import GenericStructuredBlock from "../../blocks/generic/GenericStructuredBlock.js";
|
|
14
|
+
import MarkdownKindBlock from "../../blocks/markdown/MarkdownKindBlock.js";
|
|
15
|
+
import { CodeBlockWithContextAttach } from "../../../host/app-bindings.js";
|
|
16
|
+
import { captureError } from "../../../host/diagnostics.js";
|
|
17
|
+
import { FENCE_META_KEY } from "@ai-matrx/content-ir/source";
|
|
18
|
+
import {
|
|
19
|
+
detectImageMarkdown
|
|
20
|
+
} from "../../markdown-classification/processors/utils/content-splitter-v2.js";
|
|
21
|
+
import { readEnvelope } from "../../../kinds/redux/render-block-envelope.js";
|
|
22
|
+
import { jsonAnswerRenderer } from "../../block-interaction.js";
|
|
23
|
+
const DEFAULT_UNLABELED_FENCE_LANGUAGE = "markdown";
|
|
24
|
+
const JSON_CODE_LANGUAGES = /* @__PURE__ */ new Set(["json"]);
|
|
25
|
+
function audioMimeFromUrl(url) {
|
|
26
|
+
const ext = url.split(/[?#]/)[0].match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase();
|
|
27
|
+
switch (ext) {
|
|
28
|
+
case "mp3":
|
|
29
|
+
return "audio/mpeg";
|
|
30
|
+
case "wav":
|
|
31
|
+
return "audio/wav";
|
|
32
|
+
case "m4a":
|
|
33
|
+
return "audio/mp4";
|
|
34
|
+
case "aac":
|
|
35
|
+
return "audio/aac";
|
|
36
|
+
case "ogg":
|
|
37
|
+
case "oga":
|
|
38
|
+
return "audio/ogg";
|
|
39
|
+
case "opus":
|
|
40
|
+
return "audio/opus";
|
|
41
|
+
case "flac":
|
|
42
|
+
return "audio/flac";
|
|
43
|
+
case "weba":
|
|
44
|
+
case "webm":
|
|
45
|
+
return "audio/webm";
|
|
46
|
+
default:
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function isGenuinelyIncomplete(content) {
|
|
51
|
+
const trimmed = content.trim();
|
|
52
|
+
const openBraces = (trimmed.match(/\{/g) || []).length;
|
|
53
|
+
const closeBraces = (trimmed.match(/\}/g) || []).length;
|
|
54
|
+
return openBraces > closeBraces;
|
|
55
|
+
}
|
|
56
|
+
function isBlockLoading(block) {
|
|
57
|
+
if (block.isStreamingBlock) return true;
|
|
58
|
+
const envelope = readEnvelope(block.metadata);
|
|
59
|
+
if (envelope?.root.kind && envelope.root.status !== "complete") return true;
|
|
60
|
+
if (block.metadata?.isComplete === false && isGenuinelyIncomplete(block.content))
|
|
61
|
+
return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const reportedUnregisteredTypes = /* @__PURE__ */ new Set();
|
|
65
|
+
function reportUnregisteredBlockType(type, meta) {
|
|
66
|
+
const message = `[block-dispatch] UNREGISTERED render-block type "${type}" \u2014 no dispatch registration exists. Rendering as basic markdown. Classify it in block-dispatch.tsx (per the content-vocab crosswalk) and register a renderer.`;
|
|
67
|
+
if (!reportedUnregisteredTypes.has(type)) {
|
|
68
|
+
reportedUnregisteredTypes.add(type);
|
|
69
|
+
console.error(message, meta);
|
|
70
|
+
}
|
|
71
|
+
captureError({
|
|
72
|
+
source: "content-ir",
|
|
73
|
+
message,
|
|
74
|
+
requestId: meta.requestId,
|
|
75
|
+
conversationId: meta.conversationId,
|
|
76
|
+
raw: { blockType: type, ...meta }
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const reportedArtifactStageMisses = /* @__PURE__ */ new Set();
|
|
80
|
+
const expectUnifiedArtifactStage = (ctx) => {
|
|
81
|
+
const { block } = ctx;
|
|
82
|
+
const message = `[block-dispatch] block type "${block.type}" should have rendered via the unified artifact stage (features/canvas/artifact-types/artifact-renderers.tsx) but fell through to the dispatch table \u2014 its unified renderer registration is missing. Rendering as basic markdown.`;
|
|
83
|
+
if (!reportedArtifactStageMisses.has(block.type)) {
|
|
84
|
+
reportedArtifactStageMisses.add(block.type);
|
|
85
|
+
console.error(message);
|
|
86
|
+
}
|
|
87
|
+
captureError({
|
|
88
|
+
source: "content-ir",
|
|
89
|
+
message,
|
|
90
|
+
conversationId: ctx.conversationId,
|
|
91
|
+
requestId: ctx.requestId,
|
|
92
|
+
raw: { blockType: block.type }
|
|
93
|
+
});
|
|
94
|
+
return block.content ? ctx.renderBasicMarkdown(block.content) : null;
|
|
95
|
+
};
|
|
96
|
+
const renderControlTagMarkdown = (ctx) => ctx.block.content ? ctx.renderBasicMarkdown(ctx.block.content) : null;
|
|
97
|
+
const renderNestedSection = ({ block, index, isStreamActive }) => block.content ? /* @__PURE__ */ jsx(
|
|
98
|
+
NestedRichContent,
|
|
99
|
+
{
|
|
100
|
+
source: block.content,
|
|
101
|
+
isStreaming: isStreamActive
|
|
102
|
+
},
|
|
103
|
+
index
|
|
104
|
+
) : null;
|
|
105
|
+
function missingMediaFallback(ctx, kind) {
|
|
106
|
+
console.warn(
|
|
107
|
+
`[BlockRenderer] ${kind} block without a readable URL \u2014 showing its text.`,
|
|
108
|
+
ctx.block.content.slice(0, 200)
|
|
109
|
+
);
|
|
110
|
+
return ctx.block.content ? ctx.renderBasicMarkdown(ctx.block.content) : null;
|
|
111
|
+
}
|
|
112
|
+
function readFenceMeta(source) {
|
|
113
|
+
const value = source?.[FENCE_META_KEY];
|
|
114
|
+
return typeof value === "string" && value ? value : void 0;
|
|
115
|
+
}
|
|
116
|
+
const META_PREFERS_CODE_BLOCK = /* @__PURE__ */ new Set([
|
|
117
|
+
"yaml",
|
|
118
|
+
"yml",
|
|
119
|
+
"toml",
|
|
120
|
+
"csv",
|
|
121
|
+
"tsv",
|
|
122
|
+
"xml"
|
|
123
|
+
]);
|
|
124
|
+
const CODE_LANGUAGE_DISPATCH = {
|
|
125
|
+
yaml: renderYamlCode,
|
|
126
|
+
yml: renderYamlCode,
|
|
127
|
+
// HTML used to be lumped in with XmlBlock, which broke the standard code
|
|
128
|
+
// block (and with it the "convert to actual webpage" feature) — see the
|
|
129
|
+
// `html` entry below.
|
|
130
|
+
xml: renderXmlCode,
|
|
131
|
+
svg: renderXmlCode,
|
|
132
|
+
html: renderHtmlCode,
|
|
133
|
+
jsx: renderReactCode,
|
|
134
|
+
tsx: renderReactCode,
|
|
135
|
+
react: renderReactCode,
|
|
136
|
+
csv: renderCsvCode,
|
|
137
|
+
tsv: renderCsvCode,
|
|
138
|
+
toml: renderTomlCode,
|
|
139
|
+
json: renderJsonCode,
|
|
140
|
+
jsonc: renderJsonCode,
|
|
141
|
+
json5: renderJsonCode,
|
|
142
|
+
markdown: renderMarkdownPreviewCode,
|
|
143
|
+
md: renderMarkdownPreviewCode,
|
|
144
|
+
mdx: renderMarkdownPreviewCode
|
|
145
|
+
};
|
|
146
|
+
function renderYamlCode({ block, index }) {
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
BlockComponents.YamlBlock,
|
|
149
|
+
{
|
|
150
|
+
content: block.content,
|
|
151
|
+
className: "my-3"
|
|
152
|
+
},
|
|
153
|
+
index
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function renderXmlCode({ block, index }) {
|
|
157
|
+
return /* @__PURE__ */ jsx(
|
|
158
|
+
BlockComponents.XmlBlock,
|
|
159
|
+
{
|
|
160
|
+
content: block.content,
|
|
161
|
+
language: block.language?.toLowerCase(),
|
|
162
|
+
quotedSource: isQuotedSourceXmlBlock(block),
|
|
163
|
+
className: "my-3"
|
|
164
|
+
},
|
|
165
|
+
index
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function renderPlainCodeFallback({ block, index }) {
|
|
169
|
+
return /* @__PURE__ */ jsx(BlockComponents.CodeBlock, { code: block.content, language: block.language ?? DEFAULT_UNLABELED_FENCE_LANGUAGE, className: "my-3" }, index);
|
|
170
|
+
}
|
|
171
|
+
function renderHtmlCode(ctx) {
|
|
172
|
+
const { block, index, isStreamActive, messageId, conversationId } = ctx;
|
|
173
|
+
const HtmlInlinePreview = BlockComponents.HtmlInlinePreview;
|
|
174
|
+
if (!HtmlInlinePreview) return renderPlainCodeFallback(ctx);
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
HtmlInlinePreview,
|
|
177
|
+
{
|
|
178
|
+
code: block.content,
|
|
179
|
+
language: block.language,
|
|
180
|
+
isComplete: !isStreamActive && !isBlockLoading(block),
|
|
181
|
+
messageId,
|
|
182
|
+
conversationId,
|
|
183
|
+
onCodeChange: isStreamActive ? void 0 : (newCode) => ctx.replaceBlockContent(block.content, newCode)
|
|
184
|
+
},
|
|
185
|
+
index
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
function renderReactCode(ctx) {
|
|
189
|
+
const { block, index, isStreamActive } = ctx;
|
|
190
|
+
const ReactCodeBlock = BlockComponents.ReactCodeBlock;
|
|
191
|
+
if (!ReactCodeBlock) return renderPlainCodeFallback(ctx);
|
|
192
|
+
return /* @__PURE__ */ jsx(
|
|
193
|
+
ReactCodeBlock,
|
|
194
|
+
{
|
|
195
|
+
code: block.content,
|
|
196
|
+
language: block.language,
|
|
197
|
+
isComplete: !isStreamActive && !isBlockLoading(block),
|
|
198
|
+
onCodeChange: isStreamActive ? void 0 : (newCode) => ctx.replaceBlockContent(block.content, newCode)
|
|
199
|
+
},
|
|
200
|
+
index
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function renderCsvCode(ctx) {
|
|
204
|
+
const { block, index, isStreamActive } = ctx;
|
|
205
|
+
return /* @__PURE__ */ jsx(
|
|
206
|
+
BlockComponents.CsvBlock,
|
|
207
|
+
{
|
|
208
|
+
content: block.content,
|
|
209
|
+
delimiter: block.language?.toLowerCase() === "tsv" ? " " : ",",
|
|
210
|
+
className: "my-3",
|
|
211
|
+
onInnerContentChange: isStreamActive ? void 0 : (inner) => ctx.replaceBlockContent(block.content, inner)
|
|
212
|
+
},
|
|
213
|
+
index
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function renderTomlCode({ block, index }) {
|
|
217
|
+
return /* @__PURE__ */ jsx(
|
|
218
|
+
BlockComponents.TomlBlock,
|
|
219
|
+
{
|
|
220
|
+
content: block.content,
|
|
221
|
+
className: "my-3"
|
|
222
|
+
},
|
|
223
|
+
index
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function renderJsonCode(ctx) {
|
|
227
|
+
const { block, index, isStreamActive, conversationId, messageId } = ctx;
|
|
228
|
+
return /* @__PURE__ */ jsx(
|
|
229
|
+
BlockComponents.JsonBlock,
|
|
230
|
+
{
|
|
231
|
+
content: block.content,
|
|
232
|
+
meta: readFenceMeta(block.metadata) ?? readFenceMeta(block.serverData),
|
|
233
|
+
className: "my-3",
|
|
234
|
+
isStreamActive,
|
|
235
|
+
conversationId,
|
|
236
|
+
messageId,
|
|
237
|
+
irEnvelope: readEnvelope(block.metadata),
|
|
238
|
+
onCodeChange: isStreamActive ? void 0 : (newCode) => ctx.replaceBlockContent(block.content, newCode)
|
|
239
|
+
},
|
|
240
|
+
index
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function renderMarkdownPreviewCode(ctx) {
|
|
244
|
+
const { block, index, isStreamActive } = ctx;
|
|
245
|
+
return /* @__PURE__ */ jsx(
|
|
246
|
+
BlockComponents.MarkdownPreviewBlock,
|
|
247
|
+
{
|
|
248
|
+
content: block.content,
|
|
249
|
+
className: "my-3",
|
|
250
|
+
isStreamActive,
|
|
251
|
+
onCodeChange: isStreamActive ? void 0 : (newCode) => ctx.replaceBlockContent(block.content, newCode)
|
|
252
|
+
},
|
|
253
|
+
index
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
const PROTOCOL_BLOCK_DISPATCH = {
|
|
257
|
+
thinking: renderReasoningEntry,
|
|
258
|
+
reasoning: renderReasoningEntry,
|
|
259
|
+
consolidated_reasoning: (ctx) => {
|
|
260
|
+
const { block, index } = ctx;
|
|
261
|
+
if (ctx.hideReasoning || ctx.machineFramesVisible === false) return null;
|
|
262
|
+
return /* @__PURE__ */ jsx(
|
|
263
|
+
BlockComponents.ConsolidatedReasoningVisualization,
|
|
264
|
+
{
|
|
265
|
+
reasoningTexts: block.metadata?.reasoningTexts ?? [
|
|
266
|
+
block.content
|
|
267
|
+
],
|
|
268
|
+
showReasoning: true
|
|
269
|
+
},
|
|
270
|
+
index
|
|
271
|
+
);
|
|
272
|
+
},
|
|
273
|
+
info: renderNestedSection,
|
|
274
|
+
task: renderNestedSection,
|
|
275
|
+
database: renderNestedSection,
|
|
276
|
+
private: renderNestedSection,
|
|
277
|
+
plan: renderNestedSection,
|
|
278
|
+
event: renderNestedSection,
|
|
279
|
+
tool: (ctx) => {
|
|
280
|
+
if (ctx.hideToolResults) return null;
|
|
281
|
+
return renderNestedSection(ctx);
|
|
282
|
+
},
|
|
283
|
+
search_replace: ({ block, index, isStreamActive }) => /* @__PURE__ */ jsx(
|
|
284
|
+
BlockComponents.SearchReplaceBlock,
|
|
285
|
+
{
|
|
286
|
+
serverData: block.serverData,
|
|
287
|
+
content: block.serverData ? void 0 : block.content,
|
|
288
|
+
language: block.metadata?.language || "typescript",
|
|
289
|
+
isStreamActive,
|
|
290
|
+
className: "my-3"
|
|
291
|
+
},
|
|
292
|
+
index
|
|
293
|
+
)
|
|
294
|
+
};
|
|
295
|
+
function renderReasoningEntry(ctx) {
|
|
296
|
+
const { block, index, isStreamActive, isLastReasoningBlock } = ctx;
|
|
297
|
+
if (ctx.hideReasoning) return null;
|
|
298
|
+
const isStreaming = isStreamActive === true && (isLastReasoningBlock === true || block.isStreamingBlock === true);
|
|
299
|
+
if (ctx.machineFramesVisible === false) {
|
|
300
|
+
return isStreaming ? /* @__PURE__ */ jsx(InlineStatusIndicator, { label: EXPERT_WORKING_LABEL }, index) : null;
|
|
301
|
+
}
|
|
302
|
+
return /* @__PURE__ */ jsx(
|
|
303
|
+
BlockComponents.ReasoningVisualization,
|
|
304
|
+
{
|
|
305
|
+
reasoningText: block.content,
|
|
306
|
+
showReasoning: true,
|
|
307
|
+
isStreaming
|
|
308
|
+
},
|
|
309
|
+
index
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
const SCALAR_GENERIC_BLOCK_DISPATCH = {
|
|
313
|
+
text: renderControlTagMarkdown,
|
|
314
|
+
code: (ctx) => {
|
|
315
|
+
const { block, index, isStreamActive, conversationId, messageId } = ctx;
|
|
316
|
+
const lang = block.language?.toLowerCase();
|
|
317
|
+
if (lang && JSON_CODE_LANGUAGES.has(lang) && !isStreamActive && !isBlockLoading(block)) {
|
|
318
|
+
const answer = jsonAnswerRenderer()?.(ctx);
|
|
319
|
+
if (answer) return answer;
|
|
320
|
+
}
|
|
321
|
+
if (block.language === "diff" && looksLikeDiff(block.content)) {
|
|
322
|
+
return /* @__PURE__ */ jsx(
|
|
323
|
+
BlockComponents.StreamingDiffBlock,
|
|
324
|
+
{
|
|
325
|
+
content: block.content,
|
|
326
|
+
language: block.language || "typescript",
|
|
327
|
+
isStreamActive,
|
|
328
|
+
className: "my-3"
|
|
329
|
+
},
|
|
330
|
+
index
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
const hasFenceMeta = !!(readFenceMeta(block.metadata) ?? readFenceMeta(block.serverData));
|
|
334
|
+
const languageRenderer = lang && !(hasFenceMeta && META_PREFERS_CODE_BLOCK.has(lang)) ? CODE_LANGUAGE_DISPATCH[lang] : void 0;
|
|
335
|
+
if (languageRenderer) {
|
|
336
|
+
return languageRenderer(ctx);
|
|
337
|
+
}
|
|
338
|
+
const sizingProbe = block.content.trim();
|
|
339
|
+
const lineCount = sizingProbe.split("\n").length;
|
|
340
|
+
const fenceMeta = readFenceMeta(block.metadata) ?? readFenceMeta(block.serverData);
|
|
341
|
+
const isSmallBlock = !fenceMeta && lineCount <= 2 && sizingProbe.length < 120;
|
|
342
|
+
if (!sizingProbe) return null;
|
|
343
|
+
if (isSmallBlock) {
|
|
344
|
+
return /* @__PURE__ */ jsx(
|
|
345
|
+
InlineCodeSnippet,
|
|
346
|
+
{
|
|
347
|
+
code: block.content,
|
|
348
|
+
language: block.language,
|
|
349
|
+
className: "my-3"
|
|
350
|
+
},
|
|
351
|
+
index
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
return /* @__PURE__ */ jsx(
|
|
355
|
+
CodeBlockWithContextAttach,
|
|
356
|
+
{
|
|
357
|
+
code: block.content,
|
|
358
|
+
language: block.language || DEFAULT_UNLABELED_FENCE_LANGUAGE,
|
|
359
|
+
meta: fenceMeta,
|
|
360
|
+
fontSize: 16,
|
|
361
|
+
className: "my-3",
|
|
362
|
+
onCodeChange: isStreamActive ? void 0 : (newCode) => ctx.replaceBlockContent(block.content, newCode),
|
|
363
|
+
isStreamActive,
|
|
364
|
+
conversationId,
|
|
365
|
+
messageId
|
|
366
|
+
},
|
|
367
|
+
index
|
|
368
|
+
);
|
|
369
|
+
},
|
|
370
|
+
// NOTE: standalone `table` blocks are normally consumed by the unified
|
|
371
|
+
// artifact stage (TableArtifact); this registration is the preserved legacy
|
|
372
|
+
// path should that stage ever decline.
|
|
373
|
+
table: (ctx) => {
|
|
374
|
+
const { block, index, isStreamActive } = ctx;
|
|
375
|
+
return /* @__PURE__ */ jsx(
|
|
376
|
+
BlockComponents.StreamingTableRenderer,
|
|
377
|
+
{
|
|
378
|
+
content: block.content,
|
|
379
|
+
metadata: block.metadata,
|
|
380
|
+
isStreamActive,
|
|
381
|
+
onContentChange: isStreamActive ? void 0 : (updatedTable) => ctx.replaceBlockContent(block.content, updatedTable)
|
|
382
|
+
},
|
|
383
|
+
index
|
|
384
|
+
);
|
|
385
|
+
},
|
|
386
|
+
image: (ctx) => {
|
|
387
|
+
const { block, index } = ctx;
|
|
388
|
+
const media = block.src ? { src: block.src, alt: block.alt } : detectImageMarkdown(block.content);
|
|
389
|
+
if (!media.src) return missingMediaFallback(ctx, "image");
|
|
390
|
+
return /* @__PURE__ */ jsx(BlockComponents.ImageBlock, { src: media.src, alt: media.alt }, index);
|
|
391
|
+
},
|
|
392
|
+
// NOTE: like `table` — normally consumed by the unified artifact stage
|
|
393
|
+
// (TreeArtifact); preserved legacy path below.
|
|
394
|
+
tree: ({ block, index }) => /* @__PURE__ */ jsx(
|
|
395
|
+
BlockComponents.TreeBlock,
|
|
396
|
+
{
|
|
397
|
+
content: block.content,
|
|
398
|
+
className: "my-3"
|
|
399
|
+
},
|
|
400
|
+
index
|
|
401
|
+
),
|
|
402
|
+
"accent-divider": ({ index }) => /* @__PURE__ */ jsx("div", { className: "my-4 flex items-center gap-3", children: /* @__PURE__ */ jsx("div", { className: "h-0.5 flex-1 bg-primary/60 rounded-full" }) }, index),
|
|
403
|
+
"heavy-divider": ({ index }) => /* @__PURE__ */ jsx("div", { className: "my-6 flex items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "h-1 flex-1 rounded-full bg-gradient-to-r from-primary/20 via-primary to-primary/20" }) }, index),
|
|
404
|
+
// ```svg fences are consumed by the unified artifact stage (SvgArtifact).
|
|
405
|
+
svg: expectUnifiedArtifactStage
|
|
406
|
+
};
|
|
407
|
+
const SHAPE_BLOCK_DISPATCH = {
|
|
408
|
+
// Consumed by the unified artifact stage (Stage 3) — each of these types has
|
|
409
|
+
// a registered unified renderer (artifact-renderers.tsx). Reaching the
|
|
410
|
+
// dispatch table means that registration was lost: scream + markdown.
|
|
411
|
+
flashcards: expectUnifiedArtifactStage,
|
|
412
|
+
quiz: expectUnifiedArtifactStage,
|
|
413
|
+
presentation: expectUnifiedArtifactStage,
|
|
414
|
+
cooking_recipe: expectUnifiedArtifactStage,
|
|
415
|
+
timeline: expectUnifiedArtifactStage,
|
|
416
|
+
progress_tracker: expectUnifiedArtifactStage,
|
|
417
|
+
comparison_table: expectUnifiedArtifactStage,
|
|
418
|
+
troubleshooting: expectUnifiedArtifactStage,
|
|
419
|
+
resources: expectUnifiedArtifactStage,
|
|
420
|
+
decision_tree: expectUnifiedArtifactStage,
|
|
421
|
+
research: expectUnifiedArtifactStage,
|
|
422
|
+
diagram: expectUnifiedArtifactStage,
|
|
423
|
+
mermaid: expectUnifiedArtifactStage,
|
|
424
|
+
math_problem: expectUnifiedArtifactStage,
|
|
425
|
+
questionnaire: expectUnifiedArtifactStage,
|
|
426
|
+
tasks: expectUnifiedArtifactStage,
|
|
427
|
+
chart: expectUnifiedArtifactStage,
|
|
428
|
+
map: expectUnifiedArtifactStage,
|
|
429
|
+
stats: expectUnifiedArtifactStage,
|
|
430
|
+
diff: expectUnifiedArtifactStage,
|
|
431
|
+
// The R6 generic fallback (features/content-ir/react/kind-route.ts): the
|
|
432
|
+
// envelope resolved a kind the platform KNOWS, but nothing render-trusted
|
|
433
|
+
// claims it. Rather than dropping to a raw code block, show every field
|
|
434
|
+
// readably plus an honest "unverified shape" affordance. Reached ONLY via
|
|
435
|
+
// applyIrKindRoute — nothing emits this block type upstream.
|
|
436
|
+
[GENERIC_STRUCTURED_COMPONENT_KEY]: ({ block, index }) => /* @__PURE__ */ jsx(
|
|
437
|
+
GenericStructuredBlock,
|
|
438
|
+
{
|
|
439
|
+
content: block.content,
|
|
440
|
+
metadata: block.metadata
|
|
441
|
+
},
|
|
442
|
+
index
|
|
443
|
+
),
|
|
444
|
+
// The `markdown` kind route (features/content-ir/react/kind-route.ts
|
|
445
|
+
// resolver-only path): `{ text }` goes to MarkdownStream — the SAME engine
|
|
446
|
+
// that renders every streamed assistant message — so prose renders as prose
|
|
447
|
+
// and any kind payload fenced inside it routes to its own component. Reached
|
|
448
|
+
// ONLY via applyIrKindRoute.
|
|
449
|
+
markdown_stream: ({ block, index, isStreamActive }) => /* @__PURE__ */ jsx(
|
|
450
|
+
MarkdownKindBlock,
|
|
451
|
+
{
|
|
452
|
+
content: block.content,
|
|
453
|
+
metadata: block.metadata,
|
|
454
|
+
isStreamActive
|
|
455
|
+
},
|
|
456
|
+
index
|
|
457
|
+
)
|
|
458
|
+
};
|
|
459
|
+
const OPAQUE_BLOCK_DISPATCH = {};
|
|
460
|
+
const BLOCK_DISPATCH = {
|
|
461
|
+
...PROTOCOL_BLOCK_DISPATCH,
|
|
462
|
+
...SCALAR_GENERIC_BLOCK_DISPATCH,
|
|
463
|
+
...SHAPE_BLOCK_DISPATCH,
|
|
464
|
+
...OPAQUE_BLOCK_DISPATCH
|
|
465
|
+
};
|
|
466
|
+
const BLOCK_DISPATCH_CLASSIFICATION = {
|
|
467
|
+
protocol: Object.keys(PROTOCOL_BLOCK_DISPATCH),
|
|
468
|
+
scalar_generic: Object.keys(SCALAR_GENERIC_BLOCK_DISPATCH),
|
|
469
|
+
shape: Object.keys(SHAPE_BLOCK_DISPATCH),
|
|
470
|
+
intentionally_opaque: Object.keys(OPAQUE_BLOCK_DISPATCH)
|
|
471
|
+
};
|
|
472
|
+
const DISPATCH_MAP = new Map(
|
|
473
|
+
Object.entries(BLOCK_DISPATCH)
|
|
474
|
+
);
|
|
475
|
+
const REGISTERED_KEY = /* @__PURE__ */ Symbol.for("ai-matrx.rich-content.block-dispatch");
|
|
476
|
+
function registered() {
|
|
477
|
+
const g = globalThis;
|
|
478
|
+
return g[REGISTERED_KEY] ??= /* @__PURE__ */ new Map();
|
|
479
|
+
}
|
|
480
|
+
function registerBlockDispatch(entries) {
|
|
481
|
+
for (const [type, fn] of Object.entries(entries)) if (fn) registered().set(type, fn);
|
|
482
|
+
}
|
|
483
|
+
function resolveBlockDispatch(type) {
|
|
484
|
+
return registered().get(type) ?? DISPATCH_MAP.get(type) ?? null;
|
|
485
|
+
}
|
|
486
|
+
export {
|
|
487
|
+
BLOCK_DISPATCH,
|
|
488
|
+
BLOCK_DISPATCH_CLASSIFICATION,
|
|
489
|
+
DEFAULT_UNLABELED_FENCE_LANGUAGE,
|
|
490
|
+
audioMimeFromUrl,
|
|
491
|
+
isBlockLoading,
|
|
492
|
+
registerBlockDispatch,
|
|
493
|
+
reportUnregisteredBlockType,
|
|
494
|
+
resolveBlockDispatch
|
|
495
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON parse helpers for block content (LaTeX-aware, never throw).
|
|
3
|
+
* Used by BlockRenderer for quiz, presentation, math blocks.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Preprocess JSON content to fix common escape sequence issues before parsing.
|
|
7
|
+
* CRITICAL: Must never throw. Always returns a string (original or fixed).
|
|
8
|
+
*/
|
|
9
|
+
export declare function preprocessJsonContent(jsonString: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Safe JSON parsing with preprocessing. Returns null if parsing fails.
|
|
12
|
+
*/
|
|
13
|
+
export declare function safeJsonParse(jsonString: string): unknown;
|