@agent-native/core 0.90.11 → 0.91.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 +2 -2
- package/corpus/core/CHANGELOG.md +22 -0
- package/corpus/core/docs/content/toolkit-settings.mdx +56 -3
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/agent/run-ownership.ts +29 -1
- package/corpus/core/src/changelog/parse.ts +78 -0
- package/corpus/core/src/chat-threads/schema.ts +43 -0
- package/corpus/core/src/chat-threads/store.ts +144 -12
- package/corpus/core/src/cli/workspace-dev.ts +25 -5
- package/corpus/core/src/client/AgentPanel.tsx +79 -14
- package/corpus/core/src/client/AssistantChat.tsx +359 -425
- package/corpus/core/src/client/analytics-session.ts +70 -0
- package/corpus/core/src/client/analytics.ts +175 -49
- package/corpus/core/src/client/chat/message-components.tsx +22 -2
- package/corpus/core/src/client/components/ui/message-scroller.tsx +131 -0
- package/corpus/core/src/client/conversation/AgentConversation.tsx +63 -41
- package/corpus/core/src/client/error-capture.ts +616 -0
- package/corpus/core/src/client/index.ts +12 -0
- package/corpus/core/src/client/session-replay.ts +57 -7
- package/corpus/core/src/client/settings/SettingsPanel.tsx +123 -1
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +292 -45
- package/corpus/core/src/client/settings/index.ts +1 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +14 -11
- package/corpus/core/src/client/sharing/ShareDialog.tsx +13 -10
- package/corpus/core/src/mcp/builtin-tools.ts +29 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +174 -79
- package/corpus/core/src/server/onboarding-html.ts +28 -16
- package/corpus/core/src/sharing/actions/list-resource-shares.ts +45 -1
- package/corpus/core/src/sharing/actions/share-resource.ts +9 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
- package/corpus/core/src/vite/client.ts +217 -35
- package/corpus/templates/analytics/.agents/skills/adhoc-analysis/SKILL.md +8 -7
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +14 -10
- package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +15 -15
- package/corpus/templates/analytics/.agents/skills/cross-source-analysis/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +38 -22
- package/corpus/templates/analytics/.agents/skills/data-programs/SKILL.md +114 -61
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +7 -7
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/prometheus/SKILL.md +1 -1
- package/corpus/templates/analytics/.builder/skills/bigquery/SKILL.md +17 -17
- package/corpus/templates/analytics/.builder/skills/gcloud/SKILL.md +5 -5
- package/corpus/templates/analytics/.builder/skills/github/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/gong/SKILL.md +12 -12
- package/corpus/templates/analytics/.builder/skills/grafana/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/sentry/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/slack/SKILL.md +6 -6
- package/corpus/templates/analytics/.builder/skills/stripe/SKILL.md +7 -7
- package/corpus/templates/analytics/AGENTS.md +47 -2
- package/corpus/templates/analytics/actions/add-status-page-monitor.ts +36 -0
- package/corpus/templates/analytics/actions/capture-test-error.ts +33 -0
- package/corpus/templates/analytics/actions/delete-monitor.ts +24 -0
- package/corpus/templates/analytics/actions/delete-status-page.ts +23 -0
- package/corpus/templates/analytics/actions/get-error-issue.ts +36 -0
- package/corpus/templates/analytics/actions/get-monitor-stats.ts +55 -0
- package/corpus/templates/analytics/actions/get-monitor.ts +27 -0
- package/corpus/templates/analytics/actions/get-public-status-page.ts +41 -0
- package/corpus/templates/analytics/actions/get-status-page.ts +29 -0
- package/corpus/templates/analytics/actions/list-error-issues.ts +40 -0
- package/corpus/templates/analytics/actions/list-monitors.ts +21 -0
- package/corpus/templates/analytics/actions/list-status-pages.ts +21 -0
- package/corpus/templates/analytics/actions/match-error-issues.ts +51 -0
- package/corpus/templates/analytics/actions/navigate.ts +58 -4
- package/corpus/templates/analytics/actions/remove-status-page-monitor.ts +22 -0
- package/corpus/templates/analytics/actions/reorder-status-page-monitors.ts +25 -0
- package/corpus/templates/analytics/actions/resolve-error-issue.ts +38 -0
- package/corpus/templates/analytics/actions/run-monitor-check.ts +23 -0
- package/corpus/templates/analytics/actions/save-analysis.ts +1 -0
- package/corpus/templates/analytics/actions/save-monitor.ts +145 -0
- package/corpus/templates/analytics/actions/save-status-page.ts +47 -0
- package/corpus/templates/analytics/actions/view-screen.ts +212 -0
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +10 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +134 -39
- package/corpus/templates/analytics/app/components/monitoring/PublicStatusView.tsx +351 -0
- package/corpus/templates/analytics/app/components/monitoring/ResponseTimeChart.tsx +174 -0
- package/corpus/templates/analytics/app/components/monitoring/UptimeStatCards.tsx +85 -0
- package/corpus/templates/analytics/app/components/monitoring/UptimeTimelineBars.tsx +106 -0
- package/corpus/templates/analytics/app/components/monitoring/chart-utils.ts +101 -0
- package/corpus/templates/analytics/app/components/monitoring/index.ts +28 -0
- package/corpus/templates/analytics/app/components/monitoring/types.ts +42 -0
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +34 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +6 -0
- package/corpus/templates/analytics/app/i18n-data.ts +33 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +28 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +77 -9
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +3 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-layout.ts +7 -0
- package/corpus/templates/analytics/app/pages/monitoring/ErrorsPanel.tsx +205 -0
- package/corpus/templates/analytics/app/pages/monitoring/MonitoringPage.tsx +100 -0
- package/corpus/templates/analytics/app/pages/monitoring/UptimePanel.tsx +475 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueDetail.tsx +372 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueList.tsx +360 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/Sparkline.tsx +55 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/i18n.ts +106 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/types.ts +75 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/utils.ts +132 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorDetail.tsx +535 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorFormPage.tsx +1026 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorList.tsx +311 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/i18n.ts +235 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/StatusPageEditor.tsx +661 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/StatusPagesView.tsx +355 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/i18n.ts +106 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/slug.ts +24 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/types.ts +20 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-summary.ts +87 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/types.ts +161 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/utils.ts +210 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +76 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +74 -9
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +197 -20
- package/corpus/templates/analytics/app/root.tsx +33 -1
- package/corpus/templates/analytics/app/routes/monitoring._index.tsx +10 -0
- package/corpus/templates/analytics/app/routes/status.$slug.tsx +118 -0
- package/corpus/templates/analytics/changelog/2026-07-08-add-uptime-monitors-that-ping-your-urls-and-alert-you-when-t.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-analytics-chats-keep-large-data-dictionaries-compact-so-prov.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-create-public-status-pages-that-share-the-live-health-of-cho.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-dashboard-extension-panels-use-clearer-open-copy.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-error-capture.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-fixed-single-panel-dashboard-drags-so-they-no-longer-rewrite.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-jump-straight-from-an-error-in-a-session-recording-to-its-fu.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-monitor-detail-and-list-now-show-colorful-uptime-timelines-r.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-pinned-ask-chats-now-show-a-pin-icon-in-the-sidebar.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-publish-a-public-uptime-status-page-with-colorful-uptime-tim.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-sessions-now-hide-visitor-emails-in-demo-mode-and-show-clean.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-settings-are-cleaner-searchable-and-alerts-have-their-own-tab.md +5 -0
- package/corpus/templates/analytics/changelog/2026-07-08-sidebar-sections-stay-collapsed-until-opened.md +5 -0
- package/corpus/templates/analytics/changelog/2026-07-08-the-uptime-monitor-list-now-has-a-current-status-overview-wi.md +6 -0
- package/corpus/templates/analytics/docs/error-capture.md +172 -0
- package/corpus/templates/analytics/docs/uptime-monitoring.md +150 -0
- package/corpus/templates/analytics/server/db/schema-errors.ts +150 -0
- package/corpus/templates/analytics/server/db/schema-monitoring.ts +177 -0
- package/corpus/templates/analytics/server/db/schema.ts +6 -0
- package/corpus/templates/analytics/server/jobs/uptime-monitors.ts +123 -0
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +41 -0
- package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +55 -12
- package/corpus/templates/analytics/server/lib/error-capture.ts +1331 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +47 -1
- package/corpus/templates/analytics/server/lib/monitor-stats.ts +494 -0
- package/corpus/templates/analytics/server/lib/status-pages.ts +798 -0
- package/corpus/templates/analytics/server/lib/uptime-monitors.ts +1665 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +7 -37
- package/corpus/templates/analytics/server/plugins/auth.ts +11 -1
- package/corpus/templates/analytics/server/plugins/db.ts +408 -0
- package/corpus/templates/analytics/server/plugins/uptime-monitor-jobs.ts +63 -0
- package/corpus/templates/assets/app/routes/_index.tsx +1 -1
- package/corpus/templates/assets/app/routes/settings.tsx +22 -1
- package/corpus/templates/assets/changelog/2026-07-08-recent-drafts-keep-comfortable-side-padding.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/brain/app/routes/settings.tsx +43 -5
- package/corpus/templates/brain/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +44 -6
- package/corpus/templates/calendar/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/chat/app/routes/settings.tsx +16 -1
- package/corpus/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +79 -37
- package/corpus/templates/clips/app/components/player/player-controls.tsx +35 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +162 -18
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +63 -6
- package/corpus/templates/clips/app/routes/record.tsx +18 -1
- package/corpus/templates/clips/changelog/2026-07-07-shared-clips-start-playback-reliably-from-the-first-play-click.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-camera-and-microphone-menus-now-show-which-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-copies-new-clip-links-after-saving.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-recordings-now-continue-after-granting-came.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-mobile-shared-clips-now-have-loom-style-tap-and-skip-controls.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-recordings-and-uploads-copy-links-after-saving.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-settings-are-cleaner-searchable-and-collapse-s3-with-builder.md +5 -0
- package/corpus/templates/clips/changelog/2026-07-08-transcripts-are-more-reliable-for-longer-desktop-recordings-.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +162 -13
- package/corpus/templates/clips/chrome-extension/src/content-script.ts +14 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +36 -0
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +99 -25
- package/corpus/templates/clips/chrome-extension/src/permission.ts +63 -14
- package/corpus/templates/clips/chrome-extension/src/popup.ts +123 -23
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +47 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +33 -4
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +214 -29
- package/corpus/templates/content/actions/attach-content-database-source.ts +3 -0
- package/corpus/templates/content/actions/change-content-database-source-role.ts +1 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +42 -32
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +352 -81
- package/corpus/templates/content/app/components/editor/database/settings.tsx +49 -24
- package/corpus/templates/content/app/routes/_app.settings.tsx +19 -1
- package/corpus/templates/content/changelog/2026-07-07-builder-source-tag-fields-now-import-as-multi-select.md +6 -0
- package/corpus/templates/content/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/content/shared/api.ts +3 -0
- package/corpus/templates/content/shared/properties.ts +42 -0
- package/corpus/templates/design/actions/generate-design.ts +3 -0
- package/corpus/templates/design/actions/get-design-system.ts +147 -1
- package/corpus/templates/design/app/routes/settings.tsx +16 -1
- package/corpus/templates/design/changelog/2026-07-08-design-generation-now-follows-hydrated-builder-design-system.md +6 -0
- package/corpus/templates/design/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/dispatch/app/routes/settings.tsx +23 -2
- package/corpus/templates/dispatch/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/forms/app/routes/_app.settings.tsx +16 -1
- package/corpus/templates/forms/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/macros/app/routes/settings.tsx +16 -1
- package/corpus/templates/macros/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/mail/app/components/settings/GmailFiltersSection.tsx +1 -1
- package/corpus/templates/mail/app/components/settings/SnippetsSection.tsx +1 -1
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +123 -105
- package/corpus/templates/mail/changelog/2026-07-08-settings-redesigned-with-a-consistent-searchable-layout.md +5 -0
- package/corpus/templates/plan/app/routes/settings.tsx +23 -2
- package/corpus/templates/plan/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/slides/actions/add-slide.ts +1 -0
- package/corpus/templates/slides/actions/get-design-system.ts +147 -1
- package/corpus/templates/slides/app/pages/Index.tsx +46 -1
- package/corpus/templates/slides/app/routes/settings.tsx +16 -1
- package/corpus/templates/slides/changelog/2026-07-08-deck-generation-now-follows-hydrated-builder-design-system-g.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/dist/agent/run-ownership.d.ts +6 -0
- package/dist/agent/run-ownership.d.ts.map +1 -1
- package/dist/agent/run-ownership.js +11 -1
- package/dist/agent/run-ownership.js.map +1 -1
- package/dist/changelog/parse.d.ts +7 -0
- package/dist/changelog/parse.d.ts.map +1 -1
- package/dist/changelog/parse.js +64 -0
- package/dist/changelog/parse.js.map +1 -1
- package/dist/chat-threads/schema.d.ts +445 -0
- package/dist/chat-threads/schema.d.ts.map +1 -0
- package/dist/chat-threads/schema.js +39 -0
- package/dist/chat-threads/schema.js.map +1 -0
- package/dist/chat-threads/store.d.ts +12 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +99 -10
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +20 -5
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +35 -7
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +105 -183
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/analytics-session.d.ts +3 -0
- package/dist/client/analytics-session.d.ts.map +1 -0
- package/dist/client/analytics-session.js +66 -0
- package/dist/client/analytics-session.js.map +1 -0
- package/dist/client/analytics.d.ts +32 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +116 -46
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +2 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +16 -6
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/components/ui/message-scroller.d.ts +16 -0
- package/dist/client/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/client/components/ui/message-scroller.js +25 -0
- package/dist/client/components/ui/message-scroller.js.map +1 -0
- package/dist/client/conversation/AgentConversation.d.ts +1 -1
- package/dist/client/conversation/AgentConversation.d.ts.map +1 -1
- package/dist/client/conversation/AgentConversation.js +3 -8
- package/dist/client/conversation/AgentConversation.js.map +1 -1
- package/dist/client/error-capture.d.ts +99 -0
- package/dist/client/error-capture.d.ts.map +1 -0
- package/dist/client/error-capture.js +437 -0
- package/dist/client/error-capture.js.map +1 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/session-replay.d.ts +22 -0
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +45 -4
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +100 -5
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts +49 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +131 -19
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +13 -8
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sharing/ShareDialog.d.ts.map +1 -1
- package/dist/client/sharing/ShareDialog.js +12 -7
- package/dist/client/sharing/ShareDialog.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +21 -2
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/org/schema.d.ts +15 -15
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +109 -73
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +28 -16
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/sharing/actions/list-resource-shares.js +30 -1
- package/dist/sharing/actions/list-resource-shares.js.map +1 -1
- package/dist/sharing/actions/share-resource.js +6 -0
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/dist/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +192 -30
- package/dist/vite/client.js.map +1 -1
- package/docs/content/toolkit-settings.mdx +56 -3
- package/package.json +2 -1
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-session.d.ts","sourceRoot":"","sources":["../../src/client/analytics-session.ts"],"names":[],"mappings":"AAyCA,wBAAgB,+BAA+B,IAAI,MAAM,GAAG,SAAS,CAQpE;AAED,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,SAAS,CAkBlE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const ANONYMOUS_ID_STORAGE_KEY = "agent-native.anonymous_id";
|
|
2
|
+
const SESSION_ID_STORAGE_KEY = "agent-native.session_id";
|
|
3
|
+
const SESSION_LAST_ACTIVITY_STORAGE_KEY = "agent-native.session_last_activity";
|
|
4
|
+
// 30-minute idle timeout matches GA4 / Mixpanel defaults: a tab left open
|
|
5
|
+
// overnight starts a new session in the morning instead of stretching one visit.
|
|
6
|
+
const SESSION_IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
7
|
+
function generateVisitorId() {
|
|
8
|
+
try {
|
|
9
|
+
if (typeof crypto !== "undefined" &&
|
|
10
|
+
typeof crypto.randomUUID === "function") {
|
|
11
|
+
return crypto.randomUUID();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// fall through to Math.random
|
|
16
|
+
}
|
|
17
|
+
return (Date.now().toString(36) +
|
|
18
|
+
Math.random().toString(36).slice(2) +
|
|
19
|
+
Math.random().toString(36).slice(2));
|
|
20
|
+
}
|
|
21
|
+
function safeStorageGet(key) {
|
|
22
|
+
try {
|
|
23
|
+
return window.localStorage.getItem(key);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function safeStorageSet(key, value) {
|
|
30
|
+
try {
|
|
31
|
+
window.localStorage.setItem(key, value);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// private browsing / storage disabled -- best-effort
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function getOrCreateAnalyticsAnonymousId() {
|
|
38
|
+
if (typeof window === "undefined")
|
|
39
|
+
return undefined;
|
|
40
|
+
let id = safeStorageGet(ANONYMOUS_ID_STORAGE_KEY);
|
|
41
|
+
if (!id) {
|
|
42
|
+
id = generateVisitorId();
|
|
43
|
+
safeStorageSet(ANONYMOUS_ID_STORAGE_KEY, id);
|
|
44
|
+
}
|
|
45
|
+
return id;
|
|
46
|
+
}
|
|
47
|
+
export function getOrCreateAnalyticsSessionId() {
|
|
48
|
+
if (typeof window === "undefined")
|
|
49
|
+
return undefined;
|
|
50
|
+
const now = Date.now();
|
|
51
|
+
const lastActivityRaw = safeStorageGet(SESSION_LAST_ACTIVITY_STORAGE_KEY);
|
|
52
|
+
const lastActivity = lastActivityRaw
|
|
53
|
+
? Number.parseInt(lastActivityRaw, 10)
|
|
54
|
+
: 0;
|
|
55
|
+
let id = safeStorageGet(SESSION_ID_STORAGE_KEY);
|
|
56
|
+
const expired = !lastActivity ||
|
|
57
|
+
Number.isNaN(lastActivity) ||
|
|
58
|
+
now - lastActivity > SESSION_IDLE_TIMEOUT_MS;
|
|
59
|
+
if (!id || expired) {
|
|
60
|
+
id = generateVisitorId();
|
|
61
|
+
safeStorageSet(SESSION_ID_STORAGE_KEY, id);
|
|
62
|
+
}
|
|
63
|
+
safeStorageSet(SESSION_LAST_ACTIVITY_STORAGE_KEY, String(now));
|
|
64
|
+
return id;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=analytics-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-session.js","sourceRoot":"","sources":["../../src/client/analytics-session.ts"],"names":[],"mappings":"AAAA,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAC7D,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AACzD,MAAM,iCAAiC,GAAG,oCAAoC,CAAC;AAC/E,0EAA0E;AAC1E,iFAAiF;AACjF,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,IACE,OAAO,MAAM,KAAK,WAAW;YAC7B,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,EACvC,CAAC;YACD,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IACD,OAAO,CACL,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAA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AAc,CAAC,iCAAiC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["const ANONYMOUS_ID_STORAGE_KEY = \"agent-native.anonymous_id\";\nconst SESSION_ID_STORAGE_KEY = \"agent-native.session_id\";\nconst SESSION_LAST_ACTIVITY_STORAGE_KEY = \"agent-native.session_last_activity\";\n// 30-minute idle timeout matches GA4 / Mixpanel defaults: a tab left open\n// overnight starts a new session in the morning instead of stretching one visit.\nconst SESSION_IDLE_TIMEOUT_MS = 30 * 60 * 1000;\n\nfunction generateVisitorId(): string {\n try {\n if (\n typeof crypto !== \"undefined\" &&\n typeof crypto.randomUUID === \"function\"\n ) {\n return crypto.randomUUID();\n }\n } catch {\n // fall through to Math.random\n }\n return (\n Date.now().toString(36) +\n Math.random().toString(36).slice(2) +\n Math.random().toString(36).slice(2)\n );\n}\n\nfunction safeStorageGet(key: string): string | null {\n try {\n return window.localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeStorageSet(key: string, value: string): void {\n try {\n window.localStorage.setItem(key, value);\n } catch {\n // private browsing / storage disabled -- best-effort\n }\n}\n\nexport function getOrCreateAnalyticsAnonymousId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n let id = safeStorageGet(ANONYMOUS_ID_STORAGE_KEY);\n if (!id) {\n id = generateVisitorId();\n safeStorageSet(ANONYMOUS_ID_STORAGE_KEY, id);\n }\n return id;\n}\n\nexport function getOrCreateAnalyticsSessionId(): string | undefined {\n if (typeof window === \"undefined\") return undefined;\n const now = Date.now();\n const lastActivityRaw = safeStorageGet(SESSION_LAST_ACTIVITY_STORAGE_KEY);\n const lastActivity = lastActivityRaw\n ? Number.parseInt(lastActivityRaw, 10)\n : 0;\n let id = safeStorageGet(SESSION_ID_STORAGE_KEY);\n const expired =\n !lastActivity ||\n Number.isNaN(lastActivity) ||\n now - lastActivity > SESSION_IDLE_TIMEOUT_MS;\n if (!id || expired) {\n id = generateVisitorId();\n safeStorageSet(SESSION_ID_STORAGE_KEY, id);\n }\n safeStorageSet(SESSION_LAST_ACTIVITY_STORAGE_KEY, String(now));\n return id;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionReplayOptions, SessionReplayStartResult } from "./session-replay.js";
|
|
2
2
|
export { scrubUrl } from "./url-scrub.js";
|
|
3
|
+
export { addErrorBreadcrumb, captureException, captureMessage, isErrorCaptureInstalled, type CaptureExceptionContext, type CapturedExceptionEvent, type ExceptionBreadcrumb, type ExceptionLevel, } from "./error-capture.js";
|
|
3
4
|
export type { SessionReplayConsoleOptions, SessionReplayNetworkOptions, SessionReplayOptions, SessionReplayStartResult, SessionReplayUrlMatcher, } from "./session-replay.js";
|
|
4
5
|
declare global {
|
|
5
6
|
interface Window {
|
|
@@ -11,6 +12,24 @@ declare global {
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
type GetDefaultProps = (name: string, properties: Record<string, unknown>) => Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* First-party, Sentry-style error capture configuration. Pass `true`/`false`
|
|
17
|
+
* to force on/off, or an options object to tune it. When omitted, error
|
|
18
|
+
* capture auto-enables whenever a first-party analytics public key is
|
|
19
|
+
* configured (mirroring pageview + session-replay auto-enable).
|
|
20
|
+
*/
|
|
21
|
+
export type ErrorCaptureConfigOptions = {
|
|
22
|
+
/** Build/release identifier attached to every captured exception. */
|
|
23
|
+
release?: string;
|
|
24
|
+
/** Deployment environment (e.g. "production"). Defaults to Vite MODE. */
|
|
25
|
+
environment?: string;
|
|
26
|
+
/** Auto-capture `window.onerror`. Defaults to true. */
|
|
27
|
+
captureGlobalErrors?: boolean;
|
|
28
|
+
/** Auto-capture `unhandledrejection`. Defaults to true. */
|
|
29
|
+
captureUnhandledRejections?: boolean;
|
|
30
|
+
/** Breadcrumb ring-buffer size. Defaults to 20. */
|
|
31
|
+
maxBreadcrumbs?: number;
|
|
32
|
+
};
|
|
14
33
|
export type ConfigureTrackingOptions = {
|
|
15
34
|
/**
|
|
16
35
|
* Agent Native first-party analytics public key. This mirrors hosted
|
|
@@ -24,12 +43,25 @@ export type ConfigureTrackingOptions = {
|
|
|
24
43
|
endpoint?: string;
|
|
25
44
|
getDefaultProps?: GetDefaultProps;
|
|
26
45
|
sessionReplay?: boolean | SessionReplayOptions;
|
|
46
|
+
/**
|
|
47
|
+
* First-party, Sentry-style error capture. Auto-captures uncaught errors
|
|
48
|
+
* and unhandled rejections and exposes `captureException`/`captureMessage`.
|
|
49
|
+
* Auto-enables when a public key is present; pass `false` to disable.
|
|
50
|
+
*/
|
|
51
|
+
errorCapture?: boolean | ErrorCaptureConfigOptions;
|
|
27
52
|
};
|
|
28
53
|
type SentryUser = {
|
|
29
54
|
id?: string;
|
|
30
55
|
email?: string;
|
|
31
56
|
username?: string;
|
|
32
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Dedicated first-party analytics event name for captured exceptions. The
|
|
60
|
+
* analytics server ingest forks events with this name into the error-capture
|
|
61
|
+
* tables (error_issues / error_events) while still recording them in
|
|
62
|
+
* analytics_events for alerting. Keep in sync with the template server ingest.
|
|
63
|
+
*/
|
|
64
|
+
export declare const AGENT_NATIVE_EXCEPTION_EVENT_NAME = "$exception";
|
|
33
65
|
export interface FirstTouchAttribution {
|
|
34
66
|
ref?: string;
|
|
35
67
|
via?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,u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MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,oBAAyB,GACjC,MAAM,GAAG,SAAS,CAyBpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,oBAAyB,GACjC,MAAM,GAAG,SAAS,CAEpB;AAeD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAwBzE;AAwRD,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAOnC;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAOnC;AAED,wBAAsB,iBAAiB,CAAC,MAAM,SAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE;AA4KD,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,IAAI,CASN;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE1D"}
|
package/dist/client/analytics.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as amplitude from "@amplitude/analytics-browser";
|
|
2
2
|
import * as Sentry from "@sentry/browser";
|
|
3
3
|
import { llmConnectionTrackingProperties, } from "../shared/llm-connection.js";
|
|
4
|
+
import { getOrCreateAnalyticsAnonymousId, getOrCreateAnalyticsSessionId, } from "./analytics-session.js";
|
|
4
5
|
import { agentNativePath } from "./api-path.js";
|
|
6
|
+
import { installErrorCapture, } from "./error-capture.js";
|
|
5
7
|
import { scrubUrl } from "./url-scrub.js";
|
|
6
8
|
export { scrubUrl } from "./url-scrub.js";
|
|
9
|
+
export { addErrorBreadcrumb, captureException, captureMessage, isErrorCaptureInstalled, } from "./error-capture.js";
|
|
7
10
|
let _getDefaultProps = null;
|
|
8
11
|
let _agentNativeAnalyticsPublicKey = null;
|
|
9
12
|
let _agentNativeAnalyticsEndpoint = null;
|
|
@@ -19,21 +22,24 @@ let _trackingSessionRefreshInstalled = false;
|
|
|
19
22
|
let _sessionReplayOptions = null;
|
|
20
23
|
let _sessionReplayIdentitySnapshot = null;
|
|
21
24
|
let _sessionReplayStartPromise = null;
|
|
25
|
+
let _errorCaptureInstalled = false;
|
|
26
|
+
let _errorCaptureDisposer = null;
|
|
27
|
+
let _sessionReplayModuleForCapture = null;
|
|
22
28
|
// Buffer for setSentryUser calls made before Sentry has initialized.
|
|
23
29
|
// `undefined` means "no pending update"; `null` means "pending clear".
|
|
24
30
|
let _pendingSentryUser = undefined;
|
|
25
31
|
let _pendingSentryOrgId = undefined;
|
|
26
32
|
const AGENT_NATIVE_ANALYTICS_DEFAULT_ENDPOINT = "https://analytics.agent-native.com/track";
|
|
33
|
+
/**
|
|
34
|
+
* Dedicated first-party analytics event name for captured exceptions. The
|
|
35
|
+
* analytics server ingest forks events with this name into the error-capture
|
|
36
|
+
* tables (error_issues / error_events) while still recording them in
|
|
37
|
+
* analytics_events for alerting. Keep in sync with the template server ingest.
|
|
38
|
+
*/
|
|
39
|
+
export const AGENT_NATIVE_EXCEPTION_EVENT_NAME = "$exception";
|
|
27
40
|
const PAGEVIEW_TRACKING_STATE_KEY = Symbol.for("agent-native.client.pageviewTracking");
|
|
28
|
-
const ANONYMOUS_ID_STORAGE_KEY = "agent-native.anonymous_id";
|
|
29
|
-
const SESSION_ID_STORAGE_KEY = "agent-native.session_id";
|
|
30
|
-
const SESSION_LAST_ACTIVITY_STORAGE_KEY = "agent-native.session_last_activity";
|
|
31
41
|
const LLM_CONNECTION_STORAGE_KEY = "agent-native.llm_connection_status";
|
|
32
42
|
const LLM_CONNECTION_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
33
|
-
// 30-minute idle timeout matches GA4 / Mixpanel defaults — a tab left open
|
|
34
|
-
// overnight starts a new session in the morning rather than stretching one
|
|
35
|
-
// session over multiple visits.
|
|
36
|
-
const SESSION_IDLE_TIMEOUT_MS = 30 * 60 * 1000;
|
|
37
43
|
// First-touch referral attribution (viral attribution). Captured once on the
|
|
38
44
|
// visitor's first page load and persisted across the signup boundary so the
|
|
39
45
|
// server-side `signup` event can record where the user came from. First-write
|
|
@@ -57,20 +63,6 @@ const FIRST_TOUCH_QUERY_FIELDS = [
|
|
|
57
63
|
"utm_term",
|
|
58
64
|
];
|
|
59
65
|
let _firstTouchCaptured = false;
|
|
60
|
-
function generateVisitorId() {
|
|
61
|
-
try {
|
|
62
|
-
if (typeof crypto !== "undefined" &&
|
|
63
|
-
typeof crypto.randomUUID === "function") {
|
|
64
|
-
return crypto.randomUUID();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// fall through to Math.random
|
|
69
|
-
}
|
|
70
|
-
return (Date.now().toString(36) +
|
|
71
|
-
Math.random().toString(36).slice(2) +
|
|
72
|
-
Math.random().toString(36).slice(2));
|
|
73
|
-
}
|
|
74
66
|
function safeStorageGet(key) {
|
|
75
67
|
try {
|
|
76
68
|
return window.localStorage.getItem(key);
|
|
@@ -267,36 +259,13 @@ function applyTrackingIdentity(properties, identity = _trackingIdentity) {
|
|
|
267
259
|
return next;
|
|
268
260
|
}
|
|
269
261
|
function getOrCreateAnonymousId() {
|
|
270
|
-
|
|
271
|
-
return undefined;
|
|
272
|
-
let id = safeStorageGet(ANONYMOUS_ID_STORAGE_KEY);
|
|
273
|
-
if (!id) {
|
|
274
|
-
id = generateVisitorId();
|
|
275
|
-
safeStorageSet(ANONYMOUS_ID_STORAGE_KEY, id);
|
|
276
|
-
}
|
|
277
|
-
return id;
|
|
262
|
+
return getOrCreateAnalyticsAnonymousId();
|
|
278
263
|
}
|
|
279
264
|
export function getAnalyticsAnonymousId() {
|
|
280
265
|
return getOrCreateAnonymousId();
|
|
281
266
|
}
|
|
282
267
|
function getOrCreateSessionId() {
|
|
283
|
-
|
|
284
|
-
return undefined;
|
|
285
|
-
const now = Date.now();
|
|
286
|
-
const lastActivityRaw = safeStorageGet(SESSION_LAST_ACTIVITY_STORAGE_KEY);
|
|
287
|
-
const lastActivity = lastActivityRaw
|
|
288
|
-
? Number.parseInt(lastActivityRaw, 10)
|
|
289
|
-
: 0;
|
|
290
|
-
let id = safeStorageGet(SESSION_ID_STORAGE_KEY);
|
|
291
|
-
const expired = !lastActivity ||
|
|
292
|
-
Number.isNaN(lastActivity) ||
|
|
293
|
-
now - lastActivity > SESSION_IDLE_TIMEOUT_MS;
|
|
294
|
-
if (!id || expired) {
|
|
295
|
-
id = generateVisitorId();
|
|
296
|
-
safeStorageSet(SESSION_ID_STORAGE_KEY, id);
|
|
297
|
-
}
|
|
298
|
-
safeStorageSet(SESSION_LAST_ACTIVITY_STORAGE_KEY, String(now));
|
|
299
|
-
return id;
|
|
268
|
+
return getOrCreateAnalyticsSessionId();
|
|
300
269
|
}
|
|
301
270
|
export function getAnalyticsSessionId() {
|
|
302
271
|
return getOrCreateSessionId();
|
|
@@ -811,8 +780,109 @@ export function configureTracking(options) {
|
|
|
811
780
|
endpoint: options.endpoint,
|
|
812
781
|
publicKey,
|
|
813
782
|
});
|
|
783
|
+
maybeInstallErrorCapture(options.errorCapture);
|
|
814
784
|
}
|
|
815
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* Lazily load the session-replay module so error capture can read the active
|
|
788
|
+
* replay id and surface manual captures on the replay timeline without a
|
|
789
|
+
* static import (which would create an analytics <-> session-replay import
|
|
790
|
+
* cycle and pull the replay module into the analytics chunk eagerly).
|
|
791
|
+
*/
|
|
792
|
+
function loadSessionReplayModuleForCapture() {
|
|
793
|
+
if (_sessionReplayModuleForCapture)
|
|
794
|
+
return;
|
|
795
|
+
import("./session-replay.js")
|
|
796
|
+
.then((mod) => {
|
|
797
|
+
_sessionReplayModuleForCapture = mod;
|
|
798
|
+
})
|
|
799
|
+
.catch(() => {
|
|
800
|
+
// Session linkage is best-effort; capture still works without it.
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
function errorCaptureSessionContext() {
|
|
804
|
+
return {
|
|
805
|
+
sessionId: getOrCreateSessionId(),
|
|
806
|
+
anonymousId: getOrCreateAnonymousId(),
|
|
807
|
+
replayId: _sessionReplayModuleForCapture?.getSessionReplayId?.() ?? undefined,
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function exceptionEventProperties(event) {
|
|
811
|
+
return {
|
|
812
|
+
exceptionType: event.type,
|
|
813
|
+
exceptionMessage: event.message,
|
|
814
|
+
...(event.stack ? { exceptionStack: event.stack } : {}),
|
|
815
|
+
handled: event.handled,
|
|
816
|
+
level: event.level,
|
|
817
|
+
occurredAt: event.occurredAt,
|
|
818
|
+
...(event.url ? { errorUrl: event.url } : {}),
|
|
819
|
+
...(event.release ? { release: event.release } : {}),
|
|
820
|
+
...(event.environment ? { environment: event.environment } : {}),
|
|
821
|
+
...(event.sessionReplayId
|
|
822
|
+
? { sessionReplayId: event.sessionReplayId }
|
|
823
|
+
: {}),
|
|
824
|
+
...(event.breadcrumbs?.length ? { breadcrumbs: event.breadcrumbs } : {}),
|
|
825
|
+
...(event.tags ? { exceptionTags: event.tags } : {}),
|
|
826
|
+
...(event.extra ? { exceptionExtra: event.extra } : {}),
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function sendExceptionEvent(event) {
|
|
830
|
+
// Route through the existing first-party analytics ingest as a dedicated
|
|
831
|
+
// `$exception` event. This reuses the public-key auth + sendBeacon/keepalive
|
|
832
|
+
// transport; the server forks it into error_issues/error_events and still
|
|
833
|
+
// records it in analytics_events for alerting.
|
|
834
|
+
trackEvent(AGENT_NATIVE_EXCEPTION_EVENT_NAME, exceptionEventProperties(event));
|
|
835
|
+
}
|
|
836
|
+
function emitExceptionToReplay(event) {
|
|
837
|
+
_sessionReplayModuleForCapture?.emitSessionReplayException?.({
|
|
838
|
+
type: event.type,
|
|
839
|
+
message: event.message,
|
|
840
|
+
level: event.level,
|
|
841
|
+
...(event.stack ? { stack: event.stack } : {}),
|
|
842
|
+
...(event.url ? { url: event.url } : {}),
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
function errorCaptureAutoEnabled() {
|
|
846
|
+
const publicKey = _agentNativeAnalyticsPublicKey ||
|
|
847
|
+
import.meta.env
|
|
848
|
+
?.VITE_AGENT_NATIVE_ANALYTICS_PUBLIC_KEY;
|
|
849
|
+
return !!publicKey;
|
|
850
|
+
}
|
|
851
|
+
function maybeInstallErrorCapture(config) {
|
|
852
|
+
if (typeof window === "undefined")
|
|
853
|
+
return;
|
|
854
|
+
if (config === false) {
|
|
855
|
+
_errorCaptureDisposer?.();
|
|
856
|
+
_errorCaptureDisposer = null;
|
|
857
|
+
_errorCaptureInstalled = false;
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
if (_errorCaptureInstalled && config === undefined)
|
|
861
|
+
return;
|
|
862
|
+
const enabled = config === undefined ? errorCaptureAutoEnabled() : true;
|
|
863
|
+
if (!enabled)
|
|
864
|
+
return;
|
|
865
|
+
const options = typeof config === "object" ? config : {};
|
|
866
|
+
loadSessionReplayModuleForCapture();
|
|
867
|
+
_errorCaptureDisposer = installErrorCapture({
|
|
868
|
+
send: sendExceptionEvent,
|
|
869
|
+
getSessionContext: errorCaptureSessionContext,
|
|
870
|
+
emitReplayEvent: emitExceptionToReplay,
|
|
871
|
+
environment: options.environment ||
|
|
872
|
+
import.meta.env?.MODE,
|
|
873
|
+
...(options.release ? { release: options.release } : {}),
|
|
874
|
+
...(options.captureGlobalErrors !== undefined
|
|
875
|
+
? { captureGlobalErrors: options.captureGlobalErrors }
|
|
876
|
+
: {}),
|
|
877
|
+
...(options.captureUnhandledRejections !== undefined
|
|
878
|
+
? { captureUnhandledRejections: options.captureUnhandledRejections }
|
|
879
|
+
: {}),
|
|
880
|
+
...(options.maxBreadcrumbs !== undefined
|
|
881
|
+
? { maxBreadcrumbs: options.maxBreadcrumbs }
|
|
882
|
+
: {}),
|
|
883
|
+
});
|
|
884
|
+
_errorCaptureInstalled = true;
|
|
885
|
+
}
|
|
816
886
|
function sessionReplayEnabledFromEnv() {
|
|
817
887
|
const env = import.meta.env ?? {};
|
|
818
888
|
const value = env.VITE_AGENT_NATIVE_SESSION_REPLAY_ENABLED ||
|