@mcp-b/react-components 0.10.0 → 0.12.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 (84) hide show
  1. package/dist/{AgentChat-B9LD_WF1.d.ts → AgentChat-CRmsKg9B.d.ts} +10 -6
  2. package/dist/{BrowserLiveView-ZktFZiMD.d.ts → BrowserLiveView-BV5qgFgI.d.ts} +11 -10
  3. package/dist/{BrowserReplay-6G-mnwcn.d.ts → BrowserReplay-xWvRjRAC.d.ts} +2 -1
  4. package/dist/{Menu-B5vDqZe_.d.ts → Menu-BLhnNnRK.d.ts} +3 -0
  5. package/dist/{ModelSelector-DXtpcRmT.js → ModelSelector-BB-xB-Es.js} +16 -13
  6. package/dist/{PromptInput-D6-G24p7.d.ts → PromptInput-IyM6ZETj.d.ts} +13 -45
  7. package/dist/ThinkChat-B3wYahor.js +190 -0
  8. package/dist/{ThinkChatActivity-B2UD95My.d.ts → ThinkChatActivity-F4KFPcJA.d.ts} +4 -4
  9. package/dist/ThinkChatContext-C3Eb1Xpi.d.ts +16 -0
  10. package/dist/{ThinkChatToolParts-DnUiZgCC.d.ts → ThinkChatToolParts-Cv4o7j6F.d.ts} +13 -5
  11. package/dist/components/AgentChat.d.ts +1 -1
  12. package/dist/components/AgentChat.js +57 -23
  13. package/dist/components/AgentConnection.d.ts +3 -14
  14. package/dist/components/AgentConnection.js +7 -111
  15. package/dist/components/Badge.js +1 -15
  16. package/dist/components/BrowserLiveView.d.ts +1 -1
  17. package/dist/components/BrowserLiveView.js +14 -10
  18. package/dist/components/BrowserReplay.d.ts +1 -1
  19. package/dist/components/BrowserRunPanel.d.ts +46 -0
  20. package/dist/components/BrowserRunPanel.js +159 -0
  21. package/dist/components/ChatGptSignInScreen.js +1 -1
  22. package/dist/components/CodexModelSelector.d.ts +63 -0
  23. package/dist/components/CodexModelSelector.js +148 -0
  24. package/dist/components/Commit.d.ts +2 -2
  25. package/dist/components/Commit.js +10 -22
  26. package/dist/components/Conversation.d.ts +2 -6
  27. package/dist/components/Conversation.js +2 -3
  28. package/dist/components/EnvironmentVariables.d.ts +2 -7
  29. package/dist/components/EnvironmentVariables.js +10 -33
  30. package/dist/components/Marker.js +1 -15
  31. package/dist/components/McpServerPicker.d.ts +31 -6
  32. package/dist/components/McpServerPicker.js +129 -67
  33. package/dist/components/Menu.d.ts +1 -1
  34. package/dist/components/Menu.js +2 -2
  35. package/dist/components/Message.d.ts +3 -2
  36. package/dist/components/Message.js +10 -3
  37. package/dist/components/ModelSelector.d.ts +11 -8
  38. package/dist/components/ModelSelector.js +1 -1
  39. package/dist/components/PromptInput.d.ts +2 -2
  40. package/dist/components/PromptInput.js +49 -98
  41. package/dist/components/Queue.d.ts +1 -12
  42. package/dist/components/Reasoning.js +2 -15
  43. package/dist/components/Stepper.js +1 -7
  44. package/dist/components/ThinkChat.d.ts +30 -30
  45. package/dist/components/ThinkChat.js +1 -152
  46. package/dist/components/ThinkChatActivity.d.ts +2 -2
  47. package/dist/components/ThinkChatActivity.js +3 -10
  48. package/dist/components/ThinkChatContext.d.ts +2 -2
  49. package/dist/components/ThinkChatContext.js +9 -2
  50. package/dist/components/ThinkChatToolPanels.d.ts +1 -1
  51. package/dist/components/ThinkChatToolPanels.js +19 -7
  52. package/dist/components/ThinkChatToolParts.d.ts +1 -1
  53. package/dist/components/ThinkExecutionWorkbench.d.ts +10 -7
  54. package/dist/components/ThinkExecutionWorkbench.js +382 -359
  55. package/dist/components/ThinkFullApp.d.ts +16 -13
  56. package/dist/components/ThinkFullApp.js +28 -18
  57. package/dist/components/ThinkThreadPicker.d.ts +1 -31
  58. package/dist/components/ThinkThreadPicker.js +32 -171
  59. package/dist/components/ThinkThreadShell.d.ts +35 -0
  60. package/dist/components/ThinkThreadShell.js +146 -0
  61. package/dist/components/WorkspaceExplorer.js +3 -1
  62. package/dist/merge-refs-DF_7w2x_.js +18 -0
  63. package/dist/styles/agent-chat.css +4 -1
  64. package/dist/styles/agent-connection.css +0 -166
  65. package/dist/styles/browser-run-panel.css +125 -0
  66. package/dist/styles/codex-model-selector.css +197 -0
  67. package/dist/styles/index.css +5 -0
  68. package/dist/styles/mcp-server-picker.css +62 -15
  69. package/dist/styles/message.css +1 -1
  70. package/dist/styles/model-selector.css +20 -8
  71. package/dist/styles/prompt-input.css +5 -0
  72. package/dist/styles/streamdown.css +2 -48
  73. package/dist/styles/think-execution-workbench.css +337 -0
  74. package/dist/styles/think-full-app.css +15 -390
  75. package/dist/styles/think-resize-handle.css +33 -0
  76. package/dist/styles/think-thread-picker.css +0 -238
  77. package/dist/styles/think-thread-shell.css +219 -0
  78. package/dist/styles/workspace-explorer.css +8 -2
  79. package/dist/summarize-tool-input-BUJsENSn.js +12 -0
  80. package/dist/utils/mcp-server-catalog.d.ts +2 -3
  81. package/package.json +2 -2
  82. package/dist/ThinkChatContext-BLAAb8J5.d.ts +0 -28
  83. package/dist/components/useStickToBottom.d.ts +0 -33
  84. package/dist/components/useStickToBottom.js +0 -107
@@ -1,3 +1,3 @@
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-B2UD95My.js";
1
+ import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-Cv4o7j6F.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-F4KFPcJA.js";
3
3
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, isThinkChatActivityPart, renderThinkChatActivityPart };
@@ -1,6 +1,7 @@
1
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
- import { ThinkChatContext } from "./ThinkChatContext.js";
3
+ import { t as summarizeToolInput } from "../summarize-tool-input-BUJsENSn.js";
4
+ import { useOptionalThinkChatContext } from "./ThinkChatContext.js";
4
5
  import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart } from "./ThinkChatToolParts.js";
5
6
  import { ThinkChatBrowserPanel, ThinkChatExecutePanel, ThinkChatFetchPanel, ThinkChatSkillPanel, ThinkChatWorkspacePanel } from "./ThinkChatToolPanels.js";
6
7
  import * as React from "react";
@@ -8,14 +9,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { getToolInput, getToolOutput } from "@cloudflare/think/react";
9
10
  import { getToolName, isReasoningUIPart, isToolUIPart } from "ai";
10
11
  //#region src/components/ThinkChatActivity.tsx
11
- function summarizeToolInput(input) {
12
- if (!input || typeof input !== "object") return null;
13
- for (const value of Object.values(input)) if (typeof value === "string" && value.trim()) {
14
- const line = value.trim().split("\n", 1)[0] ?? "";
15
- return line.length > 64 ? `${line.slice(0, 64)}…` : line;
16
- }
17
- return null;
18
- }
19
12
  const HTTP_URL_PATTERN = /https?:\/\/[^\s"'<>)}\]]+/i;
20
13
  function firstHttpUrl(value) {
21
14
  const text = typeof value === "string" ? value : JSON.stringify(value) ?? "";
@@ -390,7 +383,7 @@ function ThinkChatActivityStep({ text, part, toolRenderers }) {
390
383
  });
391
384
  }
392
385
  function ThinkChatActivityGroup({ message, parts, isTrailing, toolRenderers }) {
393
- const chat = React.useContext(ThinkChatContext);
386
+ const chat = useOptionalThinkChatContext();
394
387
  const chatStillWorking = isTrailing && Boolean(chat?.isStreaming) && chat?.messages.at(-1)?.id === message.id;
395
388
  return /* @__PURE__ */ jsx(ThinkChatActivity, {
396
389
  parts,
@@ -1,2 +1,2 @@
1
- import { n as ThinkChatValue, r as useThinkChatContext, t as ThinkChatContext } from "../ThinkChatContext-BLAAb8J5.js";
2
- export { ThinkChatContext, ThinkChatValue, useThinkChatContext };
1
+ import { i as useThinkChatContext, n as ThinkChatValue, r as useOptionalThinkChatContext, t as ThinkChatContext } from "../ThinkChatContext-C3Eb1Xpi.js";
2
+ export { ThinkChatContext, ThinkChatValue, useOptionalThinkChatContext, useThinkChatContext };
@@ -1,10 +1,17 @@
1
1
  import * as React from "react";
2
2
  //#region src/components/ThinkChatContext.ts
3
+ /**
4
+ * React contexts cannot bind provider-specific generics. Keep the stored value
5
+ * opaque and restore the complete upstream hook type through the typed accessors.
6
+ */
3
7
  const ThinkChatContext = React.createContext(null);
8
+ function useOptionalThinkChatContext() {
9
+ return React.useContext(ThinkChatContext);
10
+ }
4
11
  function useThinkChatContext(component) {
5
- const context = React.useContext(ThinkChatContext);
12
+ const context = useOptionalThinkChatContext();
6
13
  if (!context) throw new Error(`${component} must be used inside <ThinkChat.Provider> or <ThinkChat.Root>.`);
7
14
  return context;
8
15
  }
9
16
  //#endregion
10
- export { ThinkChatContext, useThinkChatContext };
17
+ export { ThinkChatContext, useOptionalThinkChatContext, useThinkChatContext };
@@ -1,4 +1,4 @@
1
- import { i as SkillToolPart, l as WorkspaceToolPart, n as ExecuteToolPart, r as FetchToolPart, t as BrowserToolPart } from "../ThinkChatToolParts-DnUiZgCC.js";
1
+ import { i as SkillToolPart, l as WorkspaceToolPart, n as ExecuteToolPart, r as FetchToolPart, t as BrowserToolPart } from "../ThinkChatToolParts-Cv4o7j6F.js";
2
2
  import * as React from "react";
3
3
 
4
4
  //#region src/components/ThinkChatToolPanels.d.ts
@@ -176,13 +176,22 @@ function ThinkChatFetchPanel({ part }) {
176
176
  status: `${output.status} · ${output.bytes} bytes${output.truncated ? " (truncated)" : ""}`
177
177
  });
178
178
  }
179
+ function isBrowserLiveViewUrl(value) {
180
+ if (!value || typeof value !== "object") return false;
181
+ const source = value;
182
+ if (typeof source.url !== "string" || typeof source.targetId !== "string" || typeof source.expiresInMs !== "number" || !Number.isFinite(source.expiresInMs)) return false;
183
+ try {
184
+ return new URL(source.url).origin === "https://live.browser.run";
185
+ } catch {
186
+ return false;
187
+ }
188
+ }
179
189
  function findBrowserResultMedia(value, depth = 0) {
180
190
  const media = {};
181
191
  const visit = (node, level) => {
182
192
  if (level > 4 || node === null) return;
183
193
  if (typeof node === "string") {
184
- if (!media.liveViewUrl && node.includes("live.browser.run")) media.liveViewUrl = node;
185
- else if (!media.screenshot && node.startsWith("data:image/")) media.screenshot = node;
194
+ if (!media.screenshot && node.startsWith("data:image/")) media.screenshot = node;
186
195
  return;
187
196
  }
188
197
  if (Array.isArray(node)) {
@@ -190,8 +199,11 @@ function findBrowserResultMedia(value, depth = 0) {
190
199
  return;
191
200
  }
192
201
  if (typeof node === "object") {
202
+ if (!media.liveView && isBrowserLiveViewUrl(node)) {
203
+ media.liveView = node;
204
+ return;
205
+ }
193
206
  const record = node;
194
- if (media.expiresInMs === void 0 && typeof record.url === "string" && typeof record.expiresInMs === "number") media.expiresInMs = record.expiresInMs;
195
207
  for (const item of Object.values(record)) visit(item, level + 1);
196
208
  }
197
209
  };
@@ -255,10 +267,10 @@ function ThinkChatBrowserPanel({ part }) {
255
267
  const output = part.state === "output-available" ? part.output : void 0;
256
268
  const code = part.input?.code ?? "";
257
269
  const media = output?.status === "completed" ? findBrowserResultMedia(output.result) : {};
258
- const hasMedia = Boolean(media.liveViewUrl || media.screenshot);
259
- const browserView = media.liveViewUrl ? /* @__PURE__ */ jsx(BrowserLiveView, {
260
- url: media.liveViewUrl,
261
- expiresAt: seenAt + (media.expiresInMs ?? 300 * 1e3),
270
+ const hasMedia = Boolean(media.liveView || media.screenshot);
271
+ const browserView = media.liveView ? /* @__PURE__ */ jsx(BrowserLiveView, {
272
+ source: media.liveView,
273
+ receivedAt: seenAt,
262
274
  fallback: media.screenshot ? /* @__PURE__ */ jsx("img", {
263
275
  src: media.screenshot,
264
276
  alt: "Last browser state"
@@ -1,2 +1,2 @@
1
- import { _ as isThinkChatActivityPart, a as ThinkBashToolOutput, c as ThinkWorkspaceToolName, d as isBrowserToolPart, f as isExecuteToolPart, g as isSkillToolPart, h as isPartWorking, i as SkillToolPart, l as WorkspaceToolPart, m as isPartFailed, n as ExecuteToolPart, o as ThinkBashToolPart, p as isFetchToolPart, r as FetchToolPart, s as ThinkChatPart, t as BrowserToolPart, u as displayUrl, v as isWorkspaceToolPart } from "../ThinkChatToolParts-DnUiZgCC.js";
1
+ import { _ as isThinkChatActivityPart, a as ThinkBashToolOutput, c as ThinkWorkspaceToolName, d as isBrowserToolPart, f as isExecuteToolPart, g as isSkillToolPart, h as isPartWorking, i as SkillToolPart, l as WorkspaceToolPart, m as isPartFailed, n as ExecuteToolPart, o as ThinkBashToolPart, p as isFetchToolPart, r as FetchToolPart, s as ThinkChatPart, t as BrowserToolPart, u as displayUrl, v as isWorkspaceToolPart } from "../ThinkChatToolParts-Cv4o7j6F.js";
2
2
  export { BrowserToolPart, ExecuteToolPart, FetchToolPart, SkillToolPart, ThinkBashToolOutput, ThinkBashToolPart, ThinkChatPart, ThinkWorkspaceToolName, WorkspaceToolPart, displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSkillToolPart, isThinkChatActivityPart, isWorkspaceToolPart };
@@ -3,16 +3,19 @@ import { Think } from "@cloudflare/think";
3
3
  import { AgentStub } from "agents/client";
4
4
 
5
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"> {
6
+ interface ThinkExecutionWorkbenchProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
9
7
  /** Agents SDK client stub for a Think agent; this UI calls native submission/workflow methods. */
10
- source: ThinkExecutionWorkbenchSource<State>;
8
+ source: AgentStub<Think>;
11
9
  title?: React.ReactNode;
12
10
  backButton?: React.ReactNode;
13
11
  pageSize?: number;
14
12
  }
15
- declare function ThinkExecutionWorkbench<State = unknown>({
13
+ /**
14
+ * Unified execution history for native Think submissions and Agents workflows.
15
+ * The workbench reads and acts through the whole upstream agent stub; it does
16
+ * not normalize execution records or own workflow authoring.
17
+ */
18
+ declare function ThinkExecutionWorkbench({
16
19
  backButton,
17
20
  className,
18
21
  pageSize,
@@ -20,8 +23,8 @@ declare function ThinkExecutionWorkbench<State = unknown>({
20
23
  source,
21
24
  title,
22
25
  ...props
23
- }: ThinkExecutionWorkbenchProps<State> & {
26
+ }: ThinkExecutionWorkbenchProps & {
24
27
  ref?: React.Ref<HTMLDivElement>;
25
28
  }): React.JSX.Element;
26
29
  //#endregion
27
- export { ThinkExecutionAgent, ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps, ThinkExecutionWorkbenchSource };
30
+ export { ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps };