@mcp-b/react-components 0.14.2 → 0.16.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/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 +129 -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 +235 -0
- package/dist/styles/agent-attention.css +122 -0
- package/dist/styles/agent-chat.css +133 -4
- package/dist/styles/app-frame.css +15 -0
- package/dist/styles/app-top-bar.css +100 -0
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/browser-control-overlay.css +184 -0
- package/dist/styles/card.css +21 -0
- package/dist/styles/checkbox-group.css +69 -0
- package/dist/styles/description-list.css +50 -0
- package/dist/styles/fieldset.css +11 -0
- package/dist/styles/index.css +14 -2
- package/dist/styles/mcp-connection-request.css +60 -0
- package/dist/styles/mcp-server-picker.css +95 -68
- package/dist/styles/message.css +4 -43
- 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 +23 -15
- package/dist/styles/resizable-side-panel.css +66 -0
- package/dist/styles/responsive-sidebar-shell.css +169 -0
- package/dist/styles/select.css +10 -0
- package/dist/styles/stepper.css +13 -0
- package/dist/styles/streamdown.css +0 -4
- package/dist/styles/subagent-run.css +55 -38
- 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 +8 -72
- package/dist/styles/think-full-app.css +104 -131
- package/dist/styles/think-routine-library.css +491 -0
- package/dist/styles/think-thread-picker.css +47 -3
- package/dist/styles/toggle-group.css +7 -0
- package/dist/styles/workspace-explorer.css +511 -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
|
@@ -1,227 +1,276 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import { B as SpinnerIcon, O as MinusIcon, o as CheckIcon, q as WarningIcon } from "../icons-CpfUer49.js";
|
|
3
|
+
import { buttonVariants } from "./Button.js";
|
|
4
|
+
import { Dialog } from "./Dialog.js";
|
|
2
5
|
import { Menu } from "./Menu.js";
|
|
3
|
-
import { PromptInputActionMenuTrigger } from "./PromptInput.js";
|
|
4
|
-
import { getMcpServerIconSrc } from "../utils/mcp-server-catalog.js";
|
|
6
|
+
import { PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuTrigger } from "./PromptInput.js";
|
|
7
|
+
import { getMcpServerEntry, getMcpServerIconSrc, getMcpServerRuntimeState } from "../utils/mcp-server-catalog.js";
|
|
8
|
+
import { McpConnectorForm } from "./AgentConnection.js";
|
|
9
|
+
import { Avatar } from "./Avatar.js";
|
|
5
10
|
import * as React from "react";
|
|
6
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
12
|
//#region src/components/McpServerPicker.tsx
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
/** Manual MCP setup surface driven by the same catalog metadata as the picker. */
|
|
14
|
+
function McpServerSetupDialog({ server, defaults, onOpenChange, onSubmit, redirectUrl, status }) {
|
|
15
|
+
const formDefaults = server ? {
|
|
16
|
+
...defaults,
|
|
17
|
+
name: server.id,
|
|
18
|
+
url: server.url
|
|
19
|
+
} : defaults;
|
|
20
|
+
function handleSubmit(values) {
|
|
21
|
+
if (!server?.url) return onSubmit(values);
|
|
22
|
+
return onSubmit({
|
|
23
|
+
...values,
|
|
24
|
+
name: server.id,
|
|
25
|
+
url: server.url
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
29
|
+
open: server !== null,
|
|
30
|
+
onOpenChange,
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Viewport, { children: /* @__PURE__ */ jsxs(Dialog.Popup, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(Dialog.Header, { children: [/* @__PURE__ */ jsx(Dialog.Title, { children: server ? `${server.name} MCP` : "MCP connectors" }), /* @__PURE__ */ jsx(Dialog.Description, { children: server?.manualSetup?.description ?? "Connect a remote MCP server the model can call." })] }),
|
|
33
|
+
server?.manualSetup?.links.length ? /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "mcp-server-setup-dialog__links",
|
|
35
|
+
children: server.manualSetup.links.map((link) => /* @__PURE__ */ jsx("a", {
|
|
36
|
+
className: buttonVariants({
|
|
37
|
+
size: "sm",
|
|
38
|
+
variant: "link"
|
|
39
|
+
}),
|
|
40
|
+
href: link.url,
|
|
41
|
+
rel: "noreferrer",
|
|
42
|
+
target: "_blank",
|
|
43
|
+
children: link.label
|
|
44
|
+
}, link.url))
|
|
45
|
+
}) : null,
|
|
46
|
+
/* @__PURE__ */ jsx(McpConnectorForm, {
|
|
47
|
+
auth: server?.manualSetup?.auth,
|
|
48
|
+
defaults: formDefaults,
|
|
49
|
+
readOnlyServer: Boolean(server?.url),
|
|
50
|
+
redirectUrl,
|
|
51
|
+
status,
|
|
52
|
+
onSubmit: handleSubmit
|
|
53
|
+
}, server?.id ?? "custom"),
|
|
54
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { children: /* @__PURE__ */ jsx(Dialog.Close, { children: "Close" }) })
|
|
55
|
+
] }) })] })
|
|
38
56
|
});
|
|
39
57
|
}
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
/** Prompt plus-menu picker for connecting and removing MCP servers. */
|
|
59
|
+
function McpServerPicker({ servers, onConnect, mcp, onDisconnect, sideOffset = 12, triggerLabel = "Add server" }) {
|
|
60
|
+
return /* @__PURE__ */ jsxs(PromptInputActionMenu, { children: [/* @__PURE__ */ jsx(PromptInputActionMenuTrigger, { "aria-label": triggerLabel }), /* @__PURE__ */ jsx(PromptInputActionMenuContent, {
|
|
61
|
+
tabIndex: -1,
|
|
62
|
+
"aria-label": "Servers",
|
|
63
|
+
align: "start",
|
|
64
|
+
className: "mcp-server-picker__popup",
|
|
65
|
+
collisionPadding: 8,
|
|
66
|
+
side: "top",
|
|
67
|
+
sideOffset,
|
|
68
|
+
children: /* @__PURE__ */ jsx(McpServerPickerItems, {
|
|
69
|
+
servers,
|
|
70
|
+
onConnect,
|
|
71
|
+
mcp,
|
|
72
|
+
onDisconnect
|
|
73
|
+
})
|
|
74
|
+
})] });
|
|
75
|
+
}
|
|
76
|
+
function McpServerPickerItems({ servers, onConnect, mcp, onDisconnect }) {
|
|
77
|
+
const [action, setAction] = React.useState(null);
|
|
42
78
|
const rows = getPickerRows(servers, mcp);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
79
|
+
const pendingAction = action && "pending" in action ? action.pending : null;
|
|
80
|
+
const actionError = action && "error" in action ? action.error : null;
|
|
81
|
+
async function runAction(key, callback) {
|
|
82
|
+
if (pendingAction) return;
|
|
83
|
+
setAction({ pending: key });
|
|
46
84
|
try {
|
|
47
|
-
await
|
|
48
|
-
|
|
49
|
-
|
|
85
|
+
await callback();
|
|
86
|
+
setAction(null);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
setAction({ error: error instanceof Error ? error.message : String(error) });
|
|
50
89
|
}
|
|
51
90
|
}
|
|
52
|
-
|
|
91
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [actionError ? /* @__PURE__ */ jsxs(Menu.Item, {
|
|
92
|
+
"aria-atomic": "true",
|
|
93
|
+
"aria-live": "polite",
|
|
94
|
+
className: "mcp-server-picker__action-error",
|
|
95
|
+
closeOnClick: false,
|
|
96
|
+
disabled: true,
|
|
97
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { size: 14 }), /* @__PURE__ */ jsx("span", { children: actionError })]
|
|
98
|
+
}) : null, rows.length === 0 ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
53
99
|
disabled: true,
|
|
54
100
|
className: "mcp-server-picker__empty",
|
|
55
101
|
children: "No servers available."
|
|
102
|
+
}) : groupPickerRows(rows).map(([label, groupRows]) => /* @__PURE__ */ jsx(McpServerPickerGroup, {
|
|
103
|
+
label,
|
|
104
|
+
children: groupRows.map((row) => /* @__PURE__ */ jsx(McpServerPickerRow, {
|
|
105
|
+
pendingAction,
|
|
106
|
+
row,
|
|
107
|
+
onConnect: onConnect ? (server) => runAction(`connect:${server.id}:${server.url}`, () => onConnect(server)) : void 0,
|
|
108
|
+
onDisconnect: onDisconnect ? (id) => runAction(`disconnect:${id}`, () => onDisconnect(id)) : void 0
|
|
109
|
+
}, `${row.server.id}:${row.server.url}`))
|
|
110
|
+
}, label))] });
|
|
111
|
+
}
|
|
112
|
+
function McpServerPickerGroup({ label, children, className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ jsxs(Menu.Group, {
|
|
114
|
+
className: cx("mcp-server-picker__group", className),
|
|
115
|
+
...props,
|
|
116
|
+
children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
117
|
+
className: "mcp-server-picker__group-label",
|
|
118
|
+
children: label
|
|
119
|
+
}), children]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function McpServerPickerAction({ icon, label, description, className, ...props }) {
|
|
123
|
+
return /* @__PURE__ */ jsxs(Menu.Item, {
|
|
124
|
+
className: cx("mcp-server-picker__row", "mcp-server-picker__custom-action", className),
|
|
125
|
+
...props,
|
|
126
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
127
|
+
className: "mcp-server-picker__icon",
|
|
128
|
+
children: icon
|
|
129
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
130
|
+
className: "mcp-server-picker__copy",
|
|
131
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
132
|
+
className: "mcp-server-picker__name",
|
|
133
|
+
children: label
|
|
134
|
+
}), description ? /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: "mcp-server-picker__description",
|
|
136
|
+
children: description
|
|
137
|
+
}) : null]
|
|
138
|
+
})]
|
|
56
139
|
});
|
|
57
|
-
return /* @__PURE__ */ jsx(Fragment, { children: rows.map((server) => /* @__PURE__ */ jsx(McpServerPickerRow, {
|
|
58
|
-
mcp,
|
|
59
|
-
pendingAction,
|
|
60
|
-
server,
|
|
61
|
-
onAuthorize: (id, entry) => void runAction("authorize", id, entry, onAuthorize),
|
|
62
|
-
onConnect,
|
|
63
|
-
onDisconnect: (id, entry) => void runAction("disconnect", id, entry, onDisconnect),
|
|
64
|
-
onRefresh: (id, entry) => void runAction("refresh", id, entry, onRefresh),
|
|
65
|
-
onRetry: (id, entry) => void runAction("retry", id, entry, onRetry)
|
|
66
|
-
}, server.id)) });
|
|
67
140
|
}
|
|
68
|
-
function McpServerPickerRow({
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
141
|
+
function McpServerPickerRow({ row, onConnect, onDisconnect, pendingAction }) {
|
|
142
|
+
const { entry, server } = row;
|
|
143
|
+
const connectedServerId = entry?.[0];
|
|
144
|
+
const connectedServer = entry?.[1];
|
|
145
|
+
const state = connectedServer ? getMcpServerRuntimeState(connectedServer) : void 0;
|
|
146
|
+
const connectKey = `connect:${server.id}:${server.url}`;
|
|
147
|
+
const connecting = state === "connecting" || state === "discovering" || state === "connected" && !connectedServer?.error;
|
|
148
|
+
const reconnectable = state === "authenticating" || state === "failed" || state === "not-connected" || state === "connected" && Boolean(connectedServer?.error);
|
|
149
|
+
const pendingConnect = pendingAction === connectKey;
|
|
150
|
+
const statusText = pendingConnect ? "Connecting" : getStatusLabel(state, connectedServer?.error);
|
|
151
|
+
const disabled = !onConnect || !(!connectedServer || reconnectable) || connecting || state === "ready" || pendingAction !== null;
|
|
152
|
+
const description = connectedServer?.error || server.description;
|
|
153
|
+
const disconnectPending = pendingAction === `disconnect:${connectedServerId}`;
|
|
154
|
+
let disconnectLabel = state === "ready" ? `Disconnect ${server.name}` : `Remove ${server.name}`;
|
|
155
|
+
if (disconnectPending) disconnectLabel = state === "ready" ? `Disconnecting ${server.name}` : `Removing ${server.name}`;
|
|
80
156
|
return /* @__PURE__ */ jsxs("div", {
|
|
81
157
|
className: "mcp-server-picker__row-shell",
|
|
82
|
-
"data-
|
|
83
|
-
"data-status":
|
|
158
|
+
"data-error": connectedServer?.error ? "" : void 0,
|
|
159
|
+
"data-status": state,
|
|
84
160
|
children: [/* @__PURE__ */ jsxs(Menu.Item, {
|
|
161
|
+
"aria-busy": connecting || pendingConnect || void 0,
|
|
85
162
|
className: "mcp-server-picker__row",
|
|
86
163
|
closeOnClick: false,
|
|
87
|
-
"data-status":
|
|
164
|
+
"data-status": state,
|
|
88
165
|
disabled,
|
|
89
|
-
"aria-busy": busy || void 0,
|
|
90
|
-
"aria-describedby": server.description ? descriptionId : void 0,
|
|
91
166
|
onClick: disabled ? void 0 : () => void onConnect(server),
|
|
92
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
93
|
-
className: "mcp-server-picker__icon",
|
|
94
|
-
children: renderIcon(server)
|
|
95
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
96
|
-
className: "mcp-server-picker__copy",
|
|
97
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
98
|
-
className: "mcp-server-picker__name",
|
|
99
|
-
children: server.name
|
|
100
|
-
}), server.description ? /* @__PURE__ */ jsx("span", {
|
|
101
|
-
id: descriptionId,
|
|
102
|
-
className: "mcp-server-picker__description",
|
|
103
|
-
children: server.description
|
|
104
|
-
}) : null]
|
|
105
|
-
})]
|
|
106
|
-
}), hasStatusIcon || connectedServer ? /* @__PURE__ */ jsxs("div", {
|
|
107
|
-
className: "mcp-server-picker__row-actions",
|
|
108
167
|
children: [
|
|
109
|
-
|
|
110
|
-
className: "mcp-server-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
label: pending("disconnect") ? `Cancelling ${server.name} authentication` : `Cancel ${server.name} authentication`,
|
|
127
|
-
onClick: () => onDisconnect(connectedServerId, connectedServer)
|
|
128
|
-
}) : null,
|
|
129
|
-
connectedServer?.state === "failed" && connectedServerId && onRetry ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
130
|
-
disabled: pending("retry"),
|
|
131
|
-
icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
132
|
-
label: pending("retry") ? `Retrying ${server.name}` : `Retry ${server.name}`,
|
|
133
|
-
onClick: () => onRetry(connectedServerId, connectedServer)
|
|
134
|
-
}) : null,
|
|
135
|
-
(connectedServer?.state === "ready" || connectedServer?.state === "connected") && connectedServerId && onRefresh ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
136
|
-
disabled: pending("refresh"),
|
|
137
|
-
icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
138
|
-
label: pending("refresh") ? `Reconnecting ${server.name}` : `Reconnect ${server.name}`,
|
|
139
|
-
onClick: () => onRefresh(connectedServerId, connectedServer)
|
|
140
|
-
}) : null,
|
|
141
|
-
(connectedServer?.state === "ready" || connectedServer?.state === "connected") && connectedServerId && onDisconnect ? /* @__PURE__ */ jsx(McpServerActionItem, {
|
|
142
|
-
disabled: pending("disconnect"),
|
|
143
|
-
icon: /* @__PURE__ */ jsx(MinusIcon, {}),
|
|
144
|
-
label: pending("disconnect") ? `Disconnecting ${server.name}` : `Disconnect ${server.name}`,
|
|
145
|
-
onClick: () => onDisconnect(connectedServerId, connectedServer)
|
|
168
|
+
/* @__PURE__ */ jsx("span", {
|
|
169
|
+
className: "mcp-server-picker__icon",
|
|
170
|
+
children: /* @__PURE__ */ jsx(McpServerIcon, { server })
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsxs("span", {
|
|
173
|
+
className: "mcp-server-picker__copy",
|
|
174
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
175
|
+
className: "mcp-server-picker__name",
|
|
176
|
+
children: server.name
|
|
177
|
+
}), description ? /* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: "mcp-server-picker__description",
|
|
179
|
+
children: description
|
|
180
|
+
}) : null]
|
|
181
|
+
}),
|
|
182
|
+
statusText ? /* @__PURE__ */ jsx("span", {
|
|
183
|
+
className: "mcp-server-picker__row-state",
|
|
184
|
+
children: statusText
|
|
146
185
|
}) : null
|
|
147
186
|
]
|
|
187
|
+
}), connectedServer ? /* @__PURE__ */ jsxs("div", {
|
|
188
|
+
className: "mcp-server-picker__row-actions",
|
|
189
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
className: "mcp-server-picker__row-status",
|
|
192
|
+
title: statusText,
|
|
193
|
+
children: /* @__PURE__ */ jsx(StatusIcon, {
|
|
194
|
+
error: connectedServer.error,
|
|
195
|
+
pending: pendingConnect,
|
|
196
|
+
state
|
|
197
|
+
})
|
|
198
|
+
}), connectedServerId && onDisconnect ? /* @__PURE__ */ jsxs(Menu.Item, {
|
|
199
|
+
className: "mcp-server-picker__action",
|
|
200
|
+
closeOnClick: false,
|
|
201
|
+
disabled: pendingAction !== null,
|
|
202
|
+
onClick: pendingAction !== null ? void 0 : () => void onDisconnect(connectedServerId),
|
|
203
|
+
title: disconnectLabel,
|
|
204
|
+
children: [/* @__PURE__ */ jsx(MinusIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
205
|
+
className: "mcp-server-picker__status-label",
|
|
206
|
+
children: disconnectLabel
|
|
207
|
+
})]
|
|
208
|
+
}) : null]
|
|
148
209
|
}) : null]
|
|
149
210
|
});
|
|
150
211
|
}
|
|
151
|
-
function
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
disabled,
|
|
156
|
-
onClick: disabled ? void 0 : () => void onClick(),
|
|
157
|
-
children: [icon, /* @__PURE__ */ jsx("span", {
|
|
158
|
-
className: "mcp-server-picker__status-label",
|
|
159
|
-
children: label
|
|
160
|
-
})]
|
|
161
|
-
});
|
|
212
|
+
function StatusIcon({ error, pending, state }) {
|
|
213
|
+
if (pending || state === "connecting" || state === "discovering" || state === "connected" && !error) return /* @__PURE__ */ jsx(SpinnerIcon, { size: 14 });
|
|
214
|
+
if (state === "ready") return /* @__PURE__ */ jsx(CheckIcon, { size: 14 });
|
|
215
|
+
return /* @__PURE__ */ jsx(WarningIcon, { size: 14 });
|
|
162
216
|
}
|
|
163
|
-
function
|
|
164
|
-
if (
|
|
165
|
-
if (
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
size: 14
|
|
169
|
-
});
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
function getStatusLabel(status) {
|
|
173
|
-
if (status === "ready") return "Connected";
|
|
174
|
-
if (status === "connected") return "Connected";
|
|
175
|
-
if (status === "failed") return "Failed";
|
|
176
|
-
if (status === "needs-auth") return "Authorize";
|
|
177
|
-
if (status === "authenticating") return "Authenticating";
|
|
178
|
-
if (status === "connecting") return "Connecting";
|
|
179
|
-
if (status === "discovering") return "Discovering";
|
|
217
|
+
function getStatusLabel(state, error) {
|
|
218
|
+
if (state === "ready") return "Connected";
|
|
219
|
+
if (state === "connecting" || state === "discovering" || state === "connected" && !error) return "Connecting";
|
|
220
|
+
if (state === "authenticating") return "Reconnect to sign in";
|
|
221
|
+
if (state === "connected" || state === "failed" || state === "not-connected") return "Reconnect";
|
|
180
222
|
return "";
|
|
181
223
|
}
|
|
182
|
-
function getConnectedServerEntry(card, mcp) {
|
|
183
|
-
if (!mcp) return void 0;
|
|
184
|
-
return Object.entries(mcp.servers).find(([serverId, entry]) => serverId === card.id || entry.server_url === card.url);
|
|
185
|
-
}
|
|
186
224
|
function getPickerRows(servers, mcp) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
name: entry.name,
|
|
191
|
-
url: entry.server_url
|
|
225
|
+
const catalogRows = servers.map((server) => ({
|
|
226
|
+
server,
|
|
227
|
+
entry: getMcpServerEntry(server, mcp)
|
|
192
228
|
}));
|
|
193
|
-
return
|
|
229
|
+
if (!mcp) return catalogRows;
|
|
230
|
+
const resolvedServerIds = new Set(catalogRows.flatMap((row) => row.entry ? [row.entry[0]] : []));
|
|
231
|
+
const upstreamRows = Object.entries(mcp.servers).filter(([serverId]) => !resolvedServerIds.has(serverId)).map(([serverId, entry]) => ({
|
|
232
|
+
entry: [serverId, entry],
|
|
233
|
+
server: {
|
|
234
|
+
id: serverId,
|
|
235
|
+
name: entry.name,
|
|
236
|
+
url: entry.server_url
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
return [...catalogRows, ...upstreamRows];
|
|
194
240
|
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
241
|
+
function groupPickerRows(rows) {
|
|
242
|
+
const groups = /* @__PURE__ */ new Map();
|
|
243
|
+
for (const row of rows) {
|
|
244
|
+
const key = (row.entry ? getMcpServerRuntimeState(row.entry[1]) : void 0) === "ready" ? "Connected" : row.server.category === "Auto" ? "MCP connectors" : row.server.category === "Manual" ? "Manual setup" : row.server.category ?? "Other";
|
|
245
|
+
const group = groups.get(key) ?? [];
|
|
246
|
+
group.push(row);
|
|
247
|
+
groups.set(key, group);
|
|
248
|
+
}
|
|
249
|
+
const order = [
|
|
250
|
+
"Connected",
|
|
251
|
+
"MCP connectors",
|
|
252
|
+
"Manual setup",
|
|
253
|
+
"Other"
|
|
254
|
+
];
|
|
255
|
+
return [...groups.entries()].sort(([left], [right]) => (order.indexOf(left) === -1 ? order.length : order.indexOf(left)) - (order.indexOf(right) === -1 ? order.length : order.indexOf(right)));
|
|
205
256
|
}
|
|
206
|
-
function
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
referrerPolicy: "no-referrer",
|
|
223
|
-
onError: () => setFailed(true)
|
|
257
|
+
function McpServerIcon({ server }) {
|
|
258
|
+
const src = getMcpServerIconSrc(server);
|
|
259
|
+
return /* @__PURE__ */ jsxs(Avatar.Root, {
|
|
260
|
+
className: "mcp-server-picker__avatar",
|
|
261
|
+
"aria-hidden": "true",
|
|
262
|
+
children: [src ? /* @__PURE__ */ jsx(Avatar.Image, {
|
|
263
|
+
alt: "",
|
|
264
|
+
className: "mcp-server-picker__avatar-image",
|
|
265
|
+
decoding: "async",
|
|
266
|
+
loading: "lazy",
|
|
267
|
+
referrerPolicy: "no-referrer",
|
|
268
|
+
src
|
|
269
|
+
}, src) : null, /* @__PURE__ */ jsx(Avatar.Fallback, {
|
|
270
|
+
className: "mcp-server-picker__avatar-fallback",
|
|
271
|
+
children: server.name.slice(0, 1)
|
|
272
|
+
})]
|
|
224
273
|
});
|
|
225
274
|
}
|
|
226
275
|
//#endregion
|
|
227
|
-
export { McpServerPicker, McpServerPickerItems };
|
|
276
|
+
export { McpServerPicker, McpServerPickerAction, McpServerPickerGroup, McpServerPickerItems, McpServerSetupDialog };
|
|
@@ -59,6 +59,7 @@ type MessageResponseProps = StreamdownProps;
|
|
|
59
59
|
declare const MessageResponse: React.MemoExoticComponent<({
|
|
60
60
|
className,
|
|
61
61
|
components,
|
|
62
|
+
rehypePlugins,
|
|
62
63
|
...props
|
|
63
64
|
}: MessageResponseProps) => React.JSX.Element>;
|
|
64
65
|
interface MessageAttachmentProps extends Omit<React.HTMLAttributes<HTMLElement>, "color" | "part"> {
|