@agent-native/core 0.134.1 → 0.135.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/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +107 -0
- package/corpus/core/package.json +3 -2
- package/corpus/core/src/automations/service.ts +41 -4
- package/corpus/core/src/cli/mcp-config-writers.ts +27 -21
- package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +187 -85
- package/corpus/core/src/client/agent-page/AutomationDetailsDialog.tsx +208 -0
- package/corpus/core/src/client/agent-page/AutomationScheduleDialog.tsx +180 -0
- package/corpus/core/src/client/agent-page/TimezoneSelect.tsx +241 -0
- package/corpus/core/src/client/agent-page/use-jobs.ts +50 -10
- package/corpus/core/src/client/org/OrgSwitcher.tsx +26 -0
- package/corpus/core/src/client/settings/AccountSettingsCard.tsx +35 -31
- package/corpus/core/src/client/settings/SchedulingTimezoneField.tsx +71 -0
- package/corpus/core/src/client/settings/SettingsRow.tsx +113 -0
- package/corpus/core/src/client/settings/agent-settings-search.ts +2 -1
- package/corpus/core/src/client/settings/index.ts +6 -0
- package/corpus/core/src/integrations/identity.ts +2 -12
- package/corpus/core/src/jobs/actions/list-automation-runs.ts +33 -0
- package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +27 -6
- package/corpus/core/src/jobs/actions/manage-recurring-job.ts +41 -9
- package/corpus/core/src/jobs/background-automation-runner.ts +88 -0
- package/corpus/core/src/jobs/cron.ts +52 -6
- package/corpus/core/src/jobs/frontmatter.ts +20 -0
- package/corpus/core/src/jobs/run-history.ts +242 -0
- package/corpus/core/src/jobs/scheduler.ts +73 -18
- package/corpus/core/src/jobs/tools.ts +54 -6
- package/corpus/core/src/localization/actions/get-localization-preference.ts +2 -2
- package/corpus/core/src/localization/actions/set-localization-preference.ts +49 -11
- package/corpus/core/src/localization/default-messages.ts +27 -0
- package/corpus/core/src/localization/shared.ts +39 -6
- package/corpus/core/src/localization/user-timezone.ts +36 -0
- package/corpus/core/src/org/app-roles-handlers.ts +1 -9
- package/corpus/core/src/org/index.ts +2 -0
- package/corpus/core/src/org/membership.ts +18 -0
- package/corpus/core/src/review/actions/create-review-comment.ts +4 -1
- package/corpus/core/src/review/actions/reply-review-comment.ts +4 -1
- package/corpus/core/src/review/index.ts +5 -0
- package/corpus/core/src/review/notifications.ts +163 -0
- package/corpus/core/src/review/types.ts +7 -0
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/activity-notifications.ts +174 -0
- package/corpus/core/src/server/app-name.ts +31 -0
- package/corpus/core/src/server/better-auth-instance.ts +4 -4
- package/corpus/core/src/server/email-templates.ts +70 -14
- package/corpus/core/src/server/email.ts +66 -3
- package/corpus/core/src/server/index.ts +10 -0
- package/corpus/core/src/sharing/index.ts +5 -0
- package/corpus/core/src/sharing/recipients.ts +67 -0
- package/corpus/core/src/triggers/actions/list-automations.ts +27 -8
- package/corpus/core/src/triggers/actions/manage-automation.ts +17 -6
- package/corpus/core/src/triggers/actions.ts +16 -4
- package/corpus/core/src/triggers/dispatcher.ts +44 -30
- package/corpus/core/src/triggers/routes.ts +19 -6
- package/corpus/core/src/vitest-config.ts +68 -0
- package/corpus/core/vitest.config.ts +5 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +37 -53
- package/corpus/templates/analytics/changelog/2026-08-01-new-error-alerts-now-reach-you-by-email-and-a-scheduled-dash.md +6 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +43 -0
- package/corpus/templates/analytics/server/lib/error-capture.ts +5 -1
- package/corpus/templates/analytics/vitest.config.ts +16 -12
- package/corpus/templates/assets/actions/refresh-generation-run.ts +3 -0
- package/corpus/templates/assets/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/assets/app/hooks/use-assets-prefs.ts +55 -0
- package/corpus/templates/assets/app/i18n-data.ts +30 -0
- package/corpus/templates/assets/app/routes/settings.tsx +58 -55
- package/corpus/templates/assets/changelog/2026-08-01-get-an-email-when-a-generation-you-started-finishes-or-fails.md +6 -0
- package/corpus/templates/assets/server/lib/generation-run-notifications.ts +89 -0
- package/corpus/templates/assets/server/lib/video-runs.ts +8 -1
- package/corpus/templates/assets/server/routes/_agent-native/assets/user-prefs.get.ts +17 -0
- package/corpus/templates/assets/server/routes/_agent-native/assets/user-prefs.put.ts +36 -0
- package/corpus/templates/assets/shared/assets-user-prefs.ts +10 -0
- package/corpus/templates/assets/vitest.config.ts +16 -12
- package/corpus/templates/brain/app/routes/settings.tsx +15 -15
- package/corpus/templates/brain/vitest.config.ts +16 -12
- package/corpus/templates/calendar/app/pages/Settings.tsx +32 -40
- package/corpus/templates/calendar/changelog/2026-08-01-language-and-appearance-now-sit-together-in-one-preferences-.md +6 -0
- package/corpus/templates/calendar/vitest.config.ts +16 -12
- package/corpus/templates/chat/app/routes/settings.tsx +14 -22
- package/corpus/templates/chat/vitest.config.ts +9 -0
- package/corpus/templates/clips/.agents/skills/video-editing/SKILL.md +31 -0
- package/corpus/templates/clips/AGENTS.md +1 -0
- package/corpus/templates/clips/actions/add-comment.ts +12 -1
- package/corpus/templates/clips/actions/create-meeting.ts +2 -2
- package/corpus/templates/clips/actions/create-recording.ts +2 -2
- package/corpus/templates/clips/actions/finalize-recording.ts +42 -6
- package/corpus/templates/clips/actions/generate-filmstrip.ts +154 -0
- package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -0
- package/corpus/templates/clips/actions/import-loom-recording.ts +2 -2
- package/corpus/templates/clips/actions/lib/ensure-recording-filmstrip.ts +258 -0
- package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +11 -3
- package/corpus/templates/clips/actions/react-to-comment.ts +13 -0
- package/corpus/templates/clips/actions/react-to-recording.ts +10 -1
- package/corpus/templates/clips/actions/reply-to-comment.ts +12 -1
- package/corpus/templates/clips/actions/stitch-recordings.ts +2 -2
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +152 -23
- package/corpus/templates/clips/app/components/editor/waveform.tsx +237 -75
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +23 -1
- package/corpus/templates/clips/app/components/settings/ai-setup-section.tsx +441 -0
- package/corpus/templates/clips/app/components/settings/slack-section.tsx +329 -0
- package/corpus/templates/clips/app/components/settings/types.ts +14 -0
- package/corpus/templates/clips/app/components/settings/video-storage-section.tsx +443 -0
- package/corpus/templates/clips/app/hooks/use-secret-status.ts +69 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +9 -1
- package/corpus/templates/clips/app/lib/video-filmstrip.ts +262 -0
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +165 -1351
- package/corpus/templates/clips/changelog/2026-07-27-saved-clips-now-resume-from-the-last-uploaded-byte-after-an-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-31-editor-timeline-now-shows-video-frames-behind-the-waveform-g.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-31-email-notifications-now-go-out-when-someone-comments-on-or-r.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-31-you-can-now-set-a-default-visibility-for-new-recordings-in-s.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-01-email-notifications-for-comments-and-reactions-now-actually-.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-03-the-desktop-app-now-opens-directly-beneath-its-tray-icon-on-.md +6 -0
- package/corpus/templates/clips/chrome-extension/package.json +1 -0
- package/corpus/templates/clips/chrome-extension/vitest.config.ts +9 -0
- package/corpus/templates/clips/desktop/package.json +1 -0
- package/corpus/templates/clips/desktop/src/app.tsx +17 -1
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +331 -36
- package/corpus/templates/clips/desktop/src/lib/upload-recovery.ts +129 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +815 -15
- package/corpus/templates/clips/desktop/src-tauri/src/tray.rs +61 -11
- package/corpus/templates/clips/desktop/vitest.config.ts +9 -0
- package/corpus/templates/clips/server/db/schema.ts +17 -0
- package/corpus/templates/clips/server/jobs/media-verification.ts +4 -0
- package/corpus/templates/clips/server/lib/activity-notifications.ts +185 -0
- package/corpus/templates/clips/server/lib/recording-media-cleanup.ts +2 -0
- package/corpus/templates/clips/server/lib/recording-upload-state.ts +46 -9
- package/corpus/templates/clips/server/lib/recordings.ts +24 -0
- package/corpus/templates/clips/server/lib/resumable-session.ts +10 -4
- package/corpus/templates/clips/server/lib/transactional-email-templates.ts +109 -0
- package/corpus/templates/clips/server/lib/upload-interruption.ts +8 -0
- package/corpus/templates/clips/server/lib/upload-lease.ts +50 -4
- package/corpus/templates/clips/server/lib/video-filmstrip-sprite.ts +207 -0
- package/corpus/templates/clips/server/lib/video-remux.ts +13 -4
- package/corpus/templates/clips/server/plugins/db.ts +16 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +4 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +123 -36
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +159 -29
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/interrupt.post.ts +197 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +193 -39
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/resume.get.ts +191 -12
- package/corpus/templates/clips/shared/clips-ai-prefs.ts +6 -0
- package/corpus/templates/clips/shared/feature-flags.ts +12 -0
- package/corpus/templates/clips/shared/recording-core.ts +4 -0
- package/corpus/templates/clips/vitest.config.ts +23 -19
- package/corpus/templates/content/actions/add-comment.ts +15 -1
- package/corpus/templates/content/actions/list-documents.ts +1 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +5 -2
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +50 -1
- package/corpus/templates/content/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/content/app/hooks/use-content-prefs.ts +55 -0
- package/corpus/templates/content/app/i18n-data.ts +40 -0
- package/corpus/templates/content/app/routes/_app.settings.tsx +47 -18
- package/corpus/templates/content/changelog/2026-07-30-breadcrumb-menus-now-hide-internal-system-pages.md +6 -0
- package/corpus/templates/content/changelog/2026-08-01-get-an-email-when-someone-comments-on-replies-in-or-mentions.md +6 -0
- package/corpus/templates/content/server/lib/comment-notifications.ts +146 -0
- package/corpus/templates/content/server/routes/_agent-native/content/user-prefs.get.ts +17 -0
- package/corpus/templates/content/server/routes/_agent-native/content/user-prefs.put.ts +36 -0
- package/corpus/templates/content/shared/content-user-prefs.ts +11 -0
- package/corpus/templates/content/vitest.config.ts +20 -16
- package/corpus/templates/crm/app/routes/settings.tsx +14 -22
- package/corpus/templates/crm/vitest.config.ts +8 -4
- package/corpus/templates/design/app/routes/settings.tsx +14 -22
- package/corpus/templates/design/changelog/2026-08-01-review-comments-replies-and-mentions-now-send-an-email-to-th.md +6 -0
- package/corpus/templates/design/vitest.config.ts +18 -12
- package/corpus/templates/dispatch/app/routes/settings.tsx +26 -40
- package/corpus/templates/dispatch/vitest.config.ts +11 -7
- package/corpus/templates/factory/app/routes/settings.tsx +14 -22
- package/corpus/templates/factory/vitest.config.ts +9 -0
- package/corpus/templates/forms/app/routes/_app.settings.tsx +14 -22
- package/corpus/templates/forms/vitest.config.ts +27 -23
- package/corpus/templates/macros/app/routes/settings.tsx +14 -22
- package/corpus/templates/macros/vitest.config.ts +16 -12
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +14 -16
- package/corpus/templates/mail/vitest.config.ts +16 -12
- package/corpus/templates/plan/app/routes/settings.tsx +30 -44
- package/corpus/templates/plan/vitest.config.ts +24 -20
- package/corpus/templates/slides/actions/add-slide-comment.ts +12 -1
- package/corpus/templates/slides/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/slides/app/hooks/use-slides-prefs.ts +55 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +4 -0
- package/corpus/templates/slides/app/routes/settings.tsx +45 -22
- package/corpus/templates/slides/changelog/2026-08-01-get-an-email-when-someone-comments-on-or-replies-in-your-dec.md +6 -0
- package/corpus/templates/slides/server/lib/comment-notifications.ts +182 -0
- package/corpus/templates/slides/server/routes/_agent-native/slides/user-prefs.get.ts +16 -0
- package/corpus/templates/slides/server/routes/_agent-native/slides/user-prefs.put.ts +36 -0
- package/corpus/templates/slides/shared/slides-user-prefs.ts +11 -0
- package/corpus/templates/slides/vitest.config.ts +17 -13
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/tasks/app/routes/settings.tsx +14 -22
- package/corpus/templates/tasks/vitest.config.ts +17 -13
- package/corpus/toolkit/CHANGELOG.md +9 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/vitest.config.ts +3 -0
- package/dist/automations/service.d.ts +2 -0
- package/dist/automations/service.d.ts.map +1 -1
- package/dist/automations/service.js +29 -4
- package/dist/automations/service.js.map +1 -1
- package/dist/cli/mcp-config-writers.d.ts.map +1 -1
- package/dist/cli/mcp-config-writers.js +24 -23
- package/dist/cli/mcp-config-writers.js.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.js +86 -29
- package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
- package/dist/client/agent-page/AutomationDetailsDialog.d.ts +21 -0
- package/dist/client/agent-page/AutomationDetailsDialog.d.ts.map +1 -0
- package/dist/client/agent-page/AutomationDetailsDialog.js +33 -0
- package/dist/client/agent-page/AutomationDetailsDialog.js.map +1 -0
- package/dist/client/agent-page/AutomationScheduleDialog.d.ts +15 -0
- package/dist/client/agent-page/AutomationScheduleDialog.d.ts.map +1 -0
- package/dist/client/agent-page/AutomationScheduleDialog.js +46 -0
- package/dist/client/agent-page/AutomationScheduleDialog.js.map +1 -0
- package/dist/client/agent-page/TimezoneSelect.d.ts +17 -0
- package/dist/client/agent-page/TimezoneSelect.d.ts.map +1 -0
- package/dist/client/agent-page/TimezoneSelect.js +107 -0
- package/dist/client/agent-page/TimezoneSelect.js.map +1 -0
- package/dist/client/agent-page/use-jobs.d.ts +20 -7
- package/dist/client/agent-page/use-jobs.d.ts.map +1 -1
- package/dist/client/agent-page/use-jobs.js +24 -4
- package/dist/client/agent-page/use-jobs.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +8 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +8 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/settings/AccountSettingsCard.d.ts.map +1 -1
- package/dist/client/settings/AccountSettingsCard.js +10 -9
- package/dist/client/settings/AccountSettingsCard.js.map +1 -1
- package/dist/client/settings/SchedulingTimezoneField.d.ts +10 -0
- package/dist/client/settings/SchedulingTimezoneField.d.ts.map +1 -0
- package/dist/client/settings/SchedulingTimezoneField.js +30 -0
- package/dist/client/settings/SchedulingTimezoneField.js.map +1 -0
- package/dist/client/settings/SettingsRow.d.ts +36 -0
- package/dist/client/settings/SettingsRow.d.ts.map +1 -0
- package/dist/client/settings/SettingsRow.js +15 -0
- package/dist/client/settings/SettingsRow.js.map +1 -0
- package/dist/client/settings/agent-settings-search.d.ts.map +1 -1
- package/dist/client/settings/agent-settings-search.js +1 -1
- package/dist/client/settings/agent-settings-search.js.map +1 -1
- 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/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/identity.d.ts.map +1 -1
- package/dist/integrations/identity.js +2 -11
- package/dist/integrations/identity.js.map +1 -1
- package/dist/jobs/actions/list-automation-runs.d.ts +8 -0
- package/dist/jobs/actions/list-automation-runs.d.ts.map +1 -0
- package/dist/jobs/actions/list-automation-runs.js +29 -0
- package/dist/jobs/actions/list-automation-runs.js.map +1 -0
- package/dist/jobs/actions/list-recurring-jobs.d.ts +2 -0
- package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -1
- package/dist/jobs/actions/list-recurring-jobs.js +20 -7
- package/dist/jobs/actions/list-recurring-jobs.js.map +1 -1
- package/dist/jobs/actions/manage-recurring-job.d.ts +2 -0
- package/dist/jobs/actions/manage-recurring-job.js +30 -9
- package/dist/jobs/actions/manage-recurring-job.js.map +1 -1
- package/dist/jobs/background-automation-runner.d.ts.map +1 -1
- package/dist/jobs/background-automation-runner.js +60 -0
- package/dist/jobs/background-automation-runner.js.map +1 -1
- package/dist/jobs/cron.d.ts +16 -2
- package/dist/jobs/cron.d.ts.map +1 -1
- package/dist/jobs/cron.js +43 -6
- package/dist/jobs/cron.js.map +1 -1
- package/dist/jobs/frontmatter.d.ts +12 -0
- package/dist/jobs/frontmatter.d.ts.map +1 -1
- package/dist/jobs/frontmatter.js +8 -0
- package/dist/jobs/frontmatter.js.map +1 -1
- package/dist/jobs/run-history.d.ts +56 -0
- package/dist/jobs/run-history.d.ts.map +1 -0
- package/dist/jobs/run-history.js +169 -0
- package/dist/jobs/run-history.js.map +1 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +51 -18
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +37 -6
- package/dist/jobs/tools.js.map +1 -1
- package/dist/localization/actions/get-localization-preference.d.ts +1 -2
- package/dist/localization/actions/get-localization-preference.d.ts.map +1 -1
- package/dist/localization/actions/get-localization-preference.js.map +1 -1
- package/dist/localization/actions/set-localization-preference.d.ts +3 -3
- package/dist/localization/actions/set-localization-preference.d.ts.map +1 -1
- package/dist/localization/actions/set-localization-preference.js +33 -8
- package/dist/localization/actions/set-localization-preference.js.map +1 -1
- package/dist/localization/default-messages.d.ts +25 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +25 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/localization/shared.d.ts +16 -1
- package/dist/localization/shared.d.ts.map +1 -1
- package/dist/localization/shared.js +22 -4
- package/dist/localization/shared.js.map +1 -1
- package/dist/localization/user-timezone.d.ts +11 -0
- package/dist/localization/user-timezone.d.ts.map +1 -0
- package/dist/localization/user-timezone.js +31 -0
- package/dist/localization/user-timezone.js.map +1 -0
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/org/app-roles-handlers.d.ts.map +1 -1
- package/dist/org/app-roles-handlers.js +1 -8
- package/dist/org/app-roles-handlers.js.map +1 -1
- package/dist/org/index.d.ts +1 -0
- package/dist/org/index.d.ts.map +1 -1
- package/dist/org/index.js +1 -0
- package/dist/org/index.js.map +1 -1
- package/dist/org/membership.d.ts +6 -0
- package/dist/org/membership.d.ts.map +1 -0
- package/dist/org/membership.js +16 -0
- package/dist/org/membership.js.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/review/actions/create-review-comment.d.ts +32 -1
- package/dist/review/actions/create-review-comment.d.ts.map +1 -1
- package/dist/review/actions/create-review-comment.js +3 -1
- package/dist/review/actions/create-review-comment.js.map +1 -1
- package/dist/review/actions/reply-review-comment.d.ts +32 -1
- package/dist/review/actions/reply-review-comment.d.ts.map +1 -1
- package/dist/review/actions/reply-review-comment.js +3 -1
- package/dist/review/actions/reply-review-comment.js.map +1 -1
- package/dist/review/index.d.ts +1 -0
- package/dist/review/index.d.ts.map +1 -1
- package/dist/review/index.js +1 -0
- package/dist/review/index.js.map +1 -1
- package/dist/review/notifications.d.ts +24 -0
- package/dist/review/notifications.d.ts.map +1 -0
- package/dist/review/notifications.js +123 -0
- package/dist/review/notifications.js.map +1 -0
- package/dist/review/types.d.ts +5 -0
- package/dist/review/types.d.ts.map +1 -1
- package/dist/review/types.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/activity-notifications.d.ts +61 -0
- package/dist/server/activity-notifications.d.ts.map +1 -0
- package/dist/server/activity-notifications.js +103 -0
- package/dist/server/activity-notifications.js.map +1 -0
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/app-name.d.ts +18 -0
- package/dist/server/app-name.d.ts.map +1 -1
- package/dist/server/app-name.js +31 -0
- package/dist/server/app-name.js.map +1 -1
- package/dist/server/better-auth-instance.js +4 -4
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/email-templates.d.ts +12 -0
- package/dist/server/email-templates.d.ts.map +1 -1
- package/dist/server/email-templates.js +57 -14
- package/dist/server/email-templates.js.map +1 -1
- package/dist/server/email.d.ts +12 -0
- package/dist/server/email.d.ts.map +1 -1
- package/dist/server/email.js +52 -5
- package/dist/server/email.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/sharing/index.d.ts +1 -0
- package/dist/sharing/index.d.ts.map +1 -1
- package/dist/sharing/index.js +1 -0
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing/recipients.d.ts +31 -0
- package/dist/sharing/recipients.d.ts.map +1 -0
- package/dist/sharing/recipients.js +40 -0
- package/dist/sharing/recipients.js.map +1 -0
- package/dist/templates/chat/app/routes/settings.tsx +14 -22
- package/dist/templates/chat/vitest.config.ts +9 -0
- package/dist/triggers/actions/list-automations.d.ts +2 -0
- package/dist/triggers/actions/list-automations.d.ts.map +1 -1
- package/dist/triggers/actions/list-automations.js +19 -8
- package/dist/triggers/actions/list-automations.js.map +1 -1
- package/dist/triggers/actions/manage-automation.d.ts +6 -0
- package/dist/triggers/actions/manage-automation.js +12 -6
- package/dist/triggers/actions/manage-automation.js.map +1 -1
- package/dist/triggers/actions.d.ts.map +1 -1
- package/dist/triggers/actions.js +15 -4
- package/dist/triggers/actions.js.map +1 -1
- package/dist/triggers/dispatcher.d.ts.map +1 -1
- package/dist/triggers/dispatcher.js +19 -17
- package/dist/triggers/dispatcher.js.map +1 -1
- package/dist/triggers/routes.d.ts.map +1 -1
- package/dist/triggers/routes.js +6 -6
- package/dist/triggers/routes.js.map +1 -1
- package/dist/vitest-config.d.ts +10 -0
- package/dist/vitest-config.d.ts.map +1 -0
- package/dist/vitest-config.js +55 -0
- package/dist/vitest-config.js.map +1 -0
- package/package.json +5 -4
- package/src/automations/service.ts +41 -4
- package/src/cli/mcp-config-writers.ts +27 -21
- package/src/client/agent-page/AgentJobsTab.tsx +187 -85
- package/src/client/agent-page/AutomationDetailsDialog.tsx +208 -0
- package/src/client/agent-page/AutomationScheduleDialog.tsx +180 -0
- package/src/client/agent-page/TimezoneSelect.tsx +241 -0
- package/src/client/agent-page/use-jobs.ts +50 -10
- package/src/client/org/OrgSwitcher.tsx +26 -0
- package/src/client/settings/AccountSettingsCard.tsx +35 -31
- package/src/client/settings/SchedulingTimezoneField.tsx +71 -0
- package/src/client/settings/SettingsRow.tsx +113 -0
- package/src/client/settings/agent-settings-search.ts +2 -1
- package/src/client/settings/index.ts +6 -0
- package/src/integrations/identity.ts +2 -12
- package/src/jobs/actions/list-automation-runs.ts +33 -0
- package/src/jobs/actions/list-recurring-jobs.ts +27 -6
- package/src/jobs/actions/manage-recurring-job.ts +41 -9
- package/src/jobs/background-automation-runner.ts +88 -0
- package/src/jobs/cron.ts +52 -6
- package/src/jobs/frontmatter.ts +20 -0
- package/src/jobs/run-history.ts +242 -0
- package/src/jobs/scheduler.ts +73 -18
- package/src/jobs/tools.ts +54 -6
- package/src/localization/actions/get-localization-preference.ts +2 -2
- package/src/localization/actions/set-localization-preference.ts +49 -11
- package/src/localization/default-messages.ts +27 -0
- package/src/localization/shared.ts +39 -6
- package/src/localization/user-timezone.ts +36 -0
- package/src/org/app-roles-handlers.ts +1 -9
- package/src/org/index.ts +2 -0
- package/src/org/membership.ts +18 -0
- package/src/review/actions/create-review-comment.ts +4 -1
- package/src/review/actions/reply-review-comment.ts +4 -1
- package/src/review/index.ts +5 -0
- package/src/review/notifications.ts +163 -0
- package/src/review/types.ts +7 -0
- package/src/server/action-discovery.ts +4 -0
- package/src/server/activity-notifications.ts +174 -0
- package/src/server/app-name.ts +31 -0
- package/src/server/better-auth-instance.ts +4 -4
- package/src/server/email-templates.ts +70 -14
- package/src/server/email.ts +66 -3
- package/src/server/index.ts +10 -0
- package/src/sharing/index.ts +5 -0
- package/src/sharing/recipients.ts +67 -0
- package/src/templates/chat/app/routes/settings.tsx +14 -22
- package/src/templates/chat/vitest.config.ts +9 -0
- package/src/triggers/actions/list-automations.ts +27 -8
- package/src/triggers/actions/manage-automation.ts +17 -6
- package/src/triggers/actions.ts +16 -4
- package/src/triggers/dispatcher.ts +44 -30
- package/src/triggers/routes.ts +19 -6
- package/src/vitest-config.ts +68 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared plumbing for collaboration emails (comments, replies, reactions,
|
|
3
|
+
* mentions).
|
|
4
|
+
*
|
|
5
|
+
* Two things every app was about to reimplement live here: resolving who
|
|
6
|
+
* should receive an activity email, and reporting delivery honestly. A
|
|
7
|
+
* workspace with no email provider is a *different* outcome from "nobody
|
|
8
|
+
* wanted this email" — collapsing both into an empty success is what let a
|
|
9
|
+
* dead notification toggle ship unnoticed.
|
|
10
|
+
*/
|
|
11
|
+
import { getUserSetting } from "../settings/user-settings.js";
|
|
12
|
+
import { isEmailConfigured } from "./email.js";
|
|
13
|
+
/** Default field read from an app's per-user preference blob. */
|
|
14
|
+
const DEFAULT_PREFERENCE_FIELD = "emailNotifications";
|
|
15
|
+
function normalizeEmail(value) {
|
|
16
|
+
return (value ?? "").trim().toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
async function wantsActivityEmail(email, preferenceKey, preferenceField) {
|
|
19
|
+
const prefs = await getUserSetting(email, preferenceKey);
|
|
20
|
+
// A user who never opened settings has no stored blob; treat that as opted
|
|
21
|
+
// in rather than silently dropping their notifications.
|
|
22
|
+
return prefs?.[preferenceField] !== false;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Normalize, dedupe, drop the actor, and filter by each recipient's stored
|
|
26
|
+
* preference. Order follows first appearance in `candidates`.
|
|
27
|
+
*/
|
|
28
|
+
export async function resolveActivityRecipients({ candidates, actorEmail, preferenceKey, preferenceField = DEFAULT_PREFERENCE_FIELD, }) {
|
|
29
|
+
const actor = normalizeEmail(actorEmail);
|
|
30
|
+
const unique = new Set();
|
|
31
|
+
for (const candidate of candidates) {
|
|
32
|
+
const email = normalizeEmail(candidate);
|
|
33
|
+
if (!email || email === actor || !email.includes("@"))
|
|
34
|
+
continue;
|
|
35
|
+
unique.add(email);
|
|
36
|
+
}
|
|
37
|
+
const decisions = await Promise.all([...unique].map(async (email) => (await wantsActivityEmail(email, preferenceKey, preferenceField))
|
|
38
|
+
? email
|
|
39
|
+
: null));
|
|
40
|
+
return decisions.filter((email) => email !== null);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolve recipients and deliver one email each. Returns a status that
|
|
44
|
+
* distinguishes "no email provider" from "nobody to email" from a real send.
|
|
45
|
+
*/
|
|
46
|
+
export async function notifyActivity({ send, logLabel, ...resolve }) {
|
|
47
|
+
if (!(await isEmailConfigured())) {
|
|
48
|
+
return { status: "email-not-configured", sent: [], failed: [] };
|
|
49
|
+
}
|
|
50
|
+
const recipients = await resolveActivityRecipients(resolve);
|
|
51
|
+
if (recipients.length === 0) {
|
|
52
|
+
return { status: "no-recipients", sent: [], failed: [] };
|
|
53
|
+
}
|
|
54
|
+
const sent = [];
|
|
55
|
+
const failed = [];
|
|
56
|
+
for (const to of recipients) {
|
|
57
|
+
try {
|
|
58
|
+
await send(to);
|
|
59
|
+
sent.push(to);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
failed.push({
|
|
63
|
+
email: to,
|
|
64
|
+
error: error instanceof Error ? error.message : String(error),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (failed.length > 0) {
|
|
69
|
+
console.error(`${logLabel ?? "[activity-notifications]"} delivery failed for ${failed
|
|
70
|
+
.map((failure) => `${failure.email} (${failure.error})`)
|
|
71
|
+
.join(", ")}`);
|
|
72
|
+
}
|
|
73
|
+
// Every recipient failing is an outage, not a delivery. Callers that log or
|
|
74
|
+
// surface this must not see it as the same outcome as a successful send.
|
|
75
|
+
return {
|
|
76
|
+
status: sent.length === 0 ? "delivery-failed" : "delivered",
|
|
77
|
+
sent,
|
|
78
|
+
failed,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Run an activity notification without letting it fail the write that caused
|
|
83
|
+
* it. The comment/reaction is already persisted by the time notification runs;
|
|
84
|
+
* rejecting here makes the client roll back and retry, which duplicates the
|
|
85
|
+
* row. The error still surfaces — as a distinct `notification-error` status,
|
|
86
|
+
* never as a silent success.
|
|
87
|
+
*/
|
|
88
|
+
export async function runActivityNotification(logLabel, resolve) {
|
|
89
|
+
try {
|
|
90
|
+
return await resolve();
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
94
|
+
console.error(`${logLabel} could not be resolved: ${message}`);
|
|
95
|
+
return {
|
|
96
|
+
status: "notification-error",
|
|
97
|
+
error: message,
|
|
98
|
+
sent: [],
|
|
99
|
+
failed: [],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=activity-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-notifications.js","sourceRoot":"","sources":["../../src/server/activity-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmB/C,iEAAiE;AACjE,MAAM,wBAAwB,GAAG,oBAAoB,C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IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,yEAAyE;IACzE,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW;QAC3D,IAAI;QACJ,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAO3C,QAAgB,EAChB,OAAyB;IAEzB,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,2BAA2B,OAAO,EAAE,CAAC,CAAC;QAC/D,OAAO;YACL,MAAM,EAAE,oBAAoB;YAC5B,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/**\n * Shared plumbing for collaboration emails (comments, replies, reactions,\n * mentions).\n *\n * Two things every app was about to reimplement live here: resolving who\n * should receive an activity email, and reporting delivery honestly. A\n * workspace with no email provider is a *different* outcome from \"nobody\n * wanted this email\" — collapsing both into an empty success is what let a\n * dead notification toggle ship unnoticed.\n */\n\nimport { getUserSetting } from \"../settings/user-settings.js\";\nimport { isEmailConfigured } from \"./email.js\";\n\nexport type ActivityDeliveryFailure = { email: string; error: string };\n\nexport type ActivityNotificationStatus =\n | \"delivered\"\n | \"delivery-failed\"\n | \"email-not-configured\"\n | \"no-recipients\"\n | \"notification-error\";\n\nexport type ActivityNotificationResult = {\n status: ActivityNotificationStatus;\n sent: string[];\n failed: ActivityDeliveryFailure[];\n /** Set only on `notification-error`: why recipients could not be resolved. */\n error?: string;\n};\n\n/** Default field read from an app's per-user preference blob. */\nconst DEFAULT_PREFERENCE_FIELD = \"emailNotifications\";\n\nexport interface ResolveActivityRecipientsInput {\n /** Owner, thread participants, mentions — duplicates and blanks are fine. */\n candidates: (string | null | undefined)[];\n /** The person who caused the activity. Never emailed about their own action. */\n actorEmail?: string | null;\n /** App-owned user settings key, e.g. `clips-user-prefs`. */\n preferenceKey: string;\n /** Field inside that blob. Absent or non-`false` means opted in. */\n preferenceField?: string;\n}\n\nfunction normalizeEmail(value: string | null | undefined): string {\n return (value ?? \"\").trim().toLowerCase();\n}\n\nasync function wantsActivityEmail(\n email: string,\n preferenceKey: string,\n preferenceField: string,\n): Promise<boolean> {\n const prefs = await getUserSetting(email, preferenceKey);\n // A user who never opened settings has no stored blob; treat that as opted\n // in rather than silently dropping their notifications.\n return prefs?.[preferenceField] !== false;\n}\n\n/**\n * Normalize, dedupe, drop the actor, and filter by each recipient's stored\n * preference. Order follows first appearance in `candidates`.\n */\nexport async function resolveActivityRecipients({\n candidates,\n actorEmail,\n preferenceKey,\n preferenceField = DEFAULT_PREFERENCE_FIELD,\n}: ResolveActivityRecipientsInput): Promise<string[]> {\n const actor = normalizeEmail(actorEmail);\n const unique = new Set<string>();\n for (const candidate of candidates) {\n const email = normalizeEmail(candidate);\n if (!email || email === actor || !email.includes(\"@\")) continue;\n unique.add(email);\n }\n\n const decisions = await Promise.all(\n [...unique].map(async (email) =>\n (await wantsActivityEmail(email, preferenceKey, preferenceField))\n ? email\n : null,\n ),\n );\n return decisions.filter((email): email is string => email !== null);\n}\n\nexport interface NotifyActivityInput extends ResolveActivityRecipientsInput {\n /** Sends one email. Throwing marks that recipient failed, not the batch. */\n send: (to: string) => Promise<unknown>;\n /** Prefix for the delivery-failure log line, e.g. `[slides]`. */\n logLabel?: string;\n}\n\n/**\n * Resolve recipients and deliver one email each. Returns a status that\n * distinguishes \"no email provider\" from \"nobody to email\" from a real send.\n */\nexport async function notifyActivity({\n send,\n logLabel,\n ...resolve\n}: NotifyActivityInput): Promise<ActivityNotificationResult> {\n if (!(await isEmailConfigured())) {\n return { status: \"email-not-configured\", sent: [], failed: [] };\n }\n\n const recipients = await resolveActivityRecipients(resolve);\n if (recipients.length === 0) {\n return { status: \"no-recipients\", sent: [], failed: [] };\n }\n\n const sent: string[] = [];\n const failed: ActivityDeliveryFailure[] = [];\n for (const to of recipients) {\n try {\n await send(to);\n sent.push(to);\n } catch (error) {\n failed.push({\n email: to,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n if (failed.length > 0) {\n console.error(\n `${logLabel ?? \"[activity-notifications]\"} delivery failed for ${failed\n .map((failure) => `${failure.email} (${failure.error})`)\n .join(\", \")}`,\n );\n }\n\n // Every recipient failing is an outage, not a delivery. Callers that log or\n // surface this must not see it as the same outcome as a successful send.\n return {\n status: sent.length === 0 ? \"delivery-failed\" : \"delivered\",\n sent,\n failed,\n };\n}\n\n/**\n * Run an activity notification without letting it fail the write that caused\n * it. The comment/reaction is already persisted by the time notification runs;\n * rejecting here makes the client roll back and retry, which duplicates the\n * row. The error still surfaces — as a distinct `notification-error` status,\n * never as a silent success.\n */\nexport async function runActivityNotification<\n T extends {\n status: string;\n sent: string[];\n failed: ActivityDeliveryFailure[];\n },\n>(\n logLabel: string,\n resolve: () => Promise<T>,\n): Promise<T | ActivityNotificationResult> {\n try {\n return await resolve();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`${logLabel} could not be resolved: ${message}`);\n return {\n status: \"notification-error\",\n error: message,\n sent: [],\n failed: [],\n };\n }\n}\n"]}
|
|
@@ -27,11 +27,11 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
27
27
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
28
|
error: any;
|
|
29
29
|
} | {
|
|
30
|
-
error?: undefined;
|
|
31
30
|
ok: boolean;
|
|
32
31
|
key: string;
|
|
33
32
|
baseUrlKey?: string;
|
|
34
33
|
scope: AgentEngineApiKeyScope;
|
|
34
|
+
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
|
37
37
|
//# sourceMappingURL=agent-engine-api-key-route.d.ts.map
|
|
@@ -13,4 +13,22 @@
|
|
|
13
13
|
* 5. `undefined` — caller should degrade gracefully
|
|
14
14
|
*/
|
|
15
15
|
export declare function getAppName(): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the app's slug — the machine-readable identifier used for the
|
|
18
|
+
* per-app transactional email sender (e.g. `clips@agent-native.com`).
|
|
19
|
+
*
|
|
20
|
+
* Only a first-party template name matched by package.json qualifies. A slug
|
|
21
|
+
* derived from an arbitrary `APP_NAME` must not mint a mailbox on the
|
|
22
|
+
* agent-native.com domain: a custom app would then send as
|
|
23
|
+
* `<its-name>@agent-native.com` and route replies to the Builder mailbox.
|
|
24
|
+
* Returns `undefined` for anything unrecognized, which leaves the deployment's
|
|
25
|
+
* configured sender in place.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAppSlug(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* One-line description of the app, used to tailor transactional email bodies
|
|
30
|
+
* so recipients recognize which app they signed up for. Sourced from the
|
|
31
|
+
* first-party template metadata; `undefined` for unknown apps.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getAppDescription(): string | undefined;
|
|
16
34
|
//# sourceMappingURL=app-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-name.d.ts","sourceRoot":"","sources":["../../src/server/app-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA0BH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAa/C"}
|
|
1
|
+
{"version":3,"file":"app-name.d.ts","sourceRoot":"","sources":["../../src/server/app-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA0BH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAa/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAI/C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAOtD"}
|
package/dist/server/app-name.js
CHANGED
|
@@ -49,4 +49,35 @@ export function getAppName() {
|
|
|
49
49
|
cachedFromPkg = name ?? undefined;
|
|
50
50
|
return name;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the app's slug — the machine-readable identifier used for the
|
|
54
|
+
* per-app transactional email sender (e.g. `clips@agent-native.com`).
|
|
55
|
+
*
|
|
56
|
+
* Only a first-party template name matched by package.json qualifies. A slug
|
|
57
|
+
* derived from an arbitrary `APP_NAME` must not mint a mailbox on the
|
|
58
|
+
* agent-native.com domain: a custom app would then send as
|
|
59
|
+
* `<its-name>@agent-native.com` and route replies to the Builder mailbox.
|
|
60
|
+
* Returns `undefined` for anything unrecognized, which leaves the deployment's
|
|
61
|
+
* configured sender in place.
|
|
62
|
+
*/
|
|
63
|
+
export function getAppSlug() {
|
|
64
|
+
const pkg = readPkg();
|
|
65
|
+
if (!pkg?.name)
|
|
66
|
+
return undefined;
|
|
67
|
+
return TEMPLATES.find((t) => t.name === pkg.name)?.name;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* One-line description of the app, used to tailor transactional email bodies
|
|
71
|
+
* so recipients recognize which app they signed up for. Sourced from the
|
|
72
|
+
* first-party template metadata; `undefined` for unknown apps.
|
|
73
|
+
*/
|
|
74
|
+
export function getAppDescription() {
|
|
75
|
+
const pkg = readPkg();
|
|
76
|
+
if (pkg?.name) {
|
|
77
|
+
const tmpl = TEMPLATES.find((t) => t.name === pkg.name);
|
|
78
|
+
if (tmpl)
|
|
79
|
+
return tmpl.hint;
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
52
83
|
//# sourceMappingURL=app-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AC;SAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/D,CAAC;IACD,aAAa,GAAG,IAAI,IAAI,SAAS,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Resolve the user-facing name of this app — used in transactional emails,\n * page titles, and anywhere the framework needs to refer to \"this app\" by\n * name (e.g. \"John invited you to Acme on Forms\").\n *\n * Resolution order:\n * 1. `APP_NAME` env var — explicit override (recommended for prod)\n * 2. `displayName` from the app's package.json\n * 3. Titlecased `name` from package.json (only if it matches a known\n * first-party template — on serverless runtimes `process.cwd()` may\n * point at a bundler-generated package.json with a bogus name)\n * 4. First-party template label matched by package.json name\n * 5. `undefined` — caller should degrade gracefully\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { TEMPLATES } from \"../cli/templates-meta.js\";\n\nlet cachedFromPkg: string | undefined | null = null;\n\nfunction readPkg(): { name?: string; displayName?: string } | null {\n try {\n const pkgPath = path.join(process.cwd(), \"package.json\");\n return JSON.parse(fs.readFileSync(pkgPath, \"utf8\"));\n } catch {\n return null;\n }\n}\n\nfunction titlecase(s: string): string {\n return s\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((w) => w[0].toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nexport function getAppName(): string | undefined {\n if (process.env.APP_NAME) return process.env.APP_NAME;\n if (cachedFromPkg !== null) return cachedFromPkg ?? undefined;\n const pkg = readPkg();\n let name: string | undefined;\n if (pkg?.displayName) {\n name = pkg.displayName;\n } else if (pkg?.name) {\n const tmpl = TEMPLATES.find((t) => t.name === pkg.name);\n name = tmpl ? tmpl.label || titlecase(tmpl.name) : undefined;\n }\n cachedFromPkg = name ?? undefined;\n return name;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-name.js","sourceRoot":"","sources":["../../src/server/app-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,IAAI,aAAa,GAA8B,IAAI,CAAC;AAEpD,SAAS,OAAO;IACd,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC;SACL,KAAK,CAAC,SAAS,CAAC;SAChB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IACtD,IAAI,aAAa,KAAK,IAAI;QAAE,OAAO,aAAa,IAAI,SAAS,CAAC;IAC9D,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,IAAI,IAAwB,CAAC;IAC7B,IAAI,GAAG,EAAE,WAAW,EAAE,CAAC;QACrB,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC;IACzB,CAAC;SAAM,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/D,CAAC;IACD,aAAa,GAAG,IAAI,IAAI,SAAS,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,IAAI,CAAC,GAAG,EAAE,IAAI;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;QACd,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC7B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Resolve the user-facing name of this app — used in transactional emails,\n * page titles, and anywhere the framework needs to refer to \"this app\" by\n * name (e.g. \"John invited you to Acme on Forms\").\n *\n * Resolution order:\n * 1. `APP_NAME` env var — explicit override (recommended for prod)\n * 2. `displayName` from the app's package.json\n * 3. Titlecased `name` from package.json (only if it matches a known\n * first-party template — on serverless runtimes `process.cwd()` may\n * point at a bundler-generated package.json with a bogus name)\n * 4. First-party template label matched by package.json name\n * 5. `undefined` — caller should degrade gracefully\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { TEMPLATES } from \"../cli/templates-meta.js\";\n\nlet cachedFromPkg: string | undefined | null = null;\n\nfunction readPkg(): { name?: string; displayName?: string } | null {\n try {\n const pkgPath = path.join(process.cwd(), \"package.json\");\n return JSON.parse(fs.readFileSync(pkgPath, \"utf8\"));\n } catch {\n return null;\n }\n}\n\nfunction titlecase(s: string): string {\n return s\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((w) => w[0].toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nexport function getAppName(): string | undefined {\n if (process.env.APP_NAME) return process.env.APP_NAME;\n if (cachedFromPkg !== null) return cachedFromPkg ?? undefined;\n const pkg = readPkg();\n let name: string | undefined;\n if (pkg?.displayName) {\n name = pkg.displayName;\n } else if (pkg?.name) {\n const tmpl = TEMPLATES.find((t) => t.name === pkg.name);\n name = tmpl ? tmpl.label || titlecase(tmpl.name) : undefined;\n }\n cachedFromPkg = name ?? undefined;\n return name;\n}\n\n/**\n * Resolve the app's slug — the machine-readable identifier used for the\n * per-app transactional email sender (e.g. `clips@agent-native.com`).\n *\n * Only a first-party template name matched by package.json qualifies. A slug\n * derived from an arbitrary `APP_NAME` must not mint a mailbox on the\n * agent-native.com domain: a custom app would then send as\n * `<its-name>@agent-native.com` and route replies to the Builder mailbox.\n * Returns `undefined` for anything unrecognized, which leaves the deployment's\n * configured sender in place.\n */\nexport function getAppSlug(): string | undefined {\n const pkg = readPkg();\n if (!pkg?.name) return undefined;\n return TEMPLATES.find((t) => t.name === pkg.name)?.name;\n}\n\n/**\n * One-line description of the app, used to tailor transactional email bodies\n * so recipients recognize which app they signed up for. Sourced from the\n * first-party template metadata; `undefined` for unknown apps.\n */\nexport function getAppDescription(): string | undefined {\n const pkg = readPkg();\n if (pkg?.name) {\n const tmpl = TEMPLATES.find((t) => t.name === pkg.name);\n if (tmpl) return tmpl.hint;\n }\n return undefined;\n}\n"]}
|
|
@@ -716,11 +716,11 @@ async function createBetterAuthInstance(config) {
|
|
|
716
716
|
process.env.APP_BASE_PATH ||
|
|
717
717
|
"").replace(/\/$/, "");
|
|
718
718
|
const resetUrl = `${appUrl}${appBasePath}/_agent-native/auth/reset?token=${encodeURIComponent(token)}`;
|
|
719
|
-
const { subject, html, text } = renderResetPasswordEmail({
|
|
719
|
+
const { subject, html, text, appSender } = renderResetPasswordEmail({
|
|
720
720
|
email: user.email,
|
|
721
721
|
resetUrl,
|
|
722
722
|
});
|
|
723
|
-
await sendEmail({ to: user.email, subject, html, text });
|
|
723
|
+
await sendEmail({ to: user.email, subject, html, text, appSender });
|
|
724
724
|
},
|
|
725
725
|
},
|
|
726
726
|
emailVerification: {
|
|
@@ -741,11 +741,11 @@ async function createBetterAuthInstance(config) {
|
|
|
741
741
|
const verifyUrl = verifyBasePath
|
|
742
742
|
? url.replace(/(\/\/[^/]+)(\/)/, `$1${verifyBasePath}$2`)
|
|
743
743
|
: url;
|
|
744
|
-
const { subject, html, text } = renderVerifySignupEmail({
|
|
744
|
+
const { subject, html, text, appSender } = renderVerifySignupEmail({
|
|
745
745
|
email: user.email,
|
|
746
746
|
verifyUrl,
|
|
747
747
|
});
|
|
748
|
-
await sendEmail({ to: user.email, subject, html, text });
|
|
748
|
+
await sendEmail({ to: user.email, subject, html, text, appSender });
|
|
749
749
|
},
|
|
750
750
|
},
|
|
751
751
|
socialProviders,
|