@agent-native/core 0.37.3 → 0.38.0

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 (377) hide show
  1. package/README.md +19 -6
  2. package/dist/action.d.ts +60 -2
  3. package/dist/action.d.ts.map +1 -1
  4. package/dist/action.js +6 -2
  5. package/dist/action.js.map +1 -1
  6. package/dist/agent/production-agent.d.ts +12 -6
  7. package/dist/agent/production-agent.d.ts.map +1 -1
  8. package/dist/agent/production-agent.js +161 -11
  9. package/dist/agent/production-agent.js.map +1 -1
  10. package/dist/agent/types.d.ts +2 -0
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/agent/types.js.map +1 -1
  13. package/dist/catalog.json +2 -2
  14. package/dist/cli/connect.d.ts.map +1 -1
  15. package/dist/cli/connect.js +15 -0
  16. package/dist/cli/connect.js.map +1 -1
  17. package/dist/cli/index.js +10 -6
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/cli/plan-publish-store.d.ts +52 -0
  20. package/dist/cli/plan-publish-store.d.ts.map +1 -0
  21. package/dist/cli/plan-publish-store.js +103 -0
  22. package/dist/cli/plan-publish-store.js.map +1 -0
  23. package/dist/cli/skills.d.ts +29 -4
  24. package/dist/cli/skills.d.ts.map +1 -1
  25. package/dist/cli/skills.js +851 -275
  26. package/dist/cli/skills.js.map +1 -1
  27. package/dist/cli/templates-meta.js +12 -12
  28. package/dist/cli/templates-meta.js.map +1 -1
  29. package/dist/client/AssistantChat.d.ts +3 -1
  30. package/dist/client/AssistantChat.d.ts.map +1 -1
  31. package/dist/client/AssistantChat.js +65 -15
  32. package/dist/client/AssistantChat.js.map +1 -1
  33. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  34. package/dist/client/MultiTabAssistantChat.js +20 -2
  35. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  36. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  37. package/dist/client/agent-chat-adapter.js +12 -0
  38. package/dist/client/agent-chat-adapter.js.map +1 -1
  39. package/dist/client/agent-engine-key.d.ts +24 -0
  40. package/dist/client/agent-engine-key.d.ts.map +1 -0
  41. package/dist/client/agent-engine-key.js +49 -0
  42. package/dist/client/agent-engine-key.js.map +1 -0
  43. package/dist/client/analytics.d.ts.map +1 -1
  44. package/dist/client/analytics.js +34 -0
  45. package/dist/client/analytics.js.map +1 -1
  46. package/dist/client/blocks/BlockView.d.ts +26 -0
  47. package/dist/client/blocks/BlockView.d.ts.map +1 -0
  48. package/dist/client/blocks/BlockView.js +24 -0
  49. package/dist/client/blocks/BlockView.js.map +1 -0
  50. package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
  51. package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
  52. package/dist/client/blocks/SchemaBlockEditor.js +72 -0
  53. package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
  54. package/dist/client/blocks/agent.d.ts +30 -0
  55. package/dist/client/blocks/agent.d.ts.map +1 -0
  56. package/dist/client/blocks/agent.js +61 -0
  57. package/dist/client/blocks/agent.js.map +1 -0
  58. package/dist/client/blocks/index.d.ts +34 -0
  59. package/dist/client/blocks/index.d.ts.map +1 -0
  60. package/dist/client/blocks/index.js +42 -0
  61. package/dist/client/blocks/index.js.map +1 -0
  62. package/dist/client/blocks/library/checklist.config.d.ts +36 -0
  63. package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
  64. package/dist/client/blocks/library/checklist.config.js +25 -0
  65. package/dist/client/blocks/library/checklist.config.js.map +1 -0
  66. package/dist/client/blocks/library/checklist.d.ts +26 -0
  67. package/dist/client/blocks/library/checklist.d.ts.map +1 -0
  68. package/dist/client/blocks/library/checklist.js +76 -0
  69. package/dist/client/blocks/library/checklist.js.map +1 -0
  70. package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
  71. package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
  72. package/dist/client/blocks/library/code-tabs.config.js +30 -0
  73. package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
  74. package/dist/client/blocks/library/code-tabs.d.ts +3 -0
  75. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
  76. package/dist/client/blocks/library/code-tabs.js +165 -0
  77. package/dist/client/blocks/library/code-tabs.js.map +1 -0
  78. package/dist/client/blocks/library/html.config.d.ts +37 -0
  79. package/dist/client/blocks/library/html.config.d.ts.map +1 -0
  80. package/dist/client/blocks/library/html.config.js +46 -0
  81. package/dist/client/blocks/library/html.config.js.map +1 -0
  82. package/dist/client/blocks/library/html.d.ts +21 -0
  83. package/dist/client/blocks/library/html.d.ts.map +1 -0
  84. package/dist/client/blocks/library/html.js +69 -0
  85. package/dist/client/blocks/library/html.js.map +1 -0
  86. package/dist/client/blocks/library/table.config.d.ts +30 -0
  87. package/dist/client/blocks/library/table.config.d.ts.map +1 -0
  88. package/dist/client/blocks/library/table.config.js +22 -0
  89. package/dist/client/blocks/library/table.config.js.map +1 -0
  90. package/dist/client/blocks/library/table.d.ts +8 -0
  91. package/dist/client/blocks/library/table.d.ts.map +1 -0
  92. package/dist/client/blocks/library/table.js +107 -0
  93. package/dist/client/blocks/library/table.js.map +1 -0
  94. package/dist/client/blocks/library/tabs.config.d.ts +56 -0
  95. package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
  96. package/dist/client/blocks/library/tabs.config.js +36 -0
  97. package/dist/client/blocks/library/tabs.config.js.map +1 -0
  98. package/dist/client/blocks/library/tabs.d.ts +20 -0
  99. package/dist/client/blocks/library/tabs.d.ts.map +1 -0
  100. package/dist/client/blocks/library/tabs.js +123 -0
  101. package/dist/client/blocks/library/tabs.js.map +1 -0
  102. package/dist/client/blocks/mdx.d.ts +74 -0
  103. package/dist/client/blocks/mdx.d.ts.map +1 -0
  104. package/dist/client/blocks/mdx.js +205 -0
  105. package/dist/client/blocks/mdx.js.map +1 -0
  106. package/dist/client/blocks/provider.d.ts +25 -0
  107. package/dist/client/blocks/provider.d.ts.map +1 -0
  108. package/dist/client/blocks/provider.js +19 -0
  109. package/dist/client/blocks/provider.js.map +1 -0
  110. package/dist/client/blocks/registry.d.ts +24 -0
  111. package/dist/client/blocks/registry.d.ts.map +1 -0
  112. package/dist/client/blocks/registry.js +50 -0
  113. package/dist/client/blocks/registry.js.map +1 -0
  114. package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
  115. package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
  116. package/dist/client/blocks/schema-form/introspect.js +164 -0
  117. package/dist/client/blocks/schema-form/introspect.js.map +1 -0
  118. package/dist/client/blocks/server.d.ts +22 -0
  119. package/dist/client/blocks/server.d.ts.map +1 -0
  120. package/dist/client/blocks/server.js +25 -0
  121. package/dist/client/blocks/server.js.map +1 -0
  122. package/dist/client/blocks/types.d.ts +212 -0
  123. package/dist/client/blocks/types.d.ts.map +1 -0
  124. package/dist/client/blocks/types.js +5 -0
  125. package/dist/client/blocks/types.js.map +1 -0
  126. package/dist/client/composer/ComposerPlusMenu.js +10 -1
  127. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  128. package/dist/client/guided-questions.d.ts +68 -0
  129. package/dist/client/guided-questions.d.ts.map +1 -1
  130. package/dist/client/guided-questions.js +158 -3
  131. package/dist/client/guided-questions.js.map +1 -1
  132. package/dist/client/index.d.ts +5 -1
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +15 -1
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
  137. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
  138. package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
  139. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
  140. package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
  141. package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
  142. package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
  143. package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
  144. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
  145. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
  146. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
  147. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
  148. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +61 -0
  149. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
  150. package/dist/client/rich-markdown-editor/SharedRichEditor.js +121 -0
  151. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
  152. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
  153. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
  154. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
  155. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
  156. package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
  157. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
  158. package/dist/client/rich-markdown-editor/extensions.js +222 -0
  159. package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
  160. package/dist/client/rich-markdown-editor/index.d.ts +9 -0
  161. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
  162. package/dist/client/rich-markdown-editor/index.js +9 -0
  163. package/dist/client/rich-markdown-editor/index.js.map +1 -0
  164. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
  165. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
  166. package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
  167. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
  168. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
  169. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
  170. package/dist/client/rich-markdown-editor/useCollabReconcile.js +342 -0
  171. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
  172. package/dist/client/track.d.ts +25 -0
  173. package/dist/client/track.d.ts.map +1 -0
  174. package/dist/client/track.js +53 -0
  175. package/dist/client/track.js.map +1 -0
  176. package/dist/client/use-action.d.ts.map +1 -1
  177. package/dist/client/use-action.js +6 -0
  178. package/dist/client/use-action.js.map +1 -1
  179. package/dist/client/use-session.d.ts +3 -2
  180. package/dist/client/use-session.d.ts.map +1 -1
  181. package/dist/client/use-session.js +3 -2
  182. package/dist/client/use-session.js.map +1 -1
  183. package/dist/deploy/build.d.ts +5 -0
  184. package/dist/deploy/build.d.ts.map +1 -1
  185. package/dist/deploy/build.js +67 -1
  186. package/dist/deploy/build.js.map +1 -1
  187. package/dist/extensions/schema.d.ts +1 -1
  188. package/dist/mcp/build-server.d.ts.map +1 -1
  189. package/dist/mcp/build-server.js +9 -2
  190. package/dist/mcp/build-server.js.map +1 -1
  191. package/dist/mcp/server.d.ts +1 -1
  192. package/dist/mcp/server.d.ts.map +1 -1
  193. package/dist/mcp/server.js +35 -2
  194. package/dist/mcp/server.js.map +1 -1
  195. package/dist/provider-api/index.d.ts +1 -1
  196. package/dist/provider-api/index.d.ts.map +1 -1
  197. package/dist/scripts/docs/search.d.ts.map +1 -1
  198. package/dist/scripts/docs/search.js +5 -2
  199. package/dist/scripts/docs/search.js.map +1 -1
  200. package/dist/scripts/runner.d.ts.map +1 -1
  201. package/dist/scripts/runner.js +16 -3
  202. package/dist/scripts/runner.js.map +1 -1
  203. package/dist/server/action-discovery.d.ts.map +1 -1
  204. package/dist/server/action-discovery.js +2 -0
  205. package/dist/server/action-discovery.js.map +1 -1
  206. package/dist/server/action-routes.d.ts.map +1 -1
  207. package/dist/server/action-routes.js +30 -4
  208. package/dist/server/action-routes.js.map +1 -1
  209. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  210. package/dist/server/agent-chat-plugin.js +65 -19
  211. package/dist/server/agent-chat-plugin.js.map +1 -1
  212. package/dist/server/agent-teams.d.ts.map +1 -1
  213. package/dist/server/agent-teams.js +8 -1
  214. package/dist/server/agent-teams.js.map +1 -1
  215. package/dist/server/agents-bundle.d.ts +27 -1
  216. package/dist/server/agents-bundle.d.ts.map +1 -1
  217. package/dist/server/agents-bundle.js +41 -3
  218. package/dist/server/agents-bundle.js.map +1 -1
  219. package/dist/server/auth.d.ts.map +1 -1
  220. package/dist/server/auth.js +76 -3
  221. package/dist/server/auth.js.map +1 -1
  222. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  223. package/dist/server/core-routes-plugin.js +60 -0
  224. package/dist/server/core-routes-plugin.js.map +1 -1
  225. package/dist/server/onboarding-html.d.ts.map +1 -1
  226. package/dist/server/onboarding-html.js +160 -22
  227. package/dist/server/onboarding-html.js.map +1 -1
  228. package/dist/server/sentry.d.ts.map +1 -1
  229. package/dist/server/sentry.js +6 -0
  230. package/dist/server/sentry.js.map +1 -1
  231. package/dist/server/social-og-image.d.ts +2 -1
  232. package/dist/server/social-og-image.d.ts.map +1 -1
  233. package/dist/server/social-og-image.js +24 -4
  234. package/dist/server/social-og-image.js.map +1 -1
  235. package/dist/sharing/schema.d.ts +1 -1
  236. package/dist/styles/agent-native.css +1 -0
  237. package/dist/styles/rich-markdown-editor.css +439 -0
  238. package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
  239. package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
  240. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  241. package/dist/templates/default/AGENTS.md +1 -0
  242. package/dist/templates/default/DEVELOPING.md +2 -0
  243. package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  244. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  245. package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  246. package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  247. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  248. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  249. package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  250. package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  251. package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  252. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  253. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  254. package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  255. package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  256. package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  257. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  258. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  259. package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  260. package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  261. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  262. package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  263. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  264. package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  265. package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  266. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  267. package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  268. package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  269. package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  270. package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  271. package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  272. package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  273. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  274. package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  275. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  276. package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  277. package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  278. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  279. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  280. package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  281. package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  282. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  283. package/dist/templates/workspace-core/AGENTS.md +5 -1
  284. package/dist/templates/workspace-root/AGENTS.md +5 -2
  285. package/dist/tracking/route.d.ts +43 -0
  286. package/dist/tracking/route.d.ts.map +1 -0
  287. package/dist/tracking/route.js +85 -0
  288. package/dist/tracking/route.js.map +1 -0
  289. package/dist/vite/client.d.ts.map +1 -1
  290. package/dist/vite/client.js +15 -0
  291. package/dist/vite/client.js.map +1 -1
  292. package/docs/content/a2a-protocol.md +18 -4
  293. package/docs/content/actions.md +87 -0
  294. package/docs/content/agent-mentions.md +2 -1
  295. package/docs/content/authentication.md +2 -1
  296. package/docs/content/client.md +64 -13
  297. package/docs/content/cloneable-saas.md +1 -1
  298. package/docs/content/code-agents-ui.md +17 -11
  299. package/docs/content/context-awareness.md +23 -28
  300. package/docs/content/creating-templates.md +1 -1
  301. package/docs/content/drop-in-agent.md +2 -0
  302. package/docs/content/getting-started.md +2 -2
  303. package/docs/content/key-concepts.md +2 -2
  304. package/docs/content/messaging.md +57 -15
  305. package/docs/content/migration-workbench.md +1 -1
  306. package/docs/content/multi-app-workspace.md +1 -1
  307. package/docs/content/multi-tenancy.md +17 -15
  308. package/docs/content/real-time-collaboration.md +1 -1
  309. package/docs/content/recurring-jobs.md +1 -1
  310. package/docs/content/security.md +2 -2
  311. package/docs/content/server.md +4 -4
  312. package/docs/content/skills-guide.md +30 -0
  313. package/docs/content/template-analytics.md +2 -2
  314. package/docs/content/template-assets.md +17 -1
  315. package/docs/content/template-brain.md +2 -2
  316. package/docs/content/template-calendar.md +1 -1
  317. package/docs/content/template-clips.md +3 -3
  318. package/docs/content/template-content.md +2 -2
  319. package/docs/content/template-design.md +2 -2
  320. package/docs/content/template-dispatch.md +3 -3
  321. package/docs/content/template-forms.md +14 -2
  322. package/docs/content/template-mail.md +1 -3
  323. package/docs/content/template-plan.md +118 -0
  324. package/docs/content/template-slides.md +5 -4
  325. package/docs/content/template-starter.md +4 -4
  326. package/docs/content/template-videos.md +6 -11
  327. package/docs/content/tracking.md +21 -1
  328. package/docs/content/visual-plans.md +72 -0
  329. package/docs/content/workspace.md +9 -9
  330. package/package.json +26 -11
  331. package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
  332. package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
  333. package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  334. package/src/templates/default/AGENTS.md +1 -0
  335. package/src/templates/default/DEVELOPING.md +2 -0
  336. package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  337. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  338. package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  339. package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  340. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  341. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  342. package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  343. package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  344. package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  345. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  346. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  347. package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  348. package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  349. package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  350. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  351. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  352. package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  353. package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  354. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  355. package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  356. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  357. package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  358. package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  359. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  360. package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  361. package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  362. package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  363. package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  364. package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  365. package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  366. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  367. package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  368. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  369. package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  370. package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  371. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  372. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  373. package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  374. package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  375. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  376. package/src/templates/workspace-core/AGENTS.md +5 -1
  377. package/src/templates/workspace-root/AGENTS.md +5 -2
@@ -70,6 +70,46 @@ export default defineAction({
70
70
  - **`readOnly: true`** — explicitly skip the poll-refresh even for POST actions that don't mutate.
71
71
  - **`parallelSafe: true`** — allow a mutating action to run concurrently with other same-turn tool calls. Only set this when the action is internally concurrency-safe and order-independent; mutating actions serialize by default.
72
72
 
73
+ ### Keep the action surface small {#small-surface}
74
+
75
+ Every action the agent can see is a tool in the model's context window, and a long, overlapping tool list degrades the model's tool-selection quality. Design the action surface like an API you maintain, not one action per UI affordance:
76
+
77
+ - Prefer **one CRUD-style `update`** that takes a patch of optional fields over N per-field actions (`update-name`, `update-order`, `update-color`, …). The caller sends only what changed.
78
+ - Before adding a new read action per query/filter, reach for a generic escape hatch: the [provider API trio](/docs/template-dispatch) (`provider-api-catalog` / `provider-api-docs` / `provider-api-request`) for provider data, or the dev `db-query` tool for app data.
79
+ - Mark UI-only or programmatic actions [`agentTool: false`](#agent-tool) so they stay frontend/HTTP-callable without spending a slot in the model's tool list.
80
+ - Delete or hide actions the UI no longer uses instead of leaving them exposed to the model.
81
+
82
+ A repo-level advisory helper, `node scripts/audit-template-actions.mjs [template ...]` (alias `pnpm actions:audit`), statically scans a template's `actions/` and flags likely UI-dead actions and redundant per-field clusters. It is advisory only (always exits 0, never fails CI) and uses conservative heuristics, so review its suggestions rather than treating them as errors.
83
+
84
+ ### Agent tool exposure {#agent-tool}
85
+
86
+ By default every action is exposed to the agent — the in-app assistant plus the app's MCP / A2A tool surfaces — as a callable tool. For an action that only the frontend (or an HTTP / cron caller) needs, set `agentTool: false` to keep it behind the framework's auth + action surface while removing it from every agent tool list:
87
+
88
+ ```ts
89
+ export default defineAction({
90
+ description: "Persist the user's sidebar width.",
91
+ agentTool: false, // UI-only — not a tool in the model's context window
92
+ schema: z.object({ widthPx: z.number() }),
93
+ http: { method: "PUT" },
94
+ run: async ({ widthPx }) => {
95
+ /* ... */
96
+ },
97
+ });
98
+ ```
99
+
100
+ | Value | Behavior |
101
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
102
+ | `true` | Allow (same as undefined). Useful for documenting intent. |
103
+ | `false` | **Hidden from the model entirely** — not in the agent's tool list, MCP, or A2A. Still callable from the UI (`useActionMutation` / `callAction`), CLI, and `/_agent-native/actions/<name>`. |
104
+ | `undefined` | **Default-allow.** The action is a normal agent tool. |
105
+
106
+ `agentTool: false` is **not** the same as [`toolCallable: false`](#tool-callable):
107
+
108
+ - **`agentTool: false`** removes the action from the **model's** view. The model can no longer see or call it; the UI and HTTP can.
109
+ - **`toolCallable: false`** only blocks the sandboxed **extension iframe bridge** (`appAction(...)`). The action stays fully visible to the model, UI, CLI, MCP, and A2A. It exists for high-blast-radius operations (account/org/auth changes), not for trimming the tool list.
110
+
111
+ Reach for `agentTool: false` when you find yourself adding a UI-only or purely programmatic action, or when the UI stops using an action you'd otherwise leave exposed to the model.
112
+
73
113
  ### Extension callability {#tool-callable}
74
114
 
75
115
  Extensions (Alpine.js mini-apps that run inside sandboxed iframes — see [Extensions](/docs/extensions)) call actions via `appAction(name, params)`. Because a shared extension's HTML/JS executes inside the _viewer's_ session, an action invoked from an extension runs with the viewer's permissions, secrets, and SQL scope. For high-blast-radius operations, that is too much trust to grant by default.
@@ -102,6 +142,53 @@ Set `toolCallable: false` for actions that:
102
142
  - modify org membership (invite/remove members, change roles),
103
143
  - change resource visibility or grant share access (the framework's built-in `share-resource`, `unshare-resource`, and `set-resource-visibility` are already opted out).
104
144
 
145
+ ### Run context (second argument) {#run-context}
146
+
147
+ `run` receives an optional second argument, `ctx`, carrying the resolved request identity and the surface that invoked the action. Read it instead of calling `getRequestUserEmail()` / `getRequestOrgId()` by hand, and pass the whole `ctx` to tracking:
148
+
149
+ ```ts
150
+ export default defineAction({
151
+ description: "Log an audit entry for the current request.",
152
+ schema: z.object({ event: z.string() }),
153
+ run: async (args, ctx) => {
154
+ // ctx is undefined-safe: a 1-arg `run(args)` is still valid.
155
+ const actor = ctx?.userEmail ?? "system";
156
+ if (ctx?.caller === "frontend") {
157
+ // tighter rules for browser-initiated calls, looser for "tool"/"cli"
158
+ }
159
+ await db.insert(audit).values({
160
+ actor,
161
+ orgId: ctx?.orgId ?? null,
162
+ source: ctx?.caller ?? "unknown",
163
+ event: args.event,
164
+ });
165
+ return { ok: true };
166
+ },
167
+ });
168
+ ```
169
+
170
+ `ActionRunContext` fields:
171
+
172
+ | Field | Type | Notes |
173
+ | ----------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
174
+ | `userEmail` | `string \| undefined` | Resolved request user. **Never defaulted to a dev identity** — `undefined` when the request has no authenticated user. Apply your own fallback if you need one. |
175
+ | `orgId` | `string \| null` | Resolved org id, or `null` when the request has no org. |
176
+ | `caller` | `ActionCaller` | How the action was invoked (see below). |
177
+ | `send` | `(event) => void` | Optional. Emit an SSE event to the client. Only present inside the agent tool loop (`caller: "tool"`); `undefined` elsewhere. |
178
+
179
+ `caller` is the union `"tool" | "http" | "frontend" | "cli" | "mcp" | "a2a"`:
180
+
181
+ | `caller` | Set when… |
182
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
183
+ | `"tool"` | The in-app agent loop, a sub-agent / agent team, or an A2A request (A2A drives the same agent loop, so its tool calls are `"tool"`). |
184
+ | `"frontend"` | A browser call via `useActionMutation` / `useActionQuery` / `callAction` (tagged with the `X-Agent-Native-Frontend: 1` header). |
185
+ | `"http"` | A bare programmatic `POST` / `GET` to `/_agent-native/actions/<name>` without the frontend marker. |
186
+ | `"cli"` | `pnpm action <name>` (the CLI runner). |
187
+ | `"mcp"` | An external agent over the MCP `tools/call` endpoint. |
188
+ | `"a2a"` | Reserved for a future direct A2A action dispatch. Today A2A runs through the agent loop, so those calls are `"tool"`. |
189
+
190
+ `run` stays backward compatible: existing 1-argument handlers and handlers that only destructure `{ send }` continue to work unchanged.
191
+
105
192
  ## Calling it from the UI {#ui}
106
193
 
107
194
  Two hooks, both in `@agent-native/core/client`. Types are inferred from your `defineAction` schemas — no manual type declarations.
@@ -40,8 +40,9 @@ When a message containing an `@`-mention is sent, the following happens on the s
40
40
  3. The agent's response is wrapped in an `<agent-response>` XML block and injected into the conversation context
41
41
  4. The main agent processes the enriched message, seeing both the user's text and the mentioned agent's response
42
42
 
43
+ What the main agent sees in its context:
44
+
43
45
  ```text
44
- // What the main agent sees in its context:
45
46
  User: Draft an email with the latest signup numbers. @analytics
46
47
 
47
48
  <agent-response agent="analytics">
@@ -103,7 +103,7 @@ If unset, the framework falls back to `BETTER_AUTH_SECRET`. A dedicated `OAUTH_S
103
103
 
104
104
  ## Organizations {#organizations}
105
105
 
106
- Better Auth's organization plugin is built into the framework. Every app supports:
106
+ The framework provides a built-in organization system. This is the framework's own `org/` module — backed by the `organizations` and `org_members` tables — not Better Auth's organization plugin, which is intentionally not registered. Every app supports:
107
107
 
108
108
  - Creating organizations
109
109
  - Inviting members with roles (`owner`, `admin`, `member`)
@@ -204,6 +204,7 @@ interface AuthSession {
204
204
  email: string; // User's email (primary identifier)
205
205
  userId?: string; // Better Auth user ID
206
206
  token?: string; // Session token
207
+ name?: string; // Display name from the auth provider, when available
207
208
  orgId?: string; // Active organization ID
208
209
  orgRole?: string; // Role in active org (owner/admin/member)
209
210
  }
@@ -7,6 +7,8 @@ description: "React hooks and utilities for agent-native apps: sendToAgentChat,
7
7
 
8
8
  `@agent-native/core` provides React hooks and utilities for the browser-side of agent-native apps.
9
9
 
10
+ These client/React APIs are exported from both `@agent-native/core` and `@agent-native/core/client`. Import them from `@agent-native/core/client` (the browser entry) for clarity and correct bundling, since the bare `@agent-native/core` root resolves to the Node build by default.
11
+
10
12
  ## File-Based Routing {#file-based-routing}
11
13
 
12
14
  Agent-native apps use **React Router v7** with file-based routing. Every file in `app/routes/` becomes a URL.
@@ -87,7 +89,7 @@ Internally this is the submitted-chat path sometimes surfaced as
87
89
  posting that event directly.
88
90
 
89
91
  ```ts
90
- import { sendToAgentChat } from "@agent-native/core";
92
+ import { sendToAgentChat } from "@agent-native/core/client";
91
93
 
92
94
  // Auto-submit a prompt with hidden context
93
95
  sendToAgentChat({
@@ -106,14 +108,17 @@ sendToAgentChat({
106
108
 
107
109
  ### AgentChatMessage {#agentchatmessage}
108
110
 
109
- | Option | Type | Description |
110
- | --------------------- | ----------- | ---------------------------------------------- |
111
- | `message` | `string` | The visible prompt sent to the chat |
112
- | `context` | `string?` | Hidden context appended (not shown in chat UI) |
113
- | `submit` | `boolean?` | true = auto-submit, false = prefill only |
114
- | `projectSlug` | `string?` | Optional project slug for structured context |
115
- | `preset` | `string?` | Optional preset name for downstream consumers |
116
- | `referenceImagePaths` | `string[]?` | Optional reference image paths |
111
+ | Option | Type | Description |
112
+ | --------------------- | ----------- | -------------------------------------------------------------------------- |
113
+ | `message` | `string` | The visible prompt sent to the chat |
114
+ | `context` | `string?` | Hidden context appended (not shown in chat UI) |
115
+ | `submit` | `boolean?` | true = auto-submit, false = prefill only |
116
+ | `newTab` | `boolean?` | Create a separate chat thread for this prompt |
117
+ | `background` | `boolean?` | With `newTab`, run without focusing the tab and show the run in `RunsTray` |
118
+ | `openSidebar` | `boolean?` | Set false to submit/prefill without opening the sidebar |
119
+ | `projectSlug` | `string?` | Optional project slug for structured context |
120
+ | `preset` | `string?` | Optional preset name for downstream consumers |
121
+ | `referenceImagePaths` | `string[]?` | Optional reference image paths |
117
122
 
118
123
  ## Agent Chat Context State (Advanced) {#agent-chat-context-state}
119
124
 
@@ -138,7 +143,7 @@ and `submit` for those.
138
143
  `useAgentChatContext()` returns `{ items, set, remove, clear, refresh }`.
139
144
 
140
145
  ```tsx
141
- import { useAgentChatContext } from "@agent-native/core";
146
+ import { useAgentChatContext } from "@agent-native/core/client";
142
147
 
143
148
  function SelectionContextButton({ record }: { record: { id: string } }) {
144
149
  const chatContext = useAgentChatContext();
@@ -181,6 +186,52 @@ current staged items once. `clearAgentChatContext()` is intentionally broad; use
181
186
  | `context` | `string` | Hidden context included with the next submitted prompt |
182
187
  | `openSidebar` | `boolean?` | Defaults to true; pass false to stage context silently |
183
188
 
189
+ ## askUserQuestion(opts) {#ask-user-question}
190
+
191
+ Ask the user a multiple-choice question from app code, render it inline in the
192
+ agent panel, and **await their answer**. It's the client-side twin of the
193
+ agent's built-in `ask-question` tool: it writes a `GuidedQuestionPayload` to the
194
+ `"guided-questions"` application-state key (where the mounted
195
+ `GuidedQuestionFlow` renders it) and reveals the agent panel so the question is
196
+ visible. Unlike the agent tool — whose answer flows back to the agent —
197
+ `askUserQuestion()` **resolves with the answer to the caller**, so the UI can
198
+ branch on it.
199
+
200
+ Use it when the UI needs exactly one small decision (2–4 options) before it
201
+ kicks off agent work — instead of building a custom modal. Reach for the
202
+ composer for freeform detail, and a form/popover for multi-field input.
203
+
204
+ ```tsx
205
+ import { askUserQuestion, sendToAgentChat } from "@agent-native/core/client";
206
+
207
+ const length = await askUserQuestion({
208
+ question: "How long should this deck be?",
209
+ header: "Deck length", // optional short chip/heading (≈12 chars)
210
+ options: [
211
+ { label: "Short (3–5 slides)", value: "short" },
212
+ { label: "Medium (6–10 slides)", value: "medium", recommended: true },
213
+ { label: "Long (11+ slides)", value: "long" },
214
+ ],
215
+ allowFreeText: false, // omit the "Other" free-text option (default adds it)
216
+ allowMultiple: false, // single-select (default)
217
+ });
218
+
219
+ if (length) {
220
+ sendToAgentChat({ message: `Generate a ${length} deck.`, submit: true });
221
+ }
222
+ ```
223
+
224
+ Each option is `{ label, value?, description?, preview?, recommended? }`; `value`
225
+ defaults to `label`, and `preview` renders a small mockup/code snippet under the
226
+ option. The promise resolves with the selected `value` (or `value[]` when
227
+ `allowMultiple`), the free-text string when the user picks "Other", or `null`
228
+ if they skip — it stays pending until the user answers. Requires the agent panel
229
+ to be mounted (it is in every template).
230
+
231
+ The agent reaches the same UI through its `ask-question` tool: prefer letting the
232
+ agent ask when _it_ hits a genuine fork it can't resolve from context; use
233
+ `askUserQuestion()` when the _UI_ needs to gate an action on a choice.
234
+
184
235
  ## MCP App Host Bridge {#mcp-app-host-bridge}
185
236
 
186
237
  Routes embedded as MCP Apps should be URL-first: load the current artifact from
@@ -230,7 +281,7 @@ Set `dynamicSuggestions={false}` to keep only static chips. Pass `getSuggestions
230
281
  React hook that wraps sendToAgentChat with loading state tracking:
231
282
 
232
283
  ```ts
233
- import { useAgentChatGenerating } from "@agent-native/core";
284
+ import { useAgentChatGenerating } from "@agent-native/core/client";
234
285
 
235
286
  function GenerateButton() {
236
287
  const [isGenerating, send] = useAgentChatGenerating();
@@ -257,7 +308,7 @@ function GenerateButton() {
257
308
  React hook (formerly `useFileWatcher`) that listens for database changes over SSE, falls back to polling, and invalidates the framework query caches that keep the UI aligned with agent writes:
258
309
 
259
310
  ```ts
260
- import { useDbSync } from "@agent-native/core";
311
+ import { useDbSync } from "@agent-native/core/client";
261
312
  import { useQueryClient } from "@tanstack/react-query";
262
313
 
263
314
  function App() {
@@ -325,7 +376,7 @@ function DashboardView({ id }) {
325
376
  Utility for merging class names (clsx + tailwind-merge):
326
377
 
327
378
  ```ts
328
- import { cn } from "@agent-native/core";
379
+ import { cn } from "@agent-native/core/client";
329
380
 
330
381
  <div className={cn(
331
382
  "px-4 py-2 rounded",
@@ -23,7 +23,7 @@ Each one is a real app you could use today, and the launching pad for your own v
23
23
  | **Slides** | An agent-native Google Slides. React-based decks the agent generates and edits directly. |
24
24
  | **Video** | An agent-native video editor on Remotion. Prompt for a cut, the agent assembles it. |
25
25
  | **Analytics** | An agent-native Amplitude/Mixpanel. Connect data sources, prompt for charts, pin to dashboards. |
26
- | **Clips** | An agent-native Loom. Async screen + camera recording with transcription, chapters, AI summaries. |
26
+ | **Clips** | Replaces Loom async screen + camera recording with transcription, chapters, AI summaries. |
27
27
  | **Design** | Agent-native HTML prototyping studio for interactive Alpine/Tailwind designs. |
28
28
  | **Forms** | An agent-native Typeform. Build, share, collect, and route submissions to Slack, Sheets, webhooks, or Discord. |
29
29
  | **Dispatch** | The workspace control plane: shared secrets, reusable integrations, Slack/Telegram, scheduled jobs. |
@@ -80,17 +80,20 @@ pnpm install
80
80
  pnpm dev
81
81
  ```
82
82
 
83
- Your host can wrap the local run store through normal actions:
83
+ Your host can wrap the local run store through normal actions. These are
84
+ host-owned actions you would define yourself — they are not shipped framework
85
+ actions — mapping each `CodeAgentsHost` method onto the run store, for example:
84
86
 
85
- - `list-code-agent-runs`
86
- - `list-code-agent-packs`
87
- - `create-code-agent-run`
88
- - `read-code-agent-transcript`
89
- - `append-code-agent-follow-up`
90
- - `update-code-agent-run`
91
- - `control-code-agent-run`
87
+ - a "list runs" action backing `listRuns`
88
+ - a "list code packs" action backing `listCodePacks`
89
+ - a "create run" action backing `createRun`
90
+ - a "read transcript" action backing `readTranscript`
91
+ - an "append follow-up" action backing `appendFollowUp`
92
+ - an "update run" action backing `updateRun`
93
+ - a "control run" action backing `controlRun`
92
94
 
93
- It uses `@agent-native/core/code-agents`, which exposes the same file-backed run store and executor used by the CLI.
95
+ Each one calls `@agent-native/core/code-agents`, which exposes the same
96
+ file-backed run store and executor used by the CLI.
94
97
 
95
98
  ## CLI Run Controls
96
99
 
@@ -117,7 +120,10 @@ agent-native code /audit --url https://example.com
117
120
  agent-native code /release-check
118
121
  ```
119
122
 
120
- Project commands come from `.agents/commands/*.md`; project skills come from
123
+ Here `/migrate` and `/audit` are built-in goals (the built-in goals are
124
+ `task`, `migrate`, and `audit`). `/release-check` is shown as an example of a
125
+ project command — defined in `.agents/commands/`, not a built-in goal. Project
126
+ commands come from `.agents/commands/*.md`; project skills come from
121
127
  `.agents/skills/*/SKILL.md`. The control commands operate on the same run
122
128
  records that the Desktop Code tab and shared UI display:
123
129
 
@@ -270,7 +276,7 @@ Project skills live in:
270
276
  .agents/skills/*/SKILL.md
271
277
  ```
272
278
 
273
- When the host implements `listCodePacks`, the shared UI shows project commands and skills in the rail. Command rows insert `/<command>`, and skill rows insert a focused “Use the <skill> skill…” prompt so the rail stays actionable. Built-in names such as `/migrate`, `/audit`, `/status`, and `/resume` stay reserved for the global Agent-Native Code controls.
279
+ When the host implements `listCodePacks`, the shared UI shows project commands and skills in the rail. Command rows insert `/<command>`, and skill rows insert a focused “Use the <skill> skill…” prompt so the rail stays actionable. The built-in slash goals `/migrate` and `/audit` stay reserved for the global Agent-Native Code controls, as do run-control names such as `status` and `resume` — those are subcommands invoked without a slash (`agent-native code status`, `agent-native code resume`), not slash goals.
274
280
 
275
281
  Do not create a separate slash-command registry for a new Code host. Project
276
282
  commands and skills are discovered from `.agents/commands/*.md` and
@@ -288,7 +288,7 @@ That gives the user the magic "this is what I meant" behavior without stuffing e
288
288
 
289
289
  ## The navigate action {#navigate-action}
290
290
 
291
- The agent writes a one-shot `navigate` command to application-state. The UI reads it, performs the navigation, and deletes the entry.
291
+ `navigate` is the mirror image of `navigation`. Where `navigation` is the UI telling the agent where the user is, `navigate` is the agent telling the UI where to go. The agent writes a one-shot `navigate` command to application-state; the UI reads it, performs the navigation, then deletes the entry.
292
292
 
293
293
  ```ts
294
294
  // Agent side -- write a navigate command
@@ -297,9 +297,21 @@ import { writeAppState } from "@agent-native/core/application-state";
297
297
  await writeAppState("navigate", { view: "inbox", threadId: "thread-123" });
298
298
  ```
299
299
 
300
- The UI should consume these commands through `useAgentRouteState`, which handles command polling, tab-scoped fallback keys, duplicate-command protection, and delete-after-read:
300
+ On the UI side you never poll or delete this key by hand. Both directions -- writing `navigation` on every route change and consuming the agent's `navigate` command -- are handled by a single hook, [`useNavigationState`](#use-navigation-state), covered in the next section.
301
+
302
+ The `navigation` key belongs to the UI; the agent must never write to it directly. The agent writes `navigate`, the UI performs the move, and that move is what updates `navigation`.
303
+
304
+ ## The useNavigationState hook {#use-navigation-state}
305
+
306
+ `useNavigationState` is **your app's hook, not a framework import.** Every template ships one at `app/hooks/use-navigation-state.ts` and calls it once from the app shell (`root.tsx`). It is the single place that wires navigation in both directions:
307
+
308
+ - **Outbound (UI → agent):** writes the `navigation` key whenever the route changes, so the agent always knows the current view.
309
+ - **Inbound (agent → UI):** polls the `navigate` command, runs the navigation, and deletes the command.
310
+
311
+ It stays short because it is a thin wrapper around the real framework primitive, `useAgentRouteState` (exported from `@agent-native/core/client`). You supply two app-specific functions and the framework does the rest:
301
312
 
302
313
  ```tsx
314
+ // app/hooks/use-navigation-state.ts -- this file lives in YOUR app
303
315
  import { useAgentRouteState } from "@agent-native/core/client";
304
316
  import { TAB_ID } from "@/lib/tab-id";
305
317
 
@@ -312,10 +324,14 @@ export function useNavigationState() {
312
324
  useAgentRouteState<NavigationState>({
313
325
  browserTabId: TAB_ID,
314
326
  requestSource: TAB_ID,
327
+
328
+ // UI → agent: derive semantic state from the current URL.
315
329
  getNavigationState: ({ pathname }) => {
316
330
  const match = pathname.match(/^\/thread\/([^/]+)/);
317
331
  return match ? { view: "thread", threadId: match[1] } : { view: "inbox" };
318
332
  },
333
+
334
+ // agent → UI: turn a `navigate` command into a route to push.
319
335
  getCommandPath: (command) =>
320
336
  command.view === "thread" && command.threadId
321
337
  ? `/thread/${command.threadId}`
@@ -324,33 +340,12 @@ export function useNavigationState() {
324
340
  }
325
341
  ```
326
342
 
327
- The `navigation` key belongs to the UI -- the agent should never write to it directly. Instead, the agent writes to `navigate`, and the UI performs the actual navigation, which then updates `navigation`.
328
-
329
- ## useNavigationState hook {#use-navigation-state}
330
-
331
- The `use-navigation-state.ts` hook is usually a thin wrapper around `useAgentRouteState`. Template code supplies the app-specific route mapping; core owns application-state writes, command reads/deletes, request-source headers, and duplicate-command prevention.
332
-
333
- ```tsx
334
- // app/hooks/use-navigation-state.ts
335
- import { useAgentRouteState } from "@agent-native/core/client";
336
- import { TAB_ID } from "@/lib/tab-id";
337
-
338
- export function useNavigationState() {
339
- useAgentRouteState({
340
- browserTabId: TAB_ID,
341
- requestSource: TAB_ID,
342
- getNavigationState: ({ pathname, searchParams }) => ({
343
- view: pathname === "/" ? "home" : pathname.slice(1),
344
- // Optional semantic alias. Raw query params are still visible in
345
- // <current-url> and controllable with set-search-params.
346
- label: searchParams.get("label"),
347
- }),
348
- getCommandPath: (command: any) => command.path ?? "/",
349
- });
350
- }
351
- ```
343
+ | You write | The framework handles |
344
+ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
345
+ | `getNavigationState` map the URL to semantic state | `navigation` writes, tab-scoped plus a global fallback key |
346
+ | `getCommandPath` — map a `navigate` command to a route | command polling, delete-after-read, duplicate-command protection, request-source tagging |
352
347
 
353
- For non-router state channels, use the lower-level `useSemanticNavigationState`. It takes a ready-made `state`, an ordered list of `navigationKeys`/`commandKeys`, and an `onCommand` callback, but does not import or assume React Router.
348
+ `useAgentRouteState` assumes React Router. When navigation does not live in the URL -- a wizard step, a canvas selection, a non-router shell -- drop down to the lower-level `useSemanticNavigationState` instead: you hand it a ready-made `state` value plus `navigationKeys`/`commandKeys` and an `onCommand` callback, and it stays completely agnostic about React Router.
354
349
 
355
350
  ## Jitter prevention {#jitter-prevention}
356
351
 
@@ -138,7 +138,7 @@ Actions are the single source of truth for app behavior. The agent calls them as
138
138
  ```ts
139
139
  // actions/create-project.ts
140
140
  import { defineAction } from "@agent-native/core";
141
- import { getDb } from "@agent-native/core/db";
141
+ import { getDb } from "../server/db/index.js"; // getDb is created per app via createGetDb(schema) in server/db/index.ts
142
142
  import { nanoid } from "nanoid";
143
143
  import { z } from "zod";
144
144
  import * as schema from "../server/db/schema";
@@ -117,6 +117,8 @@ import { sendToAgentChat } from "@agent-native/core/client";
117
117
  - **`message`** — the visible prompt shown in chat.
118
118
  - **`context`** — hidden context appended to the prompt (selected text, cursor position, current entity id — anything the agent should know but the user shouldn't see twice).
119
119
  - **`submit`** — `true` to auto-run, `false` to prefill but wait. Omit to use the project default.
120
+ - **`newTab`** — create a separate chat thread for this prompt.
121
+ - **`background`** — with `newTab`, run without focusing the new thread. The hidden run is tracked in `RunsTray`.
120
122
  - **`openSidebar`** — set to `false` for background/silent sends. Default opens the sidebar so the user sees the response.
121
123
  - **`type`** — `"content"` (default) keeps the work in the embedded app agent. `"code"` routes to the code-editing frame (for agent-written code changes, see [Frames](/docs/frames)).
122
124
 
@@ -12,7 +12,7 @@ By the end of this page, you'll have a working app — Mail, Calendar, Forms, or
12
12
  There are two ways to use agent-native, depending on how hands-on you want to be:
13
13
 
14
14
  - **You want to use a hosted version.** Try a template right now at [agent-native.com/templates](/templates). Each template is a live, hosted app — you sign in, start using it, and the agent is already there. No install, no setup. You can stop reading this page and head straight to the [template gallery](/templates).
15
- - **You want to run locally or customize it.** You'll clone a template, run it on your machine, and shape it however you want — branding, features, integrations. The rest of this page is for you. You'll need [Node.js 24 LTS](https://nodejs.org) and [pnpm](https://pnpm.io) installed.
15
+ - **You want to run locally or customize it.** You'll clone a template, run it on your machine, and shape it however you want — branding, features, integrations. The rest of this page is for you. You'll need [Node.js 22 or newer (LTS recommended)](https://nodejs.org) and [pnpm](https://pnpm.io) installed.
16
16
 
17
17
  Not sure which path? If you've never written code, the hosted version is for you. If you have a developer or AI coding tool ready, the local path gives you total control.
18
18
 
@@ -125,7 +125,7 @@ Each template is a complete app with UI, agent actions, database schema, and AI
125
125
  | [Assets](/docs/template-assets) | Brand asset libraries and generated media |
126
126
  | [Slides](/docs/template-slides) | Google Slides, Pitch |
127
127
  | [Video](/docs/template-videos) | Remotion-based video editing |
128
- | [Analytics](/docs/template-analytics) | Amplitude, Mixpanel, Looker |
128
+ | [Analytics](/docs/template-analytics) | Amplitude, Mixpanel |
129
129
  | [Mail](/docs/template-mail) | Superhuman, Gmail |
130
130
  | [Clips](/docs/template-clips) | Replaces Loom — screen + camera recording |
131
131
  | [Design](/docs/template-design) | HTML prototyping studios |
@@ -111,7 +111,7 @@ The UI never calls an LLM directly. When a user clicks "Generate chart" or "Writ
111
111
 
112
112
  ```ts
113
113
  // In a React component — delegate AI work to the agent
114
- import { sendToAgentChat } from "@agent-native/core";
114
+ import { sendToAgentChat } from "@agent-native/core/client";
115
115
 
116
116
  sendToAgentChat({
117
117
  message: "Generate a chart showing signups by source",
@@ -164,7 +164,7 @@ Database changes are synced to the UI through `useDbSync()`. Same-process writes
164
164
 
165
165
  ```ts
166
166
  // Client: subscribe to agent/UI data changes once near the app shell
167
- import { useDbSync } from "@agent-native/core";
167
+ import { useDbSync } from "@agent-native/core/client";
168
168
 
169
169
  useDbSync({ queryClient });
170
170
  ```
@@ -301,29 +301,71 @@ The agent can send messages on its own initiative (notifications, reminders, sch
301
301
  To add a new messaging platform, implement the `PlatformAdapter` interface:
302
302
 
303
303
  ```ts
304
- import type { PlatformAdapter } from "@agent-native/core/server";
304
+ import type { H3Event } from "h3";
305
+ import type {
306
+ PlatformAdapter,
307
+ IncomingMessage,
308
+ OutgoingMessage,
309
+ } from "@agent-native/core/server";
310
+ import type { EnvKeyConfig } from "@agent-native/core/server";
305
311
 
306
312
  const myAdapter: PlatformAdapter = {
307
313
  platform: "discord",
314
+ label: "Discord",
308
315
 
309
- // Verify the incoming webhook is authentic
310
- verifyRequest(request: Request): Promise<boolean> {
311
- // Validate signature headers
316
+ // Env keys this adapter needs (rendered in the settings UI)
317
+ getRequiredEnvKeys(): EnvKeyConfig[] {
318
+ return [
319
+ { key: "DISCORD_BOT_TOKEN", label: "Discord Bot Token", required: true },
320
+ ];
312
321
  },
313
322
 
314
- // Extract the message text and thread context
315
- parseMessage(body: unknown): Promise<{
316
- text: string;
317
- threadId: string;
318
- senderId: string;
319
- metadata?: Record<string, unknown>;
320
- }> {
321
- // Parse platform-specific payload
323
+ // Handle platform-specific verification challenges (e.g. Slack's
324
+ // url_verification). Return { handled: true, response } to short-circuit.
325
+ async handleVerification(event: H3Event) {
326
+ return { handled: false };
322
327
  },
323
328
 
324
- // Post the agent's response back
325
- sendResponse(threadId: string, text: string): Promise<void> {
326
- // Call the platform's API
329
+ // Validate the webhook request signature
330
+ async verifyWebhook(event: H3Event): Promise<boolean> {
331
+ // Validate signature headers; return true if authentic
332
+ return true;
333
+ },
334
+
335
+ // Parse the webhook payload into a normalized IncomingMessage.
336
+ // Return null to silently ignore the event (bot messages, edits, etc.).
337
+ async parseIncomingMessage(event: H3Event): Promise<IncomingMessage | null> {
338
+ return {
339
+ platform: "discord",
340
+ externalThreadId: "channel-or-thread-id",
341
+ text: "the user's message",
342
+ senderId: "discord-user-id",
343
+ platformContext: { channelId: "channel-id" },
344
+ timestamp: Date.now(),
345
+ };
346
+ },
347
+
348
+ // Format plain agent text into a platform-appropriate OutgoingMessage
349
+ formatAgentResponse(text: string): OutgoingMessage {
350
+ return { text, platformContext: {} };
351
+ },
352
+
353
+ // Post the agent's response back to the platform
354
+ async sendResponse(
355
+ message: OutgoingMessage,
356
+ context: IncomingMessage,
357
+ ): Promise<void> {
358
+ // Call the platform's API, using context.platformContext for routing
359
+ },
360
+
361
+ // Return current connection/configuration status for the settings UI
362
+ async getStatus() {
363
+ return {
364
+ platform: "discord",
365
+ label: "Discord",
366
+ enabled: true,
367
+ configured: !!process.env.DISCORD_BOT_TOKEN,
368
+ };
327
369
  },
328
370
  };
329
371
  ```
@@ -118,7 +118,7 @@ Drive the session with the standard run controls (`status`/`list`/`attach`/`logs
118
118
 
119
119
  ## Long-Running Goals
120
120
 
121
- The `/migrate` goal has an action named `run-migration-goal`. It advances a run in bounded iterations:
121
+ The `/migrate` goal advances a run in bounded iterations:
122
122
 
123
123
  - before approval, it can assess and plan but cannot write generated output
124
124
  - after approval, it scaffolds once, advances pending tasks, verifies, and records verifier results
@@ -142,7 +142,7 @@ Dispatch resources are scoped **All apps** (every app inherits them at runtime,
142
142
 
143
143
  ## Authentication and RBAC {#auth-and-rbac}
144
144
 
145
- Every agent-native app already ships with [Better Auth](/docs/authentication) and its organizations plugin — users, organizations, members, and the `owner` / `admin` / `member` roles are all first-class, shared across every template. In a workspace, you get that for free in every app, backed by the same database.
145
+ Every agent-native app already ships with [Better Auth](/docs/authentication) plus the framework's built-in organization system — users, organizations, members, and the `owner` / `admin` / `member` roles are all first-class, shared across every template. (Organizations are framework-managed via the `organizations` / `org_members` tables, not Better Auth's organization plugin, which is intentionally not registered.) In a workspace, you get that for free in every app, backed by the same database.
146
146
 
147
147
  For enterprise-specific rules (allow-list domains, SSO enforcement, extra role checks), export an `authPlugin` from `packages/shared/src/server/index.ts`. Every app in the workspace now enforces those rules.
148
148
 
@@ -9,7 +9,7 @@ Every agent-native app is multi-tenant by default. Organizations, team members,
9
9
 
10
10
  ## How it works {#how-it-works}
11
11
 
12
- The framework uses [Better Auth](https://better-auth.com)'s organizations plugin to provide full multi-tenancy:
12
+ The framework provides full multi-tenancy through its own built-in organization system — the core `org/` module backed by the `organizations` and `org_members` tables. (This is the framework's own system, not [Better Auth](https://better-auth.com)'s organization plugin, which is intentionally not registered.)
13
13
 
14
14
  - **Organizations** — users create organizations and invite team members. Each org is a fully isolated tenant.
15
15
  - **Roles** — every member has a role: `owner`, `admin`, or `member`. Actions can check roles for authorization.
@@ -20,22 +20,24 @@ All first-party templates (Mail, Calendar, Content, Brain, Assets, Slides, Video
20
20
 
21
21
  ## Organizations and members {#organizations-and-members}
22
22
 
23
- Users can create organizations, invite members by email, and assign roles:
23
+ Users can create organizations, invite members by email, and assign roles. The org-switcher and members UI drive this through the core org REST routes (no template code required):
24
+
25
+ ```text
26
+ POST /_agent-native/org # create an organization
27
+ POST /_agent-native/org/invitations # invite a member by email
28
+ ```
29
+
30
+ Server code can call the same surface directly through the `org/` module. `createOrganization(name, email, role?)` creates an org and adds the caller as a member; membership and roles live in the `org_members` table:
24
31
 
25
32
  ```typescript
26
- // Creating an org (from an action or the client)
27
- const org = await auth.api.createOrganization({
28
- body: { name: "Acme Inc", slug: "acme" },
29
- });
30
-
31
- // Inviting a member
32
- await auth.api.createInvitation({
33
- body: {
34
- organizationId: org.id,
35
- email: "alice@acme.com",
36
- role: "member", // "owner" | "admin" | "member"
37
- },
38
- });
33
+ import { createOrganization } from "@agent-native/core/org";
34
+
35
+ // Creating an org adds the caller (email) as a member with the given role
36
+ const org = await createOrganization(
37
+ "Acme Inc",
38
+ "alice@acme.com",
39
+ "owner", // "owner" | "admin" | "member", defaults to "owner"
40
+ );
39
41
  ```
40
42
 
41
43
  Org management is a **framework built-in**: the core org plugin auto-mounts REST routes under `/_agent-native/org/*` (create org, switch org, list/invite/remove members, change roles, set allowed email domain), and these back the org-switcher and members UI in every template with no extra code. Agent-callable actions with names like `create-organization` or `invite-member` are **template-authored** on top of this surface, not built-in tools — a template wires its own `defineAction` wrappers when it wants the agent to manage its specific membership model.