@agent-native/core 0.117.0 → 0.117.2

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 (357) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +16 -0
  3. package/corpus/core/package.json +2 -1
  4. package/corpus/core/src/cli/context-xray-local.ts +1 -1
  5. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +4 -4
  6. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +11 -11
  7. package/corpus/core/src/client/extensions/agent-native-extension-runtime.ts +1 -1
  8. package/corpus/core/src/client/extensions/delete-extension.ts +2 -2
  9. package/corpus/core/src/client/org/OrgSwitcher.tsx +25 -1
  10. package/corpus/core/src/client/settings/SettingsPanel.tsx +102 -10
  11. package/corpus/core/src/client/sharing/ShareButton.tsx +7 -6
  12. package/corpus/core/src/db/client.ts +13 -10
  13. package/corpus/core/src/deploy/workspace-deploy.ts +14 -4
  14. package/corpus/core/src/extensions/actions.ts +13 -5
  15. package/corpus/core/src/extensions/local.ts +1 -0
  16. package/corpus/core/src/extensions/routes.ts +10 -5
  17. package/corpus/core/src/extensions/schema.ts +5 -0
  18. package/corpus/core/src/extensions/slots/store.ts +14 -4
  19. package/corpus/core/src/extensions/store.ts +55 -19
  20. package/corpus/core/src/extensions/theme.ts +1 -1
  21. package/corpus/core/src/file-upload/registry.ts +9 -0
  22. package/corpus/core/src/index.browser.ts +5 -0
  23. package/corpus/core/src/index.ts +1 -0
  24. package/corpus/core/src/localization/default-messages.ts +23 -6
  25. package/corpus/core/src/server/action-discovery.ts +8 -0
  26. package/corpus/core/src/server/better-auth-instance.ts +7 -2
  27. package/corpus/core/src/server/email-template.ts +18 -0
  28. package/corpus/core/src/server/email-templates.ts +3 -0
  29. package/corpus/core/src/server/email.ts +40 -4
  30. package/corpus/core/src/sharing/actions/share-resource.ts +1 -0
  31. package/corpus/core/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  32. package/corpus/core/src/templates/default/app/global.css +1 -1
  33. package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -6
  34. package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -6
  35. package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -6
  36. package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -6
  37. package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -6
  38. package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -6
  39. package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -6
  40. package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -6
  41. package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -6
  42. package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +7 -7
  43. package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +7 -7
  44. package/corpus/core/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  45. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  46. package/corpus/core/src/user-profile/actions/get-user-profile.ts +16 -0
  47. package/corpus/core/src/user-profile/actions/update-user-profile.ts +24 -0
  48. package/corpus/core/src/user-profile/index.ts +5 -0
  49. package/corpus/core/src/user-profile/shared.ts +14 -0
  50. package/corpus/core/src/user-profile/store.ts +50 -0
  51. package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  52. package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  53. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +2 -2
  54. package/corpus/templates/assets/app/global.css +1 -1
  55. package/corpus/templates/assets/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  56. package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  57. package/corpus/templates/brain/app/global.css +2 -2
  58. package/corpus/templates/brain/app/lib/brain.ts +2 -2
  59. package/corpus/templates/brain/app/root.tsx +2 -2
  60. package/corpus/templates/brain/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  61. package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  62. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +6 -2
  63. package/corpus/templates/calendar/app/global.css +1 -1
  64. package/corpus/templates/calendar/app/root.tsx +2 -2
  65. package/corpus/templates/calendar/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  66. package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  67. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +2 -2
  68. package/corpus/templates/chat/app/global.css +1 -1
  69. package/corpus/templates/chat/app/root.tsx +2 -2
  70. package/corpus/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  71. package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  72. package/corpus/templates/clips/actions/export-to-brain.ts +1 -1
  73. package/corpus/templates/clips/actions/invite-member.ts +1 -0
  74. package/corpus/templates/clips/app/components/library/library-layout.tsx +2 -2
  75. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +20 -11
  76. package/corpus/templates/clips/app/global.css +1 -1
  77. package/corpus/templates/clips/app/root.tsx +7 -2
  78. package/corpus/templates/clips/app/routes/record.tsx +2 -88
  79. package/corpus/templates/clips/changelog/2026-07-22-builder-connected-recordings-start-resumable-upload-sessions.md +6 -0
  80. package/corpus/templates/clips/changelog/2026-07-22-clip-thumbnails-now-come-from-the-recording-instead-of-the-p.md +6 -0
  81. package/corpus/templates/clips/changelog/2026-07-22-clips-emails-now-render-the-agent-native-logo-in-gmail-and-o.md +6 -0
  82. package/corpus/templates/clips/changelog/2026-07-22-dismissed-zoom-and-teams-meeting-note-prompts-now-stay-dismi.md +6 -0
  83. package/corpus/templates/clips/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  84. package/corpus/templates/clips/changelog/2026-07-22-quieter-permissions-and-rewind-controls.md +6 -0
  85. package/corpus/templates/clips/desktop/src/app.tsx +86 -52
  86. package/corpus/templates/clips/desktop/src/lib/meeting-notification-dismissal.ts +31 -0
  87. package/corpus/templates/clips/desktop/src/lib/recorder.ts +4 -167
  88. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +10 -1
  89. package/corpus/templates/clips/desktop/src/styles.css +98 -36
  90. package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +67 -4
  91. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -1
  92. package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +51 -0
  93. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +5 -1
  94. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +0 -189
  95. package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +62 -0
  96. package/corpus/templates/clips/server/plugins/db.ts +6 -2
  97. package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  98. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +3 -3
  99. package/corpus/templates/content/app/global.css +1 -1
  100. package/corpus/templates/content/app/root.tsx +2 -2
  101. package/corpus/templates/content/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  102. package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  103. package/corpus/templates/crm/app/global.css +1 -1
  104. package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  105. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +19 -1
  106. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +12 -1
  107. package/corpus/templates/design/app/components/design/EditPanel.tsx +177 -52
  108. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +179 -59
  109. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +74 -27
  110. package/corpus/templates/design/app/components/design/multi-screen/types.ts +2 -0
  111. package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -2
  112. package/corpus/templates/design/app/global.css +1 -1
  113. package/corpus/templates/design/app/hooks/use-navigation-state.ts +6 -5
  114. package/corpus/templates/design/app/root.tsx +2 -2
  115. package/corpus/templates/design/changelog/2026-07-22-design-owners-can-keep-editing-their-designs-after-switching.md +6 -0
  116. package/corpus/templates/design/changelog/2026-07-22-inspector-tabs-keep-their-text-labels-at-narrow-widths.md +6 -0
  117. package/corpus/templates/design/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  118. package/corpus/templates/design/changelog/2026-07-22-narrow-breakpoint-previews-keep-their-device-labels-readable.md +6 -0
  119. package/corpus/templates/design/changelog/2026-07-22-removed-the-draft-status-chip-from-the-design-editor.md +6 -0
  120. package/corpus/templates/design/changelog/2026-07-22-responsive-breakpoint-controls-stay-within-narrow-sidebars.md +6 -0
  121. package/corpus/templates/design/changelog/2026-07-22-responsive-peers-now-use-a-softer-selection-highlight-withou.md +6 -0
  122. package/corpus/templates/design/changelog/2026-07-22-rotate-from-context-menu.md +6 -0
  123. package/corpus/templates/design/changelog/2026-07-22-the-selection-outline-now-stays-attached-while-moving-screen.md +6 -0
  124. package/corpus/templates/design/changelog/2026-07-22-view-only-designs-now-support-figma-style-layer-inspection-w.md +6 -0
  125. package/corpus/templates/design/server/db/index.ts +4 -0
  126. package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  127. package/corpus/templates/dispatch/app/dispatch-extensions.tsx +2 -2
  128. package/corpus/templates/dispatch/app/global.css +1 -1
  129. package/corpus/templates/dispatch/app/root.tsx +2 -2
  130. package/corpus/templates/dispatch/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  131. package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  132. package/corpus/templates/forms/app/components/layout/Layout.tsx +1 -1
  133. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +3 -3
  134. package/corpus/templates/forms/app/global.css +1 -1
  135. package/corpus/templates/forms/app/hooks/use-forms.ts +55 -2
  136. package/corpus/templates/forms/app/i18n/en-US.ts +2 -0
  137. package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +3 -3
  138. package/corpus/templates/forms/app/pages/FormsListPage.tsx +23 -6
  139. package/corpus/templates/forms/app/root.tsx +2 -2
  140. package/corpus/templates/forms/changelog/2026-07-22-forms-now-archive-with-optimistic-feedback.md +6 -0
  141. package/corpus/templates/forms/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  142. package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -1
  143. package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  144. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +2 -2
  145. package/corpus/templates/macros/app/root.tsx +2 -2
  146. package/corpus/templates/macros/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  147. package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  148. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +3 -3
  149. package/corpus/templates/mail/app/components/layout/CommandPalette.tsx +2 -2
  150. package/corpus/templates/mail/app/global.css +1 -1
  151. package/corpus/templates/mail/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  152. package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  153. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +2 -2
  154. package/corpus/templates/plan/app/global.css +1 -1
  155. package/corpus/templates/plan/app/root.tsx +2 -2
  156. package/corpus/templates/plan/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  157. package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  158. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +2 -2
  159. package/corpus/templates/slides/app/root.tsx +2 -2
  160. package/corpus/templates/slides/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  161. package/corpus/templates/slides/changelog/2026-07-22-slides-no-longer-fail-intermittently-on-fresh-server-instances.md +6 -0
  162. package/corpus/templates/slides/changelog/2026-07-22-uploaded-screenshots-can-now-be-analyzed-and-recreated-as-ed.md +6 -0
  163. package/corpus/templates/slides/server/lib/chat-attachments.ts +7 -3
  164. package/corpus/templates/slides/server/plugins/db.ts +44 -17
  165. package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  166. package/corpus/templates/tasks/app/global.css +1 -1
  167. package/dist/cli/context-xray-local.js +1 -1
  168. package/dist/cli/context-xray-local.js.map +1 -1
  169. package/dist/client/extensions/ExtensionViewer.js +2 -2
  170. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  171. package/dist/client/extensions/ExtensionsSidebarSection.js +11 -11
  172. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  173. package/dist/client/extensions/agent-native-extension-runtime.js +1 -1
  174. package/dist/client/extensions/agent-native-extension-runtime.js.map +1 -1
  175. package/dist/client/extensions/delete-extension.d.ts +1 -1
  176. package/dist/client/extensions/delete-extension.d.ts.map +1 -1
  177. package/dist/client/extensions/delete-extension.js +1 -1
  178. package/dist/client/extensions/delete-extension.js.map +1 -1
  179. package/dist/client/org/OrgSwitcher.d.ts +3 -1
  180. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  181. package/dist/client/org/OrgSwitcher.js +12 -4
  182. package/dist/client/org/OrgSwitcher.js.map +1 -1
  183. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  184. package/dist/client/settings/SettingsPanel.js +37 -4
  185. package/dist/client/settings/SettingsPanel.js.map +1 -1
  186. package/dist/client/sharing/ShareButton.d.ts +3 -4
  187. package/dist/client/sharing/ShareButton.d.ts.map +1 -1
  188. package/dist/client/sharing/ShareButton.js +3 -2
  189. package/dist/client/sharing/ShareButton.js.map +1 -1
  190. package/dist/collab/awareness.d.ts +2 -2
  191. package/dist/collab/awareness.d.ts.map +1 -1
  192. package/dist/collab/routes.d.ts +1 -1
  193. package/dist/collab/struct-routes.d.ts +1 -1
  194. package/dist/db/client.d.ts +7 -7
  195. package/dist/db/client.d.ts.map +1 -1
  196. package/dist/db/client.js +13 -10
  197. package/dist/db/client.js.map +1 -1
  198. package/dist/deploy/workspace-deploy.js +14 -4
  199. package/dist/deploy/workspace-deploy.js.map +1 -1
  200. package/dist/extensions/actions.d.ts.map +1 -1
  201. package/dist/extensions/actions.js +8 -5
  202. package/dist/extensions/actions.js.map +1 -1
  203. package/dist/extensions/local.d.ts.map +1 -1
  204. package/dist/extensions/local.js +1 -0
  205. package/dist/extensions/local.js.map +1 -1
  206. package/dist/extensions/routes.d.ts.map +1 -1
  207. package/dist/extensions/routes.js +9 -4
  208. package/dist/extensions/routes.js.map +1 -1
  209. package/dist/extensions/schema.d.ts +23 -2
  210. package/dist/extensions/schema.d.ts.map +1 -1
  211. package/dist/extensions/schema.js +5 -0
  212. package/dist/extensions/schema.js.map +1 -1
  213. package/dist/extensions/slots/store.d.ts +1 -1
  214. package/dist/extensions/slots/store.d.ts.map +1 -1
  215. package/dist/extensions/slots/store.js +4 -4
  216. package/dist/extensions/slots/store.js.map +1 -1
  217. package/dist/extensions/store.d.ts +1 -0
  218. package/dist/extensions/store.d.ts.map +1 -1
  219. package/dist/extensions/store.js +38 -21
  220. package/dist/extensions/store.js.map +1 -1
  221. package/dist/extensions/theme.js +1 -1
  222. package/dist/extensions/theme.js.map +1 -1
  223. package/dist/file-upload/registry.d.ts.map +1 -1
  224. package/dist/file-upload/registry.js +9 -0
  225. package/dist/file-upload/registry.js.map +1 -1
  226. package/dist/index.browser.d.ts +1 -0
  227. package/dist/index.browser.d.ts.map +1 -1
  228. package/dist/index.browser.js +1 -0
  229. package/dist/index.browser.js.map +1 -1
  230. package/dist/index.d.ts +1 -0
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +1 -0
  233. package/dist/index.js.map +1 -1
  234. package/dist/localization/default-messages.d.ts +16 -0
  235. package/dist/localization/default-messages.d.ts.map +1 -1
  236. package/dist/localization/default-messages.js +22 -6
  237. package/dist/localization/default-messages.js.map +1 -1
  238. package/dist/notifications/routes.d.ts +2 -2
  239. package/dist/observability/routes.d.ts +5 -5
  240. package/dist/progress/routes.d.ts +1 -1
  241. package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
  242. package/dist/provider-api/actions/provider-api.d.ts +11 -11
  243. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  244. package/dist/secrets/routes.d.ts +6 -6
  245. package/dist/server/action-discovery.d.ts.map +1 -1
  246. package/dist/server/action-discovery.js +8 -0
  247. package/dist/server/action-discovery.js.map +1 -1
  248. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  249. package/dist/server/better-auth-instance.d.ts +7 -2
  250. package/dist/server/better-auth-instance.d.ts.map +1 -1
  251. package/dist/server/better-auth-instance.js.map +1 -1
  252. package/dist/server/email-template.d.ts +3 -0
  253. package/dist/server/email-template.d.ts.map +1 -1
  254. package/dist/server/email-template.js +13 -0
  255. package/dist/server/email-template.js.map +1 -1
  256. package/dist/server/email-templates.d.ts.map +1 -1
  257. package/dist/server/email-templates.js +3 -0
  258. package/dist/server/email-templates.js.map +1 -1
  259. package/dist/server/email.d.ts.map +1 -1
  260. package/dist/server/email.js +27 -4
  261. package/dist/server/email.js.map +1 -1
  262. package/dist/server/transcribe-voice.d.ts +1 -1
  263. package/dist/sharing/actions/share-resource.js +1 -0
  264. package/dist/sharing/actions/share-resource.js.map +1 -1
  265. package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  266. package/dist/templates/chat/app/components/layout/Sidebar.tsx +2 -2
  267. package/dist/templates/chat/app/global.css +1 -1
  268. package/dist/templates/chat/app/root.tsx +2 -2
  269. package/dist/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  270. package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  271. package/dist/templates/default/app/global.css +1 -1
  272. package/dist/templates/default/app/i18n/ar-SA.ts +6 -6
  273. package/dist/templates/default/app/i18n/de-DE.ts +6 -6
  274. package/dist/templates/default/app/i18n/en-US.ts +6 -6
  275. package/dist/templates/default/app/i18n/es-ES.ts +6 -6
  276. package/dist/templates/default/app/i18n/fr-FR.ts +6 -6
  277. package/dist/templates/default/app/i18n/hi-IN.ts +6 -6
  278. package/dist/templates/default/app/i18n/ja-JP.ts +6 -6
  279. package/dist/templates/default/app/i18n/ko-KR.ts +6 -6
  280. package/dist/templates/default/app/i18n/pt-BR.ts +6 -6
  281. package/dist/templates/default/app/i18n/zh-CN.ts +7 -7
  282. package/dist/templates/default/app/i18n/zh-TW.ts +7 -7
  283. package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  284. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  285. package/dist/user-profile/actions/get-user-profile.d.ts +4 -0
  286. package/dist/user-profile/actions/get-user-profile.d.ts.map +1 -0
  287. package/dist/user-profile/actions/get-user-profile.js +14 -0
  288. package/dist/user-profile/actions/get-user-profile.js.map +1 -0
  289. package/dist/user-profile/actions/update-user-profile.d.ts +6 -0
  290. package/dist/user-profile/actions/update-user-profile.d.ts.map +1 -0
  291. package/dist/user-profile/actions/update-user-profile.js +20 -0
  292. package/dist/user-profile/actions/update-user-profile.js.map +1 -0
  293. package/dist/user-profile/index.d.ts +2 -0
  294. package/dist/user-profile/index.d.ts.map +1 -0
  295. package/dist/user-profile/index.js +2 -0
  296. package/dist/user-profile/index.js.map +1 -0
  297. package/dist/user-profile/shared.d.ts +7 -0
  298. package/dist/user-profile/shared.d.ts.map +1 -0
  299. package/dist/user-profile/shared.js +6 -0
  300. package/dist/user-profile/shared.js.map +1 -0
  301. package/dist/user-profile/store.d.ts +4 -0
  302. package/dist/user-profile/store.d.ts.map +1 -0
  303. package/dist/user-profile/store.js +38 -0
  304. package/dist/user-profile/store.js.map +1 -0
  305. package/package.json +2 -1
  306. package/src/cli/context-xray-local.ts +1 -1
  307. package/src/client/extensions/ExtensionViewer.tsx +4 -4
  308. package/src/client/extensions/ExtensionsSidebarSection.tsx +11 -11
  309. package/src/client/extensions/agent-native-extension-runtime.ts +1 -1
  310. package/src/client/extensions/delete-extension.ts +2 -2
  311. package/src/client/org/OrgSwitcher.tsx +25 -1
  312. package/src/client/settings/SettingsPanel.tsx +102 -10
  313. package/src/client/sharing/ShareButton.tsx +7 -6
  314. package/src/db/client.ts +13 -10
  315. package/src/deploy/workspace-deploy.ts +14 -4
  316. package/src/extensions/actions.ts +13 -5
  317. package/src/extensions/local.ts +1 -0
  318. package/src/extensions/routes.ts +10 -5
  319. package/src/extensions/schema.ts +5 -0
  320. package/src/extensions/slots/store.ts +14 -4
  321. package/src/extensions/store.ts +55 -19
  322. package/src/extensions/theme.ts +1 -1
  323. package/src/file-upload/registry.ts +9 -0
  324. package/src/index.browser.ts +5 -0
  325. package/src/index.ts +1 -0
  326. package/src/localization/default-messages.ts +23 -6
  327. package/src/server/action-discovery.ts +8 -0
  328. package/src/server/better-auth-instance.ts +7 -2
  329. package/src/server/email-template.ts +18 -0
  330. package/src/server/email-templates.ts +3 -0
  331. package/src/server/email.ts +40 -4
  332. package/src/sharing/actions/share-resource.ts +1 -0
  333. package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  334. package/src/templates/chat/app/components/layout/Sidebar.tsx +2 -2
  335. package/src/templates/chat/app/global.css +1 -1
  336. package/src/templates/chat/app/root.tsx +2 -2
  337. package/src/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  338. package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  339. package/src/templates/default/app/global.css +1 -1
  340. package/src/templates/default/app/i18n/ar-SA.ts +6 -6
  341. package/src/templates/default/app/i18n/de-DE.ts +6 -6
  342. package/src/templates/default/app/i18n/en-US.ts +6 -6
  343. package/src/templates/default/app/i18n/es-ES.ts +6 -6
  344. package/src/templates/default/app/i18n/fr-FR.ts +6 -6
  345. package/src/templates/default/app/i18n/hi-IN.ts +6 -6
  346. package/src/templates/default/app/i18n/ja-JP.ts +6 -6
  347. package/src/templates/default/app/i18n/ko-KR.ts +6 -6
  348. package/src/templates/default/app/i18n/pt-BR.ts +6 -6
  349. package/src/templates/default/app/i18n/zh-CN.ts +7 -7
  350. package/src/templates/default/app/i18n/zh-TW.ts +7 -7
  351. package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  352. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  353. package/src/user-profile/actions/get-user-profile.ts +16 -0
  354. package/src/user-profile/actions/update-user-profile.ts +24 -0
  355. package/src/user-profile/index.ts +5 -0
  356. package/src/user-profile/shared.ts +14 -0
  357. package/src/user-profile/store.ts +50 -0
@@ -41,28 +41,28 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
- ok?: undefined;
46
44
  summary: import("./types.js").TraceSummary;
47
45
  spans: import("./types.js").TraceSpan[];
48
46
  id?: undefined;
49
- } | {
50
47
  error?: undefined;
51
48
  ok?: undefined;
49
+ } | {
52
50
  summary?: undefined;
53
51
  spans?: undefined;
54
52
  id: string;
55
- } | {
53
+ error?: undefined;
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  summary?: undefined;
64
63
  spans?: undefined;
65
64
  id?: undefined;
66
65
  ok: boolean;
66
+ error?: undefined;
67
67
  }>>;
68
68
  //# sourceMappingURL=routes.d.ts.map
@@ -15,7 +15,7 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;
21
21
  //# sourceMappingURL=routes.d.ts.map
@@ -76,8 +76,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
78
  id?: undefined;
79
- found?: undefined;
80
79
  deleted?: undefined;
80
+ message?: undefined;
81
81
  providers: {
82
82
  id: string;
83
83
  label: string;
@@ -89,21 +89,22 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
89
89
  }[];
90
90
  count: number;
91
91
  provider?: undefined;
92
+ found?: undefined;
92
93
  registered?: undefined;
93
94
  label?: undefined;
94
- message?: undefined;
95
95
  } | {
96
96
  id?: undefined;
97
97
  deleted?: undefined;
98
+ message?: undefined;
98
99
  providers?: undefined;
99
100
  count?: undefined;
100
101
  found: boolean;
101
102
  provider: import("../custom-registry.js").CustomProviderConfig;
102
103
  registered?: undefined;
103
104
  label?: undefined;
104
- message?: undefined;
105
105
  } | {
106
106
  deleted?: undefined;
107
+ message?: undefined;
107
108
  providers?: undefined;
108
109
  count?: undefined;
109
110
  provider?: undefined;
@@ -111,23 +112,22 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
111
112
  id: string;
112
113
  registered?: undefined;
113
114
  label?: undefined;
114
- message?: undefined;
115
115
  } | {
116
- found?: undefined;
116
+ message?: undefined;
117
117
  providers?: undefined;
118
118
  count?: undefined;
119
119
  provider?: undefined;
120
+ found?: undefined;
120
121
  deleted: boolean;
121
122
  id: string;
122
123
  registered?: undefined;
123
124
  label?: undefined;
124
- message?: undefined;
125
125
  } | {
126
- found?: undefined;
127
126
  deleted?: undefined;
128
127
  providers?: undefined;
129
128
  count?: undefined;
130
129
  provider?: undefined;
130
+ found?: undefined;
131
131
  registered: boolean;
132
132
  id: string;
133
133
  label: string;
@@ -309,10 +309,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
309
309
  notes?: string | undefined;
310
310
  scope?: "org" | "user" | undefined;
311
311
  }, {
312
- deleted?: undefined;
312
+ message?: undefined;
313
313
  id?: undefined;
314
- provider?: undefined;
315
- found?: undefined;
314
+ deleted?: undefined;
316
315
  providers: {
317
316
  id: string;
318
317
  label: string;
@@ -323,45 +322,46 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
323
322
  updatedAt: number;
324
323
  }[];
325
324
  count: number;
325
+ provider?: undefined;
326
+ found?: undefined;
326
327
  registered?: undefined;
327
328
  label?: undefined;
328
- message?: undefined;
329
329
  } | {
330
+ message?: undefined;
331
+ id?: undefined;
330
332
  deleted?: undefined;
331
333
  count?: undefined;
332
- id?: undefined;
333
334
  providers?: undefined;
334
335
  found: boolean;
335
336
  provider: import("../custom-registry.js").CustomProviderConfig;
336
337
  registered?: undefined;
337
338
  label?: undefined;
338
- message?: undefined;
339
339
  } | {
340
+ message?: undefined;
340
341
  deleted?: undefined;
341
342
  count?: undefined;
342
- provider?: undefined;
343
343
  providers?: undefined;
344
+ provider?: undefined;
344
345
  found: boolean;
345
346
  id: string;
346
347
  registered?: undefined;
347
348
  label?: undefined;
348
- message?: undefined;
349
349
  } | {
350
+ message?: undefined;
350
351
  count?: undefined;
352
+ providers?: undefined;
351
353
  provider?: undefined;
352
354
  found?: undefined;
353
- providers?: undefined;
354
355
  deleted: boolean;
355
356
  id: string;
356
357
  registered?: undefined;
357
358
  label?: undefined;
358
- message?: undefined;
359
359
  } | {
360
360
  deleted?: undefined;
361
361
  count?: undefined;
362
+ providers?: undefined;
362
363
  provider?: undefined;
363
364
  found?: undefined;
364
- providers?: undefined;
365
365
  registered: boolean;
366
366
  id: string;
367
367
  label: string;
@@ -73,6 +73,7 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
73
73
  offset?: unknown;
74
74
  limit?: unknown;
75
75
  }, {
76
+ deleted?: undefined;
76
77
  jobs: {
77
78
  id: string;
78
79
  name: string;
@@ -83,7 +84,6 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
83
84
  updatedAt: string;
84
85
  }[];
85
86
  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;
94
95
  jobs?: undefined;
95
96
  total?: undefined;
96
- deleted?: undefined;
97
97
  jobId?: undefined;
98
98
  hits: Record<string, unknown>[];
99
99
  offset: number;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
+ error?: undefined;
40
41
  ok: boolean;
41
42
  status: string;
42
- error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: undefined;
47
47
  } | {
48
+ error?: undefined;
48
49
  ok: boolean;
49
50
  removed: boolean;
50
- error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — re-run the validator against the
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: undefined;
60
60
  } | {
61
+ error?: undefined;
61
62
  ok: boolean;
62
63
  note?: undefined;
63
- error?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  ok: boolean;
66
67
  note: string;
67
- error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,12 +95,12 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
+ error?: undefined;
98
99
  ok: boolean;
99
100
  key: string;
100
- error?: undefined;
101
101
  } | {
102
+ error?: undefined;
102
103
  ok: boolean;
103
104
  removed: boolean;
104
- error?: undefined;
105
105
  }>>;
106
106
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-discovery.d.ts","sourceRoot":"","sources":["../../src/server/action-discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2DhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACnC,IAAI,CAMN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACpC,IAAI,CAKN;AA0RD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAqC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA6FtC;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC,CAiMf;AAED,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,4BAAsB,CAAC"}
1
+ {"version":3,"file":"action-discovery.d.ts","sourceRoot":"","sources":["../../src/server/action-discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2DhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACnC,IAAI,CAMN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACpC,IAAI,CAKN;AA0RD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAqC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA6FtC;AAED,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC,CAyMf;AAED,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,4BAAsB,CAAC"}
@@ -575,6 +575,14 @@ export async function mergeCoreSharingActions(registry) {
575
575
  "set-localization-preference",
576
576
  () => import("../localization/actions/set-localization-preference.js"),
577
577
  ],
578
+ [
579
+ "get-user-profile",
580
+ () => import("../user-profile/actions/get-user-profile.js"),
581
+ ],
582
+ [
583
+ "update-user-profile",
584
+ () => import("../user-profile/actions/update-user-profile.js"),
585
+ ],
578
586
  [
579
587
  "change-appearance",
580
588
  () => import("../appearance/actions/change-appearance.js"),
@@ -1 +1 @@
1
- {"version":3,"file":"action-discovery.js","sourceRoot":"","sources":["../../src/server/action-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AA+BjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,sDAAsD;AACtD,yFAAyF;AACzF,IAAI,GAAoC,CAAC;AACzC,KAAK,UAAU,KAAK;IAClB,IAAI,CAAC,GAAG,E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MAAM,CAAC,4CAA4C,CAAC;SAC3D;QACD,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC;QACpE,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;KACnE,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACrC,IAAI,QAAQ,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;YACxB,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBACrD,QAAQ,CAAC,IAAI,CAAC,GAAG;oBACf,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACrD,kEAAkE;oBAClE,uEAAuE;oBACvE,+DAA+D;oBAC/D,2DAA2D;oBAC3D,GAAG,mBAAmB,CAAC,GAAG,CAAC;iBAC5B,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gDAAgD;QAClD,CAAC;IACH,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC","sourcesContent":["import nodePath from \"node:path\";\n\n/**\n * Auto-discover actions from a template's actions/ directory.\n *\n * Scans for .ts/.js files and builds an action registry suitable for\n * `createAgentChatPlugin({ actions })`.\n *\n * Supports two action conventions:\n *\n * 1. **Full interface** — exports `tool: ActionTool` and `run(args): Promise<string>`.\n * These are used directly.\n *\n * 2. **CLI-style** — exports only `default async function(args: string[])`.\n * These are wrapped: args are converted from `Record<string, string>` to\n * `[\"--key\", \"value\", ...]`, console output is captured, and a tool\n * definition is synthesized from the action name.\n *\n * 3. **defineAction** — exports `default` from `defineAction()`. Has `tool` and `run`.\n *\n * Usage in agent-chat plugins:\n * ```ts\n * import { autoDiscoverActions } from \"@agent-native/core/server\";\n *\n * export default createAgentChatPlugin({\n * actions: () => autoDiscoverActions(import.meta.url),\n * });\n * ```\n */\nimport type { ActionEntry } from \"../agent/production-agent.js\";\nimport type { ActionTool } from \"../agent/types.js\";\nimport { captureCliOutput } from \"./cli-capture.js\";\n\n// Lazy fs — loaded via dynamic import() on first use.\n// Avoids require() which bundlers convert to createRequire() that crashes on CF Workers.\nlet _fs: typeof import(\"fs\") | undefined;\nasync function getFs(): Promise<typeof import(\"fs\")> {\n if (!_fs) {\n _fs = await import(\"node:fs\");\n }\n return _fs;\n}\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\n/** Files to skip during auto-discovery (no extension). */\nconst SKIP_FILES = new Set([\n \"helpers\",\n \"run\",\n \"db-connect\",\n \"db-status\",\n \"registry\",\n]);\n\nfunction isRuntimeSourceFile(filename: string): boolean {\n if (!/\\.(ts|js)$/.test(filename)) return false;\n if (/\\.d\\.ts$/.test(filename)) return false;\n if (/\\.(test|spec)\\.(ts|js)$/.test(filename)) return false;\n return true;\n}\n\n/**\n * Global registry of actions contributed by published packages\n * (e.g. `@agent-native/dispatch`). Populated by `registerPackageActions()`\n * which the package calls from import side effects, then merged into\n * `autoDiscoverActions` after the template's local `actions/` directory.\n *\n * Ordering: template `actions/` files always win on name collision so\n * consumers can override a packaged action by dropping a same-named file\n * in their own `actions/` dir.\n */\nconst PACKAGE_ACTION_REGISTRY_KEY = Symbol.for(\n \"@agent-native/core.package-action-registry\",\n);\n\nfunction getPackageActionRegistry(): Record<string, ActionEntry> {\n const sharedGlobal = globalThis as typeof globalThis & {\n [key: symbol]: unknown;\n };\n const existing = sharedGlobal[PACKAGE_ACTION_REGISTRY_KEY];\n if (existing && typeof existing === \"object\") {\n return existing as Record<string, ActionEntry>;\n }\n\n const registry: Record<string, ActionEntry> = {};\n sharedGlobal[PACKAGE_ACTION_REGISTRY_KEY] = registry;\n return registry;\n}\n\n/**\n * Register a map of actions contributed by a published package.\n *\n * Called from a package's server entrypoint via import side effects:\n * ```ts\n * // packages/dispatch/src/server/index.ts\n * import { registerPackageActions } from \"@agent-native/core/server\";\n * import { actions } from \"../actions/index.js\";\n * registerPackageActions(actions);\n * ```\n *\n * Idempotent — re-registering the same name from the same import is a no-op\n * so HMR / repeated dynamic imports don't double-warn.\n */\nexport function registerPackageActions(\n actions: Record<string, ActionEntry>,\n): void {\n const packageActionRegistry = getPackageActionRegistry();\n for (const [name, entry] of Object.entries(actions)) {\n if (packageActionRegistry[name]) continue;\n packageActionRegistry[name] = entry;\n }\n}\n\n/**\n * Merge package-contributed actions without replacing app-local actions.\n *\n * This is intentionally callable even when the app passes an explicit static\n * action registry. Published packages register through import side effects,\n * while generated app registries only contain app-local action files.\n */\nexport function mergePackageActions(\n registry: Record<string, ActionEntry>,\n): void {\n for (const [name, entry] of Object.entries(getPackageActionRegistry())) {\n if (registry[name]) continue;\n registry[name] = entry;\n }\n}\n\n/**\n * Split a string into shell-like tokens, handling double and single quotes.\n * `--title \"My Page\" --content \"\"` → `[\"--title\", \"My Page\", \"--content\", \"\"]`\n */\nfunction splitShellArgs(input: string): string[] {\n const tokens: string[] = [];\n let current = \"\";\n let inDouble = false;\n let inSingle = false;\n let wasQuoted = false;\n\n for (let i = 0; i < input.length; i++) {\n const ch = input[i];\n if (ch === '\"' && !inSingle) {\n inDouble = !inDouble;\n wasQuoted = true;\n continue;\n }\n if (ch === \"'\" && !inDouble) {\n inSingle = !inSingle;\n wasQuoted = true;\n continue;\n }\n if ((ch === \" \" || ch === \"\\t\") && !inDouble && !inSingle) {\n if (current.length > 0 || wasQuoted) {\n tokens.push(current);\n }\n current = \"\";\n wasQuoted = false;\n continue;\n }\n current += ch;\n }\n if (current.length > 0 || wasQuoted) {\n tokens.push(current);\n }\n return tokens;\n}\n\n/**\n * Wrap a CLI-style action (that writes to console.log) as an ActionEntry\n * by capturing stdout/stderr and intercepting process.exit. Uses the\n * shared AsyncLocalStorage-backed capture so concurrent invocations do\n * not corrupt the global `console.log` / `process.stdout.write` /\n * `process.exit` pointers (see `cli-capture.ts`).\n */\nfunction wrapDefaultExport(\n name: string,\n defaultFn: (args: string[]) => Promise<void>,\n): ActionEntry {\n const tool: ActionTool = {\n description: `Run the \"${name}\" action. Pass arguments as key-value pairs.`,\n parameters: {\n type: \"object\",\n properties: {\n args: {\n type: \"string\",\n description:\n \"Space-separated CLI arguments (e.g. '--id abc --title Hello')\",\n },\n },\n },\n };\n\n return {\n tool,\n run: async (args: Record<string, string>): Promise<string> => {\n const cliArgs: string[] = [];\n // If only an \"args\" key was provided, split it into CLI tokens\n if (args.args && Object.keys(args).length === 1) {\n cliArgs.push(...splitShellArgs(args.args));\n } else {\n for (const [k, v] of Object.entries(args)) {\n cliArgs.push(`--${k}`, v);\n }\n }\n return captureCliOutput(() => defaultFn(cliArgs));\n },\n };\n}\n\nfunction preserveActionFlags(entry: Record<string, any>): Partial<ActionEntry> {\n const out: Partial<ActionEntry> = {};\n if (typeof entry.agentTool === \"boolean\") out.agentTool = entry.agentTool;\n if (typeof entry.requiresAuth === \"boolean\") {\n out.requiresAuth = entry.requiresAuth;\n }\n if (typeof entry.readOnly === \"boolean\") out.readOnly = entry.readOnly;\n if (typeof entry.allowInPlanMode === \"boolean\") {\n out.allowInPlanMode = entry.allowInPlanMode;\n }\n if (typeof entry.parallelSafe === \"boolean\") {\n out.parallelSafe = entry.parallelSafe;\n }\n if (typeof entry.dedupe === \"boolean\") {\n out.dedupe = entry.dedupe;\n }\n if (typeof entry.toolCallable === \"boolean\") {\n out.toolCallable = entry.toolCallable;\n }\n if (\n entry.publicAgent &&\n typeof entry.publicAgent === \"object\" &&\n !Array.isArray(entry.publicAgent)\n ) {\n out.publicAgent = entry.publicAgent;\n }\n if (typeof entry.link === \"function\") {\n out.link = entry.link;\n }\n if (\n entry.mcpApp &&\n typeof entry.mcpApp === \"object\" &&\n !Array.isArray(entry.mcpApp)\n ) {\n out.mcpApp = entry.mcpApp;\n }\n if (\n entry.chatUI &&\n typeof entry.chatUI === \"object\" &&\n !Array.isArray(entry.chatUI)\n ) {\n out.chatUI = entry.chatUI;\n }\n if (typeof entry.timeoutMs === \"number\") out.timeoutMs = entry.timeoutMs;\n if (typeof entry.maxResultChars === \"number\") {\n out.maxResultChars = entry.maxResultChars;\n }\n if (\n typeof entry.needsApproval === \"boolean\" ||\n typeof entry.needsApproval === \"function\"\n ) {\n out.needsApproval = entry.needsApproval;\n }\n return out;\n}\n\nfunction shouldRetryWithJiti(filePath: string, err: unknown): boolean {\n if (!filePath.endsWith(\".ts\")) return false;\n const candidate = err as { code?: unknown; message?: unknown } | undefined;\n if (candidate?.code === \"ERR_UNKNOWN_FILE_EXTENSION\") return true;\n return /Unknown file extension \".ts\"/.test(String(candidate?.message ?? \"\"));\n}\n\nasync function importRuntimeSourceModule(\n filePath: string,\n): Promise<Record<string, any>> {\n try {\n return await import(/* @vite-ignore */ pathToFileURL(filePath).href);\n } catch (err) {\n if (!shouldRetryWithJiti(filePath, err)) throw err;\n\n const { createJiti } = await import(\"jiti\");\n const jiti = createJiti(pathToFileURL(filePath).href, {\n interopDefault: true,\n });\n return (await jiti.import(filePath)) as Record<string, any>;\n }\n}\n\n/**\n * Resolve the actions directory from the caller's context.\n *\n * @param from - Either an `import.meta.url` (file:// URL from a plugin file),\n * an absolute directory path, or \"auto\" to use `process.cwd() + \"/actions\"`.\n * When an import.meta.url is provided, the actions directory is resolved as\n * `../../actions/` relative to the caller (typically `server/plugins/agent-chat.ts`).\n * If the resolved directory doesn't exist, falls back to `../../scripts/` for\n * backwards compatibility, then to `process.cwd() + \"/actions\"`.\n */\nasync function resolveActionsDir(from: string): Promise<string> {\n const fs = await getFs();\n const exists = (p: string) => {\n try {\n return fs.existsSync(p);\n } catch {\n return false;\n }\n };\n // On edge runtimes (e.g. Cloudflare Workers), import.meta.url may be\n // undefined after bundling. Fall back to cwd-based discovery.\n if (!from) {\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n if (from.startsWith(\"file://\") || from.startsWith(\"file:///\")) {\n const callerPath = fileURLToPath(from);\n const callerDir = nodePath.dirname(callerPath);\n const actionsResolved = nodePath.resolve(callerDir, \"../../actions\");\n if (exists(actionsResolved)) return actionsResolved;\n const scriptsResolved = nodePath.resolve(callerDir, \"../../scripts\");\n if (exists(scriptsResolved)) return scriptsResolved;\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n if (from === \"auto\") {\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n return nodePath.resolve(from);\n}\n\n/**\n * Load actions from a single directory into the given registry. Shared by\n * both the template-actions discovery path and the workspace-core actions\n * layer. When `skipExisting` is true, an entry with the same name that's\n * already in the registry is left untouched (template-wins on collision).\n */\nasync function loadActionsIntoRegistry(\n actionsDir: string,\n registry: Record<string, ActionEntry>,\n skipExisting: boolean,\n): Promise<void> {\n let files: string[];\n try {\n const fs = await getFs();\n if (!fs.existsSync(actionsDir)) return;\n files = fs.readdirSync(actionsDir);\n } catch {\n return;\n }\n\n const actionFiles = files.filter((f) => {\n if (!isRuntimeSourceFile(f)) return false;\n const name = f.replace(/\\.(ts|js)$/, \"\");\n if (name.startsWith(\"_\")) return false;\n if (SKIP_FILES.has(name)) return false;\n return true;\n });\n\n for (const file of actionFiles) {\n const name = file.replace(/\\.(ts|js)$/, \"\");\n if (skipExisting && registry[name]) continue;\n\n const filePath = nodePath.join(actionsDir, file);\n try {\n const mod = await importRuntimeSourceModule(filePath);\n\n if (mod.tool && typeof mod.run === \"function\") {\n registry[name] = {\n tool: mod.tool,\n run: mod.run,\n ...(mod.http !== undefined ? { http: mod.http } : {}),\n ...preserveActionFlags(mod),\n };\n } else if (\n mod.default &&\n typeof mod.default === \"object\" &&\n mod.default.tool &&\n typeof mod.default.run === \"function\"\n ) {\n registry[name] = {\n tool: mod.default.tool,\n run: mod.default.run,\n ...(mod.default.http !== undefined ? { http: mod.default.http } : {}),\n ...preserveActionFlags(mod.default),\n };\n } else if (typeof mod.default === \"function\") {\n registry[name] = wrapDefaultExport(name, mod.default);\n }\n } catch (err) {\n // CLI-style scripts (top-level execution) throw on import — expected,\n // they're available via `pnpm action <name>` / shell instead. But a\n // syntax error, bad import, or malformed defineAction in a real action\n // file lands here too and would silently vanish from the agent's tools.\n // Warn so a broken action file is diagnosable instead of mysteriously\n // missing.\n const msg =\n err instanceof Error ? (err.stack ?? err.message) : String(err);\n console.warn(\n `[action-discovery] Skipped \"${file}\" — failed to import. If this is an ` +\n `agent action (not a CLI script), it will be missing from the agent's tools:\\n${msg}`,\n );\n }\n }\n}\n\n/**\n * Normalize a pre-bundled static action registry (name → raw module) into\n * the `Record<string, ActionEntry>` shape the agent-chat plugin expects.\n *\n * Used by `autoDiscoverActions` when `.generated/actions-registry.ts` is\n * present so that Nitro-bundled serverless functions (Netlify, Vercel,\n * AWS-Lambda) can serve `/_agent-native/actions/*` routes without relying\n * on a filesystem scan that doesn't work in bundled output.\n */\nexport function loadActionsFromStaticRegistry(\n modules: Record<string, unknown>,\n): Record<string, ActionEntry> {\n const registry: Record<string, ActionEntry> = {};\n for (const [name, raw] of Object.entries(modules)) {\n const mod = raw as Record<string, any> | null | undefined;\n if (!mod) continue;\n\n if (mod.tool && typeof mod.run === \"function\") {\n registry[name] = {\n tool: mod.tool,\n run: mod.run,\n ...(mod.http !== undefined ? { http: mod.http } : {}),\n ...preserveActionFlags(mod),\n };\n continue;\n }\n\n const def = mod.default;\n if (\n def &&\n typeof def === \"object\" &&\n def.tool &&\n typeof def.run === \"function\"\n ) {\n registry[name] = {\n tool: def.tool,\n run: def.run,\n ...(def.http !== undefined ? { http: def.http } : {}),\n ...preserveActionFlags(def),\n };\n continue;\n }\n\n if (typeof def === \"function\") {\n registry[name] = wrapDefaultExport(name, def);\n }\n }\n return registry;\n}\n\n/**\n * Auto-discover actions from a directory.\n *\n * Merges in any actions from the enterprise workspace core (if present in\n * the ancestor chain). Template actions take precedence over workspace-core\n * actions on name collision, so an app can override an enterprise-wide\n * action by dropping a same-named file under its own `actions/`.\n *\n * Note: this helper uses a filesystem scan, which works in dev and in\n * non-bundled Node deployments. In bundled serverless functions (Nitro's\n * netlify / vercel / aws-lambda presets) the `actions/` directory is not\n * on disk at runtime; templates should pass the static registry generated\n * by the Vite plugin to `createAgentChatPlugin({ actions })` instead, so\n * the bundler sees static imports and pulls every action into the bundle.\n *\n * @param from - The caller's `import.meta.url` or an absolute path to the\n * actions directory.\n * @returns A record mapping action names to ActionEntry objects, suitable for\n * passing to `createAgentChatPlugin({ actions })`.\n */\nexport async function autoDiscoverActions(\n from: string,\n): Promise<Record<string, ActionEntry>> {\n const actionsDir = await resolveActionsDir(from);\n const registry: Record<string, ActionEntry> = {};\n\n // 1. Template actions first — these are the authoritative layer for the\n // current app and must override any workspace-core entry with the same\n // name.\n try {\n await loadActionsIntoRegistry(actionsDir, registry, false);\n } catch (err: any) {\n console.warn(\n `[autoDiscoverActions] Could not read actions directory: ${actionsDir} — ${err?.message}`,\n );\n }\n\n // 1b. Fallback: if filesystem discovery found no template actions (common\n // in bundled serverless environments like Netlify/Vercel where the\n // actions/ directory doesn't exist on disk), try importing the\n // generated static registry at .generated/actions-registry.\n //\n // This prevents the silent-empty-tools footgun where the agent has no\n // template actions and falls back to generic tools like web-request.\n // Prefer `loadActionsFromStaticRegistry` over `autoDiscoverActions` for\n // production reliability — this fallback is a safety net, not the\n // primary path.\n if (Object.keys(registry).length === 0 && from) {\n try {\n let registryPath: string;\n if (from.startsWith(\"file://\") || from.startsWith(\"file:///\")) {\n const callerDir = nodePath.dirname(fileURLToPath(from));\n registryPath = nodePath.resolve(\n callerDir,\n \"../../.generated/actions-registry.js\",\n );\n } else {\n registryPath = nodePath.resolve(\n from,\n \"../.generated/actions-registry.js\",\n );\n }\n const mod = await import(/* @vite-ignore */ registryPath);\n const staticEntries = loadActionsFromStaticRegistry(mod.default || mod);\n Object.assign(registry, staticEntries);\n if (Object.keys(staticEntries).length > 0) {\n console.log(\n `[autoDiscoverActions] Filesystem scan found 0 actions — loaded ${Object.keys(staticEntries).length} from .generated/actions-registry.ts instead. ` +\n `Consider switching to loadActionsFromStaticRegistry(actionsRegistry) for production reliability.`,\n );\n }\n } catch {\n // No generated registry available — registry stays empty.\n }\n }\n\n // If still empty after all fallbacks, warn loudly.\n if (Object.keys(registry).length === 0) {\n console.warn(\n `[autoDiscoverActions] WARNING: No template actions found! ` +\n `The agent will have no template-specific tools. ` +\n `If in production, switch from autoDiscoverActions to loadActionsFromStaticRegistry. ` +\n `See: https://docs.agent-native.com/actions#static-registry`,\n );\n }\n\n // 1c. Package-registered actions — contributed by published packages\n // (e.g. @agent-native/dispatch) via `registerPackageActions()` from\n // import side effects. Merged with skip-existing so the template's\n // own actions/ files always win on name collision.\n mergePackageActions(registry);\n\n // 2. Workspace-core actions — merged in with skipExisting so they can't\n // overwrite template entries.\n try {\n const { getWorkspaceCoreExports } =\n await import(\"../deploy/workspace-core.js\");\n const ws = await getWorkspaceCoreExports(process.cwd());\n if (ws && ws.actionsDir) {\n await loadActionsIntoRegistry(ws.actionsDir, registry, true);\n }\n } catch {\n // workspace-core discovery unavailable (e.g. edge runtime) — skip.\n }\n\n // 3. Framework-level sharing + file-upload actions — always available to any\n // template. Merged with skipExisting so templates can override by\n // providing a same-named file.\n try {\n await mergeCoreSharingActions(registry);\n } catch {\n // Ignore — templates without sharing still work.\n }\n\n return registry;\n}\n\nexport async function mergeCoreSharingActions(\n registry: Record<string, ActionEntry>,\n): Promise<void> {\n const entries: Array<[string, () => Promise<any>]> = [\n [\"share-resource\", () => import(\"../sharing/actions/share-resource.js\")],\n [\n \"unshare-resource\",\n () => import(\"../sharing/actions/unshare-resource.js\"),\n ],\n [\n \"list-resource-shares\",\n () => import(\"../sharing/actions/list-resource-shares.js\"),\n ],\n [\n \"set-resource-visibility\",\n () => import(\"../sharing/actions/set-resource-visibility.js\"),\n ],\n [\n \"create-agent-resource-link\",\n () => import(\"../sharing/actions/create-agent-resource-link.js\"),\n ],\n [\"upload-image\", () => import(\"../file-upload/actions/upload-image.js\")],\n [\n \"get-feature-flags\",\n () => import(\"../feature-flags/actions/get-feature-flags.js\"),\n ],\n [\n \"list-feature-flags\",\n () => import(\"../feature-flags/actions/list-feature-flags.js\"),\n ],\n [\n \"set-feature-flag\",\n () => import(\"../feature-flags/actions/set-feature-flag.js\"),\n ],\n // Agent Jobs page — UI-only scoped reads and mutations for resource-backed\n // recurring jobs and personal automations. The agent-facing native tools\n // remain the canonical conversational surface.\n [\n \"list-recurring-jobs\",\n () => import(\"../jobs/actions/list-recurring-jobs.js\"),\n ],\n [\n \"manage-recurring-job\",\n () => import(\"../jobs/actions/manage-recurring-job.js\"),\n ],\n [\n \"list-automations\",\n () => import(\"../triggers/actions/list-automations.js\"),\n ],\n [\n \"manage-automation\",\n () => import(\"../triggers/actions/manage-automation.js\"),\n ],\n [\n \"context-manifest-get\",\n () => import(\"../agent/context-xray/actions/context-manifest-get.js\"),\n ],\n [\n \"context-preview-get\",\n () => import(\"../agent/context-xray/actions/context-preview-get.js\"),\n ],\n [\n \"context-pin\",\n () => import(\"../agent/context-xray/actions/context-pin.js\"),\n ],\n [\n \"context-evict\",\n () => import(\"../agent/context-xray/actions/context-evict.js\"),\n ],\n [\n \"context-restore\",\n () => import(\"../agent/context-xray/actions/context-restore.js\"),\n ],\n [\n \"context-report\",\n () => import(\"../agent/context-xray/actions/context-report.js\"),\n ],\n [\n \"get-localization-preference\",\n () => import(\"../localization/actions/get-localization-preference.js\"),\n ],\n [\n \"set-localization-preference\",\n () => import(\"../localization/actions/set-localization-preference.js\"),\n ],\n [\n \"change-appearance\",\n () => import(\"../appearance/actions/change-appearance.js\"),\n ],\n // Audit log — read surface (who changed what, when, agent vs human).\n [\n \"list-audit-events\",\n () => import(\"../audit/actions/list-audit-events.js\"),\n ],\n [\"get-audit-event\", () => import(\"../audit/actions/get-audit-event.js\")],\n [\n \"export-audit-events\",\n () => import(\"../audit/actions/export-audit-events.js\"),\n ],\n // History kit — reusable version snapshots and restore surface.\n [\n \"create-resource-version\",\n () => import(\"../history/actions/create-resource-version.js\"),\n ],\n [\n \"list-resource-versions\",\n () => import(\"../history/actions/list-resource-versions.js\"),\n ],\n [\n \"get-resource-version\",\n () => import(\"../history/actions/get-resource-version.js\"),\n ],\n [\n \"restore-resource-version\",\n () => import(\"../history/actions/restore-resource-version.js\"),\n ],\n [\n \"list-resource-history\",\n () => import(\"../history/actions/list-resource-history.js\"),\n ],\n // Comments/review kit — reusable inline comments, feedback, and review status.\n [\n \"list-review-comments\",\n () => import(\"../review/actions/list-review-comments.js\"),\n ],\n [\n \"create-review-comment\",\n () => import(\"../review/actions/create-review-comment.js\"),\n ],\n [\n \"reply-review-comment\",\n () => import(\"../review/actions/reply-review-comment.js\"),\n ],\n [\n \"resolve-review-thread\",\n () => import(\"../review/actions/resolve-review-thread.js\"),\n ],\n [\n \"delete-review-comment\",\n () => import(\"../review/actions/delete-review-comment.js\"),\n ],\n [\n \"consume-review-feedback\",\n () => import(\"../review/actions/consume-review-feedback.js\"),\n ],\n [\n \"get-review-feedback\",\n () => import(\"../review/actions/get-review-feedback.js\"),\n ],\n [\n \"set-review-status\",\n () => import(\"../review/actions/set-review-status.js\"),\n ],\n [\n \"send-review-thread-to-agent\",\n () => import(\"../review/actions/send-review-thread-to-agent.js\"),\n ],\n // Org service tokens (CI credentials, e.g. PLAN_RECAP_TOKEN). Mint/revoke\n // are toolCallable:false — preserved via preserveActionFlags below.\n [\n \"create-org-service-token\",\n () => import(\"../mcp/actions/create-org-service-token.js\"),\n ],\n [\n \"list-org-service-tokens\",\n () => import(\"../mcp/actions/list-org-service-tokens.js\"),\n ],\n [\n \"revoke-org-service-token\",\n () => import(\"../mcp/actions/revoke-org-service-token.js\"),\n ],\n [\"list-mcp-tools\", () => import(\"../mcp/actions/list-mcp-tools.js\")],\n [\"call-mcp-tool\", () => import(\"../mcp/actions/call-mcp-tool.js\")],\n ];\n for (const [name, loader] of entries) {\n if (registry[name]) continue;\n try {\n const mod = await loader();\n const def = mod.default;\n if (def && def.tool && typeof def.run === \"function\") {\n registry[name] = {\n tool: def.tool,\n run: def.run,\n ...(def.http !== undefined ? { http: def.http } : {}),\n // Carry security-relevant flags (toolCallable, publicAgent, link,\n // mcpApp) plus readOnly/parallelSafe/dedupe. Without this, the sharing\n // actions' `toolCallable: false` (audit-H5) is dropped and the\n // tools-iframe bridge 403 in action-routes.ts never fires.\n ...preserveActionFlags(def),\n };\n }\n } catch {\n // Skip any sharing action that fails to import.\n }\n }\n}\n\n/** @deprecated Use `autoDiscoverActions` instead */\nexport const autoDiscoverScripts = autoDiscoverActions;\n"]}
1
+ {"version":3,"file":"action-discovery.js","sourceRoot":"","sources":["../../src/server/action-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AA+BjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,sDAAsD;AACtD,yFAAyF;AACzF,IAAI,GAAoC,CAAC;AACzC,KAAK,UAAU,KAAK;IAClB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AACD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,0DAA0D;AAC1D,MAAM,UAAU,GAAG,I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,GAAG,EAAE,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC;QACpE,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC;KACnE,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACrC,IAAI,QAAQ,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,MAAM,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;YACxB,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBACrD,QAAQ,CAAC,IAAI,CAAC,GAAG;oBACf,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACrD,kEAAkE;oBAClE,uEAAuE;oBACvE,+DAA+D;oBAC/D,2DAA2D;oBAC3D,GAAG,mBAAmB,CAAC,GAAG,CAAC;iBAC5B,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gDAAgD;QAClD,CAAC;IACH,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC","sourcesContent":["import nodePath from \"node:path\";\n\n/**\n * Auto-discover actions from a template's actions/ directory.\n *\n * Scans for .ts/.js files and builds an action registry suitable for\n * `createAgentChatPlugin({ actions })`.\n *\n * Supports two action conventions:\n *\n * 1. **Full interface** — exports `tool: ActionTool` and `run(args): Promise<string>`.\n * These are used directly.\n *\n * 2. **CLI-style** — exports only `default async function(args: string[])`.\n * These are wrapped: args are converted from `Record<string, string>` to\n * `[\"--key\", \"value\", ...]`, console output is captured, and a tool\n * definition is synthesized from the action name.\n *\n * 3. **defineAction** — exports `default` from `defineAction()`. Has `tool` and `run`.\n *\n * Usage in agent-chat plugins:\n * ```ts\n * import { autoDiscoverActions } from \"@agent-native/core/server\";\n *\n * export default createAgentChatPlugin({\n * actions: () => autoDiscoverActions(import.meta.url),\n * });\n * ```\n */\nimport type { ActionEntry } from \"../agent/production-agent.js\";\nimport type { ActionTool } from \"../agent/types.js\";\nimport { captureCliOutput } from \"./cli-capture.js\";\n\n// Lazy fs — loaded via dynamic import() on first use.\n// Avoids require() which bundlers convert to createRequire() that crashes on CF Workers.\nlet _fs: typeof import(\"fs\") | undefined;\nasync function getFs(): Promise<typeof import(\"fs\")> {\n if (!_fs) {\n _fs = await import(\"node:fs\");\n }\n return _fs;\n}\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\n/** Files to skip during auto-discovery (no extension). */\nconst SKIP_FILES = new Set([\n \"helpers\",\n \"run\",\n \"db-connect\",\n \"db-status\",\n \"registry\",\n]);\n\nfunction isRuntimeSourceFile(filename: string): boolean {\n if (!/\\.(ts|js)$/.test(filename)) return false;\n if (/\\.d\\.ts$/.test(filename)) return false;\n if (/\\.(test|spec)\\.(ts|js)$/.test(filename)) return false;\n return true;\n}\n\n/**\n * Global registry of actions contributed by published packages\n * (e.g. `@agent-native/dispatch`). Populated by `registerPackageActions()`\n * which the package calls from import side effects, then merged into\n * `autoDiscoverActions` after the template's local `actions/` directory.\n *\n * Ordering: template `actions/` files always win on name collision so\n * consumers can override a packaged action by dropping a same-named file\n * in their own `actions/` dir.\n */\nconst PACKAGE_ACTION_REGISTRY_KEY = Symbol.for(\n \"@agent-native/core.package-action-registry\",\n);\n\nfunction getPackageActionRegistry(): Record<string, ActionEntry> {\n const sharedGlobal = globalThis as typeof globalThis & {\n [key: symbol]: unknown;\n };\n const existing = sharedGlobal[PACKAGE_ACTION_REGISTRY_KEY];\n if (existing && typeof existing === \"object\") {\n return existing as Record<string, ActionEntry>;\n }\n\n const registry: Record<string, ActionEntry> = {};\n sharedGlobal[PACKAGE_ACTION_REGISTRY_KEY] = registry;\n return registry;\n}\n\n/**\n * Register a map of actions contributed by a published package.\n *\n * Called from a package's server entrypoint via import side effects:\n * ```ts\n * // packages/dispatch/src/server/index.ts\n * import { registerPackageActions } from \"@agent-native/core/server\";\n * import { actions } from \"../actions/index.js\";\n * registerPackageActions(actions);\n * ```\n *\n * Idempotent — re-registering the same name from the same import is a no-op\n * so HMR / repeated dynamic imports don't double-warn.\n */\nexport function registerPackageActions(\n actions: Record<string, ActionEntry>,\n): void {\n const packageActionRegistry = getPackageActionRegistry();\n for (const [name, entry] of Object.entries(actions)) {\n if (packageActionRegistry[name]) continue;\n packageActionRegistry[name] = entry;\n }\n}\n\n/**\n * Merge package-contributed actions without replacing app-local actions.\n *\n * This is intentionally callable even when the app passes an explicit static\n * action registry. Published packages register through import side effects,\n * while generated app registries only contain app-local action files.\n */\nexport function mergePackageActions(\n registry: Record<string, ActionEntry>,\n): void {\n for (const [name, entry] of Object.entries(getPackageActionRegistry())) {\n if (registry[name]) continue;\n registry[name] = entry;\n }\n}\n\n/**\n * Split a string into shell-like tokens, handling double and single quotes.\n * `--title \"My Page\" --content \"\"` → `[\"--title\", \"My Page\", \"--content\", \"\"]`\n */\nfunction splitShellArgs(input: string): string[] {\n const tokens: string[] = [];\n let current = \"\";\n let inDouble = false;\n let inSingle = false;\n let wasQuoted = false;\n\n for (let i = 0; i < input.length; i++) {\n const ch = input[i];\n if (ch === '\"' && !inSingle) {\n inDouble = !inDouble;\n wasQuoted = true;\n continue;\n }\n if (ch === \"'\" && !inDouble) {\n inSingle = !inSingle;\n wasQuoted = true;\n continue;\n }\n if ((ch === \" \" || ch === \"\\t\") && !inDouble && !inSingle) {\n if (current.length > 0 || wasQuoted) {\n tokens.push(current);\n }\n current = \"\";\n wasQuoted = false;\n continue;\n }\n current += ch;\n }\n if (current.length > 0 || wasQuoted) {\n tokens.push(current);\n }\n return tokens;\n}\n\n/**\n * Wrap a CLI-style action (that writes to console.log) as an ActionEntry\n * by capturing stdout/stderr and intercepting process.exit. Uses the\n * shared AsyncLocalStorage-backed capture so concurrent invocations do\n * not corrupt the global `console.log` / `process.stdout.write` /\n * `process.exit` pointers (see `cli-capture.ts`).\n */\nfunction wrapDefaultExport(\n name: string,\n defaultFn: (args: string[]) => Promise<void>,\n): ActionEntry {\n const tool: ActionTool = {\n description: `Run the \"${name}\" action. Pass arguments as key-value pairs.`,\n parameters: {\n type: \"object\",\n properties: {\n args: {\n type: \"string\",\n description:\n \"Space-separated CLI arguments (e.g. '--id abc --title Hello')\",\n },\n },\n },\n };\n\n return {\n tool,\n run: async (args: Record<string, string>): Promise<string> => {\n const cliArgs: string[] = [];\n // If only an \"args\" key was provided, split it into CLI tokens\n if (args.args && Object.keys(args).length === 1) {\n cliArgs.push(...splitShellArgs(args.args));\n } else {\n for (const [k, v] of Object.entries(args)) {\n cliArgs.push(`--${k}`, v);\n }\n }\n return captureCliOutput(() => defaultFn(cliArgs));\n },\n };\n}\n\nfunction preserveActionFlags(entry: Record<string, any>): Partial<ActionEntry> {\n const out: Partial<ActionEntry> = {};\n if (typeof entry.agentTool === \"boolean\") out.agentTool = entry.agentTool;\n if (typeof entry.requiresAuth === \"boolean\") {\n out.requiresAuth = entry.requiresAuth;\n }\n if (typeof entry.readOnly === \"boolean\") out.readOnly = entry.readOnly;\n if (typeof entry.allowInPlanMode === \"boolean\") {\n out.allowInPlanMode = entry.allowInPlanMode;\n }\n if (typeof entry.parallelSafe === \"boolean\") {\n out.parallelSafe = entry.parallelSafe;\n }\n if (typeof entry.dedupe === \"boolean\") {\n out.dedupe = entry.dedupe;\n }\n if (typeof entry.toolCallable === \"boolean\") {\n out.toolCallable = entry.toolCallable;\n }\n if (\n entry.publicAgent &&\n typeof entry.publicAgent === \"object\" &&\n !Array.isArray(entry.publicAgent)\n ) {\n out.publicAgent = entry.publicAgent;\n }\n if (typeof entry.link === \"function\") {\n out.link = entry.link;\n }\n if (\n entry.mcpApp &&\n typeof entry.mcpApp === \"object\" &&\n !Array.isArray(entry.mcpApp)\n ) {\n out.mcpApp = entry.mcpApp;\n }\n if (\n entry.chatUI &&\n typeof entry.chatUI === \"object\" &&\n !Array.isArray(entry.chatUI)\n ) {\n out.chatUI = entry.chatUI;\n }\n if (typeof entry.timeoutMs === \"number\") out.timeoutMs = entry.timeoutMs;\n if (typeof entry.maxResultChars === \"number\") {\n out.maxResultChars = entry.maxResultChars;\n }\n if (\n typeof entry.needsApproval === \"boolean\" ||\n typeof entry.needsApproval === \"function\"\n ) {\n out.needsApproval = entry.needsApproval;\n }\n return out;\n}\n\nfunction shouldRetryWithJiti(filePath: string, err: unknown): boolean {\n if (!filePath.endsWith(\".ts\")) return false;\n const candidate = err as { code?: unknown; message?: unknown } | undefined;\n if (candidate?.code === \"ERR_UNKNOWN_FILE_EXTENSION\") return true;\n return /Unknown file extension \".ts\"/.test(String(candidate?.message ?? \"\"));\n}\n\nasync function importRuntimeSourceModule(\n filePath: string,\n): Promise<Record<string, any>> {\n try {\n return await import(/* @vite-ignore */ pathToFileURL(filePath).href);\n } catch (err) {\n if (!shouldRetryWithJiti(filePath, err)) throw err;\n\n const { createJiti } = await import(\"jiti\");\n const jiti = createJiti(pathToFileURL(filePath).href, {\n interopDefault: true,\n });\n return (await jiti.import(filePath)) as Record<string, any>;\n }\n}\n\n/**\n * Resolve the actions directory from the caller's context.\n *\n * @param from - Either an `import.meta.url` (file:// URL from a plugin file),\n * an absolute directory path, or \"auto\" to use `process.cwd() + \"/actions\"`.\n * When an import.meta.url is provided, the actions directory is resolved as\n * `../../actions/` relative to the caller (typically `server/plugins/agent-chat.ts`).\n * If the resolved directory doesn't exist, falls back to `../../scripts/` for\n * backwards compatibility, then to `process.cwd() + \"/actions\"`.\n */\nasync function resolveActionsDir(from: string): Promise<string> {\n const fs = await getFs();\n const exists = (p: string) => {\n try {\n return fs.existsSync(p);\n } catch {\n return false;\n }\n };\n // On edge runtimes (e.g. Cloudflare Workers), import.meta.url may be\n // undefined after bundling. Fall back to cwd-based discovery.\n if (!from) {\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n if (from.startsWith(\"file://\") || from.startsWith(\"file:///\")) {\n const callerPath = fileURLToPath(from);\n const callerDir = nodePath.dirname(callerPath);\n const actionsResolved = nodePath.resolve(callerDir, \"../../actions\");\n if (exists(actionsResolved)) return actionsResolved;\n const scriptsResolved = nodePath.resolve(callerDir, \"../../scripts\");\n if (exists(scriptsResolved)) return scriptsResolved;\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n if (from === \"auto\") {\n const cwdActions = nodePath.join(process.cwd(), \"actions\");\n if (exists(cwdActions)) return cwdActions;\n return nodePath.join(process.cwd(), \"scripts\");\n }\n return nodePath.resolve(from);\n}\n\n/**\n * Load actions from a single directory into the given registry. Shared by\n * both the template-actions discovery path and the workspace-core actions\n * layer. When `skipExisting` is true, an entry with the same name that's\n * already in the registry is left untouched (template-wins on collision).\n */\nasync function loadActionsIntoRegistry(\n actionsDir: string,\n registry: Record<string, ActionEntry>,\n skipExisting: boolean,\n): Promise<void> {\n let files: string[];\n try {\n const fs = await getFs();\n if (!fs.existsSync(actionsDir)) return;\n files = fs.readdirSync(actionsDir);\n } catch {\n return;\n }\n\n const actionFiles = files.filter((f) => {\n if (!isRuntimeSourceFile(f)) return false;\n const name = f.replace(/\\.(ts|js)$/, \"\");\n if (name.startsWith(\"_\")) return false;\n if (SKIP_FILES.has(name)) return false;\n return true;\n });\n\n for (const file of actionFiles) {\n const name = file.replace(/\\.(ts|js)$/, \"\");\n if (skipExisting && registry[name]) continue;\n\n const filePath = nodePath.join(actionsDir, file);\n try {\n const mod = await importRuntimeSourceModule(filePath);\n\n if (mod.tool && typeof mod.run === \"function\") {\n registry[name] = {\n tool: mod.tool,\n run: mod.run,\n ...(mod.http !== undefined ? { http: mod.http } : {}),\n ...preserveActionFlags(mod),\n };\n } else if (\n mod.default &&\n typeof mod.default === \"object\" &&\n mod.default.tool &&\n typeof mod.default.run === \"function\"\n ) {\n registry[name] = {\n tool: mod.default.tool,\n run: mod.default.run,\n ...(mod.default.http !== undefined ? { http: mod.default.http } : {}),\n ...preserveActionFlags(mod.default),\n };\n } else if (typeof mod.default === \"function\") {\n registry[name] = wrapDefaultExport(name, mod.default);\n }\n } catch (err) {\n // CLI-style scripts (top-level execution) throw on import — expected,\n // they're available via `pnpm action <name>` / shell instead. But a\n // syntax error, bad import, or malformed defineAction in a real action\n // file lands here too and would silently vanish from the agent's tools.\n // Warn so a broken action file is diagnosable instead of mysteriously\n // missing.\n const msg =\n err instanceof Error ? (err.stack ?? err.message) : String(err);\n console.warn(\n `[action-discovery] Skipped \"${file}\" — failed to import. If this is an ` +\n `agent action (not a CLI script), it will be missing from the agent's tools:\\n${msg}`,\n );\n }\n }\n}\n\n/**\n * Normalize a pre-bundled static action registry (name → raw module) into\n * the `Record<string, ActionEntry>` shape the agent-chat plugin expects.\n *\n * Used by `autoDiscoverActions` when `.generated/actions-registry.ts` is\n * present so that Nitro-bundled serverless functions (Netlify, Vercel,\n * AWS-Lambda) can serve `/_agent-native/actions/*` routes without relying\n * on a filesystem scan that doesn't work in bundled output.\n */\nexport function loadActionsFromStaticRegistry(\n modules: Record<string, unknown>,\n): Record<string, ActionEntry> {\n const registry: Record<string, ActionEntry> = {};\n for (const [name, raw] of Object.entries(modules)) {\n const mod = raw as Record<string, any> | null | undefined;\n if (!mod) continue;\n\n if (mod.tool && typeof mod.run === \"function\") {\n registry[name] = {\n tool: mod.tool,\n run: mod.run,\n ...(mod.http !== undefined ? { http: mod.http } : {}),\n ...preserveActionFlags(mod),\n };\n continue;\n }\n\n const def = mod.default;\n if (\n def &&\n typeof def === \"object\" &&\n def.tool &&\n typeof def.run === \"function\"\n ) {\n registry[name] = {\n tool: def.tool,\n run: def.run,\n ...(def.http !== undefined ? { http: def.http } : {}),\n ...preserveActionFlags(def),\n };\n continue;\n }\n\n if (typeof def === \"function\") {\n registry[name] = wrapDefaultExport(name, def);\n }\n }\n return registry;\n}\n\n/**\n * Auto-discover actions from a directory.\n *\n * Merges in any actions from the enterprise workspace core (if present in\n * the ancestor chain). Template actions take precedence over workspace-core\n * actions on name collision, so an app can override an enterprise-wide\n * action by dropping a same-named file under its own `actions/`.\n *\n * Note: this helper uses a filesystem scan, which works in dev and in\n * non-bundled Node deployments. In bundled serverless functions (Nitro's\n * netlify / vercel / aws-lambda presets) the `actions/` directory is not\n * on disk at runtime; templates should pass the static registry generated\n * by the Vite plugin to `createAgentChatPlugin({ actions })` instead, so\n * the bundler sees static imports and pulls every action into the bundle.\n *\n * @param from - The caller's `import.meta.url` or an absolute path to the\n * actions directory.\n * @returns A record mapping action names to ActionEntry objects, suitable for\n * passing to `createAgentChatPlugin({ actions })`.\n */\nexport async function autoDiscoverActions(\n from: string,\n): Promise<Record<string, ActionEntry>> {\n const actionsDir = await resolveActionsDir(from);\n const registry: Record<string, ActionEntry> = {};\n\n // 1. Template actions first — these are the authoritative layer for the\n // current app and must override any workspace-core entry with the same\n // name.\n try {\n await loadActionsIntoRegistry(actionsDir, registry, false);\n } catch (err: any) {\n console.warn(\n `[autoDiscoverActions] Could not read actions directory: ${actionsDir} — ${err?.message}`,\n );\n }\n\n // 1b. Fallback: if filesystem discovery found no template actions (common\n // in bundled serverless environments like Netlify/Vercel where the\n // actions/ directory doesn't exist on disk), try importing the\n // generated static registry at .generated/actions-registry.\n //\n // This prevents the silent-empty-tools footgun where the agent has no\n // template actions and falls back to generic tools like web-request.\n // Prefer `loadActionsFromStaticRegistry` over `autoDiscoverActions` for\n // production reliability — this fallback is a safety net, not the\n // primary path.\n if (Object.keys(registry).length === 0 && from) {\n try {\n let registryPath: string;\n if (from.startsWith(\"file://\") || from.startsWith(\"file:///\")) {\n const callerDir = nodePath.dirname(fileURLToPath(from));\n registryPath = nodePath.resolve(\n callerDir,\n \"../../.generated/actions-registry.js\",\n );\n } else {\n registryPath = nodePath.resolve(\n from,\n \"../.generated/actions-registry.js\",\n );\n }\n const mod = await import(/* @vite-ignore */ registryPath);\n const staticEntries = loadActionsFromStaticRegistry(mod.default || mod);\n Object.assign(registry, staticEntries);\n if (Object.keys(staticEntries).length > 0) {\n console.log(\n `[autoDiscoverActions] Filesystem scan found 0 actions — loaded ${Object.keys(staticEntries).length} from .generated/actions-registry.ts instead. ` +\n `Consider switching to loadActionsFromStaticRegistry(actionsRegistry) for production reliability.`,\n );\n }\n } catch {\n // No generated registry available — registry stays empty.\n }\n }\n\n // If still empty after all fallbacks, warn loudly.\n if (Object.keys(registry).length === 0) {\n console.warn(\n `[autoDiscoverActions] WARNING: No template actions found! ` +\n `The agent will have no template-specific tools. ` +\n `If in production, switch from autoDiscoverActions to loadActionsFromStaticRegistry. ` +\n `See: https://docs.agent-native.com/actions#static-registry`,\n );\n }\n\n // 1c. Package-registered actions — contributed by published packages\n // (e.g. @agent-native/dispatch) via `registerPackageActions()` from\n // import side effects. Merged with skip-existing so the template's\n // own actions/ files always win on name collision.\n mergePackageActions(registry);\n\n // 2. Workspace-core actions — merged in with skipExisting so they can't\n // overwrite template entries.\n try {\n const { getWorkspaceCoreExports } =\n await import(\"../deploy/workspace-core.js\");\n const ws = await getWorkspaceCoreExports(process.cwd());\n if (ws && ws.actionsDir) {\n await loadActionsIntoRegistry(ws.actionsDir, registry, true);\n }\n } catch {\n // workspace-core discovery unavailable (e.g. edge runtime) — skip.\n }\n\n // 3. Framework-level sharing + file-upload actions — always available to any\n // template. Merged with skipExisting so templates can override by\n // providing a same-named file.\n try {\n await mergeCoreSharingActions(registry);\n } catch {\n // Ignore — templates without sharing still work.\n }\n\n return registry;\n}\n\nexport async function mergeCoreSharingActions(\n registry: Record<string, ActionEntry>,\n): Promise<void> {\n const entries: Array<[string, () => Promise<any>]> = [\n [\"share-resource\", () => import(\"../sharing/actions/share-resource.js\")],\n [\n \"unshare-resource\",\n () => import(\"../sharing/actions/unshare-resource.js\"),\n ],\n [\n \"list-resource-shares\",\n () => import(\"../sharing/actions/list-resource-shares.js\"),\n ],\n [\n \"set-resource-visibility\",\n () => import(\"../sharing/actions/set-resource-visibility.js\"),\n ],\n [\n \"create-agent-resource-link\",\n () => import(\"../sharing/actions/create-agent-resource-link.js\"),\n ],\n [\"upload-image\", () => import(\"../file-upload/actions/upload-image.js\")],\n [\n \"get-feature-flags\",\n () => import(\"../feature-flags/actions/get-feature-flags.js\"),\n ],\n [\n \"list-feature-flags\",\n () => import(\"../feature-flags/actions/list-feature-flags.js\"),\n ],\n [\n \"set-feature-flag\",\n () => import(\"../feature-flags/actions/set-feature-flag.js\"),\n ],\n // Agent Jobs page — UI-only scoped reads and mutations for resource-backed\n // recurring jobs and personal automations. The agent-facing native tools\n // remain the canonical conversational surface.\n [\n \"list-recurring-jobs\",\n () => import(\"../jobs/actions/list-recurring-jobs.js\"),\n ],\n [\n \"manage-recurring-job\",\n () => import(\"../jobs/actions/manage-recurring-job.js\"),\n ],\n [\n \"list-automations\",\n () => import(\"../triggers/actions/list-automations.js\"),\n ],\n [\n \"manage-automation\",\n () => import(\"../triggers/actions/manage-automation.js\"),\n ],\n [\n \"context-manifest-get\",\n () => import(\"../agent/context-xray/actions/context-manifest-get.js\"),\n ],\n [\n \"context-preview-get\",\n () => import(\"../agent/context-xray/actions/context-preview-get.js\"),\n ],\n [\n \"context-pin\",\n () => import(\"../agent/context-xray/actions/context-pin.js\"),\n ],\n [\n \"context-evict\",\n () => import(\"../agent/context-xray/actions/context-evict.js\"),\n ],\n [\n \"context-restore\",\n () => import(\"../agent/context-xray/actions/context-restore.js\"),\n ],\n [\n \"context-report\",\n () => import(\"../agent/context-xray/actions/context-report.js\"),\n ],\n [\n \"get-localization-preference\",\n () => import(\"../localization/actions/get-localization-preference.js\"),\n ],\n [\n \"set-localization-preference\",\n () => import(\"../localization/actions/set-localization-preference.js\"),\n ],\n [\n \"get-user-profile\",\n () => import(\"../user-profile/actions/get-user-profile.js\"),\n ],\n [\n \"update-user-profile\",\n () => import(\"../user-profile/actions/update-user-profile.js\"),\n ],\n [\n \"change-appearance\",\n () => import(\"../appearance/actions/change-appearance.js\"),\n ],\n // Audit log — read surface (who changed what, when, agent vs human).\n [\n \"list-audit-events\",\n () => import(\"../audit/actions/list-audit-events.js\"),\n ],\n [\"get-audit-event\", () => import(\"../audit/actions/get-audit-event.js\")],\n [\n \"export-audit-events\",\n () => import(\"../audit/actions/export-audit-events.js\"),\n ],\n // History kit — reusable version snapshots and restore surface.\n [\n \"create-resource-version\",\n () => import(\"../history/actions/create-resource-version.js\"),\n ],\n [\n \"list-resource-versions\",\n () => import(\"../history/actions/list-resource-versions.js\"),\n ],\n [\n \"get-resource-version\",\n () => import(\"../history/actions/get-resource-version.js\"),\n ],\n [\n \"restore-resource-version\",\n () => import(\"../history/actions/restore-resource-version.js\"),\n ],\n [\n \"list-resource-history\",\n () => import(\"../history/actions/list-resource-history.js\"),\n ],\n // Comments/review kit — reusable inline comments, feedback, and review status.\n [\n \"list-review-comments\",\n () => import(\"../review/actions/list-review-comments.js\"),\n ],\n [\n \"create-review-comment\",\n () => import(\"../review/actions/create-review-comment.js\"),\n ],\n [\n \"reply-review-comment\",\n () => import(\"../review/actions/reply-review-comment.js\"),\n ],\n [\n \"resolve-review-thread\",\n () => import(\"../review/actions/resolve-review-thread.js\"),\n ],\n [\n \"delete-review-comment\",\n () => import(\"../review/actions/delete-review-comment.js\"),\n ],\n [\n \"consume-review-feedback\",\n () => import(\"../review/actions/consume-review-feedback.js\"),\n ],\n [\n \"get-review-feedback\",\n () => import(\"../review/actions/get-review-feedback.js\"),\n ],\n [\n \"set-review-status\",\n () => import(\"../review/actions/set-review-status.js\"),\n ],\n [\n \"send-review-thread-to-agent\",\n () => import(\"../review/actions/send-review-thread-to-agent.js\"),\n ],\n // Org service tokens (CI credentials, e.g. PLAN_RECAP_TOKEN). Mint/revoke\n // are toolCallable:false — preserved via preserveActionFlags below.\n [\n \"create-org-service-token\",\n () => import(\"../mcp/actions/create-org-service-token.js\"),\n ],\n [\n \"list-org-service-tokens\",\n () => import(\"../mcp/actions/list-org-service-tokens.js\"),\n ],\n [\n \"revoke-org-service-token\",\n () => import(\"../mcp/actions/revoke-org-service-token.js\"),\n ],\n [\"list-mcp-tools\", () => import(\"../mcp/actions/list-mcp-tools.js\")],\n [\"call-mcp-tool\", () => import(\"../mcp/actions/call-mcp-tool.js\")],\n ];\n for (const [name, loader] of entries) {\n if (registry[name]) continue;\n try {\n const mod = await loader();\n const def = mod.default;\n if (def && def.tool && typeof def.run === \"function\") {\n registry[name] = {\n tool: def.tool,\n run: def.run,\n ...(def.http !== undefined ? { http: def.http } : {}),\n // Carry security-relevant flags (toolCallable, publicAgent, link,\n // mcpApp) plus readOnly/parallelSafe/dedupe. Without this, the sharing\n // actions' `toolCallable: false` (audit-H5) is dropped and the\n // tools-iframe bridge 403 in action-routes.ts never fires.\n ...preserveActionFlags(def),\n };\n }\n } catch {\n // Skip any sharing action that fails to import.\n }\n }\n}\n\n/** @deprecated Use `autoDiscoverActions` instead */\nexport const autoDiscoverScripts = autoDiscoverActions;\n"]}
@@ -27,11 +27,11 @@ 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;
31
30
  ok: boolean;
32
31
  key: string;
33
32
  baseUrlKey?: string;
34
33
  scope: AgentEngineApiKeyScope;
34
+ error?: undefined;
35
35
  }>>;
36
36
  export {};
37
37
  //# sourceMappingURL=agent-engine-api-key-route.d.ts.map
@@ -109,8 +109,8 @@ export declare function getBetterAuthSync(): BetterAuthInstance | undefined;
109
109
  * The subset of Better Auth's internal adapter we use for federated-SSO
110
110
  * JIT account linking. Better Auth owns these writes (id + timestamp +
111
111
  * schema handling), so callers never hand-roll SQL against `user`/`account`.
112
- * Read-only lookups + strictly-additive `linkAccount`/`createUser` only no
113
- * update/delete of existing identity rows.
112
+ * Read-only lookups plus account-linking and profile-update operations used by
113
+ * shared Core surfaces. Better Auth owns the actual identity writes.
114
114
  */
115
115
  export interface BetterAuthInternalAdapter {
116
116
  findUserByEmail: (email: string, options?: {
@@ -138,6 +138,11 @@ export interface BetterAuthInternalAdapter {
138
138
  }) => Promise<{
139
139
  id: string;
140
140
  }>;
141
+ /** Optional because older/custom adapter shapes may not expose mutations. */
142
+ updateUser?: (userId: string, data: {
143
+ name?: string;
144
+ image?: string | null;
145
+ }) => Promise<unknown>;
141
146
  }
142
147
  /**
143
148
  * Resolve Better Auth's internal adapter via the live instance's
@@ -1 +1 @@
1
- {"version":3,"file":"better-auth-instance.d.ts","sourceRoot":"","sources":["../../src/server/better-auth-instance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwDjE,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5E;AAED,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,EACZ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAClD,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhB;AAkJD,gBAAgB;AAChB,wBAAgB,6BAA6B,IAAI;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,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C,IAAI,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAmBhD;AAED,wBAAwB;AACxB,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAYrD"}
1
+ {"version":3,"file":"better-auth-instance.d.ts","sourceRoot":"","sources":["../../src/server/better-auth-instance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwDjE,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5E;AAED,wBAAsB,gBAAgB,CAAC,EACrC,YAAY,EACZ,UAAU,EACV,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAClD,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhB;AAkJD,gBAAgB;AAChB,wBAAgB,6BAA6B,IAAI;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAiCA;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxE;AAED,w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