@assistant-ui/react-mcp 0.0.10 → 0.0.11

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.
Files changed (70) hide show
  1. package/dist/auth/buildHeaders.js.map +1 -1
  2. package/dist/auth/createOAuthProvider.js.map +1 -1
  3. package/dist/connector.js.map +1 -1
  4. package/dist/context/McpConnectorByIndexProvider.js +29 -6
  5. package/dist/context/McpConnectorByIndexProvider.js.map +1 -1
  6. package/dist/context/McpCustomServerByIndexProvider.js +29 -6
  7. package/dist/context/McpCustomServerByIndexProvider.js.map +1 -1
  8. package/dist/context/McpServerByIdProvider.js +29 -6
  9. package/dist/context/McpServerByIdProvider.js.map +1 -1
  10. package/dist/hooks/useMcpOAuthCallback.js +30 -2
  11. package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
  12. package/dist/primitives/addForm/McpAddFormAuthFields.js +59 -16
  13. package/dist/primitives/addForm/McpAddFormAuthFields.js.map +1 -1
  14. package/dist/primitives/addForm/McpAddFormAuthSelect.js +33 -9
  15. package/dist/primitives/addForm/McpAddFormAuthSelect.js.map +1 -1
  16. package/dist/primitives/addForm/McpAddFormCancel.js +24 -7
  17. package/dist/primitives/addForm/McpAddFormCancel.js.map +1 -1
  18. package/dist/primitives/addForm/McpAddFormError.js +16 -5
  19. package/dist/primitives/addForm/McpAddFormError.js.map +1 -1
  20. package/dist/primitives/addForm/McpAddFormNameField.js +25 -8
  21. package/dist/primitives/addForm/McpAddFormNameField.js.map +1 -1
  22. package/dist/primitives/addForm/McpAddFormRoot.js +10 -10
  23. package/dist/primitives/addForm/McpAddFormRoot.js.map +1 -1
  24. package/dist/primitives/addForm/McpAddFormSubmit.js +20 -7
  25. package/dist/primitives/addForm/McpAddFormSubmit.js.map +1 -1
  26. package/dist/primitives/addForm/McpAddFormUrlField.js +26 -9
  27. package/dist/primitives/addForm/McpAddFormUrlField.js.map +1 -1
  28. package/dist/primitives/addForm/context.js.map +1 -1
  29. package/dist/primitives/addForm.js.map +1 -1
  30. package/dist/primitives/manager/McpManagerAddCustomTrigger.js +14 -5
  31. package/dist/primitives/manager/McpManagerAddCustomTrigger.js.map +1 -1
  32. package/dist/primitives/manager/McpManagerConnectors.js.map +1 -1
  33. package/dist/primitives/manager/McpManagerCustomServers.js.map +1 -1
  34. package/dist/primitives/manager/McpManagerRoot.js +19 -6
  35. package/dist/primitives/manager/McpManagerRoot.js.map +1 -1
  36. package/dist/primitives/manager.js.map +1 -1
  37. package/dist/primitives/server/McpServerConnectButton.js +31 -9
  38. package/dist/primitives/server/McpServerConnectButton.js.map +1 -1
  39. package/dist/primitives/server/McpServerDisconnectButton.js +28 -8
  40. package/dist/primitives/server/McpServerDisconnectButton.js.map +1 -1
  41. package/dist/primitives/server/McpServerError.js +20 -6
  42. package/dist/primitives/server/McpServerError.js.map +1 -1
  43. package/dist/primitives/server/McpServerIcon.js +41 -9
  44. package/dist/primitives/server/McpServerIcon.js.map +1 -1
  45. package/dist/primitives/server/McpServerName.js +20 -6
  46. package/dist/primitives/server/McpServerName.js.map +1 -1
  47. package/dist/primitives/server/McpServerOAuthLink.js +35 -9
  48. package/dist/primitives/server/McpServerOAuthLink.js.map +1 -1
  49. package/dist/primitives/server/McpServerRemoveButton.js +28 -8
  50. package/dist/primitives/server/McpServerRemoveButton.js.map +1 -1
  51. package/dist/primitives/server/McpServerRoot.js +37 -12
  52. package/dist/primitives/server/McpServerRoot.js.map +1 -1
  53. package/dist/primitives/server/McpServerStatus.js +22 -7
  54. package/dist/primitives/server/McpServerStatus.js.map +1 -1
  55. package/dist/primitives/server/McpServerToolName.js +18 -6
  56. package/dist/primitives/server/McpServerToolName.js.map +1 -1
  57. package/dist/primitives/server/McpServerTools.js +31 -6
  58. package/dist/primitives/server/McpServerTools.js.map +1 -1
  59. package/dist/primitives/server.js.map +1 -1
  60. package/dist/resources/McpManagerResource.d.ts.map +1 -1
  61. package/dist/resources/McpManagerResource.js +286 -99
  62. package/dist/resources/McpManagerResource.js.map +1 -1
  63. package/dist/resources/McpServerResource.js +31 -31
  64. package/dist/resources/McpServerResource.js.map +1 -1
  65. package/dist/resources/storage/McpCustomStorage.js.map +1 -1
  66. package/dist/resources/storage/McpLocalStorage.js.map +1 -1
  67. package/dist/resources/storage/McpMemoryStorage.js.map +1 -1
  68. package/dist/utils/serverId.js.map +1 -1
  69. package/package.json +6 -6
  70. package/src/resources/McpManagerResource.ts +21 -13
@@ -1 +1 @@
1
- {"version":3,"file":"buildHeaders.js","names":[],"sources":["../../src/auth/buildHeaders.ts"],"sourcesContent":["import type { MCPAuthConfig } from \"../mcp-scope\";\nimport type { MCPPersistedAuthState } from \"./types\";\n\n/**\n * Build request headers for the bearer/none flows. For bearer, prefer a token\n * stored at add-form time (persisted), falling back to a static token on the\n * config (used by connectors that hardcode a token, rare in practice).\n */\nexport function buildHeaders(\n auth: MCPAuthConfig,\n persisted: MCPPersistedAuthState | null,\n): Record<string, string> | undefined {\n if (auth.type === \"bearer\") {\n const token = persisted?.token ?? auth.token;\n if (!token) return undefined;\n return { Authorization: `Bearer ${token}` };\n }\n return undefined;\n}\n"],"mappings":";;;;;;AAQA,SAAgB,aACd,MACA,WACoC;CACpC,IAAI,KAAK,SAAS,UAAU;EAC1B,MAAM,QAAQ,WAAW,SAAS,KAAK;EACvC,IAAI,CAAC,OAAO,OAAO,KAAA;EACnB,OAAO,EAAE,eAAe,UAAU,QAAQ;CAC5C;AAEF"}
1
+ {"version":3,"file":"buildHeaders.js","names":["MCPAuthConfig","MCPPersistedAuthState","buildHeaders","auth","persisted","Record","type","token","undefined","Authorization"],"sources":["../../src/auth/buildHeaders.ts"],"sourcesContent":["import type { MCPAuthConfig } from \"../mcp-scope\";\nimport type { MCPPersistedAuthState } from \"./types\";\n\n/**\n * Build request headers for the bearer/none flows. For bearer, prefer a token\n * stored at add-form time (persisted), falling back to a static token on the\n * config (used by connectors that hardcode a token, rare in practice).\n */\nexport function buildHeaders(\n auth: MCPAuthConfig,\n persisted: MCPPersistedAuthState | null,\n): Record<string, string> | undefined {\n if (auth.type === \"bearer\") {\n const token = persisted?.token ?? auth.token;\n if (!token) return undefined;\n return { Authorization: `Bearer ${token}` };\n }\n return undefined;\n}\n"],"mappings":";;;;;;AAQA,SAAgBE,aACdC,MACAC,WACoC;CACpC,IAAID,KAAKG,SAAS,UAAU;EAC1B,MAAMC,QAAQH,WAAWG,SAASJ,KAAKI;EACvC,IAAI,CAACA,OAAO,OAAOC,KAAAA;EACnB,OAAO,EAAEC,eAAe,UAAUF,QAAQ;CAC5C;AAEF"}
@@ -1 +1 @@
1
- {"version":3,"file":"createOAuthProvider.js","names":[],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens,\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\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 /** 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\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 { serverId, config, storage, redirectUri, onAuthorizationUrl } = opts;\n\n type Cache = {\n tokens?: OAuthTokens | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n codeVerifier?: string | undefined;\n };\n let cached: Cache | null = null;\n\n const loadCache = async (): Promise<Cache> => {\n if (cached) return cached;\n const persisted = await storage.loadAuthState(serverId);\n const initial: Cache = {};\n if (persisted?.tokens) initial.tokens = persisted.tokens;\n if (config.clientId) {\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n initial.clientInformation = ci;\n } else if (persisted?.clientInformation) {\n initial.clientInformation = persisted.clientInformation;\n }\n if (persisted?.codeVerifier) initial.codeVerifier = persisted.codeVerifier;\n cached = initial;\n return cached;\n };\n\n const persist = async () => {\n const c = cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (c.tokens) next.tokens = c.tokens;\n if (c.clientInformation) next.clientInformation = c.clientInformation;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n await storage.saveAuthState(serverId, next);\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 return `${encodeServerIdInState(serverId)}.${nonce}`;\n },\n async clientInformation() {\n const c = await loadCache();\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\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 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 invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") delete c.tokens;\n if (scope === \"all\" || scope === \"client\") delete c.clientInformation;\n if (scope === \"all\" || scope === \"verifier\") delete c.codeVerifier;\n await persist();\n },\n };\n}\n"],"mappings":";AASA,MAAM,eAAe;AAErB,SAAS,iBAAiB,OAA2B;CACnD,IAAI,IAAI;CACR,KAAK,MAAM,KAAK,OAAO,KAAK,OAAO,aAAa,CAAC;CACjD,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,OAAO,EAAE;AAC1E;AAEA,SAAS,iBAAiB,QAA4B;CACpD,MAAM,SACJ,OAAO,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AM,eAAe;GACnB,MAAM,IAAI,MAAM,UAAU;GAC1B,IAAI,CAAC,EAAE,cACL,MAAM,IAAI,MAAM,4CAA4C;GAE9D,OAAO,EAAE;EACX;EACA,MAAM,sBAAsB,OAAO;GACjC,MAAM,IAAI,MAAM,UAAU;GAC1B,IAAI,UAAU,SAAS,UAAU,UAAU,OAAO,EAAE;GACpD,IAAI,UAAU,SAAS,UAAU,UAAU,OAAO,EAAE;GACpD,IAAI,UAAU,SAAS,UAAU,YAAY,OAAO,EAAE;GACtD,MAAM,QAAQ;EAChB;CACF;AACF"}
1
+ {"version":3,"file":"createOAuthProvider.js","names":["OAuthClientProvider","OAuthClientInformationFull","OAuthClientMetadata","OAuthTokens","MCPStorage","MCPAuthConfig","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","config","Extract","type","storage","redirectUri","onAuthorizationUrl","url","URL","createOAuthProvider","opts","Cache","tokens","clientInformation","codeVerifier","cached","loadCache","Promise","persisted","loadAuthState","initial","clientId","ci","client_id","redirect_uris","clientSecret","client_secret","persist","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","invalidateCredentials"],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens,\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\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 /** 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\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 { serverId, config, storage, redirectUri, onAuthorizationUrl } = opts;\n\n type Cache = {\n tokens?: OAuthTokens | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n codeVerifier?: string | undefined;\n };\n let cached: Cache | null = null;\n\n const loadCache = async (): Promise<Cache> => {\n if (cached) return cached;\n const persisted = await storage.loadAuthState(serverId);\n const initial: Cache = {};\n if (persisted?.tokens) initial.tokens = persisted.tokens;\n if (config.clientId) {\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n initial.clientInformation = ci;\n } else if (persisted?.clientInformation) {\n initial.clientInformation = persisted.clientInformation;\n }\n if (persisted?.codeVerifier) initial.codeVerifier = persisted.codeVerifier;\n cached = initial;\n return cached;\n };\n\n const persist = async () => {\n const c = cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (c.tokens) next.tokens = c.tokens;\n if (c.clientInformation) next.clientInformation = c.clientInformation;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n await storage.saveAuthState(serverId, next);\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 return `${encodeServerIdInState(serverId)}.${nonce}`;\n },\n async clientInformation() {\n const c = await loadCache();\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\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 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 invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") delete c.tokens;\n if (scope === \"all\" || scope === \"client\") delete c.clientInformation;\n if (scope === \"all\" || scope === \"verifier\") delete c.codeVerifier;\n await persist();\n },\n };\n}\n"],"mappings":";AASA,MAAMM,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;CAEvD,OAAO,GAAGrB,eAAeC,iBADX,IAAIqB,YAAY,CAAC,CAACC,OAAOF,QACGnB,CAAK;AACjD;AAEA,SAAgBsB,wBAAwBC,OAA8B;CACpE,IAAI,CAACA,MAAMC,WAAW1B,YAAY,GAAG,OAAO;CAC5C,MAAM2B,MAAMF,MAAMG,QAAQ,KAAK5B,CAAmB;CAClD,MAAM6B,UACJF,QAAQ,KACJF,MAAMK,MAAM9B,CAAmB,IAC/ByB,MAA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AY,OAAOT,EAAEd;GACtD,MAAMa,QAAQ;EAChB;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"connector.js","names":[],"sources":["../src/connector.ts"],"sourcesContent":["import type { MCPConnector } from \"./mcp-scope\";\nimport { assertValidServerId } from \"./utils/serverId\";\n\nexport function defineConnector(connector: MCPConnector): MCPConnector {\n assertValidServerId(connector.id);\n return connector;\n}\n"],"mappings":";;AAGA,SAAgB,gBAAgB,WAAuC;CACrE,oBAAoB,UAAU,EAAE;CAChC,OAAO;AACT"}
1
+ {"version":3,"file":"connector.js","names":["MCPConnector","assertValidServerId","defineConnector","connector","id"],"sources":["../src/connector.ts"],"sourcesContent":["import type { MCPConnector } from \"./mcp-scope\";\nimport { assertValidServerId } from \"./utils/serverId\";\n\nexport function defineConnector(connector: MCPConnector): MCPConnector {\n assertValidServerId(connector.id);\n return connector;\n}\n"],"mappings":";;AAGA,SAAgBE,gBAAgBC,WAAuC;CACrEF,oBAAoBE,UAAUC,EAAE;CAChC,OAAOD;AACT"}
@@ -1,18 +1,41 @@
1
1
  import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/context/McpConnectorByIndexProvider.tsx
4
- const McpConnectorByIndexProvider = ({ index, children }) => {
5
- return /* @__PURE__ */ jsx(AuiProvider, {
6
- value: useAui({ mcpServer: Derived({
5
+ const McpConnectorByIndexProvider = (t0) => {
6
+ const $ = c(7);
7
+ const { index, children } = t0;
8
+ let t1;
9
+ if ($[0] !== index) {
10
+ t1 = Derived({
7
11
  source: "mcp",
8
12
  query: {
9
13
  kind: "connector",
10
14
  index
11
15
  },
12
16
  get: (parent) => parent.mcp().connector({ index })
13
- }) }),
14
- children
15
- });
17
+ });
18
+ $[0] = index;
19
+ $[1] = t1;
20
+ } else t1 = $[1];
21
+ let t2;
22
+ if ($[2] !== t1) {
23
+ t2 = { mcpServer: t1 };
24
+ $[2] = t1;
25
+ $[3] = t2;
26
+ } else t2 = $[3];
27
+ const aui = useAui(t2);
28
+ let t3;
29
+ if ($[4] !== aui || $[5] !== children) {
30
+ t3 = /* @__PURE__ */ jsx(AuiProvider, {
31
+ value: aui,
32
+ children
33
+ });
34
+ $[4] = aui;
35
+ $[5] = children;
36
+ $[6] = t3;
37
+ } else t3 = $[6];
38
+ return t3;
16
39
  };
17
40
  //#endregion
18
41
  export { McpConnectorByIndexProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpConnectorByIndexProvider.js","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp().connector({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;AAGA,MAAa,+BAER,EAAE,OAAO,eAAe;CAS3B,OAAO,oBAAC,aAAD;EAAa,OARR,OAAO,EACjB,WAAW,QAAQ;GACjB,QAAQ;GACR,OAAO;IAAE,MAAM;IAAa;GAAM;GAClC,MAAM,WAAW,OAAO,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;EACnD,CAAC,EACH,CAE6B;EAAI;CAAsB,CAAA;AACzD"}
1
+ {"version":3,"file":"McpConnectorByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpConnectorByIndexProvider","index","t0","$","_c","children","t1","source","query","kind","get","parent","mcp","connector","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp().connector({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,+BAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CAAmB,IAAAI;CAAA,IAAAH,EAAA,OAAAF,OAAA;EAETK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAWR;GAAQ;GAACS,MAC9BC,WAAYA,OAAMC,IAAK,CAAC,CAAAC,UAAW,EAAAZ,MAAQ,CAAC;EACnD,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAG,IAAA;EALeQ,KAAA,EAAAC,WACNT,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAND,MAAAa,MAAYnB,OAAOiB,EAMlB;CAAE,IAAAG;CAAA,IAAAd,EAAA,OAAAa,OAAAb,EAAA,OAAAE,UAAA;EAEIY,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMX;EAAd,CAAA;EAAqCF,EAAA,KAAAa;EAAAb,EAAA,KAAAE;EAAAF,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAAjDc;AAAiD"}
@@ -1,18 +1,41 @@
1
1
  import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/context/McpCustomServerByIndexProvider.tsx
4
- const McpCustomServerByIndexProvider = ({ index, children }) => {
5
- return /* @__PURE__ */ jsx(AuiProvider, {
6
- value: useAui({ mcpServer: Derived({
5
+ const McpCustomServerByIndexProvider = (t0) => {
6
+ const $ = c(7);
7
+ const { index, children } = t0;
8
+ let t1;
9
+ if ($[0] !== index) {
10
+ t1 = Derived({
7
11
  source: "mcp",
8
12
  query: {
9
13
  kind: "custom",
10
14
  index
11
15
  },
12
16
  get: (parent) => parent.mcp().customServer({ index })
13
- }) }),
14
- children
15
- });
17
+ });
18
+ $[0] = index;
19
+ $[1] = t1;
20
+ } else t1 = $[1];
21
+ let t2;
22
+ if ($[2] !== t1) {
23
+ t2 = { mcpServer: t1 };
24
+ $[2] = t1;
25
+ $[3] = t2;
26
+ } else t2 = $[3];
27
+ const aui = useAui(t2);
28
+ let t3;
29
+ if ($[4] !== aui || $[5] !== children) {
30
+ t3 = /* @__PURE__ */ jsx(AuiProvider, {
31
+ value: aui,
32
+ children
33
+ });
34
+ $[4] = aui;
35
+ $[5] = children;
36
+ $[6] = t3;
37
+ } else t3 = $[6];
38
+ return t3;
16
39
  };
17
40
  //#endregion
18
41
  export { McpCustomServerByIndexProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpCustomServerByIndexProvider.js","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp().customServer({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;AAGA,MAAa,kCAER,EAAE,OAAO,eAAe;CAS3B,OAAO,oBAAC,aAAD;EAAa,OARR,OAAO,EACjB,WAAW,QAAQ;GACjB,QAAQ;GACR,OAAO;IAAE,MAAM;IAAU;GAAM;GAC/B,MAAM,WAAW,OAAO,IAAI,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC;EACtD,CAAC,EACH,CAE6B;EAAI;CAAsB,CAAA;AACzD"}
1
+ {"version":3,"file":"McpCustomServerByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpCustomServerByIndexProvider","index","t0","$","_c","children","t1","source","query","kind","get","parent","mcp","customServer","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp().customServer({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,kCAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CAAmB,IAAAI;CAAA,IAAAH,EAAA,OAAAF,OAAA;EAETK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAQR;GAAQ;GAACS,MAC3BC,WAAYA,OAAMC,IAAK,CAAC,CAAAC,aAAc,EAAAZ,MAAQ,CAAC;EACtD,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAG,IAAA;EALeQ,KAAA,EAAAC,WACNT,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAND,MAAAa,MAAYnB,OAAOiB,EAMlB;CAAE,IAAAG;CAAA,IAAAd,EAAA,OAAAa,OAAAb,EAAA,OAAAE,UAAA;EAEIY,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMX;EAAd,CAAA;EAAqCF,EAAA,KAAAa;EAAAb,EAAA,KAAAE;EAAAF,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAAjDc;AAAiD"}
@@ -1,15 +1,38 @@
1
1
  import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/context/McpServerByIdProvider.tsx
4
- const McpServerByIdProvider = ({ id, children }) => {
5
- return /* @__PURE__ */ jsx(AuiProvider, {
6
- value: useAui({ mcpServer: Derived({
5
+ const McpServerByIdProvider = (t0) => {
6
+ const $ = c(7);
7
+ const { id, children } = t0;
8
+ let t1;
9
+ if ($[0] !== id) {
10
+ t1 = Derived({
7
11
  source: "mcp",
8
12
  query: { id },
9
13
  get: (parent) => parent.mcp().server({ id })
10
- }) }),
11
- children
12
- });
14
+ });
15
+ $[0] = id;
16
+ $[1] = t1;
17
+ } else t1 = $[1];
18
+ let t2;
19
+ if ($[2] !== t1) {
20
+ t2 = { mcpServer: t1 };
21
+ $[2] = t1;
22
+ $[3] = t2;
23
+ } else t2 = $[3];
24
+ const aui = useAui(t2);
25
+ let t3;
26
+ if ($[4] !== aui || $[5] !== children) {
27
+ t3 = /* @__PURE__ */ jsx(AuiProvider, {
28
+ value: aui,
29
+ children
30
+ });
31
+ $[4] = aui;
32
+ $[5] = children;
33
+ $[6] = t3;
34
+ } else t3 = $[6];
35
+ return t3;
13
36
  };
14
37
  //#endregion
15
38
  export { McpServerByIdProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerByIdProvider.js","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp().server({ id }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;AAGA,MAAa,yBAAgE,EAC3E,IACA,eACI;CASJ,OAAO,oBAAC,aAAD;EAAa,OARR,OAAO,EACjB,WAAW,QAAQ;GACjB,QAAQ;GACR,OAAO,EAAE,GAAG;GACZ,MAAM,WAAW,OAAO,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC;EAC7C,CAAC,EACH,CAE6B;EAAI;CAAsB,CAAA;AACzD"}
1
+ {"version":3,"file":"McpServerByIdProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpServerByIdProvider","id","t0","$","_c","children","t1","source","query","get","parent","mcp","server","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp().server({ id }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,yBAA+DE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,IAAAI,aAAAH;CAG5E,IAAAI;CAAA,IAAAH,EAAA,OAAAF,IAAA;EAEcK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN,EAAAP,GAAK;GAACQ,MACRC,WAAYA,OAAMC,IAAK,CAAC,CAAAC,OAAQ,EAAAX,GAAK,CAAC;EAC7C,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAG,IAAA;EALeO,KAAA,EAAAC,WACNR,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAND,MAAAY,MAAYlB,OAAOgB,EAMlB;CAAE,IAAAG;CAAA,IAAAb,EAAA,OAAAY,OAAAZ,EAAA,OAAAE,UAAA;EAEIW,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMV;EAAd,CAAA;EAAqCF,EAAA,KAAAY;EAAAZ,EAAA,KAAAE;EAAAF,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAAjDa;AAAiD"}
@@ -1,5 +1,6 @@
1
1
  import { decodeServerIdFromState } from "../auth/createOAuthProvider.js";
2
2
  import { useAui } from "@assistant-ui/store";
3
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
4
  import { useEffect, useRef, useState } from "@assistant-ui/tap/react-shim";
4
5
  import { Fragment, jsx } from "react/jsx-runtime";
5
6
  //#region src/hooks/useMcpOAuthCallback.tsx
@@ -52,9 +53,36 @@ function useMcpOAuthCallback(opts = {}) {
52
53
  }, [aui, opts.url]);
53
54
  return result;
54
55
  }
55
- const McpOAuthCallback = ({ children, ...opts }) => {
56
+ const McpOAuthCallback = (t0) => {
57
+ const $ = c(8);
58
+ let children;
59
+ let opts;
60
+ if ($[0] !== t0) {
61
+ ({children, ...opts} = t0);
62
+ $[0] = t0;
63
+ $[1] = children;
64
+ $[2] = opts;
65
+ } else {
66
+ children = $[1];
67
+ opts = $[2];
68
+ }
56
69
  const result = useMcpOAuthCallback(opts);
57
- if (children) return /* @__PURE__ */ jsx(Fragment, { children: children(result) });
70
+ if (children) {
71
+ let t1;
72
+ if ($[3] !== children || $[4] !== result) {
73
+ t1 = children(result);
74
+ $[3] = children;
75
+ $[4] = result;
76
+ $[5] = t1;
77
+ } else t1 = $[5];
78
+ let t2;
79
+ if ($[6] !== t1) {
80
+ t2 = /* @__PURE__ */ jsx(Fragment, { children: t1 });
81
+ $[6] = t1;
82
+ $[7] = t2;
83
+ } else t2 = $[7];
84
+ return t2;
85
+ }
58
86
  return null;
59
87
  };
60
88
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpOAuthCallback.js","names":[],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\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 optsRef.current = opts;\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 (async () => {\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n const error = parsed.searchParams.get(\"error\");\n if (error) {\n throw new Error(\n parsed.searchParams.get(\"error_description\") ?? error,\n );\n }\n if (!state) throw new Error(\"missing state parameter in callback URL\");\n const serverId = decodeServerIdFromState(state);\n if (!serverId) {\n throw new Error(\"callback state does not match an MCP server\");\n }\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp().server({ id: serverId }).completeAuth(url);\n setResult({ status: \"done\", serverId, error: null });\n optsRef.current.onComplete?.(serverId);\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setResult((prev) => ({ ...prev, status: \"error\", error: e }));\n optsRef.current.onError?.(e);\n }\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":";;;;;AAiBA,SAAgB,oBACd,OAAmC,CAAC,GACT;CAC3B,MAAM,MAAM,OAAO;CACnB,MAAM,CAAC,QAAQ,aAAa,SAAoC;EAC9D,QAAQ;EACR,UAAU;EACV,OAAO;CACT,CAAC;CAID,MAAM,aAAa,OAAsB,IAAI;CAC7C,MAAM,UAAU,OAAO,IAAI;CAC3B,QAAQ,UAAU;CAElB,gBAAgB;EACd,MAAM,MACJ,KAAK,QAAQ,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO;EACtE,IAAI,CAAC,KAAK;EACV,IAAI,WAAW,YAAY,KAAK;EAChC,WAAW,UAAU;EAErB,CAAC,YAAY;GACX,IAAI;IACF,MAAM,SAAS,IAAI,IAAI,GAAG;IAC1B,MAAM,QAAQ,OAAO,aAAa,IAAI,OAAO;IAC7C,MAAM,QAAQ,OAAO,aAAa,IAAI,OAAO;IAC7C,IAAI,OACF,MAAM,IAAI,MACR,OAAO,aAAa,IAAI,mBAAmB,KAAK,KAClD;IAEF,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yCAAyC;IACrE,MAAM,WAAW,wBAAwB,KAAK;IAC9C,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,6CAA6C;IAE/D,UAAU;KAAE,QAAQ;KAAW;KAAU,OAAO;IAAK,CAAC;IACtD,MAAM,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC,aAAa,GAAG;IACzD,UAAU;KAAE,QAAQ;KAAQ;KAAU,OAAO;IAAK,CAAC;IACnD,QAAQ,QAAQ,aAAa,QAAQ;GACvC,SAAS,KAAK;IACZ,MAAM,IAAI,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC;IAC5D,WAAW,UAAU;KAAE,GAAG;KAAM,QAAQ;KAAS,OAAO;IAAE,EAAE;IAC5D,QAAQ,QAAQ,UAAU,CAAC;GAC7B;EACF,EAAA,CAAG;CACL,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC;CAElB,OAAO;AACT;AAEA,MAAa,oBAIR,EAAE,UAAU,GAAG,WAAW;CAC7B,MAAM,SAAS,oBAAoB,IAAI;CACvC,IAAI,UAAU,OAAO,oBAAA,UAAA,EAAA,UAAG,SAAS,MAAM,EAAI,CAAA;CAC3C,OAAO;AACT"}
1
+ {"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useRef","useState","useAui","decodeServerIdFromState","UseMcpOAuthCallbackOptions","url","onComplete","serverId","onError","err","Error","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","e","String","prev","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\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 optsRef.current = opts;\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 (async () => {\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n const error = parsed.searchParams.get(\"error\");\n if (error) {\n throw new Error(\n parsed.searchParams.get(\"error_description\") ?? error,\n );\n }\n if (!state) throw new Error(\"missing state parameter in callback URL\");\n const serverId = decodeServerIdFromState(state);\n if (!serverId) {\n throw new Error(\"callback state does not match an MCP server\");\n }\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp().server({ id: serverId }).completeAuth(url);\n setResult({ status: \"done\", serverId, error: null });\n optsRef.current.onComplete?.(serverId);\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setResult((prev) => ({ ...prev, status: \"error\", error: e }));\n optsRef.current.onError?.(e);\n }\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":";;;;;;AAiBA,SAAgBiB,oBACdC,OAAmC,CAAC,GACT;CAC3B,MAAMC,MAAMd,OAAO;CACnB,MAAM,CAACe,QAAQC,aAAajB,SAAoC;EAC9DW,QAAQ;EACRL,UAAU;EACVM,OAAO;CACT,CAAC;CAID,MAAMM,aAAanB,OAAsB,IAAI;CAC7C,MAAMoB,UAAUpB,OAAOe,IAAI;CAC3BK,QAAQC,UAAUN;CAElBhB,gBAAgB;EAC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AAC,CAAA,CAAAD,aAAAvB,QAAAwB;EAAqBC,EAAA,KAAAD;EAAAC,EAAA,KAAAF;EAAAE,EAAA,KAAAzB;CAAA,OAAA;EAAAuB,WAAAE,EAAA;EAAAzB,OAAAyB,EAAA;CAAA;CACxB,MAAAvB,SAAeH,oBAAoBC,IAAI;CACvC,IAAIuB,UAAQ;EAAA,IAAAI;EAAA,IAAAF,EAAA,OAAAF,YAAAE,EAAA,OAAAvB,QAAA;GAAYyB,KAAAJ,SAASrB,MAAM;GAACuB,EAAA,KAAAF;GAAAE,EAAA,KAAAvB;GAAAuB,EAAA,KAAAE;EAAA,OAAAA,KAAAF,EAAA;EAAA,IAAAG;EAAA,IAAAH,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,23 +1,66 @@
1
1
  import { useAddForm } from "./context.js";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/primitives/addForm/McpAddFormAuthFields.tsx
4
- const McpAddFormPrimitiveAuthFields = ({ children }) => {
5
+ const McpAddFormPrimitiveAuthFields = (t0) => {
6
+ const $ = c(13);
7
+ const { children } = t0;
5
8
  const { state, setField } = useAddForm();
6
- if (children) return /* @__PURE__ */ jsx(children, { authType: state.authType });
7
- if (state.authType === "bearer") return /* @__PURE__ */ jsx("input", {
8
- type: "password",
9
- placeholder: "Bearer token",
10
- value: state.bearerToken,
11
- onChange: (e) => setField("bearerToken", e.target.value),
12
- "data-mcp-auth-field": "bearer-token"
13
- });
14
- if (state.authType === "oauth") return /* @__PURE__ */ jsx("input", {
15
- type: "text",
16
- placeholder: "Scopes (space-separated, optional)",
17
- value: state.scopes,
18
- onChange: (e) => setField("scopes", e.target.value),
19
- "data-mcp-auth-field": "oauth-scopes"
20
- });
9
+ if (children) {
10
+ const Render = children;
11
+ let t1;
12
+ if ($[0] !== Render || $[1] !== state.authType) {
13
+ t1 = /* @__PURE__ */ jsx(Render, { authType: state.authType });
14
+ $[0] = Render;
15
+ $[1] = state.authType;
16
+ $[2] = t1;
17
+ } else t1 = $[2];
18
+ return t1;
19
+ }
20
+ if (state.authType === "bearer") {
21
+ let t1;
22
+ if ($[3] !== setField) {
23
+ t1 = (e) => setField("bearerToken", e.target.value);
24
+ $[3] = setField;
25
+ $[4] = t1;
26
+ } else t1 = $[4];
27
+ let t2;
28
+ if ($[5] !== state.bearerToken || $[6] !== t1) {
29
+ t2 = /* @__PURE__ */ jsx("input", {
30
+ type: "password",
31
+ placeholder: "Bearer token",
32
+ value: state.bearerToken,
33
+ onChange: t1,
34
+ "data-mcp-auth-field": "bearer-token"
35
+ });
36
+ $[5] = state.bearerToken;
37
+ $[6] = t1;
38
+ $[7] = t2;
39
+ } else t2 = $[7];
40
+ return t2;
41
+ }
42
+ if (state.authType === "oauth") {
43
+ let t1;
44
+ if ($[8] !== setField) {
45
+ t1 = (e_0) => setField("scopes", e_0.target.value);
46
+ $[8] = setField;
47
+ $[9] = t1;
48
+ } else t1 = $[9];
49
+ let t2;
50
+ if ($[10] !== state.scopes || $[11] !== t1) {
51
+ t2 = /* @__PURE__ */ jsx("input", {
52
+ type: "text",
53
+ placeholder: "Scopes (space-separated, optional)",
54
+ value: state.scopes,
55
+ onChange: t1,
56
+ "data-mcp-auth-field": "oauth-scopes"
57
+ });
58
+ $[10] = state.scopes;
59
+ $[11] = t1;
60
+ $[12] = t2;
61
+ } else t2 = $[12];
62
+ return t2;
63
+ }
21
64
  return null;
22
65
  };
23
66
  McpAddFormPrimitiveAuthFields.displayName = "McpAddFormPrimitive.AuthFields";
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthFields.js","names":["Render"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\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. 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, setField } = 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 <input\n type=\"password\"\n placeholder=\"Bearer token\"\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n data-mcp-auth-field=\"bearer-token\"\n />\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <input\n type=\"text\"\n placeholder=\"Scopes (space-separated, optional)\"\n value={state.scopes}\n onChange={(e) => setField(\"scopes\", e.target.value)}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;AAaA,MAAa,iCAER,EAAE,eAAe;CACpB,MAAM,EAAE,OAAO,aAAa,WAAW;CAEvC,IAAI,UAEF,OAAO,oBAACA,UAAD,EAAQ,UAAU,MAAM,SAAW,CAAA;CAG5C,IAAI,MAAM,aAAa,UACrB,OACE,oBAAC,SAAD;EACE,MAAK;EACL,aAAY;EACZ,OAAO,MAAM;EACb,WAAW,MAAM,SAAS,eAAe,EAAE,OAAO,KAAK;EACvD,uBAAoB;CACrB,CAAA;CAIL,IAAI,MAAM,aAAa,SACrB,OACE,oBAAC,SAAD;EACE,MAAK;EACL,aAAY;EACZ,OAAO,MAAM;EACb,WAAW,MAAM,SAAS,UAAU,EAAE,OAAO,KAAK;EAClD,uBAAoB;CACrB,CAAA;CAIL,OAAO;AACT;AAEA,8BAA8B,cAAc"}
1
+ {"version":3,"file":"McpAddFormAuthFields.js","names":["FC","AddFormAuthType","useAddForm","McpAddFormPrimitiveAuthFields","Props","children","authType","t0","$","_c","state","setField","Render","t1","e","target","value","t2","bearerToken","e_0","scopes","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\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. 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, setField } = 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 <input\n type=\"password\"\n placeholder=\"Bearer token\"\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n data-mcp-auth-field=\"bearer-token\"\n />\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <input\n type=\"text\"\n placeholder=\"Scopes (space-separated, optional)\"\n value={state.scopes}\n onChange={(e) => setField(\"scopes\", e.target.value)}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;;AAaA,MAAaG,iCAETI,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAJ,aAAAE;CACH,MAAA,EAAAG,OAAAC,aAA4BT,WAAW;CAEvC,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;GAA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";
2
3
  import { forwardRef } from "@assistant-ui/tap/react-shim";
3
4
  import { Primitive } from "@radix-ui/react-primitive";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -12,16 +13,20 @@ function asAuthType(value) {
12
13
  return AUTH_TYPES.has(value) ? value : null;
13
14
  }
14
15
  const McpAddFormPrimitiveAuthSelect = forwardRef((props, ref) => {
16
+ const $ = c(10);
15
17
  const { state, setField } = useAddForm();
16
- return /* @__PURE__ */ jsx(Primitive.select, {
17
- ...props,
18
- ref,
19
- value: state.authType,
20
- onChange: (e) => {
18
+ let t0;
19
+ if ($[0] !== setField) {
20
+ t0 = (e) => {
21
21
  const next = asAuthType(e.target.value);
22
22
  if (next) setField("authType", next);
23
- },
24
- children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ };
24
+ $[0] = setField;
25
+ $[1] = t0;
26
+ } else t0 = $[1];
27
+ let t1;
28
+ if ($[2] !== props.children) {
29
+ t1 = props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
25
30
  /* @__PURE__ */ jsx("option", {
26
31
  value: "oauth",
27
32
  children: "OAuth"
@@ -34,8 +39,27 @@ const McpAddFormPrimitiveAuthSelect = forwardRef((props, ref) => {
34
39
  value: "none",
35
40
  children: "None"
36
41
  })
37
- ] })
38
- });
42
+ ] });
43
+ $[2] = props.children;
44
+ $[3] = t1;
45
+ } else t1 = $[3];
46
+ let t2;
47
+ if ($[4] !== props || $[5] !== ref || $[6] !== state.authType || $[7] !== t0 || $[8] !== t1) {
48
+ t2 = /* @__PURE__ */ jsx(Primitive.select, {
49
+ ...props,
50
+ ref,
51
+ value: state.authType,
52
+ onChange: t0,
53
+ children: t1
54
+ });
55
+ $[4] = props;
56
+ $[5] = ref;
57
+ $[6] = state.authType;
58
+ $[7] = t0;
59
+ $[8] = t1;
60
+ $[9] = t2;
61
+ } else t2 = $[9];
62
+ return t2;
39
63
  });
40
64
  McpAddFormPrimitiveAuthSelect.displayName = "McpAddFormPrimitive.AuthSelect";
41
65
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthSelect.js","names":[],"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,MAAM,aAA2C,IAAI,IAAI;CACvD;CACA;CACA;AACF,CAAC;AAED,SAAS,WAAW,OAAuC;CACzD,OAAQ,WAAmC,IAAI,KAAK,IAC/C,QACD;AACN;AAUA,MAAa,gCAAgC,YAG1C,OAAO,QAAQ;CAChB,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,OACE,oBAAC,UAAU,QAAX;EACE,GAAI;EACC;EACL,OAAO,MAAM;EACb,WAAW,MAAM;GACf,MAAM,OAAO,WAAW,EAAE,OAAO,KAAK;GACtC,IAAI,MAAM,SAAS,YAAY,IAAI;EACrC;YAEC,MAAM,YACL,qBAAA,UAAA,EAAA,UAAA;GACE,oBAAC,UAAD;IAAQ,OAAM;cAAQ;GAAa,CAAA;GACnC,oBAAC,UAAD;IAAQ,OAAM;cAAS;GAAoB,CAAA;GAC3C,oBAAC,UAAD;IAAQ,OAAM;cAAO;GAAY,CAAA;EACjC,EAAA,CAAA;CAEY,CAAA;AAEtB,CAAC;AAED,8BAA8B,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"],"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,aAA2C,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;cAAQ;GAAc,CAAA;GACpC,oBAAA,UAAA;IAAc,OAAA;cAAS;GAAqB,CAAA;GAC5C,oBAAA,UAAA;IAAc,OAAA;cAAO;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;aAKTI;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,20 +1,37 @@
1
1
  import { useAddForm } from "./context.js";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { forwardRef } from "@assistant-ui/tap/react-shim";
3
4
  import { Primitive } from "@radix-ui/react-primitive";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/primitives/addForm/McpAddFormCancel.tsx
6
7
  const McpAddFormPrimitiveCancel = forwardRef((props, ref) => {
8
+ const $ = c(7);
7
9
  const { cancel } = useAddForm();
8
- return /* @__PURE__ */ jsx(Primitive.button, {
9
- ...props,
10
- type: "button",
11
- ref,
12
- onClick: (e) => {
10
+ let t0;
11
+ if ($[0] !== cancel || $[1] !== props) {
12
+ t0 = (e) => {
13
13
  props.onClick?.(e);
14
14
  if (e.defaultPrevented) return;
15
15
  cancel();
16
- }
17
- });
16
+ };
17
+ $[0] = cancel;
18
+ $[1] = props;
19
+ $[2] = t0;
20
+ } else t0 = $[2];
21
+ let t1;
22
+ if ($[3] !== props || $[4] !== ref || $[5] !== t0) {
23
+ t1 = /* @__PURE__ */ jsx(Primitive.button, {
24
+ ...props,
25
+ type: "button",
26
+ ref,
27
+ onClick: t0
28
+ });
29
+ $[3] = props;
30
+ $[4] = ref;
31
+ $[5] = t0;
32
+ $[6] = t1;
33
+ } else t1 = $[6];
34
+ return t1;
18
35
  });
19
36
  McpAddFormPrimitiveCancel.displayName = "McpAddFormPrimitive.Cancel";
20
37
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormCancel.js","names":[],"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,MAAa,4BAA4B,YAGtC,OAAO,QAAQ;CAChB,MAAM,EAAE,WAAW,WAAW;CAC9B,OACE,oBAAC,UAAU,QAAX;EACE,GAAI;EACJ,MAAK;EACA;EACL,UAAU,MAAM;GACd,MAAM,UAAU,CAAC;GACjB,IAAI,EAAE,kBAAkB;GACxB,OAAO;EACT;CACD,CAAA;AAEL,CAAC;AAED,0BAA0B,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"],"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,16 +1,27 @@
1
1
  import { useAddForm } from "./context.js";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { forwardRef } from "@assistant-ui/tap/react-shim";
3
4
  import { Primitive } from "@radix-ui/react-primitive";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/primitives/addForm/McpAddFormError.tsx
6
7
  const McpAddFormPrimitiveError = forwardRef((props, ref) => {
8
+ const $ = c(4);
7
9
  const { state } = useAddForm();
8
10
  if (!state.error) return null;
9
- return /* @__PURE__ */ jsx(Primitive.div, {
10
- ...props,
11
- ref,
12
- children: props.children ?? state.error
13
- });
11
+ const t0 = props.children ?? state.error;
12
+ let t1;
13
+ if ($[0] !== props || $[1] !== ref || $[2] !== t0) {
14
+ t1 = /* @__PURE__ */ jsx(Primitive.div, {
15
+ ...props,
16
+ ref,
17
+ children: t0
18
+ });
19
+ $[0] = props;
20
+ $[1] = ref;
21
+ $[2] = t0;
22
+ $[3] = t1;
23
+ } else t1 = $[3];
24
+ return t1;
14
25
  });
15
26
  McpAddFormPrimitiveError.displayName = "McpAddFormPrimitive.Error";
16
27
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormError.js","names":[],"sources":["../../../src/primitives/addForm/McpAddFormError.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 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 } = useAddForm();\n if (!state.error) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? state.error}\n </Primitive.div>\n );\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;AAaA,MAAa,2BAA2B,YAGrC,OAAO,QAAQ;CAChB,MAAM,EAAE,UAAU,WAAW;CAC7B,IAAI,CAAC,MAAM,OAAO,OAAO;CACzB,OACE,oBAAC,UAAU,KAAX;EAAe,GAAI;EAAY;YAC5B,MAAM,YAAY,MAAM;CACZ,CAAA;AAEnB,CAAC;AAED,yBAAyB,cAAc"}
1
+ {"version":3,"file":"McpAddFormError.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveError","Element","div","Props","props","ref","$","_c","state","error","t0","children","t1","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormError.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 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 } = useAddForm();\n if (!state.error) return null;\n return (\n <Primitive.div {...props} ref={ref}>\n {props.children ?? state.error}\n </Primitive.div>\n );\n});\n\nMcpAddFormPrimitiveError.displayName = \"McpAddFormPrimitive.Error\";\n"],"mappings":";;;;;;AAaA,MAAaK,2BAA2BH,YAGtCO,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAA,EAAAC,UAAkBT,WAAW;CAC7B,IAAI,CAACS,MAAKC,OAAM,OAAS;CAGpB,MAAAC,KAAAN,MAAKO,YAAaH,MAAKC;CAAM,IAAAG;CAAA,IAAAN,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAI,IAAA;EADhCE,KAAA,oBAAA,UAAA,KAAA;GAAA,GAAmBR;GAAYC;aAC5BK;EACH,CAAA;EAAgBJ,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAI;EAAAJ,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,OAFhBM;AAEgB,CAEnB;AAEDZ,yBAAyBa,cAAc"}