@assistant-ui/react-mcp 0.0.0 → 0.0.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/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/buildHeaders.d.ts +7 -3
- package/dist/auth/buildHeaders.d.ts.map +1 -1
- package/dist/auth/buildHeaders.js +14 -12
- package/dist/auth/buildHeaders.js.map +1 -1
- package/dist/auth/createOAuthProvider.d.ts +17 -15
- package/dist/auth/createOAuthProvider.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.js +111 -137
- package/dist/auth/createOAuthProvider.js.map +1 -1
- package/dist/auth/types.d.ts +10 -7
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js +0 -2
- package/dist/connector.d.ts +6 -2
- package/dist/connector.d.ts.map +1 -1
- package/dist/connector.js +7 -3
- package/dist/connector.js.map +1 -1
- package/dist/context/McpConnectorByIndexProvider.d.ts +7 -3
- package/dist/context/McpConnectorByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpConnectorByIndexProvider.js +18 -11
- package/dist/context/McpConnectorByIndexProvider.js.map +1 -1
- package/dist/context/McpCustomServerByIndexProvider.d.ts +7 -3
- package/dist/context/McpCustomServerByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpCustomServerByIndexProvider.js +18 -11
- package/dist/context/McpCustomServerByIndexProvider.js.map +1 -1
- package/dist/context/McpServerByIdProvider.d.ts +7 -3
- package/dist/context/McpServerByIdProvider.d.ts.map +1 -1
- package/dist/context/McpServerByIdProvider.js +15 -11
- package/dist/context/McpServerByIdProvider.js.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.d.ts +16 -13
- package/dist/hooks/useMcpOAuthCallback.d.ts.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.js +59 -55
- package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
- package/dist/index.d.ts +17 -18
- package/dist/index.js +14 -26
- package/dist/mcp-scope.d.ts +91 -94
- package/dist/mcp-scope.d.ts.map +1 -1
- package/dist/mcp-scope.js +0 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts +17 -13
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.js +23 -14
- package/dist/primitives/addForm/McpAddFormAuthFields.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts +9 -5
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.js +36 -16
- package/dist/primitives/addForm/McpAddFormAuthSelect.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormCancel.d.ts +10 -6
- package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormCancel.js +19 -11
- package/dist/primitives/addForm/McpAddFormCancel.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormError.d.ts +10 -6
- package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormError.js +15 -8
- package/dist/primitives/addForm/McpAddFormError.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormNameField.d.ts +9 -5
- package/dist/primitives/addForm/McpAddFormNameField.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormNameField.js +17 -6
- package/dist/primitives/addForm/McpAddFormNameField.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts +15 -11
- package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.js +134 -94
- package/dist/primitives/addForm/McpAddFormRoot.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts +10 -6
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormSubmit.js +16 -6
- package/dist/primitives/addForm/McpAddFormSubmit.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts +9 -5
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormUrlField.js +18 -6
- package/dist/primitives/addForm/McpAddFormUrlField.js.map +1 -1
- package/dist/primitives/addForm/context.d.ts +22 -18
- package/dist/primitives/addForm/context.d.ts.map +1 -1
- package/dist/primitives/addForm/context.js +9 -7
- package/dist/primitives/addForm/context.js.map +1 -1
- package/dist/primitives/addForm.d.ts +15 -8
- package/dist/primitives/addForm.d.ts.map +1 -1
- package/dist/primitives/addForm.js +23 -8
- package/dist/primitives/addForm.js.map +1 -1
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts +10 -6
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerAddCustomTrigger.js +13 -6
- package/dist/primitives/manager/McpManagerAddCustomTrigger.js.map +1 -1
- package/dist/primitives/manager/McpManagerConnectors.d.ts +18 -14
- package/dist/primitives/manager/McpManagerConnectors.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerConnectors.js +37 -35
- package/dist/primitives/manager/McpManagerConnectors.js.map +1 -1
- package/dist/primitives/manager/McpManagerCustomServers.d.ts +18 -14
- package/dist/primitives/manager/McpManagerCustomServers.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerCustomServers.js +38 -32
- package/dist/primitives/manager/McpManagerCustomServers.js.map +1 -1
- package/dist/primitives/manager/McpManagerRoot.d.ts +10 -6
- package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerRoot.js +14 -6
- package/dist/primitives/manager/McpManagerRoot.js.map +1 -1
- package/dist/primitives/manager.d.ts +11 -4
- package/dist/primitives/manager.d.ts.map +1 -1
- package/dist/primitives/manager.js +15 -4
- package/dist/primitives/manager.js.map +1 -1
- package/dist/primitives/server/McpServerConnectButton.d.ts +10 -6
- package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerConnectButton.js +28 -17
- package/dist/primitives/server/McpServerConnectButton.js.map +1 -1
- package/dist/primitives/server/McpServerDisconnectButton.d.ts +10 -6
- package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerDisconnectButton.js +27 -17
- package/dist/primitives/server/McpServerDisconnectButton.js.map +1 -1
- package/dist/primitives/server/McpServerError.d.ts +10 -6
- package/dist/primitives/server/McpServerError.d.ts.map +1 -1
- package/dist/primitives/server/McpServerError.js +15 -8
- package/dist/primitives/server/McpServerError.js.map +1 -1
- package/dist/primitives/server/McpServerIcon.d.ts +16 -14
- package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
- package/dist/primitives/server/McpServerIcon.js +18 -10
- package/dist/primitives/server/McpServerIcon.js.map +1 -1
- package/dist/primitives/server/McpServerName.d.ts +10 -6
- package/dist/primitives/server/McpServerName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerName.js +14 -6
- package/dist/primitives/server/McpServerName.js.map +1 -1
- package/dist/primitives/server/McpServerOAuthLink.d.ts +13 -11
- package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
- package/dist/primitives/server/McpServerOAuthLink.js +18 -9
- package/dist/primitives/server/McpServerOAuthLink.js.map +1 -1
- package/dist/primitives/server/McpServerRemoveButton.d.ts +10 -6
- package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRemoveButton.js +21 -14
- package/dist/primitives/server/McpServerRemoveButton.js.map +1 -1
- package/dist/primitives/server/McpServerRoot.d.ts +10 -6
- package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRoot.js +20 -9
- package/dist/primitives/server/McpServerRoot.js.map +1 -1
- package/dist/primitives/server/McpServerStatus.d.ts +10 -6
- package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
- package/dist/primitives/server/McpServerStatus.js +15 -6
- package/dist/primitives/server/McpServerStatus.js.map +1 -1
- package/dist/primitives/server/McpServerToolName.d.ts +10 -6
- package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerToolName.js +15 -6
- package/dist/primitives/server/McpServerToolName.js.map +1 -1
- package/dist/primitives/server/McpServerTools.d.ts +12 -8
- package/dist/primitives/server/McpServerTools.d.ts.map +1 -1
- package/dist/primitives/server/McpServerTools.js +17 -13
- package/dist/primitives/server/McpServerTools.js.map +1 -1
- package/dist/primitives/server.d.ts +18 -11
- package/dist/primitives/server.d.ts.map +1 -1
- package/dist/primitives/server.js +30 -11
- package/dist/primitives/server.js.map +1 -1
- package/dist/resources/McpManagerResource.d.ts +13 -11
- package/dist/resources/McpManagerResource.d.ts.map +1 -1
- package/dist/resources/McpManagerResource.js +149 -183
- package/dist/resources/McpManagerResource.js.map +1 -1
- package/dist/resources/McpServerResource.d.ts +19 -15
- package/dist/resources/McpServerResource.d.ts.map +1 -1
- package/dist/resources/McpServerResource.js +186 -235
- package/dist/resources/McpServerResource.js.map +1 -1
- package/dist/resources/storage/McpCustomStorage.d.ts +6 -2
- package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpCustomStorage.js +5 -1
- package/dist/resources/storage/McpCustomStorage.js.map +1 -1
- package/dist/resources/storage/McpLocalStorage.d.ts +9 -7
- package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.js +51 -62
- package/dist/resources/storage/McpLocalStorage.js.map +1 -1
- package/dist/resources/storage/McpMemoryStorage.d.ts +6 -2
- package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpMemoryStorage.js +20 -16
- package/dist/resources/storage/McpMemoryStorage.js.map +1 -1
- package/dist/resources/storage/types.d.ts +14 -10
- package/dist/resources/storage/types.d.ts.map +1 -1
- package/dist/resources/storage/types.js +0 -2
- package/dist/utils/serverId.d.ts +4 -1
- package/dist/utils/serverId.d.ts.map +1 -1
- package/dist/utils/serverId.js +8 -14
- package/dist/utils/serverId.js.map +1 -1
- package/package.json +12 -12
- package/dist/auth/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-scope.js.map +0 -1
- package/dist/resources/storage/types.js.map +0 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef, } from "react";
|
|
1
|
+
import { forwardRef } from "react";
|
|
3
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/manager/McpManagerAddCustomTrigger.tsx
|
|
5
|
+
const McpManagerPrimitiveAddCustomTrigger = forwardRef((props, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(Primitive.button, {
|
|
7
|
+
...props,
|
|
8
|
+
type: "button",
|
|
9
|
+
ref
|
|
10
|
+
});
|
|
6
11
|
});
|
|
7
|
-
McpManagerPrimitiveAddCustomTrigger.displayName =
|
|
8
|
-
|
|
12
|
+
McpManagerPrimitiveAddCustomTrigger.displayName = "McpManagerPrimitive.AddCustomTrigger";
|
|
13
|
+
//#endregion
|
|
14
|
+
export { McpManagerPrimitiveAddCustomTrigger };
|
|
15
|
+
|
|
9
16
|
//# sourceMappingURL=McpManagerAddCustomTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerAddCustomTrigger.js","
|
|
1
|
+
{"version":3,"file":"McpManagerAddCustomTrigger.js","names":[],"sources":["../../../src/primitives/manager/McpManagerAddCustomTrigger.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\n\nexport namespace McpManagerPrimitiveAddCustomTrigger {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpManagerPrimitiveAddCustomTrigger = forwardRef<\n McpManagerPrimitiveAddCustomTrigger.Element,\n McpManagerPrimitiveAddCustomTrigger.Props\n>((props, ref) => {\n return <Primitive.button {...props} type=\"button\" ref={ref} />;\n});\n\nMcpManagerPrimitiveAddCustomTrigger.displayName =\n \"McpManagerPrimitive.AddCustomTrigger\";\n"],"mappings":";;;;AAYA,MAAa,sCAAsC,YAGhD,OAAO,QAAQ;CAChB,OAAO,oBAAC,UAAU,QAAX;EAAkB,GAAI;EAAO,MAAK;EAAc;CAAM,CAAA;AAC/D,CAAC;AAED,oCAAoC,cAClC"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { MCPServerState } from "../../mcp-scope.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/manager/McpManagerConnectors.d.ts
|
|
5
|
+
declare namespace McpManagerPrimitiveConnectors {
|
|
6
|
+
type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* Render function called once per connector. Receives a lazy `server`
|
|
9
|
+
* accessor — reading it inside the render function subscribes to that
|
|
10
|
+
* connector's state.
|
|
11
|
+
*/
|
|
12
|
+
children: (value: {
|
|
13
|
+
server: MCPServerState;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
};
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Renders all connectors declared on `McpManagerResource`.
|
|
@@ -27,5 +29,7 @@ export declare namespace McpManagerPrimitiveConnectors {
|
|
|
27
29
|
* </McpManagerPrimitive.Connectors>
|
|
28
30
|
* ```
|
|
29
31
|
*/
|
|
30
|
-
|
|
32
|
+
declare const McpManagerPrimitiveConnectors: FC<McpManagerPrimitiveConnectors.Props>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { McpManagerPrimitiveConnectors };
|
|
31
35
|
//# sourceMappingURL=McpManagerConnectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerConnectors.d.ts","
|
|
1
|
+
{"version":3,"file":"McpManagerConnectors.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"mappings":";;;;kBASiB,6BAAA;EAAA,KACH,KAAA;IADG;;;;;IAOb,QAAA,GAAW,KAAA;MAAS,MAAA,EAAQ,cAAA;IAAA,MAAqB,SAAS;EAAA;AAAA;;AAAA;AAqD9D;;;;;;;;AAAkF;;;;;cAArE,6BAAA,EAA+B,EAAE,CAAC,6BAAA,CAA8B,KAAA"}
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo } from "react";
|
|
3
|
-
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
4
1
|
import { McpConnectorByIndexProvider } from "../../context/McpConnectorByIndexProvider.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/manager/McpManagerConnectors.tsx
|
|
6
|
+
const SEP = "";
|
|
8
7
|
const McpManagerPrimitiveConnectorsInner = ({ children }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
const idsJoined = useAuiState((s) => s.mcp.connectors.map((c) => c.id).join(SEP));
|
|
9
|
+
const ids = useMemo(() => idsJoined ? idsJoined.split(SEP) : [], [idsJoined]);
|
|
10
|
+
return useMemo(() => {
|
|
11
|
+
if (ids.length === 0) return null;
|
|
12
|
+
return ids.map((id, index) => /* @__PURE__ */ jsx(McpConnectorByIndexProvider, {
|
|
13
|
+
index,
|
|
14
|
+
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
15
|
+
getItemState: (aui) => aui.mcp().connector({ index }).getState(),
|
|
16
|
+
children: (getItem) => children({ get server() {
|
|
17
|
+
return getItem();
|
|
18
|
+
} })
|
|
19
|
+
})
|
|
20
|
+
}, id));
|
|
21
|
+
}, [ids, children]);
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
* Renders all connectors declared on `McpManagerResource`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <McpManagerPrimitive.Connectors>
|
|
29
|
+
* {({ server }) => (
|
|
30
|
+
* <McpServerPrimitive.Root>
|
|
31
|
+
* <McpServerPrimitive.Name />
|
|
32
|
+
* {server.connectionState === "error" && <p>{server.lastError?.message}</p>}
|
|
33
|
+
* </McpServerPrimitive.Root>
|
|
34
|
+
* )}
|
|
35
|
+
* </McpManagerPrimitive.Connectors>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const McpManagerPrimitiveConnectors = memo(McpManagerPrimitiveConnectorsInner, (prev, next) => prev.children === next.children);
|
|
40
39
|
McpManagerPrimitiveConnectors.displayName = "McpManagerPrimitive.Connectors";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { McpManagerPrimitiveConnectors };
|
|
42
|
+
|
|
41
43
|
//# sourceMappingURL=McpManagerConnectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerConnectors.js","
|
|
1
|
+
{"version":3,"file":"McpManagerConnectors.js","names":[],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpConnectorByIndexProvider } from \"../../context/McpConnectorByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\n// ASCII Unit Separator — never appears in MCP connector ids (uuids, urls,\n// app-provided strings).\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveConnectors {\n export type Props = {\n /**\n * Render function called once per connector. Receives a lazy `server`\n * accessor — reading it inside the render function subscribes to that\n * connector's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveConnectorsInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n // Subscribe to the connector id list, joined to a primitive so identity\n // is stable when the list hasn't changed. Re-renders on add/remove/reorder\n // but not on per-item state changes.\n const idsJoined = useAuiState((s) =>\n s.mcp.connectors.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpConnectorByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().connector({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpConnectorByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all connectors declared on `McpManagerResource`.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.Connectors>\n * {({ server }) => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * {server.connectionState === \"error\" && <p>{server.lastError?.message}</p>}\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.Connectors>\n * ```\n */\nexport const McpManagerPrimitiveConnectors: FC<McpManagerPrimitiveConnectors.Props> =\n memo(\n McpManagerPrimitiveConnectorsInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveConnectors.displayName = \"McpManagerPrimitive.Connectors\";\n"],"mappings":";;;;;AAOA,MAAM,MAAM;AAaZ,MAAM,sCAEA,EAAE,eAAe;CAIrB,MAAM,YAAY,aAAa,MAC7B,EAAE,IAAI,WAAW,KAAK,MAAM,EAAE,EAAE,EAAE,KAAK,GAAG,CAC5C;CACA,MAAM,MAAM,cACH,YAAY,UAAU,MAAM,GAAG,IAAI,CAAC,GAC3C,CAAC,SAAS,CACZ;CAEA,OAAO,cAAc;EACnB,IAAI,IAAI,WAAW,GAAG,OAAO;EAC7B,OAAO,IAAI,KAAK,IAAI,UAClB,oBAAC,6BAAD;GAA6C;aAC3C,oBAAC,4BAAD;IACE,eAAe,QAAQ,IAAI,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,SAAS;eAE7D,YACA,SAAS,EACP,IAAI,SAAS;KACX,OAAO,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACD,GAZK,EAYL,CAC9B;CACH,GAAG,CAAC,KAAK,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAa,gCACX,KACE,qCACC,MAAM,SAAS,KAAK,aAAa,KAAK,QACzC;AAEF,8BAA8B,cAAc"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { MCPServerState } from "../../mcp-scope.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/manager/McpManagerCustomServers.d.ts
|
|
5
|
+
declare namespace McpManagerPrimitiveCustomServers {
|
|
6
|
+
type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* Render function called once per custom server. Receives a lazy
|
|
9
|
+
* `server` accessor — reading it inside the render function subscribes
|
|
10
|
+
* to that server's state.
|
|
11
|
+
*/
|
|
12
|
+
children: (value: {
|
|
13
|
+
server: MCPServerState;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
};
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Renders all user-added custom servers persisted in storage.
|
|
@@ -27,5 +29,7 @@ export declare namespace McpManagerPrimitiveCustomServers {
|
|
|
27
29
|
* </McpManagerPrimitive.CustomServers>
|
|
28
30
|
* ```
|
|
29
31
|
*/
|
|
30
|
-
|
|
32
|
+
declare const McpManagerPrimitiveCustomServers: FC<McpManagerPrimitiveCustomServers.Props>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { McpManagerPrimitiveCustomServers };
|
|
31
35
|
//# sourceMappingURL=McpManagerCustomServers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerCustomServers.d.ts","
|
|
1
|
+
{"version":3,"file":"McpManagerCustomServers.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"mappings":";;;;kBAOiB,gCAAA;EAAA,KACH,KAAA;IADG;;;;;IAOb,QAAA,GAAW,KAAA;MAAS,MAAA,EAAQ,cAAA;IAAA,MAAqB,SAAS;EAAA;AAAA;;AAAA;AAkD9D;;;;;;;;AAAwF;;;;;cAA3E,gCAAA,EAAkC,EAAE,CAAC,gCAAA,CAAiC,KAAA"}
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo } from "react";
|
|
3
|
-
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
4
1
|
import { McpCustomServerByIndexProvider } from "../../context/McpCustomServerByIndexProvider.js";
|
|
5
|
-
|
|
2
|
+
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/manager/McpManagerCustomServers.tsx
|
|
6
|
+
const SEP = "";
|
|
6
7
|
const McpManagerPrimitiveCustomServersInner = ({ children }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const idsJoined = useAuiState((s) => s.mcp.customServers.map((c) => c.id).join(SEP));
|
|
9
|
+
const ids = useMemo(() => idsJoined ? idsJoined.split(SEP) : [], [idsJoined]);
|
|
10
|
+
return useMemo(() => {
|
|
11
|
+
if (ids.length === 0) return null;
|
|
12
|
+
return ids.map((id, index) => /* @__PURE__ */ jsx(McpCustomServerByIndexProvider, {
|
|
13
|
+
index,
|
|
14
|
+
children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
|
|
15
|
+
getItemState: (aui) => aui.mcp().customServer({ index }).getState(),
|
|
16
|
+
children: (getItem) => children({ get server() {
|
|
17
|
+
return getItem();
|
|
18
|
+
} })
|
|
19
|
+
})
|
|
20
|
+
}, id));
|
|
21
|
+
}, [ids, children]);
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
McpManagerPrimitiveCustomServers.displayName =
|
|
36
|
-
|
|
24
|
+
* Renders all user-added custom servers persisted in storage.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <McpManagerPrimitive.CustomServers>
|
|
29
|
+
* {() => (
|
|
30
|
+
* <McpServerPrimitive.Root>
|
|
31
|
+
* <McpServerPrimitive.Name />
|
|
32
|
+
* <McpServerPrimitive.RemoveButton>Remove</McpServerPrimitive.RemoveButton>
|
|
33
|
+
* </McpServerPrimitive.Root>
|
|
34
|
+
* )}
|
|
35
|
+
* </McpManagerPrimitive.CustomServers>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const McpManagerPrimitiveCustomServers = memo(McpManagerPrimitiveCustomServersInner, (prev, next) => prev.children === next.children);
|
|
39
|
+
McpManagerPrimitiveCustomServers.displayName = "McpManagerPrimitive.CustomServers";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { McpManagerPrimitiveCustomServers };
|
|
42
|
+
|
|
37
43
|
//# sourceMappingURL=McpManagerCustomServers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerCustomServers.js","
|
|
1
|
+
{"version":3,"file":"McpManagerCustomServers.js","names":[],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"sourcesContent":["import { type FC, type ReactNode, memo, useMemo } from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { McpCustomServerByIndexProvider } from \"../../context/McpCustomServerByIndexProvider\";\nimport type { MCPServerState } from \"../../mcp-scope\";\n\nconst SEP = \"\\x1f\";\n\nexport namespace McpManagerPrimitiveCustomServers {\n export type Props = {\n /**\n * Render function called once per custom server. Receives a lazy\n * `server` accessor — reading it inside the render function subscribes\n * to that server's state.\n */\n children: (value: { server: MCPServerState }) => ReactNode;\n };\n}\n\nconst McpManagerPrimitiveCustomServersInner: FC<{\n children: (value: { server: MCPServerState }) => ReactNode;\n}> = ({ children }) => {\n const idsJoined = useAuiState((s) =>\n s.mcp.customServers.map((c) => c.id).join(SEP),\n );\n const ids = useMemo(\n () => (idsJoined ? idsJoined.split(SEP) : []),\n [idsJoined],\n );\n\n return useMemo(() => {\n if (ids.length === 0) return null;\n return ids.map((id, index) => (\n <McpCustomServerByIndexProvider key={id} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.mcp().customServer({ index }).getState()}\n >\n {(getItem) =>\n children({\n get server() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </McpCustomServerByIndexProvider>\n ));\n }, [ids, children]);\n};\n\n/**\n * Renders all user-added custom servers persisted in storage.\n *\n * @example\n * ```tsx\n * <McpManagerPrimitive.CustomServers>\n * {() => (\n * <McpServerPrimitive.Root>\n * <McpServerPrimitive.Name />\n * <McpServerPrimitive.RemoveButton>Remove</McpServerPrimitive.RemoveButton>\n * </McpServerPrimitive.Root>\n * )}\n * </McpManagerPrimitive.CustomServers>\n * ```\n */\nexport const McpManagerPrimitiveCustomServers: FC<McpManagerPrimitiveCustomServers.Props> =\n memo(\n McpManagerPrimitiveCustomServersInner,\n (prev, next) => prev.children === next.children,\n );\n\nMcpManagerPrimitiveCustomServers.displayName =\n \"McpManagerPrimitive.CustomServers\";\n"],"mappings":";;;;;AAKA,MAAM,MAAM;AAaZ,MAAM,yCAEA,EAAE,eAAe;CACrB,MAAM,YAAY,aAAa,MAC7B,EAAE,IAAI,cAAc,KAAK,MAAM,EAAE,EAAE,EAAE,KAAK,GAAG,CAC/C;CACA,MAAM,MAAM,cACH,YAAY,UAAU,MAAM,GAAG,IAAI,CAAC,GAC3C,CAAC,SAAS,CACZ;CAEA,OAAO,cAAc;EACnB,IAAI,IAAI,WAAW,GAAG,OAAO;EAC7B,OAAO,IAAI,KAAK,IAAI,UAClB,oBAAC,gCAAD;GAAgD;aAC9C,oBAAC,4BAAD;IACE,eAAe,QAAQ,IAAI,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,SAAS;eAEhE,YACA,SAAS,EACP,IAAI,SAAS;KACX,OAAO,QAAQ;IACjB,EACF,CAAC;GAEuB,CAAA;EACE,GAZK,EAYL,CACjC;CACH,GAAG,CAAC,KAAK,QAAQ,CAAC;AACpB;;;;;;;;;;;;;;;;AAiBA,MAAa,mCACX,KACE,wCACC,MAAM,SAAS,KAAK,aAAa,KAAK,QACzC;AAEF,iCAAiC,cAC/B"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/manager/McpManagerRoot.d.ts
|
|
5
|
+
declare namespace McpManagerPrimitiveRoot {
|
|
6
|
+
type Element = ComponentRef<typeof Primitive.div>;
|
|
7
|
+
type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
declare const McpManagerPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
10
|
+
asChild?: boolean;
|
|
9
11
|
}, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { McpManagerPrimitiveRoot };
|
|
10
14
|
//# sourceMappingURL=McpManagerRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerRoot.d.ts","
|
|
1
|
+
{"version":3,"file":"McpManagerRoot.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.tsx"],"mappings":";;;;kBAQiB,uBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,GAAA;AAAA;AAAA,cAGnD,uBAAA,kBAAuB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,cAAA,oBAAA,cAAA,CAAA,cAAA"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, } from "react";
|
|
3
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
1
|
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/manager/McpManagerRoot.tsx
|
|
6
|
+
const McpManagerPrimitiveRoot = forwardRef((props, ref) => {
|
|
7
|
+
const isHydrated = useAuiState((s) => s.mcp.isHydrated);
|
|
8
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
9
|
+
...props,
|
|
10
|
+
ref,
|
|
11
|
+
"data-mcp-hydrated": isHydrated || void 0
|
|
12
|
+
});
|
|
8
13
|
});
|
|
9
14
|
McpManagerPrimitiveRoot.displayName = "McpManagerPrimitive.Root";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { McpManagerPrimitiveRoot };
|
|
17
|
+
|
|
10
18
|
//# sourceMappingURL=McpManagerRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerRoot.js","
|
|
1
|
+
{"version":3,"file":"McpManagerRoot.js","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpManagerPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpManagerPrimitiveRoot = forwardRef<\n McpManagerPrimitiveRoot.Element,\n McpManagerPrimitiveRoot.Props\n>((props, ref) => {\n const isHydrated = useAuiState((s) => s.mcp.isHydrated);\n return (\n <Primitive.div\n {...props}\n ref={ref}\n data-mcp-hydrated={isHydrated || undefined}\n />\n );\n});\n\nMcpManagerPrimitiveRoot.displayName = \"McpManagerPrimitive.Root\";\n"],"mappings":";;;;;AAaA,MAAa,0BAA0B,YAGpC,OAAO,QAAQ;CAChB,MAAM,aAAa,aAAa,MAAM,EAAE,IAAI,UAAU;CACtD,OACE,oBAAC,UAAU,KAAX;EACE,GAAI;EACC;EACL,qBAAmB,cAAc,KAAA;CAClC,CAAA;AAEL,CAAC;AAED,wBAAwB,cAAc"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { McpManagerPrimitiveRoot } from "./manager/McpManagerRoot.js";
|
|
2
|
+
import { McpManagerPrimitiveConnectors } from "./manager/McpManagerConnectors.js";
|
|
3
|
+
import { McpManagerPrimitiveCustomServers } from "./manager/McpManagerCustomServers.js";
|
|
4
|
+
import { McpManagerPrimitiveAddCustomTrigger } from "./manager/McpManagerAddCustomTrigger.js";
|
|
5
|
+
|
|
6
|
+
//#region src/primitives/manager.d.ts
|
|
7
|
+
declare namespace manager_d_exports {
|
|
8
|
+
export { McpManagerPrimitiveAddCustomTrigger as AddCustomTrigger, McpManagerPrimitiveConnectors as Connectors, McpManagerPrimitiveCustomServers as CustomServers, McpManagerPrimitiveRoot as Root };
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { McpManagerPrimitiveAddCustomTrigger as AddCustomTrigger, McpManagerPrimitiveConnectors as Connectors, McpManagerPrimitiveCustomServers as CustomServers, McpManagerPrimitiveRoot as Root, manager_d_exports };
|
|
5
12
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","
|
|
1
|
+
{"version":3,"file":"manager.d.ts","names":[],"sources":["../../src/primitives/manager.ts"],"mappings":""}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { McpManagerPrimitiveRoot } from "./manager/McpManagerRoot.js";
|
|
3
|
+
import { McpManagerPrimitiveConnectors } from "./manager/McpManagerConnectors.js";
|
|
4
|
+
import { McpManagerPrimitiveCustomServers } from "./manager/McpManagerCustomServers.js";
|
|
5
|
+
import { McpManagerPrimitiveAddCustomTrigger } from "./manager/McpManagerAddCustomTrigger.js";
|
|
6
|
+
//#region src/primitives/manager.ts
|
|
7
|
+
var manager_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
AddCustomTrigger: () => McpManagerPrimitiveAddCustomTrigger,
|
|
9
|
+
Connectors: () => McpManagerPrimitiveConnectors,
|
|
10
|
+
CustomServers: () => McpManagerPrimitiveCustomServers,
|
|
11
|
+
Root: () => McpManagerPrimitiveRoot
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { McpManagerPrimitiveAddCustomTrigger as AddCustomTrigger, McpManagerPrimitiveConnectors as Connectors, McpManagerPrimitiveCustomServers as CustomServers, McpManagerPrimitiveRoot as Root, manager_exports };
|
|
15
|
+
|
|
5
16
|
//# sourceMappingURL=manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","
|
|
1
|
+
{"version":3,"file":"manager.js","names":[],"sources":["../../src/primitives/manager.ts"],"sourcesContent":["export { McpManagerPrimitiveRoot as Root } from \"./manager/McpManagerRoot\";\nexport { McpManagerPrimitiveConnectors as Connectors } from \"./manager/McpManagerConnectors\";\nexport { McpManagerPrimitiveCustomServers as CustomServers } from \"./manager/McpManagerCustomServers\";\nexport { McpManagerPrimitiveAddCustomTrigger as AddCustomTrigger } from \"./manager/McpManagerAddCustomTrigger\";\n"],"mappings":""}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/server/McpServerConnectButton.d.ts
|
|
5
|
+
declare namespace McpServerPrimitiveConnectButton {
|
|
6
|
+
type Element = ComponentRef<typeof Primitive.button>;
|
|
7
|
+
type Props = ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
declare const McpServerPrimitiveConnectButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
asChild?: boolean;
|
|
9
11
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { McpServerPrimitiveConnectButton };
|
|
10
14
|
//# sourceMappingURL=McpServerConnectButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerConnectButton.d.ts","
|
|
1
|
+
{"version":3,"file":"McpServerConnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"mappings":";;;;kBAQiB,+BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAKnD,+BAAA,kBAA+B,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, } from "react";
|
|
3
|
-
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
1
|
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/primitives/server/McpServerConnectButton.tsx
|
|
6
|
+
const CONNECTABLE = new Set([
|
|
7
|
+
"disconnected",
|
|
8
|
+
"error",
|
|
9
|
+
"authRequired"
|
|
10
|
+
]);
|
|
11
|
+
const McpServerPrimitiveConnectButton = forwardRef((props, ref) => {
|
|
12
|
+
const state = useAuiState((s) => s.mcpServer.connectionState);
|
|
13
|
+
const aui = useAui();
|
|
14
|
+
if (!CONNECTABLE.has(state)) return null;
|
|
15
|
+
return /* @__PURE__ */ jsx(Primitive.button, {
|
|
16
|
+
...props,
|
|
17
|
+
type: "button",
|
|
18
|
+
ref,
|
|
19
|
+
"data-state-hint": state === "authRequired" ? "auth-required" : void 0,
|
|
20
|
+
onClick: (e) => {
|
|
21
|
+
props.onClick?.(e);
|
|
22
|
+
if (e.defaultPrevented) return;
|
|
23
|
+
aui.mcpServer().connect();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
17
26
|
});
|
|
18
|
-
McpServerPrimitiveConnectButton.displayName =
|
|
19
|
-
|
|
27
|
+
McpServerPrimitiveConnectButton.displayName = "McpServerPrimitive.ConnectButton";
|
|
28
|
+
//#endregion
|
|
29
|
+
export { McpServerPrimitiveConnectButton };
|
|
30
|
+
|
|
20
31
|
//# sourceMappingURL=McpServerConnectButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerConnectButton.js","
|
|
1
|
+
{"version":3,"file":"McpServerConnectButton.js","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveConnectButton {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nconst CONNECTABLE = new Set([\"disconnected\", \"error\", \"authRequired\"]);\n\nexport const McpServerPrimitiveConnectButton = forwardRef<\n McpServerPrimitiveConnectButton.Element,\n McpServerPrimitiveConnectButton.Props\n>((props, ref) => {\n const state = useAuiState((s) => s.mcpServer.connectionState);\n const aui = useAui();\n if (!CONNECTABLE.has(state)) return null;\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n data-state-hint={state === \"authRequired\" ? \"auth-required\" : undefined}\n onClick={(e) => {\n props.onClick?.(e);\n if (e.defaultPrevented) return;\n void aui.mcpServer().connect();\n }}\n />\n );\n});\n\nMcpServerPrimitiveConnectButton.displayName =\n \"McpServerPrimitive.ConnectButton\";\n"],"mappings":";;;;;AAaA,MAAM,cAAc,IAAI,IAAI;CAAC;CAAgB;CAAS;AAAc,CAAC;AAErE,MAAa,kCAAkC,YAG5C,OAAO,QAAQ;CAChB,MAAM,QAAQ,aAAa,MAAM,EAAE,UAAU,eAAe;CAC5D,MAAM,MAAM,OAAO;CACnB,IAAI,CAAC,YAAY,IAAI,KAAK,GAAG,OAAO;CACpC,OACE,oBAAC,UAAU,QAAX;EACE,GAAI;EACJ,MAAK;EACA;EACL,mBAAiB,UAAU,iBAAiB,kBAAkB,KAAA;EAC9D,UAAU,MAAM;GACd,MAAM,UAAU,CAAC;GACjB,IAAI,EAAE,kBAAkB;GACxB,IAAS,UAAU,EAAE,QAAQ;EAC/B;CACD,CAAA;AAEL,CAAC;AAED,gCAAgC,cAC9B"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/primitives/server/McpServerDisconnectButton.d.ts
|
|
5
|
+
declare namespace McpServerPrimitiveDisconnectButton {
|
|
6
|
+
type Element = ComponentRef<typeof Primitive.button>;
|
|
7
|
+
type Props = ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
declare const McpServerPrimitiveDisconnectButton: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
asChild?: boolean;
|
|
9
11
|
}, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { McpServerPrimitiveDisconnectButton };
|
|
10
14
|
//# sourceMappingURL=McpServerDisconnectButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerDisconnectButton.d.ts","
|
|
1
|
+
{"version":3,"file":"McpServerDisconnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerDisconnectButton.tsx"],"mappings":";;;;kBAQiB,kCAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAKnD,kCAAA,kBAAkC,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
|