@mcp-b/react-components 0.17.0 → 0.19.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-Bb-IPBc_.js} +9 -6
- package/dist/{CodeBlock-Dnpr88ZQ.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/{FileTree-B7bBsUyU.js → FileTree-CUlXfnmc.js} +42 -16
- package/dist/{Message-C4eYRogZ.js → Message-rZEaaD8Q.js} +13 -20
- package/dist/{ModelSelector-BNrZlY_Y.js → ModelSelector-4GsCWcZV.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-CEdArlOT.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 +35 -15
- 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 +31 -18
- 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-cYsJBauI.js → copy-button-BtRwhRks.js} +3 -2
- package/dist/{copy-button-CQx3LQAC.d.ts → copy-button-D7aAYA-2.d.ts} +1 -1
- package/dist/{icons--FqCZEc3.js → icons-DKXiSepE.js} +7 -3
- package/dist/{icons-DpUqY8Mp.d.ts → icons-DkRtZmvT.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 +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 +46 -8
- 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 +87 -70
- 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/codex-model-catalog.d.ts +2 -8
- package/dist/utils/codex-model-catalog.js +2 -16
- package/dist/utils/mcp-server-catalog.d.ts +139 -0
- package/dist/utils/mcp-server-catalog.js +98 -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,6 +1,7 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { U as RefreshIcon, y as EllipsisIcon } from "../icons-DKXiSepE.js";
|
|
3
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
4
|
+
import { Button, buttonVariants } from "./Button.js";
|
|
4
5
|
import { Tooltip } from "./Tooltip.js";
|
|
5
6
|
import { Menu } from "./Menu.js";
|
|
6
7
|
import { AppTopBar } from "./AppTopBar.js";
|
|
@@ -9,6 +10,7 @@ import { ThinkExecutionStatus } from "./ThinkExecutionStatus.js";
|
|
|
9
10
|
import { ThinkExecutionDetail } from "./ThinkExecutionDetail.js";
|
|
10
11
|
import * as React from "react";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { queryOptions, useMutation, useQuery } from "@tanstack/react-query";
|
|
12
14
|
//#region src/components/ThinkExecutionWorkbench.tsx
|
|
13
15
|
const executionPanelPageSize = 20;
|
|
14
16
|
function getErrorMessage(error) {
|
|
@@ -17,6 +19,13 @@ function getErrorMessage(error) {
|
|
|
17
19
|
function isSubmissionCancelable(status) {
|
|
18
20
|
return status === "pending" || status === "running";
|
|
19
21
|
}
|
|
22
|
+
function thinkExecutionRunsScopeQueryKey(sourceKey) {
|
|
23
|
+
return [
|
|
24
|
+
"think",
|
|
25
|
+
sourceKey,
|
|
26
|
+
"execution-runs"
|
|
27
|
+
];
|
|
28
|
+
}
|
|
20
29
|
function RunActions({ busy, onAction, run, source }) {
|
|
21
30
|
const id = getThinkExecutionRunId(run);
|
|
22
31
|
const statusTone = getThinkExecutionRunStatusTone(run);
|
|
@@ -28,7 +37,8 @@ function RunActions({ busy, onAction, run, source }) {
|
|
|
28
37
|
type: "button",
|
|
29
38
|
variant: "ghost",
|
|
30
39
|
color: "neutral",
|
|
31
|
-
size: "
|
|
40
|
+
size: "sm",
|
|
41
|
+
iconOnly: true,
|
|
32
42
|
className: "think-execution-workbench__run-actions",
|
|
33
43
|
"aria-label": `Actions for ${kind} ${id}`,
|
|
34
44
|
disabled: busy,
|
|
@@ -91,129 +101,51 @@ function RunActions({ busy, onAction, run, source }) {
|
|
|
91
101
|
}) })] });
|
|
92
102
|
}
|
|
93
103
|
/**
|
|
104
|
+
* Shared list options for component reads and TanStack Router loaders.
|
|
105
|
+
*/
|
|
106
|
+
function thinkExecutionRunsQueryOptions(source, sourceKey, pageSize = executionPanelPageSize) {
|
|
107
|
+
return queryOptions({
|
|
108
|
+
queryKey: [...thinkExecutionRunsScopeQueryKey(sourceKey), { limit: pageSize }],
|
|
109
|
+
queryFn: async () => {
|
|
110
|
+
const [submissions, workflows] = await Promise.all([source.listSubmissions({ limit: pageSize }), source.getWorkflows({
|
|
111
|
+
limit: pageSize,
|
|
112
|
+
orderBy: "desc"
|
|
113
|
+
})]);
|
|
114
|
+
return {
|
|
115
|
+
submissions,
|
|
116
|
+
workflows
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
staleTime: 5e3
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
94
123
|
* Unified execution history for native Think submissions and Agents workflows.
|
|
95
124
|
* The workbench reads and acts through the whole upstream agent stub; it does
|
|
96
125
|
* not normalize execution records or own workflow authoring.
|
|
97
126
|
*/
|
|
98
|
-
function ThinkExecutionWorkbench({ backButton, className,
|
|
127
|
+
function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPanelPageSize, ref, renderRunLink, selectedRun, source, sourceKey, title = "Execution", ...props }) {
|
|
99
128
|
const runsId = React.useId();
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
const runsOptions = thinkExecutionRunsQueryOptions(source, sourceKey, pageSize);
|
|
130
|
+
const runsQueryKey = thinkExecutionRunsScopeQueryKey(sourceKey);
|
|
131
|
+
const runsQuery = useQuery(runsOptions);
|
|
132
|
+
const actionMutation = useMutation({
|
|
133
|
+
mutationFn: ({ action }) => action(),
|
|
134
|
+
onSuccess: (_result, action, _onMutateResult, context) => context.client.invalidateQueries({ queryKey: action.runsQueryKey })
|
|
135
|
+
});
|
|
136
|
+
const currentAction = actionMutation.variables?.source === source ? actionMutation.variables : null;
|
|
137
|
+
const actionIsPending = currentAction !== null && actionMutation.isPending;
|
|
138
|
+
const busyAction = actionIsPending ? currentAction.key : runsQuery.isFetching ? "refresh" : null;
|
|
139
|
+
const error = currentAction && actionMutation.isError ? actionMutation.error : runsQuery.error;
|
|
140
|
+
const runs = React.useMemo(() => [...runsQuery.data?.submissions ?? [], ...runsQuery.data?.workflows.workflows ?? []].sort((first, second) => Number(second.createdAt) - Number(first.createdAt)), [runsQuery.data]);
|
|
141
|
+
const runAction = (key, action) => {
|
|
142
|
+
actionMutation.mutate({
|
|
143
|
+
action,
|
|
144
|
+
key,
|
|
145
|
+
runsQueryKey,
|
|
117
146
|
source
|
|
118
|
-
};
|
|
119
|
-
}, [source]);
|
|
120
|
-
const loadData = React.useCallback(async (operation) => {
|
|
121
|
-
const [nextSubmissions, nextWorkflows] = await Promise.all([operation.source.listSubmissions({ limit: pageSize }), operation.source.getWorkflows({
|
|
122
|
-
limit: pageSize,
|
|
123
|
-
orderBy: "desc"
|
|
124
|
-
})]);
|
|
125
|
-
if (!isCurrentOperation(operation)) return;
|
|
126
|
-
setExecutionData({
|
|
127
|
-
source: operation.source,
|
|
128
|
-
submissions: nextSubmissions,
|
|
129
|
-
workflows: nextWorkflows
|
|
130
|
-
});
|
|
131
|
-
}, [isCurrentOperation, pageSize]);
|
|
132
|
-
const refresh = React.useCallback(async () => {
|
|
133
|
-
const operation = beginOperation();
|
|
134
|
-
if (!operation) return;
|
|
135
|
-
setBusyAction("refresh");
|
|
136
|
-
setError(null);
|
|
137
|
-
try {
|
|
138
|
-
await loadData(operation);
|
|
139
|
-
} catch (nextError) {
|
|
140
|
-
if (!isCurrentOperation(operation)) return;
|
|
141
|
-
setError(getErrorMessage(nextError));
|
|
142
|
-
} finally {
|
|
143
|
-
if (isCurrentOperation(operation)) setBusyAction(null);
|
|
144
|
-
}
|
|
145
|
-
}, [
|
|
146
|
-
beginOperation,
|
|
147
|
-
isCurrentOperation,
|
|
148
|
-
loadData
|
|
149
|
-
]);
|
|
150
|
-
const runAction = React.useCallback(async (key, action) => {
|
|
151
|
-
const operation = beginOperation();
|
|
152
|
-
if (!operation) return;
|
|
153
|
-
setBusyAction(key);
|
|
154
|
-
setError(null);
|
|
155
|
-
try {
|
|
156
|
-
await action(operation);
|
|
157
|
-
if (!isCurrentOperation(operation)) return;
|
|
158
|
-
await loadData(operation);
|
|
159
|
-
} catch (nextError) {
|
|
160
|
-
if (!isCurrentOperation(operation)) return;
|
|
161
|
-
setError(getErrorMessage(nextError));
|
|
162
|
-
} finally {
|
|
163
|
-
if (isCurrentOperation(operation)) setBusyAction(null);
|
|
164
|
-
}
|
|
165
|
-
}, [
|
|
166
|
-
beginOperation,
|
|
167
|
-
isCurrentOperation,
|
|
168
|
-
loadData
|
|
169
|
-
]);
|
|
170
|
-
const selectRun = React.useCallback((run) => {
|
|
171
|
-
const kind = isThinkSubmissionRun(run) ? "submission" : "workflow";
|
|
172
|
-
runAction(`select-${kind}:${getThinkExecutionRunId(run)}`, async (operation) => {
|
|
173
|
-
if (isThinkSubmissionRun(run)) {
|
|
174
|
-
const inspection = await operation.source.inspectSubmission(run.submissionId);
|
|
175
|
-
if (!isCurrentOperation(operation)) return;
|
|
176
|
-
const selected = inspection ?? run;
|
|
177
|
-
if (controlledSelectedRun === void 0) setSelection({
|
|
178
|
-
source: operation.source,
|
|
179
|
-
run: selected
|
|
180
|
-
});
|
|
181
|
-
onSelectedRunChange?.(selected);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const workflow = await operation.source.getWorkflow(run.workflowId);
|
|
185
|
-
if (!isCurrentOperation(operation)) return;
|
|
186
|
-
const selected = workflow ?? run;
|
|
187
|
-
if (controlledSelectedRun === void 0) setSelection({
|
|
188
|
-
source: operation.source,
|
|
189
|
-
run: selected
|
|
190
|
-
});
|
|
191
|
-
onSelectedRunChange?.(selected);
|
|
192
147
|
});
|
|
193
|
-
}
|
|
194
|
-
controlledSelectedRun,
|
|
195
|
-
isCurrentOperation,
|
|
196
|
-
onSelectedRunChange,
|
|
197
|
-
runAction
|
|
198
|
-
]);
|
|
199
|
-
React.useLayoutEffect(() => {
|
|
200
|
-
activeSourceRef.current = source;
|
|
201
|
-
sourceGenerationRef.current += 1;
|
|
202
|
-
operationSequenceRef.current += 1;
|
|
203
|
-
setExecutionData(null);
|
|
204
|
-
setSelection(null);
|
|
205
|
-
setBusyAction("refresh");
|
|
206
|
-
setError(null);
|
|
207
|
-
return () => {
|
|
208
|
-
if (activeSourceRef.current === source) {
|
|
209
|
-
sourceGenerationRef.current += 1;
|
|
210
|
-
operationSequenceRef.current += 1;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}, [source]);
|
|
214
|
-
React.useEffect(() => {
|
|
215
|
-
refresh();
|
|
216
|
-
}, [refresh]);
|
|
148
|
+
};
|
|
217
149
|
return /* @__PURE__ */ jsxs("div", {
|
|
218
150
|
ref,
|
|
219
151
|
className: cx("think-execution-workbench", className),
|
|
@@ -231,7 +163,10 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
231
163
|
/* @__PURE__ */ jsx(AppTopBar.Trailing, { children: /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
232
164
|
label: "Refresh runs",
|
|
233
165
|
disabled: busyAction !== null,
|
|
234
|
-
onClick: () =>
|
|
166
|
+
onClick: () => {
|
|
167
|
+
actionMutation.reset();
|
|
168
|
+
runsQuery.refetch();
|
|
169
|
+
},
|
|
235
170
|
children: /* @__PURE__ */ jsx(RefreshIcon, {})
|
|
236
171
|
}) })
|
|
237
172
|
]
|
|
@@ -239,7 +174,7 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
239
174
|
error ? /* @__PURE__ */ jsx("div", {
|
|
240
175
|
className: "think-execution-workbench__error",
|
|
241
176
|
role: "alert",
|
|
242
|
-
children: error
|
|
177
|
+
children: getErrorMessage(error)
|
|
243
178
|
}) : null,
|
|
244
179
|
/* @__PURE__ */ jsxs("div", {
|
|
245
180
|
className: "think-execution-workbench__content",
|
|
@@ -253,7 +188,7 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
253
188
|
id: runsId,
|
|
254
189
|
children: "Runs"
|
|
255
190
|
})
|
|
256
|
-
}),
|
|
191
|
+
}), runsQuery.isPending && runs.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
257
192
|
className: "think-execution-workbench__empty",
|
|
258
193
|
role: "status",
|
|
259
194
|
children: "Loading runs..."
|
|
@@ -269,16 +204,17 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
269
204
|
const selected = isSameThinkExecutionRun(selectedRun, run);
|
|
270
205
|
return /* @__PURE__ */ jsxs("li", {
|
|
271
206
|
"data-selected": selected || void 0,
|
|
272
|
-
children: [/* @__PURE__ */ jsxs(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
207
|
+
children: [/* @__PURE__ */ jsxs(NavigationLink, {
|
|
208
|
+
render: renderRunLink(run),
|
|
209
|
+
"data-slot": "button",
|
|
210
|
+
className: buttonVariants({
|
|
211
|
+
variant: "ghost",
|
|
212
|
+
color: "neutral",
|
|
213
|
+
size: "sm",
|
|
214
|
+
className: "think-execution-workbench__run"
|
|
215
|
+
}),
|
|
278
216
|
"aria-label": getThinkExecutionRunAccessibleName(run),
|
|
279
217
|
"aria-current": selected ? "page" : void 0,
|
|
280
|
-
disabled: busyAction !== null,
|
|
281
|
-
onClick: () => selectRun(run),
|
|
282
218
|
children: [/* @__PURE__ */ jsx(ThinkExecutionStatus, {
|
|
283
219
|
run,
|
|
284
220
|
className: "think-execution-workbench__icon"
|
|
@@ -296,10 +232,10 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
296
232
|
})]
|
|
297
233
|
})]
|
|
298
234
|
}), /* @__PURE__ */ jsx(RunActions, {
|
|
299
|
-
busy:
|
|
235
|
+
busy: actionIsPending,
|
|
300
236
|
run,
|
|
301
237
|
source,
|
|
302
|
-
onAction:
|
|
238
|
+
onAction: runAction
|
|
303
239
|
})]
|
|
304
240
|
}, `${kind}:${id}`);
|
|
305
241
|
})
|
|
@@ -314,4 +250,4 @@ function ThinkExecutionWorkbench({ backButton, className, onSelectedRunChange, p
|
|
|
314
250
|
});
|
|
315
251
|
}
|
|
316
252
|
//#endregion
|
|
317
|
-
export { ThinkExecutionWorkbench };
|
|
253
|
+
export { ThinkExecutionWorkbench, thinkExecutionRunsQueryOptions };
|
|
@@ -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,
|