@mcp-b/react-components 0.7.0 → 0.7.1
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-D9koxDA7.js} +1 -1
- package/dist/{FileTree-BWQZ0FSi.js → FileTree-BdK93Uuu.js} +1 -1
- package/dist/ModelSelector-MQvK-pNb.js +306 -0
- package/dist/ThinkChatActivity-CeHzk6-K.d.ts +73 -0
- package/dist/ThinkChatContext-CC94HL4u.d.ts +28 -0
- package/dist/components/Activity.js +1 -1
- package/dist/components/AgentChat.d.ts +1 -100
- package/dist/components/AgentChat.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/ThinkChat.d.ts +16 -6
- package/dist/components/ThinkChat.js +1 -1
- package/dist/components/ThinkChatActivity.d.ts +2 -72
- package/dist/components/ThinkChatActivity.js +1 -1
- package/dist/components/ThinkChatContext.d.ts +1 -27
- package/dist/components/ThinkChatToolPanels.js +1 -1
- package/dist/components/ThinkFullApp.d.ts +23 -0
- package/dist/components/ThinkFullApp.js +175 -0
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/WorkspaceExplorer.js +3 -3
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-CB2MWcau.js → copy-button-TVhDAroI.js} +1 -1
- package/dist/{icons-BCNawx-T.js → icons-BAlTbWWP.js} +27 -1
- package/dist/{icons-BYpJY6L2.d.ts → icons-BRI54ATJ.d.ts} +2 -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 +2 -0
- package/dist/styles/message-scroller.css +24 -1
- package/dist/styles/prompt-input.css +1 -0
- package/dist/styles/think-full-app.css +318 -0
- package/dist/utils/mcp-server-catalog.d.ts +23 -1
- package/dist/utils/mcp-server-catalog.js +27 -1
- package/package.json +2 -2
|
@@ -1,101 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { ChatAddToolApproveResponseFunction, ChatStatus, UIMessage } from "ai";
|
|
4
|
-
import { PendingApproval } from "@cloudflare/think";
|
|
5
|
-
|
|
6
|
-
//#region src/components/AgentChat.d.ts
|
|
7
|
-
type AgentChatPart<MessageT extends UIMessage = UIMessage> = MessageT["parts"][number];
|
|
8
|
-
interface AgentChatRenderPartContext<MessageT extends UIMessage = UIMessage> {
|
|
9
|
-
message: MessageT;
|
|
10
|
-
part: AgentChatPart<MessageT>;
|
|
11
|
-
partIndex: number;
|
|
12
|
-
defaultRender: () => React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
interface AgentChatRenderMessageContext<MessageT extends UIMessage = UIMessage> {
|
|
15
|
-
message: MessageT;
|
|
16
|
-
messageIndex: number;
|
|
17
|
-
}
|
|
18
|
-
interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
|
|
19
|
-
className?: string;
|
|
20
|
-
/** AI SDK `UIMessage`s to render, oldest first. */
|
|
21
|
-
messages: readonly MessageT[];
|
|
22
|
-
/** Drives the composer's send/stop affordance and streaming indicators. */
|
|
23
|
-
status?: ChatStatus;
|
|
24
|
-
/** Called with the composed message when the user submits. Omit for a read-only transcript. */
|
|
25
|
-
onSubmit?: (message: PromptInputMessage) => void | Promise<void>;
|
|
26
|
-
/** Called when the user hits stop while `status` is streaming/submitted. */
|
|
27
|
-
onStop?: () => void;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
/** Rendered in place of the transcript while `messages` is empty. */
|
|
31
|
-
emptyState?: React.ReactNode;
|
|
32
|
-
/** Extra controls rendered in the composer toolbar. */
|
|
33
|
-
composerTools?: React.ReactNode;
|
|
34
|
-
/** Extra rows rendered in the built-in plus menu after files. */
|
|
35
|
-
composerAddMenuItems?: React.ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* Transient status rendered between the transcript and the composer —
|
|
38
|
-
* e.g. a "Reconnecting…" pill. `ThinkChat.Messages` fills this from the
|
|
39
|
-
* hook's `isRecovering`/`connectionError` automatically.
|
|
40
|
-
*/
|
|
41
|
-
notice?: React.ReactNode;
|
|
42
|
-
/**
|
|
43
|
-
* When set, the last assistant message gets a Retry action that calls this
|
|
44
|
-
* with its message id — pass to the AI SDK's `regenerate({ messageId })`.
|
|
45
|
-
*/
|
|
46
|
-
onRegenerate?: (messageId: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Pass `addToolApprovalResponse` from `useAgentChat`/`useChat` directly.
|
|
49
|
-
* When set and a tool call awaits approval, the composer becomes the
|
|
50
|
-
* confirmation.
|
|
51
|
-
*/
|
|
52
|
-
onApprovalResponse?: ChatAddToolApproveResponseFunction;
|
|
53
|
-
/** Resolves Think execution approvals. See {@link ExecutionApprovals}. */
|
|
54
|
-
executionApprovals?: ExecutionApprovals;
|
|
55
|
-
/** Think durable-pause approvals from `pendingApprovals()`, rendered when `executionApprovals` is set. */
|
|
56
|
-
pendingApprovals?: readonly PendingApproval[];
|
|
57
|
-
/**
|
|
58
|
-
* When set, a Context ring in the composer footer shows how much of the
|
|
59
|
-
* model's window the conversation occupies. Used tokens come from the
|
|
60
|
-
* newest message carrying `metadata.usage` (the AI SDK `messageMetadata`
|
|
61
|
-
* convention; Think merges it into message metadata as turns finish).
|
|
62
|
-
*/
|
|
63
|
-
contextWindow?: {
|
|
64
|
-
maxTokens: number;
|
|
65
|
-
modelId?: string;
|
|
66
|
-
};
|
|
67
|
-
/** Override rendering per part; return `undefined` to fall back to the default part UI. */
|
|
68
|
-
renderPart?: (context: AgentChatRenderPartContext<MessageT>) => React.ReactNode | undefined;
|
|
69
|
-
/** Rendered after each message's parts — for actions, citations, and the like. */
|
|
70
|
-
renderMessageAfter?: (context: AgentChatRenderMessageContext<MessageT>) => React.ReactNode;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Low-level transcript/composer surface used by `ThinkChat`: props in, no
|
|
74
|
-
* transport. Product code that talks to a Cloudflare Think agent should render
|
|
75
|
-
* `ThinkChat`; use this directly only for plain AI SDK or read-only messages.
|
|
76
|
-
*/
|
|
77
|
-
declare function AgentChat<MessageT extends UIMessage = UIMessage>({
|
|
78
|
-
className,
|
|
79
|
-
messages,
|
|
80
|
-
status,
|
|
81
|
-
onSubmit,
|
|
82
|
-
onStop,
|
|
83
|
-
placeholder,
|
|
84
|
-
disabled,
|
|
85
|
-
emptyState,
|
|
86
|
-
composerTools,
|
|
87
|
-
composerAddMenuItems,
|
|
88
|
-
notice,
|
|
89
|
-
onRegenerate,
|
|
90
|
-
onApprovalResponse,
|
|
91
|
-
executionApprovals,
|
|
92
|
-
pendingApprovals: durableApprovals,
|
|
93
|
-
contextWindow,
|
|
94
|
-
renderPart,
|
|
95
|
-
renderMessageAfter,
|
|
96
|
-
ref
|
|
97
|
-
}: AgentChatProps<MessageT> & {
|
|
98
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
99
|
-
}): React.JSX.Element;
|
|
100
|
-
//#endregion
|
|
1
|
+
import { a as AgentChatRenderPartContext, i as AgentChatRenderMessageContext, n as AgentChatPart, r as AgentChatProps, t as AgentChat } from "../AgentChat-403mckDG.js";
|
|
101
2
|
export { AgentChat, AgentChatPart, AgentChatProps, AgentChatRenderMessageContext, AgentChatRenderPartContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { O as PlusIcon, k as RefreshIcon } from "../icons-BAlTbWWP.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpServerCard, McpServerManualSetup } from "../utils/mcp-server-catalog.js";
|
|
1
|
+
import { McpServerCard, McpServerManualSetup, McpServerSetupAuth } from "../utils/mcp-server-catalog.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/AgentConnection.d.ts
|
|
@@ -38,6 +38,28 @@ type AgentConnectionPopoverProps = Omit<AgentConnectionPanelProps, "section"> &
|
|
|
38
38
|
type McpServerSetupProps = {
|
|
39
39
|
readonly setup: McpServerManualSetup;
|
|
40
40
|
};
|
|
41
|
+
type McpConnectorFormValues = {
|
|
42
|
+
readonly bearerToken?: string;
|
|
43
|
+
readonly clientId?: string;
|
|
44
|
+
readonly clientSecret?: string;
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly scope?: string;
|
|
47
|
+
readonly url: string;
|
|
48
|
+
};
|
|
49
|
+
type McpConnectorFormDefaults = Partial<Pick<McpConnectorFormValues, "name" | "url">>;
|
|
50
|
+
type McpConnectorFormProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "status"> & {
|
|
51
|
+
/** Authentication metadata that decides which credential fields render. */readonly auth?: McpServerSetupAuth; /** Label for the OAuth authorization button. */
|
|
52
|
+
readonly authorizeLabel?: string; /** Initial MCP name and URL values. */
|
|
53
|
+
readonly defaults?: McpConnectorFormDefaults; /** Pattern used to validate the MCP name field. */
|
|
54
|
+
readonly namePattern?: string; /** OAuth URL waiting for the user to authorize, when available. */
|
|
55
|
+
readonly pendingAuthUrl?: string | null; /** Read-only redirect URL shown for manual OAuth client setup. */
|
|
56
|
+
readonly redirectUrl?: string; /** Inline connection status announced politely to assistive tech. */
|
|
57
|
+
readonly status?: React.ReactNode; /** Label for the submit button. */
|
|
58
|
+
readonly submitLabel?: string; /** Label shown while submit is pending. */
|
|
59
|
+
readonly submittingLabel?: string; /** Called when the user starts OAuth authorization. */
|
|
60
|
+
readonly onAuthorize?: () => void | Promise<void>; /** Called with normalized connector values after native form validation passes. */
|
|
61
|
+
readonly onSubmit: (values: McpConnectorFormValues) => void | Promise<void>;
|
|
62
|
+
};
|
|
41
63
|
declare function Connection({
|
|
42
64
|
fromX,
|
|
43
65
|
fromY,
|
|
@@ -69,6 +91,25 @@ declare function AgentConnectionPanel({
|
|
|
69
91
|
declare function McpServerSetup({
|
|
70
92
|
setup
|
|
71
93
|
}: McpServerSetupProps): React.JSX.Element;
|
|
94
|
+
/** Collects MCP connector settings and optional credentials with native form validation. */
|
|
95
|
+
declare function McpConnectorForm({
|
|
96
|
+
auth,
|
|
97
|
+
authorizeLabel,
|
|
98
|
+
className,
|
|
99
|
+
defaults,
|
|
100
|
+
namePattern,
|
|
101
|
+
pendingAuthUrl,
|
|
102
|
+
redirectUrl,
|
|
103
|
+
status,
|
|
104
|
+
submitLabel,
|
|
105
|
+
submittingLabel,
|
|
106
|
+
onAuthorize,
|
|
107
|
+
onSubmit,
|
|
108
|
+
ref,
|
|
109
|
+
...props
|
|
110
|
+
}: McpConnectorFormProps & {
|
|
111
|
+
ref?: React.Ref<HTMLFormElement>;
|
|
112
|
+
}): React.JSX.Element;
|
|
72
113
|
/**
|
|
73
114
|
* Compact popover trigger for showing AgentConnectionPanel inline.
|
|
74
115
|
*/
|
|
@@ -77,4 +118,4 @@ declare function AgentConnectionPopover({
|
|
|
77
118
|
...props
|
|
78
119
|
}: AgentConnectionPopoverProps): React.JSX.Element;
|
|
79
120
|
//#endregion
|
|
80
|
-
export { AgentConnectionCommand, AgentConnectionPanel, AgentConnectionPanelProps, AgentConnectionPopover, AgentConnectionPopoverProps, AgentConnectionTarget, Connection, ConnectionProps, McpServerSetup, McpServerSetupProps, NanitesAgentConnectionOptions, buildNanitesAgentConnectionCommands };
|
|
121
|
+
export { AgentConnectionCommand, AgentConnectionPanel, AgentConnectionPanelProps, AgentConnectionPopover, AgentConnectionPopoverProps, AgentConnectionTarget, Connection, ConnectionProps, McpConnectorForm, McpConnectorFormDefaults, McpConnectorFormProps, McpConnectorFormValues, McpServerSetup, McpServerSetupProps, NanitesAgentConnectionOptions, buildNanitesAgentConnectionCommands };
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { b as LinkIcon } from "../icons-BAlTbWWP.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-
|
|
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";
|
|
6
|
+
import { Field } from "./Field.js";
|
|
7
|
+
import { Form } from "./Form.js";
|
|
6
8
|
import { DCR_MCP_SERVER_CARDS, MANUAL_MCP_SERVER_CARDS, getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
|
|
7
9
|
import * as React from "react";
|
|
8
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
//#region src/components/AgentConnection.tsx
|
|
10
12
|
const DEFAULT_LOCAL_ORIGIN = "http://localhost:5173";
|
|
11
13
|
const CONNECTION_CURVE_MIDPOINT = .5;
|
|
14
|
+
const MCP_CONNECTOR_NAME_PATTERN = "[A-Za-z_$][A-Za-z0-9_$]*";
|
|
15
|
+
const CUSTOM_AUTH_FIELDS = [{
|
|
16
|
+
inputType: "password",
|
|
17
|
+
label: "Bearer",
|
|
18
|
+
name: "bearerToken"
|
|
19
|
+
}];
|
|
12
20
|
function Connection({ fromX, fromY, toX, toY, ...props }) {
|
|
13
21
|
const controlX = fromX + (toX - fromX) * CONNECTION_CURVE_MIDPOINT;
|
|
14
22
|
return /* @__PURE__ */ jsxs("g", {
|
|
@@ -211,6 +219,149 @@ function McpServerSetup({ setup }) {
|
|
|
211
219
|
]
|
|
212
220
|
});
|
|
213
221
|
}
|
|
222
|
+
/** Collects MCP connector settings and optional credentials with native form validation. */
|
|
223
|
+
function McpConnectorForm({ auth, authorizeLabel = "Authorize", className, defaults, namePattern = MCP_CONNECTOR_NAME_PATTERN, pendingAuthUrl, redirectUrl = "", status, submitLabel = "Connect MCP", submittingLabel = "Connecting", onAuthorize, onSubmit, ref, ...props }) {
|
|
224
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
225
|
+
const credentialFields = (auth?.fields ?? CUSTOM_AUTH_FIELDS).filter(isCredentialAuthField);
|
|
226
|
+
const redirectUrlField = auth?.fields.find((field) => field.name === "redirectUrl");
|
|
227
|
+
async function handleSubmit(event) {
|
|
228
|
+
event.preventDefault();
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
if (!event.currentTarget.reportValidity()) return;
|
|
231
|
+
setSubmitting(true);
|
|
232
|
+
try {
|
|
233
|
+
await onSubmit(readMcpConnectorFormValues(new FormData(event.currentTarget)));
|
|
234
|
+
} finally {
|
|
235
|
+
setSubmitting(false);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return /* @__PURE__ */ jsxs(Form, {
|
|
239
|
+
ref,
|
|
240
|
+
"aria-label": "MCP connector",
|
|
241
|
+
className: cx("agent-connect__mcp-form", className),
|
|
242
|
+
noValidate: false,
|
|
243
|
+
onSubmit: handleSubmit,
|
|
244
|
+
...props,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Field.Label, {
|
|
248
|
+
htmlFor: "mcpName",
|
|
249
|
+
children: "MCP name"
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
252
|
+
id: "mcpName",
|
|
253
|
+
name: "name",
|
|
254
|
+
pattern: namePattern,
|
|
255
|
+
required: true,
|
|
256
|
+
title: "Use a valid JavaScript identifier.",
|
|
257
|
+
defaultValue: defaults?.name ?? "localMcp"
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
260
|
+
match: "valueMissing",
|
|
261
|
+
children: "MCP name is required."
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
264
|
+
match: "patternMismatch",
|
|
265
|
+
children: "Use a valid JavaScript identifier."
|
|
266
|
+
})
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
269
|
+
/* @__PURE__ */ jsx(Field.Label, {
|
|
270
|
+
htmlFor: "mcpUrl",
|
|
271
|
+
children: "MCP URL"
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
274
|
+
id: "mcpUrl",
|
|
275
|
+
name: "url",
|
|
276
|
+
placeholder: "http://127.0.0.1:8787/mcp",
|
|
277
|
+
required: true,
|
|
278
|
+
type: "url",
|
|
279
|
+
defaultValue: defaults?.url ?? ""
|
|
280
|
+
}),
|
|
281
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
282
|
+
match: "valueMissing",
|
|
283
|
+
children: "MCP URL is required."
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
286
|
+
match: "typeMismatch",
|
|
287
|
+
children: "MCP URL must use http or https."
|
|
288
|
+
})
|
|
289
|
+
] }),
|
|
290
|
+
redirectUrlField ? /* @__PURE__ */ jsxs(Field.Root, { children: [/* @__PURE__ */ jsx(Field.Label, {
|
|
291
|
+
htmlFor: "mcpRedirectUrl",
|
|
292
|
+
children: redirectUrlField.label
|
|
293
|
+
}), /* @__PURE__ */ jsx(Field.Control, {
|
|
294
|
+
id: "mcpRedirectUrl",
|
|
295
|
+
name: "redirectUrl",
|
|
296
|
+
readOnly: true,
|
|
297
|
+
type: "url",
|
|
298
|
+
value: redirectUrl
|
|
299
|
+
})] }) : null,
|
|
300
|
+
credentialFields.map((authField) => /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
301
|
+
/* @__PURE__ */ jsx(Field.Label, {
|
|
302
|
+
htmlFor: `mcp-${authField.name}`,
|
|
303
|
+
children: authField.label
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
306
|
+
autoComplete: "off",
|
|
307
|
+
id: `mcp-${authField.name}`,
|
|
308
|
+
name: authField.name,
|
|
309
|
+
placeholder: authField.placeholder,
|
|
310
|
+
required: authField.required,
|
|
311
|
+
type: authField.inputType ?? "text"
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsxs(Field.Error, {
|
|
314
|
+
match: "valueMissing",
|
|
315
|
+
children: [authField.label, " is required."]
|
|
316
|
+
})
|
|
317
|
+
] }, authField.name)),
|
|
318
|
+
/* @__PURE__ */ jsxs("div", {
|
|
319
|
+
className: "agent-connect__mcp-form-actions",
|
|
320
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
321
|
+
type: "submit",
|
|
322
|
+
size: "sm",
|
|
323
|
+
disabled: submitting,
|
|
324
|
+
children: submitting ? submittingLabel : submitLabel
|
|
325
|
+
}), pendingAuthUrl ? /* @__PURE__ */ jsx(Button, {
|
|
326
|
+
type: "button",
|
|
327
|
+
variant: "outline",
|
|
328
|
+
color: "neutral",
|
|
329
|
+
size: "sm",
|
|
330
|
+
onClick: () => {
|
|
331
|
+
onAuthorize?.();
|
|
332
|
+
},
|
|
333
|
+
children: authorizeLabel
|
|
334
|
+
}) : null]
|
|
335
|
+
}),
|
|
336
|
+
status ? /* @__PURE__ */ jsx("span", {
|
|
337
|
+
className: "agent-connect__mcp-form-status",
|
|
338
|
+
"aria-live": "polite",
|
|
339
|
+
children: status
|
|
340
|
+
}) : null
|
|
341
|
+
]
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function readMcpConnectorFormValues(data) {
|
|
345
|
+
const bearerToken = readFormString(data, "bearerToken");
|
|
346
|
+
const clientId = readFormString(data, "clientId");
|
|
347
|
+
const clientSecret = readFormString(data, "clientSecret");
|
|
348
|
+
const scope = readFormString(data, "scope");
|
|
349
|
+
return {
|
|
350
|
+
...bearerToken ? { bearerToken } : {},
|
|
351
|
+
...clientId ? { clientId } : {},
|
|
352
|
+
...clientSecret ? { clientSecret } : {},
|
|
353
|
+
name: readFormString(data, "name"),
|
|
354
|
+
...scope ? { scope } : {},
|
|
355
|
+
url: readFormString(data, "url")
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function readFormString(data, name) {
|
|
359
|
+
const value = data.get(name);
|
|
360
|
+
return typeof value === "string" ? value.trim() : "";
|
|
361
|
+
}
|
|
362
|
+
function isCredentialAuthField(field) {
|
|
363
|
+
return field.name !== "redirectUrl";
|
|
364
|
+
}
|
|
214
365
|
function renderMcpServerIcon(server) {
|
|
215
366
|
const src = getMcpServerIconSrc(server);
|
|
216
367
|
if (src) return /* @__PURE__ */ jsx(McpServerIconImage, {
|
|
@@ -261,4 +412,4 @@ function AgentConnectionPopover({ className, ...props }) {
|
|
|
261
412
|
}) })] });
|
|
262
413
|
}
|
|
263
414
|
//#endregion
|
|
264
|
-
export { AgentConnectionPanel, AgentConnectionPopover, Connection, McpServerSetup, buildNanitesAgentConnectionCommands };
|
|
415
|
+
export { AgentConnectionPanel, AgentConnectionPopover, Connection, McpConnectorForm, McpServerSetup, buildNanitesAgentConnectionCommands };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { I as XIcon } from "../icons-BAlTbWWP.js";
|
|
3
3
|
import { Button } from "./Button.js";
|
|
4
4
|
import { Tooltip, TooltipPopup, TooltipPortal, TooltipPositioner, TooltipTrigger } from "./Tooltip.js";
|
|
5
5
|
import "react";
|
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/components/BrowserLiveView.d.ts
|
|
4
|
-
interface BrowserLiveViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/** Live View URL (Browser Run `devtoolsFrontendUrl`, e.g. live.browser.run). */
|
|
6
|
-
url: string;
|
|
7
|
-
/** Epoch ms after which the URL is dead (Browser Run mints ~5-minute links). */
|
|
8
|
-
expiresAt?: number;
|
|
9
|
-
/** The page the session was showing — used for the ended-state text. */
|
|
10
|
-
pageTitle?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Shown once the link expires — pass the last screenshot the agent took
|
|
13
|
-
* (`<img>`) to keep the final frame on screen. Defaults to a quiet
|
|
14
|
-
* "Live view ended" state.
|
|
15
|
-
*/
|
|
16
|
-
fallback?: React.ReactNode;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Embeds a Browser Run Live View — a real-time, interactive view of the
|
|
20
|
-
* agent's browser session. Links expire (~5 minutes), so the iframe swaps to
|
|
21
|
-
* `fallback` (e.g. the last screenshot) once `expiresAt` passes. While the
|
|
22
|
-
* hosted viewer connects, a quiet loading overlay hides the frame; if it
|
|
23
|
-
* never loads, the view degrades to `fallback` or an unavailable state. An
|
|
24
|
-
* expand button opens the same view in a fullscreen dialog.
|
|
25
|
-
*
|
|
26
|
-
* Where URLs come from (upstream: `agents/browser` in
|
|
27
|
-
* github.com/cloudflare/agents — `BrowserLiveViewUrl`): the model calls
|
|
28
|
-
* `cdp.getLiveViewUrl()` inside a `browser_execute` tool run, or the host
|
|
29
|
-
* calls `connector.liveView()`/`sessionInfo()`. This package's chat rendering
|
|
30
|
-
* derives the component automatically from links found in tool results.
|
|
31
|
-
*
|
|
32
|
-
* Styling rides `@mcp-b/react-components/styles` (browser-live-view.css),
|
|
33
|
-
* which think-chat consumers load anyway.
|
|
34
|
-
*
|
|
35
|
-
* The iframe is unsandboxed by design: the hosted Live View UI needs scripts
|
|
36
|
-
* and its own origin to stream the session. Only pass trusted Live View URLs.
|
|
37
|
-
*/
|
|
38
|
-
declare function BrowserLiveView({
|
|
39
|
-
url,
|
|
40
|
-
expiresAt,
|
|
41
|
-
pageTitle,
|
|
42
|
-
fallback,
|
|
43
|
-
className,
|
|
44
|
-
...props
|
|
45
|
-
}: BrowserLiveViewProps): React.JSX.Element;
|
|
46
|
-
//#endregion
|
|
1
|
+
import { n as BrowserLiveViewProps, t as BrowserLiveView } from "../BrowserLiveView-ZktFZiMD.js";
|
|
47
2
|
export { BrowserLiveView, BrowserLiveViewProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { j as SpinnerIcon, x as MaximizeIcon } from "../icons-BAlTbWWP.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,40 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/components/BrowserReplay.d.ts
|
|
4
|
-
interface BrowserReplayProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
5
|
-
/**
|
|
6
|
-
* rrweb events for one tab, e.g. one
|
|
7
|
-
* `BrowserRecording.events[targetId]` entry from Cloudflare Browser Run.
|
|
8
|
-
*/
|
|
9
|
-
events: unknown[];
|
|
10
|
-
/** Start playing on mount. */
|
|
11
|
-
autoPlay?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Replays a completed Cloudflare Browser Run recording locally with rrweb.
|
|
15
|
-
*
|
|
16
|
-
* This is intentionally not derived from Think chat message parts. Live view
|
|
17
|
-
* links and screenshots ride the `browser_execute` stream and belong to
|
|
18
|
-
* `BrowserLiveView`; replay events are fetched after a session closes with
|
|
19
|
-
* Browser Run's `getBrowserRecording()`. Upstream currently shapes those
|
|
20
|
-
* recordings as `Record<targetId, unknown[]>`, where each array is plain rrweb
|
|
21
|
-
* JSON for one tab. Playback happens in the viewer's browser through
|
|
22
|
-
* `@rrweb/replay`; no replay service is contacted at playback time.
|
|
23
|
-
*
|
|
24
|
-
* Styling rides `@mcp-b/react-components/styles` (browser-replay.css), which
|
|
25
|
-
* think-chat consumers load anyway.
|
|
26
|
-
*
|
|
27
|
-
* @see https://github.com/cloudflare/agents/tree/main/packages/agents/src/browser
|
|
28
|
-
* @see https://github.com/rrweb-io/rrweb/tree/main/packages/%40rrweb/replay
|
|
29
|
-
*/
|
|
30
|
-
declare function BrowserReplay({
|
|
31
|
-
className,
|
|
32
|
-
events,
|
|
33
|
-
autoPlay,
|
|
34
|
-
ref,
|
|
35
|
-
...props
|
|
36
|
-
}: BrowserReplayProps & {
|
|
37
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
38
|
-
}): React.JSX.Element;
|
|
39
|
-
//#endregion
|
|
1
|
+
import { n as BrowserReplayProps, t as BrowserReplay } from "../BrowserReplay-6G-mnwcn.js";
|
|
40
2
|
export { BrowserReplay, BrowserReplayProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
2
|
+
import { D as PlayIcon, T as PauseIcon } from "../icons-BAlTbWWP.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 {
|
|
2
|
+
import { v as IconProps } from "../icons-BRI54ATJ.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 {
|
|
3
|
+
import { a as CheckIcon, c as ChevronRightIcon, j as SpinnerIcon, u as DotIcon } from "../icons-BAlTbWWP.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/ChainOfThought.tsx
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ChatGptSignInScreen.d.ts
|
|
4
|
+
interface ChatGptSignInScreenProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
/** Whether the sign-in request is currently opening ChatGPT. */
|
|
6
|
+
busy?: boolean;
|
|
7
|
+
/** Shows the sign-in action in its error state. */
|
|
8
|
+
error?: boolean;
|
|
9
|
+
/** Button label for the ChatGPT sign-in action. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Main heading shown above the sign-in button. */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Brand name displayed under the heading. */
|
|
14
|
+
brandName?: string;
|
|
15
|
+
/** Brand mark displayed next to the brand name. */
|
|
16
|
+
brandLogo?: React.ReactNode;
|
|
17
|
+
/** Called when the user clicks the sign-in action. */
|
|
18
|
+
onSignIn?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/** Full-screen ChatGPT authentication prompt for MCP-B onboarding. */
|
|
21
|
+
declare function ChatGptSignInScreen({
|
|
22
|
+
busy,
|
|
23
|
+
error,
|
|
24
|
+
label,
|
|
25
|
+
title,
|
|
26
|
+
brandName,
|
|
27
|
+
brandLogo,
|
|
28
|
+
className,
|
|
29
|
+
onPointerLeave,
|
|
30
|
+
onPointerMove,
|
|
31
|
+
onSignIn,
|
|
32
|
+
ref,
|
|
33
|
+
...props
|
|
34
|
+
}: ChatGptSignInScreenProps & {
|
|
35
|
+
ref?: React.Ref<HTMLElement>;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ChatGptSignInScreen, ChatGptSignInScreenProps };
|