@mcp-b/react-components 0.16.1 → 0.18.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/dist/{AgentActivity-BNUNrP9O.d.ts → AgentActivity-D2SHSGFX.d.ts} +1 -1
- package/dist/{AgentChat-CrlpbvQJ.d.ts → AgentChat-ClxViuUM.d.ts} +4 -29
- package/dist/AgentMessageParts-CyD2UB3V.d.ts +46 -0
- package/dist/AgentToolRunsContext-BVe4stgw.d.ts +21 -0
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-BmB4Xaqq.js → CodeBlock-Bfp5PAg3.js} +9 -6
- package/dist/{CodeBlock-BRajW4QU.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/Collapsible-N64ASIQr.d.ts +119 -0
- package/dist/{Combobox-B9Fcd6q-.d.ts → Combobox-CYc37s5l.d.ts} +11 -33
- package/dist/{FileTree-CkVbIMWV.js → FileTree-3zYtrddG.js} +46 -20
- package/dist/{Menu-Bgu-ufb5.d.ts → Menu-L6MZm-7N.d.ts} +15 -56
- package/dist/{Message-BkMdE3bS.js → Message-BXtmfc9Q.js} +13 -20
- package/dist/{ModelSelector-SlJNgwKY.js → ModelSelector-Cqw_qrUG.js} +18 -25
- package/dist/{PromptInput-BWTuXMOD.d.ts → PromptInput-Bdh9pqlo.d.ts} +41 -71
- package/dist/{ResponsiveSidebarShell-Dd9DCcBT.d.ts → ResponsiveSidebarShell-CsAh4NyL.d.ts} +1 -0
- package/dist/{Select-BeEsefzh.d.ts → Select-B_13gg_J.d.ts} +16 -44
- package/dist/{Tabs-3Zc4tb9D.d.ts → Tabs-ColWK-XA.d.ts} +14 -20
- package/dist/{ThinkChat-CzC-zNGA.js → ThinkChat-15EhfvYJ.js} +123 -73
- package/dist/{ThinkChatActivity-BFQnb2ct.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +9 -4
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- package/dist/{ThinkChatContext-C3Eb1Xpi.d.ts → ThinkChatContext-DrsZqdaO.d.ts} +1 -1
- package/dist/ThinkRecoveryNotice-DFIcG9UX.d.ts +19 -0
- package/dist/{Toggle-CAAlNl-M.d.ts → Toggle-JKZ43D5S.d.ts} +2 -2
- package/dist/{ToggleGroup-8hPv-b69.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +4 -5
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/WorkspaceExplorer-B9dQWNVK.d.ts +32 -0
- package/dist/{WorkspaceFile-DOZkPwzu.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-rSN_yT0L.js → WorkspaceFileView-C68Ub8S8.js} +121 -128
- package/dist/{WorkspaceLink-DIPbXrUM.js → WorkspaceLink-BYYeTQLf.js} +20 -55
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/class-names-BiMDVpUo.js +14 -0
- package/dist/components/Accordion.d.ts +5 -15
- package/dist/components/Accordion.js +16 -10
- package/dist/components/Activity.d.ts +5 -10
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.d.ts +1 -1
- package/dist/components/AgentActivity.js +4 -5
- package/dist/components/AgentActivityPreview.d.ts +9 -9
- package/dist/components/AgentActivityPreview.js +8 -12
- package/dist/components/AgentAttention.d.ts +2 -2
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +113 -218
- package/dist/components/AgentChatMessageEditor.js +3 -3
- package/dist/components/AgentChatTurnError.js +2 -2
- package/dist/components/AgentConnection.js +4 -4
- package/dist/components/AgentMessageParts.d.ts +2 -0
- package/dist/components/AgentMessageParts.js +119 -0
- package/dist/components/AgentToolDetail.d.ts +57 -0
- package/dist/components/AgentToolDetail.js +100 -0
- package/dist/components/AgentToolRunsContext.d.ts +2 -0
- package/dist/components/AgentToolRunsContext.js +16 -0
- package/dist/components/AlertDialog.d.ts +7 -19
- package/dist/components/AlertDialog.js +21 -32
- package/dist/components/AppTopBar.d.ts +28 -8
- package/dist/components/AppTopBar.js +36 -12
- package/dist/components/Approval.d.ts +102 -0
- package/dist/components/Approval.js +227 -0
- package/dist/components/Artifact.d.ts +3 -5
- package/dist/components/Artifact.js +7 -5
- package/dist/components/Autocomplete.d.ts +11 -33
- package/dist/components/Autocomplete.js +23 -30
- package/dist/components/Avatar.d.ts +4 -12
- package/dist/components/Avatar.js +13 -12
- package/dist/components/Badge.js +3 -0
- package/dist/components/BrowserLiveView.js +27 -12
- package/dist/components/BrowserReplay.js +4 -3
- package/dist/components/BrowserRunPanel.js +58 -78
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -16
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +5 -11
- package/dist/components/ChainOfThought.js +3 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- package/dist/components/Checkbox.d.ts +2 -4
- package/dist/components/Checkbox.js +6 -5
- package/dist/components/CheckboxGroup.d.ts +1 -3
- package/dist/components/CheckboxGroup.js +15 -14
- package/dist/components/Checkpoint.d.ts +64 -0
- package/dist/components/Checkpoint.js +63 -0
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.d.ts +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.d.ts +1 -124
- package/dist/components/Collapsible.js +7 -10
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +23 -30
- package/dist/components/Commit.d.ts +5 -11
- package/dist/components/Commit.js +6 -5
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.d.ts +21 -37
- package/dist/components/ContextMenu.js +34 -51
- package/dist/components/Conversation.d.ts +3 -5
- package/dist/components/Conversation.js +5 -4
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.d.ts +6 -17
- package/dist/components/Dialog.js +17 -24
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +4 -3
- package/dist/components/Field.d.ts +17 -20
- package/dist/components/Field.js +20 -17
- package/dist/components/Fieldset.d.ts +2 -7
- package/dist/components/Fieldset.js +7 -6
- package/dist/components/FileTree.d.ts +6 -0
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.d.ts +1 -4
- package/dist/components/Form.js +3 -2
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/IconButton.d.ts +2 -3
- package/dist/components/IconButton.js +2 -1
- package/dist/components/InlineCitation.d.ts +66 -0
- package/dist/components/InlineCitation.js +142 -0
- package/dist/components/Input.d.ts +1 -4
- package/dist/components/Input.js +3 -2
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.d.ts +1 -1
- package/dist/components/McpServerPicker.js +6 -5
- package/dist/components/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- package/dist/components/Menu.d.ts +1 -1
- package/dist/components/Menu.js +33 -52
- package/dist/components/Menubar.d.ts +22 -43
- package/dist/components/Menubar.js +36 -53
- package/dist/components/Message.d.ts +7 -7
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +2 -2
- package/dist/components/MessageScroller.js +6 -5
- package/dist/components/Meter.d.ts +5 -20
- package/dist/components/Meter.js +11 -10
- package/dist/components/ModelSelector.d.ts +6 -9
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.d.ts +11 -33
- package/dist/components/NavigationMenu.js +23 -30
- package/dist/components/NumberField.d.ts +6 -24
- package/dist/components/NumberField.js +13 -12
- package/dist/components/Plan.d.ts +103 -0
- package/dist/components/Plan.js +113 -0
- package/dist/components/Popover.d.ts +9 -36
- package/dist/components/Popover.js +23 -34
- package/dist/components/PreviewCard.d.ts +6 -24
- package/dist/components/PreviewCard.js +13 -24
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPage.js +2 -1
- package/dist/components/PricingPlanCard.js +5 -4
- package/dist/components/PricingUsageCalculator.js +3 -3
- package/dist/components/Progress.d.ts +3 -8
- package/dist/components/Progress.js +7 -10
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +83 -218
- package/dist/components/Queue.d.ts +7 -17
- package/dist/components/Queue.js +2 -3
- package/dist/components/RadioGroup.d.ts +3 -8
- package/dist/components/RadioGroup.js +7 -10
- package/dist/components/Reasoning.d.ts +4 -8
- package/dist/components/Reasoning.js +3 -6
- package/dist/components/ResizableSidePanel.js +2 -2
- package/dist/components/ResponsiveSidebarShell.d.ts +1 -1
- package/dist/components/ResponsiveSidebarShell.js +18 -11
- package/dist/components/ScrollArea.d.ts +5 -20
- package/dist/components/ScrollArea.js +12 -10
- package/dist/components/SearchField.d.ts +43 -0
- package/dist/components/SearchField.js +52 -0
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +33 -57
- package/dist/components/Separator.d.ts +1 -5
- package/dist/components/Separator.js +3 -6
- package/dist/components/Slider.d.ts +6 -19
- package/dist/components/Slider.js +15 -14
- package/dist/components/Sources.d.ts +4 -9
- package/dist/components/Sources.js +3 -2
- package/dist/components/Stepper.js +16 -9
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.d.ts +3 -5
- package/dist/components/SubagentRunList.js +3 -5
- package/dist/components/SubagentRunSelector.d.ts +9 -22
- package/dist/components/SubagentRunSelector.js +29 -31
- package/dist/components/Switch.d.ts +4 -7
- package/dist/components/Switch.js +6 -10
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +21 -18
- package/dist/components/Task.d.ts +4 -9
- package/dist/components/Task.js +4 -3
- package/dist/components/Terminal.d.ts +3 -4
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.d.ts +4 -9
- package/dist/components/TestResults.js +11 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +45 -22
- package/dist/components/ThinkChat.js +7 -5
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +24 -7
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatContext.d.ts +1 -1
- package/dist/components/ThinkChatToolPanels.js +27 -17
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
- package/dist/components/ThinkExecutionWorkbench.js +70 -134
- package/dist/components/ThinkFullApp.d.ts +40 -15
- package/dist/components/ThinkFullApp.js +193 -117
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +2 -2
- package/dist/components/ThinkPendingApproval.d.ts +60 -0
- package/dist/components/ThinkPendingApproval.js +99 -0
- package/dist/components/ThinkRecoveryNotice.d.ts +2 -0
- package/dist/components/ThinkRecoveryNotice.js +46 -0
- package/dist/components/ThinkRoutine.js +1 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +37 -44
- package/dist/components/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/ThinkRoutineDetail.js +4 -4
- package/dist/components/ThinkRoutineForm.d.ts +3 -2
- package/dist/components/ThinkRoutineForm.js +11 -10
- package/dist/components/ThinkRoutineLibrary.d.ts +27 -25
- package/dist/components/ThinkRoutineLibrary.js +104 -80
- package/dist/components/ThinkRoutineRuns.d.ts +3 -2
- package/dist/components/ThinkRoutineRuns.js +31 -24
- package/dist/components/ThinkThreadPicker.d.ts +17 -11
- package/dist/components/ThinkThreadPicker.js +163 -39
- package/dist/components/ThinkThreadShell.d.ts +1 -1
- package/dist/components/Toast.d.ts +7 -28
- package/dist/components/Toast.js +15 -14
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +10 -8
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +21 -26
- package/dist/components/ToolApproval.d.ts +28 -0
- package/dist/components/ToolApproval.js +35 -0
- package/dist/components/ToolInvocation.d.ts +26 -0
- package/dist/components/ToolInvocation.js +72 -0
- package/dist/components/Toolbar.d.ts +6 -24
- package/dist/components/Toolbar.js +13 -12
- package/dist/components/Tooltip.d.ts +11 -10
- package/dist/components/Tooltip.js +17 -11
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +6 -7
- package/dist/components/WebPreview.js +70 -55
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +361 -346
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +16 -26
- package/dist/components/WorkspaceExplorer.d.ts +5 -33
- package/dist/components/WorkspaceExplorer.js +19 -32
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +14 -2
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.d.ts +0 -8
- package/dist/components/WorkspaceHeader.js +3 -15
- package/dist/components/WorkspaceLink.d.ts +1 -1
- package/dist/components/WorkspaceLink.js +1 -1
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DtPMgN7e.d.ts → copy-button-D7aAYA-2.d.ts} +2 -3
- package/dist/{copy-button-Dejn5heL.js → copy-button-DeK6KXEV.js} +3 -2
- package/dist/{icons-CpfUer49.js → icons-CQJ-aMnI.js} +7 -3
- package/dist/{icons-GQd1xF4e.d.ts → icons-CYXmvKlJ.d.ts} +22 -2
- package/dist/navigation-link-Cob7KBlM.js +19 -0
- package/dist/styles/accordion.css +4 -19
- package/dist/styles/activity.css +48 -56
- package/dist/styles/agent-activity-preview.css +6 -0
- package/dist/styles/agent-chat.css +14 -63
- package/dist/styles/agent-connection.css +0 -12
- package/dist/styles/agent-tool-detail.css +54 -0
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +177 -0
- package/dist/styles/artifact.css +6 -18
- package/dist/styles/autocomplete.css +2 -1
- package/dist/styles/avatar.css +35 -30
- package/dist/styles/badge.css +10 -10
- package/dist/styles/base-ui-motion.css +94 -39
- package/dist/styles/browser-control-overlay.css +0 -1
- package/dist/styles/browser-live-view.css +39 -22
- package/dist/styles/browser-replay.css +1 -1
- package/dist/styles/browser-run-panel.css +13 -6
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -24
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/checkpoint.css +58 -0
- package/dist/styles/codex-model-selector.css +3 -7
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +4 -3
- package/dist/styles/commit.css +19 -39
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -11
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/environment-variables.css +0 -13
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +66 -22
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +13 -4
- package/dist/styles/inline-citation.css +107 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -47
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -40
- package/dist/styles/menubar.css +12 -19
- package/dist/styles/message-scroller.css +0 -12
- package/dist/styles/message.css +25 -31
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -34
- package/dist/styles/motion-reduction.css +29 -0
- package/dist/styles/navigation-menu.css +14 -30
- package/dist/styles/number-field.css +22 -4
- package/dist/styles/plan.css +132 -0
- package/dist/styles/popover.css +15 -52
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +76 -269
- package/dist/styles/queue.css +48 -32
- package/dist/styles/radio.css +19 -12
- package/dist/styles/reasoning.css +2 -1
- package/dist/styles/recipes.css +207 -26
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +32 -34
- package/dist/styles/scroll-area.css +32 -15
- package/dist/styles/search-field.css +21 -0
- package/dist/styles/select.css +19 -12
- package/dist/styles/slider.css +25 -29
- package/dist/styles/sources.css +3 -11
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +13 -71
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +11 -23
- package/dist/styles/test-results.css +29 -36
- package/dist/styles/theme-mode-control.css +8 -0
- package/dist/styles/think-execution-workbench.css +18 -15
- package/dist/styles/think-full-app.css +51 -100
- package/dist/styles/think-routine-library.css +51 -40
- package/dist/styles/think-thread-picker.css +207 -50
- package/dist/styles/toast.css +48 -34
- package/dist/styles/toggle-group.css +2 -36
- package/dist/styles/toggle.css +29 -5
- package/dist/styles/toolbar.css +25 -27
- package/dist/styles/tooltip.css +2 -32
- package/dist/styles/transition-surface.css +55 -0
- package/dist/styles/utilities.css +31 -0
- package/dist/styles/web-preview.css +0 -21
- package/dist/styles/workspace-explorer.css +104 -99
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- package/dist/think-agent-Cip5KAPj.d.ts +7 -0
- package/dist/utils/codex-model-catalog.d.ts +4 -4
- package/dist/utils/mcp-server-catalog.d.ts +132 -0
- package/dist/utils/mcp-server-catalog.js +90 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/workspace-path-L_KmjRjq.js +26 -0
- package/package.json +14 -9
- package/dist/Workspace-D39LxGvP.d.ts +0 -62
- package/dist/class-names-9UtZwb0J.js +0 -12
- package/dist/components/AppFrame.d.ts +0 -24
- package/dist/components/AppFrame.js +0 -25
- package/dist/components/Shell.d.ts +0 -163
- package/dist/components/Shell.js +0 -137
- package/dist/components/SubagentRun.d.ts +0 -86
- package/dist/components/SubagentRun.js +0 -108
- package/dist/styles/app-frame.css +0 -15
- package/dist/styles/shell.css +0 -122
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -1,42 +1,119 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { Y as TerminalIcon, u as ChevronDownIcon, x as FileIcon } from "../icons-CQJ-aMnI.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
|
-
import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../WorkspaceLink-
|
|
4
|
+
import { a as WorkspaceNavigationRestorationBoundary, i as WorkspaceNavigationFocusRestorer, n as WorkspaceNavigationProvider } from "../WorkspaceLink-BYYeTQLf.js";
|
|
5
5
|
import { n as mergeRefs } from "../merge-refs-DF_7w2x_.js";
|
|
6
6
|
import { AppTopBar } from "./AppTopBar.js";
|
|
7
|
-
import {
|
|
8
|
-
import { o as useThinkPendingApprovals, s as resolveThinkApprovalProps, t as ThinkChat } from "../ThinkChat-CzC-zNGA.js";
|
|
7
|
+
import { c as resolveThinkApprovalProps, s as useThinkPendingExecutionApprovals, t as ThinkChat } from "../ThinkChat-15EhfvYJ.js";
|
|
9
8
|
import { useWorkspace } from "./Workspace.js";
|
|
10
9
|
import { WorkspaceExplorer } from "./WorkspaceExplorer.js";
|
|
10
|
+
import { ResizableSidePanel } from "./ResizableSidePanel.js";
|
|
11
11
|
import { ThinkExecutionWorkbench } from "./ThinkExecutionWorkbench.js";
|
|
12
12
|
import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
|
|
13
13
|
import { ThinkThreadStatusIndicators } from "./ThinkThreadPicker.js";
|
|
14
14
|
import { ThinkThreadShell } from "./ThinkThreadShell.js";
|
|
15
15
|
import * as React from "react";
|
|
16
|
-
import {
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useAgentToolEvents } from "agents/react";
|
|
18
|
+
import { flushSync } from "react-dom";
|
|
19
|
+
//#region src/components/_internal/view-transitions.ts
|
|
20
|
+
let documentScopeSequence = 0;
|
|
21
|
+
let restoreActiveDocumentScope = null;
|
|
22
|
+
function motionIsReduced() {
|
|
23
|
+
if (typeof document === "undefined") return true;
|
|
24
|
+
if (document.documentElement.dataset.motion === "reduce") return true;
|
|
25
|
+
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
26
|
+
}
|
|
27
|
+
function isReactTestEnvironment() {
|
|
28
|
+
return globalThis.IS_REACT_ACT_ENVIRONMENT;
|
|
29
|
+
}
|
|
30
|
+
function scopeDocumentTransition(scope) {
|
|
31
|
+
if (!(scope instanceof HTMLElement || scope instanceof SVGElement)) return null;
|
|
32
|
+
restoreActiveDocumentScope?.();
|
|
33
|
+
const rootStyle = document.documentElement.style;
|
|
34
|
+
const scopeStyle = scope.style;
|
|
35
|
+
const rootValue = rootStyle.getPropertyValue("view-transition-name");
|
|
36
|
+
const rootPriority = rootStyle.getPropertyPriority("view-transition-name");
|
|
37
|
+
const scopeValue = scopeStyle.getPropertyValue("view-transition-name");
|
|
38
|
+
const scopePriority = scopeStyle.getPropertyPriority("view-transition-name");
|
|
39
|
+
rootStyle.setProperty("view-transition-name", "none", "important");
|
|
40
|
+
scopeStyle.setProperty("view-transition-name", `sigvelo-transition-scope-${++documentScopeSequence}`, "important");
|
|
41
|
+
let active = true;
|
|
42
|
+
const restore = () => {
|
|
43
|
+
if (!active) return;
|
|
44
|
+
active = false;
|
|
45
|
+
if (rootValue) rootStyle.setProperty("view-transition-name", rootValue, rootPriority);
|
|
46
|
+
else rootStyle.removeProperty("view-transition-name");
|
|
47
|
+
if (scopeValue) scopeStyle.setProperty("view-transition-name", scopeValue, scopePriority);
|
|
48
|
+
else scopeStyle.removeProperty("view-transition-name");
|
|
49
|
+
if (restoreActiveDocumentScope === restore) restoreActiveDocumentScope = null;
|
|
50
|
+
};
|
|
51
|
+
restoreActiveDocumentScope = restore;
|
|
52
|
+
return restore;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Runs one synchronous React update inside the narrowest supported native view
|
|
56
|
+
* transition. Unsupported and reduced-motion environments commit immediately.
|
|
57
|
+
*/
|
|
58
|
+
function runViewTransition({ scope, update }) {
|
|
59
|
+
let committed = false;
|
|
60
|
+
const commitOnce = () => {
|
|
61
|
+
if (committed) return;
|
|
62
|
+
committed = true;
|
|
63
|
+
flushSync(update);
|
|
64
|
+
};
|
|
65
|
+
if (typeof document === "undefined" || motionIsReduced() || isReactTestEnvironment()) {
|
|
66
|
+
commitOnce();
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const scopedHost = scope;
|
|
70
|
+
const documentHost = document;
|
|
71
|
+
const useScopedHost = typeof scopedHost?.startViewTransition === "function";
|
|
72
|
+
const host = useScopedHost ? scopedHost : typeof documentHost.startViewTransition === "function" ? documentHost : null;
|
|
73
|
+
if (!host?.startViewTransition) {
|
|
74
|
+
commitOnce();
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const restoreDocumentScope = useScopedHost ? null : scopeDocumentTransition(scope);
|
|
78
|
+
try {
|
|
79
|
+
const transition = host.startViewTransition(commitOnce);
|
|
80
|
+
if (restoreDocumentScope) transition.finished.finally(restoreDocumentScope).catch(() => void 0);
|
|
81
|
+
return transition;
|
|
82
|
+
} catch {
|
|
83
|
+
restoreDocumentScope?.();
|
|
84
|
+
commitOnce();
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
17
89
|
//#region src/components/ThinkFullApp.tsx
|
|
18
90
|
const workbenchPanelDefaultWidth = 340;
|
|
19
91
|
const workbenchPanelMinWidth = 300;
|
|
20
92
|
const workbenchPanelMaxWidth = 600;
|
|
21
93
|
const workbenchPanelKeyboardStep = 24;
|
|
22
|
-
function WorkspacePanel({ config
|
|
94
|
+
function WorkspacePanel({ config }) {
|
|
95
|
+
const selectedPath = config.navigation.current.destination.kind === "file" ? config.navigation.current.destination.path : null;
|
|
23
96
|
return /* @__PURE__ */ jsx(WorkspaceExplorer, {
|
|
24
97
|
className: "think-full-app__workbench",
|
|
25
98
|
workspace: useWorkspace({
|
|
26
99
|
source: config.source,
|
|
100
|
+
sourceKey: config.sourceKey,
|
|
27
101
|
root: config.root,
|
|
102
|
+
selectedPath,
|
|
28
103
|
resolveFileAsset: config.resolveFileAsset,
|
|
29
104
|
maxInlineAssetBytes: config.maxInlineAssetBytes
|
|
30
105
|
}),
|
|
31
106
|
navigation: config.navigation,
|
|
32
|
-
leading:
|
|
107
|
+
leading: config.leading,
|
|
33
108
|
actions: config.actions
|
|
34
109
|
});
|
|
35
110
|
}
|
|
36
111
|
/** Combines ThinkChat with an optional resizable workbench shell. */
|
|
37
|
-
function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat, className, defaultMobileView, defaultWorkbenchView, defaultThreadSidebarOpen, messages, mobileView, onMobileViewChange,
|
|
112
|
+
function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat, className, defaultMobileView, defaultWorkbenchView, defaultThreadSidebarOpen, hideAppBarInWorkbench = false, messages, mobileView, onMobileViewChange, onThreadSidebarOpenChange, onWorkbenchViewChange, ref, renderAgentToolRunLink, renderExecutionRunLink, selectedExecutionRun, showAgentTools = true, showExecutionWorkbench = true, showMobileViewSwitch = true, sourceKey, style, threadSidebar, threadSidebarOpen, threadStatusSummary, workbenchPanels, workbenchView, workspace, ...props }) {
|
|
38
113
|
const appRef = React.useRef(null);
|
|
39
|
-
const
|
|
114
|
+
const viewScopeRef = React.useRef(null);
|
|
115
|
+
const workbenchPanelRef = React.useRef(null);
|
|
116
|
+
const approvals = useThinkPendingExecutionApprovals(agent.stub, sourceKey, `${chat.messages.length}:${chat.status}`);
|
|
40
117
|
const resolvedMessages = React.useMemo(() => {
|
|
41
118
|
const approvalProps = resolveThinkApprovalProps({
|
|
42
119
|
thinkStub: messages?.thinkStub,
|
|
@@ -59,6 +136,28 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
59
136
|
]);
|
|
60
137
|
const [innerMobileView, setInnerMobileView] = React.useState(defaultMobileView ?? "chat");
|
|
61
138
|
const [innerWorkbenchView, setInnerWorkbenchView] = React.useState(defaultWorkbenchView ?? "files");
|
|
139
|
+
const agentTools = useAgentToolEvents({ agent });
|
|
140
|
+
const agentIdentity = JSON.stringify(agent.path);
|
|
141
|
+
const requestedMobileView = mobileView ?? innerMobileView;
|
|
142
|
+
const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
|
|
143
|
+
const resetAgentTools = React.useEffectEvent(() => agentTools.resetLocalState());
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
resetAgentTools();
|
|
146
|
+
}, [agentIdentity]);
|
|
147
|
+
const setWorkbenchView = React.useCallback((next) => {
|
|
148
|
+
if (workbenchView === void 0) setInnerWorkbenchView(next);
|
|
149
|
+
onWorkbenchViewChange?.(next);
|
|
150
|
+
}, [onWorkbenchViewChange, workbenchView]);
|
|
151
|
+
const setMobileView = React.useCallback((next) => {
|
|
152
|
+
if (mobileView === void 0) setInnerMobileView(next);
|
|
153
|
+
onMobileViewChange?.(next);
|
|
154
|
+
}, [mobileView, onMobileViewChange]);
|
|
155
|
+
const updateAppView = React.useCallback((update) => {
|
|
156
|
+
return runViewTransition({
|
|
157
|
+
scope: viewScopeRef.current,
|
|
158
|
+
update
|
|
159
|
+
});
|
|
160
|
+
}, []);
|
|
62
161
|
const panelContext = React.useMemo(() => ({
|
|
63
162
|
agent,
|
|
64
163
|
chat,
|
|
@@ -68,68 +167,53 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
68
167
|
chat,
|
|
69
168
|
workspace
|
|
70
169
|
]);
|
|
71
|
-
const availableWorkbenchPanels =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, [
|
|
92
|
-
onSelectedExecutionRunChange,
|
|
93
|
-
selectedExecutionRun,
|
|
94
|
-
showExecutionWorkbench,
|
|
95
|
-
workbenchPanels,
|
|
96
|
-
workspace
|
|
97
|
-
]);
|
|
98
|
-
const requestedMobileView = mobileView ?? innerMobileView;
|
|
99
|
-
const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
|
|
170
|
+
const availableWorkbenchPanels = [];
|
|
171
|
+
if (workspace !== void 0) availableWorkbenchPanels.push({
|
|
172
|
+
id: "files",
|
|
173
|
+
label: "Files",
|
|
174
|
+
icon: /* @__PURE__ */ jsx(FileIcon, {}),
|
|
175
|
+
render: () => /* @__PURE__ */ jsx(WorkspacePanel, { config: workspace })
|
|
176
|
+
});
|
|
177
|
+
if (showExecutionWorkbench) availableWorkbenchPanels.push({
|
|
178
|
+
id: "execution",
|
|
179
|
+
label: "Execution",
|
|
180
|
+
icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
|
|
181
|
+
render: ({ agent }) => /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
|
|
182
|
+
source: agent.stub,
|
|
183
|
+
sourceKey,
|
|
184
|
+
title: "Execution",
|
|
185
|
+
selectedRun: selectedExecutionRun,
|
|
186
|
+
renderRunLink: renderExecutionRunLink
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
if (workbenchPanels) availableWorkbenchPanels.push(...workbenchPanels);
|
|
100
190
|
const activePanel = availableWorkbenchPanels.find((panel) => panel.id === requestedWorkbenchView) ?? availableWorkbenchPanels[0];
|
|
101
191
|
const activeWorkbenchView = activePanel?.id;
|
|
102
192
|
const hasWorkbench = activePanel !== void 0;
|
|
103
193
|
const activeMobileView = hasWorkbench ? requestedMobileView : "chat";
|
|
104
194
|
const showWorkbenchViewSwitch = availableWorkbenchPanels.length > 1;
|
|
105
195
|
const workbenchViews = availableWorkbenchPanels;
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
onValueChange: (next) => {
|
|
124
|
-
if (next) setWorkbenchView(next);
|
|
125
|
-
},
|
|
126
|
-
"aria-label": "Workbench views"
|
|
127
|
-
}) : null;
|
|
196
|
+
const shouldRenderInlineAppBar = !threadSidebar && (Boolean(appBarActions || appBarLeading || appBarTitle || threadSidebar) || hasWorkbench);
|
|
197
|
+
const hasAppBarRow = shouldRenderInlineAppBar;
|
|
198
|
+
const updateWorkbenchPanel = (next) => {
|
|
199
|
+
const activeElement = document.activeElement;
|
|
200
|
+
const restorePanelSwitchFocus = activeElement instanceof HTMLElement && workbenchPanelRef.current?.contains(activeElement);
|
|
201
|
+
const nextLabel = availableWorkbenchPanels.find((panel) => panel.id === next)?.label;
|
|
202
|
+
const restoreFocus = () => {
|
|
203
|
+
if (!restorePanelSwitchFocus || !nextLabel) return;
|
|
204
|
+
Array.from(workbenchPanelRef.current?.querySelectorAll("button") ?? []).find((button) => button.getAttribute("aria-label") === nextLabel)?.focus({ preventScroll: true });
|
|
205
|
+
};
|
|
206
|
+
const transition = runViewTransition({
|
|
207
|
+
scope: workbenchPanelRef.current,
|
|
208
|
+
update: () => setWorkbenchView(next)
|
|
209
|
+
});
|
|
210
|
+
if (transition) transition.updateCallbackDone.then(restoreFocus, restoreFocus);
|
|
211
|
+
else requestAnimationFrame(restoreFocus);
|
|
212
|
+
};
|
|
128
213
|
const renderAppTopBar = (sidebarControls) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
129
214
|
className: "think-full-app__app-bar",
|
|
130
215
|
"aria-label": "Workbench controls",
|
|
131
216
|
"data-mobile-view": activeMobileView,
|
|
132
|
-
"data-compact-only": hasCompactAppBar ? "true" : void 0,
|
|
133
217
|
children: [
|
|
134
218
|
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [sidebarControls?.sidebarToggle, appBarLeading] }),
|
|
135
219
|
appBarTitle || sidebarControls ? /* @__PURE__ */ jsxs(AppTopBar.Title, { children: [appBarTitle ? /* @__PURE__ */ jsx("span", {
|
|
@@ -141,6 +225,7 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
141
225
|
color: "neutral",
|
|
142
226
|
size: "sm",
|
|
143
227
|
className: "think-full-app__thread-trigger",
|
|
228
|
+
"aria-label": "Threads",
|
|
144
229
|
"aria-controls": sidebarControls.sidebarId,
|
|
145
230
|
"aria-expanded": sidebarControls.sidebarOpen,
|
|
146
231
|
onClick: (event) => sidebarControls.toggleSidebar(event.currentTarget),
|
|
@@ -155,27 +240,29 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
155
240
|
}) : null] }) : null,
|
|
156
241
|
/* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [
|
|
157
242
|
appBarActions,
|
|
158
|
-
showWorkbenchViewSwitch && activeWorkbenchView
|
|
243
|
+
showWorkbenchViewSwitch && activeWorkbenchView ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
159
244
|
className: "think-full-app__workbench-view-switch",
|
|
160
245
|
views: workbenchViews,
|
|
161
246
|
value: activeWorkbenchView,
|
|
162
247
|
onValueChange: (next) => {
|
|
163
|
-
if (next)
|
|
248
|
+
if (next) updateWorkbenchPanel(next);
|
|
164
249
|
},
|
|
165
250
|
"aria-label": "Workbench views"
|
|
166
251
|
}) : null,
|
|
167
|
-
activePanel ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
252
|
+
activePanel && showMobileViewSwitch ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
168
253
|
className: "think-full-app__mobile-view-switch",
|
|
169
254
|
views: workbenchViews,
|
|
170
255
|
value: activeMobileView === "workbench" ? activePanel.id : void 0,
|
|
171
256
|
allowEmpty: true,
|
|
172
257
|
onValueChange: (next) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
258
|
+
updateAppView(() => {
|
|
259
|
+
if (!next) {
|
|
260
|
+
setMobileView("chat");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
setWorkbenchView(next);
|
|
264
|
+
setMobileView("workbench");
|
|
265
|
+
});
|
|
179
266
|
},
|
|
180
267
|
"aria-label": "App views"
|
|
181
268
|
}) : null
|
|
@@ -194,60 +281,48 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
194
281
|
"data-has-thread-sidebar": threadSidebar ? "true" : "false",
|
|
195
282
|
"data-has-workbench": hasWorkbench ? "true" : "false",
|
|
196
283
|
"data-has-workbench-topbar": hasAppBarRow ? "true" : "false",
|
|
197
|
-
"data-has-compact-app-bar": hasCompactAppBar ? "true" : "false",
|
|
198
284
|
"data-mobile-view": activeMobileView,
|
|
199
285
|
style,
|
|
200
286
|
...props,
|
|
201
287
|
children: [
|
|
202
288
|
shouldRenderInlineAppBar ? renderAppTopBar() : null,
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
"
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
onClick: () => chat.clearError(),
|
|
224
|
-
children: "Dismiss"
|
|
225
|
-
})]
|
|
226
|
-
}) : null]
|
|
289
|
+
/* @__PURE__ */ jsxs("div", {
|
|
290
|
+
ref: viewScopeRef,
|
|
291
|
+
className: "think-full-app__view-scope",
|
|
292
|
+
children: [/* @__PURE__ */ jsx("section", {
|
|
293
|
+
className: "think-full-app__chat-surface",
|
|
294
|
+
"data-workspace-restoration-scope": "chat",
|
|
295
|
+
"aria-label": "Chat",
|
|
296
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
297
|
+
className: "think-full-app__chat",
|
|
298
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
299
|
+
className: "think-full-app__chat-inner",
|
|
300
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Provider, {
|
|
301
|
+
chat,
|
|
302
|
+
agentTools,
|
|
303
|
+
children: /* @__PURE__ */ jsx(ThinkChat.Messages, {
|
|
304
|
+
...resolvedMessages,
|
|
305
|
+
renderAgentToolRunLink: showAgentTools ? renderAgentToolRunLink : void 0
|
|
306
|
+
})
|
|
307
|
+
})
|
|
308
|
+
})
|
|
227
309
|
})
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
className: "think-full-app__aside",
|
|
232
|
-
"aria-label": "Workbench",
|
|
233
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
234
|
-
className: "think-full-app__workbench-slot",
|
|
310
|
+
}), activePanel ? /* @__PURE__ */ jsx("aside", {
|
|
311
|
+
className: "think-full-app__aside",
|
|
312
|
+
"aria-label": "Workbench",
|
|
235
313
|
children: /* @__PURE__ */ jsx("div", {
|
|
236
|
-
className: "think-full-app__workbench-
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
backButton: workbenchNavigation,
|
|
245
|
-
selectedRun: selectedExecutionRun,
|
|
246
|
-
onSelectedRunChange: onSelectedExecutionRunChange
|
|
247
|
-
}) : activePanel.render(panelContext)
|
|
314
|
+
className: "think-full-app__workbench-slot",
|
|
315
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
316
|
+
ref: workbenchPanelRef,
|
|
317
|
+
className: "think-full-app__workbench-panel",
|
|
318
|
+
"data-view": activeWorkbenchView,
|
|
319
|
+
tabIndex: -1,
|
|
320
|
+
children: activePanel.render(panelContext)
|
|
321
|
+
})
|
|
248
322
|
})
|
|
249
|
-
})
|
|
250
|
-
})
|
|
323
|
+
}) : null]
|
|
324
|
+
}),
|
|
325
|
+
activePanel ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "think-full-app__resizer" }) : null
|
|
251
326
|
]
|
|
252
327
|
});
|
|
253
328
|
const app = workspace ? /* @__PURE__ */ jsx(WorkspaceNavigationProvider, {
|
|
@@ -269,6 +344,7 @@ function ThinkFullApp({ agent, appBarActions, appBarLeading, appBarTitle, chat,
|
|
|
269
344
|
sidebarOpen: threadSidebarOpen,
|
|
270
345
|
defaultSidebarOpen: defaultThreadSidebarOpen,
|
|
271
346
|
onSidebarOpenChange: onThreadSidebarOpenChange,
|
|
347
|
+
"data-hide-app-bar-in-workbench": hideAppBarInWorkbench ? "" : void 0,
|
|
272
348
|
topBar: (controls) => renderAppTopBar(controls),
|
|
273
349
|
children: app
|
|
274
350
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as mergeBaseClassName } from "../class-names-BiMDVpUo.js";
|
|
2
2
|
import { AppTopBar } from "./AppTopBar.js";
|
|
3
3
|
import { ToggleGroup } from "./ToggleGroup.js";
|
|
4
4
|
import "react";
|
|
@@ -11,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
11
11
|
*/
|
|
12
12
|
function ThinkFullAppViewSwitch({ allowEmpty = false, className, onValueChange, value, views, ...props }) {
|
|
13
13
|
return /* @__PURE__ */ jsx(ToggleGroup.Root, {
|
|
14
|
-
className:
|
|
14
|
+
className: mergeBaseClassName("think-full-app__view-switch", className),
|
|
15
15
|
size: "sm",
|
|
16
16
|
value: value ? [value] : [],
|
|
17
17
|
onValueChange: (nextValue, eventDetails) => {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
3
|
+
import { PendingApproval, Think } from "@cloudflare/think";
|
|
4
|
+
import { AgentStub } from "agents/client";
|
|
5
|
+
import { ProxyToolOutput } from "@cloudflare/codemode";
|
|
6
|
+
|
|
7
|
+
//#region src/components/ThinkPendingApproval.d.ts
|
|
8
|
+
type PausedExecution = Extract<ProxyToolOutput, {
|
|
9
|
+
status: "paused";
|
|
10
|
+
}>;
|
|
11
|
+
/** Structural match for any upstream tool binding of the Codemode execute runtime. */
|
|
12
|
+
declare function getPausedExecution(part: ToolUIPart | DynamicToolUIPart): PausedExecution | undefined;
|
|
13
|
+
interface SharedThinkApprovalProps {
|
|
14
|
+
thinkStub: AgentStub<Think>;
|
|
15
|
+
onSettled?: () => void | Promise<void>;
|
|
16
|
+
onSkip?: () => void;
|
|
17
|
+
count?: number;
|
|
18
|
+
question?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
interface ThinkPendingApprovalProps extends React.HTMLAttributes<HTMLDivElement>, SharedThinkApprovalProps {
|
|
21
|
+
/** Whole entry returned by Think `pendingApprovals()`. */
|
|
22
|
+
approval: PendingApproval;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Durable Think approval adapter. It renders the complete upstream descriptor
|
|
26
|
+
* and resolves only through the full Think stub's idempotent execution RPCs.
|
|
27
|
+
*/
|
|
28
|
+
declare function ThinkPendingApproval({
|
|
29
|
+
approval,
|
|
30
|
+
className,
|
|
31
|
+
count,
|
|
32
|
+
onSettled,
|
|
33
|
+
onSkip,
|
|
34
|
+
question,
|
|
35
|
+
ref,
|
|
36
|
+
thinkStub,
|
|
37
|
+
...props
|
|
38
|
+
}: ThinkPendingApprovalProps & {
|
|
39
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
40
|
+
}): React.JSX.Element;
|
|
41
|
+
interface ThinkExecutionApprovalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "part">, SharedThinkApprovalProps {
|
|
42
|
+
/** Whole AI SDK tool part whose upstream Codemode output may be paused. */
|
|
43
|
+
part: ToolUIPart | DynamicToolUIPart;
|
|
44
|
+
}
|
|
45
|
+
/** Actionable adapter for Think's in-band paused Codemode execution output. */
|
|
46
|
+
declare function ThinkExecutionApproval({
|
|
47
|
+
className,
|
|
48
|
+
count,
|
|
49
|
+
onSettled,
|
|
50
|
+
onSkip,
|
|
51
|
+
part,
|
|
52
|
+
question,
|
|
53
|
+
ref,
|
|
54
|
+
thinkStub,
|
|
55
|
+
...props
|
|
56
|
+
}: ThinkExecutionApprovalProps & {
|
|
57
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
58
|
+
}): React.JSX.Element | null;
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ThinkExecutionApproval, ThinkExecutionApprovalProps, ThinkPendingApproval, ThinkPendingApprovalProps, getPausedExecution };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Approval, ApprovalCount, ApprovalDecision, ApprovalHeader, ApprovalInputPreview, ApprovalPreview, ApprovalPreviewRow, ApprovalQuestion, formatApprovalValue } from "./Approval.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { getToolName } from "ai";
|
|
5
|
+
import { getToolOutput } from "@cloudflare/think/react";
|
|
6
|
+
//#region src/components/ThinkPendingApproval.tsx
|
|
7
|
+
/** Structural match for any upstream tool binding of the Codemode execute runtime. */
|
|
8
|
+
function getPausedExecution(part) {
|
|
9
|
+
if (part.state !== "output-available") return void 0;
|
|
10
|
+
const output = getToolOutput(part);
|
|
11
|
+
return output?.status === "paused" && typeof output.executionId === "string" ? output : void 0;
|
|
12
|
+
}
|
|
13
|
+
function titleCase(value) {
|
|
14
|
+
return value.split("-").map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(" ");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Durable Think approval adapter. It renders the complete upstream descriptor
|
|
18
|
+
* and resolves only through the full Think stub's idempotent execution RPCs.
|
|
19
|
+
*/
|
|
20
|
+
function ThinkPendingApproval({ approval, className, count, onSettled, onSkip, question, ref, thinkStub, ...props }) {
|
|
21
|
+
const { descriptor } = approval;
|
|
22
|
+
const permissions = descriptor.permissions.length ? descriptor.permissions.join(", ") : "None requested";
|
|
23
|
+
const source = approval.source === "action" ? "Action" : "Codemode";
|
|
24
|
+
return /* @__PURE__ */ jsxs(Approval, {
|
|
25
|
+
ref,
|
|
26
|
+
className,
|
|
27
|
+
"aria-label": `Approve ${descriptor.action}`,
|
|
28
|
+
...props,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
"Do you want to allow ",
|
|
32
|
+
/* @__PURE__ */ jsx("code", { children: descriptor.summary }),
|
|
33
|
+
"?"
|
|
34
|
+
] }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
|
|
35
|
+
/* @__PURE__ */ jsxs(ApprovalPreview, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(ApprovalPreviewRow, {
|
|
37
|
+
label: "source",
|
|
38
|
+
children: source
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx(ApprovalPreviewRow, {
|
|
41
|
+
label: "kind",
|
|
42
|
+
children: titleCase(descriptor.kind)
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(ApprovalPreviewRow, {
|
|
45
|
+
label: "risk",
|
|
46
|
+
children: descriptor.risk ? titleCase(descriptor.risk) : "Not specified"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx(ApprovalPreviewRow, {
|
|
49
|
+
label: "permissions",
|
|
50
|
+
children: permissions
|
|
51
|
+
})
|
|
52
|
+
] }),
|
|
53
|
+
descriptor.input !== void 0 ? /* @__PURE__ */ jsx(ApprovalInputPreview, { input: descriptor.input }) : null,
|
|
54
|
+
/* @__PURE__ */ jsx(ApprovalDecision, {
|
|
55
|
+
subject: descriptor.summary,
|
|
56
|
+
onSkip,
|
|
57
|
+
onDecision: async ({ approved, reason }) => {
|
|
58
|
+
try {
|
|
59
|
+
await (approved ? thinkStub.approveExecution(approval.executionId) : thinkStub.rejectExecution(approval.executionId, reason));
|
|
60
|
+
} finally {
|
|
61
|
+
await onSettled?.();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, approval.executionId)
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** Actionable adapter for Think's in-band paused Codemode execution output. */
|
|
69
|
+
function ThinkExecutionApproval({ className, count, onSettled, onSkip, part, question, ref, thinkStub, ...props }) {
|
|
70
|
+
const paused = getPausedExecution(part);
|
|
71
|
+
if (!paused) return null;
|
|
72
|
+
const toolName = part.title ?? getToolName(part);
|
|
73
|
+
return /* @__PURE__ */ jsxs(Approval, {
|
|
74
|
+
ref,
|
|
75
|
+
className,
|
|
76
|
+
"aria-label": `Approve ${toolName}`,
|
|
77
|
+
...props,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsxs(ApprovalHeader, { children: [/* @__PURE__ */ jsx(ApprovalQuestion, { children: question ?? /* @__PURE__ */ jsx(Fragment, { children: "The agent's code is paused on these calls. Allow it to continue?" }) }), count && count > 1 ? /* @__PURE__ */ jsxs(ApprovalCount, { children: ["1 of ", count] }) : null] }),
|
|
80
|
+
/* @__PURE__ */ jsx(ApprovalPreview, { children: paused.pending.map((action) => /* @__PURE__ */ jsx(ApprovalPreviewRow, {
|
|
81
|
+
label: `${action.connector}.${action.method}`,
|
|
82
|
+
children: action.args === void 0 ? null : formatApprovalValue(action.args)
|
|
83
|
+
}, action.seq)) }),
|
|
84
|
+
/* @__PURE__ */ jsx(ApprovalDecision, {
|
|
85
|
+
subject: toolName,
|
|
86
|
+
onSkip,
|
|
87
|
+
onDecision: async ({ approved, reason }) => {
|
|
88
|
+
try {
|
|
89
|
+
await (approved ? thinkStub.approveExecution(paused.executionId) : thinkStub.rejectExecution(paused.executionId, reason));
|
|
90
|
+
} finally {
|
|
91
|
+
await onSettled?.();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, `${paused.executionId}:${paused.pending[0]?.seq ?? "pending"}`)
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { ThinkExecutionApproval, ThinkPendingApproval, getPausedExecution };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TransitionSurface } from "./TransitionSurface.js";
|
|
2
|
+
import { AgentChatTurnError } from "./AgentChatTurnError.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ThinkRecoveryNotice.tsx
|
|
5
|
+
function connectionReason(error) {
|
|
6
|
+
return error.reason.trim() || error.message.trim();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Native Think recovery, connection, and turn-error content for AgentChat's
|
|
10
|
+
* persistent polite notice region. Think exposes no recovery phase, progress,
|
|
11
|
+
* checkpoint, attempt count, or timeline to the browser, so this adapter does
|
|
12
|
+
* not claim those details.
|
|
13
|
+
*/
|
|
14
|
+
function ThinkRecoveryNotice({ chat }) {
|
|
15
|
+
if (chat.isRecovering) return /* @__PURE__ */ jsx(TransitionSurface, {
|
|
16
|
+
"data-slot": "think-recovery-notice",
|
|
17
|
+
className: "think-recovery-notice",
|
|
18
|
+
children: "Recovering the interrupted response…"
|
|
19
|
+
}, "recovering");
|
|
20
|
+
if (chat.connectionError) {
|
|
21
|
+
const reason = connectionReason(chat.connectionError);
|
|
22
|
+
return /* @__PURE__ */ jsxs(TransitionSurface, {
|
|
23
|
+
"data-slot": "think-recovery-notice",
|
|
24
|
+
className: "think-recovery-notice",
|
|
25
|
+
"data-tone": "danger",
|
|
26
|
+
children: ["Connection lost", reason ? ` — ${reason}` : "."]
|
|
27
|
+
}, "connection-error");
|
|
28
|
+
}
|
|
29
|
+
if (chat.error) {
|
|
30
|
+
const retryMessageId = chat.messages.findLast((message) => message.role !== "system")?.id;
|
|
31
|
+
return /* @__PURE__ */ jsx(TransitionSurface, {
|
|
32
|
+
className: "think-recovery-notice",
|
|
33
|
+
children: /* @__PURE__ */ jsx(AgentChatTurnError, {
|
|
34
|
+
error: chat.error,
|
|
35
|
+
onDismiss: chat.clearError,
|
|
36
|
+
onRetry: retryMessageId ? () => {
|
|
37
|
+
chat.clearError();
|
|
38
|
+
chat.regenerate({ messageId: retryMessageId });
|
|
39
|
+
} : void 0
|
|
40
|
+
})
|
|
41
|
+
}, "turn-error");
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ThinkRecoveryNotice };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/components/ThinkRoutine.ts
|
|
2
2
|
function getThinkRoutineNextRun(routine) {
|
|
3
|
+
if (!routine.enabled) return "Paused";
|
|
3
4
|
return routine.schedule ? formatThinkExecutionDate(routine.schedule.time * 1e3, "Not scheduled") : "Pending reconciliation";
|
|
4
5
|
}
|
|
5
6
|
function formatThinkExecutionDate(value, fallback) {
|