@agent-native/core 0.165.0 → 0.165.2

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 (58) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/CHANGELOG.md +37 -3
  3. package/corpus/templates/analytics/changelog/2026-08-20-staged-data-limit-recovery.md +5 -0
  4. package/corpus/templates/assets/CHANGELOG.md +36 -2
  5. package/corpus/templates/brain/CHANGELOG.md +33 -3
  6. package/corpus/templates/calendar/CHANGELOG.md +45 -2
  7. package/corpus/templates/chat/CHANGELOG.md +29 -3
  8. package/corpus/templates/clips/CHANGELOG.md +55 -2
  9. package/corpus/templates/clips/app/i18n/en-US.ts +0 -9
  10. package/corpus/templates/clips/app/root.tsx +2 -1
  11. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +3 -3
  12. package/corpus/templates/clips/changelog/2026-08-20-cross-tab-recording-controls.md +5 -0
  13. package/corpus/templates/clips/changelog/2026-08-20-overlay-follow-review-fixes.md +5 -0
  14. package/corpus/templates/clips/changelog/2026-08-20-provider-key-recovery.md +5 -0
  15. package/corpus/templates/clips/chrome-extension/PERMISSIONS.md +29 -46
  16. package/corpus/templates/clips/chrome-extension/STORE_DRAFT.md +1 -1
  17. package/corpus/templates/clips/chrome-extension/public/manifest.json +9 -2
  18. package/corpus/templates/clips/chrome-extension/src/background.ts +65 -46
  19. package/corpus/templates/clips/chrome-extension/src/content-script.ts +25 -17
  20. package/corpus/templates/clips/chrome-extension/src/overlay-follow.ts +25 -0
  21. package/corpus/templates/content/CHANGELOG.md +45 -2
  22. package/corpus/templates/crm/CHANGELOG.md +28 -16
  23. package/corpus/templates/design/CHANGELOG.md +54 -2
  24. package/corpus/templates/dispatch/CHANGELOG.md +51 -2
  25. package/corpus/templates/dispatch/changelog/2026-08-20-dispatch-chat-loads-openrouter-provider-reliably.md +6 -0
  26. package/corpus/templates/dispatch/package.json +2 -0
  27. package/corpus/templates/factory/CHANGELOG.md +28 -2
  28. package/corpus/templates/forms/CHANGELOG.md +39 -3
  29. package/corpus/templates/macros/CHANGELOG.md +30 -2
  30. package/corpus/templates/macros/netlify.toml +2 -0
  31. package/corpus/templates/mail/CHANGELOG.md +34 -3
  32. package/corpus/templates/plan/CHANGELOG.md +34 -3
  33. package/corpus/templates/slides/CHANGELOG.md +73 -2
  34. package/corpus/templates/tasks/CHANGELOG.md +35 -0
  35. package/corpus/templates/tasks/app/root.tsx +8 -1
  36. package/dist/changelog/parse.d.ts +12 -4
  37. package/dist/changelog/parse.js +61 -23
  38. package/dist/cli/changelog.js +9 -11
  39. package/dist/client/chat/run-recovery.js +8 -3
  40. package/dist/client/integrations/IntegrationsPanel.js +12 -1
  41. package/dist/collab/routes.d.ts +1 -1
  42. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  43. package/dist/mcp-client/oauth-routes.d.ts +1 -0
  44. package/dist/mcp-client/oauth-routes.js +37 -9
  45. package/dist/mcp-client/remote-store.d.ts +12 -0
  46. package/dist/mcp-client/remote-store.js +71 -0
  47. package/dist/notifications/routes.d.ts +3 -3
  48. package/dist/provider-api/actions/provider-api.js +16 -4
  49. package/dist/resources/handlers.d.ts +2 -2
  50. package/dist/templates/chat/CHANGELOG.md +29 -3
  51. package/package.json +1 -1
  52. package/src/templates/chat/CHANGELOG.md +29 -3
  53. package/corpus/templates/.retired/issues/package.json +0 -7
  54. package/corpus/templates/.retired/meeting-notes/package.json +0 -7
  55. package/corpus/templates/.retired/recruiting/package.json +0 -7
  56. package/corpus/templates/.retired/scheduling/package.json +0 -7
  57. package/corpus/templates/.retired/voice/package.json +0 -7
  58. package/corpus/templates/voice/.agents/skills/upgrade-agent-native/SKILL.md +0 -87
@@ -8,7 +8,7 @@ import { getH3App } from "../server/framework-request-handler.js";
8
8
  import { getAppUrl, resolveOAuthRedirectUri } from "../server/google-oauth.js";
9
9
  import { runWithRequestContext } from "../server/request-context.js";
10
10
  import { finishMcpOAuthAuthorization, startMcpOAuthAuthorization, validateMcpOAuthCallbackIssuer, } from "./oauth-client.js";
11
- import { addOAuthRemoteServer, normalizeServerName, validateRemoteUrl, } from "./remote-store.js";
11
+ import { addOAuthRemoteServer, listRemoteServers, normalizeServerName, replaceOAuthRemoteServer, validateRemoteUrl, } from "./remote-store.js";
12
12
  const FLOW_COOKIE = "an_mcp_oauth_flow";
13
13
  const FLOW_TTL_SECONDS = 10 * 60;
14
14
  const FLOW_COOKIE_CHUNK_SIZE = 2_800;
@@ -69,8 +69,33 @@ async function handleMcpOAuthStart(event) {
69
69
  if (!session?.email)
70
70
  return unauthorized(event);
71
71
  const query = getQuery(event);
72
- const rawUrl = text(query.url);
73
- const rawName = text(query.name);
72
+ const reconnectServerId = text(query.serverId);
73
+ const reconnectScope = query.scope === "org" ? "org" : "user";
74
+ const reconnectOrg = reconnectScope === "org" ? await getOrgContext(event) : null;
75
+ const reconnectScopeId = reconnectScope === "user" ? session.email : (reconnectOrg?.orgId ?? "");
76
+ let reconnectServer;
77
+ if (reconnectServerId) {
78
+ if (reconnectScope === "org" &&
79
+ (!reconnectScopeId || !isOrgAdmin(reconnectOrg?.role))) {
80
+ setResponseStatus(event, reconnectScopeId ? 403 : 400);
81
+ return {
82
+ error: reconnectScopeId
83
+ ? "Only organization owners and admins can reconnect an org MCP server."
84
+ : "Join an organization before reconnecting an org MCP server.",
85
+ };
86
+ }
87
+ reconnectServer = (await listRemoteServers(reconnectScope, reconnectScopeId)).find((server) => server.id === reconnectServerId);
88
+ if (!reconnectServer) {
89
+ setResponseStatus(event, 404);
90
+ return { error: "MCP server was not found." };
91
+ }
92
+ if (!reconnectServer.oauthSecretKey) {
93
+ setResponseStatus(event, 400);
94
+ return { error: "This MCP server does not use OAuth credentials." };
95
+ }
96
+ }
97
+ const rawUrl = reconnectServer?.url ?? text(query.url);
98
+ const rawName = reconnectServer?.name ?? text(query.name);
74
99
  const returnUrl = text(query.return);
75
100
  if (!rawUrl || !rawName) {
76
101
  setResponseStatus(event, 400);
@@ -159,6 +184,7 @@ async function handleMcpOAuthStart(event) {
159
184
  ? { discoveryState: started.discoveryState }
160
185
  : {}),
161
186
  ...(safeReturnUrl ? { returnUrl: safeReturnUrl } : {}),
187
+ ...(reconnectServerId ? { replaceServerId: reconnectServerId } : {}),
162
188
  expiresAt: Date.now() + FLOW_TTL_SECONDS * 1_000,
163
189
  };
164
190
  setMcpOAuthFlowCookie(event, flow, redirectUri.startsWith("https://"));
@@ -245,12 +271,14 @@ async function handleMcpOAuthCallback(event, options) {
245
271
  authorizationCode: code,
246
272
  iss,
247
273
  }));
248
- const result = await addOAuthRemoteServer(flow.scope, flow.scopeId, {
249
- name: flow.name,
250
- url: flow.url,
251
- description: flow.description,
252
- credentials: finished.credentials,
253
- });
274
+ const result = flow.replaceServerId
275
+ ? await replaceOAuthRemoteServer(flow.scope, flow.scopeId, flow.replaceServerId, finished.credentials)
276
+ : await addOAuthRemoteServer(flow.scope, flow.scopeId, {
277
+ name: flow.name,
278
+ url: flow.url,
279
+ description: flow.description,
280
+ credentials: finished.credentials,
281
+ });
254
282
  if (!result.ok) {
255
283
  setResponseStatus(event, 400);
256
284
  return { error: result.error };
@@ -107,6 +107,18 @@ export declare function addOAuthRemoteServer(scope: RemoteMcpScope, scopeId: str
107
107
  ok: false;
108
108
  error: string;
109
109
  }>;
110
+ /**
111
+ * Replace the OAuth grant for an existing server without changing its id or
112
+ * display name. Reconnect must update the saved grant in place; registering a
113
+ * second row makes the original connection impossible to repair.
114
+ */
115
+ export declare function replaceOAuthRemoteServer(scope: RemoteMcpScope, scopeId: string, serverId: string, credentials: McpOAuthCredentialBundle): Promise<{
116
+ ok: true;
117
+ server: StoredRemoteMcpServer;
118
+ } | {
119
+ ok: false;
120
+ error: string;
121
+ }>;
110
122
  export declare function addFirstPartyRemoteServer(orgId: string, input: {
111
123
  appId: string;
112
124
  name: string;
@@ -193,6 +193,77 @@ export async function addOAuthRemoteServer(scope, scopeId, input) {
193
193
  };
194
194
  }
195
195
  }
196
+ /**
197
+ * Replace the OAuth grant for an existing server without changing its id or
198
+ * display name. Reconnect must update the saved grant in place; registering a
199
+ * second row makes the original connection impossible to repair.
200
+ */
201
+ export async function replaceOAuthRemoteServer(scope, scopeId, serverId, credentials) {
202
+ const credentialResource = validateRemoteUrl(credentials.serverUrl);
203
+ if (!credentialResource.ok || !credentialResource.url) {
204
+ return {
205
+ ok: false,
206
+ error: "MCP server URL must match the OAuth credential resource URL",
207
+ };
208
+ }
209
+ const existing = await readList(scope, scopeId);
210
+ const index = existing.findIndex((server) => server.id === serverId);
211
+ const current = index >= 0 ? existing[index] : undefined;
212
+ if (!current)
213
+ return { ok: false, error: "MCP server was not found" };
214
+ if (!current.oauthSecretKey) {
215
+ return {
216
+ ok: false,
217
+ error: "This MCP server does not use OAuth credentials",
218
+ };
219
+ }
220
+ if (current.url !== credentialResource.url.toString()) {
221
+ return {
222
+ ok: false,
223
+ error: "MCP server URL must match the saved OAuth connection",
224
+ };
225
+ }
226
+ const nextSecretKey = `mcp_oauth:${shortId()}`;
227
+ const nextCredentials = {
228
+ ...credentials,
229
+ serverUrl: credentialResource.url.toString(),
230
+ };
231
+ try {
232
+ await saveMcpOAuthCredentials({
233
+ key: nextSecretKey,
234
+ scope,
235
+ scopeId,
236
+ credentials: nextCredentials,
237
+ });
238
+ const server = {
239
+ ...current,
240
+ url: nextCredentials.serverUrl,
241
+ oauthSecretKey: nextSecretKey,
242
+ };
243
+ const next = [...existing];
244
+ next[index] = server;
245
+ await writeList(scope, scopeId, next);
246
+ await revokeMcpOAuthCredentials({
247
+ key: current.oauthSecretKey,
248
+ scope,
249
+ scopeId,
250
+ serverUrl: current.url,
251
+ }).catch(() => undefined);
252
+ return { ok: true, server };
253
+ }
254
+ catch (err) {
255
+ await revokeMcpOAuthCredentials({
256
+ key: nextSecretKey,
257
+ scope,
258
+ scopeId,
259
+ serverUrl: nextCredentials.serverUrl,
260
+ }).catch(() => undefined);
261
+ return {
262
+ ok: false,
263
+ error: `Failed to replace MCP OAuth credentials: ${err?.message ?? err}`,
264
+ };
265
+ }
266
+ }
196
267
  export async function addFirstPartyRemoteServer(orgId, input) {
197
268
  const trust = await isFirstPartyRemoteEndpointTrusted(orgId, input.appId, input.url);
198
269
  if (!trust.ok)
@@ -16,18 +16,18 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  ok?: undefined;
17
17
  error?: undefined;
18
18
  } | {
19
- count?: undefined;
20
19
  updated: number;
21
20
  ok?: undefined;
22
21
  error?: undefined;
23
- } | {
24
22
  count?: undefined;
23
+ } | {
25
24
  updated?: undefined;
26
25
  error: string;
27
26
  ok?: undefined;
28
- } | {
29
27
  count?: undefined;
28
+ } | {
30
29
  updated?: undefined;
31
30
  ok: boolean;
32
31
  error?: undefined;
32
+ count?: undefined;
33
33
  }>>;
@@ -193,6 +193,13 @@ export function createProviderApiDocsSchema(providerSchema = z.string().min(1))
193
193
  search: WebContentSearchSchema.optional().describe("Optional post-fetch search over extracted content by default. Supports query, queries, terms, regex, source, maxMatches, and contextChars."),
194
194
  });
195
195
  }
196
+ const STAGED_DATASET_CAP_ERROR = /Staged dataset (?:byte )?cap exceeded/i;
197
+ function rethrowStagingError(error) {
198
+ if (error instanceof Error && STAGED_DATASET_CAP_ERROR.test(error.message)) {
199
+ throw new Error(`${error.message} Recover by deleting older staged datasets with list-staged-datasets/delete-staged-dataset, or switch this request to saveToFile / a smaller staged result before trying again.`, { cause: error });
200
+ }
201
+ throw error;
202
+ }
196
203
  export function createProviderApiRequestAction(runtime, options = {}) {
197
204
  const schema = options.schema ?? createProviderApiRequestSchema();
198
205
  return defineAction({
@@ -244,10 +251,15 @@ export function createProviderApiRequestAction(runtime, options = {}) {
244
251
  if (!ownerEmail) {
245
252
  throw new Error("No authenticated context for provider API staging.");
246
253
  }
247
- return stagingExecuteRequest(args, runtime.executeRequest, {
248
- appId: options.appId,
249
- ownerEmail,
250
- });
254
+ try {
255
+ return await stagingExecuteRequest(args, runtime.executeRequest, {
256
+ appId: options.appId,
257
+ ownerEmail,
258
+ });
259
+ }
260
+ catch (error) {
261
+ rethrowStagingError(error);
262
+ }
251
263
  }
252
264
  return runtime.executeRequest(args);
253
265
  },
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
51
51
  error: string;
52
52
  ok?: undefined;
53
53
  } | {
54
- ok: boolean;
55
54
  error?: undefined;
55
+ ok: boolean;
56
56
  }>;
57
57
  /** POST /_agent-native/resources/upload — upload a file as a resource */
58
58
  export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
73
73
  runId: string | null;
74
74
  expiresAt: number | null;
75
75
  metadata: string | null;
76
+ error?: undefined;
76
77
  url: string;
77
78
  provider: string;
78
79
  storageSetupRequired?: undefined;
79
- error?: undefined;
80
80
  } | {
81
81
  error: string;
82
82
  storageSetupRequired: boolean;
@@ -3,8 +3,34 @@
3
3
  All notable user-facing changes to Chat are documented here. Open it any
4
4
  time from the command menu (Cmd+K → "What's new").
5
5
 
6
- ## 2026-06-23
6
+ Older updates live in [the changelog folder](./changelog/) and are included in the in-app "What's new" view.
7
7
 
8
- ### Added
8
+ ## 2026-08-11
9
9
 
10
- - See what's new right inside Chat — a changelog now lives in the command menu (Cmd+K).
10
+ ### Fixed
11
+
12
+ - Chrome no longer offers to install Chat as a desktop app.
13
+
14
+ ## 2026-08-10
15
+
16
+ ### Improved
17
+
18
+ - Full-page chat now uses the available width up to 1000px for more comfortable prompts and responses.
19
+
20
+ ## 2026-07-31
21
+
22
+ ### Improved
23
+
24
+ - Clicking the Agent Native logo now toggles the app sidebar.
25
+
26
+ ## 2026-07-29
27
+
28
+ ### Improved
29
+
30
+ - Sidebar footers now keep Feedback, Search, and Collapse together without a separate language shortcut.
31
+
32
+ ## 2026-07-25
33
+
34
+ ### Improved
35
+
36
+ - Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.165.0",
3
+ "version": "0.165.2",
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": {
@@ -3,8 +3,34 @@
3
3
  All notable user-facing changes to Chat are documented here. Open it any
4
4
  time from the command menu (Cmd+K → "What's new").
5
5
 
6
- ## 2026-06-23
6
+ Older updates live in [the changelog folder](./changelog/) and are included in the in-app "What's new" view.
7
7
 
8
- ### Added
8
+ ## 2026-08-11
9
9
 
10
- - See what's new right inside Chat — a changelog now lives in the command menu (Cmd+K).
10
+ ### Fixed
11
+
12
+ - Chrome no longer offers to install Chat as a desktop app.
13
+
14
+ ## 2026-08-10
15
+
16
+ ### Improved
17
+
18
+ - Full-page chat now uses the available width up to 1000px for more comfortable prompts and responses.
19
+
20
+ ## 2026-07-31
21
+
22
+ ### Improved
23
+
24
+ - Clicking the Agent Native logo now toggles the app sidebar.
25
+
26
+ ## 2026-07-29
27
+
28
+ ### Improved
29
+
30
+ - Sidebar footers now keep Feedback, Search, and Collapse together without a separate language shortcut.
31
+
32
+ ## 2026-07-25
33
+
34
+ ### Improved
35
+
36
+ - Settings navigation now keeps Manage agent as a dedicated linked destination at the bottom.
@@ -1,7 +0,0 @@
1
- {
2
- "name": "issues",
3
- "private": true,
4
- "scripts": {
5
- "build": "node ../../../scripts/build-retired-netlify-site.ts issues"
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "meeting-notes",
3
- "private": true,
4
- "scripts": {
5
- "build": "node ../../../scripts/build-retired-netlify-site.ts meeting-notes"
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "recruiting",
3
- "private": true,
4
- "scripts": {
5
- "build": "node ../../../scripts/build-retired-netlify-site.ts recruiting"
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "scheduling",
3
- "private": true,
4
- "scripts": {
5
- "build": "node ../../../scripts/build-retired-netlify-site.ts scheduling"
6
- }
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "voice",
3
- "private": true,
4
- "scripts": {
5
- "build": "node ../../../scripts/build-retired-netlify-site.ts voice"
6
- }
7
- }
@@ -1,87 +0,0 @@
1
- ---
2
- name: upgrade-agent-native
3
- description: >-
4
- Bring an older Agent Native app or workspace current. Use when updating
5
- @agent-native/core, fixing a broken upgrade, or when tempted to patch or
6
- override core/dispatch packages to make an old branch run.
7
- scope: dev
8
- metadata:
9
- internal: true
10
- ---
11
-
12
- # Upgrade Agent Native
13
-
14
- ## Rule
15
-
16
- When an older Agent Native app/branch needs to run on current packages, use
17
- `agent-native upgrade`. Never "fix" upgrade breakage with
18
- `pnpm.overrides`, `patchedDependencies`, `resolutions`, local patches, or
19
- edits under `node_modules/@agent-native/*` — especially not against
20
- `@agent-native/core` or `@agent-native/dispatch`.
21
-
22
- ## Why
23
-
24
- Agents often respond to a failed core bump by inventing framework patches and
25
- dispatch behavior overrides. That hides the real app-level break, drifts from
26
- upstream, and makes the next upgrade worse. The supported path is bump →
27
- install → refresh scaffold skills → verify, then fix **app** code only.
28
-
29
- ## How
30
-
31
- 1. **Doctor first (optional but recommended)**
32
-
33
- ```bash
34
- npx @agent-native/core@latest upgrade check
35
- ```
36
-
37
- This reports framework overrides/patches and pending `@agent-native/*`
38
- bumps. If overrides/patches are present, remove them before continuing.
39
-
40
- 2. **Run the upgrade**
41
-
42
- ```bash
43
- npx @agent-native/core@latest upgrade
44
- ```
45
-
46
- Or from an already-installed CLI: `pnpm exec agent-native upgrade` /
47
- `agent-native upgrade`.
48
-
49
- What it does:
50
-
51
- - Blocks (unless `--force`) when `@agent-native/*` overrides/patches exist
52
- - Rewrites non-local `@agent-native/*` dependency pins to `latest`
53
- - Runs the package manager install
54
- - Runs `skills update scaffold --project`
55
- - Runs `typecheck` when the project has that script
56
-
57
- 3. **If upgrade or typecheck fails**
58
-
59
- - Read the concrete error
60
- - Fix **app** source, actions, config, or env — not framework packages
61
- - Re-run `agent-native upgrade` or `pnpm typecheck`
62
- - Stop and ask the user if you cannot fix the app-level error
63
-
64
- 4. **Dry-run / partial runs**
65
-
66
- ```bash
67
- agent-native upgrade --dry-run
68
- agent-native upgrade --skip-verify
69
- agent-native upgrade --skip-install # package.json bumps only
70
- ```
71
-
72
- ## Don't
73
-
74
- - Don't add `pnpm.overrides`, `overrides`, `resolutions`, or
75
- `patchedDependencies` for any `@agent-native/*` package
76
- - Don't edit `node_modules/@agent-native/core` or
77
- `node_modules/@agent-native/dispatch`
78
- - Don't invent local "dispatch behavior" shims to paper over version skew
79
- - Don't keep iterating with more framework patches after a failed install
80
- - Don't skip `skills update scaffold --project` after a core bump (the
81
- upgrade command does this for you)
82
-
83
- ## Related Skills
84
-
85
- - **self-modifying-code** — Tier 4: framework packages are off limits
86
- - **agent-native-docs** — version-matched docs after the bump
87
- - **portability** — keep app code provider-agnostic across upgrades