@miragon/mcp-toolkit-ui 2.7.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 +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 +9 -6
- package/dist/components/DrillButton.d.ts.map +1 -1
- package/dist/components/DrillButton.js +8 -6
- 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.tsx +23 -10
- 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,19 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
-
import { useDynamicTool, useHostContext, useOpenExternal, useSendFollowUp, useToolContext,
|
|
3
|
+
import { useDynamicTool, useHostContext, useOpenExternal, useSendFollowUp, useToolContext, useViewTheme, } from "mcp-use/react";
|
|
4
4
|
import { HostBridgeProvider, toHostBridge } from "./host-bridge.js";
|
|
5
|
-
|
|
6
|
-
* `true` inside an mcp-use 2.x view — i.e. under a
|
|
7
|
-
* {@link McpUseHostBridgeProvider}, which itself only renders under a
|
|
8
|
-
* `bootstrapView`-mounted tree. Components that want to use `mcp-use/react`
|
|
9
|
-
* primitives (which throw outside a view) branch on this instead of probing
|
|
10
|
-
* mcp-use internals; see `adaptDataWidget`'s ModelContext handling.
|
|
11
|
-
*/
|
|
12
|
-
const McpUseViewContext = createContext(false);
|
|
13
|
-
/** Whether the subtree runs inside an mcp-use view (see {@link McpUseViewContext}). */
|
|
14
|
-
export function useIsInsideMcpUseView() {
|
|
15
|
-
return useContext(McpUseViewContext);
|
|
16
|
-
}
|
|
5
|
+
import { McpUseViewContext, ModelContextChannelContext, ModelContextLines, modelContextLine, withModelContextLine, } from "./model-context.js";
|
|
17
6
|
/**
|
|
18
7
|
* Mounts one `useDynamicTool` handle and hands its stable `callTool` up to the
|
|
19
8
|
* pool. This rendered indirection exists because mcp-use 2.x has no public
|
|
@@ -65,6 +54,31 @@ function useDynamicToolPool() {
|
|
|
65
54
|
const binders = useMemo(() => names.map((name) => _jsx(ToolBinder, { name: name, onBind: onBind }, name)), [names, onBind]);
|
|
66
55
|
return { callTool, binders };
|
|
67
56
|
}
|
|
57
|
+
/** The line of the bridge's own `setModelContext` (last writer wins). */
|
|
58
|
+
const BRIDGE_LINE = "host-bridge";
|
|
59
|
+
/**
|
|
60
|
+
* Where the view reports the payload it shows (the host's, a stripped-result
|
|
61
|
+
* recovery's, the user's retry or refresh), so `HostBridge.getWidgetData()`
|
|
62
|
+
* returns what the view shows (toolkit#176 K15): the bridge, not one
|
|
63
|
+
* component's local state, holds the view's data.
|
|
64
|
+
*/
|
|
65
|
+
const ViewResultSinkContext = createContext(null);
|
|
66
|
+
/**
|
|
67
|
+
* The sink for the payload a view shows, or `null` outside a
|
|
68
|
+
* {@link McpUseHostBridgeProvider}. `McpAppView` reports through it.
|
|
69
|
+
*/
|
|
70
|
+
export function useViewResultSink() {
|
|
71
|
+
return useContext(ViewResultSinkContext);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What `getWidgetData()` returns: the payload the view reported it shows,
|
|
75
|
+
* else the rendering tool's output once the call latched `"ready"`.
|
|
76
|
+
*/
|
|
77
|
+
function bridgeOutput(shown, tool) {
|
|
78
|
+
if (shown !== undefined)
|
|
79
|
+
return shown;
|
|
80
|
+
return tool.status === "ready" ? tool.toolOutput : undefined;
|
|
81
|
+
}
|
|
68
82
|
/**
|
|
69
83
|
* Install the `mcp-use` {@link HostBridge} (plus the view-scope flag) for a
|
|
70
84
|
* subtree inside an mcp-use 2.x view.
|
|
@@ -78,10 +92,16 @@ function useDynamicToolPool() {
|
|
|
78
92
|
* - `sendFollowup` / `openExternal` — `useSendFollowUp` / `useOpenExternal`;
|
|
79
93
|
* while the bridge is not connected (local `file://` preview), `openExternal`
|
|
80
94
|
* throws into `toHostBridge`'s documented `window.open` fallback.
|
|
81
|
-
* - `setModelContext` —
|
|
82
|
-
*
|
|
83
|
-
* `
|
|
84
|
-
*
|
|
95
|
+
* - `setModelContext` — one line of the view's model-context tree (an mcp-use
|
|
96
|
+
* `ModelContext` node beside the ones `HostModelContext` and
|
|
97
|
+
* `useHostModelContext` register), which hosts receive via
|
|
98
|
+
* `ui/update-model-context` (ext-apps) or `widgetState` (ChatGPT). The
|
|
99
|
+
* provider does not seed mcp-use's view state, so a widget's own
|
|
100
|
+
* `useViewState(default)` keeps its default (N29).
|
|
101
|
+
* - `getWidgetData` — the payload the view reports it shows
|
|
102
|
+
* ({@link useViewResultSink}): the host's, or the one it got by re-running
|
|
103
|
+
* the tool when the host stripped it or kept back an unusable one. Without
|
|
104
|
+
* a report, the rendering tool's `structuredContent` once ready.
|
|
85
105
|
*
|
|
86
106
|
* Must render inside a `bootstrapView`-mounted tree (the mcp-use hooks throw
|
|
87
107
|
* otherwise) — `McpToolkitApp` does this for the standard bundle; use it
|
|
@@ -94,8 +114,13 @@ export function McpUseHostBridgeProvider({ children }) {
|
|
|
94
114
|
const tool = useToolContext();
|
|
95
115
|
const theme = useViewTheme();
|
|
96
116
|
const { isAvailable } = useHostContext();
|
|
97
|
-
const [,
|
|
98
|
-
const
|
|
117
|
+
const [lines, setLines] = useState(() => new Map());
|
|
118
|
+
const channel = useMemo(() => ({ set: (id, content) => setLines((prev) => withModelContextLine(prev, id, content)) }), []);
|
|
119
|
+
// The payload the view reports it shows wins: after a latch the view could
|
|
120
|
+
// not render (`structuredContent: null` latches "ready"), the host's own
|
|
121
|
+
// output is not what the user sees.
|
|
122
|
+
const [shown, setShown] = useState(undefined);
|
|
123
|
+
const output = bridgeOutput(shown, tool);
|
|
99
124
|
const bridge = useMemo(() => toHostBridge({
|
|
100
125
|
callTool,
|
|
101
126
|
sendFollowUpMessage: (prompt) => sendFollowUp({ prompt }),
|
|
@@ -110,11 +135,15 @@ export function McpUseHostBridgeProvider({ children }) {
|
|
|
110
135
|
},
|
|
111
136
|
output,
|
|
112
137
|
theme,
|
|
138
|
+
// toHostBridge writes model context as `{ __model_context }`: it
|
|
139
|
+
// becomes the bridge's line of the one channel, never view state.
|
|
113
140
|
setState: (state) => {
|
|
114
|
-
|
|
141
|
+
const text = state.__model_context;
|
|
142
|
+
if (typeof text === "string")
|
|
143
|
+
channel.set(BRIDGE_LINE, modelContextLine(text));
|
|
115
144
|
return Promise.resolve();
|
|
116
145
|
},
|
|
117
|
-
}), [callTool, sendFollowUp, openExternal, output, theme, isAvailable,
|
|
118
|
-
return (_jsxs(McpUseViewContext.Provider, { value: true, children: [binders, _jsx(HostBridgeProvider, { bridge: bridge, children: children })] }));
|
|
146
|
+
}), [callTool, sendFollowUp, openExternal, output, theme, isAvailable, channel]);
|
|
147
|
+
return (_jsxs(McpUseViewContext.Provider, { value: true, children: [binders, _jsx(ModelContextLines, { lines: lines }), _jsx(ModelContextChannelContext.Provider, { value: channel, children: _jsx(ViewResultSinkContext.Provider, { value: setShown, children: _jsx(HostBridgeProvider, { bridge: bridge, children: children }) }) })] }));
|
|
119
148
|
}
|
|
120
149
|
//# sourceMappingURL=mcp-use-host-bridge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-use-host-bridge.js","sourceRoot":"","sources":["../../src/app/mcp-use-host-bridge.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAA;AACd,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,YAAY,
|
|
1
|
+
{"version":3,"file":"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EAAE,WAAW,EAAE,OAAO,CAAC,CAC5E,CAAA;IAED,OAAO,CACL,MAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,aACpC,OAAO,EACR,KAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,GAAI,EACnC,KAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YACjD,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAC7C,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,YAAG,QAAQ,GAAsB,GACpC,GACG,IACX,CAC9B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The view's model context: what the model reads about the view on its next
|
|
4
|
+
* turn (`ui/update-model-context`). The one module that builds on mcp-use's
|
|
5
|
+
* native `ModelContext`, which throws outside a `bootstrapView` mount; every
|
|
6
|
+
* other component reports through {@link HostModelContext} or
|
|
7
|
+
* {@link useHostModelContext} (toolkit#176 K20).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* `true` inside an mcp-use 2.x view — i.e. under a `McpUseHostBridgeProvider`,
|
|
11
|
+
* which itself only renders under a `bootstrapView`-mounted tree. Components
|
|
12
|
+
* that want to use `mcp-use/react` primitives (which throw outside a view)
|
|
13
|
+
* branch on this instead of probing mcp-use internals. Exported for the
|
|
14
|
+
* provider and for tests that render a view-scoped subtree.
|
|
15
|
+
*/
|
|
16
|
+
export declare const McpUseViewContext: import("react").Context<boolean>;
|
|
17
|
+
/** Whether the subtree runs inside an mcp-use view (see {@link McpUseViewContext}). */
|
|
18
|
+
export declare function useIsInsideMcpUseView(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Model-context reporting that works on every host — the host-portable
|
|
21
|
+
* replacement for rendering `mcp-use/react`'s `ModelContext` directly.
|
|
22
|
+
*
|
|
23
|
+
* Inside an mcp-use view it renders the native `ModelContext`, which nests:
|
|
24
|
+
* the lines of its children hang below its own in the one description the
|
|
25
|
+
* host receives. Everywhere else — ChatGPT via `createChatGptHostBridge`, the
|
|
26
|
+
* `WidgetFixtureHost` harness, standalone apps — the description flows
|
|
27
|
+
* through the bridge's `setModelContext` instead (last-writer-wins; fine for
|
|
28
|
+
* the single-widget mounts those hosts render).
|
|
29
|
+
*
|
|
30
|
+
* Widgets that self-fetch and report their own context (cockpit views like
|
|
31
|
+
* `TasksBoard`) must use this instead of importing `ModelContext` from
|
|
32
|
+
* `mcp-use/react` — the direct import crashes the widget in every non-view
|
|
33
|
+
* mount, starting with the widget playground. Without `children` it reports
|
|
34
|
+
* one line where it is rendered.
|
|
35
|
+
*/
|
|
36
|
+
export declare function HostModelContext({ content, children, }: {
|
|
37
|
+
content: string;
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}): ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* The view's ONE model-context channel: lines registered here render as
|
|
42
|
+
* root-level native `ModelContext` nodes ({@link ModelContextLines}), the
|
|
43
|
+
* tree `HostModelContext` nodes join too, so the host receives everything
|
|
44
|
+
* the view reports in one description. `McpUseHostBridgeProvider` owns it.
|
|
45
|
+
*/
|
|
46
|
+
export interface ModelContextChannel {
|
|
47
|
+
/** Set (`content`) or remove (`null`) the line registered under `id`. */
|
|
48
|
+
set: (id: string, content: string | null) => void;
|
|
49
|
+
}
|
|
50
|
+
export declare const ModelContextChannelContext: import("react").Context<ModelContextChannel | null>;
|
|
51
|
+
/** `lines` with `id` set to `content` (or removed for `null`); the same map when nothing changes. */
|
|
52
|
+
export declare function withModelContextLine(lines: ReadonlyMap<string, string>, id: string, content: string | null): ReadonlyMap<string, string>;
|
|
53
|
+
/** A line of model context, or `null` for a blank one (nothing to report). */
|
|
54
|
+
export declare function modelContextLine(content: string | null | undefined): string | null;
|
|
55
|
+
/** Renders the channel's lines as native `ModelContext` nodes (inside a view only). */
|
|
56
|
+
export declare function ModelContextLines({ lines }: {
|
|
57
|
+
lines: ReadonlyMap<string, string>;
|
|
58
|
+
}): ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Report one line of model context for as long as the calling component is
|
|
61
|
+
* mounted: what the user is looking at, a filter, an error the user sees.
|
|
62
|
+
* The channel helper for components with nothing to wrap
|
|
63
|
+
* ({@link HostModelContext} is the wrapping form).
|
|
64
|
+
*
|
|
65
|
+
* Inside an mcp-use view the line joins the view's one model-context tree and
|
|
66
|
+
* leaves it on unmount or when `content` turns blank. Elsewhere (the ChatGPT
|
|
67
|
+
* bridge, the fixture harness, standalone apps) it goes through the bridge's
|
|
68
|
+
* `setModelContext`, last writer wins.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useHostModelContext(content: string | null | undefined): void;
|
|
71
|
+
//# sourceMappingURL=model-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-context.d.ts","sourceRoot":"","sources":["../../src/app/model-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAInF;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,kCAAuB,CAAA;AAErD,uFAAuF;AACvF,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,GAAG,SAAS,CAIZ;AAWD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAClD;AAED,eAAO,MAAM,0BAA0B,qDAAkD,CAAA;AAEzF,qGAAqG;AACrG,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAM7B;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAElF;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,SAAS,CAE9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAa5E"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useId } from "react";
|
|
3
|
+
import { ModelContext } from "mcp-use/react";
|
|
4
|
+
import { useHostBridgeOrNull } from "./host-bridge.js";
|
|
5
|
+
/**
|
|
6
|
+
* The view's model context: what the model reads about the view on its next
|
|
7
|
+
* turn (`ui/update-model-context`). The one module that builds on mcp-use's
|
|
8
|
+
* native `ModelContext`, which throws outside a `bootstrapView` mount; every
|
|
9
|
+
* other component reports through {@link HostModelContext} or
|
|
10
|
+
* {@link useHostModelContext} (toolkit#176 K20).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* `true` inside an mcp-use 2.x view — i.e. under a `McpUseHostBridgeProvider`,
|
|
14
|
+
* which itself only renders under a `bootstrapView`-mounted tree. Components
|
|
15
|
+
* that want to use `mcp-use/react` primitives (which throw outside a view)
|
|
16
|
+
* branch on this instead of probing mcp-use internals. Exported for the
|
|
17
|
+
* provider and for tests that render a view-scoped subtree.
|
|
18
|
+
*/
|
|
19
|
+
export const McpUseViewContext = createContext(false);
|
|
20
|
+
/** Whether the subtree runs inside an mcp-use view (see {@link McpUseViewContext}). */
|
|
21
|
+
export function useIsInsideMcpUseView() {
|
|
22
|
+
return useContext(McpUseViewContext);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Model-context reporting that works on every host — the host-portable
|
|
26
|
+
* replacement for rendering `mcp-use/react`'s `ModelContext` directly.
|
|
27
|
+
*
|
|
28
|
+
* Inside an mcp-use view it renders the native `ModelContext`, which nests:
|
|
29
|
+
* the lines of its children hang below its own in the one description the
|
|
30
|
+
* host receives. Everywhere else — ChatGPT via `createChatGptHostBridge`, the
|
|
31
|
+
* `WidgetFixtureHost` harness, standalone apps — the description flows
|
|
32
|
+
* through the bridge's `setModelContext` instead (last-writer-wins; fine for
|
|
33
|
+
* the single-widget mounts those hosts render).
|
|
34
|
+
*
|
|
35
|
+
* Widgets that self-fetch and report their own context (cockpit views like
|
|
36
|
+
* `TasksBoard`) must use this instead of importing `ModelContext` from
|
|
37
|
+
* `mcp-use/react` — the direct import crashes the widget in every non-view
|
|
38
|
+
* mount, starting with the widget playground. Without `children` it reports
|
|
39
|
+
* one line where it is rendered.
|
|
40
|
+
*/
|
|
41
|
+
export function HostModelContext({ content, children, }) {
|
|
42
|
+
const insideView = useIsInsideMcpUseView();
|
|
43
|
+
if (insideView)
|
|
44
|
+
return _jsx(ModelContext, { content: content, children: children });
|
|
45
|
+
return _jsx(BridgeModelContext, { content: content, children: children });
|
|
46
|
+
}
|
|
47
|
+
function BridgeModelContext({ content, children }) {
|
|
48
|
+
const bridge = useHostBridgeOrNull();
|
|
49
|
+
const setModelContext = bridge?.setModelContext;
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setModelContext?.(content);
|
|
52
|
+
}, [setModelContext, content]);
|
|
53
|
+
return children;
|
|
54
|
+
}
|
|
55
|
+
export const ModelContextChannelContext = createContext(null);
|
|
56
|
+
/** `lines` with `id` set to `content` (or removed for `null`); the same map when nothing changes. */
|
|
57
|
+
export function withModelContextLine(lines, id, content) {
|
|
58
|
+
if (content === null ? !lines.has(id) : lines.get(id) === content)
|
|
59
|
+
return lines;
|
|
60
|
+
const next = new Map(lines);
|
|
61
|
+
if (content === null)
|
|
62
|
+
next.delete(id);
|
|
63
|
+
else
|
|
64
|
+
next.set(id, content);
|
|
65
|
+
return next;
|
|
66
|
+
}
|
|
67
|
+
/** A line of model context, or `null` for a blank one (nothing to report). */
|
|
68
|
+
export function modelContextLine(content) {
|
|
69
|
+
return content?.trim() ? content : null;
|
|
70
|
+
}
|
|
71
|
+
/** Renders the channel's lines as native `ModelContext` nodes (inside a view only). */
|
|
72
|
+
export function ModelContextLines({ lines }) {
|
|
73
|
+
return [...lines].map(([id, content]) => _jsx(ModelContext, { content: content }, id));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Report one line of model context for as long as the calling component is
|
|
77
|
+
* mounted: what the user is looking at, a filter, an error the user sees.
|
|
78
|
+
* The channel helper for components with nothing to wrap
|
|
79
|
+
* ({@link HostModelContext} is the wrapping form).
|
|
80
|
+
*
|
|
81
|
+
* Inside an mcp-use view the line joins the view's one model-context tree and
|
|
82
|
+
* leaves it on unmount or when `content` turns blank. Elsewhere (the ChatGPT
|
|
83
|
+
* bridge, the fixture harness, standalone apps) it goes through the bridge's
|
|
84
|
+
* `setModelContext`, last writer wins.
|
|
85
|
+
*/
|
|
86
|
+
export function useHostModelContext(content) {
|
|
87
|
+
const channel = useContext(ModelContextChannelContext);
|
|
88
|
+
const setModelContext = useHostBridgeOrNull()?.setModelContext;
|
|
89
|
+
const id = useId();
|
|
90
|
+
const line = modelContextLine(content);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (channel) {
|
|
93
|
+
channel.set(id, line);
|
|
94
|
+
return () => channel.set(id, null);
|
|
95
|
+
}
|
|
96
|
+
if (line !== null)
|
|
97
|
+
setModelContext?.(line);
|
|
98
|
+
return undefined;
|
|
99
|
+
}, [channel, id, line, setModelContext]);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=model-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-context.js","sourceRoot":"","sources":["../../src/app/model-context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;AAErD,uFAAuF;AACvF,MAAM,UAAU,qBAAqB;IACnC,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GAIT;IACC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAA;IAC1C,IAAI,UAAU;QAAE,OAAO,KAAC,YAAY,IAAC,OAAO,EAAE,OAAO,YAAG,QAAQ,GAAgB,CAAA;IAChF,OAAO,KAAC,kBAAkB,IAAC,OAAO,EAAE,OAAO,YAAG,QAAQ,GAAsB,CAAA;AAC9E,CAAC;AAED,SAAS,kBAAkB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAA6C;IAC1F,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;IACpC,MAAM,eAAe,GAAG,MAAM,EAAE,eAAe,CAAA;IAC/C,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,EAAE,CAAC,OAAO,CAAC,CAAA;IAC5B,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAA;IAC9B,OAAO,QAAQ,CAAA;AACjB,CAAC;AAaD,MAAM,CAAC,MAAM,0BAA0B,GAAG,aAAa,CAA6B,IAAI,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I,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;YACrB,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QACpC,CAAC;QACD,IAAI,IAAI,KAAK,IAAI;YAAE,eAAe,EAAE,CAAC,IAAI,CAAC,CAAA;QAC1C,OAAO,SAAS,CAAA;IAClB,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/** Where focus goes when build mode opens: the builder's title. */
|
|
3
|
+
export declare const BUILDER_FOCUS_TARGET = "[data-slot=\"builder-title\"]";
|
|
4
|
+
/** Where focus goes when build mode closes (Apply or Discard): the edit button that opened it. */
|
|
5
|
+
export declare const VIEW_FOCUS_TARGET = "[data-slot=\"view-edit\"]";
|
|
6
|
+
/**
|
|
7
|
+
* The selector focus moves to when build mode switches, or `null` when it
|
|
8
|
+
* did not switch (the first render included). Pure, so the hand-off is
|
|
9
|
+
* unit-testable without a DOM.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildModeFocusTarget(previous: boolean, current: boolean): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Where focus goes when a `LayoutBuilder` mounts, by its reset `generation`:
|
|
14
|
+
* after a reset (Discard without `onExit`, > 0) the builder's title, because
|
|
15
|
+
* the Discard button that had the focus went with the old builder; on the
|
|
16
|
+
* first mount nowhere (McpAppView's build-mode switch handles that one).
|
|
17
|
+
*/
|
|
18
|
+
export declare function builderMountFocusTarget(generation: number): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Focuses the element `target` selects inside the returned ref's element once
|
|
21
|
+
* it mounts; `null` focuses nothing. `LayoutBuilder` passes
|
|
22
|
+
* {@link builderMountFocusTarget} of its reset generation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useFocusOnMount<T extends HTMLElement>(target: string | null): RefObject<T | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Moves focus across the build-mode switch: the button that opened the
|
|
27
|
+
* builder disappears with the toolbar, so focus lands on the builder's title;
|
|
28
|
+
* Apply and Discard unmount the builder, so focus returns to the edit button.
|
|
29
|
+
* Focus that already sits outside the view (another frame, the host) stays
|
|
30
|
+
* where it is.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useBuildModeFocus(buildMode: boolean, frameRef: RefObject<HTMLElement | null>): void;
|
|
33
|
+
//# sourceMappingURL=use-build-mode-focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-build-mode-focus.d.ts","sourceRoot":"","sources":["../../src/app/use-build-mode-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEzD,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,kCAAgC,CAAA;AACjE,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,8BAA4B,CAAA;AAE1D;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAGvF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAMjG;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACtC,IAAI,CAWN"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
/** Where focus goes when build mode opens: the builder's title. */
|
|
3
|
+
export const BUILDER_FOCUS_TARGET = '[data-slot="builder-title"]';
|
|
4
|
+
/** Where focus goes when build mode closes (Apply or Discard): the edit button that opened it. */
|
|
5
|
+
export const VIEW_FOCUS_TARGET = '[data-slot="view-edit"]';
|
|
6
|
+
/**
|
|
7
|
+
* The selector focus moves to when build mode switches, or `null` when it
|
|
8
|
+
* did not switch (the first render included). Pure, so the hand-off is
|
|
9
|
+
* unit-testable without a DOM.
|
|
10
|
+
*/
|
|
11
|
+
export function buildModeFocusTarget(previous, current) {
|
|
12
|
+
if (previous === current)
|
|
13
|
+
return null;
|
|
14
|
+
return current ? BUILDER_FOCUS_TARGET : VIEW_FOCUS_TARGET;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Where focus goes when a `LayoutBuilder` mounts, by its reset `generation`:
|
|
18
|
+
* after a reset (Discard without `onExit`, > 0) the builder's title, because
|
|
19
|
+
* the Discard button that had the focus went with the old builder; on the
|
|
20
|
+
* first mount nowhere (McpAppView's build-mode switch handles that one).
|
|
21
|
+
*/
|
|
22
|
+
export function builderMountFocusTarget(generation) {
|
|
23
|
+
return generation > 0 ? BUILDER_FOCUS_TARGET : null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Focuses the element `target` selects inside the returned ref's element once
|
|
27
|
+
* it mounts; `null` focuses nothing. `LayoutBuilder` passes
|
|
28
|
+
* {@link builderMountFocusTarget} of its reset generation.
|
|
29
|
+
*/
|
|
30
|
+
export function useFocusOnMount(target) {
|
|
31
|
+
const ref = useRef(null);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (target)
|
|
34
|
+
ref.current?.querySelector(target)?.focus();
|
|
35
|
+
}, [target]);
|
|
36
|
+
return ref;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Moves focus across the build-mode switch: the button that opened the
|
|
40
|
+
* builder disappears with the toolbar, so focus lands on the builder's title;
|
|
41
|
+
* Apply and Discard unmount the builder, so focus returns to the edit button.
|
|
42
|
+
* Focus that already sits outside the view (another frame, the host) stays
|
|
43
|
+
* where it is.
|
|
44
|
+
*/
|
|
45
|
+
export function useBuildModeFocus(buildMode, frameRef) {
|
|
46
|
+
const previous = useRef(buildMode);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const target = buildModeFocusTarget(previous.current, buildMode);
|
|
49
|
+
previous.current = buildMode;
|
|
50
|
+
const frame = frameRef.current;
|
|
51
|
+
if (!target || !frame)
|
|
52
|
+
return;
|
|
53
|
+
const active = frame.ownerDocument.activeElement;
|
|
54
|
+
if (active && active !== frame.ownerDocument.body && !frame.contains(active))
|
|
55
|
+
return;
|
|
56
|
+
frame.querySelector(target)?.focus();
|
|
57
|
+
}, [buildMode, frameRef]);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=use-build-mode-focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-build-mode-focus.js","sourceRoot":"","sources":["../../src/app/use-build-mode-focus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAA;AAEzD,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAA;AACjE,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,yBAAyB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAiB,EAAE,OAAgB;IACtE,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,IAAI,CAAA;IACrC,OAAO,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,CAAA;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAAkB;IACxD,OAAO,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAwB,MAAqB;IAC1E,MAAM,GAAG,GAAG,MAAM,CAAI,IAAI,CAAC,CAAA;IAC3B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM;YAAE,GAAG,CAAC,OAAO,EAAE,aAAa,CAAc,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IACtE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IACZ,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAkB,EAClB,QAAuC;IAEvC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;IAClC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;QAChE,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAA;QAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK;YAAE,OAAM;QAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAA;QAChD,IAAI,MAAM,IAAI,MAAM,KAAK,KAAK,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAM;QACpF,KAAK,CAAC,aAAa,CAAc,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IACnD,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import type { ViewMessages } from "../locale/toolkit-messages.js";
|
|
3
|
+
import { type ViewData } from "./mcp-app-view-chrome.js";
|
|
4
|
+
/**
|
|
5
|
+
* The toolbar actions of `McpAppView`: refresh and the fullscreen toggle.
|
|
6
|
+
* Their failures raise a toast in catalog words; the raw reason goes to the
|
|
7
|
+
* console, never to the user.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Refresh via the refresh tool. A failure keeps the data and says so in a
|
|
11
|
+
* toast. A refresh that went through invalidates the queries of `client`,
|
|
12
|
+
* the one the view's widgets fetch through.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useViewRefresh(options: {
|
|
15
|
+
viewData: ViewData | null;
|
|
16
|
+
setViewData: (next: ViewData) => void;
|
|
17
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
18
|
+
refreshToolName: string;
|
|
19
|
+
labels: Pick<ViewMessages, "refreshFailed" | "refreshFailedHint">;
|
|
20
|
+
client: QueryClient;
|
|
21
|
+
}): {
|
|
22
|
+
isRefreshing: boolean;
|
|
23
|
+
refreshView: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
/** The fullscreen toggle, gated on the host's offer; a rejected request raises a toast. */
|
|
26
|
+
export declare function useFullscreenToggle(labels: Pick<ViewMessages, "fullscreenFailed" | "fullscreenFailedHint">): {
|
|
27
|
+
isFullscreen: boolean;
|
|
28
|
+
canFullscreen: boolean;
|
|
29
|
+
toggle: () => Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=use-view-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-view-actions.d.ts","sourceRoot":"","sources":["../../src/app/use-view-actions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAA2C,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAGjG;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,mBAAmB,CAAC,CAAA;IACjE,MAAM,EAAE,WAAW,CAAA;CACpB;;;EAmCA;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,sBAAsB,CAAC;;;;EAuBxE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { useDisplayMode } from "mcp-use/react";
|
|
3
|
+
import { useToast } from "../components/Toast.js";
|
|
4
|
+
import { fullscreenAvailable, isCompleteViewData } from "./mcp-app-view-chrome.js";
|
|
5
|
+
import { decodeViewResult } from "./view-lifecycle.js";
|
|
6
|
+
/**
|
|
7
|
+
* The toolbar actions of `McpAppView`: refresh and the fullscreen toggle.
|
|
8
|
+
* Their failures raise a toast in catalog words; the raw reason goes to the
|
|
9
|
+
* console, never to the user.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Refresh via the refresh tool. A failure keeps the data and says so in a
|
|
13
|
+
* toast. A refresh that went through invalidates the queries of `client`,
|
|
14
|
+
* the one the view's widgets fetch through.
|
|
15
|
+
*/
|
|
16
|
+
export function useViewRefresh(options) {
|
|
17
|
+
const { viewData, setViewData, callTool, refreshToolName, labels, client } = options;
|
|
18
|
+
const toast = useToast();
|
|
19
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
20
|
+
const refreshView = useCallback(async () => {
|
|
21
|
+
if (!viewData?._refreshParams)
|
|
22
|
+
return;
|
|
23
|
+
setIsRefreshing(true);
|
|
24
|
+
let failure = null;
|
|
25
|
+
try {
|
|
26
|
+
const result = await callTool(refreshToolName, viewData._refreshParams);
|
|
27
|
+
// One decoding convention with `useToolQuery` (structured-first), with a
|
|
28
|
+
// typed outcome: an unusable payload is a failure, never exception text.
|
|
29
|
+
const outcome = decodeViewResult(result, isCompleteViewData);
|
|
30
|
+
if (outcome.ok)
|
|
31
|
+
setViewData(outcome.data);
|
|
32
|
+
else
|
|
33
|
+
failure = outcome.reason ?? "the refresh tool returned no view";
|
|
34
|
+
// The call went through, so self-fetching widgets refresh as well;
|
|
35
|
+
// a tool error refreshes nothing.
|
|
36
|
+
if (outcome.ok || !outcome.isError)
|
|
37
|
+
void client.invalidateQueries();
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
failure = e;
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
setIsRefreshing(false);
|
|
44
|
+
}
|
|
45
|
+
if (failure === null)
|
|
46
|
+
return;
|
|
47
|
+
console.warn("[mcp-toolkit] refresh failed:", failure);
|
|
48
|
+
toast.show({
|
|
49
|
+
tone: "danger",
|
|
50
|
+
title: labels.refreshFailed,
|
|
51
|
+
description: labels.refreshFailedHint,
|
|
52
|
+
});
|
|
53
|
+
}, [callTool, client, labels, refreshToolName, setViewData, toast, viewData]);
|
|
54
|
+
return { isRefreshing, refreshView };
|
|
55
|
+
}
|
|
56
|
+
/** The fullscreen toggle, gated on the host's offer; a rejected request raises a toast. */
|
|
57
|
+
export function useFullscreenToggle(labels) {
|
|
58
|
+
const { displayMode, availableDisplayModes, requestDisplayMode } = useDisplayMode();
|
|
59
|
+
const toast = useToast();
|
|
60
|
+
const toggle = useCallback(async () => {
|
|
61
|
+
const mode = displayMode === "fullscreen" ? "inline" : "fullscreen";
|
|
62
|
+
try {
|
|
63
|
+
// Advisory since 2.x: `displayMode` updates when the host applies it.
|
|
64
|
+
await requestDisplayMode({ mode });
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
console.warn("[mcp-toolkit] display-mode request failed:", e);
|
|
68
|
+
toast.show({
|
|
69
|
+
tone: "danger",
|
|
70
|
+
title: labels.fullscreenFailed,
|
|
71
|
+
description: labels.fullscreenFailedHint,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, [displayMode, labels, requestDisplayMode, toast]);
|
|
75
|
+
return {
|
|
76
|
+
isFullscreen: displayMode === "fullscreen",
|
|
77
|
+
canFullscreen: fullscreenAvailable(displayMode, availableDisplayModes),
|
|
78
|
+
toggle,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=use-view-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-view-actions.js","sourceRoot":"","sources":["../../src/app/use-view-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAiB,MAAM,0BAA0B,CAAA;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAO9B;IACC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IACpF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACzC,IAAI,CAAC,QAAQ,EAAE,cAAc;YAAE,OAAM;QACrC,eA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AE,GAAG,cAAc,EAAE,CAAA;IACnF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAA;QACnE,IAAI,CAAC;YACH,sEAAsE;YACtE,MAAM,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;QACpC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,4CAA4C,EAAE,CAAC,CAAC,CAAA;YAC7D,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,MAAM,CAAC,gBAAgB;gBAC9B,WAAW,EAAE,MAAM,CAAC,oBAAoB;aACzC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAC,CAAA;IACpD,OAAO;QACL,YAAY,EAAE,WAAW,KAAK,YAAY;QAC1C,aAAa,EAAE,mBAAmB,CAAC,WAAW,EAAE,qBAAqB,CAAC;QACtE,MAAM;KACP,CAAA;AACH,CAAC"}
|
|
@@ -6,6 +6,10 @@ export interface UseViewLifecycleOptions<T> {
|
|
|
6
6
|
cancelled: boolean;
|
|
7
7
|
callError: unknown;
|
|
8
8
|
recoveryFailed: boolean;
|
|
9
|
+
/** The recovery policy kept the view from re-running a stripped result's tool. */
|
|
10
|
+
recoveryBlocked?: boolean;
|
|
11
|
+
/** The host reports the originating tool as writing (no retry after a block). */
|
|
12
|
+
toolWrites?: boolean;
|
|
9
13
|
/** The originating tool (`hostContext.toolInfo`); a retry needs it. */
|
|
10
14
|
toolName: string | undefined;
|
|
11
15
|
toolInput: Record<string, unknown> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-view-lifecycle.d.ts","sourceRoot":"","sources":["../../src/app/use-view-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5F,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,gBAAgB,CAAA;IAC5B,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,CAAA;IACrD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAA;IACvC,kDAAkD;IAClD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG;IACxE,SAAS,EAAE,aAAa,CAAA;IACxB,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB,
|
|
1
|
+
{"version":3,"file":"use-view-lifecycle.d.ts","sourceRoot":"","sources":["../../src/app/use-view-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5F,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,aAAa,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options) {
|
|
|
15
15
|
cancelled: options.cancelled,
|
|
16
16
|
callErrorReason: errorMessage(options.callError),
|
|
17
17
|
recoveryFailed: options.recoveryFailed,
|
|
18
|
+
recoveryBlocked: options.recoveryBlocked,
|
|
19
|
+
toolWrites: options.toolWrites,
|
|
18
20
|
retryState,
|
|
19
21
|
slow: false,
|
|
20
22
|
canRetry: toolName !== undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-view-lifecycle.js","sourceRoot":"","sources":["../../src/app/use-view-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAC5F,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,YAAY,GAGb,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-view-lifecycle.js","sourceRoot":"","sources":["../../src/app/use-view-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAC5F,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,YAAY,GAGb,MAAM,qBAAqB,CAAA;AAsB5B;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAI,OAAmC;IAIrE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAA;IACrF,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;IACnE,wEAAwE;IACxE,MAAM,CAAC,QAAQ,EAAE,WAAW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