@agent-native/core 0.32.1 → 0.32.17

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 (240) hide show
  1. package/README.md +3 -1
  2. package/dist/agent/run-store.d.ts.map +1 -1
  3. package/dist/agent/run-store.js +48 -10
  4. package/dist/agent/run-store.js.map +1 -1
  5. package/dist/agent/thread-data-builder.d.ts +12 -0
  6. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  7. package/dist/agent/thread-data-builder.js +104 -6
  8. package/dist/agent/thread-data-builder.js.map +1 -1
  9. package/dist/cli/app-skill.js +2 -2
  10. package/dist/cli/app-skill.js.map +1 -1
  11. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  12. package/dist/cli/code-agent-executor.js +6 -1
  13. package/dist/cli/code-agent-executor.js.map +1 -1
  14. package/dist/cli/code-agent-output-smoother.d.ts +7 -0
  15. package/dist/cli/code-agent-output-smoother.d.ts.map +1 -0
  16. package/dist/cli/code-agent-output-smoother.js +111 -0
  17. package/dist/cli/code-agent-output-smoother.js.map +1 -0
  18. package/dist/cli/connect.d.ts.map +1 -1
  19. package/dist/cli/connect.js +5 -0
  20. package/dist/cli/connect.js.map +1 -1
  21. package/dist/cli/migrate.d.ts.map +1 -1
  22. package/dist/cli/migrate.js +17 -42
  23. package/dist/cli/migrate.js.map +1 -1
  24. package/dist/cli/skills.d.ts +23 -2
  25. package/dist/cli/skills.d.ts.map +1 -1
  26. package/dist/cli/skills.js +405 -41
  27. package/dist/cli/skills.js.map +1 -1
  28. package/dist/cli/templates-meta.d.ts.map +1 -1
  29. package/dist/cli/templates-meta.js +7 -105
  30. package/dist/cli/templates-meta.js.map +1 -1
  31. package/dist/client/AgentPanel.d.ts.map +1 -1
  32. package/dist/client/AgentPanel.js +41 -7
  33. package/dist/client/AgentPanel.js.map +1 -1
  34. package/dist/client/AgentTaskCard.d.ts.map +1 -1
  35. package/dist/client/AgentTaskCard.js +0 -28
  36. package/dist/client/AgentTaskCard.js.map +1 -1
  37. package/dist/client/AssistantChat.d.ts +8 -23
  38. package/dist/client/AssistantChat.d.ts.map +1 -1
  39. package/dist/client/AssistantChat.js +359 -205
  40. package/dist/client/AssistantChat.js.map +1 -1
  41. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  42. package/dist/client/MultiTabAssistantChat.js +254 -14
  43. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  44. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  45. package/dist/client/agent-chat-adapter.js +14 -9
  46. package/dist/client/agent-chat-adapter.js.map +1 -1
  47. package/dist/client/agent-chat.d.ts +24 -0
  48. package/dist/client/agent-chat.d.ts.map +1 -1
  49. package/dist/client/agent-chat.js +73 -0
  50. package/dist/client/agent-chat.js.map +1 -1
  51. package/dist/client/assistant-ui-recovery.d.ts +34 -0
  52. package/dist/client/assistant-ui-recovery.d.ts.map +1 -0
  53. package/dist/client/assistant-ui-recovery.js +122 -0
  54. package/dist/client/assistant-ui-recovery.js.map +1 -0
  55. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  56. package/dist/client/composer/PromptComposer.js +7 -1
  57. package/dist/client/composer/PromptComposer.js.map +1 -1
  58. package/dist/client/composer/TiptapComposer.d.ts +7 -1
  59. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  60. package/dist/client/composer/TiptapComposer.js +22 -2
  61. package/dist/client/composer/TiptapComposer.js.map +1 -1
  62. package/dist/client/frame-protocol.d.ts +6 -2
  63. package/dist/client/frame-protocol.d.ts.map +1 -1
  64. package/dist/client/frame-protocol.js.map +1 -1
  65. package/dist/client/index.d.ts +2 -1
  66. package/dist/client/index.d.ts.map +1 -1
  67. package/dist/client/index.js +2 -1
  68. package/dist/client/index.js.map +1 -1
  69. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  70. package/dist/client/org/OrgSwitcher.js +2 -1
  71. package/dist/client/org/OrgSwitcher.js.map +1 -1
  72. package/dist/client/progress/RunsTray.d.ts +13 -3
  73. package/dist/client/progress/RunsTray.d.ts.map +1 -1
  74. package/dist/client/progress/RunsTray.js +105 -36
  75. package/dist/client/progress/RunsTray.js.map +1 -1
  76. package/dist/client/route-warmup.d.ts +61 -0
  77. package/dist/client/route-warmup.d.ts.map +1 -0
  78. package/dist/client/route-warmup.js +456 -0
  79. package/dist/client/route-warmup.js.map +1 -0
  80. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  81. package/dist/client/settings/SettingsPanel.js +2 -1
  82. package/dist/client/settings/SettingsPanel.js.map +1 -1
  83. package/dist/client/settings/useBuilderStatus.d.ts +5 -0
  84. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  85. package/dist/client/settings/useBuilderStatus.js +10 -4
  86. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  87. package/dist/client/use-action.d.ts +1 -0
  88. package/dist/client/use-action.d.ts.map +1 -1
  89. package/dist/client/use-action.js +22 -4
  90. package/dist/client/use-action.js.map +1 -1
  91. package/dist/code-agents/background-run.d.ts +2 -0
  92. package/dist/code-agents/background-run.d.ts.map +1 -1
  93. package/dist/code-agents/background-run.js.map +1 -1
  94. package/dist/db/client.d.ts +1 -1
  95. package/dist/db/client.d.ts.map +1 -1
  96. package/dist/db/client.js +25 -1
  97. package/dist/db/client.js.map +1 -1
  98. package/dist/deploy/build.d.ts +4 -0
  99. package/dist/deploy/build.d.ts.map +1 -1
  100. package/dist/deploy/build.js +171 -14
  101. package/dist/deploy/build.js.map +1 -1
  102. package/dist/deploy/immutable-assets.d.ts +1 -0
  103. package/dist/deploy/immutable-assets.d.ts.map +1 -1
  104. package/dist/deploy/immutable-assets.js +1 -0
  105. package/dist/deploy/immutable-assets.js.map +1 -1
  106. package/dist/index.browser.d.ts +1 -1
  107. package/dist/index.browser.d.ts.map +1 -1
  108. package/dist/index.browser.js +1 -1
  109. package/dist/index.browser.js.map +1 -1
  110. package/dist/index.d.ts +1 -1
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +1 -1
  113. package/dist/index.js.map +1 -1
  114. package/dist/mcp/connect-route.d.ts.map +1 -1
  115. package/dist/mcp/connect-route.js +118 -82
  116. package/dist/mcp/connect-route.js.map +1 -1
  117. package/dist/progress/routes.d.ts.map +1 -1
  118. package/dist/progress/routes.js +1 -0
  119. package/dist/progress/routes.js.map +1 -1
  120. package/dist/progress/store.d.ts +13 -0
  121. package/dist/progress/store.d.ts.map +1 -1
  122. package/dist/progress/store.js +18 -0
  123. package/dist/progress/store.js.map +1 -1
  124. package/dist/progress/types.d.ts +2 -0
  125. package/dist/progress/types.d.ts.map +1 -1
  126. package/dist/progress/types.js.map +1 -1
  127. package/dist/scripts/db/wipe-leaked-builder-keys.d.ts +2 -2
  128. package/dist/scripts/db/wipe-leaked-builder-keys.d.ts.map +1 -1
  129. package/dist/scripts/db/wipe-leaked-builder-keys.js +14 -3
  130. package/dist/scripts/db/wipe-leaked-builder-keys.js.map +1 -1
  131. package/dist/server/action-routes.d.ts +1 -0
  132. package/dist/server/action-routes.d.ts.map +1 -1
  133. package/dist/server/action-routes.js +36 -2
  134. package/dist/server/action-routes.js.map +1 -1
  135. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  136. package/dist/server/agent-chat-plugin.js +123 -25
  137. package/dist/server/agent-chat-plugin.js.map +1 -1
  138. package/dist/server/agent-discovery.d.ts.map +1 -1
  139. package/dist/server/agent-discovery.js +14 -1
  140. package/dist/server/agent-discovery.js.map +1 -1
  141. package/dist/server/agent-teams-run-queue.d.ts +80 -0
  142. package/dist/server/agent-teams-run-queue.d.ts.map +1 -0
  143. package/dist/server/agent-teams-run-queue.js +208 -0
  144. package/dist/server/agent-teams-run-queue.js.map +1 -0
  145. package/dist/server/agent-teams.d.ts +67 -0
  146. package/dist/server/agent-teams.d.ts.map +1 -1
  147. package/dist/server/agent-teams.js +607 -180
  148. package/dist/server/agent-teams.js.map +1 -1
  149. package/dist/server/auth-marketing.d.ts.map +1 -1
  150. package/dist/server/auth-marketing.js +0 -64
  151. package/dist/server/auth-marketing.js.map +1 -1
  152. package/dist/server/auth.d.ts.map +1 -1
  153. package/dist/server/auth.js +67 -14
  154. package/dist/server/auth.js.map +1 -1
  155. package/dist/server/builder-browser.d.ts +12 -2
  156. package/dist/server/builder-browser.d.ts.map +1 -1
  157. package/dist/server/builder-browser.js +24 -0
  158. package/dist/server/builder-browser.js.map +1 -1
  159. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  160. package/dist/server/core-routes-plugin.js +66 -5
  161. package/dist/server/core-routes-plugin.js.map +1 -1
  162. package/dist/server/credential-provider.d.ts +10 -0
  163. package/dist/server/credential-provider.d.ts.map +1 -1
  164. package/dist/server/credential-provider.js +82 -3
  165. package/dist/server/credential-provider.js.map +1 -1
  166. package/dist/server/csrf.d.ts.map +1 -1
  167. package/dist/server/csrf.js +3 -0
  168. package/dist/server/csrf.js.map +1 -1
  169. package/dist/server/index.d.ts +1 -0
  170. package/dist/server/index.d.ts.map +1 -1
  171. package/dist/server/index.js +1 -0
  172. package/dist/server/index.js.map +1 -1
  173. package/dist/server/onboarding-html.d.ts +1 -0
  174. package/dist/server/onboarding-html.d.ts.map +1 -1
  175. package/dist/server/onboarding-html.js +14 -1
  176. package/dist/server/onboarding-html.js.map +1 -1
  177. package/dist/server/self-dispatch.d.ts +44 -0
  178. package/dist/server/self-dispatch.d.ts.map +1 -0
  179. package/dist/server/self-dispatch.js +113 -0
  180. package/dist/server/self-dispatch.js.map +1 -0
  181. package/dist/server/social-og-image.d.ts +14 -0
  182. package/dist/server/social-og-image.d.ts.map +1 -0
  183. package/dist/server/social-og-image.js +251 -0
  184. package/dist/server/social-og-image.js.map +1 -0
  185. package/dist/server/ssr-handler.d.ts +1 -1
  186. package/dist/server/ssr-handler.d.ts.map +1 -1
  187. package/dist/server/ssr-handler.js +27 -11
  188. package/dist/server/ssr-handler.js.map +1 -1
  189. package/dist/shared/cache-control.d.ts +7 -0
  190. package/dist/shared/cache-control.d.ts.map +1 -1
  191. package/dist/shared/cache-control.js +7 -0
  192. package/dist/shared/cache-control.js.map +1 -1
  193. package/dist/shared/index.d.ts +1 -1
  194. package/dist/shared/index.d.ts.map +1 -1
  195. package/dist/shared/index.js +1 -1
  196. package/dist/shared/index.js.map +1 -1
  197. package/dist/shared/route-warmup-config.d.ts +28 -0
  198. package/dist/shared/route-warmup-config.d.ts.map +1 -0
  199. package/dist/shared/route-warmup-config.js +58 -0
  200. package/dist/shared/route-warmup-config.js.map +1 -0
  201. package/dist/shared/social-meta.d.ts +5 -0
  202. package/dist/shared/social-meta.d.ts.map +1 -1
  203. package/dist/shared/social-meta.js +36 -2
  204. package/dist/shared/social-meta.js.map +1 -1
  205. package/dist/shared/streaming-text-smoothing.d.ts +12 -0
  206. package/dist/shared/streaming-text-smoothing.d.ts.map +1 -0
  207. package/dist/shared/streaming-text-smoothing.js +52 -0
  208. package/dist/shared/streaming-text-smoothing.js.map +1 -0
  209. package/dist/styles/agent-native.css +4 -4
  210. package/dist/templates/default/AGENTS.md +9 -4
  211. package/dist/templates/default/DEVELOPING.md +15 -1
  212. package/dist/templates/workspace-core/AGENTS.md +7 -3
  213. package/dist/templates/workspace-root/AGENTS.md +7 -3
  214. package/dist/vite/client.d.ts +13 -0
  215. package/dist/vite/client.d.ts.map +1 -1
  216. package/dist/vite/client.js +36 -1
  217. package/dist/vite/client.js.map +1 -1
  218. package/dist/vite/index.d.ts +1 -0
  219. package/dist/vite/index.d.ts.map +1 -1
  220. package/dist/vite/index.js.map +1 -1
  221. package/docs/content/client.md +62 -1
  222. package/docs/content/code-agents-ui.md +6 -13
  223. package/docs/content/context-awareness.md +186 -21
  224. package/docs/content/deployment.md +8 -11
  225. package/docs/content/dispatch.md +1 -1
  226. package/docs/content/external-agents.md +32 -2
  227. package/docs/content/migration-workbench.md +4 -21
  228. package/docs/content/multi-app-workspace.md +1 -1
  229. package/docs/content/recurring-jobs.md +1 -1
  230. package/docs/content/security.md +0 -1
  231. package/docs/content/sharing.md +1 -3
  232. package/docs/content/skills-guide.md +12 -10
  233. package/docs/content/template-assets.md +21 -1
  234. package/docs/content/template-design.md +23 -5
  235. package/docs/content/template-dispatch.md +1 -1
  236. package/package.json +2 -1
  237. package/src/templates/default/AGENTS.md +9 -4
  238. package/src/templates/default/DEVELOPING.md +15 -1
  239. package/src/templates/workspace-core/AGENTS.md +7 -3
  240. package/src/templates/workspace-root/AGENTS.md +7 -3
@@ -29,10 +29,18 @@ be installed as an app-backed skill plus MCP connector:
29
29
  npx @agent-native/core@latest skills add design-exploration
30
30
  ```
31
31
 
32
- That gives the agent instructions to create a design shell, present 2-5 visual
33
- directions (3 is the sweet spot) in the inline Design MCP app, wait for your
34
- pick, and iterate from the selected prototype. See [Using it from your coding
35
- agent](#coding-agent) for the full flow.
32
+ If you only want the portable skill instructions through the Vercel/open Skills
33
+ CLI, use:
34
+
35
+ ```bash
36
+ npx skills add BuilderIO/agent-native --skill design-exploration
37
+ ```
38
+
39
+ The Agent Native CLI path gives the agent instructions and MCP tools to create
40
+ a design shell, present 2-5 visual directions (3 is the sweet spot) in the
41
+ inline Design MCP app, wait for your pick, and iterate from the selected
42
+ prototype. See [Using it from your coding agent](#coding-agent) for the full
43
+ flow.
36
44
 
37
45
  ## Useful Prompts
38
46
 
@@ -61,7 +69,17 @@ Generate and pick design directions without leaving Codex, Claude Code, Claude,
61
69
  npx @agent-native/core@latest skills add design-exploration # aliases: design, ux-exploration
62
70
  ```
63
71
 
64
- Default client is `codex`; add `--client claude-code` or `--client all` for others.
72
+ Default client is `codex`; add `--client claude-code` or `--client all` for
73
+ others. If you only want the portable skill instructions through the
74
+ Vercel/open Skills CLI, use:
75
+
76
+ ```bash
77
+ npx skills add BuilderIO/agent-native --skill design-exploration
78
+ ```
79
+
80
+ The Vercel/open Skills CLI installs the instruction file only; it does not
81
+ run MCP connector setup. Use the Agent Native CLI path above when you want
82
+ the one-command setup.
65
83
 
66
84
  2. **Ask for directions.** In your agent's chat: "Create three landing-page directions for a technical analytics product." The agent generates 2-5 directions (3 is the sweet spot) you can compare side by side.
67
85
  3. **Pick.** In inline hosts (ChatGPT, Claude.ai, Claude Desktop main chat) the variant grid renders right in the chat — pick a direction and it auto-persists as `index.html`, then keep refining. On CLI/link-only hosts (Codex, Claude Code, Claude Desktop "Code" tab) you get an **"Open in Design →"** link; open it, pick in the browser, then paste the copied handoff summary back into your chat — or just say "I picked direction B".
@@ -142,7 +142,7 @@ You can click through the Dispatch UI after signing in. To use the chat composer
142
142
 
143
143
  ## Customize it {#customize}
144
144
 
145
- Dispatch is a full template like any other — see [Templates](/docs/cloneable-saas). Ask the agent to "add a new integration for Datadog" or "route Slack DMs from channel X to the issues agent" and it'll edit the routing config, add the webhook handler, and wire it up.
145
+ Dispatch is a full template like any other — see [Templates](/docs/cloneable-saas). Ask the agent to "add a new integration for Datadog" or "route Slack DMs from channel X to the analytics agent" and it'll edit the routing config, add the webhook handler, and wire it up.
146
146
 
147
147
  For workspace-specific management screens, add local React Router pages and
148
148
  register them in `app/dispatch-extensions.tsx`. The generated workspace owns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.32.1",
3
+ "version": "0.32.17",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -130,6 +130,7 @@
130
130
  "@radix-ui/react-tooltip": "^1.2.8",
131
131
  "@react-router/dev": "^7.13.1",
132
132
  "@react-router/fs-routes": "^7.13.1",
133
+ "@resvg/resvg-js": "^2.6.2",
133
134
  "@sentry/browser": "^10.50.0",
134
135
  "@sentry/node": "^10.50.0",
135
136
  "@standard-schema/spec": "^1.1.0",
@@ -7,8 +7,8 @@ This is an **@agent-native/core** application -- the AI agent and UI share state
7
7
  ### Core Principles
8
8
 
9
9
  1. **Shared SQL database** -- All app state lives in SQL. Local SQLite at `data/app.db` is the zero-setup dev fallback; deployed apps need a persistent `DATABASE_URL` so data survives container/serverless restarts. Turso is optional, not required: Neon, Supabase, Turso/libSQL, plain Postgres, durable SQLite, D1 bindings, and Builder.io-managed environments are all valid when supported by the deploy. 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/`.
10
+ 2. **All AI through agent chat** -- No inline LLM calls. UI delegates to the AI via `sendToAgentChat()` / `agentChat.submit()`. When UI selections should add hidden context for the user's next prompt without submitting, use `setContextToAgentChat()` with a stable `key`.
11
+ 3. **Actions for app operations** -- `pnpm action <name>` dispatches to callable action files in `actions/`; `defineAction` also auto-exposes those operations at `/_agent-native/actions/:name` for the UI. Do not create custom REST routes that re-export actions.
12
12
  4. **Live sync keeps the UI current** -- Database writes stream over `/_agent-native/events` first, with `/_agent-native/poll` as the fallback. **When you (the agent) write data, the UI must reflect the change without a manual refresh.** This is non-negotiable. Use `useActionQuery` / `useActionMutation` for action-backed data (preferred). If you use raw `useQuery`, fold `useChangeVersions([<source>, "action"])` into the key for targeted refreshes. See the `real-time-sync` and `adding-a-feature` skills.
13
13
  5. **Agent can update code** -- The agent can modify this app's source code directly.
14
14
 
@@ -61,7 +61,7 @@ The `navigation` key is written by the UI whenever the route changes. The `navig
61
61
 
62
62
  This app may be mounted under `/<app-id>` in a workspace. Inside app source, React Router paths are app-local: use `<Link to="/review">` and `navigate("/review")`, not `/<app-id>/review`. The workspace gateway and `APP_BASE_PATH` add the mounted prefix in the browser; hardcoding it inside React Router links causes doubled URLs such as `/<app-id>/<app-id>/review`.
63
63
 
64
- For raw paths outside React Router, use the core helpers: `appPath()` for static assets or normal hrefs, `appApiPath()` for `/api/*`, and `agentNativePath()` for `/_agent-native/*`.
64
+ For raw paths outside React Router, use the core helpers: `appPath()` for static assets or normal hrefs, `appApiPath()` for legitimate route-only `/api/*` endpoints, and `agentNativePath()` for `/_agent-native/*`. Do not use `appApiPath()` to build action-backed CRUD wrappers.
65
65
 
66
66
  ## Agent Operations
67
67
 
@@ -77,6 +77,11 @@ You do NOT get auto-injected screen state. **Call `pnpm action view-screen` at t
77
77
 
78
78
  ### Actions
79
79
 
80
+ Use existing domain actions before reaching for SQL or custom routes. If a
81
+ capability is missing, add or extend a `defineAction` so both the agent and UI
82
+ share the same operation. Do not create `/api/*` routes that only call,
83
+ repackage, or proxy an action.
84
+
80
85
  | Action | Args | Purpose |
81
86
  | ------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
82
87
  | `view-screen` | | See current UI state |
@@ -120,7 +125,7 @@ Skills in `.agents/skills/` provide detailed guidance for each architectural rul
120
125
 
121
126
  1. **Add navigation state entries** — extend `app/hooks/use-navigation-state.ts` to track new routes
122
127
  2. **Enhance view-screen** — make the view-screen script return relevant context for the new view
123
- 3. **Create domain actions** — add actions in `actions/` for CRUD operations on new data models
128
+ 3. **Create domain actions** — add actions in `actions/` for CRUD operations on new data models; do not create REST wrappers around those actions
124
129
  4. **Wire UI for auto-refresh** — use `useActionQuery` / `useActionMutation` for normal CRUD. If a raw `useQuery` is unavoidable, fold `useChangeVersions([<source>, "action"])` into its key with `placeholderData`. When the agent mutates this data, the UI must reflect the change without a manual refresh. See `real-time-sync` skill.
125
130
  5. **Create domain skills** — add `.agents/skills/<feature>/SKILL.md` documenting the data model, storage patterns, and agent operations
126
131
  6. **Update this AGENTS.md** — add the new actions, state keys, and common tasks
@@ -80,7 +80,8 @@ export default defineNitroPlugin(async (nitroApp) => {
80
80
  | `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
81
81
  | `readResource`, `writeResource` | Read/write resources (from `@agent-native/core/resources`) |
82
82
  | `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
83
- | `sendToAgentChat` | Send messages to agent from UI (client-side) |
83
+ | `sendToAgentChat` | Send or prefill messages in the agent chat from UI (client-side) |
84
+ | `setContextToAgentChat` | Stage keyed context chips for the next agent chat prompt from UI |
84
85
  | `agentChat` | Send messages to agent from scripts (server-side) |
85
86
 
86
87
  ## Adding a Script
@@ -101,6 +102,19 @@ sendToAgentChat({
101
102
  });
102
103
  ```
103
104
 
105
+ To add hidden context without submitting or filling the prompt text, stage
106
+ keyed context nuggets. Multiple nuggets stack; using the same `key` replaces the
107
+ previous nugget.
108
+
109
+ ```ts
110
+ import { setContextToAgentChat } from "@agent-native/core";
111
+ setContextToAgentChat({
112
+ key: "selected-record",
113
+ title: "Selected Record",
114
+ context: JSON.stringify(record, null, 2),
115
+ });
116
+ ```
117
+
104
118
  **From scripts:**
105
119
 
106
120
  ```ts
@@ -14,8 +14,10 @@ agent should know.
14
14
  - All AI/LLM behavior goes through the app's agent chat. UI and server code
15
15
  must not call model providers, AI SDK `generateText()` / `streamText()`, or
16
16
  other inline LLM APIs directly. Use `sendToAgentChat()` for local app-agent
17
- work, and read `.agents/skills/delegate-to-agent/SKILL.md` before building
18
- agent-driven UI or "AI" features.
17
+ work. When selected UI data should become hidden context for the user's next
18
+ prompt without submitting anything, use `setContextToAgentChat()` with a
19
+ stable `key`. Read `.agents/skills/delegate-to-agent/SKILL.md` before
20
+ building agent-driven UI or "AI" features.
19
21
  - Put shared code in `packages/shared` only when multiple apps need it.
20
22
  - Keep app-specific screens, actions, state, and skills inside `apps/<app>`.
21
23
  - Store shared runtime configuration in the workspace root `.env`; use
@@ -74,7 +76,9 @@ create `defineAction` files in `actions/`, mark reads with
74
76
  `http: { method: "GET" }`, and call them from React with `useActionQuery` /
75
77
  `useActionMutation`. Do not add duplicate JSON CRUD routes under `/api/*` for
76
78
  the same data unless the route is for uploads, streaming, webhooks, OAuth, or
77
- another route-only concern. Action-backed UI is what makes agent-created or
79
+ another route-only concern. Do not add routes whose main job is to wrap,
80
+ proxy, or re-export an action; the action endpoint already exists at
81
+ `/_agent-native/actions/:name`. Action-backed UI is what makes agent-created or
78
82
  agent-edited records appear without a manual refresh.
79
83
 
80
84
  App database code must be provider-agnostic. Define schemas with
@@ -11,7 +11,9 @@ coding agents can discover the same workspace-wide guidance from the root.
11
11
  - All AI/LLM behavior goes through the app's agent chat. UI and server code
12
12
  must not call model providers, AI SDK `generateText()` / `streamText()`, or
13
13
  other inline LLM APIs directly. Use `sendToAgentChat()` for local app-agent
14
- work, and read `packages/shared/.agents/skills/delegate-to-agent/SKILL.md`
14
+ work. When selected UI data should become hidden context for the user's next
15
+ prompt without submitting anything, use `setContextToAgentChat()` with a
16
+ stable `key`. Read `packages/shared/.agents/skills/delegate-to-agent/SKILL.md`
15
17
  before building agent-driven UI or "AI" features.
16
18
 
17
19
  ## Workspace Resources
@@ -101,8 +103,10 @@ coding agents can discover the same workspace-wide guidance from the root.
101
103
  `http: { method: "GET" }`, and call them from React with `useActionQuery` /
102
104
  `useActionMutation`. Do not add duplicate JSON CRUD routes under `/api/*`
103
105
  for the same data unless the route is for uploads, streaming, webhooks,
104
- OAuth, or another route-only concern. Action-backed UI is what makes
105
- agent-created or agent-edited records appear without a manual refresh.
106
+ OAuth, or another route-only concern. Do not add routes whose main job is to
107
+ wrap, proxy, or re-export an action; the action endpoint already exists at
108
+ `/_agent-native/actions/:name`. Action-backed UI is what makes agent-created
109
+ or agent-edited records appear without a manual refresh.
106
110
  - App database code must be provider-agnostic. Define schemas with
107
111
  `@agent-native/core/db/schema` helpers and write app reads/writes with
108
112
  Drizzle's query builder and portable `drizzle-orm` operators. Do not import