@agent-native/core 0.145.4 → 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/editor/editor-layout.tsx +8 -3
- package/corpus/templates/clips/app/components/editor/waveform.tsx +2 -1
- package/corpus/templates/clips/app/components/library/search-bar.tsx +1 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +3 -10
- package/corpus/templates/clips/app/global.css +9 -0
- 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/desktop/src-tauri/src/silence_detector.rs +10 -11
- 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/design/actions/view-screen.ts +1 -0
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +14 -1
- package/corpus/templates/design/changelog/2026-08-07-cmd-c-now-copies-selected-text-in-the-agent-panel-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-08-07-real-time-voice-can-now-read-the-current-selection-and-edit-.md +6 -0
- package/corpus/templates/design/server/lib/reprompt-action-guard.ts +7 -3
- 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/struct-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/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 +9 -9
- 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/secrets/routes.d.ts +6 -6
- 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/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/realtime-voice.d.ts +2 -1
- package/dist/server/realtime-voice.js +38 -56
- package/dist/server/short-lived-token.d.ts +43 -0
- package/dist/server/short-lived-token.js +74 -0
- 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 +2 -2
- 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
|
@@ -202,7 +202,7 @@ export function createProviderCorpusJobAction(options) {
|
|
|
202
202
|
"Use this for broad provider searches, cross-source joins, transcript/message/ticket/issue/document scans, batch endpoint walks, and absence-sensitive questions that may exceed one tool call. " +
|
|
203
203
|
"The job is generic: paginated-search walks any paginated provider endpoint; batch-search walks a supplied id/record list or staged dataset through any provider endpoint by injecting each batch into a query param or request body path. " +
|
|
204
204
|
"Every provider request still goes through provider-api-request credentials, host allow-listing, SSRF blocking, secret redaction, and provider quota cooldown. " +
|
|
205
|
-
"When status is paused or quota_wait, call operation=continue with the jobId after the indicated time/budget. Report coverage counts,
|
|
205
|
+
"When status is paused or quota_wait, call operation=continue with the jobId after the indicated time/budget. Report coverage counts, paginationComplete, and any remaining gaps; a max-pages stop is not exhaustive.",
|
|
206
206
|
schema: ProviderCorpusJobSchema,
|
|
207
207
|
http: false,
|
|
208
208
|
run: async (args) => runProviderCorpusJobAction(args, options),
|
|
@@ -826,6 +826,7 @@ function jobStatus(job) {
|
|
|
826
826
|
const nextResumeAtIso = job.nextResumeAt
|
|
827
827
|
? new Date(job.nextResumeAt).toISOString()
|
|
828
828
|
: null;
|
|
829
|
+
const coverage = paginationCoverage(job);
|
|
829
830
|
return {
|
|
830
831
|
job: jobSummary(job),
|
|
831
832
|
source: jobSourceSummary(job),
|
|
@@ -837,6 +838,7 @@ function jobStatus(job) {
|
|
|
837
838
|
totalHits: job.totalHits,
|
|
838
839
|
storedHits: job.storedHits,
|
|
839
840
|
truncatedHits: job.totalHits > job.storedHits,
|
|
841
|
+
...coverage,
|
|
840
842
|
},
|
|
841
843
|
checkpoint: job.checkpoint,
|
|
842
844
|
error: job.error,
|
|
@@ -898,6 +900,13 @@ function jobSummary(job) {
|
|
|
898
900
|
};
|
|
899
901
|
}
|
|
900
902
|
function nextAction(job) {
|
|
903
|
+
const coverage = paginationCoverage(job);
|
|
904
|
+
if (job.mode === "paginated-search" && !coverage.paginationComplete) {
|
|
905
|
+
if (coverage.paginationStopReason === "max-pages") {
|
|
906
|
+
return `Pagination stopped at maxPages for this job. Start a new job with a larger pagination.maxPages before treating the results as exhaustive; stored hits are readable with operation="results", jobId="${job.id}".`;
|
|
907
|
+
}
|
|
908
|
+
return `Pagination coverage is incomplete${coverage.paginationStopReason ? ` (${coverage.paginationStopReason})` : ""}. Do not treat the stored hits as exhaustive; inspect the provider checkpoint or start a new bounded job before making coverage-sensitive claims. Stored hits are readable with operation="results", jobId="${job.id}".`;
|
|
909
|
+
}
|
|
901
910
|
if (job.status === "completed") {
|
|
902
911
|
return `Read all stored hits with operation="results", jobId="${job.id}".`;
|
|
903
912
|
}
|
|
@@ -915,6 +924,27 @@ function nextAction(job) {
|
|
|
915
924
|
}
|
|
916
925
|
return `Check status with operation="status", jobId="${job.id}".`;
|
|
917
926
|
}
|
|
927
|
+
function paginationCoverage(job) {
|
|
928
|
+
const stopReason = typeof job.checkpoint.stoppedReason === "string"
|
|
929
|
+
? job.checkpoint.stoppedReason
|
|
930
|
+
: null;
|
|
931
|
+
if (job.mode !== "paginated-search") {
|
|
932
|
+
return {
|
|
933
|
+
paginationComplete: job.status === "completed",
|
|
934
|
+
paginationStopReason: stopReason,
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
return {
|
|
938
|
+
paginationComplete: [
|
|
939
|
+
"empty-page",
|
|
940
|
+
"no-next-cursor",
|
|
941
|
+
"repeated-cursor",
|
|
942
|
+
"short-page",
|
|
943
|
+
"single-page",
|
|
944
|
+
].includes(stopReason ?? ""),
|
|
945
|
+
paginationStopReason: stopReason,
|
|
946
|
+
};
|
|
947
|
+
}
|
|
918
948
|
function extractItemsArray(body, itemsPath, wrapObjectFallback) {
|
|
919
949
|
if (Array.isArray(body))
|
|
920
950
|
return body;
|
|
@@ -43,6 +43,8 @@ export interface ProviderApiRequestArgs {
|
|
|
43
43
|
body?: unknown;
|
|
44
44
|
auth?: "default" | "none";
|
|
45
45
|
timeoutMs?: number;
|
|
46
|
+
/** Internal cancellation signal for trusted server-side callers. */
|
|
47
|
+
signal?: AbortSignal;
|
|
46
48
|
maxBytes?: number;
|
|
47
49
|
connectionId?: string | null;
|
|
48
50
|
accountId?: string | null;
|
|
@@ -1307,6 +1307,7 @@ export async function executeProviderApiRequest(args, runtime) {
|
|
|
1307
1307
|
body: pageBody,
|
|
1308
1308
|
maxBytes: effectiveMaxBytes,
|
|
1309
1309
|
timeoutMs: clampTimeout(args.timeoutMs),
|
|
1310
|
+
signal: args.signal,
|
|
1310
1311
|
secretValues: auth.secretValues,
|
|
1311
1312
|
quota: {
|
|
1312
1313
|
identity: quotaIdentity,
|
|
@@ -1352,6 +1353,7 @@ export async function executeProviderApiRequest(args, runtime) {
|
|
|
1352
1353
|
body,
|
|
1353
1354
|
maxBytes: effectiveMaxBytes,
|
|
1354
1355
|
timeoutMs: clampTimeout(args.timeoutMs),
|
|
1356
|
+
signal: args.signal,
|
|
1355
1357
|
secretValues: auth.secretValues,
|
|
1356
1358
|
quota: {
|
|
1357
1359
|
identity: quotaIdentity,
|
|
@@ -2058,6 +2060,7 @@ async function executeCustomProviderApiRequest(args, customConfig, runtime) {
|
|
|
2058
2060
|
body: pageBody,
|
|
2059
2061
|
maxBytes: effectiveMaxBytes,
|
|
2060
2062
|
timeoutMs: clampTimeout(args.timeoutMs),
|
|
2063
|
+
signal: args.signal,
|
|
2061
2064
|
secretValues: auth.secretValues,
|
|
2062
2065
|
quota: {
|
|
2063
2066
|
identity: quotaIdentity,
|
|
@@ -2099,6 +2102,7 @@ async function executeCustomProviderApiRequest(args, customConfig, runtime) {
|
|
|
2099
2102
|
body,
|
|
2100
2103
|
maxBytes: effectiveMaxBytes,
|
|
2101
2104
|
timeoutMs: clampTimeout(args.timeoutMs),
|
|
2105
|
+
signal: args.signal,
|
|
2102
2106
|
secretValues: auth.secretValues,
|
|
2103
2107
|
quota: {
|
|
2104
2108
|
identity: quotaIdentity,
|
|
@@ -3724,7 +3728,9 @@ async function fetchWithTimeout(optionsUrl, options) {
|
|
|
3724
3728
|
method,
|
|
3725
3729
|
headers: options.headers,
|
|
3726
3730
|
body: options.body,
|
|
3727
|
-
signal:
|
|
3731
|
+
signal: options.signal
|
|
3732
|
+
? AbortSignal.any([options.signal, controller.signal])
|
|
3733
|
+
: controller.signal,
|
|
3728
3734
|
redirect: "manual",
|
|
3729
3735
|
};
|
|
3730
3736
|
if (dispatcher)
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
37
37
|
ok?: undefined;
|
|
38
38
|
status?: undefined;
|
|
39
39
|
} | {
|
|
40
|
-
error?: undefined;
|
|
41
40
|
ok: boolean;
|
|
42
41
|
status: string;
|
|
42
|
+
error?: undefined;
|
|
43
43
|
} | {
|
|
44
44
|
ok?: undefined;
|
|
45
45
|
error: string;
|
|
46
46
|
removed?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
error?: undefined;
|
|
49
48
|
ok: boolean;
|
|
50
49
|
removed: boolean;
|
|
50
|
+
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — validate an optional candidate value
|
|
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
|
|
|
58
58
|
error: string;
|
|
59
59
|
note?: undefined;
|
|
60
60
|
} | {
|
|
61
|
-
error?: undefined;
|
|
62
61
|
ok: boolean;
|
|
63
62
|
note?: undefined;
|
|
64
|
-
} | {
|
|
65
63
|
error?: undefined;
|
|
64
|
+
} | {
|
|
66
65
|
ok: boolean;
|
|
67
66
|
note: string;
|
|
67
|
+
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
|
|
|
95
95
|
export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
|
|
96
96
|
error: string;
|
|
97
97
|
} | {
|
|
98
|
-
error?: undefined;
|
|
99
98
|
ok: boolean;
|
|
100
99
|
key: string;
|
|
101
|
-
} | {
|
|
102
100
|
error?: undefined;
|
|
101
|
+
} | {
|
|
103
102
|
ok: boolean;
|
|
104
103
|
removed: boolean;
|
|
104
|
+
error?: undefined;
|
|
105
105
|
}>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type RecurringJobsRuntimeEnvKey = "AGENT_NATIVE_DISABLE_RECURRING_JOBS" | "AGENT_NATIVE_ENABLE_LOCAL_RECURRING_JOBS" | "APP_URL" | "BETTER_AUTH_URL" | "DEPLOY_URL" | "NETLIFY" | "NETLIFY_LOCAL" | "NODE_ENV" | "SITE_ID" | "URL" | "VITE_APP_URL" | "VITE_WORKSPACE_GATEWAY_URL" | "WORKSPACE_GATEWAY_URL";
|
|
1
|
+
type RecurringJobsRuntimeEnvKey = "AGENT_NATIVE_DISABLE_RECURRING_JOBS" | "AGENT_NATIVE_ENABLE_LOCAL_RECURRING_JOBS" | "APP_URL" | "BETTER_AUTH_URL" | "CF_PAGES" | "DEPLOY_URL" | "AWS_EXECUTION_ENV" | "AWS_LAMBDA_FUNCTION_NAME" | "NETLIFY" | "NETLIFY_LOCAL" | "NITRO_PRESET" | "NODE_ENV" | "SITE_ID" | "URL" | "VERCEL" | "VITE_APP_URL" | "VITE_WORKSPACE_GATEWAY_URL" | "WORKSPACE_GATEWAY_URL";
|
|
2
2
|
type RecurringJobsRuntimeEnv = Partial<Record<RecurringJobsRuntimeEnvKey, string | undefined>>;
|
|
3
3
|
export declare function shouldDisableRecurringJobsRuntime(env?: RecurringJobsRuntimeEnv): boolean;
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
2
|
// Recurring-jobs runtime gating: decide whether this process should run the
|
|
3
|
-
// local recurring-job scheduler loop (disabled by default on hosted
|
|
4
|
-
//
|
|
3
|
+
// local recurring-job scheduler loop (disabled by default on hosted/serverless
|
|
4
|
+
// runtimes, enabled by default for local/dev).
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
function isTruthyEnv(value) {
|
|
7
7
|
return /^(1|true|yes|on)$/i.test(value?.trim() ?? "");
|
|
@@ -33,6 +33,18 @@ function isLoopbackAppUrl(value) {
|
|
|
33
33
|
export function shouldDisableRecurringJobsRuntime(env = process.env) {
|
|
34
34
|
if (isTruthyEnv(env.AGENT_NATIVE_DISABLE_RECURRING_JOBS))
|
|
35
35
|
return true;
|
|
36
|
+
// A serverless isolate is not a durable scheduler. Keep this check separate
|
|
37
|
+
// from the platform-specific scheduler branch below so a new sweep cannot
|
|
38
|
+
// accidentally start an in-process timer before its platform trigger exists.
|
|
39
|
+
const isServerlessRuntime = env.NETLIFY_LOCAL !== "true" &&
|
|
40
|
+
(isTruthyEnv(env.NETLIFY) ||
|
|
41
|
+
env.NITRO_PRESET === "netlify" ||
|
|
42
|
+
Boolean(env.AWS_LAMBDA_FUNCTION_NAME) ||
|
|
43
|
+
env.AWS_EXECUTION_ENV?.startsWith("AWS_Lambda") === true ||
|
|
44
|
+
isTruthyEnv(env.CF_PAGES) ||
|
|
45
|
+
isTruthyEnv(env.VERCEL));
|
|
46
|
+
if (isServerlessRuntime)
|
|
47
|
+
return true;
|
|
36
48
|
const isLocalRuntime = env.NODE_ENV === "development" ||
|
|
37
49
|
env.NODE_ENV === "test" ||
|
|
38
50
|
[
|
|
@@ -657,7 +657,18 @@ export async function createAgentEngineScriptEntries(appId) {
|
|
|
657
657
|
"manage-agent-engine": {
|
|
658
658
|
tool: mod.tool,
|
|
659
659
|
planMode: {
|
|
660
|
-
|
|
660
|
+
// Reads, per the tool's own enum: only set/set-app-default/
|
|
661
|
+
// reset-app-default mutate. Misclassifying a read here makes every
|
|
662
|
+
// call announce a change and bump the global `action` change
|
|
663
|
+
// version, which is how the model-picker's catalog read ended up
|
|
664
|
+
// recorded as a write for 1,127 identities.
|
|
665
|
+
// `allowedValues` stays narrower on purpose — it governs what plan
|
|
666
|
+
// mode may run, and `test` spends a live model call.
|
|
667
|
+
effect: (args) => args.action === "list" ||
|
|
668
|
+
args.action === "test" ||
|
|
669
|
+
args.action === "get-app-default"
|
|
670
|
+
? "read"
|
|
671
|
+
: "write",
|
|
661
672
|
allowedValues: { action: ["list"] },
|
|
662
673
|
description: "Plan mode allows listing available agent engines.",
|
|
663
674
|
},
|
|
@@ -4793,8 +4793,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4793
4793
|
}
|
|
4794
4794
|
// ─── Recurring Jobs Scheduler ──────────────────────────────────────
|
|
4795
4795
|
// Poll every 60 seconds for due recurring jobs and execute them.
|
|
4796
|
-
//
|
|
4797
|
-
//
|
|
4796
|
+
// Long-lived runtimes use setInterval; serverless runtimes rely on a
|
|
4797
|
+
// platform-owned sweep because an invocation cannot own a durable loop.
|
|
4798
4798
|
try {
|
|
4799
4799
|
const { processRecurringJobs } = await import("../jobs/scheduler.js");
|
|
4800
4800
|
const schedulerDeps = {
|
package/dist/server/auth.d.ts
CHANGED
|
@@ -249,6 +249,7 @@ export declare function setDesktopExchangeError(flowId: string, error: DesktopEx
|
|
|
249
249
|
*/
|
|
250
250
|
export declare function runAuthGuard(event: H3Event): Promise<Response | object | string | void>;
|
|
251
251
|
export declare function shouldBypassAuthForBuilderConnect(event: H3Event, p: string): boolean;
|
|
252
|
+
export declare function isLocalDevAuthAllowed(event: H3Event): boolean;
|
|
252
253
|
/**
|
|
253
254
|
* Get the current auth session for a request.
|
|
254
255
|
*
|
package/dist/server/auth.js
CHANGED
|
@@ -57,7 +57,7 @@ import { injectAnalyticsIntoHtml } from "./analytics.js";
|
|
|
57
57
|
import { getConfiguredAppBasePath } from "./app-base-path.js";
|
|
58
58
|
import { readAnalyticsAnonymousId, signupAttributionFromCookieHeader, } from "./attribution.js";
|
|
59
59
|
import { getAuthLoginMode } from "./auth-login-mode.js";
|
|
60
|
-
import { ensureGoogleAuthIdentity, getBetterAuth, getBetterAuthSync, } from "./better-auth-instance.js";
|
|
60
|
+
import { createBetterAuthSessionForEmail, ensureGoogleAuthIdentity, getBetterAuth, getBetterAuthSync, isDeployPreview, } from "./better-auth-instance.js";
|
|
61
61
|
import { BUILDER_CONNECT_OWNER_COOKIE, BUILDER_CONNECT_PARAM, BUILDER_RELAY_PATH, BUILDER_RELAY_STATE_PARAM, BUILDER_STATE_PARAM, verifyBuilderCallbackStateAndGetOwner, verifyBuilderConnectTokenAndGetOwner, verifyBuilderPreviewRelayStateForCallback, } from "./builder-browser.js";
|
|
62
62
|
import { resolveAuthCookieNamespace } from "./cookie-namespace.js";
|
|
63
63
|
import { getAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js";
|
|
@@ -68,6 +68,7 @@ import { isElectron as isElectronRequest, getAppBasePath, getAppUrl, getOrigin,
|
|
|
68
68
|
// auth.ts), so the guard and the SSO route handler share one validator and
|
|
69
69
|
// can never disagree about whether federated SSO is enabled.
|
|
70
70
|
import { isIdentitySsoEnabled } from "./identity-sso-store.js";
|
|
71
|
+
import { ensureCanonicalUserForLegacySession } from "./legacy-auth-migration.js";
|
|
71
72
|
import { safeOAuthReturnUrl } from "./oauth-return-url.js";
|
|
72
73
|
import { getOnboardingHtml, getResetPasswordHtml, } from "./onboarding-html.js";
|
|
73
74
|
import { captureAuthError } from "./sentry.js";
|
|
@@ -202,6 +203,12 @@ async function getLegacyCookieSession(event) {
|
|
|
202
203
|
for (const { name, value } of getFrameworkSessionCookieEntries(event)) {
|
|
203
204
|
const email = await getSessionEmail(value);
|
|
204
205
|
if (email) {
|
|
206
|
+
try {
|
|
207
|
+
await ensureCanonicalUserForLegacySession(email);
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
console.warn("[auth] legacy session canonical-user backfill failed:", error instanceof Error ? error.message : error);
|
|
211
|
+
}
|
|
205
212
|
if (name !== COOKIE_NAME)
|
|
206
213
|
setFrameworkSessionCookie(event, value);
|
|
207
214
|
return { email, token: value };
|
|
@@ -1661,6 +1668,78 @@ async function createAutoDevAccountForSession(auth, db) {
|
|
|
1661
1668
|
const result = await creationPromise;
|
|
1662
1669
|
return result?.password ?? null;
|
|
1663
1670
|
}
|
|
1671
|
+
function isHostedPreviewRequest(event) {
|
|
1672
|
+
const host = getRequestHost(event)?.split(",")[0]?.trim().toLowerCase() ?? "";
|
|
1673
|
+
return (host.endsWith(".agent-native.com") ||
|
|
1674
|
+
host.endsWith(".builderio.xyz") ||
|
|
1675
|
+
host.endsWith(".builderio.dev") ||
|
|
1676
|
+
host.endsWith(".builder.codes") ||
|
|
1677
|
+
host.endsWith(".builder.my") ||
|
|
1678
|
+
host.includes("deploy-preview"));
|
|
1679
|
+
}
|
|
1680
|
+
export function isLocalDevAuthAllowed(event) {
|
|
1681
|
+
const deployPreview = typeof isDeployPreview === "function" && isDeployPreview();
|
|
1682
|
+
return (isDevEnvironment() &&
|
|
1683
|
+
!deployPreview &&
|
|
1684
|
+
!isAuthDisabled() &&
|
|
1685
|
+
process.env.AGENT_NATIVE_DISABLE_AUTO_DEV_ACCOUNT !== "1" &&
|
|
1686
|
+
!isHostedPreviewRequest(event) &&
|
|
1687
|
+
isLoopbackRequest(event));
|
|
1688
|
+
}
|
|
1689
|
+
async function createOrReuseAutoDevSession(auth, config) {
|
|
1690
|
+
let session = await createBetterAuthSessionForEmail(AUTO_DEV_ACCOUNT_EMAIL, config);
|
|
1691
|
+
if (!session) {
|
|
1692
|
+
session = await createBetterAuthSessionForEmail(LEGACY_AUTO_DEV_ACCOUNT_EMAIL, config);
|
|
1693
|
+
}
|
|
1694
|
+
if (session)
|
|
1695
|
+
return { email: session.email, token: session.token };
|
|
1696
|
+
const db = getDbExec();
|
|
1697
|
+
const { rows: realUsers } = await db.execute({
|
|
1698
|
+
sql: 'SELECT 1 FROM "user" WHERE email NOT IN (?, ?) LIMIT 1',
|
|
1699
|
+
args: [AUTO_DEV_ACCOUNT_EMAIL, LEGACY_AUTO_DEV_ACCOUNT_EMAIL],
|
|
1700
|
+
});
|
|
1701
|
+
if (realUsers.length > 0)
|
|
1702
|
+
return null;
|
|
1703
|
+
const devPassword = await createAutoDevAccountForSession(auth, db);
|
|
1704
|
+
if (!devPassword && !(await hasAutoDevAccountUser(db)))
|
|
1705
|
+
return null;
|
|
1706
|
+
session = await createBetterAuthSessionForEmail(AUTO_DEV_ACCOUNT_EMAIL, config);
|
|
1707
|
+
if (!session) {
|
|
1708
|
+
session = await createBetterAuthSessionForEmail(LEGACY_AUTO_DEV_ACCOUNT_EMAIL, config);
|
|
1709
|
+
}
|
|
1710
|
+
return session ? { email: session.email, token: session.token } : null;
|
|
1711
|
+
}
|
|
1712
|
+
function createLocalDevAuthHandler(config) {
|
|
1713
|
+
return defineEventHandler(async (event) => {
|
|
1714
|
+
if (getMethod(event) !== "POST") {
|
|
1715
|
+
setResponseStatus(event, 405);
|
|
1716
|
+
return { error: "Method not allowed" };
|
|
1717
|
+
}
|
|
1718
|
+
// This exact route is also allowed through createAuthGuardFn's public auth
|
|
1719
|
+
// route branch. The state-changing handler still owns the full local gate.
|
|
1720
|
+
if (!isLocalDevAuthAllowed(event)) {
|
|
1721
|
+
setResponseStatus(event, 404);
|
|
1722
|
+
return { error: "Not found" };
|
|
1723
|
+
}
|
|
1724
|
+
try {
|
|
1725
|
+
const auth = await getBetterAuth(config);
|
|
1726
|
+
const session = await createOrReuseAutoDevSession(auth, config);
|
|
1727
|
+
if (!session) {
|
|
1728
|
+
setResponseStatus(event, 404);
|
|
1729
|
+
return { error: "Local development sign-in is unavailable" };
|
|
1730
|
+
}
|
|
1731
|
+
setFrameworkSessionCookie(event, session.token);
|
|
1732
|
+
await addSession(session.token, session.email);
|
|
1733
|
+
return authLoginResponse(event, session.token, session.email);
|
|
1734
|
+
}
|
|
1735
|
+
catch {
|
|
1736
|
+
// The local convenience must fail closed without exposing adapter or
|
|
1737
|
+
// generated credential details to the browser or terminal.
|
|
1738
|
+
setResponseStatus(event, 503);
|
|
1739
|
+
return { error: "Local development sign-in is unavailable" };
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1664
1743
|
/**
|
|
1665
1744
|
* Local-dev convenience: skip the sign-up wall on first run.
|
|
1666
1745
|
*
|
|
@@ -2519,6 +2598,7 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
2519
2598
|
const authLoginMode = typeof getAuthLoginMode === "function"
|
|
2520
2599
|
? await getAuthLoginMode()
|
|
2521
2600
|
: "password";
|
|
2601
|
+
app.use("/_agent-native/auth/local-dev", createLocalDevAuthHandler(betterAuthConfig));
|
|
2522
2602
|
// Mount Better Auth catch-all handler at /_agent-native/auth/ba/*
|
|
2523
2603
|
app.use("/_agent-native/auth/ba", defineEventHandler(async (event) => {
|
|
2524
2604
|
const reqPath = event.url?.pathname ?? event.path ?? "";
|
|
@@ -3039,6 +3119,10 @@ async function mountBetterAuthRoutes(app, options) {
|
|
|
3039
3119
|
// mountAuthFallbackRoutes — minimal auth endpoints when Better Auth init fails
|
|
3040
3120
|
// ---------------------------------------------------------------------------
|
|
3041
3121
|
function mountAuthFallbackRoutes(app) {
|
|
3122
|
+
// Keep the local-dev action available when Better Auth initialization failed
|
|
3123
|
+
// during boot. The handler retries Better Auth lazily and preserves the same
|
|
3124
|
+
// production, preview, and loopback gates as the normal route set.
|
|
3125
|
+
app.use("/_agent-native/auth/local-dev", createLocalDevAuthHandler());
|
|
3042
3126
|
app.use("/_agent-native/auth/login", defineEventHandler(async (event) => {
|
|
3043
3127
|
if (getMethod(event) !== "POST") {
|
|
3044
3128
|
setResponseStatus(event, 405);
|
|
@@ -184,6 +184,9 @@ export interface BetterAuthInternalAdapter {
|
|
|
184
184
|
}) => Promise<{
|
|
185
185
|
id: string;
|
|
186
186
|
}>;
|
|
187
|
+
createSession: (userId: string, dontRememberMe?: boolean) => Promise<{
|
|
188
|
+
token: string;
|
|
189
|
+
}>;
|
|
187
190
|
createOAuthUser?: (user: {
|
|
188
191
|
email: string;
|
|
189
192
|
name: string;
|
|
@@ -221,6 +224,12 @@ export interface BetterAuthInternalAdapter {
|
|
|
221
224
|
* shape is unexpected (older/newer Better Auth) so callers can fall back.
|
|
222
225
|
*/
|
|
223
226
|
export declare function getBetterAuthInternalAdapter(config?: BetterAuthConfig): Promise<BetterAuthInternalAdapter | undefined>;
|
|
227
|
+
/** Create a real Better Auth session for an existing user without credentials. */
|
|
228
|
+
export declare function createBetterAuthSessionForEmail(email: string, config?: BetterAuthConfig): Promise<{
|
|
229
|
+
email: string;
|
|
230
|
+
token: string;
|
|
231
|
+
userId: string;
|
|
232
|
+
} | null>;
|
|
224
233
|
export interface GoogleAuthIdentity {
|
|
225
234
|
email: string;
|
|
226
235
|
accountId: string;
|
|
@@ -24,6 +24,7 @@ import { acceptPendingInvitationsForEmail } from "../org/accept-pending.js";
|
|
|
24
24
|
import { getAuthEmailForUserId, getRequiredAuthProviderForEmail, } from "../org/auth-policy.js";
|
|
25
25
|
import { autoJoinDomainMatchingOrgs } from "../org/auto-join-domain.js";
|
|
26
26
|
import { PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, } from "../shared/password-policy.js";
|
|
27
|
+
import { formatRuntimeConfigReport, getRuntimeConfigReport, } from "../shared/runtime-config.js";
|
|
27
28
|
import { flushTracking, identify, track } from "../tracking/index.js";
|
|
28
29
|
import { getAppProductionUrl } from "./app-url.js";
|
|
29
30
|
import { readAnalyticsAnonymousId, signupAttributionFromCookieHeader, } from "./attribution.js";
|
|
@@ -113,17 +114,12 @@ function resolveAuthSecret() {
|
|
|
113
114
|
// every deploy that hits it — both are serious enough to fail the boot loudly
|
|
114
115
|
// so the deployer notices.
|
|
115
116
|
if (process.env.NODE_ENV === "production") {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"running deploy and need to preserve existing sessions, set it to your " +
|
|
123
|
-
"previously-deployed BETTER_AUTH_SECRET value first, then rotate to a " +
|
|
124
|
-
"fresh one. Hosted workspace deploys may also " +
|
|
125
|
-
"set A2A_SECRET; agent-native derives a per-purpose Better Auth secret " +
|
|
126
|
-
"from that workspace root secret.");
|
|
117
|
+
const report = getRuntimeConfigReport(process.env, { authEnabled: true, databaseRequired: false }, {
|
|
118
|
+
environment: "production",
|
|
119
|
+
phase: "runtime",
|
|
120
|
+
appName: process.env.APP_NAME,
|
|
121
|
+
});
|
|
122
|
+
throw new Error(formatRuntimeConfigReport(report));
|
|
127
123
|
}
|
|
128
124
|
// SECURITY (audit 09 LOW-2): the previous fallback chain
|
|
129
125
|
// (`GOOGLE_CLIENT_SECRET || ACCESS_TOKEN || hardcoded`) reused
|
|
@@ -697,6 +693,7 @@ export async function getBetterAuthInternalAdapter(config) {
|
|
|
697
693
|
typeof ia.findUserByEmail === "function" &&
|
|
698
694
|
typeof ia.linkAccount === "function" &&
|
|
699
695
|
typeof ia.createUser === "function" &&
|
|
696
|
+
typeof ia.createSession === "function" &&
|
|
700
697
|
typeof ia.findAccountByProviderId === "function") {
|
|
701
698
|
return {
|
|
702
699
|
...ia,
|
|
@@ -709,6 +706,23 @@ export async function getBetterAuthInternalAdapter(config) {
|
|
|
709
706
|
}
|
|
710
707
|
return undefined;
|
|
711
708
|
}
|
|
709
|
+
/** Create a real Better Auth session for an existing user without credentials. */
|
|
710
|
+
export async function createBetterAuthSessionForEmail(email, config) {
|
|
711
|
+
const adapter = await getBetterAuthInternalAdapter(config);
|
|
712
|
+
if (!adapter)
|
|
713
|
+
return null;
|
|
714
|
+
const existing = await adapter.findUserByEmail(email, {
|
|
715
|
+
includeAccounts: false,
|
|
716
|
+
});
|
|
717
|
+
if (!existing)
|
|
718
|
+
return null;
|
|
719
|
+
const session = await adapter.createSession(existing.user.id);
|
|
720
|
+
return {
|
|
721
|
+
email: existing.user.email,
|
|
722
|
+
token: session.token,
|
|
723
|
+
userId: existing.user.id,
|
|
724
|
+
};
|
|
725
|
+
}
|
|
712
726
|
/**
|
|
713
727
|
* Ensure a verified Google identity has a canonical Better Auth user/account
|
|
714
728
|
* before the legacy email-keyed session is issued. This prevents a later
|
|
@@ -3,6 +3,7 @@ import { type DatabaseSchemaHealthResult } from "../db/runtime-diagnostics.js";
|
|
|
3
3
|
import { type AuthSession } from "./auth.js";
|
|
4
4
|
import { type BuilderConnectTrackingParams, type BuilderRelayCredentials } from "./builder-browser.js";
|
|
5
5
|
import type { EnvKeyConfig } from "./create-server.js";
|
|
6
|
+
import { type DbPressure } from "./db-pressure.js";
|
|
6
7
|
/**
|
|
7
8
|
* The base path prefix for all framework-level routes.
|
|
8
9
|
* All agent-native core routes live under this namespace to avoid
|
|
@@ -91,6 +92,11 @@ export interface DbHealthProbeResult {
|
|
|
91
92
|
};
|
|
92
93
|
/** Optional metadata-only schema compatibility check. */
|
|
93
94
|
schema?: DatabaseSchemaHealthResult;
|
|
95
|
+
/**
|
|
96
|
+
* Optional `pg_stat_activity` pressure counters. Present only when asked for,
|
|
97
|
+
* and shaped so "could not measure" cannot be read as "nothing wrong".
|
|
98
|
+
*/
|
|
99
|
+
pressure?: DbPressure;
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
96
102
|
* Run a trivial `SELECT 1` to confirm the database is reachable and, as a side
|
|
@@ -106,6 +112,7 @@ export declare function runDbHealthProbe(exec?: () => {
|
|
|
106
112
|
execute: (sql: string) => Promise<unknown>;
|
|
107
113
|
}, options?: {
|
|
108
114
|
schema?: boolean;
|
|
115
|
+
pressure?: boolean;
|
|
109
116
|
}): Promise<DbHealthProbeResult>;
|
|
110
117
|
interface BuilderWaitlistFormTarget {
|
|
111
118
|
formId: string;
|
|
@@ -27,6 +27,7 @@ import { EMPTY_SPECULATION_RULES, resolveSsrCacheHeaders, } from "../shared/cach
|
|
|
27
27
|
import { EMBED_TARGET_HEADER } from "../shared/embed-auth.js";
|
|
28
28
|
import { llmConnectionTrackingProperties } from "../shared/llm-connection.js";
|
|
29
29
|
import { EMBED_TRANSPLANT_HEADER, isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
|
|
30
|
+
import { getRuntimeConfigReport } from "../shared/runtime-config.js";
|
|
30
31
|
import { captureException } from "../tracking/error-capture.js";
|
|
31
32
|
import { track } from "../tracking/index.js";
|
|
32
33
|
import { registerBuiltinProviders } from "../tracking/providers.js";
|
|
@@ -41,6 +42,7 @@ import { BUILDER_CONNECT_PARAM, BUILDER_CONNECT_OWNER_COOKIE, BUILDER_ENV_KEYS,
|
|
|
41
42
|
import { captureError, registerErrorCaptureProvider } from "./capture-error.js";
|
|
42
43
|
import { getAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js";
|
|
43
44
|
import { canUseDeployCredentialFallbackForRequest, prefetchSecrets, readDeployCredentialEnv, resolveSecret, } from "./credential-provider.js";
|
|
45
|
+
import { probeDbPressure } from "./db-pressure.js";
|
|
44
46
|
import { resolveDeployEnvironment, resolveServerRelease, } from "./deploy-environment.js";
|
|
45
47
|
import { createEmbedStartRouteHandler } from "./embed-route.js";
|
|
46
48
|
import { shouldReportError } from "./error-noise-filter.js";
|
|
@@ -264,6 +266,7 @@ const DB_HEALTH_PROBE_DEADLINE_MS = 5_000;
|
|
|
264
266
|
export async function runDbHealthProbe(exec = getDbExec, options = {}) {
|
|
265
267
|
const startedAt = Date.now();
|
|
266
268
|
let db = false;
|
|
269
|
+
let trivialQueryMs;
|
|
267
270
|
let schema;
|
|
268
271
|
const dbExec = exec();
|
|
269
272
|
let dbTimedOut = false;
|
|
@@ -278,8 +281,10 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
|
|
|
278
281
|
timer = setTimeout(() => reject(new Error("db probe deadline")), DB_HEALTH_PROBE_DEADLINE_MS);
|
|
279
282
|
});
|
|
280
283
|
try {
|
|
284
|
+
const trivialQueryStartedAt = Date.now();
|
|
281
285
|
await Promise.race([dbExec.execute("SELECT 1"), deadline]);
|
|
282
286
|
db = true;
|
|
287
|
+
trivialQueryMs = Date.now() - trivialQueryStartedAt;
|
|
283
288
|
}
|
|
284
289
|
finally {
|
|
285
290
|
if (timer)
|
|
@@ -296,6 +301,14 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
|
|
|
296
301
|
});
|
|
297
302
|
}
|
|
298
303
|
const database = getDatabaseRuntimeFingerprint();
|
|
304
|
+
// Measured on the connection `SELECT 1` just warmed, so the number reflects
|
|
305
|
+
// the database's own load rather than a serverless cold start.
|
|
306
|
+
let pressure;
|
|
307
|
+
if (options.pressure) {
|
|
308
|
+
pressure = db
|
|
309
|
+
? await probeDbPressure(dbExec, database.dialect, { trivialQueryMs })
|
|
310
|
+
: { measured: false, reason: "database unreachable" };
|
|
311
|
+
}
|
|
299
312
|
return {
|
|
300
313
|
ok: true,
|
|
301
314
|
ready: db && (!schema || schema.ok),
|
|
@@ -312,6 +325,7 @@ export async function runDbHealthProbe(exec = getDbExec, options = {}) {
|
|
|
312
325
|
netlifyDatabaseUrlConfigured: database.netlifyDatabaseUrlConfigured,
|
|
313
326
|
},
|
|
314
327
|
...(schema ? { schema } : {}),
|
|
328
|
+
...(pressure ? { pressure } : {}),
|
|
315
329
|
};
|
|
316
330
|
}
|
|
317
331
|
const DEFAULT_BUILDER_WAITLIST_FORM_ID = "DYTHuM0jlV";
|
|
@@ -809,7 +823,7 @@ export async function readLegacyCoreRouteInitSettings(readSetting = getSetting)
|
|
|
809
823
|
* Routes:
|
|
810
824
|
* GET /_agent-native/poll — polling endpoint for change detection
|
|
811
825
|
* GET /_agent-native/events (or custom) — SSE endpoint for real-time sync
|
|
812
|
-
* GET /_agent-native/ping — health check
|
|
826
|
+
* GET /_agent-native/ping — health check; add ?configuration=1 for redacted deploy diagnostics
|
|
813
827
|
* GET /_agent-native/health — DB liveness probe + scale-to-zero warmup
|
|
814
828
|
* GET /_agent-native/env-status — env key configuration status (when envKeys provided)
|
|
815
829
|
* POST /_agent-native/env-vars — compatibility route that saves keys to scoped DB secrets
|
|
@@ -1197,9 +1211,30 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
1197
1211
|
}
|
|
1198
1212
|
// Ping
|
|
1199
1213
|
if (!options.disablePing) {
|
|
1200
|
-
getH3App(nitroApp).use(`${P}/ping`, defineEventHandler(() =>
|
|
1201
|
-
message
|
|
1202
|
-
|
|
1214
|
+
getH3App(nitroApp).use(`${P}/ping`, defineEventHandler((event) => {
|
|
1215
|
+
const message = process.env.PING_MESSAGE ?? "pong";
|
|
1216
|
+
const configuration = event.url?.searchParams.get("configuration") === "1" ||
|
|
1217
|
+
event.url?.searchParams.get("configuration") === "true";
|
|
1218
|
+
if (!configuration)
|
|
1219
|
+
return { message };
|
|
1220
|
+
// Custom required keys must come from server-side app configuration;
|
|
1221
|
+
// never let an anonymous caller turn this into an env-name oracle.
|
|
1222
|
+
const requirements = {
|
|
1223
|
+
...(event.url?.searchParams.get("auth") === "0"
|
|
1224
|
+
? { authEnabled: false }
|
|
1225
|
+
: {}),
|
|
1226
|
+
...(event.url?.searchParams.get("database") === "0"
|
|
1227
|
+
? { databaseRequired: false }
|
|
1228
|
+
: {}),
|
|
1229
|
+
};
|
|
1230
|
+
return {
|
|
1231
|
+
message,
|
|
1232
|
+
configuration: getRuntimeConfigReport(process.env, requirements, {
|
|
1233
|
+
phase: "runtime",
|
|
1234
|
+
appName: process.env.APP_NAME,
|
|
1235
|
+
}),
|
|
1236
|
+
};
|
|
1237
|
+
}));
|
|
1203
1238
|
}
|
|
1204
1239
|
// ─── Durable sandbox execution processor ─────────────────────────
|
|
1205
1240
|
// Self-fired by run-code's background queue (see
|
|
@@ -1294,7 +1329,18 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
1294
1329
|
const strict = event.url?.searchParams.get("strict") === "1" ||
|
|
1295
1330
|
event.url?.searchParams.get("strict") === "true" ||
|
|
1296
1331
|
process.env.AGENT_NATIVE_HEALTH_STRICT_SCHEMA === "true";
|
|
1297
|
-
|
|
1332
|
+
// Off by default: the one-minute warm cron does not need it, and
|
|
1333
|
+
// an extra `pg_stat_activity` read every minute per app is waste.
|
|
1334
|
+
// Pressure deliberately does NOT change `ready` or the status
|
|
1335
|
+
// code — a pressured database is still serving, and an uptime
|
|
1336
|
+
// monitor that pages on it would learn to ignore this route. The
|
|
1337
|
+
// fleet audit reads the counters and decides.
|
|
1338
|
+
const pressure = event.url?.searchParams.get("pressure") === "1" ||
|
|
1339
|
+
event.url?.searchParams.get("pressure") === "true";
|
|
1340
|
+
const result = await runDbHealthProbe(getDbExec, {
|
|
1341
|
+
schema,
|
|
1342
|
+
pressure,
|
|
1343
|
+
});
|
|
1298
1344
|
if (strict && !result.ready)
|
|
1299
1345
|
setResponseStatus(event, 503);
|
|
1300
1346
|
return result;
|
|
@@ -3,6 +3,7 @@ import { getOrgContext } from "../org/context.js";
|
|
|
3
3
|
import { readBody } from "../server/h3-helpers.js";
|
|
4
4
|
import { EMBED_TARGET_HEADER } from "../shared/embed-auth.js";
|
|
5
5
|
import { EMBED_TRANSPLANT_HEADER, isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
|
|
6
|
+
import { getRuntimeConfigReport } from "../shared/runtime-config.js";
|
|
6
7
|
import { getSession } from "./auth.js";
|
|
7
8
|
import { getAllowedCorsOrigin, readCorsAllowedOrigins, } from "./cors-origins.js";
|
|
8
9
|
import { resolveSecret } from "./credential-provider.js";
|
|
@@ -107,9 +108,29 @@ export function createServer(options = {}) {
|
|
|
107
108
|
const router = createRouter();
|
|
108
109
|
// Health check
|
|
109
110
|
if (!options.disablePing) {
|
|
110
|
-
router.get("/_agent-native/ping", defineEventHandler(() => {
|
|
111
|
+
router.get("/_agent-native/ping", defineEventHandler((event) => {
|
|
111
112
|
const message = options.pingMessage ?? process.env.PING_MESSAGE ?? "pong";
|
|
112
|
-
|
|
113
|
+
const configuration = event.url?.searchParams.get("configuration") === "1" ||
|
|
114
|
+
event.url?.searchParams.get("configuration") === "true";
|
|
115
|
+
if (!configuration)
|
|
116
|
+
return { message };
|
|
117
|
+
// Custom required keys must come from server-side app configuration;
|
|
118
|
+
// never let an anonymous caller turn this into an env-name oracle.
|
|
119
|
+
const requirements = {
|
|
120
|
+
...(event.url?.searchParams.get("auth") === "0"
|
|
121
|
+
? { authEnabled: false }
|
|
122
|
+
: {}),
|
|
123
|
+
...(event.url?.searchParams.get("database") === "0"
|
|
124
|
+
? { databaseRequired: false }
|
|
125
|
+
: {}),
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
message,
|
|
129
|
+
configuration: getRuntimeConfigReport(process.env, requirements, {
|
|
130
|
+
phase: "runtime",
|
|
131
|
+
appName: process.env.APP_NAME,
|
|
132
|
+
}),
|
|
133
|
+
};
|
|
113
134
|
}));
|
|
114
135
|
}
|
|
115
136
|
// Env key management routes
|