@agent-native/core 0.59.1 → 0.61.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 (201) 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/NewWorkspaceAppFlow.d.ts.map +1 -1
  47. package/dist/client/NewWorkspaceAppFlow.js +5 -4
  48. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  49. package/dist/client/blocks/library/diagram.d.ts.map +1 -1
  50. package/dist/client/blocks/library/diagram.js +23 -17
  51. package/dist/client/blocks/library/diagram.js.map +1 -1
  52. package/dist/client/blocks/types.d.ts +2 -0
  53. package/dist/client/blocks/types.d.ts.map +1 -1
  54. package/dist/client/blocks/types.js.map +1 -1
  55. package/dist/client/chat/index.d.ts +1 -1
  56. package/dist/client/chat/index.d.ts.map +1 -1
  57. package/dist/client/chat/index.js.map +1 -1
  58. package/dist/client/index.d.ts +1 -1
  59. package/dist/client/index.d.ts.map +1 -1
  60. package/dist/client/index.js.map +1 -1
  61. package/dist/client/settings/useBuilderStatus.d.ts +10 -0
  62. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  63. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  64. package/dist/client/use-chat-threads.d.ts +13 -0
  65. package/dist/client/use-chat-threads.d.ts.map +1 -1
  66. package/dist/client/use-chat-threads.js +41 -0
  67. package/dist/client/use-chat-threads.js.map +1 -1
  68. package/dist/integrations/plugin.d.ts.map +1 -1
  69. package/dist/integrations/plugin.js +2 -2
  70. package/dist/integrations/plugin.js.map +1 -1
  71. package/dist/onboarding/default-steps.d.ts.map +1 -1
  72. package/dist/onboarding/default-steps.js +102 -0
  73. package/dist/onboarding/default-steps.js.map +1 -1
  74. package/dist/provider-api/actions/github-repo-files.d.ts +84 -0
  75. package/dist/provider-api/actions/github-repo-files.d.ts.map +1 -0
  76. package/dist/provider-api/actions/github-repo-files.js +213 -0
  77. package/dist/provider-api/actions/github-repo-files.js.map +1 -0
  78. package/dist/provider-api/github-repo.d.ts +11 -0
  79. package/dist/provider-api/github-repo.d.ts.map +1 -0
  80. package/dist/provider-api/github-repo.js +553 -0
  81. package/dist/provider-api/github-repo.js.map +1 -0
  82. package/dist/provider-api/index.d.ts +184 -11
  83. package/dist/provider-api/index.d.ts.map +1 -1
  84. package/dist/provider-api/index.js +519 -0
  85. package/dist/provider-api/index.js.map +1 -1
  86. package/dist/scripts/docs/search.d.ts.map +1 -1
  87. package/dist/scripts/docs/search.js +38 -13
  88. package/dist/scripts/docs/search.js.map +1 -1
  89. package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
  90. package/dist/secrets/register-framework-secrets.js +11 -0
  91. package/dist/secrets/register-framework-secrets.js.map +1 -1
  92. package/dist/server/agent-chat-plugin.d.ts +32 -0
  93. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  94. package/dist/server/agent-chat-plugin.js +297 -2
  95. package/dist/server/agent-chat-plugin.js.map +1 -1
  96. package/dist/server/auth-marketing.d.ts.map +1 -1
  97. package/dist/server/auth-marketing.js +17 -7
  98. package/dist/server/auth-marketing.js.map +1 -1
  99. package/dist/server/auth.d.ts.map +1 -1
  100. package/dist/server/auth.js +6 -0
  101. package/dist/server/auth.js.map +1 -1
  102. package/dist/server/builder-browser.d.ts +11 -0
  103. package/dist/server/builder-browser.d.ts.map +1 -1
  104. package/dist/server/builder-browser.js.map +1 -1
  105. package/dist/server/builder-space.d.ts +47 -0
  106. package/dist/server/builder-space.d.ts.map +1 -0
  107. package/dist/server/builder-space.js +142 -0
  108. package/dist/server/builder-space.js.map +1 -0
  109. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  110. package/dist/server/core-routes-plugin.js +39 -98
  111. package/dist/server/core-routes-plugin.js.map +1 -1
  112. package/dist/server/credential-provider.d.ts.map +1 -1
  113. package/dist/server/credential-provider.js +29 -6
  114. package/dist/server/credential-provider.js.map +1 -1
  115. package/dist/styles/blocks.css +30 -8
  116. package/dist/styles/rich-markdown-editor.css +10 -4
  117. package/dist/templates/{starter-shell-sync.spec.ts → chat-shell-sync.spec.ts} +21 -21
  118. package/dist/templates/default/.agents/skills/actions/SKILL.md +5 -5
  119. package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +63 -0
  120. package/dist/templates/default/AGENTS.md +22 -1
  121. package/dist/templates/default/actions/hello.ts +1 -1
  122. package/dist/templates/default/actions/navigate.ts +1 -1
  123. package/dist/templates/default/actions/view-screen.ts +1 -1
  124. package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +63 -0
  125. package/dist/templates/headless/.env.example +4 -0
  126. package/dist/templates/headless/.prettierrc +5 -0
  127. package/dist/templates/headless/AGENTS.md +58 -0
  128. package/dist/templates/headless/DEVELOPING.md +22 -0
  129. package/dist/templates/headless/_gitignore +36 -0
  130. package/dist/templates/headless/actions/hello.ts +14 -0
  131. package/dist/templates/headless/actions/run.ts +3 -0
  132. package/dist/templates/headless/package.json +22 -0
  133. package/dist/templates/headless/tsconfig.json +7 -0
  134. package/dist/templates/ui-primitives-sync.spec.ts +2 -2
  135. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -5
  136. package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +63 -0
  137. package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +93 -0
  138. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +1 -1
  139. package/dist/templates/workspace-core/AGENTS.md +20 -3
  140. package/dist/templates/workspace-core/src/server/index.ts +1 -1
  141. package/dist/templates/workspace-root/AGENTS.md +25 -5
  142. package/dist/templates/workspace-root/README.md +7 -7
  143. package/dist/triggers/dispatcher.d.ts +2 -3
  144. package/dist/triggers/dispatcher.d.ts.map +1 -1
  145. package/dist/triggers/dispatcher.js +2 -3
  146. package/dist/triggers/dispatcher.js.map +1 -1
  147. package/dist/triggers/routes.d.ts +38 -0
  148. package/dist/triggers/routes.d.ts.map +1 -0
  149. package/dist/triggers/routes.js +202 -0
  150. package/dist/triggers/routes.js.map +1 -0
  151. package/docs/AGENTS.md +57 -0
  152. package/docs/SKILL.md +40 -0
  153. package/docs/content/a2a-protocol.md +1 -1
  154. package/docs/content/actions.md +48 -8
  155. package/docs/content/agent-surfaces.md +76 -14
  156. package/docs/content/cli-adapters.md +1 -1
  157. package/docs/content/cloneable-saas.md +5 -4
  158. package/docs/content/code-agents-ui.md +1 -1
  159. package/docs/content/components.md +1 -1
  160. package/docs/content/context-awareness.md +1 -1
  161. package/docs/content/creating-templates.md +9 -7
  162. package/docs/content/drop-in-agent.md +1 -1
  163. package/docs/content/faq.md +6 -4
  164. package/docs/content/getting-started.md +63 -73
  165. package/docs/content/key-concepts.md +24 -24
  166. package/docs/content/native-chat-ui.md +4 -4
  167. package/docs/content/pure-agent-apps.md +34 -10
  168. package/docs/content/security.md +1 -1
  169. package/docs/content/server.md +1 -1
  170. package/docs/content/template-chat.md +85 -0
  171. package/docs/content/template-dispatch.md +1 -1
  172. package/docs/content/tracking.md +1 -1
  173. package/docs/content/what-is-agent-native.md +7 -6
  174. package/package.json +10 -1
  175. package/src/templates/{starter-shell-sync.spec.ts → chat-shell-sync.spec.ts} +21 -21
  176. package/src/templates/default/.agents/skills/actions/SKILL.md +5 -5
  177. package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +63 -0
  178. package/src/templates/default/AGENTS.md +22 -1
  179. package/src/templates/default/actions/hello.ts +1 -1
  180. package/src/templates/default/actions/navigate.ts +1 -1
  181. package/src/templates/default/actions/view-screen.ts +1 -1
  182. package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +63 -0
  183. package/src/templates/headless/.env.example +4 -0
  184. package/src/templates/headless/.prettierrc +5 -0
  185. package/src/templates/headless/AGENTS.md +58 -0
  186. package/src/templates/headless/DEVELOPING.md +22 -0
  187. package/src/templates/headless/_gitignore +36 -0
  188. package/src/templates/headless/actions/hello.ts +14 -0
  189. package/src/templates/headless/actions/run.ts +3 -0
  190. package/src/templates/headless/package.json +22 -0
  191. package/src/templates/headless/tsconfig.json +7 -0
  192. package/src/templates/ui-primitives-sync.spec.ts +2 -2
  193. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +5 -5
  194. package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +63 -0
  195. package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +93 -0
  196. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +1 -1
  197. package/src/templates/workspace-core/AGENTS.md +20 -3
  198. package/src/templates/workspace-core/src/server/index.ts +1 -1
  199. package/src/templates/workspace-root/AGENTS.md +25 -5
  200. package/src/templates/workspace-root/README.md +7 -7
  201. package/docs/content/template-starter.md +0 -78
@@ -49,7 +49,7 @@ Use `defineAction` with a Zod schema (required for new actions):
49
49
  ```ts
50
50
  // actions/list-meals.ts
51
51
  import { z } from "zod";
52
- import { defineAction } from "@agent-native/core";
52
+ import { defineAction } from "@agent-native/core/action";
53
53
  import { getDb } from "../server/db/index.js";
54
54
  import { meals } from "../server/db/schema.js";
55
55
 
@@ -352,7 +352,7 @@ This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all
352
352
  credentials belong in the encrypted secrets/credential/OAuth stores, never as
353
353
  hardcoded literals or shared env fallbacks.
354
354
  - **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
355
- - **Import from `@agent-native/core`** Don't redefine `parseArgs()` or other utilities locally.
355
+ - **Import action primitives from `@agent-native/core/action`** and CLI helpers such as `parseArgs()` from `@agent-native/core` — do not redefine framework utilities locally.
356
356
  - **Do not re-export actions as REST.** The mounted `/_agent-native/actions/:name` endpoint is the REST surface; duplicating it under `/api/*` creates drift and hides the operation from agents.
357
357
 
358
358
  ## Common Patterns
@@ -361,7 +361,7 @@ This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all
361
361
 
362
362
  ```ts
363
363
  import { z } from "zod";
364
- import { defineAction } from "@agent-native/core";
364
+ import { defineAction } from "@agent-native/core/action";
365
365
 
366
366
  export default defineAction({
367
367
  description: "List calendar events",
@@ -380,7 +380,7 @@ export default defineAction({
380
380
 
381
381
  ```ts
382
382
  import { z } from "zod";
383
- import { defineAction } from "@agent-native/core";
383
+ import { defineAction } from "@agent-native/core/action";
384
384
 
385
385
  export default defineAction({
386
386
  description: "Log a meal",
@@ -400,7 +400,7 @@ export default defineAction({
400
400
 
401
401
  ```ts
402
402
  import { z } from "zod";
403
- import { defineAction } from "@agent-native/core";
403
+ import { defineAction } from "@agent-native/core/action";
404
404
 
405
405
  export default defineAction({
406
406
  description: "Navigate the UI to a view",
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: agent-native-docs
3
+ description: >-
4
+ How to find version-matched Agent Native framework docs bundled in
5
+ node_modules. Use before implementing or answering questions about
6
+ @agent-native/core APIs, generated apps, workspaces, or advanced features.
7
+ metadata:
8
+ internal: true
9
+ ---
10
+
11
+ # Agent Native Docs Lookup
12
+
13
+ ## Rule
14
+
15
+ Before implementing or explaining non-trivial Agent Native behavior, read the
16
+ version-matched docs installed with `@agent-native/core`.
17
+
18
+ ## Why
19
+
20
+ Generated apps and workspaces may be on a different framework version than the
21
+ public docs or model memory. The installed package is the source that matches
22
+ the app in front of you.
23
+
24
+ ## How
25
+
26
+ From a generated app directory:
27
+
28
+ ```bash
29
+ pnpm action docs-search --query "<feature>"
30
+ pnpm action docs-search --slug <slug>
31
+ pnpm action docs-search --list
32
+ ```
33
+
34
+ The headless `pnpm agent` loop and built-in app agent also expose a read-only
35
+ `docs-search` tool with the same `query`, `slug`, and `list` options.
36
+
37
+ If the action runner is unavailable, search the package docs directly:
38
+
39
+ ```bash
40
+ rg -n "actions|automations|a2a|sharing" node_modules/@agent-native/core/docs
41
+ ```
42
+
43
+ Then read `node_modules/@agent-native/core/docs/AGENTS.md` or the matching file
44
+ under `node_modules/@agent-native/core/docs/content/`.
45
+
46
+ ## Useful Slugs
47
+
48
+ | Need | Slugs |
49
+ | --- | --- |
50
+ | Actions and typed client calls | `actions`, `client` |
51
+ | SQL, auth, access, sharing | `database`, `authentication`, `security`, `sharing` |
52
+ | UI state visible to the agent | `context-awareness` |
53
+ | Headless and chat-first apps | `pure-agent-apps`, `agent-surfaces`, `using-your-agent` |
54
+ | Automations and schedules | `automations`, `recurring-jobs` |
55
+ | Cross-app and external agents | `a2a-protocol`, `external-agents`, `mcp-protocol`, `mcp-apps` |
56
+ | Skills and instructions | `skills-guide`, `writing-agent-instructions` |
57
+
58
+ ## Don't
59
+
60
+ - Do not rely on memory for framework APIs when package docs are present.
61
+ - Do not add custom REST wrappers for app data before reading `actions`.
62
+ - Do not add inline LLM calls before reading `using-your-agent` and
63
+ `agent-surfaces`.
@@ -1,6 +1,6 @@
1
1
  # {{APP_NAME}} — Agent Guide
2
2
 
3
- This app follows the agent-native core philosophy: the agent and UI are equal partners. Everything the UI can do, the agent can do via actions. The agent always knows what you're looking at via application state. See the root AGENTS.md for full framework documentation.
3
+ This app follows the agent-native core philosophy: the agent and UI are equal partners. Everything the UI can do, the agent can do via actions. The agent always knows what you're looking at via application state. Use the framework docs lookup below for version-matched Agent Native documentation.
4
4
 
5
5
  This is an **@agent-native/core** application -- the AI agent and UI share state through a SQL database, with SSE for in-process live sync and polling as the cross-process/serverless fallback.
6
6
 
@@ -13,6 +13,26 @@ This is an **@agent-native/core** application -- the AI agent and UI share state
13
13
  5. **Agent can update code** -- The agent can modify this app's source code directly.
14
14
  6. **No hardcoded secrets or private data** -- Never put API keys, tokens, webhook URLs, signing secrets, private Builder/internal data, customer data, or credential-looking literals in source, docs, tests, fixtures, prompts, screenshots, application state, action responses, or generated content. Use secrets/OAuth/runtime configuration and obvious placeholders in examples.
15
15
 
16
+ ## Framework Docs Lookup
17
+
18
+ Version-matched Agent Native docs ship with `@agent-native/core` in
19
+ `node_modules/@agent-native/core/docs`.
20
+
21
+ - Use `pnpm action docs-search --query "<topic>"` to search framework docs,
22
+ bundled `AGENTS.md`, and codebase skills.
23
+ - Use `pnpm action docs-search --slug <slug>` to read a full page. Start with
24
+ `actions`, `database`, `context-awareness`, `client`, `automations`,
25
+ `recurring-jobs`, `a2a-protocol`, `external-agents`, `mcp-protocol`,
26
+ `sharing`, `security`, `pure-agent-apps`, or `agent-surfaces`.
27
+ - Use `pnpm action docs-search --list` to see everything available.
28
+ - If the action runner is unavailable, read
29
+ `node_modules/@agent-native/core/docs/AGENTS.md` and search
30
+ `node_modules/@agent-native/core/docs/content/` directly with `rg`.
31
+
32
+ Read these local package docs before implementing advanced Agent Native
33
+ features. Prefer this app's own `AGENTS.md` and `.agents/skills/` for
34
+ app-specific rules.
35
+
16
36
  ### Database Code
17
37
 
18
38
  - Define tables with `@agent-native/core/db/schema` helpers (`table`, `text`, `integer`, `real`, `now`, sharing helpers), never `drizzle-orm/sqlite-core` or `drizzle-orm/pg-core`.
@@ -115,6 +135,7 @@ Skills in `.agents/skills/` provide detailed guidance for each architectural rul
115
135
 
116
136
  | Skill | When to read |
117
137
  | --------------------- | --------------------------------------------------------------------------------- |
138
+ | `agent-native-docs` | Before using advanced Agent Native framework APIs or generated-app features |
118
139
  | `adding-a-feature` | **Read first when adding ANY new feature** — the four-area parity checklist |
119
140
  | `real-time-sync` | Before wiring data fetching for anything the agent can mutate (must auto-refresh) |
120
141
  | `storing-data` | Before storing or reading any app state |
@@ -1,4 +1,4 @@
1
- import { defineAction } from "@agent-native/core";
1
+ import { defineAction } from "@agent-native/core/action";
2
2
  import { z } from "zod";
3
3
 
4
4
  export default defineAction({
@@ -1,4 +1,4 @@
1
- import { defineAction } from "@agent-native/core";
1
+ import { defineAction } from "@agent-native/core/action";
2
2
  import { writeAppState } from "@agent-native/core/application-state";
3
3
  import { z } from "zod";
4
4
 
@@ -1,4 +1,4 @@
1
- import { defineAction } from "@agent-native/core";
1
+ import { defineAction } from "@agent-native/core/action";
2
2
  import { readAppState } from "@agent-native/core/application-state";
3
3
  import { z } from "zod";
4
4
 
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: agent-native-docs
3
+ description: >-
4
+ How to find version-matched Agent Native framework docs bundled in
5
+ node_modules. Use before implementing or answering questions about
6
+ @agent-native/core APIs, generated apps, workspaces, or advanced features.
7
+ metadata:
8
+ internal: true
9
+ ---
10
+
11
+ # Agent Native Docs Lookup
12
+
13
+ ## Rule
14
+
15
+ Before implementing or explaining non-trivial Agent Native behavior, read the
16
+ version-matched docs installed with `@agent-native/core`.
17
+
18
+ ## Why
19
+
20
+ Generated apps and workspaces may be on a different framework version than the
21
+ public docs or model memory. The installed package is the source that matches
22
+ the app in front of you.
23
+
24
+ ## How
25
+
26
+ From a generated app directory:
27
+
28
+ ```bash
29
+ pnpm action docs-search --query "<feature>"
30
+ pnpm action docs-search --slug <slug>
31
+ pnpm action docs-search --list
32
+ ```
33
+
34
+ The headless `pnpm agent` loop and built-in app agent also expose a read-only
35
+ `docs-search` tool with the same `query`, `slug`, and `list` options.
36
+
37
+ If the action runner is unavailable, search the package docs directly:
38
+
39
+ ```bash
40
+ rg -n "actions|automations|a2a|sharing" node_modules/@agent-native/core/docs
41
+ ```
42
+
43
+ Then read `node_modules/@agent-native/core/docs/AGENTS.md` or the matching file
44
+ under `node_modules/@agent-native/core/docs/content/`.
45
+
46
+ ## Useful Slugs
47
+
48
+ | Need | Slugs |
49
+ | --- | --- |
50
+ | Actions and typed client calls | `actions`, `client` |
51
+ | SQL, auth, access, sharing | `database`, `authentication`, `security`, `sharing` |
52
+ | UI state visible to the agent | `context-awareness` |
53
+ | Headless and chat-first apps | `pure-agent-apps`, `agent-surfaces`, `using-your-agent` |
54
+ | Automations and schedules | `automations`, `recurring-jobs` |
55
+ | Cross-app and external agents | `a2a-protocol`, `external-agents`, `mcp-protocol`, `mcp-apps` |
56
+ | Skills and instructions | `skills-guide`, `writing-agent-instructions` |
57
+
58
+ ## Don't
59
+
60
+ - Do not rely on memory for framework APIs when package docs are present.
61
+ - Do not add custom REST wrappers for app data before reading `actions`.
62
+ - Do not add inline LLM calls before reading `using-your-agent` and
63
+ `agent-surfaces`.
@@ -0,0 +1,4 @@
1
+ # Local development can use the SQLite fallback at data/app.db.
2
+ # Set DATABASE_URL for a persistent hosted database.
3
+ # DATABASE_URL=postgres://user:password@host:5432/database
4
+
@@ -0,0 +1,5 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": false,
4
+ "trailingComma": "all"
5
+ }
@@ -0,0 +1,58 @@
1
+ # {{APP_NAME}} - Agent Guide
2
+
3
+ This is a headless Agent Native app. It starts with actions instead of a browser UI, so the first useful primitive is callable from the agent, CLI, and action runtime.
4
+
5
+ This app is not stateless. The Agent Native runtime uses SQL-backed stores for app state, settings, auth/session data, resources, and other framework capabilities when those surfaces are used. Local development can use SQLite at `data/app.db`; hosted or long-lived deployments should set `DATABASE_URL` to a persistent database.
6
+
7
+ ## Working In This App
8
+
9
+ - Prefer actions in `actions/` for every app operation. Do not create REST wrappers around actions.
10
+ - Keep action inputs validated with Zod and return structured data, not JSON strings.
11
+ - Do not hardcode API keys, tokens, webhook URLs, private data, or credential-looking literals.
12
+ - There is intentionally no `app/` UI shell in this scaffold. When you need a browser UI, use the Chat template as the UI on-ramp and keep `agent-native add` for integration blueprints.
13
+
14
+ ## Framework Docs Lookup
15
+
16
+ Version-matched Agent Native docs ship with `@agent-native/core` in
17
+ `node_modules/@agent-native/core/docs`.
18
+
19
+ - Use `pnpm action docs-search --query "<topic>"` to search framework docs,
20
+ bundled `AGENTS.md`, and codebase skills.
21
+ - Use `pnpm action docs-search --slug <slug>` to read a full page. Start with
22
+ `actions`, `pure-agent-apps`, `automations`, `recurring-jobs`,
23
+ `a2a-protocol`, `external-agents`, `mcp-protocol`, `database`, `sharing`,
24
+ and `security` for advanced headless workflows.
25
+ - Use `pnpm action docs-search --list` to see everything available.
26
+ - If the action runner is unavailable, read
27
+ `node_modules/@agent-native/core/docs/AGENTS.md` and search
28
+ `node_modules/@agent-native/core/docs/content/` directly with `rg`.
29
+
30
+ Read these local package docs before implementing advanced Agent Native
31
+ features. Prefer this app's own `AGENTS.md` for app-specific rules.
32
+
33
+ ## Actions
34
+
35
+ | Action | Args | Purpose |
36
+ | ----------- | ----------------- | ----------------------- |
37
+ | `hello` | `[--name <name>]` | Return a greeting |
38
+ | `db-schema` | | Show SQL schema |
39
+ | `db-query` | `--sql "SELECT"` | Run a scoped SELECT |
40
+ | `db-exec` | `--sql "UPDATE"` | Last-resort maintenance |
41
+
42
+ Run actions from this app root:
43
+
44
+ ```bash
45
+ pnpm action hello --name Builder
46
+ ```
47
+
48
+ Run the app-agent loop against those actions:
49
+
50
+ ```bash
51
+ pnpm agent "Call the hello action for Builder and explain the result"
52
+ ```
53
+
54
+ ## Skills
55
+
56
+ Skills in `.agents/skills/` provide detailed guidance. Read
57
+ `.agents/skills/agent-native-docs/SKILL.md` before using advanced Agent Native
58
+ framework APIs, generated-app features, automations, A2A, sharing, or MCP.
@@ -0,0 +1,22 @@
1
+ # Developing {{APP_NAME}}
2
+
3
+ Install dependencies, then run the hello action:
4
+
5
+ ```bash
6
+ pnpm install
7
+ pnpm action hello --name Builder
8
+ ```
9
+
10
+ Then run the production app-agent loop against this folder:
11
+
12
+ ```bash
13
+ pnpm agent "Call hello for Builder"
14
+ ```
15
+
16
+ Useful checks:
17
+
18
+ ```bash
19
+ pnpm typecheck
20
+ ```
21
+
22
+ This scaffold intentionally has no `app/` directory, React Router config, Vite config, or dev server. Add those only when you are ready for a UI surface; the Chat template is the UI-first scaffold.
@@ -0,0 +1,36 @@
1
+ .agent-native/
2
+
3
+ # Logs
4
+ logs
5
+ *.log
6
+ npm-debug.log*
7
+ pnpm-debug.log*
8
+
9
+ node_modules
10
+ dist
11
+ *.local
12
+
13
+ # Editor directories and files
14
+ .vscode/*
15
+ !.vscode/extensions.json
16
+ .idea
17
+ .DS_Store
18
+ *.suo
19
+ *.ntvs*
20
+ *.njsproj
21
+ *.sln
22
+ *.sw?
23
+
24
+ # Environment
25
+ .env
26
+ .env.*
27
+ !.env.example
28
+
29
+ # Runtime data
30
+ data/*.db
31
+ data/*.db-shm
32
+ data/*.db-wal
33
+ data/uploads/
34
+ data/settings.json
35
+ data/.sessions.json
36
+
@@ -0,0 +1,14 @@
1
+ import { defineAction } from "@agent-native/core/action";
2
+ import { z } from "zod";
3
+
4
+ export default defineAction({
5
+ description: "Return a friendly greeting.",
6
+ schema: z.object({
7
+ name: z.string().default("world").describe("Name to greet"),
8
+ }),
9
+ http: { method: "GET" },
10
+ readOnly: true,
11
+ run: async ({ name }) => {
12
+ return { message: `Hello, ${name}!` };
13
+ },
14
+ });
@@ -0,0 +1,3 @@
1
+ import { runScript } from "@agent-native/core/scripts";
2
+
3
+ runScript();
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "{{APP_NAME}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "action": "agent-native action",
7
+ "agent": "agent-native agent",
8
+ "script": "agent-native script",
9
+ "typecheck": "tsc --noEmit"
10
+ },
11
+ "dependencies": {
12
+ "@agent-native/core": "latest",
13
+ "postgres": "^3.4.9",
14
+ "zod": "^4.4.3"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^24.2.1",
18
+ "prettier": "^3.6.2",
19
+ "tsx": "^4.20.3",
20
+ "typescript": "^6.0.3"
21
+ }
22
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@agent-native/core/tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["node"]
5
+ },
6
+ "include": ["actions/**/*", "server/**/*", "shared/**/*"]
7
+ }
@@ -70,8 +70,8 @@ const ALLOW_LIST: Array<[string, string, string]> = [
70
70
  // chart.tsx — analytics adds the useChartTooltipFlip hook (which only exists
71
71
  // in the analytics template's hooks/ dir) and uses `[_, config]` destructuring.
72
72
  // forms/mail have a shared variant without that hook and with `[, config]`.
73
- // The canonical 8-template version (calendar/clips/design/macros/plan/slides/
74
- // starter/videos) has neither analytics-specific hook nor forms/mail style.
73
+ // The canonical 8-template version (calendar/chat/clips/design/macros/plan/
74
+ // slides/videos) has neither analytics-specific hook nor forms/mail style.
75
75
  [
76
76
  "chart.tsx",
77
77
  "analytics",
@@ -49,7 +49,7 @@ Use `defineAction` with a Zod schema (required for new actions):
49
49
  ```ts
50
50
  // actions/list-meals.ts
51
51
  import { z } from "zod";
52
- import { defineAction } from "@agent-native/core";
52
+ import { defineAction } from "@agent-native/core/action";
53
53
  import { getDb } from "../server/db/index.js";
54
54
  import { meals } from "../server/db/schema.js";
55
55
 
@@ -352,7 +352,7 @@ This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all
352
352
  credentials belong in the encrypted secrets/credential/OAuth stores, never as
353
353
  hardcoded literals or shared env fallbacks.
354
354
  - **Use `fail()`** for user-friendly error messages (exits with message, no stack trace).
355
- - **Import from `@agent-native/core`** Don't redefine `parseArgs()` or other utilities locally.
355
+ - **Import action primitives from `@agent-native/core/action`** and CLI helpers such as `parseArgs()` from `@agent-native/core` — do not redefine framework utilities locally.
356
356
  - **Do not re-export actions as REST.** The mounted `/_agent-native/actions/:name` endpoint is the REST surface; duplicating it under `/api/*` creates drift and hides the operation from agents.
357
357
 
358
358
  ## Common Patterns
@@ -361,7 +361,7 @@ This still works but is not auto-exposed as HTTP. Prefer `defineAction` for all
361
361
 
362
362
  ```ts
363
363
  import { z } from "zod";
364
- import { defineAction } from "@agent-native/core";
364
+ import { defineAction } from "@agent-native/core/action";
365
365
 
366
366
  export default defineAction({
367
367
  description: "List calendar events",
@@ -380,7 +380,7 @@ export default defineAction({
380
380
 
381
381
  ```ts
382
382
  import { z } from "zod";
383
- import { defineAction } from "@agent-native/core";
383
+ import { defineAction } from "@agent-native/core/action";
384
384
 
385
385
  export default defineAction({
386
386
  description: "Log a meal",
@@ -400,7 +400,7 @@ export default defineAction({
400
400
 
401
401
  ```ts
402
402
  import { z } from "zod";
403
- import { defineAction } from "@agent-native/core";
403
+ import { defineAction } from "@agent-native/core/action";
404
404
 
405
405
  export default defineAction({
406
406
  description: "Navigate the UI to a view",
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: agent-native-docs
3
+ description: >-
4
+ How to find version-matched Agent Native framework docs bundled in
5
+ node_modules. Use before implementing or answering questions about
6
+ @agent-native/core APIs, generated apps, workspaces, or advanced features.
7
+ metadata:
8
+ internal: true
9
+ ---
10
+
11
+ # Agent Native Docs Lookup
12
+
13
+ ## Rule
14
+
15
+ Before implementing or explaining non-trivial Agent Native behavior, read the
16
+ version-matched docs installed with `@agent-native/core`.
17
+
18
+ ## Why
19
+
20
+ Generated apps and workspaces may be on a different framework version than the
21
+ public docs or model memory. The installed package is the source that matches
22
+ the app in front of you.
23
+
24
+ ## How
25
+
26
+ From a generated app directory:
27
+
28
+ ```bash
29
+ pnpm action docs-search --query "<feature>"
30
+ pnpm action docs-search --slug <slug>
31
+ pnpm action docs-search --list
32
+ ```
33
+
34
+ The headless `pnpm agent` loop and built-in app agent also expose a read-only
35
+ `docs-search` tool with the same `query`, `slug`, and `list` options.
36
+
37
+ If the action runner is unavailable, search the package docs directly:
38
+
39
+ ```bash
40
+ rg -n "actions|automations|a2a|sharing" node_modules/@agent-native/core/docs
41
+ ```
42
+
43
+ Then read `node_modules/@agent-native/core/docs/AGENTS.md` or the matching file
44
+ under `node_modules/@agent-native/core/docs/content/`.
45
+
46
+ ## Useful Slugs
47
+
48
+ | Need | Slugs |
49
+ | --- | --- |
50
+ | Actions and typed client calls | `actions`, `client` |
51
+ | SQL, auth, access, sharing | `database`, `authentication`, `security`, `sharing` |
52
+ | UI state visible to the agent | `context-awareness` |
53
+ | Headless and chat-first apps | `pure-agent-apps`, `agent-surfaces`, `using-your-agent` |
54
+ | Automations and schedules | `automations`, `recurring-jobs` |
55
+ | Cross-app and external agents | `a2a-protocol`, `external-agents`, `mcp-protocol`, `mcp-apps` |
56
+ | Skills and instructions | `skills-guide`, `writing-agent-instructions` |
57
+
58
+ ## Don't
59
+
60
+ - Do not rely on memory for framework APIs when package docs are present.
61
+ - Do not add custom REST wrappers for app data before reading `actions`.
62
+ - Do not add inline LLM calls before reading `using-your-agent` and
63
+ `agent-surfaces`.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: composable-mini-apps
3
+ description: >-
4
+ Build many focused workspace apps that compose through agent discovery and
5
+ A2A. Use when designing headless mini-apps or cross-app workflows.
6
+ ---
7
+
8
+ # Composable Mini-Apps
9
+
10
+ ## Rule
11
+
12
+ Prefer many one-job apps in a workspace over one oversized app. A headless app
13
+ can own a provider, dataset, workflow, or specialist action surface without a
14
+ full UI; the main agent composes those apps through discovery and A2A.
15
+
16
+ ## Shape
17
+
18
+ - Give each mini-app one clear job, a concise `package.json` description, and
19
+ action names that describe the job it owns.
20
+ - Keep provider credentials and upstream API details in the app that owns that
21
+ provider or workflow. Other apps should delegate to it instead of copying its
22
+ integration code.
23
+ - Use a tiny status/config screen only when users need to inspect state. A
24
+ pure headless app is fine when its job is invoked by agents, automations, or
25
+ sibling apps.
26
+ - If two workflows only share a helper, put the helper in `packages/shared`;
27
+ keep the workflow actions in separate apps.
28
+
29
+ ## Discovery And Invocation
30
+
31
+ The main agent should discover available siblings before assuming capability:
32
+
33
+ - Runtime agents receive an `<available-apps>` block built from
34
+ `discoverAgents()`. Workspace siblings are layered in by
35
+ `discoverWorkspaceAgents()`.
36
+ - UI shells, headless surfaces, and scripts can read the same registry through
37
+ `GET /_agent-native/agents?selfAppId=<app-id>`.
38
+ - Code or CLI callers should use the first-class A2A invocation path
39
+ (`invokeAgent()` / `agent-native invoke`) when they need to call an app by
40
+ id, name, or URL.
41
+ - In the agent loop, use `call-agent` with the sibling app id when another app
42
+ owns the work or data. Never call the current app through `call-agent`; use
43
+ local actions instead.
44
+
45
+ Send narrow prompts to siblings: name the exact question, relevant ids, date
46
+ ranges, and expected output shape. Preserve returned ids and URLs verbatim.
47
+
48
+ ## Provider APIs
49
+
50
+ Provider-specific actions are shortcuts, not limits. When the upstream API can
51
+ answer the question better than a first-class shortcut, call
52
+ `provider-api-catalog` and `provider-api-docs` as needed, then
53
+ `provider-api-request` against the real provider endpoint. For broad joins,
54
+ searches, or absence claims, stage the bounded corpus with `stageAs` and reduce
55
+ it with `query-staged-dataset` or code.
56
+
57
+ When composing apps, make the provider-owning mini-app do those
58
+ `provider-api-request` calls. The orchestrator should delegate a bounded job;
59
+ it should not reimplement every provider endpoint locally.
60
+
61
+ ## Example
62
+
63
+ For a sales-intelligence workspace, split the job into small apps:
64
+
65
+ | App | Owns | Calls |
66
+ | --- | --- | --- |
67
+ | `hubspot-pipeline` | CRM deals, contacts, companies, associations | `provider-api-request` with provider `hubspot` |
68
+ | `gong-evidence` | Calls, transcripts, snippets, speaker evidence | `provider-api-request` with provider `gong` |
69
+ | `knowledge-base` | Internal docs, pricing rules, playbooks | local search/read actions |
70
+ | `deal-brief` | Orchestration and final brief | `invokeAgent()` or `call-agent` to the three apps |
71
+
72
+ Flow: `deal-brief` asks `hubspot-pipeline` for the target account and open
73
+ deals, asks `gong-evidence` for recent transcript evidence about those deals,
74
+ asks `knowledge-base` for relevant playbook guidance, then synthesizes the
75
+ answer. That is a HubSpot→Gong→knowledge-base chain made of focused apps,
76
+ not a single app that clones every provider integration.
77
+
78
+ ## Don't
79
+
80
+ - Do not clone Mail, Calendar, Analytics, Brain, Assets, or another first-party
81
+ app just to reuse its data. Delegate or link to the existing app.
82
+ - Do not hide a multi-provider workflow inside a giant "misc tools" app.
83
+ - Do not add one-off provider endpoints when `provider-api-request` can express
84
+ the upstream API safely.
85
+ - Do not create wrapper routes that only re-export another app's action or A2A
86
+ result.
87
+
88
+ ## Related Skills
89
+
90
+ - **a2a-protocol** - How apps expose and call A2A endpoints.
91
+ - **actions** - How each mini-app exposes its own operation surface.
92
+ - **external-agents** - How external MCP hosts route through workspace apps.
93
+ - **storing-data** - How app-owned data stays SQL-backed and portable.
@@ -111,7 +111,7 @@ row is written — status is derived from `hasOAuthTokens("google")`.
111
111
 
112
112
  ```ts
113
113
  import { z } from "zod";
114
- import { defineAction } from "@agent-native/core";
114
+ import { defineAction } from "@agent-native/core/action";
115
115
  import { readAppSecret } from "@agent-native/core/secrets";
116
116
  import { getRequestUserEmail } from "@agent-native/core/server";
117
117