@agent-native/core 0.112.0 → 0.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/corpus/README.md +4 -2
  2. package/corpus/core/CHANGELOG.md +22 -0
  3. package/corpus/core/docs/AGENTS.md +7 -0
  4. package/corpus/core/docs/content/integrations.mdx +63 -2
  5. package/corpus/core/docs/design/provider-integration-authority.md +117 -0
  6. package/corpus/core/package.json +6 -1
  7. package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
  8. package/corpus/core/src/cli/atomic-json-file.ts +324 -0
  9. package/corpus/core/src/cli/claude-code-participant.ts +515 -0
  10. package/corpus/core/src/cli/code-agent-executor.ts +18 -10
  11. package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
  12. package/corpus/core/src/cli/code-agent-runs.ts +55 -62
  13. package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
  14. package/corpus/core/src/cli/multi-frontier-runs.ts +1246 -135
  15. package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
  16. package/corpus/core/src/integrations/index.ts +10 -0
  17. package/corpus/core/src/integrations/slack-oauth.ts +1 -0
  18. package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
  19. package/corpus/core/src/notifications/channels.ts +4 -10
  20. package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
  21. package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
  22. package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
  23. package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
  24. package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
  25. package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
  26. package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
  27. package/corpus/core/src/provider-api/gong.ts +108 -0
  28. package/corpus/core/src/scripts/docs/source-search.ts +2 -1
  29. package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
  30. package/corpus/core/src/server/index.ts +6 -0
  31. package/corpus/core/src/styles/chat-history-list.css +1 -313
  32. package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
  33. package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  34. package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  35. package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  36. package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  37. package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  38. package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  39. package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  40. package/corpus/core/src/templates/default/AGENTS.md +25 -18
  41. package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  42. package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  43. package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  44. package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  45. package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  46. package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  47. package/corpus/core/src/templates/headless/AGENTS.md +7 -0
  48. package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  49. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  50. package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  51. package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  52. package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  53. package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  54. package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
  55. package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
  56. package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
  57. package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  58. package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +11 -2
  59. package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  60. package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
  61. package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
  62. package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
  63. package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
  64. package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
  65. package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
  66. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
  67. package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
  68. package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  69. package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +11 -2
  70. package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  71. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
  72. package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
  73. package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  74. package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +11 -2
  75. package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  76. package/corpus/templates/brain/actions/_schemas.ts +13 -7
  77. package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
  78. package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
  79. package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
  80. package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
  81. package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
  82. package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
  83. package/corpus/templates/brain/actions/update-source.ts +5 -1
  84. package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
  85. package/corpus/templates/brain/app/lib/brain.ts +55 -0
  86. package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
  87. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
  88. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
  89. package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
  90. package/corpus/templates/brain/server/lib/connectors.ts +53 -2
  91. package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
  92. package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
  93. package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
  94. package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  95. package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +11 -2
  96. package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  97. package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
  98. package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
  99. package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
  100. package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
  101. package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
  102. package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
  103. package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
  104. package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
  105. package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
  106. package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  107. package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  108. package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  109. package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  110. package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  111. package/corpus/templates/chat/AGENTS.md +5 -2
  112. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  113. package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
  114. package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  115. package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +11 -2
  116. package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  117. package/corpus/templates/clips/AGENTS.md +11 -0
  118. package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
  119. package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
  120. package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
  121. package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
  122. package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
  123. package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
  124. package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
  125. package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
  126. package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
  127. package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  128. package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +11 -2
  129. package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  130. package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
  131. package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
  132. package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
  133. package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
  134. package/corpus/templates/content/actions/provider-api-request.ts +3 -37
  135. package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
  136. package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
  137. package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  138. package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +11 -2
  139. package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  140. package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
  141. package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
  142. package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
  143. package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
  144. package/corpus/templates/design/actions/provider-api-request.ts +140 -164
  145. package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
  146. package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
  147. package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  148. package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +11 -2
  149. package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  150. package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
  151. package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
  152. package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
  153. package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
  154. package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
  155. package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
  156. package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
  157. package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  158. package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +11 -2
  159. package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  160. package/corpus/templates/forms/server/lib/integrations.ts +23 -22
  161. package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  162. package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  163. package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
  164. package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  165. package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +11 -2
  166. package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  167. package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
  168. package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
  169. package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
  170. package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
  171. package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
  172. package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
  173. package/corpus/templates/mail/server/handlers/gong.ts +6 -61
  174. package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
  175. package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
  176. package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  177. package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +11 -2
  178. package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  179. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
  180. package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
  181. package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  182. package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +11 -2
  183. package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  184. package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
  185. package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
  186. package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
  187. package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
  188. package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
  189. package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
  190. package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
  191. package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
  192. package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +10 -0
  193. package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  194. package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +11 -2
  195. package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  196. package/corpus/toolkit/CHANGELOG.md +125 -0
  197. package/corpus/toolkit/README.md +60 -0
  198. package/corpus/toolkit/export-snapshot.json +35 -0
  199. package/corpus/toolkit/migration-manifest.json +4 -0
  200. package/corpus/toolkit/package.json +281 -0
  201. package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
  202. package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
  203. package/corpus/toolkit/src/app-shell/index.ts +1 -0
  204. package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
  205. package/corpus/toolkit/src/chat-history/index.ts +7 -0
  206. package/corpus/toolkit/src/chat-history.css +314 -0
  207. package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
  208. package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
  209. package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
  210. package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
  211. package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
  212. package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
  213. package/corpus/toolkit/src/collab-ui/index.ts +39 -0
  214. package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
  215. package/corpus/toolkit/src/collab-ui/types.ts +96 -0
  216. package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
  217. package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
  218. package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
  219. package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
  220. package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
  221. package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
  222. package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
  223. package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
  224. package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
  225. package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
  226. package/corpus/toolkit/src/composer/draft-key.ts +7 -0
  227. package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
  228. package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
  229. package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
  230. package/corpus/toolkit/src/composer/index.ts +79 -0
  231. package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
  232. package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
  233. package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
  234. package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
  235. package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
  236. package/corpus/toolkit/src/composer/types.ts +66 -0
  237. package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
  238. package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
  239. package/corpus/toolkit/src/composer/use-skills.ts +45 -0
  240. package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
  241. package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
  242. package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
  243. package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
  244. package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
  245. package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
  246. package/corpus/toolkit/src/context-ui/format.ts +42 -0
  247. package/corpus/toolkit/src/context-ui/index.ts +15 -0
  248. package/corpus/toolkit/src/context-ui/types.ts +43 -0
  249. package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
  250. package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
  251. package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
  252. package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
  253. package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
  254. package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
  255. package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
  256. package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
  257. package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
  258. package/corpus/toolkit/src/editor/RunId.ts +61 -0
  259. package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
  260. package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
  261. package/corpus/toolkit/src/editor/extensions.ts +402 -0
  262. package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
  263. package/corpus/toolkit/src/editor/index.ts +93 -0
  264. package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
  265. package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
  266. package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
  267. package/corpus/toolkit/src/editor.css +510 -0
  268. package/corpus/toolkit/src/hooks/index.ts +2 -0
  269. package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
  270. package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
  271. package/corpus/toolkit/src/index.ts +8 -0
  272. package/corpus/toolkit/src/onboarding/index.ts +1 -0
  273. package/corpus/toolkit/src/provider.tsx +47 -0
  274. package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
  275. package/corpus/toolkit/src/sharing/index.ts +4 -0
  276. package/corpus/toolkit/src/styles.css +21 -0
  277. package/corpus/toolkit/src/ui/accordion.tsx +56 -0
  278. package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
  279. package/corpus/toolkit/src/ui/alert.tsx +59 -0
  280. package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
  281. package/corpus/toolkit/src/ui/avatar.tsx +48 -0
  282. package/corpus/toolkit/src/ui/badge.tsx +37 -0
  283. package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
  284. package/corpus/toolkit/src/ui/button.tsx +78 -0
  285. package/corpus/toolkit/src/ui/calendar.tsx +214 -0
  286. package/corpus/toolkit/src/ui/card.tsx +86 -0
  287. package/corpus/toolkit/src/ui/carousel.tsx +260 -0
  288. package/corpus/toolkit/src/ui/chart.tsx +375 -0
  289. package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
  290. package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
  291. package/corpus/toolkit/src/ui/command.tsx +174 -0
  292. package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
  293. package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
  294. package/corpus/toolkit/src/ui/dialog.tsx +146 -0
  295. package/corpus/toolkit/src/ui/drawer.tsx +126 -0
  296. package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
  297. package/corpus/toolkit/src/ui/form.tsx +177 -0
  298. package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
  299. package/corpus/toolkit/src/ui/index.ts +52 -0
  300. package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
  301. package/corpus/toolkit/src/ui/input.tsx +22 -0
  302. package/corpus/toolkit/src/ui/label.tsx +24 -0
  303. package/corpus/toolkit/src/ui/logo.tsx +36 -0
  304. package/corpus/toolkit/src/ui/menubar.tsx +235 -0
  305. package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
  306. package/corpus/toolkit/src/ui/pagination.tsx +121 -0
  307. package/corpus/toolkit/src/ui/popover.tsx +44 -0
  308. package/corpus/toolkit/src/ui/progress.tsx +26 -0
  309. package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
  310. package/corpus/toolkit/src/ui/resizable.tsx +43 -0
  311. package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
  312. package/corpus/toolkit/src/ui/select.tsx +158 -0
  313. package/corpus/toolkit/src/ui/separator.tsx +29 -0
  314. package/corpus/toolkit/src/ui/sheet.tsx +160 -0
  315. package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
  316. package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
  317. package/corpus/toolkit/src/ui/slider.tsx +26 -0
  318. package/corpus/toolkit/src/ui/sonner.tsx +58 -0
  319. package/corpus/toolkit/src/ui/spinner.tsx +17 -0
  320. package/corpus/toolkit/src/ui/switch.tsx +27 -0
  321. package/corpus/toolkit/src/ui/table.tsx +117 -0
  322. package/corpus/toolkit/src/ui/tabs.tsx +53 -0
  323. package/corpus/toolkit/src/ui/textarea.tsx +23 -0
  324. package/corpus/toolkit/src/ui/toast.tsx +127 -0
  325. package/corpus/toolkit/src/ui/toaster.tsx +33 -0
  326. package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
  327. package/corpus/toolkit/src/ui/toggle.tsx +43 -0
  328. package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
  329. package/corpus/toolkit/src/ui/use-toast.ts +3 -0
  330. package/corpus/toolkit/src/utils.ts +8 -0
  331. package/corpus/toolkit/tsconfig.json +23 -0
  332. package/dist/cli/atomic-json-file.d.ts +30 -0
  333. package/dist/cli/atomic-json-file.d.ts.map +1 -0
  334. package/dist/cli/atomic-json-file.js +240 -0
  335. package/dist/cli/atomic-json-file.js.map +1 -0
  336. package/dist/cli/claude-code-participant.d.ts +77 -0
  337. package/dist/cli/claude-code-participant.d.ts.map +1 -0
  338. package/dist/cli/claude-code-participant.js +355 -0
  339. package/dist/cli/claude-code-participant.js.map +1 -0
  340. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  341. package/dist/cli/code-agent-executor.js +18 -10
  342. package/dist/cli/code-agent-executor.js.map +1 -1
  343. package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
  344. package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
  345. package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
  346. package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
  347. package/dist/cli/code-agent-runs.d.ts.map +1 -1
  348. package/dist/cli/code-agent-runs.js +43 -56
  349. package/dist/cli/code-agent-runs.js.map +1 -1
  350. package/dist/cli/codex-cli-participant.d.ts +77 -0
  351. package/dist/cli/codex-cli-participant.d.ts.map +1 -0
  352. package/dist/cli/codex-cli-participant.js +354 -0
  353. package/dist/cli/codex-cli-participant.js.map +1 -0
  354. package/dist/cli/multi-frontier-runs.d.ts +115 -0
  355. package/dist/cli/multi-frontier-runs.d.ts.map +1 -1
  356. package/dist/cli/multi-frontier-runs.js +831 -113
  357. package/dist/cli/multi-frontier-runs.js.map +1 -1
  358. package/dist/client/chat/ChatHistoryList.d.ts +1 -87
  359. package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
  360. package/dist/client/chat/ChatHistoryList.js +1 -82
  361. package/dist/client/chat/ChatHistoryList.js.map +1 -1
  362. package/dist/integrations/index.d.ts +2 -1
  363. package/dist/integrations/index.d.ts.map +1 -1
  364. package/dist/integrations/index.js +2 -1
  365. package/dist/integrations/index.js.map +1 -1
  366. package/dist/integrations/slack-manifest.d.ts +1 -1
  367. package/dist/integrations/slack-oauth.d.ts +1 -1
  368. package/dist/integrations/slack-oauth.d.ts.map +1 -1
  369. package/dist/integrations/slack-oauth.js +1 -0
  370. package/dist/integrations/slack-oauth.js.map +1 -1
  371. package/dist/integrations/webhook-delivery.d.ts +23 -0
  372. package/dist/integrations/webhook-delivery.d.ts.map +1 -0
  373. package/dist/integrations/webhook-delivery.js +32 -0
  374. package/dist/integrations/webhook-delivery.js.map +1 -0
  375. package/dist/notifications/channels.d.ts.map +1 -1
  376. package/dist/notifications/channels.js +4 -9
  377. package/dist/notifications/channels.js.map +1 -1
  378. package/dist/notifications/routes.d.ts +3 -3
  379. package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
  380. package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
  381. package/dist/provider-api/actions/custom-provider-registration.js +154 -0
  382. package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
  383. package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
  384. package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
  385. package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
  386. package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
  387. package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
  388. package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
  389. package/dist/provider-api/actions/list-staged-datasets.js +3 -40
  390. package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
  391. package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
  392. package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
  393. package/dist/provider-api/actions/provider-api-audit.js +74 -0
  394. package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
  395. package/dist/provider-api/actions/provider-api.d.ts +370 -0
  396. package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
  397. package/dist/provider-api/actions/provider-api.js +280 -0
  398. package/dist/provider-api/actions/provider-api.js.map +1 -0
  399. package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
  400. package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
  401. package/dist/provider-api/actions/query-staged-dataset.js +3 -116
  402. package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
  403. package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
  404. package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
  405. package/dist/provider-api/actions/staged-datasets.js +210 -0
  406. package/dist/provider-api/actions/staged-datasets.js.map +1 -0
  407. package/dist/provider-api/gong.d.ts +44 -0
  408. package/dist/provider-api/gong.d.ts.map +1 -0
  409. package/dist/provider-api/gong.js +56 -0
  410. package/dist/provider-api/gong.js.map +1 -0
  411. package/dist/scripts/docs/source-search.d.ts +2 -1
  412. package/dist/scripts/docs/source-search.d.ts.map +1 -1
  413. package/dist/scripts/docs/source-search.js +2 -1
  414. package/dist/scripts/docs/source-search.js.map +1 -1
  415. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  416. package/dist/server/google-oauth-credentials.d.ts +35 -0
  417. package/dist/server/google-oauth-credentials.d.ts.map +1 -1
  418. package/dist/server/google-oauth-credentials.js +48 -2
  419. package/dist/server/google-oauth-credentials.js.map +1 -1
  420. package/dist/server/index.d.ts +1 -1
  421. package/dist/server/index.d.ts.map +1 -1
  422. package/dist/server/index.js +1 -1
  423. package/dist/server/index.js.map +1 -1
  424. package/dist/styles/chat-history-list.css +1 -313
  425. package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  426. package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  427. package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  428. package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  429. package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  430. package/dist/templates/chat/AGENTS.md +5 -2
  431. package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  432. package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
  433. package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  434. package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  435. package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  436. package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  437. package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  438. package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  439. package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  440. package/dist/templates/default/AGENTS.md +25 -18
  441. package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  442. package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  443. package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  444. package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  445. package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  446. package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  447. package/dist/templates/headless/AGENTS.md +7 -0
  448. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  449. package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  450. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  451. package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  452. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  453. package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  454. package/dist/templates/workspace-core/AGENTS.md +4 -0
  455. package/dist/templates/workspace-root/AGENTS.md +4 -0
  456. package/docs/AGENTS.md +7 -0
  457. package/docs/content/integrations.mdx +63 -2
  458. package/docs/design/provider-integration-authority.md +117 -0
  459. package/package.json +7 -2
  460. package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
  461. package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +10 -0
  462. package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  463. package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +11 -2
  464. package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  465. package/src/templates/chat/AGENTS.md +5 -2
  466. package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
  467. package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
  468. package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +10 -0
  469. package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  470. package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
  471. package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
  472. package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
  473. package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +11 -2
  474. package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  475. package/src/templates/default/AGENTS.md +25 -18
  476. package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
  477. package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +10 -0
  478. package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  479. package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
  480. package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
  481. package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  482. package/src/templates/headless/AGENTS.md +7 -0
  483. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
  484. package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +10 -0
  485. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +6 -0
  486. package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +102 -0
  487. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +11 -2
  488. package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
  489. package/src/templates/workspace-core/AGENTS.md +4 -0
  490. package/src/templates/workspace-root/AGENTS.md +4 -0
@@ -35,8 +35,14 @@ Tier 4 includes **all** of the following — not only editing package source:
35
35
  - Files under `node_modules/@agent-native/*` (core, dispatch, scheduling, …)
36
36
  - `pnpm.overrides`, `overrides`, `resolutions`, or `patchedDependencies` that
37
37
  target any `@agent-native/*` package
38
- - Local patches, vendored copies, or invented "dispatch/core behavior"
39
- shims meant to paper over a version skew or failed upgrade
38
+ - Local package patches or invented "dispatch/core behavior" shims meant to
39
+ paper over a version skew or failed upgrade
40
+
41
+ This does not prohibit intentional app-owned UI customization. When public
42
+ props and composition are insufficient, the `customizing-agent-native` skill
43
+ allows copying the smallest reference UI component from the installed source
44
+ into the app. The copy must use public runtime contracts and must not replace
45
+ Core auth, DB, actions, agent execution, or transport behavior.
40
46
 
41
47
  When an older branch needs current packages, use **`agent-native upgrade`**
42
48
  (see the `upgrade-agent-native` skill). If upgrade or typecheck fails, fix
@@ -88,6 +94,8 @@ inline strings in components.
88
94
  - Don't modify `.env` files or files containing secrets
89
95
  - Don't modify `@agent-native/core`, `@agent-native/dispatch`, or other
90
96
  `@agent-native/*` package internals (including under `node_modules`)
97
+ - Don't confuse a read-only reference copy with editing package internals: use
98
+ `customizing-agent-native` for selective app-owned UI adoption
91
99
  - Don't add `pnpm.overrides` / `patchedDependencies` / `resolutions` for
92
100
  `@agent-native/*` to "make the app run" after a version bump
93
101
  - Don't invent local dispatch/core behavior overrides when upgrade fails —
@@ -99,6 +107,7 @@ inline strings in components.
99
107
  ## Related Skills
100
108
 
101
109
  - **upgrade-agent-native** — supported path to bring an older app/workspace current
110
+ - **customizing-agent-native** — safe selective adoption of installed reference UI
102
111
  - **storing-data** — Tier 1 modifications (data files) are the safest and most common
103
112
  - **actions** — The agent can create or modify actions to add new capabilities
104
113
  - **delegate-to-agent** — Self-modification requests come through the agent chat
@@ -63,6 +63,11 @@ install → refresh scaffold skills → verify, then fix **app** code only.
63
63
  - Re-run `agent-native upgrade` or `pnpm typecheck`
64
64
  - Stop and ask the user if you cannot fix the app-level error
65
65
 
66
+ Intentional app-level UI customization is a separate workflow. Read
67
+ `customizing-agent-native` when the product needs to own a selectively
68
+ copied component; do not use that path to reproduce framework runtime
69
+ behavior or hide version skew.
70
+
66
71
  4. **Dry-run / partial runs**
67
72
 
68
73
  ```bash
@@ -91,4 +96,5 @@ install → refresh scaffold skills → verify, then fix **app** code only.
91
96
 
92
97
  - **self-modifying-code** — Tier 4: framework packages are off limits
93
98
  - **agent-native-docs** — version-matched docs after the bump
99
+ - **customizing-agent-native** — intentional app-owned UI copies, not upgrade patches
94
100
  - **portability** — keep app code provider-agnostic across upgrades
@@ -34,6 +34,12 @@ first-party template patterns ships in `node_modules/@agent-native/core/corpus`.
34
34
  `node_modules/@agent-native/core/docs/content/` directly with `rg`. Search
35
35
  `node_modules/@agent-native/core/corpus/` for source examples.
36
36
 
37
+ When intentionally customizing shared UI, read `customizing-agent-native`.
38
+ Configure or compose public components first. If needed, inspect the installed
39
+ Toolkit source or Core corpus and copy only the smallest UI piece into app-owned
40
+ source. Never edit `node_modules`, deep-import private source, or copy runtime
41
+ auth, data, action, or agent-chat internals.
42
+
37
43
  Read these local package docs before implementing advanced Agent Native
38
44
  features. Prefer this app's own `AGENTS.md` and `.agents/skills/` for
39
45
  app-specific rules, then use the corpus for reusable framework/template
@@ -154,24 +160,25 @@ repackage, or proxy an action.
154
160
 
155
161
  Skills in `.agents/skills/` provide detailed guidance for each architectural rule. Read them before making changes.
156
162
 
157
- | Skill | When to read |
158
- | ---------------------- | --------------------------------------------------------------------------------- |
159
- | `agent-native-docs` | Before using advanced Agent Native framework APIs or generated-app features |
160
- | `adding-a-feature` | **Read first when adding ANY new feature** the four-area parity checklist |
161
- | `feature-flags` | Before shipping a staged production rollout or replacing a compile-time switch |
162
- | `real-time-sync` | Before wiring data fetching for anything the agent can mutate (must auto-refresh) |
163
- | `storing-data` | Before storing or reading any app state |
164
- | `internationalization` | Before adding or editing visible UI copy, prompts, toasts, labels, or formatting |
165
- | `delegate-to-agent` | Before adding LLM calls or AI delegation |
166
- | `actions` | Before creating or modifying actions |
167
- | `self-modifying-code` | Before editing source, components, or styles |
168
- | `upgrade-agent-native` | Before updating an older app/branch or when tempted to patch `@agent-native/*` |
169
- | `capture-learnings` | Before recording user preferences or corrections |
170
- | `frontend-design` | Before building or restyling any UI component, page, or layout |
171
- | `shadcn-ui` | Before adding, updating, or debugging shadcn/ui components |
172
- | `agent-engines` | Before switching LLM providers or registering a custom engine |
173
- | `notifications` | Before surfacing alerts/progress to the user or adding channels |
174
- | `progress` | Before running any task that takes more than a few seconds |
163
+ | Skill | When to read |
164
+ | -------------------------- | --------------------------------------------------------------------------------- |
165
+ | `agent-native-docs` | Before using advanced Agent Native framework APIs or generated-app features |
166
+ | `customizing-agent-native` | Before overriding or selectively copying shared Agent Native UI |
167
+ | `adding-a-feature` | **Read first when adding ANY new feature** the four-area parity checklist |
168
+ | `feature-flags` | Before shipping a staged production rollout or replacing a compile-time switch |
169
+ | `real-time-sync` | Before wiring data fetching for anything the agent can mutate (must auto-refresh) |
170
+ | `storing-data` | Before storing or reading any app state |
171
+ | `internationalization` | Before adding or editing visible UI copy, prompts, toasts, labels, or formatting |
172
+ | `delegate-to-agent` | Before adding LLM calls or AI delegation |
173
+ | `actions` | Before creating or modifying actions |
174
+ | `self-modifying-code` | Before editing source, components, or styles |
175
+ | `upgrade-agent-native` | Before updating an older app/branch or when tempted to patch `@agent-native/*` |
176
+ | `capture-learnings` | Before recording user preferences or corrections |
177
+ | `frontend-design` | Before building or restyling any UI component, page, or layout |
178
+ | `shadcn-ui` | Before adding, updating, or debugging shadcn/ui components |
179
+ | `agent-engines` | Before switching LLM providers or registering a custom engine |
180
+ | `notifications` | Before surfacing alerts/progress to the user or adding channels |
181
+ | `progress` | Before running any task that takes more than a few seconds |
175
182
 
176
183
  ## When Adding Features
177
184
 
@@ -0,0 +1,512 @@
1
+ ---
2
+ name: actions
3
+ description: >-
4
+ How to create and run agent actions. Actions are the single source of truth
5
+ for app operations — the agent calls them as tools and frontend code calls
6
+ them through client hooks. Use when creating a new action, adding an API
7
+ integration, or wiring up frontend data fetching.
8
+ scope: dev
9
+ metadata:
10
+ internal: true
11
+ ---
12
+
13
+ # Agent Actions
14
+
15
+ ## Rule
16
+
17
+ Actions in `actions/` are the **single source of truth** for app operations. The agent calls them as tools, and the frontend calls them through `useActionQuery` / `useActionMutation`. The framework owns the HTTP transport behind those hooks. No duplicate `/api/` routes needed.
18
+
19
+ Before creating any custom REST/API route for app data, inspect `actions/` and the action table in `AGENTS.md`. If an action already exists, call it directly from the agent or with `useActionQuery` / `useActionMutation` from the UI. If the capability is missing, create or update a `defineAction`. Do not add `/api/*`, `server/routes/*`, or other pass-through endpoints whose main job is to call, repackage, or re-export an action.
20
+
21
+ ## Why
22
+
23
+ Actions give the agent callable tools with structured input/output, AND they give the frontend a typed client contract through hooks. One implementation serves both the agent and the UI. They keep the agent's chat context clean, they're reusable, and they can be tested independently.
24
+
25
+ ## Keep the Action Surface Small and Orthogonal
26
+
27
+ Every agent-exposed action is a tool in the model's context window. There is a real cost to each one: more tools means more for the model to read, disambiguate, and choose between, which degrades tool-selection quality. Treat the action list like an API you have to maintain — add the fewest, most orthogonal actions that cover the capability, not one per UI affordance.
28
+
29
+ - **Prefer one CRUD-style `update` over N per-field actions.** A single `update-<thing>` that takes a patch of optional fields beats `update-<thing>-name`, `update-<thing>-order`, `update-<thing>-color`, … The agent (and the UI) pass only the fields that change. Same for `create`/`delete` — one orthogonal action per resource, not one per code path.
30
+ - **Reach for a generic query / escape hatch before minting a new read action.** If the agent needs more or different data, do not add `get-<thing>-by-x`, `list-<thing>-filtered-by-y`, etc. For provider data, expose the shared `provider-api-catalog` / `provider-api-docs` / `provider-api-request` trio (see `templates/dispatch/actions/`) so the agent can hit any endpoint or filter without a new action each time. For app data in dev, the `db-query` tool already answers arbitrary read questions.
31
+ - **Hide UI-only or purely programmatic actions from the model with `agentTool: false`.** An action that only the frontend or an HTTP/cron caller needs should not spend a slot in the model's tool list. `agentTool: false` keeps it callable from `useActionMutation` / `callAction` / `/_agent-native/actions/<name>` while removing it from every agent tool surface (in-app assistant, MCP, A2A).
32
+ - **`agentTool: false` is NOT `toolCallable: false`.** They are different switches:
33
+ - `agentTool: false` → hidden from the **model entirely** (it is no longer a tool the agent can see or call). Still frontend/HTTP-callable.
34
+ - `toolCallable: false` → only blocks the **sandboxed extension ("tools") iframe bridge** (`appAction(...)`). The action stays fully visible to the model, the UI, the CLI, MCP, and A2A. Use it for high-blast-radius operations (account/org/auth changes), not for trimming the tool list.
35
+ - **Remove or hide stale actions.** When the UI stops using an action, delete it or set `agentTool: false` — do not leave it exposed to the model as dead tool weight. The advisory audit below helps you spot these.
36
+
37
+ ### Audit Script (Advisory)
38
+
39
+ `pnpm actions:audit [template ...]` (or `node scripts/audit-template-actions.mjs`) statically scans a template's `actions/` and prints two kinds of suggestions:
40
+
41
+ 1. **Likely UI-dead** — HTTP-exposed mutating actions whose name is never referenced under `app/` (candidates to delete or mark `agentTool: false`).
42
+ 2. **Likely redundant clusters** — groups like `update-foo-name` / `update-foo-order` that could collapse into one orthogonal `update-foo`.
43
+
44
+ It is **advisory only**: it always exits 0, never fails CI, and uses conservative heuristics, so expect some false positives (e.g. an action the agent calls but the UI doesn't). Use it as a prompt to review, not a gate.
45
+
46
+ ## How to Create an Action
47
+
48
+ Use `defineAction` with a Zod schema (required for new actions):
49
+
50
+ ```ts
51
+ // actions/list-meals.ts
52
+ import { z } from "zod";
53
+ import { defineAction } from "@agent-native/core/action";
54
+ import { getDb } from "../server/db/index.js";
55
+ import { meals } from "../server/db/schema.js";
56
+
57
+ export default defineAction({
58
+ description: "List all meals",
59
+ schema: z.object({
60
+ date: z.string().describe("Filter by date (YYYY-MM-DD)"),
61
+ }),
62
+ http: { method: "GET" },
63
+ run: async (args) => {
64
+ // args is fully typed: { date: string }
65
+ const db = getDb();
66
+ const rows = await db.select().from(meals);
67
+ return rows; // Return objects/arrays, NOT JSON.stringify()
68
+ },
69
+ });
70
+ ```
71
+
72
+ The `schema` field accepts a Zod schema (or any Standard Schema-compatible library). It provides runtime validation with clear error messages (400 for HTTP, error result for agent), full TypeScript type inference for `run()` args, and auto-generated JSON Schema for the agent's tool definition. `zod` is a dependency of all templates.
73
+
74
+ When an action reads or writes app data, use Drizzle's query builder and portable operators from `drizzle-orm`. Do not use raw SQL, `getDbExec()`, or dialect-specific schema imports in normal actions unless there is a documented reason Drizzle cannot express the query.
75
+
76
+ When an action calls an external service, never hardcode API keys, bearer
77
+ tokens, webhook URLs, signing secrets, OAuth refresh tokens, private
78
+ Builder/internal data, or customer data. Read user/org/workspace credentials
79
+ from `readAppSecret`, `resolveCredential`, OAuth token helpers, or the provider
80
+ API credential adapter. Use `process.env` only for explicitly deploy-level
81
+ configuration, and keep examples to obvious placeholders.
82
+
83
+ Tips:
84
+ - Use `.describe()` for parameter descriptions
85
+ - Use `.optional()` for optional params
86
+ - Use `z.coerce.number()` for numeric params that arrive as strings from HTTP.
87
+ For booleans, use an explicit string parser/helper instead of
88
+ `z.coerce.boolean()` because JavaScript treats any non-empty string,
89
+ including `"false"`, as truthy.
90
+ - Use `z.enum(["draft", "published"])` for constrained values
91
+
92
+ The legacy `parameters` field (plain JSON Schema object) still works as a fallback but does not provide runtime validation or type inference.
93
+
94
+ ## Decision Order
95
+
96
+ When you need app data or a mutation:
97
+
98
+ 1. **Use an existing action** if one already performs the operation.
99
+ 2. **Create or extend a `defineAction`** when the agent and UI both need a new operation.
100
+ 3. **Create a custom route only for route-only concerns** such as uploads, streaming, webhooks, OAuth callbacks, or a non-JSON protocol.
101
+
102
+ Do not build an umbrella REST API to make actions "easier" to call. Actions are already callable by agents, CLIs, React hooks, HTTP, MCP/A2A exposure, and external hosts through the framework.
103
+
104
+ ## Flexible Provider APIs
105
+
106
+ For provider integrations used in ad hoc analysis, querying, reporting, or
107
+ cross-source research, do not hardcode every provider endpoint as a separate
108
+ rigid action and do not encode one lookback window, filter shape, or pagination
109
+ strategy as the only path the agent can take. Expose the shared provider API
110
+ action trio instead:
111
+
112
+ - `provider-api-catalog`: lists provider base URLs, auth style, credential keys,
113
+ docs/spec URLs, placeholders, and examples without exposing secrets.
114
+ - `provider-api-docs`: fetches public provider docs/spec/changelog URLs when
115
+ the exact endpoint, filter operator, payload shape, or pagination contract is
116
+ uncertain. Registered docs URLs are curated starting points. Use
117
+ `responseMode: "markdown"` for clean readable docs, or
118
+ `responseMode: "matches"` with `search: { query | terms | regex }` for
119
+ compact snippets instead of flooding context with raw HTML.
120
+ - `provider-api-request`: makes a constrained authenticated HTTP request to the
121
+ provider host, injects configured credentials, blocks private/internal URLs,
122
+ and redacts secrets.
123
+
124
+ Use `@agent-native/core/provider-api` as the shared substrate, and build these
125
+ actions as thin factory imports rather than copying `defineAction` schemas and
126
+ handlers into each template:
127
+
128
+ ```ts
129
+ import {
130
+ createProviderApiCatalogAction,
131
+ createProviderApiDocsAction,
132
+ createProviderApiRequestAction,
133
+ } from "@agent-native/core/provider-api/actions/provider-api";
134
+ import {
135
+ createDeleteStagedDatasetAction,
136
+ createListStagedDatasetsAction,
137
+ createQueryStagedDatasetAction,
138
+ } from "@agent-native/core/provider-api/actions/staged-datasets";
139
+ ```
140
+
141
+ Pass the app's existing provider runtime to the provider factories, and pass
142
+ its app id to the staged-dataset factories. Keep app-specific descriptions,
143
+ provider allow-lists, HTTP/tool-callability settings, and credential adapters
144
+ as factory options. Only add a thin credential adapter when the app has
145
+ app-specific credential lookup rules. If the app stores a built-in provider's
146
+ OAuth grant under a narrower local provider id, use the runtime's
147
+ `oauthProviderOverrides` instead of duplicating provider config. If credentials
148
+ are stored on shareable/resource rows rather than in the shared credential or
149
+ OAuth-token stores, build a resolver that enforces those access checks before
150
+ exposing raw provider requests. Keep `provider-api-request` `http: false`
151
+ unless a separate UI permission model authorizes arbitrary provider writes.
152
+ Specific actions such as `search-records`, `search-emails`, or `sync-source`
153
+ are convenience shortcuts, not capability limits; agents should fall back to
154
+ the provider API trio when a question requires an endpoint or filter that the
155
+ shortcut does not model.
156
+
157
+ This is a framework tenet. The safety boundary should be provider host
158
+ allow-listing, credential scoping, auth injection, private-network blocking,
159
+ secret redaction, and user/org access checks, not an artificially small set of
160
+ hand-authored read actions. If the upstream provider API supports a capability,
161
+ the agent should normally be able to reach it through `provider-api-request`
162
+ with the user's configured credentials. For large responses, expose staging
163
+ (`stageAs`, `itemsPath`, pagination, and `query-staged-dataset`) or sandboxed
164
+ code execution so the agent can reduce data without flooding context.
165
+
166
+ For broad provider questions, cross-source joins, corpus-wide mention/search
167
+ work, classification, or any answer where absence matters, design the action
168
+ surface for full coverage instead of convenience-only samples. The agent should
169
+ be able to fetch every relevant page or an explicitly bounded cohort, stage or
170
+ save the raw provider response outside chat, and then use
171
+ `query-staged-dataset`, `run-code`, or provider-side search to count, join,
172
+ grep, classify, and aggregate. Tool descriptions and AGENTS.md guidance should
173
+ teach agents to report source, filters, time window, row/record counts,
174
+ pagination status, truncation, failed pages, and uncovered gaps. They must not
175
+ turn default limits, sampled rows, truncated excerpts, or aborted calls into a
176
+ confident "none found", "all records", or exhaustive conclusion.
177
+
178
+ For public web pages and docs, prefer the token-efficient path: `web-search`
179
+ to find likely URLs, `web-request` or `provider-api-docs` with clean
180
+ `responseMode` output to read a page, and `run-code` with `webRead()` /
181
+ `webFetch()` when you need to grep, aggregate, or compare many pages before
182
+ returning a small result.
183
+
184
+ For LONG compute, `run-code` supports durable background executions: pass
185
+ `background: true` and the code is enqueued to a `sandbox_executions` row and
186
+ executed out-of-band with a generous budget (default 10 min), surviving the
187
+ hosted agent run's ~40s soft timeout. The call returns
188
+ `{ executionId, status: "queued" }` immediately with polling guidance; check
189
+ progress with `run-code` `{ executionId }` (or the `get-code-execution` tool
190
+ where registered) — results persist after completion. Use background for big
191
+ cross-source joins, multi-page provider sweeps, and heavy analysis scripts;
192
+ keep quick scripts in the default foreground mode. Agents should continue
193
+ other work between polls, and on `failed`/`timed_out` split the computation or
194
+ persist intermediate progress with `workspaceWrite` and re-run.
195
+
196
+ ### The `http` Option
197
+
198
+ Controls how the action is exposed as an HTTP endpoint:
199
+
200
+ | Value | Behavior | Use for |
201
+ | ------------------------- | ----------------------------------------------------------- | -------------------------------- |
202
+ | _(omitted)_ | Auto-exposed as `POST /_agent-native/actions/:name` | Write operations (default) |
203
+ | `{ method: "GET" }` | Auto-exposed as `GET /_agent-native/actions/:name` | Read-only queries |
204
+ | `{ method: "PUT" }` | Auto-exposed as `PUT /_agent-native/actions/:name` | Update operations |
205
+ | `{ method: "DELETE" }` | Auto-exposed as `DELETE /_agent-native/actions/:name` | Delete operations |
206
+ | `{ method: "GET", path: "custom" }` | Auto-exposed as `GET /_agent-native/actions/custom` | Custom route path |
207
+ | `false` | Agent-only, never exposed as HTTP | `navigate`, `view-screen`, internal actions |
208
+
209
+ ### Screen Refresh (automatic)
210
+
211
+ The framework auto-refreshes the UI after any successful mutating action. On completion of a non-`GET` action, the framework emits a change event with `source: "action"` that the client's `useDbSync` picks up and uses to invalidate `["action"]` React Query keys — so `list-*` / `get-*` hooks refetch without a full page reload. In-process calls emit directly; dev-mode `pnpm action ...` calls also write a durable marker so the web server sees child-process action changes.
212
+
213
+ Rules:
214
+
215
+ - `http: { method: "GET" }` → read-only, does NOT trigger a refresh (inferred automatically).
216
+ - Any other action (default `POST`, `PUT`, `DELETE`, or `http: false`) → treated as mutating, triggers a refresh on success.
217
+ - To override the inference on an unusual action (e.g. a `POST` that only reads), pass `readOnly: true` on the action definition.
218
+ - To let a mutating action run concurrently with other same-turn tool calls, pass `parallelSafe: true`. Only do this when the action is internally concurrency-safe and order-independent (for example, it uses an app-level lock or idempotent upsert semantics). Mutating actions remain serialized by default.
219
+
220
+ Agents do NOT need to call `refresh-screen` after a normal action — it's already handled. `refresh-screen` is only needed when the agent mutates data via a path the framework can't see (e.g. writing to an external system the app mirrors) or when the agent wants to pass a `scope` hint for narrower invalidation.
221
+
222
+ ### Return Values
223
+
224
+ Actions should return **structured data** (objects, arrays) — not `JSON.stringify()`. The framework serializes the response automatically. If you return a string, the framework tries to parse it as JSON for a clean response.
225
+
226
+ ```ts
227
+ // Good — return structured data
228
+ run: async (args) => {
229
+ const events = await fetchEvents(args.from, args.to);
230
+ return events;
231
+ }
232
+
233
+ // Bad — don't stringify
234
+ run: async (args) => {
235
+ const events = await fetchEvents(args.from, args.to);
236
+ return JSON.stringify(events, null, 2);
237
+ }
238
+ ```
239
+
240
+ ### Returning Images the Agent Can See (`_agentImages`)
241
+
242
+ An action's return object may include the well-known optional field
243
+ `_agentImages` to attach vision images (screenshots, chart previews, rendered
244
+ designs) to the tool result. The agent literally sees them — enabling visual
245
+ self-review loops — while the field itself is stripped from the JSON text the
246
+ model reads.
247
+
248
+ ```ts
249
+ run: async ({ dashboardId }) => {
250
+ const shot = await renderDashboardPng(dashboardId); // Buffer
251
+ return {
252
+ dashboardId,
253
+ panelCount: 6,
254
+ _agentImages: [
255
+ // Either a public https URL (preferred — the provider fetches it)…
256
+ { url: "https://cdn.example.com/previews/dash-1.png", label: "overview" },
257
+ // …or base64 without a data: prefix (mediaType required; a full
258
+ // data:image/png;base64,… URL in `data` is also accepted and parsed).
259
+ { data: shot.toString("base64"), mediaType: "image/png" },
260
+ ],
261
+ };
262
+ },
263
+ ```
264
+
265
+ Rules and limits:
266
+
267
+ - Shape: `Array<{ url?: string; data?: string; mediaType?: string; label?: string }>`.
268
+ Each entry needs `url` (https only) **or** `data`. Supported media types:
269
+ `image/jpeg`, `image/png`, `image/gif`, `image/webp`.
270
+ - Caps: max **4 images** per result; max **~2MB of base64** per image.
271
+ Over-cap or invalid entries never fail the call — they become text notes in
272
+ the result telling the model what was dropped and why.
273
+ - Persistence: the run ledger stores only the string result plus compact
274
+ `[image: …]` notes (URLs verbatim; base64 as a byte-count placeholder) —
275
+ never the payload. Images are re-attached only for the live turn; replayed
276
+ history is text-only, so prefer stable `url` images the model can re-request.
277
+ - Engine support: native Anthropic and vision-capable AI-SDK providers
278
+ (anthropic, openai, google, openrouter) receive real image blocks; other
279
+ paths (Builder gateway, non-vision providers) degrade to the text notes.
280
+ - External MCP tools need no changes — standard MCP `image` content parts are
281
+ converted automatically under the same caps.
282
+
283
+ ### Validating Return Values (`outputSchema`)
284
+
285
+ `schema` validates inputs; `outputSchema` validates what the action **returns**. Pass any Standard Schema-compatible schema (Zod, Valibot, ArkType) and the framework validates the result _after_ `run()` resolves — input validated before `run`, output after.
286
+
287
+ ```ts
288
+ export default defineAction({
289
+ description: "Summarize a thread.",
290
+ schema: z.object({ threadId: z.string() }),
291
+ outputSchema: z.object({ summary: z.string(), messageCount: z.number() }),
292
+ outputErrorStrategy: "warn", // default; "strict" | "fallback"
293
+ // outputFallback: { summary: "", messageCount: 0 }, // used only by "fallback"
294
+ run: async ({ threadId }) => {
295
+ /* ... */
296
+ },
297
+ });
298
+ ```
299
+
300
+ - `"warn"` (default) — `console.warn` the issues and return the **original** result unchanged. Non-breaking.
301
+ - `"strict"` — throw a clear error so a buggy action surfaces loudly.
302
+ - `"fallback"` — return `outputFallback` in place of the invalid result.
303
+
304
+ On success the validated value is returned, so coercion/defaults on `outputSchema` apply. Omit `outputSchema` and behavior is byte-for-byte unchanged (no wrapping).
305
+
306
+ ### Human-in-the-Loop Approval (`needsApproval`)
307
+
308
+ For high-consequence, outward-facing, hard-to-undo actions (sending an email, charging a card, deleting an account), set `needsApproval` so the agent **cannot** run the action without a human approving the specific call:
309
+
310
+ ```ts
311
+ export default defineAction({
312
+ description: "Send an email via Gmail.",
313
+ schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
314
+ needsApproval: true, // boolean, or (args, ctx) => boolean | Promise<boolean>
315
+ run: async (args) => {
316
+ /* ...actually send... */
317
+ },
318
+ });
319
+ ```
320
+
321
+ When the gate is truthy and the call isn't yet approved, the loop emits an `approval_required` event and **stops the turn — `run()` never executes**. A predicate gates conditionally (e.g. only external recipients) and **fails closed**: a throw is treated as "approval required". The human approves via the chat UI's Approve affordance, which re-issues the turn with the call's `approvalKey`, and only then does the action run.
322
+
323
+ **Keep approvals rare** — the default is off and almost every action should leave it off. The canonical example is Mail's `send-email` (`needsApproval: true`). See the `security` skill and the Human Approval doc.
324
+
325
+ ## Frontend Hooks
326
+
327
+ The frontend calls actions using React Query hooks from `@agent-native/core/client`. Components should not hand-write `fetch("/_agent-native/actions/...")`; add or reuse a client hook/helper instead. Use `callAction` from the same package for imperative cases that do not fit a hook, such as debounced search, prefetching, or non-React event handlers.
328
+
329
+ ### `useActionQuery` — for GET actions
330
+
331
+ ```ts
332
+ import { useActionQuery } from "@agent-native/core/client/hooks";
333
+
334
+ function MealList() {
335
+ // Types are auto-inferred from the action's schema + return type — no manual generic needed
336
+ const { data: meals } = useActionQuery("list-meals", {
337
+ date: "2025-01-01",
338
+ });
339
+ return <ul>{meals?.map((m) => <li key={m.id}>{m.name}</li>)}</ul>;
340
+ }
341
+ ```
342
+
343
+ ### `useActionMutation` — for POST/PUT/DELETE actions
344
+
345
+ ```ts
346
+ import { useActionMutation } from "@agent-native/core/client/hooks";
347
+
348
+ function AddMealButton() {
349
+ // Types are auto-inferred — no manual generic needed
350
+ const { mutate } = useActionMutation("log-meal");
351
+ return (
352
+ <button onClick={() => mutate({ name: "Salad", calories: 350 })}>
353
+ Log Meal
354
+ </button>
355
+ );
356
+ }
357
+ ```
358
+
359
+ **Do NOT use manual type generics** like `useActionQuery<Meal[]>(...)`. Types are inferred automatically from `.generated/action-types.d.ts`, which is auto-generated by a Vite plugin.
360
+
361
+ Mutations automatically invalidate all `["action"]` query keys on success, so GET queries refetch.
362
+
363
+ ### `callAction` — for imperative client code
364
+
365
+ ```ts
366
+ import { callAction } from "@agent-native/core/client/hooks";
367
+
368
+ const people = await callAction("search-people", { query }, { method: "GET" });
369
+ ```
370
+
371
+ Prefer hooks in React data flows. Use `callAction` when a hook would be awkward;
372
+ do not hand-write action route fetches in components.
373
+
374
+ ## How to Run (Agent)
375
+
376
+ ```bash
377
+ pnpm action my-action --input data/source.json --output data/result.json
378
+ ```
379
+
380
+ ## Action Dispatcher
381
+
382
+ The default template uses core's `runScript()` in `actions/run.ts`:
383
+
384
+ ```ts
385
+ import { runScript } from "@agent-native/core";
386
+ runScript();
387
+ ```
388
+
389
+ This is the canonical approach for new apps. Action names must be lowercase with hyphens only (e.g., `my-action`).
390
+
391
+ ## When You Still Need Custom `/api/` Routes
392
+
393
+ Most operations should be actions. You only need custom routes in `server/routes/api/` for:
394
+
395
+ - **File uploads** — actions receive JSON params, not multipart form data
396
+ - **Streaming responses** — SSE or chunked responses that need direct H3 control
397
+ - **Webhooks** — external services POST to a specific URL
398
+ - **OAuth callbacks** — redirect-based flows that need specific URL patterns
399
+
400
+ When the agent needs a durable image or file URL, call the core `upload-image`
401
+ action or use `uploadFile()` in server code. Do not write base64 into SQL,
402
+ markdown, deck/design JSON, or action results. `_agentImages` on action results
403
+ is for ephemeral vision previews only, not persistence.
404
+
405
+ If it's a standard CRUD operation, data query, or a wrapper around an action, use the action instead.
406
+
407
+ ## Legacy Pattern (bare export)
408
+
409
+ Older actions use a bare async function export with `parseArgs`:
410
+
411
+ ```ts
412
+ import { parseArgs, loadEnv, fail } from "@agent-native/core";
413
+
414
+ export default async function myAction(args: string[]) {
415
+ loadEnv();
416
+ const parsed = parseArgs(args);
417
+ // ...
418
+ }
419
+ ```
420
+
421
+ This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all new actions.
422
+
423
+ ## Guidelines
424
+
425
+ - **One action, one job.** Keep actions focused on a single operation. The agent composes multiple action calls for complex operations.
426
+ - **Return structured data.** Return objects/arrays, not `JSON.stringify()`.
427
+ - **Use `http: { method: "GET" }`** for read-only actions. Default is POST.
428
+ - **Use `http: false`** for agent-only actions (`navigate`, `view-screen`).
429
+ - **Use `agentTool: false`** for UI-only / programmatic actions that should NOT be a tool in the model's context window. It stays frontend/HTTP-callable but is hidden from the agent. Distinct from `toolCallable: false`, which only blocks the sandboxed extension iframe bridge.
430
+ - **Document reusable actions.** If a new action should be called by agents outside one narrow screen, update `AGENTS.md` with when to use it, important args, and which return fields to preserve.
431
+ - **Promote workflow-heavy actions to skills.** If the action is part of a provider-backed, cross-app, MCP/A2A, or multi-step workflow, create or update a skill in `.agents/skills/` and add app-skill visibility (`internal`, `exported`, or `both`) when it should ship through a marketplace.
432
+ - **Use `loadEnv()`** only for deploy-level configuration. User/org/workspace
433
+ credentials belong in the encrypted secrets/credential/OAuth stores, never as
434
+ hardcoded literals or shared env fallbacks.
435
+ - **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
436
+ - **Import action primitives from `@agent-native/core/action`** and CLI helpers such as `parseArgs()` from `@agent-native/core` — do not redefine framework utilities locally.
437
+ - **Do not re-export actions as REST.** The mounted `/_agent-native/actions/:name` endpoint is the REST surface; duplicating it under `/api/*` creates drift and hides the operation from agents.
438
+
439
+ ## Common Patterns
440
+
441
+ **Read action (GET):**
442
+
443
+ ```ts
444
+ import { z } from "zod";
445
+ import { defineAction } from "@agent-native/core/action";
446
+
447
+ export default defineAction({
448
+ description: "List calendar events",
449
+ schema: z.object({
450
+ from: z.string().describe("Start date"),
451
+ to: z.string().describe("End date"),
452
+ }),
453
+ http: { method: "GET" },
454
+ run: async (args) => {
455
+ return await fetchEvents(args.from, args.to);
456
+ },
457
+ });
458
+ ```
459
+
460
+ **Write action (POST, default):**
461
+
462
+ ```ts
463
+ import { z } from "zod";
464
+ import { defineAction } from "@agent-native/core/action";
465
+
466
+ export default defineAction({
467
+ description: "Log a meal",
468
+ schema: z.object({
469
+ name: z.string().describe("Meal name"),
470
+ calories: z.coerce.number().describe("Calorie count"),
471
+ }),
472
+ run: async (args) => {
473
+ // args.calories is a number — z.coerce.number() handles string-to-number conversion from HTTP
474
+ const meal = await insertMeal(args);
475
+ return meal;
476
+ },
477
+ });
478
+ ```
479
+
480
+ **Agent-only action:**
481
+
482
+ ```ts
483
+ import { z } from "zod";
484
+ import { defineAction } from "@agent-native/core/action";
485
+
486
+ export default defineAction({
487
+ description: "Navigate the UI to a view",
488
+ schema: z.object({
489
+ view: z.string().describe("Target view"),
490
+ }),
491
+ http: false,
492
+ run: async (args) => {
493
+ await writeAppState("navigate", { command: "go", view: args.view });
494
+ return "Navigated";
495
+ },
496
+ });
497
+ ```
498
+
499
+ ## Troubleshooting
500
+
501
+ - **Action not found** — Check that the filename matches the command name exactly. `pnpm action foo-bar` looks for `actions/foo-bar.ts`.
502
+ - **Args not parsing** — Ensure args use `--key value` or `--key=value` format. Boolean flags use `--flag` (sets value to `"true"`).
503
+ - **Frontend getting 405** — The action's `http.method` doesn't match the hook. Use `useActionQuery` for GET actions, `useActionMutation` for POST/PUT/DELETE.
504
+ - **Frontend getting undefined** — Make sure the action returns structured data, not `JSON.stringify()`.
505
+
506
+ ## Related Skills
507
+
508
+ - **storing-data** — Actions read/write data in SQL
509
+ - **delegate-to-agent** — The agent invokes actions via `pnpm action <name>`
510
+ - **real-time-sync** — Database writes from actions trigger change events to update the UI
511
+ - **adding-a-feature** — Actions are area 2 of the four-area checklist
512
+ - **client-methods** — Client code uses named helpers/hooks instead of raw REST calls
@@ -37,6 +37,7 @@ pnpm action docs-search --slug <slug>
37
37
  pnpm action docs-search --list
38
38
  pnpm action source-search --query "<pattern>"
39
39
  pnpm action source-search --path templates/plan/AGENTS.md
40
+ pnpm action source-search --path toolkit/src/index.ts
40
41
  pnpm action source-search --list
41
42
  ```
42
43
 
@@ -56,6 +57,13 @@ under `node_modules/@agent-native/core/docs/content/`. For source examples,
56
57
  read files under `node_modules/@agent-native/core/corpus/core/` or
57
58
  `node_modules/@agent-native/core/corpus/templates/`.
58
59
 
60
+ Toolkit source is searchable at `toolkit/` in the Core corpus and also ships as
61
+ readable TypeScript under `node_modules/@agent-native/toolkit/src/`. Read
62
+ `customizing-agent-native` before copying a shared component: inspect package
63
+ source as a read-only reference, copy only the smallest UI piece into app-owned
64
+ source, and preserve public actions, application state, auth, and agent-chat
65
+ runtime contracts. Never edit `node_modules` or deep-import its private source.
66
+
59
67
  ## Useful Slugs
60
68
 
61
69
  | Need | Slugs |
@@ -74,3 +82,5 @@ read files under `node_modules/@agent-native/core/corpus/core/` or
74
82
  - Do not add custom REST wrappers for app data before reading `actions`.
75
83
  - Do not add inline LLM calls before reading `using-your-agent` and
76
84
  `agent-surfaces`.
85
+ - Do not copy framework runtime internals when a public API or narrow UI copy
86
+ will do; read `customizing-agent-native` for the supported override ladder.