@mcp-b/react-components 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentChat-403mckDG.d.ts +101 -0
- package/dist/BrowserLiveView-ZktFZiMD.d.ts +47 -0
- package/dist/BrowserReplay-6G-mnwcn.d.ts +40 -0
- package/dist/{CodeBlock-BK0sOAbV.js → CodeBlock-XNQOupQ3.js} +1 -1
- package/dist/{FileTree-BWQZ0FSi.js → FileTree-wMyZhhHO.js} +1 -1
- package/dist/ModelSelector-9G_-GooI.js +306 -0
- package/dist/ThinkChatActivity-CeHzk6-K.d.ts +73 -0
- package/dist/ThinkChatContext-BLAAb8J5.d.ts +28 -0
- package/dist/components/Activity.js +1 -1
- package/dist/components/AgentChat.d.ts +1 -100
- package/dist/components/AgentChat.js +12 -7
- package/dist/components/AgentConnection.d.ts +43 -2
- package/dist/components/AgentConnection.js +154 -3
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.d.ts +1 -46
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.d.ts +1 -39
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.d.ts +38 -0
- package/dist/components/ChatGptSignInScreen.js +201 -0
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/Commit.js +1 -1
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/EnvironmentVariables.js +1 -1
- package/dist/components/FileTree.js +1 -1
- package/dist/components/McpServerPicker.js +7 -5
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.js +2 -2
- package/dist/components/ModelSelector.js +1 -305
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/PromptInput.js +6 -5
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.js +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.js +1 -1
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +4 -3
- package/dist/components/TestResults.js +1 -1
- package/dist/components/ThinkChat.d.ts +15 -7
- package/dist/components/ThinkChat.js +1 -1
- package/dist/components/ThinkChatActivity.d.ts +2 -72
- package/dist/components/ThinkChatActivity.js +4 -3
- package/dist/components/ThinkChatContext.d.ts +1 -27
- package/dist/components/ThinkChatToolPanels.js +1 -1
- package/dist/components/ThinkChatToolParts.js +4 -4
- package/dist/components/ThinkExecutionWorkbench.d.ts +27 -0
- package/dist/components/ThinkExecutionWorkbench.js +450 -0
- package/dist/components/ThinkFullApp.d.ts +61 -0
- package/dist/components/ThinkFullApp.js +258 -0
- package/dist/components/ThinkThreadPicker.d.ts +88 -0
- package/dist/components/ThinkThreadPicker.js +282 -0
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/WorkspaceExplorer.js +5 -4
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-CB2MWcau.js → copy-button-C6JSKtFE.js} +1 -1
- package/dist/{icons-BYpJY6L2.d.ts → icons-CbjtbIJK.d.ts} +3 -1
- package/dist/{icons-BCNawx-T.js → icons-D2Q5n5C1.js} +37 -1
- package/dist/styles/agent-connection.css +33 -5
- package/dist/styles/chatgpt-sign-in-screen.css +224 -0
- package/dist/styles/code-block.css +3 -1
- package/dist/styles/index.css +3 -0
- package/dist/styles/message-scroller.css +24 -1
- package/dist/styles/prompt-input.css +1 -0
- package/dist/styles/think-full-app.css +731 -0
- package/dist/styles/think-thread-picker.css +449 -0
- package/dist/utils/mcp-server-catalog.d.ts +28 -3
- package/dist/utils/mcp-server-catalog.js +27 -1
- package/package.json +7 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { C as MonitorIcon, E as PencilIcon, F as WarningIcon, L as XIcon, M as SpinnerIcon, N as SquareIcon, O as PlusIcon, h as FileIcon, i as ArrowUpIcon, o as ChevronDownIcon, w as PaperclipIcon } from "../icons-D2Q5n5C1.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
|
|
5
5
|
import { t as AttachmentPreview } from "../attachment-preview-ChtC3HiU.js";
|
|
@@ -9,6 +9,7 @@ import { Select, SelectContent, SelectItem, SelectPortal, SelectPositioner, Sele
|
|
|
9
9
|
import { Tab, TabPanel, TabsList } from "./Tabs.js";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { getToolApproval, getToolInput, getToolOutput } from "@cloudflare/think/react";
|
|
12
13
|
import { getToolName, isToolUIPart } from "ai";
|
|
13
14
|
//#region src/components/PromptInput.tsx
|
|
14
15
|
const PromptInputContext = React.createContext(null);
|
|
@@ -659,17 +660,17 @@ function PromptInputSubmit({ className, status = "ready", onStop, variant = "nor
|
|
|
659
660
|
}
|
|
660
661
|
function getPausedExecution(part) {
|
|
661
662
|
if (part.state !== "output-available") return void 0;
|
|
662
|
-
const output = part
|
|
663
|
+
const output = getToolOutput(part);
|
|
663
664
|
return output?.status === "paused" && typeof output.executionId === "string" ? output : void 0;
|
|
664
665
|
}
|
|
665
666
|
/** The id a response must carry: the approval id, or the paused run's executionId. */
|
|
666
667
|
function getApprovalRequestId(part) {
|
|
667
|
-
if (part.state === "approval-requested") return part
|
|
668
|
+
if (part.state === "approval-requested") return getToolApproval(part)?.id;
|
|
668
669
|
return getPausedExecution(part)?.executionId;
|
|
669
670
|
}
|
|
670
671
|
/** Component-local identity: paused executions can ask for multiple approvals. */
|
|
671
672
|
function getApprovalStateKey(part) {
|
|
672
|
-
if (part.state === "approval-requested") return part
|
|
673
|
+
if (part.state === "approval-requested") return getToolApproval(part)?.id;
|
|
673
674
|
const paused = getPausedExecution(part);
|
|
674
675
|
if (!paused) return void 0;
|
|
675
676
|
const seq = paused.pending[0]?.seq;
|
|
@@ -736,7 +737,7 @@ function PromptInputApproval({ part, approval: durableApproval, onRespond, execu
|
|
|
736
737
|
}
|
|
737
738
|
};
|
|
738
739
|
const submit = () => void respond(selected === "approve");
|
|
739
|
-
const input = durableApproval?.descriptor.input ?? (part
|
|
740
|
+
const input = durableApproval?.descriptor.input ?? (part ? getToolInput(part) : void 0);
|
|
740
741
|
const inputEntries = input && typeof input === "object" && !Array.isArray(input) ? Object.entries(input) : void 0;
|
|
741
742
|
return /* @__PURE__ */ jsxs("div", {
|
|
742
743
|
ref,
|
package/dist/components/Queue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import { a as CheckIcon, c as ChevronRightIcon,
|
|
3
|
+
import { a as CheckIcon, c as ChevronRightIcon, h as FileIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
|
|
4
4
|
import { Button } from "./Button.js";
|
|
5
5
|
import { Badge } from "./Badge.js";
|
|
6
6
|
import { ScrollArea } from "./ScrollArea.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import { c as ChevronRightIcon } from "../icons-
|
|
3
|
+
import { c as ChevronRightIcon } from "../icons-D2Q5n5C1.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cjk } from "@streamdown/cjk";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CheckIcon, i as ArrowUpIcon, t as ArrowDownIcon } from "../icons-
|
|
1
|
+
import { a as CheckIcon, i as ArrowUpIcon, t as ArrowDownIcon } from "../icons-D2Q5n5C1.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import {
|
|
3
|
+
import { b as LinkIcon, c as ChevronRightIcon } from "../icons-D2Q5n5C1.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Sources.tsx
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { M as SpinnerIcon, a as CheckIcon } from "../icons-D2Q5n5C1.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/Stepper.tsx
|
package/dist/components/Task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import {
|
|
3
|
+
import { A as SearchIcon, c as ChevronRightIcon, h as FileIcon } from "../icons-D2Q5n5C1.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Task.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { L as XIcon, P as TerminalIcon } from "../icons-D2Q5n5C1.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
|
|
5
|
-
import { t as CopyButton } from "../copy-button-
|
|
5
|
+
import { t as CopyButton } from "../copy-button-C6JSKtFE.js";
|
|
6
6
|
import { Badge } from "./Badge.js";
|
|
7
7
|
import { ScrollArea } from "./ScrollArea.js";
|
|
8
8
|
import * as React from "react";
|
|
@@ -165,7 +165,8 @@ function TerminalContent({ className, ref, ...props }) {
|
|
|
165
165
|
]);
|
|
166
166
|
const handleScroll = (e) => {
|
|
167
167
|
const target = e.currentTarget;
|
|
168
|
-
|
|
168
|
+
const atBottom = target.scrollHeight - target.scrollTop - target.clientHeight < 8;
|
|
169
|
+
setStickToBottom(atBottom);
|
|
169
170
|
};
|
|
170
171
|
return /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
171
172
|
ref,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollapsiblePanel, CollapsibleRoot, CollapsibleTrigger } from "./Collapsible.js";
|
|
2
2
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
3
|
-
import {
|
|
3
|
+
import { L as XIcon, M as SpinnerIcon, a as CheckIcon, c as ChevronRightIcon } from "../icons-D2Q5n5C1.js";
|
|
4
4
|
import { Badge } from "./Badge.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { n as ExecutionApprovals } from "../PromptInput-D6-G24p7.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { a as AgentChatRenderPartContext, r as AgentChatProps } from "../AgentChat-403mckDG.js";
|
|
3
|
+
import { n as BrowserLiveViewProps, t as BrowserLiveView } from "../BrowserLiveView-ZktFZiMD.js";
|
|
4
|
+
import { n as BrowserReplayProps, t as BrowserReplay } from "../BrowserReplay-6G-mnwcn.js";
|
|
5
5
|
import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-DnUiZgCC.js";
|
|
6
|
-
import {
|
|
7
|
-
import { ThinkChatValue } from "
|
|
6
|
+
import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-CeHzk6-K.js";
|
|
7
|
+
import { n as ThinkChatValue } from "../ThinkChatContext-BLAAb8J5.js";
|
|
8
8
|
import { FileInfo, UseWorkspaceOptions, WorkspaceExplorer, WorkspaceExplorerProps, WorkspaceFileState, WorkspaceInfo, WorkspaceSource, WorkspaceState, inferWorkspaceLanguage, useWorkspace } from "./WorkspaceExplorer.js";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { UIMessage } from "ai";
|
|
11
11
|
import { UseAgentOptions } from "agents/react";
|
|
12
|
+
import { PendingApproval, Think } from "@cloudflare/think";
|
|
13
|
+
import { AgentStub } from "agents/client";
|
|
12
14
|
|
|
13
15
|
//#region src/components/ThinkChat.d.ts
|
|
16
|
+
type ThinkAgent<State> = Think<object, State>;
|
|
17
|
+
type ThinkApprovalStub<State = unknown> = AgentStub<ThinkAgent<State>>;
|
|
14
18
|
interface ThinkChatProviderProps {
|
|
15
|
-
/** The `useAgentChat` value from
|
|
19
|
+
/** The `useAgentChat` value from `@cloudflare/think/react` that descendants read. */
|
|
16
20
|
chat: ThinkChatValue;
|
|
17
21
|
children: React.ReactNode;
|
|
18
22
|
}
|
|
@@ -55,6 +59,10 @@ interface ThinkChatMessagesProps extends ThinkChatActivityRendererOptions {
|
|
|
55
59
|
*/
|
|
56
60
|
contextWindow?: AgentChatProps["contextWindow"];
|
|
57
61
|
}
|
|
62
|
+
declare function useThinkPendingApprovals(stub: ThinkApprovalStub, refreshKey: unknown): {
|
|
63
|
+
pendingApprovals: readonly PendingApproval[];
|
|
64
|
+
executionApprovals: ExecutionApprovals;
|
|
65
|
+
};
|
|
58
66
|
/**
|
|
59
67
|
* Chat UI for Cloudflare Think agents. Provide a `useAgentChat` value (or let
|
|
60
68
|
* `ThinkChat.Root` create one) and `ThinkChat.Messages` renders the message
|
|
@@ -137,4 +145,4 @@ declare const ThinkChat: {
|
|
|
137
145
|
createActivityRenderer: typeof createThinkChatActivityRenderer;
|
|
138
146
|
};
|
|
139
147
|
//#endregion
|
|
140
|
-
export { BrowserLiveView, type BrowserLiveViewProps, BrowserReplay, type BrowserReplayProps, type ExecutionApprovals, type FileInfo, ThinkChat, ThinkChatActivity, type ThinkChatActivityProps, type ThinkChatActivityRendererOptions, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, type ThinkChatToolRenderer, type ThinkChatToolRenderers, type UseWorkspaceOptions, WorkspaceExplorer, type WorkspaceExplorerProps, type WorkspaceFileState, type WorkspaceInfo, type WorkspaceSource, type WorkspaceState, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useWorkspace };
|
|
148
|
+
export { BrowserLiveView, type BrowserLiveViewProps, BrowserReplay, type BrowserReplayProps, type ExecutionApprovals, type FileInfo, ThinkApprovalStub, ThinkChat, ThinkChatActivity, type ThinkChatActivityProps, type ThinkChatActivityRendererOptions, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, type ThinkChatToolRenderer, type ThinkChatToolRenderers, type UseWorkspaceOptions, WorkspaceExplorer, type WorkspaceExplorerProps, type WorkspaceFileState, type WorkspaceInfo, type WorkspaceSource, type WorkspaceState, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useThinkPendingApprovals, useWorkspace };
|
|
@@ -155,4 +155,4 @@ const ThinkChat = {
|
|
|
155
155
|
createActivityRenderer: createThinkChatActivityRenderer
|
|
156
156
|
};
|
|
157
157
|
//#endregion
|
|
158
|
-
export { BrowserLiveView, BrowserReplay, ThinkChat, ThinkChatActivity, ThinkChatMessages, ThinkChatProvider, ThinkChatRoot, WorkspaceExplorer, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useWorkspace };
|
|
158
|
+
export { BrowserLiveView, BrowserReplay, ThinkChat, ThinkChatActivity, ThinkChatMessages, ThinkChatProvider, ThinkChatRoot, WorkspaceExplorer, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useThinkPendingApprovals, useWorkspace };
|
|
@@ -1,73 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
|
|
5
|
-
|
|
6
|
-
//#region src/components/ThinkChatActivity.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Bespoke rendering for one tool inside the activity log. Both hooks fall
|
|
9
|
-
* through to the built-in families when they return `undefined`, so an
|
|
10
|
-
* override can adjust just the label or just the panel.
|
|
11
|
-
*/
|
|
12
|
-
interface ThinkChatToolRenderer {
|
|
13
|
-
/** One-line step label. `null` hides the step from the log. */
|
|
14
|
-
describe?: (part: ToolUIPart | DynamicToolUIPart) => string | null | undefined;
|
|
15
|
-
/** Expanded detail under the step. `null` keeps the step a plain row. */
|
|
16
|
-
panel?: (part: ToolUIPart | DynamicToolUIPart) => React.ReactNode;
|
|
17
|
-
}
|
|
18
|
-
type ThinkChatToolRenderers = Record<string, ThinkChatToolRenderer>;
|
|
19
|
-
interface ThinkChatActivityRendererOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Tool names to keep out of activity folding entirely — the run splits
|
|
22
|
-
* around them and they fall through to your own renderPart / AgentChat's
|
|
23
|
-
* generic standalone activity row. For tools that should stay in the log
|
|
24
|
-
* with custom UI, use `toolRenderers` instead.
|
|
25
|
-
*/
|
|
26
|
-
excludeTools?: readonly string[];
|
|
27
|
-
/** Per-tool label/panel overrides inside the activity log, keyed by tool name. */
|
|
28
|
-
toolRenderers?: ThinkChatToolRenderers;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* One-line natural-language label for an activity part ("Ran vp test",
|
|
32
|
-
* "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
|
|
33
|
-
* aren't steps (step-start). Exported so a custom `renderPart` can reuse the
|
|
34
|
-
* built-in labels for tools it doesn't override.
|
|
35
|
-
*/
|
|
36
|
-
declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolRenderers): string | null;
|
|
37
|
-
interface ThinkChatActivityProps {
|
|
38
|
-
/** Render with the log expanded. */
|
|
39
|
-
defaultOpen?: boolean;
|
|
40
|
-
parts: readonly ThinkChatPart[];
|
|
41
|
-
/** Defaults to deriving from part states (reasoning streaming, tool awaiting output). */
|
|
42
|
-
isStreaming?: boolean;
|
|
43
|
-
/** Per-tool label/panel overrides, keyed by tool name. */
|
|
44
|
-
toolRenderers?: ThinkChatToolRenderers;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* One run of agent work as a collapsed Activity block: while streaming the
|
|
48
|
-
* label shimmers with the live step; settled, it becomes a short summary
|
|
49
|
-
* ("Thought, read 2 files and ran a command") over an expandable step log
|
|
50
|
-
* with per-tool panels. Normally reached through `ThinkChat.Messages`;
|
|
51
|
-
* exported for apps that lay out messages themselves.
|
|
52
|
-
*/
|
|
53
|
-
declare function ThinkChatActivity({
|
|
54
|
-
parts,
|
|
55
|
-
defaultOpen,
|
|
56
|
-
isStreaming,
|
|
57
|
-
toolRenderers
|
|
58
|
-
}: ThinkChatActivityProps): React.JSX.Element | null;
|
|
59
|
-
/**
|
|
60
|
-
* Builds a renderPart handler that folds every run of consecutive activity
|
|
61
|
-
* parts (reasoning + tool calls) into one collapsed Activity box. Everything
|
|
62
|
-
* is derived from the UIMessage stream: part order, tool states, reasoning
|
|
63
|
-
* state. Excluded tools split the run and return undefined so your own
|
|
64
|
-
* renderPart (or AgentChat's generic activity row) takes over for them.
|
|
65
|
-
*/
|
|
66
|
-
declare function createThinkChatActivityRenderer({
|
|
67
|
-
excludeTools,
|
|
68
|
-
toolRenderers
|
|
69
|
-
}?: ThinkChatActivityRendererOptions): NonNullable<AgentChatProps["renderPart"]>;
|
|
70
|
-
/** Default activity renderer — `createThinkChatActivityRenderer()` with no overrides. */
|
|
71
|
-
declare const renderThinkChatActivityPart: (context: AgentChatRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
|
|
72
|
-
//#endregion
|
|
1
|
+
import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-DnUiZgCC.js";
|
|
2
|
+
import { a as ThinkChatToolRenderers, c as renderThinkChatActivityPart, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as describeThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-CeHzk6-K.js";
|
|
73
3
|
export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, isThinkChatActivityPart, renderThinkChatActivityPart };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as SearchIcon, C as MonitorIcon, E as PencilIcon, F as WarningIcon, I as WrenchIcon, P as TerminalIcon, b as LinkIcon, h as FileIcon, y as InfoIcon } from "../icons-D2Q5n5C1.js";
|
|
2
2
|
import { Activity, ActivityContent, ActivityItem, ActivityItemGroup, ActivityText, ActivityTrigger } from "./Activity.js";
|
|
3
3
|
import { ThinkChatContext } from "./ThinkChatContext.js";
|
|
4
4
|
import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
|
|
5
5
|
import { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel } from "./ThinkChatToolPanels.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { getToolInput, getToolOutput } from "@cloudflare/think/react";
|
|
8
9
|
import { getToolName, isReasoningUIPart, isToolUIPart } from "ai";
|
|
9
10
|
//#region src/components/ThinkChatActivity.tsx
|
|
10
11
|
function summarizeToolInput(input) {
|
|
@@ -114,13 +115,13 @@ function genericToolLabels(name, hasUrl) {
|
|
|
114
115
|
function describeGenericToolPart(part) {
|
|
115
116
|
const labels = genericToolLabels(getToolName(part), activityPartUrl(part) !== null);
|
|
116
117
|
const label = isPartFailed(part) ? labels.failed : isPartWorking(part) ? labels.working : labels.done;
|
|
117
|
-
const detail = summarizeToolInput(part
|
|
118
|
+
const detail = summarizeToolInput(getToolInput(part));
|
|
118
119
|
return detail ? `${label} · ${detail}` : label;
|
|
119
120
|
}
|
|
120
121
|
function activityPartUrl(part) {
|
|
121
122
|
if (isFetchToolPart(part)) return firstHttpUrl(part.input?.url ?? part.input?.path);
|
|
122
123
|
if (isBrowserToolPart(part) && part.type !== "tool-browser_execute") return firstHttpUrl(part.input?.url);
|
|
123
|
-
if (isToolUIPart(part) && !isExecuteToolPart(part)) return firstHttpUrl(part
|
|
124
|
+
if (isToolUIPart(part) && !isExecuteToolPart(part)) return firstHttpUrl(getToolInput(part)) ?? (part.state === "output-available" ? firstHttpUrl(getToolOutput(part)) : null);
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
126
127
|
function activityPartIconKind(part) {
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { UIMessage } from "ai";
|
|
3
|
-
import { useAgentChat } from "@cloudflare/think/react";
|
|
4
|
-
|
|
5
|
-
//#region src/components/ThinkChatContext.d.ts
|
|
6
|
-
type ThinkChatValue = ReturnType<typeof useAgentChat<unknown, UIMessage>>;
|
|
7
|
-
declare const ThinkChatContext: React.Context<(Omit<import("@ai-sdk/react").UseChatHelpers<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>, "addToolOutput"> & {
|
|
8
|
-
clearHistory: () => void;
|
|
9
|
-
addToolOutput: (opts: {
|
|
10
|
-
toolCallId: string;
|
|
11
|
-
toolName?: string;
|
|
12
|
-
output?: unknown;
|
|
13
|
-
state?: "output-available" | "output-error";
|
|
14
|
-
errorText?: string;
|
|
15
|
-
}) => void;
|
|
16
|
-
isServerStreaming: boolean;
|
|
17
|
-
isStreaming: boolean;
|
|
18
|
-
isRecovering: boolean;
|
|
19
|
-
isToolContinuation: boolean;
|
|
20
|
-
connectionError: (Error & {
|
|
21
|
-
code: number;
|
|
22
|
-
reason: string;
|
|
23
|
-
wasClean: boolean;
|
|
24
|
-
}) | null;
|
|
25
|
-
}) | null>;
|
|
26
|
-
declare function useThinkChatContext(component: string): ThinkChatValue;
|
|
27
|
-
//#endregion
|
|
1
|
+
import { n as ThinkChatValue, r as useThinkChatContext, t as ThinkChatContext } from "../ThinkChatContext-BLAAb8J5.js";
|
|
28
2
|
export { ThinkChatContext, ThinkChatValue, useThinkChatContext };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityOutput, ActivityPanel } from "./Activity.js";
|
|
2
2
|
import { Tab, TabPanel, Tabs, TabsList } from "./Tabs.js";
|
|
3
|
-
import { t as CodeBlock } from "../CodeBlock-
|
|
3
|
+
import { t as CodeBlock } from "../CodeBlock-XNQOupQ3.js";
|
|
4
4
|
import { BrowserLiveView } from "./BrowserLiveView.js";
|
|
5
5
|
import { displayUrl } from "./ThinkChatToolParts.js";
|
|
6
6
|
import * as React from "react";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
|
|
2
1
|
import { getToolPartState } from "@cloudflare/think/react";
|
|
2
|
+
import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
|
|
3
3
|
//#region src/components/ThinkChatToolParts.ts
|
|
4
|
-
const WORKSPACE_TOOL_NAMES = new Set([
|
|
4
|
+
const WORKSPACE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
5
5
|
"read",
|
|
6
6
|
"write",
|
|
7
7
|
"edit",
|
|
@@ -14,7 +14,7 @@ const WORKSPACE_TOOL_NAMES = new Set([
|
|
|
14
14
|
function isWorkspaceToolPart(part) {
|
|
15
15
|
return isStaticToolUIPart(part) && WORKSPACE_TOOL_NAMES.has(getStaticToolName(part));
|
|
16
16
|
}
|
|
17
|
-
const SKILL_TOOL_NAMES = new Set([
|
|
17
|
+
const SKILL_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
18
18
|
"activate_skill",
|
|
19
19
|
"read_skill_resource",
|
|
20
20
|
"run_skill_script"
|
|
@@ -25,7 +25,7 @@ function isSkillToolPart(part) {
|
|
|
25
25
|
function isFetchToolPart(part) {
|
|
26
26
|
return isStaticToolUIPart(part) && getStaticToolName(part).startsWith("fetch_");
|
|
27
27
|
}
|
|
28
|
-
const BROWSER_TOOL_NAMES = new Set([
|
|
28
|
+
const BROWSER_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
29
29
|
"browser_execute",
|
|
30
30
|
"browser_markdown",
|
|
31
31
|
"browser_extract",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Think } from "@cloudflare/think";
|
|
3
|
+
import { AgentStub } from "agents/client";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ThinkExecutionWorkbench.d.ts
|
|
6
|
+
type ThinkExecutionAgent<State = unknown> = Think<object, State>;
|
|
7
|
+
type ThinkExecutionWorkbenchSource<State = unknown> = AgentStub<ThinkExecutionAgent<State>>;
|
|
8
|
+
interface ThinkExecutionWorkbenchProps<State = unknown> extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
9
|
+
/** Agents SDK client stub for a Think agent; this UI calls native submission/workflow methods. */
|
|
10
|
+
source: ThinkExecutionWorkbenchSource<State>;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
backButton?: React.ReactNode;
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
}
|
|
15
|
+
declare function ThinkExecutionWorkbench<State = unknown>({
|
|
16
|
+
backButton,
|
|
17
|
+
className,
|
|
18
|
+
pageSize,
|
|
19
|
+
ref,
|
|
20
|
+
source,
|
|
21
|
+
title,
|
|
22
|
+
...props
|
|
23
|
+
}: ThinkExecutionWorkbenchProps<State> & {
|
|
24
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ThinkExecutionAgent, ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps, ThinkExecutionWorkbenchSource };
|