@mcp-b/react-components 0.17.0 → 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-CRuMi1Pb.d.ts → AgentChat-ClxViuUM.d.ts} +1 -20
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-Co1noLbC.js → CodeBlock-Bfp5PAg3.js} +9 -6
- package/dist/{CodeBlock-Dnpr88ZQ.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/{FileTree-B7bBsUyU.js → FileTree-3zYtrddG.js} +42 -16
- package/dist/{Message-C4eYRogZ.js → Message-BXtmfc9Q.js} +13 -20
- package/dist/{ModelSelector-BNrZlY_Y.js → ModelSelector-Cqw_qrUG.js} +15 -22
- package/dist/{PromptInput-OLfXPuHM.d.ts → PromptInput-Bdh9pqlo.d.ts} +4 -6
- package/dist/{Select-CwSqP07Y.d.ts → Select-B_13gg_J.d.ts} +2 -2
- package/dist/{Tabs-9zddXDQo.d.ts → Tabs-ColWK-XA.d.ts} +10 -2
- package/dist/{ThinkChat-DInElus-.js → ThinkChat-15EhfvYJ.js} +84 -61
- package/dist/{ThinkChatActivity-BgesTfZ4.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +4 -7
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- package/dist/{Toggle-DaXpe1Lc.d.ts → Toggle-JKZ43D5S.d.ts} +1 -1
- package/dist/{ToggleGroup-yseEWkOC.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +2 -2
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/{WorkspaceExplorer-sZewzT2O.d.ts → WorkspaceExplorer-B9dQWNVK.d.ts} +2 -2
- package/dist/{WorkspaceFile-C8UzuSH4.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-DNdGAEiX.js → WorkspaceFileView-C68Ub8S8.js} +120 -127
- package/dist/{WorkspaceLink-B1ykV1dS.js → WorkspaceLink-BYYeTQLf.js} +6 -27
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/{class-names-Bk-QLWWI.js → class-names-BiMDVpUo.js} +4 -1
- package/dist/components/Accordion.js +7 -2
- 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 +1 -1
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +1 -1
- package/dist/components/AgentChat.js +94 -62
- package/dist/components/AgentChatMessageEditor.js +2 -2
- package/dist/components/AgentChatTurnError.js +2 -2
- package/dist/components/AgentConnection.js +3 -3
- package/dist/components/AgentMessageParts.js +1 -1
- package/dist/components/AgentToolDetail.d.ts +6 -4
- package/dist/components/AgentToolDetail.js +12 -10
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AppTopBar.d.ts +24 -7
- package/dist/components/AppTopBar.js +32 -8
- package/dist/components/Approval.js +4 -4
- package/dist/components/Artifact.d.ts +1 -1
- package/dist/components/Artifact.js +6 -4
- package/dist/components/Autocomplete.js +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.js +2 -2
- 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 +5 -5
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -11
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +2 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/Checkpoint.js +2 -2
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.js +2 -2
- package/dist/components/Combobox.js +1 -1
- package/dist/components/Commit.d.ts +1 -1
- package/dist/components/Commit.js +3 -3
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.js +2 -2
- package/dist/components/Conversation.d.ts +1 -1
- package/dist/components/Conversation.js +5 -4
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +3 -3
- package/dist/components/Field.js +5 -2
- package/dist/components/Fieldset.js +1 -1
- package/dist/components/FileTree.d.ts +6 -0
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.js +1 -1
- 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.js +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.js +2 -2
- package/dist/components/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/Menubar.js +2 -2
- package/dist/components/Message.d.ts +4 -1
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +5 -4
- package/dist/components/Meter.js +1 -1
- package/dist/components/ModelSelector.d.ts +4 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Plan.js +2 -2
- package/dist/components/Popover.js +1 -1
- package/dist/components/PreviewCard.js +1 -1
- 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 +4 -3
- package/dist/components/PricingUsageCalculator.js +2 -2
- package/dist/components/Progress.js +1 -1
- package/dist/components/PromptInput.d.ts +1 -1
- package/dist/components/PromptInput.js +33 -20
- package/dist/components/Queue.d.ts +1 -1
- package/dist/components/Queue.js +2 -3
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/Reasoning.js +3 -6
- package/dist/components/ResizableSidePanel.js +1 -1
- package/dist/components/ResponsiveSidebarShell.js +16 -10
- package/dist/components/ScrollArea.js +2 -1
- 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 +5 -6
- package/dist/components/Separator.js +1 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/Sources.js +2 -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 -4
- package/dist/components/SubagentRunSelector.d.ts +8 -12
- package/dist/components/SubagentRunSelector.js +17 -20
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.js +4 -5
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +12 -3
- package/dist/components/Task.js +2 -2
- package/dist/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.js +10 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +33 -20
- package/dist/components/ThinkChat.js +4 -4
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +8 -10
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatToolPanels.js +26 -16
- 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 +36 -35
- package/dist/components/ThinkFullApp.js +156 -109
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +1 -1
- package/dist/components/ThinkRecoveryNotice.js +18 -12
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +33 -40
- 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 +24 -31
- package/dist/components/ThinkRoutineLibrary.js +57 -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/Toast.js +1 -1
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +9 -7
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +15 -13
- package/dist/components/ToolInvocation.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.d.ts +8 -1
- package/dist/components/Tooltip.js +11 -2
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +5 -5
- package/dist/components/WebPreview.js +68 -54
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +358 -328
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +15 -25
- package/dist/components/WorkspaceExplorer.d.ts +5 -5
- 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-CQx3LQAC.d.ts → copy-button-D7aAYA-2.d.ts} +1 -1
- package/dist/{copy-button-cYsJBauI.js → copy-button-DeK6KXEV.js} +3 -2
- package/dist/{icons--FqCZEc3.js → icons-CQJ-aMnI.js} +6 -3
- package/dist/{icons-DpUqY8Mp.d.ts → icons-CYXmvKlJ.d.ts} +17 -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 +2 -0
- package/dist/styles/agent-chat.css +14 -22
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +11 -6
- package/dist/styles/artifact.css +6 -6
- 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 +8 -4
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -16
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/codex-model-selector.css +3 -7
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +3 -2
- package/dist/styles/commit.css +19 -18
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -3
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +69 -9
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +5 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -17
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -11
- package/dist/styles/menubar.css +12 -11
- package/dist/styles/message.css +27 -21
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -14
- 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 +5 -0
- package/dist/styles/popover.css +15 -16
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +75 -75
- 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 +109 -37
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +16 -15
- 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 -3
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +1 -1
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +13 -9
- package/dist/styles/test-results.css +29 -23
- 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 +45 -68
- package/dist/styles/think-routine-library.css +43 -24
- package/dist/styles/think-thread-picker.css +193 -51
- package/dist/styles/toast.css +48 -27
- 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/workspace-explorer.css +99 -44
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- 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/package.json +13 -7
- package/dist/Workspace-C9RFoxcu.d.ts +0 -62
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { l as WorkspaceNavigationAdapter } from "../WorkspaceLink-
|
|
2
|
-
import { r as WorkspaceFileAssetResolver } from "../WorkspaceFile-
|
|
3
|
-
import {
|
|
1
|
+
import { l as WorkspaceNavigationAdapter } from "../WorkspaceLink-O-EBKUJ8.js";
|
|
2
|
+
import { r as WorkspaceFileAssetResolver } from "../WorkspaceFile-CzyHnESE.js";
|
|
3
|
+
import { a as WorkspaceSource } from "../Workspace-Jez8ffUj.js";
|
|
4
4
|
import { ThinkChatMessagesProps } from "./ThinkChat.js";
|
|
5
5
|
import { t as ThinkAgent } from "../think-agent-Cip5KAPj.js";
|
|
6
6
|
import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
7
|
+
import { ThinkExecutionWorkbenchProps } from "./ThinkExecutionWorkbench.js";
|
|
7
8
|
import { ThinkFullAppView } from "./ThinkFullAppViewSwitch.js";
|
|
8
9
|
import { ThinkThreadStatusSummary } from "./ThinkThreadPicker.js";
|
|
9
10
|
import { ThinkThreadShell } from "./ThinkThreadShell.js";
|
|
10
11
|
import * as React from "react";
|
|
11
12
|
import { UIMessage } from "ai";
|
|
12
13
|
import { useAgentChat } from "@cloudflare/think/react";
|
|
13
|
-
import {
|
|
14
|
-
import { AgentToolRunState } from "agents/agent-tools";
|
|
14
|
+
import { useAgent } from "agents/react";
|
|
15
15
|
|
|
16
16
|
//#region src/components/ThinkFullApp.d.ts
|
|
17
17
|
type ThinkFullAppMobileView = "chat" | "workbench";
|
|
@@ -19,6 +19,11 @@ type ThinkFullAppAgent<State = unknown> = ThinkAgent<State>;
|
|
|
19
19
|
type ThinkFullAppWorkbenchView = "files" | "execution" | (string & {});
|
|
20
20
|
interface ThinkFullAppWorkspaceConfig {
|
|
21
21
|
source: WorkspaceSource;
|
|
22
|
+
/**
|
|
23
|
+
* Stable, non-secret identity for this workspace backend. It is independent
|
|
24
|
+
* of the app's agent `sourceKey` when files come from a parent/shared source.
|
|
25
|
+
*/
|
|
26
|
+
sourceKey: string;
|
|
22
27
|
root?: string;
|
|
23
28
|
navigation: WorkspaceNavigationAdapter;
|
|
24
29
|
resolveFileAsset?: WorkspaceFileAssetResolver;
|
|
@@ -54,34 +59,29 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
|
|
|
54
59
|
threadStatusSummary?: ThinkThreadStatusSummary;
|
|
55
60
|
/** Whether to include the built-in Execution workbench. Defaults to true. */
|
|
56
61
|
showExecutionWorkbench?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
|
|
62
|
+
/** Whether narrow layouts render the built-in chat/workbench switch. Defaults to true. */
|
|
63
|
+
showMobileViewSwitch?: boolean;
|
|
64
|
+
/** Hide the thread app bar when a narrow workbench supplies its own navigation. */
|
|
65
|
+
hideAppBarInWorkbench?: boolean;
|
|
66
|
+
/** Whole native execution selected by the application route. */
|
|
67
|
+
selectedExecutionRun: ThinkExecutionRun | null;
|
|
68
|
+
/**
|
|
69
|
+
* Stable, non-secret identity for the remote Think agent used by approvals
|
|
70
|
+
* and execution queries. Include endpoint, account or tenant scope, and
|
|
71
|
+
* agent path so two sources cannot share cached data. The optional workspace
|
|
72
|
+
* has its own source identity.
|
|
73
|
+
*/
|
|
74
|
+
sourceKey: string;
|
|
75
|
+
/** Returns an application-authored TanStack Router Link for an execution. */
|
|
76
|
+
renderExecutionRunLink: ThinkExecutionWorkbenchProps["renderRunLink"];
|
|
61
77
|
/** Message rendering labels and approval overrides for ThinkChat. */
|
|
62
78
|
messages?: ThinkChatMessagesProps<MessageT>;
|
|
63
79
|
/** Extra workbench panels appended after the built-in Files and Execution panels. */
|
|
64
80
|
workbenchPanels?: readonly ThinkFullAppPanel<AgentT, State, MessageT>[];
|
|
65
81
|
/** Show retained Agent Tool runs from the parent connection. Defaults to true. */
|
|
66
82
|
showAgentTools?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/** Initial retained run selection when uncontrolled. */
|
|
70
|
-
defaultSelectedAgentToolRunId?: string | null;
|
|
71
|
-
/** Receives the complete upstream retained run selected from a Nanite pill. */
|
|
72
|
-
onSelectedAgentToolRunChange?: (run: AgentToolRunState<MessageT["parts"][number]> | null) => void;
|
|
73
|
-
/**
|
|
74
|
-
* Whole upstream connection options for child routing, including app auth or
|
|
75
|
-
* query configuration. The selected run's `subAgent` segment is appended.
|
|
76
|
-
*/
|
|
77
|
-
agentToolChildConnection?: UseAgentOptions<unknown>;
|
|
78
|
-
/** Child transcript rendering overrides; the composer remains hidden. */
|
|
79
|
-
agentToolMessages?: ThinkChatMessagesProps<MessageT>;
|
|
80
|
-
/**
|
|
81
|
-
* App-owned detail for retained children that do not expose Think chat or
|
|
82
|
-
* require a product-specific route. The whole upstream run stays intact.
|
|
83
|
-
*/
|
|
84
|
-
renderAgentToolDetail?: (run: AgentToolRunState<MessageT["parts"][number]>, onBack: () => void) => React.ReactNode;
|
|
83
|
+
/** Returns an application-authored TanStack Router Link for a retained child run. */
|
|
84
|
+
renderAgentToolRunLink: NonNullable<ThinkChatMessagesProps<MessageT>["renderAgentToolRunLink"]>;
|
|
85
85
|
/**
|
|
86
86
|
* Optional parent-owned thread picker/sidebar rendered beside the selected child app.
|
|
87
87
|
* Use the render form to close the compact drawer after selecting a thread.
|
|
@@ -99,7 +99,10 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
|
|
|
99
99
|
defaultMobileView?: ThinkFullAppMobileView;
|
|
100
100
|
/** Called when narrow layouts switch between chat and the workbench. */
|
|
101
101
|
onMobileViewChange?: (view: ThinkFullAppMobileView) => void;
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Selected workbench lane for controlled, ephemeral panel UI.
|
|
104
|
+
* Apps that make lanes durable should derive this value from validated route search state.
|
|
105
|
+
*/
|
|
103
106
|
workbenchView?: ThinkFullAppWorkbenchView;
|
|
104
107
|
/** Initial workbench lane when `workbenchView` is uncontrolled. */
|
|
105
108
|
defaultWorkbenchView?: ThinkFullAppWorkbenchView;
|
|
@@ -109,30 +112,28 @@ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unk
|
|
|
109
112
|
/** Combines ThinkChat with an optional resizable workbench shell. */
|
|
110
113
|
declare function ThinkFullApp<AgentT extends ThinkFullAppAgent<State>, State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
111
114
|
agent,
|
|
112
|
-
agentToolChildConnection,
|
|
113
|
-
agentToolMessages,
|
|
114
115
|
appBarActions,
|
|
115
116
|
appBarLeading,
|
|
116
117
|
appBarTitle,
|
|
117
118
|
chat,
|
|
118
119
|
className,
|
|
119
120
|
defaultMobileView,
|
|
120
|
-
defaultSelectedAgentToolRunId,
|
|
121
121
|
defaultWorkbenchView,
|
|
122
122
|
defaultThreadSidebarOpen,
|
|
123
|
+
hideAppBarInWorkbench,
|
|
123
124
|
messages,
|
|
124
125
|
mobileView,
|
|
125
126
|
onMobileViewChange,
|
|
126
|
-
onSelectedAgentToolRunChange,
|
|
127
|
-
onSelectedExecutionRunChange,
|
|
128
127
|
onThreadSidebarOpenChange,
|
|
129
128
|
onWorkbenchViewChange,
|
|
130
129
|
ref,
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
renderAgentToolRunLink,
|
|
131
|
+
renderExecutionRunLink,
|
|
133
132
|
selectedExecutionRun,
|
|
134
133
|
showAgentTools,
|
|
135
134
|
showExecutionWorkbench,
|
|
135
|
+
showMobileViewSwitch,
|
|
136
|
+
sourceKey,
|
|
136
137
|
style,
|
|
137
138
|
threadSidebar,
|
|
138
139
|
threadSidebarOpen,
|
|
@@ -1,46 +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-DInElus-.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";
|
|
11
|
-
import { SelectedAgentToolChild } from "./AgentToolDetail.js";
|
|
12
10
|
import { ResizableSidePanel } from "./ResizableSidePanel.js";
|
|
13
11
|
import { ThinkExecutionWorkbench } from "./ThinkExecutionWorkbench.js";
|
|
14
12
|
import { ThinkFullAppViewSwitch } from "./ThinkFullAppViewSwitch.js";
|
|
15
13
|
import { ThinkThreadStatusIndicators } from "./ThinkThreadPicker.js";
|
|
16
14
|
import { ThinkThreadShell } from "./ThinkThreadShell.js";
|
|
17
15
|
import * as React from "react";
|
|
18
|
-
import {
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
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
|
|
20
89
|
//#region src/components/ThinkFullApp.tsx
|
|
21
90
|
const workbenchPanelDefaultWidth = 340;
|
|
22
91
|
const workbenchPanelMinWidth = 300;
|
|
23
92
|
const workbenchPanelMaxWidth = 600;
|
|
24
93
|
const workbenchPanelKeyboardStep = 24;
|
|
25
|
-
function WorkspacePanel({ config
|
|
94
|
+
function WorkspacePanel({ config }) {
|
|
95
|
+
const selectedPath = config.navigation.current.destination.kind === "file" ? config.navigation.current.destination.path : null;
|
|
26
96
|
return /* @__PURE__ */ jsx(WorkspaceExplorer, {
|
|
27
97
|
className: "think-full-app__workbench",
|
|
28
98
|
workspace: useWorkspace({
|
|
29
99
|
source: config.source,
|
|
100
|
+
sourceKey: config.sourceKey,
|
|
30
101
|
root: config.root,
|
|
102
|
+
selectedPath,
|
|
31
103
|
resolveFileAsset: config.resolveFileAsset,
|
|
32
104
|
maxInlineAssetBytes: config.maxInlineAssetBytes
|
|
33
105
|
}),
|
|
34
106
|
navigation: config.navigation,
|
|
35
|
-
leading:
|
|
107
|
+
leading: config.leading,
|
|
36
108
|
actions: config.actions
|
|
37
109
|
});
|
|
38
110
|
}
|
|
39
111
|
/** Combines ThinkChat with an optional resizable workbench shell. */
|
|
40
|
-
function ThinkFullApp({ agent,
|
|
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 }) {
|
|
41
113
|
const appRef = React.useRef(null);
|
|
42
|
-
const
|
|
43
|
-
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}`);
|
|
44
117
|
const resolvedMessages = React.useMemo(() => {
|
|
45
118
|
const approvalProps = resolveThinkApprovalProps({
|
|
46
119
|
thinkStub: messages?.thinkStub,
|
|
@@ -63,16 +136,13 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
63
136
|
]);
|
|
64
137
|
const [innerMobileView, setInnerMobileView] = React.useState(defaultMobileView ?? "chat");
|
|
65
138
|
const [innerWorkbenchView, setInnerWorkbenchView] = React.useState(defaultWorkbenchView ?? "files");
|
|
66
|
-
const [innerSelectedAgentToolRunId, setInnerSelectedAgentToolRunId] = React.useState(defaultSelectedAgentToolRunId ?? null);
|
|
67
139
|
const agentTools = useAgentToolEvents({ agent });
|
|
68
140
|
const agentIdentity = JSON.stringify(agent.path);
|
|
69
141
|
const requestedMobileView = mobileView ?? innerMobileView;
|
|
70
142
|
const requestedWorkbenchView = workbenchView ?? innerWorkbenchView;
|
|
71
|
-
const
|
|
72
|
-
const selectedAgentToolRun = activeAgentToolRunId ? agentTools.runsById[activeAgentToolRunId] : void 0;
|
|
143
|
+
const resetAgentTools = React.useEffectEvent(() => agentTools.resetLocalState());
|
|
73
144
|
React.useEffect(() => {
|
|
74
|
-
|
|
75
|
-
setInnerSelectedAgentToolRunId(null);
|
|
145
|
+
resetAgentTools();
|
|
76
146
|
}, [agentIdentity]);
|
|
77
147
|
const setWorkbenchView = React.useCallback((next) => {
|
|
78
148
|
if (workbenchView === void 0) setInnerWorkbenchView(next);
|
|
@@ -82,30 +152,12 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
82
152
|
if (mobileView === void 0) setInnerMobileView(next);
|
|
83
153
|
onMobileViewChange?.(next);
|
|
84
154
|
}, [mobileView, onMobileViewChange]);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const selectAgentToolRun = React.useCallback((run) => {
|
|
90
|
-
const trigger = document.activeElement;
|
|
91
|
-
if (trigger instanceof HTMLElement && appRef.current?.contains(trigger)) agentToolTriggerRef.current = trigger;
|
|
92
|
-
updateSelectedAgentToolRun(run);
|
|
93
|
-
setWorkbenchView("agent-tool");
|
|
94
|
-
setMobileView("workbench");
|
|
95
|
-
}, [
|
|
96
|
-
setMobileView,
|
|
97
|
-
setWorkbenchView,
|
|
98
|
-
updateSelectedAgentToolRun
|
|
99
|
-
]);
|
|
100
|
-
const closeAgentToolDetail = React.useCallback(() => {
|
|
101
|
-
const trigger = agentToolTriggerRef.current;
|
|
102
|
-
agentToolTriggerRef.current = null;
|
|
103
|
-
updateSelectedAgentToolRun(null);
|
|
104
|
-
setMobileView("chat");
|
|
105
|
-
requestAnimationFrame(() => {
|
|
106
|
-
if (trigger?.isConnected) trigger.focus();
|
|
155
|
+
const updateAppView = React.useCallback((update) => {
|
|
156
|
+
return runViewTransition({
|
|
157
|
+
scope: viewScopeRef.current,
|
|
158
|
+
update
|
|
107
159
|
});
|
|
108
|
-
}, [
|
|
160
|
+
}, []);
|
|
109
161
|
const panelContext = React.useMemo(() => ({
|
|
110
162
|
agent,
|
|
111
163
|
chat,
|
|
@@ -120,10 +172,7 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
120
172
|
id: "files",
|
|
121
173
|
label: "Files",
|
|
122
174
|
icon: /* @__PURE__ */ jsx(FileIcon, {}),
|
|
123
|
-
render: () => /* @__PURE__ */ jsx(WorkspacePanel, {
|
|
124
|
-
config: workspace,
|
|
125
|
-
workbenchNavigation
|
|
126
|
-
})
|
|
175
|
+
render: () => /* @__PURE__ */ jsx(WorkspacePanel, { config: workspace })
|
|
127
176
|
});
|
|
128
177
|
if (showExecutionWorkbench) availableWorkbenchPanels.push({
|
|
129
178
|
id: "execution",
|
|
@@ -131,24 +180,12 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
131
180
|
icon: /* @__PURE__ */ jsx(TerminalIcon, {}),
|
|
132
181
|
render: ({ agent }) => /* @__PURE__ */ jsx(ThinkExecutionWorkbench, {
|
|
133
182
|
source: agent.stub,
|
|
183
|
+
sourceKey,
|
|
134
184
|
title: "Execution",
|
|
135
|
-
backButton: workbenchNavigation,
|
|
136
185
|
selectedRun: selectedExecutionRun,
|
|
137
|
-
|
|
186
|
+
renderRunLink: renderExecutionRunLink
|
|
138
187
|
})
|
|
139
188
|
});
|
|
140
|
-
if (showAgentTools && selectedAgentToolRun) availableWorkbenchPanels.push({
|
|
141
|
-
id: "agent-tool",
|
|
142
|
-
label: "Agent",
|
|
143
|
-
icon: /* @__PURE__ */ jsx(NaniteMark, { index: selectedAgentToolRun.order }),
|
|
144
|
-
render: () => renderAgentToolDetail ? renderAgentToolDetail(selectedAgentToolRun, closeAgentToolDetail) : /* @__PURE__ */ jsx(SelectedAgentToolChild, {
|
|
145
|
-
run: selectedAgentToolRun,
|
|
146
|
-
parentAgent: agent,
|
|
147
|
-
connectionOptions: agentToolChildConnection,
|
|
148
|
-
messages: agentToolMessages,
|
|
149
|
-
onBack: closeAgentToolDetail
|
|
150
|
-
}, selectedAgentToolRun.runId)
|
|
151
|
-
});
|
|
152
189
|
if (workbenchPanels) availableWorkbenchPanels.push(...workbenchPanels);
|
|
153
190
|
const activePanel = availableWorkbenchPanels.find((panel) => panel.id === requestedWorkbenchView) ?? availableWorkbenchPanels[0];
|
|
154
191
|
const activeWorkbenchView = activePanel?.id;
|
|
@@ -156,25 +193,27 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
156
193
|
const activeMobileView = hasWorkbench ? requestedMobileView : "chat";
|
|
157
194
|
const showWorkbenchViewSwitch = availableWorkbenchPanels.length > 1;
|
|
158
195
|
const workbenchViews = availableWorkbenchPanels;
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
+
};
|
|
173
213
|
const renderAppTopBar = (sidebarControls) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
174
214
|
className: "think-full-app__app-bar",
|
|
175
215
|
"aria-label": "Workbench controls",
|
|
176
216
|
"data-mobile-view": activeMobileView,
|
|
177
|
-
"data-compact-only": hasCompactAppBar ? "true" : void 0,
|
|
178
217
|
children: [
|
|
179
218
|
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [sidebarControls?.sidebarToggle, appBarLeading] }),
|
|
180
219
|
appBarTitle || sidebarControls ? /* @__PURE__ */ jsxs(AppTopBar.Title, { children: [appBarTitle ? /* @__PURE__ */ jsx("span", {
|
|
@@ -186,6 +225,7 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
186
225
|
color: "neutral",
|
|
187
226
|
size: "sm",
|
|
188
227
|
className: "think-full-app__thread-trigger",
|
|
228
|
+
"aria-label": "Threads",
|
|
189
229
|
"aria-controls": sidebarControls.sidebarId,
|
|
190
230
|
"aria-expanded": sidebarControls.sidebarOpen,
|
|
191
231
|
onClick: (event) => sidebarControls.toggleSidebar(event.currentTarget),
|
|
@@ -200,27 +240,29 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
200
240
|
}) : null] }) : null,
|
|
201
241
|
/* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [
|
|
202
242
|
appBarActions,
|
|
203
|
-
showWorkbenchViewSwitch && activeWorkbenchView
|
|
243
|
+
showWorkbenchViewSwitch && activeWorkbenchView ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
204
244
|
className: "think-full-app__workbench-view-switch",
|
|
205
245
|
views: workbenchViews,
|
|
206
246
|
value: activeWorkbenchView,
|
|
207
247
|
onValueChange: (next) => {
|
|
208
|
-
if (next)
|
|
248
|
+
if (next) updateWorkbenchPanel(next);
|
|
209
249
|
},
|
|
210
250
|
"aria-label": "Workbench views"
|
|
211
251
|
}) : null,
|
|
212
|
-
activePanel ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
252
|
+
activePanel && showMobileViewSwitch ? /* @__PURE__ */ jsx(ThinkFullAppViewSwitch, {
|
|
213
253
|
className: "think-full-app__mobile-view-switch",
|
|
214
254
|
views: workbenchViews,
|
|
215
255
|
value: activeMobileView === "workbench" ? activePanel.id : void 0,
|
|
216
256
|
allowEmpty: true,
|
|
217
257
|
onValueChange: (next) => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
258
|
+
updateAppView(() => {
|
|
259
|
+
if (!next) {
|
|
260
|
+
setMobileView("chat");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
setWorkbenchView(next);
|
|
264
|
+
setMobileView("workbench");
|
|
265
|
+
});
|
|
224
266
|
},
|
|
225
267
|
"aria-label": "App views"
|
|
226
268
|
}) : null
|
|
@@ -239,44 +281,48 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
239
281
|
"data-has-thread-sidebar": threadSidebar ? "true" : "false",
|
|
240
282
|
"data-has-workbench": hasWorkbench ? "true" : "false",
|
|
241
283
|
"data-has-workbench-topbar": hasAppBarRow ? "true" : "false",
|
|
242
|
-
"data-has-compact-app-bar": hasCompactAppBar ? "true" : "false",
|
|
243
284
|
"data-mobile-view": activeMobileView,
|
|
244
285
|
style,
|
|
245
286
|
...props,
|
|
246
287
|
children: [
|
|
247
288
|
shouldRenderInlineAppBar ? renderAppTopBar() : null,
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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",
|
|
254
296
|
children: /* @__PURE__ */ jsx("div", {
|
|
255
|
-
className: "think-full-app__chat
|
|
256
|
-
children: /* @__PURE__ */ jsx(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
+
})
|
|
263
307
|
})
|
|
264
308
|
})
|
|
265
309
|
})
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
className: "think-full-app__aside",
|
|
270
|
-
"aria-label": "Workbench",
|
|
271
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
272
|
-
className: "think-full-app__workbench-slot",
|
|
310
|
+
}), activePanel ? /* @__PURE__ */ jsx("aside", {
|
|
311
|
+
className: "think-full-app__aside",
|
|
312
|
+
"aria-label": "Workbench",
|
|
273
313
|
children: /* @__PURE__ */ jsx("div", {
|
|
274
|
-
className: "think-full-app__workbench-
|
|
275
|
-
"
|
|
276
|
-
|
|
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
|
+
})
|
|
277
322
|
})
|
|
278
|
-
})
|
|
279
|
-
})
|
|
323
|
+
}) : null]
|
|
324
|
+
}),
|
|
325
|
+
activePanel ? /* @__PURE__ */ jsx(ResizableSidePanel.Handle, { className: "think-full-app__resizer" }) : null
|
|
280
326
|
]
|
|
281
327
|
});
|
|
282
328
|
const app = workspace ? /* @__PURE__ */ jsx(WorkspaceNavigationProvider, {
|
|
@@ -298,6 +344,7 @@ function ThinkFullApp({ agent, agentToolChildConnection, agentToolMessages, appB
|
|
|
298
344
|
sidebarOpen: threadSidebarOpen,
|
|
299
345
|
defaultSidebarOpen: defaultThreadSidebarOpen,
|
|
300
346
|
onSidebarOpenChange: onThreadSidebarOpenChange,
|
|
347
|
+
"data-hide-app-bar-in-workbench": hideAppBarInWorkbench ? "" : void 0,
|
|
301
348
|
topBar: (controls) => renderAppTopBar(controls),
|
|
302
349
|
children: app
|
|
303
350
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TransitionSurface } from "./TransitionSurface.js";
|
|
1
2
|
import { AgentChatTurnError } from "./AgentChatTurnError.js";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/ThinkRecoveryNotice.tsx
|
|
@@ -11,28 +12,33 @@ function connectionReason(error) {
|
|
|
11
12
|
* not claim those details.
|
|
12
13
|
*/
|
|
13
14
|
function ThinkRecoveryNotice({ chat }) {
|
|
14
|
-
if (chat.isRecovering) return /* @__PURE__ */ jsx(
|
|
15
|
+
if (chat.isRecovering) return /* @__PURE__ */ jsx(TransitionSurface, {
|
|
15
16
|
"data-slot": "think-recovery-notice",
|
|
17
|
+
className: "think-recovery-notice",
|
|
16
18
|
children: "Recovering the interrupted response…"
|
|
17
|
-
});
|
|
19
|
+
}, "recovering");
|
|
18
20
|
if (chat.connectionError) {
|
|
19
21
|
const reason = connectionReason(chat.connectionError);
|
|
20
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
+
return /* @__PURE__ */ jsxs(TransitionSurface, {
|
|
21
23
|
"data-slot": "think-recovery-notice",
|
|
24
|
+
className: "think-recovery-notice",
|
|
22
25
|
"data-tone": "danger",
|
|
23
26
|
children: ["Connection lost", reason ? ` — ${reason}` : "."]
|
|
24
|
-
});
|
|
27
|
+
}, "connection-error");
|
|
25
28
|
}
|
|
26
29
|
if (chat.error) {
|
|
27
30
|
const retryMessageId = chat.messages.findLast((message) => message.role !== "system")?.id;
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
chat.clearError
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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");
|
|
36
42
|
}
|
|
37
43
|
return null;
|
|
38
44
|
}
|
|
@@ -3,22 +3,30 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/components/ThinkRoutineBrowser.d.ts
|
|
5
5
|
type ThinkRoutineFilter = "all" | "active" | "paused";
|
|
6
|
-
interface ThinkRoutineBrowserProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
|
|
7
|
-
routines: readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
interface ThinkRoutineBrowserProps<TRoutine extends ThinkRoutine = ThinkRoutine> extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect"> {
|
|
7
|
+
routines: readonly TRoutine[];
|
|
8
|
+
/** Routine selected by the current application route. */
|
|
9
|
+
selectedRoutineId?: string | null;
|
|
10
|
+
showOwner?: boolean;
|
|
11
|
+
/** App-authored TanStack Router Link for each durable routine destination. */
|
|
12
|
+
renderRoutineLink: (routine: TRoutine) => React.ReactElement;
|
|
13
|
+
/** App-authored TanStack Router Link to the routine creation route. */
|
|
14
|
+
createRoutineLink?: React.ReactElement;
|
|
15
|
+
/** Optional UI-only response after a routine link is activated. */
|
|
16
|
+
onRoutineLinkClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
11
17
|
}
|
|
12
18
|
/** Searchable, filterable navigation for an app-owned collection of Think routines. */
|
|
13
|
-
declare function ThinkRoutineBrowser({
|
|
19
|
+
declare function ThinkRoutineBrowser<TRoutine extends ThinkRoutine = ThinkRoutine>({
|
|
14
20
|
className,
|
|
15
21
|
routines,
|
|
16
22
|
selectedRoutineId,
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
showOwner,
|
|
24
|
+
renderRoutineLink,
|
|
25
|
+
createRoutineLink,
|
|
26
|
+
onRoutineLinkClick,
|
|
19
27
|
ref,
|
|
20
28
|
...props
|
|
21
|
-
}: ThinkRoutineBrowserProps & {
|
|
29
|
+
}: ThinkRoutineBrowserProps<TRoutine> & {
|
|
22
30
|
ref?: React.Ref<HTMLElement>;
|
|
23
31
|
}): React.JSX.Element;
|
|
24
32
|
//#endregion
|