@agent-native/core 0.59.0 → 0.60.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.
Files changed (220) hide show
  1. package/dist/a2a/index.d.ts +2 -0
  2. package/dist/a2a/index.d.ts.map +1 -1
  3. package/dist/a2a/index.js +1 -0
  4. package/dist/a2a/index.js.map +1 -1
  5. package/dist/a2a/invoke.d.ts +63 -0
  6. package/dist/a2a/invoke.d.ts.map +1 -0
  7. package/dist/a2a/invoke.js +157 -0
  8. package/dist/a2a/invoke.js.map +1 -0
  9. package/dist/agent/run-store.d.ts +15 -0
  10. package/dist/agent/run-store.d.ts.map +1 -1
  11. package/dist/agent/run-store.js +28 -0
  12. package/dist/agent/run-store.js.map +1 -1
  13. package/dist/chat-threads/store.d.ts +21 -0
  14. package/dist/chat-threads/store.d.ts.map +1 -1
  15. package/dist/chat-threads/store.js +128 -0
  16. package/dist/chat-threads/store.js.map +1 -1
  17. package/dist/cli/agent.d.ts +23 -0
  18. package/dist/cli/agent.d.ts.map +1 -0
  19. package/dist/cli/agent.js +300 -0
  20. package/dist/cli/agent.js.map +1 -0
  21. package/dist/cli/agents.d.ts +14 -0
  22. package/dist/cli/agents.d.ts.map +1 -0
  23. package/dist/cli/agents.js +95 -0
  24. package/dist/cli/agents.js.map +1 -0
  25. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  26. package/dist/cli/code-agent-executor.js +264 -2
  27. package/dist/cli/code-agent-executor.js.map +1 -1
  28. package/dist/cli/create.d.ts +3 -2
  29. package/dist/cli/create.d.ts.map +1 -1
  30. package/dist/cli/create.js +154 -83
  31. package/dist/cli/create.js.map +1 -1
  32. package/dist/cli/index.js +50 -2
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/invoke.d.ts +26 -0
  35. package/dist/cli/invoke.d.ts.map +1 -0
  36. package/dist/cli/invoke.js +227 -0
  37. package/dist/cli/invoke.js.map +1 -0
  38. package/dist/cli/templates-meta.d.ts +1 -1
  39. package/dist/cli/templates-meta.d.ts.map +1 -1
  40. package/dist/cli/templates-meta.js +9 -8
  41. package/dist/cli/templates-meta.js.map +1 -1
  42. package/dist/cli/workspacify.d.ts +1 -1
  43. package/dist/cli/workspacify.d.ts.map +1 -1
  44. package/dist/cli/workspacify.js +6 -6
  45. package/dist/cli/workspacify.js.map +1 -1
  46. package/dist/client/AgentPanel.js +1 -1
  47. package/dist/client/AgentPanel.js.map +1 -1
  48. package/dist/client/AssistantChat.d.ts.map +1 -1
  49. package/dist/client/AssistantChat.js +8 -2
  50. package/dist/client/AssistantChat.js.map +1 -1
  51. package/dist/client/NewWorkspaceAppFlow.d.ts.map +1 -1
  52. package/dist/client/NewWorkspaceAppFlow.js +5 -4
  53. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  54. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  55. package/dist/client/agent-chat-adapter.js +65 -12
  56. package/dist/client/agent-chat-adapter.js.map +1 -1
  57. package/dist/client/blocks/library/diagram.d.ts.map +1 -1
  58. package/dist/client/blocks/library/diagram.js +23 -17
  59. package/dist/client/blocks/library/diagram.js.map +1 -1
  60. package/dist/client/blocks/types.d.ts +2 -0
  61. package/dist/client/blocks/types.d.ts.map +1 -1
  62. package/dist/client/blocks/types.js.map +1 -1
  63. package/dist/client/chat/index.d.ts +1 -1
  64. package/dist/client/chat/index.d.ts.map +1 -1
  65. package/dist/client/chat/index.js.map +1 -1
  66. package/dist/client/extensions/ExtensionViewer.js +1 -1
  67. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  68. package/dist/client/index.d.ts +1 -1
  69. package/dist/client/index.d.ts.map +1 -1
  70. package/dist/client/index.js.map +1 -1
  71. package/dist/client/notifications/NotificationsBell.d.ts +3 -1
  72. package/dist/client/notifications/NotificationsBell.d.ts.map +1 -1
  73. package/dist/client/notifications/NotificationsBell.js +7 -3
  74. package/dist/client/notifications/NotificationsBell.js.map +1 -1
  75. package/dist/client/use-chat-threads.d.ts +13 -0
  76. package/dist/client/use-chat-threads.d.ts.map +1 -1
  77. package/dist/client/use-chat-threads.js +41 -0
  78. package/dist/client/use-chat-threads.js.map +1 -1
  79. package/dist/integrations/plugin.d.ts.map +1 -1
  80. package/dist/integrations/plugin.js +2 -2
  81. package/dist/integrations/plugin.js.map +1 -1
  82. package/dist/onboarding/default-steps.d.ts.map +1 -1
  83. package/dist/onboarding/default-steps.js +102 -0
  84. package/dist/onboarding/default-steps.js.map +1 -1
  85. package/dist/org/auto-join-domain.d.ts +11 -3
  86. package/dist/org/auto-join-domain.d.ts.map +1 -1
  87. package/dist/org/auto-join-domain.js +7 -6
  88. package/dist/org/auto-join-domain.js.map +1 -1
  89. package/dist/org/context.d.ts.map +1 -1
  90. package/dist/org/context.js +68 -32
  91. package/dist/org/context.js.map +1 -1
  92. package/dist/org/migrations.d.ts.map +1 -1
  93. package/dist/org/migrations.js +6 -0
  94. package/dist/org/migrations.js.map +1 -1
  95. package/dist/provider-api/actions/github-repo-files.d.ts +84 -0
  96. package/dist/provider-api/actions/github-repo-files.d.ts.map +1 -0
  97. package/dist/provider-api/actions/github-repo-files.js +213 -0
  98. package/dist/provider-api/actions/github-repo-files.js.map +1 -0
  99. package/dist/provider-api/github-repo.d.ts +11 -0
  100. package/dist/provider-api/github-repo.d.ts.map +1 -0
  101. package/dist/provider-api/github-repo.js +553 -0
  102. package/dist/provider-api/github-repo.js.map +1 -0
  103. package/dist/provider-api/index.d.ts +184 -11
  104. package/dist/provider-api/index.d.ts.map +1 -1
  105. package/dist/provider-api/index.js +519 -0
  106. package/dist/provider-api/index.js.map +1 -1
  107. package/dist/scripts/docs/search.d.ts.map +1 -1
  108. package/dist/scripts/docs/search.js +38 -13
  109. package/dist/scripts/docs/search.js.map +1 -1
  110. package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
  111. package/dist/secrets/register-framework-secrets.js +11 -0
  112. package/dist/secrets/register-framework-secrets.js.map +1 -1
  113. package/dist/server/agent-chat-plugin.d.ts +32 -0
  114. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  115. package/dist/server/agent-chat-plugin.js +297 -2
  116. package/dist/server/agent-chat-plugin.js.map +1 -1
  117. package/dist/server/auth-marketing.d.ts.map +1 -1
  118. package/dist/server/auth-marketing.js +17 -7
  119. package/dist/server/auth-marketing.js.map +1 -1
  120. package/dist/server/auth.d.ts.map +1 -1
  121. package/dist/server/auth.js +6 -0
  122. package/dist/server/auth.js.map +1 -1
  123. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  124. package/dist/server/core-routes-plugin.js +18 -98
  125. package/dist/server/core-routes-plugin.js.map +1 -1
  126. package/dist/styles/blocks.css +30 -8
  127. package/dist/styles/rich-markdown-editor.css +10 -4
  128. package/dist/templates/{starter-shell-sync.spec.ts → chat-shell-sync.spec.ts} +21 -21
  129. package/dist/templates/default/.agents/skills/actions/SKILL.md +5 -5
  130. package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +63 -0
  131. package/dist/templates/default/AGENTS.md +22 -1
  132. package/dist/templates/default/actions/hello.ts +1 -1
  133. package/dist/templates/default/actions/navigate.ts +1 -1
  134. package/dist/templates/default/actions/view-screen.ts +1 -1
  135. package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +63 -0
  136. package/dist/templates/headless/.env.example +4 -0
  137. package/dist/templates/headless/.prettierrc +5 -0
  138. package/dist/templates/headless/AGENTS.md +58 -0
  139. package/dist/templates/headless/DEVELOPING.md +22 -0
  140. package/dist/templates/headless/_gitignore +36 -0
  141. package/dist/templates/headless/actions/hello.ts +14 -0
  142. package/dist/templates/headless/actions/run.ts +3 -0
  143. package/dist/templates/headless/package.json +22 -0
  144. package/dist/templates/headless/tsconfig.json +7 -0
  145. package/dist/templates/ui-primitives-sync.spec.ts +2 -2
  146. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -5
  147. package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +63 -0
  148. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
  149. package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +93 -0
  150. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
  151. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +1 -1
  152. package/dist/templates/workspace-core/AGENTS.md +20 -3
  153. package/dist/templates/workspace-core/src/server/index.ts +1 -1
  154. package/dist/templates/workspace-root/AGENTS.md +25 -5
  155. package/dist/templates/workspace-root/README.md +7 -7
  156. package/dist/triggers/dispatcher.d.ts +2 -3
  157. package/dist/triggers/dispatcher.d.ts.map +1 -1
  158. package/dist/triggers/dispatcher.js +2 -3
  159. package/dist/triggers/dispatcher.js.map +1 -1
  160. package/dist/triggers/routes.d.ts +38 -0
  161. package/dist/triggers/routes.d.ts.map +1 -0
  162. package/dist/triggers/routes.js +202 -0
  163. package/dist/triggers/routes.js.map +1 -0
  164. package/dist/vite/client.d.ts +2 -1
  165. package/dist/vite/client.d.ts.map +1 -1
  166. package/dist/vite/client.js +121 -2
  167. package/dist/vite/client.js.map +1 -1
  168. package/docs/AGENTS.md +57 -0
  169. package/docs/SKILL.md +40 -0
  170. package/docs/content/a2a-protocol.md +1 -1
  171. package/docs/content/actions.md +48 -8
  172. package/docs/content/agent-surfaces.md +76 -14
  173. package/docs/content/cli-adapters.md +1 -1
  174. package/docs/content/cloneable-saas.md +5 -4
  175. package/docs/content/code-agents-ui.md +1 -1
  176. package/docs/content/components.md +1 -1
  177. package/docs/content/context-awareness.md +15 -3
  178. package/docs/content/creating-templates.md +15 -7
  179. package/docs/content/drop-in-agent.md +1 -1
  180. package/docs/content/faq.md +6 -4
  181. package/docs/content/getting-started.md +63 -73
  182. package/docs/content/key-concepts.md +24 -24
  183. package/docs/content/native-chat-ui.md +4 -4
  184. package/docs/content/pure-agent-apps.md +34 -10
  185. package/docs/content/security.md +1 -1
  186. package/docs/content/server.md +1 -1
  187. package/docs/content/template-chat.md +85 -0
  188. package/docs/content/template-dispatch.md +1 -1
  189. package/docs/content/tracking.md +1 -1
  190. package/docs/content/what-is-agent-native.md +7 -6
  191. package/package.json +10 -1
  192. package/src/templates/{starter-shell-sync.spec.ts → chat-shell-sync.spec.ts} +21 -21
  193. package/src/templates/default/.agents/skills/actions/SKILL.md +5 -5
  194. package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +63 -0
  195. package/src/templates/default/AGENTS.md +22 -1
  196. package/src/templates/default/actions/hello.ts +1 -1
  197. package/src/templates/default/actions/navigate.ts +1 -1
  198. package/src/templates/default/actions/view-screen.ts +1 -1
  199. package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +63 -0
  200. package/src/templates/headless/.env.example +4 -0
  201. package/src/templates/headless/.prettierrc +5 -0
  202. package/src/templates/headless/AGENTS.md +58 -0
  203. package/src/templates/headless/DEVELOPING.md +22 -0
  204. package/src/templates/headless/_gitignore +36 -0
  205. package/src/templates/headless/actions/hello.ts +14 -0
  206. package/src/templates/headless/actions/run.ts +3 -0
  207. package/src/templates/headless/package.json +22 -0
  208. package/src/templates/headless/tsconfig.json +7 -0
  209. package/src/templates/ui-primitives-sync.spec.ts +2 -2
  210. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -5
  211. package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +63 -0
  212. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
  213. package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +93 -0
  214. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
  215. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +1 -1
  216. package/src/templates/workspace-core/AGENTS.md +20 -3
  217. package/src/templates/workspace-core/src/server/index.ts +1 -1
  218. package/src/templates/workspace-root/AGENTS.md +25 -5
  219. package/src/templates/workspace-root/README.md +7 -7
  220. package/docs/content/template-starter.md +0 -78
package/docs/AGENTS.md ADDED
@@ -0,0 +1,57 @@
1
+ # Agent Native Docs For Agents
2
+
3
+ These docs are bundled with `@agent-native/core` and installed at:
4
+
5
+ ```txt
6
+ node_modules/@agent-native/core/docs
7
+ ```
8
+
9
+ Use these version-matched markdown docs before coding against Agent Native
10
+ framework APIs or advanced features. Public docs are useful for browsing, but
11
+ the package docs match the exact framework version installed in the app.
12
+
13
+ ## Fast Lookup
14
+
15
+ From a generated app root:
16
+
17
+ ```bash
18
+ pnpm action docs-search --list
19
+ pnpm action docs-search --query "actions"
20
+ pnpm action docs-search --slug actions
21
+ ```
22
+
23
+ The built-in app agent also has a read-only `docs-search` tool with the same
24
+ `list`, `query`, and `slug` options.
25
+
26
+ If the action runner is unavailable, search the markdown files directly:
27
+
28
+ ```bash
29
+ rg -n "actions|automations|a2a|sharing" node_modules/@agent-native/core/docs
30
+ ```
31
+
32
+ Then read the matching files under `node_modules/@agent-native/core/docs/content/`.
33
+
34
+ ## What To Read First
35
+
36
+ | Task | Start with |
37
+ | ------------------------------------- | -------------------------------------------------------------------------------------------------------- |
38
+ | Define or call app operations | `content/actions.md`, `content/client.md` |
39
+ | Add SQL data, schema, or access rules | `content/database.md`, `content/security.md`, `content/sharing.md` |
40
+ | Keep the UI and agent in sync | `content/context-awareness.md`, `content/client.md` |
41
+ | Build headless or chat-first apps | `content/pure-agent-apps.md`, `content/agent-surfaces.md`, `content/using-your-agent.md` |
42
+ | Add automations or scheduled work | `content/automations.md`, `content/recurring-jobs.md` |
43
+ | Compose apps or call sibling agents | `content/a2a-protocol.md`, `content/multi-app-workspace.md`, `content/workspace.md` |
44
+ | Expose tools to external agents | `content/external-agents.md`, `content/mcp-protocol.md`, `content/mcp-apps.md`, `content/mcp-clients.md` |
45
+ | Add integrations, setup, or secrets | `content/onboarding.md`, `content/workspace-connections.md`, `content/security.md` |
46
+ | Build extensions or custom widgets | `content/extensions.md`, `content/agent-web-surfaces.md` |
47
+ | Deploy or configure hosting | `content/deployment.md`, `content/server.md` |
48
+ | Write agent instructions or skills | `content/skills-guide.md`, `content/writing-agent-instructions.md` |
49
+
50
+ ## Rules
51
+
52
+ - Prefer the app's own `AGENTS.md` and `.agents/skills/` for app-specific
53
+ behavior. Use this package docs tree for framework APIs and patterns.
54
+ - If local instructions and package docs conflict, local app instructions win
55
+ for that app, but verify the framework API shape in package docs or types.
56
+ - Do not invent Agent Native APIs. Search these docs and installed type
57
+ definitions before adding imports, routes, actions, or framework config.
package/docs/SKILL.md ADDED
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: agent-native-docs
3
+ description: "How to look up version-matched Agent Native framework docs in node_modules. Use before coding against @agent-native/core APIs or advanced features."
4
+ ---
5
+
6
+ # Agent Native Docs Lookup
7
+
8
+ ## Rule
9
+
10
+ Before implementing non-trivial Agent Native functionality, read the
11
+ version-matched docs installed with `@agent-native/core`.
12
+
13
+ ## How
14
+
15
+ 1. Start from the generated app root.
16
+ 2. Search with `pnpm action docs-search --query "<feature>"`.
17
+ 3. Read a specific page with `pnpm action docs-search --slug <slug>`.
18
+ 4. If the action runner is unavailable, search
19
+ `node_modules/@agent-native/core/docs` directly with `rg`.
20
+ 5. For app-specific rules, also read the app's own `AGENTS.md` and any relevant
21
+ `.agents/skills/<name>/SKILL.md`.
22
+
23
+ ## Useful Slugs
24
+
25
+ | Need | Slugs |
26
+ | --- | --- |
27
+ | Actions and typed client calls | `actions`, `client` |
28
+ | SQL, auth, access, sharing | `database`, `authentication`, `security`, `sharing` |
29
+ | UI state visible to the agent | `context-awareness` |
30
+ | Headless and chat-first apps | `pure-agent-apps`, `agent-surfaces`, `using-your-agent` |
31
+ | Automations and schedules | `automations`, `recurring-jobs` |
32
+ | Cross-app and external agents | `a2a-protocol`, `external-agents`, `mcp-protocol`, `mcp-apps` |
33
+ | Skills and instructions | `skills-guide`, `writing-agent-instructions` |
34
+
35
+ ## Don't
36
+
37
+ - Do not rely on memory for framework APIs when local package docs are present.
38
+ - Do not add custom REST wrappers for normal app data before reading `actions`.
39
+ - Do not add inline LLM calls before reading `using-your-agent` and
40
+ `agent-surfaces`.
@@ -305,7 +305,7 @@ A mail agent needs analytics data. The analytics agent exposes a "run-query" ski
305
305
 
306
306
  ```ts
307
307
  // In the mail agent's actions/get-analytics.ts
308
- import { defineAction } from "@agent-native/core/server";
308
+ import { defineAction } from "@agent-native/core/action";
309
309
  import { callAgent } from "@agent-native/core/a2a";
310
310
  import { z } from "zod";
311
311
 
@@ -19,11 +19,51 @@ One definition, seven consumers. This is rung 3 of the [ladder](/docs/what-is-ag
19
19
  If you are deciding whether to expose an operation headlessly, in chat, in an
20
20
  embedded sidecar, or as a full app screen, see [Agent Surfaces](/docs/agent-surfaces).
21
21
 
22
+ ## Start with one action {#hello-action}
23
+
24
+ The primitive-first on-ramp is one action, not a template. In a headless
25
+ scaffold such as `agent-native create my-agent --headless`, this can be the
26
+ whole first app:
27
+
28
+ ```ts
29
+ // actions/hello.ts
30
+ import { defineAction } from "@agent-native/core/action";
31
+ import { z } from "zod";
32
+
33
+ export default defineAction({
34
+ description: "Say hello from the local agent.",
35
+ schema: z.object({
36
+ name: z.string().default("world"),
37
+ }),
38
+ http: { method: "GET" },
39
+ readOnly: true,
40
+ run: async ({ name }) => {
41
+ return { message: `Hello, ${name}!` };
42
+ },
43
+ });
44
+ ```
45
+
46
+ Run it from the same folder:
47
+
48
+ ```bash
49
+ pnpm action hello --name Steve
50
+ ```
51
+
52
+ Then run the app-agent loop against the folder:
53
+
54
+ ```bash
55
+ pnpm agent "Call hello for Steve and explain the result"
56
+ ```
57
+
58
+ That is the same app-agent loop your scheduled jobs, chat UI, external MCP
59
+ tools, and future screens will use. Chat and domain templates are for adding UI
60
+ around actions, not a required prerequisite for the action itself.
61
+
22
62
  ## Defining an action {#defining}
23
63
 
24
64
  ```ts
25
65
  // actions/reply-to-email.ts
26
- import { defineAction } from "@agent-native/core";
66
+ import { defineAction } from "@agent-native/core/action";
27
67
  import { z } from "zod";
28
68
 
29
69
  export default defineAction({
@@ -229,7 +269,7 @@ User-owned tables must scope reads through `accessFilter` and writes through `as
229
269
 
230
270
  ```ts
231
271
  // actions/create-lead.ts
232
- import { defineAction } from "@agent-native/core";
272
+ import { defineAction } from "@agent-native/core/action";
233
273
  import { z } from "zod";
234
274
  import { getDb } from "../server/db/index.js";
235
275
  import * as schema from "../server/db/schema.js";
@@ -315,12 +355,12 @@ summaries, and insight cards; use [MCP Apps](/docs/mcp-apps) for inline UI in
315
355
  external MCP hosts.
316
356
 
317
357
  ```ts
358
+ import { defineAction } from "@agent-native/core/action";
359
+ import { ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER } from "@agent-native/core/action-ui";
318
360
  import {
319
- ACTION_CHAT_UI_DATA_INSIGHTS_RENDERER,
361
+ createDataInsightsWidgetResult,
320
362
  dataInsightsWidgetResultSchema,
321
- defineAction,
322
- } from "@agent-native/core";
323
- import { createDataInsightsWidgetResult } from "@agent-native/core/data-widgets";
363
+ } from "@agent-native/core/data-widgets";
324
364
 
325
365
  export default defineAction({
326
366
  description: "Summarize response trends.",
@@ -411,7 +451,7 @@ Reads the current navigation state, fetches contextual data, and returns a snaps
411
451
 
412
452
  ```ts
413
453
  // actions/view-screen.ts
414
- import { defineAction } from "@agent-native/core";
454
+ import { defineAction } from "@agent-native/core/action";
415
455
  import { readAppState } from "@agent-native/core/application-state";
416
456
  import { z } from "zod";
417
457
 
@@ -438,7 +478,7 @@ Writes a one-shot navigation command to application state. The UI reads it, navi
438
478
 
439
479
  ```ts
440
480
  // actions/navigate.ts
441
- import { defineAction } from "@agent-native/core";
481
+ import { defineAction } from "@agent-native/core/action";
442
482
  import { writeAppState } from "@agent-native/core/application-state";
443
483
  import { z } from "zod";
444
484
 
@@ -13,13 +13,13 @@ application.
13
13
  The useful way to choose is not by protocol first. Choose the product surface
14
14
  you want, then use the matching primitive.
15
15
 
16
- | Surface | Use it when | Start with |
17
- | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
18
- | **Headless agent/actions** | Code, jobs, scripts, another app, or another agent should call the work directly. | `defineAction`, HTTP, CLI, MCP, A2A |
19
- | **Rich chat on Agent-Native** | You want a standalone or embedded chat backed by the built-in agent loop. | `<AgentChatSurface>`, `<AssistantChat>`, `createAgentChatPlugin()` |
20
- | **Rich chat on your agent** | You built the agent elsewhere and want Agent-Native's composer, transcript, tool cards, and native widgets. | `AgentChatRuntime`, `<AssistantChat runtime={runtime}>` |
21
- | **Embedded sidecar** | You already have a SaaS app and want an agent beside it with page context and host commands. | `createAgentNativeEmbeddedPlugin()`, `AgentNativeEmbedded` |
22
- | **Full application** | Humans and agents should share durable screens, data, navigation, and collaboration. | Templates, actions, SQL state, context awareness |
16
+ | Surface | Use it when | Start with |
17
+ | ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
18
+ | **Headless agent/actions** | Code, jobs, scripts, another app, or another agent should call the work directly. | `agent-native create --headless`, `defineAction`, `agent-native agent`, HTTP, CLI, MCP, A2A |
19
+ | **Rich chat on Agent-Native** | You want a standalone or embedded chat backed by the built-in agent loop. | [Chat template](/docs/template-chat), `<AgentChatSurface>`, `<AssistantChat>` |
20
+ | **Rich chat on your agent** | You built the agent elsewhere and want Agent-Native's composer, transcript, tool cards, and native widgets. | `AgentChatRuntime`, `<AssistantChat runtime={runtime}>` |
21
+ | **Embedded sidecar** | You already have a SaaS app and want an agent beside it with page context and host commands. | `createAgentNativeEmbeddedPlugin()`, `AgentNativeEmbedded` |
22
+ | **Full application** | Humans and agents should share durable screens, data, navigation, and collaboration. | Templates, actions, SQL state, context awareness |
23
23
 
24
24
  Those are stages, not separate products. A workflow can start as a headless
25
25
  action, appear in chat as a table or chart, and later become a full screen in an
@@ -31,11 +31,19 @@ Use the headless path when no one needs to stare at a custom app screen while
31
31
  the work runs: scheduled jobs, integrations, backend workflows, CLI loops,
32
32
  another agent, or an existing product calling into Agent-Native.
33
33
 
34
- Most headless integrations should start with actions:
34
+ The smallest local path is a headless scaffold plus one action:
35
+
36
+ ```bash
37
+ npx @agent-native/core@latest create my-agent --headless
38
+ cd my-agent
39
+ pnpm install
40
+ ```
41
+
42
+ Then define the durable operation:
35
43
 
36
44
  ```ts
37
45
  // actions/summarize-week.ts
38
- import { defineAction } from "@agent-native/core";
46
+ import { defineAction } from "@agent-native/core/action";
39
47
  import { z } from "zod";
40
48
 
41
49
  export default defineAction({
@@ -52,14 +60,26 @@ One action is then callable as:
52
60
 
53
61
  - **HTTP** — `POST /_agent-native/actions/summarize-week`
54
62
  - **CLI** — `pnpm action summarize-week --formId form_123`
63
+ - **App-agent CLI** — `pnpm agent "Summarize form_123"`
55
64
  - **MCP** — from Claude, ChatGPT, Codex, Cursor, OpenCode, Copilot, and other MCP hosts
56
65
  - **A2A** — from another agent-native app or agent peer
57
66
  - **UI** — through `useActionQuery`, `useActionMutation`, or `callAction`
58
67
  - **Agent tool** — from the built-in chat loop
59
68
 
60
- If you need the whole agent loop headlessly, use the server API from a worker,
61
- job, integration webhook, or custom host. This is lower-level than actions: you
62
- provide the engine, model, messages, actions, and event sink yourself.
69
+ This is not a no-database or stateless mode. The app-agent loop stores sessions,
70
+ threads, runs, settings, credentials, application state, and share records in
71
+ SQL. Local development defaults to SQLite; hosted headless apps should use a
72
+ persistent SQL database.
73
+
74
+ If you need the whole agent loop headlessly from the project folder, use:
75
+
76
+ ```bash
77
+ pnpm agent "Summarize this week's forms."
78
+ ```
79
+
80
+ Workers, jobs, integration webhooks, and custom hosts can use the server API
81
+ directly. This is lower-level than actions: you provide the engine, model,
82
+ messages, actions, and event sink yourself.
63
83
 
64
84
  ```ts
65
85
  import {
@@ -97,11 +117,49 @@ For most apps, scheduled prompts and integration webhooks already call this loop
97
117
  for you. Reach for direct `runAgentLoop()` when you are building a custom
98
118
  headless host, eval runner, or server-side orchestration surface.
99
119
 
120
+ ### Running against a folder {#folder-loop}
121
+
122
+ If your goal is "run an agent against this folder," start with the app-agent
123
+ loop in that folder: scaffold the headless app, add actions/instructions, run
124
+ `pnpm agent "..."`. That keeps the work inside the same action/runtime/state
125
+ contract the app will use in production.
126
+
127
+ External coding harnesses are a separate product surface for embedding Claude
128
+ Code, Codex, Pi, Cursor, Mastra, or similar runtimes inside an Agent-Native app.
129
+ Use them when you are building a coding-agent product, not as the default way to
130
+ start a local agent-native workflow.
131
+
132
+ ### Cloud repo access {#cloud-repo-access}
133
+
134
+ For cloud headless apps that need repository access, the planned model is a
135
+ GitHub connector plus token CRUD: list repositories, search files, read files,
136
+ create or edit files, delete files, and revoke access through provider-scoped
137
+ credentials.
138
+
139
+ Do not treat a VM clone or long-lived sandbox checkout as the primary cloud
140
+ repo-access model. Sandboxes still matter for isolated code execution, but
141
+ repository access should be explicit, permissioned, auditable, and revocable
142
+ through the connector layer.
143
+
144
+ ### Sharing sessions and runs {#sharing-runs}
145
+
146
+ Headless sessions and runs are durable objects. Shareability should be phased:
147
+ read/share links first, so teammates can inspect sanitized prompts, outputs,
148
+ and run status; permissioned writable collaboration later, so continuing a run,
149
+ approving actions, editing schedules, or changing configuration goes through
150
+ explicit access checks.
151
+
100
152
  ## Rich chat on Agent-Native {#rich-chat}
101
153
 
102
154
  Use the built-in chat when the user should talk to the agent, see tool calls,
103
155
  approve work, inspect native results, and keep a durable thread history.
104
156
 
157
+ For a full app starting point, use the [Chat template](/docs/template-chat):
158
+
159
+ ```bash
160
+ npx @agent-native/core@latest create my-chat-app --template chat
161
+ ```
162
+
105
163
  The simplest full-page chat:
106
164
 
107
165
  ```tsx
@@ -131,6 +189,9 @@ components in the chat, without iframes. See [Native Chat UI](/docs/native-chat-
131
189
  Use this path when your agent is already built with another framework or
132
190
  runtime and you want Agent-Native's chat UI around it.
133
191
 
192
+ The [Chat template](/docs/template-chat) is still useful here: keep its app
193
+ shell and thread UI, then swap the runtime behind the chat plugin or route.
194
+
134
195
  `AgentChatRuntime` is the boundary. Your runtime streams normalized events;
135
196
  Agent-Native renders the composer, transcript, tool calls, approvals, native
136
197
  widgets, and app layout.
@@ -245,8 +306,9 @@ Full apps add product UI around the same action and agent contract:
245
306
  - **Deep links** — action results can open the right app view.
246
307
  - **Native chat widgets** — tables, charts, cards, approvals, and typed results appear inline.
247
308
 
248
- Start from a [template](/docs/cloneable-saas) when you want a complete app, or
249
- from [Starter](/docs/template-starter) when you want only the framework wiring.
309
+ Start from the [Chat template](/docs/template-chat) when you want a minimal app
310
+ around your actions, or from a domain [template](/docs/cloneable-saas) when you
311
+ want a complete product shape.
250
312
 
251
313
  ## How to choose {#how-to-choose}
252
314
 
@@ -228,7 +228,7 @@ Actions can use CLI adapters directly for structured access:
228
228
 
229
229
  ```ts
230
230
  // actions/list-prs.ts
231
- import { defineAction } from "@agent-native/core/server";
231
+ import { defineAction } from "@agent-native/core/action";
232
232
  import { ShellCliAdapter } from "@agent-native/core/adapters/cli";
233
233
  import { z } from "zod";
234
234
 
@@ -15,6 +15,7 @@ Each one is a real app you could use today, and the launching pad for your own v
15
15
 
16
16
  | Template | What it is |
17
17
  | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
18
+ | [**Chat**](/docs/template-chat) | Minimal chat-first app with durable threads, actions, auth, and a clean path to custom UI or your own backend. |
18
19
  | [**Mail**](/docs/template-mail) | An agent-native Superhuman. Inbox, labels, AI triage, keyboard-first, drafts and sends through the agent. |
19
20
  | [**Calendar**](/docs/template-calendar) | An agent-native Google Calendar. Events, sync, public booking links, agent-driven scheduling. |
20
21
  | [**Content**](/docs/template-content) | Open-source Obsidian for MDX. Local Markdown/MDX, Tiptap editor, Notion sync, real-time multi-user collab. |
@@ -29,7 +30,7 @@ Each one is a real app you could use today, and the launching pad for your own v
29
30
  | [**Plan**](/docs/template-plan) | Visual plans and PR recaps with diagrams, wireframes, and annotations. |
30
31
  | [**Dispatch**](/docs/template-dispatch) | The workspace control plane: shared secrets, reusable integrations, Slack/Telegram, scheduled jobs. |
31
32
 
32
- Don't want a domain template? See [Pure-Agent Apps / Starter](/docs/pure-agent-apps) for the minimal scaffold.
33
+ Don't want a domain template? Use [Chat](/docs/template-chat) when you want a basic app users can talk to immediately, or start action-first with [Pure-Agent Apps](/docs/pure-agent-apps).
33
34
 
34
35
  See the full catalog under [Templates](/templates), or jump straight to one — for example, [Dispatch](/docs/template-dispatch) is a great place to start if you want a workspace-style app.
35
36
 
@@ -72,11 +73,11 @@ You don't have to. Every template is also available as a hosted app on `agent-na
72
73
 
73
74
  ## Try it with a skill {#try-with-a-skill}
74
75
 
75
- Not ready to scaffold? You can add agent-native superpowers to a coding agent you already use with a single command — no app needed. See [Try it with a skill](/docs/getting-started#try-with-a-skill) in Getting Started.
76
+ Not ready to scaffold? You can add agent-native superpowers to a coding agent you already use with a single command — no app needed. See the [Skills Guide](/docs/skills-guide#app-backed-skills).
76
77
 
77
78
  ## Building on this
78
79
 
79
- - [**Getting Started**](/docs/getting-started) — clone your first template and run it locally
80
+ - [**Getting Started**](/docs/getting-started) — create a minimal chat app or headless action
80
81
  - [**Messaging the agent**](/docs/messaging) — how users (and you) talk to the agent that ships with each template
81
82
  - [**Multi-App Workspace**](/docs/multi-app-workspace) — bundle several templates into one workspace that shares auth, brand, and agent
82
83
  - [**Dispatch**](/docs/template-dispatch) — the workspace control plane template
@@ -90,7 +91,7 @@ If you're scaffolding now, the CLI command is:
90
91
  npx @agent-native/core@latest create my-platform
91
92
  ```
92
93
 
93
- You'll get a multi-select picker. Pick one app (standalone) or several (workspace — apps share auth, brand, agent config, and database). Each picked template is scaffolded into `apps/<name>/` with every file you need.
94
+ You'll get a multi-select picker. Pick one app (standalone) or several (workspace — apps share auth, brand, agent config, and database). Each picked template is scaffolded into `apps/<name>/` with every file you need. For an action-only app instead of a template UI, use `npx @agent-native/core@latest create my-agent --headless`.
94
95
 
95
96
  Fill in `.env` (mostly `ANTHROPIC_API_KEY` and `DATABASE_URL`), `pnpm install`, `pnpm dev`, and it works. No "TODO: implement login," no placeholder routes.
96
97
 
@@ -67,7 +67,7 @@ That separation matters. The UI can be reused by templates, but native process c
67
67
  The old hidden `code` template has been removed. To build a browser-hosted Code surface, create a normal app and mount the shared UI package with a host implementation:
68
68
 
69
69
  ```bash
70
- npx @agent-native/core@latest create my-code-ui --template starter
70
+ npx @agent-native/core@latest create my-code-ui --template chat
71
71
  cd my-code-ui
72
72
  pnpm add @agent-native/code-agents-ui
73
73
  pnpm install
@@ -338,7 +338,7 @@ If you truly need raw text-in/text-out, keep it server-side and use
338
338
  action so the UI and agent share the same capability.
339
339
 
340
340
  ```ts
341
- import { defineAction } from "@agent-native/core";
341
+ import { defineAction } from "@agent-native/core/action";
342
342
  import { completeText } from "@agent-native/core/server";
343
343
 
344
344
  export default defineAction({
@@ -186,7 +186,7 @@ Every template should have a `view-screen` action. It reads navigation and selec
186
186
 
187
187
  ```ts
188
188
  // actions/view-screen.ts
189
- import { defineAction } from "@agent-native/core";
189
+ import { defineAction } from "@agent-native/core/action";
190
190
  import { readAppState } from "@agent-native/core/application-state";
191
191
  import { eq, inArray } from "drizzle-orm";
192
192
  import { z } from "zod";
@@ -305,6 +305,15 @@ On the UI side you never poll or delete this key by hand. Both directions -- wri
305
305
 
306
306
  The `navigation` key belongs to the UI; the agent must never write to it directly. The agent writes `navigate`, the UI performs the move, and that move is what updates `navigation`.
307
307
 
308
+ When the destination has a real URL, include a same-origin `path` on the
309
+ `navigate` command and have the UI prefer that path before falling back to
310
+ semantic fields. Keep app navigation single-channel: do not write both
311
+ `navigate` and `__set_url__` for the same move. `__set_url__` is for the
312
+ framework URL tools (`set-url-path`, `set-search-params`) and URL-only filter
313
+ changes. For commands that can arrive while chat is streaming, commit the route
314
+ with `navigate(path, { replace: true, flushSync: true })` instead of wrapping it
315
+ in a view transition so the address bar and visible page stay together.
316
+
308
317
  ## The useNavigationState hook {#use-navigation-state}
309
318
 
310
319
  `useNavigationState` is **your app's hook, not a framework import.** Every template ships one at `app/hooks/use-navigation-state.ts` and calls it once from the app shell (`root.tsx`). It is the single place that wires navigation in both directions:
@@ -322,6 +331,7 @@ import { TAB_ID } from "@/lib/tab-id";
322
331
  interface NavigationState {
323
332
  view: "inbox" | "thread";
324
333
  threadId?: string;
334
+ path?: string;
325
335
  }
326
336
 
327
337
  export function useNavigationState() {
@@ -337,9 +347,11 @@ export function useNavigationState() {
337
347
 
338
348
  // agent → UI: turn a `navigate` command into a route to push.
339
349
  getCommandPath: (command) =>
340
- command.view === "thread" && command.threadId
350
+ command.path ??
351
+ (command.view === "thread" && command.threadId
341
352
  ? `/thread/${command.threadId}`
342
- : "/",
353
+ : "/"),
354
+ navigateOptions: { replace: true, flushSync: true },
343
355
  });
344
356
  }
345
357
  ```
@@ -17,21 +17,23 @@ A good template:
17
17
  - Registers onboarding steps for required providers and secrets.
18
18
  - Works as a standalone app and as part of a multi-app workspace.
19
19
 
20
- ## Start from Starter {#start-from-starter}
20
+ ## Start from Chat {#start-from-chat}
21
21
 
22
- Use the CLI-only Starter scaffold when you want a blank app with the framework wiring already in place:
22
+ Use the Chat template when you want a minimal app with the framework wiring already in place:
23
23
 
24
24
  ```bash
25
- npx @agent-native/core@latest create my-template --template starter --standalone
25
+ npx @agent-native/core@latest create my-template --template chat --standalone
26
26
  ```
27
27
 
28
- For a workspace with multiple apps, run the picker and include Starter with any domain templates you want:
28
+ For a workspace with multiple apps, run the picker and include Chat with any domain templates you want:
29
29
 
30
30
  ```bash
31
31
  npx @agent-native/core@latest create my-platform
32
32
  ```
33
33
 
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.
34
+ Chat gives you auth, durable chat threads, SQL-backed resources, tools, application state, actions, and polling sync. You add the domain model and product UI.
35
+
36
+ If you are not building a reusable UI template yet, use the headless on-ramp in [Getting Started](/docs/getting-started#create-your-agent): define one action, run it with `pnpm agent`, and add UI later when the workflow needs a durable surface.
35
37
 
36
38
  ## Project Structure {#project-structure}
37
39
 
@@ -137,7 +139,7 @@ Actions are the single source of truth for app behavior. The agent calls them as
137
139
 
138
140
  ```ts
139
141
  // actions/create-project.ts
140
- import { defineAction } from "@agent-native/core";
142
+ import { defineAction } from "@agent-native/core/action";
141
143
  import { getDb } from "../server/db/index.js"; // getDb is created per app via createGetDb(schema) in server/db/index.ts
142
144
  import { nanoid } from "nanoid";
143
145
  import { z } from "zod";
@@ -234,15 +236,20 @@ export function useNavigationState() {
234
236
  selectedId: searchParams.get("id"),
235
237
  }),
236
238
  getCommandPath: (command: any) => command.path ?? "/",
239
+ navigateOptions: { replace: true, flushSync: true },
237
240
  });
238
241
  }
239
242
  ```
240
243
 
241
244
  Keep shareable filters in URL query params. The framework exposes them to the agent as `<current-url>` and the built-in agent can change them with `set-search-params`; `navigation` should hold semantic IDs and aliases, not a second copy of the full query string.
242
245
 
246
+ For app navigation, prefer one `navigate` command that includes a same-origin
247
+ `path` when the URL is known. Do not also write `__set_url__` for the same move;
248
+ that key is reserved for the framework URL tools and URL-only filter changes.
249
+
243
250
  ```ts
244
251
  // actions/navigate.ts
245
- import { defineAction } from "@agent-native/core";
252
+ import { defineAction } from "@agent-native/core/action";
246
253
  import { writeAppState } from "@agent-native/core/application-state";
247
254
  import { z } from "zod";
248
255
 
@@ -251,6 +258,7 @@ export default defineAction({
251
258
  schema: z.object({
252
259
  view: z.enum(["home", "project"]),
253
260
  projectId: z.string().optional(),
261
+ path: z.string().optional(),
254
262
  }),
255
263
  run: async (args) => {
256
264
  await writeAppState("navigate", args);
@@ -255,7 +255,7 @@ history, run state, or user steering, use `completeText()` from
255
255
  an action so the UI and agent share the same operation.
256
256
 
257
257
  ```ts
258
- import { defineAction } from "@agent-native/core";
258
+ import { defineAction } from "@agent-native/core/action";
259
259
  import { completeText } from "@agent-native/core/server";
260
260
 
261
261
  export default defineAction({
@@ -11,13 +11,15 @@ Common questions about agent-native, organized from "I'm just looking" to "I'm w
11
11
 
12
12
  ### What is agent-native? {#what-is-agent-native}
13
13
 
14
- Agent-native is a framework for building apps where the AI agent and the UI are equal partners. They share the same database, the same state, and they always stay in sync. Everything the UI can do, the agent can do and vice versa. See [What Is Agent-Native?](/docs/what-is-agent-native) for the full explanation.
14
+ Agent-native is a framework for building apps where the AI agent and the product surface around it are equal partners. That surface can start as one headless action, grow into rich chat, or become a full UI. The invariant is that agents and humans share the same actions, database, and state. See [What Is Agent-Native?](/docs/what-is-agent-native) for the full explanation.
15
15
 
16
16
  ### Who is this for? {#who-is-this-for}
17
17
 
18
18
  Agent-native is for people who want a real app and an AI agent to work from the same data and actions. The common paths are:
19
19
 
20
20
  - **Use a hosted app** if you want Mail, Calendar, Forms, Plan, or another finished template with no setup — start at the [template gallery](/templates).
21
+ - **Start with Chat** if you want a basic app users can talk to immediately, then extend with actions and screens — start with [Getting Started](/docs/getting-started) or [Chat](/docs/template-chat).
22
+ - **Start primitive-first** if you want one action and a headless app-agent loop before committing to UI — start with [Getting Started](/docs/getting-started).
21
23
  - **Fork and customize a template** if you want your own SaaS product with auth, database, UI, and agent actions already wired — see [Templates](/docs/cloneable-saas).
22
24
  - **Build from scratch** if you want the framework primitives for a new agent-driven product — start with [Getting Started](/docs/getting-started).
23
25
  - **Connect another agent or code tool** if you want Claude, ChatGPT, Codex, Cursor, or GitHub Copilot / VS Code to use an agent-native app — see [External Agents](/docs/external-agents) and [Skills Guide](/docs/skills-guide).
@@ -59,7 +61,7 @@ You can, but agent-native works best when built from the ground up. The architec
59
61
 
60
62
  ### What templates are available? {#what-templates-are-available}
61
63
 
62
- The framework ships with production-ready templates including [Mail](/docs/template-mail), [Calendar](/docs/template-calendar), [Forms](/docs/template-forms), [Plan](/docs/template-plan) (visual plans and PR recaps), [Analytics](/docs/template-analytics), [Dispatch](/docs/template-dispatch), and more. Each is a complete app with UI, agent actions, database schema, and AI instructions ready to go. See [Templates](/docs/cloneable-saas) for the full catalog.
64
+ The framework ships with production-ready templates including [Chat](/docs/template-chat), [Mail](/docs/template-mail), [Calendar](/docs/template-calendar), [Forms](/docs/template-forms), [Plan](/docs/template-plan) (visual plans and PR recaps), [Analytics](/docs/template-analytics), [Dispatch](/docs/template-dispatch), and more. Each is a complete app with UI, agent actions, database schema, and AI instructions ready to go. See [Templates](/docs/cloneable-saas) for the full catalog.
63
65
 
64
66
  ### Can I customize templates? {#can-i-customize-templates}
65
67
 
@@ -67,11 +69,11 @@ That's the whole point. Fork a template and customize it by asking the agent. "A
67
69
 
68
70
  ### Can I build something the templates don't cover? {#build-from-scratch}
69
71
 
70
- Yes. Run `npx @agent-native/core@latest create my-app` and accept the default **Starter** selection in the picker (or pass `--template starter`) you get the framework scaffolding (frontend, backend, agent panel, database) but no domain-specific code. See [Getting Started](/docs/getting-started). For agent-first products with no traditional UI, see [Pure-Agent Apps](/docs/pure-agent-apps).
72
+ Yes. If you want a basic chat app, run `npx @agent-native/core@latest create my-chat-app --template chat`; you get durable chat threads, actions, auth, SQL-backed runtime state, and room to add your own screens. If you want the smallest action-first app with no UI, run `npx @agent-native/core@latest create my-agent --headless`. See [Getting Started](/docs/getting-started), [Pure-Agent Apps](/docs/pure-agent-apps), and [Chat](/docs/template-chat).
71
73
 
72
74
  ### Can I try it without forking a template? {#try-with-a-skill}
73
75
 
74
- Yes — install a skill into a coding agent you already use with one command and no scaffold required. See [Try it with a skill](/docs/getting-started#try-with-a-skill) in Getting Started for the full walkthrough.
76
+ Yes — install a skill into a coding agent you already use with one command and no scaffold required. See the [Skills Guide](/docs/skills-guide#app-backed-skills) for the walkthrough.
75
77
 
76
78
  ## Agent capabilities {#agent-capabilities}
77
79