@agent-native/core 0.106.3 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +13 -0
  3. package/corpus/core/docs/content/integrations.mdx +597 -0
  4. package/corpus/core/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
  5. package/corpus/core/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
  6. package/corpus/core/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
  7. package/corpus/core/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
  8. package/corpus/core/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
  9. package/corpus/core/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
  10. package/corpus/core/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
  11. package/corpus/core/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
  12. package/corpus/core/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
  13. package/corpus/core/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
  14. package/corpus/core/docs/content/mcp-clients.mdx +51 -1
  15. package/corpus/core/docs/content/organizations-teams-permissions.mdx +413 -0
  16. package/corpus/core/package.json +1 -1
  17. package/corpus/core/src/client/AssistantChat.tsx +13 -1
  18. package/corpus/core/src/client/chat/message-components.tsx +41 -0
  19. package/corpus/core/src/client/composer/TiptapComposer.tsx +45 -8
  20. package/corpus/core/src/client/integrations/IntegrationsPanel.tsx +30 -11
  21. package/corpus/core/src/client/resources/McpConnectionSuggestion.tsx +240 -0
  22. package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +159 -40
  23. package/corpus/core/src/client/resources/mcp-integration-catalog.ts +433 -4
  24. package/corpus/core/src/client/resources/mcp-integration-logos.ts +108 -0
  25. package/corpus/core/src/deploy/build.ts +32 -0
  26. package/corpus/core/src/extensions/html-shell.ts +33 -1
  27. package/corpus/core/src/ingestion/office.ts +1 -2
  28. package/corpus/core/src/ingestion/pptx.ts +2 -4
  29. package/corpus/core/src/localization/default-messages.ts +126 -1
  30. package/corpus/core/src/mcp/actions/call-mcp-tool.ts +1 -0
  31. package/corpus/core/src/server/index.ts +4 -0
  32. package/corpus/core/src/server/org-admin.ts +28 -0
  33. package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
  34. package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
  35. package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
  36. package/corpus/templates/analytics/.agents/skills/creative-context/SKILL.md +64 -0
  37. package/corpus/templates/analytics/AGENTS.md +5 -0
  38. package/corpus/templates/analytics/actions/clone-creative-context-dashboard.ts +86 -0
  39. package/corpus/templates/analytics/app/components/layout/Layout.tsx +2 -0
  40. package/corpus/templates/analytics/app/i18n/zh-TW.ts +1 -0
  41. package/corpus/templates/analytics/app/i18n-data.ts +1 -0
  42. package/corpus/templates/analytics/app/pages/Ask.tsx +8 -4
  43. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +59 -0
  44. package/corpus/templates/analytics/app/routes/agent.tsx +7 -1
  45. package/corpus/templates/analytics/changelog/2026-07-17-library-now-flags-published-dashboards-with-newer-versions-a.md +6 -0
  46. package/corpus/templates/analytics/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
  47. package/corpus/templates/analytics/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
  48. package/corpus/templates/analytics/package.json +1 -0
  49. package/corpus/templates/analytics/server/lib/native-creative-context.ts +158 -0
  50. package/corpus/templates/analytics/server/plugins/creative-context.ts +10 -0
  51. package/corpus/templates/assets/.agents/skills/creative-context/SKILL.md +12 -3
  52. package/corpus/templates/assets/AGENTS.md +5 -0
  53. package/corpus/templates/assets/actions/clone-creative-context-asset.ts +74 -0
  54. package/corpus/templates/assets/app/hooks/use-navigation-state.ts +2 -1
  55. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +308 -178
  56. package/corpus/templates/assets/app/routes/library.tsx +5 -11
  57. package/corpus/templates/assets/changelog/2026-07-17-library-now-flags-published-assets-with-newer-versions-and-l.md +6 -0
  58. package/corpus/templates/assets/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
  59. package/corpus/templates/assets/server/lib/native-creative-context.ts +198 -0
  60. package/corpus/templates/assets/server/plugins/creative-context.ts +4 -0
  61. package/corpus/templates/brain/actions/provider-api-request.ts +1 -0
  62. package/corpus/templates/calendar/actions/provider-api-request.ts +1 -0
  63. package/corpus/templates/clips/actions/get-recording-insights.ts +7 -4
  64. package/corpus/templates/clips/actions/list-recordings.ts +48 -0
  65. package/corpus/templates/clips/actions/list-viewers.ts +2 -1
  66. package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +3 -1
  67. package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -3
  68. package/corpus/templates/clips/app/hooks/use-desktop-promo.ts +11 -6
  69. package/corpus/templates/clips/app/hooks/use-view-tracking.ts +6 -1
  70. package/corpus/templates/clips/app/lib/ffmpeg-export.ts +4 -2
  71. package/corpus/templates/clips/app/routes/share.$shareId.tsx +21 -3
  72. package/corpus/templates/clips/changelog/2026-07-17-dictation-keeps-sentence-spacing-and-no-longer-crashes-when-.md +6 -0
  73. package/corpus/templates/clips/changelog/2026-07-17-shared-clips-now-preserve-editor-access-and-show-editor-insi.md +6 -0
  74. package/corpus/templates/clips/changelog/2026-07-17-stitching-clips-no-longer-fails-when-editor-media-metadata-i.md +6 -0
  75. package/corpus/templates/clips/server/routes/api/public-recording.get.ts +14 -8
  76. package/corpus/templates/clips/shared/view-analytics.ts +4 -0
  77. package/corpus/templates/content/.agents/skills/creative-context/SKILL.md +12 -3
  78. package/corpus/templates/content/AGENTS.md +5 -0
  79. package/corpus/templates/content/actions/clone-creative-context-document.ts +61 -0
  80. package/corpus/templates/content/actions/provider-api-request.ts +1 -0
  81. package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +21 -0
  82. package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +29 -0
  83. package/corpus/templates/content/changelog/2026-07-17-library-now-flags-published-documents-with-newer-versions-an.md +6 -0
  84. package/corpus/templates/content/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
  85. package/corpus/templates/content/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
  86. package/corpus/templates/content/parity/matrix.md +1 -1
  87. package/corpus/templates/content/parity/matrix.ts +1 -0
  88. package/corpus/templates/content/server/lib/native-creative-context.ts +191 -0
  89. package/corpus/templates/content/server/plugins/creative-context.ts +8 -1
  90. package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +11 -3
  91. package/corpus/templates/design/AGENTS.md +5 -0
  92. package/corpus/templates/design/actions/clone-creative-context-design-native.ts +111 -0
  93. package/corpus/templates/design/actions/provider-api-request.ts +1 -0
  94. package/corpus/templates/design/app/pages/Index.tsx +44 -0
  95. package/corpus/templates/design/app/pages/design-editor/types.ts +1 -0
  96. package/corpus/templates/design/changelog/2026-07-17-library-now-flags-published-designs-with-newer-versions-and-.md +6 -0
  97. package/corpus/templates/design/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
  98. package/corpus/templates/design/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
  99. package/corpus/templates/design/server/lib/native-creative-context.ts +265 -0
  100. package/corpus/templates/design/server/plugins/creative-context.ts +8 -1
  101. package/corpus/templates/dispatch/actions/provider-api-request.ts +1 -0
  102. package/corpus/templates/mail/actions/provider-api-request.ts +1 -0
  103. package/corpus/templates/slides/.agents/skills/creative-context/SKILL.md +11 -3
  104. package/corpus/templates/slides/AGENTS.md +5 -0
  105. package/corpus/templates/slides/actions/clone-creative-context-deck.ts +96 -0
  106. package/corpus/templates/slides/actions/extract-pdf.ts +3 -2
  107. package/corpus/templates/slides/actions/import-file.ts +3 -2
  108. package/corpus/templates/slides/actions/provider-api-request.ts +1 -0
  109. package/corpus/templates/slides/app/components/deck/DeckCard.tsx +27 -0
  110. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +21 -0
  111. package/corpus/templates/slides/changelog/2026-07-17-library-now-flags-published-decks-with-newer-versions-and-le.md +6 -0
  112. package/corpus/templates/slides/changelog/2026-07-17-pdf-and-powerpoint-imports-now-work-reliably-in-hosted-decks.md +6 -0
  113. package/corpus/templates/slides/changelog/2026-07-17-resources-can-be-added-to-creative-context-from-their-action.md +6 -0
  114. package/corpus/templates/slides/changelog/2026-07-17-you-can-add-exact-approved-artifact-versions-to-governed-cre.md +6 -0
  115. package/corpus/templates/slides/server/lib/native-creative-context.ts +288 -0
  116. package/corpus/templates/slides/server/plugins/creative-context.ts +4 -0
  117. package/dist/client/AssistantChat.d.ts.map +1 -1
  118. package/dist/client/AssistantChat.js +8 -2
  119. package/dist/client/AssistantChat.js.map +1 -1
  120. package/dist/client/chat/message-components.d.ts.map +1 -1
  121. package/dist/client/chat/message-components.js +35 -1
  122. package/dist/client/chat/message-components.js.map +1 -1
  123. package/dist/client/composer/TiptapComposer.d.ts +7 -0
  124. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  125. package/dist/client/composer/TiptapComposer.js +37 -8
  126. package/dist/client/composer/TiptapComposer.js.map +1 -1
  127. package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
  128. package/dist/client/integrations/IntegrationsPanel.js +3 -2
  129. package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
  130. package/dist/client/resources/McpConnectionSuggestion.d.ts +9 -0
  131. package/dist/client/resources/McpConnectionSuggestion.d.ts.map +1 -0
  132. package/dist/client/resources/McpConnectionSuggestion.js +115 -0
  133. package/dist/client/resources/McpConnectionSuggestion.js.map +1 -0
  134. package/dist/client/resources/McpIntegrationDialog.d.ts +2 -1
  135. package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
  136. package/dist/client/resources/McpIntegrationDialog.js +48 -20
  137. package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
  138. package/dist/client/resources/mcp-integration-catalog.d.ts +9 -0
  139. package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
  140. package/dist/client/resources/mcp-integration-catalog.js +387 -4
  141. package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
  142. package/dist/client/resources/mcp-integration-logos.d.ts +2 -0
  143. package/dist/client/resources/mcp-integration-logos.d.ts.map +1 -0
  144. package/dist/client/resources/mcp-integration-logos.js +109 -0
  145. package/dist/client/resources/mcp-integration-logos.js.map +1 -0
  146. package/dist/collab/awareness.d.ts +2 -2
  147. package/dist/collab/awareness.d.ts.map +1 -1
  148. package/dist/deploy/build.d.ts.map +1 -1
  149. package/dist/deploy/build.js +23 -0
  150. package/dist/deploy/build.js.map +1 -1
  151. package/dist/extensions/html-shell.d.ts.map +1 -1
  152. package/dist/extensions/html-shell.js +33 -1
  153. package/dist/extensions/html-shell.js.map +1 -1
  154. package/dist/ingestion/office.d.ts.map +1 -1
  155. package/dist/ingestion/office.js +1 -2
  156. package/dist/ingestion/office.js.map +1 -1
  157. package/dist/ingestion/pptx.js +2 -4
  158. package/dist/ingestion/pptx.js.map +1 -1
  159. package/dist/localization/default-messages.d.ts +98 -0
  160. package/dist/localization/default-messages.d.ts.map +1 -1
  161. package/dist/localization/default-messages.js +99 -1
  162. package/dist/localization/default-messages.js.map +1 -1
  163. package/dist/mcp/actions/call-mcp-tool.js +1 -0
  164. package/dist/mcp/actions/call-mcp-tool.js.map +1 -1
  165. package/dist/notifications/routes.d.ts +1 -1
  166. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  167. package/dist/resources/handlers.d.ts +1 -1
  168. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  169. package/dist/server/index.d.ts +1 -0
  170. package/dist/server/index.d.ts.map +1 -1
  171. package/dist/server/index.js +1 -0
  172. package/dist/server/index.js.map +1 -1
  173. package/dist/server/org-admin.d.ts +3 -0
  174. package/dist/server/org-admin.d.ts.map +1 -0
  175. package/dist/server/org-admin.js +24 -0
  176. package/dist/server/org-admin.js.map +1 -0
  177. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
  178. package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
  179. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
  180. package/docs/content/integrations.mdx +597 -0
  181. package/docs/content/locales/ar-SA/mcp-clients.mdx +19 -1
  182. package/docs/content/locales/de-DE/mcp-clients.mdx +22 -1
  183. package/docs/content/locales/es-ES/mcp-clients.mdx +23 -1
  184. package/docs/content/locales/fr-FR/mcp-clients.mdx +23 -1
  185. package/docs/content/locales/hi-IN/mcp-clients.mdx +22 -1
  186. package/docs/content/locales/ja-JP/mcp-clients.mdx +21 -1
  187. package/docs/content/locales/ko-KR/mcp-clients.mdx +20 -1
  188. package/docs/content/locales/pt-BR/mcp-clients.mdx +22 -1
  189. package/docs/content/locales/zh-CN/mcp-clients.mdx +17 -1
  190. package/docs/content/locales/zh-TW/mcp-clients.mdx +17 -1
  191. package/docs/content/mcp-clients.mdx +51 -1
  192. package/docs/content/organizations-teams-permissions.mdx +413 -0
  193. package/package.json +1 -1
  194. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +9 -0
  195. package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +31 -0
  196. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAychE,wBAAgB,iBAAiB,sBA8IhC"}
1
+ {"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,KAA2C,MAAM,OAAO,CAAC;AA0chE,wBAAgB,iBAAiB,sBAgKhC"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { IconPlus, IconBrandSlack, IconBrandTelegram, IconBrandWhatsapp, IconBrandGoogleDrive, IconTerminal2, IconBuildingSkyscraper, IconCopy, IconCheck, IconChevronLeft, IconExternalLink, IconCircleCheck, } from "@tabler/icons-react";
3
3
  import { useState, useCallback, useEffect } from "react";
4
+ import { AgentAskPopover } from "../AgentAskPopover.js";
4
5
  import { agentNativePath } from "../api-path.js";
5
6
  import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
6
7
  import { useT } from "../i18n.js";
@@ -197,12 +198,12 @@ export function IntegrationsPanel() {
197
198
  return (_jsx(IntegrationDetail, { platform: selectedPlatform, serverStatus: statusMap.get(selectedPlatform.id), onBack: () => setSelectedPlatform(null), onRefresh: refetch }));
198
199
  }
199
200
  if (showPicker) {
200
- return (_jsxs("div", { children: [_jsxs("button", { onClick: () => setShowPicker(false), className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12, className: "rtl:-scale-x-100" }), t("integrations.back")] }), _jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: t("integrations.addChatIntegration") }), _jsx(AddIntegrationPicker, { connectedIds: connectedIds, onSelect: (p) => {
201
+ return (_jsxs("div", { children: [_jsxs("button", { onClick: () => setShowPicker(false), className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12, className: "rtl:-scale-x-100" }), t("integrations.back")] }), _jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: t("integrations.addChatIntegration") }), _jsx(AgentAskPopover, { label: t("integrations.addSomething"), title: t("integrations.addSomethingTitle"), placeholder: t("integrations.addSomethingPlaceholder"), prompt: "", context: "The user wants to add a chat or workspace integration that is not in the current directory. Research the provider's official OAuth or MCP setup, explain any app registration or allowlist requirements, and add a reusable integration preset when it is supported. Never ask the user to paste credentials into a prompt.", className: "mb-2 h-7 w-full justify-center border-dashed px-2 text-[10px]" }), _jsx(AddIntegrationPicker, { connectedIds: connectedIds, onSelect: (p) => {
201
202
  setSelectedPlatform(p);
202
203
  setShowPicker(false);
203
204
  } })] }));
204
205
  }
205
- return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: t("integrations.chatIntegrations") }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: t("integrations.chatIntegrationsDescription") })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => setShowPicker(true), className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 12 }) }) }), _jsx(TooltipContent, { children: t("integrations.addIntegration") })] })] }), loading ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-6 w-full rounded bg-muted/50 animate-pulse" }), _jsx("div", { className: "h-6 w-3/4 rounded bg-muted/50 animate-pulse" })] })) : connectedPlatforms.length === 0 ? (_jsxs("div", { className: "space-y-2", children: [_jsxs("button", { onClick: () => setShowPicker(true), className: "flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30", children: [_jsx(IconPlus, { size: 12, className: "shrink-0" }), t("integrations.addIntegration")] }), _jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground", children: [t("integrations.dispatchEntrypoint"), " ", _jsx("a", { href: "https://dispatch.agent-native.com", target: "_blank", rel: "noopener noreferrer", className: "no-underline font-medium text-foreground hover:text-foreground/80", children: "dispatch template" }), "."] })] })) : (_jsxs("div", { className: "space-y-2", children: [connectedPlatforms.map((platform) => {
206
+ return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: t("integrations.chatIntegrations") }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: t("integrations.chatIntegrationsDescription") })] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => setShowPicker(true), className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent/50 hover:text-foreground", children: _jsx(IconPlus, { size: 12 }) }) }), _jsx(TooltipContent, { children: t("integrations.addIntegration") })] }), _jsx(AgentAskPopover, { label: t("integrations.addSomething"), title: t("integrations.addSomethingTitle"), placeholder: t("integrations.addSomethingPlaceholder"), prompt: "", context: "The user wants to add a chat or workspace integration that is not in the current directory. Research the provider's official OAuth or MCP setup, explain any app registration or allowlist requirements, and add a reusable integration preset when it is supported. Never ask the user to paste credentials into a prompt.", className: "h-7 px-2 text-[10px]" })] })] }), loading ? (_jsxs("div", { className: "space-y-1.5", children: [_jsx("div", { className: "h-6 w-full rounded bg-muted/50 animate-pulse" }), _jsx("div", { className: "h-6 w-3/4 rounded bg-muted/50 animate-pulse" })] })) : connectedPlatforms.length === 0 ? (_jsxs("div", { className: "space-y-2", children: [_jsxs("button", { onClick: () => setShowPicker(true), className: "flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30", children: [_jsx(IconPlus, { size: 12, className: "shrink-0" }), t("integrations.addIntegration")] }), _jsxs("div", { className: "rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground", children: [t("integrations.dispatchEntrypoint"), " ", _jsx("a", { href: "https://dispatch.agent-native.com", target: "_blank", rel: "noopener noreferrer", className: "no-underline font-medium text-foreground hover:text-foreground/80", children: "dispatch template" }), "."] })] })) : (_jsxs("div", { className: "space-y-2", children: [connectedPlatforms.map((platform) => {
206
207
  const s = statusMap.get(platform.id);
207
208
  return (_jsxs("button", { onClick: () => setSelectedPlatform(platform), className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start hover:bg-accent/50", children: [_jsx(platform.icon, { size: 14, className: "shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 text-[11px] font-medium text-foreground truncate", children: platform.label }), s && (_jsx("span", { className: `inline-block h-1.5 w-1.5 rounded-full shrink-0 ${s.enabled && s.configured
208
209
  ? "bg-green-500"
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AAgBnC,MAAM,SAAS,GAAmB;IAChC;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,oFAAoF;QACtF,OAAO,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;QACpD,UAAU,EAAE;YACV,iEAAiE;YACjE,0EAA0E;YAC1E,yGAAyG;SAC1G;QACD,OAAO,EAAE,4BAA4B;KACtC;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE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B,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;wBACnC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wBACrC,OAAO,CACL,kBAEE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAC5C,SAAS,EAAC,qFAAqF,aAE/F,KAAC,QAAQ,CAAC,IAAI,IACZ,IAAI,EAAE,EAAE,EACR,SAAS,EAAC,gCAAgC,GAC1C,EACF,eAAM,SAAS,EAAC,yDAAyD,YACtE,QAAQ,CAAC,KAAK,GACV,EACN,CAAC,IAAI,CACJ,eACE,SAAS,EAAE,kDACT,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU;wCACvB,CAAC,CAAC,cAAc;wCAChB,CAAC,CAAC,CAAC,CAAC,UAAU;4CACZ,CAAC,CAAC,eAAe;4CACjB,CAAC,CAAC,wBACR,EAAE,GACF,CACH,KArBI,QAAQ,CAAC,EAAE,CAsBT,CACV,CAAC;oBACJ,CAAC,CAAC,EACF,cAAK,SAAS,EAAC,2FAA2F,YACvG,CAAC,CAAC,8BAA8B,CAAC,GAC9B,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport React, { useState, useCallback, useEffect } from \"react\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack (legacy)\",\n icon: IconBrandSlack,\n description:\n \"Legacy single-workspace setup. Use Settings → Messaging for new Slack connections.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Open Settings → Messaging for the supported managed Slack setup\",\n \"Use this legacy setup only for an existing single-workspace installation\",\n \"Managed OAuth stores workspace bot tokens automatically; do not add SLACK_BOT_TOKEN for new connections\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\nfunction useAgentEngineConfigured() {\n const [configured, setConfigured] = useState<boolean | undefined>(undefined);\n\n const refresh = useCallback(() => {\n fetch(agentNativePath(\"/_agent-native/agent-engine/status\"))\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (typeof data?.configured === \"boolean\") {\n setConfigured(data.configured);\n }\n })\n .catch(() => {});\n }, []);\n\n useEffect(() => {\n refresh();\n window.addEventListener(\"agent-engine:configured-changed\", refresh);\n return () =>\n window.removeEventListener(\"agent-engine:configured-changed\", refresh);\n }, [refresh]);\n\n return configured;\n}\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const t = useT();\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n const agentEngineConfigured = useAgentEngineConfigured();\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error ? err.message : t(\"integrations.networkError\"),\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const handleOpenLlmSettings = useCallback(() => {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:open-settings\", {\n detail: { section: \"llm\" },\n }),\n );\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n const showAgentEnginePrereq =\n !platform.isClient && agentEngineConfigured === false;\n const serviceAccountEmail =\n typeof serverStatus?.details?.serviceAccountEmail === \"string\"\n ? serverStatus.details.serviceAccountEmail\n : null;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} className=\"rtl:-scale-x-100\" />\n {t(\"integrations.back\")}\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {showAgentEnginePrereq && (\n <div className=\"mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"text-[10px] font-medium text-foreground\">\n {t(\"integrations.agentEngineRequired\")}\n </div>\n <p className=\"mt-0.5 text-[10px] leading-relaxed text-muted-foreground\">\n {t(\"integrations.agentEngineDescription\", {\n platform: platform.label,\n })}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleOpenLlmSettings}\n className=\"shrink-0 rounded border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground\"\n >\n {t(\"integrations.openLlm\")}\n </button>\n </div>\n </div>\n )}\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n {t(\"integrations.setup\")}\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {serviceAccountEmail && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.shareDocumentsWith\")}\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serviceAccountEmail}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serviceAccountEmail)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>\n {t(\"integrations.copyServiceAccountEmail\")}\n </TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.requiredSecrets\")}\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n {t(\"integrations.envHelp\")}\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.webhookUrl\")}\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>{t(\"integrations.copy\")}</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n {t(\"integrations.documentation\")}\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling\n ? t(\"integrations.toggling\")\n : isEnabled\n ? t(\"integrations.disable\")\n : t(\"integrations.enable\")}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.clientAvailable\")}\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const t = useT();\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} className=\"rtl:-scale-x-100\" />\n {t(\"integrations.back\")}\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n {t(\"integrations.addChatIntegration\")}\n </div>\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {t(\"integrations.chatIntegrations\")}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {t(\"integrations.chatIntegrationsDescription\")}\n </div>\n </div>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n <IconPlus size={12} />\n </button>\n </TooltipTrigger>\n <TooltipContent>{t(\"integrations.addIntegration\")}</TooltipContent>\n </Tooltip>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n {t(\"integrations.addIntegration\")}\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.dispatchEntrypoint\")}{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-muted-foreground/55\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.sharedMessaging\")}\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,GACh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,QAAQ,EAAE,EAAE;wBACnC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wBACrC,OAAO,CACL,kBAEE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAC5C,SAAS,EAAC,qFAAqF,aAE/F,KAAC,QAAQ,CAAC,IAAI,IACZ,IAAI,EAAE,EAAE,EACR,SAAS,EAAC,gCAAgC,GAC1C,EACF,eAAM,SAAS,EAAC,yDAAyD,YACtE,QAAQ,CAAC,KAAK,GACV,EACN,CAAC,IAAI,CACJ,eACE,SAAS,EAAE,kDACT,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU;wCACvB,CAAC,CAAC,cAAc;wCAChB,CAAC,CAAC,CAAC,CAAC,UAAU;4CACZ,CAAC,CAAC,eAAe;4CACjB,CAAC,CAAC,wBACR,EAAE,GACF,CACH,KArBI,QAAQ,CAAC,EAAE,CAsBT,CACV,CAAC;oBACJ,CAAC,CAAC,EACF,cAAK,SAAS,EAAC,2FAA2F,YACvG,CAAC,CAAC,8BAA8B,CAAC,GAC9B,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport React, { useState, useCallback, useEffect } from \"react\";\n\nimport { AgentAskPopover } from \"../AgentAskPopover.js\";\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack (legacy)\",\n icon: IconBrandSlack,\n description:\n \"Legacy single-workspace setup. Use Settings → Messaging for new Slack connections.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Open Settings → Messaging for the supported managed Slack setup\",\n \"Use this legacy setup only for an existing single-workspace installation\",\n \"Managed OAuth stores workspace bot tokens automatically; do not add SLACK_BOT_TOKEN for new connections\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\nfunction useAgentEngineConfigured() {\n const [configured, setConfigured] = useState<boolean | undefined>(undefined);\n\n const refresh = useCallback(() => {\n fetch(agentNativePath(\"/_agent-native/agent-engine/status\"))\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (typeof data?.configured === \"boolean\") {\n setConfigured(data.configured);\n }\n })\n .catch(() => {});\n }, []);\n\n useEffect(() => {\n refresh();\n window.addEventListener(\"agent-engine:configured-changed\", refresh);\n return () =>\n window.removeEventListener(\"agent-engine:configured-changed\", refresh);\n }, [refresh]);\n\n return configured;\n}\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const t = useT();\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n const agentEngineConfigured = useAgentEngineConfigured();\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error ? err.message : t(\"integrations.networkError\"),\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const handleOpenLlmSettings = useCallback(() => {\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:open-settings\", {\n detail: { section: \"llm\" },\n }),\n );\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n const showAgentEnginePrereq =\n !platform.isClient && agentEngineConfigured === false;\n const serviceAccountEmail =\n typeof serverStatus?.details?.serviceAccountEmail === \"string\"\n ? serverStatus.details.serviceAccountEmail\n : null;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} className=\"rtl:-scale-x-100\" />\n {t(\"integrations.back\")}\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {showAgentEnginePrereq && (\n <div className=\"mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <div className=\"min-w-0\">\n <div className=\"text-[10px] font-medium text-foreground\">\n {t(\"integrations.agentEngineRequired\")}\n </div>\n <p className=\"mt-0.5 text-[10px] leading-relaxed text-muted-foreground\">\n {t(\"integrations.agentEngineDescription\", {\n platform: platform.label,\n })}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={handleOpenLlmSettings}\n className=\"shrink-0 rounded border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground\"\n >\n {t(\"integrations.openLlm\")}\n </button>\n </div>\n </div>\n )}\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n {t(\"integrations.setup\")}\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {serviceAccountEmail && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.shareDocumentsWith\")}\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serviceAccountEmail}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serviceAccountEmail)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>\n {t(\"integrations.copyServiceAccountEmail\")}\n </TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.requiredSecrets\")}\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n {t(\"integrations.envHelp\")}\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n {t(\"integrations.webhookUrl\")}\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </TooltipTrigger>\n <TooltipContent>{t(\"integrations.copy\")}</TooltipContent>\n </Tooltip>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n {t(\"integrations.documentation\")}\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling\n ? t(\"integrations.toggling\")\n : isEnabled\n ? t(\"integrations.disable\")\n : t(\"integrations.enable\")}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.clientAvailable\")}\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const t = useT();\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} className=\"rtl:-scale-x-100\" />\n {t(\"integrations.back\")}\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n {t(\"integrations.addChatIntegration\")}\n </div>\n <AgentAskPopover\n label={t(\"integrations.addSomething\")}\n title={t(\"integrations.addSomethingTitle\")}\n placeholder={t(\"integrations.addSomethingPlaceholder\")}\n prompt=\"\"\n context=\"The user wants to add a chat or workspace integration that is not in the current directory. Research the provider's official OAuth or MCP setup, explain any app registration or allowlist requirements, and add a reusable integration preset when it is supported. Never ask the user to paste credentials into a prompt.\"\n className=\"mb-2 h-7 w-full justify-center border-dashed px-2 text-[10px]\"\n />\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {t(\"integrations.chatIntegrations\")}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {t(\"integrations.chatIntegrationsDescription\")}\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:bg-accent/50 hover:text-foreground\"\n >\n <IconPlus size={12} />\n </button>\n </TooltipTrigger>\n <TooltipContent>{t(\"integrations.addIntegration\")}</TooltipContent>\n </Tooltip>\n <AgentAskPopover\n label={t(\"integrations.addSomething\")}\n title={t(\"integrations.addSomethingTitle\")}\n placeholder={t(\"integrations.addSomethingPlaceholder\")}\n prompt=\"\"\n context=\"The user wants to add a chat or workspace integration that is not in the current directory. Research the provider's official OAuth or MCP setup, explain any app registration or allowlist requirements, and add a reusable integration preset when it is supported. Never ask the user to paste credentials into a prompt.\"\n className=\"h-7 px-2 text-[10px]\"\n />\n </div>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n {t(\"integrations.addIntegration\")}\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.dispatchEntrypoint\")}{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-muted-foreground/55\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n {t(\"integrations.sharedMessaging\")}\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -0,0 +1,9 @@
1
+ export type McpConnectionSuggestionVariant = "composer" | "response";
2
+ interface McpConnectionSuggestionProps {
3
+ text: string;
4
+ contextText?: string;
5
+ variant?: McpConnectionSuggestionVariant;
6
+ }
7
+ export declare function McpConnectionSuggestion({ text, contextText, variant, }: McpConnectionSuggestionProps): import("react").JSX.Element | null;
8
+ export {};
9
+ //# sourceMappingURL=McpConnectionSuggestion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpConnectionSuggestion.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":"AAwBA,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,UAAU,4BAA4B;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,8BAA8B,CAAC;CAC1C;AAuCD,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,WAAgB,EAChB,OAAoB,GACrB,EAAE,4BAA4B,sCAsK9B"}
@@ -0,0 +1,115 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconArrowUpRight, IconLoader2, IconPlugConnected, IconX, } from "@tabler/icons-react";
3
+ import { useEffect, useMemo, useState } from "react";
4
+ import { agentNativePath } from "../api-path.js";
5
+ import { useT } from "../i18n.js";
6
+ import { buildMcpOAuthStartUrl, findMcpIntegrationForText, getDefaultMcpIntegrations, isMcpConnectionFailureText, } from "./mcp-integration-catalog.js";
7
+ import { McpIntegrationDialog } from "./McpIntegrationDialog.js";
8
+ import { useCreateMcpServer, useMcpServers, } from "./use-mcp-servers.js";
9
+ function compareUrl(value) {
10
+ try {
11
+ const url = new URL(value.trim());
12
+ url.hash = "";
13
+ return url.toString().replace(/\/+$/, "");
14
+ }
15
+ catch {
16
+ return value.trim().replace(/\/+$/, "");
17
+ }
18
+ }
19
+ function isConnected(integration, servers) {
20
+ const targetUrl = compareUrl(integration.url);
21
+ return servers.some((server) => server.status.state === "connected" &&
22
+ compareUrl(server.url) === targetUrl);
23
+ }
24
+ function returnUrl() {
25
+ if (typeof window === "undefined")
26
+ return "/";
27
+ return (window.location.pathname + window.location.search + window.location.hash);
28
+ }
29
+ function canStartOAuth(integration) {
30
+ return (integration.authMode === "oauth" &&
31
+ integration.connectionMode === "oauth" &&
32
+ integration.availability === "ready");
33
+ }
34
+ export function McpConnectionSuggestion({ text, contextText = "", variant = "composer", }) {
35
+ const t = useT();
36
+ const mcpServersQuery = useMcpServers();
37
+ const createMcpServer = useCreateMcpServer();
38
+ const [dialogOpen, setDialogOpen] = useState(false);
39
+ const [dismissedId, setDismissedId] = useState(null);
40
+ const [connecting, setConnecting] = useState(false);
41
+ const [error, setError] = useState(null);
42
+ const integrations = useMemo(() => getDefaultMcpIntegrations(), []);
43
+ const textIntegration = useMemo(() => findMcpIntegrationForText(text, integrations), [integrations, text]);
44
+ const contextIntegration = useMemo(() => contextText ? findMcpIntegrationForText(contextText, integrations) : null, [contextText, integrations]);
45
+ const integration = variant === "response" &&
46
+ textIntegration &&
47
+ contextIntegration &&
48
+ textIntegration.id !== contextIntegration.id
49
+ ? null
50
+ : (textIntegration ?? contextIntegration);
51
+ const servers = useMemo(() => [
52
+ ...(mcpServersQuery.data?.user ?? []),
53
+ ...(mcpServersQuery.data?.org ?? []),
54
+ ], [mcpServersQuery.data]);
55
+ const connected = integration ? isConnected(integration, servers) : false;
56
+ const shouldSuggest = mcpServersQuery.isSuccess &&
57
+ integration &&
58
+ !connected &&
59
+ dismissedId !== integration.id &&
60
+ (variant === "composer" || isMcpConnectionFailureText(text));
61
+ useEffect(() => {
62
+ setError(null);
63
+ setConnecting(false);
64
+ }, [integration?.id, variant]);
65
+ if (!shouldSuggest)
66
+ return null;
67
+ const connect = async () => {
68
+ if (!integration || connecting)
69
+ return;
70
+ setError(null);
71
+ if (canStartOAuth(integration)) {
72
+ window.location.assign(agentNativePath(buildMcpOAuthStartUrl({
73
+ name: integration.name,
74
+ url: integration.url,
75
+ description: integration.description,
76
+ scope: "user",
77
+ returnUrl: returnUrl(),
78
+ })));
79
+ return;
80
+ }
81
+ if (integration.authMode === "none" &&
82
+ integration.connectionMode === "direct") {
83
+ setConnecting(true);
84
+ try {
85
+ await createMcpServer.mutateAsync({
86
+ scope: "user",
87
+ name: integration.name,
88
+ url: integration.url,
89
+ description: integration.description,
90
+ });
91
+ setDismissedId(integration.id);
92
+ }
93
+ catch (cause) {
94
+ setError(cause instanceof Error ? cause.message : t("mcpIntegrations.failed"));
95
+ }
96
+ finally {
97
+ setConnecting(false);
98
+ }
99
+ return;
100
+ }
101
+ setDialogOpen(true);
102
+ };
103
+ const actionLabel = canStartOAuth(integration)
104
+ ? t("mcpIntegrations.connectWithOAuth")
105
+ : integration.availability === "client-restricted" ||
106
+ integration.availability === "provider-setup"
107
+ ? t("mcpIntegrations.viewSetup")
108
+ : t("mcpIntegrations.connect");
109
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: variant === "response"
110
+ ? "mt-3 flex max-w-[520px] items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-[12px]"
111
+ : "mx-auto mb-2 flex w-[min(100%,680px)] items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-[12px]", "data-mcp-connection-suggestion": integration.id, children: [_jsxs("div", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-background text-[10px] font-semibold text-muted-foreground", children: [_jsx("span", { "aria-hidden": "true", children: integration.name.slice(0, 1) }), integration.logoUrl && (_jsx("img", { src: integration.logoUrl, alt: "", className: "absolute h-5 w-5 object-contain", onError: (event) => {
112
+ event.currentTarget.hidden = true;
113
+ } }))] }), _jsx("span", { className: "min-w-0 flex-1 leading-snug text-foreground", children: t("mcpIntegrations.connectSuggestion", { name: integration.name }) }), _jsxs("button", { type: "button", onClick: () => void connect(), disabled: connecting, className: "inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2.5 py-1.5 text-[11px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-60", children: [connecting && _jsx(IconLoader2, { className: "h-3 w-3 animate-spin" }), !connecting && canStartOAuth(integration) && (_jsx(IconPlugConnected, { className: "h-3 w-3" })), actionLabel, !connecting && !canStartOAuth(integration) && (_jsx(IconArrowUpRight, { className: "h-3 w-3" }))] }), _jsx("button", { type: "button", onClick: () => setDismissedId(integration.id), className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground", "aria-label": t("mcpIntegrations.dismissSuggestion"), children: _jsx(IconX, { className: "h-3.5 w-3.5" }) })] }), error && (_jsx("div", { className: "mx-auto mb-2 w-[min(100%,680px)] text-[11px] text-destructive", children: error })), _jsx(McpIntegrationDialog, { open: dialogOpen, onOpenChange: setDialogOpen, initialIntegrationId: integration.id, defaultScope: "user", canCreateOrgMcp: false, hasOrg: Boolean(mcpServersQuery.data?.orgId), onCreateMcpServer: (args) => createMcpServer.mutateAsync(args), onCreated: () => setDismissedId(integration.id) })] }));
114
+ }
115
+ //# sourceMappingURL=McpConnectionSuggestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpConnectionSuggestion.js","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,iBAA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C,SAAS,EAAC,aAAa,GAAG,GAC1B,IACL,EACL,KAAK,IAAI,CACR,cAAK,SAAS,EAAC,+DAA+D,YAC3E,KAAK,GACF,CACP,EACD,KAAC,oBAAoB,IACnB,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,aAAa,EAC3B,oBAAoB,EAAE,WAAW,CAAC,EAAE,EACpC,YAAY,EAAC,MAAM,EACnB,eAAe,EAAE,KAAK,EACtB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,EAC5C,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,EAC9D,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC,GAC/C,IACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconArrowUpRight,\n IconLoader2,\n IconPlugConnected,\n IconX,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n buildMcpOAuthStartUrl,\n findMcpIntegrationForText,\n getDefaultMcpIntegrations,\n isMcpConnectionFailureText,\n type DefaultMcpIntegration,\n} from \"./mcp-integration-catalog.js\";\nimport { McpIntegrationDialog } from \"./McpIntegrationDialog.js\";\nimport {\n useCreateMcpServer,\n useMcpServers,\n type McpServer,\n} from \"./use-mcp-servers.js\";\n\nexport type McpConnectionSuggestionVariant = \"composer\" | \"response\";\n\ninterface McpConnectionSuggestionProps {\n text: string;\n contextText?: string;\n variant?: McpConnectionSuggestionVariant;\n}\n\nfunction compareUrl(value: string): string {\n try {\n const url = new URL(value.trim());\n url.hash = \"\";\n return url.toString().replace(/\\/+$/, \"\");\n } catch {\n return value.trim().replace(/\\/+$/, \"\");\n }\n}\n\nfunction isConnected(\n integration: DefaultMcpIntegration,\n servers: McpServer[],\n): boolean {\n const targetUrl = compareUrl(integration.url);\n return servers.some(\n (server) =>\n server.status.state === \"connected\" &&\n compareUrl(server.url) === targetUrl,\n );\n}\n\nfunction returnUrl(): string {\n if (typeof window === \"undefined\") return \"/\";\n return (\n window.location.pathname + window.location.search + window.location.hash\n );\n}\n\nfunction canStartOAuth(integration: DefaultMcpIntegration): boolean {\n return (\n integration.authMode === \"oauth\" &&\n integration.connectionMode === \"oauth\" &&\n integration.availability === \"ready\"\n );\n}\n\nexport function McpConnectionSuggestion({\n text,\n contextText = \"\",\n variant = \"composer\",\n}: McpConnectionSuggestionProps) {\n const t = useT();\n const mcpServersQuery = useMcpServers();\n const createMcpServer = useCreateMcpServer();\n const [dialogOpen, setDialogOpen] = useState(false);\n const [dismissedId, setDismissedId] = useState<string | null>(null);\n const [connecting, setConnecting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const integrations = useMemo(() => getDefaultMcpIntegrations(), []);\n const textIntegration = useMemo(\n () => findMcpIntegrationForText(text, integrations),\n [integrations, text],\n );\n const contextIntegration = useMemo(\n () =>\n contextText ? findMcpIntegrationForText(contextText, integrations) : null,\n [contextText, integrations],\n );\n const integration =\n variant === \"response\" &&\n textIntegration &&\n contextIntegration &&\n textIntegration.id !== contextIntegration.id\n ? null\n : (textIntegration ?? contextIntegration);\n const servers = useMemo(\n () => [\n ...(mcpServersQuery.data?.user ?? []),\n ...(mcpServersQuery.data?.org ?? []),\n ],\n [mcpServersQuery.data],\n );\n const connected = integration ? isConnected(integration, servers) : false;\n const shouldSuggest =\n mcpServersQuery.isSuccess &&\n integration &&\n !connected &&\n dismissedId !== integration.id &&\n (variant === \"composer\" || isMcpConnectionFailureText(text));\n\n useEffect(() => {\n setError(null);\n setConnecting(false);\n }, [integration?.id, variant]);\n\n if (!shouldSuggest) return null;\n\n const connect = async () => {\n if (!integration || connecting) return;\n setError(null);\n\n if (canStartOAuth(integration)) {\n window.location.assign(\n agentNativePath(\n buildMcpOAuthStartUrl({\n name: integration.name,\n url: integration.url,\n description: integration.description,\n scope: \"user\",\n returnUrl: returnUrl(),\n }),\n ),\n );\n return;\n }\n\n if (\n integration.authMode === \"none\" &&\n integration.connectionMode === \"direct\"\n ) {\n setConnecting(true);\n try {\n await createMcpServer.mutateAsync({\n scope: \"user\",\n name: integration.name,\n url: integration.url,\n description: integration.description,\n });\n setDismissedId(integration.id);\n } catch (cause) {\n setError(\n cause instanceof Error ? cause.message : t(\"mcpIntegrations.failed\"),\n );\n } finally {\n setConnecting(false);\n }\n return;\n }\n\n setDialogOpen(true);\n };\n\n const actionLabel = canStartOAuth(integration)\n ? t(\"mcpIntegrations.connectWithOAuth\")\n : integration.availability === \"client-restricted\" ||\n integration.availability === \"provider-setup\"\n ? t(\"mcpIntegrations.viewSetup\")\n : t(\"mcpIntegrations.connect\");\n\n return (\n <>\n <div\n className={\n variant === \"response\"\n ? \"mt-3 flex max-w-[520px] items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-[12px]\"\n : \"mx-auto mb-2 flex w-[min(100%,680px)] items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-[12px]\"\n }\n data-mcp-connection-suggestion={integration.id}\n >\n <div className=\"relative flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-background text-[10px] font-semibold text-muted-foreground\">\n <span aria-hidden=\"true\">{integration.name.slice(0, 1)}</span>\n {integration.logoUrl && (\n <img\n src={integration.logoUrl}\n alt=\"\"\n className=\"absolute h-5 w-5 object-contain\"\n onError={(event) => {\n event.currentTarget.hidden = true;\n }}\n />\n )}\n </div>\n <span className=\"min-w-0 flex-1 leading-snug text-foreground\">\n {t(\"mcpIntegrations.connectSuggestion\", { name: integration.name })}\n </span>\n <button\n type=\"button\"\n onClick={() => void connect()}\n disabled={connecting}\n className=\"inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2.5 py-1.5 text-[11px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-60\"\n >\n {connecting && <IconLoader2 className=\"h-3 w-3 animate-spin\" />}\n {!connecting && canStartOAuth(integration) && (\n <IconPlugConnected className=\"h-3 w-3\" />\n )}\n {actionLabel}\n {!connecting && !canStartOAuth(integration) && (\n <IconArrowUpRight className=\"h-3 w-3\" />\n )}\n </button>\n <button\n type=\"button\"\n onClick={() => setDismissedId(integration.id)}\n className=\"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-background hover:text-foreground\"\n aria-label={t(\"mcpIntegrations.dismissSuggestion\")}\n >\n <IconX className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n {error && (\n <div className=\"mx-auto mb-2 w-[min(100%,680px)] text-[11px] text-destructive\">\n {error}\n </div>\n )}\n <McpIntegrationDialog\n open={dialogOpen}\n onOpenChange={setDialogOpen}\n initialIntegrationId={integration.id}\n defaultScope=\"user\"\n canCreateOrgMcp={false}\n hasOrg={Boolean(mcpServersQuery.data?.orgId)}\n onCreateMcpServer={(args) => createMcpServer.mutateAsync(args)}\n onCreated={() => setDismissedId(integration.id)}\n />\n </>\n );\n}\n"]}
@@ -2,12 +2,13 @@ import { type CreateMcpServerArgs, type McpServerScope } from "./use-mcp-servers
2
2
  interface McpIntegrationDialogProps {
3
3
  open: boolean;
4
4
  onOpenChange: (open: boolean) => void;
5
+ initialIntegrationId?: string | null;
5
6
  defaultScope: McpServerScope;
6
7
  canCreateOrgMcp: boolean;
7
8
  hasOrg: boolean;
8
9
  onCreateMcpServer: (args: CreateMcpServerArgs) => Promise<unknown>;
9
10
  onCreated?: () => void;
10
11
  }
11
- export declare function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCreateOrgMcp, hasOrg, onCreateMcpServer, onCreated, }: McpIntegrationDialogProps): import("react").JSX.Element | null;
12
+ export declare function McpIntegrationDialog({ open, onOpenChange, initialIntegrationId, defaultScope, canCreateOrgMcp, hasOrg, onCreateMcpServer, onCreated, }: McpIntegrationDialogProps): import("react").JSX.Element | null;
12
13
  export {};
13
14
  //# sourceMappingURL=McpIntegrationDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpIntegrationDialog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAI9B,UAAU,yBAAyB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE,cAAc,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAgCD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,MAAM,EACN,iBAAiB,EACjB,SAAS,GACV,EAAE,yBAAyB,sCA6jB3B"}
1
+ {"version":3,"file":"McpIntegrationDialog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":"AAkCA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAI9B,UAAU,yBAAyB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,YAAY,EAAE,cAAc,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAgCD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,oBAA2B,EAC3B,YAAY,EACZ,eAAe,EACf,MAAM,EACN,iBAAiB,EACjB,SAAS,GACV,EAAE,yBAAyB,sCAirB3B"}
@@ -1,6 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { IconArrowLeft, IconCheck, IconExternalLink, IconLoader2, IconSearch, } from "@tabler/icons-react";
3
3
  import { useEffect, useMemo, useRef, useState } from "react";
4
+ import { AgentAskPopover } from "../AgentAskPopover.js";
4
5
  import { agentNativePath } from "../api-path.js";
5
6
  import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "../components/ui/dialog.js";
6
7
  import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
@@ -35,7 +36,7 @@ function compareUrl(value) {
35
36
  return value.trim().replace(/\/+$/, "");
36
37
  }
37
38
  }
38
- export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCreateOrgMcp, hasOrg, onCreateMcpServer, onCreated, }) {
39
+ export function McpIntegrationDialog({ open, onOpenChange, initialIntegrationId = null, defaultScope, canCreateOrgMcp, hasOrg, onCreateMcpServer, onCreated, }) {
39
40
  const t = useT();
40
41
  const [mode, setMode] = useState("catalog");
41
42
  const [query, setQuery] = useState("");
@@ -68,22 +69,36 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
68
69
  .map((server) => compareUrl(server.url)));
69
70
  }, [mcpServersQuery.data]);
70
71
  const filteredIntegrations = useMemo(() => filterMcpIntegrations(query, defaultIntegrations), [defaultIntegrations, query]);
72
+ const selectedRequiresSetup = Boolean(selected &&
73
+ (selected.connectionMode === "manual" ||
74
+ selected.availability === "provider-setup" ||
75
+ selected.availability === "client-restricted"));
71
76
  useEffect(() => {
72
77
  if (!open)
73
78
  return;
74
- setMode(showCatalog ? "catalog" : "form");
79
+ const initialIntegration = initialIntegrationId
80
+ ? defaultIntegrations.find((integration) => integration.id === initialIntegrationId)
81
+ : null;
82
+ const initialDefaults = createMcpIntegrationFormDefaults(initialIntegration);
83
+ setMode(initialIntegration || !showCatalog ? "form" : "catalog");
75
84
  setQuery("");
76
- setSelected(null);
85
+ setSelected(initialIntegration ?? null);
77
86
  setScope(safeDefaultScope);
78
- setName("");
79
- setUrl("");
80
- setDescription("");
81
- setHeadersText("");
87
+ setName(initialDefaults.name);
88
+ setUrl(initialDefaults.url);
89
+ setDescription(initialDefaults.description);
90
+ setHeadersText(initialDefaults.headersText);
82
91
  setBusy(false);
83
92
  setQuickBusyId(null);
84
93
  setError(null);
85
94
  setTestResult(null);
86
- }, [open, safeDefaultScope, showCatalog]);
95
+ }, [
96
+ defaultIntegrations,
97
+ initialIntegrationId,
98
+ open,
99
+ safeDefaultScope,
100
+ showCatalog,
101
+ ]);
87
102
  useEffect(() => {
88
103
  if (open && mode === "form") {
89
104
  const timer = window.setTimeout(() => inputRef.current?.focus(), 60);
@@ -180,6 +195,10 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
180
195
  });
181
196
  };
182
197
  const quickConnect = (integration) => {
198
+ if (integration.connectionMode === "manual" ||
199
+ integration.availability === "provider-setup") {
200
+ return;
201
+ }
183
202
  if (integration.authMode === "oauth") {
184
203
  connectWithOAuth(integration);
185
204
  return;
@@ -241,19 +260,28 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
241
260
  };
242
261
  if (!showCatalog && !customIntegrationEnabled)
243
262
  return null;
244
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: "flex max-h-[min(820px,calc(100vh-32px))] w-[calc(100vw-24px)] max-w-[760px] flex-col gap-0 p-0 sm:w-[min(760px,calc(100vw-48px))]", children: mode === "catalog" ? (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { className: "shrink-0 px-7 pb-5 pe-14 pt-6", children: [_jsx(DialogTitle, { children: t("mcpIntegrations.title") }), _jsx(DialogDescription, { children: t("mcpIntegrations.description") })] }), _jsxs("div", { className: "flex shrink-0 flex-col gap-3 px-7 pb-5 sm:flex-row", children: [_jsxs("label", { className: "relative min-w-0 flex-1", children: [_jsx(IconSearch, { className: "pointer-events-none absolute start-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), _jsx("input", { value: query, onChange: (event) => setQuery(event.target.value), className: "h-9 w-full rounded-md border border-border bg-background pe-3 ps-8 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.searchPlaceholder") })] }), _jsx("button", { type: "button", onClick: () => openForm(null), className: cn("inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-3 text-[12px] font-medium text-foreground hover:bg-accent", !customIntegrationEnabled && "hidden"), children: t("mcpIntegrations.addYourOwn") })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-7 pb-7", children: [error && (_jsx("div", { className: "mb-3 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2 text-[12px] leading-relaxed text-red-600 dark:text-red-400", children: error })), _jsx("div", { className: "grid gap-3 sm:grid-cols-2", children: filteredIntegrations.map((integration) => {
263
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: "flex max-h-[min(820px,calc(100vh-32px))] w-[calc(100vw-24px)] max-w-[760px] flex-col gap-0 p-0 sm:w-[min(760px,calc(100vw-48px))]", children: mode === "catalog" ? (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { className: "shrink-0 px-7 pb-5 pe-14 pt-6", children: [_jsx(DialogTitle, { children: t("mcpIntegrations.title") }), _jsx(DialogDescription, { children: t("mcpIntegrations.description") })] }), _jsxs("div", { className: "flex shrink-0 flex-col gap-3 px-7 pb-5 sm:flex-row", children: [_jsxs("label", { className: "relative min-w-0 flex-1", children: [_jsx(IconSearch, { className: "pointer-events-none absolute start-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), _jsx("input", { value: query, onChange: (event) => setQuery(event.target.value), className: "h-9 w-full rounded-md border border-border bg-background pe-3 ps-8 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.searchPlaceholder") })] }), _jsx("button", { type: "button", onClick: () => openForm(null), className: cn("inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-3 text-[12px] font-medium text-foreground hover:bg-accent", !customIntegrationEnabled && "hidden"), children: t("mcpIntegrations.addYourOwn") }), _jsx(AgentAskPopover, { label: t("mcpIntegrations.addSomething"), title: t("mcpIntegrations.addSomethingTitle"), placeholder: t("mcpIntegrations.addSomethingPlaceholder"), prompt: "", context: "The user wants to add an MCP or provider integration that is not in the current directory. Research the provider's official remote MCP endpoint and OAuth, client-registration, or allowlist requirements. Prefer Streamable HTTP endpoints over legacy SSE, reuse an existing provider OAuth connector when appropriate, and never ask the user to paste credentials into a prompt. If this should become a reusable preset, update the integration catalog, official docs link, bundled logo, localization, and tests.", className: "h-9 whitespace-nowrap border-dashed px-3 text-[12px] font-medium" })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-7 pb-7", children: [error && (_jsx("div", { className: "mb-3 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2 text-[12px] leading-relaxed text-red-600 dark:text-red-400", children: error })), _jsx("div", { className: "grid gap-3 sm:grid-cols-2", children: filteredIntegrations.map((integration) => {
245
264
  const connected = connectedUrls.has(compareUrl(integration.url));
246
265
  const requiresHeaders = integration.authMode === "headers";
247
- return (_jsxs("article", { className: "flex min-h-[128px] flex-col rounded-md border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20", children: [_jsx("h3", { className: "truncate text-[13px] font-semibold text-foreground", children: integration.name }), _jsx("p", { className: "mt-1 line-clamp-2 flex-1 text-[12px] leading-relaxed text-muted-foreground", children: t(integration.descriptionKey) }), _jsxs("div", { className: "mt-3 flex items-center gap-2", children: [_jsxs("button", { type: "button", onClick: () => quickConnect(integration), disabled: busy || connected, className: cn("inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium", connected
248
- ? "border border-border bg-muted text-muted-foreground"
249
- : "bg-primary text-primary-foreground hover:bg-primary/90", (busy || connected) &&
250
- "cursor-not-allowed opacity-70"), children: [quickBusyId === integration.id ? (_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" })) : null, connected
251
- ? t("mcpIntegrations.connected")
252
- : integration.authMode === "oauth"
253
- ? t("mcpIntegrations.connectWithOAuth")
254
- : requiresHeaders
255
- ? t("mcpIntegrations.configure")
256
- : t("mcpIntegrations.connect")] }), integration.docsUrl && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("a", { href: integration.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": t("mcpIntegrations.docsLabel", {
266
+ const setupOnly = integration.connectionMode === "manual" ||
267
+ integration.availability === "provider-setup" ||
268
+ integration.availability === "client-restricted";
269
+ return (_jsxs("article", { className: "flex min-h-[128px] flex-col rounded-md border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "relative flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-background text-[11px] font-semibold text-muted-foreground", children: [_jsx("span", { "aria-hidden": "true", children: integration.name.slice(0, 1) }), _jsx("img", { src: integration.logoUrl, alt: "", loading: "lazy", decoding: "async", className: "absolute inset-1 h-6 w-6 object-contain", onError: (event) => {
270
+ event.currentTarget.hidden = true;
271
+ } })] }), _jsxs("div", { className: "min-w-0", children: [_jsx("h3", { className: "truncate text-[13px] font-semibold text-foreground", children: integration.name }), integration.availability !== "ready" && (_jsx("span", { className: "mt-0.5 inline-flex rounded-full border border-amber-500/20 bg-amber-500/5 px-1.5 py-0.5 text-[9px] font-medium text-amber-700 dark:text-amber-300", children: integration.availability === "beta"
272
+ ? t("mcpIntegrations.status.beta")
273
+ : integration.availability ===
274
+ "client-restricted"
275
+ ? t("mcpIntegrations.status.clientRestricted")
276
+ : t("mcpIntegrations.status.setupRequired") })), _jsx("span", { className: "ms-1 mt-0.5 inline-flex rounded-full border border-border/70 bg-muted/40 px-1.5 py-0.5 text-[9px] font-medium text-muted-foreground", children: integration.verification === "verified"
277
+ ? t("mcpIntegrations.status.verified")
278
+ : integration.verification === "restricted"
279
+ ? t("mcpIntegrations.status.restricted")
280
+ : t("mcpIntegrations.status.preflightOnly") })] })] }), _jsx("p", { className: "mt-1 line-clamp-2 flex-1 text-[12px] leading-relaxed text-muted-foreground", children: t(integration.descriptionKey) }), integration.setupNoteKey && (_jsx("p", { className: "mt-2 line-clamp-3 text-[10px] leading-relaxed text-amber-700 dark:text-amber-300", children: t(integration.setupNoteKey) })), _jsxs("div", { className: "mt-3 flex items-center gap-2", children: [connected ? (_jsx("button", { type: "button", disabled: true, className: "inline-flex h-8 flex-1 cursor-not-allowed items-center justify-center gap-1.5 rounded-md border border-border bg-muted px-2.5 text-[12px] font-medium text-muted-foreground opacity-70", children: t("mcpIntegrations.connected") })) : setupOnly ? (_jsxs("a", { href: integration.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-[12px] font-medium text-foreground hover:bg-accent", children: [t("mcpIntegrations.viewSetup"), _jsx(IconExternalLink, { className: "h-3.5 w-3.5" })] })) : (_jsxs("button", { type: "button", onClick: () => quickConnect(integration), disabled: busy, className: cn("inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md bg-primary px-2.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90", busy && "cursor-not-allowed opacity-70"), children: [quickBusyId === integration.id ? (_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" })) : null, integration.authMode === "oauth"
281
+ ? t("mcpIntegrations.connectWithOAuth")
282
+ : requiresHeaders
283
+ ? t("mcpIntegrations.configure")
284
+ : t("mcpIntegrations.connect")] })), integration.docsUrl && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("a", { href: integration.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": t("mcpIntegrations.docsLabel", {
257
285
  name: integration.name,
258
286
  }), children: _jsx(IconExternalLink, { className: "h-3.5 w-3.5" }) }) }), _jsx(TooltipContent, { children: t("mcpIntegrations.docsLabel", {
259
287
  name: integration.name,
@@ -286,6 +314,6 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
286
314
  }, placeholder: selected?.headerPlaceholder ??
287
315
  t("mcpIntegrations.headersPlaceholder") })] })), selected?.docsUrl && (_jsxs("a", { href: selected.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground underline hover:text-foreground", children: [t("mcpIntegrations.openSetupDocs"), _jsx(IconExternalLink, { className: "h-3 w-3" })] })), testResult && (_jsxs("div", { className: cn("flex items-start gap-1 rounded-md px-3 py-2 text-[11px] leading-snug", testResult.ok
288
316
  ? "bg-green-500/5 text-green-600 dark:text-green-400"
289
- : "bg-red-500/5 text-red-600 dark:text-red-400"), children: [testResult.ok && (_jsx(IconCheck, { className: "mt-0.5 h-3 w-3 shrink-0" })), _jsx("span", { className: "min-w-0 break-words", children: testResult.message })] })), error && (_jsx("div", { className: "break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400", children: error }))] }) }), _jsxs("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4", children: [_jsx("button", { type: "button", onClick: runTest, disabled: !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.test") }), !selected && (_jsx("button", { type: "button", onClick: connectCustomWithOAuth, disabled: !name.trim() || !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.connectWithOAuth") })), _jsxs("button", { type: "button", onClick: submitForm, disabled: !name.trim() || !url.trim() || busy, className: "inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40", children: [busy && _jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), t("mcpIntegrations.connect")] })] })] })) }) }));
317
+ : "bg-red-500/5 text-red-600 dark:text-red-400"), children: [testResult.ok && (_jsx(IconCheck, { className: "mt-0.5 h-3 w-3 shrink-0" })), _jsx("span", { className: "min-w-0 break-words", children: testResult.message })] })), error && (_jsx("div", { className: "break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400", children: error }))] }) }), _jsxs("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4", children: [_jsx("button", { type: "button", onClick: runTest, disabled: !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.test") }), selected?.authMode === "oauth" && !selectedRequiresSetup ? (_jsx("button", { type: "button", onClick: () => connectWithOAuth(selected), disabled: !name.trim() || !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.connectWithOAuth") })) : !selected ? (_jsx("button", { type: "button", onClick: connectCustomWithOAuth, disabled: !name.trim() || !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.connectWithOAuth") })) : null, selectedRequiresSetup ? (selected?.docsUrl ? (_jsxs("a", { href: selected.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90", children: [t("mcpIntegrations.viewSetup"), _jsx(IconExternalLink, { className: "h-3 w-3" })] })) : null) : (_jsxs("button", { type: "button", onClick: submitForm, disabled: !name.trim() || !url.trim() || busy, className: "inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40", children: [busy && _jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), t("mcpIntegrations.connect")] }))] })] })) }) }));
290
318
  }
291
319
  //# sourceMappingURL=McpIntegrationDialog.js.map