@agent-native/core 0.149.6 → 0.151.1
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +83 -45
- package/corpus/templates/analytics/changelog/2026-08-11-analytics-dashboards-keep-the-selected-tab-when-reopened.md +6 -0
- package/corpus/templates/assets/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/brain/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/calendar/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/clips/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/clips/changelog/2026-08-11-clips-recovers-from-transient-updates-and-avoids-macos-priva.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +32 -176
- package/corpus/templates/clips/desktop/src/lib/updater.ts +52 -37
- package/corpus/templates/clips/desktop/src/styles.css +1 -166
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +2 -0
- package/corpus/templates/clips/desktop/src-tauri/Info.plist +4 -0
- package/corpus/templates/clips/desktop/src-tauri/src/eventkit.rs +28 -1
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +2 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +48 -1
- package/corpus/templates/clips/desktop/src-tauri/src/permission_status.rs +3 -0
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +5 -0
- package/corpus/templates/clips/server/plugins/auth.ts +3 -0
- package/corpus/templates/content/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +2 -1
- package/corpus/templates/design/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +5 -1
- package/corpus/templates/design/changelog/2026-08-11-design-agent-prompts-copy-successfully-in-the-desktop-app.md +6 -0
- package/corpus/templates/dispatch/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/dispatch/app/global.css +2 -2
- package/corpus/templates/dispatch/changelog/2026-08-10-desktop-workspace-sign-in.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-no-longer-shows-the-generic-chat-starter-among-defa.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-integrations-and-scheduled-work-open-as-first-class-electron-pages.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-11-sidebar-text-is-slightly-easier-to-read-in-light-and-dark-mo.md +6 -0
- package/corpus/templates/dispatch/server/lib/identity-sso.ts +57 -31
- package/corpus/templates/dispatch/server/plugins/feature-flags.ts +5 -0
- package/corpus/templates/dispatch/server/plugins/identity-sso.ts +82 -33
- package/corpus/templates/dispatch/server/plugins/org-apps-directory.ts +7 -15
- package/corpus/templates/dispatch/server/plugins/setup-dispatch.ts +9 -1
- package/corpus/templates/dispatch/shared/feature-flags.ts +15 -0
- package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/forms/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/forms/.agents/skills/form-responses/SKILL.md +8 -7
- package/corpus/templates/forms/app/hooks/use-forms.ts +8 -1
- package/corpus/templates/forms/changelog/2026-08-11-fixed-public-forms-so-conditional-questions-stay-hidden-unti.md +6 -0
- package/corpus/templates/forms/server/handlers/submissions.ts +2 -1
- package/corpus/templates/forms/server/lib/public-form-ssr.ts +37 -2
- package/corpus/templates/forms/shared/page-url.ts +54 -0
- package/corpus/templates/forms/shared/types.ts +4 -4
- package/corpus/templates/mail/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/plan/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/slides/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/corpus/templates/slides/actions/add-slide.ts +0 -27
- package/corpus/templates/slides/actions/import-file.ts +28 -9
- package/corpus/templates/slides/actions/view-screen.ts +4 -4
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +8 -1
- package/corpus/templates/slides/app/components/editor/AiEditingMarker.tsx +25 -0
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +43 -48
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +9 -6
- package/corpus/templates/slides/app/components/editor/GeneratingSlidePreview.tsx +1 -9
- package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +2 -0
- package/corpus/templates/slides/app/components/editor/ImageOverlay.tsx +0 -26
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +904 -217
- package/corpus/templates/slides/app/components/editor/canvas-interactions/index.ts +1 -0
- package/corpus/templates/slides/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +11 -0
- package/corpus/templates/slides/app/components/editor/inline-edit-session.ts +16 -0
- package/corpus/templates/slides/app/components/editor/slide-object-interactions.ts +22 -6
- package/corpus/templates/slides/app/components/editor/style-clipboard.ts +61 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +26 -2
- package/corpus/templates/slides/app/components/ui/context-menu.tsx +1 -0
- package/corpus/templates/slides/app/context/DeckContext.tsx +75 -25
- package/corpus/templates/slides/app/global.css +1 -1
- package/corpus/templates/slides/app/i18n/en-US.ts +6 -1
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +1 -1
- package/corpus/templates/slides/app/lib/image-drop-to-agent.ts +12 -12
- package/corpus/templates/slides/app/lib/slide-agent-context.ts +52 -0
- package/corpus/templates/slides/app/lib/slide-image-replacement.ts +61 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +55 -116
- package/corpus/templates/slides/app/pages/Index.tsx +28 -3
- package/corpus/templates/slides/changelog/2026-08-11-agent-chat-now-follows-the-current-slide-and-selection.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-deck-titles-now-use-slide-content-instead-of-placeholder-filenames.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-history-now-opens-from-the-deck-overflow-menu.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-images-can-be-dropped-directly-onto-slides-and-resized-or-re.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-new-decks-now-transition-directly-to-a-full-page-editor-load.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-selected-slide-layers-can-be-nudged-precisely-with-arrow-key.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-can-copy-and-paste-element-styles-with-cmd-option-c-v.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-slides-shows-one-compact-ai-marker-and-keeps-your-current-sl.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-text-edits-preserve-slide-layout-when-no-changes-are-made.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-the-style-toolbar-now-uses-the-full-available-width.md +6 -0
- package/corpus/templates/slides/changelog/2026-08-11-undo-and-redo-now-move-one-visible-slide-state-at-a-time.md +6 -0
- package/corpus/templates/slides/server/lib/chat-attachments.ts +6 -2
- package/corpus/templates/slides/shared/deck-title.ts +56 -0
- package/corpus/templates/tasks/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/dist/agent/run-store.js +6 -1
- package/dist/agent/thread-data-builder.js +19 -44
- package/dist/agent/types.d.ts +13 -0
- package/dist/catalog.json +1 -0
- package/dist/cli/create.js +1 -1
- package/dist/client/AssistantChat.js +58 -10
- package/dist/client/FileStorageSetupCard.d.ts +6 -0
- package/dist/client/FileStorageSetupCard.js +18 -0
- package/dist/client/NewWorkspaceAppFlow.js +10 -0
- package/dist/client/agent-chat-adapter.js +87 -11
- package/dist/client/agent-chat.d.ts +1 -1
- package/dist/client/agent-chat.js +8 -3
- package/dist/client/chat/attachment-adapters.js +10 -0
- package/dist/client/chat/message-components.d.ts +4 -1
- package/dist/client/chat/message-components.js +37 -13
- package/dist/client/chat/tool-call-display.js +14 -0
- package/dist/client/chat-first/apps-rail.d.ts +1 -1
- package/dist/client/chat-first/apps-rail.js +6 -6
- package/dist/client/chat-first/copy.js +1 -0
- package/dist/client/chat-first/types.d.ts +1 -0
- package/dist/client/extensions/EmbeddedExtension.js +1 -1
- package/dist/client/extensions/ExtensionViewer.js +1 -1
- package/dist/client/extensions/InlineExtensionFrame.js +1 -1
- package/dist/client/onboarding/FirstRunOnboarding.js +17 -2
- package/dist/client/settings/FileStorageSettingsForm.d.ts +2 -0
- package/dist/client/settings/FileStorageSettingsForm.js +113 -0
- package/dist/client/settings/SettingsPanel.js +2 -1
- package/dist/client/sse-event-processor.js +21 -0
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/actions.js +2 -2
- package/dist/extensions/html-shell.js +3 -1
- package/dist/file-upload/pre-upload-attachments.d.ts +15 -10
- package/dist/file-upload/pre-upload-attachments.js +68 -24
- package/dist/file-upload/registry.d.ts +4 -5
- package/dist/file-upload/registry.js +7 -14
- package/dist/file-upload/s3.d.ts +9 -0
- package/dist/file-upload/s3.js +168 -0
- package/dist/file-upload/types.d.ts +3 -3
- package/dist/file-upload/types.js +2 -2
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/onboarding/app-profile.js +23 -1
- package/dist/onboarding/default-steps.js +69 -0
- package/dist/onboarding/types.d.ts +2 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-chat/browser-team-tools.js +20 -0
- package/dist/server/agent-chat-plugin.js +12 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.js +45 -21
- package/dist/server/better-auth-instance.d.ts +2 -0
- package/dist/server/better-auth-instance.js +2 -2
- package/dist/server/core-routes-plugin.d.ts +1 -0
- package/dist/server/core-routes-plugin.js +26 -16
- package/dist/server/identity-sso-store.d.ts +3 -0
- package/dist/server/identity-sso-store.js +45 -0
- package/dist/server/identity-sso.d.ts +20 -10
- package/dist/server/identity-sso.js +79 -31
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/dist/templates/default/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +24 -1
- package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +6 -2
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/generative-ui/SKILL.md +3 -1
- package/docs/content/authentication.mdx +27 -0
- package/docs/content/cross-app-sso.mdx +38 -8
- package/docs/content/extensions.mdx +15 -15
- package/docs/content/file-uploads.mdx +10 -12
- package/docs/content/generative-ui.mdx +6 -1
- package/docs/content/key-concepts.mdx +141 -83
- package/package.json +2 -2
- package/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/src/templates/default/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +24 -1
- package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +28 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +6 -2
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +1 -1
- package/src/templates/workspace-core/.agents/skills/generative-ui/SKILL.md +3 -1
|
@@ -268,27 +268,27 @@ Everything from here through [Local File Extensions](#local-file-extensions) is
|
|
|
268
268
|
|
|
269
269
|
Inside the iframe sandbox, every extension has these helpers on `window`:
|
|
270
270
|
|
|
271
|
-
| Helper | Purpose | Example
|
|
272
|
-
| ------------------------------------------------ | --------------------------------------------------------- |
|
|
273
|
-
| `appAction(name, params)` | Call any of the host template's actions, including writes | `appAction('list-emails', { view: 'inbox' })`
|
|
274
|
-
| `appFetch(path, options)` | Call allowed framework endpoints under `/_agent-native/*` | `appFetch('/_agent-native/application-state/navigation')`
|
|
275
|
-
| `dbQuery(sql, args)` | Read from SQL (auto-scoped to the user; never for writes) | `dbQuery('SELECT id, name FROM tools')`
|
|
276
|
-
| `dbExec(sql, args)` | Legacy trusted SQL writes for editor/admin extensions | Prefer `appAction` for app data writes
|
|
277
|
-
| `extensionFetch(url, options)` | Hit external APIs through a secure proxy with secrets | `extensionFetch('https://api.github.com/user')`
|
|
278
|
-
| `extensionData.set(collection, id, data, opts?)` | Persist data per-extension (user / org scoping) | `extensionData.set('notes', id, { text: '...' })`
|
|
279
|
-
| `extensionData.list(collection, opts?)` | List persisted items | `extensionData.list('notes', { scope: 'all' })`
|
|
280
|
-
| `extensionData.get(collection, id, opts?)` | Get a single item | `extensionData.get('notes', 'note-1')`
|
|
281
|
-
| `extensionData.remove(collection, id, opts?)` | Delete a persisted item | `extensionData.remove('notes', 'note-1')`
|
|
282
|
-
| `window.slotContext` | Read the page/chat context passed into this slot | `window.slotContext?.contactEmail`
|
|
283
|
-
| `agentNative.ui.output(value, opts?)` | Record passive inline UI output in application state | `agentNative.ui.output({ threshold })`
|
|
284
|
-
| `agentNative.chat.send(message, opts?)` | Send a prompt or selected value back to the agent chat | `agentNative.chat.send('Use Q2', { context: { q: 2 } })`
|
|
271
|
+
| Helper | Purpose | Example |
|
|
272
|
+
| ------------------------------------------------ | --------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
273
|
+
| `appAction(name, params)` | Call any of the host template's actions, including writes | `appAction('list-emails', { view: 'inbox' })` |
|
|
274
|
+
| `appFetch(path, options)` | Call allowed framework endpoints under `/_agent-native/*` | `appFetch('/_agent-native/application-state/navigation')` |
|
|
275
|
+
| `dbQuery(sql, args)` | Read from SQL (auto-scoped to the user; never for writes) | `dbQuery('SELECT id, name FROM tools')` |
|
|
276
|
+
| `dbExec(sql, args)` | Legacy trusted SQL writes for editor/admin extensions | Prefer `appAction` for app data writes |
|
|
277
|
+
| `extensionFetch(url, options)` | Hit external APIs through a secure proxy with secrets | `extensionFetch('https://api.github.com/user')` |
|
|
278
|
+
| `extensionData.set(collection, id, data, opts?)` | Persist data per-extension (user / org scoping) | `extensionData.set('notes', id, { text: '...' })` |
|
|
279
|
+
| `extensionData.list(collection, opts?)` | List persisted items | `extensionData.list('notes', { scope: 'all' })` |
|
|
280
|
+
| `extensionData.get(collection, id, opts?)` | Get a single item | `extensionData.get('notes', 'note-1')` |
|
|
281
|
+
| `extensionData.remove(collection, id, opts?)` | Delete a persisted item | `extensionData.remove('notes', 'note-1')` |
|
|
282
|
+
| `window.slotContext` | Read the page/chat context passed into this slot | `window.slotContext?.contactEmail` |
|
|
283
|
+
| `agentNative.ui.output(value, opts?)` | Record passive inline UI output in application state | `agentNative.ui.output({ threshold })` |
|
|
284
|
+
| `agentNative.chat.send(message, opts?)` | Send a prompt or selected value back to the agent chat | `agentNative.chat.send('Use Q2', { submit: true, context: { q: 2 } })` |
|
|
285
285
|
|
|
286
286
|
Three rules of thumb:
|
|
287
287
|
|
|
288
288
|
- **Prefer `appAction` over raw SQL.** Actions are the template's official surface — they handle access control, scoping, and validation for you. `dbQuery` is read-only; `dbExec` remains for legacy trusted editor/admin extensions, but new app data writes should go through actions.
|
|
289
289
|
- **Use `appAction` for template data.** Extension `appFetch` is limited to framework `/_agent-native/*` endpoints; template `/api/*` routes are blocked by the iframe bridge.
|
|
290
290
|
- **Prefer `extensionData` over making new tables.** Each extension gets its own isolated key-value store. No schema, no migration. Set `{ scope: 'org' }` to share with the user's org, `'user'` (default) for private.
|
|
291
|
-
- **Use `agentNative.ui.output` for inline control values the agent should read later.** It writes `inline-ui:<extensionId>:output` to application state; `agentNative.chat.send` is for
|
|
291
|
+
- **Use `agentNative.ui.output` for inline control values the agent should read later.** It writes `inline-ui:<extensionId>:output` to application state; `agentNative.chat.send` is draft-only unless `{ submit: true }` is passed for a user-triggered submit/apply message. Never call it from polling, refresh, or error handlers.
|
|
292
292
|
|
|
293
293
|
```html
|
|
294
294
|
<script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "File Uploads"
|
|
3
|
-
description: "Configure file upload storage —
|
|
3
|
+
description: "Configure durable file upload storage — Builder.io or custom object storage for production."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# File Uploads
|
|
@@ -15,9 +15,9 @@ The provider resolution order is:
|
|
|
15
15
|
|
|
16
16
|
1. **User-registered providers** — custom providers registered via `registerFileUploadProvider()`
|
|
17
17
|
2. **Builder.io provider** — built-in, activates automatically when Builder.io is connected
|
|
18
|
-
3. **
|
|
18
|
+
3. **No provider** — the upload is rejected and the chat renders a storage setup CTA; binary data is never persisted in SQL
|
|
19
19
|
|
|
20
|
-
<Diagram id="doc-block-hq5uvx" title="Provider resolution order" summary="uploadFile() picks the first configured provider in order.
|
|
20
|
+
<Diagram id="doc-block-hq5uvx" title="Provider resolution order" summary="uploadFile() picks the first configured provider in order. Without one, the upload fails closed so binary data is never persisted in SQL.">
|
|
21
21
|
|
|
22
22
|
```html
|
|
23
23
|
<div class="diagram-upload">
|
|
@@ -47,8 +47,8 @@ The provider resolution order is:
|
|
|
47
47
|
<div class="diagram-step">
|
|
48
48
|
<span class="diagram-pill warn">3</span>
|
|
49
49
|
<div class="diagram-node">
|
|
50
|
-
|
|
51
|
-
>
|
|
50
|
+
No provider<br /><small class="diagram-muted"
|
|
51
|
+
>setup CTA — no binary persistence</small
|
|
52
52
|
>
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
@@ -94,15 +94,13 @@ Dispatches to the first configured provider in resolution order. Check the activ
|
|
|
94
94
|
|
|
95
95
|
</Endpoint>
|
|
96
96
|
|
|
97
|
-
##
|
|
97
|
+
## Storage required for durable uploads {#storage-required}
|
|
98
98
|
|
|
99
|
-
When no provider is configured,
|
|
100
|
-
|
|
101
|
-
A one-time warning is logged when the fallback is used.
|
|
99
|
+
When no provider is configured, `uploadFile()` returns `null` and the multipart route returns `503`. Chat attachments remain available only for the current request, the agent receives a storage setup hint, and the transcript stores a setup marker instead of the binary payload. This fail-closed behavior keeps SQL small and makes the missing configuration visible.
|
|
102
100
|
|
|
103
101
|
## Builder.io Hosting {#builder-hosting}
|
|
104
102
|
|
|
105
|
-
When your app is connected to Builder.io, file uploads are automatically routed to Builder's asset hosting. Builder.io's free tier includes this managed storage. Files are served from a CDN with no configuration needed. This is the recommended production setup.
|
|
103
|
+
When your app is connected to Builder.io, file uploads are automatically routed to Builder's asset hosting. Builder.io's free tier includes this managed storage. Files are served from a CDN with no configuration needed, and the durable URL is stored in the chat thread so later turns can reuse it. This is the recommended production setup.
|
|
106
104
|
|
|
107
105
|
## Custom Providers {#custom-providers}
|
|
108
106
|
|
|
@@ -159,7 +157,7 @@ interface FileUploadInput {
|
|
|
159
157
|
data: Uint8Array | Buffer; // File contents
|
|
160
158
|
filename?: string; // Original filename
|
|
161
159
|
mimeType?: string; // MIME type, e.g. "image/png"
|
|
162
|
-
ownerEmail?: string; // For
|
|
160
|
+
ownerEmail?: string; // For request-scoped provider credentials
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
interface FileUploadResult {
|
|
@@ -183,7 +181,7 @@ const result = await uploadFile({
|
|
|
183
181
|
if (result) {
|
|
184
182
|
// Provider handled it — result.url is the public URL
|
|
185
183
|
} else {
|
|
186
|
-
// No provider configured —
|
|
184
|
+
// No provider configured — show the storage setup CTA, or skip
|
|
187
185
|
}
|
|
188
186
|
```
|
|
189
187
|
|
|
@@ -222,12 +222,17 @@ Generated UI can send a visible prompt or result back into the current app chat:
|
|
|
222
222
|
`agentNative.chat.send(message, options)` is also available as
|
|
223
223
|
`sendToAgentChat(message, options)`.
|
|
224
224
|
|
|
225
|
+
For generated extensions, chat messages are draft-only unless `submit: true` is
|
|
226
|
+
passed explicitly. Use that opt-in only from a user-triggered Apply or Submit
|
|
227
|
+
action. Do not call either helper from polling, refresh, or error handlers; use
|
|
228
|
+
`agentNative.ui.output` or application state for passive results.
|
|
229
|
+
|
|
225
230
|
Options:
|
|
226
231
|
|
|
227
232
|
| Option | Default | Effect |
|
|
228
233
|
| ------------- | ------- | ------------------------------------------------ |
|
|
229
234
|
| `context` | none | hidden context appended to the submitted message |
|
|
230
|
-
| `submit` | `
|
|
235
|
+
| `submit` | `false` | `true` auto-submits; `false` pre-fills/reviews |
|
|
231
236
|
| `openSidebar` | `true` | opens the agent sidebar when the message is sent |
|
|
232
237
|
|
|
233
238
|
This is the same app chat bridge used by normal UI components, so generated
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Key Concepts"
|
|
3
|
-
description: "How agent-native apps work across three layers: the Core framework, optional Toolkit building blocks, and optional Templates, plus the shared actions, SQL database, app-agent loop, and portability
|
|
3
|
+
description: "How agent-native apps work across three layers: the Core framework, optional Toolkit building blocks, and optional Templates, plus the shared actions, SQL database, app-agent loop, and portability rules."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Key Concepts
|
|
7
7
|
|
|
8
|
-
How agent-native apps work under the hood
|
|
8
|
+
How agent-native apps work under the hood: the principles and the architecture. This page is the contract: the fixed rules an app has to follow to count as agent-native. For the vision and the case for building this way, see [What Is Agent-Native?](/docs/what-is-agent-native).
|
|
9
9
|
|
|
10
10
|
## The three layers {#three-layers}
|
|
11
11
|
|
|
12
|
-
Agent Native is a framework
|
|
12
|
+
Agent Native is a framework with three layers:
|
|
13
13
|
|
|
14
|
-
| Layer
|
|
15
|
-
|
|
|
16
|
-
| **Core
|
|
17
|
-
| **Toolkit
|
|
18
|
-
| **Templates
|
|
14
|
+
| Layer | What it is |
|
|
15
|
+
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| **Core: the framework** | The foundational runtime contract: actions, SQL and Drizzle helpers, auth, application state, agent execution, access checks, routing, and live sync. Every app can use Core directly. |
|
|
17
|
+
| **Toolkit: optional reusable pieces** | Shared app-building UI and product systems such as primitives, editors, sharing, collaboration, settings, and agent UX. Apps can use, compose, or fork the pieces they need. |
|
|
18
|
+
| **Templates: optional apps built on Core** | Complete, domain-specific apps with routes, schema, actions, instructions, and visual identity. First-party and custom templates commonly use Toolkit, and can be forked and used as starting points. |
|
|
19
19
|
|
|
20
20
|
Core is the foundation. Toolkit and Templates are optional: a template can use Toolkit, but Toolkit is not required to build an app on Core.
|
|
21
21
|
|
|
@@ -23,9 +23,11 @@ Core is the foundation. Toolkit and Templates are optional: a template can use T
|
|
|
23
23
|
|
|
24
24
|
At runtime, every agent-native app is three things working together:
|
|
25
25
|
|
|
26
|
-
- **Agent
|
|
27
|
-
- **Application
|
|
28
|
-
- **Computer
|
|
26
|
+
- **Agent:** The autonomous AI. It reads data, writes data, runs actions, and uses whatever tools are configured. When its frame is intentionally granted workspace access and write tooling, it can also modify the app's own source. Customizable with skills and instructions.
|
|
27
|
+
- **Application:** The product surface around the agent. It may start as chat, add native inline results, grow into a small control plane, or become a full React UI with dashboards, flows, and visualizations.
|
|
28
|
+
- **Computer:** The database, browser, and configured tool runtimes the agent acts through. Agents work through the app's own action and data surface; that same surface can optionally be exposed over MCP, but external MCP servers stay an add-on, not the foundation.
|
|
29
|
+
|
|
30
|
+
The diagram below shows the agent and the application side by side, both with two-way arrows into one shared computer layer underneath. Neither one owns the data. Instead, they read and write the same SQL store, so a change either side makes is visible to the other immediately, with no sync layer to build in between.
|
|
29
31
|
|
|
30
32
|
<Diagram id="doc-block-t1f7pj" title="Agent, application, and computer" summary="Three layers working together over one shared SQL store. The agent and the application both read and write the same data.">
|
|
31
33
|
|
|
@@ -88,12 +90,13 @@ At runtime, every agent-native app is three things working together:
|
|
|
88
90
|
|
|
89
91
|
</Diagram>
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
That same agent-application-computer loop is what runs locally and in production. Automation-first apps run it straight from the folder with `pnpm agent`; UI apps mount the embedded agent panel and add `pnpm dev`. In the cloud, Builder.io hosts the identical loop as a managed frame: the environment that runs the agent next to your app. It handles collaboration, visual editing, and infrastructure for you.
|
|
92
94
|
|
|
93
95
|
## Agent building blocks {#agent-building-blocks}
|
|
94
96
|
|
|
95
97
|
Every agent-native app has the same agent building blocks, regardless of whether
|
|
96
|
-
the product surface is chat-first, automation-first, or a full UI
|
|
98
|
+
the product surface is chat-first, automation-first, or a full UI. Each one lives
|
|
99
|
+
in its own file:
|
|
97
100
|
|
|
98
101
|
<FileTree
|
|
99
102
|
id="doc-block-1ae57y4"
|
|
@@ -114,11 +117,13 @@ the product surface is chat-first, automation-first, or a full UI:
|
|
|
114
117
|
]}
|
|
115
118
|
/>
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
| **
|
|
120
|
+
A turn is one exchange with the agent: it reads its context, decides what to do, and responds. Loaded every turn means the file re-enters that context each time, not just once at session start.
|
|
121
|
+
|
|
122
|
+
| Building block | File | Use it for | Loaded when |
|
|
123
|
+
| ---------------- | -------------------------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
124
|
+
| **Instructions** | `AGENTS.md` | Stable guidance the agent should carry into every task: what the app is, invariants, tone, indexes | Every turn |
|
|
125
|
+
| **Skills** | `.agents/skills/<name>/SKILL.md` | Reusable behavior: how to follow a workflow, apply a policy, inspect evidence, or verify an output | On demand when the skill description matches the task |
|
|
126
|
+
| **Actions** | `actions/<name>.ts` | Real operations: read or write data, call APIs, send messages, run approvals, produce typed results | Listed as tools every turn; executed only when called |
|
|
122
127
|
|
|
123
128
|
Skills and actions work together. A skill teaches the agent how to do a class of
|
|
124
129
|
work; an action is the code path it can call while doing that work. For example,
|
|
@@ -128,41 +133,59 @@ and write the actual data.
|
|
|
128
133
|
|
|
129
134
|
Five rules govern the architecture:
|
|
130
135
|
|
|
131
|
-
1. **Data lives in SQL
|
|
132
|
-
2. **All AI goes through the agent
|
|
133
|
-
3. **Actions for agent operations
|
|
134
|
-
4. **Live sync keeps the UI in sync
|
|
135
|
-
5. **Application state in SQL
|
|
136
|
+
1. **Data lives in SQL:** all app state lives in the database via Drizzle ORM.
|
|
137
|
+
2. **All AI goes through the agent:** no inline LLM calls; every AI interaction flows through the agent chat bridge.
|
|
138
|
+
3. **Actions for agent operations:** complex work runs as a typed action, not inline code.
|
|
139
|
+
4. **Live sync keeps the UI in sync:** database changes stream over SSE, with polling as the universal fallback.
|
|
140
|
+
5. **Application state in SQL:** ephemeral UI state lives in the database, readable by both agent and UI.
|
|
136
141
|
|
|
137
142
|
## The four-area checklist {#four-area-checklist}
|
|
138
143
|
|
|
139
144
|
Every user-facing feature should update all applicable areas. Skipping an applicable area breaks the agent-native contract; forcing a screen onto an automation that no human needs to browse is also a smell.
|
|
140
145
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
| **3. Skills** | Update AGENTS.md and/or create a skill documenting the pattern |
|
|
146
|
-
| **4. App-State** | Navigation state, view-screen data, and navigate commands |
|
|
146
|
+
- **1. UI:** Page, component, or dialog the user interacts with.
|
|
147
|
+
- **2. Action:** Agent-callable action in `actions/` for the same operation.
|
|
148
|
+
- **3. Skills:** Update `AGENTS.md` and/or create a skill documenting the pattern.
|
|
149
|
+
- **4. App-State:** Navigation state, view-screen data, and navigate commands.
|
|
147
150
|
|
|
148
151
|
A feature with only UI is invisible to the agent. A full UI feature with only actions is invisible to the user. A feature without app-state means the agent is blind to what the user is doing. An automation-first operation can legitimately start with action + instructions and add chat, UI, or app-state later when humans need to browse, approve, configure, or share it.
|
|
149
152
|
|
|
153
|
+
## What Agent Native includes {#what-you-get-for-free}
|
|
154
|
+
|
|
155
|
+
Adopting the framework is valuable mostly because of what you stop having to build. The moment your app follows the five rules above, you inherit:
|
|
156
|
+
|
|
157
|
+
| Feature | What it gives you |
|
|
158
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
159
|
+
| One action = every surface | Every action defined with `defineAction()` is simultaneously an agent tool, a typesafe frontend hook (`useActionQuery` / `useActionMutation`), a framework-owned HTTP transport, a CLI command, an MCP tool for external clients, and an A2A tool for other agent-native apps. Optional `link` and `mcpApp` metadata add deep links and MCP Apps UI without a second implementation. |
|
|
160
|
+
| Full agent resources per user | Skills, shared `LEARNINGS.md`, personal `memory/MEMORY.md`, `AGENTS.md`, custom sub-agents, scheduled jobs, and connected MCP servers. All SQL-backed, no dev-box required. See [Agent Resources](/docs/agent-resources). |
|
|
161
|
+
| Drop-in React components | `<AgentPanel />` and `<AgentSidebar />` render chat + resources anywhere in your app. See [Drop-in Agent](/docs/drop-in-agent). |
|
|
162
|
+
| BYO agent chat runtimes | The same chat UI can sit on top of OpenAI Agents, OpenAI Responses, Claude Agent SDK, Vercel AI SDK, AG-UI, or your own normalized HTTP stream. See [Native Chat UI](/docs/native-chat-ui#byo-agent-runtimes). |
|
|
163
|
+
| Live sync between agent and UI | Same-process writes stream immediately over `/_agent-native/events`; a lightweight poll keeps serverless, cron, and cross-process writes convergent. Mutating actions invalidate action-backed queries automatically, so agent-created records appear without a manual refresh. See [Live Sync](#polling-sync) below. |
|
|
164
|
+
| Auth, orgs, RBAC | Better Auth with orgs/members/roles is wired in for every template. See [Authentication](/docs/authentication). For more than one user, start with [Organizations, Teams & Permissions](/docs/organizations-teams-permissions). |
|
|
165
|
+
| Context awareness | The agent always knows what the user is looking at through the `navigation` app-state key. See [Context Awareness](/docs/context-awareness). |
|
|
166
|
+
| MCP client + server, both directions | The app ingests MCP servers (local, remote, hub-shared) _and_ exposes its own actions as an MCP server. See [MCP Clients](/docs/mcp-clients) and [MCP Protocol](/docs/mcp-protocol). |
|
|
167
|
+
| Inter-app delegation | Agents in different apps talk over [A2A](/docs/a2a-protocol). Same-origin deploys skip JWT; cross-origin uses a shared `A2A_SECRET`. |
|
|
168
|
+
| Sub-agent teams | Spawn a sub-agent with its own thread and tools, surfaced as a chip inline in chat. See [Agent Teams](/docs/agent-teams). |
|
|
169
|
+
| Portability | Any Drizzle-supported SQL database, any Nitro-compatible host (Node, Workers, Netlify, Vercel, Deno, Lambda, Bun). |
|
|
170
|
+
|
|
150
171
|
## Data in SQL {#data-in-sql}
|
|
151
172
|
|
|
152
173
|
All application state lives in a SQL database via Drizzle ORM. Schemas are provider-agnostic; the supported databases, `DATABASE_URL` config, and portability rules live in [Database](/docs/database).
|
|
153
174
|
|
|
154
175
|
Core SQL stores are auto-created and available in every template:
|
|
155
176
|
|
|
156
|
-
- `application_state
|
|
157
|
-
- `settings
|
|
158
|
-
- `oauth_tokens
|
|
159
|
-
- `sessions
|
|
177
|
+
- `application_state`: ephemeral UI state (navigation, drafts, selections)
|
|
178
|
+
- `settings`: persistent key-value config
|
|
179
|
+
- `oauth_tokens`: OAuth credentials
|
|
180
|
+
- `sessions`: auth sessions
|
|
181
|
+
|
|
182
|
+
Each row below expands to show its fields:
|
|
160
183
|
|
|
161
184
|
<DataModel
|
|
162
185
|
id="doc-block-4w0fu8"
|
|
163
186
|
title="Core SQL stores"
|
|
164
187
|
summary={
|
|
165
|
-
"Auto-created in every template
|
|
188
|
+
"Auto-created in every template. The agent and UI both read and write these."
|
|
166
189
|
}
|
|
167
190
|
entities={[
|
|
168
191
|
{
|
|
@@ -234,6 +257,8 @@ Core SQL stores are auto-created and available in every template:
|
|
|
234
257
|
]}
|
|
235
258
|
/>
|
|
236
259
|
|
|
260
|
+
To add your own domain data, define a table with the same schema helpers used by the core stores above:
|
|
261
|
+
|
|
237
262
|
```ts
|
|
238
263
|
// Drizzle schema for domain data
|
|
239
264
|
import { table, text, integer } from "@agent-native/core/db/schema";
|
|
@@ -247,12 +272,18 @@ export const forms = table("forms", {
|
|
|
247
272
|
});
|
|
248
273
|
```
|
|
249
274
|
|
|
275
|
+
Both you and the agent can inspect that data from the terminal, without a separate SQL client:
|
|
276
|
+
|
|
250
277
|
```bash
|
|
251
278
|
# Core actions for quick database inspection
|
|
252
279
|
pnpm action db-schema # show all tables
|
|
253
280
|
pnpm action db-query --sql "SELECT * FROM forms"
|
|
254
281
|
```
|
|
255
282
|
|
|
283
|
+
`db-schema` prints every table's columns and types. `db-query` runs read-only SQL directly, which is useful for checking an action's writes without opening a database client.
|
|
284
|
+
|
|
285
|
+
<Callout tone="decision">
|
|
286
|
+
|
|
256
287
|
The production agent chat plugin defaults raw SQL tools to read-only
|
|
257
288
|
(`frameworkTools: { database: "read" }`), so agents inspect app-owned data with
|
|
258
289
|
`db-schema` / `db-query` and perform writes through typed app actions. Set
|
|
@@ -268,12 +299,14 @@ chat, and email. See
|
|
|
268
299
|
list, the `"minimal"` preset, and why disabling a group leaves its HTTP routes
|
|
269
300
|
mounted.
|
|
270
301
|
|
|
302
|
+
</Callout>
|
|
303
|
+
|
|
271
304
|
## Agent chat bridge {#agent-chat-bridge}
|
|
272
305
|
|
|
273
|
-
The UI never calls an LLM directly. When a user clicks "Generate chart" or "Write summary", the UI sends a message to the agent via `postMessage`. The agent does the work
|
|
306
|
+
The UI never calls an LLM directly. When a user clicks "Generate chart" or "Write summary", the UI sends a message to the agent via `postMessage`. The agent does the work. It has full conversation history, skills, instructions, and the ability to iterate.
|
|
274
307
|
|
|
275
308
|
```ts
|
|
276
|
-
//
|
|
309
|
+
// Delegate AI work to the agent from a React component
|
|
277
310
|
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
278
311
|
sendToAgentChat({
|
|
279
312
|
message: "Generate a chart showing signups by source",
|
|
@@ -282,16 +315,19 @@ sendToAgentChat({
|
|
|
282
315
|
});
|
|
283
316
|
```
|
|
284
317
|
|
|
285
|
-
|
|
318
|
+
In short:
|
|
319
|
+
|
|
320
|
+
- **AI is non-deterministic**: You need conversation flow to give feedback and iterate, not one-shot buttons.
|
|
321
|
+
- **Context matters**: The agent has the app's instructions, skills, and history. An inline call has none of that.
|
|
322
|
+
- **The agent can do more**: It can run actions, browse the web, and chain multiple steps together.
|
|
286
323
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
- **External execution.** Because everything goes through the agent and actions, any app can be driven from Slack, Telegram, scheduled jobs, scripts, or another agent via [A2A](/docs/a2a-protocol).
|
|
324
|
+
**[External execution](/docs/a2a-protocol)**
|
|
325
|
+
|
|
326
|
+
Because everything goes through the agent and actions, any app can be driven from Slack, Telegram, scheduled jobs, scripts, or another agent via A2A.
|
|
291
327
|
|
|
292
328
|
## Actions system {#actions-system}
|
|
293
329
|
|
|
294
|
-
When the agent needs to do something complex
|
|
330
|
+
When the agent needs to do something complex, like calling an API, processing data, or querying the database, it runs an **action**. Actions are TypeScript files in `actions/` that export a default `defineAction()`:
|
|
295
331
|
|
|
296
332
|
```ts filename="actions/fetch-data.ts"
|
|
297
333
|
import { defineAction } from "@agent-native/core/action";
|
|
@@ -309,19 +345,30 @@ export default defineAction({
|
|
|
309
345
|
});
|
|
310
346
|
```
|
|
311
347
|
|
|
312
|
-
|
|
348
|
+
This action fetches JSON from a source API and returns it. `defineAction()` wraps the function with a zod schema for its input (`source`), so the framework can validate that input, generate a JSON Schema the agent can call, and infer types for the frontend hook, all from this one definition.
|
|
349
|
+
|
|
350
|
+
One `defineAction()` call reaches five different consumers automatically. The diagram shows the fan-out from a single action; the list below explains what each consumer gets:
|
|
351
|
+
|
|
352
|
+
```mermaid
|
|
353
|
+
graph LR
|
|
354
|
+
A[defineAction] --> B[Agent tool]
|
|
355
|
+
A --> C[Frontend hook]
|
|
356
|
+
A --> D[Framework transport]
|
|
357
|
+
A --> E[CLI command]
|
|
358
|
+
A --> F[MCP or A2A tool]
|
|
359
|
+
```
|
|
313
360
|
|
|
314
|
-
- **Agent tool
|
|
315
|
-
- **Frontend hook
|
|
316
|
-
- **Framework transport
|
|
317
|
-
- **CLI
|
|
318
|
-
- **MCP tool / A2A tool
|
|
361
|
+
- **Agent tool:** the agent sees it with the zod-derived JSON Schema and can call it.
|
|
362
|
+
- **Frontend hook:** `useActionMutation("fetch-data")` with full TypeScript inference.
|
|
363
|
+
- **Framework transport:** auto-mounted behind the client hooks.
|
|
364
|
+
- **CLI:** `pnpm action fetch-data --source=signups` for scripting and agent dev loops.
|
|
365
|
+
- **MCP tool / A2A tool:** when MCP server or A2A is enabled, the same action shows up there too.
|
|
319
366
|
|
|
320
|
-
|
|
367
|
+
Every consumer calls the same underlying function, so there is only one implementation to write and maintain. See [Actions](/docs/actions) for the full reference.
|
|
321
368
|
|
|
322
369
|
## Live sync {#polling-sync}
|
|
323
370
|
|
|
324
|
-
|
|
371
|
+
When the agent changes data, the UI needs to reflect that without a manual refresh. `useDbSync()` is what makes that automatic. Same-process writes stream over `/_agent-native/events`; `/_agent-native/poll` remains the cross-process and serverless fallback. When the agent writes to the database (application state, settings, or domain data), a version counter increments and the client invalidates the relevant React Query caches.
|
|
325
372
|
|
|
326
373
|
```ts
|
|
327
374
|
// Client: subscribe to agent/UI data changes once near the app shell
|
|
@@ -329,6 +376,8 @@ import { useDbSync } from "@agent-native/core/client/hooks";
|
|
|
329
376
|
useDbSync({ queryClient });
|
|
330
377
|
```
|
|
331
378
|
|
|
379
|
+
Call this once, near the root of the app. It subscribes the whole app to change events, so any component using `useActionQuery` or a source-versioned `useQuery` refetches automatically when the data it reads changes.
|
|
380
|
+
|
|
332
381
|
The flow is:
|
|
333
382
|
|
|
334
383
|
1. Agent runs an action that writes to the database
|
|
@@ -337,7 +386,9 @@ The flow is:
|
|
|
337
386
|
4. `useActionQuery` hooks and source-versioned `useQuery` hooks refetch
|
|
338
387
|
5. Components render the new data without a page reload
|
|
339
388
|
|
|
340
|
-
|
|
389
|
+
The diagram traces that same sequence end to end:
|
|
390
|
+
|
|
391
|
+
<Diagram id="doc-block-87e1c3" title="Live sync flow" summary={"An agent write becomes a UI render with no manual refresh. SSE first, polling as the universal fallback."}>
|
|
341
392
|
|
|
342
393
|
```html
|
|
343
394
|
<div class="diagram-sync">
|
|
@@ -384,16 +435,16 @@ The flow is:
|
|
|
384
435
|
|
|
385
436
|
</Diagram>
|
|
386
437
|
|
|
387
|
-
This works in all deployment environments
|
|
438
|
+
This works in all deployment environments, including serverless and edge, because it uses the database instead of in-memory state or file system watchers.
|
|
388
439
|
|
|
389
440
|
## Frames {#frames}
|
|
390
441
|
|
|
391
|
-
A _frame_ is the environment that hosts the agent next to your app
|
|
442
|
+
A _frame_ is the environment that hosts the agent next to your app. Locally that's the embedded panel; in the cloud it's Builder.io's managed surface. See [Frames](/docs/frames).
|
|
392
443
|
|
|
393
444
|
Agent-native apps include an embedded agent panel that provides the AI agent alongside the app UI. This is what makes the architecture work: the agent needs a computer (database, browser, code execution), and the app needs the agent for AI work.
|
|
394
445
|
|
|
395
|
-
- **Embedded Agent Panel
|
|
396
|
-
- **Cloud
|
|
446
|
+
- **Embedded Agent Panel:** Chat and optional CLI terminal built into every app. Supports Claude Code, Codex, Gemini, OpenCode, and Builder.io. Runs locally, free and open source.
|
|
447
|
+
- **Cloud:** Deploy to any cloud with real-time collaboration, visual editing, roles, and permissions. Best for teams.
|
|
397
448
|
|
|
398
449
|
## Context awareness {#context-awareness}
|
|
399
450
|
|
|
@@ -405,7 +456,11 @@ For example, when you open an email thread the UI upserts a row like:
|
|
|
405
456
|
{ "key": "navigation", "value": { "view": "thread", "threadId": "th_abc123" } }
|
|
406
457
|
```
|
|
407
458
|
|
|
408
|
-
|
|
459
|
+
<Callout tone="info">
|
|
460
|
+
|
|
461
|
+
The UI writes this on route change; the agent reads it (via `view-screen`) before taking any action, so it always knows which thread, chart, or slide you're focused on.
|
|
462
|
+
|
|
463
|
+
</Callout>
|
|
409
464
|
|
|
410
465
|
See [Context Awareness](/docs/context-awareness) for the full pattern: navigation state, view-screen, navigate commands, and jitter prevention.
|
|
411
466
|
|
|
@@ -413,7 +468,7 @@ See [Context Awareness](/docs/context-awareness) for the full pattern: navigatio
|
|
|
413
468
|
|
|
414
469
|
Implement a domain operation once as an action; the framework exposes it to every consumer. The same `defineAction()` becomes an agent tool, a typesafe UI hook, an HTTP endpoint, a CLI command, an MCP tool, and an A2A tool, with optional `link`, `mcpApp`, native-widget metadata, or Generative UI wrappers added only when a surface needs richer interaction. Skills and instructions cover behavior.
|
|
415
470
|
|
|
416
|
-
For the full protocol/surface matrix (MCP server and OAuth, MCP Apps, A2A, deep links, native chat widgets, Generative UI, AgentChatRuntime connectors, Agent Web, and the adapter horizon for ACP and A2UI), and for choosing a product shape
|
|
471
|
+
For the full protocol/surface matrix (MCP server and OAuth, MCP Apps, A2A, deep links, native chat widgets, Generative UI, AgentChatRuntime connectors, Agent Web, and the adapter horizon for ACP and A2UI), and for choosing a product shape (chat, inline UI, full app pages, embedded sidecar, automation, or external-agent access), see [Agent Surfaces](/docs/agent-surfaces).
|
|
417
472
|
|
|
418
473
|
## App code and customization {#agent-modifies-code}
|
|
419
474
|
|
|
@@ -430,43 +485,46 @@ without source changes, use [Extensions](/docs/extensions).
|
|
|
430
485
|
Two architectural rules keep apps portable across databases and hosts:
|
|
431
486
|
|
|
432
487
|
- **Database-agnostic.** Write schemas with `@agent-native/core/db/schema` and reads/writes with Drizzle's portable query DSL so the same code runs on any supported provider. Use raw SQL only for additive migrations or one-off maintenance, kept parameterized and dialect-agnostic. See [Database](/docs/database).
|
|
433
|
-
- **Hosting-agnostic.** The server runs on Nitro and compiles to any deployment target. Never use Node-specific APIs (`fs`, `child_process`, `path`) in server routes or plugins, and never assume a persistent server process
|
|
488
|
+
- **Hosting-agnostic.** The server runs on Nitro and compiles to any deployment target. Never use Node-specific APIs (`fs`, `child_process`, `path`) in server routes or plugins, and never assume a persistent server process. Serverless and edge are stateless, so keep all state in SQL. See [Deployment](/docs/deployment).
|
|
434
489
|
|
|
435
490
|
## Agent Resources {#workspace}
|
|
436
491
|
|
|
437
|
-
Every user gets a personal set of **agent resources
|
|
492
|
+
Every user gets a personal set of **agent resources**: instructions, skills, memory, custom sub-agents, scheduled jobs, and connected MCP servers, all stored in SQL rather than files. That makes Claude-Code-level customization viable inside multi-tenant SaaS without spinning up a container per user. See [Agent Resources](/docs/agent-resources).
|
|
438
493
|
|
|
439
494
|
## Related building blocks {#building-blocks}
|
|
440
495
|
|
|
441
496
|
These sit on top of the same contract and have their own deep dives:
|
|
442
497
|
|
|
443
|
-
- **[Dispatch](/docs/dispatch)
|
|
444
|
-
- **[Extensions](/docs/extensions)
|
|
445
|
-
- **[A2A Protocol](/docs/a2a-protocol)
|
|
498
|
+
- **[Dispatch](/docs/dispatch):** the workspace control plane, with a shared inbox, secrets vault, scheduled jobs, and an orchestrator that delegates to specialist apps over A2A.
|
|
499
|
+
- **[Extensions](/docs/extensions):** sandboxed Alpine.js mini-apps the agent creates at runtime, with no source changes or migrations.
|
|
500
|
+
- **[A2A Protocol](/docs/a2a-protocol):** how apps in the same workspace discover and call each other over JSON-RPC.
|
|
446
501
|
|
|
447
|
-
## What
|
|
502
|
+
## What's next {#deep-dives}
|
|
448
503
|
|
|
449
|
-
|
|
504
|
+
<Cards>
|
|
450
505
|
|
|
451
|
-
|
|
452
|
-
- **A full set of agent resources per user.** Skills, shared `LEARNINGS.md`, personal `memory/MEMORY.md`, `AGENTS.md`, custom sub-agents, scheduled jobs, connected MCP servers — all SQL-backed, no dev-box required. See [Agent Resources](/docs/agent-resources).
|
|
453
|
-
- **Drop-in React components.** `<AgentPanel />` and `<AgentSidebar />` render chat + resources anywhere in your app. See [Drop-in Agent](/docs/drop-in-agent).
|
|
454
|
-
- **BYO agent chat runtimes.** The same chat UI can sit on top of OpenAI Agents, OpenAI Responses, Claude Agent SDK, Vercel AI SDK, AG-UI, or your own normalized HTTP stream. See [Native Chat UI](/docs/native-chat-ui#byo-agent-runtimes).
|
|
455
|
-
- **Live sync between agent and UI.** Same-process writes stream immediately over `/_agent-native/events`; a lightweight poll keeps serverless, cron, and cross-process writes convergent. Mutating actions invalidate action-backed queries automatically, so agent-created records appear without a manual refresh. See [Live Sync](#polling-sync) below.
|
|
456
|
-
- **Auth, orgs, RBAC.** Better Auth with orgs/members/roles is wired in for every template. See [Authentication](/docs/authentication). Building for more than one user? Start with [Organizations, Teams & Permissions](/docs/organizations-teams-permissions).
|
|
457
|
-
- **Context awareness.** The agent always knows what the user is looking at through the `navigation` app-state key. See [Context Awareness](/docs/context-awareness).
|
|
458
|
-
- **MCP client + server, both directions.** The app ingests MCP servers (local, remote, hub-shared) _and_ exposes its own actions as an MCP server. See [MCP Clients](/docs/mcp-clients) and [MCP Protocol](/docs/mcp-protocol).
|
|
459
|
-
- **Inter-app delegation.** Agents in different apps talk over [A2A](/docs/a2a-protocol). Same-origin deploys skip JWT; cross-origin uses a shared `A2A_SECRET`.
|
|
460
|
-
- **Sub-agent teams.** Spawn a sub-agent with its own thread and tools, surfaced as a chip inline in chat. See [Agent Teams](/docs/agent-teams).
|
|
461
|
-
- **Portability.** Any Drizzle-supported SQL database, any Nitro-compatible host (Node, Workers, Netlify, Vercel, Deno, Lambda, Bun).
|
|
506
|
+
### [What Is Agent-Native?](/docs/what-is-agent-native)
|
|
462
507
|
|
|
463
|
-
|
|
508
|
+
The vision and philosophy behind these rules.
|
|
464
509
|
|
|
465
|
-
|
|
510
|
+
### [Context Awareness](/docs/context-awareness)
|
|
511
|
+
|
|
512
|
+
Navigation state, view-screen, and navigate commands in depth.
|
|
513
|
+
|
|
514
|
+
### [Skills Guide](/docs/skills-guide)
|
|
515
|
+
|
|
516
|
+
Framework skills, domain skills, and creating custom skills.
|
|
517
|
+
|
|
518
|
+
### [Native Chat UI](/docs/native-chat-ui)
|
|
519
|
+
|
|
520
|
+
Action-declared tables, charts, and BYO runtime posture.
|
|
521
|
+
|
|
522
|
+
### [Agent Surfaces](/docs/agent-surfaces)
|
|
523
|
+
|
|
524
|
+
Chat, native inline UI, full app pages, embedded sidecar, automation, and external-agent paths.
|
|
525
|
+
|
|
526
|
+
### [A2A Protocol](/docs/a2a-protocol)
|
|
527
|
+
|
|
528
|
+
Agent-to-agent communication.
|
|
466
529
|
|
|
467
|
-
|
|
468
|
-
- [**Context Awareness**](/docs/context-awareness) — navigation state, view-screen, and navigate commands in depth
|
|
469
|
-
- [**Skills Guide**](/docs/skills-guide) — framework skills, domain skills, and creating custom skills
|
|
470
|
-
- [**Native Chat UI**](/docs/native-chat-ui) — action-declared tables, charts, and BYO runtime posture
|
|
471
|
-
- [**Agent Surfaces**](/docs/agent-surfaces) — chat, native inline UI, full app pages, embedded sidecar, automation, and external-agent paths
|
|
472
|
-
- [**A2A Protocol**](/docs/a2a-protocol) — agent-to-agent communication
|
|
530
|
+
</Cards>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.1",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
"yjs": "^13.6.31",
|
|
415
415
|
"zod": "^4.3.6",
|
|
416
416
|
"@agent-native/recap-cli": "0.5.4",
|
|
417
|
-
"@agent-native/toolkit": "^0.13.
|
|
417
|
+
"@agent-native/toolkit": "^0.13.10"
|
|
418
418
|
},
|
|
419
419
|
"devDependencies": {
|
|
420
420
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -49,6 +49,34 @@ sendToAgentChat({
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
### Keep user text separate from injected context
|
|
53
|
+
|
|
54
|
+
Treat the visible `message` as the user's request or the shortest clear
|
|
55
|
+
description of an app-initiated operation. Put context the user did not type —
|
|
56
|
+
IDs, URLs, filenames, current selection or screen state, serialized records,
|
|
57
|
+
upload instructions, and bounded source excerpts — in the `context` field.
|
|
58
|
+
`context` is model input carried through the agent turn; it is stripped from
|
|
59
|
+
the rendered user message, so do not concatenate it into `message` with labels,
|
|
60
|
+
blank-line sections, or `<context>` tags yourself.
|
|
61
|
+
|
|
62
|
+
Use the related surface for each kind of supporting input:
|
|
63
|
+
|
|
64
|
+
| Surface | Use for |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `message` | User-authored intent or a concise app action description |
|
|
67
|
+
| `context` | Derived metadata and bounded text needed to carry out that intent |
|
|
68
|
+
| `setAgentChatContextItem` | Context staged for a later user-submitted prompt; keep it keyed so updates replace stale context |
|
|
69
|
+
| `images`, `referenceImagePaths`, attachments | Binary or visual inputs; describe only the handling instructions in `context` |
|
|
70
|
+
|
|
71
|
+
If an app builds a prompt from a form, selection, upload, or editor state, keep
|
|
72
|
+
the visible message short and pass the assembled details as `context`. Preserve
|
|
73
|
+
the user's actual freeform text in `message` when it is the request; do not
|
|
74
|
+
restate it as metadata in `context` unless the agent needs a structured copy.
|
|
75
|
+
|
|
76
|
+
This boundary applies to auto-submitted turns and prefills. A hidden context
|
|
77
|
+
field is not a license to send unbounded records or secrets: cap excerpts,
|
|
78
|
+
prefer stable IDs and URLs, and use an action or resource lookup for full data.
|
|
79
|
+
|
|
52
80
|
**From the UI, in the background:**
|
|
53
81
|
|
|
54
82
|
```ts
|