@agent-native/core 0.6.1 → 0.7.1

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 (473) hide show
  1. package/README.md +43 -3
  2. package/dist/agent/production-agent.d.ts.map +1 -1
  3. package/dist/agent/production-agent.js +154 -4
  4. package/dist/agent/production-agent.js.map +1 -1
  5. package/dist/agent/types.d.ts +1 -1
  6. package/dist/agent/types.d.ts.map +1 -1
  7. package/dist/cli/create-workspace.d.ts +8 -0
  8. package/dist/cli/create-workspace.d.ts.map +1 -0
  9. package/dist/cli/create-workspace.js +18 -0
  10. package/dist/cli/create-workspace.js.map +1 -0
  11. package/dist/cli/create.d.ts +35 -7
  12. package/dist/cli/create.d.ts.map +1 -1
  13. package/dist/cli/create.js +444 -251
  14. package/dist/cli/create.js.map +1 -1
  15. package/dist/cli/index.js +59 -5
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/cli/workspacify.d.ts +18 -0
  18. package/dist/cli/workspacify.d.ts.map +1 -0
  19. package/dist/cli/workspacify.js +74 -0
  20. package/dist/cli/workspacify.js.map +1 -0
  21. package/dist/client/AgentPanel.d.ts +1 -1
  22. package/dist/client/AgentPanel.d.ts.map +1 -1
  23. package/dist/client/AgentPanel.js +63 -225
  24. package/dist/client/AgentPanel.js.map +1 -1
  25. package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
  26. package/dist/client/components/CodeRequiredDialog.js +86 -5
  27. package/dist/client/components/CodeRequiredDialog.js.map +1 -1
  28. package/dist/client/composer/MentionPopover.d.ts.map +1 -1
  29. package/dist/client/composer/MentionPopover.js +15 -2
  30. package/dist/client/composer/MentionPopover.js.map +1 -1
  31. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  32. package/dist/client/composer/TiptapComposer.js +3 -1
  33. package/dist/client/composer/TiptapComposer.js.map +1 -1
  34. package/dist/client/composer/types.d.ts +1 -1
  35. package/dist/client/composer/types.d.ts.map +1 -1
  36. package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
  37. package/dist/client/integrations/IntegrationsPanel.js +22 -9
  38. package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
  39. package/dist/client/onboarding/OnboardingBanner.d.ts +13 -0
  40. package/dist/client/onboarding/OnboardingBanner.d.ts.map +1 -0
  41. package/dist/client/onboarding/OnboardingBanner.js +36 -0
  42. package/dist/client/onboarding/OnboardingBanner.js.map +1 -0
  43. package/dist/client/onboarding/OnboardingPanel.d.ts +16 -0
  44. package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -0
  45. package/dist/client/onboarding/OnboardingPanel.js +360 -0
  46. package/dist/client/onboarding/OnboardingPanel.js.map +1 -0
  47. package/dist/client/onboarding/SetupButton.d.ts +10 -0
  48. package/dist/client/onboarding/SetupButton.d.ts.map +1 -0
  49. package/dist/client/onboarding/SetupButton.js +26 -0
  50. package/dist/client/onboarding/SetupButton.js.map +1 -0
  51. package/dist/client/onboarding/index.d.ts +12 -0
  52. package/dist/client/onboarding/index.d.ts.map +1 -0
  53. package/dist/client/onboarding/index.js +11 -0
  54. package/dist/client/onboarding/index.js.map +1 -0
  55. package/dist/client/onboarding/use-onboarding.d.ts +34 -0
  56. package/dist/client/onboarding/use-onboarding.d.ts.map +1 -0
  57. package/dist/client/onboarding/use-onboarding.js +101 -0
  58. package/dist/client/onboarding/use-onboarding.js.map +1 -0
  59. package/dist/client/org/TeamPage.d.ts +6 -1
  60. package/dist/client/org/TeamPage.d.ts.map +1 -1
  61. package/dist/client/org/TeamPage.js +85 -14
  62. package/dist/client/org/TeamPage.js.map +1 -1
  63. package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
  64. package/dist/client/resources/ResourceEditor.js +48 -77
  65. package/dist/client/resources/ResourceEditor.js.map +1 -1
  66. package/dist/client/resources/ResourceTree.d.ts.map +1 -1
  67. package/dist/client/resources/ResourceTree.js +16 -3
  68. package/dist/client/resources/ResourceTree.js.map +1 -1
  69. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
  70. package/dist/client/resources/ResourcesPanel.js +135 -9
  71. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  72. package/dist/client/resources/use-resources.d.ts +5 -0
  73. package/dist/client/resources/use-resources.d.ts.map +1 -1
  74. package/dist/client/resources/use-resources.js.map +1 -1
  75. package/dist/client/settings/AgentsSection.d.ts +2 -0
  76. package/dist/client/settings/AgentsSection.d.ts.map +1 -0
  77. package/dist/client/settings/AgentsSection.js +198 -0
  78. package/dist/client/settings/AgentsSection.js.map +1 -0
  79. package/dist/client/settings/BackgroundAgentSection.d.ts +2 -0
  80. package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -0
  81. package/dist/client/settings/BackgroundAgentSection.js +46 -0
  82. package/dist/client/settings/BackgroundAgentSection.js.map +1 -0
  83. package/dist/client/settings/BrowserSection.d.ts +2 -0
  84. package/dist/client/settings/BrowserSection.d.ts.map +1 -0
  85. package/dist/client/settings/BrowserSection.js +10 -0
  86. package/dist/client/settings/BrowserSection.js.map +1 -0
  87. package/dist/client/settings/ComingSoonSection.d.ts +13 -0
  88. package/dist/client/settings/ComingSoonSection.d.ts.map +1 -0
  89. package/dist/client/settings/ComingSoonSection.js +9 -0
  90. package/dist/client/settings/ComingSoonSection.js.map +1 -0
  91. package/dist/client/settings/LLMSection.d.ts +2 -0
  92. package/dist/client/settings/LLMSection.d.ts.map +1 -0
  93. package/dist/client/settings/LLMSection.js +64 -0
  94. package/dist/client/settings/LLMSection.js.map +1 -0
  95. package/dist/client/settings/SettingsPanel.d.ts +8 -0
  96. package/dist/client/settings/SettingsPanel.d.ts.map +1 -0
  97. package/dist/client/settings/SettingsPanel.js +118 -0
  98. package/dist/client/settings/SettingsPanel.js.map +1 -0
  99. package/dist/client/settings/SettingsSection.d.ts +19 -0
  100. package/dist/client/settings/SettingsSection.d.ts.map +1 -0
  101. package/dist/client/settings/SettingsSection.js +10 -0
  102. package/dist/client/settings/SettingsSection.js.map +1 -0
  103. package/dist/client/settings/index.d.ts +3 -0
  104. package/dist/client/settings/index.d.ts.map +1 -0
  105. package/dist/client/settings/index.js +3 -0
  106. package/dist/client/settings/index.js.map +1 -0
  107. package/dist/client/settings/useBuilderStatus.d.ts +22 -0
  108. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -0
  109. package/dist/client/settings/useBuilderStatus.js +41 -0
  110. package/dist/client/settings/useBuilderStatus.js.map +1 -0
  111. package/dist/deploy/build.js +198 -54
  112. package/dist/deploy/build.js.map +1 -1
  113. package/dist/deploy/route-discovery.d.ts +5 -0
  114. package/dist/deploy/route-discovery.d.ts.map +1 -1
  115. package/dist/deploy/route-discovery.js +38 -7
  116. package/dist/deploy/route-discovery.js.map +1 -1
  117. package/dist/deploy/workspace-core.d.ts +28 -0
  118. package/dist/deploy/workspace-core.d.ts.map +1 -0
  119. package/dist/deploy/workspace-core.js +223 -0
  120. package/dist/deploy/workspace-core.js.map +1 -0
  121. package/dist/deploy/workspace-deploy.d.ts +11 -0
  122. package/dist/deploy/workspace-deploy.d.ts.map +1 -0
  123. package/dist/deploy/workspace-deploy.js +148 -0
  124. package/dist/deploy/workspace-deploy.js.map +1 -0
  125. package/dist/file-upload/builder.d.ts +11 -0
  126. package/dist/file-upload/builder.d.ts.map +1 -0
  127. package/dist/file-upload/builder.js +53 -0
  128. package/dist/file-upload/builder.js.map +1 -0
  129. package/dist/file-upload/index.d.ts +4 -0
  130. package/dist/file-upload/index.d.ts.map +1 -0
  131. package/dist/file-upload/index.js +3 -0
  132. package/dist/file-upload/index.js.map +1 -0
  133. package/dist/file-upload/registry.d.ts +23 -0
  134. package/dist/file-upload/registry.d.ts.map +1 -0
  135. package/dist/file-upload/registry.js +52 -0
  136. package/dist/file-upload/registry.js.map +1 -0
  137. package/dist/file-upload/types.d.ts +37 -0
  138. package/dist/file-upload/types.d.ts.map +1 -0
  139. package/dist/file-upload/types.js +10 -0
  140. package/dist/file-upload/types.js.map +1 -0
  141. package/dist/integrations/adapters/google-docs.d.ts +89 -0
  142. package/dist/integrations/adapters/google-docs.d.ts.map +1 -0
  143. package/dist/integrations/adapters/google-docs.js +261 -0
  144. package/dist/integrations/adapters/google-docs.js.map +1 -0
  145. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  146. package/dist/integrations/adapters/slack.js +34 -0
  147. package/dist/integrations/adapters/slack.js.map +1 -1
  148. package/dist/integrations/adapters/telegram.d.ts.map +1 -1
  149. package/dist/integrations/adapters/telegram.js +32 -0
  150. package/dist/integrations/adapters/telegram.js.map +1 -1
  151. package/dist/integrations/google-docs-poller.d.ts +54 -0
  152. package/dist/integrations/google-docs-poller.d.ts.map +1 -0
  153. package/dist/integrations/google-docs-poller.js +442 -0
  154. package/dist/integrations/google-docs-poller.js.map +1 -0
  155. package/dist/integrations/index.d.ts +2 -0
  156. package/dist/integrations/index.d.ts.map +1 -1
  157. package/dist/integrations/index.js +3 -0
  158. package/dist/integrations/index.js.map +1 -1
  159. package/dist/integrations/plugin.d.ts.map +1 -1
  160. package/dist/integrations/plugin.js +49 -2
  161. package/dist/integrations/plugin.js.map +1 -1
  162. package/dist/integrations/types.d.ts +33 -0
  163. package/dist/integrations/types.d.ts.map +1 -1
  164. package/dist/integrations/webhook-handler.d.ts +10 -1
  165. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  166. package/dist/integrations/webhook-handler.js +13 -3
  167. package/dist/integrations/webhook-handler.js.map +1 -1
  168. package/dist/jobs/scheduler.d.ts +3 -0
  169. package/dist/jobs/scheduler.d.ts.map +1 -1
  170. package/dist/jobs/scheduler.js +81 -60
  171. package/dist/jobs/scheduler.js.map +1 -1
  172. package/dist/jobs/tools.d.ts.map +1 -1
  173. package/dist/jobs/tools.js +20 -3
  174. package/dist/jobs/tools.js.map +1 -1
  175. package/dist/mcp-client/config.d.ts +46 -0
  176. package/dist/mcp-client/config.d.ts.map +1 -0
  177. package/dist/mcp-client/config.js +152 -0
  178. package/dist/mcp-client/config.js.map +1 -0
  179. package/dist/mcp-client/index.d.ts +17 -0
  180. package/dist/mcp-client/index.d.ts.map +1 -0
  181. package/dist/mcp-client/index.js +53 -0
  182. package/dist/mcp-client/index.js.map +1 -0
  183. package/dist/mcp-client/manager.d.ts +76 -0
  184. package/dist/mcp-client/manager.d.ts.map +1 -0
  185. package/dist/mcp-client/manager.js +212 -0
  186. package/dist/mcp-client/manager.js.map +1 -0
  187. package/dist/oauth-tokens/store.d.ts.map +1 -1
  188. package/dist/oauth-tokens/store.js +3 -1
  189. package/dist/oauth-tokens/store.js.map +1 -1
  190. package/dist/onboarding/default-steps.d.ts +10 -0
  191. package/dist/onboarding/default-steps.d.ts.map +1 -0
  192. package/dist/onboarding/default-steps.js +164 -0
  193. package/dist/onboarding/default-steps.js.map +1 -0
  194. package/dist/onboarding/index.d.ts +12 -0
  195. package/dist/onboarding/index.d.ts.map +1 -0
  196. package/dist/onboarding/index.js +11 -0
  197. package/dist/onboarding/index.js.map +1 -0
  198. package/dist/onboarding/plugin.d.ts +19 -0
  199. package/dist/onboarding/plugin.d.ts.map +1 -0
  200. package/dist/onboarding/plugin.js +147 -0
  201. package/dist/onboarding/plugin.js.map +1 -0
  202. package/dist/onboarding/registry.d.ts +24 -0
  203. package/dist/onboarding/registry.d.ts.map +1 -0
  204. package/dist/onboarding/registry.js +40 -0
  205. package/dist/onboarding/registry.js.map +1 -0
  206. package/dist/onboarding/types.d.ts +71 -0
  207. package/dist/onboarding/types.d.ts.map +1 -0
  208. package/dist/onboarding/types.js +10 -0
  209. package/dist/onboarding/types.js.map +1 -0
  210. package/dist/resources/agents.d.ts +4 -0
  211. package/dist/resources/agents.d.ts.map +1 -0
  212. package/dist/resources/agents.js +44 -0
  213. package/dist/resources/agents.js.map +1 -0
  214. package/dist/resources/handlers.d.ts +17 -0
  215. package/dist/resources/handlers.d.ts.map +1 -1
  216. package/dist/resources/handlers.js +49 -12
  217. package/dist/resources/handlers.js.map +1 -1
  218. package/dist/resources/metadata.d.ts +48 -0
  219. package/dist/resources/metadata.d.ts.map +1 -0
  220. package/dist/resources/metadata.js +150 -0
  221. package/dist/resources/metadata.js.map +1 -0
  222. package/dist/resources/script-helpers.d.ts.map +1 -1
  223. package/dist/resources/script-helpers.js +3 -2
  224. package/dist/resources/script-helpers.js.map +1 -1
  225. package/dist/resources/store.d.ts.map +1 -1
  226. package/dist/resources/store.js +32 -17
  227. package/dist/resources/store.js.map +1 -1
  228. package/dist/scripts/call-agent.d.ts.map +1 -1
  229. package/dist/scripts/call-agent.js +3 -2
  230. package/dist/scripts/call-agent.js.map +1 -1
  231. package/dist/scripts/chat/search-chats.d.ts.map +1 -1
  232. package/dist/scripts/chat/search-chats.js +2 -1
  233. package/dist/scripts/chat/search-chats.js.map +1 -1
  234. package/dist/scripts/core-scripts.d.ts.map +1 -1
  235. package/dist/scripts/core-scripts.js +2 -0
  236. package/dist/scripts/core-scripts.js.map +1 -1
  237. package/dist/scripts/db/scoping.d.ts.map +1 -1
  238. package/dist/scripts/db/scoping.js +3 -2
  239. package/dist/scripts/db/scoping.js.map +1 -1
  240. package/dist/scripts/docs/index.d.ts +2 -0
  241. package/dist/scripts/docs/index.d.ts.map +1 -0
  242. package/dist/scripts/docs/index.js +4 -0
  243. package/dist/scripts/docs/index.js.map +1 -0
  244. package/dist/scripts/docs/search.d.ts +13 -0
  245. package/dist/scripts/docs/search.d.ts.map +1 -0
  246. package/dist/scripts/docs/search.js +130 -0
  247. package/dist/scripts/docs/search.js.map +1 -0
  248. package/dist/scripts/resources/delete-memory.d.ts +7 -0
  249. package/dist/scripts/resources/delete-memory.d.ts.map +1 -0
  250. package/dist/scripts/resources/delete-memory.js +49 -0
  251. package/dist/scripts/resources/delete-memory.js.map +1 -0
  252. package/dist/scripts/resources/delete.d.ts.map +1 -1
  253. package/dist/scripts/resources/delete.js +2 -1
  254. package/dist/scripts/resources/delete.js.map +1 -1
  255. package/dist/scripts/resources/index.d.ts.map +1 -1
  256. package/dist/scripts/resources/index.js +2 -0
  257. package/dist/scripts/resources/index.js.map +1 -1
  258. package/dist/scripts/resources/list.d.ts.map +1 -1
  259. package/dist/scripts/resources/list.js +2 -1
  260. package/dist/scripts/resources/list.js.map +1 -1
  261. package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -1
  262. package/dist/scripts/resources/migrate-learnings.js +2 -1
  263. package/dist/scripts/resources/migrate-learnings.js.map +1 -1
  264. package/dist/scripts/resources/read.d.ts.map +1 -1
  265. package/dist/scripts/resources/read.js +2 -1
  266. package/dist/scripts/resources/read.js.map +1 -1
  267. package/dist/scripts/resources/save-memory.d.ts +9 -0
  268. package/dist/scripts/resources/save-memory.d.ts.map +1 -0
  269. package/dist/scripts/resources/save-memory.js +78 -0
  270. package/dist/scripts/resources/save-memory.js.map +1 -0
  271. package/dist/scripts/resources/write.d.ts.map +1 -1
  272. package/dist/scripts/resources/write.js +2 -1
  273. package/dist/scripts/resources/write.js.map +1 -1
  274. package/dist/scripts/utils.d.ts +10 -1
  275. package/dist/scripts/utils.d.ts.map +1 -1
  276. package/dist/scripts/utils.js +45 -2
  277. package/dist/scripts/utils.js.map +1 -1
  278. package/dist/server/action-discovery.d.ts +5 -0
  279. package/dist/server/action-discovery.d.ts.map +1 -1
  280. package/dist/server/action-discovery.js +51 -20
  281. package/dist/server/action-discovery.js.map +1 -1
  282. package/dist/server/action-routes.d.ts.map +1 -1
  283. package/dist/server/action-routes.js +63 -57
  284. package/dist/server/action-routes.js.map +1 -1
  285. package/dist/server/agent-chat-plugin.d.ts +3 -0
  286. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  287. package/dist/server/agent-chat-plugin.js +363 -48
  288. package/dist/server/agent-chat-plugin.js.map +1 -1
  289. package/dist/server/agent-discovery.d.ts.map +1 -1
  290. package/dist/server/agent-discovery.js +11 -23
  291. package/dist/server/agent-discovery.js.map +1 -1
  292. package/dist/server/agent-teams.d.ts.map +1 -1
  293. package/dist/server/agent-teams.js +2 -1
  294. package/dist/server/agent-teams.js.map +1 -1
  295. package/dist/server/agents-bundle.d.ts +33 -5
  296. package/dist/server/agents-bundle.d.ts.map +1 -1
  297. package/dist/server/agents-bundle.js +108 -64
  298. package/dist/server/agents-bundle.js.map +1 -1
  299. package/dist/server/auth.d.ts +1 -0
  300. package/dist/server/auth.d.ts.map +1 -1
  301. package/dist/server/auth.js +172 -60
  302. package/dist/server/auth.js.map +1 -1
  303. package/dist/server/better-auth-instance.d.ts.map +1 -1
  304. package/dist/server/better-auth-instance.js +202 -6
  305. package/dist/server/better-auth-instance.js.map +1 -1
  306. package/dist/server/builder-browser.d.ts +40 -0
  307. package/dist/server/builder-browser.d.ts.map +1 -0
  308. package/dist/server/builder-browser.js +166 -0
  309. package/dist/server/builder-browser.js.map +1 -0
  310. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  311. package/dist/server/core-routes-plugin.js +152 -6
  312. package/dist/server/core-routes-plugin.js.map +1 -1
  313. package/dist/server/credential-provider.d.ts +37 -0
  314. package/dist/server/credential-provider.d.ts.map +1 -0
  315. package/dist/server/credential-provider.js +49 -0
  316. package/dist/server/credential-provider.js.map +1 -0
  317. package/dist/server/framework-request-handler.d.ts.map +1 -1
  318. package/dist/server/framework-request-handler.js +42 -3
  319. package/dist/server/framework-request-handler.js.map +1 -1
  320. package/dist/server/google-auth-plugin.js +1 -1
  321. package/dist/server/google-oauth.d.ts +1 -1
  322. package/dist/server/google-oauth.d.ts.map +1 -1
  323. package/dist/server/google-oauth.js +15 -10
  324. package/dist/server/google-oauth.js.map +1 -1
  325. package/dist/server/index.d.ts +3 -0
  326. package/dist/server/index.d.ts.map +1 -1
  327. package/dist/server/index.js +3 -0
  328. package/dist/server/index.js.map +1 -1
  329. package/dist/server/oauth-helpers.d.ts +1 -0
  330. package/dist/server/oauth-helpers.d.ts.map +1 -1
  331. package/dist/server/oauth-helpers.js +5 -4
  332. package/dist/server/oauth-helpers.js.map +1 -1
  333. package/dist/server/onboarding-html.d.ts.map +1 -1
  334. package/dist/server/onboarding-html.js +94 -3
  335. package/dist/server/onboarding-html.js.map +1 -1
  336. package/dist/server/request-context.d.ts +20 -0
  337. package/dist/server/request-context.d.ts.map +1 -0
  338. package/dist/server/request-context.js +41 -0
  339. package/dist/server/request-context.js.map +1 -0
  340. package/dist/templates/default/.agents/skills/actions/SKILL.md +2 -1
  341. package/dist/templates/default/.agents/skills/security/SKILL.md +145 -40
  342. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
  343. package/dist/templates/default/_gitignore +1 -0
  344. package/dist/templates/default/app/root.tsx +4 -1
  345. package/dist/templates/workspace-core/AGENTS.md +62 -0
  346. package/dist/templates/workspace-core/actions/company-directory.ts +38 -0
  347. package/dist/templates/workspace-core/package.json +39 -0
  348. package/dist/templates/workspace-core/skills/company-policies/SKILL.md +42 -0
  349. package/dist/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
  350. package/dist/templates/workspace-core/src/client/index.ts +26 -0
  351. package/dist/templates/workspace-core/src/credentials.ts +29 -0
  352. package/dist/templates/workspace-core/src/index.ts +21 -0
  353. package/dist/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
  354. package/dist/templates/workspace-core/src/server/auth-plugin.ts +35 -0
  355. package/dist/templates/workspace-core/src/server/index.ts +22 -0
  356. package/dist/templates/workspace-core/tailwind.preset.ts +34 -0
  357. package/dist/templates/workspace-core/tsconfig.json +9 -0
  358. package/dist/templates/workspace-root/.env.example +37 -0
  359. package/dist/templates/workspace-root/README.md +62 -0
  360. package/dist/templates/workspace-root/_gitignore +23 -0
  361. package/dist/templates/workspace-root/package.json +18 -0
  362. package/dist/templates/workspace-root/pnpm-workspace.yaml +3 -0
  363. package/dist/templates/workspace-root/tsconfig.base.json +21 -0
  364. package/dist/vite/agents-bundle-plugin.d.ts.map +1 -1
  365. package/dist/vite/agents-bundle-plugin.js +65 -15
  366. package/dist/vite/agents-bundle-plugin.js.map +1 -1
  367. package/dist/vite/client.d.ts +16 -0
  368. package/dist/vite/client.d.ts.map +1 -1
  369. package/dist/vite/client.js +75 -0
  370. package/dist/vite/client.js.map +1 -1
  371. package/docs/content/a2a-protocol.md +223 -0
  372. package/docs/content/actions.md +129 -0
  373. package/docs/content/agent-mentions.md +171 -0
  374. package/docs/content/authentication.md +155 -0
  375. package/docs/content/cli-adapters.md +244 -0
  376. package/docs/content/client.md +175 -0
  377. package/docs/content/context-awareness.md +168 -0
  378. package/docs/content/creating-templates.md +311 -0
  379. package/docs/content/database.md +82 -0
  380. package/docs/content/deployment.md +180 -0
  381. package/docs/content/enterprise-workspace.md +235 -0
  382. package/docs/content/faq.md +101 -0
  383. package/docs/content/file-uploads.md +102 -0
  384. package/docs/content/frames.md +47 -0
  385. package/docs/content/getting-started.md +104 -0
  386. package/docs/content/integrations.md +198 -0
  387. package/docs/content/key-concepts.md +246 -0
  388. package/docs/content/mcp-clients.md +110 -0
  389. package/docs/content/mcp-protocol.md +168 -0
  390. package/docs/content/onboarding.md +107 -0
  391. package/docs/content/real-time-collaboration.md +185 -0
  392. package/docs/content/resources.md +277 -0
  393. package/docs/content/security.md +158 -0
  394. package/docs/content/server.md +200 -0
  395. package/docs/content/skills-guide.md +107 -0
  396. package/docs/content/what-is-agent-native.md +100 -0
  397. package/docs/content/workspace-management.md +224 -0
  398. package/package.json +12 -2
  399. package/src/templates/default/.agents/skills/actions/SKILL.md +2 -1
  400. package/src/templates/default/.agents/skills/security/SKILL.md +145 -40
  401. package/src/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
  402. package/src/templates/default/_gitignore +1 -0
  403. package/src/templates/default/app/root.tsx +4 -1
  404. package/src/templates/workspace-core/AGENTS.md +62 -0
  405. package/src/templates/workspace-core/actions/company-directory.ts +38 -0
  406. package/src/templates/workspace-core/package.json +39 -0
  407. package/src/templates/workspace-core/skills/company-policies/SKILL.md +42 -0
  408. package/src/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
  409. package/src/templates/workspace-core/src/client/index.ts +26 -0
  410. package/src/templates/workspace-core/src/credentials.ts +29 -0
  411. package/src/templates/workspace-core/src/index.ts +21 -0
  412. package/src/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
  413. package/src/templates/workspace-core/src/server/auth-plugin.ts +35 -0
  414. package/src/templates/workspace-core/src/server/index.ts +22 -0
  415. package/src/templates/workspace-core/tailwind.preset.ts +34 -0
  416. package/src/templates/workspace-core/tsconfig.json +9 -0
  417. package/src/templates/workspace-root/.env.example +37 -0
  418. package/src/templates/workspace-root/README.md +62 -0
  419. package/src/templates/workspace-root/_gitignore +23 -0
  420. package/src/templates/workspace-root/package.json +18 -0
  421. package/src/templates/workspace-root/pnpm-workspace.yaml +3 -0
  422. package/src/templates/workspace-root/tsconfig.base.json +21 -0
  423. package/dist/templates/templates/default/.agents/skills/actions/SKILL.md +0 -142
  424. package/dist/templates/templates/default/.agents/skills/agent-engines/SKILL.md +0 -127
  425. package/dist/templates/templates/default/.agents/skills/capture-learnings/SKILL.md +0 -50
  426. package/dist/templates/templates/default/.agents/skills/create-skill/SKILL.md +0 -167
  427. package/dist/templates/templates/default/.agents/skills/delegate-to-agent/SKILL.md +0 -90
  428. package/dist/templates/templates/default/.agents/skills/frontend-design/SKILL.md +0 -69
  429. package/dist/templates/templates/default/.agents/skills/real-time-collab/SKILL.md +0 -183
  430. package/dist/templates/templates/default/.agents/skills/real-time-sync/SKILL.md +0 -112
  431. package/dist/templates/templates/default/.agents/skills/security/SKILL.md +0 -108
  432. package/dist/templates/templates/default/.agents/skills/self-modifying-code/SKILL.md +0 -79
  433. package/dist/templates/templates/default/.agents/skills/storing-data/SKILL.md +0 -110
  434. package/dist/templates/templates/default/.claude/settings.json +0 -100
  435. package/dist/templates/templates/default/.env.example +0 -5
  436. package/dist/templates/templates/default/.ignore +0 -0
  437. package/dist/templates/templates/default/.prettierrc +0 -5
  438. package/dist/templates/templates/default/AGENTS.md +0 -110
  439. package/dist/templates/templates/default/DEVELOPING.md +0 -117
  440. package/dist/templates/templates/default/_gitignore +0 -37
  441. package/dist/templates/templates/default/actions/hello.ts +0 -20
  442. package/dist/templates/templates/default/actions/navigate.ts +0 -53
  443. package/dist/templates/templates/default/actions/run.ts +0 -2
  444. package/dist/templates/templates/default/actions/view-screen.ts +0 -39
  445. package/dist/templates/templates/default/app/entry.client.tsx +0 -4
  446. package/dist/templates/templates/default/app/entry.server.tsx +0 -56
  447. package/dist/templates/templates/default/app/global.css +0 -95
  448. package/dist/templates/templates/default/app/lib/utils.ts +0 -1
  449. package/dist/templates/templates/default/app/root.tsx +0 -107
  450. package/dist/templates/templates/default/app/routes/_index.tsx +0 -62
  451. package/dist/templates/templates/default/app/routes.ts +0 -4
  452. package/dist/templates/templates/default/app/vite-env.d.ts +0 -6
  453. package/dist/templates/templates/default/components.json +0 -20
  454. package/dist/templates/templates/default/data/.gitkeep +0 -0
  455. package/dist/templates/templates/default/data/sync-config.json +0 -1
  456. package/dist/templates/templates/default/learnings.defaults.md +0 -5
  457. package/dist/templates/templates/default/learnings.md +0 -0
  458. package/dist/templates/templates/default/package.json +0 -46
  459. package/dist/templates/templates/default/postcss.config.js +0 -6
  460. package/dist/templates/templates/default/public/icon-180.svg +0 -4
  461. package/dist/templates/templates/default/public/icon-192.svg +0 -4
  462. package/dist/templates/templates/default/public/icon-512.svg +0 -4
  463. package/dist/templates/templates/default/public/manifest.json +0 -13
  464. package/dist/templates/templates/default/react-router.config.ts +0 -6
  465. package/dist/templates/templates/default/server/middleware/auth.ts +0 -15
  466. package/dist/templates/templates/default/server/plugins/.gitkeep +0 -0
  467. package/dist/templates/templates/default/server/routes/[...page].get.ts +0 -5
  468. package/dist/templates/templates/default/server/routes/api/hello.get.ts +0 -5
  469. package/dist/templates/templates/default/shared/api.ts +0 -6
  470. package/dist/templates/templates/default/ssr-entry.ts +0 -20
  471. package/dist/templates/templates/default/tailwind.config.ts +0 -7
  472. package/dist/templates/templates/default/tsconfig.json +0 -11
  473. package/dist/templates/templates/default/vite.config.ts +0 -6
@@ -0,0 +1,185 @@
1
+ ---
2
+ title: "Real-Time Collaboration"
3
+ description: "Multi-user collaborative editing with Yjs CRDT, live cursors, and AI agent real-time edits."
4
+ ---
5
+
6
+ # Real-Time Collaboration
7
+
8
+ Multi-user collaborative editing where the AI agent and human users are equal participants — like Google Docs, but with an AI collaborator.
9
+
10
+ ## Overview {#overview}
11
+
12
+ The framework provides a Yjs-based collaborative editing system in `@agent-native/core/collab`. Multiple users can edit the same document simultaneously with live cursor positions, and the AI agent can make surgical edits that appear in real-time without disrupting the user's cursor, selection, or undo history.
13
+
14
+ This is built on three battle-tested technologies: **Yjs** (CRDT for conflict-free merging), **TipTap** (rich text editor), and **polling-based sync** (works in all deployment environments including serverless and edge).
15
+
16
+ ## How it works {#how-it-works}
17
+
18
+ The collaboration system has three layers:
19
+
20
+ - **Yjs Y.Doc** — stores the document as a `Y.XmlFragment` (ProseMirror node tree). This is the CRDT that enables conflict-free merging of concurrent edits.
21
+ - **TipTap Collaboration extension** — binds the editor to the Y.XmlFragment via `ySyncPlugin`. Remote changes are applied as minimal ProseMirror transactions that preserve cursor position.
22
+ - **Polling sync** — clients poll `/_agent-native/poll` every 2 seconds for Yjs updates. Awareness state (cursor positions, user info) is synced via a separate `/_agent-native/collab/:docId/awareness` endpoint.
23
+
24
+ The Yjs state is persisted in a `_collab_docs` SQL table as base64-encoded binary, compatible with both SQLite and Postgres.
25
+
26
+ ## Agent + human collaboration {#agent-human-collab}
27
+
28
+ The agent and human users are equal participants in collaborative editing. The key insight is that both produce Yjs operations that merge cleanly:
29
+
30
+ - **Human edits** flow through TipTap → ySyncPlugin → Y.XmlFragment → server via HTTP
31
+ - **Agent edits** flow through the `edit-document` action → server search-replace endpoint → Y.XmlFragment mutation → poll update → all clients
32
+
33
+ The agent's `edit-document` action uses surgical search-and-replace on Y.XmlText nodes within the Y.XmlFragment tree. This produces the smallest possible Yjs update — only the changed text is modified, not the entire document. The result: the user sees the agent's change appear in their editor without losing their place.
34
+
35
+ ```bash
36
+ # Agent makes a surgical edit — user sees it appear live
37
+ pnpm action edit-document --id doc123 --find "Big Projects" --replace "Proyectos Grandes"
38
+
39
+ # The action:
40
+ # 1. Updates SQL content column (for search/API compat)
41
+ # 2. Calls POST /_agent-native/collab/doc123/search-replace
42
+ # 3. Server walks Y.XmlFragment, finds text, modifies Y.XmlText node
43
+ # 4. Minimal Yjs update emitted via poll system
44
+ # 5. Client receives update → ySyncPlugin applies targeted PM transaction
45
+ # 6. User's cursor stays in place ✓
46
+ ```
47
+
48
+ ## Enabling collaboration {#enabling-collab}
49
+
50
+ Templates opt into collaboration with five steps:
51
+
52
+ ### 1. Install dependencies
53
+
54
+ ```bash
55
+ pnpm add @tiptap/extension-collaboration @tiptap/extension-collaboration-caret @tiptap/y-tiptap @tiptap/core
56
+ ```
57
+
58
+ ### 2. Add Vite optimizeDeps
59
+
60
+ Prevents Vite from re-bundling TipTap in incompatible ways during dev:
61
+
62
+ ```typescript
63
+ // vite.config.ts
64
+ export default defineConfig({
65
+ plugins: [reactRouter()],
66
+ optimizeDeps: {
67
+ include: [
68
+ "yjs",
69
+ "y-protocols/awareness",
70
+ "@tiptap/core",
71
+ "@tiptap/extension-collaboration",
72
+ "@tiptap/extension-collaboration-caret",
73
+ "@tiptap/y-tiptap",
74
+ ],
75
+ },
76
+ });
77
+ ```
78
+
79
+ ### 3. Add the collab server plugin
80
+
81
+ ```typescript
82
+ // server/plugins/collab.ts
83
+ import { createCollabPlugin } from "@agent-native/core/server";
84
+
85
+ export default createCollabPlugin({
86
+ table: "documents",
87
+ contentColumn: "content",
88
+ idColumn: "id",
89
+ autoSeed: false, // Client-side seeding on first load
90
+ });
91
+ ```
92
+
93
+ ### 4. Use the client hook
94
+
95
+ ```typescript
96
+ import { useCollaborativeDoc, generateTabId } from "@agent-native/core/client";
97
+
98
+ const TAB_ID = generateTabId();
99
+
100
+ const { ydoc, awareness, isLoading, activeUsers } = useCollaborativeDoc({
101
+ docId: documentId,
102
+ requestSource: TAB_ID,
103
+ user: { name: "Steve", email: "steve@example.com", color: "#60a5fa" },
104
+ });
105
+ ```
106
+
107
+ ### 5. Add TipTap extensions
108
+
109
+ ```typescript
110
+ import Collaboration from "@tiptap/extension-collaboration";
111
+ import CollaborationCaret from "@tiptap/extension-collaboration-caret";
112
+ import { Awareness } from "y-protocols/awareness";
113
+
114
+ // Create awareness for cursor sync
115
+ const awareness = new Awareness(ydoc);
116
+ awareness.setLocalStateField("user", { name, color });
117
+
118
+ const editor = useEditor({
119
+ extensions: [
120
+ StarterKit.configure({ history: false }), // Yjs handles undo
121
+ Collaboration.configure({ document: ydoc }),
122
+ CollaborationCaret.configure({
123
+ provider: { awareness },
124
+ user: { name, color },
125
+ }),
126
+ ],
127
+ content: initialContent,
128
+ });
129
+ ```
130
+
131
+ ## Live cursors & presence {#live-cursors}
132
+
133
+ The `CollaborationCaret` extension renders colored cursor lines with user name labels for each connected user. The `useCollaborativeDoc` hook provides an `activeUsers` array that can be used to render a presence bar with user avatars.
134
+
135
+ User identity is derived from the session email. The framework provides `emailToColor()` and `emailToName()` helpers to generate consistent cursor colors and display names from email addresses.
136
+
137
+ ## Comments {#comments}
138
+
139
+ Templates can add a comments system with threaded discussions on documents. The content template includes a full implementation with:
140
+
141
+ - `document_comments` SQL table (threads, replies, resolved status)
142
+ - CRUD API routes at `/api/comments`
143
+ - Comments sidebar with threaded view and reply UI
144
+ - Resolve/unresolve threads
145
+ - **Send to AI** button — sends the comment thread context to the agent chat via `sendToAgentChat()`
146
+ - Agent actions: `list-comments`, `add-comment`
147
+ - Notion comment sync: `sync-notion-comments` action for bidirectional pull/push
148
+
149
+ ## Collab routes {#collab-routes}
150
+
151
+ All collab routes are auto-mounted under `/_agent-native/collab/` by the collab plugin:
152
+
153
+ | Route | Purpose |
154
+ | ----------------------------- | ---------------------------------------- |
155
+ | `GET /:docId/state` | Fetch full Y.Doc state (base64) |
156
+ | `POST /:docId/update` | Apply client Yjs update |
157
+ | `POST /:docId/text` | Apply full text replacement (diff-based) |
158
+ | `POST /:docId/search-replace` | Surgical find/replace in Y.XmlFragment |
159
+ | `POST /:docId/awareness` | Sync cursor/presence state |
160
+ | `GET /:docId/users` | List active users on a document |
161
+
162
+ ## Agent edit action {#edit-document}
163
+
164
+ The `edit-document` action is the primary way agents make changes to documents in collaborative mode:
165
+
166
+ ```bash
167
+ # Single edit
168
+ pnpm action edit-document --id doc123 --find "old text" --replace "new text"
169
+
170
+ # Batch edits
171
+ pnpm action edit-document --id doc123 --edits '[{"find":"old","replace":"new"}]'
172
+
173
+ # Delete text
174
+ pnpm action edit-document --id doc123 --find "delete me" --replace ""
175
+ ```
176
+
177
+ When collab state exists for the document, the action calls the server's `search-replace` endpoint via HTTP (not the collab module directly, since actions run in a separate process). The server walks the Y.XmlFragment tree, finds the text in Y.XmlText nodes, and applies minimal delete/insert operations. The resulting Yjs update is broadcast to all connected clients via the poll system.
178
+
179
+ ## Common pitfalls {#pitfalls}
180
+
181
+ - **TipTap version mismatch** — All `@tiptap/*` packages must be the same version. The Collaboration extension requires `editor.utils` which was added in v3.22.2. Add `@tiptap/core` as an explicit dependency.
182
+ - **Empty editor on first load** — The Collaboration extension does NOT auto-seed from the `content` prop. Seed manually with `editor.commands.setContent()` when the Y.XmlFragment is empty.
183
+ - **Data loss from empty saves** — Guard against saving empty content in the `onUpdate` handler when the editor is in collab mode but hasn't been seeded yet.
184
+ - **Vite dep optimization** — Always add Yjs-related packages to `optimizeDeps.include` to prevent Vite from re-bundling TipTap in incompatible ways.
185
+ - **Separate process for actions** — Actions run via `pnpm action` in a new Node.js process. Use the server's HTTP endpoints (not the collab module directly) so updates reach the poll system.
@@ -0,0 +1,277 @@
1
+ ---
2
+ title: "Workspace Resources"
3
+ description: "SQL-backed workspace files for notes, skills, custom agents, scheduled tasks, and instructions."
4
+ ---
5
+
6
+ # Workspace Resources
7
+
8
+ The **Workspace** tab is where you and the agent share persistent files — notes, instructions, skills, custom agents, and scheduled jobs. Files live in the database (not the filesystem), so they persist across sessions, work in serverless/edge deploys, and can be edited from both the UI and the agent.
9
+
10
+ ## TL;DR {#tldr}
11
+
12
+ - Open the **Workspace** tab in the agent sidebar.
13
+ - Create files with the `+` menu. Upload with the upload button. Edit inline (visual or code view).
14
+ - **Personal** is just you. **Shared** is your team/org.
15
+ - The agent can read, write, and rename any of these files as part of a conversation.
16
+ - Special files the agent always reads: `AGENTS.md` (team rules) and `learnings.md` (per-user).
17
+
18
+ ## What goes in here? {#what-goes-in-here}
19
+
20
+ | File / path | What it's for |
21
+ | ------------------------- | --------------------------------------------------------------------------------------------- |
22
+ | `AGENTS.md` (Shared) | Team instructions the agent reads every turn — tone, rules, domain context, skill references. |
23
+ | `learnings.md` (Personal) | Corrections and preferences the agent records per user so it doesn't repeat mistakes. |
24
+ | `skills/<name>.md` | Focused domain guidance the agent pulls in on demand (invoked with `/` slash commands). |
25
+ | `agents/<name>.md` | Custom sub-agent profiles the agent can delegate to (invoked with `@` mentions). |
26
+ | `agents/<name>.json` | A2A manifests for connected remote agents. |
27
+ | `jobs/<name>.md` | Scheduled tasks that run on a cron (see the recurring-jobs docs). |
28
+ | Anything else | Notes, prompts, config, dataset snippets — any text file. |
29
+
30
+ ## Overview {#overview}
31
+
32
+ Every agent-native app has a built-in resource system. Resources are SQL-backed files that persist across sessions and deployments. Unlike code files, resources live in the database — not the filesystem — so they work in serverless environments, edge runtimes, and production deploys without any filesystem dependency.
33
+
34
+ Resources have two scopes:
35
+
36
+ - **Personal** — scoped to a single user (their email). Good for preferences, notes, and per-user context.
37
+ - **Shared** — visible to all users. Good for team instructions, skills, and shared config.
38
+
39
+ ## Workspace Panel {#workspace-panel}
40
+
41
+ The agent panel includes a **Workspace** tab alongside Chat and CLI. This panel lets users browse, create, edit, and delete workspace resources. It displays a tree view of all resources organized by folder path.
42
+
43
+ Resources can be any text file — Markdown, JSON, YAML, plain text. The panel includes an inline editor for viewing and modifying resource content directly.
44
+
45
+ The `+` menu in Workspace supports typed creation flows for:
46
+
47
+ - **Files** — arbitrary resources
48
+ - **Skills** — reusable instruction files under `skills/`
49
+ - **Agents** — custom sub-agent profiles under `agents/*.md`
50
+ - **Scheduled Tasks** — recurring jobs under `jobs/`
51
+
52
+ Workspace resources come in two scopes:
53
+
54
+ - **Personal** — visible only to the current user
55
+ - **Shared** — visible across the team/org
56
+
57
+ Click the `?` icon in the Workspace toolbar to jump back to these docs at any time.
58
+
59
+ ## Getting Started: a 1-minute walkthrough {#getting-started}
60
+
61
+ Change how the agent behaves, in 60 seconds.
62
+
63
+ 1. Open the **Workspace** tab → **Shared** → `AGENTS.md` (create it with `+` → **File** if missing).
64
+ 2. Add one rule, e.g.:
65
+
66
+ ```markdown
67
+ ## Tone
68
+
69
+ Be concise. Lead with the answer.
70
+ ```
71
+
72
+ 3. Save, switch to **Chat**, ask anything — the agent follows the new rule immediately.
73
+
74
+ **Next steps, when you want them:**
75
+
76
+ - **Skills** (`+` → **Skill**) — focused how-to files invoked in chat with `/skill-name`.
77
+ - **Agents** (`+` → **Agent**) — reusable sub-agent personas invoked with `@agent-name`.
78
+ - **Scheduled Tasks** (`+` → **Scheduled Task**) — prompts that run on a cron.
79
+ - **learnings.md** — your Personal file the agent auto-updates whenever you correct it.
80
+
81
+ ## How the Agent Uses Resources {#how-the-agent-uses-resources}
82
+
83
+ The agent has built-in tools for managing resources: `resource-list`, `resource-read`, `resource-write`, and `resource-delete`. These are available in both dev and production modes.
84
+
85
+ At the start of every conversation, the agent automatically reads:
86
+
87
+ ### AGENTS.md {#agents-md}
88
+
89
+ A shared resource seeded by default. It contains custom instructions, preferences, and skill references. Edit this to change how the agent behaves for all users — tone, rules, domain context, and which skills to use.
90
+
91
+ ```text
92
+ # Agent Instructions
93
+
94
+ ## Tone
95
+ Be concise. Lead with the answer.
96
+
97
+ ## Code style
98
+ - Use TypeScript, never JavaScript
99
+ - Prefer named exports
100
+
101
+ ## Skills
102
+ | Skill | Path | Description |
103
+ |-------|------|-------------|
104
+ | data-analysis | `skills/data-analysis.md` | BigQuery and data workflows |
105
+ ```
106
+
107
+ ### learnings.md {#learnings-md}
108
+
109
+ A personal resource where the agent records corrections, preferences, and patterns it learns from each user. When the agent makes a mistake and the user corrects it, the agent updates `learnings.md` so it doesn't repeat the error.
110
+
111
+ ## Skills {#skills}
112
+
113
+ Skills are Markdown resource files that give the agent deep domain knowledge for specific tasks. They live under the `skills/` path prefix in resources (e.g. `skills/data-analysis.md`, `skills/code-review.md`).
114
+
115
+ When the agent encounters a task that matches a skill, it reads the skill file and follows its guidance. Skills referenced in `AGENTS.md` are discovered automatically.
116
+
117
+ ### Creating Skills {#creating-skills}
118
+
119
+ There are two ways to add skills:
120
+
121
+ 1. **Via Workspace tab** — Create a new resource with a path like `skills/my-skill.md`. This works in both dev and production.
122
+ 2. **Via code (dev only)** — Add a Markdown file to `.agents/skills/` in your project. These are available when the app runs in dev mode.
123
+
124
+ ## Custom Agents {#custom-agents}
125
+
126
+ Custom agents are reusable local sub-agent profiles stored as Markdown resources under `agents/*.md`.
127
+
128
+ Use them when you want a focused delegate with its own:
129
+
130
+ - name
131
+ - description
132
+ - model preference
133
+ - instruction set
134
+
135
+ Unlike skills, custom agents are not passive guidance. They are operational personas the main agent can invoke through `@` mentions or by selecting them during sub-agent spawning.
136
+
137
+ ### Agent format {#agent-format}
138
+
139
+ Custom agents use YAML frontmatter plus Markdown instructions:
140
+
141
+ ```markdown
142
+ ---
143
+ name: Design
144
+ description: >-
145
+ Reviews layouts, interaction patterns, and product UX decisions.
146
+ model: inherit
147
+ tools: inherit
148
+ delegate-default: false
149
+ ---
150
+
151
+ # Role
152
+
153
+ You are a focused design agent.
154
+
155
+ ## Responsibilities
156
+
157
+ - Review layouts and interaction flows
158
+ - Suggest stronger visual direction
159
+ - Be concise and opinionated
160
+ ```
161
+
162
+ Recommended conventions:
163
+
164
+ - Store custom agents at `agents/<slug>.md`
165
+ - Use `model: inherit` unless the profile clearly needs a different model
166
+ - Keep `tools: inherit` for now; the field is reserved for future tool policies
167
+
168
+ ### Remote agents vs custom agents {#remote-vs-custom-agents}
169
+
170
+ There are two agent types in Workspace:
171
+
172
+ - **Custom agents** — local profiles in `agents/*.md`, executed inside the current app/runtime
173
+ - **Connected agents** — remote A2A peers described by manifests in `agents/*.json`
174
+
175
+ Use custom agents for delegation within one app. Use connected agents when you need to call another app over A2A.
176
+
177
+ ### Skill Format {#skill-format}
178
+
179
+ Skills are Markdown files with optional YAML frontmatter for metadata:
180
+
181
+ ````text
182
+ ---
183
+ name: data-analysis
184
+ description: BigQuery queries, data transforms, and visualization
185
+ ---
186
+
187
+ # Data Analysis
188
+
189
+ ## When to use
190
+ Use this skill when the user asks about data, queries, or analytics.
191
+
192
+ ## Rules
193
+ - Always validate SQL before executing
194
+ - Prefer CTEs over subqueries
195
+ - Include LIMIT on exploratory queries
196
+
197
+ ## Patterns
198
+ ```sql
199
+ -- Standard BigQuery date filter
200
+ WHERE DATE(created_at) BETWEEN @start_date AND @end_date
201
+ ````
202
+
203
+ ````
204
+
205
+ ## @ Tagging {#at-tagging}
206
+
207
+ Type `@` in the chat input to reference workspace items. A dropdown appears at the cursor showing matching agents and files. Use arrow keys to navigate and Enter to select. The selected item appears as an inline chip in the input.
208
+
209
+ When you send a message:
210
+
211
+ - **Files/resources** are passed as references the agent can read
212
+ - **Custom agents** run locally with their profile instructions
213
+ - **Connected agents** are called over A2A
214
+
215
+ What shows up depends on the mode:
216
+
217
+ - **Dev mode** — Codebase files, workspace resources, custom agents, and connected agents
218
+ - **Production mode** — Workspace resources, custom agents, and connected agents
219
+
220
+ ## / Slash Commands {#slash-commands}
221
+
222
+ Type `/` at the start of a line to invoke a skill. A dropdown shows available skills with their names and descriptions. Selecting a skill adds it as an inline chip, and its content is included as context when the message is sent.
223
+
224
+ What shows up depends on the mode:
225
+
226
+ - **Dev mode** — Skills from `.agents/skills/` (codebase) and skills from resources
227
+ - **Production mode** — Skills from resources only
228
+
229
+ If no skills are configured, the dropdown shows a hint with a link to these docs.
230
+
231
+ ## Dev vs Production Mode {#dev-vs-prod}
232
+
233
+ The resource system works identically in both modes. The difference is what additional sources are available for `@` tagging and `/` commands:
234
+
235
+ | Feature | Dev Mode | Production |
236
+ |---------|----------|------------|
237
+ | @ tagging | Codebase files + workspace resources + custom agents + connected agents | Workspace resources + custom agents + connected agents |
238
+ | / slash commands | .agents/skills/ + resource skills | Resource skills only |
239
+ | Agent file access | Filesystem + resources | Resources only |
240
+ | Workspace panel | Full access | Full access |
241
+ | AGENTS.md / learnings.md | Available | Available |
242
+
243
+ ## Resource API {#resource-api}
244
+
245
+ Resources can be managed from server code, actions, or the REST API.
246
+
247
+ ### Server API {#server-api}
248
+
249
+ REST endpoints mounted automatically:
250
+
251
+ | Method | Endpoint | Description |
252
+ |--------|----------|-------------|
253
+ | `GET` | `/_agent-native/resources?scope=all` | List resources |
254
+ | `GET` | `/_agent-native/resources/tree?scope=all` | Get folder tree |
255
+ | `POST` | `/_agent-native/resources` | Create a resource |
256
+ | `GET` | `/_agent-native/resources/:id` | Get resource with content |
257
+ | `PUT` | `/_agent-native/resources/:id` | Update a resource |
258
+ | `DELETE` | `/_agent-native/resources/:id` | Delete a resource |
259
+ | `POST` | `/_agent-native/resources/upload` | Upload a file as resource |
260
+
261
+ ### Action API {#script-api}
262
+
263
+ The agent uses these built-in actions. You can also call them from your own actions:
264
+
265
+ ```bash
266
+ # List all resources
267
+ pnpm action resource-list --scope all
268
+
269
+ # Read a resource
270
+ pnpm action resource-read --path "skills/my-skill.md"
271
+
272
+ # Write a resource
273
+ pnpm action resource-write --path "notes/meeting.md" --content "# Meeting Notes..."
274
+
275
+ # Delete a resource
276
+ pnpm action resource-delete --path "notes/old.md"
277
+ ````
@@ -0,0 +1,158 @@
1
+ ---
2
+ title: "Security"
3
+ description: "Security model for agent-native apps: input validation, SQL injection prevention, XSS, data scoping, secrets management, and auth patterns."
4
+ ---
5
+
6
+ # Security
7
+
8
+ Agent-native apps are designed to be secure by default. The framework provides automatic protections at multiple layers — you get SQL-level data isolation, parameterized queries, input validation, and authentication out of the box.
9
+
10
+ ## Security by Design {#secure-by-design}
11
+
12
+ The framework architecture prevents common vulnerabilities when you use the standard patterns:
13
+
14
+ | Vulnerability | Framework Protection |
15
+ | --------------- | --------------------------------------------------------------- |
16
+ | SQL injection | Parameterized queries in `db-query`/`db-exec` and Drizzle ORM |
17
+ | XSS | React auto-escapes JSX; TipTap sanitizes rich text |
18
+ | Data leaks | SQL-level scoping via temporary views (`owner_email`, `org_id`) |
19
+ | Auth bypass | Auth guard auto-protects all `defineAction` endpoints |
20
+ | Input injection | Zod schema validation in `defineAction` |
21
+ | CSRF | `SameSite=lax` + `httpOnly` cookies |
22
+ | Secret exposure | `.env` files gitignored; OAuth tokens in dedicated store |
23
+
24
+ ## Input Validation {#input-validation}
25
+
26
+ Use `defineAction` with a Zod `schema:` for every action. The framework validates input automatically before your code runs:
27
+
28
+ ```typescript
29
+ import { z } from "zod";
30
+ import { defineAction } from "@agent-native/core";
31
+
32
+ export default defineAction({
33
+ description: "Create a note",
34
+ schema: z.object({
35
+ title: z.string().min(1).max(200).describe("Note title"),
36
+ content: z.string().optional().describe("Note body"),
37
+ }),
38
+ run: async (args) => {
39
+ // args is guaranteed valid — invalid input never reaches here
40
+ },
41
+ });
42
+ ```
43
+
44
+ Invalid input returns clear error messages (400 for HTTP, structured error for agent calls). The legacy `parameters:` format provides no runtime validation.
45
+
46
+ ## SQL Injection Prevention {#sql-injection}
47
+
48
+ The framework's `db-query` and `db-exec` tools use parameterized queries. User input is passed as arguments, never interpolated into the SQL string:
49
+
50
+ ```typescript
51
+ // SAFE — parameterized query (framework default)
52
+ await exec({ sql: "INSERT INTO notes (title) VALUES (?)", args: [title] });
53
+
54
+ // SAFE — Drizzle ORM (always generates parameterized queries)
55
+ await db.insert(notes).values({ title, ownerEmail: email });
56
+
57
+ // DANGEROUS — string concatenation (never do this)
58
+ await exec(`INSERT INTO notes (title) VALUES ('${title}')`);
59
+ ```
60
+
61
+ ## XSS Prevention {#xss}
62
+
63
+ React auto-escapes all JSX expressions. Additional guidelines:
64
+
65
+ - Never use `dangerouslySetInnerHTML` with user-controlled content
66
+ - Never use `innerHTML`, `eval()`, or `document.write()`
67
+ - For rich text editing, use TipTap (framework dependency) — it sanitizes through its schema
68
+ - For rendering markdown, use `react-markdown` — it converts to React elements safely
69
+
70
+ ## Data Scoping {#data-scoping}
71
+
72
+ In production, the framework automatically restricts agent SQL queries to the current user's data. This is enforced at the SQL level — agents cannot bypass it.
73
+
74
+ ### Per-User Scoping (`owner_email`)
75
+
76
+ Every table with user-specific data **must** have an `owner_email` text column:
77
+
78
+ ```typescript
79
+ import { table, text, integer } from "@agent-native/core/db/schema";
80
+
81
+ export const notes = table("notes", {
82
+ id: text("id").primaryKey(),
83
+ title: text("title").notNull(),
84
+ content: text("content"),
85
+ owner_email: text("owner_email").notNull(), // REQUIRED
86
+ });
87
+ ```
88
+
89
+ The framework creates temporary SQL views that filter queries automatically:
90
+
91
+ ```sql
92
+ CREATE TEMPORARY VIEW "notes" AS
93
+ SELECT * FROM main."notes"
94
+ WHERE "owner_email" = 'alice@example.com';
95
+ ```
96
+
97
+ INSERT statements get `owner_email` auto-injected when the column isn't already present.
98
+
99
+ ### Per-Org Scoping (`org_id`)
100
+
101
+ For multi-user apps where teams share data, add an `org_id` column. When both columns are present, queries are scoped by both: `WHERE owner_email = ? AND org_id = ?`.
102
+
103
+ ### Validation
104
+
105
+ ```bash
106
+ pnpm action db-check-scoping # Check all tables have owner_email
107
+ pnpm action db-check-scoping --require-org # Also require org_id
108
+ ```
109
+
110
+ ## Secrets Management {#secrets}
111
+
112
+ | Secret type | Where to store |
113
+ | ------------------------------- | -------------------------------------------- |
114
+ | API keys (OpenAI, Stripe, etc.) | `.env` file (gitignored, server-side only) |
115
+ | OAuth tokens (Google, GitHub) | `oauth_tokens` store via `saveOAuthTokens()` |
116
+ | Session tokens | Automatic (Better Auth handles this) |
117
+
118
+ Never store secrets in `settings`, `application_state`, source code, or action responses.
119
+
120
+ ## Authentication {#auth}
121
+
122
+ Auth is automatic. See the [Authentication](/docs/authentication) docs for the full setup.
123
+
124
+ **Key points for security:**
125
+
126
+ - `defineAction` endpoints are auto-protected by the auth guard
127
+ - Custom `/api/` routes must call `getSession(event)` and check the result
128
+ - State-changing operations should use POST (the default for actions)
129
+ - `SameSite=lax` + `httpOnly` cookies prevent most CSRF attacks
130
+
131
+ ## A2A Identity Verification {#a2a-identity}
132
+
133
+ When apps call each other via the A2A protocol, they verify identity using JWT tokens signed with a shared secret:
134
+
135
+ ```bash
136
+ A2A_SECRET=your-shared-secret-at-least-32-chars
137
+ ```
138
+
139
+ 1. App A signs a JWT containing `sub: "steve@example.com"`
140
+ 2. App B verifies the JWT signature with the same secret
141
+ 3. App B sets `AGENT_USER_EMAIL` from the verified `sub` claim
142
+ 4. Data scoping applies — App B only shows Steve's data
143
+
144
+ Without `A2A_SECRET`, A2A calls are unauthenticated (fine for local dev, not production).
145
+
146
+ ## Production Checklist {#production-checklist}
147
+
148
+ - [ ] Every user-facing table has `owner_email`
149
+ - [ ] Multi-user tables also have `org_id`
150
+ - [ ] All actions use `defineAction` with Zod `schema:`
151
+ - [ ] No `dangerouslySetInnerHTML` with user content
152
+ - [ ] No string-concatenated SQL
153
+ - [ ] API keys are in `.env` only (not in source code or settings)
154
+ - [ ] `BETTER_AUTH_SECRET` is set to a random 32+ character string
155
+ - [ ] `A2A_SECRET` is set on all apps that call each other
156
+ - [ ] `AUTH_MODE` is **not** set to `local`
157
+ - [ ] `pnpm action db-check-scoping` passes
158
+ - [ ] Tested with two user accounts to verify data isolation