@agent-native/core 0.137.8 → 0.139.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-native.eject.json +2 -0
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +15 -0
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/analytics/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/analytics/AGENTS.md +2 -2
- package/corpus/templates/analytics/actions/get-first-party-analytics-health.ts +65 -0
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +3 -6
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -6
- package/corpus/templates/analytics/actions/provider-api-request.ts +3 -6
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +3 -3
- package/corpus/templates/analytics/agent-native.json +12 -0
- package/corpus/templates/analytics/app/i18n-data.ts +162 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +126 -1
- package/corpus/templates/analytics/changelog/2026-08-05-analytics-now-flags-neon-pressure-and-guides-high-volume-tra.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-05-first-party-analytics-uses-compact-rollups-for-faster-usage-.md +6 -0
- package/corpus/templates/analytics/server/db/schema.ts +52 -0
- package/corpus/templates/analytics/server/lib/credential-keys.ts +3 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +2 -0
- package/corpus/templates/analytics/server/lib/emails.ts +51 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-health.ts +397 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-rollups.ts +182 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +86 -15
- package/corpus/templates/analytics/server/lib/provider-api.ts +20 -1
- package/corpus/templates/analytics/server/lib/replay-storage.ts +1 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/analytics/server/plugins/db.ts +60 -0
- package/corpus/templates/analytics/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/assets/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/assets/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/assets/agent-native.json +12 -0
- package/corpus/templates/assets/server/lib/generation.ts +8 -8
- package/corpus/templates/assets/server/lib/storage.ts +1 -1
- package/corpus/templates/assets/server/plugins/onboarding.ts +1 -1
- package/corpus/templates/brain/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/brain/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/brain/agent-native.json +12 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/calendar/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/calendar/agent-native.json +12 -0
- package/corpus/templates/calendar/server/lib/booking-emails.ts +154 -70
- package/corpus/templates/calendar/server/lib/emails.ts +167 -0
- package/corpus/templates/calendar/server/lib/event-guest-notifications.ts +64 -28
- package/corpus/templates/calendar/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/chat/AGENTS.md +3 -0
- package/corpus/templates/chat/DESIGN.md +28 -0
- package/corpus/templates/chat/agent-native.json +12 -0
- package/corpus/templates/clips/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/clips/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/clips/actions/cleanup-transcript.ts +2 -2
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +3 -0
- package/corpus/templates/clips/actions/get-playback-position.ts +68 -0
- package/corpus/templates/clips/actions/import-loom-recording.ts +2 -2
- package/corpus/templates/clips/actions/invite-member.ts +39 -15
- package/corpus/templates/clips/actions/save-playback-position.ts +80 -0
- package/corpus/templates/clips/actions/set-thumbnail.ts +1 -1
- package/corpus/templates/clips/agent-native.json +12 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +54 -5
- package/corpus/templates/clips/app/hooks/use-playback-position.ts +188 -0
- package/corpus/templates/clips/app/hooks/use-view-tracking.ts +6 -24
- package/corpus/templates/clips/app/lib/playback-position.ts +99 -0
- package/corpus/templates/clips/app/lib/viewer-session.ts +29 -0
- package/corpus/templates/clips/changelog/2026-08-05-clip-buffering-now-uses-buffering-copy-after-playback.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-05-clips-remembers-your-playback-position-when-you-reopen-a-cli.md +6 -0
- package/corpus/templates/clips/learnings.defaults.md +1 -1
- package/corpus/templates/clips/server/db/schema.ts +18 -0
- package/corpus/templates/clips/server/lib/emails.ts +256 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +1 -1
- package/corpus/templates/clips/server/lib/transactional-email-templates.ts +24 -0
- package/corpus/templates/clips/server/lib/video-storage.ts +1 -1
- package/corpus/templates/clips/server/plugins/db.ts +15 -0
- package/corpus/templates/clips/server/plugins/transactional-email-catalog.ts +5 -0
- package/corpus/templates/clips/server/routes/api/media/index.post.ts +1 -1
- package/corpus/templates/content/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +13 -0
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/content/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/content/AGENTS.md +1 -0
- package/corpus/templates/content/actions/_content-database-mutation-lock.ts +41 -0
- package/corpus/templates/content/actions/_content-database-row-migration.ts +569 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +82 -36
- package/corpus/templates/content/actions/_database-utils.ts +5 -0
- package/corpus/templates/content/actions/_delete-content-space.ts +25 -11
- package/corpus/templates/content/actions/add-database-item.ts +60 -42
- package/corpus/templates/content/actions/attach-content-database-source.ts +2 -0
- package/corpus/templates/content/actions/configure-document-property.ts +99 -104
- package/corpus/templates/content/actions/delete-content-database.ts +19 -7
- package/corpus/templates/content/actions/delete-document-property.ts +47 -58
- package/corpus/templates/content/actions/delete-document.ts +390 -167
- package/corpus/templates/content/actions/disconnect-content-database-source.ts +41 -24
- package/corpus/templates/content/actions/duplicate-database-item.ts +63 -31
- package/corpus/templates/content/actions/duplicate-database-items.ts +86 -43
- package/corpus/templates/content/actions/duplicate-document-property.ts +37 -14
- package/corpus/templates/content/actions/migrate-content-database-rows.ts +830 -0
- package/corpus/templates/content/actions/move-database-item.ts +14 -0
- package/corpus/templates/content/actions/permanently-delete-document.ts +27 -6
- package/corpus/templates/content/actions/remove-database-items.ts +13 -0
- package/corpus/templates/content/actions/reorder-document-property.ts +45 -46
- package/corpus/templates/content/actions/set-document-property.ts +68 -28
- package/corpus/templates/content/actions/submit-content-database-form.ts +49 -0
- package/corpus/templates/content/actions/transcribe-media.ts +1 -1
- package/corpus/templates/content/agent-native.json +12 -0
- package/corpus/templates/content/app/components/editor/image-upload.ts +2 -2
- package/corpus/templates/content/app/i18n-data.ts +1 -1
- package/corpus/templates/content/changelog/2026-08-01-content-can-reorganize-every-row-in-an-existing-database-as-.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -1
- package/corpus/templates/content/parity/matrix.ts +4 -2
- package/corpus/templates/content/server/db/schema.ts +30 -0
- package/corpus/templates/content/server/lib/comment-notifications.ts +57 -26
- package/corpus/templates/content/server/lib/emails.ts +70 -0
- package/corpus/templates/content/server/plugins/db.ts +24 -0
- package/corpus/templates/content/server/plugins/onboarding.ts +2 -2
- package/corpus/templates/content/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/crm/agent-native.json +12 -0
- package/corpus/templates/design/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/design/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/design/CODE_NATIVE_DESIGN_STUDIO_IMPLEMENTATION_PLAN.md +2 -2
- package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +2 -2
- package/corpus/templates/design/actions/apply-design-token-edit.ts +1 -1
- package/corpus/templates/design/actions/capture-design-state.ts +1 -1
- package/corpus/templates/design/actions/connect-builder-app.ts +2 -2
- package/corpus/templates/design/actions/create-design-branch.ts +1 -1
- package/corpus/templates/design/actions/create-fusion-app.ts +3 -3
- package/corpus/templates/design/actions/deploy-design-preview.ts +1 -1
- package/corpus/templates/design/actions/get-component-details.ts +1 -1
- package/corpus/templates/design/actions/get-design-branch-diff.ts +1 -1
- package/corpus/templates/design/actions/index-components.ts +3 -3
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +1 -1
- package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +3 -3
- package/corpus/templates/design/actions/open-component-source.ts +1 -1
- package/corpus/templates/design/actions/update-design.ts +61 -0
- package/corpus/templates/design/agent-native.json +12 -0
- package/corpus/templates/design/app/components/design/edit-panel/component-section.tsx +1 -1
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +1 -1
- package/corpus/templates/design/scripts/qa-figma-stress-import.ts +1 -1
- package/corpus/templates/design/server/lib/figma-node-import.ts +1 -1
- package/corpus/templates/design/shared/design-source-capabilities.ts +25 -9
- package/corpus/templates/dispatch/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/dispatch/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/dispatch/agent-native.json +12 -0
- package/corpus/templates/dispatch/app/routes/transactional-email.$appId.$id.tsx +4 -0
- package/corpus/templates/dispatch/app/routes/transactional-email.tsx +4 -0
- package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/factory/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/factory/agent-native.json +12 -0
- package/corpus/templates/forms/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/forms/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/forms/actions/export-responses.ts +1 -1
- package/corpus/templates/forms/agent-native.json +12 -0
- package/corpus/templates/forms/server/lib/emails.ts +52 -0
- package/corpus/templates/forms/server/lib/response-email.ts +2 -0
- package/corpus/templates/forms/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/macros/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/macros/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/macros/agent-native.json +12 -0
- package/corpus/templates/mail/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/mail/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/mail/agent-native.json +12 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +1 -1
- package/corpus/templates/mail/server/lib/media-upload.ts +1 -1
- package/corpus/templates/plan/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/plan/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/plan/actions/request-plan-access.ts +33 -12
- package/corpus/templates/plan/agent-native.json +12 -0
- package/corpus/templates/plan/server/lib/comment-notifications.ts +53 -27
- package/corpus/templates/plan/server/lib/emails.ts +67 -0
- package/corpus/templates/plan/server/lib/plan-assets.ts +1 -1
- package/corpus/templates/plan/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/slides/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/slides/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/slides/actions/generate-image-api.ts +1 -1
- package/corpus/templates/slides/actions/generate-slides-ai.ts +1 -1
- package/corpus/templates/slides/actions/import-file.ts +2 -2
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +1 -1
- package/corpus/templates/slides/agent-native.json +12 -0
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +1 -1
- package/corpus/templates/slides/app/i18n/en-US.ts +2 -2
- package/corpus/templates/slides/app/lib/deck-sorting.ts +19 -0
- package/corpus/templates/slides/app/lib/image-drop-to-agent.ts +1 -1
- package/corpus/templates/slides/app/pages/Index.tsx +7 -2
- package/corpus/templates/slides/changelog/2026-08-05-decks-are-now-sorted-by-most-recently-updated.md +6 -0
- package/corpus/templates/slides/server/handlers/assets.ts +1 -1
- package/corpus/templates/slides/server/handlers/uploads.ts +1 -1
- package/corpus/templates/slides/server/lib/comment-notifications.ts +44 -21
- package/corpus/templates/slides/server/lib/emails.ts +40 -0
- package/corpus/templates/slides/server/plugins/transactional-emails.ts +5 -0
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/tasks/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/tasks/agent-native.json +12 -0
- package/dist/action.d.ts +6 -0
- package/dist/agent/engine/builder-engine.js +2 -2
- package/dist/agent/engine/credential-errors.d.ts +1 -1
- package/dist/agent/engine/credential-errors.js +2 -2
- package/dist/agent/production-agent.js +3 -2
- package/dist/brand-kit/fig/index.js +1 -1
- package/dist/cli/agent.js +45 -3
- package/dist/cli/code-agent-executor.js +2 -1
- package/dist/cli/create.d.ts +9 -1
- package/dist/cli/create.js +94 -1
- package/dist/cli/doctor.d.ts +8 -11
- package/dist/cli/doctor.js +92 -24
- package/dist/cli/index.js +6 -5
- package/dist/client/AgentAskPopover.d.ts +3 -1
- package/dist/client/AgentAskPopover.js +2 -2
- package/dist/client/AgentPanel.js +9 -3
- package/dist/client/AssistantChat.js +54 -33
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/RouteTransitionIndicator.d.ts +7 -0
- package/dist/client/RouteTransitionIndicator.js +31 -0
- package/dist/client/agent-engine-key.js +1 -1
- package/dist/client/app-providers.js +11 -2
- package/dist/client/chat/message-components.js +1 -1
- package/dist/client/chat/run-recovery.js +1 -1
- package/dist/client/chat/tool-call-display.d.ts +3 -1
- package/dist/client/chat/tool-call-display.js +4 -3
- package/dist/client/chat-model-groups.d.ts +6 -0
- package/dist/client/chat-model-groups.js +11 -0
- package/dist/client/error-format.js +1 -1
- package/dist/client/i18n.js +1 -1
- package/dist/client/onboarding/FirstRunOnboarding.d.ts +5 -1
- package/dist/client/onboarding/FirstRunOnboarding.js +29 -13
- package/dist/client/onboarding/first-run-enabled.d.ts +6 -1
- package/dist/client/onboarding/first-run-enabled.js +33 -3
- package/dist/client/onboarding/use-onboarding.js +16 -11
- package/dist/client/resources/mcp-integration-catalog.js +26 -0
- package/dist/client/resources/mcp-integration-logos.js +4 -0
- package/dist/client/route-warmup.js +56 -10
- package/dist/client/settings/AccountSettingsCard.js +78 -3
- package/dist/client/settings/SettingsPanel.js +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +2 -2
- package/dist/client/settings/useBuilderStatus.js +1 -1
- package/dist/client/setup-connections/useBuilderConnectCardController.js +1 -1
- package/dist/client/ui/index.d.ts +1 -0
- package/dist/client/ui/index.js +1 -0
- package/dist/client/uploads/upload-editor-image.js +1 -1
- package/dist/client/use-chat-threads.js +3 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/config.d.ts +48 -0
- package/dist/config.js +111 -0
- package/dist/db/migrations.js +5 -0
- package/dist/eject/provider-api-definitions.d.ts +1 -1
- package/dist/eject/provider-api-definitions.js +1 -0
- package/dist/eject/remote-mcp-presets.js +1 -0
- package/dist/email-catalog/actions/list-email-activity.d.ts +6 -0
- package/dist/email-catalog/actions/list-email-activity.js +15 -0
- package/dist/email-catalog/actions/list-email-engagement.d.ts +6 -0
- package/dist/email-catalog/actions/list-email-engagement.js +15 -0
- package/dist/email-catalog/actions/list-email-log.d.ts +8 -0
- package/dist/email-catalog/actions/list-email-log.js +22 -0
- package/dist/email-catalog/actions/list-transactional-emails.d.ts +23 -0
- package/dist/email-catalog/actions/list-transactional-emails.js +61 -0
- package/dist/email-catalog/actions/render-transactional-email-preview.d.ts +10 -0
- package/dist/email-catalog/actions/render-transactional-email-preview.js +24 -0
- package/dist/email-catalog/authorize.d.ts +2 -0
- package/dist/email-catalog/authorize.js +10 -0
- package/dist/email-catalog/log.d.ts +57 -0
- package/dist/email-catalog/log.js +117 -0
- package/dist/email-catalog/provider-metrics.d.ts +34 -0
- package/dist/email-catalog/provider-metrics.js +165 -0
- package/dist/email-catalog/registry.d.ts +79 -0
- package/dist/email-catalog/registry.js +71 -0
- package/dist/email-catalog/schema.d.ts +212 -0
- package/dist/email-catalog/schema.js +49 -0
- package/dist/email-catalog/system-emails.d.ts +14 -0
- package/dist/email-catalog/system-emails.js +68 -0
- package/dist/extensions/web-search-tool.js +2 -2
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.js +1 -1
- package/dist/file-upload/registry.js +1 -1
- package/dist/guards/index.d.ts +3 -0
- package/dist/guards/index.js +2 -0
- package/dist/guards/no-empty-migrations.d.ts +14 -0
- package/dist/guards/no-empty-migrations.js +126 -0
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/localization/default-messages.d.ts +69 -0
- package/dist/localization/default-messages.js +71 -2
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/onboarding/app-profile.js +1 -1
- package/dist/onboarding/plugin.d.ts +2 -0
- package/dist/onboarding/plugin.js +29 -2
- package/dist/org/handlers.js +8 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +13 -13
- package/dist/provider-api/index.d.ts +4 -4
- package/dist/provider-api/index.js +35 -0
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/resources/handlers.js +1 -1
- package/dist/scripts/docs/framework-search.d.ts +9 -0
- package/dist/scripts/docs/framework-search.js +239 -0
- package/dist/scripts/docs/index.js +1 -0
- package/dist/scripts/docs/search.d.ts +10 -0
- package/dist/scripts/docs/search.js +1 -1
- package/dist/scripts/docs/source-search.d.ts +10 -2
- package/dist/scripts/docs/source-search.js +108 -41
- package/dist/search-utils/index.d.ts +11 -0
- package/dist/search-utils/index.js +72 -0
- package/dist/server/action-change.d.ts +6 -0
- package/dist/server/action-change.js +28 -14
- package/dist/server/action-discovery.js +31 -0
- package/dist/server/action-routes.js +1 -0
- package/dist/server/agent-chat/browser-team-tools.js +1 -1
- package/dist/server/agent-chat/script-entries.js +43 -2
- package/dist/server/auth-login-mode.d.ts +8 -0
- package/dist/server/auth-login-mode.js +17 -0
- package/dist/server/auth.js +100 -15
- package/dist/server/better-auth-instance.d.ts +36 -0
- package/dist/server/better-auth-instance.js +42 -5
- package/dist/server/builder-design-systems.js +1 -1
- package/dist/server/core-routes-plugin.js +17 -14
- package/dist/server/credential-provider.js +3 -3
- package/dist/server/email-templates.d.ts +7 -0
- package/dist/server/email-templates.js +24 -0
- package/dist/server/email.d.ts +26 -0
- package/dist/server/email.js +66 -4
- package/dist/server/framework-request-handler.js +6 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/onboarding-html.d.ts +2 -0
- package/dist/server/onboarding-html.js +169 -8
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/realtime-voice.js +1 -1
- package/dist/server/sentry.d.ts +1 -1
- package/dist/server/transcribe-voice.js +3 -3
- package/dist/shared/first-run-onboarding.d.ts +1 -0
- package/dist/shared/first-run-onboarding.js +1 -0
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/chat/AGENTS.md +3 -0
- package/dist/templates/chat/DESIGN.md +28 -0
- package/dist/templates/chat/agent-native.json +12 -0
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/default/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/default/AGENTS.md +4 -0
- package/dist/templates/default/DESIGN.md +30 -0
- package/dist/templates/default/agent-native.json +9 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +2 -2
- package/dist/templates/default/app/i18n/de-DE.ts +2 -2
- package/dist/templates/default/app/i18n/en-US.ts +2 -2
- package/dist/templates/default/app/i18n/es-ES.ts +2 -2
- package/dist/templates/default/app/i18n/fr-FR.ts +2 -2
- package/dist/templates/default/app/i18n/hi-IN.ts +2 -2
- package/dist/templates/default/app/i18n/ja-JP.ts +2 -2
- package/dist/templates/default/app/i18n/ko-KR.ts +2 -2
- package/dist/templates/default/app/i18n/pt-BR.ts +2 -2
- package/dist/templates/default/app/i18n/zh-CN.ts +2 -2
- package/dist/templates/default/app/i18n/zh-TW.ts +1 -1
- package/dist/templates/default/package.json +1 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/headless/agent-native.json +9 -0
- package/dist/templates/headless/package.json +2 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/workspace-core/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/workspace-core/AGENTS.md +3 -0
- package/dist/templates/workspace-core/DESIGN.md +35 -0
- package/dist/templates/workspace-root/AGENTS.md +3 -0
- package/dist/templates/workspace-root/DESIGN.md +35 -0
- package/dist/templates/workspace-root/agent-native.json +9 -0
- package/dist/templates/workspace-root/package.json +3 -0
- package/dist/transcription/builder-transcription.js +1 -1
- package/dist/user-profile/actions/change-password.d.ts +8 -0
- package/dist/user-profile/actions/change-password.js +24 -0
- package/dist/user-profile/actions/get-auth-methods.d.ts +6 -0
- package/dist/user-profile/actions/get-auth-methods.js +23 -0
- package/dist/user-profile/actions/set-password.d.ts +7 -0
- package/dist/user-profile/actions/set-password.js +23 -0
- package/dist/vite/client.d.ts +8 -1
- package/dist/vite/client.js +63 -12
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/docs/AGENTS.md +7 -2
- package/docs/SKILL.md +7 -5
- package/docs/content/agent-native-config.mdx +165 -0
- package/docs/content/agent-native-toolkit.mdx +1 -1
- package/docs/content/deployment.mdx +7 -2
- package/docs/content/doctor.mdx +21 -13
- package/docs/content/environment-variables.mdx +158 -0
- package/docs/content/file-uploads.mdx +1 -1
- package/docs/content/getting-started.mdx +1 -1
- package/docs/content/key-concepts.mdx +1 -1
- package/docs/content/multi-app-workspace.mdx +1 -1
- package/docs/content/template-clips-ai-and-editing.mdx +6 -6
- package/docs/content/template-clips-developers.mdx +3 -3
- package/docs/content/toolkit-settings.mdx +1 -1
- package/docs/content/voice-input.mdx +4 -4
- package/package.json +7 -2
- package/src/eject/provider-api-definitions.ts +1 -0
- package/src/eject/remote-mcp-presets.ts +1 -0
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/chat/AGENTS.md +3 -0
- package/src/templates/chat/DESIGN.md +28 -0
- package/src/templates/chat/agent-native.json +12 -0
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/default/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/default/AGENTS.md +4 -0
- package/src/templates/default/DESIGN.md +30 -0
- package/src/templates/default/agent-native.json +9 -0
- package/src/templates/default/app/i18n/ar-SA.ts +2 -2
- package/src/templates/default/app/i18n/de-DE.ts +2 -2
- package/src/templates/default/app/i18n/en-US.ts +2 -2
- package/src/templates/default/app/i18n/es-ES.ts +2 -2
- package/src/templates/default/app/i18n/fr-FR.ts +2 -2
- package/src/templates/default/app/i18n/hi-IN.ts +2 -2
- package/src/templates/default/app/i18n/ja-JP.ts +2 -2
- package/src/templates/default/app/i18n/ko-KR.ts +2 -2
- package/src/templates/default/app/i18n/pt-BR.ts +2 -2
- package/src/templates/default/app/i18n/zh-CN.ts +2 -2
- package/src/templates/default/app/i18n/zh-TW.ts +1 -1
- package/src/templates/default/package.json +1 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/headless/agent-native.json +9 -0
- package/src/templates/headless/package.json +2 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/workspace-core/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/workspace-core/AGENTS.md +3 -0
- package/src/templates/workspace-core/DESIGN.md +35 -0
- package/src/templates/workspace-root/AGENTS.md +3 -0
- package/src/templates/workspace-root/DESIGN.md +35 -0
- package/src/templates/workspace-root/agent-native.json +9 -0
- package/src/templates/workspace-root/package.json +3 -0
package/dist/server/auth.js
CHANGED
|
@@ -54,6 +54,7 @@ import { normalizeWorkspaceAppAudience, workspaceAppAudienceFromEnv, workspaceAp
|
|
|
54
54
|
import { isValidWorkspaceAppIdFormat } from "../shared/workspace-app-id.js";
|
|
55
55
|
import { injectAnalyticsIntoHtml } from "./analytics.js";
|
|
56
56
|
import { readAnalyticsAnonymousId, signupAttributionFromCookieHeader, } from "./attribution.js";
|
|
57
|
+
import { getAuthLoginMode } from "./auth-login-mode.js";
|
|
57
58
|
import { ensureGoogleAuthIdentity, getBetterAuth, getBetterAuthSync, } from "./better-auth-instance.js";
|
|
58
59
|
import { BUILDER_CONNECT_OWNER_COOKIE, BUILDER_CONNECT_PARAM, BUILDER_RELAY_PATH, BUILDER_RELAY_STATE_PARAM, BUILDER_STATE_PARAM, verifyBuilderCallbackStateAndGetOwner, verifyBuilderConnectTokenAndGetOwner, verifyBuilderPreviewRelayStateForCallback, } from "./builder-browser.js";
|
|
59
60
|
import { resolveAuthCookieNamespace } from "./cookie-namespace.js";
|
|
@@ -791,8 +792,9 @@ function getRequestHost(event) {
|
|
|
791
792
|
getHeader(event, "host") ??
|
|
792
793
|
undefined);
|
|
793
794
|
}
|
|
794
|
-
function getOnboardingHtmlOptions(options, event, rawPath) {
|
|
795
|
+
function getOnboardingHtmlOptions(options, event, rawPath, authMode) {
|
|
795
796
|
return {
|
|
797
|
+
authMode,
|
|
796
798
|
googleOnly: options.googleOnly,
|
|
797
799
|
marketing: options.marketing,
|
|
798
800
|
googleSignInNotice: options.googleSignInNotice,
|
|
@@ -803,15 +805,16 @@ function getOnboardingHtmlOptions(options, event, rawPath) {
|
|
|
803
805
|
requestOrigin: event ? getOrigin(event) : undefined,
|
|
804
806
|
};
|
|
805
807
|
}
|
|
806
|
-
function getAuthOnboardingHtml(options, event, rawPath) {
|
|
807
|
-
return getOnboardingHtml(getOnboardingHtmlOptions(options, event, rawPath));
|
|
808
|
+
function getAuthOnboardingHtml(options, event, rawPath, authMode) {
|
|
809
|
+
return getOnboardingHtml(getOnboardingHtmlOptions(options, event, rawPath, authMode));
|
|
808
810
|
}
|
|
809
|
-
function getOnboardingLoginHtmlConfig(options) {
|
|
811
|
+
function getOnboardingLoginHtmlConfig(options, authMode) {
|
|
810
812
|
if (options.loginHtml)
|
|
811
|
-
return { loginHtml: options.loginHtml };
|
|
813
|
+
return { loginHtml: options.loginHtml, authMode };
|
|
812
814
|
return {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
+
authMode,
|
|
816
|
+
loginHtml: getAuthOnboardingHtml(options, undefined, undefined, authMode),
|
|
817
|
+
getLoginHtml: (event, rawPath) => getAuthOnboardingHtml(options, event, rawPath, authMode),
|
|
815
818
|
};
|
|
816
819
|
}
|
|
817
820
|
function resolveWorkspaceAppAudience(options = {}) {
|
|
@@ -1899,6 +1902,12 @@ function setFirstRunOnboardingCookie(event) {
|
|
|
1899
1902
|
maxAge: FIRST_RUN_ONBOARDING_MAX_AGE,
|
|
1900
1903
|
});
|
|
1901
1904
|
}
|
|
1905
|
+
function clearFirstRunOnboardingCookie(event) {
|
|
1906
|
+
deleteCookie(event, FIRST_RUN_ONBOARDING_COOKIE, {
|
|
1907
|
+
...crossSiteCookieAttrs(event),
|
|
1908
|
+
path: "/",
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1902
1911
|
export function setFrameworkSessionCookie(event, token) {
|
|
1903
1912
|
clearFrameworkSessionCookies(event);
|
|
1904
1913
|
setCookie(event, COOKIE_NAME, token, {
|
|
@@ -2456,12 +2465,16 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2456
2465
|
...(options.googleScopes ? { googleScopes: options.googleScopes } : {}),
|
|
2457
2466
|
};
|
|
2458
2467
|
const auth = await getBetterAuth(betterAuthConfig);
|
|
2468
|
+
const authLoginMode = typeof getAuthLoginMode === "function"
|
|
2469
|
+
? await getAuthLoginMode()
|
|
2470
|
+
: "password";
|
|
2459
2471
|
// Mount Better Auth catch-all handler at /_agent-native/auth/ba/*
|
|
2460
2472
|
app.use("/_agent-native/auth/ba", defineEventHandler(async (event) => {
|
|
2461
2473
|
const reqPath = event.url?.pathname ?? event.path ?? "";
|
|
2462
2474
|
const isResetPassword = reqPath.includes("reset-password") && getMethod(event) === "POST";
|
|
2463
2475
|
const isSendVerificationEmail = reqPath.includes("send-verification-email") &&
|
|
2464
2476
|
getMethod(event) === "POST";
|
|
2477
|
+
const isMagicLinkRequest = reqPath.includes("/sign-in/magic-link") && getMethod(event) === "POST";
|
|
2465
2478
|
const isSignOut = reqPath.includes("sign-out") && getMethod(event) === "POST";
|
|
2466
2479
|
if (isSignOut)
|
|
2467
2480
|
optOutOfAuthDisabledSession(event);
|
|
@@ -2471,7 +2484,8 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2471
2484
|
// wrapper. Check its password endpoints before handing the request to
|
|
2472
2485
|
// Better Auth so an org policy cannot be bypassed through the raw API.
|
|
2473
2486
|
if (reqPath.includes("/sign-in/email") ||
|
|
2474
|
-
reqPath.includes("/sign-up/email")
|
|
2487
|
+
reqPath.includes("/sign-up/email") ||
|
|
2488
|
+
isMagicLinkRequest) {
|
|
2475
2489
|
const body = (await authRequest
|
|
2476
2490
|
.clone()
|
|
2477
2491
|
.json()
|
|
@@ -2525,22 +2539,35 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2525
2539
|
// but the resend endpoint is exposed directly so users can request a
|
|
2526
2540
|
// fresh link while unauthenticated. Keep that path equally strict:
|
|
2527
2541
|
// only same-origin relative return paths survive into the email.
|
|
2528
|
-
if (isSendVerificationEmail) {
|
|
2542
|
+
if (isSendVerificationEmail || isMagicLinkRequest) {
|
|
2529
2543
|
try {
|
|
2530
2544
|
const body = (await authRequest
|
|
2531
2545
|
.clone()
|
|
2532
2546
|
.json()
|
|
2533
2547
|
.catch(() => undefined));
|
|
2534
|
-
if (body
|
|
2535
|
-
const
|
|
2536
|
-
|
|
2548
|
+
if (body) {
|
|
2549
|
+
const callbackKeys = isMagicLinkRequest
|
|
2550
|
+
? ["callbackURL", "newUserCallbackURL", "errorCallbackURL"]
|
|
2551
|
+
: ["callbackURL"];
|
|
2552
|
+
const sanitizedBody = { ...body };
|
|
2553
|
+
let changed = false;
|
|
2554
|
+
for (const key of callbackKeys) {
|
|
2555
|
+
if (typeof body[key] !== "string")
|
|
2556
|
+
continue;
|
|
2557
|
+
const callbackURL = safeReturnPath(body[key]);
|
|
2558
|
+
if (callbackURL !== body[key]) {
|
|
2559
|
+
sanitizedBody[key] = callbackURL;
|
|
2560
|
+
changed = true;
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
if (changed) {
|
|
2537
2564
|
const headers = new Headers(authRequest.headers);
|
|
2538
2565
|
headers.delete("content-length");
|
|
2539
2566
|
headers.set("content-type", "application/json");
|
|
2540
2567
|
requestForAuth = new Request(authRequest.url, {
|
|
2541
2568
|
method: authRequest.method,
|
|
2542
2569
|
headers,
|
|
2543
|
-
body: JSON.stringify(
|
|
2570
|
+
body: JSON.stringify(sanitizedBody),
|
|
2544
2571
|
duplex: "half",
|
|
2545
2572
|
});
|
|
2546
2573
|
}
|
|
@@ -2719,6 +2746,46 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2719
2746
|
return { error: authError.message };
|
|
2720
2747
|
}
|
|
2721
2748
|
}));
|
|
2749
|
+
// Passwordless login via Better Auth's rate-limited magic-link plugin.
|
|
2750
|
+
app.use("/_agent-native/auth/magic-link", defineEventHandler(async (event) => {
|
|
2751
|
+
if (getMethod(event) !== "POST") {
|
|
2752
|
+
setResponseStatus(event, 405);
|
|
2753
|
+
return { error: "Method not allowed" };
|
|
2754
|
+
}
|
|
2755
|
+
const body = await readBody(event);
|
|
2756
|
+
const rawEmail = typeof body?.email === "string" ? body.email : "";
|
|
2757
|
+
const email = normalizeAuthEmail(rawEmail);
|
|
2758
|
+
const callbackURL = typeof body?.callbackURL === "string"
|
|
2759
|
+
? safeReturnPath(body.callbackURL)
|
|
2760
|
+
: "/";
|
|
2761
|
+
if (!email) {
|
|
2762
|
+
setResponseStatus(event, 400);
|
|
2763
|
+
return { error: VALID_AUTH_EMAIL_MESSAGE };
|
|
2764
|
+
}
|
|
2765
|
+
if (await isGoogleSignInRequiredForEmail(email)) {
|
|
2766
|
+
setResponseStatus(event, 403);
|
|
2767
|
+
return { error: GOOGLE_AUTH_REQUIRED_MESSAGE };
|
|
2768
|
+
}
|
|
2769
|
+
try {
|
|
2770
|
+
await auth.api.signInMagicLink({
|
|
2771
|
+
body: {
|
|
2772
|
+
email,
|
|
2773
|
+
callbackURL,
|
|
2774
|
+
newUserCallbackURL: `${getAppBasePath()}/_agent-native/auth/magic-link/new-user?return=${encodeURIComponent(callbackURL)}`,
|
|
2775
|
+
},
|
|
2776
|
+
headers: event.headers,
|
|
2777
|
+
});
|
|
2778
|
+
return { ok: true };
|
|
2779
|
+
}
|
|
2780
|
+
catch (e) {
|
|
2781
|
+
if (!isExpectedAuthFailure(e)) {
|
|
2782
|
+
captureAuthError(e, { route: "magic-link", email });
|
|
2783
|
+
}
|
|
2784
|
+
const authError = publicAuthError(e, "Unable to send sign-in link");
|
|
2785
|
+
setResponseStatus(event, authError.statusCode ?? 400);
|
|
2786
|
+
return { error: authError.message };
|
|
2787
|
+
}
|
|
2788
|
+
}));
|
|
2722
2789
|
// Backward-compat: POST /_agent-native/auth/register
|
|
2723
2790
|
app.use("/_agent-native/auth/register", defineEventHandler(async (event) => {
|
|
2724
2791
|
if (getMethod(event) !== "POST") {
|
|
@@ -2770,6 +2837,7 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2770
2837
|
if (bearerToken)
|
|
2771
2838
|
await removeSession(bearerToken);
|
|
2772
2839
|
clearFrameworkSessionCookies(event);
|
|
2840
|
+
clearFirstRunOnboardingCookie(event);
|
|
2773
2841
|
optOutOfAuthDisabledSession(event);
|
|
2774
2842
|
try {
|
|
2775
2843
|
const result = await auth.api.signOut({
|
|
@@ -2838,6 +2906,7 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2838
2906
|
// 3. Drop the current request's cookie and best-effort sign out
|
|
2839
2907
|
// of Better Auth (so the response sets the proper expiry header).
|
|
2840
2908
|
clearFrameworkSessionCookies(event);
|
|
2909
|
+
clearFirstRunOnboardingCookie(event);
|
|
2841
2910
|
optOutOfAuthDisabledSession(event);
|
|
2842
2911
|
try {
|
|
2843
2912
|
const result = await auth.api.signOut({
|
|
@@ -2879,9 +2948,23 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2879
2948
|
headers: { "Content-Type": "text/html; charset=utf-8" },
|
|
2880
2949
|
});
|
|
2881
2950
|
}));
|
|
2951
|
+
// Better Auth redirects new magic-link users through this small public
|
|
2952
|
+
// callback so first-run onboarding is marked only for newly created users.
|
|
2953
|
+
app.use("/_agent-native/auth/magic-link/new-user", defineEventHandler(async (event) => {
|
|
2954
|
+
if (!isReadMethod(event)) {
|
|
2955
|
+
setResponseStatus(event, 405);
|
|
2956
|
+
return { error: "Method not allowed" };
|
|
2957
|
+
}
|
|
2958
|
+
const query = getQuery(event);
|
|
2959
|
+
const rawReturn = Array.isArray(query.return)
|
|
2960
|
+
? query.return[0]
|
|
2961
|
+
: query.return;
|
|
2962
|
+
setFirstRunOnboardingCookie(event);
|
|
2963
|
+
return redirectWithStagedCookies(event, safeReturnPath(rawReturn), 302);
|
|
2964
|
+
}));
|
|
2882
2965
|
// Auth guard — stored both in framework middleware registry AND in
|
|
2883
2966
|
// _authGuardFn so the server middleware can enforce it on ALL routes.
|
|
2884
|
-
const loginHtmlConfig = getOnboardingLoginHtmlConfig(options);
|
|
2967
|
+
const loginHtmlConfig = getOnboardingLoginHtmlConfig(options, authLoginMode);
|
|
2885
2968
|
_authGuardConfig = {
|
|
2886
2969
|
...loginHtmlConfig,
|
|
2887
2970
|
publicPaths,
|
|
@@ -2996,6 +3079,7 @@ function mountAuthFallbackRoutes(app) {
|
|
|
2996
3079
|
if (bearerToken)
|
|
2997
3080
|
await removeSession(bearerToken);
|
|
2998
3081
|
clearFrameworkSessionCookies(event);
|
|
3082
|
+
clearFirstRunOnboardingCookie(event);
|
|
2999
3083
|
optOutOfAuthDisabledSession(event);
|
|
3000
3084
|
try {
|
|
3001
3085
|
const auth = await getBetterAuth();
|
|
@@ -3064,7 +3148,7 @@ export async function autoMountAuth(app, options = {}) {
|
|
|
3064
3148
|
options.loginHtml ||
|
|
3065
3149
|
options.marketing ||
|
|
3066
3150
|
options.googleSignInNotice) {
|
|
3067
|
-
const loginHtmlConfig = getOnboardingLoginHtmlConfig(options);
|
|
3151
|
+
const loginHtmlConfig = getOnboardingLoginHtmlConfig(options, _authGuardConfig.authMode);
|
|
3068
3152
|
_authGuardConfig.loginHtml = loginHtmlConfig.loginHtml;
|
|
3069
3153
|
_authGuardConfig.getLoginHtml = loginHtmlConfig.getLoginHtml;
|
|
3070
3154
|
}
|
|
@@ -3130,6 +3214,7 @@ export async function autoMountAuth(app, options = {}) {
|
|
|
3130
3214
|
if (bearerToken)
|
|
3131
3215
|
await removeSession(bearerToken);
|
|
3132
3216
|
clearFrameworkSessionCookies(event);
|
|
3217
|
+
clearFirstRunOnboardingCookie(event);
|
|
3133
3218
|
optOutOfAuthDisabledSession(event);
|
|
3134
3219
|
if (isElectronRequest(event))
|
|
3135
3220
|
await clearDesktopSso();
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* implementation detail behind those interfaces.
|
|
7
7
|
*/
|
|
8
8
|
import { type BetterAuthOptions } from "better-auth";
|
|
9
|
+
export { getAuthLoginMode, resolveAuthLoginMode, resolveAuthLoginModeFromReadiness, type AuthLoginMode, } from "./auth-login-mode.js";
|
|
9
10
|
export declare function hasBetterAuthUserEmail(email: string): Promise<boolean>;
|
|
10
11
|
export declare function trackSignupEvent({ authProvider, authUserId, email, name, attribution, anonymousId, }: {
|
|
11
12
|
authProvider: string;
|
|
@@ -64,6 +65,41 @@ export interface BetterAuthInstance {
|
|
|
64
65
|
token?: string;
|
|
65
66
|
user?: any;
|
|
66
67
|
} | null>;
|
|
68
|
+
signInMagicLink: (opts: {
|
|
69
|
+
body: {
|
|
70
|
+
email: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
callbackURL?: string;
|
|
73
|
+
newUserCallbackURL?: string;
|
|
74
|
+
errorCallbackURL?: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
headers: Headers;
|
|
78
|
+
}) => Promise<{
|
|
79
|
+
status: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
listUserAccounts: (opts: {
|
|
82
|
+
headers: Headers;
|
|
83
|
+
}) => Promise<Array<{
|
|
84
|
+
providerId: string;
|
|
85
|
+
}>>;
|
|
86
|
+
setPassword: (opts: {
|
|
87
|
+
body: {
|
|
88
|
+
newPassword: string;
|
|
89
|
+
};
|
|
90
|
+
headers: Headers;
|
|
91
|
+
}) => Promise<{
|
|
92
|
+
status: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
changePassword: (opts: {
|
|
95
|
+
body: {
|
|
96
|
+
currentPassword: string;
|
|
97
|
+
newPassword: string;
|
|
98
|
+
};
|
|
99
|
+
headers: Headers;
|
|
100
|
+
}) => Promise<{
|
|
101
|
+
status: boolean;
|
|
102
|
+
}>;
|
|
67
103
|
signUpEmail: (opts: {
|
|
68
104
|
body: {
|
|
69
105
|
email: string;
|
|
@@ -11,12 +11,14 @@ import path from "node:path";
|
|
|
11
11
|
import { betterAuth } from "better-auth";
|
|
12
12
|
import { bearer } from "better-auth/plugins/bearer";
|
|
13
13
|
import { jwt } from "better-auth/plugins/jwt";
|
|
14
|
+
import { magicLink } from "better-auth/plugins/magic-link";
|
|
14
15
|
import { pgTable, text as pgText, timestamp as pgTimestamp, boolean as pgBoolean, } from "drizzle-orm/pg-core";
|
|
15
16
|
import { sqliteTable, text as sqliteText, integer as sqliteInteger, } from "drizzle-orm/sqlite-core";
|
|
16
17
|
import { TEMPLATES } from "../cli/templates-meta.js";
|
|
17
18
|
import { getDbExec, isPostgres } from "../db/client.js";
|
|
18
19
|
import { getDialect, getDatabaseUrl, getDatabaseAuthToken, closePgliteClients, getPgliteClient, isPgliteUrl, loadPgliteDrizzle, pgPoolOptions, neonPoolMax, attachNeonPoolErrorLogger, sharedDbPool, onSharedDbPoolsClosed, onSharedDbPoolReplaced, } from "../db/client.js";
|
|
19
20
|
import { ensureTableExists } from "../db/ddl-guard.js";
|
|
21
|
+
import { CORE_RESET_PASSWORD_EMAIL_ID, CORE_VERIFY_SIGNUP_EMAIL_ID, } from "../email-catalog/system-emails.js";
|
|
20
22
|
import { saveOAuthTokens } from "../oauth-tokens/store.js";
|
|
21
23
|
import { acceptPendingInvitationsForEmail } from "../org/accept-pending.js";
|
|
22
24
|
import { getAuthEmailForUserId, getRequiredAuthProviderForEmail, } from "../org/auth-policy.js";
|
|
@@ -26,9 +28,10 @@ import { getAppProductionUrl } from "./app-url.js";
|
|
|
26
28
|
import { readAnalyticsAnonymousId, signupAttributionFromCookieHeader, } from "./attribution.js";
|
|
27
29
|
import { resolveAuthCookieNamespace } from "./cookie-namespace.js";
|
|
28
30
|
import { getWorkspaceA2ADerivedSecret } from "./derived-secret.js";
|
|
29
|
-
import { renderResetPasswordEmail, renderVerifySignupEmail, } from "./email-templates.js";
|
|
30
|
-
import {
|
|
31
|
+
import { renderMagicLinkEmail, renderResetPasswordEmail, renderVerifySignupEmail, } from "./email-templates.js";
|
|
32
|
+
import { getEmailReadiness, sendEmail } from "./email.js";
|
|
31
33
|
import { resolveGoogleSignInCredentials } from "./google-oauth-credentials.js";
|
|
34
|
+
export { getAuthLoginMode, resolveAuthLoginMode, resolveAuthLoginModeFromReadiness, } from "./auth-login-mode.js";
|
|
32
35
|
async function flushSignupTracking() {
|
|
33
36
|
try {
|
|
34
37
|
await Promise.race([
|
|
@@ -889,7 +892,8 @@ async function createBetterAuthInstance(config) {
|
|
|
889
892
|
const secret = resolveAuthSecret();
|
|
890
893
|
const appUrl = getAppProductionUrl();
|
|
891
894
|
const cookieNamespace = resolveAuthCookieNamespace();
|
|
892
|
-
const
|
|
895
|
+
const emailReadiness = await getEmailReadiness();
|
|
896
|
+
const { requireEmailVerification, disableSignUp } = resolveEmailPasswordAuthPolicy(emailReadiness.status === "ready");
|
|
893
897
|
const shouldMirrorGoogleAccountTokens = (config?.googleScopes?.length ?? 0) > 0;
|
|
894
898
|
const auth = betterAuth({
|
|
895
899
|
basePath,
|
|
@@ -915,7 +919,14 @@ async function createBetterAuthInstance(config) {
|
|
|
915
919
|
email: user.email,
|
|
916
920
|
resetUrl,
|
|
917
921
|
});
|
|
918
|
-
await sendEmail({
|
|
922
|
+
await sendEmail({
|
|
923
|
+
to: user.email,
|
|
924
|
+
subject,
|
|
925
|
+
html,
|
|
926
|
+
text,
|
|
927
|
+
appSender,
|
|
928
|
+
templateId: CORE_RESET_PASSWORD_EMAIL_ID,
|
|
929
|
+
});
|
|
919
930
|
},
|
|
920
931
|
},
|
|
921
932
|
emailVerification: {
|
|
@@ -939,7 +950,14 @@ async function createBetterAuthInstance(config) {
|
|
|
939
950
|
email: user.email,
|
|
940
951
|
verifyUrl,
|
|
941
952
|
});
|
|
942
|
-
await sendEmail({
|
|
953
|
+
await sendEmail({
|
|
954
|
+
to: user.email,
|
|
955
|
+
subject,
|
|
956
|
+
html,
|
|
957
|
+
text,
|
|
958
|
+
appSender,
|
|
959
|
+
templateId: CORE_VERIFY_SIGNUP_EMAIL_ID,
|
|
960
|
+
});
|
|
943
961
|
},
|
|
944
962
|
},
|
|
945
963
|
socialProviders,
|
|
@@ -1111,6 +1129,25 @@ async function createBetterAuthInstance(config) {
|
|
|
1111
1129
|
: {}),
|
|
1112
1130
|
},
|
|
1113
1131
|
plugins: [
|
|
1132
|
+
magicLink({
|
|
1133
|
+
expiresIn: 60 * 5,
|
|
1134
|
+
storeToken: "hashed",
|
|
1135
|
+
rateLimit: { window: 60, max: 5 },
|
|
1136
|
+
disableSignUp,
|
|
1137
|
+
sendMagicLink: async ({ email, url }) => {
|
|
1138
|
+
const appBasePath = (process.env.VITE_APP_BASE_PATH ||
|
|
1139
|
+
process.env.APP_BASE_PATH ||
|
|
1140
|
+
"").replace(/\/$/, "");
|
|
1141
|
+
const magicLinkUrl = appBasePath
|
|
1142
|
+
? url.replace(/(\/\/[^/]+)(\/)/, `$1${appBasePath}$2`)
|
|
1143
|
+
: url;
|
|
1144
|
+
const { subject, html, text, appSender } = renderMagicLinkEmail({
|
|
1145
|
+
email,
|
|
1146
|
+
magicLinkUrl,
|
|
1147
|
+
});
|
|
1148
|
+
await sendEmail({ to: email, subject, html, text, appSender });
|
|
1149
|
+
},
|
|
1150
|
+
}),
|
|
1114
1151
|
// JWT: issue tokens for A2A calls, JWKS endpoint for verification
|
|
1115
1152
|
jwt({
|
|
1116
1153
|
jwt: {
|
|
@@ -112,7 +112,7 @@ async function resolveBuilderDesignSystemCredentials() {
|
|
|
112
112
|
if (!credentials.privateKey || !credentials.publicKey) {
|
|
113
113
|
throw new FeatureNotConfiguredError({
|
|
114
114
|
requiredCredential: "BUILDER_PRIVATE_KEY",
|
|
115
|
-
message: "Connect Builder.io before indexing a design system from Figma or code.",
|
|
115
|
+
message: "Connect Builder.io (free tier available) before indexing a design system from Figma or code.",
|
|
116
116
|
builderConnectUrl: "/_agent-native/builder/connect",
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -856,6 +856,21 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
856
856
|
paths: [FRAMEWORK_ROUTE_PREFIX, "/mcp", "/.well-known"],
|
|
857
857
|
});
|
|
858
858
|
try {
|
|
859
|
+
const P = FRAMEWORK_ROUTE_PREFIX;
|
|
860
|
+
// This response is a side-effect-free static contract used by the SSR
|
|
861
|
+
// shell. Mount it before optional default-plugin/bootstrap work so a
|
|
862
|
+
// browser's automatic rules fetch cannot inherit the cold-start wait.
|
|
863
|
+
getH3App(nitroApp).use(`${P}/speculation-rules.json`, defineEventHandler((event) => {
|
|
864
|
+
// `createH3SSRHandler` points the Speculation-Rules response header
|
|
865
|
+
// here to prevent Cloudflare Speed Brain from injecting its own
|
|
866
|
+
// edge prefetch rules. Keep this route public and side-effect free:
|
|
867
|
+
// browsers may request it while parsing any SSR HTML document.
|
|
868
|
+
setResponseHeader(event, "content-type", "application/speculationrules+json; charset=utf-8");
|
|
869
|
+
for (const [name, value] of Object.entries(resolveSsrCacheHeaders())) {
|
|
870
|
+
setResponseHeader(event, name, value);
|
|
871
|
+
}
|
|
872
|
+
return EMPTY_SPECULATION_RULES;
|
|
873
|
+
}));
|
|
859
874
|
await awaitBootstrap(nitroApp);
|
|
860
875
|
const { persistedEnvVars, builderDisconnected } = await readLegacyCoreRouteInitSettings();
|
|
861
876
|
// Legacy cleanup: key saves now go to scoped app_secrets rows. Do not
|
|
@@ -959,7 +974,6 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
959
974
|
catch {
|
|
960
975
|
// Audit module not available — skip
|
|
961
976
|
}
|
|
962
|
-
const P = FRAMEWORK_ROUTE_PREFIX;
|
|
963
977
|
for (const provider of [
|
|
964
978
|
"figma",
|
|
965
979
|
"google_drive",
|
|
@@ -1281,17 +1295,6 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
1281
1295
|
schema,
|
|
1282
1296
|
};
|
|
1283
1297
|
}));
|
|
1284
|
-
getH3App(nitroApp).use(`${P}/speculation-rules.json`, defineEventHandler((event) => {
|
|
1285
|
-
// `createH3SSRHandler` points the Speculation-Rules response header
|
|
1286
|
-
// here to prevent Cloudflare Speed Brain from injecting its own
|
|
1287
|
-
// edge prefetch rules. Keep this route public and side-effect free:
|
|
1288
|
-
// browsers may request it while parsing any SSR HTML document.
|
|
1289
|
-
setResponseHeader(event, "content-type", "application/speculationrules+json; charset=utf-8");
|
|
1290
|
-
for (const [name, value] of Object.entries(resolveSsrCacheHeaders())) {
|
|
1291
|
-
setResponseHeader(event, name, value);
|
|
1292
|
-
}
|
|
1293
|
-
return EMPTY_SPECULATION_RULES;
|
|
1294
|
-
}));
|
|
1295
1298
|
{
|
|
1296
1299
|
const { createAgentNativeOgImageHandler } = await import("./social-og-image.js");
|
|
1297
1300
|
getH3App(nitroApp).use(`${P}/og-image.png`, createAgentNativeOgImageHandler());
|
|
@@ -2339,7 +2342,7 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
2339
2342
|
if (!creds.privateKey || !creds.publicKey) {
|
|
2340
2343
|
setResponseStatus(event, 400);
|
|
2341
2344
|
return {
|
|
2342
|
-
error: "Builder not connected. Connect Builder in Setup to use background agent.",
|
|
2345
|
+
error: "Builder not connected. Connect Builder (free tier available) in Setup to use background agent.",
|
|
2343
2346
|
};
|
|
2344
2347
|
}
|
|
2345
2348
|
const body = (await readBody(event));
|
|
@@ -2743,7 +2746,7 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
2743
2746
|
}
|
|
2744
2747
|
setResponseStatus(event, 503);
|
|
2745
2748
|
return {
|
|
2746
|
-
error: "No file upload provider configured. Connect Builder.io in Settings → File uploads, or register a provider.",
|
|
2749
|
+
error: "No file upload provider configured. Connect Builder.io (free tier available) in Settings → File uploads, or register a provider.",
|
|
2747
2750
|
};
|
|
2748
2751
|
}));
|
|
2749
2752
|
// ─── Voice transcription (Whisper) ───────────────────────────────
|
|
@@ -42,7 +42,7 @@ export class FeatureNotConfiguredError extends Error {
|
|
|
42
42
|
byokDocsUrl;
|
|
43
43
|
constructor(opts) {
|
|
44
44
|
super(opts.message ??
|
|
45
|
-
`Feature requires credential "${opts.requiredCredential}". Connect Builder or set your own key.`);
|
|
45
|
+
`Feature requires credential "${opts.requiredCredential}". Connect Builder (free tier available) or set your own key.`);
|
|
46
46
|
this.name = "FeatureNotConfiguredError";
|
|
47
47
|
this.requiredCredential = opts.requiredCredential;
|
|
48
48
|
this.builderConnectUrl = opts.builderConnectUrl;
|
|
@@ -692,7 +692,7 @@ export async function getBuilderCredentialAuthFailure(creds = {}) {
|
|
|
692
692
|
fingerprint,
|
|
693
693
|
message: typeof row.message === "string" && row.message
|
|
694
694
|
? row.message
|
|
695
|
-
: "Builder rejected the connected credentials. Reconnect Builder.io.",
|
|
695
|
+
: "Builder rejected the connected credentials. Reconnect Builder.io (free tier available).",
|
|
696
696
|
status: typeof row.status === "number" ? row.status : undefined,
|
|
697
697
|
code: typeof row.code === "string" ? row.code : undefined,
|
|
698
698
|
at,
|
|
@@ -714,7 +714,7 @@ export async function recordBuilderCredentialAuthFailure(details) {
|
|
|
714
714
|
await putSetting(builderAuthFailureSettingKey(fingerprint), {
|
|
715
715
|
fingerprint,
|
|
716
716
|
message: details?.message ||
|
|
717
|
-
"Builder rejected the connected credentials. Reconnect Builder.io.",
|
|
717
|
+
"Builder rejected the connected credentials. Reconnect Builder.io (free tier available).",
|
|
718
718
|
...(typeof details?.status === "number" && { status: details.status }),
|
|
719
719
|
...(details?.code && { code: details.code }),
|
|
720
720
|
at: Date.now(),
|
|
@@ -45,6 +45,13 @@ export interface RenderVerifySignupEmailArgs {
|
|
|
45
45
|
verifyUrl: string;
|
|
46
46
|
}
|
|
47
47
|
export declare function renderVerifySignupEmail(args: RenderVerifySignupEmailArgs): RenderedEmailMessage;
|
|
48
|
+
export interface RenderMagicLinkEmailArgs {
|
|
49
|
+
/** The account email receiving the one-time sign-in link. */
|
|
50
|
+
email: string;
|
|
51
|
+
/** The full Better Auth URL containing the one-time token. */
|
|
52
|
+
magicLinkUrl: string;
|
|
53
|
+
}
|
|
54
|
+
export declare function renderMagicLinkEmail(args: RenderMagicLinkEmailArgs): RenderedEmailMessage;
|
|
48
55
|
export interface RenderResetPasswordEmailArgs {
|
|
49
56
|
/** The account email the reset is for. */
|
|
50
57
|
email: string;
|
|
@@ -103,6 +103,30 @@ export function renderVerifySignupEmail(args) {
|
|
|
103
103
|
: undefined,
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
+
export function renderMagicLinkEmail(args) {
|
|
107
|
+
const email = stripCrlf(args.email);
|
|
108
|
+
const slug = getAppSlug();
|
|
109
|
+
const brand = resolveBrand(slug);
|
|
110
|
+
const { html, text } = renderEmail({
|
|
111
|
+
brandName: brand,
|
|
112
|
+
preheader: `Sign in to ${brand} with your secure one-time link.`,
|
|
113
|
+
heading: `Sign in to ${brand}`,
|
|
114
|
+
paragraphs: [
|
|
115
|
+
`Use the button below to sign in as ${emailStrong(email)}. This link expires in 5 minutes and can only be used once.`,
|
|
116
|
+
`If you didn't request this email, you can safely ignore it.`,
|
|
117
|
+
],
|
|
118
|
+
cta: { label: "Sign in securely", url: args.magicLinkUrl },
|
|
119
|
+
footer: `For your security, never forward this email or share the link.`,
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
subject: `Your sign-in link for ${brand}`,
|
|
123
|
+
html,
|
|
124
|
+
text,
|
|
125
|
+
appSender: slug
|
|
126
|
+
? { name: brand, slug, replyTo: AGENT_NATIVE_REPLY_TO }
|
|
127
|
+
: undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
106
130
|
export function renderResetPasswordEmail(args) {
|
|
107
131
|
const email = stripCrlf(args.email);
|
|
108
132
|
// Match the verification email branding so password resets are clearly tied
|
package/dist/server/email.d.ts
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
* so the reset-password flow still works end-to-end for local development.
|
|
11
11
|
*/
|
|
12
12
|
export type EmailProvider = "resend" | "sendgrid" | "dev";
|
|
13
|
+
export type EmailReadiness = {
|
|
14
|
+
status: "ready";
|
|
15
|
+
provider: Exclude<EmailProvider, "dev">;
|
|
16
|
+
} | {
|
|
17
|
+
status: "not-configured";
|
|
18
|
+
provider: "dev";
|
|
19
|
+
} | {
|
|
20
|
+
status: "misconfigured" | "unavailable";
|
|
21
|
+
provider: EmailProvider | "unknown";
|
|
22
|
+
};
|
|
13
23
|
export interface EmailAttachment {
|
|
14
24
|
filename: string;
|
|
15
25
|
content: string | Buffer;
|
|
@@ -48,8 +58,24 @@ export interface SendEmailArgs {
|
|
|
48
58
|
references?: string;
|
|
49
59
|
attachments?: EmailAttachment[];
|
|
50
60
|
timeoutMs?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Registered transactional email id (see `defineTransactionalEmail`), e.g.
|
|
63
|
+
* `calendar.booking-confirmed`. Tags the message at the provider so delivery
|
|
64
|
+
* and open metrics attribute to one email instead of to the whole account,
|
|
65
|
+
* and keys the row written to `email_log`. Omit for genuinely one-off sends.
|
|
66
|
+
*/
|
|
67
|
+
templateId?: string;
|
|
68
|
+
/** App slug that owns the send. Defaults to the running app. */
|
|
69
|
+
app?: string;
|
|
51
70
|
}
|
|
52
71
|
export declare function isEmailConfigured(): Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Auth must only offer magic links when sending can succeed. In particular,
|
|
74
|
+
* SendGrid needs EMAIL_FROM while Resend can use its sandbox sender. Keep
|
|
75
|
+
* unreadable credential stores distinct from an unconfigured deployment so
|
|
76
|
+
* callers can fail closed without claiming setup is absent.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getEmailReadiness(): Promise<EmailReadiness>;
|
|
53
79
|
export declare function getEmailProvider(): Promise<EmailProvider>;
|
|
54
80
|
export declare function sendEmail(args: SendEmailArgs): Promise<void>;
|
|
55
81
|
//# sourceMappingURL=email.d.ts.map
|