@agent-native/core 0.79.16 → 0.79.18

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 (344) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +14 -0
  3. package/corpus/core/docs/content/file-uploads.md +11 -4
  4. package/corpus/core/docs/content/locales/ar-SA/multi-app-workspace.md +3 -3
  5. package/corpus/core/docs/content/locales/de-DE/multi-app-workspace.md +3 -3
  6. package/corpus/core/docs/content/locales/es-ES/multi-app-workspace.md +3 -3
  7. package/corpus/core/docs/content/locales/fr-FR/multi-app-workspace.md +3 -3
  8. package/corpus/core/docs/content/locales/hi-IN/multi-app-workspace.md +3 -3
  9. package/corpus/core/docs/content/locales/ja-JP/multi-app-workspace.md +3 -3
  10. package/corpus/core/docs/content/locales/ko-KR/multi-app-workspace.md +3 -3
  11. package/corpus/core/docs/content/locales/pt-BR/multi-app-workspace.md +3 -3
  12. package/corpus/core/docs/content/locales/zh-CN/multi-app-workspace.md +3 -3
  13. package/corpus/core/docs/content/locales/zh-TW/multi-app-workspace.md +3 -3
  14. package/corpus/core/docs/content/multi-app-workspace.md +3 -3
  15. package/corpus/core/docs/content/template-clips.md +14 -5
  16. package/corpus/core/package.json +1 -1
  17. package/corpus/core/src/agent/engine/builder-engine.ts +8 -3
  18. package/corpus/core/src/cli/mcp.ts +11 -6
  19. package/corpus/core/src/client/AssistantChat.tsx +6 -2
  20. package/corpus/core/src/client/chat/markdown-renderer.tsx +1 -0
  21. package/corpus/core/src/client/index.ts +7 -1
  22. package/corpus/core/src/client/org/OrgSwitcher.tsx +5 -5
  23. package/corpus/core/src/client/org/TeamPage.tsx +11 -3
  24. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +216 -0
  25. package/corpus/core/src/client/settings/index.ts +5 -0
  26. package/corpus/core/src/file-upload/index.ts +1 -0
  27. package/corpus/core/src/file-upload/registry.ts +22 -6
  28. package/corpus/core/src/file-upload/types.ts +6 -1
  29. package/corpus/core/src/integrations/adapters/email.ts +26 -18
  30. package/corpus/core/src/integrations/adapters/slack.ts +8 -7
  31. package/corpus/core/src/integrations/adapters/telegram.ts +9 -11
  32. package/corpus/core/src/integrations/adapters/whatsapp.ts +12 -9
  33. package/corpus/core/src/integrations/plugin.ts +79 -13
  34. package/corpus/core/src/onboarding/default-steps.ts +6 -3
  35. package/corpus/core/src/onboarding/types.ts +1 -1
  36. package/corpus/core/src/org/handlers.ts +1 -1
  37. package/corpus/core/src/server/agent-chat-plugin.ts +4 -7
  38. package/corpus/core/src/server/better-auth-instance.ts +19 -62
  39. package/corpus/core/src/server/core-routes-plugin.ts +93 -180
  40. package/corpus/core/src/server/create-server.ts +55 -116
  41. package/corpus/core/src/server/email-actions.ts +3 -6
  42. package/corpus/core/src/server/email.ts +52 -17
  43. package/corpus/core/src/server/index.ts +2 -1
  44. package/corpus/core/src/server/scoped-key-storage.ts +223 -0
  45. package/corpus/core/src/shared/agent-env.ts +3 -3
  46. package/corpus/core/src/sharing/actions/share-resource.ts +1 -1
  47. package/corpus/core/src/styles/agent-native.css +55 -3
  48. package/corpus/core/src/templates/workspace-root/AGENTS.md +3 -2
  49. package/corpus/core/src/templates/workspace-root/README.md +1 -1
  50. package/corpus/core/src/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
  51. package/corpus/core/src/terminal/pty-server.ts +3 -38
  52. package/corpus/core/src/triggers/dispatcher.ts +1 -2
  53. package/corpus/templates/.retired/issues/package.json +7 -0
  54. package/corpus/templates/.retired/meeting-notes/package.json +7 -0
  55. package/corpus/templates/.retired/recruiting/package.json +7 -0
  56. package/corpus/templates/.retired/scheduling/package.json +7 -0
  57. package/corpus/templates/.retired/voice/package.json +7 -0
  58. package/corpus/templates/analytics/app/components/layout/Header.tsx +0 -1
  59. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +0 -17
  60. package/corpus/templates/analytics/app/i18n/zh-TW.ts +7 -1
  61. package/corpus/templates/analytics/app/i18n-data.ts +71 -2
  62. package/corpus/templates/analytics/app/pages/Settings.tsx +120 -73
  63. package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +0 -11
  64. package/corpus/templates/analytics/app/routes/catalog.tsx +33 -176
  65. package/corpus/templates/analytics/app/routes/team.tsx +3 -2
  66. package/corpus/templates/analytics/changelog/2026-06-26-dashboard-templates-are-tucked-into-settings-and-show-simple.md +6 -0
  67. package/corpus/templates/analytics/changelog/2026-06-26-the-sessions-page-shows-a-single-page-title-instead-of-repea.md +6 -0
  68. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +37 -28
  69. package/corpus/templates/assets/app/routes/settings.tsx +65 -43
  70. package/corpus/templates/assets/app/routes/team.tsx +2 -10
  71. package/corpus/templates/brain/app/routes/settings.tsx +390 -358
  72. package/corpus/templates/brain/app/routes/team.tsx +2 -8
  73. package/corpus/templates/calendar/actions/db-connect.ts +5 -29
  74. package/corpus/templates/calendar/app/components/CloudUpgrade.tsx +8 -51
  75. package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +2 -1
  76. package/corpus/templates/calendar/app/components/calendar/GoogleSetupWizard.tsx +4 -2
  77. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +0 -2
  78. package/corpus/templates/calendar/app/pages/Settings.tsx +304 -271
  79. package/corpus/templates/calendar/app/routes/_app.team.tsx +2 -17
  80. package/corpus/templates/calendar/server/handlers/google-auth.ts +22 -9
  81. package/corpus/templates/calendar/server/lib/booking-emails.ts +1 -1
  82. package/corpus/templates/calendar/server/lib/event-guest-notifications.ts +1 -1
  83. package/corpus/templates/calendar/server/lib/google-calendar.ts +48 -28
  84. package/corpus/templates/chat/app/components/layout/Header.tsx +0 -1
  85. package/corpus/templates/chat/app/hooks/use-navigation-state.ts +4 -2
  86. package/corpus/templates/chat/app/routes/settings.tsx +54 -54
  87. package/corpus/templates/chat/app/routes/team.tsx +2 -10
  88. package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +7 -2
  89. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +1 -1
  90. package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +7 -0
  91. package/corpus/templates/clips/AGENTS.md +8 -0
  92. package/corpus/templates/clips/actions/invite-member.ts +1 -1
  93. package/corpus/templates/clips/actions/request-transcript.ts +1 -1
  94. package/corpus/templates/clips/app/components/library/library-layout.tsx +3 -3
  95. package/corpus/templates/clips/app/components/player/transcript-panel.tsx +2 -0
  96. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +629 -643
  97. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +219 -155
  98. package/corpus/templates/clips/changelog/2026-06-26-long-desktop-recordings-are-checkpointed-so-macos-finalizati.md +6 -0
  99. package/corpus/templates/clips/changelog/2026-06-26-non-mac-desktop-recordings-wait-for-upload-transcription.md +6 -0
  100. package/corpus/templates/clips/changelog/2026-06-26-s3-compatible-storage-keys-now-save-securely-from-clips-sett.md +6 -0
  101. package/corpus/templates/clips/changelog/2026-06-26-shared-clip-links-guide-agents-through-processing-transcripts.md +6 -0
  102. package/corpus/templates/clips/changelog/2026-06-26-the-clip-details-sidebar-now-collapses-into-a-slide-out-pane.md +6 -0
  103. package/corpus/templates/clips/changelog/2026-06-26-the-clips-library-now-matches-the-shared-recessed-shell-styl.md +6 -0
  104. package/corpus/templates/clips/desktop/src/lib/recorder.ts +55 -3
  105. package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +217 -5
  106. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -0
  107. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +176 -5
  108. package/corpus/templates/clips/server/lib/public-agent-context.ts +31 -0
  109. package/corpus/templates/clips/server/lib/s3-upload-provider.ts +60 -14
  110. package/corpus/templates/clips/server/lib/video-storage.ts +37 -9
  111. package/corpus/templates/clips/server/routes/api/agent-transcript.json.get.ts +5 -0
  112. package/corpus/templates/content/app/components/layout/Header.tsx +0 -1
  113. package/corpus/templates/content/app/components/sidebar/NotionButton.tsx +1 -0
  114. package/corpus/templates/content/app/routes/_app.settings.tsx +54 -55
  115. package/corpus/templates/content/app/routes/_app.team.tsx +2 -28
  116. package/corpus/templates/content/server/lib/notion.ts +43 -11
  117. package/corpus/templates/content/server/routes/api/notion/auth-url.get.ts +2 -2
  118. package/corpus/templates/content/server/routes/api/notion/status.get.ts +3 -3
  119. package/corpus/templates/design/app/routes/settings.tsx +60 -38
  120. package/corpus/templates/design/app/routes/team.tsx +2 -10
  121. package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +2 -2
  122. package/corpus/templates/dispatch/app/routes/settings.tsx +70 -55
  123. package/corpus/templates/dispatch/app/routes/team.tsx +5 -1
  124. package/corpus/templates/forms/actions/db-connect.ts +7 -36
  125. package/corpus/templates/forms/actions/navigate.ts +2 -2
  126. package/corpus/templates/forms/app/components/CloudUpgrade.tsx +8 -47
  127. package/corpus/templates/forms/app/components/layout/Header.tsx +0 -1
  128. package/corpus/templates/forms/app/components/layout/Layout.tsx +42 -25
  129. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +35 -76
  130. package/corpus/templates/forms/app/global.css +9 -25
  131. package/corpus/templates/forms/app/hooks/use-navigation-state.ts +4 -4
  132. package/corpus/templates/forms/app/i18n/ar-SA.ts +1 -0
  133. package/corpus/templates/forms/app/i18n/de-DE.ts +1 -0
  134. package/corpus/templates/forms/app/i18n/en-US.ts +1 -0
  135. package/corpus/templates/forms/app/i18n/es-ES.ts +1 -0
  136. package/corpus/templates/forms/app/i18n/fr-FR.ts +1 -0
  137. package/corpus/templates/forms/app/i18n/hi-IN.ts +1 -0
  138. package/corpus/templates/forms/app/i18n/ja-JP.ts +1 -0
  139. package/corpus/templates/forms/app/i18n/ko-KR.ts +1 -0
  140. package/corpus/templates/forms/app/i18n/pt-BR.ts +1 -0
  141. package/corpus/templates/forms/app/i18n/zh-CN.ts +1 -0
  142. package/corpus/templates/forms/app/i18n/zh-TW.ts +1 -0
  143. package/corpus/templates/forms/app/lib/route-prewarm.ts +9 -8
  144. package/corpus/templates/forms/app/pages/AskPage.tsx +70 -0
  145. package/corpus/templates/forms/app/pages/FormsListPage.tsx +74 -81
  146. package/corpus/templates/forms/app/root.tsx +1 -1
  147. package/corpus/templates/forms/app/routes/_app.ask.tsx +14 -0
  148. package/corpus/templates/forms/app/routes/_app.settings.tsx +54 -54
  149. package/corpus/templates/forms/app/routes/_app.team.tsx +2 -9
  150. package/corpus/templates/forms/app/routes/_index.tsx +21 -130
  151. package/corpus/templates/forms/changelog/2026-06-26-ask-forms-opens-as-a-standard-app-tab-with-a-simpler-sidebar.md +6 -0
  152. package/corpus/templates/forms/changelog/2026-06-26-forms-are-shown-in-a-tighter-row-list-with-a-denser-sidebar.md +6 -0
  153. package/corpus/templates/forms/shared/navigation.ts +4 -2
  154. package/corpus/templates/macros/app/routes/settings.tsx +54 -54
  155. package/corpus/templates/macros/app/routes/team.tsx +2 -10
  156. package/corpus/templates/mail/actions/helpers.ts +2 -2
  157. package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +2 -1
  158. package/corpus/templates/mail/app/pages/SettingsPage.tsx +5 -5
  159. package/corpus/templates/mail/app/routes/team.tsx +3 -2
  160. package/corpus/templates/mail/server/handlers/emails.ts +3 -2
  161. package/corpus/templates/mail/server/handlers/google-auth.ts +19 -12
  162. package/corpus/templates/mail/server/lib/automation-engine.ts +3 -2
  163. package/corpus/templates/mail/server/lib/email-state.ts +2 -3
  164. package/corpus/templates/mail/server/lib/google-auth.ts +28 -11
  165. package/corpus/templates/mail/server/lib/jobs.ts +3 -2
  166. package/corpus/templates/mail/server/onboarding.ts +9 -6
  167. package/corpus/templates/mail/server/routes/api/attachments.get.ts +3 -3
  168. package/corpus/templates/plan/actions/request-plan-access.ts +1 -1
  169. package/corpus/templates/plan/app/components/layout/Header.tsx +0 -1
  170. package/corpus/templates/plan/app/hooks/use-navigation-state.ts +4 -2
  171. package/corpus/templates/plan/app/lib/route-prewarm.ts +0 -4
  172. package/corpus/templates/plan/app/routes/settings.tsx +75 -73
  173. package/corpus/templates/plan/app/routes/team.tsx +2 -8
  174. package/corpus/templates/plan/server/lib/comment-notifications.ts +1 -1
  175. package/corpus/templates/slides/actions/check-image-gen.ts +2 -1
  176. package/corpus/templates/slides/actions/db-connect.ts +7 -45
  177. package/corpus/templates/slides/actions/edit-image.ts +6 -3
  178. package/corpus/templates/slides/actions/generate-image-api.ts +1 -1
  179. package/corpus/templates/slides/actions/generate-image.ts +2 -2
  180. package/corpus/templates/slides/actions/generate-slides-ai.ts +5 -3
  181. package/corpus/templates/slides/actions/image-gen-status.ts +4 -3
  182. package/corpus/templates/slides/actions/image-search.ts +6 -3
  183. package/corpus/templates/slides/actions/search-images.ts +6 -3
  184. package/corpus/templates/slides/app/components/CloudUpgrade.tsx +8 -51
  185. package/corpus/templates/slides/app/components/layout/Header.tsx +0 -1
  186. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +0 -2
  187. package/corpus/templates/slides/app/routes/settings.tsx +54 -54
  188. package/corpus/templates/slides/app/routes/team.tsx +2 -12
  189. package/corpus/templates/slides/server/handlers/google-docs-auth.ts +9 -9
  190. package/corpus/templates/slides/server/handlers/image-gen.ts +5 -1
  191. package/corpus/templates/slides/server/handlers/image-providers/gemini.ts +9 -1
  192. package/corpus/templates/slides/server/handlers/image-providers/index.ts +18 -8
  193. package/corpus/templates/slides/server/handlers/image-providers/openai.ts +10 -4
  194. package/corpus/templates/slides/server/handlers/image-providers/types.ts +1 -0
  195. package/corpus/templates/slides/server/lib/google-docs-oauth.ts +59 -34
  196. package/corpus/templates/slides/server/register-secrets.ts +60 -0
  197. package/corpus/templates/videos/actions/db-connect.ts +7 -45
  198. package/corpus/templates/videos/app/components/CloudUpgrade.tsx +8 -51
  199. package/corpus/templates/videos/app/components/Sidebar.tsx +1 -9
  200. package/corpus/templates/videos/app/components/layout/Header.tsx +0 -1
  201. package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +0 -3
  202. package/corpus/templates/videos/app/routes/settings.tsx +54 -54
  203. package/corpus/templates/videos/app/routes/team.tsx +2 -8
  204. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  205. package/dist/agent/engine/builder-engine.js +8 -3
  206. package/dist/agent/engine/builder-engine.js.map +1 -1
  207. package/dist/cli/mcp.d.ts.map +1 -1
  208. package/dist/cli/mcp.js +3 -4
  209. package/dist/cli/mcp.js.map +1 -1
  210. package/dist/client/AssistantChat.d.ts.map +1 -1
  211. package/dist/client/AssistantChat.js +6 -2
  212. package/dist/client/AssistantChat.js.map +1 -1
  213. package/dist/client/chat/markdown-renderer.d.ts.map +1 -1
  214. package/dist/client/chat/markdown-renderer.js +1 -0
  215. package/dist/client/chat/markdown-renderer.js.map +1 -1
  216. package/dist/client/index.d.ts +1 -1
  217. package/dist/client/index.d.ts.map +1 -1
  218. package/dist/client/index.js +1 -1
  219. package/dist/client/index.js.map +1 -1
  220. package/dist/client/org/OrgSwitcher.d.ts +3 -3
  221. package/dist/client/org/OrgSwitcher.js +2 -2
  222. package/dist/client/org/OrgSwitcher.js.map +1 -1
  223. package/dist/client/org/TeamPage.d.ts +6 -1
  224. package/dist/client/org/TeamPage.d.ts.map +1 -1
  225. package/dist/client/org/TeamPage.js +2 -2
  226. package/dist/client/org/TeamPage.js.map +1 -1
  227. package/dist/client/settings/SettingsTabsPage.d.ts +27 -0
  228. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -0
  229. package/dist/client/settings/SettingsTabsPage.js +108 -0
  230. package/dist/client/settings/SettingsTabsPage.js.map +1 -0
  231. package/dist/client/settings/index.d.ts +1 -0
  232. package/dist/client/settings/index.d.ts.map +1 -1
  233. package/dist/client/settings/index.js +1 -0
  234. package/dist/client/settings/index.js.map +1 -1
  235. package/dist/collab/awareness.d.ts +2 -2
  236. package/dist/collab/awareness.d.ts.map +1 -1
  237. package/dist/collab/routes.d.ts +1 -1
  238. package/dist/file-upload/index.d.ts +1 -1
  239. package/dist/file-upload/index.d.ts.map +1 -1
  240. package/dist/file-upload/index.js +1 -1
  241. package/dist/file-upload/index.js.map +1 -1
  242. package/dist/file-upload/registry.d.ts +1 -0
  243. package/dist/file-upload/registry.d.ts.map +1 -1
  244. package/dist/file-upload/registry.js +24 -6
  245. package/dist/file-upload/registry.js.map +1 -1
  246. package/dist/file-upload/types.d.ts +6 -1
  247. package/dist/file-upload/types.d.ts.map +1 -1
  248. package/dist/file-upload/types.js.map +1 -1
  249. package/dist/integrations/adapters/email.d.ts.map +1 -1
  250. package/dist/integrations/adapters/email.js +18 -18
  251. package/dist/integrations/adapters/email.js.map +1 -1
  252. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  253. package/dist/integrations/adapters/slack.js +8 -7
  254. package/dist/integrations/adapters/slack.js.map +1 -1
  255. package/dist/integrations/adapters/telegram.d.ts.map +1 -1
  256. package/dist/integrations/adapters/telegram.js +9 -9
  257. package/dist/integrations/adapters/telegram.js.map +1 -1
  258. package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
  259. package/dist/integrations/adapters/whatsapp.js +10 -9
  260. package/dist/integrations/adapters/whatsapp.js.map +1 -1
  261. package/dist/integrations/plugin.d.ts.map +1 -1
  262. package/dist/integrations/plugin.js +47 -13
  263. package/dist/integrations/plugin.js.map +1 -1
  264. package/dist/notifications/routes.d.ts +1 -1
  265. package/dist/onboarding/default-steps.d.ts.map +1 -1
  266. package/dist/onboarding/default-steps.js +6 -5
  267. package/dist/onboarding/default-steps.js.map +1 -1
  268. package/dist/onboarding/types.d.ts +1 -1
  269. package/dist/onboarding/types.d.ts.map +1 -1
  270. package/dist/onboarding/types.js.map +1 -1
  271. package/dist/org/handlers.js +1 -1
  272. package/dist/org/handlers.js.map +1 -1
  273. package/dist/progress/routes.d.ts +1 -1
  274. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  275. package/dist/server/agent-chat-plugin.js +4 -6
  276. package/dist/server/agent-chat-plugin.js.map +1 -1
  277. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  278. package/dist/server/better-auth-instance.d.ts.map +1 -1
  279. package/dist/server/better-auth-instance.js +17 -56
  280. package/dist/server/better-auth-instance.js.map +1 -1
  281. package/dist/server/core-routes-plugin.d.ts +1 -1
  282. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  283. package/dist/server/core-routes-plugin.js +67 -153
  284. package/dist/server/core-routes-plugin.js.map +1 -1
  285. package/dist/server/create-server.d.ts +3 -9
  286. package/dist/server/create-server.d.ts.map +1 -1
  287. package/dist/server/create-server.js +37 -91
  288. package/dist/server/create-server.js.map +1 -1
  289. package/dist/server/email-actions.d.ts +2 -3
  290. package/dist/server/email-actions.d.ts.map +1 -1
  291. package/dist/server/email-actions.js +3 -6
  292. package/dist/server/email-actions.js.map +1 -1
  293. package/dist/server/email.d.ts +3 -3
  294. package/dist/server/email.d.ts.map +1 -1
  295. package/dist/server/email.js +40 -19
  296. package/dist/server/email.js.map +1 -1
  297. package/dist/server/index.d.ts +3 -3
  298. package/dist/server/index.d.ts.map +1 -1
  299. package/dist/server/index.js +3 -3
  300. package/dist/server/index.js.map +1 -1
  301. package/dist/server/scoped-key-storage.d.ts +22 -0
  302. package/dist/server/scoped-key-storage.d.ts.map +1 -0
  303. package/dist/server/scoped-key-storage.js +152 -0
  304. package/dist/server/scoped-key-storage.js.map +1 -0
  305. package/dist/shared/agent-env.d.ts +3 -3
  306. package/dist/shared/agent-env.d.ts.map +1 -1
  307. package/dist/shared/agent-env.js +3 -3
  308. package/dist/shared/agent-env.js.map +1 -1
  309. package/dist/sharing/actions/share-resource.js +1 -1
  310. package/dist/sharing/actions/share-resource.js.map +1 -1
  311. package/dist/styles/agent-native.css +55 -3
  312. package/dist/templates/workspace-root/AGENTS.md +3 -2
  313. package/dist/templates/workspace-root/README.md +1 -1
  314. package/dist/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
  315. package/dist/terminal/pty-server.d.ts.map +1 -1
  316. package/dist/terminal/pty-server.js +3 -36
  317. package/dist/terminal/pty-server.js.map +1 -1
  318. package/dist/triggers/dispatcher.js +1 -1
  319. package/dist/triggers/dispatcher.js.map +1 -1
  320. package/docs/content/file-uploads.md +11 -4
  321. package/docs/content/locales/ar-SA/multi-app-workspace.md +3 -3
  322. package/docs/content/locales/de-DE/multi-app-workspace.md +3 -3
  323. package/docs/content/locales/es-ES/multi-app-workspace.md +3 -3
  324. package/docs/content/locales/fr-FR/multi-app-workspace.md +3 -3
  325. package/docs/content/locales/hi-IN/multi-app-workspace.md +3 -3
  326. package/docs/content/locales/ja-JP/multi-app-workspace.md +3 -3
  327. package/docs/content/locales/ko-KR/multi-app-workspace.md +3 -3
  328. package/docs/content/locales/pt-BR/multi-app-workspace.md +3 -3
  329. package/docs/content/locales/zh-CN/multi-app-workspace.md +3 -3
  330. package/docs/content/locales/zh-TW/multi-app-workspace.md +3 -3
  331. package/docs/content/multi-app-workspace.md +3 -3
  332. package/docs/content/template-clips.md +14 -5
  333. package/package.json +1 -1
  334. package/src/templates/workspace-root/AGENTS.md +3 -2
  335. package/src/templates/workspace-root/README.md +1 -1
  336. package/src/templates/workspace-root/scripts/repair-workspace-org.ts +29 -90
  337. package/corpus/core/src/server/env-var-writes.ts +0 -16
  338. package/corpus/templates/analytics/app/pages/Team.tsx +0 -9
  339. package/corpus/templates/calendar/app/pages/Team.tsx +0 -12
  340. package/corpus/templates/mail/app/pages/Team.tsx +0 -17
  341. package/dist/server/env-var-writes.d.ts +0 -10
  342. package/dist/server/env-var-writes.d.ts.map +0 -1
  343. package/dist/server/env-var-writes.js +0 -18
  344. package/dist/server/env-var-writes.js.map +0 -1
@@ -2,16 +2,18 @@ import { defineEventHandler, setResponseStatus, getMethod, getQuery } from "h3";
2
2
  import { getRequestHeader } from "h3";
3
3
  import { createRemoteJWKSet, jwtVerify } from "jose";
4
4
 
5
- import { getOrgContext } from "../org/context.js";
5
+ import { getOrgContext, resolveOrgIdForEmail } from "../org/context.js";
6
6
  import { loadResourcesForPrompt } from "../server/agent-chat-plugin.js";
7
7
  import { withConfiguredAppBasePath } from "../server/app-base-path.js";
8
8
  import { getSession } from "../server/auth.js";
9
9
  import { FRAMEWORK_ROUTE_PREFIX } from "../server/core-routes-plugin.js";
10
+ import { resolveSecret } from "../server/credential-provider.js";
10
11
  import {
11
12
  getH3App,
12
13
  markDefaultPluginProvided,
13
14
  } from "../server/framework-request-handler.js";
14
15
  import { readBody } from "../server/h3-helpers.js";
16
+ import { runWithRequestContext } from "../server/request-context.js";
15
17
  import {
16
18
  processA2AContinuationById,
17
19
  processDueA2AContinuations,
@@ -175,6 +177,12 @@ type RemoteCodeCommandEnvelope = {
175
177
  source?: unknown;
176
178
  };
177
179
 
180
+ type IntegrationCredentialContext = {
181
+ userEmail: string;
182
+ orgId?: string;
183
+ isIntegrationCaller?: boolean;
184
+ };
185
+
178
186
  const REMOTE_DEVICE_ONLINE_MS = 90_000;
179
187
 
180
188
  export async function enqueueRemoteCommand(
@@ -517,8 +525,7 @@ export function createIntegrationsPlugin(
517
525
  // init can leave us with an empty string forever. The getter
518
526
  // re-resolves on every webhook so freshly-set secrets work without
519
527
  // a redeploy.
520
- const getApiKey = () =>
521
- options?.apiKey ?? process.env.ANTHROPIC_API_KEY ?? "";
528
+ const getApiKey = () => options?.apiKey ?? "";
522
529
 
523
530
  // Build the system prompt
524
531
  const baseSystemPrompt = options?.systemPrompt ?? INTEGRATION_SYSTEM_PROMPT;
@@ -569,6 +576,39 @@ export function createIntegrationsPlugin(
569
576
  };
570
577
  }
571
578
 
579
+ function toCredentialContext(
580
+ ctx: { ownerEmail: string; orgId: string | null },
581
+ opts?: { isIntegrationCaller?: boolean },
582
+ ): IntegrationCredentialContext {
583
+ return {
584
+ userEmail: ctx.ownerEmail,
585
+ ...(ctx.orgId ? { orgId: ctx.orgId } : {}),
586
+ ...(opts?.isIntegrationCaller ? { isIntegrationCaller: true } : {}),
587
+ };
588
+ }
589
+
590
+ async function credentialContextForIntegrationConfig(
591
+ config: Awaited<ReturnType<typeof getIntegrationConfig>>,
592
+ ): Promise<IntegrationCredentialContext | null> {
593
+ const ownerEmail =
594
+ typeof config?.owner === "string" ? config.owner.trim() : "";
595
+ if (!ownerEmail) return null;
596
+ const orgId = await resolveOrgIdForEmail(ownerEmail).catch(() => null);
597
+ return {
598
+ userEmail: ownerEmail,
599
+ ...(orgId ? { orgId } : {}),
600
+ isIntegrationCaller: true,
601
+ };
602
+ }
603
+
604
+ async function withCredentialContext<T>(
605
+ context: IntegrationCredentialContext | null,
606
+ fn: () => Promise<T>,
607
+ ): Promise<T> {
608
+ if (!context) return fn();
609
+ return runWithRequestContext(context, fn);
610
+ }
611
+
572
612
  async function requireRemoteDevice(event: any) {
573
613
  const token = extractBearerToken(
574
614
  getRequestHeader(event, "authorization"),
@@ -627,11 +667,15 @@ export function createIntegrationsPlugin(
627
667
  setResponseStatus(event, 405);
628
668
  return { error: "Method not allowed" };
629
669
  }
630
- if (!(await requireSession(event))) return { error: "unauthorized" };
631
670
  const baseUrl = getBaseUrl(event);
671
+ const ctx = await requireSessionContext(event);
672
+ if (!ctx) return { error: "unauthorized" };
673
+ const credentialContext = toCredentialContext(ctx);
632
674
  const statuses: IntegrationStatus[] = [];
633
675
  for (const adapter of adapters) {
634
- const status = await adapter.getStatus(baseUrl);
676
+ const status = await withCredentialContext(credentialContext, () =>
677
+ adapter.getStatus(baseUrl),
678
+ );
635
679
  const config = await getIntegrationConfig(adapter.platform);
636
680
  status.enabled = !!config?.configData?.enabled;
637
681
  status.webhookUrl = `${baseUrl}${P}/${adapter.platform}/webhook`;
@@ -1422,9 +1466,13 @@ export function createIntegrationsPlugin(
1422
1466
 
1423
1467
  // ─── GET /:platform/status ─────────────────────────────
1424
1468
  if (action === "status" && method === "GET") {
1425
- if (!(await requireSession(event))) return { error: "unauthorized" };
1469
+ const ctx = await requireSessionContext(event);
1470
+ if (!ctx) return { error: "unauthorized" };
1426
1471
  const baseUrl = getBaseUrl(event);
1427
- const status = await adapter.getStatus(baseUrl);
1472
+ const status = await withCredentialContext(
1473
+ toCredentialContext(ctx),
1474
+ () => adapter.getStatus(baseUrl),
1475
+ );
1428
1476
  const config = await getIntegrationConfig(platform);
1429
1477
  status.enabled = !!config?.configData?.enabled;
1430
1478
  status.webhookUrl = `${baseUrl}${P}/${platform}/webhook`;
@@ -1482,14 +1530,20 @@ export function createIntegrationsPlugin(
1482
1530
  return "ok";
1483
1531
  }
1484
1532
 
1533
+ const config = await getIntegrationConfig(platform);
1534
+ const credentialContext =
1535
+ await credentialContextForIntegrationConfig(config);
1536
+
1485
1537
  // Handle platform verification challenges (e.g. Slack url_verification)
1486
1538
  // before checking enable state or parsing the message.
1487
- const verification = await adapter.handleVerification(event);
1539
+ const verification = await withCredentialContext(
1540
+ credentialContext,
1541
+ () => adapter.handleVerification(event),
1542
+ );
1488
1543
  if (verification.handled) {
1489
1544
  return verification.response ?? "ok";
1490
1545
  }
1491
1546
 
1492
- const config = await getIntegrationConfig(platform);
1493
1547
  if (!config?.configData?.enabled) {
1494
1548
  setResponseStatus(event, 404);
1495
1549
  return { error: `Integration ${platform} is not enabled` };
@@ -1500,13 +1554,17 @@ export function createIntegrationsPlugin(
1500
1554
  // hangs on streaming providers), and that means handleWebhook's
1501
1555
  // own verifyWebhook step is bypassed. Without this call anyone
1502
1556
  // could POST a forged Slack/Telegram/email payload.
1503
- const isValid = await adapter.verifyWebhook(event);
1557
+ const isValid = await withCredentialContext(credentialContext, () =>
1558
+ adapter.verifyWebhook(event),
1559
+ );
1504
1560
  if (!isValid) {
1505
1561
  setResponseStatus(event, 401);
1506
1562
  return { error: "Invalid webhook signature" };
1507
1563
  }
1508
1564
 
1509
- const incoming = await adapter.parseIncomingMessage(event);
1565
+ const incoming = await withCredentialContext(credentialContext, () =>
1566
+ adapter.parseIncomingMessage(event),
1567
+ );
1510
1568
  if (!incoming) {
1511
1569
  setResponseStatus(event, 200);
1512
1570
  return "ok";
@@ -1582,10 +1640,18 @@ export function createIntegrationsPlugin(
1582
1640
  if (platform === "telegram") {
1583
1641
  const baseUrl = getBaseUrl(event);
1584
1642
  const webhookUrl = `${baseUrl}${P}/telegram/webhook`;
1585
- const token = process.env.TELEGRAM_BOT_TOKEN;
1643
+ const ctx = await requireSessionContext(event);
1644
+ if (!ctx) return { error: "unauthorized" };
1645
+ const token = await withCredentialContext(
1646
+ toCredentialContext(ctx),
1647
+ () => resolveSecret("TELEGRAM_BOT_TOKEN"),
1648
+ );
1586
1649
  if (!token) {
1587
1650
  setResponseStatus(event, 400);
1588
- return { error: "TELEGRAM_BOT_TOKEN not configured" };
1651
+ return {
1652
+ error:
1653
+ "TELEGRAM_BOT_TOKEN not configured. Save it in settings.",
1654
+ };
1589
1655
  }
1590
1656
  try {
1591
1657
  const res = await fetch(
@@ -17,6 +17,7 @@ import {
17
17
  import {
18
18
  canUseDeployCredentialFallbackForRequest,
19
19
  readDeployCredentialEnv,
20
+ resolveSecret,
20
21
  } from "../server/credential-provider.js";
21
22
  import { getSetting } from "../settings/store.js";
22
23
  import { registerOnboardingStep } from "./registry.js";
@@ -287,12 +288,14 @@ const emailStep: OnboardingStep = {
287
288
  },
288
289
  },
289
290
  ],
290
- isComplete: () => {
291
- if (process.env.RESEND_API_KEY) return true;
291
+ isComplete: async () => {
292
+ if (await resolveSecret("RESEND_API_KEY")) return true;
292
293
  // SendGrid rejects Resend's sandbox sender, so EMAIL_FROM must also be
293
294
  // set — otherwise sendEmail() throws at runtime even though the API key
294
295
  // is configured.
295
- if (process.env.SENDGRID_API_KEY) return !!process.env.EMAIL_FROM;
296
+ if (await resolveSecret("SENDGRID_API_KEY")) {
297
+ return !!(await resolveSecret("EMAIL_FROM"));
298
+ }
296
299
  return false;
297
300
  },
298
301
  };
@@ -9,7 +9,7 @@
9
9
 
10
10
  export type OnboardingMethodBadge = "recommended" | "beta" | "free" | "soon";
11
11
 
12
- /** Fields for a form-style onboarding method (key/value env-var entry). */
12
+ /** Fields for a form-style onboarding method (key/value secret entry). */
13
13
  export interface OnboardingFormField {
14
14
  key: string;
15
15
  label: string;
@@ -312,7 +312,7 @@ async function inviteOne(
312
312
 
313
313
  let emailSent = false;
314
314
  let emailError: string | undefined;
315
- if (isEmailConfigured()) {
315
+ if (await isEmailConfigured()) {
316
316
  try {
317
317
  const { subject, html, text } = renderInviteEmail({
318
318
  invitee: email,
@@ -5435,10 +5435,7 @@ export function createAgentChatPlugin(
5435
5435
  // Sub-agents must inherit the parent run's resolved key so
5436
5436
  // delegations spawned by agent-teams don't silently fall back
5437
5437
  // to the platform key while the parent uses BYO credentials.
5438
- apiKey:
5439
- runCtx?.userApiKey ??
5440
- options?.apiKey ??
5441
- process.env.ANTHROPIC_API_KEY,
5438
+ apiKey: runCtx?.userApiKey ?? options?.apiKey,
5442
5439
  })
5443
5440
  );
5444
5441
  },
@@ -6949,7 +6946,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
6949
6946
  const { getOwnerActiveApiKey } =
6950
6947
  await import("../agent/production-agent.js");
6951
6948
  const userApiKey = await getOwnerActiveApiKey(ownerEmail);
6952
- const apiKey = userApiKey ?? process.env.ANTHROPIC_API_KEY;
6949
+ const apiKey = userApiKey;
6953
6950
  if (!apiKey) {
6954
6951
  // Fallback: truncate the message
6955
6952
  return { title: cleanMessage.trim().slice(0, 60) };
@@ -7985,7 +7982,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
7985
7982
  : await buildSchemaBlock(owner, databaseToolsMode);
7986
7983
  return basePrompt + resources + schemaBlock;
7987
7984
  },
7988
- apiKey: options?.apiKey ?? process.env.ANTHROPIC_API_KEY,
7985
+ apiKey: options?.apiKey,
7989
7986
  model: options?.model,
7990
7987
  appId: options?.appId,
7991
7988
  };
@@ -8084,7 +8081,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
8084
8081
  : await buildSchemaBlock(owner, databaseToolsMode);
8085
8082
  return basePrompt + resources + schemaBlock;
8086
8083
  },
8087
- apiKey: options?.apiKey ?? process.env.ANTHROPIC_API_KEY,
8084
+ apiKey: options?.apiKey,
8088
8085
  model: options?.model,
8089
8086
  appId: options?.appId,
8090
8087
  });
@@ -125,6 +125,8 @@ export async function trackSignupEvent({
125
125
  // Persistent auth secret
126
126
  // ---------------------------------------------------------------------------
127
127
 
128
+ let inMemoryDevAuthSecret: string | undefined;
129
+
128
130
  /**
129
131
  * Resolve the Better Auth signing secret.
130
132
  *
@@ -133,13 +135,9 @@ export async function trackSignupEvent({
133
135
  * 2. Hosted workspace deploys can derive a per-purpose secret from the
134
136
  * already-required `A2A_SECRET` root. This keeps fresh workspace branches
135
137
  * bootable without reusing the raw A2A key as a cookie-signing key.
136
- * 3. `.env.local` in the template cwd — a per-workspace persistent secret
137
- * that the framework writes once on first boot when no secret is set.
138
- * Gitignored by convention (`.env*` in template .gitignore files), so
139
- * it's safe to persist credentials here.
140
- * 4. Generate a new random 32-byte hex, write it to `.env.local`, and use
141
- * it. Subsequent restarts re-read the same file — so session cookies
142
- * signed by a previous boot remain valid across dev-server restarts.
138
+ * 3. Existing `.env.local` values in the template cwd — read-only
139
+ * compatibility for projects that already configured this secret.
140
+ * 4. Generate a per-process in-memory random 32-byte hex in development.
143
141
  *
144
142
  * Why this matters: before this helper existed, missing `BETTER_AUTH_SECRET`
145
143
  * fell through to `GOOGLE_CLIENT_SECRET` / `ACCESS_TOKEN` / a hardcoded
@@ -147,8 +145,8 @@ export async function trackSignupEvent({
147
145
  * boot would re-fall back to the hardcoded value (still stable) — but
148
146
  * rotating Google credentials, toggling `ACCESS_TOKEN`, or churning the
149
147
  * fallback chain would invalidate every signed cookie and force everyone
150
- * to sign in again. Pinning the secret to `.env.local` on first boot
151
- * removes that footgun.
148
+ * to sign in again. We still read explicit env configuration, but never
149
+ * auto-write a generated secret into env files.
152
150
  */
153
151
  function resolveAuthSecret(): string {
154
152
  if (process.env.BETTER_AUTH_SECRET) return process.env.BETTER_AUTH_SECRET;
@@ -177,47 +175,26 @@ function resolveAuthSecret(): string {
177
175
  );
178
176
  }
179
177
 
180
- // Dev: persist a generated secret to .env.local so sessions survive
181
- // dev-server restarts. Falls back to an in-memory random secret only if
182
- // the filesystem isn't writable (rare in dev, e.g. read-only mounts) —
183
- // sessions reset on every dev-process restart in that case, which is
184
- // fine.
185
- //
186
178
  // SECURITY (audit 09 LOW-2): the previous fallback chain
187
179
  // (`GOOGLE_CLIENT_SECRET || ACCESS_TOKEN || hardcoded`) reused
188
180
  // cross-purpose secrets and a public hardcoded literal as the cookie
189
181
  // HMAC. Dropped entirely — better to mint an ephemeral secret than to
190
182
  // re-use a Google client secret or a known string.
191
- try {
192
- const envLocalPath = path.resolve(process.cwd(), ".env.local");
193
- const existing = readEnvLocalSecret(envLocalPath);
194
- if (existing) {
195
- process.env.BETTER_AUTH_SECRET = existing; // guard:allow-env-mutation — boot-time secret resolution from .env.local, runs once at module init
196
- return existing;
197
- }
183
+ const existing = readEnvLocalSecret(
184
+ path.resolve(process.cwd(), ".env.local"),
185
+ );
186
+ if (existing) return existing;
198
187
 
199
- const generated = crypto.randomBytes(32).toString("hex");
200
- appendEnvLocalSecret(envLocalPath, generated);
201
- process.env.BETTER_AUTH_SECRET = generated; // guard:allow-env-mutation — boot-time secret generation, runs once at module init before any request
202
- console.log(
203
- "[agent-native] Generated a persistent BETTER_AUTH_SECRET in .env.local. " +
204
- "Sessions will now survive dev-server restarts. " +
205
- "(Delete .env.local to rotate; set BETTER_AUTH_SECRET in .env to override.)",
206
- );
207
- return generated;
208
- } catch {
209
- // Filesystem unwritable (read-only mount, sandboxed test env, etc.).
210
- // Mint a per-process random secret so cookies stay unique per boot.
211
- // Sessions reset when the dev process restarts — acceptable for dev.
212
- const ephemeral = crypto.randomBytes(32).toString("hex");
188
+ if (!inMemoryDevAuthSecret) {
189
+ inMemoryDevAuthSecret = crypto.randomBytes(32).toString("hex");
213
190
  console.warn(
214
- "[agent-native] Could not persist BETTER_AUTH_SECRET to .env.local " +
215
- "(filesystem unwritable). Using an ephemeral in-memory secret. " +
216
- "Sessions will reset every time this process restarts. " +
217
- "Set BETTER_AUTH_SECRET in your environment to keep sessions valid across restarts.",
191
+ "[agent-native] BETTER_AUTH_SECRET is not configured. Using an ephemeral " +
192
+ "in-memory development secret. Sessions will reset every time this " +
193
+ "process restarts. Set BETTER_AUTH_SECRET in your environment to keep " +
194
+ "sessions valid across restarts.",
218
195
  );
219
- return ephemeral;
220
196
  }
197
+ return inMemoryDevAuthSecret;
221
198
  }
222
199
 
223
200
  function readEnvLocalSecret(envLocalPath: string): string | undefined {
@@ -234,26 +211,6 @@ function readEnvLocalSecret(envLocalPath: string): string | undefined {
234
211
  }
235
212
  }
236
213
 
237
- function appendEnvLocalSecret(envLocalPath: string, secret: string): void {
238
- const header =
239
- "# Auto-generated by agent-native on first boot. Gitignored.\n" +
240
- "# Keeps signed session cookies valid across dev-server restarts.\n" +
241
- "# Delete this file (or this line) to rotate the secret.\n";
242
- const line = `BETTER_AUTH_SECRET=${secret}\n`;
243
-
244
- // If the file already exists, just append; otherwise create with header.
245
- if (fs.existsSync(envLocalPath)) {
246
- const existing = fs.readFileSync(envLocalPath, "utf8");
247
- const needsLeadingNewline = existing.length > 0 && !existing.endsWith("\n");
248
- fs.appendFileSync(
249
- envLocalPath,
250
- (needsLeadingNewline ? "\n" : "") + "\n" + header + line,
251
- );
252
- } else {
253
- fs.writeFileSync(envLocalPath, header + line, { mode: 0o600 });
254
- }
255
- }
256
-
257
214
  function normalizeTrackingSlug(value: string | undefined): string | undefined {
258
215
  const trimmed = value?.trim();
259
216
  if (!trimmed) return undefined;
@@ -912,7 +869,7 @@ async function createBetterAuthInstance(
912
869
  const appUrl = getAppProductionUrl();
913
870
  const cookieNamespace = resolveAuthCookieNamespace();
914
871
  const requireEmailVerification =
915
- isEmailConfigured() && !shouldSkipEmailVerification();
872
+ (await isEmailConfigured()) && !shouldSkipEmailVerification();
916
873
 
917
874
  const shouldMirrorGoogleAccountTokens =
918
875
  (config?.googleScopes?.length ?? 0) > 0;