@agent-native/core 0.115.4 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-native.eject.json +1 -0
- package/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +28 -0
- package/corpus/core/agent-native.eject.json +1 -0
- package/corpus/core/docs/AGENTS.md +1 -1
- package/corpus/core/docs/content/agent-mentions.mdx +2 -2
- package/corpus/core/docs/content/{workspace.mdx → agent-resources.mdx} +1 -7
- package/corpus/core/docs/content/agent-teams.mdx +4 -4
- package/corpus/core/docs/content/dispatch.mdx +10 -10
- package/corpus/core/docs/content/drop-in-agent.mdx +4 -4
- package/corpus/core/docs/content/external-agents.mdx +1 -1
- package/corpus/core/docs/content/frames.mdx +1 -1
- package/corpus/core/docs/content/integrations.mdx +13 -2
- package/corpus/core/docs/content/key-concepts.mdx +2 -2
- package/corpus/core/docs/content/mcp-clients.mdx +7 -1
- package/corpus/core/docs/content/multi-app-workspace.mdx +3 -3
- package/corpus/core/docs/content/real-time-collaboration.mdx +33 -15
- package/corpus/core/docs/content/recurring-jobs.mdx +7 -7
- package/corpus/core/docs/content/skills-guide.mdx +4 -4
- package/corpus/core/docs/content/template-brain.mdx +1 -1
- package/corpus/core/docs/content/toolkit-collaboration.mdx +1 -1
- package/corpus/core/docs/content/using-your-agent.mdx +1 -1
- package/corpus/core/docs/content/what-is-agent-native.mdx +4 -4
- package/corpus/core/docs/content/workspace-management.mdx +4 -4
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/production-agent.ts +13 -3
- package/corpus/core/src/cli/doctor.ts +6 -1
- package/corpus/core/src/client/AgentPanel.tsx +79 -41
- package/corpus/core/src/client/AssistantChat.tsx +71 -25
- package/corpus/core/src/client/FeedbackButton.tsx +33 -7
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +6 -8
- package/corpus/core/src/client/agent-chat-adapter.ts +11 -2
- package/corpus/core/src/client/agent-page/AgentTabFrame.tsx +22 -3
- package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +34 -19
- package/corpus/core/src/client/chat/message-components.tsx +43 -16
- package/corpus/core/src/client/chat/tool-call-display.tsx +30 -18
- package/corpus/core/src/client/chat/tool-render-registry.tsx +2 -0
- package/corpus/core/src/client/resources/McpConnectionSuggestion.tsx +19 -2
- package/corpus/core/src/client/resources/ResourceTree.tsx +7 -10
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +33 -70
- package/corpus/core/src/client/resources/mcp-connection-resume.ts +107 -0
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +65 -12
- package/corpus/core/src/client/resources/mcp-integration-logos.ts +4 -0
- package/corpus/core/src/client/sse-event-processor.ts +50 -14
- package/corpus/core/src/client/use-db-sync.ts +16 -6
- package/corpus/core/src/connections/catalog.ts +7 -1
- package/corpus/core/src/eject/remote-mcp-presets.ts +37 -5
- package/corpus/core/src/guards/explicit-collab-access.ts +229 -0
- package/corpus/core/src/guards/index.ts +1 -0
- package/corpus/core/src/localization/default-messages.ts +54 -5
- package/corpus/core/src/mcp/connect-route.ts +34 -51
- package/corpus/core/src/provider-api/index.ts +1 -1
- package/corpus/core/src/server/collab-plugin.ts +137 -18
- package/corpus/core/src/server/index.ts +2 -0
- package/corpus/core/src/styles/agent-native.css +40 -0
- package/corpus/core/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/core/src/templates/default/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/corpus/core/src/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/corpus/core/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +12 -8
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/analytics/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/analytics/AGENTS.md +7 -2
- package/corpus/templates/analytics/actions/export-dashboard-panel-to-google-sheet.ts +144 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +7 -88
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +34 -37
- package/corpus/templates/analytics/app/global.css +0 -4
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +2 -7
- package/corpus/templates/analytics/app/i18n-data.ts +107 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +9 -0
- package/corpus/templates/analytics/app/lib/sql-query.ts +1 -2
- package/corpus/templates/analytics/app/pages/Ask.tsx +2 -7
- package/corpus/templates/analytics/app/pages/DataSources.tsx +48 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +59 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +2 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/report-panel-window.ts +3 -1
- package/corpus/templates/analytics/changelog/2026-07-22-clear-background-chat-progress.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-22-daily-dashboard-email-query-batches.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-22-export-table-panels-directly-to-google-sheets.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-22-recent-chats-can-expand-in-the-sidebar.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +8 -8
- package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +31 -0
- package/corpus/templates/analytics/server/lib/dashboard-report-subscriptions.ts +3 -5
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +12 -0
- package/corpus/templates/analytics/server/lib/first-party-dashboard-repair.ts +3 -5
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +150 -21
- package/corpus/templates/analytics/server/lib/google-sheets-export.ts +188 -0
- package/corpus/templates/analytics/server/lib/provider-api.ts +7 -2
- package/corpus/templates/analytics/server/plugins/collab.ts +6 -3
- package/corpus/templates/analytics/shared/sql-query-limits.ts +1 -0
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/assets/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/corpus/templates/assets/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/assets/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +54 -62
- package/corpus/templates/assets/app/hooks/use-navigation-state.ts +2 -6
- package/corpus/templates/assets/app/routes/_index.tsx +8 -5
- package/corpus/templates/assets/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-22-recent-chats-expand-from-a-compact-list.md +6 -0
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/brain/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/brain/actions/rotate-source-ingest-token.ts +77 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +5 -1
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +38 -51
- package/corpus/templates/brain/app/hooks/use-navigation-state.ts +2 -9
- package/corpus/templates/brain/app/i18n-data.ts +120 -0
- package/corpus/templates/brain/app/routes/sources.tsx +156 -5
- package/corpus/templates/brain/changelog/2026-07-22-chat-runs-always-end-with-an-answer.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-22-clear-background-chat-progress.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-22-long-chat-titles-stay-inside-the-sidebar.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-22-new-clips-and-webhook-sources-now-show-their-secure-connecti.md +6 -0
- package/corpus/templates/brain/jobs/emit-netlify-brain-queue-cron.ts +125 -0
- package/corpus/templates/brain/netlify.toml +5 -1
- package/corpus/templates/brain/scripts/configure-prod-clips-source.ts +50 -0
- package/corpus/templates/brain/server/lib/capture-sanitization.ts +64 -6
- package/corpus/templates/brain/server/plugins/agent-chat.ts +4 -0
- package/corpus/templates/brain/server/plugins/brain-jobs.ts +1 -0
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +55 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/calendar/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/chat/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +43 -67
- package/corpus/templates/chat/app/hooks/use-navigation-state.ts +2 -7
- package/corpus/templates/chat/app/routes/_index.tsx +8 -5
- package/corpus/templates/chat/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/chat/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/chat/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/clips/AGENTS.md +9 -1
- package/corpus/templates/clips/actions/export-to-brain.ts +82 -6
- package/corpus/templates/clips/actions/request-transcript.ts +25 -14
- package/corpus/templates/clips/changelog/2026-07-22-clips-transcripts-now-retry-brain-export.md +5 -0
- package/corpus/templates/clips/changelog/2026-07-22-german-umlauts-and-other-non-ascii-characters-now-paste-corr.md +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +26 -3
- package/corpus/templates/clips/jobs/emit-netlify-brain-export-cron.ts +118 -0
- package/corpus/templates/clips/netlify.toml +4 -1
- package/corpus/templates/clips/scripts/configure-prod-brain-export.ts +92 -0
- package/corpus/templates/clips/server/jobs/brain-export.ts +182 -0
- package/corpus/templates/clips/server/lib/brain-export-state.ts +42 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +5 -1
- package/corpus/templates/clips/server/plugins/calendar-jobs.ts +2 -0
- package/corpus/templates/clips/server/register-secrets.ts +42 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +10 -1
- package/corpus/templates/clips/server/routes/api/clips/brain-export/run.post.ts +45 -0
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/content/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -1
- package/corpus/templates/content/server/plugins/collab.ts +1 -1
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/crm/actions/_crm-data-program-actions.ts +15 -0
- package/corpus/templates/crm/actions/get-crm-dashboard-panel.ts +2 -0
- package/corpus/templates/crm/actions/run.ts +2 -6
- package/corpus/templates/crm/actions/update-crm-record.ts +4 -2
- package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +6 -0
- package/corpus/templates/crm/changelog/2026-07-22-crm-field-validation-now-explains-which-fields-cannot-be-edi.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-22-fixed-hubspot-contact-syncs-missing-records-updated-after-th.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-22-fixed-pipeline-dashboard-panels-so-their-opportunity-data-lo.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/crm/server/crm/hubspot-adapter.ts +4 -1
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/design/server/plugins/collab.ts +11 -8
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/forms/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/forms/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/forms/app/hooks/use-navigation-state.ts +2 -9
- package/corpus/templates/forms/app/root.tsx +1 -6
- package/corpus/templates/forms/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/mail/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/plan/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/plan/app/components/layout/Layout.tsx +5 -1
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +57 -72
- package/corpus/templates/plan/app/hooks/use-navigation-state.ts +2 -9
- package/corpus/templates/plan/app/lib/create-plan-routing.ts +2 -2
- package/corpus/templates/plan/app/pages/PlanChatPage.tsx +0 -1
- package/corpus/templates/plan/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-22-recent-chats-and-sidebar-controls-are-more-compact.md +6 -0
- package/corpus/templates/plan/server/plugins/collab.ts +5 -2
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/slides/server/plugins/collab.ts +11 -8
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/corpus/templates/tasks/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +5 -22
- package/corpus/templates/tasks/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +7 -0
- package/corpus/toolkit/README.md +12 -3
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/chat-history/ChatHistoryRail.tsx +89 -0
- package/corpus/toolkit/src/chat-history/index.ts +5 -0
- package/corpus/toolkit/src/chat-history.css +59 -0
- package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +106 -36
- package/corpus/toolkit/src/composer/VoiceButton.tsx +49 -0
- package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +2 -1
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +5 -3
- package/corpus/toolkit/src/styles.css +35 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +13 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +5 -2
- package/dist/cli/doctor.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +1 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +38 -18
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +55 -20
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/FeedbackButton.d.ts +4 -2
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +18 -2
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +2 -3
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +11 -3
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-page/AgentTabFrame.d.ts +3 -1
- package/dist/client/agent-page/AgentTabFrame.d.ts.map +1 -1
- package/dist/client/agent-page/AgentTabFrame.js +3 -2
- package/dist/client/agent-page/AgentTabFrame.js.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.d.ts +2 -0
- package/dist/client/agent-page/AgentTabsPage.d.ts.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.js +26 -15
- package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +6 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +17 -11
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +11 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +16 -17
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/chat/tool-render-registry.d.ts +2 -0
- package/dist/client/chat/tool-render-registry.d.ts.map +1 -1
- package/dist/client/chat/tool-render-registry.js.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.d.ts.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.js +15 -1
- package/dist/client/resources/McpConnectionSuggestion.js.map +1 -1
- package/dist/client/resources/ResourceTree.d.ts.map +1 -1
- package/dist/client/resources/ResourceTree.js +3 -3
- package/dist/client/resources/ResourceTree.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +1 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +34 -20
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/mcp-connection-resume.d.ts +11 -0
- package/dist/client/resources/mcp-connection-resume.d.ts.map +1 -0
- package/dist/client/resources/mcp-connection-resume.js +95 -0
- package/dist/client/resources/mcp-connection-resume.js.map +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +63 -8
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/mcp-integration-logos.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-logos.js +4 -0
- package/dist/client/resources/mcp-integration-logos.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +5 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +39 -13
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +3 -2
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +17 -6
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/connections/catalog.d.ts +1 -1
- package/dist/connections/catalog.d.ts.map +1 -1
- package/dist/connections/catalog.js +7 -1
- package/dist/connections/catalog.js.map +1 -1
- package/dist/eject/remote-mcp-presets.d.ts.map +1 -1
- package/dist/eject/remote-mcp-presets.js +33 -3
- package/dist/eject/remote-mcp-presets.js.map +1 -1
- package/dist/guards/explicit-collab-access.d.ts +8 -0
- package/dist/guards/explicit-collab-access.d.ts.map +1 -0
- package/dist/guards/explicit-collab-access.js +214 -0
- package/dist/guards/explicit-collab-access.js.map +1 -0
- package/dist/guards/index.d.ts +1 -0
- package/dist/guards/index.d.ts.map +1 -1
- package/dist/guards/index.js +1 -0
- package/dist/guards/index.js.map +1 -1
- package/dist/localization/default-messages.d.ts +43 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +48 -5
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +34 -48
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/provider-api/index.js +1 -1
- package/dist/provider-api/index.js.map +1 -1
- package/dist/server/collab-plugin.d.ts +34 -3
- package/dist/server/collab-plugin.d.ts.map +1 -1
- package/dist/server/collab-plugin.js +65 -12
- package/dist/server/collab-plugin.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/styles/agent-native.css +40 -0
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/dist/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/chat/app/components/layout/Layout.tsx +1 -0
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +43 -67
- package/dist/templates/chat/app/hooks/use-navigation-state.ts +2 -7
- package/dist/templates/chat/app/routes/_index.tsx +8 -5
- package/dist/templates/chat/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/dist/templates/chat/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/dist/templates/chat/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/dist/templates/default/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/dist/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +12 -8
- package/docs/AGENTS.md +1 -1
- package/docs/content/agent-mentions.mdx +2 -2
- package/docs/content/{workspace.mdx → agent-resources.mdx} +1 -7
- package/docs/content/agent-teams.mdx +4 -4
- package/docs/content/dispatch.mdx +10 -10
- package/docs/content/drop-in-agent.mdx +4 -4
- package/docs/content/external-agents.mdx +1 -1
- package/docs/content/frames.mdx +1 -1
- package/docs/content/integrations.mdx +13 -2
- package/docs/content/key-concepts.mdx +2 -2
- package/docs/content/mcp-clients.mdx +7 -1
- package/docs/content/multi-app-workspace.mdx +3 -3
- package/docs/content/real-time-collaboration.mdx +33 -15
- package/docs/content/recurring-jobs.mdx +7 -7
- package/docs/content/skills-guide.mdx +4 -4
- package/docs/content/template-brain.mdx +1 -1
- package/docs/content/toolkit-collaboration.mdx +1 -1
- package/docs/content/using-your-agent.mdx +1 -1
- package/docs/content/what-is-agent-native.mdx +4 -4
- package/docs/content/workspace-management.mdx +4 -4
- package/package.json +3 -3
- package/src/agent/production-agent.ts +13 -3
- package/src/cli/doctor.ts +6 -1
- package/src/client/AgentPanel.tsx +79 -41
- package/src/client/AssistantChat.tsx +71 -25
- package/src/client/FeedbackButton.tsx +33 -7
- package/src/client/MultiTabAssistantChat.tsx +6 -8
- package/src/client/agent-chat-adapter.ts +11 -2
- package/src/client/agent-page/AgentTabFrame.tsx +22 -3
- package/src/client/agent-page/AgentTabsPage.tsx +34 -19
- package/src/client/chat/message-components.tsx +43 -16
- package/src/client/chat/tool-call-display.tsx +30 -18
- package/src/client/chat/tool-render-registry.tsx +2 -0
- package/src/client/resources/McpConnectionSuggestion.tsx +19 -2
- package/src/client/resources/ResourceTree.tsx +7 -10
- package/src/client/resources/ResourcesPanel.tsx +33 -70
- package/src/client/resources/mcp-connection-resume.ts +107 -0
- package/src/client/resources/mcp-integration-catalog.ts +65 -12
- package/src/client/resources/mcp-integration-logos.ts +4 -0
- package/src/client/sse-event-processor.ts +50 -14
- package/src/client/use-db-sync.ts +16 -6
- package/src/connections/catalog.ts +7 -1
- package/src/eject/remote-mcp-presets.ts +37 -5
- package/src/guards/explicit-collab-access.ts +229 -0
- package/src/guards/index.ts +1 -0
- package/src/localization/default-messages.ts +54 -5
- package/src/mcp/connect-route.ts +34 -51
- package/src/provider-api/index.ts +1 -1
- package/src/server/collab-plugin.ts +137 -18
- package/src/server/index.ts +2 -0
- package/src/styles/agent-native.css +40 -0
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/chat/app/components/layout/Layout.tsx +1 -0
- package/src/templates/chat/app/components/layout/Sidebar.tsx +43 -67
- package/src/templates/chat/app/hooks/use-navigation-state.ts +2 -7
- package/src/templates/chat/app/routes/_index.tsx +8 -5
- package/src/templates/chat/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/src/templates/chat/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/src/templates/chat/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/src/templates/default/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -1
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +35 -13
- package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +12 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call-display.js","s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I,EACnB,SAAS,EAAC,4GAA4G,aAEtH,yBAAO,KAAK,GAAQ,EACpB,KAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CACX,wCAAwC,EACxC,IAAI,IAAI,WAAW,CACpB,GACD,IACK,EACT,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,YAC1B,KAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,kBACvC,cAAK,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAO,GACH,GACpB,IACf,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EACT,QAAQ,GAIT;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,SAAS,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,aAAa,aAC1B,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,mBAClB,IAAI,EACnB,SAAS,EAAC,4GAA4G,aAEtH,yBAAO,KAAK,GAAQ,EACpB,KAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CACX,wCAAwC,EACxC,IAAI,IAAI,WAAW,CACpB,GACD,IACK,EACT,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,YAC1B,cAAK,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAO,GACrB,IACf,CACP,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["// Owns: tool-payload formatting helpers, ToolCallDisplay, ToolCallFallback,\n// and ReconnectStreamMessage used by AssistantChat.\n\nimport type { ToolCallMessagePartProps } from \"@assistant-ui/react\";\nimport {\n IconLoader2,\n IconCircleX,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconCode,\n IconBrandSlack,\n IconTerminal2,\n IconDatabase,\n IconSearch,\n IconFileCode,\n IconShieldCheck,\n IconX,\n} from \"@tabler/icons-react\";\nimport React, {\n useState,\n useEffect,\n useCallback,\n useLayoutEffect,\n useRef,\n} from \"react\";\n\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../../mcp-client/app-result.js\";\nimport { AgentTaskCard } from \"../AgentTaskCard.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport { ConnectBuilderCard } from \"../ConnectBuilderCard.js\";\nimport { McpAppRenderer } from \"../mcp-apps/McpAppRenderer.js\";\nimport type { ContentPart } from \"../sse-event-processor.js\";\nimport {\n BashCell,\n EditCell,\n WriteCell,\n FilesChangedSummary,\n} from \"../tool-cells/index.js\";\nimport { humanizeToolName } from \"../tool-display.js\";\nimport { cn } from \"../utils.js\";\nimport {\n SmoothMarkdownText,\n HighlightedCodeBlock,\n markdownComponents,\n markdownModule,\n remarkGfmFn,\n markdownUrlTransform,\n useSmoothStreamingText,\n} from \"./markdown-renderer.js\";\nimport { resolveToolRenderer } from \"./tool-render-registry.js\";\nimport {\n isBuiltinDataWidgetActionRenderer,\n resolveBuiltinActionChatRenderer,\n resolveBuiltinFallbackToolRenderer,\n} from \"./widgets/builtin-tool-renderers.js\";\n\n// Exported so AssistantChatInner can provide a context value.\nexport const ChatRunningContext = React.createContext(false);\nexport const ChatRunDurationContext = React.createContext<number | null>(null);\nexport const ASSISTANT_VISIBLE_TOOL_CALL_LIMIT = 3;\n\n/**\n * Human-in-the-loop approval bridge. `AssistantChatInner` provides a value that\n * re-issues the turn approving a specific paused tool call (opt-in\n * `needsApproval` actions). When null, the Approve button is not rendered.\n * Deny defaults to local-only (the action stays un-run) unless `onDeny` is\n * provided, and \"Always allow\" only renders when `onAlwaysAllow` is provided\n * — both are additive so existing action-approval consumers are unaffected.\n */\nexport type ApprovalContextValue = {\n /** Re-issue the turn so the server runs the approved call. */\n onApprove: (approvalKey: string) => void;\n /**\n * Optional host hook invoked in addition to the local \"denied\" state, e.g.\n * so a Code session can also resolve its own pending approval as denied.\n */\n onDeny?: (approvalKey: string) => void;\n /**\n * Optional host hook that persists this exact call so future occurrences\n * skip the approval gate. When absent, no \"Always allow\" button renders.\n */\n onAlwaysAllow?: (approvalKey: string) => void;\n};\nexport const ApprovalContext = React.createContext<ApprovalContextValue | null>(\n null,\n);\n\nexport const TOOL_LONG_RUNNING_HINT_DELAY_MS = 45_000;\n\nfunction ToolLongRunningHintShell({\n toolName,\n isRunning,\n children,\n}: {\n toolName: string;\n isRunning: boolean;\n children: React.ReactNode;\n}) {\n const [showLongRunningHint, setShowLongRunningHint] = useState(false);\n // useState initializer runs once at mount: a row that mounts already\n // resolved never animates, while a tool appended during an active stream\n // mounts running and animates in.\n const [animateEntry] = useState(isRunning);\n\n useEffect(() => {\n if (!isRunning) {\n setShowLongRunningHint(false);\n return;\n }\n setShowLongRunningHint(false);\n const timeout = window.setTimeout(() => {\n setShowLongRunningHint(true);\n }, TOOL_LONG_RUNNING_HINT_DELAY_MS);\n return () => window.clearTimeout(timeout);\n }, [isRunning, toolName]);\n\n return (\n <div\n className={cn(\n \"agent-tool-call\",\n animateEntry &&\n \"motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-200 motion-safe:ease-[var(--ease-out-strong)]\",\n )}\n data-running={isRunning ? \"true\" : undefined}\n >\n {children}\n {isRunning && showLongRunningHint && (\n <div className=\"mt-0.5 px-2.5 text-[11px] leading-snug text-muted-foreground/80\">\n Still working. Large updates can take a minute or two.\n </div>\n )}\n </div>\n );\n}\n\n// ─── Tool-payload formatting ──────────────────────────────────────────────────\n\ntype ToolDetailSection = \"input\" | \"result\";\nexport type ToolDetailPayload = {\n section: ToolDetailSection;\n title: string;\n text: string;\n copyText: string;\n lang: string;\n};\n\nfunction stringifyToolValue(value: unknown, pretty = false): string {\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value, null, pretty ? 2 : 0);\n } catch {\n return String(value ?? \"\");\n }\n}\n\nfunction looksLikeSql(text: string): boolean {\n return /^\\s*(select|with|insert|update|delete|merge|create|alter|drop|explain|declare|begin)\\b/i.test(\n text,\n );\n}\n\nfunction parseJsonText(text: string): unknown | null {\n const trimmed = text.trim();\n if (!trimmed || !/^[{[]/.test(trimmed)) return null;\n try {\n return JSON.parse(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction inferToolTextLanguage(\n text: string,\n key?: string,\n toolName?: string,\n): string {\n const keyName = (key ?? \"\").toLowerCase();\n const tool = (toolName ?? \"\").toLowerCase();\n if (\n keyName === \"code\" &&\n (tool.includes(\"run-code\") || tool.includes(\"run_code\"))\n ) {\n return \"javascript\";\n }\n if (\n keyName === \"sql\" ||\n keyName.endsWith(\"sql\") ||\n keyName === \"query\" ||\n tool.includes(\"bigquery\") ||\n tool.includes(\"db-query\") ||\n looksLikeSql(text)\n ) {\n return \"sql\";\n }\n return parseJsonText(text) ? \"json\" : \"text\";\n}\n\nfunction formatToolTextValue(\n value: unknown,\n key?: string,\n toolName?: string,\n): { text: string; lang: string } {\n if (typeof value === \"string\") {\n const parsed = parseJsonText(value);\n if (parsed) {\n return { text: JSON.stringify(parsed, null, 2), lang: \"json\" };\n }\n return {\n text: value,\n lang: inferToolTextLanguage(value, key, toolName),\n };\n }\n return { text: stringifyToolValue(value, true), lang: \"json\" };\n}\n\nexport function toolInputPayload(\n toolName: string,\n args: Record<string, unknown>,\n): ToolDetailPayload | null {\n const entries = Object.entries(args);\n if (entries.length === 0) return null;\n if (entries.length === 1) {\n const [key, value] = entries[0]!;\n const formatted = formatToolTextValue(value, key, toolName);\n const normalizedKey = key.toLowerCase();\n const keyLabel =\n normalizedKey === \"sql\" || normalizedKey.endsWith(\"sql\") ? \"SQL\" : key;\n return {\n section: \"input\",\n title: `Input - ${keyLabel}`,\n text: formatted.text,\n copyText:\n typeof value === \"string\" ? value : stringifyToolValue(value, true),\n lang: formatted.lang,\n };\n }\n return {\n section: \"input\",\n title: \"Input\",\n text: JSON.stringify(args, null, 2),\n copyText: JSON.stringify(args, null, 2),\n lang: \"json\",\n };\n}\n\nexport function toolResultPayload(\n result: string | undefined,\n): ToolDetailPayload | null {\n if (result === undefined) return null;\n const formatted = formatToolTextValue(result);\n return {\n section: \"result\",\n title: \"Result\",\n text: formatted.text,\n copyText: result,\n lang: formatted.lang,\n };\n}\n\n// ─── Tool icon helpers ────────────────────────────────────────────────────────\n\ntype ToolIconComponent = React.ComponentType<{\n className?: string;\n size?: number | string;\n}>;\n\nfunction resolveToolIcon(toolName: string): ToolIconComponent {\n const name = toolName.toLowerCase();\n if (name.includes(\"slack\")) return IconBrandSlack;\n if (\n name.includes(\"bash\") ||\n name.includes(\"shell\") ||\n name.includes(\"terminal\") ||\n name.includes(\"run-code\") ||\n name.includes(\"exec\")\n ) {\n return IconTerminal2;\n }\n if (\n name.includes(\"sql\") ||\n name.includes(\"bigquery\") ||\n name.includes(\"db-query\") ||\n name.includes(\"query\")\n ) {\n return IconDatabase;\n }\n if (\n name.includes(\"search\") ||\n name.includes(\"find\") ||\n name.includes(\"grep\")\n ) {\n return IconSearch;\n }\n if (\n name.includes(\"file\") ||\n name.includes(\"read\") ||\n name.includes(\"write\") ||\n name.includes(\"edit\")\n ) {\n return IconFileCode;\n }\n return IconCode;\n}\n\n// ─── Simple code viewer (Codex-style gray box) ────────────────────────────────\n\nfunction SimpleCodeViewer({\n text,\n lang,\n className,\n maxHeightClass = \"max-h-56\",\n}: {\n text: string;\n lang: string;\n className?: string;\n maxHeightClass?: string;\n}) {\n return (\n <div\n className={cn(\n \"agent-tool-code overflow-auto rounded-md bg-muted/70 font-mono text-[11px] leading-relaxed text-foreground\",\n maxHeightClass,\n className,\n )}\n >\n {lang !== \"text\" && (\n <div className=\"sticky top-0 z-[1] flex items-center justify-between border-b border-border/40 bg-muted/90 px-2.5 py-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-wide text-muted-foreground/80\">\n {lang}\n </span>\n </div>\n )}\n <HighlightedCodeBlock code={text} lang={lang} />\n </div>\n );\n}\n\nfunction ToolOutputPopover({\n open,\n onOpenChange,\n title,\n payload,\n children,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n payload: ToolDetailPayload;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n const copyResetRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n };\n }, []);\n\n const copyValue = useCallback(async () => {\n try {\n if (await writeClipboardText(payload.copyText)) {\n setCopied(true);\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n copyResetRef.current = setTimeout(() => setCopied(false), 1200);\n }\n } catch {\n // Clipboard failures should not interrupt chat rendering.\n }\n }, [payload.copyText]);\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>{children}</PopoverTrigger>\n <PopoverContent\n align=\"start\"\n side=\"bottom\"\n sideOffset={6}\n collisionPadding={12}\n className=\"flex max-h-[min(calc(100vh-2rem),var(--radix-popover-content-available-height,75vh))] w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,760px),760px)] flex-col gap-0 overflow-hidden p-0\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3\">\n <div className=\"truncate text-sm font-medium\">{title}</div>\n <button\n type=\"button\"\n onClick={copyValue}\n className=\"inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n {copied ? <IconCheck size={13} /> : <IconCopy size={13} />}\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-hidden p-3\">\n <SimpleCodeViewer\n text={payload.text}\n lang={payload.lang}\n maxHeightClass=\"max-h-[min(70vh,calc(var(--radix-popover-content-available-height,75vh)-4.5rem))]\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ─── Collapsible height animation ─────────────────────────────────────────────\n\nexport function AnimatedCollapse({\n open,\n children,\n}: {\n open: boolean;\n children: React.ReactNode;\n}) {\n const [mounted, setMounted] = useState(open);\n\n useLayoutEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n const onTransitionEnd = useCallback(\n (event: React.TransitionEvent<HTMLDivElement>) => {\n if (event.propertyName !== \"grid-template-rows\" || open) return;\n setMounted(false);\n },\n [open],\n );\n\n if (!mounted) return null;\n\n return (\n <div\n className=\"agent-chat-collapse\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden={!open}\n onTransitionEnd={onTransitionEnd}\n >\n <div className=\"agent-chat-collapse__content\">{children}</div>\n </div>\n );\n}\n\n// ─── Human-in-the-loop approval affordance ────────────────────────────────────\n\n/**\n * Inline Approve/Deny prompt rendered when a `needsApproval` action paused the\n * turn. Approve re-issues the turn with the call's `approvalKey`; Deny dismisses\n * the prompt locally (the action stays un-run).\n */\nfunction ApprovalAffordance({\n toolName,\n approval,\n}: {\n toolName: string;\n approval: { approvalKey: string; dismissed?: boolean };\n}) {\n const ctx = React.useContext(ApprovalContext);\n const [approved, setApproved] = useState(false);\n const [denied, setDenied] = useState(false);\n\n // Once approved, the turn is re-issued; collapse to a quiet note so the user\n // can't double-fire the approval.\n if (approved) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Approved. Re-running {toolName}...\n </div>\n );\n }\n // Deny defaults to local-only (the action simply stays un-run). When the\n // host also provided `onDeny` (e.g. a Code session resolving its own\n // pending approval), it fires alongside the local state.\n if (denied) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Denied. {toolName} did not run.\n </div>\n );\n }\n return (\n <div className=\"mt-1.5 flex items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5\">\n <IconShieldCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"mr-auto text-xs text-muted-foreground\">\n Approve to run {toolName}?\n </span>\n {ctx && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onApprove(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n <IconCheck className=\"h-3.5 w-3.5\" />\n Approve\n </button>\n )}\n {ctx?.onAlwaysAllow && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onAlwaysAllow?.(approval.approvalKey);\n }}\n title=\"Approve and always allow this exact command\"\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconShieldCheck className=\"h-3.5 w-3.5\" />\n Always allow\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setDenied(true);\n ctx?.onDeny?.(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconX className=\"h-3.5 w-3.5\" />\n Deny\n </button>\n </div>\n );\n}\n\n// ─── ToolCallDisplay ──────────────────────────────────────────────────────────\n\nexport function ToolCallDisplay({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n structuredMeta,\n approval,\n repeatCount,\n isLatestRunning = isRunning,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n structuredMeta?: Record<string, unknown>;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n isLatestRunning?: boolean;\n}) {\n // Delegate to bespoke cells when structured metadata is present.\n // These must be separate components so hook order in ToolCallDisplayGeneric\n // is always stable (no conditional hook calls).\n const toolKind = structuredMeta?.toolKind as string | undefined;\n const wrapToolDisplay = (children: React.ReactNode) => (\n <ToolLongRunningHintShell toolName={toolName} isRunning={isRunning}>\n {children}\n </ToolLongRunningHintShell>\n );\n if (toolKind === \"bash\") {\n return wrapToolDisplay(\n <BashCell\n meta={\n structuredMeta as unknown as Parameters<typeof BashCell>[0][\"meta\"]\n }\n output={result}\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"edit\") {\n return wrapToolDisplay(\n <EditCell\n meta={\n structuredMeta as unknown as Parameters<typeof EditCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"write\") {\n return wrapToolDisplay(\n <WriteCell\n meta={\n structuredMeta as unknown as Parameters<typeof WriteCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n return wrapToolDisplay(\n <ToolCallDisplayGeneric\n toolName={toolName}\n argsText={argsText}\n args={args}\n result={result}\n mcpApp={mcpApp}\n chatUI={chatUI}\n isRunning={isRunning}\n isLatestRunning={isLatestRunning}\n approval={approval}\n repeatCount={repeatCount}\n />,\n );\n}\n\nfunction ToolCallDisplayGeneric({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n isLatestRunning,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n isLatestRunning: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const streamRef = useRef<HTMLDivElement>(null);\n\n const isAgentCall = toolName.startsWith(\"agent:\");\n const [expanded, setExpanded] = useState(isAgentCall);\n const [outputOpen, setOutputOpen] = useState(false);\n const agentName = isAgentCall ? toolName.slice(6) : null;\n const isAgentError = isAgentCall && result === \"Error calling agent\";\n const agentStreamText = isAgentCall ? (argsText ?? \"\") : \"\";\n const hasStreamText = agentStreamText.length > 0;\n const hasArgs = !isAgentCall && Object.keys(args).length > 0;\n\n // NOTE: All hooks must be above any conditional returns\n useEffect(() => {\n if (isAgentCall && isRunning && streamRef.current) {\n streamRef.current.scrollTop = streamRef.current.scrollHeight;\n }\n }, [agentStreamText, isAgentCall, isRunning]);\n\n // Render connect-builder as ConnectBuilderCard once the result is available\n if (toolName === \"connect-builder\" && result) {\n try {\n const parsed = JSON.parse(result);\n if (parsed?.kind === \"connect-builder-card\") {\n return (\n <ConnectBuilderCard\n configured={!!parsed.configured}\n builderEnabled={parsed.builderEnabled !== false}\n // Ignore saved cliAuthUrl values from older tool results. They\n // contain signed callback state and can expire while a chat sits\n // open; the card's hook fetches a fresh signed URL on mount/click.\n connectUrl={parsed.connectUrl || \"\"}\n orgName={parsed.orgName ?? null}\n prompt={typeof parsed.prompt === \"string\" ? parsed.prompt : \"\"}\n />\n );\n }\n } catch {\n // fall through to default pill rendering\n }\n }\n\n // Render agent-teams spawn as AgentTaskCard once the result is available\n if (\n toolName === \"agent-teams\" &&\n (args as Record<string, string>)?.action === \"spawn\" &&\n result\n ) {\n try {\n const parsed = JSON.parse(result);\n if (parsed.taskId && parsed.threadId) {\n return (\n <AgentTaskCard\n taskId={parsed.taskId}\n threadId={parsed.threadId}\n description={\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"Sub-agent task\"\n }\n onOpen={(tid) => {\n window.dispatchEvent(\n new CustomEvent(\"agent-task-open\", {\n detail: {\n threadId: tid,\n description:\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"\",\n name: parsed.name || \"\",\n },\n }),\n );\n }}\n />\n );\n }\n } catch {\n // Fall through to default pill rendering\n }\n }\n\n const parsedResult = result ? parseJsonText(result) : null;\n const nativeToolContext = {\n toolName,\n args,\n resultText: result,\n resultJson: parsedResult,\n isRunning,\n chatUI,\n };\n const skipRegistryRenderer =\n !isAgentCall && isBuiltinDataWidgetActionRenderer(nativeToolContext);\n const NativeToolRenderer = isAgentCall\n ? null\n : (resolveBuiltinActionChatRenderer(nativeToolContext) ??\n (skipRegistryRenderer ? null : resolveToolRenderer(nativeToolContext)) ??\n resolveBuiltinFallbackToolRenderer(nativeToolContext));\n if (NativeToolRenderer) {\n return <NativeToolRenderer context={nativeToolContext} />;\n }\n\n const inputPayload = hasArgs ? toolInputPayload(toolName, args) : null;\n const resultPayload = toolResultPayload(result);\n\n const displayName = isAgentCall\n ? isRunning\n ? `Asking ${agentName}...`\n : isAgentError\n ? `Error asking ${agentName}`\n : `Asked ${agentName}`\n : humanizeToolName(toolName);\n\n const canExpand = isAgentCall\n ? hasStreamText\n : hasArgs || result !== undefined;\n const isExpanded = isAgentCall ? hasStreamText && expanded : expanded;\n const ToolIcon = resolveToolIcon(toolName);\n const outputTitle = `Raw ${toolName} tool call output`;\n\n return (\n <div className=\"group/tool my-0.5 w-full overflow-hidden\">\n {mcpApp && <McpAppRenderer app={mcpApp} className=\"mb-1.5\" />}\n <button\n type=\"button\"\n onClick={() => canExpand && setExpanded(!isExpanded)}\n aria-expanded={canExpand ? isExpanded : undefined}\n className={cn(\n \"flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors\",\n canExpand && \"hover:text-foreground\",\n isRunning && \"text-muted-foreground\",\n )}\n >\n <span className=\"relative flex size-4 shrink-0 items-center justify-center\">\n {isRunning ? (\n <IconLoader2 className=\"size-3.5 animate-spin\" />\n ) : isAgentError ? (\n <IconCircleX className=\"size-3.5 text-destructive\" />\n ) : (\n <>\n <ToolIcon\n className={cn(\n \"size-3.5 transition-opacity\",\n canExpand && \"group-hover/tool:opacity-0\",\n )}\n />\n {canExpand && (\n <IconChevronRight\n className={cn(\n \"absolute size-3.5 opacity-0 transition-[opacity,transform] group-hover/tool:opacity-100\",\n isExpanded && \"rotate-90\",\n )}\n />\n )}\n </>\n )}\n </span>\n <span\n className={cn(\n \"min-w-0 truncate font-normal\",\n isRunning && isLatestRunning && \"agent-running-shimmer\",\n )}\n >\n {displayName}\n </span>\n {repeatCount && repeatCount > 1 && (\n <span\n className=\"shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground\"\n title={`Repeated ${repeatCount} times`}\n >\n {repeatCount}x\n </span>\n )}\n </button>\n <AnimatedCollapse open={isExpanded && isAgentCall && hasStreamText}>\n <div\n ref={streamRef}\n className=\"mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none\"\n >\n {markdownModule?.default && remarkGfmFn ? (\n <markdownModule.default\n remarkPlugins={[remarkGfmFn]}\n components={markdownComponents}\n urlTransform={markdownUrlTransform}\n >\n {agentStreamText}\n </markdownModule.default>\n ) : (\n <span style={{ whiteSpace: \"pre-wrap\" }}>{agentStreamText}</span>\n )}\n </div>\n </AnimatedCollapse>\n <AnimatedCollapse\n open={isExpanded && !isAgentCall && (hasArgs || result !== undefined)}\n >\n <div className=\"mt-1 space-y-2 pl-5\">\n {inputPayload && (\n <SimpleCodeViewer\n text={inputPayload.text}\n lang={inputPayload.lang}\n />\n )}\n {resultPayload && (\n <ToolOutputPopover\n open={outputOpen}\n onOpenChange={setOutputOpen}\n title={outputTitle}\n payload={resultPayload}\n >\n <button\n type=\"button\"\n aria-label={`View ${toolName} output`}\n className=\"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground\"\n >\n <IconCode className=\"size-3.5\" />\n </button>\n </ToolOutputPopover>\n )}\n </div>\n </AnimatedCollapse>\n {approval && (\n <ApprovalAffordance toolName={toolName} approval={approval} />\n )}\n </div>\n );\n}\n\n// ─── ToolCallFallback ──────────────────────────────────────────────────────────\n\nexport function ToolCallFallback({\n toolName,\n args,\n argsText,\n result,\n ...rest\n}: ToolCallMessagePartProps & {\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n structuredMeta?: Record<string, unknown>;\n activity?: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n isLatestRunning?: boolean;\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const isRunning =\n result === undefined && (chatRunning || rest.activity === true);\n return (\n <ToolCallDisplay\n toolName={toolName}\n args={args as Record<string, unknown>}\n argsText={argsText}\n result={\n typeof result === \"string\"\n ? result\n : result !== undefined\n ? JSON.stringify(result)\n : undefined\n }\n mcpApp={rest.mcpApp}\n chatUI={rest.chatUI}\n structuredMeta={rest.structuredMeta}\n isRunning={isRunning}\n isLatestRunning={rest.isLatestRunning}\n approval={rest.approval}\n repeatCount={rest.repeatCount}\n />\n );\n}\n\n// ─── ReconnectStreamMessage ────────────────────────────────────────────────────\n// Renders the agent's in-progress response during reconnection (outside\n// assistant-ui's runtime). Uses the same visual styling as normal messages.\n\nexport function ReconnectStreamMessage({\n content,\n}: {\n content: ContentPart[];\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const toolSummary = getReconnectToolSummaryInfo(content);\n const latestReasoningPartIndex = content.reduce(\n (latestIndex, part, index) =>\n part.type === \"reasoning\" ? index : latestIndex,\n -1,\n );\n const streamingTextPartIndex =\n content.at(-1)?.type === \"text\" ? content.length - 1 : -1;\n const streamingReasoningPartIndex =\n content.at(-1)?.type === \"reasoning\" ? content.length - 1 : -1;\n const latestRunningToolIndex = content.reduce(\n (latestIndex, part, index) =>\n part.type === \"tool-call\" &&\n part.result === undefined &&\n (chatRunning || part.activity === true)\n ? index\n : latestIndex,\n -1,\n );\n\n const renderPart = (part: ContentPart, i: number) => {\n if (part.type === \"text\") {\n const partStreaming = chatRunning && i === streamingTextPartIndex;\n return (\n <SmoothMarkdownText\n key={`reconnect-text-${i}`}\n text={part.text}\n streaming={partStreaming}\n resetKey={`reconnect-text-${i}`}\n statusType={partStreaming ? \"running\" : \"complete\"}\n />\n );\n }\n if (part.type === \"reasoning\") {\n return (\n <ReasoningCell\n key={`reconnect-reasoning-${i}`}\n text={part.text}\n isStreaming={chatRunning && i === streamingReasoningPartIndex}\n resetKey={`reconnect-reasoning-${i}`}\n defaultOpen={i === latestReasoningPartIndex}\n collapseWhenReplaced={i < latestReasoningPartIndex}\n />\n );\n }\n return (\n <ToolCallDisplay\n key={`reconnect-tool-${i}`}\n toolName={part.toolName}\n argsText={part.argsText}\n args={part.args}\n result={part.result}\n mcpApp={part.mcpApp}\n chatUI={part.chatUI}\n structuredMeta={part.structuredMeta}\n isRunning={\n part.result === undefined && (chatRunning || part.activity === true)\n }\n isLatestRunning={i === latestRunningToolIndex}\n approval={part.approval}\n repeatCount={part.repeatCount}\n />\n );\n };\n\n const renderedParts: React.ReactNode[] = [];\n let summaryStartIndex = -1;\n let summaryToolCount = 0;\n const flushSummary = (endIndex: number) => {\n if (summaryStartIndex < 0) return;\n renderedParts.push(\n <RanToolsSummary\n key={`reconnect-tool-summary-${summaryStartIndex}`}\n toolCount={summaryToolCount}\n >\n {content\n .slice(summaryStartIndex, endIndex)\n .map((part, offset) => renderPart(part, summaryStartIndex + offset))}\n </RanToolsSummary>,\n );\n summaryStartIndex = -1;\n summaryToolCount = 0;\n };\n\n for (let i = 0; i < content.length; i++) {\n const part = content[i]!;\n const isOlderToolWork =\n toolSummary.startIndex >= 0 &&\n i < toolSummary.startIndex &&\n isReconnectToolSummaryPart(content, i, toolSummary.startIndex);\n if (isOlderToolWork) {\n summaryStartIndex = summaryStartIndex < 0 ? i : summaryStartIndex;\n if (part.type === \"tool-call\") summaryToolCount++;\n continue;\n }\n flushSummary(i);\n renderedParts.push(renderPart(part, i));\n }\n flushSummary(content.length);\n\n return (\n <div className=\"flex justify-start\">\n <div className=\"w-full max-w-[95%] text-sm leading-relaxed text-foreground space-y-1\">\n {renderedParts}\n </div>\n </div>\n );\n}\n\nfunction getReconnectToolSummaryInfo(content: readonly ContentPart[]) {\n const toolCallIndices = content.reduce<number[]>((indices, part, index) => {\n if (part.type === \"tool-call\" && isReconnectSummarizablePart(part)) {\n indices.push(index);\n }\n return indices;\n }, []);\n if (toolCallIndices.length <= ASSISTANT_VISIBLE_TOOL_CALL_LIMIT) {\n return { startIndex: -1 };\n }\n return {\n startIndex:\n toolCallIndices[\n toolCallIndices.length - ASSISTANT_VISIBLE_TOOL_CALL_LIMIT\n ]!,\n };\n}\n\nfunction isReconnectSummarizablePart(part: ContentPart): boolean {\n return (\n part.type === \"reasoning\" ||\n (part.type === \"tool-call\" && part.toolName !== \"connect-builder\")\n );\n}\n\nfunction isReconnectToolSummaryPart(\n content: readonly ContentPart[],\n index: number,\n startIndex: number,\n): boolean {\n if (startIndex < 0 || index >= startIndex) return false;\n if (!isReconnectSummarizablePart(content[index]!)) return false;\n\n let segmentStart = index;\n while (\n segmentStart > 0 &&\n isReconnectSummarizablePart(content[segmentStart - 1]!)\n ) {\n segmentStart--;\n }\n\n let segmentEnd = index + 1;\n while (\n segmentEnd < startIndex &&\n isReconnectSummarizablePart(content[segmentEnd]!)\n ) {\n segmentEnd++;\n }\n\n return content\n .slice(segmentStart, segmentEnd)\n .some((candidate) => candidate.type === \"tool-call\");\n}\n\n// ─── Reasoning / Thinking cell ────────────────────────────────────────────────\n\n/**\n * Completed reasoning and tool calls share one outer \"Worked for…\"\n * disclosure. Reasoning cells inside it render their prose directly so\n * opening that summary never reveals a redundant second disclosure.\n */\nconst WorkSummaryContentContext = React.createContext(false);\n\nexport function ReasoningCell({\n text,\n isStreaming = false,\n resetKey,\n defaultOpen,\n autoCollapse = false,\n collapseWhenReplaced = false,\n durationMs,\n}: {\n text: string;\n isStreaming?: boolean;\n /** Stable identity used to restart the reveal when a new reasoning part mounts. */\n resetKey?: string;\n defaultOpen?: boolean;\n /** Animate closed when a live reasoning segment finishes during a run. */\n autoCollapse?: boolean;\n /** Animate closed when a newer reasoning segment replaces this one. */\n collapseWhenReplaced?: boolean;\n /**\n * Elapsed thinking time in ms, once known. Only meaningful once streaming\n * has finished — callers that track live timing (see ReasoningMessagePart)\n * pass this so the label can read \"Thought for Xs\" instead of \"Thought\".\n * Historical messages with no live timing simply omit it.\n */\n durationMs?: number | null;\n}) {\n const embeddedInWorkSummary = React.useContext(WorkSummaryContentContext);\n const [open, setOpen] = useState(defaultOpen ?? true);\n const wasStreamingRef = useRef(isStreaming);\n const wasReplacedRef = useRef(collapseWhenReplaced);\n const trimmed = text.trim();\n const visibleText = useSmoothStreamingText(\n trimmed,\n isStreaming,\n resetKey ?? \"reasoning\",\n );\n\n useEffect(() => {\n if (autoCollapse && wasStreamingRef.current && !isStreaming) {\n setOpen(false);\n }\n wasStreamingRef.current = isStreaming;\n }, [autoCollapse, isStreaming]);\n\n useEffect(() => {\n if (collapseWhenReplaced && !wasReplacedRef.current) {\n setOpen(false);\n }\n wasReplacedRef.current = collapseWhenReplaced;\n }, [collapseWhenReplaced]);\n\n if (!trimmed && !isStreaming) return null;\n\n if (embeddedInWorkSummary) {\n return (\n <div className=\"pb-1 pl-5 text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {visibleText || (isStreaming ? \"…\" : \"\")}\n </div>\n );\n }\n\n const label = isStreaming\n ? \"Thinking\"\n : durationMs != null\n ? `Thought for ${formatWorkedDuration(durationMs)}`\n : \"Thought\";\n // Only clamp to a scroll-free \"tail\" view while actively streaming and\n // expanded — once the run finishes the full text is shown, unclamped.\n const showTail = isStreaming && open;\n\n return (\n <div className=\"my-0.5 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n {isStreaming ? (\n <span className=\"agent-thinking-indicator__text\">{label}</span>\n ) : (\n <span>{label}</span>\n )}\n </button>\n <AnimatedCollapse open={open}>\n <div className={cn(\"pl-5 pb-1\", showTail && \"reasoning-cell-tail\")}>\n <div className=\"text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {visibleText || (isStreaming ? \"…\" : \"\")}\n </div>\n </div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Worked-for duration helpers ──────────────────────────────────────────────\n\nexport function formatWorkedDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.round(ms / 1000));\n if (totalSeconds < 60) {\n return totalSeconds <= 1 ? \"1s\" : `${totalSeconds}s`;\n }\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n if (minutes < 60) {\n if (seconds === 0) return `${minutes}m`;\n return `${minutes}m ${seconds}s`;\n }\n const hours = Math.floor(minutes / 60);\n const remMinutes = minutes % 60;\n if (remMinutes === 0) return `${hours}h`;\n return `${hours}h ${remMinutes}m`;\n}\n\nexport function WorkedForSummary({\n durationMs,\n autoCollapse = false,\n children,\n}: {\n durationMs?: number | null;\n /** When true, close the summary after a run has completed. */\n autoCollapse?: boolean;\n children: React.ReactNode;\n}) {\n // Start closed so a remounted completed message never flashes its work\n // details open while auto-collapse settles. If the summary was already\n // open when autoCollapse changes, AnimatedCollapse still animates it shut.\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (autoCollapse) setOpen(false);\n }, [autoCollapse]);\n\n const label =\n durationMs != null && durationMs >= 1000\n ? `Worked for ${formatWorkedDuration(durationMs)}`\n : \"Worked\";\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <WorkSummaryContentContext.Provider value>\n <div className=\"pt-1\">{children}</div>\n </WorkSummaryContentContext.Provider>\n </AnimatedCollapse>\n </div>\n );\n}\n\nexport function RanToolsSummary({\n toolCount,\n children,\n}: {\n toolCount: number;\n children: React.ReactNode;\n}) {\n const [open, setOpen] = useState(false);\n const label = `Ran ${toolCount} ${toolCount === 1 ? \"tool\" : \"tools\"}`;\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <div className=\"pt-1\">{children}</div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Re-export for AssistantMessage ───────────────────────────────────────────\n// AssistantMessage in AssistantChat.tsx uses FilesChangedSummary directly, so\n// re-export it so AssistantChat.tsx can import from one place.\nexport { FilesChangedSummary };\n"]}
|
|
1
|
+
{"version":3,"file":"tool-call-display.js","sourceRoot":"","sources":["../../../src/client/chat/tool-call-display.tsx"],"names":[],"mappings":";AAIA,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,MAAM,GACP,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D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CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,SAAS,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,aAAa,aAC1B,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,mBAClB,IAAI,EACnB,SAAS,EAAC,4GAA4G,aAEtH,yBAAO,KAAK,GAAQ,EACpB,KAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CACX,wCAAwC,EACxC,IAAI,IAAI,WAAW,CACpB,GACD,IACK,EACT,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,YAC1B,cAAK,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAO,GACrB,IACf,CACP,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["// Owns: tool-payload formatting helpers, ToolCallDisplay, ToolCallFallback,\n// and ReconnectStreamMessage used by AssistantChat.\n\nimport type { ToolCallMessagePartProps } from \"@assistant-ui/react\";\nimport {\n IconLoader2,\n IconCircleX,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconCode,\n IconBrandSlack,\n IconTerminal2,\n IconDatabase,\n IconSearch,\n IconFileCode,\n IconShieldCheck,\n IconX,\n} from \"@tabler/icons-react\";\nimport React, {\n useState,\n useEffect,\n useCallback,\n useLayoutEffect,\n useRef,\n} from \"react\";\n\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../../mcp-client/app-result.js\";\nimport { AgentTaskCard } from \"../AgentTaskCard.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport { ConnectBuilderCard } from \"../ConnectBuilderCard.js\";\nimport { McpAppRenderer } from \"../mcp-apps/McpAppRenderer.js\";\nimport type { ContentPart } from \"../sse-event-processor.js\";\nimport {\n BashCell,\n EditCell,\n WriteCell,\n FilesChangedSummary,\n} from \"../tool-cells/index.js\";\nimport { humanizeToolName } from \"../tool-display.js\";\nimport { cn } from \"../utils.js\";\nimport {\n SmoothMarkdownText,\n HighlightedCodeBlock,\n markdownComponents,\n markdownModule,\n remarkGfmFn,\n markdownUrlTransform,\n useSmoothStreamingText,\n} from \"./markdown-renderer.js\";\nimport { resolveToolRenderer } from \"./tool-render-registry.js\";\nimport {\n isBuiltinDataWidgetActionRenderer,\n resolveBuiltinActionChatRenderer,\n resolveBuiltinFallbackToolRenderer,\n} from \"./widgets/builtin-tool-renderers.js\";\n\n// Exported so AssistantChatInner can provide a context value.\nexport const ChatRunningContext = React.createContext(false);\nexport const ChatRunDurationContext = React.createContext<number | null>(null);\nexport const ASSISTANT_VISIBLE_TOOL_CALL_LIMIT = 3;\n\n/**\n * Human-in-the-loop approval bridge. `AssistantChatInner` provides a value that\n * re-issues the turn approving a specific paused tool call (opt-in\n * `needsApproval` actions). When null, the Approve button is not rendered.\n * Deny defaults to local-only (the action stays un-run) unless `onDeny` is\n * provided, and \"Always allow\" only renders when `onAlwaysAllow` is provided\n * — both are additive so existing action-approval consumers are unaffected.\n */\nexport type ApprovalContextValue = {\n /** Re-issue the turn so the server runs the approved call. */\n onApprove: (approvalKey: string) => void;\n /**\n * Optional host hook invoked in addition to the local \"denied\" state, e.g.\n * so a Code session can also resolve its own pending approval as denied.\n */\n onDeny?: (approvalKey: string) => void;\n /**\n * Optional host hook that persists this exact call so future occurrences\n * skip the approval gate. When absent, no \"Always allow\" button renders.\n */\n onAlwaysAllow?: (approvalKey: string) => void;\n};\nexport const ApprovalContext = React.createContext<ApprovalContextValue | null>(\n null,\n);\n\nexport const TOOL_LONG_RUNNING_HINT_DELAY_MS = 45_000;\n\nexport function ToolActivityPresentation({\n toolName,\n isRunning,\n isActiveTail,\n children,\n}: {\n toolName: string;\n isRunning: boolean;\n isActiveTail: boolean;\n children: React.ReactNode;\n}) {\n const [showLongRunningHint, setShowLongRunningHint] = useState(false);\n // A batched update can first reveal a tool with its result already attached.\n // Presentation follows the active chat tail rather than execution state so\n // that newly revealed completed tools still get their entrance motion.\n const [animateEntry] = useState(isActiveTail);\n\n useEffect(() => {\n if (!isRunning) {\n setShowLongRunningHint(false);\n return;\n }\n setShowLongRunningHint(false);\n const timeout = window.setTimeout(() => {\n setShowLongRunningHint(true);\n }, TOOL_LONG_RUNNING_HINT_DELAY_MS);\n return () => window.clearTimeout(timeout);\n }, [isRunning, toolName]);\n\n return (\n <div\n className={cn(\n \"agent-tool-call\",\n animateEntry && \"agent-tool-call--entering\",\n )}\n data-running={isRunning ? \"true\" : undefined}\n data-active-tail={isActiveTail ? \"true\" : undefined}\n >\n {children}\n {isRunning && showLongRunningHint && (\n <div className=\"mt-0.5 px-2.5 text-[11px] leading-snug text-muted-foreground/80\">\n Still working. Large updates can take a minute or two.\n </div>\n )}\n </div>\n );\n}\n\n// ─── Tool-payload formatting ──────────────────────────────────────────────────\n\ntype ToolDetailSection = \"input\" | \"result\";\nexport type ToolDetailPayload = {\n section: ToolDetailSection;\n title: string;\n text: string;\n copyText: string;\n lang: string;\n};\n\nfunction stringifyToolValue(value: unknown, pretty = false): string {\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value, null, pretty ? 2 : 0);\n } catch {\n return String(value ?? \"\");\n }\n}\n\nfunction looksLikeSql(text: string): boolean {\n return /^\\s*(select|with|insert|update|delete|merge|create|alter|drop|explain|declare|begin)\\b/i.test(\n text,\n );\n}\n\nfunction parseJsonText(text: string): unknown | null {\n const trimmed = text.trim();\n if (!trimmed || !/^[{[]/.test(trimmed)) return null;\n try {\n return JSON.parse(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction inferToolTextLanguage(\n text: string,\n key?: string,\n toolName?: string,\n): string {\n const keyName = (key ?? \"\").toLowerCase();\n const tool = (toolName ?? \"\").toLowerCase();\n if (\n keyName === \"code\" &&\n (tool.includes(\"run-code\") || tool.includes(\"run_code\"))\n ) {\n return \"javascript\";\n }\n if (\n keyName === \"sql\" ||\n keyName.endsWith(\"sql\") ||\n keyName === \"query\" ||\n tool.includes(\"bigquery\") ||\n tool.includes(\"db-query\") ||\n looksLikeSql(text)\n ) {\n return \"sql\";\n }\n return parseJsonText(text) ? \"json\" : \"text\";\n}\n\nfunction formatToolTextValue(\n value: unknown,\n key?: string,\n toolName?: string,\n): { text: string; lang: string } {\n if (typeof value === \"string\") {\n const parsed = parseJsonText(value);\n if (parsed) {\n return { text: JSON.stringify(parsed, null, 2), lang: \"json\" };\n }\n return {\n text: value,\n lang: inferToolTextLanguage(value, key, toolName),\n };\n }\n return { text: stringifyToolValue(value, true), lang: \"json\" };\n}\n\nexport function toolInputPayload(\n toolName: string,\n args: Record<string, unknown>,\n): ToolDetailPayload | null {\n const entries = Object.entries(args);\n if (entries.length === 0) return null;\n if (entries.length === 1) {\n const [key, value] = entries[0]!;\n const formatted = formatToolTextValue(value, key, toolName);\n const normalizedKey = key.toLowerCase();\n const keyLabel =\n normalizedKey === \"sql\" || normalizedKey.endsWith(\"sql\") ? \"SQL\" : key;\n return {\n section: \"input\",\n title: `Input - ${keyLabel}`,\n text: formatted.text,\n copyText:\n typeof value === \"string\" ? value : stringifyToolValue(value, true),\n lang: formatted.lang,\n };\n }\n return {\n section: \"input\",\n title: \"Input\",\n text: JSON.stringify(args, null, 2),\n copyText: JSON.stringify(args, null, 2),\n lang: \"json\",\n };\n}\n\nexport function toolResultPayload(\n result: string | undefined,\n): ToolDetailPayload | null {\n if (result === undefined) return null;\n const formatted = formatToolTextValue(result);\n return {\n section: \"result\",\n title: \"Result\",\n text: formatted.text,\n copyText: result,\n lang: formatted.lang,\n };\n}\n\n// ─── Tool icon helpers ────────────────────────────────────────────────────────\n\ntype ToolIconComponent = React.ComponentType<{\n className?: string;\n size?: number | string;\n}>;\n\nfunction resolveToolIcon(toolName: string): ToolIconComponent {\n const name = toolName.toLowerCase();\n if (name.includes(\"slack\")) return IconBrandSlack;\n if (\n name.includes(\"bash\") ||\n name.includes(\"shell\") ||\n name.includes(\"terminal\") ||\n name.includes(\"run-code\") ||\n name.includes(\"exec\")\n ) {\n return IconTerminal2;\n }\n if (\n name.includes(\"sql\") ||\n name.includes(\"bigquery\") ||\n name.includes(\"db-query\") ||\n name.includes(\"query\")\n ) {\n return IconDatabase;\n }\n if (\n name.includes(\"search\") ||\n name.includes(\"find\") ||\n name.includes(\"grep\")\n ) {\n return IconSearch;\n }\n if (\n name.includes(\"file\") ||\n name.includes(\"read\") ||\n name.includes(\"write\") ||\n name.includes(\"edit\")\n ) {\n return IconFileCode;\n }\n return IconCode;\n}\n\n// ─── Simple code viewer (Codex-style gray box) ────────────────────────────────\n\nfunction SimpleCodeViewer({\n text,\n lang,\n className,\n maxHeightClass = \"max-h-56\",\n}: {\n text: string;\n lang: string;\n className?: string;\n maxHeightClass?: string;\n}) {\n return (\n <div\n className={cn(\n \"agent-tool-code overflow-auto rounded-md bg-muted/70 font-mono text-[11px] leading-relaxed text-foreground\",\n maxHeightClass,\n className,\n )}\n >\n {lang !== \"text\" && (\n <div className=\"sticky top-0 z-[1] flex items-center justify-between border-b border-border/40 bg-muted/90 px-2.5 py-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-wide text-muted-foreground/80\">\n {lang}\n </span>\n </div>\n )}\n <HighlightedCodeBlock code={text} lang={lang} />\n </div>\n );\n}\n\nfunction ToolOutputPopover({\n open,\n onOpenChange,\n title,\n payload,\n children,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n payload: ToolDetailPayload;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n const copyResetRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n };\n }, []);\n\n const copyValue = useCallback(async () => {\n try {\n if (await writeClipboardText(payload.copyText)) {\n setCopied(true);\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n copyResetRef.current = setTimeout(() => setCopied(false), 1200);\n }\n } catch {\n // Clipboard failures should not interrupt chat rendering.\n }\n }, [payload.copyText]);\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>{children}</PopoverTrigger>\n <PopoverContent\n align=\"start\"\n side=\"bottom\"\n sideOffset={6}\n collisionPadding={12}\n className=\"flex max-h-[min(calc(100vh-2rem),var(--radix-popover-content-available-height,75vh))] w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,760px),760px)] flex-col gap-0 overflow-hidden p-0\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3\">\n <div className=\"truncate text-sm font-medium\">{title}</div>\n <button\n type=\"button\"\n onClick={copyValue}\n className=\"inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n {copied ? <IconCheck size={13} /> : <IconCopy size={13} />}\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-hidden p-3\">\n <SimpleCodeViewer\n text={payload.text}\n lang={payload.lang}\n maxHeightClass=\"max-h-[min(70vh,calc(var(--radix-popover-content-available-height,75vh)-4.5rem))]\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ─── Collapsible height animation ─────────────────────────────────────────────\n\nexport function AnimatedCollapse({\n open,\n children,\n}: {\n open: boolean;\n children: React.ReactNode;\n}) {\n const [mounted, setMounted] = useState(open);\n\n useLayoutEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n const onTransitionEnd = useCallback(\n (event: React.TransitionEvent<HTMLDivElement>) => {\n if (event.propertyName !== \"grid-template-rows\" || open) return;\n setMounted(false);\n },\n [open],\n );\n\n if (!mounted) return null;\n\n return (\n <div\n className=\"agent-chat-collapse\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden={!open}\n onTransitionEnd={onTransitionEnd}\n >\n <div className=\"agent-chat-collapse__content\">{children}</div>\n </div>\n );\n}\n\n// ─── Human-in-the-loop approval affordance ────────────────────────────────────\n\n/**\n * Inline Approve/Deny prompt rendered when a `needsApproval` action paused the\n * turn. Approve re-issues the turn with the call's `approvalKey`; Deny dismisses\n * the prompt locally (the action stays un-run).\n */\nfunction ApprovalAffordance({\n toolName,\n approval,\n}: {\n toolName: string;\n approval: { approvalKey: string; dismissed?: boolean };\n}) {\n const ctx = React.useContext(ApprovalContext);\n const [approved, setApproved] = useState(false);\n const [denied, setDenied] = useState(false);\n\n // Once approved, the turn is re-issued; collapse to a quiet note so the user\n // can't double-fire the approval.\n if (approved) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Approved. Re-running {toolName}...\n </div>\n );\n }\n // Deny defaults to local-only (the action simply stays un-run). When the\n // host also provided `onDeny` (e.g. a Code session resolving its own\n // pending approval), it fires alongside the local state.\n if (denied) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Denied. {toolName} did not run.\n </div>\n );\n }\n return (\n <div className=\"mt-1.5 flex items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5\">\n <IconShieldCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"mr-auto text-xs text-muted-foreground\">\n Approve to run {toolName}?\n </span>\n {ctx && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onApprove(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n <IconCheck className=\"h-3.5 w-3.5\" />\n Approve\n </button>\n )}\n {ctx?.onAlwaysAllow && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onAlwaysAllow?.(approval.approvalKey);\n }}\n title=\"Approve and always allow this exact command\"\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconShieldCheck className=\"h-3.5 w-3.5\" />\n Always allow\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setDenied(true);\n ctx?.onDeny?.(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconX className=\"h-3.5 w-3.5\" />\n Deny\n </button>\n </div>\n );\n}\n\n// ─── ToolCallDisplay ──────────────────────────────────────────────────────────\n\nexport function ToolCallDisplay({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n structuredMeta,\n approval,\n repeatCount,\n isLatestRunning = isRunning,\n isActiveTail,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n structuredMeta?: Record<string, unknown>;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n /** The latest tool shown while the overall chat turn is still active. */\n isActiveTail?: boolean;\n /** @deprecated Use isActiveTail. */\n isLatestRunning?: boolean;\n}) {\n const showActiveTail = isActiveTail ?? isLatestRunning;\n // Delegate to bespoke cells when structured metadata is present.\n // These must be separate components so hook order in ToolCallDisplayGeneric\n // is always stable (no conditional hook calls).\n const toolKind = structuredMeta?.toolKind as string | undefined;\n const wrapToolDisplay = (children: React.ReactNode) => (\n <ToolActivityPresentation\n toolName={toolName}\n isRunning={isRunning}\n isActiveTail={showActiveTail}\n >\n {children}\n </ToolActivityPresentation>\n );\n if (toolKind === \"bash\") {\n return wrapToolDisplay(\n <BashCell\n meta={\n structuredMeta as unknown as Parameters<typeof BashCell>[0][\"meta\"]\n }\n output={result}\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"edit\") {\n return wrapToolDisplay(\n <EditCell\n meta={\n structuredMeta as unknown as Parameters<typeof EditCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"write\") {\n return wrapToolDisplay(\n <WriteCell\n meta={\n structuredMeta as unknown as Parameters<typeof WriteCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n return wrapToolDisplay(\n <ToolCallDisplayGeneric\n toolName={toolName}\n argsText={argsText}\n args={args}\n result={result}\n mcpApp={mcpApp}\n chatUI={chatUI}\n isRunning={isRunning}\n isActiveTail={showActiveTail}\n approval={approval}\n repeatCount={repeatCount}\n />,\n );\n}\n\nfunction ToolCallDisplayGeneric({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n isActiveTail,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n isActiveTail: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const streamRef = useRef<HTMLDivElement>(null);\n\n const isAgentCall = toolName.startsWith(\"agent:\");\n const [expanded, setExpanded] = useState(isAgentCall);\n const [outputOpen, setOutputOpen] = useState(false);\n const agentName = isAgentCall ? toolName.slice(6) : null;\n const isAgentError = isAgentCall && result === \"Error calling agent\";\n const agentStreamText = isAgentCall ? (argsText ?? \"\") : \"\";\n const hasStreamText = agentStreamText.length > 0;\n const hasArgs = !isAgentCall && Object.keys(args).length > 0;\n\n // NOTE: All hooks must be above any conditional returns\n useEffect(() => {\n if (isAgentCall && isRunning && streamRef.current) {\n streamRef.current.scrollTop = streamRef.current.scrollHeight;\n }\n }, [agentStreamText, isAgentCall, isRunning]);\n\n // Render connect-builder as ConnectBuilderCard once the result is available\n if (toolName === \"connect-builder\" && result) {\n try {\n const parsed = JSON.parse(result);\n if (parsed?.kind === \"connect-builder-card\") {\n return (\n <ConnectBuilderCard\n configured={!!parsed.configured}\n builderEnabled={parsed.builderEnabled !== false}\n // Ignore saved cliAuthUrl values from older tool results. They\n // contain signed callback state and can expire while a chat sits\n // open; the card's hook fetches a fresh signed URL on mount/click.\n connectUrl={parsed.connectUrl || \"\"}\n orgName={parsed.orgName ?? null}\n prompt={typeof parsed.prompt === \"string\" ? parsed.prompt : \"\"}\n />\n );\n }\n } catch {\n // fall through to default pill rendering\n }\n }\n\n // Render agent-teams spawn as AgentTaskCard once the result is available\n if (\n toolName === \"agent-teams\" &&\n (args as Record<string, string>)?.action === \"spawn\" &&\n result\n ) {\n try {\n const parsed = JSON.parse(result);\n if (parsed.taskId && parsed.threadId) {\n return (\n <AgentTaskCard\n taskId={parsed.taskId}\n threadId={parsed.threadId}\n description={\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"Sub-agent task\"\n }\n onOpen={(tid) => {\n window.dispatchEvent(\n new CustomEvent(\"agent-task-open\", {\n detail: {\n threadId: tid,\n description:\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"\",\n name: parsed.name || \"\",\n },\n }),\n );\n }}\n />\n );\n }\n } catch {\n // Fall through to default pill rendering\n }\n }\n\n const parsedResult = result ? parseJsonText(result) : null;\n const nativeToolContext = {\n toolName,\n args,\n resultText: result,\n resultJson: parsedResult,\n isRunning,\n isActiveTail,\n chatUI,\n };\n const skipRegistryRenderer =\n !isAgentCall && isBuiltinDataWidgetActionRenderer(nativeToolContext);\n const NativeToolRenderer = isAgentCall\n ? null\n : (resolveBuiltinActionChatRenderer(nativeToolContext) ??\n (skipRegistryRenderer ? null : resolveToolRenderer(nativeToolContext)) ??\n resolveBuiltinFallbackToolRenderer(nativeToolContext));\n if (NativeToolRenderer) {\n return <NativeToolRenderer context={nativeToolContext} />;\n }\n\n const inputPayload = hasArgs ? toolInputPayload(toolName, args) : null;\n const resultPayload = toolResultPayload(result);\n\n const displayName = isAgentCall\n ? isRunning\n ? `Asking ${agentName}...`\n : isAgentError\n ? `Error asking ${agentName}`\n : `Asked ${agentName}`\n : humanizeToolName(toolName);\n\n const canExpand = isAgentCall\n ? hasStreamText\n : hasArgs || result !== undefined;\n const isExpanded = isAgentCall ? hasStreamText && expanded : expanded;\n const ToolIcon = resolveToolIcon(toolName);\n const outputTitle = `Raw ${toolName} tool call output`;\n\n return (\n <div className=\"group/tool my-0.5 w-full overflow-hidden\">\n {mcpApp && <McpAppRenderer app={mcpApp} className=\"mb-1.5\" />}\n <button\n type=\"button\"\n onClick={() => canExpand && setExpanded(!isExpanded)}\n aria-expanded={canExpand ? isExpanded : undefined}\n className={cn(\n \"flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors\",\n canExpand && \"hover:text-foreground\",\n isRunning && \"text-muted-foreground\",\n )}\n >\n <span className=\"relative flex size-4 shrink-0 items-center justify-center\">\n {isRunning ? (\n <IconLoader2 className=\"size-3.5 animate-spin\" />\n ) : isAgentError ? (\n <IconCircleX className=\"size-3.5 text-destructive\" />\n ) : (\n <>\n <ToolIcon\n className={cn(\n \"size-3.5 transition-opacity\",\n canExpand && \"group-hover/tool:opacity-0\",\n )}\n />\n {canExpand && (\n <IconChevronRight\n className={cn(\n \"absolute size-3.5 opacity-0 transition-[opacity,transform] group-hover/tool:opacity-100\",\n isExpanded && \"rotate-90\",\n )}\n />\n )}\n </>\n )}\n </span>\n <span\n className={cn(\n \"min-w-0 truncate font-normal\",\n isActiveTail && \"agent-running-shimmer\",\n )}\n >\n {displayName}\n </span>\n {repeatCount && repeatCount > 1 && (\n <span\n className=\"shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground\"\n title={`Repeated ${repeatCount} times`}\n >\n {repeatCount}x\n </span>\n )}\n </button>\n <AnimatedCollapse open={isExpanded && isAgentCall && hasStreamText}>\n <div\n ref={streamRef}\n className=\"mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none\"\n >\n {markdownModule?.default && remarkGfmFn ? (\n <markdownModule.default\n remarkPlugins={[remarkGfmFn]}\n components={markdownComponents}\n urlTransform={markdownUrlTransform}\n >\n {agentStreamText}\n </markdownModule.default>\n ) : (\n <span style={{ whiteSpace: \"pre-wrap\" }}>{agentStreamText}</span>\n )}\n </div>\n </AnimatedCollapse>\n <AnimatedCollapse\n open={isExpanded && !isAgentCall && (hasArgs || result !== undefined)}\n >\n <div className=\"mt-1 space-y-2 pl-5\">\n {inputPayload && (\n <SimpleCodeViewer\n text={inputPayload.text}\n lang={inputPayload.lang}\n />\n )}\n {resultPayload && (\n <ToolOutputPopover\n open={outputOpen}\n onOpenChange={setOutputOpen}\n title={outputTitle}\n payload={resultPayload}\n >\n <button\n type=\"button\"\n aria-label={`View ${toolName} output`}\n className=\"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground\"\n >\n <IconCode className=\"size-3.5\" />\n </button>\n </ToolOutputPopover>\n )}\n </div>\n </AnimatedCollapse>\n {approval && (\n <ApprovalAffordance toolName={toolName} approval={approval} />\n )}\n </div>\n );\n}\n\n// ─── ToolCallFallback ──────────────────────────────────────────────────────────\n\nexport function ToolCallFallback({\n toolName,\n args,\n argsText,\n result,\n ...rest\n}: ToolCallMessagePartProps & {\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n structuredMeta?: Record<string, unknown>;\n activity?: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n isLatestRunning?: boolean;\n isActiveTail?: boolean;\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const isRunning =\n result === undefined && (chatRunning || rest.activity === true);\n return (\n <ToolCallDisplay\n toolName={toolName}\n args={args as Record<string, unknown>}\n argsText={argsText}\n result={\n typeof result === \"string\"\n ? result\n : result !== undefined\n ? JSON.stringify(result)\n : undefined\n }\n mcpApp={rest.mcpApp}\n chatUI={rest.chatUI}\n structuredMeta={rest.structuredMeta}\n isRunning={isRunning}\n isActiveTail={rest.isActiveTail}\n isLatestRunning={rest.isLatestRunning}\n approval={rest.approval}\n repeatCount={rest.repeatCount}\n />\n );\n}\n\n// ─── ReconnectStreamMessage ────────────────────────────────────────────────────\n// Renders the agent's in-progress response during reconnection (outside\n// assistant-ui's runtime). Uses the same visual styling as normal messages.\n\nexport function ReconnectStreamMessage({\n content,\n}: {\n content: ContentPart[];\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const toolSummary = getReconnectToolSummaryInfo(content);\n const latestReasoningPartIndex = content.reduce(\n (latestIndex, part, index) =>\n part.type === \"reasoning\" ? index : latestIndex,\n -1,\n );\n const streamingTextPartIndex =\n content.at(-1)?.type === \"text\" ? content.length - 1 : -1;\n const streamingReasoningPartIndex =\n content.at(-1)?.type === \"reasoning\" ? content.length - 1 : -1;\n const latestActiveToolIndex = content.reduce(\n (latestIndex, part, index) =>\n part.type === \"tool-call\" && (chatRunning || part.activity === true)\n ? index\n : latestIndex,\n -1,\n );\n\n const renderPart = (part: ContentPart, i: number) => {\n if (part.type === \"text\") {\n const partStreaming = chatRunning && i === streamingTextPartIndex;\n return (\n <SmoothMarkdownText\n key={`reconnect-text-${i}`}\n text={part.text}\n streaming={partStreaming}\n resetKey={`reconnect-text-${i}`}\n statusType={partStreaming ? \"running\" : \"complete\"}\n />\n );\n }\n if (part.type === \"reasoning\") {\n return (\n <ReasoningCell\n key={`reconnect-reasoning-${i}`}\n text={part.text}\n isStreaming={chatRunning && i === streamingReasoningPartIndex}\n resetKey={`reconnect-reasoning-${i}`}\n defaultOpen={i === latestReasoningPartIndex}\n collapseWhenReplaced={i < latestReasoningPartIndex}\n />\n );\n }\n return (\n <ToolCallDisplay\n key={`reconnect-tool-${i}`}\n toolName={part.toolName}\n argsText={part.argsText}\n args={part.args}\n result={part.result}\n mcpApp={part.mcpApp}\n chatUI={part.chatUI}\n structuredMeta={part.structuredMeta}\n isRunning={\n part.result === undefined && (chatRunning || part.activity === true)\n }\n isActiveTail={i === latestActiveToolIndex}\n approval={part.approval}\n repeatCount={part.repeatCount}\n />\n );\n };\n\n const renderedParts: React.ReactNode[] = [];\n let summaryStartIndex = -1;\n let summaryToolCount = 0;\n const flushSummary = (endIndex: number) => {\n if (summaryStartIndex < 0) return;\n renderedParts.push(\n <RanToolsSummary\n key={`reconnect-tool-summary-${summaryStartIndex}`}\n toolCount={summaryToolCount}\n >\n {content\n .slice(summaryStartIndex, endIndex)\n .map((part, offset) => renderPart(part, summaryStartIndex + offset))}\n </RanToolsSummary>,\n );\n summaryStartIndex = -1;\n summaryToolCount = 0;\n };\n\n for (let i = 0; i < content.length; i++) {\n const part = content[i]!;\n const isOlderToolWork =\n toolSummary.startIndex >= 0 &&\n i < toolSummary.startIndex &&\n isReconnectToolSummaryPart(content, i, toolSummary.startIndex);\n if (isOlderToolWork) {\n summaryStartIndex = summaryStartIndex < 0 ? i : summaryStartIndex;\n if (part.type === \"tool-call\") summaryToolCount++;\n continue;\n }\n flushSummary(i);\n renderedParts.push(renderPart(part, i));\n }\n flushSummary(content.length);\n\n return (\n <div className=\"flex justify-start\">\n <div className=\"w-full max-w-[95%] text-sm leading-relaxed text-foreground space-y-1\">\n {renderedParts}\n </div>\n </div>\n );\n}\n\nfunction getReconnectToolSummaryInfo(content: readonly ContentPart[]) {\n const toolCallIndices = content.reduce<number[]>((indices, part, index) => {\n if (part.type === \"tool-call\" && isReconnectSummarizablePart(part)) {\n indices.push(index);\n }\n return indices;\n }, []);\n if (toolCallIndices.length <= ASSISTANT_VISIBLE_TOOL_CALL_LIMIT) {\n return { startIndex: -1 };\n }\n return {\n startIndex:\n toolCallIndices[\n toolCallIndices.length - ASSISTANT_VISIBLE_TOOL_CALL_LIMIT\n ]!,\n };\n}\n\nfunction isReconnectSummarizablePart(part: ContentPart): boolean {\n return (\n part.type === \"reasoning\" ||\n (part.type === \"tool-call\" && part.toolName !== \"connect-builder\")\n );\n}\n\nfunction isReconnectToolSummaryPart(\n content: readonly ContentPart[],\n index: number,\n startIndex: number,\n): boolean {\n if (startIndex < 0 || index >= startIndex) return false;\n if (!isReconnectSummarizablePart(content[index]!)) return false;\n\n let segmentStart = index;\n while (\n segmentStart > 0 &&\n isReconnectSummarizablePart(content[segmentStart - 1]!)\n ) {\n segmentStart--;\n }\n\n let segmentEnd = index + 1;\n while (\n segmentEnd < startIndex &&\n isReconnectSummarizablePart(content[segmentEnd]!)\n ) {\n segmentEnd++;\n }\n\n return content\n .slice(segmentStart, segmentEnd)\n .some((candidate) => candidate.type === \"tool-call\");\n}\n\n// ─── Reasoning / Thinking cell ────────────────────────────────────────────────\n\n/**\n * Completed reasoning and tool calls share one outer \"Worked for…\"\n * disclosure. Reasoning cells inside it render their prose directly so\n * opening that summary never reveals a redundant second disclosure.\n */\nconst WorkSummaryContentContext = React.createContext(false);\n\nexport function ReasoningCell({\n text,\n isStreaming = false,\n resetKey,\n defaultOpen,\n autoCollapse = false,\n collapseWhenReplaced = false,\n durationMs,\n}: {\n text: string;\n isStreaming?: boolean;\n /** Stable identity used to restart the reveal when a new reasoning part mounts. */\n resetKey?: string;\n defaultOpen?: boolean;\n /** Animate closed when a live reasoning segment finishes during a run. */\n autoCollapse?: boolean;\n /** Animate closed when a newer reasoning segment replaces this one. */\n collapseWhenReplaced?: boolean;\n /**\n * Elapsed thinking time in ms, once known. Only meaningful once streaming\n * has finished — callers that track live timing (see ReasoningMessagePart)\n * pass this so the label can read \"Thought for Xs\" instead of \"Thought\".\n * Historical messages with no live timing simply omit it.\n */\n durationMs?: number | null;\n}) {\n const embeddedInWorkSummary = React.useContext(WorkSummaryContentContext);\n const [open, setOpen] = useState(defaultOpen ?? true);\n const wasStreamingRef = useRef(isStreaming);\n const wasReplacedRef = useRef(collapseWhenReplaced);\n const trimmed = text.trim();\n const visibleText = useSmoothStreamingText(\n trimmed,\n isStreaming,\n resetKey ?? \"reasoning\",\n );\n\n useEffect(() => {\n if (autoCollapse && wasStreamingRef.current && !isStreaming) {\n setOpen(false);\n }\n wasStreamingRef.current = isStreaming;\n }, [autoCollapse, isStreaming]);\n\n useEffect(() => {\n if (collapseWhenReplaced && !wasReplacedRef.current) {\n setOpen(false);\n }\n wasReplacedRef.current = collapseWhenReplaced;\n }, [collapseWhenReplaced]);\n\n if (!trimmed && !isStreaming) return null;\n\n if (embeddedInWorkSummary) {\n return (\n <div className=\"pb-1 pl-5 text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {visibleText || (isStreaming ? \"…\" : \"\")}\n </div>\n );\n }\n\n const label = isStreaming\n ? \"Thinking\"\n : durationMs != null\n ? `Thought for ${formatWorkedDuration(durationMs)}`\n : \"Thought\";\n // Only clamp to a scroll-free \"tail\" view while actively streaming and\n // expanded — once the run finishes the full text is shown, unclamped.\n const showTail = isStreaming && open;\n\n return (\n <div className=\"my-0.5 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n {isStreaming ? (\n <span className=\"agent-thinking-indicator__text\">{label}</span>\n ) : (\n <span>{label}</span>\n )}\n </button>\n <AnimatedCollapse open={open}>\n <div className={cn(\"pl-5 pb-1\", showTail && \"reasoning-cell-tail\")}>\n <div className=\"text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {visibleText || (isStreaming ? \"…\" : \"\")}\n </div>\n </div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Worked-for duration helpers ──────────────────────────────────────────────\n\nexport function formatWorkedDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.round(ms / 1000));\n if (totalSeconds < 60) {\n return totalSeconds <= 1 ? \"1s\" : `${totalSeconds}s`;\n }\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n if (minutes < 60) {\n if (seconds === 0) return `${minutes}m`;\n return `${minutes}m ${seconds}s`;\n }\n const hours = Math.floor(minutes / 60);\n const remMinutes = minutes % 60;\n if (remMinutes === 0) return `${hours}h`;\n return `${hours}h ${remMinutes}m`;\n}\n\nexport function WorkedForSummary({\n durationMs,\n autoCollapse = false,\n children,\n}: {\n durationMs?: number | null;\n /** When true, close the summary after a run has completed. */\n autoCollapse?: boolean;\n children: React.ReactNode;\n}) {\n // Start closed so a remounted completed message never flashes its work\n // details open while auto-collapse settles. If the summary was already\n // open when autoCollapse changes, AnimatedCollapse still animates it shut.\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (autoCollapse) setOpen(false);\n }, [autoCollapse]);\n\n const label =\n durationMs != null && durationMs >= 1000\n ? `Worked for ${formatWorkedDuration(durationMs)}`\n : \"Worked\";\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <WorkSummaryContentContext.Provider value>\n <div className=\"pt-1\">{children}</div>\n </WorkSummaryContentContext.Provider>\n </AnimatedCollapse>\n </div>\n );\n}\n\nexport function RanToolsSummary({\n toolCount,\n children,\n}: {\n toolCount: number;\n children: React.ReactNode;\n}) {\n const [open, setOpen] = useState(false);\n const label = `Ran ${toolCount} ${toolCount === 1 ? \"tool\" : \"tools\"}`;\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <div className=\"pt-1\">{children}</div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Re-export for AssistantMessage ───────────────────────────────────────────\n// AssistantMessage in AssistantChat.tsx uses FilesChangedSummary directly, so\n// re-export it so AssistantChat.tsx can import from one place.\nexport { FilesChangedSummary };\n"]}
|
|
@@ -6,6 +6,8 @@ export interface ToolRendererContext {
|
|
|
6
6
|
resultText?: string;
|
|
7
7
|
resultJson: unknown;
|
|
8
8
|
isRunning: boolean;
|
|
9
|
+
/** True while this is the newest tool representing an active chat turn. */
|
|
10
|
+
isActiveTail?: boolean;
|
|
9
11
|
chatUI?: ActionChatUIConfig;
|
|
10
12
|
}
|
|
11
13
|
export interface ToolRendererProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-render-registry.d.ts","sourceRoot":"","sources":["../../../src/client/chat/tool-render-registry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAErE,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,CAAC,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC;AA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|
|
1
|
-
{"version":3,"file":"tool-render-registry.js","sourceRoot":"","sources":["../../../src/client/chat/tool-render-registry.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-render-registry.js","sourceRoot":"","sources":["../../../src/client/chat/tool-render-registry.tsx"],"names":[],"mappings":"AAqCA,MAAM,qBAAqB,GAA+B,EAAE,CAAC;AAC7D,MAAM,aAAa,GAA+B,EAAE,CAAC;AACrD,MAAM,6BAA6B,GAA+B,EAAE,CAAC;AACrE,MAAM,qBAAqB,GAA+B,EAAE,CAAC;AAC7D,MAAM,+BAA+B,GAAqC,EAAE,CAAC;AAC7E,MAAM,uBAAuB,GAAqC,EAAE,CAAC;AAErE,SAAS,UAAU,CAAI,IAAS,EAAE,YAAe;IAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;QAC9D,IAAI,KAAK,IAAI,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,YAAsC;IAEtC,OAAO,UAAU,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,YAAsC;IAEtC,OAAO,UAAU,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,YAAsC;IAEtC,OAAO,UAAU,CAAC,6BAA6B,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,YAAsC;IAEtC,OAAO,UAAU,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,0BAA0B,CAC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AAE,CAAC;YAC/C,OAAO,YAAY,CAAC,SAAS,CAAC;QAChC,CAAC;IACH,CAAC;IACD,KAAK,MAAM,YAAY,IAAI,qBAAqB,EAAE,CAAC;QACjD,IAAI,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC;YAC/C,OAAO,YAAY,CAAC,SAAS,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,uBAAuB,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,kCAAkC;IAChD,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,6BAA6B,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,+BAA+B,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { ComponentType } from \"react\";\n\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\n\nexport interface ToolRendererContext {\n toolName: string;\n args: Record<string, unknown>;\n resultText?: string;\n resultJson: unknown;\n isRunning: boolean;\n /** True while this is the newest tool representing an active chat turn. */\n isActiveTail?: boolean;\n chatUI?: ActionChatUIConfig;\n}\n\nexport interface ToolRendererProps {\n context: ToolRendererContext;\n}\n\nexport type ToolRendererComponent = ComponentType<ToolRendererProps>;\n\nexport type ToolRendererMatch =\n | string\n | ((context: ToolRendererContext) => boolean);\n\nexport interface ToolRendererRegistration {\n id: string;\n match: ToolRendererMatch;\n Component: ToolRendererComponent;\n}\n\nexport interface ActionChatRendererRegistration {\n id: string;\n renderer: string;\n Component: ToolRendererComponent;\n}\n\nconst reservedRegistrations: ToolRendererRegistration[] = [];\nconst registrations: ToolRendererRegistration[] = [];\nconst reservedFallbackRegistrations: ToolRendererRegistration[] = [];\nconst fallbackRegistrations: ToolRendererRegistration[] = [];\nconst reservedActionChatRegistrations: ActionChatRendererRegistration[] = [];\nconst actionChatRegistrations: ActionChatRendererRegistration[] = [];\n\nfunction registerIn<T>(list: T[], registration: T) {\n list.push(registration);\n return () => {\n const index = list.findIndex((item) => item === registration);\n if (index >= 0) list.splice(index, 1);\n };\n}\n\nexport function registerToolRenderer(\n registration: ToolRendererRegistration,\n): () => void {\n return registerIn(registrations, registration);\n}\n\nexport function registerReservedToolRenderer(\n registration: ToolRendererRegistration,\n): () => void {\n return registerIn(reservedRegistrations, registration);\n}\n\nexport function registerReservedFallbackToolRenderer(\n registration: ToolRendererRegistration,\n): () => void {\n return registerIn(reservedFallbackRegistrations, registration);\n}\n\nexport function registerFallbackToolRenderer(\n registration: ToolRendererRegistration,\n): () => void {\n return registerIn(fallbackRegistrations, registration);\n}\n\nexport function registerActionChatRenderer(\n registration: ActionChatRendererRegistration,\n): () => void {\n return registerIn(actionChatRegistrations, registration);\n}\n\nexport function registerReservedActionChatRenderer(\n registration: ActionChatRendererRegistration,\n): () => void {\n return registerIn(reservedActionChatRegistrations, registration);\n}\n\nfunction matchesToolRenderer(\n registration: ToolRendererRegistration,\n context: ToolRendererContext,\n): boolean {\n if (typeof registration.match === \"string\") {\n return registration.match === context.toolName;\n }\n return registration.match(context);\n}\n\nexport function resolveToolRenderer(\n context: ToolRendererContext,\n): ToolRendererComponent | null {\n for (const registration of reservedRegistrations) {\n if (matchesToolRenderer(registration, context)) {\n return registration.Component;\n }\n }\n const renderer = context.chatUI?.renderer;\n if (renderer) {\n for (const registration of [\n ...reservedActionChatRegistrations,\n ...actionChatRegistrations,\n ]) {\n if (registration.renderer === renderer) {\n return registration.Component;\n }\n }\n }\n for (const registration of registrations) {\n if (matchesToolRenderer(registration, context)) {\n return registration.Component;\n }\n }\n for (const registration of reservedFallbackRegistrations) {\n if (matchesToolRenderer(registration, context)) {\n return registration.Component;\n }\n }\n for (const registration of fallbackRegistrations) {\n if (matchesToolRenderer(registration, context)) {\n return registration.Component;\n }\n }\n return null;\n}\n\nexport function clearToolRenderersForTests() {\n registrations.length = 0;\n fallbackRegistrations.length = 0;\n actionChatRegistrations.length = 0;\n}\n\nexport function clearReservedToolRenderersForTests() {\n reservedRegistrations.length = 0;\n reservedFallbackRegistrations.length = 0;\n reservedActionChatRegistrations.length = 0;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpConnectionSuggestion.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpConnectionSuggestion.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;AAQtC,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,8BAA8B,CAAC;IACzC,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACxC;AA6CD,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,WAAgB,EAChB,OAAoB,EACpB,YAAY,EAAE,kBAAkB,GACjC,EAAE,4BAA4B,sCA4M9B"}
|
|
@@ -4,6 +4,7 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
4
4
|
import { agentNativePath } from "../api-path.js";
|
|
5
5
|
import { openAgentSettings } from "../CommandMenu.js";
|
|
6
6
|
import { useT } from "../i18n.js";
|
|
7
|
+
import { clearMcpConnectionResume, notifyMcpConnectionComplete, saveMcpConnectionResume, } from "./mcp-connection-resume.js";
|
|
7
8
|
import { buildMcpOAuthStartUrl, findMcpIntegrationForText, getMcpIntegrationApiFallback, getDefaultMcpIntegrations, isMcpConnectionFailureText, } from "./mcp-integration-catalog.js";
|
|
8
9
|
import { McpIntegrationDialog } from "./McpIntegrationDialog.js";
|
|
9
10
|
import { useCreateMcpServer, useMcpServers, } from "./use-mcp-servers.js";
|
|
@@ -80,6 +81,7 @@ export function McpConnectionSuggestion({ text, contextText = "", variant = "com
|
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
83
|
if (canStartOAuth(integration)) {
|
|
84
|
+
saveMcpConnectionResume(variant === "response" ? contextText : text);
|
|
83
85
|
window.location.assign(agentNativePath(buildMcpOAuthStartUrl({
|
|
84
86
|
name: integration.name,
|
|
85
87
|
url: integration.url,
|
|
@@ -91,6 +93,7 @@ export function McpConnectionSuggestion({ text, contextText = "", variant = "com
|
|
|
91
93
|
}
|
|
92
94
|
if (integration.authMode === "none" &&
|
|
93
95
|
integration.connectionMode === "direct") {
|
|
96
|
+
saveMcpConnectionResume(variant === "response" ? contextText : text);
|
|
94
97
|
setConnecting(true);
|
|
95
98
|
try {
|
|
96
99
|
await createMcpServer.mutateAsync({
|
|
@@ -100,8 +103,10 @@ export function McpConnectionSuggestion({ text, contextText = "", variant = "com
|
|
|
100
103
|
description: integration.description,
|
|
101
104
|
});
|
|
102
105
|
setDismissedId(integration.id);
|
|
106
|
+
notifyMcpConnectionComplete();
|
|
103
107
|
}
|
|
104
108
|
catch (cause) {
|
|
109
|
+
clearMcpConnectionResume();
|
|
105
110
|
setError(cause instanceof Error ? cause.message : t("mcpIntegrations.failed"));
|
|
106
111
|
}
|
|
107
112
|
finally {
|
|
@@ -109,6 +114,7 @@ export function McpConnectionSuggestion({ text, contextText = "", variant = "com
|
|
|
109
114
|
}
|
|
110
115
|
return;
|
|
111
116
|
}
|
|
117
|
+
saveMcpConnectionResume(variant === "response" ? contextText : text);
|
|
112
118
|
setDialogOpen(true);
|
|
113
119
|
};
|
|
114
120
|
const actionLabel = hasApiFallback(apiFallback)
|
|
@@ -129,6 +135,14 @@ export function McpConnectionSuggestion({ text, contextText = "", variant = "com
|
|
|
129
135
|
canStartOAuth(integration) &&
|
|
130
136
|
!hasApiFallback(apiFallback) && (_jsx(IconPlugConnected, { className: "h-3 w-3" })), !connecting && hasApiFallback(apiFallback) && (_jsx(IconPlugConnected, { className: "h-3 w-3" })), actionLabel, !connecting &&
|
|
131
137
|
!canStartOAuth(integration) &&
|
|
132
|
-
!hasApiFallback(apiFallback) && (_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:
|
|
138
|
+
!hasApiFallback(apiFallback) && (_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: (open) => {
|
|
139
|
+
setDialogOpen(open);
|
|
140
|
+
if (!open)
|
|
141
|
+
clearMcpConnectionResume();
|
|
142
|
+
}, initialIntegrationId: integration.id, defaultScope: "user", canCreateOrgMcp: false, hasOrg: Boolean(mcpServersQuery.data?.orgId), onCreateMcpServer: (args) => createMcpServer.mutateAsync(args), onCreated: () => {
|
|
143
|
+
setDismissedId(integration.id);
|
|
144
|
+
saveMcpConnectionResume(variant === "response" ? contextText : text);
|
|
145
|
+
notifyMcpConnectionComplete();
|
|
146
|
+
}, integrations: integrations })] }));
|
|
133
147
|
}
|
|
134
148
|
//# sourceMappingURL=McpConnectionSuggestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpConnectionSuggestion.js","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,GAE3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,aAAa,GAEd,MAAM,sBAAsB,CAAC;AAW9B,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;QACd,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAClB,WAAkC,EAClC,OAAoB;IAEpB,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC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,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,EAC/C,YAAY,EAAE,YAAY,GAC1B,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 { openAgentSettings } from \"../CommandMenu.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n buildMcpOAuthStartUrl,\n findMcpIntegrationForText,\n getMcpIntegrationApiFallback,\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\nexport interface McpConnectionSuggestionProps {\n text: string;\n contextText?: string;\n variant?: McpConnectionSuggestionVariant;\n integrations?: DefaultMcpIntegration[];\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\nfunction hasApiFallback(\n apiFallback: DefaultMcpIntegration[\"apiFallback\"] | null,\n): boolean {\n return Boolean(apiFallback);\n}\n\nexport function McpConnectionSuggestion({\n text,\n contextText = \"\",\n variant = \"composer\",\n integrations: integrationOptions,\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(\n () => integrationOptions ?? getDefaultMcpIntegrations(),\n [integrationOptions],\n );\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 apiFallback = integration\n ? getMcpIntegrationApiFallback(integration)\n : null;\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 (apiFallback) {\n openAgentSettings(`secrets:${apiFallback.secretKey}`);\n return;\n }\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 = hasApiFallback(apiFallback)\n ? t(\"mcpIntegrations.useApiToken\")\n : 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(\n hasApiFallback(apiFallback)\n ? \"mcpIntegrations.connectSuggestionWithApiToken\"\n : \"mcpIntegrations.connectSuggestion\",\n { name: integration.name },\n )}\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 &&\n canStartOAuth(integration) &&\n !hasApiFallback(apiFallback) && (\n <IconPlugConnected className=\"h-3 w-3\" />\n )}\n {!connecting && hasApiFallback(apiFallback) && (\n <IconPlugConnected className=\"h-3 w-3\" />\n )}\n {actionLabel}\n {!connecting &&\n !canStartOAuth(integration) &&\n !hasApiFallback(apiFallback) && (\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 integrations={integrations}\n />\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"McpConnectionSuggestion.js","sourceRoot":"","sources":["../../../src/client/resources/McpConnectionSuggestion.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE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F,CACP,EACD,KAAC,oBAAoB,IACnB,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;oBACrB,aAAa,CAAC,IAAI,CAAC,CAAC;oBACpB,IAAI,CAAC,IAAI;wBAAE,wBAAwB,EAAE,CAAC;gBACxC,CAAC,EACD,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;oBACd,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;oBAC/B,uBAAuB,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;oBACrE,2BAA2B,EAAE,CAAC;gBAChC,CAAC,EACD,YAAY,EAAE,YAAY,GAC1B,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 { openAgentSettings } from \"../CommandMenu.js\";\nimport { useT } from \"../i18n.js\";\nimport {\n clearMcpConnectionResume,\n notifyMcpConnectionComplete,\n saveMcpConnectionResume,\n} from \"./mcp-connection-resume.js\";\nimport {\n buildMcpOAuthStartUrl,\n findMcpIntegrationForText,\n getMcpIntegrationApiFallback,\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\nexport interface McpConnectionSuggestionProps {\n text: string;\n contextText?: string;\n variant?: McpConnectionSuggestionVariant;\n integrations?: DefaultMcpIntegration[];\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\nfunction hasApiFallback(\n apiFallback: DefaultMcpIntegration[\"apiFallback\"] | null,\n): boolean {\n return Boolean(apiFallback);\n}\n\nexport function McpConnectionSuggestion({\n text,\n contextText = \"\",\n variant = \"composer\",\n integrations: integrationOptions,\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(\n () => integrationOptions ?? getDefaultMcpIntegrations(),\n [integrationOptions],\n );\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 apiFallback = integration\n ? getMcpIntegrationApiFallback(integration)\n : null;\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 (apiFallback) {\n openAgentSettings(`secrets:${apiFallback.secretKey}`);\n return;\n }\n\n if (canStartOAuth(integration)) {\n saveMcpConnectionResume(variant === \"response\" ? contextText : text);\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 saveMcpConnectionResume(variant === \"response\" ? contextText : text);\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 notifyMcpConnectionComplete();\n } catch (cause) {\n clearMcpConnectionResume();\n setError(\n cause instanceof Error ? cause.message : t(\"mcpIntegrations.failed\"),\n );\n } finally {\n setConnecting(false);\n }\n return;\n }\n\n saveMcpConnectionResume(variant === \"response\" ? contextText : text);\n setDialogOpen(true);\n };\n\n const actionLabel = hasApiFallback(apiFallback)\n ? t(\"mcpIntegrations.useApiToken\")\n : 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(\n hasApiFallback(apiFallback)\n ? \"mcpIntegrations.connectSuggestionWithApiToken\"\n : \"mcpIntegrations.connectSuggestion\",\n { name: integration.name },\n )}\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 &&\n canStartOAuth(integration) &&\n !hasApiFallback(apiFallback) && (\n <IconPlugConnected className=\"h-3 w-3\" />\n )}\n {!connecting && hasApiFallback(apiFallback) && (\n <IconPlugConnected className=\"h-3 w-3\" />\n )}\n {actionLabel}\n {!connecting &&\n !canStartOAuth(integration) &&\n !hasApiFallback(apiFallback) && (\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={(open) => {\n setDialogOpen(open);\n if (!open) clearMcpConnectionResume();\n }}\n initialIntegrationId={integration.id}\n defaultScope=\"user\"\n canCreateOrgMcp={false}\n hasOrg={Boolean(mcpServersQuery.data?.orgId)}\n onCreateMcpServer={(args) => createMcpServer.mutateAsync(args)}\n onCreated={() => {\n setDismissedId(integration.id);\n saveMcpConnectionResume(variant === \"response\" ? contextText : text);\n notifyMcpConnectionComplete();\n }}\n integrations={integrations}\n />\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTree.d.ts","sourceRoot":"","sources":["../../../src/client/resources/ResourceTree.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAU7D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAC;AAoE9E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,EAAE,CAAC,EAAE,EAA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node: node, depth: 0, expanded: expanded, selectedId: selectedId, deletingId: deletingId, readOnly: readOnly, onToggle: toggleExpand, onSelect: onSelect, onDelete: onDelete, onStartCreate: handleStartCreate }, node.resource?.id ?? node.path))), isLoading && isEmpty && (_jsx("div", { className: cn("px-1 py-1"), children: Array.from({ length: 3 }).map((_, i) => (_jsxs("div", { className: cn("flex items-center gap-2 px-1.5 py-1", variant === "collection" && "gap-3 px-2.5 py-3"), children: [_jsx("div", { className: cn("rounded bg-muted-foreground/10 animate-pulse", variant === "collection" ? "size-8" : "h-3.5 w-3.5"), style: { animationDelay: `${i * 75}ms` } }), _jsx("div", { className: "h-3 rounded bg-muted-foreground/10 animate-pulse", style: {
|
|
265
265
|
width: `${50 + ((i * 37) % 40)}%`,
|
|
266
266
|
animationDelay: `${i * 75}ms`,
|
|
267
|
-
} })] }, i))) })), creating && creating.parentPath === "" && (_jsx(InlineInput, { depth: 0, onConfirm: handleConfirmCreate, onCancel: handleCancelCreate })), creating && creating.parentPath !== "" && (_jsx(InlineInput, { depth: creating.parentPath.split("/").filter(Boolean).length, onConfirm: handleConfirmCreate, onCancel: handleCancelCreate })), isEmpty && !creating && !isLoading && (_jsxs("div", { className: "flex items-start
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
} })] }, i))) })), creating && creating.parentPath === "" && (_jsx(InlineInput, { depth: 0, onConfirm: handleConfirmCreate, onCancel: handleCancelCreate })), creating && creating.parentPath !== "" && (_jsx(InlineInput, { depth: creating.parentPath.split("/").filter(Boolean).length, onConfirm: handleConfirmCreate, onCancel: handleCancelCreate })), isEmpty && !creating && !isLoading && (_jsxs("div", { className: "flex flex-col items-start border-y border-border/60 px-2 py-5", children: [_jsx("p", { className: "ps-5 text-xs text-muted-foreground", children: variant === "collection"
|
|
268
|
+
? "No resources in this collection yet"
|
|
269
|
+
: "No files yet" }), emptyStateAction && _jsx("div", { className: "mt-4", children: emptyStateAction })] }))] }));
|
|
270
270
|
}
|
|
271
271
|
//# sourceMappingURL=ResourceTree.js.map
|