@agent-native/core 0.4.5 → 0.5.0-dev.b51eaae

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 (479) hide show
  1. package/dist/a2a/client.d.ts +7 -0
  2. package/dist/a2a/client.d.ts.map +1 -1
  3. package/dist/a2a/client.js +24 -3
  4. package/dist/a2a/client.js.map +1 -1
  5. package/dist/a2a/handlers.d.ts +6 -3
  6. package/dist/a2a/handlers.d.ts.map +1 -1
  7. package/dist/a2a/handlers.js +45 -39
  8. package/dist/a2a/handlers.js.map +1 -1
  9. package/dist/a2a/index.d.ts +1 -1
  10. package/dist/a2a/index.d.ts.map +1 -1
  11. package/dist/a2a/index.js +2 -2
  12. package/dist/a2a/index.js.map +1 -1
  13. package/dist/a2a/server.d.ts +7 -2
  14. package/dist/a2a/server.d.ts.map +1 -1
  15. package/dist/a2a/server.js +54 -14
  16. package/dist/a2a/server.js.map +1 -1
  17. package/dist/a2a/task-store.d.ts +6 -6
  18. package/dist/a2a/task-store.d.ts.map +1 -1
  19. package/dist/a2a/task-store.js +102 -42
  20. package/dist/a2a/task-store.js.map +1 -1
  21. package/dist/a2a/types.d.ts +2 -0
  22. package/dist/a2a/types.d.ts.map +1 -1
  23. package/dist/action.d.ts +46 -0
  24. package/dist/action.d.ts.map +1 -0
  25. package/dist/action.js +35 -0
  26. package/dist/action.js.map +1 -0
  27. package/dist/adapters/sync/file-sync.js +1 -1
  28. package/dist/agent/index.d.ts +2 -2
  29. package/dist/agent/index.d.ts.map +1 -1
  30. package/dist/agent/index.js.map +1 -1
  31. package/dist/agent/production-agent.d.ts +22 -6
  32. package/dist/agent/production-agent.d.ts.map +1 -1
  33. package/dist/agent/production-agent.js +336 -123
  34. package/dist/agent/production-agent.js.map +1 -1
  35. package/dist/agent/run-manager.d.ts +43 -0
  36. package/dist/agent/run-manager.d.ts.map +1 -0
  37. package/dist/agent/run-manager.js +358 -0
  38. package/dist/agent/run-manager.js.map +1 -0
  39. package/dist/agent/run-store.d.ts +26 -0
  40. package/dist/agent/run-store.d.ts.map +1 -0
  41. package/dist/agent/run-store.js +145 -0
  42. package/dist/agent/run-store.js.map +1 -0
  43. package/dist/agent/thread-data-builder.d.ts +30 -0
  44. package/dist/agent/thread-data-builder.d.ts.map +1 -0
  45. package/dist/agent/thread-data-builder.js +88 -0
  46. package/dist/agent/thread-data-builder.js.map +1 -0
  47. package/dist/agent/types.d.ts +52 -1
  48. package/dist/agent/types.d.ts.map +1 -1
  49. package/dist/application-state/emitter.d.ts +3 -2
  50. package/dist/application-state/emitter.d.ts.map +1 -1
  51. package/dist/application-state/emitter.js +14 -4
  52. package/dist/application-state/emitter.js.map +1 -1
  53. package/dist/application-state/handlers.d.ts.map +1 -1
  54. package/dist/application-state/handlers.js +13 -16
  55. package/dist/application-state/handlers.js.map +1 -1
  56. package/dist/application-state/script-helpers.d.ts +1 -1
  57. package/dist/application-state/script-helpers.d.ts.map +1 -1
  58. package/dist/application-state/script-helpers.js +15 -5
  59. package/dist/application-state/script-helpers.js.map +1 -1
  60. package/dist/application-state/store.d.ts +4 -3
  61. package/dist/application-state/store.d.ts.map +1 -1
  62. package/dist/application-state/store.js +31 -59
  63. package/dist/application-state/store.js.map +1 -1
  64. package/dist/chat-threads/emitter.d.ts +9 -0
  65. package/dist/chat-threads/emitter.d.ts.map +1 -0
  66. package/dist/chat-threads/emitter.js +14 -0
  67. package/dist/chat-threads/emitter.js.map +1 -0
  68. package/dist/chat-threads/store.d.ts +28 -0
  69. package/dist/chat-threads/store.d.ts.map +1 -0
  70. package/dist/chat-threads/store.js +124 -0
  71. package/dist/chat-threads/store.js.map +1 -0
  72. package/dist/cli/create.d.ts.map +1 -1
  73. package/dist/cli/create.js +4 -18
  74. package/dist/cli/create.js.map +1 -1
  75. package/dist/cli/index.js +30 -3
  76. package/dist/cli/index.js.map +1 -1
  77. package/dist/cli/setup-agents.d.ts +11 -0
  78. package/dist/cli/setup-agents.d.ts.map +1 -0
  79. package/dist/cli/setup-agents.js +123 -0
  80. package/dist/cli/setup-agents.js.map +1 -0
  81. package/dist/client/AgentPanel.d.ts +9 -2
  82. package/dist/client/AgentPanel.d.ts.map +1 -1
  83. package/dist/client/AgentPanel.js +466 -29
  84. package/dist/client/AgentPanel.js.map +1 -1
  85. package/dist/client/AssistantChat.d.ts +25 -3
  86. package/dist/client/AssistantChat.d.ts.map +1 -1
  87. package/dist/client/AssistantChat.js +613 -83
  88. package/dist/client/AssistantChat.js.map +1 -1
  89. package/dist/client/ClientOnly.d.ts +14 -0
  90. package/dist/client/ClientOnly.d.ts.map +1 -0
  91. package/dist/client/ClientOnly.js +17 -0
  92. package/dist/client/ClientOnly.js.map +1 -0
  93. package/dist/client/CommandMenu.d.ts +71 -0
  94. package/dist/client/CommandMenu.d.ts.map +1 -0
  95. package/dist/client/CommandMenu.js +257 -0
  96. package/dist/client/CommandMenu.js.map +1 -0
  97. package/dist/client/DefaultSpinner.d.ts +7 -0
  98. package/dist/client/DefaultSpinner.d.ts.map +1 -0
  99. package/dist/client/DefaultSpinner.js +28 -0
  100. package/dist/client/DefaultSpinner.js.map +1 -0
  101. package/dist/client/MultiTabAssistantChat.d.ts +34 -2
  102. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  103. package/dist/client/MultiTabAssistantChat.js +346 -57
  104. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  105. package/dist/client/PoweredByBadge.d.ts.map +1 -1
  106. package/dist/client/PoweredByBadge.js +2 -1
  107. package/dist/client/PoweredByBadge.js.map +1 -1
  108. package/dist/client/active-run-state.d.ts +10 -0
  109. package/dist/client/active-run-state.d.ts.map +1 -0
  110. package/dist/client/active-run-state.js +32 -0
  111. package/dist/client/active-run-state.js.map +1 -0
  112. package/dist/client/agent-chat-adapter.d.ts +2 -1
  113. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  114. package/dist/client/agent-chat-adapter.js +83 -129
  115. package/dist/client/agent-chat-adapter.js.map +1 -1
  116. package/dist/client/agent-chat.js +2 -2
  117. package/dist/client/agent-chat.js.map +1 -1
  118. package/dist/client/components/ApiKeySettings.d.ts +2 -2
  119. package/dist/client/components/ApiKeySettings.js +4 -4
  120. package/dist/client/components/ApiKeySettings.js.map +1 -1
  121. package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
  122. package/dist/client/components/CodeRequiredDialog.js +4 -3
  123. package/dist/client/components/CodeRequiredDialog.js.map +1 -1
  124. package/dist/client/composer/MentionPopover.d.ts +26 -0
  125. package/dist/client/composer/MentionPopover.d.ts.map +1 -0
  126. package/dist/client/composer/MentionPopover.js +130 -0
  127. package/dist/client/composer/MentionPopover.js.map +1 -0
  128. package/dist/client/composer/TiptapComposer.d.ts +19 -0
  129. package/dist/client/composer/TiptapComposer.d.ts.map +1 -0
  130. package/dist/client/composer/TiptapComposer.js +415 -0
  131. package/dist/client/composer/TiptapComposer.js.map +1 -0
  132. package/dist/client/composer/extensions/FileReference.d.ts +3 -0
  133. package/dist/client/composer/extensions/FileReference.d.ts.map +1 -0
  134. package/dist/client/composer/extensions/FileReference.js +36 -0
  135. package/dist/client/composer/extensions/FileReference.js.map +1 -0
  136. package/dist/client/composer/extensions/MentionReference.d.ts +3 -0
  137. package/dist/client/composer/extensions/MentionReference.d.ts.map +1 -0
  138. package/dist/client/composer/extensions/MentionReference.js +63 -0
  139. package/dist/client/composer/extensions/MentionReference.js.map +1 -0
  140. package/dist/client/composer/extensions/SkillReference.d.ts +3 -0
  141. package/dist/client/composer/extensions/SkillReference.d.ts.map +1 -0
  142. package/dist/client/composer/extensions/SkillReference.js +40 -0
  143. package/dist/client/composer/extensions/SkillReference.js.map +1 -0
  144. package/dist/client/composer/index.d.ts +8 -0
  145. package/dist/client/composer/index.d.ts.map +1 -0
  146. package/dist/client/composer/index.js +7 -0
  147. package/dist/client/composer/index.js.map +1 -0
  148. package/dist/client/composer/types.d.ts +32 -0
  149. package/dist/client/composer/types.d.ts.map +1 -0
  150. package/dist/client/composer/types.js +2 -0
  151. package/dist/client/composer/types.js.map +1 -0
  152. package/dist/client/composer/use-file-search.d.ts +6 -0
  153. package/dist/client/composer/use-file-search.d.ts.map +1 -0
  154. package/dist/client/composer/use-file-search.js +40 -0
  155. package/dist/client/composer/use-file-search.js.map +1 -0
  156. package/dist/client/composer/use-mention-search.d.ts +6 -0
  157. package/dist/client/composer/use-mention-search.d.ts.map +1 -0
  158. package/dist/client/composer/use-mention-search.js +39 -0
  159. package/dist/client/composer/use-mention-search.js.map +1 -0
  160. package/dist/client/composer/use-skills.d.ts +7 -0
  161. package/dist/client/composer/use-skills.d.ts.map +1 -0
  162. package/dist/client/composer/use-skills.js +38 -0
  163. package/dist/client/composer/use-skills.js.map +1 -0
  164. package/dist/client/index.d.ts +9 -4
  165. package/dist/client/index.d.ts.map +1 -1
  166. package/dist/client/index.js +8 -3
  167. package/dist/client/index.js.map +1 -1
  168. package/dist/client/resources/ResourceEditor.d.ts +7 -0
  169. package/dist/client/resources/ResourceEditor.d.ts.map +1 -0
  170. package/dist/client/resources/ResourceEditor.js +851 -0
  171. package/dist/client/resources/ResourceEditor.js.map +1 -0
  172. package/dist/client/resources/ResourceTree.d.ts +13 -0
  173. package/dist/client/resources/ResourceTree.d.ts.map +1 -0
  174. package/dist/client/resources/ResourceTree.js +122 -0
  175. package/dist/client/resources/ResourceTree.js.map +1 -0
  176. package/dist/client/resources/ResourcesPanel.d.ts +2 -0
  177. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -0
  178. package/dist/client/resources/ResourcesPanel.js +341 -0
  179. package/dist/client/resources/ResourcesPanel.js.map +1 -0
  180. package/dist/client/resources/index.d.ts +5 -0
  181. package/dist/client/resources/index.d.ts.map +1 -0
  182. package/dist/client/resources/index.js +5 -0
  183. package/dist/client/resources/index.js.map +1 -0
  184. package/dist/client/resources/use-resources.d.ts +45 -0
  185. package/dist/client/resources/use-resources.d.ts.map +1 -0
  186. package/dist/client/resources/use-resources.js +102 -0
  187. package/dist/client/resources/use-resources.js.map +1 -0
  188. package/dist/client/sse-event-processor.d.ts +50 -0
  189. package/dist/client/sse-event-processor.d.ts.map +1 -0
  190. package/dist/client/sse-event-processor.js +267 -0
  191. package/dist/client/sse-event-processor.js.map +1 -0
  192. package/dist/client/terminal/AgentTerminal.d.ts +1 -1
  193. package/dist/client/terminal/AgentTerminal.d.ts.map +1 -1
  194. package/dist/client/terminal/AgentTerminal.js +11 -6
  195. package/dist/client/terminal/AgentTerminal.js.map +1 -1
  196. package/dist/client/use-agent-chat.d.ts +1 -1
  197. package/dist/client/use-agent-chat.d.ts.map +1 -1
  198. package/dist/client/use-agent-chat.js +3 -3
  199. package/dist/client/use-agent-chat.js.map +1 -1
  200. package/dist/client/use-chat-threads.d.ts +36 -0
  201. package/dist/client/use-chat-threads.d.ts.map +1 -0
  202. package/dist/client/use-chat-threads.js +175 -0
  203. package/dist/client/use-chat-threads.js.map +1 -0
  204. package/dist/client/use-db-sync.d.ts +35 -0
  205. package/dist/client/use-db-sync.d.ts.map +1 -0
  206. package/dist/client/use-db-sync.js +74 -0
  207. package/dist/client/use-db-sync.js.map +1 -0
  208. package/dist/client/use-dev-mode.d.ts +4 -2
  209. package/dist/client/use-dev-mode.d.ts.map +1 -1
  210. package/dist/client/use-dev-mode.js +39 -12
  211. package/dist/client/use-dev-mode.js.map +1 -1
  212. package/dist/client/use-file-sync-status.d.ts +1 -1
  213. package/dist/client/use-file-sync-status.js +3 -3
  214. package/dist/client/use-file-sync-status.js.map +1 -1
  215. package/dist/client/use-session.d.ts +1 -1
  216. package/dist/client/use-session.js +2 -2
  217. package/dist/client/use-session.js.map +1 -1
  218. package/dist/client/useProductionAgent.d.ts +1 -1
  219. package/dist/client/useProductionAgent.d.ts.map +1 -1
  220. package/dist/client/useProductionAgent.js +38 -3
  221. package/dist/client/useProductionAgent.js.map +1 -1
  222. package/dist/credentials/index.d.ts +18 -0
  223. package/dist/credentials/index.d.ts.map +1 -0
  224. package/dist/credentials/index.js +32 -0
  225. package/dist/credentials/index.js.map +1 -0
  226. package/dist/db/client.d.ts +35 -0
  227. package/dist/db/client.d.ts.map +1 -0
  228. package/dist/db/client.js +248 -0
  229. package/dist/db/client.js.map +1 -0
  230. package/dist/db/create-get-db.d.ts.map +1 -1
  231. package/dist/db/create-get-db.js +103 -16
  232. package/dist/db/create-get-db.js.map +1 -1
  233. package/dist/db/index.d.ts +10 -6
  234. package/dist/db/index.d.ts.map +1 -1
  235. package/dist/db/index.js +10 -4
  236. package/dist/db/index.js.map +1 -1
  237. package/dist/db/migrations.d.ts.map +1 -1
  238. package/dist/db/migrations.js +31 -30
  239. package/dist/db/migrations.js.map +1 -1
  240. package/dist/db/schema.d.ts +45 -0
  241. package/dist/db/schema.d.ts.map +1 -0
  242. package/dist/db/schema.js +61 -0
  243. package/dist/db/schema.js.map +1 -0
  244. package/dist/deploy/build.js +35 -6
  245. package/dist/deploy/build.js.map +1 -1
  246. package/dist/deploy/route-discovery.d.ts +9 -0
  247. package/dist/deploy/route-discovery.d.ts.map +1 -1
  248. package/dist/deploy/route-discovery.js +30 -1
  249. package/dist/deploy/route-discovery.js.map +1 -1
  250. package/dist/index.browser.d.ts +1 -1
  251. package/dist/index.browser.d.ts.map +1 -1
  252. package/dist/index.browser.js +1 -1
  253. package/dist/index.browser.js.map +1 -1
  254. package/dist/index.d.ts +3 -2
  255. package/dist/index.d.ts.map +1 -1
  256. package/dist/index.js +2 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/oauth-tokens/store.d.ts.map +1 -1
  259. package/dist/oauth-tokens/store.js +43 -81
  260. package/dist/oauth-tokens/store.js.map +1 -1
  261. package/dist/resources/emitter.d.ts +13 -0
  262. package/dist/resources/emitter.d.ts.map +1 -0
  263. package/dist/resources/emitter.js +32 -0
  264. package/dist/resources/emitter.js.map +1 -0
  265. package/dist/resources/handlers.d.ts +45 -0
  266. package/dist/resources/handlers.d.ts.map +1 -0
  267. package/dist/resources/handlers.js +219 -0
  268. package/dist/resources/handlers.js.map +1 -0
  269. package/dist/resources/index.d.ts +5 -0
  270. package/dist/resources/index.d.ts.map +1 -0
  271. package/dist/resources/index.js +5 -0
  272. package/dist/resources/index.js.map +1 -0
  273. package/dist/resources/script-helpers.d.ts +24 -0
  274. package/dist/resources/script-helpers.d.ts.map +1 -0
  275. package/dist/resources/script-helpers.js +36 -0
  276. package/dist/resources/script-helpers.js.map +1 -0
  277. package/dist/resources/store.d.ts +35 -0
  278. package/dist/resources/store.d.ts.map +1 -0
  279. package/dist/resources/store.js +453 -0
  280. package/dist/resources/store.js.map +1 -0
  281. package/dist/scripts/call-agent.d.ts +5 -0
  282. package/dist/scripts/call-agent.d.ts.map +1 -0
  283. package/dist/scripts/call-agent.js +107 -0
  284. package/dist/scripts/call-agent.js.map +1 -0
  285. package/dist/scripts/core-scripts.d.ts.map +1 -1
  286. package/dist/scripts/core-scripts.js +2 -0
  287. package/dist/scripts/core-scripts.js.map +1 -1
  288. package/dist/scripts/db/exec.d.ts +6 -2
  289. package/dist/scripts/db/exec.d.ts.map +1 -1
  290. package/dist/scripts/db/exec.js +127 -36
  291. package/dist/scripts/db/exec.js.map +1 -1
  292. package/dist/scripts/db/query.d.ts +7 -2
  293. package/dist/scripts/db/query.d.ts.map +1 -1
  294. package/dist/scripts/db/query.js +89 -45
  295. package/dist/scripts/db/query.js.map +1 -1
  296. package/dist/scripts/db/schema.d.ts +2 -2
  297. package/dist/scripts/db/schema.d.ts.map +1 -1
  298. package/dist/scripts/db/schema.js +145 -6
  299. package/dist/scripts/db/schema.js.map +1 -1
  300. package/dist/scripts/db/scoping.d.ts +36 -0
  301. package/dist/scripts/db/scoping.d.ts.map +1 -0
  302. package/dist/scripts/db/scoping.js +198 -0
  303. package/dist/scripts/db/scoping.js.map +1 -0
  304. package/dist/scripts/dev/index.d.ts +2 -2
  305. package/dist/scripts/dev/index.js +1 -1
  306. package/dist/scripts/dev/list-files.d.ts +2 -2
  307. package/dist/scripts/dev/read-file.d.ts +2 -2
  308. package/dist/scripts/dev/read-file.js +1 -1
  309. package/dist/scripts/dev/read-file.js.map +1 -1
  310. package/dist/scripts/dev/search-files.d.ts +2 -2
  311. package/dist/scripts/dev/search-files.js +1 -1
  312. package/dist/scripts/dev/search-files.js.map +1 -1
  313. package/dist/scripts/dev/shell.d.ts +2 -2
  314. package/dist/scripts/dev/shell.js +1 -1
  315. package/dist/scripts/dev/shell.js.map +1 -1
  316. package/dist/scripts/dev/write-file.d.ts +2 -2
  317. package/dist/scripts/dev/write-file.js +1 -1
  318. package/dist/scripts/dev/write-file.js.map +1 -1
  319. package/dist/scripts/resources/delete.d.ts +10 -0
  320. package/dist/scripts/resources/delete.d.ts.map +1 -0
  321. package/dist/scripts/resources/delete.js +38 -0
  322. package/dist/scripts/resources/delete.js.map +1 -0
  323. package/dist/scripts/resources/index.d.ts +2 -0
  324. package/dist/scripts/resources/index.d.ts.map +1 -0
  325. package/dist/scripts/resources/index.js +8 -0
  326. package/dist/scripts/resources/index.js.map +1 -0
  327. package/dist/scripts/resources/list.d.ts +10 -0
  328. package/dist/scripts/resources/list.d.ts.map +1 -0
  329. package/dist/scripts/resources/list.js +57 -0
  330. package/dist/scripts/resources/list.js.map +1 -0
  331. package/dist/scripts/resources/migrate-learnings.d.ts +10 -0
  332. package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -0
  333. package/dist/scripts/resources/migrate-learnings.js +23 -0
  334. package/dist/scripts/resources/migrate-learnings.js.map +1 -0
  335. package/dist/scripts/resources/read.d.ts +10 -0
  336. package/dist/scripts/resources/read.d.ts.map +1 -0
  337. package/dist/scripts/resources/read.js +59 -0
  338. package/dist/scripts/resources/read.js.map +1 -0
  339. package/dist/scripts/resources/write.d.ts +10 -0
  340. package/dist/scripts/resources/write.d.ts.map +1 -0
  341. package/dist/scripts/resources/write.js +67 -0
  342. package/dist/scripts/resources/write.js.map +1 -0
  343. package/dist/scripts/runner.d.ts +7 -7
  344. package/dist/scripts/runner.d.ts.map +1 -1
  345. package/dist/scripts/runner.js +68 -27
  346. package/dist/scripts/runner.js.map +1 -1
  347. package/dist/scripts/utils.d.ts +4 -1
  348. package/dist/scripts/utils.d.ts.map +1 -1
  349. package/dist/scripts/utils.js +5 -3
  350. package/dist/scripts/utils.js.map +1 -1
  351. package/dist/server/action-discovery.d.ts +40 -0
  352. package/dist/server/action-discovery.d.ts.map +1 -0
  353. package/dist/server/action-discovery.js +189 -0
  354. package/dist/server/action-discovery.js.map +1 -0
  355. package/dist/server/agent-chat-plugin.d.ts +12 -23
  356. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  357. package/dist/server/agent-chat-plugin.js +1087 -36
  358. package/dist/server/agent-chat-plugin.js.map +1 -1
  359. package/dist/server/agent-discovery.d.ts +16 -0
  360. package/dist/server/agent-discovery.d.ts.map +1 -0
  361. package/dist/server/agent-discovery.js +136 -0
  362. package/dist/server/agent-discovery.js.map +1 -0
  363. package/dist/server/auth-plugin.d.ts +5 -0
  364. package/dist/server/auth-plugin.d.ts.map +1 -1
  365. package/dist/server/auth-plugin.js +12 -1
  366. package/dist/server/auth-plugin.js.map +1 -1
  367. package/dist/server/auth.d.ts +3 -1
  368. package/dist/server/auth.d.ts.map +1 -1
  369. package/dist/server/auth.js +576 -117
  370. package/dist/server/auth.js.map +1 -1
  371. package/dist/server/core-routes-plugin.d.ts +57 -0
  372. package/dist/server/core-routes-plugin.d.ts.map +1 -0
  373. package/dist/server/core-routes-plugin.js +125 -0
  374. package/dist/server/core-routes-plugin.js.map +1 -0
  375. package/dist/server/create-server.d.ts +4 -4
  376. package/dist/server/create-server.d.ts.map +1 -1
  377. package/dist/server/create-server.js +5 -5
  378. package/dist/server/create-server.js.map +1 -1
  379. package/dist/server/default-watcher.d.ts +9 -3
  380. package/dist/server/default-watcher.d.ts.map +1 -1
  381. package/dist/server/default-watcher.js +26 -6
  382. package/dist/server/default-watcher.js.map +1 -1
  383. package/dist/server/google-auth-plugin.js +3 -3
  384. package/dist/server/google-auth-plugin.js.map +1 -1
  385. package/dist/server/google-oauth.d.ts +72 -0
  386. package/dist/server/google-oauth.d.ts.map +1 -0
  387. package/dist/server/google-oauth.js +187 -0
  388. package/dist/server/google-oauth.js.map +1 -0
  389. package/dist/server/index.d.ts +9 -2
  390. package/dist/server/index.d.ts.map +1 -1
  391. package/dist/server/index.js +8 -1
  392. package/dist/server/index.js.map +1 -1
  393. package/dist/server/oauth-helpers.d.ts +16 -0
  394. package/dist/server/oauth-helpers.d.ts.map +1 -0
  395. package/dist/server/oauth-helpers.js +25 -0
  396. package/dist/server/oauth-helpers.js.map +1 -0
  397. package/dist/server/poll.d.ts +40 -0
  398. package/dist/server/poll.d.ts.map +1 -0
  399. package/dist/server/poll.js +49 -0
  400. package/dist/server/poll.js.map +1 -0
  401. package/dist/server/resources-plugin.d.ts +27 -0
  402. package/dist/server/resources-plugin.d.ts.map +1 -0
  403. package/dist/server/resources-plugin.js +74 -0
  404. package/dist/server/resources-plugin.js.map +1 -0
  405. package/dist/server/script-discovery.d.ts +6 -0
  406. package/dist/server/script-discovery.d.ts.map +1 -0
  407. package/dist/server/script-discovery.js +6 -0
  408. package/dist/server/script-discovery.js.map +1 -0
  409. package/dist/server/sse.d.ts +1 -1
  410. package/dist/server/sse.js +1 -1
  411. package/dist/settings/handlers.d.ts +3 -3
  412. package/dist/settings/handlers.d.ts.map +1 -1
  413. package/dist/settings/handlers.js +8 -6
  414. package/dist/settings/handlers.js.map +1 -1
  415. package/dist/settings/index.d.ts +1 -1
  416. package/dist/settings/index.d.ts.map +1 -1
  417. package/dist/settings/index.js.map +1 -1
  418. package/dist/settings/store.d.ts +6 -2
  419. package/dist/settings/store.d.ts.map +1 -1
  420. package/dist/settings/store.js +26 -63
  421. package/dist/settings/store.js.map +1 -1
  422. package/dist/settings/user-settings.d.ts +3 -2
  423. package/dist/settings/user-settings.d.ts.map +1 -1
  424. package/dist/settings/user-settings.js +5 -5
  425. package/dist/settings/user-settings.js.map +1 -1
  426. package/dist/tailwind.preset.d.ts +7 -6
  427. package/dist/tailwind.preset.d.ts.map +1 -1
  428. package/dist/tailwind.preset.js +18 -1
  429. package/dist/tailwind.preset.js.map +1 -1
  430. package/dist/terminal/cli-registry.d.ts +1 -1
  431. package/dist/terminal/cli-registry.js +3 -3
  432. package/dist/terminal/cli-registry.js.map +1 -1
  433. package/dist/terminal/pty-server.d.ts.map +1 -1
  434. package/dist/terminal/pty-server.js +65 -11
  435. package/dist/terminal/pty-server.js.map +1 -1
  436. package/dist/terminal/terminal-plugin.d.ts +2 -2
  437. package/dist/terminal/terminal-plugin.d.ts.map +1 -1
  438. package/dist/terminal/terminal-plugin.js +27 -21
  439. package/dist/terminal/terminal-plugin.js.map +1 -1
  440. package/dist/vite/client.d.ts.map +1 -1
  441. package/dist/vite/client.js +114 -8
  442. package/dist/vite/client.js.map +1 -1
  443. package/dist/vite/dev-api-server.d.ts +1 -1
  444. package/dist/vite/dev-api-server.d.ts.map +1 -1
  445. package/dist/vite/dev-api-server.js +105 -22
  446. package/dist/vite/dev-api-server.js.map +1 -1
  447. package/package.json +22 -6
  448. package/src/templates/default/.agents/skills/actions/SKILL.md +136 -0
  449. package/src/templates/default/.agents/skills/create-skill/SKILL.md +1 -1
  450. package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +1 -1
  451. package/src/templates/default/.agents/skills/files-as-database/SKILL.md +2 -2
  452. package/src/templates/default/.agents/skills/real-time-sync/SKILL.md +112 -0
  453. package/src/templates/default/AGENTS.md +56 -164
  454. package/src/templates/default/DEVELOPING.md +117 -0
  455. package/src/templates/default/{scripts → actions}/hello.ts +1 -1
  456. package/src/templates/default/actions/navigate.ts +53 -0
  457. package/src/templates/default/actions/view-screen.ts +39 -0
  458. package/src/templates/default/app/global.css +2 -2
  459. package/src/templates/default/app/root.tsx +19 -16
  460. package/src/templates/default/app/routes/_index.tsx +1 -1
  461. package/src/templates/default/package.json +4 -0
  462. package/src/templates/default/server/plugins/.gitkeep +0 -0
  463. package/dist/a2a/middleware.d.ts +0 -3
  464. package/dist/a2a/middleware.d.ts.map +0 -1
  465. package/dist/a2a/middleware.js +0 -36
  466. package/dist/a2a/middleware.js.map +0 -1
  467. package/dist/client/use-file-watcher.d.ts +0 -23
  468. package/dist/client/use-file-watcher.d.ts.map +0 -1
  469. package/dist/client/use-file-watcher.js +0 -50
  470. package/dist/client/use-file-watcher.js.map +0 -1
  471. package/src/templates/default/.agents/skills/scripts/SKILL.md +0 -121
  472. package/src/templates/default/.agents/skills/sse-file-watcher/SKILL.md +0 -80
  473. package/src/templates/default/server/plugins/agent-chat.ts +0 -1
  474. package/src/templates/default/server/plugins/auth.ts +0 -1
  475. package/src/templates/default/server/plugins/file-sync.ts +0 -1
  476. package/src/templates/default/server/plugins/terminal.ts +0 -1
  477. package/src/templates/default/server/routes/api/events.get.ts +0 -3
  478. package/src/templates/default/server/routes/api/file-sync/status.get.ts +0 -4
  479. /package/src/templates/default/{scripts → actions}/run.ts +0 -0
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: actions
3
+ description: >-
4
+ How to create and run agent-callable actions in actions/. Use when creating
5
+ a new action, adding an API integration, implementing a complex agent
6
+ operation, or running pnpm action commands.
7
+ ---
8
+
9
+ # Agent Actions
10
+
11
+ ## Rule
12
+
13
+ Complex operations the agent needs to perform are implemented as actions in `actions/`. The agent runs them via `pnpm action <name>`.
14
+
15
+ ## Why
16
+
17
+ Actions give the agent callable tools with structured input/output. They keep the agent's chat context clean (no massive code blocks), they're reusable, and they can be tested independently.
18
+
19
+ ## How to Create an Action
20
+
21
+ Create `actions/my-action.ts`:
22
+
23
+ ```ts
24
+ import fs from "fs";
25
+ import { parseArgs, loadEnv, fail, agentChat } from "@agent-native/core";
26
+
27
+ export default async function myAction(args: string[]) {
28
+ loadEnv();
29
+
30
+ const parsed = parseArgs(args);
31
+ const input = parsed.input;
32
+ if (!input) fail("--input is required");
33
+
34
+ const outputPath = parsed.output ?? "data/result.json";
35
+ const raw = fs.readFileSync(input, "utf-8");
36
+ const data = JSON.parse(raw) as unknown;
37
+
38
+ fs.writeFileSync(outputPath, JSON.stringify(data, null, 2));
39
+ agentChat.submit(`Processed ${input}, result saved to ${outputPath}`);
40
+ }
41
+ ```
42
+
43
+ ### Using `defineAction` (recommended for new actions)
44
+
45
+ ```ts
46
+ import { defineAction } from "@agent-native/core";
47
+
48
+ export default defineAction({
49
+ description: "Process some data",
50
+ parameters: {
51
+ input: { type: "string", description: "Input file path" },
52
+ output: { type: "string", description: "Output file path" },
53
+ },
54
+ run: async (args) => {
55
+ // do work
56
+ return "Done";
57
+ },
58
+ });
59
+ ```
60
+
61
+ ## How to Run
62
+
63
+ ```bash
64
+ pnpm action my-action --input data/source.json --output data/result.json
65
+ ```
66
+
67
+ ## Action Dispatcher
68
+
69
+ The default template uses core's `runScript()` in `actions/run.ts`:
70
+
71
+ ```ts
72
+ import { runScript } from "@agent-native/core";
73
+ runScript();
74
+ ```
75
+
76
+ This is the canonical approach for new apps. Action names must be lowercase with hyphens only (e.g., `my-action`).
77
+
78
+ ## Guidelines
79
+
80
+ - **One action, one job.** Keep actions focused on a single operation. The agent composes multiple action calls for complex operations.
81
+ - **Use `parseArgs()`** for structured argument parsing. It converts `--key value` pairs to a `Record<string, string>`.
82
+ - **Use `loadEnv()`** if the action needs environment variables (API keys, etc.).
83
+ - **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
84
+ - **Write results to the database.** The agent and UI will pick them up via db sync polling.
85
+ - **Use `agentChat.submit()`** to report results or errors back to the agent chat.
86
+ - **Import from `@agent-native/core`** -- Don't redefine `parseArgs()` or other utilities locally.
87
+
88
+ ## Common Patterns
89
+
90
+ **API integration action** (e.g., image generation):
91
+
92
+ ```ts
93
+ import fs from "fs";
94
+ import { parseArgs, loadEnv, fail } from "@agent-native/core";
95
+
96
+ export default async function generateImage(args: string[]) {
97
+ loadEnv();
98
+ const parsed = parseArgs(args);
99
+ const prompt = parsed.prompt;
100
+ if (!prompt) fail("--prompt is required");
101
+
102
+ const outputPath = parsed.output ?? "data/generated-image.png";
103
+ const imageUrl = await callImageAPI(prompt);
104
+ const buffer = await fetch(imageUrl).then((r) => r.arrayBuffer());
105
+ fs.writeFileSync(outputPath, Buffer.from(buffer));
106
+ }
107
+ ```
108
+
109
+ **Data processing action:**
110
+
111
+ ```ts
112
+ import fs from "fs";
113
+ import { parseArgs, fail } from "@agent-native/core";
114
+
115
+ export default async function transform(args: string[]) {
116
+ const parsed = parseArgs(args);
117
+ const source = parsed.source;
118
+ if (!source) fail("--source is required");
119
+
120
+ const data = JSON.parse(fs.readFileSync(source, "utf-8")) as unknown[];
121
+ const result = data.map(transformItem);
122
+ fs.writeFileSync(source, JSON.stringify(result, null, 2));
123
+ }
124
+ ```
125
+
126
+ ## Troubleshooting
127
+
128
+ - **Action not found** -- Check that the filename matches the command name exactly. `pnpm action foo-bar` looks for `actions/foo-bar.ts`.
129
+ - **Args not parsing** -- Ensure args use `--key value` or `--key=value` format. Boolean flags use `--flag` (sets value to `"true"`).
130
+ - **Action runs but UI doesn't update** -- Make sure results are written to the database so db sync polling picks them up.
131
+
132
+ ## Related Skills
133
+
134
+ - **files-as-database** -- Actions read/write data files in `data/`
135
+ - **delegate-to-agent** -- The agent invokes actions via `pnpm action <name>`
136
+ - **real-time-sync** -- Database writes from actions trigger poll events to update the UI
@@ -148,7 +148,7 @@ description: >-
148
148
 
149
149
  - **Inline LLM calls** — Skills must not call LLMs directly (violates Rule 2)
150
150
  - **Database patterns** — Skills must not introduce databases (violates Rule 1)
151
- - **Ignoring SSE** — If a skill creates data files, mention wiring up `useFileWatcher`
151
+ - **Ignoring db sync** — If a skill creates data, mention wiring up `useDbSync`
152
152
  - **Vague descriptions** — "Helps with development" won't trigger. Be specific about _when_.
153
153
  - **Pure documentation** — Skills should guide action, not just explain concepts
154
154
 
@@ -84,7 +84,7 @@ Scripts may call external APIs (image generation, search, etc.) — but the AI r
84
84
 
85
85
  ## Related Skills
86
86
 
87
- - **scripts** — The agent invokes scripts via `pnpm script <name>` to perform complex operations
87
+ - **scripts** — The agent invokes scripts via `pnpm action <name>` to perform complex operations
88
88
  - **self-modifying-code** — The agent operates through the chat bridge to make code changes
89
89
  - **storing-data** — The agent writes results to the database after processing requests
90
90
  - **real-time-sync** — The UI updates automatically when the agent writes to the database
@@ -63,9 +63,9 @@ SSE: writes automatically notify the UI via `{ source: "app-state", type: "chang
63
63
  For data with schemas, relationships, and queries: forms, bookings, emails, compositions. Define tables in `server/db/schema.ts` using Drizzle ORM.
64
64
 
65
65
  ```ts
66
- import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
66
+ import { table, text, integer } from "@agent-native/core/db/schema";
67
67
 
68
- export const bookings = sqliteTable("bookings", {
68
+ export const bookings = table("bookings", {
69
69
  id: text("id").primaryKey(),
70
70
  name: text("name").notNull(),
71
71
  email: text("email").notNull(),
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: real-time-sync
3
+ description: >-
4
+ How to keep the UI in sync with agent changes via polling. Use when wiring
5
+ query invalidation for new data models, debugging UI not updating, or
6
+ understanding jitter prevention.
7
+ ---
8
+
9
+ # Real-Time Sync (Polling)
10
+
11
+ ## Rule
12
+
13
+ The UI stays in sync with agent/script changes through database polling. When the agent writes to the database, the UI detects the change and updates automatically — no manual refresh needed.
14
+
15
+ ## Why
16
+
17
+ The agent modifies data in SQL, but the UI runs in the browser. Polling bridges this gap: every database write increments a version counter, the `useDbSync()` hook polls for version changes, and React Query invalidates the relevant caches. This is what makes database writes feel real-time.
18
+
19
+ ## How It Works
20
+
21
+ 1. **Server** increments a version counter on every database write. The `/_agent-native/poll` endpoint returns the current version and any events since the last poll.
22
+
23
+ 2. **Client** polls for changes and invalidates React Query caches:
24
+
25
+ ```ts
26
+ import { useDbSync } from "@agent-native/core";
27
+ useDbSync({ queryClient, queryKeys: ["items", "settings"] });
28
+ ```
29
+
30
+ 3. When the agent writes to the database, the version increments, polling detects it, and React Query refetches the affected queries.
31
+
32
+ ## Don't
33
+
34
+ - Don't create manual polling loops — `useDbSync()` handles it (polls every 2 seconds by default)
35
+ - Don't create your own fetch-based polling alongside `useDbSync` — use the `onEvent` callback for custom handling
36
+
37
+ ## Query Key Mapping
38
+
39
+ By default, `useDbSync` invalidates all listed query keys on every change. For apps with multiple data models, this causes unnecessary refetches. Use event-based filtering via the `onEvent` callback:
40
+
41
+ ```ts
42
+ useDbSync({
43
+ queryClient,
44
+ queryKeys: [], // don't auto-invalidate everything
45
+ onEvent: (data) => {
46
+ if (data.source === "settings") {
47
+ queryClient.invalidateQueries({ queryKey: ["settings"] });
48
+ } else if (data.source === "app-state") {
49
+ queryClient.invalidateQueries({ queryKey: ["navigate-command"] });
50
+ } else {
51
+ queryClient.invalidateQueries({ queryKey: ["items"] });
52
+ }
53
+ },
54
+ });
55
+ ```
56
+
57
+ To prevent cache thrashing during rapid agent writes, set `staleTime` on your queries:
58
+
59
+ ```ts
60
+ useQuery({
61
+ queryKey: ["items"],
62
+ queryFn: fetchItems,
63
+ staleTime: 2000, // don't refetch within 2 seconds
64
+ });
65
+ ```
66
+
67
+ ## Troubleshooting
68
+
69
+ | Symptom | Check |
70
+ | ---------------------------------- | -------------------------------------------------------------------------------------------------------------- |
71
+ | UI not updating after agent writes | Is `useDbSync` called with the correct `queryClient`? Are the `queryKeys` matching your `useQuery` keys? |
72
+ | Poll endpoint not responding | Is `/_agent-native/poll` accessible? Is the server running? |
73
+ | High CPU / event storms | The agent is writing rapidly. Add `staleTime` to queries and use event-based filtering. |
74
+
75
+ ## Jitter Prevention
76
+
77
+ When the agent writes to application-state via script helpers (`writeAppState`, `deleteAppState`), the write is automatically tagged with `requestSource: "agent"`. This prevents the UI from overwriting active user edits when it receives the change event.
78
+
79
+ ### How it works
80
+
81
+ 1. **Agent writes** are tagged: the script helpers in `@agent-native/core/application-state` pass `{ requestSource: "agent" }` to the store.
82
+ 2. **UI writes** are tagged: templates send a per-tab ID via the `X-Request-Source` header on PUT/DELETE requests to application-state endpoints.
83
+ 3. **Polling filters**: `useDbSync()` accepts an `ignoreSource` option. The UI passes its own tab ID so it ignores events from its own writes — but still picks up events from agents, other tabs, and scripts.
84
+
85
+ ### Template setup
86
+
87
+ ```ts
88
+ // app/lib/tab-id.ts
89
+ export const TAB_ID = `tab-${Math.random().toString(36).slice(2, 8)}`;
90
+
91
+ // app/root.tsx
92
+ import { TAB_ID } from "@/lib/tab-id";
93
+
94
+ useDbSync({
95
+ queryClient,
96
+ queryKeys: ["app-state", "settings"],
97
+ ignoreSource: TAB_ID,
98
+ });
99
+ ```
100
+
101
+ The `use-navigation-state.ts` hook sends the same `TAB_ID` in the `X-Request-Source` header when writing navigation state, so the tab that wrote the state does not refetch it.
102
+
103
+ ### Why this matters
104
+
105
+ Without jitter prevention, a cycle occurs: the UI writes state, polling detects the change, the UI refetches and re-renders, potentially overwriting what the user is actively editing. With `ignoreSource`, the UI only reacts to changes from other sources (agent scripts, other browser tabs, other users).
106
+
107
+ ## Related Skills
108
+
109
+ - **storing-data** — Application-state and settings are the data stores that sync via polling
110
+ - **context-awareness** — Navigation state writes use jitter prevention to avoid overwriting active edits
111
+ - **scripts** — Script outputs written to the database trigger poll events
112
+ - **self-modifying-code** — Agent code edits trigger poll events; rapid edits can cause event storms
@@ -1,73 +1,71 @@
1
- # {{APP_NAME}} — Agent-Native App
1
+ # {{APP_NAME}} — Agent Guide
2
2
 
3
- ## Architecture
3
+ This app follows the agent-native core philosophy: the agent and UI are equal partners. Everything the UI can do, the agent can do via actions. The agent always knows what you're looking at via application state. See the root AGENTS.md for full framework documentation.
4
4
 
5
- This is an **@agent-native/core** application the AI agent and UI share state through a SQL database, with SSE for real-time sync.
5
+ This is an **@agent-native/core** application -- the AI agent and UI share state through a SQL database, with polling for real-time sync.
6
6
 
7
7
  ### Core Principles
8
8
 
9
- 1. **Shared SQL database** All app state lives in SQL (SQLite locally, cloud DB via `DATABASE_URL` in production). Core stores: `application_state`, `settings`, `oauth_tokens`, `sessions`.
10
- 2. **All AI through agent chat** No inline LLM calls. UI delegates to the AI via `sendToAgentChat()` / `agentChat.submit()`.
11
- 3. **Scripts for agent operations** `pnpm script <name>` dispatches to callable script files in `scripts/`.
12
- 4. **SSE for real-time sync** Database writes emit events that keep the UI in sync automatically.
13
- 5. **Agent can update code** The agent can modify this app's source code directly.
9
+ 1. **Shared SQL database** -- All app state lives in SQL (SQLite locally, cloud DB via `DATABASE_URL` in production). Core stores: `application_state`, `settings`, `oauth_tokens`, `sessions`, `resources`.
10
+ 2. **All AI through agent chat** -- No inline LLM calls. UI delegates to the AI via `sendToAgentChat()` / `agentChat.submit()`.
11
+ 3. **Actions for agent operations** -- `pnpm action <name>` dispatches to callable action files in `actions/`.
12
+ 4. **Polling for real-time sync** -- Database writes trigger version counter increments that the UI polls to stay in sync.
13
+ 5. **Agent can update code** -- The agent can modify this app's source code directly.
14
14
 
15
15
  ### Authentication
16
16
 
17
- Auth is automatic and environment-driven. The `server/plugins/auth.ts` plugin calls `autoMountAuth(app)` at startup.
17
+ Auth is automatic and environment-driven:
18
18
 
19
- - **Dev mode**: Auth is bypassed. `getSession()` returns `{ email: "local@localhost" }`. Zero friction.
20
- - **Production** (`ACCESS_TOKEN` set): Auth middleware auto-mounts. Login page for unauthenticated visitors.
21
- - **Production** (no token, no `AUTH_DISABLED=true`): Server refuses to start.
19
+ - **Dev mode**: Auth is bypassed. `getSession()` returns `{ email: "local@localhost" }`.
20
+ - **Production** (`ACCESS_TOKEN` set): Auth middleware auto-mounts.
22
21
 
23
- Use `getSession(event)` server-side and `useSession()` client-side. See [docs/auth.md](docs/auth.md).
22
+ Use `getSession(event)` server-side and `useSession()` client-side.
24
23
 
25
- ### Directory Structure
24
+ ## Resources
26
25
 
27
- ```
28
- app/ # React frontend
29
- root.tsx # HTML shell + global providers
30
- entry.client.tsx # Client hydration entry
31
- routes.ts # Route config — flatRoutes()
32
- routes/ # File-based page routes (auto-discovered)
33
- _index.tsx # / (home page)
34
- components/ # UI components
35
- hooks/ # React hooks
36
- lib/ # Utilities (cn, etc)
26
+ Resources are SQL-backed persistent files for notes, learnings, and context.
37
27
 
38
- server/ # Nitro API server
39
- routes/
40
- api/ # File-based API routes (auto-discovered)
41
- [...page].get.ts # SSR catch-all (delegates to React Router)
42
- plugins/ # Server plugins (startup logic)
43
- lib/ # Shared server modules
28
+ **At the start of every conversation, read these resources (both personal and shared scopes):**
44
29
 
45
- shared/ # Isomorphic code (imported by both client & server)
30
+ 1. **`AGENTS.md`** -- user-specific context. Read both `--scope personal` and `--scope shared`.
31
+ 2. **`LEARNINGS.md`** -- user preferences, corrections, and patterns. Read both scopes.
46
32
 
47
- scripts/ # Agent-callable scripts
48
- run.ts # Script dispatcher
49
- *.ts # Individual scripts (pnpm script <name>)
33
+ **Update `LEARNINGS.md` when you learn something important.**
50
34
 
51
- data/ # App data (SQLite DB file)
35
+ | Action | Args | Purpose |
36
+ | ----------------- | ----------------------------------------------------------- | ----------------------- |
37
+ | `resource-read` | `--path <path> [--scope personal\|shared]` | Read a resource |
38
+ | `resource-write` | `--path <path> --content <text> [--scope personal\|shared]` | Write/update a resource |
39
+ | `resource-list` | `[--prefix <path>] [--scope personal\|shared\|all]` | List resources |
40
+ | `resource-delete` | `--path <path> [--scope personal\|shared]` | Delete a resource |
52
41
 
53
- react-router.config.ts # React Router framework config
54
- .agents/skills/ # Agent skills — detailed guidance for each rule
55
- ```
42
+ ## Application State
56
43
 
57
- ## Learnings & Preferences
44
+ Ephemeral UI state is stored in the SQL `application_state` table, accessed via `readAppState(key)` and `writeAppState(key, value)` from `@agent-native/core/application-state`.
58
45
 
59
- **Always read `learnings.md` at the start of every conversation.** This file is the app's memory — it contains user preferences, corrections, important context, and patterns learned from past interactions.
46
+ | State Key | Purpose | Direction |
47
+ | ------------ | ----------------------------------------- | -------------------------- |
48
+ | `navigation` | Current view | UI -> Agent (read-only) |
49
+ | `navigate` | Navigate command (one-shot, auto-deleted) | Agent -> UI (auto-deleted) |
60
50
 
61
- **Update `learnings.md` when you learn something important:**
51
+ The `navigation` key is written by the UI whenever the route changes. The `navigate` key is a one-shot command: the agent writes it, the UI reads and executes the navigation, then deletes it.
62
52
 
63
- - User corrects your tone, style, or approach
64
- - User shares personal info relevant to the app (contacts, preferences, habits)
65
- - You discover a non-obvious pattern or gotcha
66
- - User gives feedback that should apply to future conversations
53
+ ## Agent Operations
67
54
 
68
- Keep entries concise and actionable. Group by category. This file is gitignored so personal data stays local.
55
+ **Always run `pnpm action view-screen` first** before taking any action. This tells you what the user is looking at.
69
56
 
70
- ---
57
+ ### Actions
58
+
59
+ | Action | Args | Purpose |
60
+ | ------------- | --------------------------------- | ------------------------------- |
61
+ | `view-screen` | | See current UI state |
62
+ | `navigate` | `--view <name>` or `--path <url>` | Navigate the UI |
63
+ | `hello` | `[--name <name>]` | Example script |
64
+ | `db-schema` | | Show all tables, columns, types |
65
+ | `db-query` | `--sql "SELECT ..."` | Run a SELECT query |
66
+ | `db-exec` | `--sql "INSERT ..."` | Run INSERT/UPDATE/DELETE |
67
+
68
+ ## Skills
71
69
 
72
70
  Skills in `.agents/skills/` provide detailed guidance for each architectural rule. Read them before making changes.
73
71
 
@@ -75,128 +73,22 @@ Skills in `.agents/skills/` provide detailed guidance for each architectural rul
75
73
  | --------------------- | -------------------------------------------------------------- |
76
74
  | `storing-data` | Before storing or reading any app state |
77
75
  | `delegate-to-agent` | Before adding LLM calls or AI delegation |
78
- | `scripts` | Before creating or modifying scripts |
76
+ | `actions` | Before creating or modifying actions |
79
77
  | `real-time-sync` | Before wiring up real-time UI sync |
80
78
  | `self-modifying-code` | Before editing source, components, or styles |
79
+ | `capture-learnings` | Before recording user preferences or corrections |
81
80
  | `frontend-design` | Before building or restyling any UI component, page, or layout |
82
81
 
83
- The **`frontend-design`** skill (sourced from [Anthropic's skills library](https://github.com/anthropics/skills/blob/main/skills/frontend-design/SKILL.md)) enforces distinctive, production-grade aesthetics — committing to a clear visual direction and avoiding generic patterns like purple gradients, overused fonts, and cookie-cutter layouts.
84
-
85
- ### Framework Basics
86
-
87
- **SSR-first framework, CSR-by-default content:** This app uses React Router v7 framework mode with `ssr: true`. But virtually every route renders only an SSR shell (loading spinner + meta tags). All real data fetching and rendering happens on the client via React Query hooks. Server-side data fetching is the exception — only used for public pages that need SEO/og tags.
88
-
89
- **Adding a page:**
90
- Create a file in `app/routes/`. The filename determines the URL path:
91
-
92
- ```
93
- app/routes/_index.tsx → /
94
- app/routes/settings.tsx → /settings
95
- app/routes/inbox.tsx → /inbox
96
- app/routes/inbox.$threadId.tsx → /inbox/:threadId
97
- app/routes/$id.tsx → /:id (dynamic param)
98
- ```
99
-
100
- Each route file exports a default component, optional `meta()`, and optional `HydrateFallback()`:
101
-
102
- ```tsx
103
- import MyPage from "@/pages/MyPage";
104
-
105
- export function meta() {
106
- return [{ title: "My Page" }];
107
- }
108
-
109
- export function HydrateFallback() {
110
- return (
111
- <div className="flex items-center justify-center h-screen">
112
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-foreground" />
113
- </div>
114
- );
115
- }
116
-
117
- export default function MyPageRoute() {
118
- return <MyPage />;
119
- }
120
- ```
121
-
122
- **Do NOT fetch data server-side** in route loaders unless the page genuinely needs SEO content or og tags based on dynamic data. The standard pattern is: SSR renders a loading spinner, client hydrates, React Query hooks fetch from `/api/*`.
123
-
124
- ### Key Patterns
82
+ ## When Adding Features
125
83
 
126
- **Adding an API route:**
127
- Create a file in `server/routes/api/`. The filename determines the URL path and HTTP method:
84
+ As you build out this app, follow this checklist for each new feature:
128
85
 
129
- ```
130
- server/routes/api/items/index.get.ts → GET /api/items
131
- server/routes/api/items/[id].get.ts → GET /api/items/:id
132
- server/routes/api/items/[id].patch.ts → PATCH /api/items/:id
133
- ```
86
+ 1. **Add navigation state entries** -- create or extend `app/hooks/use-navigation-state.ts` to track new routes
87
+ 2. **Enhance view-screen** -- make the view-screen script return relevant context for the new view
88
+ 3. **Create domain actions** -- add scripts for CRUD operations on new data models
89
+ 4. **Create domain skills** -- add `.agents/skills/<feature>/SKILL.md` documenting the data model, storage patterns, and agent operations
90
+ 5. **Update this AGENTS.md** -- add the new actions, state keys, and common tasks
134
91
 
135
- Each file exports a default `defineEventHandler`.
136
-
137
- **Adding a server plugin:**
138
- Startup logic (auth, SSE, etc.) lives in `server/plugins/`. Use `defineNitroPlugin` from core:
139
-
140
- ```ts
141
- import { defineNitroPlugin } from "@agent-native/core";
142
-
143
- export default defineNitroPlugin(async (nitroApp) => {
144
- // Runs once at server startup
145
- });
146
- ```
147
-
148
- **Key imports from `@agent-native/core`:**
149
-
150
- | Import | Purpose |
151
- | -------------------------------------------- | -------------------------------------------------------------------------- |
152
- | `defineNitroPlugin` | Define a server plugin (re-exported from Nitro) |
153
- | `createDefaultSSEHandler` | Create SSE endpoint for DB change events (server) |
154
- | `readAppState`, `writeAppState` | Read/write application state (from `@agent-native/core/application-state`) |
155
- | `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
156
- | `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
157
- | `sendToAgentChat` | Send messages to agent from UI (client-side) |
158
- | `agentChat` | Send messages to agent from scripts (server-side) |
159
-
160
- **Adding a script:**
161
- Create `scripts/my-script.ts` exporting `default async function(args: string[])`.
162
- Run with: `pnpm script my-script --arg value`
163
-
164
- **Sending to agent chat from UI:**
165
-
166
- ```ts
167
- import { sendToAgentChat } from "@agent-native/core";
168
- sendToAgentChat({
169
- message: "Generate something",
170
- context: "...",
171
- submit: true,
172
- });
173
- ```
174
-
175
- **Sending to agent chat from scripts:**
176
-
177
- ```ts
178
- import { agentChat } from "@agent-native/core";
179
- agentChat.submit("Generate something");
180
- ```
181
-
182
- ### Database (Cloud Deployment)
183
-
184
- By default, data is stored in SQLite at `data/app.db`. For production/cloud deployment, set `DATABASE_URL` to point to a remote database (Turso, Neon, Supabase, D1).
92
+ ---
185
93
 
186
- **Environment variables:**
187
-
188
- | Variable | Required | Description |
189
- | --------------------- | ---------------- | ---------------------------------------------------------- |
190
- | `DATABASE_URL` | No (has default) | Database connection string (default: `file:./data/app.db`) |
191
- | `DATABASE_AUTH_TOKEN` | For remote DBs | Auth token for Turso or other remote databases |
192
-
193
- ### Tech Stack
194
-
195
- - **Framework:** @agent-native/core + React Router v7 (framework mode)
196
- - **Frontend:** React 18, Vite, TailwindCSS, shadcn/ui
197
- - **Routing:** File-based via `flatRoutes()` — SSR shell + client rendering
198
- - **Backend:** Nitro (via @agent-native/core) — file-based API routing, server plugins, deploy-anywhere presets
199
- - **State:** SQL-backed (SSE for real-time updates)
200
- - **Build:** `pnpm build` (React Router build — client + SSR + Nitro server)
201
- - **Dev:** `pnpm dev` (Vite dev server with both React Router + Nitro plugins)
202
- - **Start:** `node .output/server/index.mjs` (production)
94
+ For code editing and development guidance, read `DEVELOPING.md`.
@@ -0,0 +1,117 @@
1
+ # {{APP_NAME}} — Development Guide
2
+
3
+ This guide is for development-mode agents editing this app's source code. For app operations and tools, see AGENTS.md.
4
+
5
+ ## Framework Basics
6
+
7
+ **Client-side-first rendering:** This app uses React Router v7 framework mode with `ssr: true`, but all app content renders **client-side only**. The server renders only the HTML shell (meta tags, styles, scripts) plus a loading spinner. This is enforced by the `ClientOnly` wrapper in `root.tsx` — never remove it. Browser APIs (`window`, `localStorage`, `new Date()`) are safe to use anywhere in app code because components never run on the server.
8
+
9
+ **Do NOT fetch data server-side** in route loaders. The standard pattern is: server renders a spinner, client hydrates, React Query hooks fetch from `/api/*`.
10
+
11
+ ## Adding a Page
12
+
13
+ Create a file in `app/routes/`. The filename determines the URL path:
14
+
15
+ ```
16
+ app/routes/_index.tsx → /
17
+ app/routes/settings.tsx → /settings
18
+ app/routes/inbox.tsx → /inbox
19
+ app/routes/inbox.$threadId.tsx → /inbox/:threadId
20
+ app/routes/$id.tsx → /:id (dynamic param)
21
+ ```
22
+
23
+ Each route file exports a default component and optional `meta()`:
24
+
25
+ ```tsx
26
+ import MyPage from "@/pages/MyPage";
27
+
28
+ export function meta() {
29
+ return [{ title: "My Page" }];
30
+ }
31
+
32
+ export default function MyPageRoute() {
33
+ return <MyPage />;
34
+ }
35
+ ```
36
+
37
+ ## Adding an API Route
38
+
39
+ Create a file in `server/routes/api/`. The filename determines the URL path and HTTP method:
40
+
41
+ ```
42
+ server/routes/api/items/index.get.ts → GET /api/items
43
+ server/routes/api/items/[id].get.ts → GET /api/items/:id
44
+ server/routes/api/items/[id].patch.ts → PATCH /api/items/:id
45
+ ```
46
+
47
+ Each file exports a default `defineEventHandler`.
48
+
49
+ ## Server Plugins
50
+
51
+ Startup logic (auth, SSE, etc.) lives in `server/plugins/`. Use `defineNitroPlugin` from core:
52
+
53
+ ```ts
54
+ import { defineNitroPlugin } from "@agent-native/core";
55
+
56
+ export default defineNitroPlugin(async (nitroApp) => {
57
+ // Runs once at server startup
58
+ });
59
+ ```
60
+
61
+ ## Key Imports
62
+
63
+ | Import | Purpose |
64
+ | -------------------------------------------- | -------------------------------------------------------------------------- |
65
+ | `defineNitroPlugin` | Define a server plugin (re-exported from Nitro) |
66
+ | `createDefaultSSEHandler` | Create SSE endpoint for DB change events (server) |
67
+ | `readAppState`, `writeAppState` | Read/write application state (from `@agent-native/core/application-state`) |
68
+ | `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
69
+ | `readResource`, `writeResource` | Read/write resources (from `@agent-native/core/resources`) |
70
+ | `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
71
+ | `sendToAgentChat` | Send messages to agent from UI (client-side) |
72
+ | `agentChat` | Send messages to agent from scripts (server-side) |
73
+
74
+ ## Adding a Script
75
+
76
+ Create `actions/my-script.ts` exporting `default async function(args: string[])`.
77
+ Run with: `pnpm action my-script --arg value`
78
+
79
+ ## Sending to Agent Chat
80
+
81
+ **From UI:**
82
+
83
+ ```ts
84
+ import { sendToAgentChat } from "@agent-native/core";
85
+ sendToAgentChat({
86
+ message: "Generate something",
87
+ context: "...",
88
+ submit: true,
89
+ });
90
+ ```
91
+
92
+ **From scripts:**
93
+
94
+ ```ts
95
+ import { agentChat } from "@agent-native/core";
96
+ agentChat.submit("Generate something");
97
+ ```
98
+
99
+ ## Database
100
+
101
+ By default, data is stored in SQLite at `data/app.db`. For production/cloud deployment, set `DATABASE_URL` to point to a remote database (Turso, Neon, Supabase, D1).
102
+
103
+ | Variable | Required | Description |
104
+ | --------------------- | ---------------- | ---------------------------------------------------------- |
105
+ | `DATABASE_URL` | No (has default) | Database connection string (default: `file:./data/app.db`) |
106
+ | `DATABASE_AUTH_TOKEN` | For remote DBs | Auth token for Turso or other remote databases |
107
+
108
+ ## Tech Stack
109
+
110
+ - **Framework:** @agent-native/core + React Router v7 (framework mode)
111
+ - **Frontend:** React 18, Vite, TailwindCSS, shadcn/ui
112
+ - **Routing:** File-based via `flatRoutes()` — SSR shell + client rendering
113
+ - **Backend:** Nitro (via @agent-native/core) — file-based API routing, server plugins, deploy-anywhere presets
114
+ - **State:** SQL-backed (SSE for real-time updates)
115
+ - **Build:** `pnpm build` (React Router build — client + SSR + Nitro server)
116
+ - **Dev:** `pnpm dev` (Vite dev server with both React Router + Nitro plugins)
117
+ - **Start:** `node .output/server/index.mjs` (production)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Example script — callable via `pnpm script hello`
2
+ * Example script — callable via `pnpm action hello`
3
3
  *
4
4
  * Scripts export a default async function that receives CLI args.
5
5
  */