@miragon/mcp-toolkit-ui 2.7.0 → 2.8.1
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 +7 -4
- 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.js +1 -1
- 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 +21 -7
- 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 +11 -4
- 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/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 +2 -1
- package/dist/app/builder/PipelineStrip.d.ts.map +1 -1
- package/dist/app/builder/PipelineStrip.js +26 -13
- 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 +8 -2
- package/dist/app/builder/SaveDialog.js.map +1 -1
- package/dist/app/builder/Toolbar.d.ts +12 -4
- package/dist/app/builder/Toolbar.d.ts.map +1 -1
- package/dist/app/builder/Toolbar.js +18 -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 +143 -1
- package/dist/app/builder/builder-model.d.ts.map +1 -1
- package/dist/app/builder/builder-model.js +191 -1
- package/dist/app/builder/builder-model.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/use-builder-catalogue.d.ts +4 -1
- package/dist/app/builder/use-builder-catalogue.d.ts.map +1 -1
- package/dist/app/builder/use-builder-catalogue.js +44 -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/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 +13 -25
- package/dist/app/layout-builder.d.ts.map +1 -1
- package/dist/app/layout-builder.js +75 -81
- package/dist/app/layout-builder.js.map +1 -1
- package/dist/app/mcp-app-view-chrome.d.ts +12 -3
- package/dist/app/mcp-app-view-chrome.d.ts.map +1 -1
- package/dist/app/mcp-app-view-chrome.js +21 -5
- package/dist/app/mcp-app-view-chrome.js.map +1 -1
- package/dist/app/mcp-app-view-states.d.ts +11 -3
- package/dist/app/mcp-app-view-states.d.ts.map +1 -1
- package/dist/app/mcp-app-view-states.js +29 -8
- package/dist/app/mcp-app-view-states.js.map +1 -1
- package/dist/app/mcp-app-view.d.ts +33 -1
- package/dist/app/mcp-app-view.d.ts.map +1 -1
- package/dist/app/mcp-app-view.js +181 -127
- package/dist/app/mcp-app-view.js.map +1 -1
- package/dist/app/mcp-toolkit-app.d.ts +6 -1
- package/dist/app/mcp-toolkit-app.d.ts.map +1 -1
- package/dist/app/mcp-toolkit-app.js +8 -1
- 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 +4 -0
- package/dist/app/use-view-lifecycle.d.ts.map +1 -1
- package/dist/app/use-view-lifecycle.js +2 -0
- package/dist/app/use-view-lifecycle.js.map +1 -1
- package/dist/app/view-lifecycle.d.ts +80 -4
- package/dist/app/view-lifecycle.d.ts.map +1 -1
- package/dist/app/view-lifecycle.js +90 -3
- package/dist/app/view-lifecycle.js.map +1 -1
- 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 +3 -1
- package/dist/app/widget-props-sheet.d.ts.map +1 -1
- package/dist/app/widget-props-sheet.js +22 -10
- package/dist/app/widget-props-sheet.js.map +1 -1
- package/dist/app/widget-renderer.js +1 -1
- package/dist/app/widget-renderer.js.map +1 -1
- package/dist/components/DrillButton.d.ts +14 -6
- package/dist/components/DrillButton.d.ts.map +1 -1
- package/dist/components/DrillButton.js +14 -7
- package/dist/components/DrillButton.js.map +1 -1
- package/dist/components/EmptyState.d.ts.map +1 -1
- package/dist/components/EmptyState.js +4 -2
- package/dist/components/EmptyState.js.map +1 -1
- package/dist/components/ErrorState.d.ts +5 -2
- package/dist/components/ErrorState.d.ts.map +1 -1
- package/dist/components/ErrorState.js +25 -8
- package/dist/components/ErrorState.js.map +1 -1
- package/dist/components/FilterBar.d.ts +15 -4
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +11 -6
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/KpiGrid.d.ts +66 -21
- package/dist/components/KpiGrid.d.ts.map +1 -1
- package/dist/components/KpiGrid.js +101 -34
- package/dist/components/KpiGrid.js.map +1 -1
- package/dist/components/ListFooter.d.ts +31 -4
- package/dist/components/ListFooter.d.ts.map +1 -1
- package/dist/components/ListFooter.js +30 -11
- 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 +27 -7
- package/dist/components/Pills.d.ts.map +1 -1
- package/dist/components/Pills.js +21 -6
- 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 +9 -3
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +31 -16
- package/dist/components/Toast.js.map +1 -1
- 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 +47 -52
- package/dist/hooks/use-tool-result-recovery.d.ts.map +1 -1
- package/dist/hooks/use-tool-result-recovery.js +58 -120
- package/dist/hooks/use-tool-result-recovery.js.map +1 -1
- package/dist/hooks/use-view-data.d.ts +52 -10
- package/dist/hooks/use-view-data.d.ts.map +1 -1
- package/dist/hooks/use-view-data.js +81 -16
- 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 +17 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -6
- 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/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 +41 -1
- package/dist/lib/toast-model.d.ts.map +1 -1
- package/dist/lib/toast-model.js +67 -1
- package/dist/lib/toast-model.js.map +1 -1
- package/dist/lib/tone-utils.d.ts +58 -6
- package/dist/lib/tone-utils.d.ts.map +1 -1
- package/dist/lib/tone-utils.js +66 -4
- 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 +1 -1
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/locale/message-types.d.ts +117 -4
- package/dist/locale/message-types.d.ts.map +1 -1
- package/dist/locale/messages-de.d.ts.map +1 -1
- package/dist/locale/messages-de.js +44 -10
- package/dist/locale/messages-de.js.map +1 -1
- package/dist/locale/messages-en.d.ts.map +1 -1
- package/dist/locale/messages-en.js +44 -10
- package/dist/locale/messages-en.js.map +1 -1
- package/dist/locale/toolkit-messages.d.ts +19 -1
- package/dist/locale/toolkit-messages.d.ts.map +1 -1
- package/dist/locale/toolkit-messages.js +54 -1
- package/dist/locale/toolkit-messages.js.map +1 -1
- package/dist/primitives/alert.d.ts +1 -1
- package/dist/primitives/alert.d.ts.map +1 -1
- package/dist/primitives/alert.js +2 -0
- 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 +9 -4
- package/dist/primitives/badge.js.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/button.js.map +1 -1
- package/dist/primitives/dialog.d.ts +1 -1
- package/dist/primitives/dialog.d.ts.map +1 -1
- package/dist/primitives/dialog.js +10 -3
- package/dist/primitives/dialog.js.map +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/select.js.map +1 -1
- package/dist/primitives/sheet.d.ts +1 -1
- package/dist/primitives/sheet.d.ts.map +1 -1
- package/dist/primitives/sheet.js +6 -2
- package/dist/primitives/sheet.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 +30 -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/theme/create-theme.d.ts +19 -1
- package/dist/theme/create-theme.d.ts.map +1 -1
- package/dist/theme/create-theme.js +15 -0
- package/dist/theme/create-theme.js.map +1 -1
- package/package.json +5 -4
- package/src/app/adapt-data-widget.tsx +2 -42
- package/src/app/builder/BuilderBanners.tsx +1 -1
- package/src/app/builder/CanvasRow.tsx +63 -17
- package/src/app/builder/CatalogueSheet.tsx +50 -29
- package/src/app/builder/CellPropsSheet.tsx +17 -2
- package/src/app/builder/DiscardDialog.tsx +59 -0
- package/src/app/builder/LayoutSurface.tsx +206 -66
- package/src/app/builder/PipelineStrip.tsx +253 -153
- package/src/app/builder/SaveDialog.tsx +14 -2
- package/src/app/builder/Toolbar.tsx +144 -59
- package/src/app/builder/Workspace.tsx +226 -58
- package/src/app/builder/builder-model.ts +341 -2
- 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/reveal.ts +10 -0
- package/src/app/builder/use-builder-catalogue.ts +56 -19
- package/src/app/builder/use-builder-session.ts +68 -0
- package/src/app/builder/use-display-resolver.ts +24 -0
- package/src/app/index.ts +12 -2
- package/src/app/layout-builder.tsx +178 -191
- package/src/app/mcp-app-view-chrome.test.tsx +141 -1
- package/src/app/mcp-app-view-chrome.tsx +56 -6
- package/src/app/mcp-app-view-states.tsx +51 -11
- package/src/app/mcp-app-view.effects.test.tsx +292 -0
- package/src/app/mcp-app-view.test.tsx +222 -2
- package/src/app/mcp-app-view.tsx +267 -117
- package/src/app/mcp-toolkit-app.test.tsx +40 -0
- package/src/app/mcp-toolkit-app.tsx +8 -1
- 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 +6 -0
- package/src/app/view-lifecycle.test.ts +216 -0
- package/src/app/view-lifecycle.ts +165 -5
- 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 +57 -16
- package/src/app/widget-renderer.tsx +1 -1
- package/src/components/DrillButton.test.tsx +48 -0
- package/src/components/DrillButton.tsx +26 -11
- package/src/components/EmptyState.tsx +6 -4
- package/src/components/ErrorState.tsx +31 -9
- package/src/components/FilterBar.test.tsx +82 -0
- package/src/components/FilterBar.tsx +52 -26
- package/src/components/KpiGrid.test.tsx +279 -0
- package/src/components/KpiGrid.tsx +297 -90
- package/src/components/ListFooter.test.tsx +116 -0
- package/src/components/ListFooter.tsx +102 -15
- 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 +63 -10
- package/src/components/SectionHeading.tsx +9 -3
- package/src/components/Toast.tsx +37 -19
- package/src/components/WidgetHeader.test.tsx +78 -0
- package/src/components/WidgetHeader.tsx +63 -16
- package/src/components/feedback-states.test.tsx +98 -9
- package/src/components/tone-figures.test.tsx +8 -4
- 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 +3 -4
- package/src/hooks/use-tool-result-recovery.ts +84 -142
- package/src/hooks/use-view-data.test.tsx +118 -9
- package/src/hooks/use-view-data.ts +128 -18
- package/src/hooks/use-view-tool-query.ts +25 -19
- package/src/i18n-coverage.test.tsx +104 -2
- package/src/index.ts +48 -11
- package/src/lib/focus-return.test.ts +288 -0
- package/src/lib/focus-return.ts +96 -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 +166 -1
- package/src/lib/toast-model.ts +104 -2
- package/src/lib/tone-utils.test.ts +86 -10
- package/src/lib/tone-utils.ts +89 -8
- 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 +1 -0
- package/src/locale/message-types.ts +118 -2
- package/src/locale/messages-de.ts +49 -10
- package/src/locale/messages-en.ts +49 -10
- package/src/locale/toolkit-messages.test.ts +133 -0
- package/src/locale/toolkit-messages.ts +63 -2
- package/src/primitives/alert.tsx +3 -0
- package/src/primitives/badge.tsx +9 -4
- package/src/primitives/button.tsx +1 -1
- package/src/primitives/dialog.tsx +10 -1
- package/src/primitives/select.tsx +1 -1
- package/src/primitives/sheet.tsx +7 -0
- 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 +38 -6
- package/src/render-effects.tsx +96 -0
- package/src/theme/cd-tokens.test.ts +3 -1
- package/src/theme/create-theme.test.ts +10 -0
- package/src/theme/create-theme.ts +28 -0
- package/src/theme/theme-css.test.ts +51 -0
- package/src/theme.css +31 -1
- package/ui-catalog.json +448 -41
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type RecoveryPolicy } from "../hooks/use-tool-result-recovery.js";
|
|
2
3
|
import { type DescribeStep, type McpAppViewLabels, type ViewTitleLevel, type ViewTitleMode } from "./mcp-app-view-chrome.js";
|
|
3
4
|
import { type DescribeViewError } from "./mcp-app-view-states.js";
|
|
4
5
|
import type { LayoutBuilderLabels } from "./layout-builder.js";
|
|
5
6
|
import type { WidgetComponent } from "./widget-renderer.js";
|
|
6
7
|
export type { McpAppViewLabels, ViewTitleLevel, ViewTitleMode } from "./mcp-app-view-chrome.js";
|
|
7
8
|
export type { DescribeStep } from "./mcp-app-view-chrome.js";
|
|
8
|
-
export type { DescribeViewError } from "./mcp-app-view-states.js";
|
|
9
|
+
export type { DescribeViewError, ViewErrorKind } from "./mcp-app-view-states.js";
|
|
10
|
+
export type { RecoveryPolicy } from "../hooks/use-tool-result-recovery.js";
|
|
9
11
|
export interface McpAppViewProps {
|
|
10
12
|
/**
|
|
11
13
|
* Map of widget ID to React component. The consumer aggregates this from
|
|
@@ -59,6 +61,34 @@ export interface McpAppViewProps {
|
|
|
59
61
|
describeError?: DescribeViewError;
|
|
60
62
|
/** Human title of a pipeline step in the failed-steps alert (default: the step id). */
|
|
61
63
|
describeStep?: DescribeStep;
|
|
64
|
+
/**
|
|
65
|
+
* Which originating tools the view may re-execute on its own when the host
|
|
66
|
+
* strips the result's `structuredContent` (claude.ai, Claude Desktop).
|
|
67
|
+
* `"auto"` (default): any tool the host does not report as writing
|
|
68
|
+
* (`readOnlyHint: false` or `destructiveHint: true`); `"read-only"`: only
|
|
69
|
+
* tools reported with `readOnlyHint: true`; `"never"`: none. A recovery
|
|
70
|
+
* the policy forbids shows a note that the chat did not pass the result to
|
|
71
|
+
* the view. It offers to load the view only for a tool the host does not
|
|
72
|
+
* report as writing; for a writing tool it asks for the current state in
|
|
73
|
+
* the chat, so one click never runs the write a second time.
|
|
74
|
+
*/
|
|
75
|
+
recoverStrippedResult?: RecoveryPolicy;
|
|
76
|
+
/**
|
|
77
|
+
* Grace period (ms) after which a silent call counts as a stripped result.
|
|
78
|
+
* Only used where the view could not watch the host's notifications from
|
|
79
|
+
* the start (e.g. a custom shell mounted under its own `bootstrapView`
|
|
80
|
+
* without `installToolResultObserver`); a view mounted by
|
|
81
|
+
* `mountMcpToolkitApp` sees the stripped result itself and never guesses,
|
|
82
|
+
* so a slow tool is never re-run. Default 2500 ms.
|
|
83
|
+
*/
|
|
84
|
+
strippedResultGraceMs?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Put the tool name into the cache keys of the data hooks inside the view
|
|
87
|
+
* (`[...queryKey, toolName, args]`, see `toolQueryKey`), so two tools never
|
|
88
|
+
* share an entry. Omitted: an enclosing `AppQueryProvider`'s setting, else
|
|
89
|
+
* the 2.x key `[...queryKey, args]`. The next major makes it the default.
|
|
90
|
+
*/
|
|
91
|
+
toolNameInQueryKey?: boolean;
|
|
62
92
|
}
|
|
63
93
|
/**
|
|
64
94
|
* The toolkit's MCP App view: lifecycle placeholder (waiting / error /
|
|
@@ -67,6 +97,8 @@ export interface McpAppViewProps {
|
|
|
67
97
|
* the host's locale unless a `LocaleProvider` sets one, so the chrome follows
|
|
68
98
|
* the host language; `useLocale()` in consumer widgets is unaffected. Lucide
|
|
69
99
|
* icons draw at the CI stroke (2.5) throughout, the toast stack included.
|
|
100
|
+
* The widgets' data hooks fetch through an enclosing `AppQueryProvider`'s
|
|
101
|
+
* client, else the toolkit's shared `queryClient`.
|
|
70
102
|
*/
|
|
71
103
|
export declare function McpAppView(props: McpAppViewProps): import("react").JSX.Element;
|
|
72
104
|
//# sourceMappingURL=mcp-app-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-app-view.d.ts","sourceRoot":"","sources":["../../src/app/mcp-app-view.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mcp-app-view.d.ts","sourceRoot":"","sources":["../../src/app/mcp-app-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjF,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,sCAAsC,CAAA;AAK7C,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAErB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAW9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC/F,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAC5D,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAE1E,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IACxC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,sFAAsF;IACtF,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,wEAAwE;IACxE,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,SAAS,CAAA;IACtD,2FAA2F;IAC3F,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,uFAAuF;IACvF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAA;IACtC;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAYhD"}
|
package/dist/app/mcp-app-view.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useMemo } from "react";
|
|
2
|
+
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
3
|
import { LucideProvider } from "lucide-react";
|
|
4
|
-
import { ToolCancelledError,
|
|
5
|
-
import { ToastProvider
|
|
6
|
-
import { ToolkitLocaleFallback, useToolkitMessages } from "../locale/locale-provider.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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";
|
|
9
11
|
import { ICON_STROKE } from "../lib/icon-stroke.js";
|
|
10
12
|
import { useHostBridge } from "./host-bridge.js";
|
|
11
|
-
import {
|
|
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";
|
|
12
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";
|
|
13
19
|
import { useRetryFocus, useViewLifecycle } from "./use-view-lifecycle.js";
|
|
14
|
-
import { DEFAULT_SLOW_HINT_MS,
|
|
20
|
+
import { DEFAULT_SLOW_HINT_MS, describeViewForModel, reloadedAtOf, } from "./view-lifecycle.js";
|
|
15
21
|
/**
|
|
16
22
|
* The toolkit's MCP App view: lifecycle placeholder (waiting / error /
|
|
17
23
|
* cancelled), toolbar, failed-steps alert and the rendered layout (or the
|
|
@@ -19,18 +25,21 @@ import { DEFAULT_SLOW_HINT_MS, decodeViewResult } from "./view-lifecycle.js";
|
|
|
19
25
|
* the host's locale unless a `LocaleProvider` sets one, so the chrome follows
|
|
20
26
|
* the host language; `useLocale()` in consumer widgets is unaffected. Lucide
|
|
21
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`.
|
|
22
30
|
*/
|
|
23
31
|
export function McpAppView(props) {
|
|
24
32
|
const { locale } = useHostContext();
|
|
25
33
|
return (_jsx(ToolkitLocaleFallback, { locale: locale, children: _jsx(LucideProvider, { strokeWidth: ICON_STROKE, children: _jsx(ToastProvider, { children: _jsx(McpAppViewShell, { ...props }) }) }) }));
|
|
26
34
|
}
|
|
35
|
+
const NO_VIEW = { data: null, source: null, reloadedAt: null };
|
|
27
36
|
/**
|
|
28
|
-
* Host-delivered payload →
|
|
29
|
-
* Render-phase setState (not an effect) so the React
|
|
30
|
-
* cascading render.
|
|
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.
|
|
31
40
|
*/
|
|
32
|
-
function useHostViewData(initialViewData, isPending, recovered) {
|
|
33
|
-
const [
|
|
41
|
+
function useHostViewData(initialViewData, isPending, recovered, recoveredAt) {
|
|
42
|
+
const [view, setView] = useState(NO_VIEW);
|
|
34
43
|
// `prev` MUST start as `null`, not `initialViewData`: hosts that expose the
|
|
35
44
|
// complete tool output before the app's first render (e.g. window.openai
|
|
36
45
|
// globals injected ahead of script execution) would otherwise never trip the
|
|
@@ -40,166 +49,211 @@ function useHostViewData(initialViewData, isPending, recovered) {
|
|
|
40
49
|
const [prevInitial, setPrevInitial] = useState(null);
|
|
41
50
|
if (initialViewData !== prevInitial) {
|
|
42
51
|
setPrevInitial(initialViewData);
|
|
43
|
-
if (!isPending && isCompleteViewData(initialViewData))
|
|
44
|
-
|
|
52
|
+
if (!isPending && isCompleteViewData(initialViewData)) {
|
|
53
|
+
setView({ data: initialViewData, source: "host", reloadedAt: null });
|
|
54
|
+
}
|
|
45
55
|
}
|
|
46
56
|
const [prevRecovered, setPrevRecovered] = useState(null);
|
|
47
57
|
if (recovered !== prevRecovered) {
|
|
48
58
|
setPrevRecovered(recovered);
|
|
49
|
-
// The host-delivered payload always wins; recovery
|
|
50
|
-
|
|
51
|
-
|
|
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);
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
|
-
return [
|
|
67
|
+
return [view, setView];
|
|
54
68
|
}
|
|
55
69
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* the
|
|
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.
|
|
59
74
|
*/
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setIsRefreshing(false);
|
|
88
|
-
}
|
|
89
|
-
if (failure === null)
|
|
90
|
-
return;
|
|
91
|
-
console.warn("[mcp-toolkit] refresh failed:", failure);
|
|
92
|
-
toast.show({
|
|
93
|
-
tone: "danger",
|
|
94
|
-
title: labels.refreshFailed,
|
|
95
|
-
description: labels.refreshFailedHint,
|
|
96
|
-
});
|
|
97
|
-
}, [callTool, labels, refreshToolName, setViewData, toast, viewData]);
|
|
98
|
-
return { isRefreshing, refreshView };
|
|
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
|
+
};
|
|
99
102
|
}
|
|
100
103
|
/**
|
|
101
|
-
* The
|
|
102
|
-
*
|
|
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.
|
|
103
109
|
*/
|
|
104
|
-
function
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
110
|
+
function useShownView(call, callTool, policy = "auto", graceMs = DEFAULT_ASSUME_STRIPPED_AFTER_MS) {
|
|
111
|
+
const recovery = useToolResultRecovery({
|
|
112
|
+
resultReady: !call.isPending,
|
|
113
|
+
cancelled: call.isCancelled,
|
|
114
|
+
errored: call.isCallError,
|
|
115
|
+
props: call.initialViewData,
|
|
116
|
+
isValid: isCompleteViewData,
|
|
117
|
+
toolInput: call.tool.toolInput,
|
|
118
|
+
hostContext: call.hostContext,
|
|
119
|
+
callTool,
|
|
120
|
+
policy,
|
|
121
|
+
assumeStrippedAfterMs: graceMs,
|
|
122
|
+
});
|
|
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]);
|
|
122
134
|
return {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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",
|
|
126
143
|
};
|
|
127
144
|
}
|
|
128
|
-
|
|
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, }) {
|
|
129
163
|
const messages = useToolkitMessages();
|
|
130
164
|
const L = useMemo(() => ({ ...messages.view, ...labels }), [messages.view, labels]);
|
|
131
165
|
// The mcp-use 2.x view channels (all need the `bootstrapView` mount
|
|
132
166
|
// `mountMcpToolkitApp` provides); tools go through the HostBridge.
|
|
133
|
-
const
|
|
134
|
-
const { safeArea,
|
|
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();
|
|
135
174
|
const bridge = useHostBridge();
|
|
136
175
|
const callTool = useCallback((name, args) => bridge.callTool(name, args), [bridge]);
|
|
137
176
|
// The widget-facing shape (`args: object`, so generated input interfaces
|
|
138
177
|
// without an index signature pass straight through).
|
|
139
178
|
const callToolFn = useCallback((name, args) => bridge.callTool(name, args), [bridge]);
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
const isCallError = tool.status === "error" && !isCancelled;
|
|
144
|
-
const initialViewData = tool.status === "ready" ? tool.toolOutput : undefined;
|
|
145
|
-
// Hosts that strip `structuredContent` (claude.ai) never latch a result under
|
|
146
|
-
// mcp-use 2.x; the recovery re-executes the call once to fill the gap. It
|
|
147
|
-
// never fires on a cancelled or failed call (#176): those render their state.
|
|
148
|
-
const recovery = useToolResultRecovery({
|
|
149
|
-
resultReady: !isPending,
|
|
150
|
-
cancelled: isCancelled,
|
|
151
|
-
errored: isCallError,
|
|
152
|
-
props: initialViewData,
|
|
153
|
-
isValid: isCompleteViewData,
|
|
154
|
-
toolInput: tool.toolInput,
|
|
155
|
-
hostContext,
|
|
156
|
-
callTool,
|
|
157
|
-
});
|
|
158
|
-
const [viewData, setViewData] = useHostViewData(initialViewData, isPending, recovery.data);
|
|
179
|
+
const shown = useShownView(call, callTool, recoverStrippedResult, strippedResultGraceMs);
|
|
180
|
+
const { view, setView } = shown;
|
|
181
|
+
const viewData = view.data;
|
|
159
182
|
const { lifecycle, retry: retryCall } = useViewLifecycle({
|
|
160
183
|
hasViewData: viewData !== null,
|
|
161
|
-
callStatus: tool.status,
|
|
162
|
-
cancelled: isCancelled,
|
|
163
|
-
callError:
|
|
164
|
-
recoveryFailed:
|
|
165
|
-
|
|
166
|
-
|
|
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,
|
|
167
192
|
callTool,
|
|
168
193
|
isValid: isCompleteViewData,
|
|
169
|
-
onResult:
|
|
194
|
+
onResult: shown.showRetried,
|
|
170
195
|
slowHintAfterMs,
|
|
171
196
|
});
|
|
172
197
|
const { frameRef, retry } = useRetryFocus(lifecycle.phase, retryCall);
|
|
173
198
|
const { isRefreshing, refreshView } = useViewRefresh({
|
|
174
199
|
viewData,
|
|
175
|
-
setViewData,
|
|
200
|
+
setViewData: shown.showRefreshed,
|
|
176
201
|
callTool,
|
|
177
202
|
refreshToolName,
|
|
178
203
|
labels: L,
|
|
204
|
+
client: viewClient,
|
|
179
205
|
});
|
|
180
206
|
const fullscreen = useFullscreenToggle(L);
|
|
181
207
|
// In-iframe build mode is purely a UI state — the LLM never sees the catalogue.
|
|
182
208
|
const [buildMode, setBuildMode] = useState(false);
|
|
209
|
+
useBuildModeFocus(buildMode, frameRef);
|
|
183
210
|
const exitBuildMode = useCallback((commit) => {
|
|
184
211
|
if (commit)
|
|
185
|
-
|
|
212
|
+
setView((prev) => withBuilderCommit(prev, commit));
|
|
186
213
|
setBuildMode(false);
|
|
187
|
-
}, [
|
|
214
|
+
}, [setView]);
|
|
215
|
+
const viewContext = (_jsx(ViewModelContext, { lifecycle: lifecycle, toolName: call.toolName, view: view }));
|
|
188
216
|
// `isPending` must not gate the render: on stripping hosts the latch stays
|
|
189
217
|
// "pending" forever, and recovered viewData still has to replace it. The
|
|
190
218
|
// frame is the stable focus target of a retry (`useRetryFocus`).
|
|
191
219
|
if (!viewData) {
|
|
192
|
-
return (
|
|
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 })] }));
|
|
193
221
|
}
|
|
194
|
-
return (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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);
|
|
204
258
|
}
|
|
205
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,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-app-view.js","sourceRoot":"","sources":["../../src/app/mcp-app-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAkB,MAAM,OA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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"}
|
|
@@ -19,7 +19,12 @@ export declare function McpToolkitApp(props: McpAppViewProps): import("react").J
|
|
|
19
19
|
*
|
|
20
20
|
* `bootstrapView` owns the mount: it connects the ext-apps postMessage bridge
|
|
21
21
|
* to the host, installs an error boundary, and auto-reports size changes
|
|
22
|
-
* (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.
|
|
23
28
|
*
|
|
24
29
|
* ```tsx
|
|
25
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,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect } from "react";
|
|
3
3
|
import { ThemeProvider, bootstrapView, useHostContext } from "mcp-use/react";
|
|
4
|
+
import { installToolResultObserver } from "../lib/tool-result-observer.js";
|
|
4
5
|
import { adoptHostFontVariables } from "../theme/host-fonts.js";
|
|
5
6
|
import { McpAppView } from "./mcp-app-view.js";
|
|
6
7
|
import { McpUseHostBridgeProvider } from "./mcp-use-host-bridge.js";
|
|
@@ -45,7 +46,12 @@ export function McpToolkitApp(props) {
|
|
|
45
46
|
*
|
|
46
47
|
* `bootstrapView` owns the mount: it connects the ext-apps postMessage bridge
|
|
47
48
|
* to the host, installs an error boundary, and auto-reports size changes
|
|
48
|
-
* (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.
|
|
49
55
|
*
|
|
50
56
|
* ```tsx
|
|
51
57
|
* // main.tsx of the widget bundle
|
|
@@ -53,6 +59,7 @@ export function McpToolkitApp(props) {
|
|
|
53
59
|
* ```
|
|
54
60
|
*/
|
|
55
61
|
export function mountMcpToolkitApp(props) {
|
|
62
|
+
installToolResultObserver();
|
|
56
63
|
bootstrapView({ default: () => _jsx(McpToolkitApp, { ...props }) });
|
|
57
64
|
}
|
|
58
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,eAAe,EAAkB,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC5E,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
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-use-host-bridge.d.ts","sourceRoot":"","sources":["../../src/app/mcp-use-host-bridge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-use-host-bridge.d.ts","sourceRoot":"","sources":["../../src/app/mcp-use-host-bridge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAgGd;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,CAEvE;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAwDzF"}
|