@agent-native/core 0.26.9 → 0.27.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.
- package/dist/agent/run-ownership.d.ts +12 -0
- package/dist/agent/run-ownership.d.ts.map +1 -0
- package/dist/agent/run-ownership.js +39 -0
- package/dist/agent/run-ownership.js.map +1 -0
- package/dist/client/db-admin/DataGrid.d.ts +42 -0
- package/dist/client/db-admin/DataGrid.d.ts.map +1 -0
- package/dist/client/db-admin/DataGrid.js +204 -0
- package/dist/client/db-admin/DataGrid.js.map +1 -0
- package/dist/client/db-admin/DbAdminPage.d.ts +2 -0
- package/dist/client/db-admin/DbAdminPage.d.ts.map +1 -0
- package/dist/client/db-admin/DbAdminPage.js +72 -0
- package/dist/client/db-admin/DbAdminPage.js.map +1 -0
- package/dist/client/db-admin/DevDatabaseLink.d.ts +19 -0
- package/dist/client/db-admin/DevDatabaseLink.d.ts.map +1 -0
- package/dist/client/db-admin/DevDatabaseLink.js +25 -0
- package/dist/client/db-admin/DevDatabaseLink.js.map +1 -0
- package/dist/client/db-admin/EditableCell.d.ts +26 -0
- package/dist/client/db-admin/EditableCell.d.ts.map +1 -0
- package/dist/client/db-admin/EditableCell.js +150 -0
- package/dist/client/db-admin/EditableCell.js.map +1 -0
- package/dist/client/db-admin/FilterBar.d.ts +8 -0
- package/dist/client/db-admin/FilterBar.d.ts.map +1 -0
- package/dist/client/db-admin/FilterBar.js +68 -0
- package/dist/client/db-admin/FilterBar.js.map +1 -0
- package/dist/client/db-admin/ResultsGrid.d.ts +6 -0
- package/dist/client/db-admin/ResultsGrid.d.ts.map +1 -0
- package/dist/client/db-admin/ResultsGrid.js +41 -0
- package/dist/client/db-admin/ResultsGrid.js.map +1 -0
- package/dist/client/db-admin/RowSidePanel.d.ts +18 -0
- package/dist/client/db-admin/RowSidePanel.d.ts.map +1 -0
- package/dist/client/db-admin/RowSidePanel.js +104 -0
- package/dist/client/db-admin/RowSidePanel.js.map +1 -0
- package/dist/client/db-admin/SqlEditor.d.ts +8 -0
- package/dist/client/db-admin/SqlEditor.d.ts.map +1 -0
- package/dist/client/db-admin/SqlEditor.js +350 -0
- package/dist/client/db-admin/SqlEditor.js.map +1 -0
- package/dist/client/db-admin/TableBrowser.d.ts +10 -0
- package/dist/client/db-admin/TableBrowser.d.ts.map +1 -0
- package/dist/client/db-admin/TableBrowser.js +61 -0
- package/dist/client/db-admin/TableBrowser.js.map +1 -0
- package/dist/client/db-admin/TableEditor.d.ts +9 -0
- package/dist/client/db-admin/TableEditor.d.ts.map +1 -0
- package/dist/client/db-admin/TableEditor.js +254 -0
- package/dist/client/db-admin/TableEditor.js.map +1 -0
- package/dist/client/db-admin/cell-format.d.ts +55 -0
- package/dist/client/db-admin/cell-format.d.ts.map +1 -0
- package/dist/client/db-admin/cell-format.js +223 -0
- package/dist/client/db-admin/cell-format.js.map +1 -0
- package/dist/client/db-admin/changeset.d.ts +74 -0
- package/dist/client/db-admin/changeset.d.ts.map +1 -0
- package/dist/client/db-admin/changeset.js +169 -0
- package/dist/client/db-admin/changeset.js.map +1 -0
- package/dist/client/db-admin/export-utils.d.ts +15 -0
- package/dist/client/db-admin/export-utils.d.ts.map +1 -0
- package/dist/client/db-admin/export-utils.js +62 -0
- package/dist/client/db-admin/export-utils.js.map +1 -0
- package/dist/client/db-admin/index.d.ts +7 -0
- package/dist/client/db-admin/index.d.ts.map +1 -0
- package/dist/client/db-admin/index.js +8 -0
- package/dist/client/db-admin/index.js.map +1 -0
- package/dist/client/db-admin/sql-storage.d.ts +35 -0
- package/dist/client/db-admin/sql-storage.d.ts.map +1 -0
- package/dist/client/db-admin/sql-storage.js +117 -0
- package/dist/client/db-admin/sql-storage.js.map +1 -0
- package/dist/client/db-admin/storage.d.ts +24 -0
- package/dist/client/db-admin/storage.d.ts.map +1 -0
- package/dist/client/db-admin/storage.js +50 -0
- package/dist/client/db-admin/storage.js.map +1 -0
- package/dist/client/db-admin/useAgentSync.d.ts +22 -0
- package/dist/client/db-admin/useAgentSync.d.ts.map +1 -0
- package/dist/client/db-admin/useAgentSync.js +120 -0
- package/dist/client/db-admin/useAgentSync.js.map +1 -0
- package/dist/client/db-admin/useDbAdmin.d.ts +20 -0
- package/dist/client/db-admin/useDbAdmin.d.ts.map +1 -0
- package/dist/client/db-admin/useDbAdmin.js +154 -0
- package/dist/client/db-admin/useDbAdmin.js.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/index.js +25 -5
- package/dist/credentials/index.js.map +1 -1
- package/dist/db-admin/agent-tools.d.ts +15 -0
- package/dist/db-admin/agent-tools.d.ts.map +1 -0
- package/dist/db-admin/agent-tools.js +147 -0
- package/dist/db-admin/agent-tools.js.map +1 -0
- package/dist/db-admin/operations.d.ts +17 -0
- package/dist/db-admin/operations.d.ts.map +1 -0
- package/dist/db-admin/operations.js +541 -0
- package/dist/db-admin/operations.js.map +1 -0
- package/dist/db-admin/routes.d.ts +5 -0
- package/dist/db-admin/routes.d.ts.map +1 -0
- package/dist/db-admin/routes.js +134 -0
- package/dist/db-admin/routes.js.map +1 -0
- package/dist/db-admin/types.d.ts +85 -0
- package/dist/db-admin/types.d.ts.map +1 -0
- package/dist/db-admin/types.js +9 -0
- package/dist/db-admin/types.js.map +1 -0
- package/dist/extensions/url-safety.d.ts +20 -0
- package/dist/extensions/url-safety.d.ts.map +1 -1
- package/dist/extensions/url-safety.js +43 -0
- package/dist/extensions/url-safety.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts.map +1 -1
- package/dist/file-upload/actions/upload-image.js +6 -1
- package/dist/file-upload/actions/upload-image.js.map +1 -1
- package/dist/integrations/adapters/email.d.ts.map +1 -1
- package/dist/integrations/adapters/email.js +112 -0
- package/dist/integrations/adapters/email.js.map +1 -1
- package/dist/integrations/types.d.ts +11 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/scripts/db/exec.d.ts.map +1 -1
- package/dist/scripts/db/exec.js +2 -1
- package/dist/scripts/db/exec.js.map +1 -1
- package/dist/scripts/db/index.d.ts.map +1 -1
- package/dist/scripts/db/index.js +1 -0
- package/dist/scripts/db/index.js.map +1 -1
- package/dist/scripts/db/migrate-encrypt-credentials.d.ts +28 -0
- package/dist/scripts/db/migrate-encrypt-credentials.d.ts.map +1 -0
- package/dist/scripts/db/migrate-encrypt-credentials.js +190 -0
- package/dist/scripts/db/migrate-encrypt-credentials.js.map +1 -0
- package/dist/scripts/db/query.d.ts.map +1 -1
- package/dist/scripts/db/query.js +2 -1
- package/dist/scripts/db/query.js.map +1 -1
- package/dist/scripts/db/safety.d.ts +1 -0
- package/dist/scripts/db/safety.d.ts.map +1 -1
- package/dist/scripts/db/safety.js +32 -0
- package/dist/scripts/db/safety.js.map +1 -1
- package/dist/scripts/db/scoping.d.ts.map +1 -1
- package/dist/scripts/db/scoping.js +11 -1
- package/dist/scripts/db/scoping.js.map +1 -1
- package/dist/secrets/crypto.d.ts +28 -0
- package/dist/secrets/crypto.d.ts.map +1 -0
- package/dist/secrets/crypto.js +81 -0
- package/dist/secrets/crypto.js.map +1 -0
- package/dist/secrets/storage.d.ts.map +1 -1
- package/dist/secrets/storage.js +3 -61
- package/dist/secrets/storage.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +5 -2
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +24 -7
- 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 +39 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.js +3 -3
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +5 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +9 -1
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/design-token-utils.d.ts +8 -1
- package/dist/server/design-token-utils.d.ts.map +1 -1
- package/dist/server/design-token-utils.js +12 -4
- package/dist/server/design-token-utils.js.map +1 -1
- package/dist/templates/default/AGENTS.md +4 -4
- package/dist/templates/default/app/routes/database.tsx +13 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +9 -2
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +7 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +4 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +2 -2
- package/docs/content/actions.md +2 -54
- package/docs/content/agent-mentions.md +1 -1
- package/docs/content/agent-teams.md +1 -1
- package/docs/content/authentication.md +2 -2
- package/docs/content/cli-adapters.md +33 -17
- package/docs/content/client.md +11 -20
- package/docs/content/code-agents-ui.md +19 -6
- package/docs/content/context-awareness.md +36 -20
- package/docs/content/database.md +3 -3
- package/docs/content/deployment.md +8 -8
- package/docs/content/dispatch.md +1 -1
- package/docs/content/external-agents.md +5 -1
- package/docs/content/faq.md +1 -0
- package/docs/content/frames.md +110 -30
- package/docs/content/getting-started.md +15 -14
- package/docs/content/mcp-clients.md +1 -1
- package/docs/content/mcp-protocol.md +11 -88
- package/docs/content/messaging.md +1 -1
- package/docs/content/migration-workbench.md +13 -87
- package/docs/content/multi-app-workspace.md +2 -38
- package/docs/content/multi-tenancy.md +3 -26
- package/docs/content/onboarding.md +10 -3
- package/docs/content/recurring-jobs.md +2 -2
- package/docs/content/security.md +33 -1
- package/docs/content/server.md +1 -1
- package/docs/content/template-assets.md +9 -9
- package/docs/content/template-brain.md +114 -388
- package/docs/content/template-clips.md +42 -2
- package/docs/content/template-content.md +1 -1
- package/docs/content/template-design.md +27 -0
- package/docs/content/template-dispatch.md +3 -3
- package/docs/content/template-forms.md +6 -6
- package/docs/content/template-starter.md +2 -2
- package/docs/content/using-your-agent.md +56 -0
- package/docs/content/workspace-management.md +6 -6
- package/docs/content/workspace.md +19 -0
- package/package.json +10 -3
- package/src/templates/default/AGENTS.md +4 -4
- package/src/templates/default/app/routes/database.tsx +13 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +9 -2
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +7 -1
|
@@ -174,12 +174,20 @@ export class DockerAdapter implements CliAdapter {
|
|
|
174
174
|
|
|
175
175
|
Expose the registry to the UI via an API route so actions and components can discover and invoke CLIs:
|
|
176
176
|
|
|
177
|
+
`createServer()` returns an H3 `{ app, router }`. Mount routes on `router` with H3 handlers (`defineEventHandler`, `readBody`, `getRouterParam`):
|
|
178
|
+
|
|
177
179
|
```ts
|
|
178
180
|
// server/index.ts
|
|
179
181
|
import { createServer } from "@agent-native/core";
|
|
180
182
|
import { CliRegistry, ShellCliAdapter } from "@agent-native/core/adapters/cli";
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
import {
|
|
184
|
+
defineEventHandler,
|
|
185
|
+
readBody,
|
|
186
|
+
getRouterParam,
|
|
187
|
+
setResponseStatus,
|
|
188
|
+
} from "h3";
|
|
189
|
+
|
|
190
|
+
const { router } = createServer();
|
|
183
191
|
const cliRegistry = new CliRegistry();
|
|
184
192
|
|
|
185
193
|
cliRegistry.register(
|
|
@@ -190,23 +198,31 @@ cliRegistry.register(
|
|
|
190
198
|
);
|
|
191
199
|
|
|
192
200
|
// Discovery endpoint — agent can query this
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
router.get(
|
|
202
|
+
"/api/cli",
|
|
203
|
+
defineEventHandler(async () => {
|
|
204
|
+
return await cliRegistry.describe();
|
|
205
|
+
}),
|
|
206
|
+
);
|
|
197
207
|
|
|
198
208
|
// Execution endpoint
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
209
|
+
router.post(
|
|
210
|
+
"/api/cli/:name",
|
|
211
|
+
defineEventHandler(async (event) => {
|
|
212
|
+
const name = getRouterParam(event, "name");
|
|
213
|
+
const adapter = name ? cliRegistry.get(name) : undefined;
|
|
214
|
+
if (!adapter) {
|
|
215
|
+
setResponseStatus(event, 404);
|
|
216
|
+
return { error: "CLI not found" };
|
|
217
|
+
}
|
|
202
218
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
219
|
+
const { args } = await readBody(event);
|
|
220
|
+
return await adapter.execute(args ?? []);
|
|
221
|
+
}),
|
|
222
|
+
);
|
|
207
223
|
```
|
|
208
224
|
|
|
209
|
-
## Using from actions {#from-
|
|
225
|
+
## Using from actions {#from-actions}
|
|
210
226
|
|
|
211
227
|
Actions can use CLI adapters directly for structured access:
|
|
212
228
|
|
|
@@ -240,9 +256,9 @@ export default async function listPrs() {
|
|
|
240
256
|
}
|
|
241
257
|
|
|
242
258
|
const prs = JSON.parse(result.stdout);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
259
|
+
console.error(`Fetched ${prs.length} PRs`);
|
|
260
|
+
// Return the data (or persist it to SQL) — don't write durable state to data/.
|
|
261
|
+
return prs;
|
|
246
262
|
}
|
|
247
263
|
```
|
|
248
264
|
|
package/docs/content/client.md
CHANGED
|
@@ -117,25 +117,10 @@ sendToAgentChat({
|
|
|
117
117
|
|
|
118
118
|
## MCP App Host Bridge {#mcp-app-host-bridge}
|
|
119
119
|
|
|
120
|
-
Routes embedded
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Default direct route embeds use the standard MCP Apps `ui/*` JSON-RPC bridge.
|
|
125
|
-
The exported helpers below send `ui/update-model-context`, `ui/open-link`, and
|
|
126
|
-
`ui/request-display-mode` directly to the host. The explicit nested diagnostic
|
|
127
|
-
mode still uses the wrapper relay:
|
|
128
|
-
|
|
129
|
-
| Direction | Message type | Purpose |
|
|
130
|
-
| --------------- | ---------------------------------------- | ------------------------------------------------- |
|
|
131
|
-
| wrapper → route | `agentNative.mcpHostContext` | Push host context such as theme/display mode |
|
|
132
|
-
| route → wrapper | `agentNative.mcpHost.updateModelContext` | Add hidden model context |
|
|
133
|
-
| route → wrapper | `agentNative.mcpHost.openLink` | Ask the host to open a URL |
|
|
134
|
-
| route → wrapper | `agentNative.mcpHost.requestDisplayMode` | Ask for `inline`, `fullscreen`, or `pip` |
|
|
135
|
-
| wrapper → route | `agentNative.mcpHost.response` | Resolve or reject a request by matching requestId |
|
|
136
|
-
|
|
137
|
-
Use the exported helpers from `@agent-native/core/client` inside embedded
|
|
138
|
-
routes:
|
|
120
|
+
Routes embedded as MCP Apps should be URL-first: load the current artifact from
|
|
121
|
+
path/query params, render the real React route or a focused shared component,
|
|
122
|
+
and use the host bridge only for host-owned behavior. `@agent-native/core/client`
|
|
123
|
+
exports the helpers embedded routes call:
|
|
139
124
|
|
|
140
125
|
```ts
|
|
141
126
|
import {
|
|
@@ -149,10 +134,16 @@ import {
|
|
|
149
134
|
|
|
150
135
|
`getMcpAppHostContext()` reads the latest pushed host context snapshot;
|
|
151
136
|
`useMcpAppHostContext()` subscribes React components to changes. The request
|
|
152
|
-
helpers
|
|
137
|
+
helpers (`openMcpAppHostLink`, `requestMcpAppDisplayMode`,
|
|
138
|
+
`updateMcpAppModelContext`) return `false` outside an embedded MCP App frame, or
|
|
153
139
|
`Promise<boolean>` inside a frame. `sendToAgentChat()` uses the same bridge for
|
|
154
140
|
auto-submitted prompts from embedded routes.
|
|
155
141
|
|
|
142
|
+
The bridge itself — the `ui/*` JSON-RPC messages, the `agentNative.mcpHost.*`
|
|
143
|
+
wrapper relay, transplant vs. controlled-frame rendering, host context, and
|
|
144
|
+
display-mode requests — is owned by
|
|
145
|
+
[External Agents](/docs/external-agents#mcp-app-bridge).
|
|
146
|
+
|
|
156
147
|
## Dynamic Suggestions {#dynamic-suggestions}
|
|
157
148
|
|
|
158
149
|
`<AgentSidebar>`, `<AgentPanel>`, and `<AssistantChat>` merge static `suggestions` with context-aware suggestions by default. The framework reads `navigation`, `selection`, `pending-selection-context`, and the current URL from application state while an empty chat is visible, then offers prompt chips that match the current screen.
|
|
@@ -140,7 +140,20 @@ agent-native code ui
|
|
|
140
140
|
|
|
141
141
|
`resume` appends context and continues a run, `status` reports the latest run
|
|
142
142
|
state, `stop` asks the active controller to halt work, and `ui` opens the local
|
|
143
|
-
Code surface. These are run controls, not a separate implementation path.
|
|
143
|
+
Code surface. These are run controls, not a separate implementation path. If a
|
|
144
|
+
high-risk command pauses for approval, `approve --last` runs that one pending
|
|
145
|
+
command and then points you back to resume the session.
|
|
146
|
+
|
|
147
|
+
Run modes make editing policy explicit per session:
|
|
148
|
+
|
|
149
|
+
| Mode | CLI flag | Behavior |
|
|
150
|
+
| ------------- | -------- | -------------------------------------------------------------------------------------------------------- |
|
|
151
|
+
| **Plan mode** | `--plan` | Inspect, plan, and explain without writing files or running mutations. |
|
|
152
|
+
| **Auto mode** | `--auto` | Edit files, run checks, and pause only for genuinely destructive file, git, publish, or data operations. |
|
|
153
|
+
|
|
154
|
+
Auto mode is the default for local Agent-Native Code sessions. Use Plan mode for
|
|
155
|
+
assessment, architecture, review, or any task where you want a proposal before
|
|
156
|
+
edits.
|
|
144
157
|
|
|
145
158
|
For cross-surface lists, dashboards, or monitoring panes, prefer the shared
|
|
146
159
|
background-run exports from `@agent-native/core/code-agents` over reading Code
|
|
@@ -271,10 +284,10 @@ commands and skills are discovered from `.agents/commands/*.md` and
|
|
|
271
284
|
`.agents/skills/*/SKILL.md`; the UI should render those packs and insert prompts
|
|
272
285
|
through the shared composer.
|
|
273
286
|
|
|
274
|
-
## Background Agent
|
|
287
|
+
## Background Agent Run-Manager
|
|
275
288
|
|
|
276
|
-
Background coding-agent work should reuse the same
|
|
277
|
-
Agent-Native:
|
|
289
|
+
Background coding-agent work should reuse the same run-manager foundation as the
|
|
290
|
+
rest of Agent-Native:
|
|
278
291
|
|
|
279
292
|
- Use the Code run store/executor for local Code sessions.
|
|
280
293
|
- Use the shared background-run adapter/foundation when a surface needs to list,
|
|
@@ -285,8 +298,8 @@ Agent-Native:
|
|
|
285
298
|
background sub-agent from a normal app chat.
|
|
286
299
|
|
|
287
300
|
Do not add a parallel background-agent runner just because a new surface needs a
|
|
288
|
-
different layout. Build a host adapter or UI slot on top of the shared
|
|
289
|
-
instead.
|
|
301
|
+
different layout. Build a host adapter or UI slot on top of the shared
|
|
302
|
+
run-manager foundation instead.
|
|
290
303
|
|
|
291
304
|
Regression rule for new prompt or background surfaces: Code, Brain, and the
|
|
292
305
|
standard sidebar must keep using `PromptComposer` through the shared composer
|
|
@@ -53,28 +53,44 @@ Every template should have a `view-screen` action. It reads navigation state, fe
|
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
55
|
// actions/view-screen.ts
|
|
56
|
+
import { defineAction } from "@agent-native/core";
|
|
56
57
|
import { readAppState } from "@agent-native/core/application-state";
|
|
58
|
+
import { eq } from "drizzle-orm";
|
|
59
|
+
import { z } from "zod";
|
|
60
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
61
|
+
|
|
62
|
+
export default defineAction({
|
|
63
|
+
description:
|
|
64
|
+
"See what the user is currently looking at on screen. Reads navigation state and fetches matching data.",
|
|
65
|
+
schema: z.object({}),
|
|
66
|
+
http: false,
|
|
67
|
+
run: async () => {
|
|
68
|
+
const navigation = (await readAppState("navigation")) as any;
|
|
69
|
+
const screen: Record<string, unknown> = {};
|
|
70
|
+
if (navigation) screen.navigation = navigation;
|
|
71
|
+
|
|
72
|
+
const db = getDb();
|
|
73
|
+
|
|
74
|
+
// Fetch data based on what the user is viewing
|
|
75
|
+
if (navigation?.view === "inbox") {
|
|
76
|
+
screen.emailList = await db
|
|
77
|
+
.select()
|
|
78
|
+
.from(schema.emails)
|
|
79
|
+
.where(eq(schema.emails.label, navigation.label));
|
|
80
|
+
}
|
|
81
|
+
if (navigation?.threadId) {
|
|
82
|
+
screen.thread = await db
|
|
83
|
+
.select()
|
|
84
|
+
.from(schema.threads)
|
|
85
|
+
.where(eq(schema.threads.id, navigation.threadId));
|
|
86
|
+
}
|
|
57
87
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const res = await fetch(
|
|
65
|
-
"http://localhost:3000/api/emails?label=" + navigation.label,
|
|
66
|
-
);
|
|
67
|
-
screen.emailList = await res.json();
|
|
68
|
-
}
|
|
69
|
-
if (navigation?.threadId) {
|
|
70
|
-
const res = await fetch(
|
|
71
|
-
"http://localhost:3000/api/threads/" + navigation.threadId,
|
|
72
|
-
);
|
|
73
|
-
screen.thread = await res.json();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
console.log(JSON.stringify(screen, null, 2));
|
|
77
|
-
}
|
|
88
|
+
if (Object.keys(screen).length === 0) {
|
|
89
|
+
return "No application state found. Is the app running?";
|
|
90
|
+
}
|
|
91
|
+
return screen;
|
|
92
|
+
},
|
|
93
|
+
});
|
|
78
94
|
```
|
|
79
95
|
|
|
80
96
|
The agent should always call `pnpm action view-screen` before acting. This is a hard convention across all templates. When adding new features, update `view-screen` to return data for the new view.
|
package/docs/content/database.md
CHANGED
|
@@ -5,11 +5,11 @@ description: "Connect a portable SQL database to your agent-native app and write
|
|
|
5
5
|
|
|
6
6
|
# Database
|
|
7
7
|
|
|
8
|
-
Agent-native apps use [Drizzle ORM](https://orm.drizzle.team) and support portable SQL backends.
|
|
8
|
+
Agent-native apps use [Drizzle ORM](https://orm.drizzle.team) and support portable SQL backends. For anything beyond local development, connect a persistent SQL database — Postgres, libSQL/Turso, or another Drizzle-compatible backend — by setting `DATABASE_URL`. When that variable is unset, the app falls back to a zero-config local SQLite file so you can start developing immediately.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Local default: SQLite file {#default-sqlite}
|
|
11
11
|
|
|
12
|
-
When `DATABASE_URL` is not set, the app creates a SQLite database at `data/app.db`. This is
|
|
12
|
+
When `DATABASE_URL` is not set, the app creates a SQLite database at `data/app.db`. This is the zero-config default for local development — no setup required. It is meant for development only; for production, set `DATABASE_URL` to a persistent SQL database.
|
|
13
13
|
|
|
14
14
|
Do not rely on that local file for deployed apps. Containers, serverless functions, and preview environments may reset their filesystem, which means a local SQLite file can disappear between restarts. Set `DATABASE_URL` to a persistent hosted database before production use.
|
|
15
15
|
|
|
@@ -11,7 +11,7 @@ Agent-native apps use [Nitro](https://nitro.build) under the hood, which means y
|
|
|
11
11
|
|
|
12
12
|
Every deployed app needs a persistent SQL database. In local development, agent-native falls back to a SQLite file at `data/app.db`; that is convenient on your machine, but it is not durable in containers, previews, or serverless environments where the filesystem can be reset.
|
|
13
13
|
|
|
14
|
-
Set `DATABASE_URL` in your deploy provider before promoting an app to production. Agent-native uses Drizzle for schema and queries, so the data layer is portable across Drizzle-compatible SQL backends
|
|
14
|
+
Set `DATABASE_URL` in your deploy provider before promoting an app to production. Agent-native uses Drizzle for schema and queries, so the data layer is portable across Drizzle-compatible SQL backends and the framework auto-detects the dialect from the URL. See [Database](/docs/database#production) for the adapter list and dialect details.
|
|
15
15
|
|
|
16
16
|
Use `DATABASE_AUTH_TOKEN` only when your database provider requires a separate token, such as Turso/libSQL. For workspaces, all apps inherit the root `DATABASE_URL` by default; set `<APP_NAME>_DATABASE_URL` when one app should use a different database.
|
|
17
17
|
|
|
@@ -208,13 +208,13 @@ export default defineConfig({
|
|
|
208
208
|
|
|
209
209
|
### Build / Runtime {#env-runtime}
|
|
210
210
|
|
|
211
|
-
| Variable | Description
|
|
212
|
-
| --------------------- |
|
|
213
|
-
| `PORT` | Server port (Node.js only)
|
|
214
|
-
| `NITRO_PRESET` | Override build preset at build time
|
|
215
|
-
| `APP_BASE_PATH` | Mount the app under a prefix (e.g. `/mail`). Set automatically by `agent-native deploy`; leave unset for standalone.
|
|
216
|
-
| `DATABASE_URL` | Persistent SQL connection string. Required in production
|
|
217
|
-
| `DATABASE_AUTH_TOKEN` | Auth token for providers that require a separate token, such as Turso/libSQL.
|
|
211
|
+
| Variable | Description |
|
|
212
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
213
|
+
| `PORT` | Server port (Node.js only) |
|
|
214
|
+
| `NITRO_PRESET` | Override build preset at build time |
|
|
215
|
+
| `APP_BASE_PATH` | Mount the app under a prefix (e.g. `/mail`). Set automatically by `agent-native deploy`; leave unset for standalone. |
|
|
216
|
+
| `DATABASE_URL` | Persistent SQL connection string. Required in production. See [Database](/docs/database#production) for adapter and dialect details. |
|
|
217
|
+
| `DATABASE_AUTH_TOKEN` | Auth token for providers that require a separate token, such as Turso/libSQL. |
|
|
218
218
|
|
|
219
219
|
### Required in Production {#env-required-prod}
|
|
220
220
|
|
package/docs/content/dispatch.md
CHANGED
|
@@ -137,7 +137,7 @@ The whole pipeline is built to survive on every serverless host (Netlify, Vercel
|
|
|
137
137
|
- **A2A continuation polling.** When Dispatch delegates to another app, it polls the downstream task with a bounded timeout. If the downstream agent takes too long or crashes, Dispatch records the continuation and the retry job picks it up — the user's Slack reply still arrives.
|
|
138
138
|
- **Auto-signed cross-app A2A.** Hosted multi-app workspaces auto-generate per-app A2A credentials at deploy time, so apps in the same workspace can call each other without you ever pasting a JWT secret. Dispatch's agent-discovery layer reads those creds from the workspace database so newly added apps appear as callable peers automatically.
|
|
139
139
|
|
|
140
|
-
This is the
|
|
140
|
+
This is the hardened reliability story. Conceptually: every step that crosses a network or a process boundary is recoverable.
|
|
141
141
|
|
|
142
142
|
## Setup {#setup}
|
|
143
143
|
|
|
@@ -246,7 +246,11 @@ path; the MCP layer strips that ticket-bearing URL from model-visible
|
|
|
246
246
|
`structuredContent` and normal open-link metadata. When no embed start URL is
|
|
247
247
|
present, the resource falls back to the app-only `create_embed_session` helper.
|
|
248
248
|
This keeps production hosts that restrict iframe-initiated tool calls on the
|
|
249
|
-
direct route without leaking one-time app session URLs into the transcript.
|
|
249
|
+
direct route without leaking one-time app session URLs into the transcript. If a
|
|
250
|
+
user reopens an old chat after a one-time start ticket has expired, the start
|
|
251
|
+
route returns a small refresh page and posts `agentNative.embedSessionExpired`
|
|
252
|
+
to the wrapper; `embedApp()` clears the stale start URL and mints a fresh ticket
|
|
253
|
+
through `create_embed_session` when it still has the original app route.
|
|
250
254
|
|
|
251
255
|
ChatGPT gets a dedicated compatibility path through `window.openai`: the launch
|
|
252
256
|
document reads `toolInput`, `toolOutput`, and `toolResponseMetadata` directly,
|
package/docs/content/faq.md
CHANGED
|
@@ -65,6 +65,7 @@ The framework ships with production-ready templates you can use as daily drivers
|
|
|
65
65
|
- **[Brain](/docs/template-brain)** — full-page company chat, cited memory, sources, and review queue
|
|
66
66
|
- **[Assets](/docs/template-assets)** — brand asset libraries, uploads, and generated media
|
|
67
67
|
- **[Slides](/docs/template-slides)** — presentation builder
|
|
68
|
+
- **[Video](/docs/template-videos)** — Remotion-based video editor
|
|
68
69
|
- **[Analytics](/docs/template-analytics)** — data platform (like Amplitude/Mixpanel)
|
|
69
70
|
- **[Mail](/docs/template-mail)** — full-featured email client (like Superhuman)
|
|
70
71
|
- **[Clips](/docs/template-clips)** — async screen + camera recording (replaces Loom)
|
package/docs/content/frames.md
CHANGED
|
@@ -1,47 +1,127 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Frames"
|
|
3
|
-
description: "
|
|
3
|
+
description: "The local dev frame, the embedded agent panel, and the cloud frame — the ways an AI agent runs alongside your app."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Frames
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Every agent-native app runs with an AI agent next to the app UI. A **frame** is
|
|
9
|
+
the wrapper that hosts both: it shows your app and gives the agent a place to
|
|
10
|
+
chat, run, and (in dev) edit code. There are three frames, sharing one runtime:
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
- **Embedded agent panel** — ships inside every app from `@agent-native/core`.
|
|
13
|
+
This is the sidebar your app renders itself, in development and in production.
|
|
14
|
+
- **Local dev frame** — a thin wrapper that loads your running app in an iframe
|
|
15
|
+
and adds the same agent panel plus an integrated CLI terminal beside it. Used
|
|
16
|
+
for local development of templates in this repo.
|
|
17
|
+
- **Builder.io cloud frame** — a managed, hosted frame with collaboration,
|
|
18
|
+
visual editing, and parallel agent runs.
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- Supports multiple AI coding CLIs — switch between them from the settings panel
|
|
15
|
-
- Toggle between production mode (app tools only) and development mode (shared `bash`/`read`/`edit`/`write` coding tools plus database access)
|
|
16
|
-
- Great for local development, self-hosted production, and OSS
|
|
20
|
+
Your app code is identical regardless of which frame hosts it. The agent talks
|
|
21
|
+
to your app through the same actions and application state in every case.
|
|
17
22
|
|
|
18
|
-
##
|
|
23
|
+
## Embedded agent panel {#embedded-agent}
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
| Codex | `codex` | --full-auto, --quiet |
|
|
24
|
-
| Gemini CLI | `gemini` | --sandbox |
|
|
25
|
-
| OpenCode | `opencode` | — |
|
|
26
|
-
| Builder.io | `builder` | — |
|
|
25
|
+
The embedded panel is the agent sidebar your app renders. It ships with
|
|
26
|
+
`@agent-native/core` — there is no separate package to install — and is the same
|
|
27
|
+
component in dev and prod.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
- Exported as `AgentPanel` from `@agent-native/core/client`, with a
|
|
30
|
+
production-only variant `ProductionAgentPanel`.
|
|
31
|
+
- Provides the full Chat / CLI / Workspace surface, so the agent input stays on
|
|
32
|
+
the shared composer stack used everywhere else in the framework.
|
|
33
|
+
- Reads `application_state.navigation` every turn, so it already knows which
|
|
34
|
+
view you're in and what's selected — you don't have to re-explain "this".
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
### Dev vs prod tool modes {#tool-modes}
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
- Real-time collaboration — multiple users can watch/interact simultaneously
|
|
34
|
-
- Visual editing, roles and permissions
|
|
35
|
-
- Parallel agent execution for faster iteration
|
|
36
|
-
- Great for team use
|
|
38
|
+
The panel runs in one of two tool modes:
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
- **Production mode** — the agent only has your app's own tools: the actions you
|
|
41
|
+
defined with `defineAction`, plus navigation and context. No filesystem or
|
|
42
|
+
shell access. This is what end users get.
|
|
43
|
+
- **Development mode** — adds the shared coding tools (`bash`, `read`, `edit`,
|
|
44
|
+
`write`) and database access on top of the app tools, so the agent can change
|
|
45
|
+
the app's own source. Code requests are gated: when a message requires code
|
|
46
|
+
(`type: "code"`) and no code-capable frame is connected, the panel shows a
|
|
47
|
+
dialog explaining that code changes need Agent Native Desktop or Builder;
|
|
48
|
+
when a frame is connected, the request is routed to it and a code-agent
|
|
49
|
+
indicator shows while it works (`useSendToAgentChat`).
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
In the local dev frame, the settings cog toggles between these modes. Switching
|
|
52
|
+
to prod hides the frame's own sidebar and shows the app's in-app agent sidebar
|
|
53
|
+
inside the iframe instead, so you can preview exactly what end users see.
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
2. **Generation state** — use `useAgentChatGenerating()` to track when the agent is running
|
|
44
|
-
3. **Polling sync** — database-backed sync keeps UI caches fresh when the agent changes state
|
|
45
|
-
4. **Action system** — `pnpm action <name>` dispatches to callable actions
|
|
55
|
+
## Integrated terminal and CLI switching {#cli-terminal}
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
In development the panel includes an embedded terminal (`AgentTerminal`, also
|
|
58
|
+
from `@agent-native/core/client`) backed by a PTY server. You can run a real
|
|
59
|
+
coding CLI right beside the app and switch between them; the terminal restarts
|
|
60
|
+
with the selected CLI.
|
|
61
|
+
|
|
62
|
+
The supported CLIs come from the core CLI registry
|
|
63
|
+
(`packages/core/src/terminal/cli-registry.ts`). Only these commands are allowed
|
|
64
|
+
to spawn — the PTY server validates the requested command against the registry
|
|
65
|
+
allow-list to prevent injection:
|
|
66
|
+
|
|
67
|
+
| CLI | Command | Install package |
|
|
68
|
+
| ----------- | ---------- | --------------------------- |
|
|
69
|
+
| Claude Code | `claude` | `@anthropic-ai/claude-code` |
|
|
70
|
+
| Builder.io | `builder` | (built in) |
|
|
71
|
+
| Codex | `codex` | `@openai/codex` |
|
|
72
|
+
| Gemini CLI | `gemini` | `@google/gemini-cli` |
|
|
73
|
+
| OpenCode | `opencode` | `opencode-ai` |
|
|
74
|
+
|
|
75
|
+
If the selected CLI isn't found on `PATH`, the terminal falls back to running it
|
|
76
|
+
through `npx --yes <install-package>` (where an install package exists). The
|
|
77
|
+
default command is `claude`. Switch CLIs from the agent panel settings at any
|
|
78
|
+
time.
|
|
79
|
+
|
|
80
|
+
## Builder.io cloud frame {#cloud-frame}
|
|
81
|
+
|
|
82
|
+
[Builder.io](https://www.builder.io) provides a managed frame that hosts the
|
|
83
|
+
same app and the same agent panel, in the cloud:
|
|
84
|
+
|
|
85
|
+
- Real-time collaboration — multiple users can watch and interact at once.
|
|
86
|
+
- Visual editing, roles, and permissions.
|
|
87
|
+
- Parallel agent execution for faster iteration.
|
|
88
|
+
- Good for team use, where everyone shares one hosted environment.
|
|
89
|
+
|
|
90
|
+
Code requests from the embedded panel route to the Builder frame the same way
|
|
91
|
+
they route to the local dev frame, so the dev-vs-prod behavior above is
|
|
92
|
+
consistent across both.
|
|
93
|
+
|
|
94
|
+
## Runtime APIs {#runtime-apis}
|
|
95
|
+
|
|
96
|
+
These ship with `@agent-native/core` and are what your app uses to talk to the
|
|
97
|
+
agent, regardless of which frame is hosting it:
|
|
98
|
+
|
|
99
|
+
1. **Send a message** — `sendToAgentChat()` sends a message to the agent. The
|
|
100
|
+
`useSendToAgentChat()` hook wraps it with the code-request gating described
|
|
101
|
+
above and returns a `codeRequiredDialog` element to render.
|
|
102
|
+
2. **Generation state** — `useAgentChatGenerating()` tracks when the agent is
|
|
103
|
+
running, so the UI can show progress without polling the agent directly.
|
|
104
|
+
3. **Polling sync** — database-backed sync keeps UI caches fresh when the agent
|
|
105
|
+
changes data or application state.
|
|
106
|
+
4. **Action system** — `pnpm action <name>` dispatches to the same callable
|
|
107
|
+
actions the agent invokes as tools, so anything the agent can do, you can
|
|
108
|
+
script.
|
|
109
|
+
|
|
110
|
+
## Running it {#running}
|
|
111
|
+
|
|
112
|
+
The embedded agent panel is part of every app — scaffold a template and it's
|
|
113
|
+
already there:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm dlx @agent-native/core create my-app --template mail --standalone
|
|
117
|
+
cd my-app
|
|
118
|
+
pnpm dev
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The local dev frame is an internal tooling package (it is not published to npm),
|
|
122
|
+
used when developing templates inside this repository. It loads the active
|
|
123
|
+
app's dev server in an iframe and mounts the embedded panel beside it, selecting
|
|
124
|
+
the app via the `app` query param. The integrated CLI terminal requires Agent
|
|
125
|
+
Native Desktop, which provides the local code and PTY access the terminal needs;
|
|
126
|
+
without it, the panel shows the chat surface and prompts you to open Desktop to
|
|
127
|
+
use the CLI.
|
|
@@ -117,20 +117,21 @@ Once your app is running, the most useful follow-ups are:
|
|
|
117
117
|
|
|
118
118
|
Each template is a complete app with UI, agent actions, database schema, and AI instructions ready to go:
|
|
119
119
|
|
|
120
|
-
| Template
|
|
121
|
-
|
|
|
122
|
-
| [Calendar](/
|
|
123
|
-
| [Content](/
|
|
124
|
-
| [Brain](/
|
|
125
|
-
| [Assets](/
|
|
126
|
-
| [Slides](/
|
|
127
|
-
| [
|
|
128
|
-
| [
|
|
129
|
-
| [
|
|
130
|
-
| [
|
|
131
|
-
| [
|
|
132
|
-
| [
|
|
133
|
-
| [
|
|
120
|
+
| Template | Replaces |
|
|
121
|
+
| ------------------------------------- | ----------------------------------------------- |
|
|
122
|
+
| [Calendar](/docs/template-calendar) | Google Calendar, Calendly |
|
|
123
|
+
| [Content](/docs/template-content) | Notion, Google Docs |
|
|
124
|
+
| [Brain](/docs/template-brain) | Company chat with cited institutional memory |
|
|
125
|
+
| [Assets](/docs/template-assets) | Brand asset libraries and generated media |
|
|
126
|
+
| [Slides](/docs/template-slides) | Google Slides, Pitch |
|
|
127
|
+
| [Video](/docs/template-videos) | Remotion-based video editing |
|
|
128
|
+
| [Analytics](/docs/template-analytics) | Amplitude, Mixpanel, Looker |
|
|
129
|
+
| [Mail](/docs/template-mail) | Superhuman, Gmail |
|
|
130
|
+
| [Clips](/docs/template-clips) | Replaces Loom — screen + camera recording |
|
|
131
|
+
| [Design](/docs/template-design) | HTML prototyping studios |
|
|
132
|
+
| [Forms](/docs/template-forms) | Typeform |
|
|
133
|
+
| [Dispatch](/docs/template-dispatch) | Workspace control plane — integrations, routing |
|
|
134
|
+
| [Starter](/docs/template-starter) | Minimal scaffold — build from scratch |
|
|
134
135
|
|
|
135
136
|
Browse the [template gallery](/templates) for live demos, or see [Templates](/docs/cloneable-saas) for the full list and the clone → customize → deploy flow.
|
|
136
137
|
|
|
@@ -5,7 +5,7 @@ description: "Connect your agent-native app to local MCP servers (claude-in-chro
|
|
|
5
5
|
|
|
6
6
|
# MCP Clients
|
|
7
7
|
|
|
8
|
-
Agent-native apps can also act as MCP **clients** — connecting to locally installed MCP servers and exposing their tools to the agent chat. This is the symmetric counterpart to the [MCP Protocol](
|
|
8
|
+
Agent-native apps can also act as MCP **clients** — connecting to locally installed MCP servers and exposing their tools to the agent chat. This is the symmetric counterpart to the [MCP Protocol](/docs/mcp-protocol) (which makes your app an MCP server).
|
|
9
9
|
|
|
10
10
|
Looking for the other direction — connecting Claude, ChatGPT, Claude Code, Codex, Cursor, or Claude Cowork to an agent-native app? Use [External Agents](/docs/external-agents).
|
|
11
11
|
|