@agent-native/core 0.100.2 → 0.101.2
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 +65 -0
- package/corpus/core/docs/content/locales/ar-SA/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/ar-SA/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/de-DE/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/de-DE/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/es-ES/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/es-ES/template-plan.mdx +14 -0
- package/corpus/core/docs/content/locales/fr-FR/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/fr-FR/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/hi-IN/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/hi-IN/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/ja-JP/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/ja-JP/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/ko-KR/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/ko-KR/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/pt-BR/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/pt-BR/template-plan.mdx +14 -0
- package/corpus/core/docs/content/locales/zh-CN/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/zh-CN/template-plan.mdx +7 -0
- package/corpus/core/docs/content/locales/zh-TW/pr-visual-recap.mdx +48 -30
- package/corpus/core/docs/content/locales/zh-TW/template-plan.mdx +7 -0
- package/corpus/core/docs/content/pr-visual-recap.mdx +50 -32
- package/corpus/core/docs/content/template-plan.mdx +14 -0
- package/corpus/core/docs/content/toolkit-comments-review.mdx +16 -2
- package/corpus/core/package.json +4 -1
- package/corpus/core/src/a2a/index.ts +2 -1
- package/corpus/core/src/a2a/server.ts +34 -9
- package/corpus/core/src/agent/production-agent.ts +56 -10
- package/corpus/core/src/cli/create.ts +47 -19
- package/corpus/core/src/cli/pr-visual-recap-workflow.ts +2 -3
- package/corpus/core/src/cli/recap.ts +3 -4932
- package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +6 -4
- package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +7 -1
- package/corpus/core/src/client/AgentPanel.tsx +19 -17
- package/corpus/core/src/client/analytics.ts +8 -1
- package/corpus/core/src/client/chat/markdown-renderer.tsx +54 -8
- package/corpus/core/src/client/chat/message-components.tsx +8 -2
- package/corpus/core/src/client/clipboard.ts +28 -1
- package/corpus/core/src/client/guided-questions.tsx +4 -0
- package/corpus/core/src/client/i18n.tsx +2 -1
- package/corpus/core/src/client/index.ts +4 -0
- package/corpus/core/src/client/review/ReviewCommentComposer.tsx +108 -0
- package/corpus/core/src/client/review/ReviewThreadPanel.tsx +482 -150
- package/corpus/core/src/client/review/index.ts +8 -0
- package/corpus/core/src/client/review/use-review.ts +35 -1
- package/corpus/core/src/client/use-agent-chat-context.ts +3 -2
- package/corpus/core/src/review/actions/create-review-comment.ts +2 -1
- package/corpus/core/src/review/actions/get-review-feedback.ts +6 -11
- package/corpus/core/src/review/actions/list-review-comments.ts +38 -4
- package/corpus/core/src/review/actions/reply-review-comment.ts +33 -22
- package/corpus/core/src/review/actions/resolve-review-thread.ts +29 -2
- package/corpus/core/src/review/actions/send-review-thread-to-agent.ts +62 -0
- package/corpus/core/src/review/identity.ts +101 -0
- package/corpus/core/src/review/index.ts +14 -0
- package/corpus/core/src/review/store.ts +315 -8
- package/corpus/core/src/review/types.ts +4 -0
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/action-routes.ts +125 -4
- package/corpus/core/src/server/agent-chat/plugin-options.ts +16 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +1 -0
- package/corpus/core/src/server/index.ts +8 -0
- package/corpus/core/src/vite/action-types-plugin.ts +4 -0
- package/corpus/templates/analytics/changelog/2026-07-14-daily-dashboard-email-captures-authenticate-with-a-sessi.md +6 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +156 -3
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +402 -142
- package/corpus/templates/assets/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/assets/app/i18n-data.ts +1 -0
- package/corpus/templates/assets/app/routes/library.tsx +187 -48
- package/corpus/templates/assets/changelog/2026-07-13-merged-the-candidates-panel-into-the-library-as-a-drafts-tab.md +6 -0
- package/corpus/templates/chat/app/lib/agent-page.tsx +40 -0
- package/corpus/templates/chat/app/routes/agent.tsx +5 -3
- package/corpus/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +5 -0
- package/corpus/templates/clips/AGENTS.md +4 -0
- package/corpus/templates/clips/actions/get-feature-flags.ts +30 -0
- package/corpus/templates/clips/actions/lib/transcript-preview.ts +48 -0
- package/corpus/templates/clips/actions/request-transcript.ts +41 -1
- package/corpus/templates/clips/actions/view-screen.ts +5 -9
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -1
- package/corpus/templates/clips/app/components/player/video-player.tsx +39 -1
- package/corpus/templates/clips/app/hooks/use-desktop-promo.ts +6 -12
- package/corpus/templates/clips/app/hooks/use-mse-video-source.ts +146 -0
- package/corpus/templates/clips/app/lib/capture-install-options.ts +21 -0
- package/corpus/templates/clips/app/lib/fmp4.ts +271 -0
- package/corpus/templates/clips/app/lib/mse-video-loader.ts +585 -0
- package/corpus/templates/clips/app/routes/_app.dictate.tsx +0 -4
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +5 -13
- package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +2 -37
- package/corpus/templates/clips/app/routes/download.tsx +3 -2
- package/corpus/templates/clips/changelog/2026-07-10-shared-clips-now-start-playing-instantly-instead-of-showing-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-14-clips-now-distinguishes-transcript-previews-from-incomplete-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-14-desktop-app-prompts-stay-hidden-after-you-download-the-insta.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +5 -0
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +10 -0
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +4 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +2518 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/live_upload.rs +353 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +558 -67
- package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +11 -1
- package/corpus/templates/clips/desktop/src-tauri/src/remote_flags.rs +188 -0
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +1 -1
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +1 -0
- package/corpus/templates/clips/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +5 -1
- package/corpus/templates/clips/shared/feature-flags.ts +41 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +3 -0
- package/corpus/templates/design/.agents/skills/design-review-feedback/SKILL.md +42 -0
- package/corpus/templates/design/AGENTS.md +6 -0
- package/corpus/templates/design/README.md +1 -0
- package/corpus/templates/design/actions/navigate.ts +4 -4
- package/corpus/templates/design/actions/view-screen.ts +116 -2
- package/corpus/templates/design/agent-native.app-skill.json +5 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +52 -59
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +13 -9
- package/corpus/templates/design/app/components/design/EditPanel.tsx +79 -11
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +78 -65
- package/corpus/templates/design/app/components/design/ReviewCommentsPanel.tsx +161 -0
- package/corpus/templates/design/app/components/design/ReviewStatusControl.tsx +96 -0
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +166 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +1077 -0
- package/corpus/templates/design/app/components/visual-editor/index.ts +1 -0
- package/corpus/templates/design/app/components/visual-editor/review-canvas-state.ts +42 -0
- package/corpus/templates/design/app/hooks/use-design-systems.ts +2 -2
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +9 -6
- package/corpus/templates/design/app/hooks/use-question-flow.ts +7 -1
- package/corpus/templates/design/app/i18n/ar-SA.ts +56 -1
- package/corpus/templates/design/app/i18n/de-DE.ts +57 -1
- package/corpus/templates/design/app/i18n/en-US.ts +56 -1
- package/corpus/templates/design/app/i18n/es-ES.ts +56 -1
- package/corpus/templates/design/app/i18n/fr-FR.ts +57 -1
- package/corpus/templates/design/app/i18n/hi-IN.ts +56 -1
- package/corpus/templates/design/app/i18n/ja-JP.ts +56 -1
- package/corpus/templates/design/app/i18n/ko-KR.ts +56 -1
- package/corpus/templates/design/app/i18n/pt-BR.ts +57 -1
- package/corpus/templates/design/app/i18n/zh-CN.ts +56 -1
- package/corpus/templates/design/app/i18n/zh-TW.ts +51 -0
- package/corpus/templates/design/app/pages/Present.tsx +172 -14
- package/corpus/templates/design/app/pages/design-editor/overview-camera.ts +23 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +10 -0
- package/corpus/templates/design/app/pages/present-review-state.ts +18 -0
- package/corpus/templates/design/app/public-routes.ts +8 -0
- package/corpus/templates/design/app/root.tsx +7 -6
- package/corpus/templates/design/changelog/2026-07-13-dragged-design-assets-now-appear-at-the-visible-drop-locatio.md +6 -0
- package/corpus/templates/design/changelog/2026-07-13-reviewers-can-pin-comments-on-shared-designs-and-apply-verif.md +6 -0
- package/corpus/templates/design/server/plugins/agent-chat.ts +10 -0
- package/corpus/templates/design/server/plugins/auth.ts +7 -5
- package/corpus/templates/design/server/plugins/review.ts +9 -0
- package/corpus/templates/design/shared/review-anchor.ts +83 -0
- package/corpus/templates/design/shared/review-summary.ts +25 -0
- package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +2 -0
- package/corpus/templates/forms/AGENTS.md +4 -0
- package/corpus/templates/forms/actions/create-form.ts +2 -1
- package/corpus/templates/forms/actions/update-form.ts +5 -2
- package/corpus/templates/forms/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +3 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +3 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +19 -0
- package/corpus/templates/forms/changelog/2026-07-14-fixed-the-ask-forms-loading-input-appearing-above-the-welcom.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-14-form-social-previews-now-show-the-form-title-description-and.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-14-forms-can-email-the-form-owner-when-new-responses-arrive.md +6 -0
- package/corpus/templates/forms/server/handlers/submissions.ts +17 -0
- package/corpus/templates/forms/server/lib/form-og-image.ts +64 -6
- package/corpus/templates/forms/server/lib/public-form-ssr.ts +6 -2
- package/corpus/templates/forms/server/lib/response-email.ts +65 -0
- package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/forms/server/routes/api/forms/og/[...slug]/og.png.get.ts +184 -0
- package/corpus/templates/forms/shared/types.ts +2 -0
- package/corpus/templates/plan/.agents/skills/visual-plan/SKILL.md +6 -4
- package/corpus/templates/plan/.agents/skills/visual-recap/SKILL.md +7 -1
- package/dist/a2a/index.d.ts +2 -1
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/server.d.ts +25 -0
- package/dist/a2a/server.d.ts.map +1 -1
- package/dist/a2a/server.js +30 -6
- package/dist/a2a/server.js.map +1 -1
- package/dist/agent/production-agent.d.ts +2 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +37 -12
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/create.d.ts +5 -3
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +44 -19
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.d.ts +2 -2
- package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
- package/dist/cli/pr-visual-recap-workflow.js +2 -2
- package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
- package/dist/cli/recap.d.ts +3 -562
- package/dist/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +3 -3875
- package/dist/cli/recap.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 +6 -4
- 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 +7 -1
- package/dist/cli/skills-content/visual-recap-skill.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +3 -3
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/analytics.d.ts +5 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +3 -1
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/chat/markdown-renderer.d.ts +1 -0
- package/dist/client/chat/markdown-renderer.d.ts.map +1 -1
- package/dist/client/chat/markdown-renderer.js +36 -1
- package/dist/client/chat/markdown-renderer.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +5 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/clipboard.d.ts +3 -1
- package/dist/client/clipboard.d.ts.map +1 -1
- package/dist/client/clipboard.js +24 -1
- package/dist/client/clipboard.js.map +1 -1
- package/dist/client/guided-questions.d.ts +3 -1
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +2 -1
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/i18n.d.ts.map +1 -1
- package/dist/client/i18n.js +3 -1
- package/dist/client/i18n.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/review/ReviewCommentComposer.d.ts +18 -0
- package/dist/client/review/ReviewCommentComposer.d.ts.map +1 -0
- package/dist/client/review/ReviewCommentComposer.js +30 -0
- package/dist/client/review/ReviewCommentComposer.js.map +1 -0
- package/dist/client/review/ReviewThreadPanel.d.ts +28 -1
- package/dist/client/review/ReviewThreadPanel.d.ts.map +1 -1
- package/dist/client/review/ReviewThreadPanel.js +151 -39
- package/dist/client/review/ReviewThreadPanel.js.map +1 -1
- package/dist/client/review/index.d.ts +3 -2
- package/dist/client/review/index.d.ts.map +1 -1
- package/dist/client/review/index.js +2 -1
- package/dist/client/review/index.js.map +1 -1
- package/dist/client/review/use-review.d.ts +23 -0
- package/dist/client/review/use-review.d.ts.map +1 -1
- package/dist/client/review/use-review.js +3 -0
- package/dist/client/review/use-review.js.map +1 -1
- package/dist/client/use-agent-chat-context.d.ts +1 -1
- package/dist/client/use-agent-chat-context.d.ts.map +1 -1
- package/dist/client/use-agent-chat-context.js +4 -2
- package/dist/client/use-agent-chat-context.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- 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/review/actions/create-review-comment.js +2 -1
- package/dist/review/actions/create-review-comment.js.map +1 -1
- package/dist/review/actions/get-review-feedback.js +6 -11
- package/dist/review/actions/get-review-feedback.js.map +1 -1
- package/dist/review/actions/list-review-comments.d.ts +1 -0
- package/dist/review/actions/list-review-comments.js +25 -4
- package/dist/review/actions/list-review-comments.js.map +1 -1
- package/dist/review/actions/reply-review-comment.js +12 -5
- package/dist/review/actions/reply-review-comment.js.map +1 -1
- package/dist/review/actions/resolve-review-thread.d.ts +3 -0
- package/dist/review/actions/resolve-review-thread.js +20 -3
- package/dist/review/actions/resolve-review-thread.js.map +1 -1
- package/dist/review/actions/send-review-thread-to-agent.d.ts +17 -0
- package/dist/review/actions/send-review-thread-to-agent.d.ts.map +1 -0
- package/dist/review/actions/send-review-thread-to-agent.js +49 -0
- package/dist/review/actions/send-review-thread-to-agent.js.map +1 -0
- package/dist/review/identity.d.ts +6 -0
- package/dist/review/identity.d.ts.map +1 -0
- package/dist/review/identity.js +68 -0
- package/dist/review/identity.js.map +1 -0
- package/dist/review/index.d.ts +3 -1
- package/dist/review/index.d.ts.map +1 -1
- package/dist/review/index.js +2 -1
- package/dist/review/index.js.map +1 -1
- package/dist/review/store.d.ts +36 -0
- package/dist/review/store.d.ts.map +1 -1
- package/dist/review/store.js +223 -8
- package/dist/review/store.js.map +1 -1
- package/dist/review/types.d.ts +4 -0
- package/dist/review/types.d.ts.map +1 -1
- package/dist/review/types.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts +45 -0
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +71 -5
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat/plugin-options.d.ts +16 -0
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +1 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +4 -0
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/content/locales/ar-SA/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/ar-SA/template-plan.mdx +7 -0
- package/docs/content/locales/de-DE/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/de-DE/template-plan.mdx +7 -0
- package/docs/content/locales/es-ES/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/es-ES/template-plan.mdx +14 -0
- package/docs/content/locales/fr-FR/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/fr-FR/template-plan.mdx +7 -0
- package/docs/content/locales/hi-IN/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/hi-IN/template-plan.mdx +7 -0
- package/docs/content/locales/ja-JP/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/ja-JP/template-plan.mdx +7 -0
- package/docs/content/locales/ko-KR/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/ko-KR/template-plan.mdx +7 -0
- package/docs/content/locales/pt-BR/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/pt-BR/template-plan.mdx +14 -0
- package/docs/content/locales/zh-CN/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/zh-CN/template-plan.mdx +7 -0
- package/docs/content/locales/zh-TW/pr-visual-recap.mdx +48 -30
- package/docs/content/locales/zh-TW/template-plan.mdx +7 -0
- package/docs/content/pr-visual-recap.mdx +50 -32
- package/docs/content/template-plan.mdx +14 -0
- package/docs/content/toolkit-comments-review.mdx +16 -2
- package/package.json +4 -1
- package/corpus/templates/forms/server/routes/api/forms/og/[slug]/og.png.get.ts +0 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-routes.d.ts","sourceRoot":"","sources":["../../src/server/action-routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-routes.d.ts","sourceRoot":"","sources":["../../src/server/action-routes.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAUhE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAgBhC,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,eAAe,GAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAMrB;AA2HD;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,GAAG;IAC7D;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,GAAG,KAER,yBAAyB,GACzB,IAAI,GACJ,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,GAAG,KACP,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACtD,0DAA0D;IAC1D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtE;;;;OAIG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AA4BD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,OAAO,CAAC,EAAE,wBAAwB,QAwSnC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { defineEventHandler, setResponseStatus, setResponseHeader, getMethod, getQuery, getHeader, getRequestURL, } from "h3";
|
|
1
|
+
import { createError, defineEventHandler, setResponseStatus, setResponseHeader, getMethod, getQuery, getHeader, getRequestURL, } from "h3";
|
|
2
2
|
import { isAgentActionStopError } from "../action.js";
|
|
3
|
+
import { resolveOrgIdForEmail } from "../org/context.js";
|
|
3
4
|
import { readBody } from "../server/h3-helpers.js";
|
|
4
5
|
import { EMBED_TARGET_HEADER } from "../shared/embed-auth.js";
|
|
5
6
|
import { isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
|
|
6
7
|
import { notifyActionChange } from "./action-change.js";
|
|
8
|
+
import { seedAgentRunOwnerContext, } from "./agent-run-context.js";
|
|
7
9
|
import { getAllowedCorsOrigin as resolveAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js";
|
|
8
10
|
/**
|
|
9
11
|
* Auto-mount actions as HTTP endpoints under /_agent-native/actions/:name.
|
|
@@ -118,6 +120,11 @@ function handleOptionsRequest(event) {
|
|
|
118
120
|
setResponseStatus(event, 204);
|
|
119
121
|
return "";
|
|
120
122
|
}
|
|
123
|
+
function normalizeOrgId(value) {
|
|
124
|
+
return typeof value === "string" && value.trim().length > 0
|
|
125
|
+
? value.trim()
|
|
126
|
+
: undefined;
|
|
127
|
+
}
|
|
121
128
|
function isAuthResolutionFailure(error) {
|
|
122
129
|
if (!error || typeof error !== "object")
|
|
123
130
|
return false;
|
|
@@ -181,7 +188,43 @@ export function mountActionRoutes(nitroApp, actions, options) {
|
|
|
181
188
|
// Resolve auth context for per-request scoping
|
|
182
189
|
let userEmail;
|
|
183
190
|
let userName;
|
|
184
|
-
|
|
191
|
+
// An app-supplied auth adapter runs first: it can accept caller
|
|
192
|
+
// identities the framework's getSession chain doesn't understand (e.g.
|
|
193
|
+
// an A2A JWT). A resolved caller is seeded onto the event context so any
|
|
194
|
+
// downstream resolveAgentRunOwnerContext (nested agent runs) sees the
|
|
195
|
+
// same identity. The adapter is only consulted for the action route, so
|
|
196
|
+
// it can't affect other surfaces.
|
|
197
|
+
//
|
|
198
|
+
// Contract: `resolveCaller` returning `null` means "this credential
|
|
199
|
+
// isn't mine — defer to the cookie/session chain below". THROWING means
|
|
200
|
+
// "the credential is mine but invalid" (e.g. an expired/forged A2A
|
|
201
|
+
// bearer) and is a hard rejection: we surface a 401 instead of falling
|
|
202
|
+
// through, so a live same-origin session cookie can't silently execute
|
|
203
|
+
// the request as the logged-in user.
|
|
204
|
+
let resolvedCaller = null;
|
|
205
|
+
if (options?.actionRouteAuth?.resolveCaller) {
|
|
206
|
+
let caller;
|
|
207
|
+
try {
|
|
208
|
+
caller = await options.actionRouteAuth.resolveCaller(event);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
throw createError({
|
|
212
|
+
statusCode: 401,
|
|
213
|
+
statusMessage: "Unauthorized",
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (caller) {
|
|
217
|
+
seedAgentRunOwnerContext(event, {
|
|
218
|
+
owner: caller.owner,
|
|
219
|
+
anonymous: caller.anonymous,
|
|
220
|
+
name: caller.name,
|
|
221
|
+
});
|
|
222
|
+
userEmail = caller.owner;
|
|
223
|
+
userName = caller.name;
|
|
224
|
+
resolvedCaller = caller;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (!resolvedCaller && options?.getOwnerFromEvent) {
|
|
185
228
|
try {
|
|
186
229
|
userEmail = await options.getOwnerFromEvent(event);
|
|
187
230
|
userName = options?.getUserNameFromEvent
|
|
@@ -199,9 +242,32 @@ export function mountActionRoutes(nitroApp, actions, options) {
|
|
|
199
242
|
}
|
|
200
243
|
}
|
|
201
244
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
245
|
+
// Org scoping. For adapter-resolved callers the org must come
|
|
246
|
+
// exclusively from the verified credential: the adapter-asserted
|
|
247
|
+
// orgId when present, otherwise the owner-email membership lookup.
|
|
248
|
+
// The request's ambient session/org state (`resolveOrgId`, usually
|
|
249
|
+
// getSession-backed) is deliberately NOT consulted — a request can
|
|
250
|
+
// carry both a valid A2A bearer and an unrelated same-origin browser
|
|
251
|
+
// cookie, and the cookie user's org must not become the org the
|
|
252
|
+
// token caller's actions execute under. Non-adapter callers keep the
|
|
253
|
+
// original resolveOrgId-only behavior.
|
|
254
|
+
let orgId;
|
|
255
|
+
if (resolvedCaller) {
|
|
256
|
+
orgId = normalizeOrgId(resolvedCaller.orgId);
|
|
257
|
+
if (!orgId && resolvedCaller.owner && !resolvedCaller.anonymous) {
|
|
258
|
+
try {
|
|
259
|
+
orgId = normalizeOrgId(await resolveOrgIdForEmail(resolvedCaller.owner));
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
// Org tables may not exist yet on first boot.
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
orgId = options?.resolveOrgId
|
|
268
|
+
? ((await options.resolveOrgId(event)) ?? undefined)
|
|
269
|
+
: undefined;
|
|
270
|
+
}
|
|
205
271
|
const timezone = readTimezoneHeader(event);
|
|
206
272
|
return runWithRequestContext({
|
|
207
273
|
userEmail,
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AM,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,IAAI,GAAG,CAAC,CAAC;oBACjE,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;oBAEjC,kDAAkD;oBAClD,6DAA6D;oBAC7D,iEAAiE;oBACjE,8DAA8D;oBAC9D,gEAAgE;oBAChE,2DAA2D;oBAC3D,kDAAkD;oBAClD,MAAM,YAAY,GAChB,iBAAiB;wBACjB,sBAAsB,CAAC,GAAG,CAAC;wBAC3B,CAAC,cAAc,KAAK,SAAS,IAAI,cAAc,GAAG,GAAG,CAAC,CAAC;oBACzD,IAAI,YAAY,EAAE,CAAC;wBACjB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;oBACxB,CAAC;oBACD,OAAO,CAAC,KAAK,CAAC,0BAA0B,IAAI,WAAW,EAAE,GAAG,CAAC,CAAC;oBAC9D,OAAO,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC;gBAC5C,CAAC;YACH,CAAC,CACF,CAAC,CAAC,4BAA4B;QACjC,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK;QACzC,OAAO,CAAC,GAAG,CACT,2BAA2B,OAAO,CAAC,MAAM,qBAAqB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACnF,CAAC;AACN,CAAC","sourcesContent":["import {\n defineEventHandler,\n setResponseStatus,\n setResponseHeader,\n getMethod,\n getQuery,\n getHeader,\n getRequestURL,\n} from \"h3\";\n\nimport { isAgentActionStopError } from \"../action.js\";\nimport type { ActionEntry } from \"../agent/production-agent.js\";\nimport { readBody } from \"../server/h3-helpers.js\";\nimport { EMBED_TARGET_HEADER } from \"../shared/embed-auth.js\";\nimport {\n isMcpEmbedCorsOrigin,\n MCP_EMBED_CORS_ALLOW_HEADERS,\n shouldAllowMcpEmbedCredentials,\n} from \"../shared/mcp-embed-headers.js\";\nimport { notifyActionChange } from \"./action-change.js\";\nimport {\n getAllowedCorsOrigin as resolveAllowedCorsOrigin,\n readCorsAllowedOrigins,\n} from \"./cors-origins.js\";\n/**\n * Auto-mount actions as HTTP endpoints under /_agent-native/actions/:name.\n *\n * Actions are exposed as POST by default. Use `http: { method: \"GET\" }` in\n * defineAction to expose as GET. Use `http: false` to mark as agent-only.\n */\nimport { getH3App } from \"./framework-request-handler.js\";\nimport { runWithRequestContext } from \"./request-context.js\";\n\nconst ROUTE_PREFIX = \"/_agent-native/actions\";\n\nexport function parseActionSearchParams(\n searchParams: URLSearchParams,\n): Record<string, any> {\n const params: Record<string, any> = {};\n for (const [rawKey, value] of searchParams.entries()) {\n appendActionParam(params, rawKey, value);\n }\n return params;\n}\n\nfunction parseActionQueryObject(\n query: Record<string, unknown>,\n): Record<string, any> {\n const params: Record<string, any> = {};\n for (const [rawKey, rawValue] of Object.entries(query)) {\n const values = Array.isArray(rawValue) ? rawValue : [rawValue];\n for (const value of values) {\n if (value != null) appendActionParam(params, rawKey, String(value));\n }\n }\n return params;\n}\n\nfunction appendActionParam(\n params: Record<string, any>,\n rawKey: string,\n value: any,\n) {\n const isArrayKey = rawKey.endsWith(\"[]\");\n // The core client serializes arrays as `key[]=value` so even a single\n // value can validate against z.array() action schemas.\n const key = isArrayKey ? rawKey.slice(0, -2) : rawKey;\n const current = params[key];\n if (current === undefined) {\n params[key] = isArrayKey ? [value] : value;\n } else if (Array.isArray(current)) {\n current.push(value);\n } else {\n params[key] = [current, value];\n }\n}\n\n/**\n * Read the caller's IANA timezone from the `x-user-timezone` header. The core\n * client sends this on every action request so server-side \"today\" fallbacks\n * can honor the user's local day.\n */\nfunction readTimezoneHeader(event: any): string | undefined {\n try {\n const raw = getHeader(event, \"x-user-timezone\");\n if (!raw || typeof raw !== \"string\") return undefined;\n const trimmed = raw.trim();\n return trimmed.length > 0 && trimmed.length < 64 ? trimmed : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * True when the request originated from the browser action client\n * (`useActionQuery` / `useActionMutation` / `callAction`), which tags every\n * call with `X-Agent-Native-Frontend: 1`. Used to set `ctx.caller` to\n * `\"frontend\"` vs a bare programmatic `\"http\"` POST. The header carries no\n * auth weight — it only narrows the caller tag for tracking/branching.\n */\nfunction isFrontendActionRequest(event: any): boolean {\n try {\n return getHeader(event, \"x-agent-native-frontend\") === \"1\";\n } catch {\n return false;\n }\n}\n\ntype CorsOrigin = {\n origin: string;\n credentials: boolean;\n};\n\nfunction getAllowedCorsOrigin(origin: string | undefined): CorsOrigin | null {\n const allowedOrigin = resolveAllowedCorsOrigin(origin, {\n allowedOrigins: readCorsAllowedOrigins(),\n // Let the cors-origins default apply (dev-only). Omitting this option\n // keeps production from trusting arbitrary localhost callers.\n });\n if (allowedOrigin) {\n return { origin: allowedOrigin, credentials: true };\n }\n if (origin && isMcpEmbedCorsOrigin(origin)) {\n return {\n origin,\n credentials: shouldAllowMcpEmbedCredentials(origin),\n };\n }\n return null;\n}\n\nfunction handleOptionsRequest(event: any): string {\n const origin = getHeader(event, \"origin\");\n const cors = getAllowedCorsOrigin(\n typeof origin === \"string\" ? origin : undefined,\n );\n\n if (origin && !cors) {\n setResponseStatus(event, 403);\n return \"\";\n }\n\n if (cors) {\n setResponseHeader(event, \"Access-Control-Allow-Origin\", cors.origin);\n setResponseHeader(event, \"Vary\", \"Origin\");\n if (cors.credentials) {\n setResponseHeader(event, \"Access-Control-Allow-Credentials\", \"true\");\n }\n setResponseHeader(\n event,\n \"Access-Control-Allow-Methods\",\n \"GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS\",\n );\n setResponseHeader(\n event,\n \"Access-Control-Allow-Headers\",\n cors.credentials\n ? `Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,${EMBED_TARGET_HEADER}`\n : `${MCP_EMBED_CORS_ALLOW_HEADERS},X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend`,\n );\n }\n\n setResponseStatus(event, 204);\n return \"\";\n}\n\nexport interface MountActionRoutesOptions {\n /** Resolve owner email from the H3 event (for data scoping). */\n getOwnerFromEvent?: (event: any) => string | Promise<string>;\n /** Resolve display name from the H3 event, when available. */\n getUserNameFromEvent?: (\n event: any,\n ) => string | undefined | Promise<string | undefined>;\n /** Resolve org ID from the H3 event (for org scoping). */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n}\n\nfunction isAuthResolutionFailure(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n const maybeStatus = error as {\n status?: unknown;\n statusCode?: unknown;\n statusMessage?: unknown;\n };\n const status =\n typeof maybeStatus.statusCode === \"number\"\n ? maybeStatus.statusCode\n : typeof maybeStatus.status === \"number\"\n ? maybeStatus.status\n : undefined;\n if (status === 401 || status === 403) return true;\n return (\n typeof maybeStatus.statusMessage === \"string\" &&\n /unauthenticated|forbidden/i.test(maybeStatus.statusMessage)\n );\n}\n\n/**\n * Mount discovered actions as HTTP endpoints.\n *\n * Only actions from `autoDiscoverActions` (template actions) are mounted.\n * Built-in actions (resource-*, chat-*, shell, etc.) are NOT passed here.\n */\nexport function mountActionRoutes(\n nitroApp: any,\n actions: Record<string, ActionEntry>,\n options?: MountActionRoutesOptions,\n) {\n const mounted: string[] = [];\n\n for (const [name, entry] of Object.entries(actions)) {\n // Skip agent-only actions\n if (entry.http === false) continue;\n\n const method = entry.http?.method ?? \"POST\";\n const path = entry.http?.path ?? name;\n const routePath = `${ROUTE_PREFIX}/${path}`;\n\n getH3App(nitroApp).use(\n routePath,\n defineEventHandler(async (event) => {\n const reqMethod = getMethod(event);\n const effectiveMethod =\n reqMethod === \"HEAD\" && method === \"GET\" ? \"GET\" : reqMethod;\n\n if (reqMethod === \"OPTIONS\") {\n return handleOptionsRequest(event);\n }\n\n setResponseHeader(event, \"Cache-Control\", \"no-store\");\n\n // Allow the declared method\n if (effectiveMethod !== method) {\n setResponseStatus(event, 405);\n return { error: `Method not allowed. Use ${method}.` };\n }\n\n // (audit H5) Per-action `toolCallable` opt-out for the tools-iframe\n // bridge. The bridge tags every outbound action call with\n // X-Agent-Native-Tool-Bridge: 1. When that header is present and the\n // action declares `toolCallable: false`, we 403 — used by the\n // framework's share-resource / unshare-resource /\n // set-resource-visibility for defense-in-depth on auth-adjacent\n // operations. Undefined defaults to allow: tools are intra-org and\n // typically authored by trusted teammates, so the default is to\n // trust the org-level access controls.\n // The header is set by the parent (the React host), not by the\n // iframe's user-authored content; sanitizeToolRequestOptions strips\n // iframe attempts to spoof it.\n const fromToolBridge =\n getHeader(event, \"x-agent-native-tool-bridge\") === \"1\";\n if (fromToolBridge && entry.toolCallable === false) {\n setResponseStatus(event, 403);\n return {\n error: `Action '${name}' is not callable from tools.`,\n };\n }\n\n // Resolve auth context for per-request scoping\n let userEmail: string | undefined;\n let userName: string | undefined;\n if (options?.getOwnerFromEvent) {\n try {\n userEmail = await options.getOwnerFromEvent(event);\n userName = options?.getUserNameFromEvent\n ? await options.getUserNameFromEvent(event)\n : undefined;\n } catch (error) {\n if (\n entry.requiresAuth === false &&\n isAuthResolutionFailure(error)\n ) {\n userEmail = undefined;\n userName = undefined;\n } else {\n throw error;\n }\n }\n }\n const orgId = options?.resolveOrgId\n ? ((await options.resolveOrgId(event)) ?? undefined)\n : undefined;\n const timezone = readTimezoneHeader(event);\n\n return runWithRequestContext(\n {\n userEmail,\n userName,\n orgId,\n timezone,\n requestOrigin: getRequestURL(event).origin,\n },\n async () => {\n // Reject oversize bodies from Content-Length before parsing, so a\n // public no-auth POST can't force parse work on a huge request.\n if (typeof entry.maxBodyBytes === \"number\" && method !== \"GET\") {\n const clRaw = getHeader(event, \"content-length\");\n if (clRaw) {\n const declared = parseInt(clRaw, 10);\n if (!Number.isNaN(declared) && declared > entry.maxBodyBytes) {\n setResponseStatus(event, 413);\n return {\n error: `Request body too large (max ${entry.maxBodyBytes} bytes)`,\n };\n }\n }\n }\n // Parse params based on method. On web-standard runtimes (Netlify\n // Functions, CF Workers), event.req IS the web Request — use .json()\n // directly. H3's readBody fails on those runtimes because it expects\n // a Node.js stream on event.node.req.\n let params: Record<string, any>;\n try {\n if (method === \"GET\") {\n // H3 v2: prefer web Request URL, fallback to getQuery\n const webReq = (event as any).req;\n if (webReq?.url) {\n const url = new URL(webReq.url);\n params = parseActionSearchParams(url.searchParams);\n } else {\n params = parseActionQueryObject(\n getQuery(event) as Record<string, any>,\n );\n }\n } else {\n const webReq = (event as any).req;\n if (webReq && typeof webReq.json === \"function\") {\n // H3 v2: event.req is the web Request — use .json() directly\n params = (await webReq.json().catch(() => null)) ?? {};\n } else {\n // Fallback: H3's readBody (Node.js dev)\n params = (await readBody(event)) ?? {};\n }\n }\n } catch {\n params = {};\n }\n\n // Run the action. Tag the caller: browser calls (useActionQuery /\n // useActionMutation / callAction) send X-Agent-Native-Frontend: 1,\n // so they become \"frontend\"; bare programmatic POSTs are \"http\".\n // userEmail / orgId mirror the request context resolved above (do\n // NOT inject a dev identity — leave undefined when unauthenticated).\n try {\n const caller = isFrontendActionRequest(event)\n ? \"frontend\"\n : \"http\";\n const result = await entry.run(params, {\n userEmail,\n orgId: orgId ?? null,\n caller,\n actionName: name,\n });\n\n // Auto-refresh the UI after a successful mutating action. GET\n // actions and actions explicitly flagged readOnly are skipped.\n // Other tabs' useDbSync will see source:\"action\" and invalidate\n // their action queries. The calling tab already refetches via\n // useActionMutation's onSuccess, so this is mainly cross-tab\n // sync (and parity with the agent's tool-call path).\n // Explicit entry.readOnly (true OR false) wins over the method\n // heuristic. defineAction already auto-infers GET → readOnly=true,\n // so for actions registered through that path entry.readOnly is\n // always set and the fallback just guards legacy wrap paths.\n const isReadOnly =\n typeof entry.readOnly === \"boolean\"\n ? entry.readOnly\n : method === \"GET\";\n if (!isReadOnly) {\n try {\n await notifyActionChange({\n actionName: name,\n ...(userEmail ? { owner: userEmail } : {}),\n ...(getHeader(event, \"x-request-source\")\n ? {\n requestSource: getHeader(\n event,\n \"x-request-source\",\n ) as string,\n }\n : {}),\n });\n } catch {\n // ignore\n }\n }\n\n // If the action returned a string, try to parse as JSON for a\n // clean response. Plain strings still need to go over the HTTP\n // action transport as JSON, otherwise H3 sends text/plain and the\n // browser action client rejects the successful 2xx response.\n if (typeof result === \"string\") {\n try {\n return JSON.parse(result);\n } catch {\n setResponseHeader(event, \"Content-Type\", \"application/json\");\n return JSON.stringify(result);\n }\n }\n\n return result;\n } catch (err: any) {\n const msg = err?.message ?? String(err);\n const isValidationError = msg.startsWith(\n \"Invalid action parameters\",\n );\n const explicitStatus =\n typeof err?.statusCode === \"number\"\n ? err.statusCode\n : undefined;\n // Return 400 for validation errors, the explicit statusCode if\n // set, otherwise 500.\n const status = isValidationError ? 400 : (explicitStatus ?? 500);\n setResponseStatus(event, status);\n\n // Only echo the raw message for known-safe cases:\n // - validation errors (deterministic, parameter-shape only)\n // - explicit user-facing errors (AgentActionStopError / fail())\n // - errors with an explicit statusCode < 500 (client errors)\n // For uncategorized 500s, return a generic message and keep the\n // real detail server-side only — it can contain DB/driver/\n // upstream text we must not leak to HTTP callers.\n const isUserFacing =\n isValidationError ||\n isAgentActionStopError(err) ||\n (explicitStatus !== undefined && explicitStatus < 500);\n if (isUserFacing) {\n return { error: msg };\n }\n console.error(`[agent-native] action '${name}' failed:`, err);\n return { error: \"Internal server error\" };\n }\n },\n ); // end runWithRequestContext\n }),\n );\n\n mounted.push(`${method} ${routePath}`);\n }\n\n if (mounted.length > 0 && process.env.DEBUG)\n console.log(\n `[action-routes] Mounted ${mounted.length} action route(s): ${mounted.join(\", \")}`,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"action-routes.js","sourceRoot":"","sources":["../../src/server/action-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,W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AAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK;QACzC,OAAO,CAAC,GAAG,CACT,2BAA2B,OAAO,CAAC,MAAM,qBAAqB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACnF,CAAC;AACN,CAAC","sourcesContent":["import {\n createError,\n defineEventHandler,\n setResponseStatus,\n setResponseHeader,\n getMethod,\n getQuery,\n getHeader,\n getRequestURL,\n} from \"h3\";\n\nimport { isAgentActionStopError } from \"../action.js\";\nimport type { ActionEntry } from \"../agent/production-agent.js\";\nimport { resolveOrgIdForEmail } from \"../org/context.js\";\nimport { readBody } from \"../server/h3-helpers.js\";\nimport { EMBED_TARGET_HEADER } from \"../shared/embed-auth.js\";\nimport {\n isMcpEmbedCorsOrigin,\n MCP_EMBED_CORS_ALLOW_HEADERS,\n shouldAllowMcpEmbedCredentials,\n} from \"../shared/mcp-embed-headers.js\";\nimport { notifyActionChange } from \"./action-change.js\";\nimport {\n seedAgentRunOwnerContext,\n type AgentRunOwnerContext,\n} from \"./agent-run-context.js\";\nimport {\n getAllowedCorsOrigin as resolveAllowedCorsOrigin,\n readCorsAllowedOrigins,\n} from \"./cors-origins.js\";\n/**\n * Auto-mount actions as HTTP endpoints under /_agent-native/actions/:name.\n *\n * Actions are exposed as POST by default. Use `http: { method: \"GET\" }` in\n * defineAction to expose as GET. Use `http: false` to mark as agent-only.\n */\nimport { getH3App } from \"./framework-request-handler.js\";\nimport { runWithRequestContext } from \"./request-context.js\";\n\nconst ROUTE_PREFIX = \"/_agent-native/actions\";\n\nexport function parseActionSearchParams(\n searchParams: URLSearchParams,\n): Record<string, any> {\n const params: Record<string, any> = {};\n for (const [rawKey, value] of searchParams.entries()) {\n appendActionParam(params, rawKey, value);\n }\n return params;\n}\n\nfunction parseActionQueryObject(\n query: Record<string, unknown>,\n): Record<string, any> {\n const params: Record<string, any> = {};\n for (const [rawKey, rawValue] of Object.entries(query)) {\n const values = Array.isArray(rawValue) ? rawValue : [rawValue];\n for (const value of values) {\n if (value != null) appendActionParam(params, rawKey, String(value));\n }\n }\n return params;\n}\n\nfunction appendActionParam(\n params: Record<string, any>,\n rawKey: string,\n value: any,\n) {\n const isArrayKey = rawKey.endsWith(\"[]\");\n // The core client serializes arrays as `key[]=value` so even a single\n // value can validate against z.array() action schemas.\n const key = isArrayKey ? rawKey.slice(0, -2) : rawKey;\n const current = params[key];\n if (current === undefined) {\n params[key] = isArrayKey ? [value] : value;\n } else if (Array.isArray(current)) {\n current.push(value);\n } else {\n params[key] = [current, value];\n }\n}\n\n/**\n * Read the caller's IANA timezone from the `x-user-timezone` header. The core\n * client sends this on every action request so server-side \"today\" fallbacks\n * can honor the user's local day.\n */\nfunction readTimezoneHeader(event: any): string | undefined {\n try {\n const raw = getHeader(event, \"x-user-timezone\");\n if (!raw || typeof raw !== \"string\") return undefined;\n const trimmed = raw.trim();\n return trimmed.length > 0 && trimmed.length < 64 ? trimmed : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * True when the request originated from the browser action client\n * (`useActionQuery` / `useActionMutation` / `callAction`), which tags every\n * call with `X-Agent-Native-Frontend: 1`. Used to set `ctx.caller` to\n * `\"frontend\"` vs a bare programmatic `\"http\"` POST. The header carries no\n * auth weight — it only narrows the caller tag for tracking/branching.\n */\nfunction isFrontendActionRequest(event: any): boolean {\n try {\n return getHeader(event, \"x-agent-native-frontend\") === \"1\";\n } catch {\n return false;\n }\n}\n\ntype CorsOrigin = {\n origin: string;\n credentials: boolean;\n};\n\nfunction getAllowedCorsOrigin(origin: string | undefined): CorsOrigin | null {\n const allowedOrigin = resolveAllowedCorsOrigin(origin, {\n allowedOrigins: readCorsAllowedOrigins(),\n // Let the cors-origins default apply (dev-only). Omitting this option\n // keeps production from trusting arbitrary localhost callers.\n });\n if (allowedOrigin) {\n return { origin: allowedOrigin, credentials: true };\n }\n if (origin && isMcpEmbedCorsOrigin(origin)) {\n return {\n origin,\n credentials: shouldAllowMcpEmbedCredentials(origin),\n };\n }\n return null;\n}\n\nfunction handleOptionsRequest(event: any): string {\n const origin = getHeader(event, \"origin\");\n const cors = getAllowedCorsOrigin(\n typeof origin === \"string\" ? origin : undefined,\n );\n\n if (origin && !cors) {\n setResponseStatus(event, 403);\n return \"\";\n }\n\n if (cors) {\n setResponseHeader(event, \"Access-Control-Allow-Origin\", cors.origin);\n setResponseHeader(event, \"Vary\", \"Origin\");\n if (cors.credentials) {\n setResponseHeader(event, \"Access-Control-Allow-Credentials\", \"true\");\n }\n setResponseHeader(\n event,\n \"Access-Control-Allow-Methods\",\n \"GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS\",\n );\n setResponseHeader(\n event,\n \"Access-Control-Allow-Headers\",\n cors.credentials\n ? `Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,${EMBED_TARGET_HEADER}`\n : `${MCP_EMBED_CORS_ALLOW_HEADERS},X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend`,\n );\n }\n\n setResponseStatus(event, 204);\n return \"\";\n}\n\n/**\n * Declarative auth adapter for the HTTP action route. Its `resolveCaller` runs\n * BEFORE the framework's `getOwnerFromEvent` / `getSession` chain, letting an\n * app accept caller identities `getSession` doesn't understand (e.g. an A2A\n * JWT) without reaching into request context from a Nitro `request` hook.\n *\n * Scoped to `/_agent-native/actions/*` only — it does not affect other routes.\n */\nexport type ActionRouteResolvedCaller = AgentRunOwnerContext & {\n /**\n * Org to scope the request to, verified from the same credential as the\n * caller identity (e.g. the A2A token's org claim). When omitted, the org\n * is derived from the verified owner email via the framework's owner→org\n * membership lookup. The ambient session/org state on the request is never\n * consulted for adapter-resolved callers: a request can carry both a valid\n * A2A bearer and an unrelated browser cookie, and the cookie user's org\n * must not leak into the token caller's request context.\n */\n orgId?: string;\n};\n\nexport interface ActionRouteAuthAdapter {\n /**\n * Resolve a caller from the raw event before the cookie/bearer chain.\n *\n * - Return the resolved caller to run the action scoped to that identity.\n * Org scoping comes exclusively from the caller: the returned `orgId` if\n * set, otherwise the owner-email membership lookup — never from the\n * request's session cookie or org context.\n * - Return `null` when the credential isn't yours to judge — the request\n * defers to `getOwnerFromEvent` / `getSession`.\n * - THROW to hard-reject: the credential is present but invalid (e.g. an\n * expired or forged A2A bearer). The action route responds 401 and does\n * NOT fall through to the cookie/session chain, so a valid same-origin\n * session cookie can't be used to execute the request as the logged-in\n * user. Do not throw merely to signal \"not mine\" — return `null` for that.\n */\n resolveCaller?: (\n event: any,\n ) =>\n | ActionRouteResolvedCaller\n | null\n | Promise<ActionRouteResolvedCaller | null>;\n}\n\nexport interface MountActionRoutesOptions {\n /** Resolve owner email from the H3 event (for data scoping). */\n getOwnerFromEvent?: (event: any) => string | Promise<string>;\n /** Resolve display name from the H3 event, when available. */\n getUserNameFromEvent?: (\n event: any,\n ) => string | undefined | Promise<string | undefined>;\n /** Resolve org ID from the H3 event (for org scoping). */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional caller resolver that runs before the `getOwnerFromEvent` /\n * `getSession` chain. Lets apps accept A2A JWTs (or other bearer schemes) on\n * the action route declaratively. See {@link ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: ActionRouteAuthAdapter;\n}\n\nfunction normalizeOrgId(value: string | null | undefined): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0\n ? value.trim()\n : undefined;\n}\n\nfunction isAuthResolutionFailure(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n const maybeStatus = error as {\n status?: unknown;\n statusCode?: unknown;\n statusMessage?: unknown;\n };\n const status =\n typeof maybeStatus.statusCode === \"number\"\n ? maybeStatus.statusCode\n : typeof maybeStatus.status === \"number\"\n ? maybeStatus.status\n : undefined;\n if (status === 401 || status === 403) return true;\n return (\n typeof maybeStatus.statusMessage === \"string\" &&\n /unauthenticated|forbidden/i.test(maybeStatus.statusMessage)\n );\n}\n\n/**\n * Mount discovered actions as HTTP endpoints.\n *\n * Only actions from `autoDiscoverActions` (template actions) are mounted.\n * Built-in actions (resource-*, chat-*, shell, etc.) are NOT passed here.\n */\nexport function mountActionRoutes(\n nitroApp: any,\n actions: Record<string, ActionEntry>,\n options?: MountActionRoutesOptions,\n) {\n const mounted: string[] = [];\n\n for (const [name, entry] of Object.entries(actions)) {\n // Skip agent-only actions\n if (entry.http === false) continue;\n\n const method = entry.http?.method ?? \"POST\";\n const path = entry.http?.path ?? name;\n const routePath = `${ROUTE_PREFIX}/${path}`;\n\n getH3App(nitroApp).use(\n routePath,\n defineEventHandler(async (event) => {\n const reqMethod = getMethod(event);\n const effectiveMethod =\n reqMethod === \"HEAD\" && method === \"GET\" ? \"GET\" : reqMethod;\n\n if (reqMethod === \"OPTIONS\") {\n return handleOptionsRequest(event);\n }\n\n setResponseHeader(event, \"Cache-Control\", \"no-store\");\n\n // Allow the declared method\n if (effectiveMethod !== method) {\n setResponseStatus(event, 405);\n return { error: `Method not allowed. Use ${method}.` };\n }\n\n // (audit H5) Per-action `toolCallable` opt-out for the tools-iframe\n // bridge. The bridge tags every outbound action call with\n // X-Agent-Native-Tool-Bridge: 1. When that header is present and the\n // action declares `toolCallable: false`, we 403 — used by the\n // framework's share-resource / unshare-resource /\n // set-resource-visibility for defense-in-depth on auth-adjacent\n // operations. Undefined defaults to allow: tools are intra-org and\n // typically authored by trusted teammates, so the default is to\n // trust the org-level access controls.\n // The header is set by the parent (the React host), not by the\n // iframe's user-authored content; sanitizeToolRequestOptions strips\n // iframe attempts to spoof it.\n const fromToolBridge =\n getHeader(event, \"x-agent-native-tool-bridge\") === \"1\";\n if (fromToolBridge && entry.toolCallable === false) {\n setResponseStatus(event, 403);\n return {\n error: `Action '${name}' is not callable from tools.`,\n };\n }\n\n // Resolve auth context for per-request scoping\n let userEmail: string | undefined;\n let userName: string | undefined;\n // An app-supplied auth adapter runs first: it can accept caller\n // identities the framework's getSession chain doesn't understand (e.g.\n // an A2A JWT). A resolved caller is seeded onto the event context so any\n // downstream resolveAgentRunOwnerContext (nested agent runs) sees the\n // same identity. The adapter is only consulted for the action route, so\n // it can't affect other surfaces.\n //\n // Contract: `resolveCaller` returning `null` means \"this credential\n // isn't mine — defer to the cookie/session chain below\". THROWING means\n // \"the credential is mine but invalid\" (e.g. an expired/forged A2A\n // bearer) and is a hard rejection: we surface a 401 instead of falling\n // through, so a live same-origin session cookie can't silently execute\n // the request as the logged-in user.\n let resolvedCaller: ActionRouteResolvedCaller | null = null;\n if (options?.actionRouteAuth?.resolveCaller) {\n let caller: ActionRouteResolvedCaller | null;\n try {\n caller = await options.actionRouteAuth.resolveCaller(event);\n } catch {\n throw createError({\n statusCode: 401,\n statusMessage: \"Unauthorized\",\n });\n }\n if (caller) {\n seedAgentRunOwnerContext(event, {\n owner: caller.owner,\n anonymous: caller.anonymous,\n name: caller.name,\n });\n userEmail = caller.owner;\n userName = caller.name;\n resolvedCaller = caller;\n }\n }\n if (!resolvedCaller && options?.getOwnerFromEvent) {\n try {\n userEmail = await options.getOwnerFromEvent(event);\n userName = options?.getUserNameFromEvent\n ? await options.getUserNameFromEvent(event)\n : undefined;\n } catch (error) {\n if (\n entry.requiresAuth === false &&\n isAuthResolutionFailure(error)\n ) {\n userEmail = undefined;\n userName = undefined;\n } else {\n throw error;\n }\n }\n }\n // Org scoping. For adapter-resolved callers the org must come\n // exclusively from the verified credential: the adapter-asserted\n // orgId when present, otherwise the owner-email membership lookup.\n // The request's ambient session/org state (`resolveOrgId`, usually\n // getSession-backed) is deliberately NOT consulted — a request can\n // carry both a valid A2A bearer and an unrelated same-origin browser\n // cookie, and the cookie user's org must not become the org the\n // token caller's actions execute under. Non-adapter callers keep the\n // original resolveOrgId-only behavior.\n let orgId: string | undefined;\n if (resolvedCaller) {\n orgId = normalizeOrgId(resolvedCaller.orgId);\n if (!orgId && resolvedCaller.owner && !resolvedCaller.anonymous) {\n try {\n orgId = normalizeOrgId(\n await resolveOrgIdForEmail(resolvedCaller.owner),\n );\n } catch {\n // Org tables may not exist yet on first boot.\n }\n }\n } else {\n orgId = options?.resolveOrgId\n ? ((await options.resolveOrgId(event)) ?? undefined)\n : undefined;\n }\n const timezone = readTimezoneHeader(event);\n\n return runWithRequestContext(\n {\n userEmail,\n userName,\n orgId,\n timezone,\n requestOrigin: getRequestURL(event).origin,\n },\n async () => {\n // Reject oversize bodies from Content-Length before parsing, so a\n // public no-auth POST can't force parse work on a huge request.\n if (typeof entry.maxBodyBytes === \"number\" && method !== \"GET\") {\n const clRaw = getHeader(event, \"content-length\");\n if (clRaw) {\n const declared = parseInt(clRaw, 10);\n if (!Number.isNaN(declared) && declared > entry.maxBodyBytes) {\n setResponseStatus(event, 413);\n return {\n error: `Request body too large (max ${entry.maxBodyBytes} bytes)`,\n };\n }\n }\n }\n // Parse params based on method. On web-standard runtimes (Netlify\n // Functions, CF Workers), event.req IS the web Request — use .json()\n // directly. H3's readBody fails on those runtimes because it expects\n // a Node.js stream on event.node.req.\n let params: Record<string, any>;\n try {\n if (method === \"GET\") {\n // H3 v2: prefer web Request URL, fallback to getQuery\n const webReq = (event as any).req;\n if (webReq?.url) {\n const url = new URL(webReq.url);\n params = parseActionSearchParams(url.searchParams);\n } else {\n params = parseActionQueryObject(\n getQuery(event) as Record<string, any>,\n );\n }\n } else {\n const webReq = (event as any).req;\n if (webReq && typeof webReq.json === \"function\") {\n // H3 v2: event.req is the web Request — use .json() directly\n params = (await webReq.json().catch(() => null)) ?? {};\n } else {\n // Fallback: H3's readBody (Node.js dev)\n params = (await readBody(event)) ?? {};\n }\n }\n } catch {\n params = {};\n }\n\n // Run the action. Tag the caller: browser calls (useActionQuery /\n // useActionMutation / callAction) send X-Agent-Native-Frontend: 1,\n // so they become \"frontend\"; bare programmatic POSTs are \"http\".\n // userEmail / orgId mirror the request context resolved above (do\n // NOT inject a dev identity — leave undefined when unauthenticated).\n try {\n const caller = isFrontendActionRequest(event)\n ? \"frontend\"\n : \"http\";\n const result = await entry.run(params, {\n userEmail,\n orgId: orgId ?? null,\n caller,\n actionName: name,\n });\n\n // Auto-refresh the UI after a successful mutating action. GET\n // actions and actions explicitly flagged readOnly are skipped.\n // Other tabs' useDbSync will see source:\"action\" and invalidate\n // their action queries. The calling tab already refetches via\n // useActionMutation's onSuccess, so this is mainly cross-tab\n // sync (and parity with the agent's tool-call path).\n // Explicit entry.readOnly (true OR false) wins over the method\n // heuristic. defineAction already auto-infers GET → readOnly=true,\n // so for actions registered through that path entry.readOnly is\n // always set and the fallback just guards legacy wrap paths.\n const isReadOnly =\n typeof entry.readOnly === \"boolean\"\n ? entry.readOnly\n : method === \"GET\";\n if (!isReadOnly) {\n try {\n await notifyActionChange({\n actionName: name,\n ...(userEmail ? { owner: userEmail } : {}),\n ...(getHeader(event, \"x-request-source\")\n ? {\n requestSource: getHeader(\n event,\n \"x-request-source\",\n ) as string,\n }\n : {}),\n });\n } catch {\n // ignore\n }\n }\n\n // If the action returned a string, try to parse as JSON for a\n // clean response. Plain strings still need to go over the HTTP\n // action transport as JSON, otherwise H3 sends text/plain and the\n // browser action client rejects the successful 2xx response.\n if (typeof result === \"string\") {\n try {\n return JSON.parse(result);\n } catch {\n setResponseHeader(event, \"Content-Type\", \"application/json\");\n return JSON.stringify(result);\n }\n }\n\n return result;\n } catch (err: any) {\n const msg = err?.message ?? String(err);\n const isValidationError = msg.startsWith(\n \"Invalid action parameters\",\n );\n const explicitStatus =\n typeof err?.statusCode === \"number\"\n ? err.statusCode\n : undefined;\n // Return 400 for validation errors, the explicit statusCode if\n // set, otherwise 500.\n const status = isValidationError ? 400 : (explicitStatus ?? 500);\n setResponseStatus(event, status);\n\n // Only echo the raw message for known-safe cases:\n // - validation errors (deterministic, parameter-shape only)\n // - explicit user-facing errors (AgentActionStopError / fail())\n // - errors with an explicit statusCode < 500 (client errors)\n // For uncategorized 500s, return a generic message and keep the\n // real detail server-side only — it can contain DB/driver/\n // upstream text we must not leak to HTTP callers.\n const isUserFacing =\n isValidationError ||\n isAgentActionStopError(err) ||\n (explicitStatus !== undefined && explicitStatus < 500);\n if (isUserFacing) {\n return { error: msg };\n }\n console.error(`[agent-native] action '${name}' failed:`, err);\n return { error: \"Internal server error\" };\n }\n },\n ); // end runWithRequestContext\n }),\n );\n\n mounted.push(`${method} ${routePath}`);\n }\n\n if (mounted.length > 0 && process.env.DEBUG)\n console.log(\n `[action-routes] Mounted ${mounted.length} action route(s): ${mounted.join(\", \")}`,\n );\n}\n"]}
|
|
@@ -91,6 +91,22 @@ export interface AgentChatPluginOptions {
|
|
|
91
91
|
* agent mutations.
|
|
92
92
|
*/
|
|
93
93
|
anonymousReadOnly?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Optional auth adapter for the HTTP action route
|
|
96
|
+
* (`/_agent-native/actions/*`). Its `resolveCaller` runs before the
|
|
97
|
+
* cookie/bearer `getSession` chain, letting an app accept caller identities
|
|
98
|
+
* `getSession` doesn't understand (e.g. an A2A JWT verified with
|
|
99
|
+
* `verifyA2AToken`) declaratively, instead of pre-seeding request context
|
|
100
|
+
* from a Nitro `request` hook.
|
|
101
|
+
*
|
|
102
|
+
* Returning `null` defers to the normal chain; THROWING hard-rejects with a
|
|
103
|
+
* 401 (an invalid/forged credential must not fall through to a same-origin
|
|
104
|
+
* session cookie). A resolved caller's org comes exclusively from the
|
|
105
|
+
* verified credential — the returned `orgId` or the owner-email membership
|
|
106
|
+
* lookup — never from the request's session cookie.
|
|
107
|
+
* See {@link import("../action-routes.js").ActionRouteAuthAdapter}.
|
|
108
|
+
*/
|
|
109
|
+
actionRouteAuth?: import("../action-routes.js").ActionRouteAuthAdapter;
|
|
94
110
|
/**
|
|
95
111
|
* Optional callback to append template-specific context to the system
|
|
96
112
|
* prompt on each request. Runs after AGENTS.md / skills / memory are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-options.d.ts","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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,CAAA;KAAE,CAAC;CAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * true. Set to false for apps that do not want the LLM to create or manage\n * sandboxed extension mini-apps, even though the core extension routes may\n * still be mounted for other surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional auth adapter for the HTTP action route\n * (`/_agent-native/actions/*`). Its `resolveCaller` runs before the\n * cookie/bearer `getSession` chain, letting an app accept caller identities\n * `getSession` doesn't understand (e.g. an A2A JWT verified with\n * `verifyA2AToken`) declaratively, instead of pre-seeding request context\n * from a Nitro `request` hook.\n *\n * Returning `null` defers to the normal chain; THROWING hard-rejects with a\n * 401 (an invalid/forged credential must not fall through to a same-origin\n * session cookie). A resolved caller's org comes exclusively from the\n * verified credential — the returned `orgId` or the owner-email membership\n * lookup — never from the request's session cookie.\n * See {@link import(\"../action-routes.js\").ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: import(\"../action-routes.js\").ActionRouteAuthAdapter;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * true. Set to false for apps that do not want the LLM to create or manage\n * sandboxed extension mini-apps, even though the core extension routes may\n * still be mounted for other surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat-plugin.d.ts","sourceRoot":"","sources":["../../src/server/agent-chat-plugin.ts"],"names":[],"mappings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CAAC;AACtC,OAAO,EAAE,sCAAsC,EAAE,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAC7C,OAAO,EAAE,yCAAyC,EAAE,CAAC;AAErD,wBAAgB,wBAAwB,CACtC,6BAA6B,EAAE,MAAM,EACrC,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAER;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,uCAAuC,CAC3D,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC,CAUlB;AAaD,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CA8nKhB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAAwC,CAAC;AAE9E,OAAO,EAEL,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1402,6 +1402,7 @@ export function createAgentChatPlugin(options) {
|
|
|
1402
1402
|
getOwnerFromEvent,
|
|
1403
1403
|
getUserNameFromEvent,
|
|
1404
1404
|
resolveOrgId: options?.resolveOrgId,
|
|
1405
|
+
actionRouteAuth: options?.actionRouteAuth,
|
|
1405
1406
|
});
|
|
1406
1407
|
}
|
|
1407
1408
|
const preRunGitStatusByThread = new Map();
|