@miragon/mcp-toolkit-ui 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -5
- package/dist/app/adapt-data-widget.d.ts +1 -22
- package/dist/app/adapt-data-widget.d.ts.map +1 -1
- package/dist/app/adapt-data-widget.js +1 -35
- package/dist/app/adapt-data-widget.js.map +1 -1
- package/dist/app/builder/BuilderBanners.d.ts +7 -2
- package/dist/app/builder/BuilderBanners.d.ts.map +1 -1
- package/dist/app/builder/BuilderBanners.js +8 -3
- package/dist/app/builder/BuilderBanners.js.map +1 -1
- package/dist/app/builder/CanvasRow.d.ts +4 -2
- package/dist/app/builder/CanvasRow.d.ts.map +1 -1
- package/dist/app/builder/CanvasRow.js +29 -17
- package/dist/app/builder/CanvasRow.js.map +1 -1
- package/dist/app/builder/CatalogueSheet.d.ts.map +1 -1
- package/dist/app/builder/CatalogueSheet.js +14 -6
- package/dist/app/builder/CatalogueSheet.js.map +1 -1
- package/dist/app/builder/CellPropsSheet.d.ts +7 -3
- package/dist/app/builder/CellPropsSheet.d.ts.map +1 -1
- package/dist/app/builder/CellPropsSheet.js +10 -3
- package/dist/app/builder/CellPropsSheet.js.map +1 -1
- package/dist/app/builder/DiscardDialog.d.ts +18 -0
- package/dist/app/builder/DiscardDialog.d.ts.map +1 -0
- package/dist/app/builder/DiscardDialog.js +18 -0
- package/dist/app/builder/DiscardDialog.js.map +1 -0
- package/dist/app/builder/EmptyHint.d.ts +4 -0
- package/dist/app/builder/EmptyHint.d.ts.map +1 -1
- package/dist/app/builder/EmptyHint.js +6 -1
- package/dist/app/builder/EmptyHint.js.map +1 -1
- package/dist/app/builder/LayoutSurface.d.ts +33 -9
- package/dist/app/builder/LayoutSurface.d.ts.map +1 -1
- package/dist/app/builder/LayoutSurface.js +74 -23
- package/dist/app/builder/LayoutSurface.js.map +1 -1
- package/dist/app/builder/PipelineStrip.d.ts +5 -2
- package/dist/app/builder/PipelineStrip.d.ts.map +1 -1
- package/dist/app/builder/PipelineStrip.js +33 -15
- package/dist/app/builder/PipelineStrip.js.map +1 -1
- package/dist/app/builder/SaveDialog.d.ts +9 -1
- package/dist/app/builder/SaveDialog.d.ts.map +1 -1
- package/dist/app/builder/SaveDialog.js +9 -3
- package/dist/app/builder/SaveDialog.js.map +1 -1
- package/dist/app/builder/Toolbar.d.ts +14 -4
- package/dist/app/builder/Toolbar.d.ts.map +1 -1
- package/dist/app/builder/Toolbar.js +24 -7
- package/dist/app/builder/Toolbar.js.map +1 -1
- package/dist/app/builder/Workspace.d.ts +23 -3
- package/dist/app/builder/Workspace.d.ts.map +1 -1
- package/dist/app/builder/Workspace.js +58 -8
- package/dist/app/builder/Workspace.js.map +1 -1
- package/dist/app/builder/builder-model.d.ts +146 -3
- package/dist/app/builder/builder-model.d.ts.map +1 -1
- package/dist/app/builder/builder-model.js +196 -5
- package/dist/app/builder/builder-model.js.map +1 -1
- package/dist/app/builder/labels.d.ts +13 -62
- package/dist/app/builder/labels.d.ts.map +1 -1
- package/dist/app/builder/labels.js +9 -58
- package/dist/app/builder/labels.js.map +1 -1
- package/dist/app/builder/reveal.d.ts +10 -0
- package/dist/app/builder/reveal.d.ts.map +1 -0
- package/dist/app/builder/reveal.js +10 -0
- package/dist/app/builder/reveal.js.map +1 -0
- package/dist/app/builder/status-chip.d.ts.map +1 -1
- package/dist/app/builder/status-chip.js +3 -2
- package/dist/app/builder/status-chip.js.map +1 -1
- package/dist/app/builder/use-builder-catalogue.d.ts +5 -1
- package/dist/app/builder/use-builder-catalogue.d.ts.map +1 -1
- package/dist/app/builder/use-builder-catalogue.js +50 -17
- package/dist/app/builder/use-builder-catalogue.js.map +1 -1
- package/dist/app/builder/use-builder-session.d.ts +30 -0
- package/dist/app/builder/use-builder-session.d.ts.map +1 -0
- package/dist/app/builder/use-builder-session.js +58 -0
- package/dist/app/builder/use-builder-session.js.map +1 -0
- package/dist/app/builder/use-display-resolver.d.ts +17 -0
- package/dist/app/builder/use-display-resolver.d.ts.map +1 -0
- package/dist/app/builder/use-display-resolver.js +16 -0
- package/dist/app/builder/use-display-resolver.js.map +1 -0
- package/dist/app/builder/use-save-dashboard.d.ts +3 -1
- package/dist/app/builder/use-save-dashboard.d.ts.map +1 -1
- package/dist/app/builder/use-save-dashboard.js +3 -1
- package/dist/app/builder/use-save-dashboard.js.map +1 -1
- package/dist/app/index.d.ts +8 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +8 -2
- package/dist/app/index.js.map +1 -1
- package/dist/app/layout-builder.d.ts +18 -25
- package/dist/app/layout-builder.d.ts.map +1 -1
- package/dist/app/layout-builder.js +84 -78
- package/dist/app/layout-builder.js.map +1 -1
- package/dist/app/mcp-app-view-chrome.d.ts +103 -20
- package/dist/app/mcp-app-view-chrome.d.ts.map +1 -1
- package/dist/app/mcp-app-view-chrome.js +125 -40
- package/dist/app/mcp-app-view-chrome.js.map +1 -1
- package/dist/app/mcp-app-view-states.d.ts +23 -0
- package/dist/app/mcp-app-view-states.d.ts.map +1 -0
- package/dist/app/mcp-app-view-states.js +55 -0
- package/dist/app/mcp-app-view-states.js.map +1 -0
- package/dist/app/mcp-app-view.d.ts +72 -5
- package/dist/app/mcp-app-view.d.ts.map +1 -1
- package/dist/app/mcp-app-view.js +241 -141
- package/dist/app/mcp-app-view.js.map +1 -1
- package/dist/app/mcp-toolkit-app.d.ts +8 -2
- package/dist/app/mcp-toolkit-app.d.ts.map +1 -1
- package/dist/app/mcp-toolkit-app.js +33 -4
- package/dist/app/mcp-toolkit-app.js.map +1 -1
- package/dist/app/mcp-use-host-bridge.d.ts +15 -6
- package/dist/app/mcp-use-host-bridge.d.ts.map +1 -1
- package/dist/app/mcp-use-host-bridge.js +51 -22
- package/dist/app/mcp-use-host-bridge.js.map +1 -1
- package/dist/app/model-context.d.ts +71 -0
- package/dist/app/model-context.d.ts.map +1 -0
- package/dist/app/model-context.js +101 -0
- package/dist/app/model-context.js.map +1 -0
- package/dist/app/use-build-mode-focus.d.ts +33 -0
- package/dist/app/use-build-mode-focus.d.ts.map +1 -0
- package/dist/app/use-build-mode-focus.js +59 -0
- package/dist/app/use-build-mode-focus.js.map +1 -0
- package/dist/app/use-view-actions.d.ts +31 -0
- package/dist/app/use-view-actions.d.ts.map +1 -0
- package/dist/app/use-view-actions.js +81 -0
- package/dist/app/use-view-actions.js.map +1 -0
- package/dist/app/use-view-lifecycle.d.ts +42 -0
- package/dist/app/use-view-lifecycle.d.ts.map +1 -0
- package/dist/app/use-view-lifecycle.js +81 -0
- package/dist/app/use-view-lifecycle.js.map +1 -0
- package/dist/app/view-lifecycle.d.ts +185 -0
- package/dist/app/view-lifecycle.d.ts.map +1 -0
- package/dist/app/view-lifecycle.js +207 -0
- package/dist/app/view-lifecycle.js.map +1 -0
- package/dist/app/widget-fixture.d.ts +10 -3
- package/dist/app/widget-fixture.d.ts.map +1 -1
- package/dist/app/widget-fixture.js +21 -8
- package/dist/app/widget-fixture.js.map +1 -1
- package/dist/app/widget-props-sheet.d.ts +6 -10
- package/dist/app/widget-props-sheet.d.ts.map +1 -1
- package/dist/app/widget-props-sheet.js +25 -20
- package/dist/app/widget-props-sheet.js.map +1 -1
- package/dist/app/widget-renderer.d.ts +41 -1
- package/dist/app/widget-renderer.d.ts.map +1 -1
- package/dist/app/widget-renderer.js +82 -31
- package/dist/app/widget-renderer.js.map +1 -1
- package/dist/components/DrillButton.d.ts +9 -6
- package/dist/components/DrillButton.d.ts.map +1 -1
- package/dist/components/DrillButton.js +9 -6
- package/dist/components/DrillButton.js.map +1 -1
- package/dist/components/EmptyState.d.ts +33 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/EmptyState.js +19 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/ErrorState.d.ts +53 -0
- package/dist/components/ErrorState.d.ts.map +1 -0
- package/dist/components/ErrorState.js +77 -0
- package/dist/components/ErrorState.js.map +1 -0
- package/dist/components/FilterBar.d.ts +16 -5
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +13 -5
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/GroupCard.d.ts.map +1 -1
- package/dist/components/GroupCard.js +2 -1
- package/dist/components/GroupCard.js.map +1 -1
- package/dist/components/KpiGrid.d.ts +70 -18
- package/dist/components/KpiGrid.d.ts.map +1 -1
- package/dist/components/KpiGrid.js +112 -23
- package/dist/components/KpiGrid.js.map +1 -1
- package/dist/components/ListFooter.d.ts +32 -4
- package/dist/components/ListFooter.d.ts.map +1 -1
- package/dist/components/ListFooter.js +35 -6
- package/dist/components/ListFooter.js.map +1 -1
- package/dist/components/PagedListFooter.d.ts +57 -0
- package/dist/components/PagedListFooter.d.ts.map +1 -0
- package/dist/components/PagedListFooter.js +27 -0
- package/dist/components/PagedListFooter.js.map +1 -0
- package/dist/components/Pills.d.ts +36 -12
- package/dist/components/Pills.d.ts.map +1 -1
- package/dist/components/Pills.js +29 -8
- package/dist/components/Pills.js.map +1 -1
- package/dist/components/SectionHeading.d.ts +3 -1
- package/dist/components/SectionHeading.d.ts.map +1 -1
- package/dist/components/SectionHeading.js +6 -2
- package/dist/components/SectionHeading.js.map +1 -1
- package/dist/components/Toast.d.ts +43 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +106 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/WidgetHeader.d.ts +34 -10
- package/dist/components/WidgetHeader.d.ts.map +1 -1
- package/dist/components/WidgetHeader.js +11 -6
- package/dist/components/WidgetHeader.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/tool-result-recovery-model.d.ts +155 -0
- package/dist/hooks/tool-result-recovery-model.d.ts.map +1 -0
- package/dist/hooks/tool-result-recovery-model.js +273 -0
- package/dist/hooks/tool-result-recovery-model.js.map +1 -0
- package/dist/hooks/use-tool-query.d.ts +56 -14
- package/dist/hooks/use-tool-query.d.ts.map +1 -1
- package/dist/hooks/use-tool-query.js +102 -25
- package/dist/hooks/use-tool-query.js.map +1 -1
- package/dist/hooks/use-tool-result-recovery.d.ts +61 -44
- package/dist/hooks/use-tool-result-recovery.d.ts.map +1 -1
- package/dist/hooks/use-tool-result-recovery.js +62 -110
- package/dist/hooks/use-tool-result-recovery.js.map +1 -1
- package/dist/hooks/use-view-data.d.ts +55 -7
- package/dist/hooks/use-view-data.d.ts.map +1 -1
- package/dist/hooks/use-view-data.js +81 -11
- package/dist/hooks/use-view-data.js.map +1 -1
- package/dist/hooks/use-view-tool-query.d.ts +12 -7
- package/dist/hooks/use-view-tool-query.d.ts.map +1 -1
- package/dist/hooks/use-view-tool-query.js +15 -14
- package/dist/hooks/use-view-tool-query.js.map +1 -1
- package/dist/index.d.ts +27 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/focus-return.d.ts +61 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/focus-return.js +46 -0
- package/dist/lib/focus-return.js.map +1 -0
- package/dist/lib/focus-ring.d.ts +18 -0
- package/dist/lib/focus-ring.d.ts.map +1 -0
- package/dist/lib/focus-ring.js +18 -0
- package/dist/lib/focus-ring.js.map +1 -0
- package/dist/lib/icon-stroke.d.ts +12 -0
- package/dist/lib/icon-stroke.d.ts.map +1 -0
- package/dist/lib/icon-stroke.js +12 -0
- package/dist/lib/icon-stroke.js.map +1 -0
- package/dist/lib/parse-tool-result.d.ts +23 -1
- package/dist/lib/parse-tool-result.d.ts.map +1 -1
- package/dist/lib/parse-tool-result.js +38 -2
- package/dist/lib/parse-tool-result.js.map +1 -1
- package/dist/lib/toast-model.d.ts +86 -0
- package/dist/lib/toast-model.d.ts.map +1 -0
- package/dist/lib/toast-model.js +102 -0
- package/dist/lib/toast-model.js.map +1 -0
- package/dist/lib/tone-utils.d.ts +95 -9
- package/dist/lib/tone-utils.d.ts.map +1 -1
- package/dist/lib/tone-utils.js +100 -9
- package/dist/lib/tone-utils.js.map +1 -1
- package/dist/lib/tool-query.d.ts +107 -0
- package/dist/lib/tool-query.d.ts.map +1 -0
- package/dist/lib/tool-query.js +182 -0
- package/dist/lib/tool-query.js.map +1 -0
- package/dist/lib/tool-result-observer.d.ts +108 -0
- package/dist/lib/tool-result-observer.d.ts.map +1 -0
- package/dist/lib/tool-result-observer.js +158 -0
- package/dist/lib/tool-result-observer.js.map +1 -0
- package/dist/lib/typography.d.ts +37 -0
- package/dist/lib/typography.d.ts.map +1 -0
- package/dist/lib/typography.js +41 -0
- package/dist/lib/typography.js.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +11 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/locale/index.d.ts +3 -1
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/locale/index.js +2 -1
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/locale-provider.d.ts +42 -1
- package/dist/locale/locale-provider.d.ts.map +1 -1
- package/dist/locale/locale-provider.js +44 -3
- package/dist/locale/locale-provider.js.map +1 -1
- package/dist/locale/message-types.d.ts +336 -0
- package/dist/locale/message-types.d.ts.map +1 -0
- package/dist/locale/message-types.js +7 -0
- package/dist/locale/message-types.js.map +1 -0
- package/dist/locale/messages-de.d.ts +9 -0
- package/dist/locale/messages-de.d.ts.map +1 -0
- package/dist/locale/messages-de.js +185 -0
- package/dist/locale/messages-de.js.map +1 -0
- package/dist/locale/messages-en.d.ts +8 -0
- package/dist/locale/messages-en.d.ts.map +1 -0
- package/dist/locale/messages-en.js +184 -0
- package/dist/locale/messages-en.js.map +1 -0
- package/dist/locale/toolkit-messages.d.ts +57 -0
- package/dist/locale/toolkit-messages.d.ts.map +1 -0
- package/dist/locale/toolkit-messages.js +103 -0
- package/dist/locale/toolkit-messages.js.map +1 -0
- package/dist/primitives/alert.d.ts +1 -1
- package/dist/primitives/alert.d.ts.map +1 -1
- package/dist/primitives/alert.js +6 -2
- package/dist/primitives/alert.js.map +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/badge.d.ts.map +1 -1
- package/dist/primitives/badge.js +19 -6
- package/dist/primitives/badge.js.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/button.js +12 -8
- package/dist/primitives/button.js.map +1 -1
- package/dist/primitives/card.js +4 -4
- package/dist/primitives/card.js.map +1 -1
- package/dist/primitives/dialog.d.ts +7 -3
- package/dist/primitives/dialog.d.ts.map +1 -1
- package/dist/primitives/dialog.js +22 -8
- package/dist/primitives/dialog.js.map +1 -1
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +4 -1
- package/dist/primitives/input.js.map +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/scroll-area.js.map +1 -1
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +6 -3
- package/dist/primitives/select.js.map +1 -1
- package/dist/primitives/sheet.d.ts +3 -1
- package/dist/primitives/sheet.d.ts.map +1 -1
- package/dist/primitives/sheet.js +17 -7
- package/dist/primitives/sheet.js.map +1 -1
- package/dist/primitives/skeleton.js +1 -1
- package/dist/primitives/skeleton.js.map +1 -1
- package/dist/primitives/switch.d.ts.map +1 -1
- package/dist/primitives/switch.js +2 -1
- package/dist/primitives/switch.js.map +1 -1
- package/dist/primitives/tabs.d.ts.map +1 -1
- package/dist/primitives/tabs.js +5 -3
- package/dist/primitives/tabs.js.map +1 -1
- package/dist/providers/query-provider.d.ts +32 -1
- package/dist/providers/query-provider.d.ts.map +1 -1
- package/dist/providers/query-provider.js +53 -4
- package/dist/providers/query-provider.js.map +1 -1
- package/dist/render-cases-primitives.js +1 -1
- package/dist/render-cases-primitives.js.map +1 -1
- package/dist/render-cases.d.ts.map +1 -1
- package/dist/render-cases.js +48 -6
- package/dist/render-cases.js.map +1 -1
- package/dist/render-effects.d.ts +42 -0
- package/dist/render-effects.d.ts.map +1 -0
- package/dist/render-effects.js +81 -0
- package/dist/render-effects.js.map +1 -0
- package/dist/render-scan.d.ts +25 -0
- package/dist/render-scan.d.ts.map +1 -0
- package/dist/render-scan.js +66 -0
- package/dist/render-scan.js.map +1 -0
- package/dist/theme/cd-tokens.d.ts +66 -0
- package/dist/theme/cd-tokens.d.ts.map +1 -0
- package/dist/theme/cd-tokens.js +64 -0
- package/dist/theme/cd-tokens.js.map +1 -0
- package/dist/theme/create-theme.d.ts +214 -39
- package/dist/theme/create-theme.d.ts.map +1 -1
- package/dist/theme/create-theme.js +204 -13
- package/dist/theme/create-theme.js.map +1 -1
- package/dist/theme/fonts.d.ts +38 -0
- package/dist/theme/fonts.d.ts.map +1 -0
- package/dist/theme/fonts.js +56 -0
- package/dist/theme/fonts.js.map +1 -0
- package/dist/theme/host-fonts.d.ts +39 -0
- package/dist/theme/host-fonts.d.ts.map +1 -0
- package/dist/theme/host-fonts.js +44 -0
- package/dist/theme/host-fonts.js.map +1 -0
- package/dist/theme/index.d.ts +8 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +5 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/portal-container.d.ts +16 -0
- package/dist/theme/portal-container.d.ts.map +1 -0
- package/dist/theme/portal-container.js +19 -0
- package/dist/theme/portal-container.js.map +1 -0
- package/dist/theme/presets.d.ts +24 -9
- package/dist/theme/presets.d.ts.map +1 -1
- package/dist/theme/presets.js +44 -11
- package/dist/theme/presets.js.map +1 -1
- package/dist/theme/theme-provider.d.ts +27 -9
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +42 -20
- package/dist/theme/theme-provider.js.map +1 -1
- package/package.json +11 -5
- package/src/app/adapt-data-widget.tsx +2 -42
- package/src/app/builder/BuilderBanners.tsx +26 -13
- package/src/app/builder/CanvasRow.tsx +79 -32
- package/src/app/builder/CatalogueSheet.tsx +58 -35
- package/src/app/builder/CellPropsSheet.tsx +17 -2
- package/src/app/builder/DiscardDialog.tsx +59 -0
- package/src/app/builder/EmptyHint.tsx +16 -11
- package/src/app/builder/LayoutSurface.tsx +207 -67
- package/src/app/builder/PipelineStrip.tsx +265 -156
- package/src/app/builder/SaveDialog.tsx +25 -14
- package/src/app/builder/Toolbar.tsx +154 -57
- package/src/app/builder/Workspace.tsx +226 -56
- package/src/app/builder/builder-feedback.test.tsx +75 -0
- package/src/app/builder/builder-model.test.ts +5 -0
- package/src/app/builder/builder-model.ts +346 -6
- package/src/app/builder/builder-model.ux.test.ts +456 -0
- package/src/app/builder/builder-ux.test.tsx +844 -0
- package/src/app/builder/labels.ts +15 -121
- package/src/app/builder/reveal.ts +10 -0
- package/src/app/builder/status-chip.tsx +8 -4
- package/src/app/builder/use-builder-catalogue.ts +62 -19
- package/src/app/builder/use-builder-session.ts +68 -0
- package/src/app/builder/use-display-resolver.ts +24 -0
- package/src/app/builder/use-save-dashboard.ts +5 -0
- package/src/app/index.ts +20 -3
- package/src/app/layout-builder.tsx +193 -186
- package/src/app/mcp-app-view-chrome.test.tsx +487 -14
- package/src/app/mcp-app-view-chrome.tsx +328 -100
- package/src/app/mcp-app-view-states.tsx +140 -0
- package/src/app/mcp-app-view.effects.test.tsx +292 -0
- package/src/app/mcp-app-view.test.tsx +478 -0
- package/src/app/mcp-app-view.tsx +447 -190
- package/src/app/mcp-toolkit-app.test.tsx +40 -0
- package/src/app/mcp-toolkit-app.tsx +39 -8
- package/src/app/mcp-use-host-bridge.test.tsx +180 -0
- package/src/app/mcp-use-host-bridge.tsx +67 -24
- package/src/app/model-context.test.tsx +116 -0
- package/src/app/model-context.tsx +125 -0
- package/src/app/use-build-mode-focus.ts +62 -0
- package/src/app/use-view-actions.ts +89 -0
- package/src/app/use-view-lifecycle.ts +122 -0
- package/src/app/view-lifecycle.test.ts +443 -0
- package/src/app/view-lifecycle.ts +334 -0
- package/src/app/widget-fixture.effects.test.tsx +51 -0
- package/src/app/widget-fixture.render.test.tsx +81 -0
- package/src/app/widget-fixture.tsx +34 -11
- package/src/app/widget-props-sheet.tsx +67 -39
- package/src/app/widget-renderer.render.test.tsx +131 -0
- package/src/app/widget-renderer.tsx +136 -38
- package/src/components/DrillButton.tsx +24 -10
- package/src/components/EmptyState.tsx +83 -0
- package/src/components/ErrorState.tsx +204 -0
- package/src/components/FilterBar.test.tsx +82 -0
- package/src/components/FilterBar.tsx +56 -27
- package/src/components/GroupCard.tsx +3 -2
- package/src/components/KpiGrid.test.tsx +279 -0
- package/src/components/KpiGrid.tsx +329 -91
- package/src/components/ListFooter.test.tsx +116 -0
- package/src/components/ListFooter.tsx +110 -12
- package/src/components/PagedListFooter.test.tsx +140 -0
- package/src/components/PagedListFooter.tsx +107 -0
- package/src/components/Pills.test.tsx +77 -0
- package/src/components/Pills.tsx +78 -16
- package/src/components/SectionHeading.tsx +9 -3
- package/src/components/Toast.tsx +206 -0
- package/src/components/WidgetHeader.test.tsx +78 -0
- package/src/components/WidgetHeader.tsx +63 -16
- package/src/components/feedback-states.test.tsx +314 -0
- package/src/components/tone-figures.test.tsx +58 -0
- package/src/fonts.css +19 -0
- package/src/globals.css +9 -165
- package/src/hooks/index.ts +6 -3
- package/src/hooks/tool-result-recovery-model.test.ts +744 -0
- package/src/hooks/tool-result-recovery-model.ts +418 -0
- package/src/hooks/use-tool-query.effects.test.tsx +205 -0
- package/src/hooks/use-tool-query.ts +156 -33
- package/src/hooks/use-tool-result-recovery.effects.test.tsx +141 -0
- package/src/hooks/use-tool-result-recovery.test.ts +28 -5
- package/src/hooks/use-tool-result-recovery.ts +101 -131
- package/src/hooks/use-view-data.test.tsx +169 -0
- package/src/hooks/use-view-data.ts +131 -10
- package/src/hooks/use-view-tool-query.ts +25 -19
- package/src/i18n-coverage.test.tsx +425 -0
- package/src/index.ts +102 -13
- package/src/lib/focus-return.test.ts +288 -0
- package/src/lib/focus-return.ts +96 -0
- package/src/lib/focus-ring.ts +20 -0
- package/src/lib/icon-stroke.test.ts +59 -0
- package/src/lib/icon-stroke.ts +13 -0
- package/src/lib/parse-tool-result.test.ts +46 -1
- package/src/lib/parse-tool-result.ts +40 -2
- package/src/lib/toast-model.test.ts +233 -0
- package/src/lib/toast-model.ts +165 -0
- package/src/lib/tone-utils.test.ts +125 -16
- package/src/lib/tone-utils.ts +144 -15
- package/src/lib/tool-query.test.ts +569 -0
- package/src/lib/tool-query.ts +253 -0
- package/src/lib/tool-result-observer.test.ts +296 -0
- package/src/lib/tool-result-observer.ts +211 -0
- package/src/lib/typography.test.ts +45 -0
- package/src/lib/typography.ts +47 -0
- package/src/lib/utils.ts +12 -1
- package/src/locale/index.ts +14 -1
- package/src/locale/locale-provider.test.tsx +87 -0
- package/src/locale/locale-provider.tsx +90 -3
- package/src/locale/message-types.ts +337 -0
- package/src/locale/messages-de.ts +198 -0
- package/src/locale/messages-en.ts +196 -0
- package/src/locale/toolkit-messages.test.ts +349 -0
- package/src/locale/toolkit-messages.ts +143 -0
- package/src/no-hardcoded-copy.test.ts +432 -0
- package/src/primitives/alert.tsx +7 -2
- package/src/primitives/badge.tsx +19 -7
- package/src/primitives/button.tsx +13 -8
- package/src/primitives/card.tsx +4 -4
- package/src/primitives/dialog.tsx +42 -8
- package/src/primitives/input.tsx +5 -3
- package/src/primitives/scroll-area.tsx +1 -1
- package/src/primitives/select.tsx +7 -4
- package/src/primitives/sheet.tsx +33 -6
- package/src/primitives/skeleton.tsx +1 -1
- package/src/primitives/switch.tsx +4 -2
- package/src/primitives/tabs.tsx +9 -6
- package/src/providers/query-provider.test.tsx +154 -0
- package/src/providers/query-provider.tsx +66 -5
- package/src/render-cases-primitives.tsx +1 -1
- package/src/render-cases.tsx +82 -6
- package/src/render-effects.tsx +96 -0
- package/src/render-scan.ts +75 -0
- package/src/theme/cd-tokens.generated.css +48 -0
- package/src/theme/cd-tokens.test.ts +109 -0
- package/src/theme/cd-tokens.ts +67 -0
- package/src/theme/create-theme.test.ts +253 -5
- package/src/theme/create-theme.ts +341 -41
- package/src/theme/fonts.test.ts +85 -0
- package/src/theme/fonts.ts +72 -0
- package/src/theme/host-fonts.test.ts +135 -0
- package/src/theme/host-fonts.ts +52 -0
- package/src/theme/index.ts +15 -1
- package/src/theme/portal-container.ts +20 -0
- package/src/theme/presets.ts +44 -11
- package/src/theme/theme-css.test.ts +619 -0
- package/src/theme/theme-provider.test.tsx +82 -0
- package/src/theme/theme-provider.tsx +60 -24
- package/src/theme.css +344 -0
- package/ui-catalog.json +783 -49
package/dist/app/mcp-app-view.js
CHANGED
|
@@ -1,159 +1,259 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
|
+
import { LucideProvider } from "lucide-react";
|
|
4
|
+
import { ToolCancelledError, useHostContext, useToolContext } from "mcp-use/react";
|
|
5
|
+
import { ToastProvider } from "../components/Toast.js";
|
|
6
|
+
import { ToolkitLocaleFallback, useToolkitLocale, useToolkitMessages, } from "../locale/locale-provider.js";
|
|
7
|
+
import { formatClockTime, resolveFormatLocale } from "../locale/toolkit-messages.js";
|
|
8
|
+
import { AppQueryProvider, useAppQueryClient } from "../providers/query-provider.js";
|
|
9
|
+
import { resolveToolSafety } from "../hooks/tool-result-recovery-model.js";
|
|
10
|
+
import { DEFAULT_ASSUME_STRIPPED_AFTER_MS, resolveRecoveryToolName, useToolResultRecovery, } from "../hooks/use-tool-result-recovery.js";
|
|
11
|
+
import { ICON_STROKE } from "../lib/icon-stroke.js";
|
|
7
12
|
import { useHostBridge } from "./host-bridge.js";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
import { useViewResultSink } from "./mcp-use-host-bridge.js";
|
|
14
|
+
import { HostModelContext } from "./model-context.js";
|
|
15
|
+
import { applyBuilderCommit, isCompleteViewData, StepErrors, ViewBody, ViewToolbar, } from "./mcp-app-view-chrome.js";
|
|
16
|
+
import { ViewPlaceholder } from "./mcp-app-view-states.js";
|
|
17
|
+
import { useBuildModeFocus } from "./use-build-mode-focus.js";
|
|
18
|
+
import { useFullscreenToggle, useViewRefresh } from "./use-view-actions.js";
|
|
19
|
+
import { useRetryFocus, useViewLifecycle } from "./use-view-lifecycle.js";
|
|
20
|
+
import { DEFAULT_SLOW_HINT_MS, describeViewForModel, reloadedAtOf, } from "./view-lifecycle.js";
|
|
21
|
+
/**
|
|
22
|
+
* The toolkit's MCP App view: lifecycle placeholder (waiting / error /
|
|
23
|
+
* cancelled), toolbar, failed-steps alert and the rendered layout (or the
|
|
24
|
+
* builder). Mounts a `ToastProvider` and binds the toolkit's own strings to
|
|
25
|
+
* the host's locale unless a `LocaleProvider` sets one, so the chrome follows
|
|
26
|
+
* the host language; `useLocale()` in consumer widgets is unaffected. Lucide
|
|
27
|
+
* icons draw at the CI stroke (2.5) throughout, the toast stack included.
|
|
28
|
+
* The widgets' data hooks fetch through an enclosing `AppQueryProvider`'s
|
|
29
|
+
* client, else the toolkit's shared `queryClient`.
|
|
30
|
+
*/
|
|
31
|
+
export function McpAppView(props) {
|
|
32
|
+
const { locale } = useHostContext();
|
|
33
|
+
return (_jsx(ToolkitLocaleFallback, { locale: locale, children: _jsx(LucideProvider, { strokeWidth: ICON_STROKE, children: _jsx(ToastProvider, { children: _jsx(McpAppViewShell, { ...props }) }) }) }));
|
|
34
|
+
}
|
|
35
|
+
const NO_VIEW = { data: null, source: null, reloadedAt: null };
|
|
36
|
+
/**
|
|
37
|
+
* Host-delivered payload → the shown view, recovered payloads included, each
|
|
38
|
+
* tagged with its source. Render-phase setState (not an effect) so the React
|
|
39
|
+
* Compiler doesn't flag a cascading render.
|
|
40
|
+
*/
|
|
41
|
+
function useHostViewData(initialViewData, isPending, recovered, recoveredAt) {
|
|
42
|
+
const [view, setView] = useState(NO_VIEW);
|
|
38
43
|
// `prev` MUST start as `null`, not `initialViewData`: hosts that expose the
|
|
39
44
|
// complete tool output before the app's first render (e.g. window.openai
|
|
40
45
|
// globals injected ahead of script execution) would otherwise never trip the
|
|
41
|
-
// identity check —
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
// identity check — the sync never runs and the app idles on the skeleton.
|
|
47
|
+
// The completeness guard stays: widgetProps may briefly drop
|
|
48
|
+
// `context`/`layout` when displayMode toggles.
|
|
49
|
+
const [prevInitial, setPrevInitial] = useState(null);
|
|
50
|
+
if (initialViewData !== prevInitial) {
|
|
51
|
+
setPrevInitial(initialViewData);
|
|
46
52
|
if (!isPending && isCompleteViewData(initialViewData)) {
|
|
47
|
-
|
|
53
|
+
setView({ data: initialViewData, source: "host", reloadedAt: null });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const [prevRecovered, setPrevRecovered] = useState(null);
|
|
57
|
+
if (recovered !== prevRecovered) {
|
|
58
|
+
setPrevRecovered(recovered);
|
|
59
|
+
// The host-delivered payload always wins; a recovery fills the gap, and a
|
|
60
|
+
// recovery for newer arguments replaces an older recovered payload (N21).
|
|
61
|
+
if (recovered) {
|
|
62
|
+
setView((prev) => prev.data === null || prev.source === "recovered"
|
|
63
|
+
? { data: recovered, source: "recovered", reloadedAt: recoveredAt }
|
|
64
|
+
: prev);
|
|
48
65
|
}
|
|
49
66
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
return [view, setView];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Hands the payload the view shows (the host's, its own recovery's, the
|
|
71
|
+
* user's retry or refresh) to the host bridge, so `HostBridge.getWidgetData()`
|
|
72
|
+
* returns what the view shows (toolkit#176 K15), also after a latch the view
|
|
73
|
+
* could not render.
|
|
74
|
+
*/
|
|
75
|
+
function useReportShownPayload(view) {
|
|
76
|
+
const report = useViewResultSink();
|
|
77
|
+
const payload = view.data;
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (payload)
|
|
80
|
+
report?.(payload);
|
|
81
|
+
}, [payload, report]);
|
|
82
|
+
}
|
|
83
|
+
/** The rendering call as mcp-use 2.x latches it, plus the tool the host names. */
|
|
84
|
+
function useRenderCall() {
|
|
85
|
+
const tool = useToolContext();
|
|
86
|
+
const { hostContext } = useHostContext();
|
|
87
|
+
// Since mcp-use 2.7.1 a host cancellation latches as `status: "error"`.
|
|
88
|
+
const isCancelled = tool.status === "error" && tool.error instanceof ToolCancelledError;
|
|
89
|
+
const isCallError = tool.status === "error" && !isCancelled;
|
|
90
|
+
return {
|
|
91
|
+
tool,
|
|
92
|
+
hostContext,
|
|
93
|
+
isPending: tool.status === "pending",
|
|
94
|
+
isCancelled,
|
|
95
|
+
isCallError,
|
|
96
|
+
callError: isCallError ? tool.error : undefined,
|
|
97
|
+
initialViewData: tool.status === "ready" ? tool.toolOutput : undefined,
|
|
98
|
+
toolName: resolveRecoveryToolName(hostContext),
|
|
99
|
+
/** The host reports the tool as writing: the view never offers to re-run it after a block. */
|
|
100
|
+
toolWrites: resolveToolSafety(hostContext) === "writes",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The payload the view shows: the host's, else the stripped-result recovery's.
|
|
105
|
+
* Hosts that strip `structuredContent` (claude.ai) never latch a result under
|
|
106
|
+
* mcp-use 2.x; the recovery re-executes the call once when the stripped
|
|
107
|
+
* result arrives. It never fires on a cancelled or failed call, nor while a
|
|
108
|
+
* slow tool is still running (#176): those render their state.
|
|
109
|
+
*/
|
|
110
|
+
function useShownView(call, callTool, policy = "auto", graceMs = DEFAULT_ASSUME_STRIPPED_AFTER_MS) {
|
|
58
111
|
const recovery = useToolResultRecovery({
|
|
59
|
-
resultReady: !isPending,
|
|
60
|
-
cancelled: isCancelled,
|
|
61
|
-
|
|
112
|
+
resultReady: !call.isPending,
|
|
113
|
+
cancelled: call.isCancelled,
|
|
114
|
+
errored: call.isCallError,
|
|
115
|
+
props: call.initialViewData,
|
|
62
116
|
isValid: isCompleteViewData,
|
|
63
|
-
toolInput,
|
|
64
|
-
hostContext,
|
|
117
|
+
toolInput: call.tool.toolInput,
|
|
118
|
+
hostContext: call.hostContext,
|
|
65
119
|
callTool,
|
|
120
|
+
policy,
|
|
121
|
+
assumeStrippedAfterMs: graceMs,
|
|
66
122
|
});
|
|
67
|
-
const [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
//
|
|
123
|
+
const [view, setView] = useHostViewData(call.initialViewData, call.isPending, recovery.data, recovery.recoveredAt);
|
|
124
|
+
useReportShownPayload(view);
|
|
125
|
+
// A re-run's figures can differ from the answer in the chat (N23): stamp
|
|
126
|
+
// it, unless the original call failed and the chat never had figures.
|
|
127
|
+
const callFailed = call.isCallError || call.isCancelled;
|
|
128
|
+
const showRetried = useCallback((data) => setView({ data, source: "retry", reloadedAt: reloadedAtOf("retry", Date.now(), callFailed) }), [setView, callFailed]);
|
|
129
|
+
const showRefreshed = useCallback((data) => setView({
|
|
130
|
+
data,
|
|
131
|
+
source: "refresh",
|
|
132
|
+
reloadedAt: reloadedAtOf("refresh", Date.now(), callFailed),
|
|
133
|
+
}), [setView, callFailed]);
|
|
134
|
+
return {
|
|
135
|
+
view,
|
|
136
|
+
setView,
|
|
137
|
+
showRetried,
|
|
138
|
+
showRefreshed,
|
|
139
|
+
// Without a named tool nothing can re-run it: a plain failure. A policy
|
|
140
|
+
// block is its own state: the tool ran, and the view must not repeat it.
|
|
141
|
+
recoveryFailed: recovery.failed || recovery.blocked === "no-tool",
|
|
142
|
+
recoveryBlocked: recovery.blocked === "policy",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The view's own line of model context (toolkit#176 K20, N23): an error the
|
|
147
|
+
* user sees instead of the view, failed data steps, or data the view
|
|
148
|
+
* re-loaded itself (a recovery, a retry, a refresh). Renders nothing while
|
|
149
|
+
* there is nothing to report.
|
|
150
|
+
*/
|
|
151
|
+
function ViewModelContext({ lifecycle, toolName, view, }) {
|
|
152
|
+
const content = describeViewForModel({
|
|
153
|
+
lifecycle,
|
|
154
|
+
toolName,
|
|
155
|
+
stepErrors: view.data?.context.errors,
|
|
156
|
+
stepsRetryable: Boolean(view.data?._refreshParams),
|
|
157
|
+
reloadedAt: view.reloadedAt,
|
|
158
|
+
reloadedBy: reloadedByOf(view.source),
|
|
159
|
+
});
|
|
160
|
+
return content ? _jsx(HostModelContext, { content: content }) : null;
|
|
161
|
+
}
|
|
162
|
+
function McpAppViewShell({ widgets, refreshToolName = "refresh-view", builderEnabled, labels, builderLabels, titleMode = "show", titleLevel = 2, renderTitle, slowHintAfterMs = DEFAULT_SLOW_HINT_MS, describeError, describeStep, recoverStrippedResult, strippedResultGraceMs, toolNameInQueryKey, }) {
|
|
163
|
+
const messages = useToolkitMessages();
|
|
164
|
+
const L = useMemo(() => ({ ...messages.view, ...labels }), [messages.view, labels]);
|
|
165
|
+
// The mcp-use 2.x view channels (all need the `bootstrapView` mount
|
|
166
|
+
// `mountMcpToolkitApp` provides); tools go through the HostBridge.
|
|
167
|
+
const call = useRenderCall();
|
|
168
|
+
const { safeArea, locale, timeZone } = useHostContext();
|
|
169
|
+
// A time in the language of the sentence around it, in the host's zone.
|
|
170
|
+
const formatLocale = resolveFormatLocale(useToolkitLocale(), locale);
|
|
171
|
+
// The client the view's widgets fetch through (an enclosing
|
|
172
|
+
// AppQueryProvider's, else the shared one): a refresh invalidates it.
|
|
173
|
+
const viewClient = useAppQueryClient();
|
|
174
|
+
const bridge = useHostBridge();
|
|
175
|
+
const callTool = useCallback((name, args) => bridge.callTool(name, args), [bridge]);
|
|
176
|
+
// The widget-facing shape (`args: object`, so generated input interfaces
|
|
177
|
+
// without an index signature pass straight through).
|
|
178
|
+
const callToolFn = useCallback((name, args) => bridge.callTool(name, args), [bridge]);
|
|
179
|
+
const shown = useShownView(call, callTool, recoverStrippedResult, strippedResultGraceMs);
|
|
180
|
+
const { view, setView } = shown;
|
|
181
|
+
const viewData = view.data;
|
|
182
|
+
const { lifecycle, retry: retryCall } = useViewLifecycle({
|
|
183
|
+
hasViewData: viewData !== null,
|
|
184
|
+
callStatus: call.tool.status,
|
|
185
|
+
cancelled: call.isCancelled,
|
|
186
|
+
callError: call.callError,
|
|
187
|
+
recoveryFailed: shown.recoveryFailed,
|
|
188
|
+
recoveryBlocked: shown.recoveryBlocked,
|
|
189
|
+
toolWrites: call.toolWrites,
|
|
190
|
+
toolName: call.toolName,
|
|
191
|
+
toolInput: call.tool.toolInput,
|
|
192
|
+
callTool,
|
|
193
|
+
isValid: isCompleteViewData,
|
|
194
|
+
onResult: shown.showRetried,
|
|
195
|
+
slowHintAfterMs,
|
|
196
|
+
});
|
|
197
|
+
const { frameRef, retry } = useRetryFocus(lifecycle.phase, retryCall);
|
|
198
|
+
const { isRefreshing, refreshView } = useViewRefresh({
|
|
199
|
+
viewData,
|
|
200
|
+
setViewData: shown.showRefreshed,
|
|
201
|
+
callTool,
|
|
202
|
+
refreshToolName,
|
|
203
|
+
labels: L,
|
|
204
|
+
client: viewClient,
|
|
205
|
+
});
|
|
206
|
+
const fullscreen = useFullscreenToggle(L);
|
|
207
|
+
// In-iframe build mode is purely a UI state — the LLM never sees the catalogue.
|
|
208
|
+
const [buildMode, setBuildMode] = useState(false);
|
|
209
|
+
useBuildModeFocus(buildMode, frameRef);
|
|
114
210
|
const exitBuildMode = useCallback((commit) => {
|
|
115
|
-
if (commit)
|
|
116
|
-
|
|
117
|
-
? {
|
|
118
|
-
...prev,
|
|
119
|
-
layout: commit.layout,
|
|
120
|
-
title: commit.title ?? prev.title,
|
|
121
|
-
context: commit.context ?? prev.context,
|
|
122
|
-
_refreshParams: {
|
|
123
|
-
keys: commit.keys,
|
|
124
|
-
steps: commit.steps,
|
|
125
|
-
layout: commit.layout,
|
|
126
|
-
title: commit.title ?? prev.title,
|
|
127
|
-
},
|
|
128
|
-
}
|
|
129
|
-
: prev);
|
|
130
|
-
}
|
|
211
|
+
if (commit)
|
|
212
|
+
setView((prev) => withBuilderCommit(prev, commit));
|
|
131
213
|
setBuildMode(false);
|
|
132
|
-
}, []);
|
|
133
|
-
|
|
134
|
-
// `
|
|
135
|
-
// viewData still has to replace
|
|
214
|
+
}, [setView]);
|
|
215
|
+
const viewContext = (_jsx(ViewModelContext, { lifecycle: lifecycle, toolName: call.toolName, view: view }));
|
|
216
|
+
// `isPending` must not gate the render: on stripping hosts the latch stays
|
|
217
|
+
// "pending" forever, and recovered viewData still has to replace it. The
|
|
218
|
+
// frame is the stable focus target of a retry (`useRetryFocus`).
|
|
136
219
|
if (!viewData) {
|
|
137
|
-
return _jsx(ViewPlaceholder, {
|
|
220
|
+
return (_jsxs("div", { ref: frameRef, tabIndex: -1, "data-slot": "mcp-app-view", className: "outline-hidden", children: [viewContext, _jsx(ViewPlaceholder, { lifecycle: lifecycle, labels: L, onRetry: retry, describeError: describeError })] }));
|
|
138
221
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
222
|
+
return (_jsxs("div", { ref: frameRef, tabIndex: -1, "data-slot": "mcp-app-view", className: "outline-hidden", children: [viewContext, _jsxs("main", { style: {
|
|
223
|
+
// Fullscreen: the view owns the viewport and scrolls itself. Inline:
|
|
224
|
+
// the host sizes us from our intrinsic height (bootstrapView's
|
|
225
|
+
// auto-resize), so no overflow clipping there.
|
|
226
|
+
...(fullscreen.isFullscreen ? { minHeight: "100vh", overflowY: "auto" } : null),
|
|
227
|
+
paddingTop: safeArea.top,
|
|
228
|
+
paddingRight: safeArea.right,
|
|
229
|
+
paddingBottom: safeArea.bottom,
|
|
230
|
+
paddingLeft: safeArea.left,
|
|
231
|
+
}, children: [_jsx(ViewToolbar, { hidden: buildMode, viewData: viewData, builderAvailable: builderEnabled ?? viewData.builderAvailable ?? false, isFullscreen: fullscreen.isFullscreen, canFullscreen: fullscreen.canFullscreen, isRefreshing: isRefreshing, labels: L, titleMode: titleMode, titleLevel: titleLevel, renderTitle: renderTitle, onRefresh: refreshView, onEnterBuildMode: () => setBuildMode(true), onToggleFullscreen: fullscreen.toggle, dataAsOf: formatDataAsOf(view.reloadedAt, formatLocale, timeZone) }), _jsx(StepErrors, { hidden: buildMode, errors: viewData.context.errors, steps: viewData._refreshParams?.steps, labels: L, describeStep: describeStep, onRetry: viewData._refreshParams ? () => void refreshView() : undefined }), _jsx(AppQueryProvider, { callTool: callToolFn, client: viewClient, toolNameInQueryKey: toolNameInQueryKey, children: _jsx(ViewBody, { buildMode: buildMode, viewData: viewData, widgets: widgets, callTool: callToolFn, builderLabels: builderLabels, onExit: exitBuildMode }) })] })] }));
|
|
232
|
+
}
|
|
233
|
+
/** How the model line names the view's own re-load of the shown payload. */
|
|
234
|
+
function reloadedByOf(source) {
|
|
235
|
+
if (source === "refresh" || source === "builder")
|
|
236
|
+
return source;
|
|
237
|
+
return "recovery";
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The shown view with a builder commit applied (nothing to apply without
|
|
241
|
+
* data). A commit that carries the builder's live context shows figures the
|
|
242
|
+
* builder loaded itself (its catalogue call ran the steps again), so it is
|
|
243
|
+
* stamped like a refresh: the toolbar says when, and the model learns that
|
|
244
|
+
* they can differ from the result the chat answered from. A commit without a
|
|
245
|
+
* context keeps the shown figures, and with them their source and stamp.
|
|
246
|
+
*/
|
|
247
|
+
function withBuilderCommit(view, commit) {
|
|
248
|
+
if (!view.data)
|
|
249
|
+
return view;
|
|
250
|
+
const data = applyBuilderCommit(view.data, commit);
|
|
251
|
+
if (!commit.context)
|
|
252
|
+
return { ...view, data };
|
|
253
|
+
return { data, source: "builder", reloadedAt: reloadedAtOf("builder", Date.now(), false) };
|
|
254
|
+
}
|
|
255
|
+
/** The toolbar's "as of" time of a re-loaded payload, `undefined` for any other. */
|
|
256
|
+
function formatDataAsOf(reloadedAt, locale, timeZone) {
|
|
257
|
+
return reloadedAt === null ? undefined : formatClockTime(reloadedAt, locale, timeZone);
|
|
158
258
|
}
|
|
159
259
|
//# sourceMappingURL=mcp-app-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-app-view.js","sourceRoot":"","sources":["../../src/app/mcp-app-view.tsx"],"names":[],"mappings":";AAAA,OAA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O,MAAM,CAAA;IAC/D,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,IAAe,EAAE,MAAqB;IAC/D,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAC3B,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAA;IAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,EAAE,CAAA;AAC5F,CAAC;AAED,oFAAoF;AACpF,SAAS,cAAc,CACrB,UAAyB,EACzB,MAAc,EACd,QAA4B;IAE5B,OAAO,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AACxF,CAAC"}
|
|
@@ -2,7 +2,8 @@ import { type McpAppViewProps } from "./mcp-app-view.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Consumer-facing root for a toolkit-rendered MCP App. Composes the mcp-use
|
|
4
4
|
* 2.x view plumbing around `McpAppView`: `ThemeProvider` applies the host's
|
|
5
|
-
* theme/style variables to the document
|
|
5
|
+
* theme/style variables to the document (with the host's font kept behind
|
|
6
|
+
* Geist, see `adoptHostFontVariables`), and `McpUseHostBridgeProvider`
|
|
6
7
|
* installs the `HostBridge` (and view-scope flag) every toolkit widget below
|
|
7
8
|
* resolves through `useHostBridge()`.
|
|
8
9
|
*
|
|
@@ -18,7 +19,12 @@ export declare function McpToolkitApp(props: McpAppViewProps): import("react").J
|
|
|
18
19
|
*
|
|
19
20
|
* `bootstrapView` owns the mount: it connects the ext-apps postMessage bridge
|
|
20
21
|
* to the host, installs an error boundary, and auto-reports size changes
|
|
21
|
-
* (replacing 1.x's `createRoot` + `McpUseProvider` pair).
|
|
22
|
+
* (replacing 1.x's `createRoot` + `McpUseProvider` pair). The tool-result
|
|
23
|
+
* observer goes in first, so it sees the whole host lifecycle from the
|
|
24
|
+
* handshake on: the view then tells a stripped result from a slow tool and
|
|
25
|
+
* never re-runs a call the host is still answering (toolkit#176). A custom
|
|
26
|
+
* shell under its own `bootstrapView` calls `installToolResultObserver()`
|
|
27
|
+
* before it for the same effect.
|
|
22
28
|
*
|
|
23
29
|
* ```tsx
|
|
24
30
|
* // main.tsx of the widget bundle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-toolkit-app.d.ts","sourceRoot":"","sources":["../../src/app/mcp-toolkit-app.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-toolkit-app.d.ts","sourceRoot":"","sources":["../../src/app/mcp-toolkit-app.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAsBpE;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,+BAUnD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAG/D"}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
3
|
+
import { ThemeProvider, bootstrapView, useHostContext } from "mcp-use/react";
|
|
4
|
+
import { installToolResultObserver } from "../lib/tool-result-observer.js";
|
|
5
|
+
import { adoptHostFontVariables } from "../theme/host-fonts.js";
|
|
3
6
|
import { McpAppView } from "./mcp-app-view.js";
|
|
4
7
|
import { McpUseHostBridgeProvider } from "./mcp-use-host-bridge.js";
|
|
8
|
+
/**
|
|
9
|
+
* Keeps Geist first when the host sends its font. mcp-use's `ThemeProvider`
|
|
10
|
+
* writes the host's SEP-1865 style variables inline on `<html>`, including
|
|
11
|
+
* `--font-sans`/`--font-mono`, which share their names with the toolkit's font
|
|
12
|
+
* roles and would replace the Geist-first stacks whole. This component sits
|
|
13
|
+
* ABOVE that provider on purpose: a parent's layout effect runs after its
|
|
14
|
+
* children's, so the host variables are already applied when it moves the
|
|
15
|
+
* font pair into the fallback slot (`adoptHostFontVariables`). Both effects
|
|
16
|
+
* key on the same host-context snapshot, so they run in the same commit.
|
|
17
|
+
*/
|
|
18
|
+
function HostFontRoles({ children }) {
|
|
19
|
+
const { hostContext } = useHostContext();
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
if (typeof document === "undefined")
|
|
22
|
+
return;
|
|
23
|
+
adoptHostFontVariables(document.documentElement.style, hostContext?.styles?.variables);
|
|
24
|
+
}, [hostContext]);
|
|
25
|
+
return children;
|
|
26
|
+
}
|
|
5
27
|
/**
|
|
6
28
|
* Consumer-facing root for a toolkit-rendered MCP App. Composes the mcp-use
|
|
7
29
|
* 2.x view plumbing around `McpAppView`: `ThemeProvider` applies the host's
|
|
8
|
-
* theme/style variables to the document
|
|
30
|
+
* theme/style variables to the document (with the host's font kept behind
|
|
31
|
+
* Geist, see `adoptHostFontVariables`), and `McpUseHostBridgeProvider`
|
|
9
32
|
* installs the `HostBridge` (and view-scope flag) every toolkit widget below
|
|
10
33
|
* resolves through `useHostBridge()`.
|
|
11
34
|
*
|
|
@@ -15,7 +38,7 @@ import { McpUseHostBridgeProvider } from "./mcp-use-host-bridge.js";
|
|
|
15
38
|
* composing a custom view under your own `bootstrapView` call.
|
|
16
39
|
*/
|
|
17
40
|
export function McpToolkitApp(props) {
|
|
18
|
-
return (_jsx(ThemeProvider, { children: _jsx(McpUseHostBridgeProvider, { children: _jsx(McpAppView, { ...props }) }) }));
|
|
41
|
+
return (_jsx(HostFontRoles, { children: _jsx(ThemeProvider, { children: _jsx(McpUseHostBridgeProvider, { children: _jsx(McpAppView, { ...props }) }) }) }));
|
|
19
42
|
}
|
|
20
43
|
/**
|
|
21
44
|
* Mount the toolkit app as the document's MCP App view — the bundle entry
|
|
@@ -23,7 +46,12 @@ export function McpToolkitApp(props) {
|
|
|
23
46
|
*
|
|
24
47
|
* `bootstrapView` owns the mount: it connects the ext-apps postMessage bridge
|
|
25
48
|
* to the host, installs an error boundary, and auto-reports size changes
|
|
26
|
-
* (replacing 1.x's `createRoot` + `McpUseProvider` pair).
|
|
49
|
+
* (replacing 1.x's `createRoot` + `McpUseProvider` pair). The tool-result
|
|
50
|
+
* observer goes in first, so it sees the whole host lifecycle from the
|
|
51
|
+
* handshake on: the view then tells a stripped result from a slow tool and
|
|
52
|
+
* never re-runs a call the host is still answering (toolkit#176). A custom
|
|
53
|
+
* shell under its own `bootstrapView` calls `installToolResultObserver()`
|
|
54
|
+
* before it for the same effect.
|
|
27
55
|
*
|
|
28
56
|
* ```tsx
|
|
29
57
|
* // main.tsx of the widget bundle
|
|
@@ -31,6 +59,7 @@ export function McpToolkitApp(props) {
|
|
|
31
59
|
* ```
|
|
32
60
|
*/
|
|
33
61
|
export function mountMcpToolkitApp(props) {
|
|
62
|
+
installToolResultObserver();
|
|
34
63
|
bootstrapView({ default: () => _jsx(McpToolkitApp, { ...props }) });
|
|
35
64
|
}
|
|
36
65
|
//# sourceMappingURL=mcp-toolkit-app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-toolkit-app.js","sourceRoot":"","sources":["../../src/app/mcp-toolkit-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-toolkit-app.js","sourceRoot":"","sources":["../../src/app/mcp-toolkit-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAwB,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAEnE;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,EAAE,QAAQ,EAA2B;IAC1D,MAAM,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAAA;IACxC,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,OAAM;QAC3C,sBAAsB,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IACxF,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IACjB,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAAsB;IAClD,OAAO,CACL,KAAC,aAAa,cACZ,KAAC,aAAa,cACZ,KAAC,wBAAwB,cACvB,KAAC,UAAU,OAAK,KAAK,GAAI,GACA,GACb,GACF,CACjB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAsB;IACvD,yBAAyB,EAAE,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,EAAE,CAAC,CAAA;AAChE,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* The sink for the payload a view shows, or `null` outside a
|
|
4
|
+
* {@link McpUseHostBridgeProvider}. `McpAppView` reports through it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useViewResultSink(): ((payload: unknown) => void) | null;
|
|
4
7
|
/**
|
|
5
8
|
* Install the `mcp-use` {@link HostBridge} (plus the view-scope flag) for a
|
|
6
9
|
* subtree inside an mcp-use 2.x view.
|
|
@@ -14,10 +17,16 @@ export declare function useIsInsideMcpUseView(): boolean;
|
|
|
14
17
|
* - `sendFollowup` / `openExternal` — `useSendFollowUp` / `useOpenExternal`;
|
|
15
18
|
* while the bridge is not connected (local `file://` preview), `openExternal`
|
|
16
19
|
* throws into `toHostBridge`'s documented `window.open` fallback.
|
|
17
|
-
* - `setModelContext` —
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
20
|
+
* - `setModelContext` — one line of the view's model-context tree (an mcp-use
|
|
21
|
+
* `ModelContext` node beside the ones `HostModelContext` and
|
|
22
|
+
* `useHostModelContext` register), which hosts receive via
|
|
23
|
+
* `ui/update-model-context` (ext-apps) or `widgetState` (ChatGPT). The
|
|
24
|
+
* provider does not seed mcp-use's view state, so a widget's own
|
|
25
|
+
* `useViewState(default)` keeps its default (N29).
|
|
26
|
+
* - `getWidgetData` — the payload the view reports it shows
|
|
27
|
+
* ({@link useViewResultSink}): the host's, or the one it got by re-running
|
|
28
|
+
* the tool when the host stripped it or kept back an unusable one. Without
|
|
29
|
+
* a report, the rendering tool's `structuredContent` once ready.
|
|
21
30
|
*
|
|
22
31
|
* Must render inside a `bootstrapView`-mounted tree (the mcp-use hooks throw
|
|
23
32
|
* otherwise) — `McpToolkitApp` does this for the standard bundle; use it
|