@agent-native/core 0.98.17 → 0.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +25 -0
- package/corpus/core/docs/content/actions.mdx +1 -1
- package/corpus/core/docs/content/authentication.mdx +1 -1
- package/corpus/core/docs/content/dispatch.mdx +3 -3
- package/corpus/core/docs/content/external-agents.mdx +30 -19
- package/corpus/core/docs/content/locales/ar-SA/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/ar-SA/mcp-clients.mdx +31 -3
- package/corpus/core/docs/content/locales/ar-SA/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/ar-SA/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ar-SA/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/de-DE/mcp-clients.mdx +37 -3
- package/corpus/core/docs/content/locales/de-DE/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/de-DE/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/server.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +32 -19
- package/corpus/core/docs/content/locales/es-ES/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/es-ES/mcp-protocol.mdx +38 -15
- package/corpus/core/docs/content/locales/es-ES/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/es-ES/server.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/fr-FR/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/fr-FR/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/fr-FR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/fr-FR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +31 -19
- package/corpus/core/docs/content/locales/hi-IN/mcp-clients.mdx +17 -3
- package/corpus/core/docs/content/locales/hi-IN/mcp-protocol.mdx +36 -15
- package/corpus/core/docs/content/locales/hi-IN/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/hi-IN/server.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/ja-JP/mcp-clients.mdx +34 -3
- package/corpus/core/docs/content/locales/ja-JP/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/ja-JP/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ja-JP/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +30 -19
- package/corpus/core/docs/content/locales/ko-KR/mcp-clients.mdx +33 -3
- package/corpus/core/docs/content/locales/ko-KR/mcp-protocol.mdx +36 -15
- package/corpus/core/docs/content/locales/ko-KR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/ko-KR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +32 -19
- package/corpus/core/docs/content/locales/pt-BR/mcp-clients.mdx +34 -3
- package/corpus/core/docs/content/locales/pt-BR/mcp-protocol.mdx +32 -15
- package/corpus/core/docs/content/locales/pt-BR/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/pt-BR/server.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/zh-CN/mcp-clients.mdx +28 -3
- package/corpus/core/docs/content/locales/zh-CN/mcp-protocol.mdx +29 -15
- package/corpus/core/docs/content/locales/zh-CN/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-CN/server.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/template-plan.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/actions.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/dispatch.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +23 -19
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.mdx +28 -3
- package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.mdx +30 -15
- package/corpus/core/docs/content/locales/zh-TW/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/locales/zh-TW/server.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/template-assets.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/template-plan.mdx +3 -3
- package/corpus/core/docs/content/mcp-clients.mdx +31 -4
- package/corpus/core/docs/content/mcp-protocol.mdx +35 -15
- package/corpus/core/docs/content/plan-plugin.mdx +3 -3
- package/corpus/core/docs/content/server.mdx +2 -2
- package/corpus/core/docs/content/skills-guide.mdx +1 -1
- package/corpus/core/docs/content/template-assets.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +2 -2
- package/corpus/core/docs/content/template-plan.mdx +3 -3
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/client.ts +3 -0
- package/corpus/core/src/a2a/handlers.ts +95 -7
- package/corpus/core/src/agent/production-agent.ts +21 -0
- package/corpus/core/src/cli/connect.ts +50 -24
- package/corpus/core/src/cli/mcp-config-writers.ts +10 -0
- package/corpus/core/src/cli/mcp.ts +5 -5
- package/corpus/core/src/cli/pr-visual-recap-workflow.ts +1 -1
- package/corpus/core/src/cli/skills-content/assets-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/design-exploration-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/help.ts +1 -1
- package/corpus/core/src/cli/skills-content/plan-setup-auth.ts +1 -1
- package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +1 -1
- package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +2 -2
- package/corpus/core/src/cli/skills.ts +23 -12
- package/corpus/core/src/client/analytics.ts +13 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +5 -0
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +17 -0
- package/corpus/core/src/embedding/agent.ts +8 -6
- package/corpus/core/src/localization/default-messages.ts +7 -0
- package/corpus/core/src/mcp/ask-app-inline-tasks.ts +125 -0
- package/corpus/core/src/mcp/build-server.ts +65 -3
- package/corpus/core/src/mcp/builtin-tools.ts +186 -22
- package/corpus/core/src/mcp/connect-route.ts +17 -14
- package/corpus/core/src/mcp/oauth-route.ts +38 -13
- package/corpus/core/src/mcp/route-paths.ts +34 -0
- package/corpus/core/src/mcp/server.ts +21 -10
- package/corpus/core/src/mcp/stdio.ts +34 -16
- package/corpus/core/src/mcp/workspace-resolve.ts +2 -1
- package/corpus/core/src/mcp-client/manager.ts +5 -3
- package/corpus/core/src/mcp-client/remote-store.ts +10 -10
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +13 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +42 -9
- package/corpus/core/src/server/agent-teams.ts +17 -0
- package/corpus/core/src/server/auth.ts +22 -6
- package/corpus/core/src/server/core-routes-plugin.ts +30 -24
- package/corpus/core/src/server/csrf.ts +17 -0
- package/corpus/core/src/server/framework-request-handler.ts +8 -2
- package/corpus/core/src/server/google-oauth.ts +12 -2
- package/corpus/core/src/server/http-response-telemetry.ts +6 -1
- package/corpus/core/src/server/recap-image-route.ts +3 -3
- package/corpus/core/src/server/security-headers.ts +7 -1
- package/corpus/core/src/server/ssr-handler.ts +2 -0
- package/corpus/core/src/shared/cache-control.ts +6 -4
- package/corpus/core/src/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/corpus/core/src/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/analytics/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/analytics/app/assets/replay-cursor.svg +17 -0
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +4 -3
- package/corpus/templates/analytics/app/global.css +71 -4
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/DashboardFilterBar.tsx +32 -4
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueDetail.tsx +1 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +49 -11
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +4 -6
- package/corpus/templates/analytics/changelog/2026-07-13-all-time-dashboard-filters-no-longer-send-invalid-dates-to-b.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-daily-dashboard-emails-recover-more-reliably-from-serverless.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-error-issue-titles-wrap-instead-of-overflowing.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-saving-a-new-dashboard-view-no-longer-fails-with-a-server-er.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-session-replay-cursors-stay-hidden-until-their-first-recorde.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-session-replay-links-now-support-cmd-click-and-middle-click-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-13-session-replays-keep-a-visible-mac-style-cursor-over-the-vis.md +6 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +21 -2
- package/corpus/templates/analytics/server/lib/dashboard-report-subscriptions.ts +57 -1
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +266 -28
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +43 -4
- package/corpus/templates/analytics/server/lib/error-capture.ts +24 -5
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/analytics/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/assets/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/assets/agent-native.app-skill.json +1 -1
- package/corpus/templates/brain/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/calendar/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/calendar/AGENTS.md +2 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +0 -19
- package/corpus/templates/calendar/app/lib/attendee-local-time.ts +14 -5
- package/corpus/templates/calendar/changelog/2026-07-13-your-local-time-now-follows-your-browser-timezone-and-event-.md +6 -0
- package/corpus/templates/chat/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +7 -2
- package/corpus/templates/clips/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/clips/AGENTS.md +7 -0
- package/corpus/templates/clips/actions/list-meetings.ts +19 -4
- package/corpus/templates/clips/actions/start-meeting-recording.ts +7 -1
- package/corpus/templates/clips/app/components/library/recording-card.tsx +27 -26
- package/corpus/templates/clips/app/components/library/space-card.tsx +4 -6
- package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +75 -78
- package/corpus/templates/clips/app/components/recorder/confetti-canvas.tsx +18 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +6 -12
- package/corpus/templates/clips/app/components/recorder/recording-toolbar.tsx +19 -2
- package/corpus/templates/clips/app/lib/camera-composite.ts +70 -10
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +1 -1
- package/corpus/templates/clips/app/routes/record.tsx +5 -25
- package/corpus/templates/clips/changelog/2026-07-13-clips-desktop-now-requires-macos-13-for-native-capture.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-clips-hide-solo-meeting-reminders.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-clips-now-removes-duplicate-mic-and-system-transcript-turns-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-desktop-recordings-run-cooler-and-quieter-live-transcription.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-meeting-recordings-now-stop-after-a-calendar-meeting-ends-an.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-meeting-transcripts-now-use-a-clean-agent-chat-style-reading.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-13-screen-recordings-use-less-processing-power-during-longer-ca.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +5 -3
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +17 -14
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +8 -2
- package/corpus/templates/clips/desktop/README.md +3 -0
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +9 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +8 -2
- package/corpus/templates/clips/desktop/src/lib/silence-events.ts +1 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +5 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +134 -5
- package/corpus/templates/clips/desktop/src/lib/upload-video-stream.ts +28 -0
- package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +10 -3
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +42 -9
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +10 -2
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +6 -1
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +77 -1
- package/corpus/templates/clips/desktop/src-tauri/src/silence_detector.rs +104 -25
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +4 -0
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +287 -32
- package/corpus/templates/clips/desktop/src-tauri/tauri.conf.json +1 -1
- package/corpus/templates/clips/server/lib/calendar-event-classification.ts +28 -0
- package/corpus/templates/clips/server/routes/[...page].get.ts +1 -59
- package/corpus/templates/clips/shared/recording-capture.ts +37 -0
- package/corpus/templates/content/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/content/agent-native.app-skill.json +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +18 -16
- package/corpus/templates/content/server/routes/[...page].get.ts +1 -15
- package/corpus/templates/design/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/design/actions/connect-assets-mcp.ts +1 -1
- package/corpus/templates/design/agent-native.app-skill.json +1 -1
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +88 -12
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +4 -1
- package/corpus/templates/design/changelog/2026-07-13-adding-shapes-preserves-canvas-background.md +6 -0
- package/corpus/templates/design/changelog/2026-07-13-clicking-quickly-between-overlapping-elements-no-longer-bounc.md +6 -0
- package/corpus/templates/design/server/plugins/assets-mcp.ts +1 -1
- package/corpus/templates/design/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/dispatch/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/forms/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/macros/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/mail/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/plan/.agents/skills/security/SKILL.md +10 -0
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +1 -1
- package/corpus/templates/plan/.agents/skills/visual-recap/SKILL.md +2 -2
- package/corpus/templates/plan/agent-native.app-skill.json +1 -1
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +6 -1
- package/corpus/templates/plan/app/pages/PlansPage.tsx +15 -6
- package/corpus/templates/plan/changelog/2026-07-13-fixed-local-plan-previews-continuously-flickering-while-revi.md +6 -0
- package/corpus/templates/plan/server/routes/[...page].get.ts +0 -2
- package/corpus/templates/slides/.agents/skills/security/SKILL.md +10 -0
- package/dist/a2a/client.d.ts +2 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +2 -0
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +84 -7
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/agent/production-agent.d.ts +9 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +12 -0
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/connect.d.ts +2 -2
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +45 -23
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/mcp-config-writers.d.ts.map +1 -1
- package/dist/cli/mcp-config-writers.js +7 -0
- package/dist/cli/mcp-config-writers.js.map +1 -1
- package/dist/cli/mcp.js +5 -3
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.js +1 -1
- package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
- package/dist/cli/skills-content/assets-skill.d.ts +1 -1
- package/dist/cli/skills-content/assets-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/assets-skill.js +1 -1
- package/dist/cli/skills-content/assets-skill.js.map +1 -1
- package/dist/cli/skills-content/design-exploration-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-exploration-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-exploration-skill.js +1 -1
- package/dist/cli/skills-content/design-exploration-skill.js.map +1 -1
- package/dist/cli/skills-content/help.d.ts +1 -1
- package/dist/cli/skills-content/help.d.ts.map +1 -1
- package/dist/cli/skills-content/help.js +1 -1
- package/dist/cli/skills-content/help.js.map +1 -1
- package/dist/cli/skills-content/plan-setup-auth.d.ts +1 -1
- package/dist/cli/skills-content/plan-setup-auth.d.ts.map +1 -1
- package/dist/cli/skills-content/plan-setup-auth.js +1 -1
- package/dist/cli/skills-content/plan-setup-auth.js.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/visual-plan-skill.js +1 -1
- package/dist/cli/skills-content/visual-plan-skill.js.map +1 -1
- package/dist/cli/skills-content/visual-recap-skill.d.ts +1 -1
- package/dist/cli/skills-content/visual-recap-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/visual-recap-skill.js +2 -2
- package/dist/cli/skills-content/visual-recap-skill.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +16 -12
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +11 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +1 -1
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- 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 +14 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/embedding/agent.d.ts.map +1 -1
- package/dist/embedding/agent.js +6 -7
- package/dist/embedding/agent.js.map +1 -1
- package/dist/localization/default-messages.d.ts +5 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +5 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/ask-app-inline-tasks.d.ts +47 -0
- package/dist/mcp/ask-app-inline-tasks.d.ts.map +1 -0
- package/dist/mcp/ask-app-inline-tasks.js +87 -0
- package/dist/mcp/ask-app-inline-tasks.js.map +1 -0
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +56 -3
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +141 -21
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/mcp/connect-route.d.ts +12 -10
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +17 -14
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/mcp/oauth-route.d.ts +1 -1
- package/dist/mcp/oauth-route.d.ts.map +1 -1
- package/dist/mcp/oauth-route.js +30 -13
- package/dist/mcp/oauth-route.js.map +1 -1
- package/dist/mcp/route-paths.d.ts +13 -0
- package/dist/mcp/route-paths.d.ts.map +1 -0
- package/dist/mcp/route-paths.js +27 -0
- package/dist/mcp/route-paths.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +14 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/stdio.d.ts +7 -6
- package/dist/mcp/stdio.d.ts.map +1 -1
- package/dist/mcp/stdio.js +27 -15
- package/dist/mcp/stdio.js.map +1 -1
- package/dist/mcp/workspace-resolve.d.ts +2 -1
- package/dist/mcp/workspace-resolve.d.ts.map +1 -1
- package/dist/mcp/workspace-resolve.js +2 -1
- package/dist/mcp/workspace-resolve.js.map +1 -1
- package/dist/mcp-client/manager.js +6 -3
- package/dist/mcp-client/manager.js.map +1 -1
- package/dist/mcp-client/remote-store.js +5 -7
- package/dist/mcp-client/remote-store.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.js +11 -1
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +43 -11
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +15 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +16 -6
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +4 -3
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +20 -15
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +11 -0
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +8 -2
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-oauth.d.ts +2 -0
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +11 -2
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/http-response-telemetry.d.ts.map +1 -1
- package/dist/server/http-response-telemetry.js +4 -1
- package/dist/server/http-response-telemetry.js.map +1 -1
- package/dist/server/recap-image-route.js +3 -3
- package/dist/server/recap-image-route.js.map +1 -1
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +4 -1
- package/dist/server/security-headers.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +3 -1
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/shared/cache-control.d.ts +7 -6
- package/dist/shared/cache-control.d.ts.map +1 -1
- package/dist/shared/cache-control.js +4 -3
- package/dist/shared/cache-control.js.map +1 -1
- package/dist/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
- package/docs/content/actions.mdx +1 -1
- package/docs/content/authentication.mdx +1 -1
- package/docs/content/dispatch.mdx +3 -3
- package/docs/content/external-agents.mdx +30 -19
- package/docs/content/locales/ar-SA/actions.mdx +1 -1
- package/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/docs/content/locales/ar-SA/dispatch.mdx +3 -3
- package/docs/content/locales/ar-SA/external-agents.mdx +23 -19
- package/docs/content/locales/ar-SA/mcp-clients.mdx +31 -3
- package/docs/content/locales/ar-SA/mcp-protocol.mdx +29 -15
- package/docs/content/locales/ar-SA/plan-plugin.mdx +3 -3
- package/docs/content/locales/ar-SA/server.mdx +2 -2
- package/docs/content/locales/ar-SA/skills-guide.mdx +1 -1
- package/docs/content/locales/ar-SA/template-assets.mdx +1 -1
- package/docs/content/locales/ar-SA/template-dispatch.mdx +2 -2
- package/docs/content/locales/ar-SA/template-plan.mdx +3 -3
- package/docs/content/locales/de-DE/actions.mdx +1 -1
- package/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/docs/content/locales/de-DE/dispatch.mdx +3 -3
- package/docs/content/locales/de-DE/external-agents.mdx +23 -19
- package/docs/content/locales/de-DE/mcp-clients.mdx +37 -3
- package/docs/content/locales/de-DE/mcp-protocol.mdx +29 -15
- package/docs/content/locales/de-DE/plan-plugin.mdx +3 -3
- package/docs/content/locales/de-DE/server.mdx +2 -2
- package/docs/content/locales/de-DE/skills-guide.mdx +1 -1
- package/docs/content/locales/de-DE/template-assets.mdx +1 -1
- package/docs/content/locales/de-DE/template-dispatch.mdx +2 -2
- package/docs/content/locales/de-DE/template-plan.mdx +3 -3
- package/docs/content/locales/es-ES/actions.mdx +1 -1
- package/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/docs/content/locales/es-ES/dispatch.mdx +3 -3
- package/docs/content/locales/es-ES/external-agents.mdx +32 -19
- package/docs/content/locales/es-ES/mcp-clients.mdx +17 -3
- package/docs/content/locales/es-ES/mcp-protocol.mdx +38 -15
- package/docs/content/locales/es-ES/plan-plugin.mdx +3 -3
- package/docs/content/locales/es-ES/server.mdx +2 -2
- package/docs/content/locales/es-ES/skills-guide.mdx +1 -1
- package/docs/content/locales/es-ES/template-assets.mdx +1 -1
- package/docs/content/locales/es-ES/template-dispatch.mdx +2 -2
- package/docs/content/locales/es-ES/template-plan.mdx +3 -3
- package/docs/content/locales/fr-FR/actions.mdx +1 -1
- package/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/docs/content/locales/fr-FR/dispatch.mdx +3 -3
- package/docs/content/locales/fr-FR/external-agents.mdx +23 -19
- package/docs/content/locales/fr-FR/mcp-clients.mdx +17 -3
- package/docs/content/locales/fr-FR/mcp-protocol.mdx +29 -15
- package/docs/content/locales/fr-FR/plan-plugin.mdx +3 -3
- package/docs/content/locales/fr-FR/server.mdx +2 -2
- package/docs/content/locales/fr-FR/skills-guide.mdx +1 -1
- package/docs/content/locales/fr-FR/template-assets.mdx +1 -1
- package/docs/content/locales/fr-FR/template-dispatch.mdx +2 -2
- package/docs/content/locales/fr-FR/template-plan.mdx +3 -3
- package/docs/content/locales/hi-IN/actions.mdx +1 -1
- package/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/docs/content/locales/hi-IN/dispatch.mdx +3 -3
- package/docs/content/locales/hi-IN/external-agents.mdx +31 -19
- package/docs/content/locales/hi-IN/mcp-clients.mdx +17 -3
- package/docs/content/locales/hi-IN/mcp-protocol.mdx +36 -15
- package/docs/content/locales/hi-IN/plan-plugin.mdx +3 -3
- package/docs/content/locales/hi-IN/server.mdx +2 -2
- package/docs/content/locales/hi-IN/skills-guide.mdx +1 -1
- package/docs/content/locales/hi-IN/template-assets.mdx +1 -1
- package/docs/content/locales/hi-IN/template-dispatch.mdx +2 -2
- package/docs/content/locales/hi-IN/template-plan.mdx +3 -3
- package/docs/content/locales/ja-JP/actions.mdx +1 -1
- package/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/docs/content/locales/ja-JP/dispatch.mdx +3 -3
- package/docs/content/locales/ja-JP/external-agents.mdx +23 -19
- package/docs/content/locales/ja-JP/mcp-clients.mdx +34 -3
- package/docs/content/locales/ja-JP/mcp-protocol.mdx +29 -15
- package/docs/content/locales/ja-JP/plan-plugin.mdx +3 -3
- package/docs/content/locales/ja-JP/server.mdx +2 -2
- package/docs/content/locales/ja-JP/skills-guide.mdx +1 -1
- package/docs/content/locales/ja-JP/template-assets.mdx +1 -1
- package/docs/content/locales/ja-JP/template-dispatch.mdx +2 -2
- package/docs/content/locales/ja-JP/template-plan.mdx +3 -3
- package/docs/content/locales/ko-KR/actions.mdx +1 -1
- package/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/docs/content/locales/ko-KR/dispatch.mdx +3 -3
- package/docs/content/locales/ko-KR/external-agents.mdx +30 -19
- package/docs/content/locales/ko-KR/mcp-clients.mdx +33 -3
- package/docs/content/locales/ko-KR/mcp-protocol.mdx +36 -15
- package/docs/content/locales/ko-KR/plan-plugin.mdx +3 -3
- package/docs/content/locales/ko-KR/server.mdx +2 -2
- package/docs/content/locales/ko-KR/skills-guide.mdx +1 -1
- package/docs/content/locales/ko-KR/template-assets.mdx +1 -1
- package/docs/content/locales/ko-KR/template-dispatch.mdx +2 -2
- package/docs/content/locales/ko-KR/template-plan.mdx +3 -3
- package/docs/content/locales/pt-BR/actions.mdx +1 -1
- package/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/docs/content/locales/pt-BR/dispatch.mdx +3 -3
- package/docs/content/locales/pt-BR/external-agents.mdx +32 -19
- package/docs/content/locales/pt-BR/mcp-clients.mdx +34 -3
- package/docs/content/locales/pt-BR/mcp-protocol.mdx +32 -15
- package/docs/content/locales/pt-BR/plan-plugin.mdx +3 -3
- package/docs/content/locales/pt-BR/server.mdx +2 -2
- package/docs/content/locales/pt-BR/skills-guide.mdx +1 -1
- package/docs/content/locales/pt-BR/template-assets.mdx +1 -1
- package/docs/content/locales/pt-BR/template-dispatch.mdx +2 -2
- package/docs/content/locales/pt-BR/template-plan.mdx +3 -3
- package/docs/content/locales/zh-CN/actions.mdx +1 -1
- package/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/docs/content/locales/zh-CN/dispatch.mdx +3 -3
- package/docs/content/locales/zh-CN/external-agents.mdx +23 -19
- package/docs/content/locales/zh-CN/mcp-clients.mdx +28 -3
- package/docs/content/locales/zh-CN/mcp-protocol.mdx +29 -15
- package/docs/content/locales/zh-CN/plan-plugin.mdx +3 -3
- package/docs/content/locales/zh-CN/server.mdx +2 -2
- package/docs/content/locales/zh-CN/skills-guide.mdx +1 -1
- package/docs/content/locales/zh-CN/template-assets.mdx +1 -1
- package/docs/content/locales/zh-CN/template-dispatch.mdx +2 -2
- package/docs/content/locales/zh-CN/template-plan.mdx +3 -3
- package/docs/content/locales/zh-TW/actions.mdx +1 -1
- package/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/docs/content/locales/zh-TW/dispatch.mdx +3 -3
- package/docs/content/locales/zh-TW/external-agents.mdx +23 -19
- package/docs/content/locales/zh-TW/mcp-clients.mdx +28 -3
- package/docs/content/locales/zh-TW/mcp-protocol.mdx +30 -15
- package/docs/content/locales/zh-TW/plan-plugin.mdx +3 -3
- package/docs/content/locales/zh-TW/server.mdx +2 -2
- package/docs/content/locales/zh-TW/skills-guide.mdx +1 -1
- package/docs/content/locales/zh-TW/template-assets.mdx +1 -1
- package/docs/content/locales/zh-TW/template-dispatch.mdx +2 -2
- package/docs/content/locales/zh-TW/template-plan.mdx +3 -3
- package/docs/content/mcp-clients.mdx +31 -4
- package/docs/content/mcp-protocol.mdx +35 -15
- package/docs/content/plan-plugin.mdx +3 -3
- package/docs/content/server.mdx +2 -2
- package/docs/content/skills-guide.mdx +1 -1
- package/docs/content/template-assets.mdx +1 -1
- package/docs/content/template-dispatch.mdx +2 -2
- package/docs/content/template-plan.mdx +3 -3
- package/package.json +2 -2
- package/src/templates/default/.agents/skills/security/SKILL.md +10 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +15 -6
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +16 -10
- package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +20 -1
- package/src/templates/workspace-core/.agents/skills/security/SKILL.md +10 -0
|
@@ -88,14 +88,23 @@ const ASK_APP_TERMINAL_STATES = new Set<string>([
|
|
|
88
88
|
"completed",
|
|
89
89
|
"failed",
|
|
90
90
|
"canceled",
|
|
91
|
+
"input-required",
|
|
91
92
|
]);
|
|
92
93
|
|
|
94
|
+
class AskAppInlineDeadlineError extends Error {
|
|
95
|
+
constructor() {
|
|
96
|
+
super("ask_app inline wait deadline reached");
|
|
97
|
+
this.name = "AskAppInlineDeadlineError";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
type AskAppRequestMeta = { origin?: string; basePath?: string };
|
|
94
102
|
|
|
95
103
|
interface AskAppRoute {
|
|
96
104
|
app: string;
|
|
97
105
|
origin: string;
|
|
98
106
|
routedVia: "local" | "a2a";
|
|
107
|
+
requestOrigin?: string;
|
|
99
108
|
note?: string;
|
|
100
109
|
}
|
|
101
110
|
|
|
@@ -106,7 +115,9 @@ interface AskAppTaskResult {
|
|
|
106
115
|
status: string;
|
|
107
116
|
response?: string;
|
|
108
117
|
error?: string;
|
|
118
|
+
inputRequired?: string;
|
|
109
119
|
note?: string;
|
|
120
|
+
pollAfterMs?: number;
|
|
110
121
|
poll?: {
|
|
111
122
|
tool: "ask_app_status";
|
|
112
123
|
arguments: { app: string; taskId: string };
|
|
@@ -236,8 +247,20 @@ function askAppTaskResult(route: AskAppRoute, task: Task): AskAppTaskResult {
|
|
|
236
247
|
};
|
|
237
248
|
}
|
|
238
249
|
|
|
250
|
+
if (status === "input-required") {
|
|
251
|
+
const inputRequired =
|
|
252
|
+
response || "The agent needs additional input before it can continue.";
|
|
253
|
+
return {
|
|
254
|
+
...base,
|
|
255
|
+
response: inputRequired,
|
|
256
|
+
inputRequired,
|
|
257
|
+
message: inputRequired,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
239
261
|
return {
|
|
240
262
|
...base,
|
|
263
|
+
pollAfterMs: ASK_APP_POLL_INTERVAL_MS,
|
|
241
264
|
poll: {
|
|
242
265
|
tool: "ask_app_status",
|
|
243
266
|
arguments: { app: route.app, taskId: task.id },
|
|
@@ -248,7 +271,57 @@ function askAppTaskResult(route: AskAppRoute, task: Task): AskAppTaskResult {
|
|
|
248
271
|
};
|
|
249
272
|
}
|
|
250
273
|
|
|
251
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Same shape as `askAppTaskResult`, but built from an in-process
|
|
276
|
+
* `ask-app-inline-tasks.ts` snapshot instead of an A2A `Task` — used by the
|
|
277
|
+
* no-origin fallback (no A2A task exists to describe). Kept field-for-field
|
|
278
|
+
* identical so `ask_app` / `ask_app_status` callers can't tell which backing
|
|
279
|
+
* store answered.
|
|
280
|
+
*/
|
|
281
|
+
function askAppInlineTaskResult(
|
|
282
|
+
selfId: string,
|
|
283
|
+
taskId: string,
|
|
284
|
+
inline: {
|
|
285
|
+
status: "working" | "completed" | "failed";
|
|
286
|
+
response?: string;
|
|
287
|
+
error?: string;
|
|
288
|
+
},
|
|
289
|
+
note?: string,
|
|
290
|
+
): AskAppTaskResult {
|
|
291
|
+
const base = {
|
|
292
|
+
app: selfId,
|
|
293
|
+
routedVia: "local" as const,
|
|
294
|
+
taskId,
|
|
295
|
+
status: inline.status,
|
|
296
|
+
...(note ? { note } : {}),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
if (inline.status === "completed") {
|
|
300
|
+
return { ...base, response: inline.response || "(no response)" };
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (inline.status === "failed") {
|
|
304
|
+
return { ...base, error: inline.error || "ask_app task failed." };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
...base,
|
|
309
|
+
pollAfterMs: ASK_APP_POLL_INTERVAL_MS,
|
|
310
|
+
poll: {
|
|
311
|
+
tool: "ask_app_status",
|
|
312
|
+
arguments: { app: selfId, taskId },
|
|
313
|
+
},
|
|
314
|
+
message:
|
|
315
|
+
`ask_app is still ${inline.status}. Call ask_app_status with ` +
|
|
316
|
+
`taskId "${taskId}" to retrieve the final response.`,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async function createA2AClientForAskApp(
|
|
321
|
+
origin: string,
|
|
322
|
+
requestOrigin?: string,
|
|
323
|
+
deadline?: number,
|
|
324
|
+
): Promise<{
|
|
252
325
|
client: import("../a2a/client.js").A2AClient;
|
|
253
326
|
metadata: Record<string, unknown>;
|
|
254
327
|
}> {
|
|
@@ -258,9 +331,14 @@ async function createA2AClientForAskApp(origin: string): Promise<{
|
|
|
258
331
|
const metadata: Record<string, unknown> = {};
|
|
259
332
|
if (auth.userEmail) metadata.userEmail = auth.userEmail;
|
|
260
333
|
if (auth.orgDomain) metadata.orgDomain = auth.orgDomain;
|
|
334
|
+
if (requestOrigin) metadata.requestOrigin = requestOrigin;
|
|
335
|
+
const remainingMs = deadline == null ? null : deadline - Date.now();
|
|
261
336
|
return {
|
|
262
337
|
client: new A2AClient(origin, auth.apiKey, {
|
|
263
|
-
requestTimeoutMs:
|
|
338
|
+
requestTimeoutMs:
|
|
339
|
+
remainingMs == null
|
|
340
|
+
? ASK_APP_A2A_REQUEST_TIMEOUT_MS
|
|
341
|
+
: Math.max(1, Math.min(ASK_APP_A2A_REQUEST_TIMEOUT_MS, remainingMs)),
|
|
264
342
|
...(auth.apiKeyFallbacks
|
|
265
343
|
? { fallbackApiKeys: auth.apiKeyFallbacks }
|
|
266
344
|
: {}),
|
|
@@ -269,13 +347,35 @@ async function createA2AClientForAskApp(origin: string): Promise<{
|
|
|
269
347
|
};
|
|
270
348
|
}
|
|
271
349
|
|
|
350
|
+
async function runBeforeAskAppDeadline<T>(
|
|
351
|
+
operation: () => Promise<T>,
|
|
352
|
+
deadline: number,
|
|
353
|
+
): Promise<T> {
|
|
354
|
+
const remainingMs = deadline - Date.now();
|
|
355
|
+
if (remainingMs <= 0) throw new AskAppInlineDeadlineError();
|
|
356
|
+
|
|
357
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
358
|
+
try {
|
|
359
|
+
return await Promise.race([
|
|
360
|
+
operation(),
|
|
361
|
+
new Promise<T>((_resolve, reject) => {
|
|
362
|
+
timeout = setTimeout(
|
|
363
|
+
() => reject(new AskAppInlineDeadlineError()),
|
|
364
|
+
remainingMs,
|
|
365
|
+
);
|
|
366
|
+
}),
|
|
367
|
+
]);
|
|
368
|
+
} finally {
|
|
369
|
+
if (timeout) clearTimeout(timeout);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
272
373
|
async function waitForA2ATask(
|
|
273
374
|
client: import("../a2a/client.js").A2AClient,
|
|
274
375
|
initialTask: Task,
|
|
275
|
-
|
|
376
|
+
deadline: number | undefined,
|
|
276
377
|
): Promise<Task> {
|
|
277
|
-
if (
|
|
278
|
-
const deadline = Date.now() + maxWaitMs;
|
|
378
|
+
if (deadline == null || isTerminalTask(initialTask)) return initialTask;
|
|
279
379
|
let current = initialTask;
|
|
280
380
|
|
|
281
381
|
while (!isTerminalTask(current)) {
|
|
@@ -284,13 +384,16 @@ async function waitForA2ATask(
|
|
|
284
384
|
await new Promise((resolve) =>
|
|
285
385
|
setTimeout(resolve, Math.min(ASK_APP_POLL_INTERVAL_MS, remaining)),
|
|
286
386
|
);
|
|
387
|
+
if (Date.now() >= deadline) return current;
|
|
287
388
|
try {
|
|
288
|
-
current = await
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
389
|
+
current = await runBeforeAskAppDeadline(
|
|
390
|
+
() => client.getTask(initialTask.id),
|
|
391
|
+
deadline,
|
|
392
|
+
);
|
|
393
|
+
} catch (err) {
|
|
394
|
+
if (err instanceof AskAppInlineDeadlineError) return current;
|
|
395
|
+
if (!isTransientAskAppStatusError(err)) throw err;
|
|
292
396
|
if (Date.now() >= deadline) return current;
|
|
293
|
-
continue;
|
|
294
397
|
}
|
|
295
398
|
}
|
|
296
399
|
|
|
@@ -302,7 +405,12 @@ async function submitAskAppA2ATask(
|
|
|
302
405
|
message: string,
|
|
303
406
|
maxWaitMs: number,
|
|
304
407
|
): Promise<AskAppTaskResult> {
|
|
305
|
-
const
|
|
408
|
+
const deadline = maxWaitMs > 0 ? Date.now() + maxWaitMs : undefined;
|
|
409
|
+
const { client, metadata } = await createA2AClientForAskApp(
|
|
410
|
+
route.origin,
|
|
411
|
+
route.requestOrigin,
|
|
412
|
+
deadline,
|
|
413
|
+
);
|
|
306
414
|
const task = await client.send(
|
|
307
415
|
{
|
|
308
416
|
role: "user",
|
|
@@ -313,7 +421,7 @@ async function submitAskAppA2ATask(
|
|
|
313
421
|
metadata,
|
|
314
422
|
},
|
|
315
423
|
);
|
|
316
|
-
const finalOrRunning = await waitForA2ATask(client, task,
|
|
424
|
+
const finalOrRunning = await waitForA2ATask(client, task, deadline);
|
|
317
425
|
return askAppTaskResult(route, finalOrRunning);
|
|
318
426
|
}
|
|
319
427
|
|
|
@@ -778,13 +886,22 @@ async function routeAskOverA2A(
|
|
|
778
886
|
origin: string,
|
|
779
887
|
id: string,
|
|
780
888
|
message: string,
|
|
781
|
-
options?: {
|
|
889
|
+
options?: {
|
|
890
|
+
durable?: boolean;
|
|
891
|
+
maxWaitMs?: number;
|
|
892
|
+
requestOrigin?: string;
|
|
893
|
+
},
|
|
782
894
|
): Promise<
|
|
783
895
|
{ app: string; routedVia: "a2a"; response: string } | AskAppTaskResult
|
|
784
896
|
> {
|
|
785
897
|
if (options?.durable) {
|
|
786
898
|
return submitAskAppA2ATask(
|
|
787
|
-
{
|
|
899
|
+
{
|
|
900
|
+
app: id,
|
|
901
|
+
origin: agentNativeA2AEndpoint(origin),
|
|
902
|
+
routedVia: "a2a",
|
|
903
|
+
requestOrigin: options.requestOrigin ?? origin,
|
|
904
|
+
},
|
|
788
905
|
message,
|
|
789
906
|
options.maxWaitMs ?? ASK_APP_DEFAULT_INLINE_WAIT_MS,
|
|
790
907
|
);
|
|
@@ -801,6 +918,7 @@ async function routeAskOverA2A(
|
|
|
801
918
|
userEmail: auth.userEmail,
|
|
802
919
|
orgDomain: auth.orgDomain,
|
|
803
920
|
orgSecret: auth.orgSecret,
|
|
921
|
+
requestOrigin: options?.requestOrigin,
|
|
804
922
|
// Bound the wait — cross-app A2A polls async by default.
|
|
805
923
|
timeoutMs: 5 * 60_000,
|
|
806
924
|
});
|
|
@@ -822,7 +940,12 @@ async function resolveAskAppStatusRoute(
|
|
|
822
940
|
"ask_app_status requires a running app origin for local tasks.",
|
|
823
941
|
);
|
|
824
942
|
}
|
|
825
|
-
return {
|
|
943
|
+
return {
|
|
944
|
+
app: selfId,
|
|
945
|
+
origin: selfEndpointUrl,
|
|
946
|
+
routedVia: "local",
|
|
947
|
+
requestOrigin: requestMeta?.origin,
|
|
948
|
+
};
|
|
826
949
|
}
|
|
827
950
|
|
|
828
951
|
const targetApp = await resolveTargetAppOrigin(config, requestedApp);
|
|
@@ -831,6 +954,7 @@ async function resolveAskAppStatusRoute(
|
|
|
831
954
|
app: targetApp.id,
|
|
832
955
|
origin: agentNativeA2AEndpoint(targetApp.origin),
|
|
833
956
|
routedVia: "a2a",
|
|
957
|
+
requestOrigin: targetApp.origin,
|
|
834
958
|
};
|
|
835
959
|
}
|
|
836
960
|
|
|
@@ -841,6 +965,7 @@ async function resolveAskAppStatusRoute(
|
|
|
841
965
|
app: dirMatch.id,
|
|
842
966
|
origin: agentNativeA2AEndpoint(dirMatch.a2aUrl),
|
|
843
967
|
routedVia: "a2a",
|
|
968
|
+
requestOrigin: dirMatch.url,
|
|
844
969
|
};
|
|
845
970
|
}
|
|
846
971
|
|
|
@@ -914,6 +1039,7 @@ function askAppTool(
|
|
|
914
1039
|
{
|
|
915
1040
|
durable: useDurableA2A,
|
|
916
1041
|
maxWaitMs,
|
|
1042
|
+
requestOrigin: targetApp.origin,
|
|
917
1043
|
},
|
|
918
1044
|
);
|
|
919
1045
|
} catch (err: any) {
|
|
@@ -947,6 +1073,7 @@ function askAppTool(
|
|
|
947
1073
|
{
|
|
948
1074
|
durable: useDurableA2A,
|
|
949
1075
|
maxWaitMs,
|
|
1076
|
+
requestOrigin: dirMatch.url,
|
|
950
1077
|
},
|
|
951
1078
|
);
|
|
952
1079
|
} catch (err: any) {
|
|
@@ -988,6 +1115,7 @@ function askAppTool(
|
|
|
988
1115
|
app: selfId,
|
|
989
1116
|
origin: localA2AEndpointUrl,
|
|
990
1117
|
routedVia: "local",
|
|
1118
|
+
requestOrigin: requestMeta?.origin,
|
|
991
1119
|
...(note ? { note } : {}),
|
|
992
1120
|
},
|
|
993
1121
|
message,
|
|
@@ -995,13 +1123,35 @@ function askAppTool(
|
|
|
995
1123
|
);
|
|
996
1124
|
}
|
|
997
1125
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1126
|
+
// No derivable app origin at all (e.g. stdio / no request context) —
|
|
1127
|
+
// there is no `/_agent-native/a2a` endpoint to submit a durable task
|
|
1128
|
+
// to either. Bound the wait against a process-local task map instead
|
|
1129
|
+
// of awaiting config.askAgent() unbounded, so a slow agent run can't
|
|
1130
|
+
// hold this MCP call open indefinitely. Settling in time keeps the
|
|
1131
|
+
// original response shape; timing out returns the same still-working
|
|
1132
|
+
// poll payload the A2A path would, using the same taskId contract
|
|
1133
|
+
// (see ask-app-inline-tasks.ts).
|
|
1134
|
+
const { startAskAppInlineTask } =
|
|
1135
|
+
await import("./ask-app-inline-tasks.js");
|
|
1136
|
+
const inline = await startAskAppInlineTask(
|
|
1137
|
+
config.askAgent,
|
|
1138
|
+
message,
|
|
1139
|
+
maxWaitMs,
|
|
1140
|
+
);
|
|
1141
|
+
if (inline.status === "completed") {
|
|
1142
|
+
return {
|
|
1143
|
+
app: selfId,
|
|
1144
|
+
routedVia: "local",
|
|
1145
|
+
...(note ? { note } : {}),
|
|
1146
|
+
response: inline.response || "(no response)",
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
if (inline.status === "failed") {
|
|
1150
|
+
// Settled with an error inside the bounded wait — surface it the
|
|
1151
|
+
// same way the old unbounded `await config.askAgent(message)` did.
|
|
1152
|
+
throw new Error(inline.error || "ask_app task failed.");
|
|
1153
|
+
}
|
|
1154
|
+
return askAppInlineTaskResult(selfId, inline.taskId, inline, note);
|
|
1005
1155
|
},
|
|
1006
1156
|
};
|
|
1007
1157
|
}
|
|
@@ -1031,6 +1181,20 @@ function askAppStatusTool(
|
|
|
1031
1181
|
run: async (args: Record<string, any>) => {
|
|
1032
1182
|
const taskId = String(args.taskId ?? "").trim();
|
|
1033
1183
|
if (!taskId) throw new Error("ask_app_status requires 'taskId'.");
|
|
1184
|
+
|
|
1185
|
+
// The no-derivable-origin ask_app fallback tracks its tasks in a
|
|
1186
|
+
// process-local map, not the durable A2A store. Check it FIRST —
|
|
1187
|
+
// before any origin requirement — so a taskId minted by that fallback
|
|
1188
|
+
// never has to satisfy `resolveAskAppStatusRoute`'s "running app
|
|
1189
|
+
// origin" check. Falls through to the normal A2A route when the id
|
|
1190
|
+
// isn't one of these (never started here, evicted, or an ordinary A2A
|
|
1191
|
+
// task id).
|
|
1192
|
+
const { getAskAppInlineTask } = await import("./ask-app-inline-tasks.js");
|
|
1193
|
+
const inline = getAskAppInlineTask(taskId);
|
|
1194
|
+
if (inline) {
|
|
1195
|
+
return askAppInlineTaskResult(currentAppId(config), taskId, inline);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1034
1198
|
const requestedApp = String(args.app ?? "").trim();
|
|
1035
1199
|
const route = await resolveAskAppStatusRoute(
|
|
1036
1200
|
config,
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/
|
|
2
|
+
* `/mcp/connect` — frictionless external-agent connection. The legacy
|
|
3
|
+
* `/_agent-native/mcp/connect` alias is mounted by the core route plugin.
|
|
3
4
|
*
|
|
4
5
|
* A logged-in user on a deployed agent-native app (e.g. mail.agent-native.com)
|
|
5
6
|
* mints a per-user, scoped, revocable MCP bearer token WITHOUT ever copying a
|
|
6
7
|
* shared deployment secret. Two surfaces:
|
|
7
8
|
*
|
|
8
|
-
* 1. Browser — `GET /connect` renders a minimal in-app page (same inline
|
|
9
|
+
* 1. Browser — `GET /mcp/connect` renders a minimal in-app page (same inline
|
|
9
10
|
* HTML approach as the auth pages). The Authorize button POSTs to
|
|
10
11
|
* `/connect/token`, then shows the ready-to-paste `.mcp.json` entry, the
|
|
11
12
|
* `agent-native connect <origin>` one-liner, and the user's existing
|
|
12
13
|
* tokens with Revoke buttons.
|
|
13
14
|
* 2. CLI — an OAuth-2.0-device-authorization-style flow:
|
|
14
|
-
* POST /connect/device/start (unauth) → device_code + user_code
|
|
15
|
-
* GET /connect?user_code=… (browser) → user signs in & approves
|
|
16
|
-
* POST /connect/device/authorize (session) → binds user to the code
|
|
17
|
-
* POST /connect/device/poll (unauth) → mints + returns the token
|
|
15
|
+
* POST /mcp/connect/device/start (unauth) → device_code + user_code
|
|
16
|
+
* GET /mcp/connect?user_code=… (browser) → user signs in & approves
|
|
17
|
+
* POST /mcp/connect/device/authorize (session) → binds user to the code
|
|
18
|
+
* POST /mcp/connect/device/poll (unauth) → mints + returns the token
|
|
18
19
|
*
|
|
19
20
|
* When A2A_SECRET exists, the minted token reuses the existing A2A signer
|
|
20
21
|
* (`signA2AToken`) and adds a random `jti` + `scope: "mcp-connect"` claim so
|
|
@@ -64,6 +65,7 @@ import {
|
|
|
64
65
|
MCP_OAUTH_DEFAULT_SCOPE,
|
|
65
66
|
signMcpOAuthAccessToken,
|
|
66
67
|
} from "./oauth-token.js";
|
|
68
|
+
import { MCP_PUBLIC_ROUTE_PREFIX } from "./route-paths.js";
|
|
67
69
|
|
|
68
70
|
/** Device-flow poll interval hint (seconds). */
|
|
69
71
|
const DEVICE_POLL_INTERVAL_S = 3;
|
|
@@ -383,7 +385,7 @@ function mcpResultPayload(
|
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
function mcpResourceUrl(appUrl: string): string {
|
|
386
|
-
return `${appUrl}
|
|
388
|
+
return `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
387
389
|
}
|
|
388
390
|
|
|
389
391
|
// ---------------------------------------------------------------------------
|
|
@@ -415,7 +417,7 @@ function renderConnectPage(params: {
|
|
|
415
417
|
params;
|
|
416
418
|
const safeEmail = escapeHtml(email);
|
|
417
419
|
const safeApp = escapeHtml(appName);
|
|
418
|
-
const mcpUrl = `${appUrl}
|
|
420
|
+
const mcpUrl = `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
419
421
|
const safeMcpUrl = escapeHtml(mcpUrl);
|
|
420
422
|
const safeServerId = escapeHtml(serverId);
|
|
421
423
|
const safeClaudeCodeCmd = escapeHtml(
|
|
@@ -948,7 +950,7 @@ function renderConnectPage(params: {
|
|
|
948
950
|
</div>
|
|
949
951
|
<script>
|
|
950
952
|
(function () {
|
|
951
|
-
var BASE = ${JSON.stringify(joinAppPath(connectBasePath, "/
|
|
953
|
+
var BASE = ${JSON.stringify(joinAppPath(connectBasePath, MCP_PUBLIC_ROUTE_PREFIX + "/connect"))};
|
|
952
954
|
var USER_CODE = ${JSON.stringify(safeUserCode || null)};
|
|
953
955
|
var msgEl = document.getElementById("msg");
|
|
954
956
|
var connectionsEl = document.getElementById("connections");
|
|
@@ -1182,10 +1184,11 @@ function renderConnectPage(params: {
|
|
|
1182
1184
|
// ---------------------------------------------------------------------------
|
|
1183
1185
|
|
|
1184
1186
|
/**
|
|
1185
|
-
* Handle a `/
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1187
|
+
* Handle a `/mcp/connect[...]` request. The legacy
|
|
1188
|
+
* `/_agent-native/mcp/connect` alias is mounted too. `subpath` is the part
|
|
1189
|
+
* after `/connect` (empty string = the page itself, otherwise e.g. `/token`,
|
|
1190
|
+
* `/device/start`). The core-routes-plugin computes it from the stripped event
|
|
1191
|
+
* path so this module stays mount-agnostic.
|
|
1189
1192
|
*/
|
|
1190
1193
|
export async function handleMcpConnect(
|
|
1191
1194
|
event: H3Event,
|
|
@@ -1291,7 +1294,7 @@ export async function handleMcpConnect(
|
|
|
1291
1294
|
if (method !== "POST") return json({ error: "Method not allowed" }, 405);
|
|
1292
1295
|
try {
|
|
1293
1296
|
const row = await createDeviceCode();
|
|
1294
|
-
const verificationUri = `${appUrl}/
|
|
1297
|
+
const verificationUri = `${appUrl}${MCP_PUBLIC_ROUTE_PREFIX}/connect`;
|
|
1295
1298
|
return json({
|
|
1296
1299
|
device_code: row.deviceCode,
|
|
1297
1300
|
user_code: row.userCode,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These routes let MCP hosts such as Claude Code and ChatGPT authenticate
|
|
5
5
|
* through their native remote-MCP OAuth flow instead of pasting bearer tokens.
|
|
6
|
-
* The issued access tokens are audience-bound to `/
|
|
6
|
+
* The issued access tokens are audience-bound to `/mcp`, carry
|
|
7
7
|
* the same user/org identity as the existing connect flow, and are mediated by
|
|
8
8
|
* `verifyAuth` before any MCP tool/resource request runs.
|
|
9
9
|
*/
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
normalizeOAuthScope,
|
|
36
36
|
signMcpOAuthAccessToken,
|
|
37
37
|
} from "./oauth-token.js";
|
|
38
|
+
import { MCP_PUBLIC_ROUTE_PREFIX, MCP_ROUTE_PREFIXES } from "./route-paths.js";
|
|
38
39
|
|
|
39
40
|
export interface McpOAuthRouteOptions {
|
|
40
41
|
appId?: string;
|
|
@@ -172,7 +173,16 @@ export function getMcpOAuthIssuer(event: H3Event): string | undefined {
|
|
|
172
173
|
export function getMcpOAuthResource(event: H3Event): string | undefined {
|
|
173
174
|
const issuer = getMcpOAuthIssuer(event);
|
|
174
175
|
if (!issuer) return undefined;
|
|
175
|
-
return `${issuer}
|
|
176
|
+
return `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function mcpResourcesForIssuer(issuer: string): string[] {
|
|
180
|
+
return [
|
|
181
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
182
|
+
...MCP_ROUTE_PREFIXES.filter(
|
|
183
|
+
(prefix) => prefix !== MCP_PUBLIC_ROUTE_PREFIX,
|
|
184
|
+
),
|
|
185
|
+
].map((prefix) => `${issuer}${prefix}`);
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
/**
|
|
@@ -185,18 +195,21 @@ export function getMcpOAuthResource(event: H3Event): string | undefined {
|
|
|
185
195
|
* accepts either without issuing a 401.
|
|
186
196
|
*/
|
|
187
197
|
export function getMcpOAuthAudiences(event: H3Event): string[] {
|
|
188
|
-
const
|
|
189
|
-
const configured = (() => {
|
|
198
|
+
const configuredIssuer = (() => {
|
|
190
199
|
const base = configuredPublicBaseUrl();
|
|
191
200
|
if (!base) return undefined;
|
|
192
201
|
// Re-apply base path if present so the configured resource is also
|
|
193
202
|
// base-path-aware, consistent with how getMcpOAuthResource computes it.
|
|
194
|
-
|
|
195
|
-
return `${withPath}/_agent-native/mcp`;
|
|
203
|
+
return appendConfiguredBasePath(base);
|
|
196
204
|
})();
|
|
197
205
|
const seen = new Set<string>();
|
|
198
206
|
const out: string[] = [];
|
|
199
|
-
for (const r of [
|
|
207
|
+
for (const r of [
|
|
208
|
+
...(getMcpOAuthIssuer(event)
|
|
209
|
+
? mcpResourcesForIssuer(getMcpOAuthIssuer(event) as string)
|
|
210
|
+
: []),
|
|
211
|
+
...(configuredIssuer ? mcpResourcesForIssuer(configuredIssuer) : []),
|
|
212
|
+
]) {
|
|
200
213
|
const n = r?.replace(/\/+$/, "");
|
|
201
214
|
if (n && !seen.has(n)) {
|
|
202
215
|
seen.add(n);
|
|
@@ -224,17 +237,21 @@ export function buildMcpOAuthChallenge(event: H3Event): string {
|
|
|
224
237
|
|
|
225
238
|
function authorizationEndpoint(event: H3Event): string | undefined {
|
|
226
239
|
const issuer = getMcpOAuthIssuer(event);
|
|
227
|
-
return issuer
|
|
240
|
+
return issuer
|
|
241
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/authorize`
|
|
242
|
+
: undefined;
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
function tokenEndpoint(event: H3Event): string | undefined {
|
|
231
246
|
const issuer = getMcpOAuthIssuer(event);
|
|
232
|
-
return issuer ? `${issuer}/
|
|
247
|
+
return issuer ? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/token` : undefined;
|
|
233
248
|
}
|
|
234
249
|
|
|
235
250
|
function registrationEndpoint(event: H3Event): string | undefined {
|
|
236
251
|
const issuer = getMcpOAuthIssuer(event);
|
|
237
|
-
return issuer
|
|
252
|
+
return issuer
|
|
253
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/register`
|
|
254
|
+
: undefined;
|
|
238
255
|
}
|
|
239
256
|
|
|
240
257
|
export function handleMcpOAuthProtectedResourceMetadata(
|
|
@@ -707,8 +724,11 @@ async function handleAuthorize(
|
|
|
707
724
|
const state = params.state;
|
|
708
725
|
const clientId = params.client_id;
|
|
709
726
|
const redirectUri = params.redirect_uri;
|
|
710
|
-
const resource = params.resource || getMcpOAuthResource(event)
|
|
711
|
-
|
|
727
|
+
const resource = (params.resource || getMcpOAuthResource(event))?.replace(
|
|
728
|
+
/\/+$/,
|
|
729
|
+
"",
|
|
730
|
+
);
|
|
731
|
+
const expectedResources = getMcpOAuthAudiences(event);
|
|
712
732
|
|
|
713
733
|
if (params.response_type !== "code") {
|
|
714
734
|
return oauthError(
|
|
@@ -716,7 +736,12 @@ async function handleAuthorize(
|
|
|
716
736
|
"response_type must be code",
|
|
717
737
|
);
|
|
718
738
|
}
|
|
719
|
-
if (
|
|
739
|
+
if (
|
|
740
|
+
!clientId ||
|
|
741
|
+
!redirectUri ||
|
|
742
|
+
!resource ||
|
|
743
|
+
!expectedResources.includes(resource)
|
|
744
|
+
) {
|
|
720
745
|
return oauthError("invalid_request", "Invalid OAuth authorization request");
|
|
721
746
|
}
|
|
722
747
|
if (params.code_challenge_method !== "S256" || !params.code_challenge) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP's public protocol path and the framework path kept for compatibility.
|
|
3
|
+
*
|
|
4
|
+
* Only the protocol and its OAuth/connect companions use the public alias.
|
|
5
|
+
* Other framework-owned MCP management routes remain under `/_agent-native`.
|
|
6
|
+
*/
|
|
7
|
+
export const MCP_PUBLIC_ROUTE_PREFIX = "/mcp";
|
|
8
|
+
export const MCP_LEGACY_ROUTE_PREFIX = "/_agent-native/mcp";
|
|
9
|
+
|
|
10
|
+
export const MCP_ROUTE_PREFIXES = [
|
|
11
|
+
MCP_LEGACY_ROUTE_PREFIX,
|
|
12
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
export function joinMcpRoute(prefix: string, suffix: string): string {
|
|
16
|
+
const normalizedSuffix = suffix.startsWith("/") ? suffix : `/${suffix}`;
|
|
17
|
+
return `${prefix}${normalizedSuffix}` || normalizedSuffix;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isMcpPublicPath(pathname: string): boolean {
|
|
21
|
+
return (
|
|
22
|
+
pathname === MCP_PUBLIC_ROUTE_PREFIX ||
|
|
23
|
+
pathname.startsWith(`${MCP_PUBLIC_ROUTE_PREFIX}/`)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isMcpProtocolPath(pathname: string): boolean {
|
|
28
|
+
return (
|
|
29
|
+
pathname === MCP_PUBLIC_ROUTE_PREFIX ||
|
|
30
|
+
pathname === MCP_LEGACY_ROUTE_PREFIX ||
|
|
31
|
+
pathname === `${MCP_PUBLIC_ROUTE_PREFIX}/` ||
|
|
32
|
+
pathname === `${MCP_LEGACY_ROUTE_PREFIX}/`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -28,6 +28,11 @@ import {
|
|
|
28
28
|
getMcpOAuthProtectedResourceMetadataUrl,
|
|
29
29
|
getMcpOAuthResource,
|
|
30
30
|
} from "./oauth-route.js";
|
|
31
|
+
import {
|
|
32
|
+
MCP_PUBLIC_ROUTE_PREFIX,
|
|
33
|
+
MCP_ROUTE_PREFIXES,
|
|
34
|
+
joinMcpRoute,
|
|
35
|
+
} from "./route-paths.js";
|
|
31
36
|
|
|
32
37
|
// Re-export the shared MCP server builder + types so the stdio transport and
|
|
33
38
|
// any (future) external importer of `@agent-native/core/mcp` keep resolving
|
|
@@ -183,7 +188,7 @@ function buildWebRequest(event: H3Event, method: string): Request {
|
|
|
183
188
|
forwardedProto?.split(",")[0]?.trim() ||
|
|
184
189
|
(/^(localhost|127\.0\.0\.1)(:|$)/.test(host) ? "http" : "https");
|
|
185
190
|
const basePath = getConfiguredAppBasePath();
|
|
186
|
-
const url = `${proto}://${host}${basePath}
|
|
191
|
+
const url = `${proto}://${host}${basePath}${MCP_PUBLIC_ROUTE_PREFIX}`;
|
|
187
192
|
|
|
188
193
|
// No body here on purpose: the JSON-RPC payload is forwarded via the
|
|
189
194
|
// transport's `parsedBody` option (the same mechanism the Node transport
|
|
@@ -220,7 +225,7 @@ function buildUnauthorizedBody(event: H3Event): {
|
|
|
220
225
|
? `npx @agent-native/core@latest connect ${issuer}`
|
|
221
226
|
: undefined;
|
|
222
227
|
const authorizeUrl = issuer
|
|
223
|
-
? `${issuer}/
|
|
228
|
+
? `${issuer}${MCP_PUBLIC_ROUTE_PREFIX}/oauth/authorize`
|
|
224
229
|
: undefined;
|
|
225
230
|
const message = command
|
|
226
231
|
? `Authentication required. Run \`${command}\` to re-authenticate this ` +
|
|
@@ -454,7 +459,8 @@ export async function handleMcpRequest(
|
|
|
454
459
|
/**
|
|
455
460
|
* Mount an MCP remote server on an H3/Nitro app.
|
|
456
461
|
*
|
|
457
|
-
*
|
|
462
|
+
* Endpoints: `/mcp` (public) and `/_agent-native/mcp` (compatibility).
|
|
463
|
+
* A custom route prefix only mounts that custom endpoint.
|
|
458
464
|
*
|
|
459
465
|
* Uses stateless Streamable HTTP transport — no in-memory sessions, JSON
|
|
460
466
|
* request/response (no SSE), and no standalone GET stream, so it survives
|
|
@@ -473,15 +479,20 @@ export function mountMCP(
|
|
|
473
479
|
config: MCPConfig,
|
|
474
480
|
routePrefix = "/_agent-native",
|
|
475
481
|
): void {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
const routePaths =
|
|
483
|
+
routePrefix === "/_agent-native"
|
|
484
|
+
? [...MCP_ROUTE_PREFIXES]
|
|
485
|
+
: [joinMcpRoute(routePrefix, "/mcp")];
|
|
486
|
+
const handler = defineEventHandler(async (event) => {
|
|
487
|
+
return handleMcpRequest(event as H3Event, config);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
for (const routePath of routePaths) {
|
|
491
|
+
getH3App(nitroApp).use(routePath, handler);
|
|
492
|
+
}
|
|
482
493
|
|
|
483
494
|
if (process.env.DEBUG)
|
|
484
495
|
console.log(
|
|
485
|
-
`[mcp] Mounted MCP server at ${
|
|
496
|
+
`[mcp] Mounted MCP server at ${routePaths.join(" and ")} (${Object.keys(config.actions).length} tools${config.askAgent ? " + ask-agent" : ""})`,
|
|
486
497
|
);
|
|
487
498
|
}
|