@agent-native/core 0.79.16 → 0.79.18
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 +14 -0
- package/corpus/core/docs/content/file-uploads.md +11 -4
- package/corpus/core/docs/content/locales/ar-SA/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/de-DE/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/es-ES/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/fr-FR/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/hi-IN/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/ja-JP/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/ko-KR/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/pt-BR/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/zh-CN/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/locales/zh-TW/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/multi-app-workspace.md +3 -3
- package/corpus/core/docs/content/template-clips.md +14 -5
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/engine/builder-engine.ts +8 -3
- package/corpus/core/src/cli/mcp.ts +11 -6
- package/corpus/core/src/client/AssistantChat.tsx +6 -2
- package/corpus/core/src/client/chat/markdown-renderer.tsx +1 -0
- package/corpus/core/src/client/index.ts +7 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +5 -5
- package/corpus/core/src/client/org/TeamPage.tsx +11 -3
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +216 -0
- package/corpus/core/src/client/settings/index.ts +5 -0
- package/corpus/core/src/file-upload/index.ts +1 -0
- package/corpus/core/src/file-upload/registry.ts +22 -6
- package/corpus/core/src/file-upload/types.ts +6 -1
- package/corpus/core/src/integrations/adapters/email.ts +26 -18
- package/corpus/core/src/integrations/adapters/slack.ts +8 -7
- package/corpus/core/src/integrations/adapters/telegram.ts +9 -11
- package/corpus/core/src/integrations/adapters/whatsapp.ts +12 -9
- package/corpus/core/src/integrations/plugin.ts +79 -13
- package/corpus/core/src/onboarding/default-steps.ts +6 -3
- package/corpus/core/src/onboarding/types.ts +1 -1
- package/corpus/core/src/org/handlers.ts +1 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +4 -7
- package/corpus/core/src/server/better-auth-instance.ts +19 -62
- package/corpus/core/src/server/core-routes-plugin.ts +93 -180
- package/corpus/core/src/server/create-server.ts +55 -116
- package/corpus/core/src/server/email-actions.ts +3 -6
- package/corpus/core/src/server/email.ts +52 -17
- package/corpus/core/src/server/index.ts +2 -1
- package/corpus/core/src/server/scoped-key-storage.ts +223 -0
- package/corpus/core/src/shared/agent-env.ts +3 -3
- package/corpus/core/src/sharing/actions/share-resource.ts +1 -1
- package/corpus/core/src/styles/agent-native.css +55 -3
- package/corpus/core/src/templates/workspace-root/AGENTS.md +3 -2
- package/corpus/core/src/templates/workspace-root/README.md +1 -1
- package/corpus/core/src/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
- package/corpus/core/src/terminal/pty-server.ts +3 -38
- package/corpus/core/src/triggers/dispatcher.ts +1 -2
- package/corpus/templates/.retired/issues/package.json +7 -0
- package/corpus/templates/.retired/meeting-notes/package.json +7 -0
- package/corpus/templates/.retired/recruiting/package.json +7 -0
- package/corpus/templates/.retired/scheduling/package.json +7 -0
- package/corpus/templates/.retired/voice/package.json +7 -0
- package/corpus/templates/analytics/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +0 -17
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +7 -1
- package/corpus/templates/analytics/app/i18n-data.ts +71 -2
- package/corpus/templates/analytics/app/pages/Settings.tsx +120 -73
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +0 -11
- package/corpus/templates/analytics/app/routes/catalog.tsx +33 -176
- package/corpus/templates/analytics/app/routes/team.tsx +3 -2
- package/corpus/templates/analytics/changelog/2026-06-26-dashboard-templates-are-tucked-into-settings-and-show-simple.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-26-the-sessions-page-shows-a-single-page-title-instead-of-repea.md +6 -0
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +37 -28
- package/corpus/templates/assets/app/routes/settings.tsx +65 -43
- package/corpus/templates/assets/app/routes/team.tsx +2 -10
- package/corpus/templates/brain/app/routes/settings.tsx +390 -358
- package/corpus/templates/brain/app/routes/team.tsx +2 -8
- package/corpus/templates/calendar/actions/db-connect.ts +5 -29
- package/corpus/templates/calendar/app/components/CloudUpgrade.tsx +8 -51
- package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +2 -1
- package/corpus/templates/calendar/app/components/calendar/GoogleSetupWizard.tsx +4 -2
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +0 -2
- package/corpus/templates/calendar/app/pages/Settings.tsx +304 -271
- package/corpus/templates/calendar/app/routes/_app.team.tsx +2 -17
- package/corpus/templates/calendar/server/handlers/google-auth.ts +22 -9
- package/corpus/templates/calendar/server/lib/booking-emails.ts +1 -1
- package/corpus/templates/calendar/server/lib/event-guest-notifications.ts +1 -1
- package/corpus/templates/calendar/server/lib/google-calendar.ts +48 -28
- package/corpus/templates/chat/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/chat/app/hooks/use-navigation-state.ts +4 -2
- package/corpus/templates/chat/app/routes/settings.tsx +54 -54
- package/corpus/templates/chat/app/routes/team.tsx +2 -10
- package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +7 -2
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +1 -1
- package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +7 -0
- package/corpus/templates/clips/AGENTS.md +8 -0
- package/corpus/templates/clips/actions/invite-member.ts +1 -1
- package/corpus/templates/clips/actions/request-transcript.ts +1 -1
- package/corpus/templates/clips/app/components/library/library-layout.tsx +3 -3
- package/corpus/templates/clips/app/components/player/transcript-panel.tsx +2 -0
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +629 -643
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +219 -155
- package/corpus/templates/clips/changelog/2026-06-26-long-desktop-recordings-are-checkpointed-so-macos-finalizati.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-non-mac-desktop-recordings-wait-for-upload-transcription.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-s3-compatible-storage-keys-now-save-securely-from-clips-sett.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-shared-clip-links-guide-agents-through-processing-transcripts.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-the-clip-details-sidebar-now-collapses-into-a-slide-out-pane.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-the-clips-library-now-matches-the-shared-recessed-shell-styl.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +55 -3
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +217 -5
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +176 -5
- package/corpus/templates/clips/server/lib/public-agent-context.ts +31 -0
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +60 -14
- package/corpus/templates/clips/server/lib/video-storage.ts +37 -9
- package/corpus/templates/clips/server/routes/api/agent-transcript.json.get.ts +5 -0
- package/corpus/templates/content/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/content/app/components/sidebar/NotionButton.tsx +1 -0
- package/corpus/templates/content/app/routes/_app.settings.tsx +54 -55
- package/corpus/templates/content/app/routes/_app.team.tsx +2 -28
- package/corpus/templates/content/server/lib/notion.ts +43 -11
- package/corpus/templates/content/server/routes/api/notion/auth-url.get.ts +2 -2
- package/corpus/templates/content/server/routes/api/notion/status.get.ts +3 -3
- package/corpus/templates/design/app/routes/settings.tsx +60 -38
- package/corpus/templates/design/app/routes/team.tsx +2 -10
- package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +2 -2
- package/corpus/templates/dispatch/app/routes/settings.tsx +70 -55
- package/corpus/templates/dispatch/app/routes/team.tsx +5 -1
- package/corpus/templates/forms/actions/db-connect.ts +7 -36
- package/corpus/templates/forms/actions/navigate.ts +2 -2
- package/corpus/templates/forms/app/components/CloudUpgrade.tsx +8 -47
- package/corpus/templates/forms/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/forms/app/components/layout/Layout.tsx +42 -25
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +35 -76
- package/corpus/templates/forms/app/global.css +9 -25
- package/corpus/templates/forms/app/hooks/use-navigation-state.ts +4 -4
- package/corpus/templates/forms/app/i18n/ar-SA.ts +1 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +1 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +1 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +1 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +1 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +1 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +1 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +1 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +1 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +1 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/forms/app/lib/route-prewarm.ts +9 -8
- package/corpus/templates/forms/app/pages/AskPage.tsx +70 -0
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +74 -81
- package/corpus/templates/forms/app/root.tsx +1 -1
- package/corpus/templates/forms/app/routes/_app.ask.tsx +14 -0
- package/corpus/templates/forms/app/routes/_app.settings.tsx +54 -54
- package/corpus/templates/forms/app/routes/_app.team.tsx +2 -9
- package/corpus/templates/forms/app/routes/_index.tsx +21 -130
- package/corpus/templates/forms/changelog/2026-06-26-ask-forms-opens-as-a-standard-app-tab-with-a-simpler-sidebar.md +6 -0
- package/corpus/templates/forms/changelog/2026-06-26-forms-are-shown-in-a-tighter-row-list-with-a-denser-sidebar.md +6 -0
- package/corpus/templates/forms/shared/navigation.ts +4 -2
- package/corpus/templates/macros/app/routes/settings.tsx +54 -54
- package/corpus/templates/macros/app/routes/team.tsx +2 -10
- package/corpus/templates/mail/actions/helpers.ts +2 -2
- package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +2 -1
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +5 -5
- package/corpus/templates/mail/app/routes/team.tsx +3 -2
- package/corpus/templates/mail/server/handlers/emails.ts +3 -2
- package/corpus/templates/mail/server/handlers/google-auth.ts +19 -12
- package/corpus/templates/mail/server/lib/automation-engine.ts +3 -2
- package/corpus/templates/mail/server/lib/email-state.ts +2 -3
- package/corpus/templates/mail/server/lib/google-auth.ts +28 -11
- package/corpus/templates/mail/server/lib/jobs.ts +3 -2
- package/corpus/templates/mail/server/onboarding.ts +9 -6
- package/corpus/templates/mail/server/routes/api/attachments.get.ts +3 -3
- package/corpus/templates/plan/actions/request-plan-access.ts +1 -1
- package/corpus/templates/plan/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/plan/app/hooks/use-navigation-state.ts +4 -2
- package/corpus/templates/plan/app/lib/route-prewarm.ts +0 -4
- package/corpus/templates/plan/app/routes/settings.tsx +75 -73
- package/corpus/templates/plan/app/routes/team.tsx +2 -8
- package/corpus/templates/plan/server/lib/comment-notifications.ts +1 -1
- package/corpus/templates/slides/actions/check-image-gen.ts +2 -1
- package/corpus/templates/slides/actions/db-connect.ts +7 -45
- package/corpus/templates/slides/actions/edit-image.ts +6 -3
- package/corpus/templates/slides/actions/generate-image-api.ts +1 -1
- package/corpus/templates/slides/actions/generate-image.ts +2 -2
- package/corpus/templates/slides/actions/generate-slides-ai.ts +5 -3
- package/corpus/templates/slides/actions/image-gen-status.ts +4 -3
- package/corpus/templates/slides/actions/image-search.ts +6 -3
- package/corpus/templates/slides/actions/search-images.ts +6 -3
- package/corpus/templates/slides/app/components/CloudUpgrade.tsx +8 -51
- package/corpus/templates/slides/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +0 -2
- package/corpus/templates/slides/app/routes/settings.tsx +54 -54
- package/corpus/templates/slides/app/routes/team.tsx +2 -12
- package/corpus/templates/slides/server/handlers/google-docs-auth.ts +9 -9
- package/corpus/templates/slides/server/handlers/image-gen.ts +5 -1
- package/corpus/templates/slides/server/handlers/image-providers/gemini.ts +9 -1
- package/corpus/templates/slides/server/handlers/image-providers/index.ts +18 -8
- package/corpus/templates/slides/server/handlers/image-providers/openai.ts +10 -4
- package/corpus/templates/slides/server/handlers/image-providers/types.ts +1 -0
- package/corpus/templates/slides/server/lib/google-docs-oauth.ts +59 -34
- package/corpus/templates/slides/server/register-secrets.ts +60 -0
- package/corpus/templates/videos/actions/db-connect.ts +7 -45
- package/corpus/templates/videos/app/components/CloudUpgrade.tsx +8 -51
- package/corpus/templates/videos/app/components/Sidebar.tsx +1 -9
- package/corpus/templates/videos/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +0 -3
- package/corpus/templates/videos/app/routes/settings.tsx +54 -54
- package/corpus/templates/videos/app/routes/team.tsx +2 -8
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +8 -3
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +3 -4
- package/dist/cli/mcp.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +6 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/chat/markdown-renderer.d.ts.map +1 -1
- package/dist/client/chat/markdown-renderer.js +1 -0
- package/dist/client/chat/markdown-renderer.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/org/OrgSwitcher.d.ts +3 -3
- package/dist/client/org/OrgSwitcher.js +2 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts +6 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +2 -2
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts +27 -0
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -0
- package/dist/client/settings/SettingsTabsPage.js +108 -0
- package/dist/client/settings/SettingsTabsPage.js.map +1 -0
- package/dist/client/settings/index.d.ts +1 -0
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js +1 -0
- package/dist/client/settings/index.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/index.d.ts +1 -1
- package/dist/file-upload/index.d.ts.map +1 -1
- package/dist/file-upload/index.js +1 -1
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/registry.d.ts +1 -0
- package/dist/file-upload/registry.d.ts.map +1 -1
- package/dist/file-upload/registry.js +24 -6
- package/dist/file-upload/registry.js.map +1 -1
- package/dist/file-upload/types.d.ts +6 -1
- package/dist/file-upload/types.d.ts.map +1 -1
- package/dist/file-upload/types.js.map +1 -1
- package/dist/integrations/adapters/email.d.ts.map +1 -1
- package/dist/integrations/adapters/email.js +18 -18
- package/dist/integrations/adapters/email.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +8 -7
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +9 -9
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
- package/dist/integrations/adapters/whatsapp.js +10 -9
- package/dist/integrations/adapters/whatsapp.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +47 -13
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/onboarding/default-steps.d.ts.map +1 -1
- package/dist/onboarding/default-steps.js +6 -5
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/onboarding/types.d.ts +1 -1
- package/dist/onboarding/types.d.ts.map +1 -1
- package/dist/onboarding/types.js.map +1 -1
- package/dist/org/handlers.js +1 -1
- package/dist/org/handlers.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +4 -6
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +17 -56
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +67 -153
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/create-server.d.ts +3 -9
- package/dist/server/create-server.d.ts.map +1 -1
- package/dist/server/create-server.js +37 -91
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/email-actions.d.ts +2 -3
- package/dist/server/email-actions.d.ts.map +1 -1
- package/dist/server/email-actions.js +3 -6
- package/dist/server/email-actions.js.map +1 -1
- package/dist/server/email.d.ts +3 -3
- package/dist/server/email.d.ts.map +1 -1
- package/dist/server/email.js +40 -19
- package/dist/server/email.js.map +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/scoped-key-storage.d.ts +22 -0
- package/dist/server/scoped-key-storage.d.ts.map +1 -0
- package/dist/server/scoped-key-storage.js +152 -0
- package/dist/server/scoped-key-storage.js.map +1 -0
- package/dist/shared/agent-env.d.ts +3 -3
- package/dist/shared/agent-env.d.ts.map +1 -1
- package/dist/shared/agent-env.js +3 -3
- package/dist/shared/agent-env.js.map +1 -1
- package/dist/sharing/actions/share-resource.js +1 -1
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/styles/agent-native.css +55 -3
- package/dist/templates/workspace-root/AGENTS.md +3 -2
- package/dist/templates/workspace-root/README.md +1 -1
- package/dist/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
- package/dist/terminal/pty-server.d.ts.map +1 -1
- package/dist/terminal/pty-server.js +3 -36
- package/dist/terminal/pty-server.js.map +1 -1
- package/dist/triggers/dispatcher.js +1 -1
- package/dist/triggers/dispatcher.js.map +1 -1
- package/docs/content/file-uploads.md +11 -4
- package/docs/content/locales/ar-SA/multi-app-workspace.md +3 -3
- package/docs/content/locales/de-DE/multi-app-workspace.md +3 -3
- package/docs/content/locales/es-ES/multi-app-workspace.md +3 -3
- package/docs/content/locales/fr-FR/multi-app-workspace.md +3 -3
- package/docs/content/locales/hi-IN/multi-app-workspace.md +3 -3
- package/docs/content/locales/ja-JP/multi-app-workspace.md +3 -3
- package/docs/content/locales/ko-KR/multi-app-workspace.md +3 -3
- package/docs/content/locales/pt-BR/multi-app-workspace.md +3 -3
- package/docs/content/locales/zh-CN/multi-app-workspace.md +3 -3
- package/docs/content/locales/zh-TW/multi-app-workspace.md +3 -3
- package/docs/content/multi-app-workspace.md +3 -3
- package/docs/content/template-clips.md +14 -5
- package/package.json +1 -1
- package/src/templates/workspace-root/AGENTS.md +3 -2
- package/src/templates/workspace-root/README.md +1 -1
- package/src/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
- package/corpus/core/src/server/env-var-writes.ts +0 -16
- package/corpus/templates/analytics/app/pages/Team.tsx +0 -9
- package/corpus/templates/calendar/app/pages/Team.tsx +0 -12
- package/corpus/templates/mail/app/pages/Team.tsx +0 -17
- package/dist/server/env-var-writes.d.ts +0 -10
- package/dist/server/env-var-writes.d.ts.map +0 -1
- package/dist/server/env-var-writes.js +0 -18
- package/dist/server/env-var-writes.js.map +0 -1
|
@@ -2,16 +2,18 @@ import { defineEventHandler, setResponseStatus, getMethod, getQuery } from "h3";
|
|
|
2
2
|
import { getRequestHeader } from "h3";
|
|
3
3
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
4
4
|
|
|
5
|
-
import { getOrgContext } from "../org/context.js";
|
|
5
|
+
import { getOrgContext, resolveOrgIdForEmail } from "../org/context.js";
|
|
6
6
|
import { loadResourcesForPrompt } from "../server/agent-chat-plugin.js";
|
|
7
7
|
import { withConfiguredAppBasePath } from "../server/app-base-path.js";
|
|
8
8
|
import { getSession } from "../server/auth.js";
|
|
9
9
|
import { FRAMEWORK_ROUTE_PREFIX } from "../server/core-routes-plugin.js";
|
|
10
|
+
import { resolveSecret } from "../server/credential-provider.js";
|
|
10
11
|
import {
|
|
11
12
|
getH3App,
|
|
12
13
|
markDefaultPluginProvided,
|
|
13
14
|
} from "../server/framework-request-handler.js";
|
|
14
15
|
import { readBody } from "../server/h3-helpers.js";
|
|
16
|
+
import { runWithRequestContext } from "../server/request-context.js";
|
|
15
17
|
import {
|
|
16
18
|
processA2AContinuationById,
|
|
17
19
|
processDueA2AContinuations,
|
|
@@ -175,6 +177,12 @@ type RemoteCodeCommandEnvelope = {
|
|
|
175
177
|
source?: unknown;
|
|
176
178
|
};
|
|
177
179
|
|
|
180
|
+
type IntegrationCredentialContext = {
|
|
181
|
+
userEmail: string;
|
|
182
|
+
orgId?: string;
|
|
183
|
+
isIntegrationCaller?: boolean;
|
|
184
|
+
};
|
|
185
|
+
|
|
178
186
|
const REMOTE_DEVICE_ONLINE_MS = 90_000;
|
|
179
187
|
|
|
180
188
|
export async function enqueueRemoteCommand(
|
|
@@ -517,8 +525,7 @@ export function createIntegrationsPlugin(
|
|
|
517
525
|
// init can leave us with an empty string forever. The getter
|
|
518
526
|
// re-resolves on every webhook so freshly-set secrets work without
|
|
519
527
|
// a redeploy.
|
|
520
|
-
const getApiKey = () =>
|
|
521
|
-
options?.apiKey ?? process.env.ANTHROPIC_API_KEY ?? "";
|
|
528
|
+
const getApiKey = () => options?.apiKey ?? "";
|
|
522
529
|
|
|
523
530
|
// Build the system prompt
|
|
524
531
|
const baseSystemPrompt = options?.systemPrompt ?? INTEGRATION_SYSTEM_PROMPT;
|
|
@@ -569,6 +576,39 @@ export function createIntegrationsPlugin(
|
|
|
569
576
|
};
|
|
570
577
|
}
|
|
571
578
|
|
|
579
|
+
function toCredentialContext(
|
|
580
|
+
ctx: { ownerEmail: string; orgId: string | null },
|
|
581
|
+
opts?: { isIntegrationCaller?: boolean },
|
|
582
|
+
): IntegrationCredentialContext {
|
|
583
|
+
return {
|
|
584
|
+
userEmail: ctx.ownerEmail,
|
|
585
|
+
...(ctx.orgId ? { orgId: ctx.orgId } : {}),
|
|
586
|
+
...(opts?.isIntegrationCaller ? { isIntegrationCaller: true } : {}),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async function credentialContextForIntegrationConfig(
|
|
591
|
+
config: Awaited<ReturnType<typeof getIntegrationConfig>>,
|
|
592
|
+
): Promise<IntegrationCredentialContext | null> {
|
|
593
|
+
const ownerEmail =
|
|
594
|
+
typeof config?.owner === "string" ? config.owner.trim() : "";
|
|
595
|
+
if (!ownerEmail) return null;
|
|
596
|
+
const orgId = await resolveOrgIdForEmail(ownerEmail).catch(() => null);
|
|
597
|
+
return {
|
|
598
|
+
userEmail: ownerEmail,
|
|
599
|
+
...(orgId ? { orgId } : {}),
|
|
600
|
+
isIntegrationCaller: true,
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
async function withCredentialContext<T>(
|
|
605
|
+
context: IntegrationCredentialContext | null,
|
|
606
|
+
fn: () => Promise<T>,
|
|
607
|
+
): Promise<T> {
|
|
608
|
+
if (!context) return fn();
|
|
609
|
+
return runWithRequestContext(context, fn);
|
|
610
|
+
}
|
|
611
|
+
|
|
572
612
|
async function requireRemoteDevice(event: any) {
|
|
573
613
|
const token = extractBearerToken(
|
|
574
614
|
getRequestHeader(event, "authorization"),
|
|
@@ -627,11 +667,15 @@ export function createIntegrationsPlugin(
|
|
|
627
667
|
setResponseStatus(event, 405);
|
|
628
668
|
return { error: "Method not allowed" };
|
|
629
669
|
}
|
|
630
|
-
if (!(await requireSession(event))) return { error: "unauthorized" };
|
|
631
670
|
const baseUrl = getBaseUrl(event);
|
|
671
|
+
const ctx = await requireSessionContext(event);
|
|
672
|
+
if (!ctx) return { error: "unauthorized" };
|
|
673
|
+
const credentialContext = toCredentialContext(ctx);
|
|
632
674
|
const statuses: IntegrationStatus[] = [];
|
|
633
675
|
for (const adapter of adapters) {
|
|
634
|
-
const status = await
|
|
676
|
+
const status = await withCredentialContext(credentialContext, () =>
|
|
677
|
+
adapter.getStatus(baseUrl),
|
|
678
|
+
);
|
|
635
679
|
const config = await getIntegrationConfig(adapter.platform);
|
|
636
680
|
status.enabled = !!config?.configData?.enabled;
|
|
637
681
|
status.webhookUrl = `${baseUrl}${P}/${adapter.platform}/webhook`;
|
|
@@ -1422,9 +1466,13 @@ export function createIntegrationsPlugin(
|
|
|
1422
1466
|
|
|
1423
1467
|
// ─── GET /:platform/status ─────────────────────────────
|
|
1424
1468
|
if (action === "status" && method === "GET") {
|
|
1425
|
-
|
|
1469
|
+
const ctx = await requireSessionContext(event);
|
|
1470
|
+
if (!ctx) return { error: "unauthorized" };
|
|
1426
1471
|
const baseUrl = getBaseUrl(event);
|
|
1427
|
-
const status = await
|
|
1472
|
+
const status = await withCredentialContext(
|
|
1473
|
+
toCredentialContext(ctx),
|
|
1474
|
+
() => adapter.getStatus(baseUrl),
|
|
1475
|
+
);
|
|
1428
1476
|
const config = await getIntegrationConfig(platform);
|
|
1429
1477
|
status.enabled = !!config?.configData?.enabled;
|
|
1430
1478
|
status.webhookUrl = `${baseUrl}${P}/${platform}/webhook`;
|
|
@@ -1482,14 +1530,20 @@ export function createIntegrationsPlugin(
|
|
|
1482
1530
|
return "ok";
|
|
1483
1531
|
}
|
|
1484
1532
|
|
|
1533
|
+
const config = await getIntegrationConfig(platform);
|
|
1534
|
+
const credentialContext =
|
|
1535
|
+
await credentialContextForIntegrationConfig(config);
|
|
1536
|
+
|
|
1485
1537
|
// Handle platform verification challenges (e.g. Slack url_verification)
|
|
1486
1538
|
// before checking enable state or parsing the message.
|
|
1487
|
-
const verification = await
|
|
1539
|
+
const verification = await withCredentialContext(
|
|
1540
|
+
credentialContext,
|
|
1541
|
+
() => adapter.handleVerification(event),
|
|
1542
|
+
);
|
|
1488
1543
|
if (verification.handled) {
|
|
1489
1544
|
return verification.response ?? "ok";
|
|
1490
1545
|
}
|
|
1491
1546
|
|
|
1492
|
-
const config = await getIntegrationConfig(platform);
|
|
1493
1547
|
if (!config?.configData?.enabled) {
|
|
1494
1548
|
setResponseStatus(event, 404);
|
|
1495
1549
|
return { error: `Integration ${platform} is not enabled` };
|
|
@@ -1500,13 +1554,17 @@ export function createIntegrationsPlugin(
|
|
|
1500
1554
|
// hangs on streaming providers), and that means handleWebhook's
|
|
1501
1555
|
// own verifyWebhook step is bypassed. Without this call anyone
|
|
1502
1556
|
// could POST a forged Slack/Telegram/email payload.
|
|
1503
|
-
const isValid = await
|
|
1557
|
+
const isValid = await withCredentialContext(credentialContext, () =>
|
|
1558
|
+
adapter.verifyWebhook(event),
|
|
1559
|
+
);
|
|
1504
1560
|
if (!isValid) {
|
|
1505
1561
|
setResponseStatus(event, 401);
|
|
1506
1562
|
return { error: "Invalid webhook signature" };
|
|
1507
1563
|
}
|
|
1508
1564
|
|
|
1509
|
-
const incoming = await
|
|
1565
|
+
const incoming = await withCredentialContext(credentialContext, () =>
|
|
1566
|
+
adapter.parseIncomingMessage(event),
|
|
1567
|
+
);
|
|
1510
1568
|
if (!incoming) {
|
|
1511
1569
|
setResponseStatus(event, 200);
|
|
1512
1570
|
return "ok";
|
|
@@ -1582,10 +1640,18 @@ export function createIntegrationsPlugin(
|
|
|
1582
1640
|
if (platform === "telegram") {
|
|
1583
1641
|
const baseUrl = getBaseUrl(event);
|
|
1584
1642
|
const webhookUrl = `${baseUrl}${P}/telegram/webhook`;
|
|
1585
|
-
const
|
|
1643
|
+
const ctx = await requireSessionContext(event);
|
|
1644
|
+
if (!ctx) return { error: "unauthorized" };
|
|
1645
|
+
const token = await withCredentialContext(
|
|
1646
|
+
toCredentialContext(ctx),
|
|
1647
|
+
() => resolveSecret("TELEGRAM_BOT_TOKEN"),
|
|
1648
|
+
);
|
|
1586
1649
|
if (!token) {
|
|
1587
1650
|
setResponseStatus(event, 400);
|
|
1588
|
-
return {
|
|
1651
|
+
return {
|
|
1652
|
+
error:
|
|
1653
|
+
"TELEGRAM_BOT_TOKEN not configured. Save it in settings.",
|
|
1654
|
+
};
|
|
1589
1655
|
}
|
|
1590
1656
|
try {
|
|
1591
1657
|
const res = await fetch(
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
canUseDeployCredentialFallbackForRequest,
|
|
19
19
|
readDeployCredentialEnv,
|
|
20
|
+
resolveSecret,
|
|
20
21
|
} from "../server/credential-provider.js";
|
|
21
22
|
import { getSetting } from "../settings/store.js";
|
|
22
23
|
import { registerOnboardingStep } from "./registry.js";
|
|
@@ -287,12 +288,14 @@ const emailStep: OnboardingStep = {
|
|
|
287
288
|
},
|
|
288
289
|
},
|
|
289
290
|
],
|
|
290
|
-
isComplete: () => {
|
|
291
|
-
if (
|
|
291
|
+
isComplete: async () => {
|
|
292
|
+
if (await resolveSecret("RESEND_API_KEY")) return true;
|
|
292
293
|
// SendGrid rejects Resend's sandbox sender, so EMAIL_FROM must also be
|
|
293
294
|
// set — otherwise sendEmail() throws at runtime even though the API key
|
|
294
295
|
// is configured.
|
|
295
|
-
if (
|
|
296
|
+
if (await resolveSecret("SENDGRID_API_KEY")) {
|
|
297
|
+
return !!(await resolveSecret("EMAIL_FROM"));
|
|
298
|
+
}
|
|
296
299
|
return false;
|
|
297
300
|
},
|
|
298
301
|
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
export type OnboardingMethodBadge = "recommended" | "beta" | "free" | "soon";
|
|
11
11
|
|
|
12
|
-
/** Fields for a form-style onboarding method (key/value
|
|
12
|
+
/** Fields for a form-style onboarding method (key/value secret entry). */
|
|
13
13
|
export interface OnboardingFormField {
|
|
14
14
|
key: string;
|
|
15
15
|
label: string;
|
|
@@ -5435,10 +5435,7 @@ export function createAgentChatPlugin(
|
|
|
5435
5435
|
// Sub-agents must inherit the parent run's resolved key so
|
|
5436
5436
|
// delegations spawned by agent-teams don't silently fall back
|
|
5437
5437
|
// to the platform key while the parent uses BYO credentials.
|
|
5438
|
-
apiKey:
|
|
5439
|
-
runCtx?.userApiKey ??
|
|
5440
|
-
options?.apiKey ??
|
|
5441
|
-
process.env.ANTHROPIC_API_KEY,
|
|
5438
|
+
apiKey: runCtx?.userApiKey ?? options?.apiKey,
|
|
5442
5439
|
})
|
|
5443
5440
|
);
|
|
5444
5441
|
},
|
|
@@ -6949,7 +6946,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6949
6946
|
const { getOwnerActiveApiKey } =
|
|
6950
6947
|
await import("../agent/production-agent.js");
|
|
6951
6948
|
const userApiKey = await getOwnerActiveApiKey(ownerEmail);
|
|
6952
|
-
const apiKey = userApiKey
|
|
6949
|
+
const apiKey = userApiKey;
|
|
6953
6950
|
if (!apiKey) {
|
|
6954
6951
|
// Fallback: truncate the message
|
|
6955
6952
|
return { title: cleanMessage.trim().slice(0, 60) };
|
|
@@ -7985,7 +7982,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
7985
7982
|
: await buildSchemaBlock(owner, databaseToolsMode);
|
|
7986
7983
|
return basePrompt + resources + schemaBlock;
|
|
7987
7984
|
},
|
|
7988
|
-
apiKey: options?.apiKey
|
|
7985
|
+
apiKey: options?.apiKey,
|
|
7989
7986
|
model: options?.model,
|
|
7990
7987
|
appId: options?.appId,
|
|
7991
7988
|
};
|
|
@@ -8084,7 +8081,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
8084
8081
|
: await buildSchemaBlock(owner, databaseToolsMode);
|
|
8085
8082
|
return basePrompt + resources + schemaBlock;
|
|
8086
8083
|
},
|
|
8087
|
-
apiKey: options?.apiKey
|
|
8084
|
+
apiKey: options?.apiKey,
|
|
8088
8085
|
model: options?.model,
|
|
8089
8086
|
appId: options?.appId,
|
|
8090
8087
|
});
|
|
@@ -125,6 +125,8 @@ export async function trackSignupEvent({
|
|
|
125
125
|
// Persistent auth secret
|
|
126
126
|
// ---------------------------------------------------------------------------
|
|
127
127
|
|
|
128
|
+
let inMemoryDevAuthSecret: string | undefined;
|
|
129
|
+
|
|
128
130
|
/**
|
|
129
131
|
* Resolve the Better Auth signing secret.
|
|
130
132
|
*
|
|
@@ -133,13 +135,9 @@ export async function trackSignupEvent({
|
|
|
133
135
|
* 2. Hosted workspace deploys can derive a per-purpose secret from the
|
|
134
136
|
* already-required `A2A_SECRET` root. This keeps fresh workspace branches
|
|
135
137
|
* bootable without reusing the raw A2A key as a cookie-signing key.
|
|
136
|
-
* 3. `.env.local` in the template cwd —
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* it's safe to persist credentials here.
|
|
140
|
-
* 4. Generate a new random 32-byte hex, write it to `.env.local`, and use
|
|
141
|
-
* it. Subsequent restarts re-read the same file — so session cookies
|
|
142
|
-
* signed by a previous boot remain valid across dev-server restarts.
|
|
138
|
+
* 3. Existing `.env.local` values in the template cwd — read-only
|
|
139
|
+
* compatibility for projects that already configured this secret.
|
|
140
|
+
* 4. Generate a per-process in-memory random 32-byte hex in development.
|
|
143
141
|
*
|
|
144
142
|
* Why this matters: before this helper existed, missing `BETTER_AUTH_SECRET`
|
|
145
143
|
* fell through to `GOOGLE_CLIENT_SECRET` / `ACCESS_TOKEN` / a hardcoded
|
|
@@ -147,8 +145,8 @@ export async function trackSignupEvent({
|
|
|
147
145
|
* boot would re-fall back to the hardcoded value (still stable) — but
|
|
148
146
|
* rotating Google credentials, toggling `ACCESS_TOKEN`, or churning the
|
|
149
147
|
* fallback chain would invalidate every signed cookie and force everyone
|
|
150
|
-
* to sign in again.
|
|
151
|
-
*
|
|
148
|
+
* to sign in again. We still read explicit env configuration, but never
|
|
149
|
+
* auto-write a generated secret into env files.
|
|
152
150
|
*/
|
|
153
151
|
function resolveAuthSecret(): string {
|
|
154
152
|
if (process.env.BETTER_AUTH_SECRET) return process.env.BETTER_AUTH_SECRET;
|
|
@@ -177,47 +175,26 @@ function resolveAuthSecret(): string {
|
|
|
177
175
|
);
|
|
178
176
|
}
|
|
179
177
|
|
|
180
|
-
// Dev: persist a generated secret to .env.local so sessions survive
|
|
181
|
-
// dev-server restarts. Falls back to an in-memory random secret only if
|
|
182
|
-
// the filesystem isn't writable (rare in dev, e.g. read-only mounts) —
|
|
183
|
-
// sessions reset on every dev-process restart in that case, which is
|
|
184
|
-
// fine.
|
|
185
|
-
//
|
|
186
178
|
// SECURITY (audit 09 LOW-2): the previous fallback chain
|
|
187
179
|
// (`GOOGLE_CLIENT_SECRET || ACCESS_TOKEN || hardcoded`) reused
|
|
188
180
|
// cross-purpose secrets and a public hardcoded literal as the cookie
|
|
189
181
|
// HMAC. Dropped entirely — better to mint an ephemeral secret than to
|
|
190
182
|
// re-use a Google client secret or a known string.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
process.env.BETTER_AUTH_SECRET = existing; // guard:allow-env-mutation — boot-time secret resolution from .env.local, runs once at module init
|
|
196
|
-
return existing;
|
|
197
|
-
}
|
|
183
|
+
const existing = readEnvLocalSecret(
|
|
184
|
+
path.resolve(process.cwd(), ".env.local"),
|
|
185
|
+
);
|
|
186
|
+
if (existing) return existing;
|
|
198
187
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
process.env.BETTER_AUTH_SECRET = generated; // guard:allow-env-mutation — boot-time secret generation, runs once at module init before any request
|
|
202
|
-
console.log(
|
|
203
|
-
"[agent-native] Generated a persistent BETTER_AUTH_SECRET in .env.local. " +
|
|
204
|
-
"Sessions will now survive dev-server restarts. " +
|
|
205
|
-
"(Delete .env.local to rotate; set BETTER_AUTH_SECRET in .env to override.)",
|
|
206
|
-
);
|
|
207
|
-
return generated;
|
|
208
|
-
} catch {
|
|
209
|
-
// Filesystem unwritable (read-only mount, sandboxed test env, etc.).
|
|
210
|
-
// Mint a per-process random secret so cookies stay unique per boot.
|
|
211
|
-
// Sessions reset when the dev process restarts — acceptable for dev.
|
|
212
|
-
const ephemeral = crypto.randomBytes(32).toString("hex");
|
|
188
|
+
if (!inMemoryDevAuthSecret) {
|
|
189
|
+
inMemoryDevAuthSecret = crypto.randomBytes(32).toString("hex");
|
|
213
190
|
console.warn(
|
|
214
|
-
"[agent-native]
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
191
|
+
"[agent-native] BETTER_AUTH_SECRET is not configured. Using an ephemeral " +
|
|
192
|
+
"in-memory development secret. Sessions will reset every time this " +
|
|
193
|
+
"process restarts. Set BETTER_AUTH_SECRET in your environment to keep " +
|
|
194
|
+
"sessions valid across restarts.",
|
|
218
195
|
);
|
|
219
|
-
return ephemeral;
|
|
220
196
|
}
|
|
197
|
+
return inMemoryDevAuthSecret;
|
|
221
198
|
}
|
|
222
199
|
|
|
223
200
|
function readEnvLocalSecret(envLocalPath: string): string | undefined {
|
|
@@ -234,26 +211,6 @@ function readEnvLocalSecret(envLocalPath: string): string | undefined {
|
|
|
234
211
|
}
|
|
235
212
|
}
|
|
236
213
|
|
|
237
|
-
function appendEnvLocalSecret(envLocalPath: string, secret: string): void {
|
|
238
|
-
const header =
|
|
239
|
-
"# Auto-generated by agent-native on first boot. Gitignored.\n" +
|
|
240
|
-
"# Keeps signed session cookies valid across dev-server restarts.\n" +
|
|
241
|
-
"# Delete this file (or this line) to rotate the secret.\n";
|
|
242
|
-
const line = `BETTER_AUTH_SECRET=${secret}\n`;
|
|
243
|
-
|
|
244
|
-
// If the file already exists, just append; otherwise create with header.
|
|
245
|
-
if (fs.existsSync(envLocalPath)) {
|
|
246
|
-
const existing = fs.readFileSync(envLocalPath, "utf8");
|
|
247
|
-
const needsLeadingNewline = existing.length > 0 && !existing.endsWith("\n");
|
|
248
|
-
fs.appendFileSync(
|
|
249
|
-
envLocalPath,
|
|
250
|
-
(needsLeadingNewline ? "\n" : "") + "\n" + header + line,
|
|
251
|
-
);
|
|
252
|
-
} else {
|
|
253
|
-
fs.writeFileSync(envLocalPath, header + line, { mode: 0o600 });
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
214
|
function normalizeTrackingSlug(value: string | undefined): string | undefined {
|
|
258
215
|
const trimmed = value?.trim();
|
|
259
216
|
if (!trimmed) return undefined;
|
|
@@ -912,7 +869,7 @@ async function createBetterAuthInstance(
|
|
|
912
869
|
const appUrl = getAppProductionUrl();
|
|
913
870
|
const cookieNamespace = resolveAuthCookieNamespace();
|
|
914
871
|
const requireEmailVerification =
|
|
915
|
-
isEmailConfigured() && !shouldSkipEmailVerification();
|
|
872
|
+
(await isEmailConfigured()) && !shouldSkipEmailVerification();
|
|
916
873
|
|
|
917
874
|
const shouldMirrorGoogleAccountTokens =
|
|
918
875
|
(config?.googleScopes?.length ?? 0) > 0;
|