@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.
- package/README.md +3 -1
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +48 -10
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +12 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +104 -6
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/cli/app-skill.js +2 -2
- package/dist/cli/app-skill.js.map +1 -1
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +6 -1
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-output-smoother.d.ts +7 -0
- package/dist/cli/code-agent-output-smoother.d.ts.map +1 -0
- package/dist/cli/code-agent-output-smoother.js +111 -0
- package/dist/cli/code-agent-output-smoother.js.map +1 -0
- package/dist/cli/connect.d.ts.map +1 -1
- package/dist/cli/connect.js +5 -0
- package/dist/cli/connect.js.map +1 -1
- package/dist/cli/migrate.d.ts.map +1 -1
- package/dist/cli/migrate.js +17 -42
- package/dist/cli/migrate.js.map +1 -1
- package/dist/cli/skills.d.ts +23 -2
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +405 -41
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +7 -105
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +41 -7
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AgentTaskCard.d.ts.map +1 -1
- package/dist/client/AgentTaskCard.js +0 -28
- package/dist/client/AgentTaskCard.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +8 -23
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +359 -205
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +254 -14
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +14 -9
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-chat.d.ts +24 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +73 -0
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/assistant-ui-recovery.d.ts +34 -0
- package/dist/client/assistant-ui-recovery.d.ts.map +1 -0
- package/dist/client/assistant-ui-recovery.js +122 -0
- package/dist/client/assistant-ui-recovery.js.map +1 -0
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +7 -1
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +7 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +22 -2
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/frame-protocol.d.ts +6 -2
- package/dist/client/frame-protocol.d.ts.map +1 -1
- package/dist/client/frame-protocol.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +2 -1
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/progress/RunsTray.d.ts +13 -3
- package/dist/client/progress/RunsTray.d.ts.map +1 -1
- package/dist/client/progress/RunsTray.js +105 -36
- package/dist/client/progress/RunsTray.js.map +1 -1
- package/dist/client/route-warmup.d.ts +61 -0
- package/dist/client/route-warmup.d.ts.map +1 -0
- package/dist/client/route-warmup.js +456 -0
- package/dist/client/route-warmup.js.map +1 -0
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +2 -1
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +5 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +10 -4
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/use-action.d.ts +1 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +22 -4
- package/dist/client/use-action.js.map +1 -1
- package/dist/code-agents/background-run.d.ts +2 -0
- package/dist/code-agents/background-run.d.ts.map +1 -1
- package/dist/code-agents/background-run.js.map +1 -1
- package/dist/db/client.d.ts +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +25 -1
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts +4 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +171 -14
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/immutable-assets.d.ts +1 -0
- package/dist/deploy/immutable-assets.d.ts.map +1 -1
- package/dist/deploy/immutable-assets.js +1 -0
- package/dist/deploy/immutable-assets.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +118 -82
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/progress/routes.d.ts.map +1 -1
- package/dist/progress/routes.js +1 -0
- package/dist/progress/routes.js.map +1 -1
- package/dist/progress/store.d.ts +13 -0
- package/dist/progress/store.d.ts.map +1 -1
- package/dist/progress/store.js +18 -0
- package/dist/progress/store.js.map +1 -1
- package/dist/progress/types.d.ts +2 -0
- package/dist/progress/types.d.ts.map +1 -1
- package/dist/progress/types.js.map +1 -1
- package/dist/scripts/db/wipe-leaked-builder-keys.d.ts +2 -2
- package/dist/scripts/db/wipe-leaked-builder-keys.d.ts.map +1 -1
- package/dist/scripts/db/wipe-leaked-builder-keys.js +14 -3
- package/dist/scripts/db/wipe-leaked-builder-keys.js.map +1 -1
- package/dist/server/action-routes.d.ts +1 -0
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +36 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +123 -25
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +14 -1
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-teams-run-queue.d.ts +80 -0
- package/dist/server/agent-teams-run-queue.d.ts.map +1 -0
- package/dist/server/agent-teams-run-queue.js +208 -0
- package/dist/server/agent-teams-run-queue.js.map +1 -0
- package/dist/server/agent-teams.d.ts +67 -0
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +607 -180
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth-marketing.d.ts.map +1 -1
- package/dist/server/auth-marketing.js +0 -64
- package/dist/server/auth-marketing.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +67 -14
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-browser.d.ts +12 -2
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +24 -0
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +66 -5
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +10 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +82 -3
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +3 -0
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts +1 -0
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +14 -1
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/self-dispatch.d.ts +44 -0
- package/dist/server/self-dispatch.d.ts.map +1 -0
- package/dist/server/self-dispatch.js +113 -0
- package/dist/server/self-dispatch.js.map +1 -0
- package/dist/server/social-og-image.d.ts +14 -0
- package/dist/server/social-og-image.d.ts.map +1 -0
- package/dist/server/social-og-image.js +251 -0
- package/dist/server/social-og-image.js.map +1 -0
- package/dist/server/ssr-handler.d.ts +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +27 -11
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/shared/cache-control.d.ts +7 -0
- package/dist/shared/cache-control.d.ts.map +1 -1
- package/dist/shared/cache-control.js +7 -0
- package/dist/shared/cache-control.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/route-warmup-config.d.ts +28 -0
- package/dist/shared/route-warmup-config.d.ts.map +1 -0
- package/dist/shared/route-warmup-config.js +58 -0
- package/dist/shared/route-warmup-config.js.map +1 -0
- package/dist/shared/social-meta.d.ts +5 -0
- package/dist/shared/social-meta.d.ts.map +1 -1
- package/dist/shared/social-meta.js +36 -2
- package/dist/shared/social-meta.js.map +1 -1
- package/dist/shared/streaming-text-smoothing.d.ts +12 -0
- package/dist/shared/streaming-text-smoothing.d.ts.map +1 -0
- package/dist/shared/streaming-text-smoothing.js +52 -0
- package/dist/shared/streaming-text-smoothing.js.map +1 -0
- package/dist/styles/agent-native.css +4 -4
- package/dist/templates/default/AGENTS.md +9 -4
- package/dist/templates/default/DEVELOPING.md +15 -1
- package/dist/templates/workspace-core/AGENTS.md +7 -3
- package/dist/templates/workspace-root/AGENTS.md +7 -3
- package/dist/vite/client.d.ts +13 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +36 -1
- package/dist/vite/client.js.map +1 -1
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js.map +1 -1
- package/docs/content/client.md +62 -1
- package/docs/content/code-agents-ui.md +6 -13
- package/docs/content/context-awareness.md +186 -21
- package/docs/content/deployment.md +8 -11
- package/docs/content/dispatch.md +1 -1
- package/docs/content/external-agents.md +32 -2
- package/docs/content/migration-workbench.md +4 -21
- package/docs/content/multi-app-workspace.md +1 -1
- package/docs/content/recurring-jobs.md +1 -1
- package/docs/content/security.md +0 -1
- package/docs/content/sharing.md +1 -3
- package/docs/content/skills-guide.md +12 -10
- package/docs/content/template-assets.md +21 -1
- package/docs/content/template-design.md +23 -5
- package/docs/content/template-dispatch.md +1 -1
- package/package.json +2 -1
- package/src/templates/default/AGENTS.md +9 -4
- package/src/templates/default/DEVELOPING.md +15 -1
- package/src/templates/workspace-core/AGENTS.md +7 -3
- 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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
18
|
-
|
|
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.
|
|
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
|
|
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.
|
|
105
|
-
|
|
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
|