@agent-native/core 0.37.2 → 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 -0
  24. package/dist/cli/skills.d.ts.map +1 -1
  25. package/dist/cli/skills.js +1349 -544
  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
@@ -3,6 +3,8 @@ name: adding-a-feature
3
3
  description: >-
4
4
  The four-area checklist every new feature must complete. Use when adding any
5
5
  feature, integration, or capability to ensure the agent and UI stay in parity.
6
+ metadata:
7
+ internal: true
6
8
  ---
7
9
 
8
10
  # Adding a Feature — The Four-Area Checklist
@@ -21,7 +23,7 @@ When you add a new feature, work through these four areas in order:
21
23
 
22
24
  ### 1. UI Component
23
25
 
24
- Build the user-facing interface — a page, component, dialog, or route. Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` to call actions for data fetching and mutations you rarely need custom `/api/` routes.
26
+ Build the user-facing interface — a page, component, dialog, or route. Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` to call actions for data fetching and mutations. Do not create a custom REST endpoint just so React can call action-backed data; the action endpoint already exists.
25
27
 
26
28
  **Auto-refresh on agent writes is non-negotiable** — when the agent mutates data, the UI must reflect the change without a manual refresh. There are two paths, and you must pick the right one:
27
29
 
@@ -44,12 +46,45 @@ Build the user-facing interface — a page, component, dialog, or route. Use `us
44
46
 
45
47
  ### 2. Action
46
48
 
47
- Create an action in `actions/` using `defineAction`. This serves double duty: the agent calls it as a tool, and the framework auto-exposes it as an HTTP endpoint at `/_agent-native/actions/:name` for the UI to call. Set `http: { method: "GET" }` for read actions, leave default for writes, or set `http: false` for agent-only actions like `navigate` and `view-screen`.
49
+ Create an action in `actions/` using `defineAction`. This serves double duty: the agent calls it as a tool, and the UI calls it through `useActionQuery` / `useActionMutation` while the framework owns the HTTP transport. Set `http: { method: "GET" }` for read actions, leave default for writes, or set `http: false` for agent-only actions like `navigate` and `view-screen`.
50
+
51
+ Before adding a new route or endpoint, inspect the existing actions. Reuse an
52
+ action if it already covers the business operation, extend it if the shared
53
+ contract is incomplete, or create a new `defineAction` if the agent and UI both
54
+ need the capability. Do not add pass-through `/api/*` routes that re-export
55
+ actions. If client code needs a new framework/app route, expose a named helper
56
+ or hook first and use that helper from components and docs.
57
+
58
+ For provider-backed analysis/query/reporting integrations, do not turn every
59
+ provider endpoint or filter into a rigid action. Prefer the shared
60
+ `provider-api-catalog` / `provider-api-docs` / `provider-api-request` pattern
61
+ from `@agent-native/core/provider-api`, then add narrow convenience actions only
62
+ for workflows that truly deserve a first-class shortcut.
63
+
64
+ If the feature needs credentials, design the credential path in the same change.
65
+ Never hardcode API keys, tokens, webhook URLs, signing secrets, private
66
+ Builder/internal data, or customer data in the action, UI, seed data, fixtures,
67
+ docs, prompts, or generated extension/app content. Register required secrets,
68
+ use OAuth helpers, or read scoped values from the vault/credential store.
69
+
70
+ **If the action produces or lists a navigable resource**, add a `link` builder that returns `{ url: buildDeepLink({ app, view, params }), label }`. External coding agents and MCP hosts (Claude / ChatGPT / Claude Code / Cowork / Codex, over MCP/A2A) then surface an "Open in … →" deep link that drops the user back into the running UI focused on the record — for free. If a compatible MCP host should render an inline review/edit surface, also add `mcpApp` with `embedApp()` so the action embeds the real React app route instead of a one-off HTML UI. The `link` builder and `mcpApp` metadata must be pure and synchronous (no I/O). Any external-agent read/ingest action must be `http: { method: "GET" }` + `readOnly: true` + `publicAgent: { expose: true, readOnly: true, requiresAuth: true }`. See the `external-agents` skill.
48
71
 
49
72
  ### 3. Skills / Instructions
50
73
 
51
74
  Update `AGENTS.md` and/or create a skill in `.agents/skills/` if the feature introduces patterns the agent needs to know. At minimum, add the new actions to the action table in the template's `AGENTS.md`.
52
75
 
76
+ Reusable actions are part of the app contract, not just implementation detail. When an action is useful outside one screen, update agent instructions in the same change so app agents know when to call it, which arguments matter, and what output to preserve. If the capability is workflow-heavy, cross-app, provider-backed, or has a non-obvious sequence of actions, add or update a skill instead of burying the behavior in one long `AGENTS.md` paragraph.
77
+
78
+ Instruction examples may name secret keys like `SLACK_WEBHOOK`, but must use
79
+ placeholders such as `${keys.SLACK_WEBHOOK}` or `<SLACK_WEBHOOK>`. Do not paste
80
+ real keys, internal data, or customer data into instructions as examples.
81
+
82
+ For app-backed skills, declare skill visibility in the app-skill manifest:
83
+
84
+ - `internal` — only the app's own agents should use it.
85
+ - `exported` — marketplace installs receive it, but the app does not need it loaded internally.
86
+ - `both` — shared between the app's internal agents and exported marketplace bundles.
87
+
53
88
  ### 4. Application State Sync
54
89
 
55
90
  Expose navigation and selection state so the agent knows what the user is looking at. Write to the `navigation` app-state key on route changes. Update the `view-screen` action to fetch relevant data for the new feature. Add a `navigate` command if the agent needs to open the new view.
@@ -100,7 +135,10 @@ See the "Client-Side Routing" section in the root `CLAUDE.md` for full details.
100
135
  - **Per-route `<AppLayout>` wrappers** — Every route file wraps its content in `<AppLayout>` or `<Layout>`. React sees a different component at the outlet on each nav and unmounts the whole shell, causing the agent sidebar to reload on every click. Mount the shell once above `<Outlet />` (root.tsx or `_app.tsx` pathless layout).
101
136
  - **UI without actions** — The user can create forms but the agent cannot. The agent says "I don't have access to that" when it should be able to do it.
102
137
  - **Actions without AGENTS.md** — The actions exist but the agent doesn't know about them because they're not documented. The agent reinvents solutions instead of using the actions.
103
- - **Duplicate API routes** — Creating `/api/` routes for operations that actions already handle. Actions are auto-exposed as HTTP endpoints use `useActionQuery`/`useActionMutation` instead.
138
+ - **Duplicate API routes** — Creating `/api/` routes for operations that actions already handle, including pass-through routes that just call or repackage an action. Use `useActionQuery`/`useActionMutation` instead.
139
+ - **Raw client route calls** — Teaching or adding `fetch("/_agent-native/...")`,
140
+ `fetch(agentNativePath(...))`, or template `/api/*` calls in components for
141
+ normal app work. Add a named client helper/hook and call that instead.
104
142
  - **Features without app-state** — The agent cannot see that the user is looking at a specific form, email, or chart. It asks "which one?" instead of acting on the current selection.
105
143
  - **Actions without UI** — The agent can do something the user cannot. This is less common but still breaks parity.
106
144
 
@@ -113,6 +151,9 @@ After completing all four areas, verify:
113
151
  3. Does `pnpm action view-screen` show the relevant state when the user is using the feature?
114
152
  4. Can the agent navigate to the feature view via the `navigate` action?
115
153
  5. Is the feature documented in AGENTS.md with action names and args?
154
+ 6. Are credentials and sensitive data supplied only through approved runtime
155
+ channels, with no hardcoded real keys, tokens, webhook URLs, Builder/internal
156
+ data, or customer data?
116
157
 
117
158
  ## One more area — sharing
118
159
 
@@ -125,6 +166,7 @@ TL;DR: spread `ownableColumns()` into the resource table, pair it with `createSh
125
166
  - **sharing** — How to make a new resource ownable (private by default, share with users/orgs/public)
126
167
  - **context-awareness** — How to expose UI state to the agent (area 4 in detail)
127
168
  - **actions** — How to create actions with `defineAction` and the `http` option (area 2 in detail)
169
+ - **external-agents** — Add a `link` builder so external agents (MCP/A2A) get an "Open in … →" deep link
128
170
  - **create-skill** — How to create skills for new patterns (area 3 in detail)
129
171
  - **storing-data** — Where to store the feature's data
130
172
  - **real-time-sync** — How the UI stays in sync when the agent writes data
@@ -4,6 +4,8 @@ description: >-
4
4
  Triage feedback docs or pasted feedback into bugs to fix, UX suggestions to
5
5
  propose, unclear questions, and skipped noise; verify bugs, check Sentry when
6
6
  relevant, and keep UI changes minimal.
7
+ metadata:
8
+ internal: true
7
9
  ---
8
10
 
9
11
  # Address Feedback
@@ -4,6 +4,8 @@ description: >-
4
4
  How auth works in agent-native apps. Use when wiring login/signup,
5
5
  configuring auth modes, setting up organizations, protecting routes, or
6
6
  debugging session issues.
7
+ metadata:
8
+ internal: true
7
9
  ---
8
10
 
9
11
  # Authentication
@@ -20,7 +22,7 @@ Auth is powered by **Better Auth** with account-first design. Every new user cre
20
22
  | **Production (default)** | Better Auth with email/password + social providers (Google, GitHub). Organizations built in. |
21
23
  | **`AUTH_MODE=local`** | **Not** a browser auth bypass, and never returns `local@localhost`. It only affects CLI/agent identity: it lets `pnpm action` / the local agent loop auto-bind to the single real signed-in dev user from the `sessions` table (see `scripts/dev-session.ts`). Browser login is unchanged. |
22
24
  | **`AUTH_SKIP_EMAIL_VERIFICATION=1`** | QA/preview escape hatch for real email/password accounts. Signup skips email verification and does not send the signup verification email. Local dev/test skips verification by default; set `AUTH_SKIP_EMAIL_VERIFICATION=0` only when testing verification itself. Use `+qa` emails for test accounts. |
23
- | **`ACCESS_TOKEN` / `ACCESS_TOKENS`** | Simple token-based auth for production deployments. |
25
+ | **`ACCESS_TOKEN` / `ACCESS_TOKENS`** | Static bearer fallback for MCP/connect clients that cannot use OAuth. Not browser auth and never a token login page. |
24
26
  | **`AUTH_DISABLED=true`** | Skip auth entirely (for apps behind infrastructure-level auth like Cloudflare Access). |
25
27
  | **Custom** | Pass your own `getSession` to `autoMountAuth(app, { getSession })`. |
26
28
 
@@ -31,6 +33,22 @@ Auth is powered by **Better Auth** with account-first design. Every new user cre
31
33
  > When there is no session, **throw or return 401** — never substitute a
32
34
  > sentinel. Enforced by `scripts/guard-no-localhost-fallback.mjs`.
33
35
 
36
+ ## Remote MCP OAuth
37
+
38
+ Every app's `/_agent-native/mcp` endpoint is also a standard protected MCP
39
+ resource. OAuth-capable hosts connect with the remote MCP URL only, receive a
40
+ `WWW-Authenticate` challenge, discover `/.well-known/oauth-protected-resource`
41
+ and `/.well-known/oauth-authorization-server`, dynamically register a public
42
+ client, and complete authorization-code + PKCE at
43
+ `/_agent-native/mcp/oauth/authorize` / `/_agent-native/mcp/oauth/token`.
44
+ Access tokens are audience-bound to the exact MCP URL and carry user/org
45
+ identity plus `mcp:read`, `mcp:write`, and/or `mcp:apps`; refresh tokens are
46
+ stored hashed and rotate. Keep `ACCESS_TOKEN` and `agent-native connect` for
47
+ local stdio proxying and fallback clients. The CLI
48
+ uses the OAuth-native URL-only entry for Claude Code/Claude Code CLI by
49
+ default; use the Connect page or `agent-native connect --token <token>` when a
50
+ client needs explicit bearer headers.
51
+
34
52
  ## Local → Real Account Migration
35
53
 
36
54
  Upgrading from `local@localhost` to a real account preserves SQL-backed workspace data. The built-in migration moves `application_state`, user-scoped `settings`, `oauth_tokens`, and any template table that uses `owner_email`.
@@ -39,9 +57,9 @@ Templates with legacy global settings can provide `POST /api/local-migration` fo
39
57
 
40
58
  ## Organizations
41
59
 
42
- Better Auth's organization plugin is built in. Every app supports creating orgs, inviting members, and role-based access (owner/admin/member).
60
+ Organizations are **framework-managed**, not handled by Better Auth's organization plugin (which is intentionally NOT registered). Org data lives in the framework's own `organizations`, `org_members`, and `org_invitations` tables. Every app supports creating orgs, inviting members, and role-based access (owner/admin/member).
43
61
 
44
- The active org flows automatically: `session.orgId` → `AGENT_ORG_ID` → SQL scoping (see `security` skill).
62
+ The active org flows automatically: `session.orgId` — resolved by `getOrgContext` from `org_members` plus the user's `active-org-id` setting (_not_ from a Better Auth session field) — → `AGENT_ORG_ID` → SQL scoping (see `security` skill).
45
63
 
46
64
  **If your template requires an org to function** (data is scoped by `organization_id`, core features can't run without one), set `AUTO_CREATE_DEFAULT_ORG=1` in your `.env`. The framework will auto-create a default org (named after the user) on first login when no memberships exist. This happens inside `getOrgContext` — no template integration needed.
47
65
 
@@ -55,13 +73,27 @@ Set `A2A_SECRET` (same value) on all apps that must verify each other's identity
55
73
  - Inbound calls are verified cryptographically
56
74
  - Without `A2A_SECRET`, A2A calls are unauthenticated (fine for local dev)
57
75
 
76
+ ## Cross-App SSO (Dispatch identity hub)
77
+
78
+ Each hosted `*.agent-native.com` app has its **own user store**, so "sign in once" is identity federation, not a shared cookie. **Dispatch is the identity authority.**
79
+
80
+ - **Opt-in per app via one env var:** set `AGENT_NATIVE_IDENTITY_HUB_URL=https://dispatch.agent-native.com` and the app shows a "Sign in with Agent-Native" option. **Unset = zero behavior change** — the whole path is dormant. Reversible at any time.
81
+ - **Flow:** app → `GET <hub>/_agent-native/identity/authorize?app=&redirect_uri=&state=` → user logs in at Dispatch → 302 back with a short-lived (`≤5min`) `A2A_SECRET`-signed identity JWT (`sub`/`email`/`name`/`org_domain`/`scope:"identity"`). Strict `redirect_uri` allowlist (`*.agent-native.com` + localhost). App verifies the token, **JIT-links strictly by verified email** (existing same-email user → reused unchanged; new email → created), then mints a normal local session.
82
+ - **Invariant (do not break):** identity rows are only ever **added** — never modified, renamed, or deleted. Enabling SSO logs users out, but they always log back into the **same email-matched account with data intact**. Email is the only thing that crosses the trust boundary; the app never trusts a user id, role, or org from the wire.
83
+ - **Canary rollout:** deploy with the env unset everywhere (no-op) → set it on **one** app (mail) only → verify (logout → SSO → Dispatch → back to the same pre-existing account, data intact, direct logins still work) → expand app-by-app → rollback = unset the env on that app's deploy (instant, no data change).
84
+
85
+ Full runbook + flow detail: [Cross-App SSO doc](/docs/cross-app-sso).
86
+
58
87
  ## Builder Browser Access
59
88
 
60
89
  Apps can connect to Builder via the `cli-auth` flow and persist shared browser credentials in `.env`. Agents then use the built-in `get-browser-connection` tool to provision a real browser session via AI Services.
61
90
 
62
91
  ## Protecting Custom Routes
63
92
 
64
- Actions are auto-protected. For custom `/api/` routes:
93
+ Actions are auto-protected. Do not create custom `/api/` routes for normal
94
+ CRUD, data queries, or action-backed operations; use `defineAction` and the
95
+ auto-mounted action endpoint instead. If a route-only concern forces a custom
96
+ route:
65
97
 
66
98
  ```ts
67
99
  import { getSession } from "@agent-native/core/server";
@@ -93,3 +125,4 @@ Bookmarked private paths already work without any plumbing — the framework's l
93
125
 
94
126
  - `security` — Data scoping, SQL injection, secrets
95
127
  - `actions` — Auto-protected by the auth guard
128
+ - [Cross-App SSO doc](/docs/cross-app-sso) — Dispatch identity hub, federation flow, canary runbook
@@ -4,6 +4,8 @@ description: >-
4
4
  Event-triggered and schedule-triggered automations with natural-language
5
5
  conditions. Use when creating automations, wiring events, or understanding
6
6
  how triggers fire.
7
+ metadata:
8
+ internal: true
7
9
  ---
8
10
 
9
11
  # Automations
@@ -42,7 +44,7 @@ event: calendar.booking.created
42
44
  condition: "attendee email ends with @example.com"
43
45
  mode: agentic
44
46
  domain: calendar
45
- createdBy: owner@example.com
47
+ createdBy: user@example.com
46
48
  runAs: creator
47
49
  ---
48
50
 
@@ -109,7 +111,7 @@ emit("calendar.booking.created", {
109
111
  bookingId: "abc",
110
112
  attendeeEmail: "jane@co.com",
111
113
  startTime: "2025-01-15T10:00:00Z",
112
- }, { owner: "owner@example.com" });
114
+ }, { owner: "user@example.com" });
113
115
  ```
114
116
 
115
117
  ### Built-in Events
@@ -134,7 +136,7 @@ emit("calendar.booking.created", {
134
136
 
135
137
  ## Condition Evaluator
136
138
 
137
- When an automation has a `condition`, the dispatcher calls Haiku (claude-haiku-4-5) to classify whether the event payload satisfies the condition. This is a yes/no classification, not a generation task.
139
+ When an automation has a `condition`, the dispatcher calls the configured fast/classification model to classify whether the event payload satisfies the condition. This is a yes/no classification, not a generation task. The exact model ID lives in `condition-evaluator.ts`.
138
140
 
139
141
  - Empty or missing condition = unconditional (always fires).
140
142
  - Results are memoized (SHA-256 of condition + payload) with a 5-minute TTL and 500-entry LRU cache.
@@ -149,6 +151,9 @@ Automations use the `web-request` tool for outbound HTTP. It supports `${keys.NA
149
151
  - Each key can have a URL allowlist that restricts which origins the key can be sent to.
150
152
  - `resolveKeyReferences()` resolves placeholders, falling back from user scope to workspace scope.
151
153
  - `validateUrlAllowlist()` checks the resolved URL against per-key allowlists (origin-level matching).
154
+ - Automation definitions, examples, event payloads, and prompts must not
155
+ hardcode real API keys, webhook URLs, tokens, private Builder/internal data, or
156
+ customer data. Use `${keys.NAME}` and synthetic `example.com` identities.
152
157
 
153
158
  ## UI
154
159
 
@@ -163,7 +168,7 @@ Agent flow:
163
168
  1. Calls `manage-automations` with `action=list-events` to find `calendar.booking.created`.
164
169
  2. Confirms the plan with the user.
165
170
  3. Calls `manage-automations` with `action=define`:
166
- - `name`: `slack-on-builder-booking`
171
+ - `name`: `slack-on-example-booking`
167
172
  - `trigger_type`: `event`
168
173
  - `event`: `calendar.booking.created`
169
174
  - `condition`: `attendee email ends with @example.com`
@@ -5,6 +5,8 @@ description: >-
5
5
  user gives feedback, shares preferences, corrects a mistake, or when you
6
6
  discover something worth remembering for future conversations.
7
7
  user-invocable: false
8
+ metadata:
9
+ internal: true
8
10
  ---
9
11
 
10
12
  # Capture Learnings
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: client-methods
3
+ description: >-
4
+ Client method surface rules. Use when wiring browser/client code to actions,
5
+ application state, framework routes, app APIs, uploads, auth, or settings.
6
+ metadata:
7
+ internal: true
8
+ ---
9
+
10
+ # Client Methods
11
+
12
+ ## Rule
13
+
14
+ Browser/client code imports named methods, hooks, or client modules instead of
15
+ hand-writing REST calls to framework or app routes.
16
+
17
+ ## Why
18
+
19
+ Route shapes are transport details. If components and docs call
20
+ `fetch("/_agent-native/...")` or template `/api/*` routes directly, every caller
21
+ has to rediscover auth, base paths, request-source headers, JSON parsing, error
22
+ handling, optimistic updates, sync invalidation, and route quirks. A named client
23
+ method gives the UI, docs, and future agents one stable contract.
24
+
25
+ ## How
26
+
27
+ 1. Look for an existing client API first.
28
+
29
+ | Need | Use |
30
+ | --- | --- |
31
+ | App action reads/writes | `useActionQuery` / `useActionMutation` from `@agent-native/core/client` |
32
+ | Imperative action calls | `callAction` from `@agent-native/core/client` |
33
+ | Browser application state | `readClientAppState`, `writeClientAppState`, `setClientAppState`, `deleteClientAppState` |
34
+ | Navigation/app-state sync | `useAgentRouteState` / `useSemanticNavigationState` from `@agent-native/core/client` |
35
+ | Agent chat context | Agent chat client helpers from `@agent-native/core/client` |
36
+ | Ask the user a multiple-choice question from app code | `askUserQuestion` from `@agent-native/core/client` (renders inline in the agent panel; answer goes to the agent — do not build a custom modal) |
37
+ | Live sync | `useDbSync`, `useChangeVersion`, `useChangeVersions` |
38
+ | Extension iframe calls | `appAction`, `appFetch`, `extensionFetch` from the extension runtime |
39
+
40
+ 2. If no client API exists, add the narrowest helper at the boundary.
41
+
42
+ - Put shared framework helpers in `packages/core/src/client/*`.
43
+ - Put template-local helpers in `templates/<app>/app/hooks/*`,
44
+ `templates/<app>/app/lib/*`, or an existing local client module.
45
+ - Export reusable core helpers from `@agent-native/core/client`; add a leaf
46
+ export when callers may need to avoid the broad barrel.
47
+ - Keep raw `fetch`, `agentNativePath`, and route paths inside that helper,
48
+ not scattered through components or docs.
49
+ - Add focused tests for URL construction, headers, response parsing, error
50
+ shape, and any sync invalidation.
51
+
52
+ 3. Teach the helper, not the route.
53
+
54
+ Docs, skills, examples, and generated code should show:
55
+
56
+ ```ts
57
+ await setClientAppState("selection", selection, { keepalive: true });
58
+ ```
59
+
60
+ not:
61
+
62
+ ```ts
63
+ await fetch("/_agent-native/application-state/selection", {
64
+ method: "PUT",
65
+ body: JSON.stringify(selection),
66
+ });
67
+ ```
68
+
69
+ ## Exceptions
70
+
71
+ Raw route calls are acceptable only inside low-level client helpers or for
72
+ route-shaped protocols that cannot be hidden cleanly:
73
+
74
+ - multipart uploads
75
+ - streaming/SSE/WebSocket transports
76
+ - OAuth redirects and callback URL construction
77
+ - webhooks and external provider callbacks
78
+ - extension sandbox `appFetch` / `extensionFetch`, which are themselves exposed
79
+ client methods
80
+ - tests that assert route construction
81
+
82
+ Even for exceptions, prefer a named helper as soon as more than one caller needs
83
+ the behavior.
84
+
85
+ ## Don't
86
+
87
+ - Don't put `fetch("/_agent-native/...")`, `fetch(agentNativePath(...))`, or
88
+ template `/api/*` calls directly in React components for normal app data,
89
+ actions, settings, or application state.
90
+ - Don't document route calls as the way client code should do work.
91
+ - Don't add pass-through `/api/*` routes just to make client fetches look
92
+ simpler; expose an action and call it with action hooks.
93
+ - Don't duplicate auth/session/base-path/request-source/error parsing logic in
94
+ every component.
95
+
96
+ ## Related Skills
97
+
98
+ - `actions` — app operations shared by UI and agent.
99
+ - `context-awareness` — application-state navigation and selection helpers.
100
+ - `real-time-sync` — keeping helper-backed UI reads fresh.
101
+ - `server-plugins` — when a new route is actually warranted.
102
+
103
+ ## References
104
+
105
+ - `references/legacy-client-fetch-audit-2026-06-03.md` — known legacy cleanup
106
+ targets found when this rule was added.
@@ -0,0 +1,53 @@
1
+ # Legacy Client Fetch Audit (2026-06-03)
2
+
3
+ These are known legacy client-side route calls found while adding the
4
+ `client-methods` rule. Treat them as cleanup targets when editing the relevant
5
+ area. Do not migrate them mechanically without reading the local action/data
6
+ contracts; some need new actions or helper modules first.
7
+
8
+ ## Highest Priority
9
+
10
+ - `templates/analytics/app/pages/analyses/AnalysesList.tsx`,
11
+ `templates/analytics/app/pages/analyses/AnalysisDetail.tsx`,
12
+ `templates/analytics/app/components/layout/Sidebar.tsx`, and
13
+ `templates/analytics/app/components/layout/CommandPalette.tsx` use `/api/*`
14
+ for normal app data. `list-analyses` and `get-analysis` already exist; add
15
+ action-backed hooks/helpers for dashboard, explorer, theme, and user-pref
16
+ routes.
17
+ - `templates/slides/app/context/DeckContext.tsx` and
18
+ `templates/slides/app/pages/Presentation.tsx` use `/api/decks` for deck CRUD.
19
+ `list-decks` and `get-deck` already exist; add or expose UI-safe actions for
20
+ upsert/delete flows before migrating.
21
+ - `templates/mail/app/hooks/use-emails.ts`,
22
+ `templates/mail/app/hooks/use-scheduled-jobs.ts`,
23
+ `templates/mail/app/hooks/use-automations.ts`, and
24
+ `templates/mail/app/pages/SettingsPage.tsx` still use `/api/*` for normal
25
+ email/settings/automation work. Reuse existing actions where possible and add
26
+ missing structured actions for aliases, scheduled jobs, and automation
27
+ settings.
28
+ - `templates/calendar/app/hooks/use-events.ts` bypasses existing private event
29
+ actions for event CRUD. Prefer `get-event`, `update-event`, `delete-event`,
30
+ and `rsvp-event` through action hooks or `callAction`.
31
+
32
+ ## Medium Priority
33
+
34
+ - Raw action endpoint calls remain in several client flows, including Gmail
35
+ filters, calendar people search, slides import, videos composition generation,
36
+ and design variant flow. Prefer hooks or `callAction`.
37
+ - Template navigation hooks duplicate application-state fetch logic. Prefer
38
+ `setClientAppState`, `readClientAppState`, `deleteClientAppState`, or a shared
39
+ navigation-state helper.
40
+ - Mail integration credentials are written through application state in
41
+ `templates/mail/app/hooks/use-integrations.ts` and `use-apollo.ts`; move
42
+ credential values to secrets/actions instead of browser-readable app-state.
43
+ - Content comments and versions are partially migrated. Add missing actions such
44
+ as `resolve-comment`, `delete-comment`, `list-document-versions`, and
45
+ `restore-document-version`.
46
+
47
+ ## Acceptable Exceptions
48
+
49
+ Uploads/file transfer, exports, public/anonymous pages, OAuth/auth redirects,
50
+ webhooks/tracking endpoints, media/blob routes, collab text endpoints,
51
+ framework setup/status routes, low-level core helper implementations, and the
52
+ extension bridge `appFetch` / `extensionFetch` can be route-shaped protocols.
53
+ Prefer named helpers when more than one caller needs the behavior.
@@ -4,6 +4,8 @@ description: >-
4
4
  How to add routes without remounting the app shell. Use when adding a new
5
5
  route, fixing agent sidebar reloads on navigation, or choosing between
6
6
  `root.tsx` layout and pathless `_app.tsx` layout patterns.
7
+ metadata:
8
+ internal: true
7
9
  ---
8
10
 
9
11
  # Client-Side Routing