@agent-native/core 0.16.1 → 0.16.3

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 (123) hide show
  1. package/README.md +21 -5
  2. package/dist/cli/code-agent-executor.js +1 -1
  3. package/dist/cli/code-agent-executor.js.map +1 -1
  4. package/dist/cli/code.d.ts.map +1 -1
  5. package/dist/cli/code.js +29 -4
  6. package/dist/cli/code.js.map +1 -1
  7. package/dist/client/AgentPanel.d.ts.map +1 -1
  8. package/dist/client/AgentPanel.js +9 -1
  9. package/dist/client/AgentPanel.js.map +1 -1
  10. package/dist/client/AssistantChat.js +2 -2
  11. package/dist/client/AssistantChat.js.map +1 -1
  12. package/dist/client/ConnectBuilderCard.js +1 -1
  13. package/dist/client/ConnectBuilderCard.js.map +1 -1
  14. package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
  15. package/dist/client/components/CodeRequiredDialog.js +3 -1
  16. package/dist/client/components/CodeRequiredDialog.js.map +1 -1
  17. package/dist/client/composer/AgentComposerFrame.d.ts +3 -1
  18. package/dist/client/composer/AgentComposerFrame.d.ts.map +1 -1
  19. package/dist/client/composer/AgentComposerFrame.js +3 -3
  20. package/dist/client/composer/AgentComposerFrame.js.map +1 -1
  21. package/dist/client/composer/ComposerPlusMenu.d.ts.map +1 -1
  22. package/dist/client/composer/ComposerPlusMenu.js +2 -7
  23. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  24. package/dist/client/composer/PromptComposer.d.ts +4 -1
  25. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  26. package/dist/client/composer/PromptComposer.js +3 -3
  27. package/dist/client/composer/PromptComposer.js.map +1 -1
  28. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  29. package/dist/client/composer/TiptapComposer.js +13 -3
  30. package/dist/client/composer/TiptapComposer.js.map +1 -1
  31. package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
  32. package/dist/client/composer/useVoiceDictation.js +16 -10
  33. package/dist/client/composer/useVoiceDictation.js.map +1 -1
  34. package/dist/client/onboarding/OnboardingPanel.js +1 -1
  35. package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
  36. package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -1
  37. package/dist/client/settings/BackgroundAgentSection.js +9 -2
  38. package/dist/client/settings/BackgroundAgentSection.js.map +1 -1
  39. package/dist/client/settings/BrowserSection.d.ts.map +1 -1
  40. package/dist/client/settings/BrowserSection.js +17 -3
  41. package/dist/client/settings/BrowserSection.js.map +1 -1
  42. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  43. package/dist/client/settings/SettingsPanel.js +5 -5
  44. package/dist/client/settings/SettingsPanel.js.map +1 -1
  45. package/dist/client/settings/useBuilderStatus.d.ts +15 -2
  46. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  47. package/dist/client/settings/useBuilderStatus.js +99 -11
  48. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  49. package/dist/client/settings/useBuilderStatus.spec.js +12 -6
  50. package/dist/client/settings/useBuilderStatus.spec.js.map +1 -1
  51. package/dist/code-agents/background-controller.d.ts +39 -0
  52. package/dist/code-agents/background-controller.d.ts.map +1 -0
  53. package/dist/code-agents/background-controller.js +249 -0
  54. package/dist/code-agents/background-controller.js.map +1 -0
  55. package/dist/code-agents/background-run.d.ts +58 -0
  56. package/dist/code-agents/background-run.d.ts.map +1 -0
  57. package/dist/code-agents/background-run.js +58 -0
  58. package/dist/code-agents/background-run.js.map +1 -0
  59. package/dist/code-agents/index.d.ts +2 -0
  60. package/dist/code-agents/index.d.ts.map +1 -1
  61. package/dist/code-agents/index.js +2 -0
  62. package/dist/code-agents/index.js.map +1 -1
  63. package/dist/connections/index.d.ts +1 -0
  64. package/dist/connections/index.d.ts.map +1 -1
  65. package/dist/connections/index.js +1 -0
  66. package/dist/connections/index.js.map +1 -1
  67. package/dist/connections/reader.d.ts +248 -0
  68. package/dist/connections/reader.d.ts.map +1 -0
  69. package/dist/connections/reader.js +461 -0
  70. package/dist/connections/reader.js.map +1 -0
  71. package/dist/credentials/index.d.ts +11 -0
  72. package/dist/credentials/index.d.ts.map +1 -1
  73. package/dist/credentials/index.js +40 -15
  74. package/dist/credentials/index.js.map +1 -1
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +2 -2
  78. package/dist/index.js.map +1 -1
  79. package/dist/server/agent-chat-plugin.d.ts +18 -0
  80. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  81. package/dist/server/agent-chat-plugin.js +57 -9
  82. package/dist/server/agent-chat-plugin.js.map +1 -1
  83. package/dist/server/agent-teams.d.ts +66 -1
  84. package/dist/server/agent-teams.d.ts.map +1 -1
  85. package/dist/server/agent-teams.js +433 -16
  86. package/dist/server/agent-teams.js.map +1 -1
  87. package/dist/server/builder-browser.d.ts +11 -0
  88. package/dist/server/builder-browser.d.ts.map +1 -1
  89. package/dist/server/builder-browser.js +45 -0
  90. package/dist/server/builder-browser.js.map +1 -1
  91. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  92. package/dist/server/core-routes-plugin.js +25 -2
  93. package/dist/server/core-routes-plugin.js.map +1 -1
  94. package/dist/templates/workspace-root/AGENTS.md +5 -5
  95. package/dist/templates/workspace-root/README.md +1 -1
  96. package/dist/workspace-connections/credentials.d.ts +64 -0
  97. package/dist/workspace-connections/credentials.d.ts.map +1 -0
  98. package/dist/workspace-connections/credentials.js +378 -0
  99. package/dist/workspace-connections/credentials.js.map +1 -0
  100. package/dist/workspace-connections/index.d.ts +2 -1
  101. package/dist/workspace-connections/index.d.ts.map +1 -1
  102. package/dist/workspace-connections/index.js +2 -1
  103. package/dist/workspace-connections/index.js.map +1 -1
  104. package/dist/workspace-connections/store.d.ts +16 -0
  105. package/dist/workspace-connections/store.d.ts.map +1 -1
  106. package/dist/workspace-connections/store.js +57 -1
  107. package/dist/workspace-connections/store.js.map +1 -1
  108. package/docs/content/agent-teams.md +22 -5
  109. package/docs/content/cloneable-saas.md +2 -2
  110. package/docs/content/code-agents-ui.md +103 -3
  111. package/docs/content/creating-templates.md +16 -0
  112. package/docs/content/getting-started.md +40 -14
  113. package/docs/content/migration-workbench.md +25 -2
  114. package/docs/content/multi-app-workspace.md +1 -1
  115. package/docs/content/template-analytics.md +17 -1
  116. package/docs/content/template-brain.md +57 -28
  117. package/docs/content/template-dispatch.md +9 -2
  118. package/docs/content/workspace-connections.md +63 -14
  119. package/docs/content/workspace-management.md +9 -2
  120. package/docs/content/workspace.md +12 -5
  121. package/package.json +1 -1
  122. package/src/templates/workspace-root/AGENTS.md +5 -5
  123. package/src/templates/workspace-root/README.md +1 -1
@@ -5,19 +5,26 @@ description: "Shared provider metadata, grants, and credential refs for connect-
5
5
 
6
6
  # Workspace Connections
7
7
 
8
- Workspace connections are the framework path toward "connect once, grant apps,
9
- use everywhere" integrations. The workspace/Dispatch layer records provider
10
- accounts once, grants apps such as Brain, Analytics, Mail, and Dispatch access,
11
- and lets each app's UI and agent inspect safe integration metadata before
12
- asking for another credential.
8
+ Workspace connections are the framework primitive for reusable integration
9
+ metadata. They make "connect once, grant apps, reuse credentials" possible
10
+ without pretending every provider is fully generic. The workspace/Dispatch
11
+ layer records provider accounts once, grants apps such as Brain, Analytics,
12
+ Mail, and Dispatch access, and lets each app's UI and agent inspect safe
13
+ integration metadata before asking for another credential.
13
14
 
14
- They have two shared pieces:
15
+ They have three shared pieces:
15
16
 
16
17
  - A typed provider catalog that templates import to describe the external
17
18
  systems they understand.
18
19
  - A scoped SQL store for connected accounts plus per-app grants, so Dispatch or
19
20
  another workspace setup flow can connect Slack, GitHub, Google Drive, Granola,
20
21
  or another provider once and then grant individual apps access.
22
+ - A conservative provider-reader registry/runtime that standardizes provider
23
+ `search`, `get`, and `listRecent` contracts and calls registered handlers
24
+ through granted workspace connections.
25
+ - An app-local boundary: the shared connection owns provider identity,
26
+ credential refs, account metadata, and grants; each app owns the source
27
+ choices and interpretation that only make sense inside that app.
21
28
 
22
29
  The store records provider ids, account labels, non-secret config, credential
23
30
  reference names, health state, and grant rows. It does not run OAuth and never
@@ -25,6 +32,14 @@ returns secret values. Secret values stay in the credential vault and are
25
32
  resolved by actions at execution time from the request's user/org/workspace
26
33
  scope.
27
34
 
35
+ That boundary is intentional. What is reusable today is provider identity,
36
+ credential-reference resolution, per-app grants, provider readiness, safe
37
+ account metadata, and the normalized provider-reader contract. What is not yet
38
+ generic is most live provider API reading, OAuth flow ownership, ingestion
39
+ cursors, source filters, sync cadence, and domain interpretation. Those stay in
40
+ the app that owns the workflow unless a reader implementation is explicitly
41
+ promoted to shared.
42
+
28
43
  Dispatch exposes the first control-plane implementation through the
29
44
  `list-workspace-connections`, `upsert-workspace-connection`, and
30
45
  `set-workspace-connection-grant` actions. App-specific actions then consume the
@@ -32,6 +47,22 @@ same records. Brain uses `list-connection-providers`; Analytics uses
32
47
  `data-source-status`; future apps should expose the same kind of readiness
33
48
  summary before asking users for duplicate provider keys.
34
49
 
50
+ ## Provider Reader Runtime
51
+
52
+ The provider-reader layer is a contract first, not a promise that every
53
+ provider has a shared live reader. Reader definitions describe supported
54
+ operations, credential requirements, and implementation status:
55
+ `metadata-only`, `template-owned`, or `shared`. The runtime resolves the granted
56
+ workspace connection and credential refs for an app, calls a registered handler,
57
+ and returns normalized items without exposing secret values.
58
+
59
+ Initial providers such as Slack, GitHub, Notion, HubSpot, Gmail, Google Drive,
60
+ and generic sources have conservative definitions. Most live handlers remain
61
+ template-owned today, which means Brain still owns Slack/GitHub ingestion
62
+ behavior and Analytics still owns analytics interpretation. Promote a reader to
63
+ `shared` only when the provider-specific API calls, pagination, permissions,
64
+ and result semantics are truly reusable across templates.
65
+
35
66
  ## Provider Catalog
36
67
 
37
68
  Import the catalog from `@agent-native/core/connections`:
@@ -169,15 +200,15 @@ it?"
169
200
  Use both together:
170
201
 
171
202
  1. Dispatch or another workspace setup flow creates/grants the underlying vault
172
- secret.
203
+ secret or OAuth credential reference.
173
204
  2. The workspace connection store records the provider account, safe metadata,
174
205
  credential refs, and app grants.
175
206
  3. Each app reads provider metadata from the catalog and connection/grant
176
207
  summaries from the shared store.
177
208
  4. The app UI shows readiness: connected, granted but unhealthy, needs grant,
178
209
  missing credentials, or metadata-only.
179
- 5. App-specific SQL stores only app-specific source ids, cursors, filters, and
180
- user choices.
210
+ 5. App-specific SQL stores only app-specific source ids, cursors, filters,
211
+ sync windows, metric definitions, review rules, and user choices.
181
212
  6. App actions resolve credentials at execution time through granted connection
182
213
  refs and the vault, and never return secret values.
183
214
 
@@ -210,10 +241,10 @@ Use a connect-once flow before app-specific source setup:
210
241
  filters, cursors, or sync cadence.
211
242
  5. Agents inspect readiness and grants before asking for new credentials.
212
243
 
213
- This keeps the UX clean: users connect Slack, GitHub, HubSpot, Google Drive,
214
- Granola, and similar providers once, then choose which apps may use that
215
- connection without duplicating secrets or scattering account setup across every
216
- template.
244
+ This keeps the UX clean without overclaiming the abstraction: users connect
245
+ Slack, GitHub, HubSpot, Google Drive, Granola, and similar providers once, then
246
+ choose which apps may use the credential/account metadata. Each app still
247
+ decides what data to read, how to read it, and what the data means.
217
248
 
218
249
  ## Build A Reusable Connector Once
219
250
 
@@ -233,7 +264,9 @@ three layers:
233
264
  Do not duplicate OAuth/token storage in each app. The connection record should
234
265
  say "this is Acme Slack and its token lives at `SLACK_BOT_TOKEN`"; the app-local
235
266
  source should say "Brain may ingest `#product` and `#dev-fusion` from that
236
- Slack connection."
267
+ Slack connection." The Slack API handler, cursor, retry policy, and
268
+ distillation rules still belong to Brain unless and until those pieces are
269
+ promoted to a shared provider-reader implementation.
237
270
 
238
271
  ### Dispatch control-plane setup
239
272
 
@@ -452,6 +485,19 @@ await upsertWorkspaceConnectionGrant({
452
485
  | **Mail** | A Mail readiness action using the same catalog helper | Mailboxes, labels, reply rules, CRM enrichment preferences |
453
486
  | **Agents** | App readiness actions before asking for secrets | No secret values; only cite provider ids, grant state, next steps |
454
487
 
488
+ Analytics data sources are app-owned even when their credentials come from a
489
+ workspace connection. A HubSpot or GitHub grant tells Analytics which provider
490
+ account it may use; the Analytics app still owns the source-of-truth decision,
491
+ warehouse-vs-live-provider choice, metric definitions, dashboard semantics, and
492
+ saved analyses.
493
+
494
+ Brain's "ask across everything" direction should be federated rather than
495
+ centralized. Brain can answer from reviewed Brain knowledge and raw captures it
496
+ is allowed to search. When a question needs live app-owned data such as current
497
+ analytics metrics, mail state, calendar availability, or Dispatch runtime
498
+ policy, Brain should delegate to the specialized app agent or action and cite
499
+ that result instead of trying to own every app's reader locally.
500
+
455
501
  Agents should follow a simple rule: if a user asks to connect Slack, GitHub,
456
502
  HubSpot, Gmail, Google Drive, Granola, or another shared provider, inspect the
457
503
  workspace connection catalog first. If the provider is `connected`, use it. If
@@ -504,6 +550,9 @@ layer:
504
550
  - Federated search can ask for providers with `search`, `docs`, `messages`,
505
551
  `meetings`, `crm`, or `code` capabilities instead of hardcoding every app's
506
552
  connector list.
553
+ - Provider-specific readers, OAuth refresh flows, ingestion checkpoints, and
554
+ app-owned data models can become shared later, but they are not implied by a
555
+ workspace connection today.
507
556
 
508
557
  Keep the boundary strict: provider metadata is safe to show; credential values
509
558
  stay in the vault.
@@ -187,7 +187,7 @@ The [Dispatch](/docs/dispatch) app is the workspace's runtime control plane. It
187
187
  | Who can access secrets | — | Vault policy, grants, request workflow |
188
188
  | What instructions agents follow | — | Global workspace resources (AGENTS.md, instructions, skills) |
189
189
  | Which agents are shared | — | Workspace agent profiles |
190
- | Integration inventory | — | Integrations catalog |
190
+ | Integration inventory | — | Workspace connections and integrations catalog |
191
191
  | Runtime change approval | — | Dispatch approval flow |
192
192
  | Audit trail | `git log` / `git blame` | Vault audit + dispatch audit logs |
193
193
  | Messaging & routing | — | Slack / Telegram integration |
@@ -197,7 +197,11 @@ The [Dispatch](/docs/dispatch) app is the workspace's runtime control plane. It
197
197
  ### What Dispatch Manages
198
198
 
199
199
  - **Vault** — store credentials centrally and sync on demand. The default policy makes all vault keys available to all workspace apps; manual mode requires specific app grants. Non-admins can request access; admins approve.
200
- - **Integrations catalog** — see which credentials each app needs, what's configured, what's missing, what's granted from the vault.
200
+ - **Reusable integrations** — connect provider accounts once, store safe
201
+ credential refs and account metadata, and grant apps access without copying
202
+ secrets. Dispatch is the control plane for provider inventory, repair,
203
+ grants, and audit; the vault/secrets layer owns values; each app keeps its
204
+ own source configuration and interpretation.
201
205
  - **Workspace resources** — manage global skills, always-on guardrail instructions, reusable agent profiles, and reference resources inherited by apps. Use `AGENTS.md` or `instructions/<slug>.md` for instructions loaded every turn, `skills/<slug>/SKILL.md` for on-demand skills, and `context/<slug>.md` for brand/company/product knowledge. Scope to All apps for workspace defaults; apps read those defaults at runtime with no copy or manual sync step, and app shared or personal resources can override locally. The Resources page highlights the starter global context files, can restore missing starter files, and each app card shows the exact inherited/granted resources that app receives.
202
206
  - **Approvals** — require review before runtime changes (destinations, settings) take effect.
203
207
  - **Audit** — full history of secret access, grants, syncs, and changes.
@@ -253,6 +257,9 @@ For a new workspace, after running `agent-native create`:
253
257
  - [ ] Add shared secrets to the vault (API keys, OAuth credentials, etc.)
254
258
  - [ ] Keep the default all-apps vault policy or switch to manual per-app grants
255
259
  - [ ] Sync vault secrets to push them to apps
260
+ - [ ] Register reusable workspace connections for shared provider accounts, then
261
+ grant apps such as Brain, Analytics, Mail, or Dispatch only when they need
262
+ that account
256
263
  - [ ] Add workspace-wide skills, guardrail instructions, and brand/company reference resources via the Resources page: `context/company.md`, `context/brand.md`, `context/messaging.md`, `instructions/guardrails.md`, and `skills/company-voice/SKILL.md`
257
264
  - [ ] Configure the approval policy and approver emails
258
265
  - [ ] Set up SendGrid (`SENDGRID_API_KEY`, `SENDGRID_FROM_EMAIL`) for admin notifications
@@ -283,11 +283,12 @@ Users can edit these memory files directly in the Workspace tab — they're regu
283
283
 
284
284
  ## Workspace Connections {#workspace-connections}
285
285
 
286
- Workspace Connections are the reusable integration metadata layer for apps that
287
- need the same third-party account. A connection records the provider, account
288
- label, status, scopes, allowed app slugs, and credential references in portable
289
- SQL. Secrets stay in the scoped credential store; connection records should only
290
- point at credential keys such as `SLACK_BOT_TOKEN` or `GITHUB_TOKEN`.
286
+ Workspace Connections are the reusable integration framework primitive for apps
287
+ that need the same third-party account. A connection records provider identity,
288
+ account labels, status, scopes, app grants, and credential references in
289
+ portable SQL. Secrets stay in the scoped credential store; connection records
290
+ should only point at credential keys such as `SLACK_BOT_TOKEN` or
291
+ `GITHUB_TOKEN`.
291
292
 
292
293
  This is the foundation for “connect once, use everywhere”: Brain can ingest
293
294
  approved repositories, Analytics can analyze the same provider later, and
@@ -295,6 +296,12 @@ Dispatch can remain the control plane for sharing credentials and policy. The
295
296
  initial API lives in `@agent-native/core/workspace-connections` and is scoped by
296
297
  the active request user/org.
297
298
 
299
+ The boundary is deliberate: reusable connections own provider identity and
300
+ grants; app-local source config still belongs to the app. Brain decides which
301
+ channels, repositories, captures, review gates, and citations are allowed.
302
+ Analytics decides which source is authoritative for a metric and stores the
303
+ dashboard, dictionary, and analysis context.
304
+
298
305
  See [Workspace Connections](/docs/workspace-connections) for the reusable
299
306
  connector pattern, app grant/readiness APIs, and concrete Slack, HubSpot, and
300
307
  GitHub examples.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "type": "module",
5
5
  "description": "Framework for agent-native application development — where AI agents and UI share state via files",
6
6
  "license": "MIT",
@@ -60,15 +60,15 @@ coding agents can discover the same workspace-wide guidance from the root.
60
60
  - Do not satisfy a new-app request by adding a route, page, component, or file
61
61
  to `apps/starter` or another existing app unless the user explicitly asks to
62
62
  modify that existing app.
63
- - Treat first-party apps such as Mail, Calendar, Analytics, and Dispatch as
63
+ - Treat first-party apps such as Mail, Calendar, Analytics, Brain, and Dispatch as
64
64
  existing hosted/connected neighbors available through links and A2A/default
65
- connected agents. For example, Mail, Calendar, and Analytics already exist at
65
+ connected agents. For example, Mail, Calendar, Analytics, and Brain already exist at
66
66
  `https://mail.agent-native.com`, `https://calendar.agent-native.com`, and
67
- `https://analytics.agent-native.com`.
68
- - If a new app needs to use Mail, Calendar, Analytics, or similar first-party
67
+ `https://analytics.agent-native.com`, and `https://brain.agent-native.com`.
68
+ - If a new app needs to use Mail, Calendar, Analytics, Brain, or similar first-party
69
69
  data/agents, build only the genuinely new workflow and delegate/link to those
70
70
  existing apps. Do not create wrapper apps, child apps, nested template copies,
71
- or cloned Mail/Calendar/Analytics implementations inside the new app just to
71
+ or cloned Mail/Calendar/Analytics/Brain implementations inside the new app just to
72
72
  provide access.
73
73
  - Only create a first-party app copy when the user explicitly asks for a
74
74
  customized fork/copy of that app. Otherwise prefer the hosted/shared app so
@@ -116,7 +116,7 @@ separate workspace app registry to edit. React Router apps must preserve
116
116
  For requests phrased as creating an "agent", classify the scope first: simple
117
117
  recurring Dispatch behavior can stay in Dispatch, while a robust app-like
118
118
  teammate should become a real workspace app listed with the rest of the apps.
119
- First-party apps such as Mail, Calendar, Analytics, and Dispatch should be
119
+ First-party apps such as Mail, Calendar, Analytics, Brain, and Dispatch should be
120
120
  treated as existing hosted or connected neighbors. If a new app needs access to
121
121
  their data or agents, link/delegate to those apps through the workspace/A2A
122
122
  path rather than creating wrapper apps, child apps, or cloned template copies