@agent-native/core 0.7.52 → 0.7.53
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/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +1 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.d.ts.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +54 -13
- package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
- package/docs/content/a2a-protocol.md +19 -9
- package/docs/content/agent-mentions.md +2 -2
- package/docs/content/agent-teams.md +2 -2
- package/docs/content/client.md +1 -1
- package/docs/content/cloneable-saas.md +13 -13
- package/docs/content/creating-templates.md +251 -219
- package/docs/content/faq.md +2 -2
- package/docs/content/frames.md +1 -1
- package/docs/content/getting-started.md +1 -1
- package/docs/content/key-concepts.md +1 -1
- package/docs/content/messaging.md +11 -6
- package/docs/content/multi-app-workspace.md +2 -2
- package/docs/content/server.md +117 -133
- package/docs/content/skills-guide.md +3 -3
- package/docs/content/template-analytics.md +8 -6
- package/docs/content/template-design.md +25 -27
- package/docs/content/template-forms.md +26 -21
- package/docs/content/template-mail.md +4 -0
- package/docs/content/template-video.md +4 -4
- package/docs/content/what-is-agent-native.md +1 -1
- package/docs/content/workspace.md +37 -30
- package/package.json +1 -1
|
@@ -5,315 +5,347 @@ description: "How to create and publish your own agent-native app templates."
|
|
|
5
5
|
|
|
6
6
|
# Creating Templates
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Templates are complete, forkable agent-native apps that solve a real workflow. The first-party templates are built with the same framework surface you use: React routes for the UI, Drizzle SQL for data, actions for operations, workspace resources for agent behavior, and polling sync so the agent and UI stay aligned.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
A good template:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- Solves one workflow end-to-end, with useful seed data or an empty-state flow.
|
|
13
|
+
- Stores durable state in SQL, not JSON files.
|
|
14
|
+
- Defines app operations as `defineAction()` actions.
|
|
15
|
+
- Exposes navigation and selection through application state.
|
|
16
|
+
- Ships a clear `AGENTS.md` plus focused skills for non-obvious workflows.
|
|
17
|
+
- Registers onboarding steps for required providers and secrets.
|
|
18
|
+
- Works as a standalone app and as part of a multi-app workspace.
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
## Start from Starter {#start-from-starter}
|
|
15
21
|
|
|
16
|
-
-
|
|
17
|
-
- Works out of the box with example data
|
|
18
|
-
- Has a comprehensive `AGENTS.md` so the AI agent understands the architecture
|
|
19
|
-
- Includes actions for key operations the agent can call
|
|
20
|
-
- Follows the core rules: data in SQL, all AI through agent chat, actions for operations, real-time sync, agent can modify code
|
|
22
|
+
Use the CLI-only Starter scaffold when you want a blank app with the framework wiring already in place:
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
```bash
|
|
25
|
+
pnpm dlx @agent-native/core create my-template --template starter --standalone
|
|
26
|
+
```
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
For a workspace with multiple apps, run the picker and include Starter with any domain templates you want:
|
|
25
29
|
|
|
26
30
|
```bash
|
|
27
|
-
|
|
31
|
+
pnpm dlx @agent-native/core create my-platform
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
Starter gives you auth, the agent sidebar, SQL-backed resources, tools, application state, actions, and polling sync. You add the domain model and product UI.
|
|
31
35
|
|
|
32
|
-
## Project
|
|
36
|
+
## Project Structure {#project-structure}
|
|
33
37
|
|
|
34
|
-
Every template follows the same
|
|
38
|
+
Every template follows the same broad layout:
|
|
35
39
|
|
|
36
40
|
```text
|
|
37
41
|
my-template/
|
|
38
|
-
app/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
routes/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
data/ # File-based state (watched by SSE)
|
|
64
|
-
.gitkeep # Or seed data for the template
|
|
65
|
-
|
|
66
|
-
.agents/skills/ # Agent skills — detailed guidance per topic
|
|
67
|
-
|
|
68
|
-
AGENTS.md # Master agent instructions
|
|
69
|
-
react-router.config.ts # React Router config (ssr, appDirectory)
|
|
70
|
-
package.json # Scripts: dev, build, start, action, typecheck
|
|
71
|
-
vite.config.ts # Vite config (React Router + Nitro)
|
|
72
|
-
tsconfig.json # TypeScript config
|
|
42
|
+
app/
|
|
43
|
+
root.tsx # HTML shell and providers
|
|
44
|
+
routes/ # React Router file routes
|
|
45
|
+
components/ # Template UI
|
|
46
|
+
hooks/ # UI state and data hooks
|
|
47
|
+
|
|
48
|
+
actions/
|
|
49
|
+
*.ts # defineAction operations
|
|
50
|
+
|
|
51
|
+
server/
|
|
52
|
+
db/schema.ts # Drizzle schema
|
|
53
|
+
plugins/db.ts # additive migrations
|
|
54
|
+
plugins/*.ts # startup integrations
|
|
55
|
+
routes/api/*.ts # custom routes only when actions are not enough
|
|
56
|
+
|
|
57
|
+
shared/
|
|
58
|
+
types.ts # shared client/server types
|
|
59
|
+
|
|
60
|
+
.agents/skills/
|
|
61
|
+
<skill>/SKILL.md # agent guidance for complex workflows
|
|
62
|
+
|
|
63
|
+
AGENTS.md # template-specific agent instructions
|
|
64
|
+
package.json
|
|
65
|
+
react-router.config.ts
|
|
66
|
+
vite.config.ts
|
|
73
67
|
```
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
The client uses React Router v7 framework mode with file-based routing. Pages go in `app/routes/`, global providers live in `app/root.tsx`, and React Query handles data fetching.
|
|
69
|
+
Do not add a `data/` directory for application state. Durable app data belongs in SQL, and the UI reads it through actions or typed server handlers.
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
// app/root.tsx — App shell with providers
|
|
81
|
-
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
|
|
82
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
83
|
-
import { useDbSync } from "@agent-native/core";
|
|
71
|
+
## Model Data In SQL {#data-models}
|
|
84
72
|
|
|
85
|
-
|
|
73
|
+
Define domain tables with the framework Drizzle helpers so schemas stay portable across SQLite, Postgres, D1, Turso, Supabase, and Neon:
|
|
86
74
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
75
|
+
```ts
|
|
76
|
+
// server/db/schema.ts
|
|
77
|
+
import {
|
|
78
|
+
table,
|
|
79
|
+
text,
|
|
80
|
+
integer,
|
|
81
|
+
now,
|
|
82
|
+
ownableColumns,
|
|
83
|
+
createSharesTable,
|
|
84
|
+
} from "@agent-native/core/db/schema";
|
|
85
|
+
|
|
86
|
+
export const projects = table("projects", {
|
|
87
|
+
id: text("id").primaryKey(),
|
|
88
|
+
title: text("title").notNull(),
|
|
89
|
+
status: text("status", {
|
|
90
|
+
enum: ["draft", "active", "archived"],
|
|
91
|
+
})
|
|
92
|
+
.notNull()
|
|
93
|
+
.default("draft"),
|
|
94
|
+
sortOrder: integer("sort_order").notNull().default(0),
|
|
95
|
+
...ownableColumns(),
|
|
96
|
+
createdAt: text("created_at").notNull().default(now()),
|
|
97
|
+
updatedAt: text("updated_at").notNull().default(now()),
|
|
98
|
+
});
|
|
104
99
|
|
|
105
|
-
export
|
|
106
|
-
useDbSync({ queryClient, queryKeys: ["items", "projects"] });
|
|
107
|
-
return (
|
|
108
|
-
<QueryClientProvider client={queryClient}>
|
|
109
|
-
<Outlet />
|
|
110
|
-
</QueryClientProvider>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
100
|
+
export const projectShares = createSharesTable("project_shares", "project");
|
|
113
101
|
```
|
|
114
102
|
|
|
115
|
-
|
|
103
|
+
Schema changes must be additive. Add tables and columns through `runMigrations()` in `server/plugins/db.ts`; never use destructive SQL, `drizzle-kit push`, table renames, or column drops.
|
|
116
104
|
|
|
117
105
|
```ts
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
// server/plugins/db.ts
|
|
107
|
+
import { runMigrations } from "@agent-native/core/db/migrations";
|
|
108
|
+
|
|
109
|
+
export default runMigrations([
|
|
110
|
+
{
|
|
111
|
+
id: "001_create_projects",
|
|
112
|
+
sql: `CREATE TABLE IF NOT EXISTS projects (
|
|
113
|
+
id TEXT PRIMARY KEY,
|
|
114
|
+
title TEXT NOT NULL,
|
|
115
|
+
status TEXT NOT NULL DEFAULT 'draft',
|
|
116
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
117
|
+
owner_email TEXT NOT NULL,
|
|
118
|
+
org_id TEXT,
|
|
119
|
+
visibility TEXT NOT NULL DEFAULT 'private',
|
|
120
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
121
|
+
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
122
|
+
)`,
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
Use the [Database](/docs/database) and [Security](/docs/security) docs before adding schemas that hold user or org data.
|
|
130
128
|
|
|
131
|
-
##
|
|
129
|
+
## Define Operations As Actions {#actions}
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
Actions are the single source of truth for app behavior. The agent calls them as tools, the frontend calls them through hooks or HTTP, and other apps can reach them through MCP/A2A.
|
|
134
132
|
|
|
135
133
|
```ts
|
|
136
|
-
//
|
|
137
|
-
import {
|
|
138
|
-
import {
|
|
139
|
-
import
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
134
|
+
// actions/create-project.ts
|
|
135
|
+
import { defineAction } from "@agent-native/core";
|
|
136
|
+
import { getDb } from "@agent-native/core/db";
|
|
137
|
+
import { nanoid } from "nanoid";
|
|
138
|
+
import { z } from "zod";
|
|
139
|
+
import * as schema from "../server/db/schema";
|
|
140
|
+
|
|
141
|
+
export default defineAction({
|
|
142
|
+
description: "Create a project.",
|
|
143
|
+
schema: z.object({
|
|
144
|
+
title: z.string().min(1).describe("Project title"),
|
|
145
|
+
}),
|
|
146
|
+
run: async ({ title }, ctx) => {
|
|
147
|
+
const db = getDb();
|
|
148
|
+
const id = nanoid();
|
|
149
|
+
await db.insert(schema.projects).values({
|
|
150
|
+
id,
|
|
151
|
+
title,
|
|
152
|
+
ownerEmail: ctx.userEmail,
|
|
153
|
+
orgId: ctx.orgId,
|
|
154
|
+
});
|
|
155
|
+
return { id, title };
|
|
156
|
+
},
|
|
153
157
|
});
|
|
154
158
|
```
|
|
155
159
|
|
|
156
|
-
|
|
160
|
+
Use `http: { method: "GET" }` or `readOnly: true` for read-only actions. Use `toolCallable: false` for high-blast-radius actions that should not run from sandboxed tools.
|
|
157
161
|
|
|
158
|
-
##
|
|
162
|
+
## Build The UI {#ui}
|
|
159
163
|
|
|
160
|
-
|
|
164
|
+
Routes live in `app/routes/` and use React Router v7 file routing. Query data through actions or API handlers, and make mutations optimistic by default.
|
|
161
165
|
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
import { parseArgs } from "@agent-native/core";
|
|
165
|
-
import { writeFile, mkdir } from "node:fs/promises";
|
|
166
|
+
```tsx
|
|
167
|
+
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
166
168
|
|
|
167
|
-
export default
|
|
168
|
-
const {
|
|
169
|
-
|
|
170
|
-
console.error("--url is required");
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
169
|
+
export default function ProjectsPage() {
|
|
170
|
+
const { data: projects = [] } = useActionQuery("list-projects", {});
|
|
171
|
+
const create = useActionMutation("create-project");
|
|
173
172
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
await mkdir("./data/imports", { recursive: true });
|
|
179
|
-
await writeFile(`./data/imports/${slug}.json`, JSON.stringify(data, null, 2));
|
|
180
|
-
console.log(
|
|
181
|
-
`Imported ${Array.isArray(data) ? data.length + " records" : "data"} to data/imports/${slug}.json`,
|
|
173
|
+
return (
|
|
174
|
+
<button onClick={() => create.mutate({ title: "Launch plan" })}>
|
|
175
|
+
New project ({projects.length})
|
|
176
|
+
</button>
|
|
182
177
|
);
|
|
183
178
|
}
|
|
184
179
|
```
|
|
185
180
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
Wire polling once near the app shell so React Query caches refresh when the agent, another tab, or an action changes data:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { useDbSync } from "@agent-native/core/client";
|
|
185
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
186
|
+
|
|
187
|
+
export function AppSync() {
|
|
188
|
+
const queryClient = useQueryClient();
|
|
189
|
+
useDbSync({ queryClient });
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
189
192
|
```
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
## Add Application State {#application-state}
|
|
192
195
|
|
|
193
|
-
|
|
196
|
+
Application state is how the agent knows what the user is seeing. At minimum, add:
|
|
194
197
|
|
|
195
|
-
|
|
198
|
+
- A UI hook that writes `navigation` state when routes, selected records, filters, or editor selections change.
|
|
199
|
+
- A `view-screen` action that reads that state and returns the current screen snapshot.
|
|
200
|
+
- A `navigate` action that writes a one-shot `navigate` command for the UI to consume.
|
|
196
201
|
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
```ts
|
|
203
|
+
// actions/navigate.ts
|
|
204
|
+
import { defineAction } from "@agent-native/core";
|
|
205
|
+
import { writeAppState } from "@agent-native/core/application-state";
|
|
206
|
+
import { z } from "zod";
|
|
207
|
+
|
|
208
|
+
export default defineAction({
|
|
209
|
+
description: "Navigate the UI.",
|
|
210
|
+
schema: z.object({
|
|
211
|
+
view: z.enum(["home", "project"]),
|
|
212
|
+
projectId: z.string().optional(),
|
|
213
|
+
}),
|
|
214
|
+
run: async (args) => {
|
|
215
|
+
await writeAppState("navigate", args);
|
|
216
|
+
return { ok: true };
|
|
217
|
+
},
|
|
218
|
+
});
|
|
204
219
|
```
|
|
205
220
|
|
|
206
|
-
|
|
221
|
+
See [Context Awareness](/docs/context-awareness) for the full pattern.
|
|
207
222
|
|
|
208
|
-
##
|
|
223
|
+
## Use API Routes Sparingly {#api-routes}
|
|
209
224
|
|
|
210
|
-
|
|
225
|
+
Prefer actions for app operations. Create custom Nitro routes only for surfaces that cannot be actions cleanly:
|
|
211
226
|
|
|
212
|
-
|
|
213
|
-
|
|
227
|
+
- File upload or binary streaming.
|
|
228
|
+
- Public anonymous pages and webhooks.
|
|
229
|
+
- OAuth callbacks and provider-specific protocol handlers.
|
|
230
|
+
- Server-rendered public content.
|
|
214
231
|
|
|
215
|
-
|
|
232
|
+
Custom routes that touch ownable data must call `getSession(event)` and wrap database work in `runWithRequestContext({ userEmail, orgId }, fn)` before using access helpers.
|
|
216
233
|
|
|
217
|
-
|
|
234
|
+
## Write Agent Instructions {#write-agents-md}
|
|
218
235
|
|
|
219
|
-
|
|
236
|
+
`AGENTS.md` is the agent's map of your app. Keep it specific and operational:
|
|
220
237
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
3. **Actions for operations** — `pnpm action <name>` for complex work.
|
|
224
|
-
4. **Real-time sync** — Polling keeps UI in sync with agent changes.
|
|
225
|
-
5. **Agent can update code** — Edit components, routes, actions.
|
|
226
|
-
|
|
227
|
-
### Directory Structure
|
|
238
|
+
```markdown
|
|
239
|
+
# My Template
|
|
228
240
|
|
|
229
|
-
|
|
230
|
-
server/ # Nitro API server
|
|
231
|
-
actions/ # Agent-callable actions
|
|
232
|
-
data/ # File-based state
|
|
241
|
+
## Product Model
|
|
233
242
|
|
|
234
|
-
|
|
243
|
+
Projects are the top-level resource. They contain tasks and notes.
|
|
235
244
|
|
|
236
|
-
|
|
237
|
-
- `pnpm action generate-report --id <id>` — Generate a report
|
|
245
|
+
## Navigation State
|
|
238
246
|
|
|
239
|
-
|
|
247
|
+
- `navigation.view`: `home` or `project`
|
|
248
|
+
- `navigation.projectId`: selected project when on a project page
|
|
240
249
|
|
|
241
|
-
|
|
250
|
+
## Actions
|
|
242
251
|
|
|
243
|
-
|
|
252
|
+
| Action | Purpose |
|
|
253
|
+
| ---------------- | --------------------------- |
|
|
254
|
+
| `list-projects` | List accessible projects |
|
|
255
|
+
| `create-project` | Create a project |
|
|
256
|
+
| `update-project` | Rename or archive a project |
|
|
244
257
|
|
|
245
|
-
|
|
258
|
+
## Rules
|
|
246
259
|
|
|
247
|
-
-
|
|
248
|
-
-
|
|
249
|
-
-
|
|
260
|
+
- Use `view-screen` before acting on "this project" if the current screen is unclear.
|
|
261
|
+
- Use actions for project changes; do not write raw SQL unless debugging.
|
|
262
|
+
- For shared projects, check access through framework sharing helpers.
|
|
250
263
|
```
|
|
251
264
|
|
|
252
|
-
|
|
265
|
+
Update `AGENTS.md` whenever you add a new action, route, state key, or recurring workflow.
|
|
253
266
|
|
|
254
|
-
|
|
267
|
+
## Add Skills {#skills}
|
|
255
268
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
For complex topics that don't fit in `AGENTS.md`, create skills in `.agents/skills/`. Each skill is a Markdown file with detailed guidance for a specific topic:
|
|
269
|
+
Use skills for detailed patterns that would bloat `AGENTS.md`: provider-specific APIs, import/export formats, complex editing flows, or domain terminology.
|
|
259
270
|
|
|
260
271
|
```markdown
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
### Column Reference
|
|
266
|
-
|
|
267
|
-
- `event_name` — The event type (string)
|
|
268
|
-
- `event_timestamp` — Microsecond timestamp (int64)
|
|
269
|
-
- `user_pseudo_id` — Anonymous user ID (string)
|
|
272
|
+
---
|
|
273
|
+
name: project-imports
|
|
274
|
+
description: How to import projects from the legacy CSV export.
|
|
275
|
+
---
|
|
270
276
|
|
|
271
|
-
|
|
277
|
+
# Project Imports
|
|
272
278
|
|
|
273
|
-
|
|
279
|
+
Use this skill when the user uploads a legacy project CSV.
|
|
274
280
|
|
|
275
|
-
|
|
281
|
+
## Rules
|
|
276
282
|
|
|
277
|
-
-
|
|
278
|
-
-
|
|
283
|
+
- Validate required columns before creating rows.
|
|
284
|
+
- Use `create-project` for each project so ownership and sync are correct.
|
|
285
|
+
- Save rejected rows as a note attached to the import summary.
|
|
279
286
|
```
|
|
280
287
|
|
|
281
|
-
|
|
288
|
+
Store template skills in `.agents/skills/<name>/SKILL.md`. If users should be able to edit the guidance at runtime, surface it through workspace resources as well.
|
|
282
289
|
|
|
283
|
-
##
|
|
290
|
+
## Register Setup Steps {#onboarding}
|
|
284
291
|
|
|
285
|
-
If
|
|
292
|
+
If a template needs an API key, OAuth connection, or provider account, register an onboarding step instead of burying the requirement in a README.
|
|
286
293
|
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
294
|
+
```ts
|
|
295
|
+
// server/plugins/onboarding.ts
|
|
296
|
+
import { defineNitroPlugin } from "@agent-native/core/server";
|
|
297
|
+
import { registerOnboardingStep } from "@agent-native/core/onboarding";
|
|
298
|
+
|
|
299
|
+
export default defineNitroPlugin(() => {
|
|
300
|
+
registerOnboardingStep({
|
|
301
|
+
id: "github",
|
|
302
|
+
title: "Connect GitHub",
|
|
303
|
+
description: "Needed to import repositories and pull requests.",
|
|
304
|
+
order: 100,
|
|
305
|
+
methods: [
|
|
306
|
+
{
|
|
307
|
+
id: "token",
|
|
308
|
+
kind: "form",
|
|
309
|
+
primary: true,
|
|
310
|
+
label: "Save token",
|
|
311
|
+
payload: {
|
|
312
|
+
fields: [
|
|
313
|
+
{ key: "GITHUB_TOKEN", label: "GitHub token", secret: true },
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
isComplete: () => !!process.env.GITHUB_TOKEN,
|
|
319
|
+
});
|
|
320
|
+
});
|
|
292
321
|
```
|
|
293
322
|
|
|
294
|
-
|
|
323
|
+
See [Onboarding & API Keys](/docs/onboarding).
|
|
295
324
|
|
|
296
|
-
## Make
|
|
325
|
+
## Make It Workspace-Ready {#workspace-ready}
|
|
297
326
|
|
|
298
|
-
Templates
|
|
327
|
+
Templates should fit naturally into [Multi-App Workspaces](/docs/multi-app-workspace), usually coordinated by [Dispatch](/docs/dispatch).
|
|
299
328
|
|
|
300
|
-
|
|
301
|
-
2. **Publish an agent card with skill metadata.** Your A2A peer exposes a manifest describing what your template does and which actions it offers. Dispatch reads these cards to decide which specialist to route a request to — clear, specific skill descriptions make routing accurate.
|
|
302
|
-
3. **Register secrets through onboarding.** Any third-party API keys your template needs (OpenAI, Stripe, SendGrid, etc.) should be registered via the [onboarding](/docs/onboarding) system. They show up in the workspace setup checklist and the Dispatch secrets vault, instead of forcing every user to hand-edit `.env`.
|
|
329
|
+
Checklist:
|
|
303
330
|
|
|
304
|
-
|
|
331
|
+
- Mount A2A through the framework agent chat plugin or `mountA2A()` so sibling apps can call your agent.
|
|
332
|
+
- Keep the agent card descriptions specific enough for Dispatch to route work accurately.
|
|
333
|
+
- Register required secrets/onboarding so setup appears in the sidebar and Dispatch can manage shared credentials.
|
|
334
|
+
- Keep cross-cutting instructions in workspace `AGENTS.md` or workspace resources, not copied into every app.
|
|
335
|
+
- Use sharing/access helpers for all ownable resources so org-scoped workspaces stay isolated.
|
|
305
336
|
|
|
306
|
-
##
|
|
337
|
+
## Publish A Template {#publishing}
|
|
307
338
|
|
|
308
|
-
|
|
339
|
+
Before sharing:
|
|
309
340
|
|
|
310
|
-
1.
|
|
311
|
-
2.
|
|
312
|
-
3.
|
|
313
|
-
4.
|
|
341
|
+
1. Run `pnpm install`, `pnpm typecheck`, and the template's tests.
|
|
342
|
+
2. Verify it works with no optional provider keys configured.
|
|
343
|
+
3. Check auth, sharing, and two-user data isolation.
|
|
344
|
+
4. Document required env vars and onboarding steps.
|
|
345
|
+
5. Include examples or seed rows through additive migrations, not tracked runtime data files.
|
|
314
346
|
|
|
315
|
-
Community templates can be
|
|
347
|
+
Community templates can be created from a GitHub repo:
|
|
316
348
|
|
|
317
349
|
```bash
|
|
318
|
-
|
|
350
|
+
pnpm dlx @agent-native/core create my-app --template github:user/repo
|
|
319
351
|
```
|
package/docs/content/faq.md
CHANGED
|
@@ -67,7 +67,7 @@ The framework ships with production-ready templates you can use as daily drivers
|
|
|
67
67
|
- **[Video](/templates/video)** — video composition with Remotion
|
|
68
68
|
- **[Analytics](/templates/analytics)** — data platform (like Amplitude/Mixpanel)
|
|
69
69
|
- **[Clips](/templates/clips)** — async screen + camera recording (replaces Loom)
|
|
70
|
-
- **[Design](/templates/design)** — agent-native
|
|
70
|
+
- **[Design](/templates/design)** — agent-native HTML prototyping studio
|
|
71
71
|
- **[Forms](/templates/forms)** — form builder (like Typeform)
|
|
72
72
|
- **[Dispatch](/templates/dispatch)** — workspace control plane: shared secrets, integrations, jobs
|
|
73
73
|
|
|
@@ -123,7 +123,7 @@ Anywhere. The server runs on Nitro, which compiles to any deployment target: Nod
|
|
|
123
123
|
|
|
124
124
|
### Why polling instead of WebSockets? {#why-polling-not-websockets}
|
|
125
125
|
|
|
126
|
-
Polling works in every deployment environment — including serverless, edge, and container platforms where persistent connections aren't available. The framework polls every 2 seconds using a lightweight version counter. When changes are detected, React Query caches are invalidated and components re-render. It's simple, reliable, and universal.
|
|
126
|
+
Polling works in every deployment environment — including serverless, edge, and container platforms where persistent connections aren't available. The framework polls every 2 seconds using a lightweight version counter. When changes are detected, React Query caches are invalidated and components re-render. It's simple, reliable, and universal.
|
|
127
127
|
|
|
128
128
|
### Why can't the UI call an LLM directly? {#why-no-inline-llm-calls}
|
|
129
129
|
|
package/docs/content/frames.md
CHANGED
|
@@ -41,7 +41,7 @@ The framework provides type-safe APIs so you never deal with raw messaging:
|
|
|
41
41
|
|
|
42
42
|
1. **Agent chat** — use `sendToAgentChat()` to send messages to the agent
|
|
43
43
|
2. **Generation state** — use `useAgentChatGenerating()` to track when the agent is running
|
|
44
|
-
3. **
|
|
44
|
+
3. **Polling sync** — database-backed sync keeps UI caches fresh when the agent changes state
|
|
45
45
|
4. **Action system** — `pnpm action <name>` dispatches to callable actions
|
|
46
46
|
|
|
47
47
|
Your app code is identical regardless of how the agent is provided.
|
|
@@ -72,7 +72,7 @@ Each template is a complete app with UI, agent actions, database schema, and AI
|
|
|
72
72
|
| [Video](/templates/video) | video editing |
|
|
73
73
|
| [Analytics](/templates/analytics) | Amplitude, Mixpanel, Looker |
|
|
74
74
|
| [Clips](/templates/clips) | Replaces Loom — screen + camera recording |
|
|
75
|
-
| [Design](/templates/design) |
|
|
75
|
+
| [Design](/templates/design) | HTML prototyping studios |
|
|
76
76
|
| [Forms](/docs/template-forms) | Typeform |
|
|
77
77
|
| [Dispatch](/docs/template-dispatch) | Workspace control plane — secrets, routing, jobs |
|
|
78
78
|
| [Starter](/docs/template-starter) | Minimal scaffold — build from scratch |
|
|
@@ -46,7 +46,7 @@ Six rules govern the architecture:
|
|
|
46
46
|
Adopting the framework is valuable mostly because of what you stop having to build. The moment your app follows the six rules, you inherit:
|
|
47
47
|
|
|
48
48
|
- **One action = four surfaces.** Every action defined with `defineAction()` is simultaneously an agent tool, a typesafe frontend mutation (`useActionMutation("name")`), an HTTP endpoint at `/_agent-native/actions/:name`, and an MCP tool (when MCP is enabled). External agents can call it over [A2A](/docs/a2a-protocol) too. One implementation, four consumers.
|
|
49
|
-
- **A full workspace per user.** Skills,
|
|
49
|
+
- **A full workspace 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 [Workspace](/docs/workspace).
|
|
50
50
|
- **Drop-in React components.** `<AgentPanel />` and `<AgentSidebar />` render chat + workspace anywhere in your app. See [Drop-in Agent](/docs/drop-in-agent).
|
|
51
51
|
- **Live sync between agent and UI.** A 2-second poll invalidates React Query caches whenever the agent writes to the DB. No WebSockets, no serverless-unfriendly long-lived connections. See [Polling Sync](#polling-sync) below.
|
|
52
52
|
- **Auth, orgs, RBAC.** Better Auth with orgs/members/roles is wired in for every template. See [Authentication](/docs/authentication).
|