@mcp-b/react-components 0.7.1 → 0.9.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.
Files changed (62) hide show
  1. package/dist/{AgentChat-403mckDG.d.ts → AgentChat-B9LD_WF1.d.ts} +67 -2
  2. package/dist/{CodeBlock-D9koxDA7.js → CodeBlock-XNQOupQ3.js} +1 -1
  3. package/dist/{FileTree-BdK93Uuu.js → FileTree-wMyZhhHO.js} +1 -1
  4. package/dist/{ModelSelector-MQvK-pNb.js → ModelSelector-9G_-GooI.js} +1 -1
  5. package/dist/{ThinkChatActivity-CeHzk6-K.d.ts → ThinkChatActivity-B2UD95My.d.ts} +1 -1
  6. package/dist/{ThinkChatContext-CC94HL4u.d.ts → ThinkChatContext-BLAAb8J5.d.ts} +1 -1
  7. package/dist/components/Activity.js +1 -1
  8. package/dist/components/AgentChat.d.ts +1 -1
  9. package/dist/components/AgentChat.js +107 -8
  10. package/dist/components/AgentConnection.js +2 -2
  11. package/dist/components/Artifact.js +1 -1
  12. package/dist/components/BrowserLiveView.js +1 -1
  13. package/dist/components/BrowserReplay.js +1 -1
  14. package/dist/components/ChainOfThought.d.ts +1 -1
  15. package/dist/components/ChainOfThought.js +1 -1
  16. package/dist/components/ChatGptSignInScreen.js +2 -2
  17. package/dist/components/CodeBlock.js +1 -1
  18. package/dist/components/Commit.js +1 -1
  19. package/dist/components/ContextMenu.js +1 -1
  20. package/dist/components/Conversation.js +1 -1
  21. package/dist/components/Dialog.js +1 -1
  22. package/dist/components/EnvironmentVariables.js +1 -1
  23. package/dist/components/FileTree.js +1 -1
  24. package/dist/components/McpServerPicker.js +7 -5
  25. package/dist/components/Menubar.js +1 -1
  26. package/dist/components/Message.js +1 -1
  27. package/dist/components/MessageScroller.js +1 -1
  28. package/dist/components/ModelSelector.js +1 -1
  29. package/dist/components/NavigationMenu.js +1 -1
  30. package/dist/components/PromptInput.js +6 -5
  31. package/dist/components/Queue.js +1 -1
  32. package/dist/components/Reasoning.js +1 -1
  33. package/dist/components/Select.js +1 -1
  34. package/dist/components/Sources.js +1 -1
  35. package/dist/components/Stepper.js +1 -1
  36. package/dist/components/Task.js +1 -1
  37. package/dist/components/Terminal.js +4 -3
  38. package/dist/components/TestResults.js +1 -1
  39. package/dist/components/ThinkChat.d.ts +8 -10
  40. package/dist/components/ThinkChatActivity.d.ts +1 -1
  41. package/dist/components/ThinkChatActivity.js +4 -3
  42. package/dist/components/ThinkChatContext.d.ts +1 -1
  43. package/dist/components/ThinkChatToolPanels.js +1 -1
  44. package/dist/components/ThinkChatToolParts.js +4 -4
  45. package/dist/components/ThinkExecutionWorkbench.d.ts +27 -0
  46. package/dist/components/ThinkExecutionWorkbench.js +450 -0
  47. package/dist/components/ThinkFullApp.d.ts +63 -9
  48. package/dist/components/ThinkFullApp.js +171 -73
  49. package/dist/components/ThinkThreadPicker.d.ts +88 -0
  50. package/dist/components/ThinkThreadPicker.js +282 -0
  51. package/dist/components/WebPreview.js +1 -1
  52. package/dist/components/WorkspaceExplorer.js +5 -4
  53. package/dist/components/icons.d.ts +2 -2
  54. package/dist/components/icons.js +2 -2
  55. package/dist/{copy-button-TVhDAroI.js → copy-button-C6JSKtFE.js} +1 -1
  56. package/dist/{icons-BRI54ATJ.d.ts → icons-CbjtbIJK.d.ts} +2 -1
  57. package/dist/{icons-BAlTbWWP.js → icons-D2Q5n5C1.js} +11 -1
  58. package/dist/styles/index.css +1 -0
  59. package/dist/styles/think-full-app.css +439 -26
  60. package/dist/styles/think-thread-picker.css +449 -0
  61. package/dist/utils/mcp-server-catalog.d.ts +5 -2
  62. package/package.json +7 -8
@@ -17,7 +17,60 @@ interface AgentChatRenderMessageContext<MessageT extends UIMessage = UIMessage>
17
17
  }
18
18
  interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
19
19
  className?: string;
20
- /** AI SDK `UIMessage`s to render, oldest first. */
20
+ /**
21
+ * AI SDK `UIMessage`s to render, oldest first.
22
+ *
23
+ * `AgentChat` intentionally renders the upstream message objects in place:
24
+ * it does not normalize them into a local transcript model. That keeps AI SDK
25
+ * parts such as `text`, `reasoning`, `file`, `tool-*`, `source-url`,
26
+ * `source-document`, and `step-start` aligned with the types exported from
27
+ * `ai`. Cloudflare Think also returns these same UI messages through
28
+ * `useAgentChat`, with Agents session storage applying compaction overlays to
29
+ * reads before they reach the hook.
30
+ *
31
+ * Backend setup for compaction is owned by Think/Agents, not this component:
32
+ * configure the agent session with `Session.create(this).onCompaction(...)
33
+ * .compactAfter(...)`. Agents' Sessions docs describe that `getHistory()`
34
+ * replaces a compacted range with a synthetic message whose id starts with
35
+ * `compaction_`; this component uses Agents' exported
36
+ * `isCompactionMessage` helper to render that synthetic message as a quiet
37
+ * separator. Think's context-overflow recovery is a separate opt-in layer:
38
+ * set `contextOverflow` and `classifyChatError` on the Think agent if the
39
+ * backend should compact and retry/proactively guard a too-large in-flight
40
+ * turn.
41
+ *
42
+ * @example Think session compaction setup
43
+ * ```ts
44
+ * import { Think, defaultContextOverflowClassifier } from "@cloudflare/think";
45
+ * import { Session } from "agents/experimental/memory/session";
46
+ * import { createCompactFunction } from "agents/experimental/memory/utils";
47
+ * import { generateText } from "ai";
48
+ *
49
+ * export class MyAgent extends Think<Env> {
50
+ * override configureSession(session: Session) {
51
+ * return session
52
+ * .onCompaction(
53
+ * createCompactFunction({
54
+ * summarize: async (prompt) =>
55
+ * (await generateText({ model: this.env.MODEL, prompt })).text,
56
+ * protectHead: 3,
57
+ * tailTokenBudget: 20_000,
58
+ * }),
59
+ * )
60
+ * .compactAfter(100_000);
61
+ * }
62
+ *
63
+ * override contextOverflow = {
64
+ * reactive: true,
65
+ * proactive: { maxInputTokens: 200_000 },
66
+ * };
67
+ * override classifyChatError = defaultContextOverflowClassifier;
68
+ * }
69
+ * ```
70
+ *
71
+ * @see https://github.com/cloudflare/agents/blob/main/docs/agents/sessions.md#compaction
72
+ * @see https://github.com/cloudflare/agents/blob/main/docs/think/index.md#context-window-overflow-recovery
73
+ */
21
74
  messages: readonly MessageT[];
22
75
  /** Drives the composer's send/stop affordance and streaming indicators. */
23
76
  status?: ChatStatus;
@@ -64,7 +117,19 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
64
117
  maxTokens: number;
65
118
  modelId?: string;
66
119
  };
67
- /** Override rendering per part; return `undefined` to fall back to the default part UI. */
120
+ /**
121
+ * Override rendering per part; return `undefined` to fall back to the default
122
+ * AI SDK/Think-aware part UI.
123
+ *
124
+ * The default renderer uses upstream helpers where available:
125
+ * `isTextUIPart`, `isReasoningUIPart`, `isFileUIPart`, `isToolUIPart`,
126
+ * `getToolName`, and Think's `getToolPartState`/input/output accessors. It
127
+ * also renders native AI SDK `source-url`/`source-document` parts as a single
128
+ * grouped `Sources` block when they appear consecutively, and native
129
+ * `step-start` parts as step separators. If you override source rendering,
130
+ * return a React node for every source part you want to show; returning
131
+ * `undefined` lets `AgentChat` keep the upstream-shaped source-run grouping.
132
+ */
68
133
  renderPart?: (context: AgentChatRenderPartContext<MessageT>) => React.ReactNode | undefined;
69
134
  /** Rendered after each message's parts — for actions, citations, and the like. */
70
135
  renderMessageAfter?: (context: AgentChatRenderMessageContext<MessageT>) => React.ReactNode;
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "./class-names-9UtZwb0J.js";
2
2
  import { Select, SelectContent, SelectItem, SelectList, SelectTrigger, SelectValue } from "./components/Select.js";
3
- import { t as CopyButton } from "./copy-button-TVhDAroI.js";
3
+ import { t as CopyButton } from "./copy-button-C6JSKtFE.js";
4
4
  import * as React from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createHighlighter } from "shiki";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "./class-names-9UtZwb0J.js";
2
- import { _ as FolderOpenIcon, c as ChevronRightIcon, g as FolderIcon, h as FileIcon } from "./icons-BAlTbWWP.js";
2
+ import { _ as FolderOpenIcon, c as ChevronRightIcon, g as FolderIcon, h as FileIcon } from "./icons-D2Q5n5C1.js";
3
3
  import * as React from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/components/_internal/use-file-tree-nav.ts
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "./class-names-9UtZwb0J.js";
2
- import { A as SearchIcon, o as ChevronDownIcon } from "./icons-BAlTbWWP.js";
2
+ import { A as SearchIcon, o as ChevronDownIcon } from "./icons-D2Q5n5C1.js";
3
3
  import { Button } from "./components/Button.js";
4
4
  import { Dialog, DialogBackdrop, DialogPopup, DialogPortal, DialogTitle, DialogTrigger } from "./components/Dialog.js";
5
5
  import * as React from "react";
@@ -1,4 +1,4 @@
1
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-403mckDG.js";
1
+ import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-B9LD_WF1.js";
2
2
  import { s as ThinkChatPart } from "./ThinkChatToolParts-DnUiZgCC.js";
3
3
  import * as React from "react";
4
4
  import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- import { UIMessage } from "ai";
3
2
  import { useAgentChat } from "@cloudflare/think/react";
3
+ import { UIMessage } from "ai";
4
4
 
5
5
  //#region src/components/ThinkChatContext.d.ts
6
6
  type ThinkChatValue = ReturnType<typeof useAgentChat<unknown, UIMessage>>;
@@ -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-BAlTbWWP.js";
3
+ import { c as ChevronRightIcon } from "../icons-D2Q5n5C1.js";
4
4
  import "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/Activity.tsx
@@ -1,2 +1,2 @@
1
- import { a as AgentChatRenderPartContext, i as AgentChatRenderMessageContext, n as AgentChatPart, r as AgentChatProps, t as AgentChat } from "../AgentChat-403mckDG.js";
1
+ import { a as AgentChatRenderPartContext, i as AgentChatRenderMessageContext, n as AgentChatPart, r as AgentChatProps, t as AgentChat } from "../AgentChat-B9LD_WF1.js";
2
2
  export { AgentChat, AgentChatPart, AgentChatProps, AgentChatRenderMessageContext, AgentChatRenderPartContext };
@@ -1,15 +1,19 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { O as PlusIcon, k as RefreshIcon } from "../icons-BAlTbWWP.js";
2
+ import { O as PlusIcon, k as RefreshIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Activity, ActivityContent, ActivityPanel, ActivityTrigger } from "./Activity.js";
4
4
  import { Context, ContextContent, ContextContentBody, ContextContentHeader, ContextTrigger, getContextUsage, getContextUsedTokens } from "./Context.js";
5
5
  import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
6
6
  import { ConversationEmptyState } from "./Conversation.js";
7
7
  import { Message, MessageAction, MessageActions, MessageAttachment, MessageContent, MessageResponse } from "./Message.js";
8
+ import { Marker, MarkerContent } from "./Marker.js";
8
9
  import { MenuGroup, MenuGroupLabel } from "./Menu.js";
9
10
  import { PromptInput, PromptInputActionAddAttachments, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger, PromptInputApproval, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputFooter, PromptInputPermissionSelector, PromptInputSubmit, PromptInputTextarea, PromptInputTools, getApprovalRequestId, getApprovalStateKey, getPendingToolApprovals, usePromptInputAttachments } from "./PromptInput.js";
10
11
  import { Reasoning, ReasoningContent, ReasoningTrigger } from "./Reasoning.js";
12
+ import { Source, Sources, SourcesContent, SourcesTrigger } from "./Sources.js";
11
13
  import * as React from "react";
12
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ import { isCompactionMessage } from "agents/experimental/memory/utils";
16
+ import { getToolInput, getToolOutput, getToolPartState } from "@cloudflare/think/react";
13
17
  import { getToolName, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolUIPart } from "ai";
14
18
  //#region src/components/AgentChat.tsx
15
19
  const EMPTY_PENDING_APPROVALS = [];
@@ -32,6 +36,21 @@ function AgentChatAddMenu({ children }) {
32
36
  children: [/* @__PURE__ */ jsxs(MenuGroup, { children: [/* @__PURE__ */ jsx(MenuGroupLabel, { children: "Files" }), /* @__PURE__ */ jsx(PromptInputActionAddAttachments, {})] }), children]
33
37
  })] });
34
38
  }
39
+ /**
40
+ * Per-message row-size compaction marker from `AIChatAgent` persistence.
41
+ *
42
+ * This is distinct from Session history compaction overlays. When a single
43
+ * SQLite row approaches the Workers/SQLite size limit, Agents compacts large
44
+ * tool outputs and, if necessary, truncates text before persistence. The
45
+ * message remains in place and receives metadata keys documented by Agents:
46
+ * `compactedToolOutputs` lists tool-call ids whose outputs were summarized;
47
+ * `compactedTextParts` lists text-part indexes that were truncated. The UI
48
+ * reads those keys structurally because they are persisted metadata rather than
49
+ * exported AI SDK part variants, then adds a local visual note while preserving
50
+ * the original `UIMessage` and part shapes.
51
+ *
52
+ * @see https://github.com/cloudflare/agents/blob/main/docs/agents/chat-agents.md#row-size-protection
53
+ */
35
54
  function isCompactedPart(message, part, partIndex) {
36
55
  const metadata = message.metadata;
37
56
  if (isTextUIPart(part)) return Array.isArray(metadata?.compactedTextParts) && metadata.compactedTextParts.includes(partIndex);
@@ -52,15 +71,80 @@ function summarizeToolInput(input) {
52
71
  return null;
53
72
  }
54
73
  function isToolPartWorking(part) {
55
- return part.state === "input-streaming" || part.state === "input-available" || part.state === "approval-requested";
74
+ const state = getToolPartState(part);
75
+ return state === "loading" || state === "streaming" || state === "waiting-approval";
56
76
  }
57
77
  function isToolPartFailed(part) {
58
- return part.state === "output-error" || part.state === "output-denied";
78
+ const state = getToolPartState(part);
79
+ return state === "error" || state === "denied";
80
+ }
81
+ /**
82
+ * AI SDK exports concrete source part types but no public source-part guard.
83
+ * Keep these local guards as exact discriminant checks, matching
84
+ * `ai/src/ui/ui-messages.ts` and `ai/src/ui/process-ui-message-stream.ts`.
85
+ * If AI SDK exports source or step guards later, replace these wrappers rather
86
+ * than widening the local transcript contract.
87
+ */
88
+ function isSourceUrlPart(part) {
89
+ return part?.type === "source-url";
90
+ }
91
+ function isSourceDocumentPart(part) {
92
+ return part?.type === "source-document";
93
+ }
94
+ /**
95
+ * AI SDK emits `step-start` as a native `StepStartUIPart`, but currently exports
96
+ * only the type, not an `isStepStartUIPart` helper. Keep this as the exact
97
+ * upstream discriminant so step separators do not become a local protocol.
98
+ */
99
+ function isStepStartPart(part) {
100
+ return part.type === "step-start";
101
+ }
102
+ /**
103
+ * Session compaction overlay marker from Agents Sessions.
104
+ *
105
+ * Agents exports `isCompactionMessage` from
106
+ * `agents/experimental/memory/utils`; it checks the canonical `compaction_`
107
+ * id prefix used when `Session.getHistory()` materializes a summary overlay.
108
+ * `UIMessage` is structurally compatible with the fields the helper reads, so
109
+ * keep this wrapper instead of duplicating the prefix test locally.
110
+ */
111
+ function isCompactionMessage$1(message) {
112
+ return isCompactionMessage(message);
113
+ }
114
+ function getMessageText(message) {
115
+ return message.parts.filter((part) => isTextUIPart(part) || isReasoningUIPart(part)).map((part) => part.text).join("");
116
+ }
117
+ function formatSourceTitle(part) {
118
+ if (part.title) return part.title;
119
+ if (part.type === "source-document") return part.filename ?? part.mediaType;
120
+ try {
121
+ return new URL(part.url).hostname.replace(/^www\./, "");
122
+ } catch {
123
+ return part.url;
124
+ }
125
+ }
126
+ function renderSources(parts) {
127
+ return /* @__PURE__ */ jsxs(Sources, { children: [/* @__PURE__ */ jsx(SourcesTrigger, { count: parts.length }), /* @__PURE__ */ jsx(SourcesContent, { children: parts.map((part) => part.type === "source-url" ? /* @__PURE__ */ jsx(Source, {
128
+ href: part.url,
129
+ title: formatSourceTitle(part)
130
+ }, part.sourceId) : /* @__PURE__ */ jsx(Source, {
131
+ title: formatSourceTitle(part),
132
+ description: part.filename ?? part.mediaType
133
+ }, part.sourceId)) })] });
134
+ }
135
+ function getSourceRun(parts, start) {
136
+ const sources = [];
137
+ for (let index = start; index < parts.length; index++) {
138
+ const candidate = parts[index];
139
+ if (!isSourceUrlPart(candidate) && !isSourceDocumentPart(candidate)) break;
140
+ sources.push(candidate);
141
+ }
142
+ return sources;
59
143
  }
60
144
  function describeToolPart(part) {
61
145
  const name = getToolName(part);
62
146
  const verb = isToolPartFailed(part) ? `${name} failed` : isToolPartWorking(part) ? `Running ${name}` : `Ran ${name}`;
63
- const detail = summarizeToolInput(part.input);
147
+ const detail = summarizeToolInput(getToolInput(part));
64
148
  return detail ? `${verb} · ${detail}` : verb;
65
149
  }
66
150
  function formatToolValue(value) {
@@ -68,17 +152,19 @@ function formatToolValue(value) {
68
152
  return typeof value === "string" ? value : JSON.stringify(value, null, 2);
69
153
  }
70
154
  function renderToolActivity(part) {
155
+ const state = getToolPartState(part);
71
156
  const failed = isToolPartFailed(part);
72
- const output = part.state === "output-error" ? part.errorText : part.state === "output-denied" ? part.approval.reason ?? "Denied" : formatToolValue("output" in part ? part.output : void 0);
157
+ const deniedReason = part.state === "output-denied" ? part.approval.reason : void 0;
158
+ const output = state === "error" ? part.errorText : state === "denied" ? deniedReason ?? "Denied" : formatToolValue(getToolOutput(part));
73
159
  return /* @__PURE__ */ jsxs(Activity, {
74
160
  isStreaming: isToolPartWorking(part),
75
161
  children: [/* @__PURE__ */ jsx(ActivityTrigger, { label: describeToolPart(part) }), /* @__PURE__ */ jsxs(ActivityContent, { children: [/* @__PURE__ */ jsx(ActivityPanel, {
76
162
  label: getToolName(part),
77
- text: formatToolValue(part.input)
163
+ text: formatToolValue(getToolInput(part))
78
164
  }), output ? /* @__PURE__ */ jsx(ActivityPanel, {
79
165
  label: "output",
80
166
  text: output,
81
- status: part.state === "output-denied" ? "denied" : failed ? "error" : void 0,
167
+ status: state === "denied" ? "denied" : failed ? "error" : void 0,
82
168
  error: failed
83
169
  }) : null] })]
84
170
  });
@@ -91,6 +177,10 @@ function renderDefaultPart(part) {
91
177
  children: [/* @__PURE__ */ jsx(ReasoningTrigger, {}), /* @__PURE__ */ jsx(ReasoningContent, { children: part.text })]
92
178
  });
93
179
  if (isToolUIPart(part)) return renderToolActivity(part);
180
+ if (isStepStartPart(part)) return /* @__PURE__ */ jsx(Marker, {
181
+ variant: "separator",
182
+ children: /* @__PURE__ */ jsx(MarkerContent, { children: "Next step" })
183
+ });
94
184
  return null;
95
185
  }
96
186
  /**
@@ -163,7 +253,10 @@ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, pl
163
253
  }) : null, messages.map((message, messageIndex) => /* @__PURE__ */ jsx(MessageScrollerItem, {
164
254
  messageId: message.id,
165
255
  scrollAnchor: message.role === "user",
166
- children: /* @__PURE__ */ jsxs(Message, {
256
+ children: isCompactionMessage$1(message) ? /* @__PURE__ */ jsx(Marker, {
257
+ variant: "separator",
258
+ children: /* @__PURE__ */ jsx(MarkerContent, { children: getMessageText(message) || "Conversation compacted" })
259
+ }) : /* @__PURE__ */ jsxs(Message, {
167
260
  from: message.role,
168
261
  children: [
169
262
  message.parts.map((part, partIndex) => {
@@ -174,6 +267,12 @@ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, pl
174
267
  partIndex,
175
268
  defaultRender
176
269
  });
270
+ if (isSourceUrlPart(part) || isSourceDocumentPart(part)) {
271
+ if (custom !== void 0) return custom ? /* @__PURE__ */ jsx(MessageContent, { children: custom }, getPartKey(part, partIndex)) : null;
272
+ const previous = message.parts[partIndex - 1];
273
+ if (isSourceUrlPart(previous) || isSourceDocumentPart(previous)) return null;
274
+ return /* @__PURE__ */ jsx(MessageContent, { children: renderSources(getSourceRun(message.parts, partIndex)) }, getPartKey(part, partIndex));
275
+ }
177
276
  const rendered = custom === void 0 ? defaultRender() : custom;
178
277
  return rendered ? /* @__PURE__ */ jsxs(MessageContent, { children: [rendered, isCompactedPart(message, part, partIndex) ? /* @__PURE__ */ jsx("div", {
179
278
  className: "message__compacted",
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { b as LinkIcon } from "../icons-BAlTbWWP.js";
2
+ import { b as LinkIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Popover } from "./Popover.js";
4
4
  import { Button } from "./Button.js";
5
- import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-D9koxDA7.js";
5
+ import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-XNQOupQ3.js";
6
6
  import { Field } from "./Field.js";
7
7
  import { Form } from "./Form.js";
8
8
  import { DCR_MCP_SERVER_CARDS, MANUAL_MCP_SERVER_CARDS, getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { I as XIcon } from "../icons-BAlTbWWP.js";
2
+ import { L as XIcon } 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 "react";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { j as SpinnerIcon, x as MaximizeIcon } from "../icons-BAlTbWWP.js";
2
+ import { M as SpinnerIcon, x as MaximizeIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Dialog, DialogContent, DialogTitle } from "./Dialog.js";
5
5
  import { Badge } from "./Badge.js";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { D as PlayIcon, T as PauseIcon } from "../icons-BAlTbWWP.js";
2
+ import { D as PlayIcon, T as PauseIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { Slider, SliderControl, SliderIndicator, SliderThumb, SliderTrack } from "./Slider.js";
5
5
  import * as React from "react";
@@ -1,5 +1,5 @@
1
1
  import { CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps } from "./Collapsible.js";
2
- import { v as IconProps } from "../icons-BRI54ATJ.js";
2
+ import { v as IconProps } from "../icons-CbjtbIJK.js";
3
3
  import * as React from "react";
4
4
 
5
5
  //#region src/components/ChainOfThought.d.ts
@@ -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, j as SpinnerIcon, u as DotIcon } from "../icons-BAlTbWWP.js";
3
+ import { M as SpinnerIcon, a as CheckIcon, c as ChevronRightIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
4
4
  import "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/ChainOfThought.tsx
@@ -1,7 +1,7 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { j as SpinnerIcon } from "../icons-BAlTbWWP.js";
2
+ import { M as SpinnerIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
- import { l as ModelSelectorLogo } from "../ModelSelector-MQvK-pNb.js";
4
+ import { l as ModelSelectorLogo } from "../ModelSelector-9G_-GooI.js";
5
5
  import "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/ChatGptSignInScreen.tsx
@@ -1,2 +1,2 @@
1
- import { a as CodeBlockCopyButton, c as CodeBlockLanguageSelector, d as CodeBlockLanguageSelectorTrigger, f as CodeBlockLanguageSelectorValue, h as CODE_BLOCK_LANGUAGES, i as CodeBlockContent, l as CodeBlockLanguageSelectorContent, m as highlightCode, n as CodeBlockActions, o as CodeBlockFilename, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock, u as CodeBlockLanguageSelectorItem } from "../CodeBlock-D9koxDA7.js";
1
+ import { a as CodeBlockCopyButton, c as CodeBlockLanguageSelector, d as CodeBlockLanguageSelectorTrigger, f as CodeBlockLanguageSelectorValue, h as CODE_BLOCK_LANGUAGES, i as CodeBlockContent, l as CodeBlockLanguageSelectorContent, m as highlightCode, n as CodeBlockActions, o as CodeBlockFilename, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock, u as CodeBlockLanguageSelectorItem } from "../CodeBlock-XNQOupQ3.js";
2
2
  export { CODE_BLOCK_LANGUAGES, CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockTitle, highlightCode };
@@ -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, h as FileIcon, l as CopyIcon } from "../icons-BAlTbWWP.js";
3
+ import { a as CheckIcon, c as ChevronRightIcon, h as FileIcon, l as CopyIcon } from "../icons-D2Q5n5C1.js";
4
4
  import { Button } from "./Button.js";
5
5
  import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
6
6
  import { Avatar } from "./Avatar.js";
@@ -1,4 +1,4 @@
1
- import { a as CheckIcon, c as ChevronRightIcon, u as DotIcon } from "../icons-BAlTbWWP.js";
1
+ import { a as CheckIcon, c as ChevronRightIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
2
2
  import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { d as DownloadIcon, t as ArrowDownIcon } from "../icons-BAlTbWWP.js";
2
+ import { d as DownloadIcon, t as ArrowDownIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
4
  import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
5
5
  import * as React from "react";
@@ -1,4 +1,4 @@
1
- import { I as XIcon } from "../icons-BAlTbWWP.js";
1
+ import { L as XIcon } from "../icons-D2Q5n5C1.js";
2
2
  import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { a as CheckIcon, l as CopyIcon, m as EyeOffIcon, p as EyeIcon } from "../icons-BAlTbWWP.js";
2
+ import { a as CheckIcon, l as CopyIcon, m as EyeOffIcon, p as EyeIcon } 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 { Badge } from "./Badge.js";
@@ -1,2 +1,2 @@
1
- import { a as FileTreeIcon, i as FileTreeFolder, n as FileTreeActions, o as FileTreeName, r as FileTreeFile, t as FileTree } from "../FileTree-BdK93Uuu.js";
1
+ import { a as FileTreeIcon, i as FileTreeFolder, n as FileTreeActions, o as FileTreeName, r as FileTreeFile, t as FileTree } from "../FileTree-wMyZhhHO.js";
2
2
  export { FileTree, FileTreeActions, FileTreeFile, FileTreeFolder, FileTreeIcon, FileTreeName };
@@ -1,4 +1,4 @@
1
- import { O as PlusIcon, P as WarningIcon, a as CheckIcon, j as SpinnerIcon } from "../icons-BAlTbWWP.js";
1
+ import { F as WarningIcon, M as SpinnerIcon, O as PlusIcon, a as CheckIcon } from "../icons-D2Q5n5C1.js";
2
2
  import { Button } from "./Button.js";
3
3
  import { MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuRoot, MenuShortcut, MenuTrigger } from "./Menu.js";
4
4
  import { getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
@@ -53,8 +53,8 @@ function McpServerPickerItems({ servers, onConnect }) {
53
53
  function McpServerPickerRow({ server, onConnect }) {
54
54
  const descriptionId = React.useId();
55
55
  const statusText = server.statusLabel ?? getStatusLabel(server.status);
56
- const busy = server.status === "connecting" || server.status === "authenticating";
57
- const disabled = busy || server.status === "ready";
56
+ const busy = server.status === "connecting" || server.status === "authenticating" || server.status === "discovering";
57
+ const disabled = busy || server.status === "ready" || server.status === "connected";
58
58
  return /* @__PURE__ */ jsxs(MenuItem, {
59
59
  className: "mcp-server-picker__row",
60
60
  closeOnClick: false,
@@ -91,9 +91,9 @@ function McpServerPickerRow({ server, onConnect }) {
91
91
  });
92
92
  }
93
93
  function StatusIcon({ status }) {
94
- if (status === "ready") return /* @__PURE__ */ jsx(CheckIcon, { size: 14 });
94
+ if (status === "ready" || status === "connected") return /* @__PURE__ */ jsx(CheckIcon, { size: 14 });
95
95
  if (status === "failed" || status === "needs-auth") return /* @__PURE__ */ jsx(WarningIcon, { size: 14 });
96
- if (status === "connecting" || status === "authenticating") return /* @__PURE__ */ jsx(SpinnerIcon, {
96
+ if (status === "connecting" || status === "authenticating" || status === "discovering") return /* @__PURE__ */ jsx(SpinnerIcon, {
97
97
  className: "mcp-server-picker__spinner",
98
98
  size: 14
99
99
  });
@@ -101,10 +101,12 @@ function StatusIcon({ status }) {
101
101
  }
102
102
  function getStatusLabel(status) {
103
103
  if (status === "ready") return "Connected";
104
+ if (status === "connected") return "Connected";
104
105
  if (status === "failed") return "Failed";
105
106
  if (status === "needs-auth") return "Authorize";
106
107
  if (status === "authenticating") return "Authenticating";
107
108
  if (status === "connecting") return "Connecting";
109
+ if (status === "discovering") return "Discovering";
108
110
  return "";
109
111
  }
110
112
  function renderIcon(server) {
@@ -1,4 +1,4 @@
1
- import { a as CheckIcon, c as ChevronRightIcon, u as DotIcon } from "../icons-BAlTbWWP.js";
1
+ import { a as CheckIcon, c as ChevronRightIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
2
2
  import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Menu } from "@base-ui/react/menu";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { h as FileIcon, n as ArrowLeftIcon, r as ArrowRightIcon } from "../icons-BAlTbWWP.js";
2
+ import { h as FileIcon, n as ArrowLeftIcon, r as ArrowRightIcon } 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";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { t as ArrowDownIcon } from "../icons-BAlTbWWP.js";
2
+ import { t as ArrowDownIcon } from "../icons-D2Q5n5C1.js";
3
3
  import { Button } from "./Button.js";
4
4
  import "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,2 +1,2 @@
1
- import { a as ModelSelectorGroup, c as ModelSelectorList, d as ModelSelectorName, f as ModelSelectorSeparator, i as ModelSelectorEmpty, l as ModelSelectorLogo, m as ModelSelectorTrigger, n as ModelSelectorContent, o as ModelSelectorInput, p as ModelSelectorShortcut, r as ModelSelectorDialog, s as ModelSelectorItem, t as ModelSelector, u as ModelSelectorLogoGroup } from "../ModelSelector-MQvK-pNb.js";
1
+ import { a as ModelSelectorGroup, c as ModelSelectorList, d as ModelSelectorName, f as ModelSelectorSeparator, i as ModelSelectorEmpty, l as ModelSelectorLogo, m as ModelSelectorTrigger, n as ModelSelectorContent, o as ModelSelectorInput, p as ModelSelectorShortcut, r as ModelSelectorDialog, s as ModelSelectorItem, t as ModelSelector, u as ModelSelectorLogoGroup } from "../ModelSelector-9G_-GooI.js";
2
2
  export { ModelSelector, ModelSelectorContent, ModelSelectorDialog, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorInput, ModelSelectorItem, ModelSelectorList, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, ModelSelectorSeparator, ModelSelectorShortcut, ModelSelectorTrigger };
@@ -1,4 +1,4 @@
1
- import { o as ChevronDownIcon } from "../icons-BAlTbWWP.js";
1
+ import { o as ChevronDownIcon } from "../icons-D2Q5n5C1.js";
2
2
  import * as React from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
- import { C as MonitorIcon, E as PencilIcon, I as XIcon, M as SquareIcon, O as PlusIcon, P as WarningIcon, h as FileIcon, i as ArrowUpIcon, j as SpinnerIcon, o as ChevronDownIcon, w as PaperclipIcon } from "../icons-BAlTbWWP.js";
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.output;
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.approval.id;
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.approval.id;
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 && "input" in part ? part.input : void 0);
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,
@@ -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, h as FileIcon, u as DotIcon } from "../icons-BAlTbWWP.js";
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-BAlTbWWP.js";
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-BAlTbWWP.js";
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 { b as LinkIcon, c as ChevronRightIcon } from "../icons-BAlTbWWP.js";
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 { a as CheckIcon, j as SpinnerIcon } from "../icons-BAlTbWWP.js";
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
@@ -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 SearchIcon, c as ChevronRightIcon, h as FileIcon } from "../icons-BAlTbWWP.js";
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