@mcp-b/react-components 0.6.4 → 0.7.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/PromptInput-D6-G24p7.d.ts +528 -0
- package/dist/ThinkChatToolParts-DnUiZgCC.d.ts +83 -0
- package/dist/components/AgentChat.d.ts +11 -14
- package/dist/components/AgentChat.js +76 -57
- package/dist/components/AgentConnection.js +21 -18
- package/dist/components/Context.d.ts +6 -10
- package/dist/components/Context.js +4 -2
- package/dist/components/Conversation.d.ts +28 -28
- package/dist/components/Conversation.js +35 -54
- package/dist/components/Marker.d.ts +57 -0
- package/dist/components/Marker.js +89 -0
- package/dist/components/McpServerPicker.js +8 -10
- package/dist/components/MessageScroller.d.ts +52 -0
- package/dist/components/MessageScroller.js +62 -0
- package/dist/components/PromptInput.d.ts +2 -534
- package/dist/components/PromptInput.js +17 -11
- package/dist/components/ThinkChat.d.ts +10 -77
- package/dist/components/ThinkChat.js +59 -856
- package/dist/components/ThinkChatActivity.d.ts +73 -0
- package/dist/components/ThinkChatActivity.js +429 -0
- package/dist/components/ThinkChatContext.d.ts +28 -0
- package/dist/components/ThinkChatContext.js +10 -0
- package/dist/components/ThinkChatToolPanels.d.ts +39 -0
- package/dist/components/ThinkChatToolPanels.js +355 -0
- package/dist/components/ThinkChatToolParts.d.ts +2 -0
- package/dist/components/ThinkChatToolParts.js +66 -0
- package/dist/components/WorkspaceExplorer.d.ts +1 -1
- package/dist/components/useStickToBottom.d.ts +5 -2
- package/dist/components/useStickToBottom.js +5 -2
- package/dist/styles/agent-chat.css +15 -3
- package/dist/styles/agent-connection.css +12 -0
- package/dist/styles/code-block.css +4 -4
- package/dist/styles/conversation.css +10 -0
- package/dist/styles/index.css +2 -0
- package/dist/styles/marker.css +95 -0
- package/dist/styles/message-scroller.css +90 -0
- package/dist/styles/message.css +2 -1
- package/dist/styles/scrollbars.css +10 -2
- package/dist/styles/streamdown.css +2 -0
- package/dist/utils/mcp-server-catalog.d.ts +392 -1
- package/dist/utils/mcp-server-catalog.js +137 -1
- package/package.json +3 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ExecutionApprovals } from "
|
|
1
|
+
import { n as ExecutionApprovals } from "../PromptInput-D6-G24p7.js";
|
|
2
2
|
import { AgentChatProps, AgentChatRenderPartContext } from "./AgentChat.js";
|
|
3
3
|
import { BrowserLiveView, BrowserLiveViewProps } from "./BrowserLiveView.js";
|
|
4
4
|
import { BrowserReplay, BrowserReplayProps } from "./BrowserReplay.js";
|
|
5
|
+
import { _ as isThinkChatActivityPart } from "../ThinkChatToolParts-DnUiZgCC.js";
|
|
6
|
+
import { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, renderThinkChatActivityPart } from "./ThinkChatActivity.js";
|
|
7
|
+
import { ThinkChatValue } from "./ThinkChatContext.js";
|
|
5
8
|
import { FileInfo, UseWorkspaceOptions, WorkspaceExplorer, WorkspaceExplorerProps, WorkspaceFileState, WorkspaceInfo, WorkspaceSource, WorkspaceState, inferWorkspaceLanguage, useWorkspace } from "./WorkspaceExplorer.js";
|
|
6
9
|
import * as React from "react";
|
|
7
|
-
import {
|
|
8
|
-
import { useAgentChat } from "@cloudflare/think/react";
|
|
10
|
+
import { UIMessage } from "ai";
|
|
9
11
|
import { UseAgentOptions } from "agents/react";
|
|
10
12
|
|
|
11
13
|
//#region src/components/ThinkChat.d.ts
|
|
12
|
-
type ThinkChatValue = ReturnType<typeof useAgentChat<unknown, UIMessage>>;
|
|
13
|
-
type ThinkChatPart = UIMessage["parts"][number];
|
|
14
14
|
interface ThinkChatProviderProps {
|
|
15
15
|
/** The `useAgentChat` value from the `agents` SDK that descendants read. */
|
|
16
16
|
chat: ThinkChatValue;
|
|
@@ -44,11 +44,10 @@ interface ThinkChatMessagesProps extends ThinkChatActivityRendererOptions {
|
|
|
44
44
|
notice?: AgentChatProps["notice"];
|
|
45
45
|
/** Full replacement for part rendering; wins over excludeTools/toolRenderers. */
|
|
46
46
|
renderPart?: AgentChatProps["renderPart"];
|
|
47
|
-
/**
|
|
48
|
-
* Surfaces paused codemode executions in the composer's approval UI —
|
|
49
|
-
* the same confirmation tool approvals use. See {@link ExecutionApprovals}.
|
|
50
|
-
*/
|
|
47
|
+
/** Resolves Think execution approvals. `ThinkChat.Root` wires this automatically. */
|
|
51
48
|
executionApprovals?: ExecutionApprovals;
|
|
49
|
+
/** Think durable-pause approvals from `pendingApprovals()`. */
|
|
50
|
+
pendingApprovals?: AgentChatProps["pendingApprovals"];
|
|
52
51
|
/**
|
|
53
52
|
* Shows a Context ring in the composer footer — how much of the model's
|
|
54
53
|
* window the conversation occupies, from `metadata.usage` on the newest
|
|
@@ -56,29 +55,6 @@ interface ThinkChatMessagesProps extends ThinkChatActivityRendererOptions {
|
|
|
56
55
|
*/
|
|
57
56
|
contextWindow?: AgentChatProps["contextWindow"];
|
|
58
57
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Bespoke rendering for one tool inside the activity log. Both hooks fall
|
|
61
|
-
* through to the built-in families when they return `undefined`, so an
|
|
62
|
-
* override can adjust just the label or just the panel.
|
|
63
|
-
*/
|
|
64
|
-
interface ThinkChatToolRenderer {
|
|
65
|
-
/** One-line step label. `null` hides the step from the log. */
|
|
66
|
-
describe?: (part: ToolUIPart | DynamicToolUIPart) => string | null | undefined;
|
|
67
|
-
/** Expanded detail under the step. `null` keeps the step a plain row. */
|
|
68
|
-
panel?: (part: ToolUIPart | DynamicToolUIPart) => React.ReactNode;
|
|
69
|
-
}
|
|
70
|
-
type ThinkChatToolRenderers = Record<string, ThinkChatToolRenderer>;
|
|
71
|
-
interface ThinkChatActivityRendererOptions {
|
|
72
|
-
/**
|
|
73
|
-
* Tool names to keep out of activity folding entirely — the run splits
|
|
74
|
-
* around them and they fall through to your own renderPart / AgentChat's
|
|
75
|
-
* generic standalone activity row. For tools that should stay in the log
|
|
76
|
-
* with custom UI, use `toolRenderers` instead.
|
|
77
|
-
*/
|
|
78
|
-
excludeTools?: readonly string[];
|
|
79
|
-
/** Per-tool label/panel overrides inside the activity log, keyed by tool name. */
|
|
80
|
-
toolRenderers?: ThinkChatToolRenderers;
|
|
81
|
-
}
|
|
82
58
|
/**
|
|
83
59
|
* Chat UI for Cloudflare Think agents. Provide a `useAgentChat` value (or let
|
|
84
60
|
* `ThinkChat.Root` create one) and `ThinkChat.Messages` renders the message
|
|
@@ -118,53 +94,10 @@ declare function ThinkChatMessages({
|
|
|
118
94
|
excludeTools,
|
|
119
95
|
toolRenderers,
|
|
120
96
|
executionApprovals,
|
|
97
|
+
pendingApprovals,
|
|
121
98
|
notice,
|
|
122
99
|
...props
|
|
123
100
|
}: ThinkChatMessagesProps): React.JSX.Element;
|
|
124
|
-
/** Agent work (reasoning, tool calls, step boundaries) vs. content shown to the user. */
|
|
125
|
-
declare function isThinkChatActivityPart(part: ThinkChatPart | undefined, excludeTools?: ReadonlySet<string>): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* One-line natural-language label for an activity part ("Ran vp test",
|
|
128
|
-
* "Fetched developers.cloudflare.com/agents/"); `null` for boundaries that
|
|
129
|
-
* aren't steps (step-start). Exported so a custom `renderPart` can reuse the
|
|
130
|
-
* built-in labels for tools it doesn't override.
|
|
131
|
-
*/
|
|
132
|
-
declare function describeThinkChatActivityPart(part: ThinkChatPart, toolRenderers?: ThinkChatToolRenderers): string | null;
|
|
133
|
-
interface ThinkChatActivityProps {
|
|
134
|
-
/** Render with the log expanded. */
|
|
135
|
-
defaultOpen?: boolean;
|
|
136
|
-
parts: readonly ThinkChatPart[];
|
|
137
|
-
/** Defaults to deriving from part states (reasoning streaming, tool awaiting output). */
|
|
138
|
-
isStreaming?: boolean;
|
|
139
|
-
/** Per-tool label/panel overrides, keyed by tool name. */
|
|
140
|
-
toolRenderers?: ThinkChatToolRenderers;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* One run of agent work as a collapsed Activity block: while streaming the
|
|
144
|
-
* label shimmers with the live step; settled, it becomes a short summary
|
|
145
|
-
* ("Thought, read 2 files and ran a command") over an expandable step log
|
|
146
|
-
* with per-tool panels. Normally reached through `ThinkChat.Messages`;
|
|
147
|
-
* exported for apps that lay out messages themselves.
|
|
148
|
-
*/
|
|
149
|
-
declare function ThinkChatActivity({
|
|
150
|
-
parts,
|
|
151
|
-
defaultOpen,
|
|
152
|
-
isStreaming,
|
|
153
|
-
toolRenderers
|
|
154
|
-
}: ThinkChatActivityProps): React.JSX.Element | null;
|
|
155
|
-
/**
|
|
156
|
-
* Builds a renderPart handler that folds every run of consecutive activity
|
|
157
|
-
* parts (reasoning + tool calls) into one collapsed Activity box. Everything
|
|
158
|
-
* is derived from the UIMessage stream: part order, tool states, reasoning
|
|
159
|
-
* state. Excluded tools split the run and return undefined so your own
|
|
160
|
-
* renderPart (or AgentChat's generic activity row) takes over for them.
|
|
161
|
-
*/
|
|
162
|
-
declare function createThinkChatActivityRenderer({
|
|
163
|
-
excludeTools,
|
|
164
|
-
toolRenderers
|
|
165
|
-
}?: ThinkChatActivityRendererOptions): NonNullable<AgentChatProps["renderPart"]>;
|
|
166
|
-
/** Default activity renderer — `createThinkChatActivityRenderer()` with no overrides. */
|
|
167
|
-
declare const renderThinkChatActivityPart: (context: AgentChatRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
|
|
168
101
|
/**
|
|
169
102
|
* The ambient chat value from `ThinkChat.Root`/`Provider` — for custom tool
|
|
170
103
|
* panels, cards, or composer actions that need `messages`, `status`, or
|
|
@@ -204,4 +137,4 @@ declare const ThinkChat: {
|
|
|
204
137
|
createActivityRenderer: typeof createThinkChatActivityRenderer;
|
|
205
138
|
};
|
|
206
139
|
//#endregion
|
|
207
|
-
export { BrowserLiveView, type BrowserLiveViewProps, BrowserReplay, type BrowserReplayProps, type ExecutionApprovals, type FileInfo, ThinkChat, ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, ThinkChatToolRenderer, ThinkChatToolRenderers, type UseWorkspaceOptions, WorkspaceExplorer, type WorkspaceExplorerProps, type WorkspaceFileState, type WorkspaceInfo, type WorkspaceSource, type WorkspaceState, createThinkChatActivityRenderer, describeThinkChatActivityPart, inferWorkspaceLanguage, isThinkChatActivityPart, renderThinkChatActivityPart, useThinkChat, useWorkspace };
|
|
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 };
|