@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.
Files changed (387) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +18 -0
  3. package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  4. package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +17 -1
  5. package/corpus/templates/analytics/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  6. package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +1 -0
  7. package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +22 -3
  8. package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +76 -23
  9. package/corpus/templates/analytics/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  10. package/corpus/templates/analytics/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  11. package/corpus/templates/analytics/AGENTS.md +2 -1
  12. package/corpus/templates/analytics/actions/account-deep-dive.ts +83 -47
  13. package/corpus/templates/analytics/actions/create-dashboard-folder.ts +27 -0
  14. package/corpus/templates/analytics/actions/gong-calls.ts +3 -3
  15. package/corpus/templates/analytics/actions/list-dashboard-folders.ts +26 -0
  16. package/corpus/templates/analytics/actions/list-sql-dashboards.ts +1 -0
  17. package/corpus/templates/analytics/actions/set-dashboard-folder.ts +26 -0
  18. package/corpus/templates/analytics/app/components/ProviderCorpusJobNotifier.tsx +18 -3
  19. package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +6 -4
  20. package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
  21. package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +12 -2
  22. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +35 -20
  23. package/corpus/templates/analytics/app/global.css +17 -0
  24. package/corpus/templates/analytics/app/hooks/use-dashboard-revisions.ts +29 -15
  25. package/corpus/templates/analytics/app/hooks/use-dashboard-views.ts +15 -3
  26. package/corpus/templates/analytics/app/i18n-data.ts +296 -0
  27. package/corpus/templates/analytics/app/lib/prefetch-keys.ts +23 -2
  28. package/corpus/templates/analytics/app/pages/DashboardOverview.tsx +642 -0
  29. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +66 -31
  30. package/corpus/templates/analytics/app/root.tsx +4 -0
  31. package/corpus/templates/analytics/app/routes/dashboards._index.tsx +5 -1
  32. package/corpus/templates/analytics/changelog/2026-08-07-added-a-dashboards-overview-with-personal-and-shared-folders.md +6 -0
  33. package/corpus/templates/analytics/changelog/2026-08-07-analytics-tracking-and-chat-startup-no-longer-emit-avoidable.md +6 -0
  34. package/corpus/templates/analytics/changelog/2026-08-07-dashboard-panels-now-load-custom-api-data-programs-reliably.md +6 -0
  35. package/corpus/templates/analytics/changelog/2026-08-07-gong-searches-conserve-api-quota-and-report-incomplete-coverage.md +6 -0
  36. package/corpus/templates/analytics/changelog/2026-08-07-searchable-dashboards-make-personal-and-shared-folders-easie.md +6 -0
  37. package/corpus/templates/analytics/netlify.toml +3 -0
  38. package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +112 -0
  39. package/corpus/templates/analytics/server/db/index.ts +12 -0
  40. package/corpus/templates/analytics/server/db/schema.ts +14 -0
  41. package/corpus/templates/analytics/server/jobs/analytics-rollup-backfill.ts +4 -0
  42. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +1 -0
  43. package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +85 -15
  44. package/corpus/templates/analytics/server/lib/dashboard-folders-store.ts +168 -0
  45. package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +9 -4
  46. package/corpus/templates/analytics/server/lib/dashboards-store.ts +116 -1
  47. package/corpus/templates/analytics/server/lib/first-party-analytics-rollups.ts +4 -8
  48. package/corpus/templates/analytics/server/lib/gong.ts +139 -78
  49. package/corpus/templates/analytics/server/plugins/db.ts +55 -15
  50. package/corpus/templates/analytics/server/plugins/session-replay-retention-jobs.ts +6 -2
  51. package/corpus/templates/analytics/server/routes/api/session-replay/retention.post.ts +65 -0
  52. package/corpus/templates/assets/.agents/skills/actions/SKILL.md +18 -0
  53. package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  54. package/corpus/templates/assets/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  55. package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +1 -0
  56. package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +76 -23
  57. package/corpus/templates/assets/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  58. package/corpus/templates/assets/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  59. package/corpus/templates/brain/.agents/skills/actions/SKILL.md +18 -0
  60. package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  61. package/corpus/templates/brain/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  62. package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +1 -0
  63. package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +76 -23
  64. package/corpus/templates/brain/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  65. package/corpus/templates/brain/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  66. package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +18 -0
  67. package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  68. package/corpus/templates/calendar/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  69. package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +1 -0
  70. package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +76 -23
  71. package/corpus/templates/calendar/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  72. package/corpus/templates/calendar/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  73. package/corpus/templates/chat/.agents/skills/actions/SKILL.md +18 -0
  74. package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  75. package/corpus/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  76. package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
  77. package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
  78. package/corpus/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  79. package/corpus/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  80. package/corpus/templates/chat/.env.example +3 -0
  81. package/corpus/templates/chat/AGENTS.md +4 -0
  82. package/corpus/templates/clips/.agents/skills/actions/SKILL.md +18 -0
  83. package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  84. package/corpus/templates/clips/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  85. package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +1 -0
  86. package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +76 -23
  87. package/corpus/templates/clips/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  88. package/corpus/templates/clips/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  89. package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +4 -0
  90. package/corpus/templates/clips/actions/request-transcript.ts +52 -3
  91. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +3 -10
  92. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -0
  93. package/corpus/templates/clips/changelog/2026-08-07-screen-recordings-now-capture-tab-and-system-audio-even-when.md +6 -0
  94. package/corpus/templates/clips/changelog/2026-08-07-transcription-now-retries-transient-cloud-failures-automatic.md +6 -0
  95. package/corpus/templates/clips/server/db/schema.ts +7 -0
  96. package/corpus/templates/clips/server/plugins/db.ts +8 -0
  97. package/corpus/templates/clips/shared/recording-capture.ts +38 -0
  98. package/corpus/templates/clips/shared/transcript-failure.ts +89 -0
  99. package/corpus/templates/content/.agents/skills/actions/SKILL.md +18 -0
  100. package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  101. package/corpus/templates/content/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  102. package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +1 -0
  103. package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +76 -23
  104. package/corpus/templates/content/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  105. package/corpus/templates/content/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  106. package/corpus/templates/content/.env.example +9 -3
  107. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -0
  108. package/corpus/templates/content/changelog/2026-08-07-collapsed-sidebar-utility-buttons-stay-anchored-at-the-botto.md +6 -0
  109. package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  110. package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +76 -23
  111. package/corpus/templates/crm/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  112. package/corpus/templates/crm/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  113. package/corpus/templates/design/.agents/skills/actions/SKILL.md +18 -0
  114. package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  115. package/corpus/templates/design/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  116. package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +1 -0
  117. package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +76 -23
  118. package/corpus/templates/design/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  119. package/corpus/templates/design/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  120. package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +18 -0
  121. package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  122. package/corpus/templates/dispatch/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  123. package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +1 -0
  124. package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +76 -23
  125. package/corpus/templates/dispatch/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  126. package/corpus/templates/dispatch/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  127. package/corpus/templates/factory/.agents/skills/actions/SKILL.md +18 -0
  128. package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  129. package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  130. package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +1 -0
  131. package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +76 -23
  132. package/corpus/templates/factory/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  133. package/corpus/templates/factory/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  134. package/corpus/templates/factory/actions/babysit-agent-native-pull-request.ts +279 -0
  135. package/corpus/templates/factory/actions/get-factory-automation-health.ts +23 -4
  136. package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +1 -1
  137. package/corpus/templates/factory/app/routes/factory.tsx +21 -3
  138. package/corpus/templates/factory/changelog/2026-08-07-factory-can-keep-builder-bot-pull-requests-moving-by-request.md +6 -0
  139. package/corpus/templates/factory/server/lib/require-factory-automation.ts +1 -0
  140. package/corpus/templates/factory/server/plugins/agent-chat.ts +4 -1
  141. package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +81 -12
  142. package/corpus/templates/factory/server/triage/github-client.ts +31 -0
  143. package/corpus/templates/factory/server/triage/pr-babysit.ts +75 -1
  144. package/corpus/templates/forms/.agents/skills/actions/SKILL.md +18 -0
  145. package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  146. package/corpus/templates/forms/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  147. package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +1 -0
  148. package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +76 -23
  149. package/corpus/templates/forms/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  150. package/corpus/templates/forms/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  151. package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  152. package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +1 -0
  153. package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +76 -23
  154. package/corpus/templates/macros/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  155. package/corpus/templates/macros/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  156. package/corpus/templates/mail/.agents/skills/actions/SKILL.md +18 -0
  157. package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  158. package/corpus/templates/mail/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  159. package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +1 -0
  160. package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +76 -23
  161. package/corpus/templates/mail/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  162. package/corpus/templates/mail/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  163. package/corpus/templates/plan/.agents/skills/actions/SKILL.md +18 -0
  164. package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  165. package/corpus/templates/plan/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  166. package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +1 -0
  167. package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +76 -23
  168. package/corpus/templates/plan/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  169. package/corpus/templates/plan/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  170. package/corpus/templates/plan/app/pages/PlansPage.tsx +2 -1
  171. package/corpus/templates/plan/changelog/2026-08-07-inline-help-icons-now-stay-visually-balanced-with-nearby-tex.md +6 -0
  172. package/corpus/templates/slides/.agents/skills/actions/SKILL.md +18 -0
  173. package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  174. package/corpus/templates/slides/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  175. package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +1 -0
  176. package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +76 -23
  177. package/corpus/templates/slides/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  178. package/corpus/templates/slides/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  179. package/corpus/templates/slides/.env.example +5 -0
  180. package/corpus/templates/slides/changelog/2026-08-07-fixed-generated-slides-briefly-disappearing-while-they-are-b.md +6 -0
  181. package/corpus/templates/slides/server/plugins/collab.ts +20 -8
  182. package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +18 -0
  183. package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  184. package/corpus/templates/tasks/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  185. package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +1 -0
  186. package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +76 -23
  187. package/corpus/templates/tasks/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  188. package/corpus/templates/tasks/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  189. package/corpus/templates/tasks/.env.example +3 -0
  190. package/dist/agent/production-agent.js +24 -3
  191. package/dist/client/AgentPanel.d.ts +6 -0
  192. package/dist/client/AgentPanel.js +176 -30
  193. package/dist/client/AssistantChat.d.ts +2 -0
  194. package/dist/client/AssistantChat.js +4 -1
  195. package/dist/client/ConnectBuilderCard.js +6 -11
  196. package/dist/client/MultiTabAssistantChat.js +1 -1
  197. package/dist/client/RuntimeConfigNotice.d.ts +1 -0
  198. package/dist/client/RuntimeConfigNotice.js +94 -0
  199. package/dist/client/agent-chat/index.d.ts +1 -1
  200. package/dist/client/agent-chat/index.js +1 -1
  201. package/dist/client/agent-chat-adapter.js +85 -4
  202. package/dist/client/agent-page/AgentTabsPage.js +1 -1
  203. package/dist/client/agent-sidebar-state.d.ts +6 -0
  204. package/dist/client/agent-sidebar-state.js +25 -0
  205. package/dist/client/app-providers.js +2 -1
  206. package/dist/client/assistant-ui-recovery.js +1 -1
  207. package/dist/client/chat/index.d.ts +1 -1
  208. package/dist/client/chat/index.js +1 -1
  209. package/dist/client/chat/markdown-renderer.d.ts +2 -1
  210. package/dist/client/chat/markdown-renderer.js +48 -2
  211. package/dist/client/chat/message-components.d.ts +6 -0
  212. package/dist/client/chat/message-components.js +182 -53
  213. package/dist/client/chat/tool-call-display.d.ts +16 -4
  214. package/dist/client/chat/tool-call-display.js +225 -18
  215. package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
  216. package/dist/client/frame-protocol.d.ts +4 -0
  217. package/dist/client/i18n.js +9 -0
  218. package/dist/client/integrations/IntegrationsPanel.js +2 -5
  219. package/dist/client/onboarding/FirstRunOnboarding.js +2 -3
  220. package/dist/client/org/TeamPage.js +49 -6
  221. package/dist/client/org/hooks.d.ts +7 -2
  222. package/dist/client/org/hooks.js +11 -4
  223. package/dist/client/resources/McpConnectionSuggestion.js +2 -3
  224. package/dist/client/resources/McpIntegrationDialog.js +2 -16
  225. package/dist/client/resources/McpIntegrationLogo.d.ts +11 -0
  226. package/dist/client/resources/McpIntegrationLogo.js +14 -0
  227. package/dist/client/resources/ResourceTree.js +1 -1
  228. package/dist/client/resources/mcp-integration-logos.d.ts +1 -0
  229. package/dist/client/resources/mcp-integration-logos.js +47 -18
  230. package/dist/client/settings/useBuilderStatus.js +6 -0
  231. package/dist/client/ui/index.d.ts +1 -0
  232. package/dist/client/ui/index.js +1 -0
  233. package/dist/collab/routes.d.ts +1 -1
  234. package/dist/config.d.ts +26 -3
  235. package/dist/config.js +106 -14
  236. package/dist/db/ddl-guard.d.ts +15 -2
  237. package/dist/db/ddl-guard.js +53 -5
  238. package/dist/jobs/scheduler.js +7 -0
  239. package/dist/localization/default-messages.d.ts +17 -0
  240. package/dist/localization/default-messages.js +17 -0
  241. package/dist/mcp/oauth-client-metadata.js +5 -1
  242. package/dist/mcp/oauth-route.d.ts +5 -4
  243. package/dist/mcp/oauth-route.js +25 -9
  244. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  245. package/dist/mcp/server.d.ts +1 -1
  246. package/dist/mcp/server.js +9 -10
  247. package/dist/notifications/routes.d.ts +3 -3
  248. package/dist/org/handlers.d.ts +1 -0
  249. package/dist/org/handlers.js +17 -2
  250. package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
  251. package/dist/provider-api/actions/provider-api.d.ts +7 -7
  252. package/dist/provider-api/corpus-jobs.d.ts +12 -2
  253. package/dist/provider-api/corpus-jobs.js +31 -1
  254. package/dist/provider-api/index.d.ts +2 -0
  255. package/dist/provider-api/index.js +7 -1
  256. package/dist/resources/handlers.d.ts +1 -1
  257. package/dist/secrets/routes.d.ts +3 -3
  258. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +1 -1
  259. package/dist/server/agent-chat/recurring-jobs-runtime.js +14 -2
  260. package/dist/server/agent-chat/script-entries.js +12 -1
  261. package/dist/server/agent-chat-plugin.js +2 -2
  262. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  263. package/dist/server/auth.d.ts +1 -0
  264. package/dist/server/auth.js +85 -1
  265. package/dist/server/better-auth-instance.d.ts +9 -0
  266. package/dist/server/better-auth-instance.js +25 -11
  267. package/dist/server/core-routes-plugin.d.ts +7 -0
  268. package/dist/server/core-routes-plugin.js +51 -5
  269. package/dist/server/create-server.js +23 -2
  270. package/dist/server/db-pressure.d.ts +38 -0
  271. package/dist/server/db-pressure.js +147 -0
  272. package/dist/server/index.d.ts +1 -0
  273. package/dist/server/index.js +1 -0
  274. package/dist/server/legacy-auth-migration.d.ts +10 -0
  275. package/dist/server/legacy-auth-migration.js +37 -0
  276. package/dist/server/onboarding-html.js +206 -2
  277. package/dist/server/poll.d.ts +26 -0
  278. package/dist/server/poll.js +108 -13
  279. package/dist/server/ssr-handler.js +4 -1
  280. package/dist/shared/index.d.ts +1 -0
  281. package/dist/shared/index.js +1 -0
  282. package/dist/shared/runtime-config.d.ts +44 -0
  283. package/dist/shared/runtime-config.js +284 -0
  284. package/dist/styles/agent-native.css +48 -1
  285. package/dist/templates/chat/.agents/skills/actions/SKILL.md +18 -0
  286. package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  287. package/dist/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  288. package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
  289. package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
  290. package/dist/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  291. package/dist/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  292. package/dist/templates/chat/.env.example +3 -0
  293. package/dist/templates/chat/AGENTS.md +4 -0
  294. package/dist/templates/default/.agents/skills/actions/SKILL.md +18 -0
  295. package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  296. package/dist/templates/default/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  297. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +1 -0
  298. package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +76 -23
  299. package/dist/templates/default/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  300. package/dist/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  301. package/dist/templates/default/AGENTS.md +6 -1
  302. package/dist/templates/default/app/i18n/ar-SA.ts +6 -0
  303. package/dist/templates/default/app/i18n/de-DE.ts +6 -0
  304. package/dist/templates/default/app/i18n/en-US.ts +6 -0
  305. package/dist/templates/default/app/i18n/es-ES.ts +6 -0
  306. package/dist/templates/default/app/i18n/fr-FR.ts +6 -0
  307. package/dist/templates/default/app/i18n/hi-IN.ts +6 -0
  308. package/dist/templates/default/app/i18n/ja-JP.ts +6 -0
  309. package/dist/templates/default/app/i18n/ko-KR.ts +6 -0
  310. package/dist/templates/default/app/i18n/pt-BR.ts +6 -0
  311. package/dist/templates/default/app/i18n/zh-CN.ts +6 -0
  312. package/dist/templates/default/app/i18n/zh-TW.ts +6 -0
  313. package/dist/templates/headless/.agents/skills/actions/SKILL.md +18 -0
  314. package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  315. package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +76 -23
  316. package/dist/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  317. package/dist/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  318. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +18 -0
  319. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  320. package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  321. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -0
  322. package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +76 -23
  323. package/dist/templates/workspace-core/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  324. package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  325. package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -0
  326. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +8 -0
  327. package/dist/templates/workspace-core/AGENTS.md +7 -2
  328. package/dist/templates/workspace-root/AGENTS.md +5 -0
  329. package/dist/vite/client.d.ts +3 -3
  330. package/dist/vite/client.js +47 -1
  331. package/dist/vite/index.d.ts +1 -1
  332. package/docs/content/agent-native-config.mdx +240 -139
  333. package/docs/content/authentication.mdx +17 -0
  334. package/docs/content/deployment.mdx +19 -14
  335. package/docs/content/drop-in-agent.mdx +19 -2
  336. package/docs/content/environment-variables.mdx +63 -38
  337. package/docs/content/getting-started-actions.mdx +15 -6
  338. package/docs/content/getting-started-database.mdx +14 -10
  339. package/docs/content/getting-started-pages.mdx +32 -35
  340. package/docs/content/getting-started.mdx +7 -6
  341. package/package.json +1 -1
  342. package/src/templates/chat/.agents/skills/actions/SKILL.md +18 -0
  343. package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  344. package/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  345. package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -0
  346. package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +76 -23
  347. package/src/templates/chat/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  348. package/src/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  349. package/src/templates/chat/.env.example +3 -0
  350. package/src/templates/chat/AGENTS.md +4 -0
  351. package/src/templates/default/.agents/skills/actions/SKILL.md +18 -0
  352. package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  353. package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  354. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -0
  355. package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +76 -23
  356. package/src/templates/default/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  357. package/src/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  358. package/src/templates/default/AGENTS.md +6 -1
  359. package/src/templates/default/app/i18n/ar-SA.ts +6 -0
  360. package/src/templates/default/app/i18n/de-DE.ts +6 -0
  361. package/src/templates/default/app/i18n/en-US.ts +6 -0
  362. package/src/templates/default/app/i18n/es-ES.ts +6 -0
  363. package/src/templates/default/app/i18n/fr-FR.ts +6 -0
  364. package/src/templates/default/app/i18n/hi-IN.ts +6 -0
  365. package/src/templates/default/app/i18n/ja-JP.ts +6 -0
  366. package/src/templates/default/app/i18n/ko-KR.ts +6 -0
  367. package/src/templates/default/app/i18n/pt-BR.ts +6 -0
  368. package/src/templates/default/app/i18n/zh-CN.ts +6 -0
  369. package/src/templates/default/app/i18n/zh-TW.ts +6 -0
  370. package/src/templates/headless/.agents/skills/actions/SKILL.md +18 -0
  371. package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  372. package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +76 -23
  373. package/src/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  374. package/src/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  375. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +18 -0
  376. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
  377. package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +45 -47
  378. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -0
  379. package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +76 -23
  380. package/src/templates/workspace-core/.agents/skills/turn-into-app/agents/openai.yaml +2 -2
  381. package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +64 -0
  382. package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -0
  383. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +8 -0
  384. package/src/templates/workspace-core/AGENTS.md +7 -2
  385. package/src/templates/workspace-root/AGENTS.md +5 -0
  386. package/corpus/templates/dispatch/app/routes/admin.apps.$appId.tsx +0 -1
  387. package/corpus/templates/dispatch/app/routes/admin.apps.tsx +0 -1
@@ -73,7 +73,6 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
73
73
  offset?: unknown;
74
74
  limit?: unknown;
75
75
  }, {
76
- deleted?: undefined;
77
76
  jobs: {
78
77
  id: string;
79
78
  name: string;
@@ -84,6 +83,7 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
84
83
  updatedAt: string;
85
84
  }[];
86
85
  total: number;
86
+ deleted?: undefined;
87
87
  jobId?: undefined;
88
88
  } | {
89
89
  jobs?: undefined;
@@ -91,9 +91,9 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
91
91
  deleted: boolean;
92
92
  jobId: string;
93
93
  } | {
94
- deleted?: undefined;
95
94
  jobs?: undefined;
96
95
  total?: undefined;
96
+ deleted?: undefined;
97
97
  jobId?: undefined;
98
98
  hits: Record<string, unknown>[];
99
99
  offset: number;
@@ -147,6 +147,8 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
147
147
  totalHits: number;
148
148
  storedHits: number;
149
149
  truncatedHits: boolean;
150
+ paginationComplete: boolean;
151
+ paginationStopReason: string | null;
150
152
  };
151
153
  checkpoint: Record<string, unknown>;
152
154
  error: string | null;
@@ -201,6 +203,8 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
201
203
  totalHits: number;
202
204
  storedHits: number;
203
205
  truncatedHits: boolean;
206
+ paginationComplete: boolean;
207
+ paginationStopReason: string | null;
204
208
  };
205
209
  checkpoint: Record<string, unknown>;
206
210
  error: string | null;
@@ -262,6 +266,8 @@ export declare function createProviderCorpusJobReadAction(options: Pick<CreatePr
262
266
  totalHits: number;
263
267
  storedHits: number;
264
268
  truncatedHits: boolean;
269
+ paginationComplete: boolean;
270
+ paginationStopReason: string | null;
265
271
  };
266
272
  checkpoint: Record<string, unknown>;
267
273
  error: string | null;
@@ -323,6 +329,8 @@ export declare function createProviderCorpusJobReadAction(options: Pick<CreatePr
323
329
  totalHits: number;
324
330
  storedHits: number;
325
331
  truncatedHits: boolean;
332
+ paginationComplete: boolean;
333
+ paginationStopReason: string | null;
326
334
  };
327
335
  checkpoint: Record<string, unknown>;
328
336
  error: string | null;
@@ -377,6 +385,8 @@ export declare function createProviderCorpusJobReadAction(options: Pick<CreatePr
377
385
  totalHits: number;
378
386
  storedHits: number;
379
387
  truncatedHits: boolean;
388
+ paginationComplete: boolean;
389
+ paginationStopReason: string | null;
380
390
  };
381
391
  checkpoint: Record<string, unknown>;
382
392
  error: string | null;
@@ -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, pagination status, and any remaining gaps.",
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: controller.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)
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
48
48
  }>;
49
49
  /** DELETE /_agent-native/resources/:id — delete a resource */
50
50
  export declare function handleDeleteResource(event: any): Promise<{
51
- error: string;
52
51
  ok?: undefined;
52
+ error: string;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -34,16 +34,16 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- status?: undefined;
38
37
  ok?: undefined;
38
+ status?: undefined;
39
39
  } | {
40
40
  ok: boolean;
41
41
  status: string;
42
42
  error?: undefined;
43
43
  } | {
44
+ ok?: undefined;
44
45
  error: string;
45
46
  removed?: undefined;
46
- ok?: undefined;
47
47
  } | {
48
48
  ok: boolean;
49
49
  removed: boolean;
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
+ ok?: undefined;
57
58
  error: string;
58
59
  note?: undefined;
59
- ok?: undefined;
60
60
  } | {
61
61
  ok: boolean;
62
62
  note?: undefined;
@@ -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 runtimes
4
- // that already run a dedicated sweep, enabled by default for local/dev).
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
- effect: (args) => (args.action === "list" ? "read" : "write"),
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
- // Uses setInterval so it works in all deployment environments without
4797
- // requiring Nitro experimental tasks configuration.
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 = {
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
27
27
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
28
28
  error: any;
29
29
  } | {
30
+ error?: undefined;
30
31
  ok: boolean;
31
32
  key: string;
32
33
  baseUrlKey?: string;
33
34
  scope: AgentEngineApiKeyScope;
34
- error?: undefined;
35
35
  }>>;
36
36
  export {};
@@ -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
  *
@@ -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 sample = crypto.randomBytes(32).toString("hex");
117
- throw new Error("[agent-native] BETTER_AUTH_SECRET is not set. This is required in production " +
118
- "so signed session cookies stay valid across deploys. Set it as a deploy " +
119
- "environment variable (any 32-byte hex string), e.g.:\n\n" +
120
- ` BETTER_AUTH_SECRET=${sample}\n\n` +
121
- "Generate your own with `openssl rand -hex 32`. If you already have a " +
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;