@assistant-ui/react-mcp 0.1.20 → 0.1.22
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 +1 -1
- package/dist/auth/createOAuthProvider.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.js +7 -1
- package/dist/auth/createOAuthProvider.js.map +1 -1
- package/dist/context/McpConnectorByIndexProvider.js.map +1 -1
- package/dist/context/McpCustomServerByIndexProvider.js.map +1 -1
- package/dist/context/McpServerByIdProvider.js.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormBearerTokenField.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormCancel.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormError.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormNameField.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.js +14 -5
- package/dist/primitives/addForm/McpAddFormRoot.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormScopesField.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormSubmit.js.map +1 -1
- package/dist/primitives/addForm/McpAddFormUrlField.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveAccept.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveCancel.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveDecline.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveError.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveFields.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveItems.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveMessage.js.map +1 -1
- package/dist/primitives/elicitation/McpElicitationPrimitiveRoot.js.map +1 -1
- package/dist/primitives/manager/McpManagerAddCustomTrigger.js.map +1 -1
- package/dist/primitives/manager/McpManagerRoot.js.map +1 -1
- package/dist/primitives/server/McpServerConnectButton.js.map +1 -1
- package/dist/primitives/server/McpServerDisconnectButton.js.map +1 -1
- package/dist/primitives/server/McpServerError.js.map +1 -1
- package/dist/primitives/server/McpServerIcon.js.map +1 -1
- package/dist/primitives/server/McpServerName.js.map +1 -1
- package/dist/primitives/server/McpServerOAuthLink.js.map +1 -1
- package/dist/primitives/server/McpServerRemoveButton.js.map +1 -1
- package/dist/primitives/server/McpServerRoot.js.map +1 -1
- package/dist/primitives/server/McpServerStatus.js.map +1 -1
- package/dist/primitives/server/McpServerToolName.js.map +1 -1
- package/dist/primitives/server/McpServerTools.js.map +1 -1
- package/dist/resources/McpCustomServerPersistence.d.ts +17 -0
- package/dist/resources/McpCustomServerPersistence.d.ts.map +1 -0
- package/dist/resources/McpCustomServerPersistence.js +192 -0
- package/dist/resources/McpCustomServerPersistence.js.map +1 -0
- package/dist/resources/McpElicitationLifecycle.d.ts +12 -0
- package/dist/resources/McpElicitationLifecycle.d.ts.map +1 -0
- package/dist/resources/McpElicitationLifecycle.js +144 -0
- package/dist/resources/McpElicitationLifecycle.js.map +1 -0
- package/dist/resources/McpManagerResource.d.ts.map +1 -1
- package/dist/resources/McpManagerResource.js +28 -205
- package/dist/resources/McpManagerResource.js.map +1 -1
- package/dist/resources/McpServerResource.d.ts.map +1 -1
- package/dist/resources/McpServerResource.js +24 -101
- package/dist/resources/McpServerResource.js.map +1 -1
- package/dist/resources/storage/McpLocalStorage.d.ts +1 -4
- package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.js +1 -100
- package/dist/resources/storage/McpLocalStorage.js.map +1 -1
- package/dist/resources/storage/McpStoredDataNormalization.d.ts +5 -0
- package/dist/resources/storage/McpStoredDataNormalization.d.ts.map +1 -0
- package/dist/resources/storage/McpStoredDataNormalization.js +95 -0
- package/dist/resources/storage/McpStoredDataNormalization.js.map +1 -0
- package/dist/utils/serverUrl.d.ts +1 -0
- package/dist/utils/serverUrl.d.ts.map +1 -1
- package/dist/utils/serverUrl.js +15 -1
- package/dist/utils/serverUrl.js.map +1 -1
- package/package.json +15 -11
- package/src/auth/createOAuthProvider.test.ts +30 -1
- package/src/auth/createOAuthProvider.ts +12 -4
- package/src/primitives/addForm/McpAddFormRoot.test.tsx +66 -0
- package/src/primitives/addForm/McpAddFormRoot.tsx +11 -1
- package/src/resources/McpCustomServerPersistence.test.ts +56 -0
- package/src/resources/McpCustomServerPersistence.ts +233 -0
- package/src/resources/McpElicitationLifecycle.test.ts +83 -0
- package/src/resources/McpElicitationLifecycle.ts +156 -0
- package/src/resources/McpManagerResource.test.ts +36 -0
- package/src/resources/McpManagerResource.ts +25 -248
- package/src/resources/McpServerResource.test.ts +123 -10
- package/src/resources/McpServerResource.ts +29 -149
- package/src/resources/storage/McpLocalStorage.ts +9 -209
- package/src/resources/storage/McpStoredDataNormalization.test.ts +24 -0
- package/src/resources/storage/McpStoredDataNormalization.ts +201 -0
- package/src/utils/serverUrl.test.ts +30 -0
- package/src/utils/serverUrl.ts +26 -0
package/LICENSE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/createOAuthProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAG1B,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,sCAAmC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAqB;
|
|
1
|
+
{"version":3,"file":"createOAuthProvider.d.ts","sourceRoot":"","sources":["../../src/auth/createOAuthProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAG1B,WAAW,EACZ,MAAM,8BAA8B,CAAC;A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= new TextEncoder().encode(serverId);
|
|
18
18
|
return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;
|
|
19
19
|
}
|
|
20
|
+
function createStateNonce() {
|
|
21
|
+
if (typeof crypto === "undefined") throw new Error("Web Crypto is required to start MCP OAuth");
|
|
22
|
+
if (typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
|
23
|
+
if (typeof crypto.getRandomValues !== "function") throw new Error("Web Crypto is required to start MCP OAuth");
|
|
24
|
+
return bytesToBase64Url(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
|
|
25
|
+
}
|
|
20
26
|
function decodeServerIdFromState(state) {
|
|
21
27
|
if (!state.startsWith(STATE_PREFIX)) return null;
|
|
22
28
|
const dot = state.indexOf(".", 8);
|
|
@@ -202,7 +208,7 @@ function createOAuthProvider(opts) {
|
|
|
202
208
|
return clientMetadata;
|
|
203
209
|
},
|
|
204
210
|
state() {
|
|
205
|
-
const nonce =
|
|
211
|
+
const nonce = createStateNonce();
|
|
206
212
|
pendingState = `${encodeServerIdInState(serverId)}.${nonce}`;
|
|
207
213
|
return pendingState;
|
|
208
214
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOAuthProvider.js","names":["OAuthClientProvider","OAuthClientInformationFull","OAuthClientMetadata","OAuthDiscoveryState","OAuthTokens","MCPStorage","MCPAuthConfig","MCPPersistedAuthState","isAuthStateForServerUrl","normalizeMcpServerUrl","STATE_PREFIX","bytesToBase64Url","bytes","Uint8Array","s","b","String","fromCharCode","btoa","replace","base64UrlToBytes","b64url","padded","repeat","length","bin","atob","out","i","charCodeAt","encodeServerIdInState","serverId","TextEncoder","encode","decodeServerIdFromState","state","startsWith","dot","indexOf","encoded","slice","TextDecoder","fatal","decode","CreateOAuthProviderOptions","serverUrl","config","Extract","type","storage","redirectUri","onAuthorizationUrl","url","URL","OAuthProviderCache","token","tokens","tokensClientId","clientInformation","clientInformationSource","codeVerifier","discoveryState","OAuthConfig","OAuthCredentialState","registeredClientId","client_id","undefined","hasUsableOAuthTokens","clientId","hasUsableRegisteredClientInformation","OAuthProviderEndpointCache","cached","cachePromise","Promise","invalidated","OAuthProviderPersistence","endpoint","queue","anchorByStorage","WeakMap","anchorByScope","Map","WeakRef","anchorRegistry","FinalizationRegistry","scopeId","get","deref","delete","getStorageIdentity","existing","anchor","set","register","persistenceByIdentity","getPersistence","persistence","identity","byServerId","resolve","clearOAuthProviderAuthState","clearAuthState","size","allSettled","createOAuthProvider","opts","normalizedServerUrl","pendingState","configuredClientInformation","ci","redirect_uris","clientSecret","client_secret","clientInformationOverlay","activeClientId","cache","loadCache","then","loadAuthState","persisted","initial","needsMigration","persist","catch","error","task","c","next","Parameters","saveAuthState","clientMetadata","client_name","grant_types","response_types","token_endpoint_auth_method","scope","scopes","join","redirectUrl","nonce","crypto","randomUUID","Date","now","Math","random","saveClientInformation","info","saveTokens","redirectToAuthorization","saveCodeVerifier","Error","saveDiscoveryState","invalidateCredentials"],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type {\n OAuthClientProvider,\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthDiscoveryState,\n OAuthTokens,\n} from \"@modelcontextprotocol/client\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\nimport type { MCPPersistedAuthState } from \"./types\";\nimport {\n isAuthStateForServerUrl,\n normalizeMcpServerUrl,\n} from \"../utils/serverUrl\";\n\nconst STATE_PREFIX = \"aui-mcp:\";\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let s = \"\";\n for (const b of bytes) s += String.fromCharCode(b);\n return btoa(s).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nfunction base64UrlToBytes(b64url: string): Uint8Array {\n const padded =\n b64url.replace(/-/g, \"+\").replace(/_/g, \"/\") +\n \"=\".repeat((4 - (b64url.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n\nfunction encodeServerIdInState(serverId: string): string {\n const bytes = new TextEncoder().encode(serverId);\n return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;\n}\n\nexport function decodeServerIdFromState(state: string): string | null {\n if (!state.startsWith(STATE_PREFIX)) return null;\n const dot = state.indexOf(\".\", STATE_PREFIX.length);\n const encoded =\n dot === -1\n ? state.slice(STATE_PREFIX.length)\n : state.slice(STATE_PREFIX.length, dot);\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(\n base64UrlToBytes(encoded),\n );\n } catch {\n return null;\n }\n}\n\nexport type CreateOAuthProviderOptions = {\n serverId: string;\n serverUrl: string;\n /** Must be `auth.type === \"oauth\"`. */\n config: Extract<MCPAuthConfig, { type: \"oauth\" }>;\n storage: MCPStorage;\n redirectUri: string;\n /** Called by the SDK to start the authorization redirect. */\n onAuthorizationUrl: (url: URL) => void;\n};\n\ntype OAuthProviderCache = {\n token?: string | undefined;\n tokens?: OAuthTokens | undefined;\n tokensClientId?: string | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n clientInformationSource?: MCPPersistedAuthState[\"clientInformationSource\"];\n codeVerifier?: string | undefined;\n state?: string | undefined;\n discoveryState?: OAuthDiscoveryState | undefined;\n};\n\ntype OAuthConfig = Extract<MCPAuthConfig, { type: \"oauth\" }>;\n\ntype OAuthCredentialState = {\n tokens?: OAuthTokens | undefined;\n tokensClientId?: string | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n clientInformationSource?: \"registered\" | undefined;\n};\n\nconst registeredClientId = (\n state: OAuthCredentialState | null | undefined,\n): string | undefined =>\n state?.clientInformationSource === \"registered\"\n ? state.clientInformation?.client_id\n : undefined;\n\nexport const hasUsableOAuthTokens = (\n state: OAuthCredentialState | null | undefined,\n config: OAuthConfig,\n): boolean => {\n const clientId = config.clientId ?? registeredClientId(state);\n return (\n clientId !== undefined &&\n state?.tokens !== undefined &&\n state.tokensClientId === clientId\n );\n};\n\nconst hasUsableRegisteredClientInformation = (\n state: OAuthCredentialState | null | undefined,\n config: OAuthConfig,\n): boolean => {\n const clientId = registeredClientId(state);\n return (\n clientId !== undefined &&\n (config.clientId === undefined || config.clientId === clientId)\n );\n};\n\ntype OAuthProviderEndpointCache = {\n serverUrl: string;\n cached: OAuthProviderCache | null;\n cachePromise: Promise<OAuthProviderCache> | null;\n invalidated: boolean;\n};\n\ntype OAuthProviderPersistence = {\n endpoint: OAuthProviderEndpointCache | null;\n queue: Promise<void>;\n invalidated: boolean;\n};\n\n// scopeId, not object identity, is what addresses the same persisted data, so\n// storages sharing one share an anchor and an unscoped storage is its own\n// identity. Every storage declaring a scope holds that scope's anchor, so the\n// coordination state below is collected once the last of them is gone.\nconst anchorByStorage = new WeakMap<MCPStorage, object>();\nconst anchorByScope = new Map<string, WeakRef<object>>();\nconst anchorRegistry = new FinalizationRegistry<string>((scopeId) => {\n if (!anchorByScope.get(scopeId)?.deref()) anchorByScope.delete(scopeId);\n});\n\nconst getStorageIdentity = (storage: MCPStorage): object => {\n const existing = anchorByStorage.get(storage);\n if (existing) return existing;\n\n const { scopeId } = storage;\n if (scopeId === undefined) return storage;\n\n let anchor = anchorByScope.get(scopeId)?.deref();\n if (!anchor) {\n anchor = {};\n anchorByScope.set(scopeId, new WeakRef(anchor));\n anchorRegistry.register(anchor, scopeId);\n }\n anchorByStorage.set(storage, anchor);\n return anchor;\n};\n\n// McpServerResource builds a fresh provider for every transport, so the cache,\n// the in-flight load, and the write queue have to outlive any one provider.\n// saveAuthState replaces the whole record, so two providers writing their own\n// snapshots concurrently would drop whichever field the loser had added.\nconst persistenceByIdentity = new WeakMap<\n object,\n Map<string, OAuthProviderPersistence>\n>();\n\nconst getPersistence = (\n storage: MCPStorage,\n serverId: string,\n serverUrl: string,\n): {\n persistence: OAuthProviderPersistence;\n endpoint: OAuthProviderEndpointCache;\n} => {\n const identity = getStorageIdentity(storage);\n let byServerId = persistenceByIdentity.get(identity);\n if (!byServerId) {\n byServerId = new Map();\n persistenceByIdentity.set(identity, byServerId);\n }\n\n let persistence = byServerId.get(serverId);\n if (!persistence) {\n persistence = {\n endpoint: null,\n queue: Promise.resolve(),\n invalidated: false,\n };\n byServerId.set(serverId, persistence);\n }\n\n let endpoint = persistence.endpoint;\n if (endpoint?.serverUrl !== serverUrl) {\n if (endpoint) endpoint.invalidated = true;\n endpoint = {\n serverUrl,\n cached: null,\n cachePromise: null,\n invalidated: false,\n };\n persistence.endpoint = endpoint;\n }\n return { persistence, endpoint };\n};\n\n/**\n * Clears persisted OAuth state after the in-flight load and every queued write\n * for that server have settled, so a discarded provider cannot recreate the\n * record it was mid-save on.\n */\nexport const clearOAuthProviderAuthState = async (\n storage: MCPStorage,\n serverId: string,\n): Promise<void> => {\n const identity = getStorageIdentity(storage);\n const byServerId = persistenceByIdentity.get(identity);\n const persistence = byServerId?.get(serverId);\n if (!byServerId || !persistence) {\n await storage.clearAuthState(serverId);\n return;\n }\n\n // Detaching the entry before awaiting keeps a provider built during the clear\n // on a fresh generation instead of inheriting the fenced one.\n persistence.invalidated = true;\n byServerId.delete(serverId);\n if (byServerId.size === 0) persistenceByIdentity.delete(identity);\n\n if (persistence.endpoint) persistence.endpoint.invalidated = true;\n const cachePromise = persistence.endpoint?.cachePromise;\n if (cachePromise) await Promise.allSettled([cachePromise]);\n await persistence.queue;\n await storage.clearAuthState(serverId);\n};\n\n/**\n * Builds an OAuthClientProvider for the MCP SDK, backed by MCPStorage.\n * Token refresh and DCR are handled by the SDK; this provider only mediates\n * load/save and the redirect step.\n */\nexport function createOAuthProvider(\n opts: CreateOAuthProviderOptions,\n): OAuthClientProvider {\n const {\n serverId,\n serverUrl,\n config,\n storage,\n redirectUri,\n onAuthorizationUrl,\n } = opts;\n const normalizedServerUrl = normalizeMcpServerUrl(serverUrl);\n const { persistence, endpoint } = getPersistence(\n storage,\n serverId,\n normalizedServerUrl,\n );\n let pendingState: string | undefined;\n\n // The cache is shared with every other provider for this storage, server id,\n // and server URL, so a statically configured client stays a read-time overlay\n // owned by this provider. Writing it into the cache would leak this provider's\n // registration to a replacement built for a different, or absent, clientId.\n // The SDK's write-backs, its issuer stamp included, replace the overlay.\n const configuredClientInformation = ():\n | OAuthClientInformationFull\n | undefined => {\n if (!config.clientId) return undefined;\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n return ci;\n };\n let clientInformationOverlay = configuredClientInformation();\n\n const activeClientId = (cache: OAuthProviderCache): string | undefined =>\n clientInformationOverlay?.client_id ?? registeredClientId(cache);\n\n const loadCache = (): Promise<OAuthProviderCache> => {\n if (endpoint.invalidated) return Promise.resolve({});\n if (endpoint.cached) return Promise.resolve(endpoint.cached);\n if (endpoint.cachePromise) return endpoint.cachePromise;\n\n endpoint.cachePromise = persistence.queue\n .then(() => storage.loadAuthState(serverId))\n .then(\n async (persisted) => {\n const initial: OAuthProviderCache = {};\n let needsMigration = false;\n if (endpoint.invalidated) return initial;\n if (\n persisted &&\n isAuthStateForServerUrl(persisted, normalizedServerUrl)\n ) {\n if (\n hasUsableRegisteredClientInformation(persisted, config) &&\n persisted.clientInformation\n ) {\n initial.clientInformation = persisted.clientInformation;\n initial.clientInformationSource = \"registered\";\n } else if (\n persisted?.clientInformation ||\n persisted?.clientInformationSource !== undefined\n ) {\n needsMigration = true;\n }\n if (hasUsableOAuthTokens(persisted, config)) {\n initial.tokens = persisted.tokens;\n initial.tokensClientId = persisted.tokensClientId;\n } else if (\n persisted?.tokens ||\n persisted?.tokensClientId !== undefined\n ) {\n needsMigration = true;\n }\n if (persisted?.token) initial.token = persisted.token;\n if (persisted?.codeVerifier)\n initial.codeVerifier = persisted.codeVerifier;\n if (persisted?.state) initial.state = persisted.state;\n if (persisted?.discoveryState)\n initial.discoveryState = persisted.discoveryState;\n }\n endpoint.cached = initial;\n if (needsMigration) await persist().catch(() => {});\n return initial;\n },\n (error) => {\n endpoint.cachePromise = null;\n throw error;\n },\n );\n return endpoint.cachePromise;\n };\n\n function persist() {\n const task = persistence.queue.then(async () => {\n if (persistence.invalidated || endpoint.invalidated) return;\n const c = endpoint.cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (hasUsableOAuthTokens(c, config) && c.tokens && c.tokensClientId) {\n next.tokens = c.tokens;\n next.tokensClientId = c.tokensClientId;\n }\n if (c.clientInformation && c.clientInformationSource === \"registered\") {\n next.clientInformation = c.clientInformation;\n next.clientInformationSource = \"registered\";\n }\n if (c.token) next.token = c.token;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n if (c.state) next.state = c.state;\n if (c.discoveryState) next.discoveryState = c.discoveryState;\n next.serverUrl = normalizedServerUrl;\n await storage.saveAuthState(serverId, next);\n });\n persistence.queue = task.catch(() => {});\n return task;\n }\n\n const clientMetadata: OAuthClientMetadata = {\n client_name: \"assistant-ui\",\n redirect_uris: [redirectUri],\n grant_types: [\"authorization_code\", \"refresh_token\"],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\",\n scope: config.scopes?.join(\" \"),\n };\n\n return {\n get redirectUrl() {\n return redirectUri;\n },\n get clientMetadata() {\n return clientMetadata;\n },\n state() {\n // Embed the server id so the callback handler can route it back to the\n // right MCPServerResource without app-level wiring.\n const nonce =\n typeof crypto !== \"undefined\" && \"randomUUID\" in crypto\n ? crypto.randomUUID()\n : `${Date.now()}.${Math.random()}`;\n pendingState = `${encodeServerIdInState(serverId)}.${nonce}`;\n return pendingState;\n },\n async clientInformation() {\n const c = await loadCache();\n if (clientInformationOverlay) return clientInformationOverlay;\n if (c.clientInformationSource !== \"registered\") return undefined;\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n if (clientInformationOverlay) {\n clientInformationOverlay = info as OAuthClientInformationFull;\n return;\n }\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n c.clientInformationSource = \"registered\";\n if (c.tokensClientId !== c.clientInformation.client_id) {\n delete c.tokens;\n delete c.tokensClientId;\n }\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n const clientId = activeClientId(c);\n if (clientId === undefined || c.tokensClientId !== clientId)\n return undefined;\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\n const clientId = activeClientId(c);\n if (clientId) c.tokensClientId = clientId;\n else delete c.tokensClientId;\n delete c.state;\n await persist();\n },\n async redirectToAuthorization(url) {\n onAuthorizationUrl(url);\n },\n async saveCodeVerifier(codeVerifier) {\n const c = await loadCache();\n c.codeVerifier = codeVerifier;\n if (pendingState) {\n c.state = pendingState;\n pendingState = undefined;\n }\n await persist();\n },\n async codeVerifier() {\n const c = await loadCache();\n if (!c.codeVerifier) {\n throw new Error(\"No code verifier saved for this OAuth flow\");\n }\n return c.codeVerifier;\n },\n async saveDiscoveryState(discoveryState) {\n const c = await loadCache();\n c.discoveryState = discoveryState;\n await persist();\n },\n async discoveryState() {\n const c = await loadCache();\n return c.discoveryState;\n },\n async invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") {\n delete c.tokens;\n delete c.tokensClientId;\n }\n if (scope === \"all\" || scope === \"client\") {\n delete c.clientInformation;\n delete c.clientInformationSource;\n if (!config.clientId) {\n delete c.tokens;\n delete c.tokensClientId;\n }\n clientInformationOverlay = configuredClientInformation();\n }\n if (scope === \"all\" || scope === \"verifier\") {\n delete c.codeVerifier;\n delete c.state;\n }\n if (scope === \"all\" || scope === \"discovery\") delete c.discoveryState;\n await persist();\n },\n };\n}\n"],"mappings":";;AAeA,MAAMU,eAAe;AAErB,SAASC,iBAAiBC,OAA2B;CACnD,IAAIE,IAAI;CACR,KAAK,MAAMC,KAAKH,OAAOE,KAAKE,OAAOC,aAAaF,CAAC;CACjD,OAAOG,KAAKJ,CAAC,CAAC,CAACK,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,EAA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GAC1BU,EAAElE,eAAeA;GACjB,IAAI+C,cAAc;IAChBmB,EAAE3F,QAAQwE;IACVA,eAAezC,KAAAA;GACjB;GACA,MAAMwD,QAAQ;EAChB;EACA,MAAM9D,eAAe;GACnB,MAAMkE,IAAI,MAAMV,UAAU;GAC1B,IAAI,CAACU,EAAElE,cACL,MAAM,IAAI2F,MAAM,4CAA4C;GAE9D,OAAOzB,EAAElE;EACX;EACA,MAAM4F,mBAAmB3F,gBAAgB;GACvC,MAAMiE,IAAI,MAAMV,UAAU;GAC1BU,EAAEjE,iBAAiBA;GACnB,MAAM6D,QAAQ;EAChB;EACA,MAAM7D,iBAAiB;GAErB,QAAOiE,MADSV,UAAU,EAAA,CACjBvD;EACX;EACA,MAAM4F,sBAAsBlB,OAAO;GACjC,MAAMT,IAAI,MAAMV,UAAU;GAC1B,IAAImB,UAAU,SAASA,UAAU,UAAU;IACzC,OAAOT,EAAEtE;IACT,OAAOsE,EAAErE;GACX;GACA,IAAI8E,UAAU,SAASA,UAAU,UAAU;IACzC,OAAOT,EAAEpE;IACT,OAAOoE,EAAEnE;IACT,IAAI,CAACb,OAAOsB,UAAU;KACpB,OAAO0D,EAAEtE;KACT,OAAOsE,EAAErE;IACX;IACAwD,2BAA2BL,4BAA4B;GACzD;GACA,IAAI2B,UAAU,SAASA,UAAU,YAAY;IAC3C,OAAOT,EAAElE;IACT,OAAOkE,EAAE3F;GACX;GACA,IAAIoG,UAAU,SAASA,UAAU,aAAa,OAAOT,EAAEjE;GACvD,MAAM6D,QAAQ;EAChB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"createOAuthProvider.js","names":["OAuthClientProvider","OAuthClientInformationFull","OAuthClientMetadata","OAuthDiscoveryState","OAuthTokens","MCPStorage","MCPAuthConfig","MCPPersistedAuthState","isAuthStateForServerUrl","normalizeMcpServerUrl","STATE_PREFIX","bytesToBase64Url","bytes","Uint8Array","s","b","String","fromCharCode","btoa","replace","base64UrlToBytes","b64url","padded","repeat","length","bin","atob","out","i","charCodeAt","encodeServerIdInState","serverId","TextEncoder","encode","createStateNonce","crypto","Error","randomUUID","getRandomValues","decodeServerIdFromState","state","startsWith","dot","indexOf","encoded","slice","TextDecoder","fatal","decode","CreateOAuthProviderOptions","serverUrl","config","Extract","type","storage","redirectUri","onAuthorizationUrl","url","URL","OAuthProviderCache","token","tokens","tokensClientId","clientInformation","clientInformationSource","codeVerifier","discoveryState","OAuthConfig","OAuthCredentialState","registeredClientId","client_id","undefined","hasUsableOAuthTokens","clientId","hasUsableRegisteredClientInformation","OAuthProviderEndpointCache","cached","cachePromise","Promise","invalidated","OAuthProviderPersistence","endpoint","queue","anchorByStorage","WeakMap","anchorByScope","Map","WeakRef","anchorRegistry","FinalizationRegistry","scopeId","get","deref","delete","getStorageIdentity","existing","anchor","set","register","persistenceByIdentity","getPersistence","persistence","identity","byServerId","resolve","clearOAuthProviderAuthState","clearAuthState","size","allSettled","createOAuthProvider","opts","normalizedServerUrl","pendingState","configuredClientInformation","ci","redirect_uris","clientSecret","client_secret","clientInformationOverlay","activeClientId","cache","loadCache","then","loadAuthState","persisted","initial","needsMigration","persist","catch","error","task","c","next","Parameters","saveAuthState","clientMetadata","client_name","grant_types","response_types","token_endpoint_auth_method","scope","scopes","join","redirectUrl","nonce","saveClientInformation","info","saveTokens","redirectToAuthorization","saveCodeVerifier","saveDiscoveryState","invalidateCredentials"],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type {\n OAuthClientProvider,\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthDiscoveryState,\n OAuthTokens,\n} from \"@modelcontextprotocol/client\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\nimport type { MCPPersistedAuthState } from \"./types\";\nimport {\n isAuthStateForServerUrl,\n normalizeMcpServerUrl,\n} from \"../utils/serverUrl\";\n\nconst STATE_PREFIX = \"aui-mcp:\";\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let s = \"\";\n for (const b of bytes) s += String.fromCharCode(b);\n return btoa(s).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nfunction base64UrlToBytes(b64url: string): Uint8Array {\n const padded =\n b64url.replace(/-/g, \"+\").replace(/_/g, \"/\") +\n \"=\".repeat((4 - (b64url.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n\nfunction encodeServerIdInState(serverId: string): string {\n const bytes = new TextEncoder().encode(serverId);\n return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;\n}\n\nfunction createStateNonce(): string {\n if (typeof crypto === \"undefined\") {\n throw new Error(\"Web Crypto is required to start MCP OAuth\");\n }\n if (typeof crypto.randomUUID === \"function\") return crypto.randomUUID();\n if (typeof crypto.getRandomValues !== \"function\") {\n throw new Error(\"Web Crypto is required to start MCP OAuth\");\n }\n return bytesToBase64Url(crypto.getRandomValues(new Uint8Array(32)));\n}\n\nexport function decodeServerIdFromState(state: string): string | null {\n if (!state.startsWith(STATE_PREFIX)) return null;\n const dot = state.indexOf(\".\", STATE_PREFIX.length);\n const encoded =\n dot === -1\n ? state.slice(STATE_PREFIX.length)\n : state.slice(STATE_PREFIX.length, dot);\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(\n base64UrlToBytes(encoded),\n );\n } catch {\n return null;\n }\n}\n\nexport type CreateOAuthProviderOptions = {\n serverId: string;\n serverUrl: string;\n /** Must be `auth.type === \"oauth\"`. */\n config: Extract<MCPAuthConfig, { type: \"oauth\" }>;\n storage: MCPStorage;\n redirectUri: string;\n /** Called by the SDK to start the authorization redirect. */\n onAuthorizationUrl: (url: URL) => void;\n};\n\ntype OAuthProviderCache = {\n token?: string | undefined;\n tokens?: OAuthTokens | undefined;\n tokensClientId?: string | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n clientInformationSource?: MCPPersistedAuthState[\"clientInformationSource\"];\n codeVerifier?: string | undefined;\n state?: string | undefined;\n discoveryState?: OAuthDiscoveryState | undefined;\n};\n\ntype OAuthConfig = Extract<MCPAuthConfig, { type: \"oauth\" }>;\n\ntype OAuthCredentialState = {\n tokens?: OAuthTokens | undefined;\n tokensClientId?: string | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n clientInformationSource?: \"registered\" | undefined;\n};\n\nconst registeredClientId = (\n state: OAuthCredentialState | null | undefined,\n): string | undefined =>\n state?.clientInformationSource === \"registered\"\n ? state.clientInformation?.client_id\n : undefined;\n\nexport const hasUsableOAuthTokens = (\n state: OAuthCredentialState | null | undefined,\n config: OAuthConfig,\n): boolean => {\n const clientId = config.clientId ?? registeredClientId(state);\n return (\n clientId !== undefined &&\n state?.tokens !== undefined &&\n state.tokensClientId === clientId\n );\n};\n\nconst hasUsableRegisteredClientInformation = (\n state: OAuthCredentialState | null | undefined,\n config: OAuthConfig,\n): boolean => {\n const clientId = registeredClientId(state);\n return (\n clientId !== undefined &&\n (config.clientId === undefined || config.clientId === clientId)\n );\n};\n\ntype OAuthProviderEndpointCache = {\n serverUrl: string;\n cached: OAuthProviderCache | null;\n cachePromise: Promise<OAuthProviderCache> | null;\n invalidated: boolean;\n};\n\ntype OAuthProviderPersistence = {\n endpoint: OAuthProviderEndpointCache | null;\n queue: Promise<void>;\n invalidated: boolean;\n};\n\n// scopeId, not object identity, is what addresses the same persisted data, so\n// storages sharing one share an anchor and an unscoped storage is its own\n// identity. Every storage declaring a scope holds that scope's anchor, so the\n// coordination state below is collected once the last of them is gone.\nconst anchorByStorage = new WeakMap<MCPStorage, object>();\nconst anchorByScope = new Map<string, WeakRef<object>>();\nconst anchorRegistry = new FinalizationRegistry<string>((scopeId) => {\n if (!anchorByScope.get(scopeId)?.deref()) anchorByScope.delete(scopeId);\n});\n\nconst getStorageIdentity = (storage: MCPStorage): object => {\n const existing = anchorByStorage.get(storage);\n if (existing) return existing;\n\n const { scopeId } = storage;\n if (scopeId === undefined) return storage;\n\n let anchor = anchorByScope.get(scopeId)?.deref();\n if (!anchor) {\n anchor = {};\n anchorByScope.set(scopeId, new WeakRef(anchor));\n anchorRegistry.register(anchor, scopeId);\n }\n anchorByStorage.set(storage, anchor);\n return anchor;\n};\n\n// McpServerResource builds a fresh provider for every transport, so the cache,\n// the in-flight load, and the write queue have to outlive any one provider.\n// saveAuthState replaces the whole record, so two providers writing their own\n// snapshots concurrently would drop whichever field the loser had added.\nconst persistenceByIdentity = new WeakMap<\n object,\n Map<string, OAuthProviderPersistence>\n>();\n\nconst getPersistence = (\n storage: MCPStorage,\n serverId: string,\n serverUrl: string,\n): {\n persistence: OAuthProviderPersistence;\n endpoint: OAuthProviderEndpointCache;\n} => {\n const identity = getStorageIdentity(storage);\n let byServerId = persistenceByIdentity.get(identity);\n if (!byServerId) {\n byServerId = new Map();\n persistenceByIdentity.set(identity, byServerId);\n }\n\n let persistence = byServerId.get(serverId);\n if (!persistence) {\n persistence = {\n endpoint: null,\n queue: Promise.resolve(),\n invalidated: false,\n };\n byServerId.set(serverId, persistence);\n }\n\n let endpoint = persistence.endpoint;\n if (endpoint?.serverUrl !== serverUrl) {\n if (endpoint) endpoint.invalidated = true;\n endpoint = {\n serverUrl,\n cached: null,\n cachePromise: null,\n invalidated: false,\n };\n persistence.endpoint = endpoint;\n }\n return { persistence, endpoint };\n};\n\n/**\n * Clears persisted OAuth state after the in-flight load and every queued write\n * for that server have settled, so a discarded provider cannot recreate the\n * record it was mid-save on.\n */\nexport const clearOAuthProviderAuthState = async (\n storage: MCPStorage,\n serverId: string,\n): Promise<void> => {\n const identity = getStorageIdentity(storage);\n const byServerId = persistenceByIdentity.get(identity);\n const persistence = byServerId?.get(serverId);\n if (!byServerId || !persistence) {\n await storage.clearAuthState(serverId);\n return;\n }\n\n // Detaching the entry before awaiting keeps a provider built during the clear\n // on a fresh generation instead of inheriting the fenced one.\n persistence.invalidated = true;\n byServerId.delete(serverId);\n if (byServerId.size === 0) persistenceByIdentity.delete(identity);\n\n if (persistence.endpoint) persistence.endpoint.invalidated = true;\n const cachePromise = persistence.endpoint?.cachePromise;\n if (cachePromise) await Promise.allSettled([cachePromise]);\n await persistence.queue;\n await storage.clearAuthState(serverId);\n};\n\n/**\n * Builds an OAuthClientProvider for the MCP SDK, backed by MCPStorage.\n * Token refresh and DCR are handled by the SDK; this provider only mediates\n * load/save and the redirect step.\n */\nexport function createOAuthProvider(\n opts: CreateOAuthProviderOptions,\n): OAuthClientProvider {\n const {\n serverId,\n serverUrl,\n config,\n storage,\n redirectUri,\n onAuthorizationUrl,\n } = opts;\n const normalizedServerUrl = normalizeMcpServerUrl(serverUrl);\n const { persistence, endpoint } = getPersistence(\n storage,\n serverId,\n normalizedServerUrl,\n );\n let pendingState: string | undefined;\n\n // The cache is shared with every other provider for this storage, server id,\n // and server URL, so a statically configured client stays a read-time overlay\n // owned by this provider. Writing it into the cache would leak this provider's\n // registration to a replacement built for a different, or absent, clientId.\n // The SDK's write-backs, its issuer stamp included, replace the overlay.\n const configuredClientInformation = ():\n | OAuthClientInformationFull\n | undefined => {\n if (!config.clientId) return undefined;\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n return ci;\n };\n let clientInformationOverlay = configuredClientInformation();\n\n const activeClientId = (cache: OAuthProviderCache): string | undefined =>\n clientInformationOverlay?.client_id ?? registeredClientId(cache);\n\n const loadCache = (): Promise<OAuthProviderCache> => {\n if (endpoint.invalidated) return Promise.resolve({});\n if (endpoint.cached) return Promise.resolve(endpoint.cached);\n if (endpoint.cachePromise) return endpoint.cachePromise;\n\n endpoint.cachePromise = persistence.queue\n .then(() => storage.loadAuthState(serverId))\n .then(\n async (persisted) => {\n const initial: OAuthProviderCache = {};\n let needsMigration = false;\n if (endpoint.invalidated) return initial;\n if (\n persisted &&\n isAuthStateForServerUrl(persisted, normalizedServerUrl)\n ) {\n if (\n hasUsableRegisteredClientInformation(persisted, config) &&\n persisted.clientInformation\n ) {\n initial.clientInformation = persisted.clientInformation;\n initial.clientInformationSource = \"registered\";\n } else if (\n persisted?.clientInformation ||\n persisted?.clientInformationSource !== undefined\n ) {\n needsMigration = true;\n }\n if (hasUsableOAuthTokens(persisted, config)) {\n initial.tokens = persisted.tokens;\n initial.tokensClientId = persisted.tokensClientId;\n } else if (\n persisted?.tokens ||\n persisted?.tokensClientId !== undefined\n ) {\n needsMigration = true;\n }\n if (persisted?.token) initial.token = persisted.token;\n if (persisted?.codeVerifier)\n initial.codeVerifier = persisted.codeVerifier;\n if (persisted?.state) initial.state = persisted.state;\n if (persisted?.discoveryState)\n initial.discoveryState = persisted.discoveryState;\n }\n endpoint.cached = initial;\n if (needsMigration) await persist().catch(() => {});\n return initial;\n },\n (error) => {\n endpoint.cachePromise = null;\n throw error;\n },\n );\n return endpoint.cachePromise;\n };\n\n function persist() {\n const task = persistence.queue.then(async () => {\n if (persistence.invalidated || endpoint.invalidated) return;\n const c = endpoint.cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (hasUsableOAuthTokens(c, config) && c.tokens && c.tokensClientId) {\n next.tokens = c.tokens;\n next.tokensClientId = c.tokensClientId;\n }\n if (c.clientInformation && c.clientInformationSource === \"registered\") {\n next.clientInformation = c.clientInformation;\n next.clientInformationSource = \"registered\";\n }\n if (c.token) next.token = c.token;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n if (c.state) next.state = c.state;\n if (c.discoveryState) next.discoveryState = c.discoveryState;\n next.serverUrl = normalizedServerUrl;\n await storage.saveAuthState(serverId, next);\n });\n persistence.queue = task.catch(() => {});\n return task;\n }\n\n const clientMetadata: OAuthClientMetadata = {\n client_name: \"assistant-ui\",\n redirect_uris: [redirectUri],\n grant_types: [\"authorization_code\", \"refresh_token\"],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\",\n scope: config.scopes?.join(\" \"),\n };\n\n return {\n get redirectUrl() {\n return redirectUri;\n },\n get clientMetadata() {\n return clientMetadata;\n },\n state() {\n // Embed the server id so the callback handler can route it back to the\n // right MCPServerResource without app-level wiring.\n const nonce = createStateNonce();\n pendingState = `${encodeServerIdInState(serverId)}.${nonce}`;\n return pendingState;\n },\n async clientInformation() {\n const c = await loadCache();\n if (clientInformationOverlay) return clientInformationOverlay;\n if (c.clientInformationSource !== \"registered\") return undefined;\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n if (clientInformationOverlay) {\n clientInformationOverlay = info as OAuthClientInformationFull;\n return;\n }\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n c.clientInformationSource = \"registered\";\n if (c.tokensClientId !== c.clientInformation.client_id) {\n delete c.tokens;\n delete c.tokensClientId;\n }\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n const clientId = activeClientId(c);\n if (clientId === undefined || c.tokensClientId !== clientId)\n return undefined;\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\n const clientId = activeClientId(c);\n if (clientId) c.tokensClientId = clientId;\n else delete c.tokensClientId;\n delete c.state;\n await persist();\n },\n async redirectToAuthorization(url) {\n onAuthorizationUrl(url);\n },\n async saveCodeVerifier(codeVerifier) {\n const c = await loadCache();\n c.codeVerifier = codeVerifier;\n if (pendingState) {\n c.state = pendingState;\n pendingState = undefined;\n }\n await persist();\n },\n async codeVerifier() {\n const c = await loadCache();\n if (!c.codeVerifier) {\n throw new Error(\"No code verifier saved for this OAuth flow\");\n }\n return c.codeVerifier;\n },\n async saveDiscoveryState(discoveryState) {\n const c = await loadCache();\n c.discoveryState = discoveryState;\n await persist();\n },\n async discoveryState() {\n const c = await loadCache();\n return c.discoveryState;\n },\n async invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") {\n delete c.tokens;\n delete c.tokensClientId;\n }\n if (scope === \"all\" || scope === \"client\") {\n delete c.clientInformation;\n delete c.clientInformationSource;\n if (!config.clientId) {\n delete c.tokens;\n delete c.tokensClientId;\n }\n clientInformationOverlay = configuredClientInformation();\n }\n if (scope === \"all\" || scope === \"verifier\") {\n delete c.codeVerifier;\n delete c.state;\n }\n if (scope === \"all\" || scope === \"discovery\") delete c.discoveryState;\n await persist();\n },\n };\n}\n"],"mappings":";;AAeA,MAAMU,eAAe;AAErB,SAASC,iBAAiBC,OAA2B;CACnD,IAAIE,IAAI;CACR,KAAK,MAAMC,KAAKH,OAAOE,KAAKE,OAAOC,aAAaF,CAAC;CACjD,OAAOG,KAAKJ,CAAC,CAAC,CAACK,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,EAAE;AAC1E;AAEA,SAASC,iBAAiBC,QAA4B;CACpD,MAAMC,SACJD,OAAOF,QAAQ,MAAM,GAAG,CAAC,CAACA,QAAQ,MAAM,GAAG,IAC3C,IAAII,QAAQ,IAAKF,OAAOG,SAAS,KAAM,CAAC;CAC1C,MAAMC,MAAMC,KAAKJ,MAAM;CACvB,MAAMK,MAAM,IAAId,WAAWY,IAAID,MAAM;CACrC,KAAK,IAAII,IAAI,GAAGA,IAAIH,IAAID,QAAQI,KAAKD,IAAIC,KAAKH,IAAII,WAAWD,CAAC;CAC9D,OAAOD;AACT;AAEA,SAASG,sBAAsBC,UAA0B;CACvD,MAAMnB,QAAQ,IAAIoB,YAAY,CAAC,CAACC,OAAOF,QAAQ;CAC/C,OAAO,GAAGrB,eAAeC,iBAAiBC,KAAK;AACjD;AAEA,SAASsB,mBAA2B;CAClC,IAAI,OAAOC,WAAW,aACpB,MAAM,IAAIC,MAAM,2CAA2C;CAE7D,IAAI,OAAOD,OAAOE,eAAe,YAAY,OAAOF,OAAOE,WAAW;CACtE,IAAI,OAAOF,OAAOG,oBAAoB,YACpC,MAAM,IAAIF,MAAM,2CAA2C;CAE7D,OAAOzB,iBAAiBwB,OAAOG,gCAAgB,IAAIzB,WAAW,EAAE,CAAC,CAAC;AACpE;AAEA,SAAgB0B,wBAAwB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AAU,SAASA,UAAU,UAAU;IACzC,OAAOT,EAAEpE;IACT,OAAOoE,EAAEnE;IACT,IAAI,CAACb,OAAOsB,UAAU;KACpB,OAAO0D,EAAEtE;KACT,OAAOsE,EAAErE;IACX;IACAwD,2BAA2BL,4BAA4B;GACzD;GACA,IAAI2B,UAAU,SAASA,UAAU,YAAY;IAC3C,OAAOT,EAAElE;IACT,OAAOkE,EAAE3F;GACX;GACA,IAAIoG,UAAU,SAASA,UAAU,aAAa,OAAOT,EAAEjE;GACvD,MAAM6D,QAAQ;EAChB;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpConnectorByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpConnectorByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","connector","config","t2"],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp.connector({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,+BAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAWV;GAAQ;GAACW,MAC9BC,WAAYA,OAAMC,IAAIC,UAAW,EAAAd,MAAQ,CAAC;EACjD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
|
|
1
|
+
{"version":3,"file":"McpConnectorByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpConnectorByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","connector","config","t2","_c"],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp.connector({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,+BAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAWV;GAAQ;GAACW,MAC9BC,WAAYA,OAAMC,IAAIC,UAAW,EAAAd,MAAQ,CAAC;EACjD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpCustomServerByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpCustomServerByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","customServer","config","t2"],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp.customServer({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,kCAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAQV;GAAQ;GAACW,MAC3BC,WAAYA,OAAMC,IAAIC,aAAc,EAAAd,MAAQ,CAAC;EACpD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
|
|
1
|
+
{"version":3,"file":"McpCustomServerByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpCustomServerByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","customServer","config","t2","_c"],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp.customServer({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,kCAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAQV;GAAQ;GAACW,MAC3BC,WAAYA,OAAMC,IAAIC,aAAc,EAAAd,MAAQ,CAAC;EACpD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerByIdProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpServerByIdProvider","id","t0","$","_c","children","aui","t1","mcpServer","source","query","get","parent","mcp","server","config","t2"],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp.server({ id }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,yBAA+DE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,IAAAI,aAAAH;CAI3E,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,IAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN,EAAAT,GAAK;GAACU,MACRC,WAAYA,OAAMC,IAAIC,OAAQ,EAAAb,GAAK,CAAC;EAC3C,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAY,SAAeR;CAMZ,IAAAS;CAAA,IAAAb,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAY,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBV,SAAAA;GAAaS;GAChCV;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAFda;AAEc"}
|
|
1
|
+
{"version":3,"file":"McpServerByIdProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpServerByIdProvider","id","t0","$","_c","children","aui","t1","mcpServer","source","query","get","parent","mcp","server","config","t2","_c"],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp.server({ id }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,yBAA+DE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,IAAAI,aAAAH;CAI3E,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,IAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN,EAAAT,GAAK;GAACU,MACRC,WAAYA,OAAMC,IAAIC,OAAQ,EAAAb,GAAK,CAAC;EAC3C,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAY,SAAeR;CAMZ,IAAAS;CAAA,IAAAb,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAY,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBV,SAAAA;GAAaS;GAChCV;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAFda;AAEc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useInsertionEffect","useRef","useState","useAui","decodeServerIdFromState","invokeMcpCallback","createMcpOAuthCallbackError","err","serverId","Error","message","String","cause","UseMcpOAuthCallbackOptions","url","onComplete","onError","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","superseded","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import {\n type FC,\n type ReactNode,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\nimport { invokeMcpCallback } from \"../utils/invokeMcpCallback\";\n\nexport const createMcpOAuthCallbackError = (\n err: unknown,\n serverId: string | null,\n): Error => {\n const message = err instanceof Error ? err.message : String(err);\n if (serverId) {\n return new Error(\n `MCP OAuth callback for server \"${serverId}\" failed: ${message}`,\n { cause: err },\n );\n }\n return new Error(`MCP OAuth callback failed: ${message}`, { cause: err });\n};\n\nexport type UseMcpOAuthCallbackOptions = {\n /** Defaults to `window.location.href`. */\n url?: string;\n onComplete?: (serverId: string) => void;\n onError?: (err: Error) => void;\n};\n\nexport type UseMcpOAuthCallbackResult = {\n status: \"idle\" | \"running\" | \"done\" | \"error\";\n serverId: string | null;\n error: Error | null;\n};\n\nexport function useMcpOAuthCallback(\n opts: UseMcpOAuthCallbackOptions = {},\n): UseMcpOAuthCallbackResult {\n const aui = useAui();\n const [result, setResult] = useState<UseMcpOAuthCallbackResult>({\n status: \"idle\",\n serverId: null,\n error: null,\n });\n // Guard against React 18 Strict Mode's mount-unmount-remount: the effect\n // body must not run completeAuth twice for the same URL, otherwise the\n // single-use OAuth code is double-redeemed and the second attempt 4xxs.\n const startedRef = useRef<string | null>(null);\n const optsRef = useRef(opts);\n useInsertionEffect(() => {\n optsRef.current = opts;\n });\n\n useEffect(() => {\n const url =\n opts.url ?? (typeof window !== \"undefined\" ? window.location.href : null);\n if (!url) return;\n if (startedRef.current === url) return;\n startedRef.current = url;\n\n // A callback page can be handed a second login URL while the first\n // completeAuth is still in flight. That attempt keeps running, so it\n // publishes only while its own URL is still the one being attempted;\n // otherwise an older failure would overwrite the newer attempt's success.\n // The check is against `startedRef` rather than a teardown flag so that\n // Strict Mode's unmount-remount, which starts no new attempt, still\n // publishes the result of the one already running.\n const superseded = () => startedRef.current !== url;\n\n void (async () => {\n let serverId: string | null = null;\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n if (state) serverId = decodeServerIdFromState(state);\n if (!state) throw new Error('missing \"state\" parameter');\n if (!serverId) {\n throw new Error(\"state was not created by assistant-ui MCP\");\n }\n if (superseded()) return;\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp.server({ id: serverId }).completeAuth(url);\n if (superseded()) return;\n setResult({ status: \"done\", serverId, error: null });\n } catch (err) {\n if (superseded()) return;\n const error = createMcpOAuthCallbackError(err, serverId);\n setResult({ status: \"error\", serverId, error });\n invokeMcpCallback(\"onError\", optsRef.current.onError, error);\n return;\n }\n\n invokeMcpCallback(\"onComplete\", optsRef.current.onComplete, serverId);\n })();\n }, [aui, opts.url]);\n\n return result;\n}\n\nexport const McpOAuthCallback: FC<\n UseMcpOAuthCallbackOptions & {\n children?: (result: UseMcpOAuthCallbackResult) => ReactNode;\n }\n> = ({ children, ...opts }) => {\n const result = useMcpOAuthCallback(opts);\n if (children) return <>{children(result)}</>;\n return null;\n};\n"],"mappings":";;;;;;;AAYA,MAAaS,+BACXC,KACAC,aACU;CACV,MAAME,UAAUH,eAAeE,QAAQF,IAAIG,UAAUC,OAAOJ,GAAG;CAC/D,IAAIC,UACF,OAAO,IAAIC,MACT,kCAAkCD,SAAQ,YAAaE,WACvD,EAAEE,OAAOL,IAAI,CACf;CAEF,OAAO,IAAIE,MAAM,8BAA8BC,WAAW,EAAEE,OAAOL,IAAI,CAAC;AAC1E;AAeA,SAAgBa,oBACdC,OAAmC,CAAC,GACT;CAC3B,MAAMC,MAAMnB,OAAO;CACnB,MAAM,CAACoB,QAAQC,aAAatB,SAAoC;EAC9DgB,QAAQ;EACRV,UAAU;EACVW,OAAO;CACT,CAAC;CAID,MAAMM,aAAaxB,OAAsB,IAAI;CAC7C,MAAMyB,UAAUzB,OAAOoB,IAAI;CAC3BrB,yBAAyB;EACvB0B,QAAQC,UAAUN;CACpB,CAAC;CAEDtB,gBAAgB;EACd,MAAMe,MACJO,KAAKP,QAAQ,OAAOc,WAAW,cAAcA,OAAOC,SAASC,OAAO;EACtE,IAAI,CAAChB,KAAK;EACV,IAAIW,WAAWE,YAAYb,KAAK;EAChCW,WAAWE,UAAUb;EASrB,MAAMiB,mBAAmBN,WAAWE,YAAYb;EAEhD,CAAM,YAAY;GAChB,IAAIN,WAA0B;GAC9B,IAAI;IAEF,MAAM0B,QAAQF,IADKC,IAAInB,GACTkB,CAAM,CAACG,aAAaC,IAAI,OAAO;IAC7C,IAAIF,OAAO1B,WAAWJ,wBAAwB8B,KAAK;IACnD,IAAI,CAACA,OAAO,MAAM,I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AH,EAAA,OAAAE,IAAA;GAAnBC,KAAA,oBAAA,UAAA,EAAA,UAAGD,GAAgB,CAAA;GAAIF,EAAA,KAAAE;GAAAF,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAA,OAAvBG;CAAuB;CAAC,OACtC;AAAI"}
|
|
1
|
+
{"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useInsertionEffect","useRef","useState","useAui","decodeServerIdFromState","invokeMcpCallback","createMcpOAuthCallbackError","err","serverId","Error","message","String","cause","UseMcpOAuthCallbackOptions","url","onComplete","onError","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","superseded","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","McpOAuthCallback","children","t0","$","_c","t1","t2","_c"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import {\n type FC,\n type ReactNode,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\nimport { invokeMcpCallback } from \"../utils/invokeMcpCallback\";\n\nexport const createMcpOAuthCallbackError = (\n err: unknown,\n serverId: string | null,\n): Error => {\n const message = err instanceof Error ? err.message : String(err);\n if (serverId) {\n return new Error(\n `MCP OAuth callback for server \"${serverId}\" failed: ${message}`,\n { cause: err },\n );\n }\n return new Error(`MCP OAuth callback failed: ${message}`, { cause: err });\n};\n\nexport type UseMcpOAuthCallbackOptions = {\n /** Defaults to `window.location.href`. */\n url?: string;\n onComplete?: (serverId: string) => void;\n onError?: (err: Error) => void;\n};\n\nexport type UseMcpOAuthCallbackResult = {\n status: \"idle\" | \"running\" | \"done\" | \"error\";\n serverId: string | null;\n error: Error | null;\n};\n\nexport function useMcpOAuthCallback(\n opts: UseMcpOAuthCallbackOptions = {},\n): UseMcpOAuthCallbackResult {\n const aui = useAui();\n const [result, setResult] = useState<UseMcpOAuthCallbackResult>({\n status: \"idle\",\n serverId: null,\n error: null,\n });\n // Guard against React 18 Strict Mode's mount-unmount-remount: the effect\n // body must not run completeAuth twice for the same URL, otherwise the\n // single-use OAuth code is double-redeemed and the second attempt 4xxs.\n const startedRef = useRef<string | null>(null);\n const optsRef = useRef(opts);\n useInsertionEffect(() => {\n optsRef.current = opts;\n });\n\n useEffect(() => {\n const url =\n opts.url ?? (typeof window !== \"undefined\" ? window.location.href : null);\n if (!url) return;\n if (startedRef.current === url) return;\n startedRef.current = url;\n\n // A callback page can be handed a second login URL while the first\n // completeAuth is still in flight. That attempt keeps running, so it\n // publishes only while its own URL is still the one being attempted;\n // otherwise an older failure would overwrite the newer attempt's success.\n // The check is against `startedRef` rather than a teardown flag so that\n // Strict Mode's unmount-remount, which starts no new attempt, still\n // publishes the result of the one already running.\n const superseded = () => startedRef.current !== url;\n\n void (async () => {\n let serverId: string | null = null;\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n if (state) serverId = decodeServerIdFromState(state);\n if (!state) throw new Error('missing \"state\" parameter');\n if (!serverId) {\n throw new Error(\"state was not created by assistant-ui MCP\");\n }\n if (superseded()) return;\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp.server({ id: serverId }).completeAuth(url);\n if (superseded()) return;\n setResult({ status: \"done\", serverId, error: null });\n } catch (err) {\n if (superseded()) return;\n const error = createMcpOAuthCallbackError(err, serverId);\n setResult({ status: \"error\", serverId, error });\n invokeMcpCallback(\"onError\", optsRef.current.onError, error);\n return;\n }\n\n invokeMcpCallback(\"onComplete\", optsRef.current.onComplete, serverId);\n })();\n }, [aui, opts.url]);\n\n return result;\n}\n\nexport const McpOAuthCallback: FC<\n UseMcpOAuthCallbackOptions & {\n children?: (result: UseMcpOAuthCallbackResult) => ReactNode;\n }\n> = ({ children, ...opts }) => {\n const result = useMcpOAuthCallback(opts);\n if (children) return <>{children(result)}</>;\n return null;\n};\n"],"mappings":";;;;;;;AAYA,MA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pAddFormPrimitiveScopesField","AddFormAuthType","useAddForm","McpAddFormPrimitiveAuthFields","Props","children","authType","t0","$","_c","state","ids","Render","t1","bearerToken","scopes","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { McpAddFormPrimitiveBearerTokenField } from \"./McpAddFormBearerTokenField\";\nimport { McpAddFormPrimitiveScopesField } from \"./McpAddFormScopesField\";\nimport { type AddFormAuthType, useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveAuthFields {\n export type Props = {\n /**\n * Optional render override. Receives the current auth type so apps can render\n * fully custom inputs, bound to the form through `BearerTokenField` and\n * `ScopesField`. Defaults to a minimal built-in for bearer / oauth.\n */\n children?: FC<{ authType: AddFormAuthType }>;\n };\n}\n\nexport const McpAddFormPrimitiveAuthFields: FC<\n McpAddFormPrimitiveAuthFields.Props\n> = ({ children }) => {\n const { state, ids } = useAddForm();\n\n if (children) {\n const Render = children;\n return <Render authType={state.authType} />;\n }\n\n if (state.authType === \"bearer\") {\n return (\n <div>\n <label\n htmlFor={ids.bearerToken}\n data-mcp-auth-field-label=\"bearer-token\"\n >\n Bearer token\n </label>\n <McpAddFormPrimitiveBearerTokenField\n id={ids.bearerToken}\n data-mcp-auth-field=\"bearer-token\"\n />\n </div>\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <div>\n <label htmlFor={ids.scopes} data-mcp-auth-field-label=\"oauth-scopes\">\n OAuth scopes\n </label>\n <McpAddFormPrimitiveScopesField\n id={ids.scopes}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n </div>\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;;;;AAgBA,MAAaK,iCAETI,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAJ,aAAAE;CACH,MAAA,EAAAG,OAAAC,QAAuBT,WAAW;CAElC,IAAIG,UAAQ;EACV,MAAAO,SAAeP;EAAS,IAAAQ;EAAA,IAAAL,EAAA,OAAAI,UAAAJ,EAAA,OAAAE,MAAAJ,UAAA;GACjBO,KAAA,oBAAC,QAAD,EAAkB,UAAAH,MAAKJ,SAAS,CAAA;GAAIE,EAAA,KAAAI;GAAAJ,EAAA,KAAAE,MAAAJ;GAAAE,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAApCK;CAAoC;CAG7C,IAAIH,MAAKJ,aAAc,UAAQ;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAG,aAAA;GAE3BD,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IACW,SAAAF,IAAGG;IACc,6BAAA;IAC3B,UAAA;GAEO,CAAA,GACR,oBAAC,qCAAD;IACM,IAAAH,IAAGG;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAN,EAAA,KAAAG,IAAAG;GAAAN,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAXNK;CAWM;CAIV,IAAIH,MAAKJ,aAAc,SAAO;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAI,QAAA;GAE1BF,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IAAgB,SAAAF,IAAGI;IAAmC,6BAAA;IAAe,UAAA;GAE7D,CAAA,GACR,oBAAC,gCAAD;IACM,IAAAJ,IAAGI;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAP,EAAA,KAAAG,IAAAI;GAAAP,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OARNK;CAQM;CAET,OAEM;AAAI;AAGbV,8BAA8Ba,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormAuthFields.js","names":["FC","McpAddFormPrimitiveBearerTokenField","McpAddFormPrimitiveScopesField","AddFormAuthType","useAddForm","McpAddFormPrimitiveAuthFields","Props","children","authType","t0","$","_c","state","ids","Render","t1","bearerToken","scopes","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { McpAddFormPrimitiveBearerTokenField } from \"./McpAddFormBearerTokenField\";\nimport { McpAddFormPrimitiveScopesField } from \"./McpAddFormScopesField\";\nimport { type AddFormAuthType, useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveAuthFields {\n export type Props = {\n /**\n * Optional render override. Receives the current auth type so apps can render\n * fully custom inputs, bound to the form through `BearerTokenField` and\n * `ScopesField`. Defaults to a minimal built-in for bearer / oauth.\n */\n children?: FC<{ authType: AddFormAuthType }>;\n };\n}\n\nexport const McpAddFormPrimitiveAuthFields: FC<\n McpAddFormPrimitiveAuthFields.Props\n> = ({ children }) => {\n const { state, ids } = useAddForm();\n\n if (children) {\n const Render = children;\n return <Render authType={state.authType} />;\n }\n\n if (state.authType === \"bearer\") {\n return (\n <div>\n <label\n htmlFor={ids.bearerToken}\n data-mcp-auth-field-label=\"bearer-token\"\n >\n Bearer token\n </label>\n <McpAddFormPrimitiveBearerTokenField\n id={ids.bearerToken}\n data-mcp-auth-field=\"bearer-token\"\n />\n </div>\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <div>\n <label htmlFor={ids.scopes} data-mcp-auth-field-label=\"oauth-scopes\">\n OAuth scopes\n </label>\n <McpAddFormPrimitiveScopesField\n id={ids.scopes}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n </div>\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;;;;AAgBA,MAAaK,iCAETI,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAJ,aAAAE;CACH,MAAA,EAAAG,OAAAC,QAAuBT,WAAW;CAElC,IAAIG,UAAQ;EACV,MAAAO,SAAeP;EAAS,IAAAQ;EAAA,IAAAL,EAAA,OAAAI,UAAAJ,EAAA,OAAAE,MAAAJ,UAAA;GACjBO,KAAA,oBAAC,QAAD,EAAkB,UAAAH,MAAKJ,SAAS,CAAA;GAAIE,EAAA,KAAAI;GAAAJ,EAAA,KAAAE,MAAAJ;GAAAE,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAApCK;CAAoC;CAG7C,IAAIH,MAAKJ,aAAc,UAAQ;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAG,aAAA;GAE3BD,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IACW,SAAAF,IAAGG;IACc,6BAAA;IAC3B,UAAA;GAEO,CAAA,GACR,oBAAC,qCAAD;IACM,IAAAH,IAAGG;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAN,EAAA,KAAAG,IAAAG;GAAAN,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAXNK;CAWM;CAIV,IAAIH,MAAKJ,aAAc,SAAO;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAI,QAAA;GAE1BF,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IAAgB,SAAAF,IAAGI;IAAmC,6BAAA;IAAe,UAAA;GAE7D,CAAA,GACR,oBAAC,gCAAD;IACM,IAAAJ,IAAGI;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAP,EAAA,KAAAG,IAAAI;GAAAP,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OARNK;CAQM;CAET,OAEM;AAAI;AAGbV,8BAA8Ba,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormAuthSelect.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","AddFormAuthType","AUTH_TYPES","ReadonlySet","Set","asAuthType","value","has","McpAddFormPrimitiveAuthSelect","Element","select","Props","Omit","props","ref","$","_c","state","setField","t0","e","next","target","t1","children","t2","authType","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm, type AddFormAuthType } from \"./context\";\n\nconst AUTH_TYPES: ReadonlySet<AddFormAuthType> = new Set([\n \"none\",\n \"bearer\",\n \"oauth\",\n]);\n\nfunction asAuthType(value: string): AddFormAuthType | null {\n return (AUTH_TYPES as ReadonlySet<string>).has(value)\n ? (value as AddFormAuthType)\n : null;\n}\n\nexport namespace McpAddFormPrimitiveAuthSelect {\n export type Element = ComponentRef<typeof Primitive.select>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.select>,\n \"value\" | \"onChange\"\n >;\n}\n\nexport const McpAddFormPrimitiveAuthSelect = forwardRef<\n McpAddFormPrimitiveAuthSelect.Element,\n McpAddFormPrimitiveAuthSelect.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.select\n {...props}\n ref={ref}\n value={state.authType}\n onChange={(e) => {\n const next = asAuthType(e.target.value);\n if (next) setField(\"authType\", next);\n }}\n >\n {props.children ?? (\n <>\n <option value=\"oauth\">OAuth</option>\n <option value=\"bearer\">Bearer token</option>\n <option value=\"none\">None</option>\n </>\n )}\n </Primitive.select>\n );\n});\n\nMcpAddFormPrimitiveAuthSelect.displayName = \"McpAddFormPrimitive.AuthSelect\";\n"],"mappings":";;;;;;AAQA,MAAMM,6BAA2C,IAAIE,IAAI;CACvD;CACA;CACA;AAAO,CACR;AAED,SAASC,WAAWC,OAAuC;CACzD,OAAQJ,WAAmCK,IAAID,KAAK,IAC/CA,QACD;AACN;AAUA,MAAaE,gCAAgCV,YAG3Ce,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BlB,WAAW;CAAE,IAAAmB;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAM3BC,MAAAC,MAAA;GACR,MAAAC,OAAahB,WAAWe,EAACE,OAAOhB,KAAM;GACtC,IAAIe,MAAMH,SAAS,YAAYG,IAAI;EAAE;EACtCN,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,MAAAW,UAAA;EAEAD,KAAAV,MAAKW,YAAL,qBAAA,UAAA,EAAA,UAAA;GAEG,oBAAA,UAAA;IAAc,OAAA;IAAQ,UAAA;GAAc,CAAA;GACpC,oBAAA,UAAA;IAAc,OAAA;IAAS,UAAA;GAAqB,CAAA;GAC5C,oBAAA,UAAA;IAAc,OAAA;IAAO,UAAA;GAAa,CAAA;EAAA,EAAA,CAAA;EAErCT,EAAA,KAAAF,MAAAW;EAAAT,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAS,YAAAX,EAAA,OAAAI,MAAAJ,EAAA,OAAAQ,IAAA;EAfHE,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMZ;GACCC;GACE,OAAAG,MAAKS;GACF,UAAAP;GAKTI,UAAAA;EAOH,CAAA;EAAmBR,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAS;EAAAX,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;EAAAR,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAhBnBU;AAgBmB,CAEtB;AAEDjB,8BAA8BmB,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormAuthSelect.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","AddFormAuthType","AUTH_TYPES","ReadonlySet","Set","asAuthType","value","has","McpAddFormPrimitiveAuthSelect","Element","select","Props","Omit","props","ref","$","_c","state","setField","t0","e","next","target","t1","children","t2","authType","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm, type AddFormAuthType } from \"./context\";\n\nconst AUTH_TYPES: ReadonlySet<AddFormAuthType> = new Set([\n \"none\",\n \"bearer\",\n \"oauth\",\n]);\n\nfunction asAuthType(value: string): AddFormAuthType | null {\n return (AUTH_TYPES as ReadonlySet<string>).has(value)\n ? (value as AddFormAuthType)\n : null;\n}\n\nexport namespace McpAddFormPrimitiveAuthSelect {\n export type Element = ComponentRef<typeof Primitive.select>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.select>,\n \"value\" | \"onChange\"\n >;\n}\n\nexport const McpAddFormPrimitiveAuthSelect = forwardRef<\n McpAddFormPrimitiveAuthSelect.Element,\n McpAddFormPrimitiveAuthSelect.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.select\n {...props}\n ref={ref}\n value={state.authType}\n onChange={(e) => {\n const next = asAuthType(e.target.value);\n if (next) setField(\"authType\", next);\n }}\n >\n {props.children ?? (\n <>\n <option value=\"oauth\">OAuth</option>\n <option value=\"bearer\">Bearer token</option>\n <option value=\"none\">None</option>\n </>\n )}\n </Primitive.select>\n );\n});\n\nMcpAddFormPrimitiveAuthSelect.displayName = \"McpAddFormPrimitive.AuthSelect\";\n"],"mappings":";;;;;;AAQA,MAAMM,6BAA2C,IAAIE,IAAI;CACvD;CACA;CACA;AAAO,CACR;AAED,SAASC,WAAWC,OAAuC;CACzD,OAAQJ,WAAmCK,IAAID,KAAK,IAC/CA,QACD;AACN;AAUA,MAAaE,gCAAgCV,YAG3Ce,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BlB,WAAW;CAAE,IAAAmB;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAM3BC,MAAAC,MAAA;GACR,MAAAC,OAAahB,WAAWe,EAACE,OAAOhB,KAAM;GACtC,IAAIe,MAAMH,SAAS,YAAYG,IAAI;EAAE;EACtCN,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,MAAAW,UAAA;EAEAD,KAAAV,MAAKW,YAAL,qBAAA,UAAA,EAAA,UAAA;GAEG,oBAAA,UAAA;IAAc,OAAA;IAAQ,UAAA;GAAc,CAAA;GACpC,oBAAA,UAAA;IAAc,OAAA;IAAS,UAAA;GAAqB,CAAA;GAC5C,oBAAA,UAAA;IAAc,OAAA;IAAO,UAAA;GAAa,CAAA;EAAA,EAAA,CAAA;EAErCT,EAAA,KAAAF,MAAAW;EAAAT,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAS,YAAAX,EAAA,OAAAI,MAAAJ,EAAA,OAAAQ,IAAA;EAfHE,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMZ;GACCC;GACE,OAAAG,MAAKS;GACF,UAAAP;GAKTI,UAAAA;EAOH,CAAA;EAAmBR,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAS;EAAAX,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;EAAAR,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAhBnBU;AAgBmB,CAEtB;AAEDjB,8BAA8BmB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormBearerTokenField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveBearerTokenField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","bearerToken","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormBearerTokenField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveBearerTokenField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveBearerTokenField = forwardRef<\n McpAddFormPrimitiveBearerTokenField.Element,\n McpAddFormPrimitiveBearerTokenField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"password\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ??\n (state.errorField === \"bearerToken\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"bearerToken\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveBearerTokenField.displayName =\n \"McpAddFormPrimitive.BearerTokenField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,sCAAsCH,YAGjDQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,KAAAC,aAAiCZ,WAAW;CAMtC,MAAAa,KAAAP,MAAM,oBACLI,MAAKI,eAAgB,gBAArB,OAAAC,KAAAA;CAAsD,IAAAC;CAAA,IAAAR,EAAA,OAAAG,OAAAH,EAAA,OAAAF,SAAAE,EAAA,OAAAE,MAAAI,YAAA;EAGvDE,KAAA,CACEV,MAAM,qBACNI,MAAKI,eAAgB,gBAAgBH,IAAGM,QAAxC,IAAqD,CACtD,CAAAC,OACSC,OAAO,CAAC,CAAAC,KACV,GAAgB,KALxBL,KAAAA;EAKyBP,EAAA,KAAAG;EAAAH,EAAA,KAAAF;EAAAE,EAAA,KAAAE,MAAAI;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAI,UAAA;EAIjBS,MAAAC,MAAOV,SAAS,eAAeU,EAACC,OAAOC,KAAM;EAAChB,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAgB,eAAAlB,EAAA,OAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,IAAA;EAjB1DI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GAAU,GACXnB;GAEF,gBAAAO;GAIA,oBAAAG;GAOGT;GACE,OAAAG,MAAKgB;GACF,UAAAL;EAA8C,CAAA;EACxDb,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAgB;EAAAlB,EAAA,KAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAlBFiB;AAkBE,CAEL;AAEDxB,oCAAoC0B,cAClC"}
|
|
1
|
+
{"version":3,"file":"McpAddFormBearerTokenField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveBearerTokenField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","bearerToken","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormBearerTokenField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveBearerTokenField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveBearerTokenField = forwardRef<\n McpAddFormPrimitiveBearerTokenField.Element,\n McpAddFormPrimitiveBearerTokenField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"password\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ??\n (state.errorField === \"bearerToken\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"bearerToken\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveBearerTokenField.displayName =\n \"McpAddFormPrimitive.BearerTokenField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,sCAAsCH,YAGjDQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,KAAAC,aAAiCZ,WAAW;CAMtC,MAAAa,KAAAP,MAAM,oBACLI,MAAKI,eAAgB,gBAArB,OAAAC,KAAAA;CAAsD,IAAAC;CAAA,IAAAR,EAAA,OAAAG,OAAAH,EAAA,OAAAF,SAAAE,EAAA,OAAAE,MAAAI,YAAA;EAGvDE,KAAA,CACEV,MAAM,qBACNI,MAAKI,eAAgB,gBAAgBH,IAAGM,QAAxC,IAAqD,CACtD,CAAAC,OACSC,OAAO,CAAC,CAAAC,KACV,GAAgB,KALxBL,KAAAA;EAKyBP,EAAA,KAAAG;EAAAH,EAAA,KAAAF;EAAAE,EAAA,KAAAE,MAAAI;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAI,UAAA;EAIjBS,MAAAC,MAAOV,SAAS,eAAeU,EAACC,OAAOC,KAAM;EAAChB,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAgB,eAAAlB,EAAA,OAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,IAAA;EAjB1DI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GAAU,GACXnB;GAEF,gBAAAO;GAIA,oBAAAG;GAOGT;GACE,OAAAG,MAAKgB;GACF,UAAAL;EAA8C,CAAA;EACxDb,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAgB;EAAAlB,EAAA,KAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAlBFiB;AAkBE,CAEL;AAEDxB,oCAAoC0B,cAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormCancel.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveCancel","Element","button","Props","props","ref","$","_c","cancel","t0","e","onClick","defaultPrevented","t1","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveCancel {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpAddFormPrimitiveCancel = forwardRef<\n McpAddFormPrimitiveCancel.Element,\n McpAddFormPrimitiveCancel.Props\n>((props, ref) => {\n const { cancel } = useAddForm();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(e) => {\n props.onClick?.(e);\n if (e.defaultPrevented) return;\n cancel();\n }}\n />\n );\n});\n\nMcpAddFormPrimitiveCancel.displayName = \"McpAddFormPrimitive.Cancel\";\n"],"mappings":";;;;;;AAaA,MAAaK,4BAA4BH,YAGvCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,WAAmBT,WAAW;CAAE,IAAAU;CAAA,IAAAH,EAAA,OAAAE,UAAAF,EAAA,OAAAF,OAAA;EAMnBK,MAAAC,MAAA;GACPN,MAAKO,UAAWD,CAAC;GACjB,IAAIA,EAACE,kBAAiB;GACtBJ,OAAO;EAAC;EACTF,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EARHI,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMT;GACC,MAAA;GACAC;GACI,SAAAI;EAIR,CAAA;EACDH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OATFO;AASE,CAEL;AAEDb,0BAA0Bc,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormCancel.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveCancel","Element","button","Props","props","ref","$","_c","cancel","t0","e","onClick","defaultPrevented","t1","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveCancel {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpAddFormPrimitiveCancel = forwardRef<\n McpAddFormPrimitiveCancel.Element,\n McpAddFormPrimitiveCancel.Props\n>((props, ref) => {\n const { cancel } = useAddForm();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(e) => {\n props.onClick?.(e);\n if (e.defaultPrevented) return;\n cancel();\n }}\n />\n );\n});\n\nMcpAddFormPrimitiveCancel.displayName = \"McpAddFormPrimitive.Cancel\";\n"],"mappings":";;;;;;AAaA,MAAaK,4BAA4BH,YAGvCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,WAAmBT,WAAW;CAAE,IAAAU;CAAA,IAAAH,EAAA,OAAAE,UAAAF,EAAA,OAAAF,OAAA;EAMnBK,MAAAC,MAAA;GACPN,MAAKO,UAAWD,CAAC;GACjB,IAAIA,EAACE,kBAAiB;GACtBJ,OAAO;EAAC;EACTF,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,IAAA;EARHI,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMT;GACC,MAAA;GACAC;GACI,SAAAI;EAIR,CAAA;EACDH,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OATFO;AASE,CAEL;AAEDb,0BAA0Bc,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","isValidElement","Primitive","useAddForm","McpAddFormPrimitiveError","Element","div","Props","props","ref","$","_c","state","ids","error","childId","asChild","children","id","undefined","customId","needsDescriptionWrapper","t0","t1","role","t2","t3","t4","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpAddFormPrimitiveError = forwardRef<\n McpAddFormPrimitiveError.Element,\n McpAddFormPrimitiveError.Props\n>((props, ref) => {\n const { state, ids } = useAddForm();\n if (!state.error) return null;\n const childId =\n props.asChild && isValidElement<{ id?: string }>(props.children)\n ? props.children.props.id\n : undefined;\n const customId = childId ?? props.id;\n const needsDescriptionWrapper =\n customId !== undefined && customId !== ids.error;\n const error = (\n <Primitive.div\n {...props}\n id={needsDescriptionWrapper ? props.id : ids.error}\n role={props.role ?? \"alert\"}\n ref={ref}\n >\n {props.children ?? state.error}\n </Primitive.div>\n );\n return needsDescriptionWrapper ? <div id={ids.error}>{error}</div> : error;\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;;AAcA,MAAaM,2BAA2BJ,YAGtCQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,QAAuBV,WAAW;CAClC,IAAI,CAACS,MAAKE,OAAM,OAAS;CAKzB,MAAAM,YAHEZ,MAAKQ,WAAYf,eAAgCO,MAAKS,QAAS,IAC3DT,MAAKS,SAAST,MAAMU,KADxBC,KAAAA,MAG0BX,MAAKU;CACjC,MAAAG,0BACED,aAAaD,KAAAA,KAAaC,aAAaP,IAAGC;CAIpC,MAAAQ,KAAAD,0BAA0Bb,MAAKU,KAAML,IAAGC;CACtC,MAAAS,KAAAf,MAAKgB,QAAL;CAGL,MAAAC,KAAAjB,MAAKS,YAAaL,MAAKE;CAAM,IAAAY;CAAA,IAAAhB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAY,MAAAZ,EAAA,OAAAa,MAAAb,EAAA,OAAAe,IAAA;EANhCC,KAAA,oBAAA,UAAA,KAAA;GAAA,GACMlB;GACA,IAAAc;GACE,MAAAC;GACDd;GAEJgB,UAAAA;EACH,CAAA;EAAgBf,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;EAAAb,EAAA,KAAAe;EAAAf,EAAA,KAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CARlB,MAAAI,QACEY;CAQA,IAAAC;CAAA,IAAAjB,EAAA,OAAAI,SAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAW,yBAAA;EACKM,KAAAN,0BAA0B,oBAAA,OAAA;GAAS,IAAAR,IAAGC;GAASA,UAAAA;EAAY,CAAA,IAA3DA;EAAmEJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAG;EAAAH,EAAA,KAAAW;EAAAX,EAAA,KAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAAnEiB;AAAmE,CAC3E;AAEDvB,yBAAyBwB,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","isValidElement","Primitive","useAddForm","McpAddFormPrimitiveError","Element","div","Props","props","ref","$","_c","state","ids","error","childId","asChild","children","id","undefined","customId","needsDescriptionWrapper","t0","t1","role","t2","t3","t4","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n isValidElement,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveError {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const McpAddFormPrimitiveError = forwardRef<\n McpAddFormPrimitiveError.Element,\n McpAddFormPrimitiveError.Props\n>((props, ref) => {\n const { state, ids } = useAddForm();\n if (!state.error) return null;\n const childId =\n props.asChild && isValidElement<{ id?: string }>(props.children)\n ? props.children.props.id\n : undefined;\n const customId = childId ?? props.id;\n const needsDescriptionWrapper =\n customId !== undefined && customId !== ids.error;\n const error = (\n <Primitive.div\n {...props}\n id={needsDescriptionWrapper ? props.id : ids.error}\n role={props.role ?? \"alert\"}\n ref={ref}\n >\n {props.children ?? state.error}\n </Primitive.div>\n );\n return needsDescriptionWrapper ? <div id={ids.error}>{error}</div> : error;\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;;AAcA,MAAaM,2BAA2BJ,YAGtCQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,QAAuBV,WAAW;CAClC,IAAI,CAACS,MAAKE,OAAM,OAAS;CAKzB,MAAAM,YAHEZ,MAAKQ,WAAYf,eAAgCO,MAAKS,QAAS,IAC3DT,MAAKS,SAAST,MAAMU,KADxBC,KAAAA,MAG0BX,MAAKU;CACjC,MAAAG,0BACED,aAAaD,KAAAA,KAAaC,aAAaP,IAAGC;CAIpC,MAAAQ,KAAAD,0BAA0Bb,MAAKU,KAAML,IAAGC;CACtC,MAAAS,KAAAf,MAAKgB,QAAL;CAGL,MAAAC,KAAAjB,MAAKS,YAAaL,MAAKE;CAAM,IAAAY;CAAA,IAAAhB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAY,MAAAZ,EAAA,OAAAa,MAAAb,EAAA,OAAAe,IAAA;EANhCC,KAAA,oBAAA,UAAA,KAAA;GAAA,GACMlB;GACA,IAAAc;GACE,MAAAC;GACDd;GAEJgB,UAAAA;EACH,CAAA;EAAgBf,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;EAAAb,EAAA,KAAAe;EAAAf,EAAA,KAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CARlB,MAAAI,QACEY;CAQA,IAAAC;CAAA,IAAAjB,EAAA,OAAAI,SAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAW,yBAAA;EACKM,KAAAN,0BAA0B,oBAAA,OAAA;GAAS,IAAAR,IAAGC;GAASA,UAAAA;EAAY,CAAA,IAA3DA;EAAmEJ,EAAA,KAAAI;EAAAJ,EAAA,KAAAG;EAAAH,EAAA,KAAAW;EAAAX,EAAA,KAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAAnEiB;AAAmE,CAC3E;AAEDvB,yBAAyBwB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormNameField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveNameField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","name","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormNameField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveNameField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveNameField = forwardRef<\n McpAddFormPrimitiveNameField.Element,\n McpAddFormPrimitiveNameField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"text\"\n placeholder=\"Name\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ??\n (state.errorField === \"name\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"name\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.name}\n onChange={(e) => setField(\"name\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveNameField.displayName = \"McpAddFormPrimitive.NameField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,+BAA+BH,YAG1CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,KAAAC,aAAiCZ,WAAW;CAOtC,MAAAa,KAAAP,MAAM,oBACLI,MAAKI,eAAgB,SAArB,OAAAC,KAAAA;CAA+C,IAAAC;CAAA,IAAAR,EAAA,OAAAG,OAAAH,EAAA,OAAAF,SAAAE,EAAA,OAAAE,MAAAI,YAAA;EAGhDE,KAAA,CACEV,MAAM,qBACNI,MAAKI,eAAgB,SAASH,IAAGM,QAAjC,IAA8C,CAC/C,CAAAC,OACSC,OAAO,CAAC,CAAAC,KACV,GAAgB,KALxBL,KAAAA;EAKyBP,EAAA,KAAAG;EAAAH,EAAA,KAAAF;EAAAE,EAAA,KAAAE,MAAAI;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAI,UAAA;EAIjBS,MAAAC,MAAOV,SAAS,QAAQU,EAACC,OAAOC,KAAM;EAAChB,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAgB,QAAAlB,EAAA,OAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,IAAA;EAlBnDI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GACO,aAAA;GAAM,GACdnB;GAEF,gBAAAO;GAIA,oBAAAG;GAOGT;GACE,OAAAG,MAAKgB;GACF,UAAAL;EAAuC,CAAA;EACjDb,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAgB;EAAAlB,EAAA,KAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAnBFiB;AAmBE,CAEL;AAEDxB,6BAA6B0B,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormNameField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveNameField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","name","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormNameField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveNameField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveNameField = forwardRef<\n McpAddFormPrimitiveNameField.Element,\n McpAddFormPrimitiveNameField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"text\"\n placeholder=\"Name\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ??\n (state.errorField === \"name\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"name\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.name}\n onChange={(e) => setField(\"name\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveNameField.displayName = \"McpAddFormPr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KAAAjB,EAAA;CAAA,OAnBFiB;AAmBE,CAEL;AAEDxB,6BAA6B0B,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAOlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"McpAddFormRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAOlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAqCtD,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAY,KAAK,GAAG,IAAI,CACtB,wBAAwB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,EAC/C,UAAU,CACX,GAAG;QACF,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;QACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,uBAAuB;;;kBALlB,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI;eACvB,MAAM,IAAI;mDA0IvB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isSecureNetworkUrl } from "../../utils/serverUrl.js";
|
|
1
2
|
import { invokeMcpCallback } from "../../utils/invokeMcpCallback.js";
|
|
2
3
|
import { AddFormContext } from "./context.js";
|
|
3
4
|
import { useAui } from "@assistant-ui/store";
|
|
@@ -38,7 +39,7 @@ const McpAddFormPrimitiveRoot = forwardRef(({ onSubmitted, onCancel, ...props },
|
|
|
38
39
|
}), [formId]);
|
|
39
40
|
const setField = useCallback((key, value) => {
|
|
40
41
|
setState((prev) => {
|
|
41
|
-
const clearsError = prev.errorField === "form" || prev.errorField === key || key === "authType" && prev.errorField === "bearerToken";
|
|
42
|
+
const clearsError = prev.errorField === "form" || prev.errorField === key || key === "authType" && (prev.errorField === "bearerToken" || prev.errorField === "url");
|
|
42
43
|
return {
|
|
43
44
|
...prev,
|
|
44
45
|
[key]: value,
|
|
@@ -97,8 +98,16 @@ const McpAddFormPrimitiveRoot = forwardRef(({ onSubmitted, onCancel, ...props },
|
|
|
97
98
|
}));
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
if (state.authType !== "none" && !isSecureNetworkUrl(urlResult.url)) {
|
|
102
|
+
setState((p_2) => ({
|
|
103
|
+
...p_2,
|
|
104
|
+
error: "Authenticated servers must use HTTPS or loopback HTTP",
|
|
105
|
+
errorField: "url"
|
|
106
|
+
}));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
setState((p_3) => ({
|
|
110
|
+
...p_3,
|
|
102
111
|
submitting: true,
|
|
103
112
|
error: null,
|
|
104
113
|
errorField: null
|
|
@@ -112,8 +121,8 @@ const McpAddFormPrimitiveRoot = forwardRef(({ onSubmitted, onCancel, ...props },
|
|
|
112
121
|
setState(INITIAL);
|
|
113
122
|
invokeMcpCallback("onSubmitted", onSubmitted, id);
|
|
114
123
|
} catch (err) {
|
|
115
|
-
setState((
|
|
116
|
-
...
|
|
124
|
+
setState((p_4) => ({
|
|
125
|
+
...p_4,
|
|
117
126
|
submitting: false,
|
|
118
127
|
error: err instanceof Error ? err.message : String(err),
|
|
119
128
|
errorField: "form"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormRoot.js","names":["ComponentPropsWithoutRef","ComponentRef","FormEventHandler","forwardRef","useCallback","useId","useMemo","useState","Primitive","useAui","AddFormContext","AddFormFieldIds","AddFormState","MCPAuthConfig","invokeMcpCallback","INITIAL","name","url","authType","bearerToken","scopes","submitting","error","errorField","validateUrl","raw","trimmed","trim","parsed","URL","protocol","McpAddFormPrimitiveRoot","Element","form","Props","Omit","onSubmitted","id","onCancel","props","ref","aui","formId","state","setState","ids","setField","key","K","value","prev","clearsError","reset","buildAuth","type","token","undefined","scopeList","split","map","s","filter","Boolean","length","submit","p","urlResult","mcp","addCustomServer","auth","err","Error","message","String","cancel","onFormSubmit","HTMLFormElement","e","preventDefault","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type FormEventHandler,\n forwardRef,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport {\n AddFormContext,\n type AddFormFieldIds,\n type AddFormState,\n} from \"./context\";\nimport type { MCPAuthConfig } from \"../../mcp-scope\";\nimport { invokeMcpCallback } from \"../../utils/invokeMcpCallback\";\n\nconst INITIAL: AddFormState = {\n name: \"\",\n url: \"\",\n authType: \"oauth\",\n bearerToken: \"\",\n scopes: \"\",\n submitting: false,\n error: null,\n errorField: null,\n};\n\nfunction validateUrl(raw: string): { url: string } | { error: string } {\n const trimmed = raw.trim();\n if (!trimmed) return { error: \"URL is required\" };\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return { error: \"Invalid URL\" };\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return { error: \"URL must be http(s)\" };\n }\n return { url: trimmed };\n}\n\nexport namespace McpAddFormPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.form>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.form>,\n \"onSubmit\"\n > & {\n onSubmitted?: (id: string) => void;\n onCancel?: () => void;\n };\n}\n\nexport const McpAddFormPrimitiveRoot = forwardRef<\n McpAddFormPrimitiveRoot.Element,\n McpAddFormPrimitiveRoot.Props\n>(({ onSubmitted, onCancel, ...props }, ref) => {\n const aui = useAui();\n const formId = useId();\n const [state, setState] = useState<AddFormState>(INITIAL);\n const ids = useMemo<AddFormFieldIds>(\n () => ({\n bearerToken: `${formId}-bearer-token`,\n scopes: `${formId}-oauth-scopes`,\n error: `${formId}-error`,\n }),\n [formId],\n );\n\n const setField = useCallback(\n <K extends keyof AddFormState>(key: K, value: AddFormState[K]) => {\n setState((prev) => {\n const clearsError =\n prev.errorField === \"form\" ||\n prev.errorField === key ||\n (key === \"authType\"
|
|
1
|
+
{"version":3,"file":"McpAddFormRoot.js","names":["ComponentPropsWithoutRef","ComponentRef","FormEventHandler","forwardRef","useCallback","useId","useMemo","useState","Primitive","useAui","AddFormContext","AddFormFieldIds","AddFormState","MCPAuthConfig","invokeMcpCallback","isSecureNetworkUrl","INITIAL","name","url","authType","bearerToken","scopes","submitting","error","errorField","validateUrl","raw","trimmed","trim","parsed","URL","protocol","McpAddFormPrimitiveRoot","Element","form","Props","Omit","onSubmitted","id","onCancel","props","ref","aui","formId","state","setState","ids","setField","key","K","value","prev","clearsError","reset","buildAuth","type","token","undefined","scopeList","split","map","s","filter","Boolean","length","submit","p","urlResult","mcp","addCustomServer","auth","err","Error","message","String","cancel","onFormSubmit","HTMLFormElement","e","preventDefault","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n type FormEventHandler,\n forwardRef,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport {\n AddFormContext,\n type AddFormFieldIds,\n type AddFormState,\n} from \"./context\";\nimport type { MCPAuthConfig } from \"../../mcp-scope\";\nimport { invokeMcpCallback } from \"../../utils/invokeMcpCallback\";\nimport { isSecureNetworkUrl } from \"../../utils/serverUrl\";\n\nconst INITIAL: AddFormState = {\n name: \"\",\n url: \"\",\n authType: \"oauth\",\n bearerToken: \"\",\n scopes: \"\",\n submitting: false,\n error: null,\n errorField: null,\n};\n\nfunction validateUrl(raw: string): { url: string } | { error: string } {\n const trimmed = raw.trim();\n if (!trimmed) return { error: \"URL is required\" };\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return { error: \"Invalid URL\" };\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return { error: \"URL must be http(s)\" };\n }\n return { url: trimmed };\n}\n\nexport namespace McpAddFormPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.form>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.form>,\n \"onSubmit\"\n > & {\n onSubmitted?: (id: string) => void;\n onCancel?: () => void;\n };\n}\n\nexport const McpAddFormPrimitiveRoot = forwardRef<\n McpAddFormPrimitiveRoot.Element,\n McpAddFormPrimitiveRoot.Props\n>(({ onSubmitted, onCancel, ...props }, ref) => {\n const aui = useAui();\n const formId = useId();\n const [state, setState] = useState<AddFormState>(INITIAL);\n const ids = useMemo<AddFormFieldIds>(\n () => ({\n bearerToken: `${formId}-bearer-token`,\n scopes: `${formId}-oauth-scopes`,\n error: `${formId}-error`,\n }),\n [formId],\n );\n\n const setField = useCallback(\n <K extends keyof AddFormState>(key: K, value: AddFormState[K]) => {\n setState((prev) => {\n const clearsError =\n prev.errorField === \"form\" ||\n prev.errorField === key ||\n (key === \"authType\" &&\n (prev.errorField === \"bearerToken\" || prev.errorField === \"url\"));\n return {\n ...prev,\n [key]: value,\n ...(clearsError ? { error: null, errorField: null } : {}),\n };\n });\n },\n [],\n );\n\n const reset = useCallback(() => setState(INITIAL), []);\n\n const buildAuth = useCallback((): MCPAuthConfig => {\n switch (state.authType) {\n case \"none\":\n return { type: \"none\" };\n case \"bearer\":\n return { type: \"bearer\", token: state.bearerToken || undefined };\n case \"oauth\": {\n const scopeList = state.scopes\n .split(/[\\s,]+/)\n .map((s) => s.trim())\n .filter(Boolean);\n return {\n type: \"oauth\",\n scopes: scopeList.length > 0 ? scopeList : undefined,\n };\n }\n }\n }, [state.authType, state.bearerToken, state.scopes]);\n\n const submit = useCallback(async () => {\n if (state.submitting) return;\n if (!state.name.trim()) {\n setState((p) => ({\n ...p,\n error: \"Name is required\",\n errorField: \"name\",\n }));\n return;\n }\n if (state.authType === \"bearer\" && !state.bearerToken.trim()) {\n setState((p) => ({\n ...p,\n error: \"Bearer token is required\",\n errorField: \"bearerToken\",\n }));\n return;\n }\n const urlResult = validateUrl(state.url);\n if (\"error\" in urlResult) {\n setState((p) => ({\n ...p,\n error: urlResult.error,\n errorField: \"url\",\n }));\n return;\n }\n if (state.authType !== \"none\" && !isSecureNetworkUrl(urlResult.url)) {\n setState((p) => ({\n ...p,\n error: \"Authenticated servers must use HTTPS or loopback HTTP\",\n errorField: \"url\",\n }));\n return;\n }\n setState((p) => ({\n ...p,\n submitting: true,\n error: null,\n errorField: null,\n }));\n try {\n const id = await aui.mcp.addCustomServer({\n name: state.name.trim(),\n url: urlResult.url,\n auth: buildAuth(),\n });\n setState(INITIAL);\n invokeMcpCallback(\"onSubmitted\", onSubmitted, id);\n } catch (err) {\n setState((p) => ({\n ...p,\n submitting: false,\n error: err instanceof Error ? err.message : String(err),\n errorField: \"form\",\n }));\n }\n }, [aui, buildAuth, onSubmitted, state]);\n\n const cancel = useCallback(() => {\n setState(INITIAL);\n onCancel?.();\n }, [onCancel]);\n\n const value = useMemo(\n () => ({ state, ids, setField, reset, submit, cancel }),\n [state, ids, setField, reset, submit, cancel],\n );\n\n const onFormSubmit: FormEventHandler<HTMLFormElement> = (e) => {\n e.preventDefault();\n void submit();\n };\n\n return (\n <AddFormContext.Provider value={value}>\n <Primitive.form {...props} ref={ref} onSubmit={onFormSubmit} />\n </AddFormContext.Provider>\n );\n});\n\nMcpAddFormPrimitiveRoot.displayName = \"McpAddFormPrimitive.Root\";\n"],"mappings":";;;;;;;;AAqBA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CpD,MAAM2B,MAAM3B,KAAKW,KAAK;IACtBV,KAAKiD,UAAUjD;IACfoD,MAAMhB,UAAU;GAClB,CAAC;GACDT,SAAS7B,OAAO;GAChBF,kBAAkB,eAAeuB,aAAaC,EAAE;EAClD,SAASiC,KAAK;GACZ1B,UAAUqB,SAAO;IACf,GAAGA;IACH5C,YAAY;IACZC,OAAOgD,eAAeC,QAAQD,IAAIE,UAAUC,OAAOH,GAAG;IACtD/C,YAAY;GACd,EAAE;EACJ;CACF,GAAG;EAACkB;EAAKY;EAAWjB;EAAaO;CAAK,CAAC;CAEvC,MAAM+B,SAASvE,kBAAkB;EAC/ByC,SAAS7B,OAAO;EAChBuB,WAAW;CACb,GAAG,CAACA,QAAQ,CAAC;CAEb,MAAMW,UAAQ5C,eACL;EAAEsC;EAAOE;EAAKC;EAAUM;EAAOY;EAAQU;CAAO,IACrD;EAAC/B;EAAOE;EAAKC;EAAUM;EAAOY;EAAQU;CAAM,CAC9C;CAEA,MAAMC,gBAAmDE,MAAM;EAC7DA,EAAEC,eAAe;EACjB,OAAY;CACd;CAEA,OACE,oBAAC,eAAe,UAAhB;EAAyB,OAAO7B;EAC9B,UAAA,oBAAC,UAAU,MAAX;GAAgB,GAAIV;GAAYC;GAAK,UAAUmC;EAAa,CAAA;CACrC,CAAA;AAE7B,CAAC;AAED5C,wBAAwBgD,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormScopesField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveScopesField","Element","input","Props","Omit","props","ref","$","_c","state","setField","t0","e","target","value","t1","scopes","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormScopesField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveScopesField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveScopesField = forwardRef<\n McpAddFormPrimitiveScopesField.Element,\n McpAddFormPrimitiveScopesField.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"text\"\n placeholder=\"Scopes (space-separated, optional)\"\n {...props}\n ref={ref}\n value={state.scopes}\n onChange={(e) => setField(\"scopes\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveScopesField.displayName = \"McpAddFormPrimitive.ScopesField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,iCAAiCH,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BX,WAAW;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAQ3BC,MAAAC,MAAOF,SAAS,UAAUE,EAACC,OAAOC,KAAM;EAACP,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAO,UAAAT,EAAA,OAAAI,IAAA;EANrDI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GACO,aAAA;GAAoC,GAC5CV;GACCC;GACE,OAAAG,MAAKO;GACF,UAAAL;EAAyC,CAAA;EACnDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAO;EAAAT,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAPFQ;AAOE,CAEL;AAEDf,+BAA+BiB,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormScopesField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveScopesField","Element","input","Props","Omit","props","ref","$","_c","state","setField","t0","e","target","value","t1","scopes","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormScopesField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveScopesField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveScopesField = forwardRef<\n McpAddFormPrimitiveScopesField.Element,\n McpAddFormPrimitiveScopesField.Props\n>((props, ref) => {\n const { state, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"text\"\n placeholder=\"Scopes (space-separated, optional)\"\n {...props}\n ref={ref}\n value={state.scopes}\n onChange={(e) => setField(\"scopes\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveScopesField.displayName = \"McpAddFormPrimitive.ScopesField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,iCAAiCH,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,OAAAC,aAA4BX,WAAW;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,UAAA;EAQ3BC,MAAAC,MAAOF,SAAS,UAAUE,EAACC,OAAOC,KAAM;EAACP,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAO,UAAAT,EAAA,OAAAI,IAAA;EANrDI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GACO,aAAA;GAAoC,GAC5CV;GACCC;GACE,OAAAG,MAAKO;GACF,UAAAL;EAAyC,CAAA;EACnDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAO;EAAAT,EAAA,KAAAI;EAAAJ,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAPFQ;AAOE,CAEL;AAEDf,+BAA+BiB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormSubmit.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveSubmit","Element","button","Props","props","ref","$","_c","state","t0","disabled","submitting","t1","undefined","t2","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveSubmit {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpAddFormPrimitiveSubmit = forwardRef<\n McpAddFormPrimitiveSubmit.Element,\n McpAddFormPrimitiveSubmit.Props\n>((props, ref) => {\n const { state } = useAddForm();\n return (\n <Primitive.button\n type=\"submit\"\n {...props}\n ref={ref}\n disabled={props.disabled || state.submitting}\n data-submitting={state.submitting || undefined}\n />\n );\n});\n\nMcpAddFormPrimitiveSubmit.displayName = \"McpAddFormPrimitive.Submit\";\n"],"mappings":";;;;;;AAaA,MAAaK,4BAA4BH,YAGvCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,UAAkBT,WAAW;CAMf,MAAAU,KAAAL,MAAKM,YAAaF,MAAKG;CAChB,MAAAC,KAAAJ,MAAKG,cAALE,KAAAA;CAA6B,IAAAC;CAAA,IAAAR,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,MAAAH,EAAA,OAAAM,IAAA;EALhDE,KAAA,oBAAA,UAAA,QAAA;GACO,MAAA;GAAQ,GACTV;GACCC;GACK,UAAAI;GACO,mBAAAG;EAA6B,CAAA;EAC9CN,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OANFQ;AAME,CAEL;AAEDd,0BAA0Be,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormSubmit.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveSubmit","Element","button","Props","props","ref","$","_c","state","t0","disabled","submitting","t1","undefined","t2","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveSubmit {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpAddFormPrimitiveSubmit = forwardRef<\n McpAddFormPrimitiveSubmit.Element,\n McpAddFormPrimitiveSubmit.Props\n>((props, ref) => {\n const { state } = useAddForm();\n return (\n <Primitive.button\n type=\"submit\"\n {...props}\n ref={ref}\n disabled={props.disabled || state.submitting}\n data-submitting={state.submitting || undefined}\n />\n );\n});\n\nMcpAddFormPrimitiveSubmit.displayName = \"McpAddFormPrimitive.Submit\";\n"],"mappings":";;;;;;AAaA,MAAaK,4BAA4BH,YAGvCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,UAAkBT,WAAW;CAMf,MAAAU,KAAAL,MAAKM,YAAaF,MAAKG;CAChB,MAAAC,KAAAJ,MAAKG,cAALE,KAAAA;CAA6B,IAAAC;CAAA,IAAAR,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAG,MAAAH,EAAA,OAAAM,IAAA;EALhDE,KAAA,oBAAA,UAAA,QAAA;GACO,MAAA;GAAQ,GACTV;GACCC;GACK,UAAAI;GACO,mBAAAG;EAA6B,CAAA;EAC9CN,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OANFQ;AAME,CAEL;AAEDd,0BAA0Be,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormUrlField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveUrlField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","url","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormUrlField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveUrlField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveUrlField = forwardRef<\n McpAddFormPrimitiveUrlField.Element,\n McpAddFormPrimitiveUrlField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"url\"\n inputMode=\"url\"\n placeholder=\"https://example.com/mcp\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ?? (state.errorField === \"url\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"url\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.url}\n onChange={(e) => setField(\"url\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveUrlField.displayName = \"McpAddFormPrimitive.UrlField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,8BAA8BH,YAGzCQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,KAAAC,aAAiCZ,WAAW;CAQtC,MAAAa,KAAAP,MAAM,oBAAoBI,MAAKI,eAAgB,QAArB,OAAAC,KAAAA;CAA8C,IAAAC;CAAA,IAAAR,EAAA,OAAAG,OAAAH,EAAA,OAAAF,SAAAE,EAAA,OAAAE,MAAAI,YAAA;EAGxEE,KAAA,CACEV,MAAM,qBACNI,MAAKI,eAAgB,QAAQH,IAAGM,QAAhC,IAA6C,CAC9C,CAAAC,OACSC,OAAO,CAAC,CAAAC,KACV,GAAgB,KALxBL,KAAAA;EAKyBP,EAAA,KAAAG;EAAAH,EAAA,KAAAF;EAAAE,EAAA,KAAAE,MAAAI;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAI,UAAA;EAIjBS,MAAAC,MAAOV,SAAS,OAAOU,EAACC,OAAOC,KAAM;EAAChB,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAgB,OAAAlB,EAAA,OAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,IAAA;EAlBlDI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GACK,WAAA;GACE,aAAA;GAAyB,GACjCnB;GAEF,gBAAAO;GAGA,oBAAAG;GAOGT;GACE,OAAAG,MAAKgB;GACF,UAAAL;EAAsC,CAAA;EAChDb,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAgB;EAAAlB,EAAA,KAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAnBFiB;AAmBE,CAEL;AAEDxB,4BAA4B0B,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpAddFormUrlField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveUrlField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","url","displayName","_c"],"sources":["../../../src/primitives/addForm/McpAddFormUrlField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveUrlField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveUrlField = forwardRef<\n McpAddFormPrimitiveUrlField.Element,\n McpAddFormPrimitiveUrlField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"url\"\n inputMode=\"url\"\n placeholder=\"https://example.com/mcp\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ?? (state.errorField === \"url\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"url\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.url}\n onChange={(e) => setField(\"url\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveUrlField.displayName = \"McpAddFormPrimitive.UrlField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,8BAA8BH,YAGzCQ,OAAAC,QAAA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B0B,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpElicitationPrimitiveAccept.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useElicitationContext","prepareElicitationContent","McpElicitationPrimitiveAccept","Element","button","Props","props","ref","$","_c","elicitation","draft","aui","T0","content","hasInvalid","hasMissingRequired","t0","t1","t2","t3","t4","t5","requestedSchema","t6","missingRequired","invalid","length","disabled","undefined","join","id","event","onClick","defaultPrevented","mcpServer","answerElicitation","action","t7","displayName"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveAccept.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useElicitationContext } from \"./context\";\nimport { prepareElicitationContent } from \"./prepareElicitationContent\";\n\nexport namespace McpElicitationPrimitiveAccept {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveAccept = forwardRef<\n McpElicitationPrimitiveAccept.Element,\n McpElicitationPrimitiveAccept.Props\n>((props, ref) => {\n const { elicitation, draft } = useElicitationContext();\n const aui = useAui();\n const { content, missingRequired, invalid } = prepareElicitationContent(\n elicitation.requestedSchema,\n draft,\n );\n const hasMissingRequired = missingRequired.length > 0;\n const hasInvalid = invalid.length > 0;\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n disabled={props.disabled || hasMissingRequired || hasInvalid}\n data-missing-required={hasMissingRequired ? \"\" : undefined}\n data-invalid={hasInvalid ? invalid.join(\",\") : undefined}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented || hasMissingRequired || hasInvalid) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"accept\",\n content,\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveAccept.displayName = \"Mc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["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useElicitationContext","prepareElicitationContent","McpElicitationPrimitiveAccept","Element","button","Props","props","ref","$","_c","elicitation","draft","aui","T0","content","hasInvalid","hasMissingRequired","t0","t1","t2","t3","t4","t5","requestedSchema","t6","missingRequired","invalid","length","disabled","undefined","join","id","event","onClick","defaultPrevented","mcpServer","answerElicitation","action","t7","displayName","_c"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveAccept.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useElicitationContext } from \"./context\";\nimport { prepareElicitationContent } from \"./prepareElicitationContent\";\n\nexport namespace McpElicitationPrimitiveAccept {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveAccept = forwardRef<\n McpElicitationPrimitiveAccept.Element,\n McpElicitationPrimitiveAccept.Props\n>((props, ref) => {\n const { elicitation, draft } = useElicitationContext();\n const aui = useAui();\n const { content, missingRequired, invalid } = prepareElicitationContent(\n elicitation.requestedSchema,\n draft,\n );\n const hasMissingRequired = missingRequired.length > 0;\n const hasInvalid = invalid.length > 0;\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n disabled={props.disabled || hasMissingRequired || hasInvalid}\n data-missing-required={hasMissingRequired ? \"\" : undefined}\n data-invalid={hasInvalid ? invalid.join(\",\") : undefined}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented || hasMissingRequired || hasInvalid) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"accept\",\n content,\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveAccept.displayName = \"McpElicitationPrimitive.Accept\";\n"],"mappings":";;;;;;;;AAeA,MAAaO,gCAAgCL,YAG3CS,OAAAC,Q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ElicitationPrimitiveCancel","Element","button","Props","props","ref","$","_c","elicitation","aui","t0","event","onClick","defaultPrevented","mcpServer","answerElicitation","id","action","t1","displayName"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveCancel.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useMcpElicitation } from \"./context\";\n\nexport namespace McpElicitationPrimitiveCancel {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveCancel = forwardRef<\n McpElicitationPrimitiveCancel.Element,\n McpElicitationPrimitiveCancel.Props\n>((props, ref) => {\n const elicitation = useMcpElicitation();\n const aui = useAui();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"cancel\",\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveCancel.displayName = \"McpElicitationPrimitive.Cancel\";\n"],"mappings":";;;;;;;AAcA,MAAaM,gCAAgCJ,YAG3CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,cAAoBT,kBAAkB;CACtC,MAAAU,MAAYX,OAAO;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAE,eAAAF,EAAA,OAAAF,OAAA;EAMRM,MAAAC,UAAA;GACPP,MAAKQ,UAAWD,KAAK;GACrB,IAAIA,MAAKE,kBAAiB;GAC1BJ,IAAGK,UAAUC,kBAAmBP,YAAWQ,IAAK,EAAAC,QACtC,SACV,CAAC;EAAC;EACHX,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAVHQ,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMd;GACC,MAAA;GACAC;GACI,SAAAK;EAMR,CAAA;EACDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAXFY;AAWE,CAEL;AAEDlB,8BAA8BmB,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpElicitationPrimitiveCancel.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useMcpElicitation","McpElicitationPrimitiveCancel","Element","button","Props","props","ref","$","_c","elicitation","aui","t0","event","onClick","defaultPrevented","mcpServer","answerElicitation","id","action","t1","displayName","_c"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveCancel.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useMcpElicitation } from \"./context\";\n\nexport namespace McpElicitationPrimitiveCancel {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveCancel = forwardRef<\n McpElicitationPrimitiveCancel.Element,\n McpElicitationPrimitiveCancel.Props\n>((props, ref) => {\n const elicitation = useMcpElicitation();\n const aui = useAui();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"cancel\",\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveCancel.displayName = \"McpElicitationPrimitive.Cancel\";\n"],"mappings":";;;;;;;AAcA,MAAaM,gCAAgCJ,YAG3CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,cAAoBT,kBAAkB;CACtC,MAAAU,MAAYX,OAAO;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAE,eAAAF,EAAA,OAAAF,OAAA;EAMRM,MAAAC,UAAA;GACPP,MAAKQ,UAAWD,KAAK;GACrB,IAAIA,MAAKE,kBAAiB;GAC1BJ,IAAGK,UAAUC,kBAAmBP,YAAWQ,IAAK,EAAAC,QACtC,SACV,CAAC;EAAC;EACHX,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAVHQ,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMd;GACC,MAAA;GACAC;GACI,SAAAK;EAMR,CAAA;EACDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAXFY;AAWE,CAEL;AAEDlB,8BAA8BmB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpElicitationPrimitiveDecline.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useMcpElicitation","McpElicitationPrimitiveDecline","Element","button","Props","props","ref","$","_c","elicitation","aui","t0","event","onClick","defaultPrevented","mcpServer","answerElicitation","id","action","t1","displayName"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveDecline.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useMcpElicitation } from \"./context\";\n\nexport namespace McpElicitationPrimitiveDecline {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveDecline = forwardRef<\n McpElicitationPrimitiveDecline.Element,\n McpElicitationPrimitiveDecline.Props\n>((props, ref) => {\n const elicitation = useMcpElicitation();\n const aui = useAui();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"decline\",\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveDecline.displayName = \"McpElicitationPrimitive.Decline\";\n"],"mappings":";;;;;;;AAcA,MAAaM,iCAAiCJ,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,cAAoBT,kBAAkB;CACtC,MAAAU,MAAYX,OAAO;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAE,eAAAF,EAAA,OAAAF,OAAA;EAMRM,MAAAC,UAAA;GACPP,MAAKQ,UAAWD,KAAK;GACrB,IAAIA,MAAKE,kBAAiB;GAC1BJ,IAAGK,UAAUC,kBAAmBP,YAAWQ,IAAK,EAAAC,QACtC,UACV,CAAC;EAAC;EACHX,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAVHQ,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMd;GACC,MAAA;GACAC;GACI,SAAAK;EAMR,CAAA;EACDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAXFY;AAWE,CAEL;AAEDlB,+BAA+BmB,cAAc"}
|
|
1
|
+
{"version":3,"file":"McpElicitationPrimitiveDecline.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useMcpElicitation","McpElicitationPrimitiveDecline","Element","button","Props","props","ref","$","_c","elicitation","aui","t0","event","onClick","defaultPrevented","mcpServer","answerElicitation","id","action","t1","displayName","_c"],"sources":["../../../src/primitives/elicitation/McpElicitationPrimitiveDecline.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { useMcpElicitation } from \"./context\";\n\nexport namespace McpElicitationPrimitiveDecline {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpElicitationPrimitiveDecline = forwardRef<\n McpElicitationPrimitiveDecline.Element,\n McpElicitationPrimitiveDecline.Props\n>((props, ref) => {\n const elicitation = useMcpElicitation();\n const aui = useAui();\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(event) => {\n props.onClick?.(event);\n if (event.defaultPrevented) return;\n aui.mcpServer.answerElicitation(elicitation.id, {\n action: \"decline\",\n });\n }}\n />\n );\n});\n\nMcpElicitationPrimitiveDecline.displayName = \"McpElicitationPrimitive.Decline\";\n"],"mappings":";;;;;;;AAcA,MAAaM,iCAAiCJ,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,cAAoBT,kBAAkB;CACtC,MAAAU,MAAYX,OAAO;CAAE,IAAAY;CAAA,IAAAJ,EAAA,OAAAG,OAAAH,EAAA,OAAAE,eAAAF,EAAA,OAAAF,OAAA;EAMRM,MAAAC,UAAA;GACPP,MAAKQ,UAAWD,KAAK;GACrB,IAAIA,MAAKE,kBAAiB;GAC1BJ,IAAGK,UAAUC,kBAAmBP,YAAWQ,IAAK,EAAAC,QACtC,UACV,CAAC;EAAC;EACHX,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EAVHQ,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMd;GACC,MAAA;GACAC;GACI,SAAAK;EAMR,CAAA;EACDJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAXFY;AAWE,CAEL;AAEDlB,+BAA+BmB,cAAc"}
|