@mcp-b/react-components 0.14.1 → 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-Cgb1xuT7.d.ts → AgentChat-CrlpbvQJ.d.ts} +62 -8
- 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-DVgVBdvw.js → ModelSelector-SlJNgwKY.js} +17 -8
- 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-7DQ2CogF.js → ThinkChat-CzC-zNGA.js} +27 -37
- package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BFQnb2ct.d.ts} +3 -10
- package/dist/ThinkChatActivitySummary-BPmu9a-c.d.ts +39 -0
- package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CSzVwMXf.d.ts} +62 -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 +231 -205
- 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.d.ts +15 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NaniteScene.d.ts +10 -1
- package/dist/components/NaniteScene.js +36 -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 +86 -0
- package/dist/components/SubagentRun.js +108 -0
- package/dist/components/SubagentRunDetails.d.ts +44 -0
- package/dist/components/SubagentRunDetails.js +48 -0
- 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 +34 -7
- package/dist/components/ThinkChat.js +7 -4
- package/dist/components/ThinkChatActivity.d.ts +3 -2
- package/dist/components/ThinkChatActivity.js +18 -297
- package/dist/components/ThinkChatActivitySummary.d.ts +2 -0
- package/dist/components/ThinkChatActivitySummary.js +421 -0
- package/dist/components/ThinkChatToolPanels.d.ts +15 -5
- package/dist/components/ThinkChatToolPanels.js +116 -9
- package/dist/components/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/ThinkChatToolParts.js +51 -9
- 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 +141 -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 +15 -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/nanite-scene.css +16 -0
- 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 +205 -0
- 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 +106 -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/codex-model-catalog.d.ts +4 -4
- 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,92 @@
|
|
|
1
|
+
import { Button } from "./Button.js";
|
|
2
|
+
import { Field } from "./Field.js";
|
|
3
|
+
import { Form } from "./Form.js";
|
|
4
|
+
import { Textarea } from "./Textarea.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/AgentChatMessageEditor.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Edit-and-resend form for a chat message. It composes the shared Base UI
|
|
10
|
+
* Form/Field wrappers and Textarea recipe so validation, labels, focus, and
|
|
11
|
+
* disabled states stay owned by the design-system primitives.
|
|
12
|
+
*/
|
|
13
|
+
function AgentChatMessageEditor({ message, originalText, onCancel, onSubmit, onSuccess }) {
|
|
14
|
+
const [draft, setDraft] = React.useState(originalText);
|
|
15
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
16
|
+
const [error, setError] = React.useState();
|
|
17
|
+
const textareaRef = React.useRef(null);
|
|
18
|
+
const trimmedDraft = draft.trim();
|
|
19
|
+
const canSubmit = !isSubmitting && Boolean(trimmedDraft) && trimmedDraft !== originalText.trim();
|
|
20
|
+
React.useLayoutEffect(() => {
|
|
21
|
+
textareaRef.current?.focus();
|
|
22
|
+
const end = textareaRef.current?.value.length ?? 0;
|
|
23
|
+
textareaRef.current?.setSelectionRange(end, end);
|
|
24
|
+
}, []);
|
|
25
|
+
const handleSubmit = async (event) => {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
if (!canSubmit) return;
|
|
28
|
+
setError(void 0);
|
|
29
|
+
setIsSubmitting(true);
|
|
30
|
+
try {
|
|
31
|
+
await onSubmit({
|
|
32
|
+
message,
|
|
33
|
+
text: trimmedDraft
|
|
34
|
+
});
|
|
35
|
+
onSuccess?.();
|
|
36
|
+
} catch {
|
|
37
|
+
setError("Message wasn’t resent. Try again.");
|
|
38
|
+
setIsSubmitting(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs(Form, {
|
|
42
|
+
className: "message__edit-form",
|
|
43
|
+
"data-slot": "agent-chat-message-editor",
|
|
44
|
+
"aria-busy": isSubmitting,
|
|
45
|
+
onSubmit: (event) => void handleSubmit(event),
|
|
46
|
+
children: [/* @__PURE__ */ jsxs(Field.Root, {
|
|
47
|
+
name: "message",
|
|
48
|
+
invalid: Boolean(error),
|
|
49
|
+
disabled: isSubmitting,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Edit message" }),
|
|
52
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
53
|
+
render: /* @__PURE__ */ jsx(Textarea, {
|
|
54
|
+
ref: textareaRef,
|
|
55
|
+
className: "message__edit-textarea",
|
|
56
|
+
rows: 3
|
|
57
|
+
}),
|
|
58
|
+
value: draft,
|
|
59
|
+
onChange: (event) => {
|
|
60
|
+
setDraft(event.currentTarget.value);
|
|
61
|
+
if (error) setError(void 0);
|
|
62
|
+
},
|
|
63
|
+
onKeyDown: (event) => {
|
|
64
|
+
if (event.key !== "Escape" || isSubmitting) return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
onCancel();
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
error ? /* @__PURE__ */ jsx(Field.Error, { errors: [error] }) : null
|
|
70
|
+
]
|
|
71
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "message__edit-actions",
|
|
73
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
74
|
+
type: "button",
|
|
75
|
+
variant: "outline",
|
|
76
|
+
color: "neutral",
|
|
77
|
+
size: "lg",
|
|
78
|
+
disabled: isSubmitting,
|
|
79
|
+
onClick: onCancel,
|
|
80
|
+
children: "Cancel"
|
|
81
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
82
|
+
type: "submit",
|
|
83
|
+
color: "primary",
|
|
84
|
+
size: "lg",
|
|
85
|
+
disabled: !canSubmit,
|
|
86
|
+
children: isSubmitting ? "Resending…" : "Send"
|
|
87
|
+
})]
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { AgentChatMessageEditor };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/components/AgentChatTurnError.d.ts
|
|
2
|
+
interface AgentChatTurnErrorProps {
|
|
3
|
+
error: Error;
|
|
4
|
+
onDismiss: () => void;
|
|
5
|
+
onRetry?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Recoverable turn failure for AgentChat-compatible surfaces. The message and
|
|
9
|
+
* actions remain one status unit while Button owns all interaction styling.
|
|
10
|
+
*/
|
|
11
|
+
declare function AgentChatTurnError({
|
|
12
|
+
error,
|
|
13
|
+
onDismiss,
|
|
14
|
+
onRetry
|
|
15
|
+
}: AgentChatTurnErrorProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { AgentChatTurnError, AgentChatTurnErrorProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Button } from "./Button.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/AgentChatTurnError.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Recoverable turn failure for AgentChat-compatible surfaces. The message and
|
|
6
|
+
* actions remain one status unit while Button owns all interaction styling.
|
|
7
|
+
*/
|
|
8
|
+
function AgentChatTurnError({ error, onDismiss, onRetry }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
10
|
+
className: "agent-chat__turn-error",
|
|
11
|
+
"data-slot": "agent-chat-turn-error",
|
|
12
|
+
"data-tone": "danger",
|
|
13
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
14
|
+
className: "agent-chat__turn-error-message",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("strong", { children: "Response failed." }),
|
|
17
|
+
" ",
|
|
18
|
+
error.message.trim() || "The response could not be completed."
|
|
19
|
+
]
|
|
20
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "agent-chat__turn-error-actions",
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
23
|
+
type: "button",
|
|
24
|
+
variant: "ghost",
|
|
25
|
+
color: "neutral",
|
|
26
|
+
size: "lg",
|
|
27
|
+
onClick: onDismiss,
|
|
28
|
+
children: "Dismiss"
|
|
29
|
+
}), onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
30
|
+
type: "button",
|
|
31
|
+
color: "primary",
|
|
32
|
+
size: "lg",
|
|
33
|
+
onClick: onRetry,
|
|
34
|
+
children: "Try again"
|
|
35
|
+
}) : null]
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { AgentChatTurnError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpServerSetupAuth } from "../utils/mcp-server-catalog.js";
|
|
1
|
+
import { McpServerSetupAuth, McpServerSetupAuthFieldName } from "../utils/mcp-server-catalog.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/AgentConnection.d.ts
|
|
@@ -19,6 +19,7 @@ type ConnectionProps = React.SVGProps<SVGGElement> & {
|
|
|
19
19
|
type NanitesAgentConnectionOptions = {
|
|
20
20
|
readonly mcpName?: string;
|
|
21
21
|
readonly pluginMarketplace?: string;
|
|
22
|
+
readonly codexPluginRef?: string;
|
|
22
23
|
readonly claudePluginRef?: string;
|
|
23
24
|
readonly skillName?: string;
|
|
24
25
|
};
|
|
@@ -33,25 +34,20 @@ type AgentConnectionPanelProps = {
|
|
|
33
34
|
type AgentConnectionPopoverProps = Omit<AgentConnectionPanelProps, "section"> & {
|
|
34
35
|
readonly className?: string;
|
|
35
36
|
};
|
|
36
|
-
type
|
|
37
|
-
|
|
38
|
-
readonly clientId?: string;
|
|
39
|
-
readonly clientSecret?: string;
|
|
37
|
+
type CredentialFieldName = Exclude<McpServerSetupAuthFieldName, "redirectUrl">;
|
|
38
|
+
type McpConnectorFormValues = Readonly<Partial<Record<CredentialFieldName, string>> & {
|
|
40
39
|
readonly name: string;
|
|
41
|
-
readonly scope?: string;
|
|
42
40
|
readonly url: string;
|
|
43
|
-
}
|
|
41
|
+
}>;
|
|
44
42
|
type McpConnectorFormProps = Omit<React.FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "status"> & {
|
|
45
|
-
/** Authentication metadata that decides which credential fields render. */readonly auth?: McpServerSetupAuth; /**
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly pendingAuthUrl?: string | null; /** Read-only redirect URL shown for manual OAuth client setup. */
|
|
43
|
+
/** Authentication metadata that decides which credential fields render. */readonly auth?: McpServerSetupAuth; /** Initial connector values. Publisher client credentials remain app-owned. */
|
|
44
|
+
readonly defaults?: Partial<McpConnectorFormValues>; /** Optional pattern used to validate the MCP name field. */
|
|
45
|
+
readonly namePattern?: string; /** Keep a catalog-owned MCP name and URL visible but immutable. */
|
|
46
|
+
readonly readOnlyServer?: boolean; /** Read-only redirect URL shown for manual OAuth client setup. */
|
|
50
47
|
readonly redirectUrl?: string; /** Inline connection status announced politely to assistive tech. */
|
|
51
48
|
readonly status?: React.ReactNode; /** Label for the submit button. */
|
|
52
49
|
readonly submitLabel?: string; /** Label shown while submit is pending. */
|
|
53
|
-
readonly submittingLabel?: string; /** Called
|
|
54
|
-
readonly onAuthorize?: () => void | Promise<void>; /** Called with normalized connector values after native form validation passes. */
|
|
50
|
+
readonly submittingLabel?: string; /** Called with normalized connector values after native form validation passes. */
|
|
55
51
|
readonly onSubmit: (values: McpConnectorFormValues) => void | Promise<void>;
|
|
56
52
|
};
|
|
57
53
|
declare function Connection({
|
|
@@ -64,6 +60,7 @@ declare function Connection({
|
|
|
64
60
|
declare function buildNanitesAgentConnectionCommands(origin: string, {
|
|
65
61
|
mcpName,
|
|
66
62
|
pluginMarketplace,
|
|
63
|
+
codexPluginRef,
|
|
67
64
|
claudePluginRef,
|
|
68
65
|
skillName
|
|
69
66
|
}?: NanitesAgentConnectionOptions): readonly AgentConnectionCommand[];
|
|
@@ -83,16 +80,14 @@ declare function AgentConnectionPanel({
|
|
|
83
80
|
/** Collects MCP connector settings and optional credentials with native form validation. */
|
|
84
81
|
declare function McpConnectorForm({
|
|
85
82
|
auth,
|
|
86
|
-
authorizeLabel,
|
|
87
83
|
className,
|
|
88
84
|
defaults,
|
|
89
85
|
namePattern,
|
|
90
|
-
|
|
86
|
+
readOnlyServer,
|
|
91
87
|
redirectUrl,
|
|
92
88
|
status,
|
|
93
89
|
submitLabel,
|
|
94
90
|
submittingLabel,
|
|
95
|
-
onAuthorize,
|
|
96
91
|
onSubmit,
|
|
97
92
|
ref,
|
|
98
93
|
...props
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Popover } from "./Popover.js";
|
|
2
|
+
import { C as LinkIcon } from "../icons-CpfUer49.js";
|
|
4
3
|
import { Button } from "./Button.js";
|
|
5
|
-
import {
|
|
4
|
+
import { Popover } from "./Popover.js";
|
|
6
5
|
import { Field } from "./Field.js";
|
|
7
6
|
import { Form } from "./Form.js";
|
|
7
|
+
import { a as CodeBlockCopyButton, i as CodeBlockContent, n as CodeBlockActions, p as CodeBlockTitle, r as CodeBlockContainer, s as CodeBlockHeader, t as CodeBlock } from "../CodeBlock-BmB4Xaqq.js";
|
|
8
|
+
import { CUSTOM_MCP_SERVER_CARD } from "../utils/mcp-server-catalog.js";
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/AgentConnection.tsx
|
|
11
12
|
const DEFAULT_LOCAL_ORIGIN = "http://localhost:5173";
|
|
12
13
|
const CONNECTION_CURVE_MIDPOINT = .5;
|
|
13
|
-
const MCP_CONNECTOR_NAME_PATTERN = "[A-Za-z_$][A-Za-z0-9_$]*";
|
|
14
14
|
const CUSTOM_AUTH_FIELDS = [{
|
|
15
15
|
inputType: "password",
|
|
16
16
|
label: "Bearer",
|
|
@@ -43,7 +43,7 @@ function getBrowserOrigin() {
|
|
|
43
43
|
function buildMcpUrl(origin) {
|
|
44
44
|
return `${origin.replace(/\/$/, "")}/mcp`;
|
|
45
45
|
}
|
|
46
|
-
function buildNanitesAgentConnectionCommands(origin, { mcpName = "nanites", pluginMarketplace = "WebMCP-org/nanites", claudePluginRef = "nanites@nanites", skillName = "nanites" } = {}) {
|
|
46
|
+
function buildNanitesAgentConnectionCommands(origin, { mcpName = "nanites", pluginMarketplace = "WebMCP-org/nanites", codexPluginRef = "nanites@nanites", claudePluginRef = "nanites@nanites", skillName = "nanites" } = {}) {
|
|
47
47
|
const mcpUrl = buildMcpUrl(origin);
|
|
48
48
|
return [
|
|
49
49
|
{
|
|
@@ -55,6 +55,7 @@ function buildNanitesAgentConnectionCommands(origin, { mcpName = "nanites", plug
|
|
|
55
55
|
`NANITES_MCP_URL="${mcpUrl}"`,
|
|
56
56
|
"",
|
|
57
57
|
`codex plugin marketplace add ${pluginMarketplace}`,
|
|
58
|
+
`codex plugin add ${codexPluginRef}`,
|
|
58
59
|
`codex mcp add ${mcpName} --url "$NANITES_MCP_URL"`,
|
|
59
60
|
`codex mcp login ${mcpName}`
|
|
60
61
|
].join("\n")
|
|
@@ -154,106 +155,115 @@ function AgentConnectionPanel({ className, commands: commandsProp, defaultTarget
|
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
/** Collects MCP connector settings and optional credentials with native form validation. */
|
|
157
|
-
function McpConnectorForm({ auth,
|
|
158
|
-
const [
|
|
158
|
+
function McpConnectorForm({ auth, className, defaults, namePattern, readOnlyServer = false, redirectUrl = "", status, submitLabel = "Connect MCP", submittingLabel = "Connecting", onSubmit, ref, ...props }) {
|
|
159
|
+
const [submission, setSubmission] = React.useState(null);
|
|
159
160
|
const credentialFields = (auth?.fields ?? CUSTOM_AUTH_FIELDS).filter(isCredentialAuthField);
|
|
160
161
|
const redirectUrlField = auth?.fields.find((field) => field.name === "redirectUrl");
|
|
161
|
-
async function handleSubmit(
|
|
162
|
-
|
|
163
|
-
event.stopPropagation();
|
|
164
|
-
if (!event.currentTarget.reportValidity()) return;
|
|
165
|
-
setSubmitting(true);
|
|
162
|
+
async function handleSubmit(values) {
|
|
163
|
+
setSubmission(true);
|
|
166
164
|
try {
|
|
167
|
-
await onSubmit(readMcpConnectorFormValues(
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
await onSubmit(readMcpConnectorFormValues(values));
|
|
166
|
+
setSubmission(null);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
setSubmission(error instanceof Error ? error.message : String(error));
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
171
|
return /* @__PURE__ */ jsxs(Form, {
|
|
173
172
|
ref,
|
|
174
173
|
"aria-label": "MCP connector",
|
|
175
174
|
className: cx("agent-connect__mcp-form", className),
|
|
176
|
-
|
|
177
|
-
onSubmit: handleSubmit,
|
|
175
|
+
onFormSubmit: handleSubmit,
|
|
178
176
|
...props,
|
|
179
177
|
children: [
|
|
180
|
-
/* @__PURE__ */ jsxs(Field.Root, {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
178
|
+
/* @__PURE__ */ jsxs(Field.Root, {
|
|
179
|
+
name: "name",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "MCP name" }),
|
|
182
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
183
|
+
defaultValue: defaults?.name ?? CUSTOM_MCP_SERVER_CARD.id,
|
|
184
|
+
pattern: namePattern,
|
|
185
|
+
readOnly: readOnlyServer,
|
|
186
|
+
required: true,
|
|
187
|
+
title: namePattern ? "Use the required name format." : void 0
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
190
|
+
match: "valueMissing",
|
|
191
|
+
children: "MCP name is required."
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
194
|
+
match: "patternMismatch",
|
|
195
|
+
children: "Use the required name format."
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ jsxs(Field.Root, {
|
|
200
|
+
name: "url",
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "MCP URL" }),
|
|
203
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
204
|
+
defaultValue: defaults?.url ?? "",
|
|
205
|
+
placeholder: "http://127.0.0.1:8787/mcp",
|
|
206
|
+
readOnly: readOnlyServer,
|
|
207
|
+
required: true,
|
|
208
|
+
type: "url"
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
211
|
+
match: "valueMissing",
|
|
212
|
+
children: "MCP URL is required."
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ jsx(Field.Error, {
|
|
215
|
+
match: "typeMismatch",
|
|
216
|
+
children: "MCP URL must use http or https."
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
}),
|
|
220
|
+
redirectUrlField ? /* @__PURE__ */ jsxs(Field.Root, {
|
|
217
221
|
name: "redirectUrl",
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
222
|
+
children: [/* @__PURE__ */ jsx(Field.Label, { children: redirectUrlField.label }), /* @__PURE__ */ jsx(Field.Control, {
|
|
223
|
+
readOnly: true,
|
|
224
|
+
type: "url",
|
|
225
|
+
value: redirectUrl
|
|
226
|
+
})]
|
|
227
|
+
}) : null,
|
|
228
|
+
credentialFields.length > 0 ? /* @__PURE__ */ jsxs(Field.Set, { children: [/* @__PURE__ */ jsx(Field.Legend, {
|
|
229
|
+
variant: "label",
|
|
230
|
+
children: auth?.label ?? "Credentials"
|
|
231
|
+
}), /* @__PURE__ */ jsx(Field.Group, { children: credentialFields.map((authField) => /* @__PURE__ */ jsxs(Field.Root, {
|
|
232
|
+
name: authField.name,
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(Field.Label, { children: authField.label }),
|
|
235
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
236
|
+
autoComplete: "off",
|
|
237
|
+
defaultValue: defaults?.[authField.name],
|
|
238
|
+
placeholder: authField.placeholder,
|
|
239
|
+
required: authField.required,
|
|
240
|
+
type: authField.inputType ?? "text"
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ jsxs(Field.Error, {
|
|
243
|
+
match: "valueMissing",
|
|
244
|
+
children: [authField.label, " is required."]
|
|
245
|
+
})
|
|
246
|
+
]
|
|
247
|
+
}, authField.name)) })] }) : null,
|
|
248
|
+
/* @__PURE__ */ jsx("div", {
|
|
237
249
|
className: "agent-connect__mcp-form-actions",
|
|
238
|
-
children:
|
|
250
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
239
251
|
type: "submit",
|
|
240
252
|
size: "sm",
|
|
241
|
-
disabled:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
variant: "outline",
|
|
246
|
-
color: "neutral",
|
|
247
|
-
size: "sm",
|
|
248
|
-
onClick: () => {
|
|
249
|
-
onAuthorize?.();
|
|
250
|
-
},
|
|
251
|
-
children: authorizeLabel
|
|
252
|
-
}) : null]
|
|
253
|
+
disabled: submission === true,
|
|
254
|
+
focusableWhenDisabled: submission === true,
|
|
255
|
+
children: submission === true ? submittingLabel : submitLabel
|
|
256
|
+
})
|
|
253
257
|
}),
|
|
254
|
-
|
|
258
|
+
typeof submission === "string" ? /* @__PURE__ */ jsx("span", {
|
|
259
|
+
className: "agent-connect__mcp-form-status",
|
|
260
|
+
"aria-atomic": "true",
|
|
261
|
+
role: "alert",
|
|
262
|
+
children: submission
|
|
263
|
+
}) : status ? /* @__PURE__ */ jsx("span", {
|
|
255
264
|
className: "agent-connect__mcp-form-status",
|
|
256
|
-
"aria-
|
|
265
|
+
"aria-atomic": "true",
|
|
266
|
+
role: "status",
|
|
257
267
|
children: status
|
|
258
268
|
}) : null
|
|
259
269
|
]
|
|
@@ -263,18 +273,16 @@ function readMcpConnectorFormValues(data) {
|
|
|
263
273
|
const bearerToken = readFormString(data, "bearerToken");
|
|
264
274
|
const clientId = readFormString(data, "clientId");
|
|
265
275
|
const clientSecret = readFormString(data, "clientSecret");
|
|
266
|
-
const scope = readFormString(data, "scope");
|
|
267
276
|
return {
|
|
268
277
|
...bearerToken ? { bearerToken } : {},
|
|
269
278
|
...clientId ? { clientId } : {},
|
|
270
279
|
...clientSecret ? { clientSecret } : {},
|
|
271
280
|
name: readFormString(data, "name"),
|
|
272
|
-
...scope ? { scope } : {},
|
|
273
281
|
url: readFormString(data, "url")
|
|
274
282
|
};
|
|
275
283
|
}
|
|
276
284
|
function readFormString(data, name) {
|
|
277
|
-
const value = data
|
|
285
|
+
const value = data[name];
|
|
278
286
|
return typeof value === "string" ? value.trim() : "";
|
|
279
287
|
}
|
|
280
288
|
function isCredentialAuthField(field) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/AppFrame.d.ts
|
|
4
|
+
declare function Root({
|
|
5
|
+
className,
|
|
6
|
+
ref,
|
|
7
|
+
...props
|
|
8
|
+
}: React.HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function Body({
|
|
12
|
+
className,
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}: React.HTMLAttributes<HTMLDivElement> & {
|
|
16
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
/** Full-height application frame with a fixed chrome row and contained work surface. */
|
|
19
|
+
declare const AppFrame: {
|
|
20
|
+
Root: typeof Root;
|
|
21
|
+
Body: typeof Body;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { AppFrame };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as cx } from "../class-names-9UtZwb0J.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/AppFrame.tsx
|
|
5
|
+
function Root({ className, ref, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
ref,
|
|
8
|
+
className: cx("app-frame", className),
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function Body({ className, ref, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
ref,
|
|
15
|
+
className: cx("app-frame__body", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Full-height application frame with a fixed chrome row and contained work surface. */
|
|
20
|
+
const AppFrame = {
|
|
21
|
+
Root,
|
|
22
|
+
Body
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { AppFrame };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Toolbar, ToolbarButtonProps, ToolbarGroupProps } from "./Toolbar.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/AppTopBar.d.ts
|
|
5
|
+
interface AppTopBarRootProps extends React.ComponentPropsWithoutRef<typeof Toolbar.Root> {
|
|
6
|
+
/** Accessible name describing the controls in this application bar. */
|
|
7
|
+
"aria-label": string;
|
|
8
|
+
}
|
|
9
|
+
interface AppTopBarGroupProps extends ToolbarGroupProps {}
|
|
10
|
+
interface AppTopBarTitleProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
11
|
+
interface AppTopBarButtonProps extends Omit<ToolbarButtonProps, "aria-label"> {
|
|
12
|
+
/** Accessible name and default tooltip text for the icon-only control. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Tooltip text when it should differ from the accessible name. */
|
|
15
|
+
tooltip?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
interface AppTopBarControlProps extends ToolbarButtonProps {}
|
|
18
|
+
/**
|
|
19
|
+
* Stable application-level toolbar with composable leading, title, and trailing
|
|
20
|
+
* slots. Descendant buttons share Base UI's roving focus and tooltip provider.
|
|
21
|
+
*/
|
|
22
|
+
declare function AppTopBarRoot({
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: AppTopBarRootProps): React.JSX.Element;
|
|
27
|
+
declare function AppTopBarLeading({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: AppTopBarGroupProps): React.JSX.Element;
|
|
31
|
+
declare function AppTopBarTitle({
|
|
32
|
+
className,
|
|
33
|
+
ref,
|
|
34
|
+
...props
|
|
35
|
+
}: AppTopBarTitleProps & {
|
|
36
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
37
|
+
}): React.JSX.Element;
|
|
38
|
+
declare function AppTopBarTrailing({
|
|
39
|
+
className,
|
|
40
|
+
...props
|
|
41
|
+
}: AppTopBarGroupProps): React.JSX.Element;
|
|
42
|
+
declare function AppTopBarControl({
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}: AppTopBarControlProps): React.JSX.Element;
|
|
46
|
+
declare function AppTopBarButton({
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
disabled,
|
|
50
|
+
label,
|
|
51
|
+
render,
|
|
52
|
+
tooltip,
|
|
53
|
+
...props
|
|
54
|
+
}: AppTopBarButtonProps): React.JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Composable application top bar with stable leading, title, and trailing
|
|
57
|
+
* slots. Icon controls use shared Toolbar roving focus and coordinated Tooltip
|
|
58
|
+
* behavior; their fixed slots do not resize when state icons change. Render an
|
|
59
|
+
* existing behavior-rich button through `Control` to retain those toolbar
|
|
60
|
+
* semantics without rebuilding the control.
|
|
61
|
+
*/
|
|
62
|
+
declare const AppTopBar: {
|
|
63
|
+
Root: typeof AppTopBarRoot;
|
|
64
|
+
Leading: typeof AppTopBarLeading;
|
|
65
|
+
Title: typeof AppTopBarTitle;
|
|
66
|
+
Trailing: typeof AppTopBarTrailing;
|
|
67
|
+
Control: typeof AppTopBarControl;
|
|
68
|
+
Button: typeof AppTopBarButton;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { AppTopBar, AppTopBarButtonProps, AppTopBarControlProps, AppTopBarGroupProps, AppTopBarRootProps, AppTopBarTitleProps };
|