@agent-native/core 0.161.16 → 0.161.20

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 (148) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/adding-a-feature/SKILL.md +10 -0
  3. package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  4. package/corpus/templates/analytics/.agents/skills/secrets/SKILL.md +29 -2
  5. package/corpus/templates/analytics/AGENTS.md +1 -0
  6. package/corpus/templates/analytics/server/plugins/auth.ts +4 -0
  7. package/corpus/templates/assets/.agents/skills/adding-a-feature/SKILL.md +10 -0
  8. package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  9. package/corpus/templates/assets/.agents/skills/secrets/SKILL.md +29 -2
  10. package/corpus/templates/assets/AGENTS.md +1 -0
  11. package/corpus/templates/brain/.agents/skills/adding-a-feature/SKILL.md +10 -0
  12. package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  13. package/corpus/templates/brain/.agents/skills/secrets/SKILL.md +29 -2
  14. package/corpus/templates/brain/AGENTS.md +1 -0
  15. package/corpus/templates/calendar/.agents/skills/adding-a-feature/SKILL.md +10 -0
  16. package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  17. package/corpus/templates/calendar/.agents/skills/secrets/SKILL.md +29 -2
  18. package/corpus/templates/calendar/AGENTS.md +1 -0
  19. package/corpus/templates/chat/.agents/skills/adding-a-feature/SKILL.md +10 -0
  20. package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  21. package/corpus/templates/chat/.agents/skills/secrets/SKILL.md +29 -2
  22. package/corpus/templates/chat/AGENTS.md +4 -0
  23. package/corpus/templates/chat/vitest.config.ts +12 -7
  24. package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  25. package/corpus/templates/clips/.agents/skills/secrets/SKILL.md +29 -2
  26. package/corpus/templates/clips/AGENTS.md +1 -0
  27. package/corpus/templates/clips/app/components/player/video-player.tsx +4 -0
  28. package/corpus/templates/clips/app/hooks/use-playback-position.ts +10 -2
  29. package/corpus/templates/clips/app/routes/embed.$shareId.tsx +1 -0
  30. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +26 -25
  31. package/corpus/templates/clips/app/routes/share.$shareId.tsx +1 -0
  32. package/corpus/templates/clips/changelog/2026-08-18-clips-no-longer-opens-welcome-window-on-first-launch.md +6 -0
  33. package/corpus/templates/clips/changelog/2026-08-18-clips-now-recovers-interrupted-uploads-and-reliably-restarts.md +6 -0
  34. package/corpus/templates/clips/changelog/2026-08-18-meeting-notifications-no-longer-show-decorative-left-side-lines.md +6 -0
  35. package/corpus/templates/clips/changelog/2026-08-18-pending-recording-files-now-use-a-clips-prefixed-name.md +6 -0
  36. package/corpus/templates/clips/desktop/src/lib/updater.ts +21 -1
  37. package/corpus/templates/clips/desktop/src/main.tsx +0 -3
  38. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +0 -4
  39. package/corpus/templates/clips/desktop/src/shared/config.ts +0 -1
  40. package/corpus/templates/clips/desktop/src/styles.css +0 -136
  41. package/corpus/templates/clips/desktop/src-tauri/capabilities/default.json +0 -1
  42. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +0 -45
  43. package/corpus/templates/clips/desktop/src-tauri/src/config.rs +1 -4
  44. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +3 -11
  45. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +63 -8
  46. package/corpus/templates/clips/desktop/src-tauri/src/util.rs +98 -0
  47. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +54 -20
  48. package/corpus/templates/content/.agents/skills/adding-a-feature/SKILL.md +10 -0
  49. package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  50. package/corpus/templates/content/.agents/skills/secrets/SKILL.md +29 -2
  51. package/corpus/templates/content/AGENTS.md +1 -0
  52. package/corpus/templates/crm/.agents/skills/adding-a-feature/SKILL.md +10 -0
  53. package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  54. package/corpus/templates/crm/.agents/skills/secrets/SKILL.md +29 -2
  55. package/corpus/templates/crm/AGENTS.md +1 -0
  56. package/corpus/templates/design/.agents/skills/adding-a-feature/SKILL.md +10 -0
  57. package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  58. package/corpus/templates/design/.agents/skills/secrets/SKILL.md +29 -2
  59. package/corpus/templates/design/AGENTS.md +1 -0
  60. package/corpus/templates/design/app/global.css +6 -0
  61. package/corpus/templates/design/app/i18n-data.ts +11 -0
  62. package/corpus/templates/design/app/lib/agent-chat.ts +9 -8
  63. package/corpus/templates/design/app/root.tsx +1 -1
  64. package/corpus/templates/design/changelog/2026-08-18-design-chat-context-stays-out-of-the-composer.md +6 -0
  65. package/corpus/templates/design/server/plugins/agent-chat.ts +2 -0
  66. package/corpus/templates/dispatch/.agents/skills/adding-a-feature/SKILL.md +10 -0
  67. package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  68. package/corpus/templates/dispatch/.agents/skills/secrets/SKILL.md +29 -2
  69. package/corpus/templates/dispatch/AGENTS.md +5 -5
  70. package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +10 -0
  71. package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  72. package/corpus/templates/factory/.agents/skills/secrets/SKILL.md +29 -2
  73. package/corpus/templates/factory/AGENTS.md +1 -0
  74. package/corpus/templates/forms/.agents/skills/adding-a-feature/SKILL.md +10 -0
  75. package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  76. package/corpus/templates/forms/.agents/skills/secrets/SKILL.md +29 -2
  77. package/corpus/templates/forms/AGENTS.md +1 -0
  78. package/corpus/templates/macros/.agents/skills/adding-a-feature/SKILL.md +10 -0
  79. package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  80. package/corpus/templates/macros/.agents/skills/secrets/SKILL.md +29 -2
  81. package/corpus/templates/macros/AGENTS.md +1 -0
  82. package/corpus/templates/mail/.agents/skills/adding-a-feature/SKILL.md +10 -0
  83. package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  84. package/corpus/templates/mail/.agents/skills/secrets/SKILL.md +29 -2
  85. package/corpus/templates/mail/AGENTS.md +1 -0
  86. package/corpus/templates/plan/.agents/skills/adding-a-feature/SKILL.md +10 -0
  87. package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  88. package/corpus/templates/plan/.agents/skills/secrets/SKILL.md +29 -2
  89. package/corpus/templates/plan/AGENTS.md +1 -0
  90. package/corpus/templates/slides/.agents/skills/adding-a-feature/SKILL.md +10 -0
  91. package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  92. package/corpus/templates/slides/.agents/skills/secrets/SKILL.md +29 -2
  93. package/corpus/templates/slides/AGENTS.md +2 -1
  94. package/corpus/templates/tasks/.agents/skills/adding-a-feature/SKILL.md +10 -0
  95. package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  96. package/corpus/templates/tasks/.agents/skills/secrets/SKILL.md +29 -2
  97. package/corpus/templates/tasks/AGENTS.md +1 -0
  98. package/dist/action.d.ts +1 -0
  99. package/dist/action.js +44 -2
  100. package/dist/agent/production-agent.js +28 -5
  101. package/dist/client/chat/run-recovery.js +1 -1
  102. package/dist/client/route-state.js +17 -13
  103. package/dist/collab/struct-routes.d.ts +1 -1
  104. package/dist/notifications/routes.d.ts +1 -1
  105. package/dist/observability/routes.d.ts +5 -5
  106. package/dist/secrets/routes.d.ts +3 -3
  107. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  108. package/dist/server/auth.d.ts +6 -0
  109. package/dist/server/auth.js +23 -5
  110. package/dist/server/realtime-token.d.ts +1 -1
  111. package/dist/templates/chat/.agents/skills/adding-a-feature/SKILL.md +10 -0
  112. package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  113. package/dist/templates/chat/.agents/skills/secrets/SKILL.md +29 -2
  114. package/dist/templates/chat/AGENTS.md +4 -0
  115. package/dist/templates/chat/vitest.config.ts +12 -7
  116. package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +10 -0
  117. package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  118. package/dist/templates/default/.agents/skills/secrets/SKILL.md +29 -2
  119. package/dist/templates/default/AGENTS.md +4 -0
  120. package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  121. package/dist/templates/headless/.agents/skills/secrets/SKILL.md +29 -2
  122. package/dist/templates/headless/AGENTS.md +4 -0
  123. package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +10 -0
  124. package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  125. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +29 -2
  126. package/dist/templates/workspace-core/AGENTS.md +4 -0
  127. package/dist/templates/workspace-root/AGENTS.md +9 -0
  128. package/docs/content/deployment.mdx +70 -0
  129. package/docs/content/faq.mdx +1 -1
  130. package/package.json +1 -1
  131. package/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +10 -0
  132. package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  133. package/src/templates/chat/.agents/skills/secrets/SKILL.md +29 -2
  134. package/src/templates/chat/AGENTS.md +4 -0
  135. package/src/templates/chat/vitest.config.ts +12 -7
  136. package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +10 -0
  137. package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  138. package/src/templates/default/.agents/skills/secrets/SKILL.md +29 -2
  139. package/src/templates/default/AGENTS.md +4 -0
  140. package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  141. package/src/templates/headless/.agents/skills/secrets/SKILL.md +29 -2
  142. package/src/templates/headless/AGENTS.md +4 -0
  143. package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +10 -0
  144. package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +24 -0
  145. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +29 -2
  146. package/src/templates/workspace-core/AGENTS.md +4 -0
  147. package/src/templates/workspace-root/AGENTS.md +9 -0
  148. package/corpus/templates/clips/desktop/src/overlays/onboarding.tsx +0 -314
@@ -7,6 +7,73 @@ description: "Deploy agent-native apps to any platform with Nitro presets — No
7
7
 
8
8
  Agent-native apps use [Nitro](https://nitro.build) under the hood, which means you can deploy to any platform with zero config changes — just set a preset.
9
9
 
10
+ ## Fast path: self-host a Chat app locally {#self-host-quickstart}
11
+
12
+ There are two good starting points, depending on your role:
13
+
14
+ - **Building an app?** Start with [Getting Started](/docs/getting-started), then return here when you are ready to put the result somewhere permanent.
15
+ - **Operating an app?** Use the local Docker path below first. It exercises the same Node.js, Postgres, authentication, and environment-variable shape you will use on a small server.
16
+
17
+ The local stack intentionally uses a fake auth secret, trust authentication, and a local Postgres volume. It is for `localhost`, not an internet-facing deployment. Do not reuse the trust-authentication setting in production.
18
+
19
+ ### 1. Create the app
20
+
21
+ ```bash
22
+ npx @agent-native/core@latest create my-app --standalone --template chat
23
+ cd my-app
24
+ pnpm install
25
+ ```
26
+
27
+ The install step creates the lockfile that the production Dockerfile below copies into its build stage.
28
+
29
+ ### 2. Add a local Compose file
30
+
31
+ Create `docker-compose.yml` in the app root. It uses the [Dockerfile](#docker) in the next section and starts Postgres only on the private Compose network:
32
+
33
+ You can also download the [Dockerfile](https://www.agent-native.com/examples/self-hosted-chat/Dockerfile), [Compose file](https://www.agent-native.com/examples/self-hosted-chat/docker-compose.yml), and [environment template](https://www.agent-native.com/examples/self-hosted-chat/env.example) as a starter fixture.
34
+
35
+ ```yaml filename="docker-compose.yml" maxLines=40
36
+ services:
37
+ app:
38
+ build: .
39
+ ports:
40
+ - "127.0.0.1:3000:3000"
41
+ environment:
42
+ DATABASE_URL: postgres://agent_native@postgres:5432/agent_native
43
+ BETTER_AUTH_SECRET: local-development-secret-change-me-1234567890
44
+ ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
45
+ depends_on:
46
+ postgres:
47
+ condition: service_healthy
48
+
49
+ postgres:
50
+ image: postgres:18
51
+ environment:
52
+ POSTGRES_DB: agent_native
53
+ POSTGRES_USER: agent_native
54
+ POSTGRES_HOST_AUTH_METHOD: trust
55
+ volumes:
56
+ - postgres-data:/var/lib/postgresql
57
+ healthcheck:
58
+ test: ["CMD-SHELL", "pg_isready -U agent_native -d agent_native"]
59
+ interval: 5s
60
+ timeout: 5s
61
+ retries: 10
62
+
63
+ volumes:
64
+ postgres-data:
65
+ ```
66
+
67
+ ### 3. Run it
68
+
69
+ ```bash
70
+ docker compose up --build
71
+ ```
72
+
73
+ Open [http://localhost:3000](http://localhost:3000). The app infers its local auth origin from the browser request. Set `ANTHROPIC_API_KEY` in a local `.env` file if you want to use the embedded agent; leave it empty if you only want to verify that the app and database start. Stop the stack with `docker compose down`; add `-v` when you intentionally want to reset the local database.
74
+
75
+ Before putting this on the public internet, replace the example secret, configure HTTPS and OAuth callback URLs, use a persistent production database, and complete the [production environment checklist](#env-required-prod).
76
+
10
77
  ## Before You Deploy: Pick a Persistent Database {#persistent-database}
11
78
 
12
79
  Every deployed app needs a persistent SQL database. In local development, agent-native falls back to a SQLite file at `data/app.db`; that is convenient on your machine, but it is not durable in containers, previews, or serverless environments where the filesystem can be reset.
@@ -233,6 +300,8 @@ receives upstream security updates.
233
300
 
234
301
  ### Docker {#docker}
235
302
 
303
+ This Dockerfile works for the standalone app created above. Run `pnpm install` before building so `pnpm-lock.yaml` exists in the build context. Keep the dependency manifest and lockfile in sync when you update the app.
304
+
236
305
  ```dockerfile filename="Dockerfile"
237
306
  FROM node:24-slim AS build
238
307
  WORKDIR /app
@@ -247,6 +316,7 @@ COPY --from=build /app/.output .output
247
316
  # data/ is a runtime-created SQLite directory — do not copy a dev DB into prod.
248
317
  # For production, set DATABASE_URL to a hosted Postgres or Turso instance.
249
318
  RUN mkdir -p /app/data
319
+ ENV NODE_ENV=production
250
320
  ENV PORT=3000
251
321
  EXPOSE 3000
252
322
  CMD ["node", ".output/server/index.mjs"]
@@ -104,7 +104,7 @@ If you'd rather not manage any of this, the hosted version on `agent-native.com`
104
104
 
105
105
  ### Can I host this myself? {#can-i-self-host}
106
106
 
107
- Yes. Pick any host that runs Node — Netlify, Vercel, Cloudflare, AWS, Deno Deploy, your own server — and any SQL database (Postgres, SQLite, Turso, D1). The framework is built to be portable. See [Deployment](/docs/deployment).
107
+ Yes. Pick any host that runs Node — Netlify, Vercel, Cloudflare, AWS, Deno Deploy, your own server — and any SQL database (Postgres, SQLite, Turso, D1). The framework is built to be portable. Start with the [local Docker quickstart](/docs/deployment#self-host-quickstart), then use [Deployment](/docs/deployment) for production.
108
108
 
109
109
  ### What AI models does it support? {#what-models}
110
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.161.16",
3
+ "version": "0.161.20",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -76,6 +76,16 @@ Builder/internal data, or customer data in the action, UI, seed data, fixtures,
76
76
  docs, prompts, or generated extension/app content. Register required secrets,
77
77
  use OAuth helpers, or read scoped values from the vault/credential store.
78
78
 
79
+ Before writing custom setup or credential UI, perform the shared-primitive
80
+ preflight from `agent-native-toolkit`: inspect the workspace/provider connection
81
+ catalog first, then settings, secrets/vault, OAuth, onboarding, and provider API
82
+ support. Reuse an existing connection's app grant and scoped credential
83
+ resolver; only use app-local vault or OAuth primitives when no reusable
84
+ connection exists. Keep any wizard thin and provider-specific - it may explain
85
+ prerequisites, ordering, or readiness, but must not become a second vault or
86
+ custom credential transport. Do not mark each field `required` by reflex;
87
+ model onboarding around the logical connection outcome.
88
+
79
89
  If the feature involves attachments, images, recordings, screenshots, exports,
80
90
  or other file-like payloads, design the upload path in the same change:
81
91
  provider upload first, then URL/id/blob handle in SQL. Do not add base64/binary
@@ -152,6 +152,30 @@ preference, notification preference, or usage/billing surface, register it as a
152
152
  settings tab or app settings panel first. Only add sidebar UI when it is needed
153
153
  in the moment of agent use.
154
154
 
155
+ ## Integration Setup Preflight
156
+
157
+ Before building any setup, settings, credential, OAuth, or connection surface,
158
+ search the workspace/provider connection catalog first. If the provider already
159
+ has a reusable connection, use its catalog, app grant, and scoped credential
160
+ resolver rather than registering a parallel secret. Only then classify fields
161
+ that still need app-local setup by lifecycle and scope:
162
+
163
+ | Need | Default primitive |
164
+ | --- | --- |
165
+ | Deploy- or app-level configuration | Runtime configuration or deployment env vars |
166
+ | Existing workspace/provider connection | Workspace-connection catalog/grant plus `resolveWorkspaceConnectionCredential(s)ForApp` |
167
+ | App-local API/service key with no reusable connection | `registerRequiredSecret({ kind: "api-key" })` and the vault |
168
+ | Authorization-code or refresh-token flow | `kind: "oauth"` with `@agent-native/core/oauth-tokens` |
169
+ | Account, customer, or other non-secret identifiers | Scoped connection metadata or app data |
170
+ | Provider-specific prerequisites, sequencing, or health | A thin app-local guide over the shared primitives |
171
+
172
+ Do not register every provider field as a generic secret, mark every field as
173
+ required, or create a second credential-management surface. One logical
174
+ connection should normally produce one onboarding outcome. A custom setup page
175
+ is appropriate only when it adds domain-specific guidance or readiness checks;
176
+ it should link to or call the shared settings, OAuth, and action surfaces rather
177
+ than duplicating their storage or transport.
178
+
155
179
  ## Reusable Kits
156
180
 
157
181
  - **Settings kit**: a searchable settings page with account, workspace, AI
@@ -3,8 +3,8 @@ name: secrets
3
3
  description: >-
4
4
  Declaratively register API keys and service credentials a template needs so
5
5
  they appear in the agent sidebar settings UI and the onboarding checklist.
6
- Use for any third-party API key (OpenAI, Stripe, Twilio, etc.) and for
7
- surfacing OAuth connections in the unified settings UI.
6
+ Use before adding any third-party credential or setup UI so API keys, OAuth
7
+ connections, and scoped configuration use the correct shared primitive.
8
8
  scope: dev
9
9
  metadata:
10
10
  internal: true
@@ -24,6 +24,33 @@ encrypted `app_secrets` vault, `saveCredential` / `resolveCredential`, OAuth, or
24
24
  `${keys.NAME}` substitution. Examples must use obvious placeholders such as
25
25
  `<OPENAI_API_KEY>` or `${keys.SLACK_WEBHOOK}`, not real-looking copied values.
26
26
 
27
+ ## Credential Modeling Preflight
28
+
29
+ Before registering a provider's fields, inspect the workspace/provider connection
30
+ catalog first. If a reusable connection exists, use its app grant and scoped
31
+ `resolveWorkspaceConnectionCredential(s)ForApp` path instead of registering a
32
+ parallel secret. Only classify fields for app-local setup when no reusable
33
+ connection exists:
34
+
35
+ - **API or service key** - register it as `kind: "api-key"` with the narrowest
36
+ correct `scope`, a human label, a description, a docs link, and a validator.
37
+ - **OAuth authorization or refresh token** - use the OAuth token store and
38
+ register a `kind: "oauth"` entry so the shared UI renders Connect and the
39
+ runtime owns status, refresh, and reauthorization.
40
+ - **Deploy- or app-level configuration** - use deployment/runtime
41
+ configuration, not a per-user secret row.
42
+ - **Account, customer, manager, or other non-secret identifier** - store it as
43
+ scoped connection metadata or app data, not as a masked secret field.
44
+
45
+ `required: true` is for a logical setup requirement. If a provider needs
46
+ several values, do not automatically create one required checklist item per
47
+ field; use one composite onboarding step or a registered connection readiness
48
+ check.
49
+
50
+ Custom setup UI is allowed for provider-specific prerequisites, ordering, or
51
+ health checks, but it must delegate credential storage and connection state to
52
+ the shared vault/OAuth/settings surfaces.
53
+
27
54
  ## When to use
28
55
 
29
56
  Use this for any external credential your template needs: API keys, service
@@ -25,6 +25,10 @@ the matching skill only when this app actually uses that workflow. The
25
25
  - Never hardcode API keys, tokens, webhook URLs, signing secrets, private
26
26
  Builder/internal data, customer data, or credential-looking literals. Use
27
27
  secrets/OAuth/runtime configuration and obvious placeholders in examples.
28
+ - For external integrations, inspect the workspace/provider connection catalog
29
+ first. Reuse an existing connection and its scoped credential resolver; only
30
+ use app-local vault/OAuth/settings primitives when no reusable connection
31
+ exists. Keep custom setup UI provider-specific and never duplicate storage.
28
32
  - Keep actions deterministic and focused. Research, analysis, generation,
29
33
  recommendation, and synthesis start in the AgentSidebar and let the agent
30
34
  orchestrate its tools; follow-ups stay in the same thread rather than moving
@@ -1,9 +1,14 @@
1
- import baseConfig from "@agent-native/core/vitest-config";
2
- import { mergeConfig } from "vitest/config";
1
+ import path from "node:path";
3
2
 
4
- import viteConfig from "./vite.config";
3
+ import { defineConfig } from "vitest/config";
5
4
 
6
- // Kept separate from vite.config.ts so the production config never imports
7
- // vitest: `agent-native build` loads vite.config.ts in installs where vitest
8
- // is absent.
9
- export default mergeConfig(viteConfig, baseConfig);
5
+ // Keep tests independent from vite.config.ts: the production config starts
6
+ // Nitro/Vite watchers and evaluates browser-targeted CommonJS SSR modules.
7
+ export default defineConfig({
8
+ resolve: {
9
+ alias: {
10
+ "@": path.resolve(__dirname, "./app"),
11
+ "@shared": path.resolve(__dirname, "./shared"),
12
+ },
13
+ },
14
+ });
@@ -76,6 +76,16 @@ Builder/internal data, or customer data in the action, UI, seed data, fixtures,
76
76
  docs, prompts, or generated extension/app content. Register required secrets,
77
77
  use OAuth helpers, or read scoped values from the vault/credential store.
78
78
 
79
+ Before writing custom setup or credential UI, perform the shared-primitive
80
+ preflight from `agent-native-toolkit`: inspect the workspace/provider connection
81
+ catalog first, then settings, secrets/vault, OAuth, onboarding, and provider API
82
+ support. Reuse an existing connection's app grant and scoped credential
83
+ resolver; only use app-local vault or OAuth primitives when no reusable
84
+ connection exists. Keep any wizard thin and provider-specific - it may explain
85
+ prerequisites, ordering, or readiness, but must not become a second vault or
86
+ custom credential transport. Do not mark each field `required` by reflex;
87
+ model onboarding around the logical connection outcome.
88
+
79
89
  If the feature involves attachments, images, recordings, screenshots, exports,
80
90
  or other file-like payloads, design the upload path in the same change:
81
91
  provider upload first, then URL/id/blob handle in SQL. Do not add base64/binary
@@ -152,6 +152,30 @@ preference, notification preference, or usage/billing surface, register it as a
152
152
  settings tab or app settings panel first. Only add sidebar UI when it is needed
153
153
  in the moment of agent use.
154
154
 
155
+ ## Integration Setup Preflight
156
+
157
+ Before building any setup, settings, credential, OAuth, or connection surface,
158
+ search the workspace/provider connection catalog first. If the provider already
159
+ has a reusable connection, use its catalog, app grant, and scoped credential
160
+ resolver rather than registering a parallel secret. Only then classify fields
161
+ that still need app-local setup by lifecycle and scope:
162
+
163
+ | Need | Default primitive |
164
+ | --- | --- |
165
+ | Deploy- or app-level configuration | Runtime configuration or deployment env vars |
166
+ | Existing workspace/provider connection | Workspace-connection catalog/grant plus `resolveWorkspaceConnectionCredential(s)ForApp` |
167
+ | App-local API/service key with no reusable connection | `registerRequiredSecret({ kind: "api-key" })` and the vault |
168
+ | Authorization-code or refresh-token flow | `kind: "oauth"` with `@agent-native/core/oauth-tokens` |
169
+ | Account, customer, or other non-secret identifiers | Scoped connection metadata or app data |
170
+ | Provider-specific prerequisites, sequencing, or health | A thin app-local guide over the shared primitives |
171
+
172
+ Do not register every provider field as a generic secret, mark every field as
173
+ required, or create a second credential-management surface. One logical
174
+ connection should normally produce one onboarding outcome. A custom setup page
175
+ is appropriate only when it adds domain-specific guidance or readiness checks;
176
+ it should link to or call the shared settings, OAuth, and action surfaces rather
177
+ than duplicating their storage or transport.
178
+
155
179
  ## Reusable Kits
156
180
 
157
181
  - **Settings kit**: a searchable settings page with account, workspace, AI
@@ -3,8 +3,8 @@ name: secrets
3
3
  description: >-
4
4
  Declaratively register API keys and service credentials a template needs so
5
5
  they appear in the agent sidebar settings UI and the onboarding checklist.
6
- Use for any third-party API key (OpenAI, Stripe, Twilio, etc.) and for
7
- surfacing OAuth connections in the unified settings UI.
6
+ Use before adding any third-party credential or setup UI so API keys, OAuth
7
+ connections, and scoped configuration use the correct shared primitive.
8
8
  scope: dev
9
9
  metadata:
10
10
  internal: true
@@ -24,6 +24,33 @@ encrypted `app_secrets` vault, `saveCredential` / `resolveCredential`, OAuth, or
24
24
  `${keys.NAME}` substitution. Examples must use obvious placeholders such as
25
25
  `<OPENAI_API_KEY>` or `${keys.SLACK_WEBHOOK}`, not real-looking copied values.
26
26
 
27
+ ## Credential Modeling Preflight
28
+
29
+ Before registering a provider's fields, inspect the workspace/provider connection
30
+ catalog first. If a reusable connection exists, use its app grant and scoped
31
+ `resolveWorkspaceConnectionCredential(s)ForApp` path instead of registering a
32
+ parallel secret. Only classify fields for app-local setup when no reusable
33
+ connection exists:
34
+
35
+ - **API or service key** - register it as `kind: "api-key"` with the narrowest
36
+ correct `scope`, a human label, a description, a docs link, and a validator.
37
+ - **OAuth authorization or refresh token** - use the OAuth token store and
38
+ register a `kind: "oauth"` entry so the shared UI renders Connect and the
39
+ runtime owns status, refresh, and reauthorization.
40
+ - **Deploy- or app-level configuration** - use deployment/runtime
41
+ configuration, not a per-user secret row.
42
+ - **Account, customer, manager, or other non-secret identifier** - store it as
43
+ scoped connection metadata or app data, not as a masked secret field.
44
+
45
+ `required: true` is for a logical setup requirement. If a provider needs
46
+ several values, do not automatically create one required checklist item per
47
+ field; use one composite onboarding step or a registered connection readiness
48
+ check.
49
+
50
+ Custom setup UI is allowed for provider-specific prerequisites, ordering, or
51
+ health checks, but it must delegate credential storage and connection state to
52
+ the shared vault/OAuth/settings surfaces.
53
+
27
54
  ## When to use
28
55
 
29
56
  Use this for any external credential your template needs: API keys, service
@@ -52,6 +52,10 @@ cross-cutting work and `self-modifying-code` when changing app source.
52
52
  and focused-object context.
53
53
  - Never hardcode keys, tokens, webhook URLs, private data, or credential-like
54
54
  literals. Use secrets, OAuth, or obvious placeholders.
55
+ - For external integrations, inspect the workspace/provider connection catalog
56
+ first. Reuse an existing connection and its scoped credential resolver; only
57
+ use app-local vault/OAuth/settings primitives when no reusable connection
58
+ exists. Keep custom setup UI provider-specific and never duplicate storage.
55
59
  - A missing or unreadable value must stay distinguishable from success. Throw or
56
60
  return an explicit error instead of silently falling back to an empty value.
57
61
 
@@ -152,6 +152,30 @@ preference, notification preference, or usage/billing surface, register it as a
152
152
  settings tab or app settings panel first. Only add sidebar UI when it is needed
153
153
  in the moment of agent use.
154
154
 
155
+ ## Integration Setup Preflight
156
+
157
+ Before building any setup, settings, credential, OAuth, or connection surface,
158
+ search the workspace/provider connection catalog first. If the provider already
159
+ has a reusable connection, use its catalog, app grant, and scoped credential
160
+ resolver rather than registering a parallel secret. Only then classify fields
161
+ that still need app-local setup by lifecycle and scope:
162
+
163
+ | Need | Default primitive |
164
+ | --- | --- |
165
+ | Deploy- or app-level configuration | Runtime configuration or deployment env vars |
166
+ | Existing workspace/provider connection | Workspace-connection catalog/grant plus `resolveWorkspaceConnectionCredential(s)ForApp` |
167
+ | App-local API/service key with no reusable connection | `registerRequiredSecret({ kind: "api-key" })` and the vault |
168
+ | Authorization-code or refresh-token flow | `kind: "oauth"` with `@agent-native/core/oauth-tokens` |
169
+ | Account, customer, or other non-secret identifiers | Scoped connection metadata or app data |
170
+ | Provider-specific prerequisites, sequencing, or health | A thin app-local guide over the shared primitives |
171
+
172
+ Do not register every provider field as a generic secret, mark every field as
173
+ required, or create a second credential-management surface. One logical
174
+ connection should normally produce one onboarding outcome. A custom setup page
175
+ is appropriate only when it adds domain-specific guidance or readiness checks;
176
+ it should link to or call the shared settings, OAuth, and action surfaces rather
177
+ than duplicating their storage or transport.
178
+
155
179
  ## Reusable Kits
156
180
 
157
181
  - **Settings kit**: a searchable settings page with account, workspace, AI
@@ -3,8 +3,8 @@ name: secrets
3
3
  description: >-
4
4
  Declaratively register API keys and service credentials a template needs so
5
5
  they appear in the agent sidebar settings UI and the onboarding checklist.
6
- Use for any third-party API key (OpenAI, Stripe, Twilio, etc.) and for
7
- surfacing OAuth connections in the unified settings UI.
6
+ Use before adding any third-party credential or setup UI so API keys, OAuth
7
+ connections, and scoped configuration use the correct shared primitive.
8
8
  scope: dev
9
9
  metadata:
10
10
  internal: true
@@ -24,6 +24,33 @@ encrypted `app_secrets` vault, `saveCredential` / `resolveCredential`, OAuth, or
24
24
  `${keys.NAME}` substitution. Examples must use obvious placeholders such as
25
25
  `<OPENAI_API_KEY>` or `${keys.SLACK_WEBHOOK}`, not real-looking copied values.
26
26
 
27
+ ## Credential Modeling Preflight
28
+
29
+ Before registering a provider's fields, inspect the workspace/provider connection
30
+ catalog first. If a reusable connection exists, use its app grant and scoped
31
+ `resolveWorkspaceConnectionCredential(s)ForApp` path instead of registering a
32
+ parallel secret. Only classify fields for app-local setup when no reusable
33
+ connection exists:
34
+
35
+ - **API or service key** - register it as `kind: "api-key"` with the narrowest
36
+ correct `scope`, a human label, a description, a docs link, and a validator.
37
+ - **OAuth authorization or refresh token** - use the OAuth token store and
38
+ register a `kind: "oauth"` entry so the shared UI renders Connect and the
39
+ runtime owns status, refresh, and reauthorization.
40
+ - **Deploy- or app-level configuration** - use deployment/runtime
41
+ configuration, not a per-user secret row.
42
+ - **Account, customer, manager, or other non-secret identifier** - store it as
43
+ scoped connection metadata or app data, not as a masked secret field.
44
+
45
+ `required: true` is for a logical setup requirement. If a provider needs
46
+ several values, do not automatically create one required checklist item per
47
+ field; use one composite onboarding step or a registered connection readiness
48
+ check.
49
+
50
+ Custom setup UI is allowed for provider-specific prerequisites, ordering, or
51
+ health checks, but it must delegate credential storage and connection state to
52
+ the shared vault/OAuth/settings surfaces.
53
+
27
54
  ## When to use
28
55
 
29
56
  Use this for any external credential your template needs: API keys, service
@@ -13,6 +13,10 @@ This app is not stateless. The Agent Native runtime uses SQL-backed stores for a
13
13
  ZIPs, screenshots, thumbnails, session replay chunks) in configured file/blob
14
14
  storage and persist only URLs, ids, or handles.
15
15
  - Do not hardcode API keys, tokens, webhook URLs, private data, or credential-looking literals.
16
+ - For external integrations, inspect the workspace/provider connection catalog
17
+ first. Reuse an existing connection and its scoped credential resolver; only
18
+ use app-local vault/OAuth/settings primitives when no reusable connection
19
+ exists. Keep custom setup UI provider-specific and never duplicate storage.
16
20
  - `actions/run.ts` is the CLI dispatcher for `pnpm action ...`, not an app
17
21
  action. Leave it in place and add callable primitives as separate
18
22
  `actions/<name>.ts` files.
@@ -76,6 +76,16 @@ Builder/internal data, or customer data in the action, UI, seed data, fixtures,
76
76
  docs, prompts, or generated extension/app content. Register required secrets,
77
77
  use OAuth helpers, or read scoped values from the vault/credential store.
78
78
 
79
+ Before writing custom setup or credential UI, perform the shared-primitive
80
+ preflight from `agent-native-toolkit`: inspect the workspace/provider connection
81
+ catalog first, then settings, secrets/vault, OAuth, onboarding, and provider API
82
+ support. Reuse an existing connection's app grant and scoped credential
83
+ resolver; only use app-local vault or OAuth primitives when no reusable
84
+ connection exists. Keep any wizard thin and provider-specific - it may explain
85
+ prerequisites, ordering, or readiness, but must not become a second vault or
86
+ custom credential transport. Do not mark each field `required` by reflex;
87
+ model onboarding around the logical connection outcome.
88
+
79
89
  If the feature involves attachments, images, recordings, screenshots, exports,
80
90
  or other file-like payloads, design the upload path in the same change:
81
91
  provider upload first, then URL/id/blob handle in SQL. Do not add base64/binary
@@ -152,6 +152,30 @@ preference, notification preference, or usage/billing surface, register it as a
152
152
  settings tab or app settings panel first. Only add sidebar UI when it is needed
153
153
  in the moment of agent use.
154
154
 
155
+ ## Integration Setup Preflight
156
+
157
+ Before building any setup, settings, credential, OAuth, or connection surface,
158
+ search the workspace/provider connection catalog first. If the provider already
159
+ has a reusable connection, use its catalog, app grant, and scoped credential
160
+ resolver rather than registering a parallel secret. Only then classify fields
161
+ that still need app-local setup by lifecycle and scope:
162
+
163
+ | Need | Default primitive |
164
+ | --- | --- |
165
+ | Deploy- or app-level configuration | Runtime configuration or deployment env vars |
166
+ | Existing workspace/provider connection | Workspace-connection catalog/grant plus `resolveWorkspaceConnectionCredential(s)ForApp` |
167
+ | App-local API/service key with no reusable connection | `registerRequiredSecret({ kind: "api-key" })` and the vault |
168
+ | Authorization-code or refresh-token flow | `kind: "oauth"` with `@agent-native/core/oauth-tokens` |
169
+ | Account, customer, or other non-secret identifiers | Scoped connection metadata or app data |
170
+ | Provider-specific prerequisites, sequencing, or health | A thin app-local guide over the shared primitives |
171
+
172
+ Do not register every provider field as a generic secret, mark every field as
173
+ required, or create a second credential-management surface. One logical
174
+ connection should normally produce one onboarding outcome. A custom setup page
175
+ is appropriate only when it adds domain-specific guidance or readiness checks;
176
+ it should link to or call the shared settings, OAuth, and action surfaces rather
177
+ than duplicating their storage or transport.
178
+
155
179
  ## Reusable Kits
156
180
 
157
181
  - **Settings kit**: a searchable settings page with account, workspace, AI
@@ -3,8 +3,8 @@ name: secrets
3
3
  description: >-
4
4
  Declaratively register API keys and service credentials a template needs so
5
5
  they appear in the agent sidebar settings UI and the onboarding checklist.
6
- Use for any third-party API key (OpenAI, Stripe, Twilio, etc.) and for
7
- surfacing OAuth connections in the unified settings UI.
6
+ Use before adding any third-party credential or setup UI so API keys, OAuth
7
+ connections, and scoped configuration use the correct shared primitive.
8
8
  scope: dev
9
9
  metadata:
10
10
  internal: true
@@ -24,6 +24,33 @@ encrypted `app_secrets` vault, `saveCredential` / `resolveCredential`, OAuth, or
24
24
  `${keys.NAME}` substitution. Examples must use obvious placeholders such as
25
25
  `<OPENAI_API_KEY>` or `${keys.SLACK_WEBHOOK}`, not real-looking copied values.
26
26
 
27
+ ## Credential Modeling Preflight
28
+
29
+ Before registering a provider's fields, inspect the workspace/provider connection
30
+ catalog first. If a reusable connection exists, use its app grant and scoped
31
+ `resolveWorkspaceConnectionCredential(s)ForApp` path instead of registering a
32
+ parallel secret. Only classify fields for app-local setup when no reusable
33
+ connection exists:
34
+
35
+ - **API or service key** - register it as `kind: "api-key"` with the narrowest
36
+ correct `scope`, a human label, a description, a docs link, and a validator.
37
+ - **OAuth authorization or refresh token** - use the OAuth token store and
38
+ register a `kind: "oauth"` entry so the shared UI renders Connect and the
39
+ runtime owns status, refresh, and reauthorization.
40
+ - **Deploy- or app-level configuration** - use deployment/runtime
41
+ configuration, not a per-user secret row.
42
+ - **Account, customer, manager, or other non-secret identifier** - store it as
43
+ scoped connection metadata or app data, not as a masked secret field.
44
+
45
+ `required: true` is for a logical setup requirement. If a provider needs
46
+ several values, do not automatically create one required checklist item per
47
+ field; use one composite onboarding step or a registered connection readiness
48
+ check.
49
+
50
+ Custom setup UI is allowed for provider-specific prerequisites, ordering, or
51
+ health checks, but it must delegate credential storage and connection state to
52
+ the shared vault/OAuth/settings surfaces.
53
+
27
54
  ## When to use
28
55
 
29
56
  Use this for any external credential your template needs: API keys, service
@@ -98,3 +98,7 @@ file plus `.agents/skills/` for workspace-specific conventions.
98
98
  | --- | --- |
99
99
  | `docs-search` | Search version-matched framework docs by query or slug, or list |
100
100
  | `source-search` | Search the bundled core/template source corpus by pattern or path |
101
+
102
+ - For external integrations, check the provider connection catalog first; reuse
103
+ its scoped resolver before app-local vault/OAuth/settings. Custom UI is for
104
+ provider readiness only, never duplicate credential storage.
@@ -164,6 +164,15 @@ an additional locale or changelog.
164
164
  - Dispatch vault access is workspace-wide by default: every saved vault key is
165
165
  available to every workspace app. Only create or request per-app vault grants
166
166
  when Dispatch's vault access setting is switched to manual mode.
167
+ - Before implementing an app that connects to an external service, inspect the
168
+ workspace/provider connection catalog first. Reuse an existing connection and
169
+ its scoped credential resolver; only then use shared settings, vault, OAuth,
170
+ onboarding, and provider API primitives for app-local setup.
171
+ - Keep custom setup UI only for provider-specific prerequisites, sequencing,
172
+ readiness, or health checks. It must link to or call shared settings/OAuth and
173
+ action surfaces, not duplicate credential storage or transport. Model one
174
+ logical connection as one onboarding outcome instead of marking every field
175
+ required by reflex.
167
176
  - When an app needs a provider credential, read it through the framework's
168
177
  scoped secret or workspace-connection resolver so the Dispatch vault remains
169
178
  the source of truth. Framework apps should use `resolveSecret` from