@agent-native/core 0.145.5 → 0.145.6
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 +1 -1
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +17 -1
- package/corpus/templates/analytics/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +22 -3
- package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/analytics/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/analytics/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/analytics/AGENTS.md +2 -1
- package/corpus/templates/analytics/actions/account-deep-dive.ts +83 -47
- package/corpus/templates/analytics/actions/create-dashboard-folder.ts +27 -0
- package/corpus/templates/analytics/actions/gong-calls.ts +3 -3
- package/corpus/templates/analytics/actions/list-dashboard-folders.ts +26 -0
- package/corpus/templates/analytics/actions/list-sql-dashboards.ts +1 -0
- package/corpus/templates/analytics/actions/set-dashboard-folder.ts +26 -0
- package/corpus/templates/analytics/app/components/ProviderCorpusJobNotifier.tsx +18 -3
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +6 -4
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +12 -2
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +35 -20
- package/corpus/templates/analytics/app/global.css +17 -0
- package/corpus/templates/analytics/app/hooks/use-dashboard-revisions.ts +29 -15
- package/corpus/templates/analytics/app/hooks/use-dashboard-views.ts +15 -3
- package/corpus/templates/analytics/app/i18n-data.ts +296 -0
- package/corpus/templates/analytics/app/lib/prefetch-keys.ts +23 -2
- package/corpus/templates/analytics/app/pages/DashboardOverview.tsx +642 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +66 -31
- package/corpus/templates/analytics/app/root.tsx +4 -0
- package/corpus/templates/analytics/app/routes/dashboards._index.tsx +5 -1
- package/corpus/templates/analytics/changelog/2026-08-07-added-a-dashboards-overview-with-personal-and-shared-folders.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-07-analytics-tracking-and-chat-startup-no-longer-emit-avoidable.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-07-dashboard-panels-now-load-custom-api-data-programs-reliably.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-07-gong-searches-conserve-api-quota-and-report-incomplete-coverage.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-07-searchable-dashboards-make-personal-and-shared-folders-easie.md +6 -0
- package/corpus/templates/analytics/netlify.toml +3 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +112 -0
- package/corpus/templates/analytics/server/db/index.ts +12 -0
- package/corpus/templates/analytics/server/db/schema.ts +14 -0
- package/corpus/templates/analytics/server/jobs/analytics-rollup-backfill.ts +4 -0
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +1 -0
- package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +85 -15
- package/corpus/templates/analytics/server/lib/dashboard-folders-store.ts +168 -0
- package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +9 -4
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +116 -1
- package/corpus/templates/analytics/server/lib/first-party-analytics-rollups.ts +4 -8
- package/corpus/templates/analytics/server/lib/gong.ts +139 -78
- package/corpus/templates/analytics/server/plugins/db.ts +55 -15
- package/corpus/templates/analytics/server/plugins/session-replay-retention-jobs.ts +6 -2
- package/corpus/templates/analytics/server/routes/api/session-replay/retention.post.ts +65 -0
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/assets/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/assets/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/assets/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/brain/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/brain/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/brain/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/calendar/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/calendar/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/calendar/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/chat/.env.example +3 -0
- package/corpus/templates/chat/AGENTS.md +4 -0
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/clips/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/clips/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/clips/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +4 -0
- package/corpus/templates/clips/actions/request-transcript.ts +52 -3
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +3 -10
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -0
- package/corpus/templates/clips/changelog/2026-08-07-screen-recordings-now-capture-tab-and-system-audio-even-when.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-07-transcription-now-retries-transient-cloud-failures-automatic.md +6 -0
- package/corpus/templates/clips/server/db/schema.ts +7 -0
- package/corpus/templates/clips/server/plugins/db.ts +8 -0
- package/corpus/templates/clips/shared/recording-capture.ts +38 -0
- package/corpus/templates/clips/shared/transcript-failure.ts +89 -0
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/content/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/content/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/content/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/content/.env.example +9 -3
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -0
- package/corpus/templates/content/changelog/2026-08-07-collapsed-sidebar-utility-buttons-stay-anchored-at-the-botto.md +6 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/crm/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/crm/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/design/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/design/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/design/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/dispatch/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/factory/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/factory/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/factory/actions/babysit-agent-native-pull-request.ts +279 -0
- package/corpus/templates/factory/actions/get-factory-automation-health.ts +23 -4
- package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +1 -1
- package/corpus/templates/factory/app/routes/factory.tsx +21 -3
- package/corpus/templates/factory/changelog/2026-08-07-factory-can-keep-builder-bot-pull-requests-moving-by-request.md +6 -0
- package/corpus/templates/factory/server/lib/require-factory-automation.ts +1 -0
- package/corpus/templates/factory/server/plugins/agent-chat.ts +4 -1
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +81 -12
- package/corpus/templates/factory/server/triage/github-client.ts +31 -0
- package/corpus/templates/factory/server/triage/pr-babysit.ts +75 -1
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/forms/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/forms/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/forms/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/macros/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/macros/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/mail/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/mail/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/mail/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/plan/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/plan/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/plan/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +2 -1
- package/corpus/templates/plan/changelog/2026-08-07-inline-help-icons-now-stay-visually-balanced-with-nearby-tex.md +6 -0
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/slides/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/slides/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/slides/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/slides/.env.example +5 -0
- package/corpus/templates/slides/changelog/2026-08-07-fixed-generated-slides-briefly-disappearing-while-they-are-b.md +6 -0
- package/corpus/templates/slides/server/plugins/collab.ts +20 -8
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +18 -0
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/tasks/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/corpus/templates/tasks/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/corpus/templates/tasks/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/corpus/templates/tasks/.env.example +3 -0
- package/dist/agent/production-agent.js +24 -3
- package/dist/client/AgentPanel.d.ts +6 -0
- package/dist/client/AgentPanel.js +176 -30
- package/dist/client/AssistantChat.d.ts +2 -0
- package/dist/client/AssistantChat.js +4 -1
- package/dist/client/ConnectBuilderCard.js +6 -11
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/RuntimeConfigNotice.d.ts +1 -0
- package/dist/client/RuntimeConfigNotice.js +94 -0
- package/dist/client/agent-chat/index.d.ts +1 -1
- package/dist/client/agent-chat/index.js +1 -1
- package/dist/client/agent-chat-adapter.js +85 -4
- package/dist/client/agent-page/AgentTabsPage.js +1 -1
- package/dist/client/agent-sidebar-state.d.ts +6 -0
- package/dist/client/agent-sidebar-state.js +25 -0
- package/dist/client/app-providers.js +2 -1
- package/dist/client/assistant-ui-recovery.js +1 -1
- package/dist/client/chat/index.d.ts +1 -1
- package/dist/client/chat/index.js +1 -1
- package/dist/client/chat/markdown-renderer.d.ts +2 -1
- package/dist/client/chat/markdown-renderer.js +48 -2
- package/dist/client/chat/message-components.d.ts +6 -0
- package/dist/client/chat/message-components.js +182 -53
- package/dist/client/chat/tool-call-display.d.ts +16 -4
- package/dist/client/chat/tool-call-display.js +225 -18
- package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
- package/dist/client/frame-protocol.d.ts +4 -0
- package/dist/client/i18n.js +9 -0
- package/dist/client/integrations/IntegrationsPanel.js +2 -5
- package/dist/client/onboarding/FirstRunOnboarding.js +2 -3
- package/dist/client/org/TeamPage.js +49 -6
- package/dist/client/org/hooks.d.ts +7 -2
- package/dist/client/org/hooks.js +11 -4
- package/dist/client/resources/McpConnectionSuggestion.js +2 -3
- package/dist/client/resources/McpIntegrationDialog.js +2 -16
- package/dist/client/resources/McpIntegrationLogo.d.ts +11 -0
- package/dist/client/resources/McpIntegrationLogo.js +14 -0
- package/dist/client/resources/ResourceTree.js +1 -1
- package/dist/client/resources/mcp-integration-logos.d.ts +1 -0
- package/dist/client/resources/mcp-integration-logos.js +47 -18
- package/dist/client/settings/useBuilderStatus.js +6 -0
- package/dist/client/ui/index.d.ts +1 -0
- package/dist/client/ui/index.js +1 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/config.d.ts +26 -3
- package/dist/config.js +106 -14
- package/dist/db/ddl-guard.d.ts +15 -2
- package/dist/db/ddl-guard.js +53 -5
- package/dist/jobs/scheduler.js +7 -0
- package/dist/localization/default-messages.d.ts +17 -0
- package/dist/localization/default-messages.js +17 -0
- package/dist/mcp/oauth-client-metadata.js +5 -1
- package/dist/mcp/oauth-route.d.ts +5 -4
- package/dist/mcp/oauth-route.js +25 -9
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +9 -10
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/org/handlers.d.ts +1 -0
- package/dist/org/handlers.js +17 -2
- package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/provider-api/corpus-jobs.d.ts +12 -2
- package/dist/provider-api/corpus-jobs.js +31 -1
- package/dist/provider-api/index.d.ts +2 -0
- package/dist/provider-api/index.js +7 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +1 -1
- package/dist/server/agent-chat/recurring-jobs-runtime.js +14 -2
- package/dist/server/agent-chat/script-entries.js +12 -1
- package/dist/server/agent-chat-plugin.js +2 -2
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.d.ts +1 -0
- package/dist/server/auth.js +85 -1
- package/dist/server/better-auth-instance.d.ts +9 -0
- package/dist/server/better-auth-instance.js +25 -11
- package/dist/server/core-routes-plugin.d.ts +7 -0
- package/dist/server/core-routes-plugin.js +51 -5
- package/dist/server/create-server.js +23 -2
- package/dist/server/db-pressure.d.ts +38 -0
- package/dist/server/db-pressure.js +147 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/legacy-auth-migration.d.ts +10 -0
- package/dist/server/legacy-auth-migration.js +37 -0
- package/dist/server/onboarding-html.js +206 -2
- package/dist/server/poll.d.ts +26 -0
- package/dist/server/poll.js +108 -13
- package/dist/server/ssr-handler.js +4 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/runtime-config.d.ts +44 -0
- package/dist/shared/runtime-config.js +284 -0
- package/dist/styles/agent-native.css +48 -1
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +18 -0
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
- package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/dist/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/dist/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/dist/templates/chat/.env.example +3 -0
- package/dist/templates/chat/AGENTS.md +4 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +18 -0
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/default/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +1 -0
- package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/dist/templates/default/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/dist/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/dist/templates/default/AGENTS.md +6 -1
- package/dist/templates/default/app/i18n/ar-SA.ts +6 -0
- package/dist/templates/default/app/i18n/de-DE.ts +6 -0
- package/dist/templates/default/app/i18n/en-US.ts +6 -0
- package/dist/templates/default/app/i18n/es-ES.ts +6 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +6 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +6 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +6 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +6 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +6 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +6 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +6 -0
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +18 -0
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/dist/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/dist/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +18 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -0
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +8 -0
- package/dist/templates/workspace-core/AGENTS.md +7 -2
- package/dist/templates/workspace-root/AGENTS.md +5 -0
- package/dist/vite/client.d.ts +3 -3
- package/dist/vite/client.js +47 -1
- package/dist/vite/index.d.ts +1 -1
- package/docs/content/agent-native-config.mdx +240 -139
- package/docs/content/authentication.mdx +17 -0
- package/docs/content/deployment.mdx +19 -14
- package/docs/content/drop-in-agent.mdx +19 -2
- package/docs/content/environment-variables.mdx +63 -38
- package/docs/content/getting-started-actions.mdx +15 -6
- package/docs/content/getting-started-database.mdx +14 -10
- package/docs/content/getting-started-pages.mdx +32 -35
- package/docs/content/getting-started.mdx +7 -6
- package/package.json +1 -1
- package/src/templates/chat/.agents/skills/actions/SKILL.md +18 -0
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
- package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/src/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/src/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/src/templates/chat/.env.example +3 -0
- package/src/templates/chat/AGENTS.md +4 -0
- package/src/templates/default/.agents/skills/actions/SKILL.md +18 -0
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -0
- package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/src/templates/default/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/src/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/src/templates/default/AGENTS.md +6 -1
- package/src/templates/default/app/i18n/ar-SA.ts +6 -0
- package/src/templates/default/app/i18n/de-DE.ts +6 -0
- package/src/templates/default/app/i18n/en-US.ts +6 -0
- package/src/templates/default/app/i18n/es-ES.ts +6 -0
- package/src/templates/default/app/i18n/fr-FR.ts +6 -0
- package/src/templates/default/app/i18n/hi-IN.ts +6 -0
- package/src/templates/default/app/i18n/ja-JP.ts +6 -0
- package/src/templates/default/app/i18n/ko-KR.ts +6 -0
- package/src/templates/default/app/i18n/pt-BR.ts +6 -0
- package/src/templates/default/app/i18n/zh-CN.ts +6 -0
- package/src/templates/default/app/i18n/zh-TW.ts +6 -0
- package/src/templates/headless/.agents/skills/actions/SKILL.md +18 -0
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/src/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/src/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +18 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +45 -47
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +76 -23
- package/src/templates/workspace-core/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
- package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -0
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +8 -0
- package/src/templates/workspace-core/AGENTS.md +7 -2
- package/src/templates/workspace-root/AGENTS.md +5 -0
- package/corpus/templates/dispatch/app/routes/admin.apps.$appId.tsx +0 -1
- package/corpus/templates/dispatch/app/routes/admin.apps.tsx +0 -1
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
} from "@/lib/dashboard-report-capture";
|
|
120
120
|
import { incrementItemView } from "@/lib/item-popularity";
|
|
121
121
|
import {
|
|
122
|
+
dashboardCacheScope,
|
|
122
123
|
sqlDashboardPrefetchKey,
|
|
123
124
|
type PrefetchSnapshot,
|
|
124
125
|
} from "@/lib/prefetch-keys";
|
|
@@ -570,6 +571,7 @@ function SqlDashboardPageContent({
|
|
|
570
571
|
const { id: routeId } = useParams<{ id: string }>();
|
|
571
572
|
const queryClient = useQueryClient();
|
|
572
573
|
const navigate = useNavigate();
|
|
574
|
+
const dashboardScope = dashboardCacheScope(session);
|
|
573
575
|
const dashboardId = searchParams.get("id") || routeId;
|
|
574
576
|
const reportSettingsRequested = searchParams.get("reportSettings") === "1";
|
|
575
577
|
|
|
@@ -689,7 +691,7 @@ function SqlDashboardPageContent({
|
|
|
689
691
|
// writes show up without a manual refresh"; see `use-change-version.ts`.
|
|
690
692
|
const sync = useChangeVersions(["dashboards", "action"]);
|
|
691
693
|
const dashboardQuery = useQuery({
|
|
692
|
-
queryKey: ["data", "sql-dashboard", dashboardId, sync],
|
|
694
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope, sync],
|
|
693
695
|
enabled: !!dashboardId,
|
|
694
696
|
queryFn: async () => {
|
|
695
697
|
if (!dashboardId) return null;
|
|
@@ -700,17 +702,16 @@ function SqlDashboardPageContent({
|
|
|
700
702
|
? DASHBOARD_REPORT_BOOTSTRAP_RETRY_DELAY_MS
|
|
701
703
|
: undefined,
|
|
702
704
|
staleTime: 30_000,
|
|
703
|
-
placeholderData: (prev) => prev,
|
|
704
705
|
initialData: () => {
|
|
705
706
|
if (!dashboardId) return undefined;
|
|
706
707
|
const snapshot = queryClient.getQueryData<
|
|
707
708
|
PrefetchSnapshot<FetchedDashboard | null>
|
|
708
|
-
>(sqlDashboardPrefetchKey(dashboardId));
|
|
709
|
+
>(sqlDashboardPrefetchKey(dashboardId, dashboardScope));
|
|
709
710
|
return dashboardPrefetchInitialData(snapshot, sync);
|
|
710
711
|
},
|
|
711
712
|
initialDataUpdatedAt: () => {
|
|
712
713
|
if (!dashboardId) return undefined;
|
|
713
|
-
const queryKey = sqlDashboardPrefetchKey(dashboardId);
|
|
714
|
+
const queryKey = sqlDashboardPrefetchKey(dashboardId, dashboardScope);
|
|
714
715
|
const snapshot =
|
|
715
716
|
queryClient.getQueryData<PrefetchSnapshot<FetchedDashboard | null>>(
|
|
716
717
|
queryKey,
|
|
@@ -754,18 +755,20 @@ function SqlDashboardPageContent({
|
|
|
754
755
|
(updated: SqlDashboardConfig) => {
|
|
755
756
|
if (!dashboardId) return;
|
|
756
757
|
queryClient.setQueriesData<FetchedDashboard | null>(
|
|
757
|
-
{
|
|
758
|
+
{
|
|
759
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
760
|
+
},
|
|
758
761
|
(prev) => (prev ? { ...prev, config: updated } : prev),
|
|
759
762
|
);
|
|
760
763
|
queryClient.setQueryData<PrefetchSnapshot<FetchedDashboard | null>>(
|
|
761
|
-
sqlDashboardPrefetchKey(dashboardId),
|
|
764
|
+
sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
762
765
|
(prev) =>
|
|
763
766
|
prev?.data
|
|
764
767
|
? { ...prev, data: { ...prev.data, config: updated } }
|
|
765
768
|
: prev,
|
|
766
769
|
);
|
|
767
770
|
},
|
|
768
|
-
[dashboardId, queryClient],
|
|
771
|
+
[dashboardId, dashboardScope, queryClient],
|
|
769
772
|
);
|
|
770
773
|
|
|
771
774
|
const holdDashboardConfig = useCallback(() => {
|
|
@@ -775,10 +778,12 @@ function SqlDashboardPageContent({
|
|
|
775
778
|
currentUpdatedAt: dashboardUpdatedAt,
|
|
776
779
|
});
|
|
777
780
|
void queryClient.cancelQueries(
|
|
778
|
-
{
|
|
781
|
+
{
|
|
782
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
783
|
+
},
|
|
779
784
|
{ revert: false },
|
|
780
785
|
);
|
|
781
|
-
}, [dashboardId, dashboardUpdatedAt, queryClient]);
|
|
786
|
+
}, [dashboardId, dashboardScope, dashboardUpdatedAt, queryClient]);
|
|
782
787
|
|
|
783
788
|
// Track which panels remote users are editing (from awareness)
|
|
784
789
|
const [remoteEditingPanels, setRemoteEditingPanels] = useState<
|
|
@@ -872,7 +877,7 @@ function SqlDashboardPageContent({
|
|
|
872
877
|
resetRevisionNavigation();
|
|
873
878
|
revisionRestoreInFlightRef.current = false;
|
|
874
879
|
if (!dashboardId) setLoaded(true);
|
|
875
|
-
}, [dashboardId, resetRevisionNavigation]);
|
|
880
|
+
}, [dashboardId, dashboardScope, resetRevisionNavigation]);
|
|
876
881
|
|
|
877
882
|
useEffect(() => {
|
|
878
883
|
if (!dashboardId || !dashboardQuery.isSuccess) return;
|
|
@@ -1075,16 +1080,16 @@ function SqlDashboardPageContent({
|
|
|
1075
1080
|
.then(({ isLatest }) => {
|
|
1076
1081
|
if (!isLatest) return;
|
|
1077
1082
|
queryClient.removeQueries({
|
|
1078
|
-
queryKey: sqlDashboardPrefetchKey(dashboardId),
|
|
1083
|
+
queryKey: sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
1079
1084
|
});
|
|
1080
1085
|
queryClient.invalidateQueries({
|
|
1081
|
-
queryKey: ["sql-dashboards-sidebar"],
|
|
1086
|
+
queryKey: ["sql-dashboards-sidebar", dashboardScope],
|
|
1082
1087
|
});
|
|
1083
1088
|
queryClient.invalidateQueries({
|
|
1084
|
-
queryKey: ["sql-dashboards-palette"],
|
|
1089
|
+
queryKey: ["sql-dashboards-palette", dashboardScope],
|
|
1085
1090
|
});
|
|
1086
1091
|
queryClient.invalidateQueries({
|
|
1087
|
-
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
1092
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
1088
1093
|
});
|
|
1089
1094
|
})
|
|
1090
1095
|
.catch((err) => {
|
|
@@ -1099,6 +1104,7 @@ function SqlDashboardPageContent({
|
|
|
1099
1104
|
},
|
|
1100
1105
|
[
|
|
1101
1106
|
dashboardId,
|
|
1107
|
+
dashboardScope,
|
|
1102
1108
|
canEdit,
|
|
1103
1109
|
enqueueDashboardSave,
|
|
1104
1110
|
holdDashboardConfig,
|
|
@@ -1126,16 +1132,21 @@ function SqlDashboardPageContent({
|
|
|
1126
1132
|
setDashboard(updated);
|
|
1127
1133
|
updateCachedDashboardConfig(updated);
|
|
1128
1134
|
queryClient.removeQueries({
|
|
1129
|
-
queryKey: sqlDashboardPrefetchKey(dashboardId),
|
|
1135
|
+
queryKey: sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
1136
|
+
});
|
|
1137
|
+
queryClient.invalidateQueries({
|
|
1138
|
+
queryKey: ["sql-dashboards-sidebar", dashboardScope],
|
|
1139
|
+
});
|
|
1140
|
+
queryClient.invalidateQueries({
|
|
1141
|
+
queryKey: ["sql-dashboards-palette", dashboardScope],
|
|
1130
1142
|
});
|
|
1131
|
-
queryClient.invalidateQueries({ queryKey: ["sql-dashboards-sidebar"] });
|
|
1132
|
-
queryClient.invalidateQueries({ queryKey: ["sql-dashboards-palette"] });
|
|
1133
1143
|
queryClient.invalidateQueries({
|
|
1134
|
-
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
1144
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
1135
1145
|
});
|
|
1136
1146
|
},
|
|
1137
1147
|
[
|
|
1138
1148
|
dashboardId,
|
|
1149
|
+
dashboardScope,
|
|
1139
1150
|
canEdit,
|
|
1140
1151
|
enqueueDashboardSave,
|
|
1141
1152
|
holdDashboardConfig,
|
|
@@ -1596,16 +1607,27 @@ function SqlDashboardPageContent({
|
|
|
1596
1607
|
if (!dashboardId) return;
|
|
1597
1608
|
if (!canManage) return;
|
|
1598
1609
|
await deleteDashboardAction({ id: dashboardId });
|
|
1599
|
-
queryClient.invalidateQueries({
|
|
1600
|
-
|
|
1610
|
+
queryClient.invalidateQueries({
|
|
1611
|
+
queryKey: ["sql-dashboards-sidebar", dashboardScope],
|
|
1612
|
+
});
|
|
1613
|
+
queryClient.invalidateQueries({
|
|
1614
|
+
queryKey: ["sql-dashboards-palette", dashboardScope],
|
|
1615
|
+
});
|
|
1601
1616
|
queryClient.removeQueries({
|
|
1602
|
-
queryKey: sqlDashboardPrefetchKey(dashboardId),
|
|
1617
|
+
queryKey: sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
1603
1618
|
});
|
|
1604
1619
|
queryClient.invalidateQueries({
|
|
1605
|
-
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
1620
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
1606
1621
|
});
|
|
1607
1622
|
navigate("/");
|
|
1608
|
-
}, [
|
|
1623
|
+
}, [
|
|
1624
|
+
dashboardId,
|
|
1625
|
+
dashboardScope,
|
|
1626
|
+
canManage,
|
|
1627
|
+
deleteDashboardAction,
|
|
1628
|
+
queryClient,
|
|
1629
|
+
navigate,
|
|
1630
|
+
]);
|
|
1609
1631
|
|
|
1610
1632
|
const dismissDemoIntro = useCallback(() => {
|
|
1611
1633
|
setSearchParams(
|
|
@@ -1624,12 +1646,14 @@ function SqlDashboardPageContent({
|
|
|
1624
1646
|
if (archivedAt) return;
|
|
1625
1647
|
try {
|
|
1626
1648
|
await archiveDashboardAction({ id: dashboardId, archived: true });
|
|
1627
|
-
queryClient.invalidateQueries({
|
|
1649
|
+
queryClient.invalidateQueries({
|
|
1650
|
+
queryKey: ["sql-dashboards-sidebar", dashboardScope],
|
|
1651
|
+
});
|
|
1628
1652
|
queryClient.removeQueries({
|
|
1629
|
-
queryKey: sqlDashboardPrefetchKey(dashboardId),
|
|
1653
|
+
queryKey: sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
1630
1654
|
});
|
|
1631
1655
|
queryClient.invalidateQueries({
|
|
1632
|
-
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
1656
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
1633
1657
|
});
|
|
1634
1658
|
toast.success(`Archived "${dashboard?.name ?? "dashboard"}"`);
|
|
1635
1659
|
navigate("/");
|
|
@@ -1640,6 +1664,7 @@ function SqlDashboardPageContent({
|
|
|
1640
1664
|
}
|
|
1641
1665
|
}, [
|
|
1642
1666
|
dashboardId,
|
|
1667
|
+
dashboardScope,
|
|
1643
1668
|
canEdit,
|
|
1644
1669
|
archivedAt,
|
|
1645
1670
|
archiveDashboardAction,
|
|
@@ -1659,13 +1684,17 @@ function SqlDashboardPageContent({
|
|
|
1659
1684
|
if (typeof result?.ownerEmail === "string") {
|
|
1660
1685
|
setDashboardOwner(result.ownerEmail);
|
|
1661
1686
|
}
|
|
1662
|
-
queryClient.invalidateQueries({
|
|
1663
|
-
|
|
1687
|
+
queryClient.invalidateQueries({
|
|
1688
|
+
queryKey: ["sql-dashboards-sidebar", dashboardScope],
|
|
1689
|
+
});
|
|
1690
|
+
queryClient.invalidateQueries({
|
|
1691
|
+
queryKey: ["sql-dashboards-palette", dashboardScope],
|
|
1692
|
+
});
|
|
1664
1693
|
queryClient.removeQueries({
|
|
1665
|
-
queryKey: sqlDashboardPrefetchKey(dashboardId),
|
|
1694
|
+
queryKey: sqlDashboardPrefetchKey(dashboardId, dashboardScope),
|
|
1666
1695
|
});
|
|
1667
1696
|
queryClient.invalidateQueries({
|
|
1668
|
-
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
1697
|
+
queryKey: ["data", "sql-dashboard", dashboardId, dashboardScope],
|
|
1669
1698
|
});
|
|
1670
1699
|
toast.success(`Unhid "${dashboard?.name ?? "dashboard"}"`);
|
|
1671
1700
|
} catch (err) {
|
|
@@ -1673,7 +1702,13 @@ function SqlDashboardPageContent({
|
|
|
1673
1702
|
err instanceof Error ? err.message : "Couldn't unhide dashboard",
|
|
1674
1703
|
);
|
|
1675
1704
|
}
|
|
1676
|
-
}, [
|
|
1705
|
+
}, [
|
|
1706
|
+
dashboardId,
|
|
1707
|
+
dashboardScope,
|
|
1708
|
+
dashboard?.name,
|
|
1709
|
+
hideDashboardAction,
|
|
1710
|
+
queryClient,
|
|
1711
|
+
]);
|
|
1677
1712
|
|
|
1678
1713
|
const handleSaveView = useCallback(
|
|
1679
1714
|
async (name: string, filters: Record<string, string>) => {
|
|
@@ -95,6 +95,10 @@ function DbSyncBridge() {
|
|
|
95
95
|
const queryClient = useQueryClient();
|
|
96
96
|
useDbSync({
|
|
97
97
|
queryClient,
|
|
98
|
+
// Netlify functions cannot reliably hold the local long-lived SSE
|
|
99
|
+
// response. Analytics uses the poll safety net until a hosted realtime
|
|
100
|
+
// gateway is configured for this deployment.
|
|
101
|
+
sseUrl: false,
|
|
98
102
|
ignoreSource: TAB_ID,
|
|
99
103
|
onEvent: notifyProviderCorpusJobSyncEvent,
|
|
100
104
|
actionInvalidatePredicate: shouldInvalidateAnalyticsQueryForAction,
|
|
@@ -26,6 +26,10 @@ const ROLLUP_SCHEDULED_NAME = "analytics-rollup-backfill-cron";
|
|
|
26
26
|
const ROLLUP_WORKER_NAME = "analytics-rollup-backfill-background";
|
|
27
27
|
const ROLLUP_ROUTE_PATH = "/api/analytics-rollups/backfill";
|
|
28
28
|
const ROLLUP_SCHEDULE = "*/15 * * * *";
|
|
29
|
+
const RETENTION_SCHEDULED_NAME = "session-replay-retention-cron";
|
|
30
|
+
const RETENTION_WORKER_NAME = "session-replay-retention-sweep-background";
|
|
31
|
+
const RETENTION_ROUTE_PATH = "/api/session-replay/retention";
|
|
32
|
+
const RETENTION_SCHEDULE = "0 3 * * *";
|
|
29
33
|
|
|
30
34
|
function ensureDir(dir: string) {
|
|
31
35
|
mkdirSync(dir, { recursive: true });
|
|
@@ -495,6 +499,108 @@ export const config = {
|
|
|
495
499
|
writeFileSync(path.join(dest, `${ROLLUP_WORKER_NAME}.mjs`), source);
|
|
496
500
|
}
|
|
497
501
|
|
|
502
|
+
function emitRetentionScheduledTrigger(token: string) {
|
|
503
|
+
const dest = path.join(FUNCTIONS_DIR, RETENTION_SCHEDULED_NAME);
|
|
504
|
+
rmSync(dest, { recursive: true, force: true });
|
|
505
|
+
ensureDir(dest);
|
|
506
|
+
|
|
507
|
+
const source = `const WORKER_PATH = "/.netlify/functions/${RETENTION_WORKER_NAME}";
|
|
508
|
+
const CRON_TOKEN = ${JSON.stringify(token)};
|
|
509
|
+
|
|
510
|
+
function siteOrigin(request) {
|
|
511
|
+
const configured = process.env.URL || process.env.DEPLOY_URL;
|
|
512
|
+
if (configured) return configured;
|
|
513
|
+
const url = new URL(request.url);
|
|
514
|
+
return url.origin;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export default async function handler(request) {
|
|
518
|
+
const url = new URL(WORKER_PATH, siteOrigin(request));
|
|
519
|
+
const response = await fetch(url.toString(), {
|
|
520
|
+
method: "POST",
|
|
521
|
+
headers: {
|
|
522
|
+
"content-type": "application/json",
|
|
523
|
+
"x-agent-native-session-replay-retention-cron": CRON_TOKEN,
|
|
524
|
+
},
|
|
525
|
+
body: JSON.stringify({ scheduled: true }),
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
if (!response.ok && response.status !== 202) {
|
|
529
|
+
console.error(
|
|
530
|
+
"[session-replay-retention-cron] Background retention trigger failed:",
|
|
531
|
+
response.status,
|
|
532
|
+
// coercion-ok: the non-2xx status remains the failure signal; the body is diagnostics only.
|
|
533
|
+
await response.text().catch(() => ""),
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export const config = {
|
|
539
|
+
name: "session replay retention cron trigger",
|
|
540
|
+
generator: "agent-native analytics build",
|
|
541
|
+
schedule: ${JSON.stringify(RETENTION_SCHEDULE)},
|
|
542
|
+
};
|
|
543
|
+
`;
|
|
544
|
+
|
|
545
|
+
writeFileSync(path.join(dest, `${RETENTION_SCHEDULED_NAME}.mjs`), source);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function emitRetentionBackgroundWorker(token: string) {
|
|
549
|
+
const dest = path.join(FUNCTIONS_DIR, RETENTION_WORKER_NAME);
|
|
550
|
+
rmSync(dest, { recursive: true, force: true });
|
|
551
|
+
cloneServerBundleForFunction(SERVER_DIR, dest);
|
|
552
|
+
rmSync(path.join(dest, "server.mjs"), { force: true });
|
|
553
|
+
|
|
554
|
+
const source = `globalThis.__AGENT_NATIVE_BACKGROUND_RUNTIME__ = true;
|
|
555
|
+
globalThis.__AGENT_NATIVE_LOW_CONNECTION_BACKGROUND_RUNTIME__ = true;
|
|
556
|
+
globalThis.__AGENT_NATIVE_SESSION_REPLAY_RETENTION_SCHEDULED_RUNTIME__ = true;
|
|
557
|
+
|
|
558
|
+
const CRON_TOKEN = ${JSON.stringify(token)};
|
|
559
|
+
const ROUTE_PATH = ${JSON.stringify(RETENTION_ROUTE_PATH)};
|
|
560
|
+
let cachedHandler;
|
|
561
|
+
|
|
562
|
+
function timingSafeEquals(a, b) {
|
|
563
|
+
if (a.length !== b.length) return false;
|
|
564
|
+
let diff = 0;
|
|
565
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
566
|
+
diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
567
|
+
}
|
|
568
|
+
return diff === 0;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export default async function handler(request, context) {
|
|
572
|
+
const token = request.headers.get("x-agent-native-session-replay-retention-cron") || "";
|
|
573
|
+
if (!timingSafeEquals(token, CRON_TOKEN)) {
|
|
574
|
+
return new Response("Unauthorized", { status: 401 });
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
cachedHandler ??= (await import("./main.mjs")).default;
|
|
578
|
+
const url = new URL(request.url);
|
|
579
|
+
url.pathname = ROUTE_PATH;
|
|
580
|
+
url.search = "";
|
|
581
|
+
|
|
582
|
+
const rewritten = new Request(url.toString(), {
|
|
583
|
+
method: "POST",
|
|
584
|
+
headers: new Headers({ "content-type": "application/json" }),
|
|
585
|
+
body: JSON.stringify({ scheduled: true }),
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
return await cachedHandler(rewritten, context);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export const config = {
|
|
592
|
+
name: "session replay retention background sweep",
|
|
593
|
+
generator: "agent-native analytics build",
|
|
594
|
+
background: true,
|
|
595
|
+
nodeBundler: "none",
|
|
596
|
+
includedFiles: ["**"],
|
|
597
|
+
preferStatic: false,
|
|
598
|
+
};
|
|
599
|
+
`;
|
|
600
|
+
|
|
601
|
+
writeFileSync(path.join(dest, `${RETENTION_WORKER_NAME}.mjs`), source);
|
|
602
|
+
}
|
|
603
|
+
|
|
498
604
|
function isDirectRun(): boolean {
|
|
499
605
|
const entrypoint = process.argv[1];
|
|
500
606
|
return Boolean(
|
|
@@ -515,6 +621,7 @@ function main(): void {
|
|
|
515
621
|
const alertToken = randomBytes(32).toString("hex");
|
|
516
622
|
const uptimeToken = randomBytes(32).toString("hex");
|
|
517
623
|
const rollupToken = randomBytes(32).toString("hex");
|
|
624
|
+
const retentionToken = randomBytes(32).toString("hex");
|
|
518
625
|
emitScheduledTrigger(token);
|
|
519
626
|
emitBackgroundWorker(token);
|
|
520
627
|
emitAlertScheduledTrigger(alertToken);
|
|
@@ -523,6 +630,8 @@ function main(): void {
|
|
|
523
630
|
emitUptimeBackgroundWorker(uptimeToken);
|
|
524
631
|
emitRollupScheduledTrigger(rollupToken);
|
|
525
632
|
emitRollupBackgroundWorker(rollupToken);
|
|
633
|
+
emitRetentionScheduledTrigger(retentionToken);
|
|
634
|
+
emitRetentionBackgroundWorker(retentionToken);
|
|
526
635
|
console.log(
|
|
527
636
|
`[dashboard-report-cron] Emitted Netlify scheduled trigger "${SCHEDULED_NAME}" (${SCHEDULE}) and background worker "${WORKER_NAME}".`,
|
|
528
637
|
);
|
|
@@ -535,6 +644,9 @@ function main(): void {
|
|
|
535
644
|
console.log(
|
|
536
645
|
`[analytics-rollup-backfill-cron] Emitted Netlify scheduled trigger "${ROLLUP_SCHEDULED_NAME}" (${ROLLUP_SCHEDULE}) and background worker "${ROLLUP_WORKER_NAME}".`,
|
|
537
646
|
);
|
|
647
|
+
console.log(
|
|
648
|
+
`[session-replay-retention-cron] Emitted Netlify scheduled trigger "${RETENTION_SCHEDULED_NAME}" (${RETENTION_SCHEDULE}) and background worker "${RETENTION_WORKER_NAME}".`,
|
|
649
|
+
);
|
|
538
650
|
}
|
|
539
651
|
|
|
540
652
|
if (isDirectRun()) {
|
|
@@ -59,6 +59,18 @@ registerShareableResource({
|
|
|
59
59
|
getDb,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
registerShareableResource({
|
|
63
|
+
type: "dashboard-folder",
|
|
64
|
+
resourceTable: schema.dashboardFolders,
|
|
65
|
+
sharesTable: schema.dashboardFolderShares,
|
|
66
|
+
displayName: "Dashboard folder",
|
|
67
|
+
titleColumn: "name",
|
|
68
|
+
getResourcePath: (folder) => `/dashboards?folder=${folder.id}`,
|
|
69
|
+
allowPublic: false,
|
|
70
|
+
requireOrgMemberForUserShares: true,
|
|
71
|
+
getDb,
|
|
72
|
+
});
|
|
73
|
+
|
|
62
74
|
registerShareableResource({
|
|
63
75
|
type: "analysis",
|
|
64
76
|
resourceTable: schema.analyses,
|
|
@@ -38,6 +38,7 @@ export const dashboards = table("dashboards", {
|
|
|
38
38
|
/** Hidden dashboards are omitted from default navigation but remain openable. */
|
|
39
39
|
hiddenAt: text("hidden_at"),
|
|
40
40
|
hiddenBy: text("hidden_by"),
|
|
41
|
+
folderId: text("folder_id"),
|
|
41
42
|
/** Last authenticated user who changed dashboard metadata/config, if tracked. */
|
|
42
43
|
updatedBy: text("updated_by"),
|
|
43
44
|
...ownableColumns(),
|
|
@@ -55,6 +56,19 @@ export const dashboardNameLocks = table("dashboard_name_locks", {
|
|
|
55
56
|
|
|
56
57
|
export const dashboardShares = createSharesTable("dashboard_shares");
|
|
57
58
|
|
|
59
|
+
export const dashboardFolders = table("dashboard_folders", {
|
|
60
|
+
id: text("id").primaryKey(),
|
|
61
|
+
name: text("name").notNull(),
|
|
62
|
+
scope: text("scope", { enum: ["personal", "shared"] }).notNull(),
|
|
63
|
+
createdAt: text("created_at").notNull().default(now()),
|
|
64
|
+
updatedAt: text("updated_at").notNull().default(now()),
|
|
65
|
+
...ownableColumns(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const dashboardFolderShares = createSharesTable(
|
|
69
|
+
"dashboard_folder_shares",
|
|
70
|
+
);
|
|
71
|
+
|
|
58
72
|
/**
|
|
59
73
|
* Bounded dashboard history. Each row snapshots the previous dashboard config
|
|
60
74
|
* before a meaningful save so users and agents can restore known-good states.
|
|
@@ -137,6 +137,7 @@ const SQLITE_BACKFILL_STATEMENTS = [
|
|
|
137
137
|
type BackfillStatus =
|
|
138
138
|
| "completed"
|
|
139
139
|
| "already-complete"
|
|
140
|
+
| "disabled"
|
|
140
141
|
| "skipped-lock"
|
|
141
142
|
| "already-running";
|
|
142
143
|
|
|
@@ -320,6 +321,9 @@ async function runD1Backfill(
|
|
|
320
321
|
* each scan the full event history.
|
|
321
322
|
*/
|
|
322
323
|
export async function runAnalyticsRollupBackfillOnce(): Promise<AnalyticsRollupBackfillResult> {
|
|
324
|
+
if (process.env.ANALYTICS_ROLLUP_BACKFILL_JOBS?.trim() === "0") {
|
|
325
|
+
return { status: "disabled", remaining: 1 };
|
|
326
|
+
}
|
|
323
327
|
if (running) {
|
|
324
328
|
return { status: "already-running", remaining: 1 };
|
|
325
329
|
}
|
|
@@ -37,6 +37,7 @@ export const INITIAL_TOOL_NAMES = [
|
|
|
37
37
|
// tool-search round trip (~15 KB of results) before it can even start — or worse,
|
|
38
38
|
// enumerates the cohort page by page through whatever it can already see.
|
|
39
39
|
"provider-api-request",
|
|
40
|
+
"provider-corpus-job",
|
|
40
41
|
"query-staged-dataset",
|
|
41
42
|
"hubspot-records",
|
|
42
43
|
"navigate",
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { getAllSettings, listOrgSettings } from "@agent-native/core/settings";
|
|
2
2
|
|
|
3
3
|
import { dashboardCatalogEntries } from "./dashboard-catalog";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
listDashboardSummaries,
|
|
6
|
+
loadDashboardCatalogDashboards,
|
|
7
|
+
type DashboardCatalogRecord,
|
|
8
|
+
type DashboardSummaryRecord,
|
|
9
|
+
} from "./dashboards-store";
|
|
5
10
|
|
|
6
11
|
const DATA_DICTIONARY_KEY_PREFIX = "data-dict-";
|
|
7
12
|
const MAX_QUERY_LENGTH = 12_000;
|
|
13
|
+
const MAX_CATALOG_DASHBOARD_HYDRATION = 24;
|
|
8
14
|
const STOP_WORDS = new Set([
|
|
9
15
|
"a",
|
|
10
16
|
"all",
|
|
@@ -106,6 +112,44 @@ function compactQuery(value: unknown): string | Record<string, unknown> | null {
|
|
|
106
112
|
return null;
|
|
107
113
|
}
|
|
108
114
|
|
|
115
|
+
function summaryScore(
|
|
116
|
+
search: string,
|
|
117
|
+
dashboard: DashboardSummaryRecord,
|
|
118
|
+
): number {
|
|
119
|
+
const { score } = matchScore(search, [
|
|
120
|
+
{ value: dashboard.name, weight: 24 },
|
|
121
|
+
{ value: dashboard.description, weight: 12 },
|
|
122
|
+
{ value: dashboard.configName, weight: 10 },
|
|
123
|
+
{ value: dashboard.catalogTemplateId, weight: 6 },
|
|
124
|
+
{ value: dashboard.demoId, weight: 6 },
|
|
125
|
+
]);
|
|
126
|
+
return score;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function shortlistDashboardSummaries(
|
|
130
|
+
search: string,
|
|
131
|
+
dashboards: DashboardSummaryRecord[],
|
|
132
|
+
limit: number,
|
|
133
|
+
): DashboardSummaryRecord[] {
|
|
134
|
+
const maxHydration = Math.min(
|
|
135
|
+
Math.max(limit * 4, 12),
|
|
136
|
+
MAX_CATALOG_DASHBOARD_HYDRATION,
|
|
137
|
+
);
|
|
138
|
+
return dashboards
|
|
139
|
+
.map((dashboard) => ({
|
|
140
|
+
dashboard,
|
|
141
|
+
score: summaryScore(search, dashboard),
|
|
142
|
+
}))
|
|
143
|
+
.sort((a, b) => {
|
|
144
|
+
if (b.score !== a.score) return b.score - a.score;
|
|
145
|
+
return JSON.stringify(a.dashboard).localeCompare(
|
|
146
|
+
JSON.stringify(b.dashboard),
|
|
147
|
+
);
|
|
148
|
+
})
|
|
149
|
+
.slice(0, maxHydration)
|
|
150
|
+
.map(({ dashboard }) => dashboard);
|
|
151
|
+
}
|
|
152
|
+
|
|
109
153
|
// Analytics vocabulary the corpus spells out but users abbreviate (or vice versa).
|
|
110
154
|
// Expansions match at reduced weight so they break ties without outranking a literal hit.
|
|
111
155
|
const SYNONYM_EXPANSIONS: Record<string, string[]> = {
|
|
@@ -497,13 +541,15 @@ async function listDictionaryEntries(args: {
|
|
|
497
541
|
return entries;
|
|
498
542
|
}
|
|
499
543
|
|
|
500
|
-
function savedDashboardInput(
|
|
501
|
-
|
|
544
|
+
function savedDashboardInput(
|
|
545
|
+
summary: DashboardSummaryRecord,
|
|
546
|
+
dashboard: DashboardCatalogRecord,
|
|
547
|
+
) {
|
|
502
548
|
return {
|
|
503
549
|
id: dashboard.id,
|
|
504
|
-
title:
|
|
505
|
-
description:
|
|
506
|
-
config,
|
|
550
|
+
title: summary.name,
|
|
551
|
+
description: summary.description ?? undefined,
|
|
552
|
+
config: dashboard.config,
|
|
507
553
|
origin: "saved-dashboard" as const,
|
|
508
554
|
};
|
|
509
555
|
}
|
|
@@ -514,26 +560,46 @@ export async function searchAnalyticsQueryCatalog(args: {
|
|
|
514
560
|
orgId: string | null;
|
|
515
561
|
limit: number;
|
|
516
562
|
}): Promise<AnalyticsQueryCatalogCandidate[]> {
|
|
517
|
-
const [
|
|
563
|
+
const [savedSummariesResult, dictionaryEntriesResult] =
|
|
518
564
|
await Promise.allSettled([
|
|
519
|
-
|
|
565
|
+
listDashboardSummaries(
|
|
520
566
|
{ email: args.email, orgId: args.orgId },
|
|
521
|
-
{
|
|
567
|
+
{
|
|
568
|
+
kind: "sql",
|
|
569
|
+
archived: "active",
|
|
570
|
+
hidden: "visible",
|
|
571
|
+
includeCatalogMetadata: true,
|
|
572
|
+
},
|
|
522
573
|
),
|
|
523
574
|
listDictionaryEntries({ email: args.email, orgId: args.orgId }),
|
|
524
575
|
]);
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
?
|
|
576
|
+
const savedSummaries =
|
|
577
|
+
savedSummariesResult.status === "fulfilled"
|
|
578
|
+
? savedSummariesResult.value
|
|
528
579
|
: [];
|
|
529
580
|
const dictionaryEntries =
|
|
530
581
|
dictionaryEntriesResult.status === "fulfilled"
|
|
531
582
|
? dictionaryEntriesResult.value
|
|
532
583
|
: [];
|
|
584
|
+
const savedSummaryIds = new Set(
|
|
585
|
+
savedSummaries.map((dashboard) => dashboard.id),
|
|
586
|
+
);
|
|
533
587
|
|
|
534
|
-
const
|
|
588
|
+
const shortlistedSummaries = shortlistDashboardSummaries(
|
|
589
|
+
args.search,
|
|
590
|
+
savedSummaries,
|
|
591
|
+
args.limit,
|
|
592
|
+
);
|
|
593
|
+
const shortlistedIds = shortlistedSummaries.map((dashboard) => dashboard.id);
|
|
594
|
+
const savedDashboardsResult = await loadDashboardCatalogDashboards(
|
|
595
|
+
{ email: args.email, orgId: args.orgId },
|
|
596
|
+
shortlistedIds,
|
|
597
|
+
);
|
|
598
|
+
const savedDashboards = new Map(
|
|
599
|
+
savedDashboardsResult.map((dashboard) => [dashboard.id, dashboard]),
|
|
600
|
+
);
|
|
535
601
|
const templateDashboards = dashboardCatalogEntries
|
|
536
|
-
.filter((entry) => !
|
|
602
|
+
.filter((entry) => !savedSummaryIds.has(entry.defaultDashboardId))
|
|
537
603
|
.flatMap((entry) => {
|
|
538
604
|
try {
|
|
539
605
|
const config = entry.buildConfig() as unknown as Record<
|
|
@@ -557,7 +623,11 @@ export async function searchAnalyticsQueryCatalog(args: {
|
|
|
557
623
|
return rankAnalyticsQueryCatalog({
|
|
558
624
|
search: args.search,
|
|
559
625
|
dashboards: [
|
|
560
|
-
...
|
|
626
|
+
...shortlistedSummaries.flatMap((summary) => {
|
|
627
|
+
const dashboard = savedDashboards.get(summary.id);
|
|
628
|
+
if (!dashboard) return [];
|
|
629
|
+
return [savedDashboardInput(summary, dashboard)];
|
|
630
|
+
}),
|
|
561
631
|
...templateDashboards,
|
|
562
632
|
],
|
|
563
633
|
dictionaryEntries,
|