@mcp-b/react-components 0.14.2 → 0.16.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/AgentActivity-BNUNrP9O.d.ts +36 -0
- package/dist/{AgentChat-DQkqt82e.d.ts → AgentChat-CrlpbvQJ.d.ts} +58 -6
- package/dist/{CodeBlock-DUh9WOGo.d.ts → CodeBlock-BRajW4QU.d.ts} +1 -1
- package/dist/{CodeBlock-BUFXG8HW.js → CodeBlock-BmB4Xaqq.js} +15 -4
- package/dist/{FileTree-mpEIcfzA.js → FileTree-CkVbIMWV.js} +82 -89
- package/dist/Message-BkMdE3bS.js +375 -0
- package/dist/{ModelSelector-CPCpFAUt.js → ModelSelector-SlJNgwKY.js} +2 -2
- package/dist/{PromptInput-ClNqBiIw.d.ts → PromptInput-BWTuXMOD.d.ts} +123 -5
- package/dist/ResponsiveSidebarShell-Dd9DCcBT.d.ts +67 -0
- package/dist/{Select-Dl_vF_Bt.d.ts → Select-BeEsefzh.d.ts} +12 -2
- package/dist/{ThinkChat-BPcehdbP.js → ThinkChat-CzC-zNGA.js} +24 -36
- package/dist/{ThinkChatActivity-BmwuIigx.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-CDEjqS6A.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +13 -3
- package/dist/ThinkExecutionRun-ChhWhOoU.d.ts +30 -0
- package/dist/Toggle-CAAlNl-M.d.ts +69 -0
- package/dist/ToggleGroup-8hPv-b69.d.ts +73 -0
- package/dist/Workspace-D39LxGvP.d.ts +62 -0
- package/dist/WorkspaceFile-DOZkPwzu.d.ts +106 -0
- package/dist/WorkspaceFileView-rSN_yT0L.js +744 -0
- package/dist/WorkspaceLink-DIPbXrUM.js +337 -0
- package/dist/WorkspaceLink-DK1DWMHe.d.ts +89 -0
- package/dist/components/Activity.d.ts +27 -1
- package/dist/components/Activity.js +33 -15
- package/dist/components/AgentActivity.d.ts +2 -0
- package/dist/components/AgentActivity.js +45 -0
- package/dist/components/AgentActivityPreview.d.ts +46 -0
- package/dist/components/AgentActivityPreview.js +94 -0
- package/dist/components/AgentAttention.d.ts +73 -0
- package/dist/components/AgentAttention.js +85 -0
- package/dist/components/AgentChat.d.ts +2 -2
- package/dist/components/AgentChat.js +224 -200
- package/dist/components/AgentChatMessageEditor.d.ts +29 -0
- package/dist/components/AgentChatMessageEditor.js +92 -0
- package/dist/components/AgentChatTurnError.d.ts +17 -0
- package/dist/components/AgentChatTurnError.js +40 -0
- package/dist/components/AgentConnection.d.ts +12 -17
- package/dist/components/AgentConnection.js +99 -91
- package/dist/components/AppFrame.d.ts +24 -0
- package/dist/components/AppFrame.js +25 -0
- package/dist/components/AppTopBar.d.ts +71 -0
- package/dist/components/AppTopBar.js +82 -0
- package/dist/components/Artifact.js +1 -1
- package/dist/components/BrowserLiveView.js +1 -1
- package/dist/components/BrowserReplay.js +1 -1
- package/dist/components/BrowserRunPanel.js +1 -1
- package/dist/components/Card.d.ts +3 -0
- package/dist/components/Card.js +2 -1
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +1 -1
- package/dist/components/ChatGptSignInScreen.js +2 -2
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/CheckboxGroup.d.ts +58 -2
- package/dist/components/CheckboxGroup.js +59 -1
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +1 -1
- package/dist/components/Commit.js +2 -2
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/Conversation.js +1 -1
- package/dist/components/DescriptionList.d.ts +12 -0
- package/dist/components/DescriptionList.js +11 -0
- package/dist/components/DescriptionListParts.d.ts +37 -0
- package/dist/components/DescriptionListParts.js +35 -0
- package/dist/components/EnvironmentVariables.js +2 -2
- package/dist/components/Fieldset.d.ts +13 -1
- package/dist/components/Fieldset.js +11 -2
- package/dist/components/FileTree.js +1 -1
- package/dist/components/IconButton.d.ts +33 -0
- package/dist/components/IconButton.js +27 -0
- package/dist/components/McpConnectionRequest.d.ts +44 -0
- package/dist/components/McpConnectionRequest.js +122 -0
- package/dist/components/McpServerPicker.d.ts +48 -23
- package/dist/components/McpServerPicker.js +238 -189
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Message.d.ts +1 -0
- package/dist/components/Message.js +1 -285
- package/dist/components/MessageScroller.js +1 -1
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/Pricing.d.ts +37 -0
- package/dist/components/Pricing.js +17 -0
- package/dist/components/PricingBillingToggle.d.ts +23 -0
- package/dist/components/PricingBillingToggle.js +86 -0
- package/dist/components/PricingConfirmationDialog.d.ts +25 -0
- package/dist/components/PricingConfirmationDialog.js +57 -0
- package/dist/components/PricingFAQ.d.ts +18 -0
- package/dist/components/PricingFAQ.js +27 -0
- package/dist/components/PricingPage.d.ts +2 -38
- package/dist/components/PricingPage.js +39 -359
- package/dist/components/PricingPlanCard.d.ts +22 -0
- package/dist/components/PricingPlanCard.js +109 -0
- package/dist/components/PricingUsageCalculator.d.ts +22 -0
- package/dist/components/PricingUsageCalculator.js +96 -0
- package/dist/components/PromptInput.d.ts +2 -2
- package/dist/components/PromptInput.js +210 -15
- package/dist/components/Queue.js +1 -1
- package/dist/components/Reasoning.d.ts +2 -1
- package/dist/components/Reasoning.js +14 -29
- package/dist/components/ResizableSidePanel.d.ts +57 -0
- package/dist/components/ResizableSidePanel.js +151 -0
- package/dist/components/ResponsiveSidebarShell.d.ts +2 -0
- package/dist/components/ResponsiveSidebarShell.js +129 -0
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.js +11 -2
- package/dist/components/Slider.d.ts +13 -1
- package/dist/components/Slider.js +11 -0
- package/dist/components/Sources.js +1 -1
- package/dist/components/Stepper.d.ts +4 -0
- package/dist/components/Stepper.js +5 -3
- package/dist/components/SubagentRun.d.ts +18 -19
- package/dist/components/SubagentRun.js +25 -18
- package/dist/components/SubagentRunIndicator.d.ts +22 -0
- package/dist/components/SubagentRunIndicator.js +33 -0
- package/dist/components/SubagentRunList.d.ts +25 -0
- package/dist/components/SubagentRunList.js +26 -0
- package/dist/components/SubagentRunSelector.d.ts +47 -0
- package/dist/components/SubagentRunSelector.js +55 -0
- package/dist/components/Task.js +1 -1
- package/dist/components/Terminal.js +2 -2
- package/dist/components/TestResults.js +1 -1
- package/dist/components/Textarea.d.ts +21 -0
- package/dist/components/Textarea.js +19 -0
- package/dist/components/ThemeModeControl.d.ts +24 -0
- package/dist/components/ThemeModeControl.js +52 -0
- package/dist/components/ThemeProvider.d.ts +38 -0
- package/dist/components/ThemeProvider.js +80 -0
- package/dist/components/ThinkChat.d.ts +29 -6
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +12 -318
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +7 -5
- package/dist/components/ThinkChatToolPanels.js +70 -8
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +36 -10
- package/dist/components/ThinkExecutionDetail.d.ts +20 -0
- package/dist/components/ThinkExecutionDetail.js +80 -0
- package/dist/components/ThinkExecutionRun.d.ts +2 -0
- package/dist/components/ThinkExecutionRun.js +72 -0
- package/dist/components/ThinkExecutionStatus.d.ts +22 -0
- package/dist/components/ThinkExecutionStatus.js +36 -0
- package/dist/components/ThinkExecutionWorkbench.d.ts +7 -0
- package/dist/components/ThinkExecutionWorkbench.js +69 -225
- package/dist/components/ThinkFullApp.d.ts +58 -14
- package/dist/components/ThinkFullApp.js +154 -160
- package/dist/components/ThinkFullAppViewSwitch.d.ts +31 -0
- package/dist/components/ThinkFullAppViewSwitch.js +34 -0
- package/dist/components/ThinkRoutine.d.ts +36 -0
- package/dist/components/ThinkRoutine.js +15 -0
- package/dist/components/ThinkRoutineBrowser.d.ts +25 -0
- package/dist/components/ThinkRoutineBrowser.js +156 -0
- package/dist/components/ThinkRoutineDetail.d.ts +24 -0
- package/dist/components/ThinkRoutineDetail.js +102 -0
- package/dist/components/ThinkRoutineForm.d.ts +32 -0
- package/dist/components/ThinkRoutineForm.js +151 -0
- package/dist/components/ThinkRoutineLibrary.d.ts +74 -0
- package/dist/components/ThinkRoutineLibrary.js +178 -0
- package/dist/components/ThinkRoutineRuns.d.ts +24 -0
- package/dist/components/ThinkRoutineRuns.js +68 -0
- package/dist/components/ThinkThreadPicker.d.ts +18 -1
- package/dist/components/ThinkThreadPicker.js +51 -5
- package/dist/components/ThinkThreadShell.d.ts +12 -9
- package/dist/components/ThinkThreadShell.js +17 -137
- package/dist/components/Toggle.d.ts +1 -68
- package/dist/components/ToggleGroup.d.ts +1 -72
- package/dist/components/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip.js +4 -2
- package/dist/components/WebPreview.js +1 -1
- package/dist/components/Workspace.d.ts +2 -0
- package/dist/components/Workspace.js +424 -0
- package/dist/components/WorkspaceBrowser.d.ts +32 -0
- package/dist/components/WorkspaceBrowser.js +103 -0
- package/dist/components/WorkspaceExplorer.d.ts +12 -79
- package/dist/components/WorkspaceExplorer.js +116 -330
- package/dist/components/WorkspaceFile.d.ts +2 -0
- package/dist/components/WorkspaceFile.js +195 -0
- package/dist/components/WorkspaceFileView.d.ts +26 -0
- package/dist/components/WorkspaceFileView.js +2 -0
- package/dist/components/WorkspaceHeader.d.ts +35 -0
- package/dist/components/WorkspaceHeader.js +51 -0
- package/dist/components/WorkspaceLink.d.ts +2 -0
- package/dist/components/WorkspaceLink.js +2 -0
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-DUMLYdsk.js → copy-button-Dejn5heL.js} +1 -1
- package/dist/icons-CpfUer49.js +85 -0
- package/dist/{icons-CUCz_Sft.d.ts → icons-GQd1xF4e.d.ts} +51 -1
- package/dist/styles/activity-header.css +75 -0
- package/dist/styles/activity.css +49 -63
- package/dist/styles/agent-activity-preview-overlay.css +80 -0
- package/dist/styles/agent-activity-preview.css +233 -0
- package/dist/styles/agent-attention.css +128 -0
- package/dist/styles/agent-chat.css +133 -4
- package/dist/styles/agent-connection.css +9 -9
- package/dist/styles/alert-dialog.css +11 -11
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +102 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +29 -8
- package/dist/styles/chain-of-thought.css +5 -5
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/codex-model-selector.css +3 -3
- package/dist/styles/combobox.css +2 -1
- package/dist/styles/context-menu.css +1 -1
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/dialog.css +11 -11
- package/dist/styles/field.css +14 -14
- package/dist/styles/fieldset.css +15 -4
- package/dist/styles/index.css +14 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +96 -68
- package/dist/styles/menu.css +1 -1
- package/dist/styles/message.css +4 -43
- package/dist/styles/model-selector.css +18 -12
- package/dist/styles/popover.css +9 -9
- package/dist/styles/preview-card.css +1 -1
- package/dist/styles/pricing-page.css +21 -27
- package/dist/styles/prompt-input.css +225 -32
- package/dist/styles/reasoning.css +1 -55
- package/dist/styles/recipes.css +50 -24
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +13 -3
- package/dist/styles/sources.css +6 -6
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +59 -42
- package/dist/styles/task.css +17 -10
- package/dist/styles/test-results.css +17 -10
- package/dist/styles/textarea.css +20 -0
- package/dist/styles/theme-mode-control.css +72 -0
- package/dist/styles/think-execution-status.css +49 -0
- package/dist/styles/think-execution-workbench.css +16 -80
- package/dist/styles/think-full-app.css +143 -128
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toast.css +6 -6
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/workspace-explorer.css +516 -64
- package/dist/utils/mcp-server-catalog.d.ts +82 -78
- package/dist/utils/mcp-server-catalog.js +64 -41
- package/dist/utils/structured-code.d.ts +1 -1
- package/dist/utils/theme.d.ts +22 -0
- package/dist/utils/theme.js +55 -0
- package/package.json +34 -28
- package/dist/icons-Ba9THQKz.js +0 -64
- package/dist/styles/think-resize-handle.css +0 -33
- package/dist/styles/think-thread-shell.css +0 -219
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Button } from "./Button.js";
|
|
2
|
+
import { Tooltip } from "./Tooltip.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/IconButton.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A square, icon-only button with a required accessible name and matching
|
|
8
|
+
* tooltip. Use text buttons for actions whose consequence an icon cannot make
|
|
9
|
+
* clear on its own.
|
|
10
|
+
*/
|
|
11
|
+
function IconButton({ children, label, size = "icon-sm", tooltip = label, tooltipSide = "top", type = "button", ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
13
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
14
|
+
type,
|
|
15
|
+
size,
|
|
16
|
+
"aria-label": label,
|
|
17
|
+
...props
|
|
18
|
+
}),
|
|
19
|
+
children
|
|
20
|
+
}), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
21
|
+
side: tooltipSide,
|
|
22
|
+
sideOffset: 6,
|
|
23
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: tooltip })
|
|
24
|
+
}) })] });
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { IconButton };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { McpServerCard } from "../utils/mcp-server-catalog.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
4
|
+
import { MCPServersState } from "agents";
|
|
5
|
+
|
|
6
|
+
//#region src/components/McpConnectionRequest.d.ts
|
|
7
|
+
type McpConnectionRequestOutcome = "connected" | "declined" | "failed";
|
|
8
|
+
interface McpConnectionRequestProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "part"> {
|
|
9
|
+
/** Whole upstream AI SDK tool part whose lifecycle this card renders. */
|
|
10
|
+
part: ToolUIPart | DynamicToolUIPart;
|
|
11
|
+
/** Canonical catalog/custom display data after the host validates the request. */
|
|
12
|
+
server: McpServerCard;
|
|
13
|
+
/** Plain-language detail supplied by the app's validated tool input or failed output. */
|
|
14
|
+
reason: React.ReactNode;
|
|
15
|
+
/** Whole upstream Agents MCP state, kept separate from the tool lifecycle. */
|
|
16
|
+
mcp?: MCPServersState;
|
|
17
|
+
/** App-validated meaning of an available tool output. */
|
|
18
|
+
outcome?: McpConnectionRequestOutcome;
|
|
19
|
+
/** Starts a new connection or replaces a stale non-ready upstream entry. */
|
|
20
|
+
onConnect?: (server: McpServerCard) => void | Promise<void>;
|
|
21
|
+
/** Declines the request. The host may remove any existing non-ready entry. */
|
|
22
|
+
onDecline?: () => void | Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* In-chat MCP connection request backed by the AI SDK tool part and Agents MCP
|
|
26
|
+
* state. Failed and interrupted connections deliberately restart through the
|
|
27
|
+
* same `onConnect` seam instead of introducing recovery operations.
|
|
28
|
+
*/
|
|
29
|
+
declare function McpConnectionRequest({
|
|
30
|
+
part,
|
|
31
|
+
server,
|
|
32
|
+
reason,
|
|
33
|
+
mcp,
|
|
34
|
+
outcome,
|
|
35
|
+
onConnect,
|
|
36
|
+
onDecline,
|
|
37
|
+
className,
|
|
38
|
+
ref,
|
|
39
|
+
...props
|
|
40
|
+
}: McpConnectionRequestProps & {
|
|
41
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { McpConnectionRequest, McpConnectionRequestOutcome, McpConnectionRequestProps };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { B as SpinnerIcon, T as McpIcon, o as CheckIcon, q as WarningIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
import { AgentAttention, AgentAttentionActions, AgentAttentionBody, AgentAttentionHeader } from "./AgentAttention.js";
|
|
5
|
+
import { getMcpServerEntry, getMcpServerRuntimeState } from "../utils/mcp-server-catalog.js";
|
|
6
|
+
import { DescriptionList } from "./DescriptionList.js";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { getToolPartState } from "@cloudflare/think/react";
|
|
10
|
+
//#region src/components/McpConnectionRequest.tsx
|
|
11
|
+
/**
|
|
12
|
+
* In-chat MCP connection request backed by the AI SDK tool part and Agents MCP
|
|
13
|
+
* state. Failed and interrupted connections deliberately restart through the
|
|
14
|
+
* same `onConnect` seam instead of introducing recovery operations.
|
|
15
|
+
*/
|
|
16
|
+
function McpConnectionRequest({ part, server, reason, mcp, outcome, onConnect, onDecline, className, ref, ...props }) {
|
|
17
|
+
const [action, setAction] = React.useState(null);
|
|
18
|
+
const connectedServer = getMcpServerEntry(server, mcp)?.[1];
|
|
19
|
+
const serverState = connectedServer ? getMcpServerRuntimeState(connectedServer) : void 0;
|
|
20
|
+
const pendingAction = action && "pending" in action ? action.pending : null;
|
|
21
|
+
const actionError = action && "error" in action ? action.error : null;
|
|
22
|
+
const toolState = part.state === "output-available" && part.preliminary === true ? "streaming" : getToolPartState(part);
|
|
23
|
+
const settled = toolState === "complete" || toolState === "error" || toolState === "denied";
|
|
24
|
+
const preparing = !settled && (toolState === "streaming" || toolState === "waiting-approval" || toolState === "approved");
|
|
25
|
+
const connecting = pendingAction === "connect" || serverState === "connecting" || serverState === "discovering" || serverState === "connected" && !connectedServer?.error;
|
|
26
|
+
const reconnect = Boolean(actionError) || serverState === "authenticating" || serverState === "failed" || serverState === "not-connected" || serverState === "connected" && Boolean(connectedServer?.error);
|
|
27
|
+
const connectionError = actionError ?? connectedServer?.error ?? (serverState === "failed" ? "Connection failed. Reconnect to try again." : void 0);
|
|
28
|
+
async function runAction(kind, callback) {
|
|
29
|
+
if (pendingAction) return;
|
|
30
|
+
setAction({ pending: kind });
|
|
31
|
+
try {
|
|
32
|
+
await callback();
|
|
33
|
+
setAction(null);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
setAction({ error: error instanceof Error ? error.message : String(error) });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (settled) {
|
|
39
|
+
const failed = toolState === "error" || outcome === "failed";
|
|
40
|
+
const declined = toolState === "denied" || outcome === "declined";
|
|
41
|
+
const error = toolState === "error" && part.state === "output-error" ? part.errorText : outcome === "failed" ? reason : void 0;
|
|
42
|
+
return /* @__PURE__ */ jsxs(AgentAttention, {
|
|
43
|
+
ref,
|
|
44
|
+
...props,
|
|
45
|
+
"aria-atomic": "true",
|
|
46
|
+
className: cx("mcp-connection-request", "mcp-connection-request--settled", className),
|
|
47
|
+
"data-state": failed ? "failed" : declined ? "declined" : "connected",
|
|
48
|
+
role: failed ? "alert" : "status",
|
|
49
|
+
tone: failed ? "warning" : "neutral",
|
|
50
|
+
children: [/* @__PURE__ */ jsx(AgentAttentionHeader, {
|
|
51
|
+
icon: failed ? /* @__PURE__ */ jsx(WarningIcon, {}) : outcome === "connected" ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(McpIcon, {}),
|
|
52
|
+
title: failed ? `Couldn’t connect ${server.name}` : declined ? `Skipped connecting ${server.name}` : outcome === "connected" ? `Connected to ${server.name}` : `Connection request completed for ${server.name}`
|
|
53
|
+
}), error ? /* @__PURE__ */ jsx(AgentAttentionBody, { children: /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "mcp-connection-request__error",
|
|
55
|
+
children: error
|
|
56
|
+
}) }) : null]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const ready = serverState === "ready";
|
|
60
|
+
const title = preparing ? "Preparing connection request" : connecting ? `Connecting ${server.name}` : ready ? `Connected to ${server.name}` : reconnect ? `Reconnect ${server.name}` : `Connect ${server.name}`;
|
|
61
|
+
const description = preparing ? "Reading assistant request" : connecting ? "Setting up connection" : ready ? "Connection is ready" : reconnect ? "The previous connection needs attention" : "Assistant requested access";
|
|
62
|
+
const connectLabel = pendingAction === "connect" ? "Connecting…" : ready ? "Continue" : reconnect ? `Reconnect ${server.name}` : `Connect ${server.name}`;
|
|
63
|
+
return /* @__PURE__ */ jsxs(AgentAttention, {
|
|
64
|
+
ref,
|
|
65
|
+
...props,
|
|
66
|
+
busy: preparing || connecting,
|
|
67
|
+
className: cx("mcp-connection-request", className),
|
|
68
|
+
"data-state": serverState ?? (preparing ? "preparing" : "idle"),
|
|
69
|
+
tone: connectionError ? "warning" : "neutral",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(AgentAttentionHeader, {
|
|
72
|
+
description,
|
|
73
|
+
icon: preparing || connecting ? /* @__PURE__ */ jsx(SpinnerIcon, {}) : ready ? /* @__PURE__ */ jsx(CheckIcon, {}) : reconnect ? /* @__PURE__ */ jsx(WarningIcon, {}) : /* @__PURE__ */ jsx(McpIcon, {}),
|
|
74
|
+
title
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ jsxs(AgentAttentionBody, {
|
|
77
|
+
className: "mcp-connection-request__body",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx("div", {
|
|
80
|
+
className: "mcp-connection-request__reason",
|
|
81
|
+
children: reason
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx(DescriptionList.Root, {
|
|
84
|
+
className: "mcp-connection-request__endpoint",
|
|
85
|
+
children: /* @__PURE__ */ jsxs(DescriptionList.Item, {
|
|
86
|
+
className: "mcp-connection-request__endpoint-item",
|
|
87
|
+
children: [/* @__PURE__ */ jsx(DescriptionList.Term, { children: "Server" }), /* @__PURE__ */ jsx(DescriptionList.Details, {
|
|
88
|
+
className: "mcp-connection-request__endpoint-details",
|
|
89
|
+
title: server.url,
|
|
90
|
+
children: server.url
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
connectionError ? /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "mcp-connection-request__error",
|
|
96
|
+
role: "alert",
|
|
97
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, {}), /* @__PURE__ */ jsx("span", { children: connectionError })]
|
|
98
|
+
}) : null
|
|
99
|
+
]
|
|
100
|
+
}),
|
|
101
|
+
onConnect || onDecline ? /* @__PURE__ */ jsxs(AgentAttentionActions, { children: [onConnect ? /* @__PURE__ */ jsx(Button, {
|
|
102
|
+
disabled: preparing || connecting || pendingAction !== null,
|
|
103
|
+
focusableWhenDisabled: preparing || connecting,
|
|
104
|
+
onClick: () => void runAction("connect", () => onConnect(server)),
|
|
105
|
+
size: "sm",
|
|
106
|
+
type: "button",
|
|
107
|
+
children: preparing ? "Preparing…" : connecting ? "Connecting…" : connectLabel
|
|
108
|
+
}) : null, onDecline ? /* @__PURE__ */ jsx(Button, {
|
|
109
|
+
color: "neutral",
|
|
110
|
+
disabled: preparing || pendingAction !== null,
|
|
111
|
+
focusableWhenDisabled: pendingAction === "decline",
|
|
112
|
+
onClick: () => void runAction("decline", onDecline),
|
|
113
|
+
size: "sm",
|
|
114
|
+
type: "button",
|
|
115
|
+
variant: "ghost",
|
|
116
|
+
children: pendingAction === "decline" ? "Skipping…" : "Not now"
|
|
117
|
+
}) : null] }) : null
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
export { McpConnectionRequest };
|
|
@@ -1,42 +1,57 @@
|
|
|
1
|
+
import { s as MenuItemProps, t as Menu } from "../Menu-Bgu-ufb5.js";
|
|
1
2
|
import { McpServerCard } from "../utils/mcp-server-catalog.js";
|
|
3
|
+
import { McpConnectorFormProps } from "./AgentConnection.js";
|
|
4
|
+
import { DialogProps } from "./Dialog.js";
|
|
2
5
|
import * as React from "react";
|
|
3
|
-
import {
|
|
6
|
+
import { MCPServersState } from "agents";
|
|
4
7
|
|
|
5
8
|
//#region src/components/McpServerPicker.d.ts
|
|
6
9
|
interface McpServerPickerProps {
|
|
7
10
|
/** MCP servers to show in the plus-menu picker. */
|
|
8
11
|
servers: readonly McpServerCard[];
|
|
9
|
-
/** Called
|
|
12
|
+
/** Called for a new or non-ready server. Hosts should replace stale entries before adding it. */
|
|
10
13
|
onConnect?: (server: McpServerCard) => void | Promise<void>;
|
|
11
14
|
/** Upstream Agents SDK MCP state from `getMcpServers()` or `useAgent({ onMcpUpdate })`. */
|
|
12
15
|
mcp?: MCPServersState;
|
|
13
|
-
/** Called when an
|
|
14
|
-
|
|
15
|
-
/** Called when a failed server should retry through an app-owned Agent RPC. */
|
|
16
|
-
onRetry?: McpServerConnectionAction;
|
|
17
|
-
/** Called when a ready/connected server should refresh discovery through an app-owned Agent RPC. */
|
|
18
|
-
onRefresh?: McpServerConnectionAction;
|
|
19
|
-
/** Called when an authenticating or connected server should be removed or disconnected. */
|
|
20
|
-
onDisconnect?: McpServerConnectionAction;
|
|
16
|
+
/** Called when an upstream server entry should be removed. */
|
|
17
|
+
onDisconnect?: (serverId: string) => void | Promise<void>;
|
|
21
18
|
/** Offset from the plus trigger to the menu, useful for prompt composers. */
|
|
22
19
|
sideOffset?: number;
|
|
23
20
|
/** Accessible name for the plus trigger. */
|
|
24
21
|
triggerLabel?: string;
|
|
25
22
|
}
|
|
26
|
-
type McpServerConnectionAction = (serverId: string, server: MCPServer) => void | Promise<void>;
|
|
27
23
|
type McpServerPickerItemsProps = Omit<McpServerPickerProps, "sideOffset" | "triggerLabel">;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
interface McpServerPickerGroupProps extends Omit<React.ComponentProps<typeof Menu.Group>, "children" | "label"> {
|
|
25
|
+
/** Quiet visible heading for a related set of picker actions. */
|
|
26
|
+
label: React.ReactNode;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
interface McpServerPickerActionProps extends Omit<MenuItemProps, "children" | "label"> {
|
|
30
|
+
icon?: React.ReactNode;
|
|
31
|
+
label: React.ReactNode;
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
interface McpServerSetupDialogProps extends Pick<McpConnectorFormProps, "defaults" | "onSubmit" | "redirectUrl" | "status"> {
|
|
35
|
+
/** Selected catalog entry. Passing null closes the dialog. */
|
|
36
|
+
server: McpServerCard | null;
|
|
37
|
+
/** Called when the user dismisses the dialog. */
|
|
38
|
+
onOpenChange: NonNullable<DialogProps["onOpenChange"]>;
|
|
39
|
+
}
|
|
40
|
+
/** Manual MCP setup surface driven by the same catalog metadata as the picker. */
|
|
41
|
+
declare function McpServerSetupDialog({
|
|
42
|
+
server,
|
|
43
|
+
defaults,
|
|
44
|
+
onOpenChange,
|
|
45
|
+
onSubmit,
|
|
46
|
+
redirectUrl,
|
|
47
|
+
status
|
|
48
|
+
}: McpServerSetupDialogProps): React.JSX.Element;
|
|
49
|
+
/** Prompt plus-menu picker for connecting and removing MCP servers. */
|
|
32
50
|
declare function McpServerPicker({
|
|
33
51
|
servers,
|
|
34
52
|
onConnect,
|
|
35
53
|
mcp,
|
|
36
|
-
onAuthorize,
|
|
37
54
|
onDisconnect,
|
|
38
|
-
onRefresh,
|
|
39
|
-
onRetry,
|
|
40
55
|
sideOffset,
|
|
41
56
|
triggerLabel
|
|
42
57
|
}: McpServerPickerProps): React.JSX.Element;
|
|
@@ -44,10 +59,20 @@ declare function McpServerPickerItems({
|
|
|
44
59
|
servers,
|
|
45
60
|
onConnect,
|
|
46
61
|
mcp,
|
|
47
|
-
|
|
48
|
-
onDisconnect,
|
|
49
|
-
onRefresh,
|
|
50
|
-
onRetry
|
|
62
|
+
onDisconnect
|
|
51
63
|
}: McpServerPickerItemsProps): React.JSX.Element;
|
|
64
|
+
declare function McpServerPickerGroup({
|
|
65
|
+
label,
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
...props
|
|
69
|
+
}: McpServerPickerGroupProps): React.JSX.Element;
|
|
70
|
+
declare function McpServerPickerAction({
|
|
71
|
+
icon,
|
|
72
|
+
label,
|
|
73
|
+
description,
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: McpServerPickerActionProps): React.JSX.Element;
|
|
52
77
|
//#endregion
|
|
53
|
-
export {
|
|
78
|
+
export { McpServerPicker, McpServerPickerAction, McpServerPickerActionProps, McpServerPickerGroup, McpServerPickerGroupProps, McpServerPickerItems, McpServerPickerItemsProps, McpServerPickerProps, McpServerSetupDialog, McpServerSetupDialogProps };
|