@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
|
@@ -8,6 +8,7 @@ import * as React from "react";
|
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useAgentChat } from "@cloudflare/think/react";
|
|
10
10
|
import { useAgent, useAgentToolEvents } from "agents/react";
|
|
11
|
+
import { queryOptions, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
11
12
|
//#region src/components/_internal/think-approvals.ts
|
|
12
13
|
/**
|
|
13
14
|
* Ambient approvals belong to their stub. An explicit different stub may only
|
|
@@ -23,54 +24,69 @@ function resolveThinkApprovalProps(overrides, ambient) {
|
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
26
|
//#region src/components/ThinkChat.tsx
|
|
27
|
+
const EMPTY_PENDING_APPROVALS = [];
|
|
26
28
|
function toAgentChatStatus(chat) {
|
|
27
29
|
if (chat.status === "submitted") return "submitted";
|
|
28
30
|
if (chat.isStreaming || chat.isRecovering) return "streaming";
|
|
29
31
|
return chat.status ?? "ready";
|
|
30
32
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
React.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
refresh();
|
|
61
|
-
return () => {
|
|
62
|
-
requestIdRef.current += 1;
|
|
33
|
+
function thinkPendingExecutionApprovalsQueryKey(sourceKey) {
|
|
34
|
+
return [
|
|
35
|
+
"think",
|
|
36
|
+
sourceKey,
|
|
37
|
+
"pending-approvals"
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
/** Shared pending-approval options for components and TanStack Router loaders. */
|
|
41
|
+
function thinkPendingExecutionApprovalsQueryOptions(stub, sourceKey) {
|
|
42
|
+
return queryOptions({
|
|
43
|
+
queryKey: thinkPendingExecutionApprovalsQueryKey(sourceKey),
|
|
44
|
+
queryFn: () => stub.pendingApprovals(),
|
|
45
|
+
staleTime: 5e3
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function useThinkPendingExecutionApprovals(stub, sourceKey, refreshSignal) {
|
|
49
|
+
const queryClient = useQueryClient();
|
|
50
|
+
const approvalsQuery = useQuery(thinkPendingExecutionApprovalsQueryOptions(stub, sourceKey));
|
|
51
|
+
const refreshState = React.useRef({
|
|
52
|
+
sourceKey,
|
|
53
|
+
observedSignal: refreshSignal,
|
|
54
|
+
pending: false
|
|
55
|
+
});
|
|
56
|
+
const refetch = React.useEffectEvent(() => approvalsQuery.refetch());
|
|
57
|
+
const refreshPendingApprovals = React.useCallback(async () => {
|
|
58
|
+
const filters = {
|
|
59
|
+
queryKey: thinkPendingExecutionApprovalsQueryKey(sourceKey),
|
|
60
|
+
exact: true
|
|
63
61
|
};
|
|
62
|
+
await queryClient.cancelQueries(filters);
|
|
63
|
+
await queryClient.invalidateQueries(filters);
|
|
64
|
+
}, [queryClient, sourceKey]);
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
if (refreshState.current.sourceKey !== sourceKey) {
|
|
67
|
+
refreshState.current = {
|
|
68
|
+
sourceKey,
|
|
69
|
+
observedSignal: refreshSignal,
|
|
70
|
+
pending: false
|
|
71
|
+
};
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!Object.is(refreshState.current.observedSignal, refreshSignal)) {
|
|
75
|
+
refreshState.current.observedSignal = refreshSignal;
|
|
76
|
+
refreshState.current.pending = true;
|
|
77
|
+
}
|
|
78
|
+
if (approvalsQuery.isFetching || !refreshState.current.pending) return;
|
|
79
|
+
refreshState.current.pending = false;
|
|
80
|
+
refetch();
|
|
64
81
|
}, [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
approvalsQuery.isFetching,
|
|
83
|
+
refreshSignal,
|
|
84
|
+
sourceKey
|
|
68
85
|
]);
|
|
69
|
-
const pendingApprovals = state.source === stub ? state.pendingApprovals : [];
|
|
70
86
|
return React.useMemo(() => ({
|
|
71
|
-
pendingApprovals,
|
|
72
|
-
refreshPendingApprovals
|
|
73
|
-
}), [
|
|
87
|
+
pendingApprovals: approvalsQuery.data ?? EMPTY_PENDING_APPROVALS,
|
|
88
|
+
refreshPendingApprovals
|
|
89
|
+
}), [approvalsQuery.data, refreshPendingApprovals]);
|
|
74
90
|
}
|
|
75
91
|
/**
|
|
76
92
|
* Chat UI for Cloudflare Think agents. Provide a `useAgentChat` value (or let
|
|
@@ -90,16 +106,23 @@ function ThinkChatProvider({ agentTools, chat, children }) {
|
|
|
90
106
|
/**
|
|
91
107
|
* Batteries-included root: connects to the named Think agent (upstream's
|
|
92
108
|
* `useAgent` + `useAgentChat`) and provides the live chat to everything
|
|
93
|
-
* inside.
|
|
109
|
+
* inside. Render it beneath the app's `QueryClientProvider`. If the app
|
|
110
|
+
* already owns the chat hook, use `ThinkChat.Provider`.
|
|
94
111
|
*
|
|
95
112
|
* @example
|
|
96
113
|
* ```tsx
|
|
97
|
-
* <
|
|
98
|
-
* <ThinkChat.
|
|
99
|
-
*
|
|
114
|
+
* <QueryClientProvider client={queryClient}>
|
|
115
|
+
* <ThinkChat.Root
|
|
116
|
+
* agent="my-agent"
|
|
117
|
+
* name="session-1"
|
|
118
|
+
* sourceKey="api.example.com:account:acme:agent:session-1"
|
|
119
|
+
* >
|
|
120
|
+
* <ThinkChat.Messages />
|
|
121
|
+
* </ThinkChat.Root>
|
|
122
|
+
* </QueryClientProvider>
|
|
100
123
|
* ```
|
|
101
124
|
*/
|
|
102
|
-
function ThinkChatRoot({ agent: agentOption, name, children }) {
|
|
125
|
+
function ThinkChatRoot({ agent: agentOption, name, sourceKey, children }) {
|
|
103
126
|
const agent = useAgent(typeof agentOption === "string" ? {
|
|
104
127
|
agent: agentOption,
|
|
105
128
|
name
|
|
@@ -110,19 +133,21 @@ function ThinkChatRoot({ agent: agentOption, name, children }) {
|
|
|
110
133
|
const chat = useAgentChat({ agent });
|
|
111
134
|
const agentTools = useAgentToolEvents({ agent });
|
|
112
135
|
const agentIdentity = JSON.stringify(agent.path);
|
|
113
|
-
const approvals =
|
|
136
|
+
const approvals = useThinkPendingExecutionApprovals(agent.stub, sourceKey, `${chat.messages.length}:${chat.status}`);
|
|
137
|
+
const resetAgentTools = React.useEffectEvent(() => agentTools.resetLocalState());
|
|
114
138
|
React.useEffect(() => {
|
|
115
|
-
|
|
139
|
+
resetAgentTools();
|
|
116
140
|
}, [agentIdentity]);
|
|
141
|
+
const approvalsContext = React.useMemo(() => ({
|
|
142
|
+
...approvals,
|
|
143
|
+
thinkStub: agent.stub
|
|
144
|
+
}), [agent.stub, approvals]);
|
|
117
145
|
return /* @__PURE__ */ jsx(AgentToolRunsProvider, {
|
|
118
146
|
agentTools,
|
|
119
147
|
children: /* @__PURE__ */ jsx(ThinkChatContext.Provider, {
|
|
120
148
|
value: chat,
|
|
121
149
|
children: /* @__PURE__ */ jsx(ThinkChatApprovalsContext.Provider, {
|
|
122
|
-
value:
|
|
123
|
-
...approvals,
|
|
124
|
-
thinkStub: agent.stub
|
|
125
|
-
},
|
|
150
|
+
value: approvalsContext,
|
|
126
151
|
children
|
|
127
152
|
})
|
|
128
153
|
})
|
|
@@ -139,7 +164,7 @@ const ThinkChatApprovalsContext = React.createContext(null);
|
|
|
139
164
|
* inside the log) or `excludeTools` + your own `renderPart` (standalone
|
|
140
165
|
* card) — see README "App-specific tools" and the Custom Tool Panel story.
|
|
141
166
|
*/
|
|
142
|
-
function ThinkChatMessages({ composerHeader, renderPart, excludeTools,
|
|
167
|
+
function ThinkChatMessages({ composerHeader, renderPart, excludeTools, renderAgentToolRunLink, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, ...props }) {
|
|
143
168
|
const chat = useThinkChatContext("ThinkChat.Messages");
|
|
144
169
|
const agentTools = useOptionalAgentToolRuns();
|
|
145
170
|
const approvals = React.useContext(ThinkChatApprovalsContext);
|
|
@@ -155,13 +180,11 @@ function ThinkChatMessages({ composerHeader, renderPart, excludeTools, onAgentTo
|
|
|
155
180
|
});
|
|
156
181
|
const defaultRenderPart = React.useMemo(() => createThinkChatActivityRenderer({
|
|
157
182
|
excludeTools,
|
|
158
|
-
|
|
159
|
-
selectedAgentToolRunId,
|
|
183
|
+
renderAgentToolRunLink,
|
|
160
184
|
toolRenderers
|
|
161
185
|
}), [
|
|
162
186
|
excludeTools,
|
|
163
|
-
|
|
164
|
-
selectedAgentToolRunId,
|
|
187
|
+
renderAgentToolRunLink,
|
|
165
188
|
toolRenderers
|
|
166
189
|
]);
|
|
167
190
|
const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
|
|
@@ -176,8 +199,8 @@ function ThinkChatMessages({ composerHeader, renderPart, excludeTools, onAgentTo
|
|
|
176
199
|
return custom === void 0 ? renderBuiltIn() : custom;
|
|
177
200
|
} : defaultRenderPart, [defaultRenderPart, renderPart]);
|
|
178
201
|
const defaultNotice = /* @__PURE__ */ jsx(ThinkRecoveryNotice, { chat });
|
|
179
|
-
const backgroundRuns =
|
|
180
|
-
const resolvedComposerHeader = composerHeader || backgroundRuns?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [composerHeader, backgroundRuns?.length ? /* @__PURE__ */ jsxs("div", {
|
|
202
|
+
const backgroundRuns = renderAgentToolRunLink ? agentTools?.unboundRuns : void 0;
|
|
203
|
+
const resolvedComposerHeader = composerHeader || backgroundRuns?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [composerHeader, backgroundRuns?.length && renderAgentToolRunLink ? /* @__PURE__ */ jsxs("div", {
|
|
181
204
|
className: "subagent-run__tray",
|
|
182
205
|
"data-slot": "background-agent-runs",
|
|
183
206
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -186,8 +209,7 @@ function ThinkChatMessages({ composerHeader, renderPart, excludeTools, onAgentTo
|
|
|
186
209
|
}), /* @__PURE__ */ jsx(SubagentRunList, {
|
|
187
210
|
"aria-label": "Background agent runs",
|
|
188
211
|
runs: backgroundRuns,
|
|
189
|
-
|
|
190
|
-
onSelect: onAgentToolRunSelect
|
|
212
|
+
renderRunLink: renderAgentToolRunLink
|
|
191
213
|
})]
|
|
192
214
|
}) : null] }) : void 0;
|
|
193
215
|
return /* @__PURE__ */ jsx(AgentChat, {
|
|
@@ -205,7 +227,8 @@ function ThinkChatMessages({ composerHeader, renderPart, excludeTools, onAgentTo
|
|
|
205
227
|
onRegenerate: (messageId) => void chat.regenerate({ messageId }),
|
|
206
228
|
onSubmit: ({ text, files, references }) => {
|
|
207
229
|
const prompt = [...references?.map(({ trigger, value }) => trigger ? `${trigger}${value}` : value) ?? [], text.trim()].filter(Boolean).join(" ");
|
|
208
|
-
if (prompt
|
|
230
|
+
if (!prompt && !files.length) return;
|
|
231
|
+
return chat.sendMessage({
|
|
209
232
|
text: prompt,
|
|
210
233
|
files
|
|
211
234
|
});
|
|
@@ -236,4 +259,4 @@ const ThinkChat = {
|
|
|
236
259
|
createActivityRenderer: createThinkChatActivityRenderer
|
|
237
260
|
};
|
|
238
261
|
//#endregion
|
|
239
|
-
export {
|
|
262
|
+
export { thinkPendingExecutionApprovalsQueryOptions as a, resolveThinkApprovalProps as c, ThinkChatRoot as i, ThinkChatMessages as n, useThinkChat as o, ThinkChatProvider as r, useThinkPendingExecutionApprovals as s, ThinkChat as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-CyD2UB3V.js";
|
|
2
|
-
import { r as AgentChatProps } from "./AgentChat-
|
|
2
|
+
import { r as AgentChatProps } from "./AgentChat-ClxViuUM.js";
|
|
3
3
|
import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
|
|
@@ -28,10 +28,8 @@ interface ThinkChatActivityRendererOptions<MessageT extends UIMessage = UIMessag
|
|
|
28
28
|
excludeTools?: readonly string[];
|
|
29
29
|
/** Per-tool label/panel overrides inside the activity log, keyed by tool name. */
|
|
30
30
|
toolRenderers?: ThinkChatToolRenderers;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** Opens a whole upstream retained run in the host-owned detail surface. */
|
|
34
|
-
onAgentToolRunSelect?: (run: AgentToolRunState<MessageT["parts"][number]>) => void;
|
|
31
|
+
/** App-authored TanStack Router Link for each retained child destination. */
|
|
32
|
+
renderAgentToolRunLink?: (run: AgentToolRunState<MessageT["parts"][number]>) => React.ReactElement;
|
|
35
33
|
}
|
|
36
34
|
interface ThinkChatActivityProps {
|
|
37
35
|
/** Render with the log expanded. */
|
|
@@ -64,8 +62,7 @@ declare function ThinkChatActivity({
|
|
|
64
62
|
*/
|
|
65
63
|
declare function createThinkChatActivityRenderer<MessageT extends UIMessage = UIMessage>({
|
|
66
64
|
excludeTools,
|
|
67
|
-
|
|
68
|
-
selectedAgentToolRunId,
|
|
65
|
+
renderAgentToolRunLink,
|
|
69
66
|
toolRenderers
|
|
70
67
|
}?: ThinkChatActivityRendererOptions<MessageT>): NonNullable<AgentChatProps<MessageT>["renderPart"]>;
|
|
71
68
|
/** Default activity renderer — `createThinkChatActivityRenderer()` with no overrides. */
|
package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-
|
|
1
|
+
import { i as AgentActivityIconKind, s as AgentActivitySummary } from "./AgentActivity-D2SHSGFX.js";
|
|
2
2
|
import { l as ThinkChatPart } from "./ThinkChatToolParts-CSzVwMXf.js";
|
|
3
3
|
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
4
4
|
|
|
@@ -4,7 +4,7 @@ import { Toggle } from "@base-ui/react/toggle";
|
|
|
4
4
|
//#region src/components/Toggle.d.ts
|
|
5
5
|
interface ToggleVariantsOptions {
|
|
6
6
|
variant?: "default" | "outline" | null;
|
|
7
|
-
size?: "
|
|
7
|
+
size?: "sm" | "md" | "lg" | null;
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as ToggleVariantsOptions } from "./Toggle-
|
|
1
|
+
import { r as ToggleVariantsOptions } from "./Toggle-JKZ43D5S.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
4
4
|
import { Toggle } from "@base-ui/react/toggle";
|
|
5
5
|
|
|
6
6
|
//#region src/components/ToggleGroup.d.ts
|
|
7
|
-
type ToggleGroupSize = ToggleVariantsOptions["size"]
|
|
7
|
+
type ToggleGroupSize = ToggleVariantsOptions["size"];
|
|
8
8
|
interface ToggleGroupProps extends React.ComponentPropsWithRef<typeof ToggleGroup> {
|
|
9
9
|
variant?: ToggleVariantsOptions["variant"];
|
|
10
10
|
/**
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { a as WorkspaceMediaInfo, i as WorkspaceFileState, r as WorkspaceFileAssetResolver, t as WorkspaceFileAsset } from "./WorkspaceFile-CzyHnESE.js";
|
|
2
|
+
import { WorkspaceLike } from "@cloudflare/think";
|
|
3
|
+
import { FileInfo, Workspace } from "@cloudflare/shell";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Workspace.d.ts
|
|
6
|
+
/** Workspace summary, as returned by `Workspace.getWorkspaceInfo()` upstream. */
|
|
7
|
+
type WorkspaceInfo = Awaited<ReturnType<Workspace["getWorkspaceInfo"]>>;
|
|
8
|
+
/** Whole upstream workspace shapes, accepted without narrowing or mirroring. */
|
|
9
|
+
type WorkspaceSource = Workspace | WorkspaceLike;
|
|
10
|
+
interface UseWorkspaceOptions {
|
|
11
|
+
/** Must be referentially stable (memoize in the app). */
|
|
12
|
+
source: WorkspaceSource;
|
|
13
|
+
/**
|
|
14
|
+
* Stable, non-secret identity for the endpoint/account/tenant/workspace
|
|
15
|
+
* behind `source`. Change it whenever that backing workspace changes.
|
|
16
|
+
*/
|
|
17
|
+
sourceKey: string;
|
|
18
|
+
/** Root directory to list first. Defaults to "/". */
|
|
19
|
+
root?: string;
|
|
20
|
+
/** Route-owned selected file path. */
|
|
21
|
+
selectedPath: string | null;
|
|
22
|
+
/** Called when a non-link browser asks the app to select a file. */
|
|
23
|
+
onSelectedPathChange?: (path: string | null) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Optional host adapter called before text/binary reads. Return `null` for
|
|
26
|
+
* ordinary text files and prefer signed/range-friendly URLs for large media.
|
|
27
|
+
* The configured root scopes navigation; hosts must enforce authorization
|
|
28
|
+
* atomically when resolving assets across a trust boundary.
|
|
29
|
+
* Keep this resolver semantically stable for a given `sourceKey`; function
|
|
30
|
+
* identity is intentionally excluded from serializable query keys.
|
|
31
|
+
*/
|
|
32
|
+
resolveFileAsset?: WorkspaceFileAssetResolver;
|
|
33
|
+
/** Maximum size for the built-in buffered-byte fallback. Defaults to 32 MiB. */
|
|
34
|
+
maxInlineAssetBytes?: number;
|
|
35
|
+
}
|
|
36
|
+
interface WorkspaceState {
|
|
37
|
+
root: string;
|
|
38
|
+
/** Loaded directory listings, keyed by directory path. */
|
|
39
|
+
entriesByDirectory: Readonly<Record<string, readonly FileInfo[]>>;
|
|
40
|
+
/** Every loaded entry, keyed by its path. */
|
|
41
|
+
entryByPath: ReadonlyMap<string, FileInfo>;
|
|
42
|
+
expandedPaths: ReadonlySet<string>;
|
|
43
|
+
/** Update expansion; newly expanded directories load lazily. */
|
|
44
|
+
setExpandedPaths: (next: Set<string>) => void;
|
|
45
|
+
selectedPath: string | null;
|
|
46
|
+
/** Ask the route owner to select a file. */
|
|
47
|
+
selectFile: (path: string | null) => void;
|
|
48
|
+
/** The selected file once its read settles; null while loading. */
|
|
49
|
+
selectedFile: WorkspaceFileState | null;
|
|
50
|
+
/** Initial root/info load or explicit refresh in flight. */
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
/** Directory and file paths with a query in flight. */
|
|
53
|
+
loadingPaths: ReadonlySet<string>;
|
|
54
|
+
/** Root/directory listing failure. Per-file read errors live on the file state. */
|
|
55
|
+
error: string | null;
|
|
56
|
+
/** Workspace summary, when the source provides `getWorkspaceInfo`. */
|
|
57
|
+
info: WorkspaceInfo | null;
|
|
58
|
+
/** Reload the root, every expanded directory, and the selected file. */
|
|
59
|
+
refresh: () => void;
|
|
60
|
+
}
|
|
61
|
+
interface WorkspaceFileReadTarget {
|
|
62
|
+
requestedPath: string;
|
|
63
|
+
readPath: string;
|
|
64
|
+
info: FileInfo;
|
|
65
|
+
media: WorkspaceMediaInfo | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Source/root prefix for cache inspection, cancellation, or removal.
|
|
69
|
+
* Do not broadly invalidate this prefix: active file queries must refresh in
|
|
70
|
+
* stat → resolver → content order. Use a resource option key or `refresh()`.
|
|
71
|
+
*/
|
|
72
|
+
declare function workspaceQueryKey(sourceKey: string, root: string): readonly ["workspace", string, string];
|
|
73
|
+
type WorkspaceQueryKey = ReturnType<typeof workspaceQueryKey>;
|
|
74
|
+
/** Shared directory options for workspace components and route loaders. */
|
|
75
|
+
declare function workspaceDirectoryQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, path: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<readonly FileInfo[], Error, readonly FileInfo[], readonly ["workspace", string, string, "directory", string]>, "queryFn"> & {
|
|
76
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<readonly FileInfo[], readonly ["workspace", string, string, "directory", string], never> | undefined;
|
|
77
|
+
} & {
|
|
78
|
+
queryKey: readonly ["workspace", string, string, "directory", string] & {
|
|
79
|
+
[dataTagSymbol]: readonly FileInfo[];
|
|
80
|
+
[dataTagErrorSymbol]: Error;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/** Shared workspace-summary options for workspace components and route loaders. */
|
|
84
|
+
declare function workspaceInfoQueryOptions(source: WorkspaceSource, sourceKey: string, root: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
85
|
+
fileCount: number;
|
|
86
|
+
directoryCount: number;
|
|
87
|
+
totalBytes: number;
|
|
88
|
+
r2FileCount: number;
|
|
89
|
+
} | null, Error, {
|
|
90
|
+
fileCount: number;
|
|
91
|
+
directoryCount: number;
|
|
92
|
+
totalBytes: number;
|
|
93
|
+
r2FileCount: number;
|
|
94
|
+
} | null, readonly ["workspace", string, string, "info"]>, "queryFn"> & {
|
|
95
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
96
|
+
fileCount: number;
|
|
97
|
+
directoryCount: number;
|
|
98
|
+
totalBytes: number;
|
|
99
|
+
r2FileCount: number;
|
|
100
|
+
} | null, readonly ["workspace", string, string, "info"], never> | undefined;
|
|
101
|
+
} & {
|
|
102
|
+
queryKey: readonly ["workspace", string, string, "info"] & {
|
|
103
|
+
[dataTagSymbol]: {
|
|
104
|
+
fileCount: number;
|
|
105
|
+
directoryCount: number;
|
|
106
|
+
totalBytes: number;
|
|
107
|
+
r2FileCount: number;
|
|
108
|
+
} | null;
|
|
109
|
+
[dataTagErrorSymbol]: Error;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/** Re-stat and validate a requested path before any resolver or file read. */
|
|
113
|
+
declare function workspaceFileStatQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, requestedPath: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<WorkspaceFileReadTarget, Error, WorkspaceFileReadTarget, readonly ["workspace", string, string, "file", string, "stat"]>, "queryFn"> & {
|
|
114
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<WorkspaceFileReadTarget, readonly ["workspace", string, string, "file", string, "stat"], never> | undefined;
|
|
115
|
+
} & {
|
|
116
|
+
queryKey: readonly ["workspace", string, string, "file", string, "stat"] & {
|
|
117
|
+
[dataTagSymbol]: WorkspaceFileReadTarget;
|
|
118
|
+
[dataTagErrorSymbol]: Error;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/** Optional host asset resolution, scoped to the current stat result. */
|
|
122
|
+
declare function workspaceFileAssetQueryOptions(sourceKey: string, root: string, target: WorkspaceFileReadTarget, resolveFileAsset: WorkspaceFileAssetResolver): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
123
|
+
asset: WorkspaceFileAsset;
|
|
124
|
+
media: WorkspaceMediaInfo;
|
|
125
|
+
} | null, Error, {
|
|
126
|
+
asset: WorkspaceFileAsset;
|
|
127
|
+
media: WorkspaceMediaInfo;
|
|
128
|
+
} | null, readonly ["workspace", string, string, "file", string, "asset", {
|
|
129
|
+
readonly path: string;
|
|
130
|
+
readonly name: string;
|
|
131
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
132
|
+
readonly mimeType: string;
|
|
133
|
+
readonly size: number;
|
|
134
|
+
readonly createdAt: number;
|
|
135
|
+
readonly updatedAt: number;
|
|
136
|
+
readonly target: string | null;
|
|
137
|
+
}]>, "queryFn"> & {
|
|
138
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
139
|
+
asset: WorkspaceFileAsset;
|
|
140
|
+
media: WorkspaceMediaInfo;
|
|
141
|
+
} | null, readonly ["workspace", string, string, "file", string, "asset", {
|
|
142
|
+
readonly path: string;
|
|
143
|
+
readonly name: string;
|
|
144
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
145
|
+
readonly mimeType: string;
|
|
146
|
+
readonly size: number;
|
|
147
|
+
readonly createdAt: number;
|
|
148
|
+
readonly updatedAt: number;
|
|
149
|
+
readonly target: string | null;
|
|
150
|
+
}], never> | undefined;
|
|
151
|
+
} & {
|
|
152
|
+
queryKey: readonly ["workspace", string, string, "file", string, "asset", {
|
|
153
|
+
readonly path: string;
|
|
154
|
+
readonly name: string;
|
|
155
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
156
|
+
readonly mimeType: string;
|
|
157
|
+
readonly size: number;
|
|
158
|
+
readonly createdAt: number;
|
|
159
|
+
readonly updatedAt: number;
|
|
160
|
+
readonly target: string | null;
|
|
161
|
+
}] & {
|
|
162
|
+
[dataTagSymbol]: {
|
|
163
|
+
asset: WorkspaceFileAsset;
|
|
164
|
+
media: WorkspaceMediaInfo;
|
|
165
|
+
} | null;
|
|
166
|
+
[dataTagErrorSymbol]: Error;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/** Cached text read options, scoped to the validated stat result. */
|
|
170
|
+
declare function workspaceTextFileQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, target: WorkspaceFileReadTarget): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string | null, Error, string | null, readonly ["workspace", string, string, "file", string, "text", {
|
|
171
|
+
readonly path: string;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
174
|
+
readonly mimeType: string;
|
|
175
|
+
readonly size: number;
|
|
176
|
+
readonly createdAt: number;
|
|
177
|
+
readonly updatedAt: number;
|
|
178
|
+
readonly target: string | null;
|
|
179
|
+
}]>, "queryFn"> & {
|
|
180
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<string | null, readonly ["workspace", string, string, "file", string, "text", {
|
|
181
|
+
readonly path: string;
|
|
182
|
+
readonly name: string;
|
|
183
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
184
|
+
readonly mimeType: string;
|
|
185
|
+
readonly size: number;
|
|
186
|
+
readonly createdAt: number;
|
|
187
|
+
readonly updatedAt: number;
|
|
188
|
+
readonly target: string | null;
|
|
189
|
+
}], never> | undefined;
|
|
190
|
+
} & {
|
|
191
|
+
queryKey: readonly ["workspace", string, string, "file", string, "text", {
|
|
192
|
+
readonly path: string;
|
|
193
|
+
readonly name: string;
|
|
194
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
195
|
+
readonly mimeType: string;
|
|
196
|
+
readonly size: number;
|
|
197
|
+
readonly createdAt: number;
|
|
198
|
+
readonly updatedAt: number;
|
|
199
|
+
readonly target: string | null;
|
|
200
|
+
}] & {
|
|
201
|
+
[dataTagSymbol]: string | null;
|
|
202
|
+
[dataTagErrorSymbol]: Error;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
/** Active-file-only buffered asset options, scoped to the validated stat result. */
|
|
206
|
+
declare function workspaceBinaryFileQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, target: WorkspaceFileReadTarget, maxInlineAssetBytes: number): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
|
|
207
|
+
asset: WorkspaceFileAsset;
|
|
208
|
+
media: WorkspaceMediaInfo;
|
|
209
|
+
} | null, Error, {
|
|
210
|
+
asset: WorkspaceFileAsset;
|
|
211
|
+
media: WorkspaceMediaInfo;
|
|
212
|
+
} | null, readonly ["workspace", string, string, "file", string, "bytes", {
|
|
213
|
+
readonly path: string;
|
|
214
|
+
readonly name: string;
|
|
215
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
216
|
+
readonly mimeType: string;
|
|
217
|
+
readonly size: number;
|
|
218
|
+
readonly createdAt: number;
|
|
219
|
+
readonly updatedAt: number;
|
|
220
|
+
readonly target: string | null;
|
|
221
|
+
}, {
|
|
222
|
+
readonly maxInlineAssetBytes: number;
|
|
223
|
+
}]>, "queryFn"> & {
|
|
224
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<{
|
|
225
|
+
asset: WorkspaceFileAsset;
|
|
226
|
+
media: WorkspaceMediaInfo;
|
|
227
|
+
} | null, readonly ["workspace", string, string, "file", string, "bytes", {
|
|
228
|
+
readonly path: string;
|
|
229
|
+
readonly name: string;
|
|
230
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
231
|
+
readonly mimeType: string;
|
|
232
|
+
readonly size: number;
|
|
233
|
+
readonly createdAt: number;
|
|
234
|
+
readonly updatedAt: number;
|
|
235
|
+
readonly target: string | null;
|
|
236
|
+
}, {
|
|
237
|
+
readonly maxInlineAssetBytes: number;
|
|
238
|
+
}], never> | undefined;
|
|
239
|
+
} & {
|
|
240
|
+
queryKey: readonly ["workspace", string, string, "file", string, "bytes", {
|
|
241
|
+
readonly path: string;
|
|
242
|
+
readonly name: string;
|
|
243
|
+
readonly type: import("@cloudflare/shell").EntryType;
|
|
244
|
+
readonly mimeType: string;
|
|
245
|
+
readonly size: number;
|
|
246
|
+
readonly createdAt: number;
|
|
247
|
+
readonly updatedAt: number;
|
|
248
|
+
readonly target: string | null;
|
|
249
|
+
}, {
|
|
250
|
+
readonly maxInlineAssetBytes: number;
|
|
251
|
+
}] & {
|
|
252
|
+
[dataTagSymbol]: {
|
|
253
|
+
asset: WorkspaceFileAsset;
|
|
254
|
+
media: WorkspaceMediaInfo;
|
|
255
|
+
} | null;
|
|
256
|
+
[dataTagErrorSymbol]: Error;
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Headless state for browsing a Think workspace. TanStack Query owns remote
|
|
261
|
+
* directory, metadata, resolver, text, and byte lifecycles; the route owns
|
|
262
|
+
* selection, while this hook only keeps local tree expansion state.
|
|
263
|
+
*/
|
|
264
|
+
declare function useWorkspace({
|
|
265
|
+
source,
|
|
266
|
+
sourceKey,
|
|
267
|
+
root,
|
|
268
|
+
selectedPath,
|
|
269
|
+
onSelectedPathChange,
|
|
270
|
+
resolveFileAsset,
|
|
271
|
+
maxInlineAssetBytes
|
|
272
|
+
}: UseWorkspaceOptions): WorkspaceState;
|
|
273
|
+
//#endregion
|
|
274
|
+
export { WorkspaceSource as a, workspaceBinaryFileQueryOptions as c, workspaceFileStatQueryOptions as d, workspaceInfoQueryOptions as f, WorkspaceQueryKey as i, workspaceDirectoryQueryOptions as l, workspaceTextFileQueryOptions as m, WorkspaceFileReadTarget as n, WorkspaceState as o, workspaceQueryKey as p, WorkspaceInfo as r, useWorkspace as s, UseWorkspaceOptions as t, workspaceFileAssetQueryOptions as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as WorkspaceNavigationAdapter } from "./WorkspaceLink-
|
|
2
|
-
import {
|
|
1
|
+
import { l as WorkspaceNavigationAdapter } from "./WorkspaceLink-O-EBKUJ8.js";
|
|
2
|
+
import { o as WorkspaceState } from "./Workspace-Jez8ffUj.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/components/WorkspaceExplorer.d.ts
|