@agent-native/core 0.175.3 → 0.175.4-nightly-20260826190205

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 (36) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/clips/server/plugins/agent-chat.ts +3 -0
  3. package/corpus/templates/content/actions/_linked-local-document-edit.ts +167 -0
  4. package/corpus/templates/content/actions/edit-document.ts +181 -61
  5. package/corpus/templates/content/actions/import-content-source.ts +33 -1
  6. package/corpus/templates/content/actions/update-document.ts +2 -0
  7. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +68 -0
  8. package/corpus/templates/content/app/components/editor/LinkedLocalDocumentAgentBridge.tsx +245 -0
  9. package/corpus/templates/content/app/lib/local-content-source-files.ts +96 -9
  10. package/corpus/templates/content/shared/api.ts +2 -0
  11. package/corpus/templates/content/shared/content-source.ts +14 -0
  12. package/corpus/templates/content/shared/document-text-edits.ts +39 -0
  13. package/corpus/templates/content/shared/nfm.ts +347 -1
  14. package/corpus/templates/slides/server/plugins/agent-chat.ts +2 -0
  15. package/dist/agent/engine/ai-sdk-engine.js +14 -4
  16. package/dist/agent/engine/anthropic-engine.js +6 -4
  17. package/dist/agent/engine/builder-engine.js +11 -4
  18. package/dist/agent/engine/tool-name.d.ts +9 -0
  19. package/dist/agent/engine/tool-name.js +56 -0
  20. package/dist/agent/engine/translate-ai-sdk.d.ts +5 -3
  21. package/dist/agent/engine/translate-ai-sdk.js +16 -13
  22. package/dist/agent/engine/translate-anthropic.d.ts +8 -6
  23. package/dist/agent/engine/translate-anthropic.js +21 -22
  24. package/dist/agent/production-agent.js +23 -5
  25. package/dist/collab/routes.d.ts +1 -1
  26. package/dist/collab/struct-routes.d.ts +1 -1
  27. package/dist/extensions/fetch-tool.js +73 -5
  28. package/dist/extensions/proxy-security.d.ts +5 -0
  29. package/dist/extensions/proxy-security.js +21 -13
  30. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  31. package/dist/notifications/routes.d.ts +3 -3
  32. package/dist/server/agent-chat/context-tools.js +5 -0
  33. package/dist/server/credential-provider.js +47 -10
  34. package/dist/server/realtime-token.d.ts +1 -1
  35. package/docs/content/webmcp.mdx +5 -5
  36. package/package.json +1 -1
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
137
137
  inputSchema: {
138
138
  type: string;
139
139
  properties: {
140
+ count?: undefined;
140
141
  query?: undefined;
141
142
  minutes?: undefined;
142
143
  limit?: undefined;
143
144
  clientHint?: undefined;
144
145
  timestamp?: undefined;
145
146
  chapterId?: undefined;
146
- count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
+ count?: undefined;
162
163
  query: {
163
164
  type: string;
164
165
  description: string;
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
174
175
  clientHint?: undefined;
175
176
  timestamp?: undefined;
176
177
  chapterId?: undefined;
177
- count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
+ count?: undefined;
193
194
  minutes: {
194
195
  type: string;
195
196
  description: string;
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
199
200
  clientHint?: undefined;
200
201
  timestamp?: undefined;
201
202
  chapterId?: undefined;
202
- count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
+ count?: undefined;
219
220
  query: {
220
221
  type: string;
221
222
  description: string;
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
234
235
  };
235
236
  timestamp?: undefined;
236
237
  chapterId?: undefined;
237
- count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
+ count?: undefined;
253
254
  query?: undefined;
254
255
  minutes?: undefined;
255
256
  limit?: undefined;
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
263
264
  description: string;
264
265
  };
265
266
  chapterId?: undefined;
266
- count?: undefined;
267
267
  startAt?: undefined;
268
268
  endAt?: undefined;
269
269
  includeMicrophone?: undefined;
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
314
314
  type: string;
315
315
  required: string[];
316
316
  properties: {
317
+ count?: undefined;
317
318
  query?: undefined;
318
319
  minutes?: undefined;
319
320
  limit?: undefined;
320
321
  clientHint?: undefined;
321
322
  timestamp?: undefined;
322
323
  chapterId?: undefined;
323
- count?: undefined;
324
324
  startAt: {
325
325
  type: string;
326
326
  description: string;
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
349
349
  type: string;
350
350
  required: string[];
351
351
  properties: {
352
+ count?: undefined;
352
353
  query?: undefined;
353
354
  minutes?: undefined;
354
355
  limit?: undefined;
355
356
  clientHint?: undefined;
356
357
  timestamp?: undefined;
357
358
  chapterId?: undefined;
358
- count?: undefined;
359
359
  startAt?: undefined;
360
360
  endAt?: undefined;
361
361
  reason?: undefined;
@@ -16,18 +16,18 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  error?: undefined;
17
17
  ok?: undefined;
18
18
  } | {
19
+ count?: undefined;
19
20
  updated: number;
20
21
  error?: undefined;
21
22
  ok?: undefined;
22
- count?: undefined;
23
23
  } | {
24
+ count?: undefined;
24
25
  updated?: undefined;
25
26
  error: string;
26
27
  ok?: undefined;
27
- count?: undefined;
28
28
  } | {
29
+ count?: undefined;
29
30
  updated?: undefined;
30
31
  error?: undefined;
31
32
  ok: boolean;
32
- count?: undefined;
33
33
  }>>;
@@ -144,6 +144,11 @@ Use a natural-language \`message\` by default. The receiving app owns interpreta
144
144
  - Call your own app by name
145
145
  - Perform tasks you can accomplish with your own registered tools
146
146
 
147
+ Written todo lists, checklists, summaries, action-item lists, and prose plans
148
+ belong in the current chat. Do not route those ordinary outputs to Plan. Call
149
+ Plan only when the user explicitly asks for a visual or structured
150
+ Agent-Native Plan, a Plan artifact, or the Plans app.
151
+
147
152
  **ONLY use \`call-agent\` when:**
148
153
  - The user explicitly asks you to communicate with a different app
149
154
  - You need data that only another deployed app can provide
@@ -841,6 +841,38 @@ export async function resolveBuilderGatewayAuth() {
841
841
  ? { authorization: `Bearer ${legacyKey}`, spaceId: null, userId: null }
842
842
  : null;
843
843
  }
844
+ /**
845
+ * Both auth-failure markers below are fingerprinted on the credential VALUE, so
846
+ * a rotated or corrected credential never matches the old marker and is usable
847
+ * immediately — the TTL is not what unpins it. The TTL covers only the case
848
+ * where the SAME value starts working again: a plan upgrade, a re-enabled
849
+ * gateway, a transient upstream 401.
850
+ *
851
+ * Re-admitting on a flat timer means a credential that is simply wrong is
852
+ * retested on that cadence forever, and each retest is paid for by whichever
853
+ * user's turn happens to land first — they get a 401 while the next lane serves
854
+ * everyone after them. That is the whole shape of the recurring "the saved
855
+ * provider key was rejected" report. Back off per consecutive strike so a dead
856
+ * credential stops costing a turn every quarter hour, while one that genuinely
857
+ * recovers is still retried within the day.
858
+ */
859
+ const AUTH_FAILURE_MAX_TTL_MS = 24 * 60 * 60 * 1000;
860
+ const AUTH_FAILURE_MAX_STRIKES = 8;
861
+ function authFailureStrikes(row) {
862
+ const raw = row?.strikes;
863
+ return typeof raw === "number" && Number.isFinite(raw) && raw >= 1
864
+ ? Math.min(Math.floor(raw), AUTH_FAILURE_MAX_STRIKES)
865
+ : 1;
866
+ }
867
+ function authFailureTtlMs(baseTtlMs, row) {
868
+ return Math.min(baseTtlMs * 2 ** (authFailureStrikes(row) - 1), AUTH_FAILURE_MAX_TTL_MS);
869
+ }
870
+ /** Next strike count for a marker being (re-)armed on the same fingerprint. */
871
+ async function nextAuthFailureStrikes(settingKey) {
872
+ const { getSetting } = await import("../settings/store.js");
873
+ const prior = await getSetting(settingKey, { bypassCache: true });
874
+ return Math.min(authFailureStrikes(prior) + (prior ? 1 : 0), AUTH_FAILURE_MAX_STRIKES);
875
+ }
844
876
  const BUILDER_AUTH_FAILURE_SETTING_PREFIX = "builder-auth-failure:";
845
877
  /**
846
878
  * Stale markers expire so a rejected model or a transient gateway failure
@@ -873,10 +905,10 @@ export async function getBuilderCredentialAuthFailure(creds = {}) {
873
905
  if (!row)
874
906
  return null;
875
907
  const at = typeof row.at === "number" ? row.at : Date.now();
876
- if (Date.now() - at > BUILDER_AUTH_FAILURE_TTL_MS) {
877
- if (typeof settings.deleteSetting === "function") {
878
- await settings.deleteSetting(settingKey).catch(() => { });
879
- }
908
+ // Expired means "usable again", not "never failed": the row stays so the
909
+ // strike count survives, and a credential that fails on re-admission backs
910
+ // off further instead of resetting to the base TTL. A success clears it.
911
+ if (Date.now() - at > authFailureTtlMs(BUILDER_AUTH_FAILURE_TTL_MS, row)) {
880
912
  return null;
881
913
  }
882
914
  return {
@@ -902,12 +934,15 @@ export async function recordBuilderCredentialAuthFailure(details) {
902
934
  if (!fingerprint)
903
935
  return;
904
936
  const { putSetting } = await import("../settings/store.js");
905
- await putSetting(builderAuthFailureSettingKey(fingerprint), {
937
+ const settingKey = builderAuthFailureSettingKey(fingerprint);
938
+ const strikes = await nextAuthFailureStrikes(settingKey);
939
+ await putSetting(settingKey, {
906
940
  fingerprint,
907
941
  message: details?.message ||
908
942
  "Builder rejected the connected credentials. Reconnect Builder.io (free tier available).",
909
943
  ...(typeof details?.status === "number" && { status: details.status }),
910
944
  ...(details?.code && { code: details.code }),
945
+ strikes,
911
946
  at: Date.now(),
912
947
  ownerEmail: getRequestUserEmail() ?? null,
913
948
  orgId: getRequestOrgId() ?? null,
@@ -961,10 +996,9 @@ export async function getProviderCredentialAuthFailure(opts) {
961
996
  if (row.fingerprint !== fingerprint)
962
997
  return null;
963
998
  const at = typeof row.at === "number" ? row.at : Date.now();
964
- if (Date.now() - at > PROVIDER_AUTH_FAILURE_TTL_MS) {
965
- if (typeof settings.deleteSetting === "function") {
966
- await settings.deleteSetting(settingKey).catch(() => { });
967
- }
999
+ // See `getBuilderCredentialAuthFailure`: the row outlives its TTL so the
1000
+ // strike count does, and re-admission backs off instead of resetting.
1001
+ if (Date.now() - at > authFailureTtlMs(PROVIDER_AUTH_FAILURE_TTL_MS, row)) {
968
1002
  return null;
969
1003
  }
970
1004
  return {
@@ -994,12 +1028,15 @@ export async function recordProviderCredentialAuthFailure(opts) {
994
1028
  if (!fingerprint)
995
1029
  return;
996
1030
  const { putSetting } = await import("../settings/store.js");
997
- await putSetting(providerAuthFailureSettingKey(fingerprint), {
1031
+ const settingKey = providerAuthFailureSettingKey(fingerprint);
1032
+ const strikes = await nextAuthFailureStrikes(settingKey);
1033
+ await putSetting(settingKey, {
998
1034
  fingerprint,
999
1035
  key,
1000
1036
  message: opts.message || "The model provider rejected the saved API key.",
1001
1037
  ...(typeof opts.status === "number" && { status: opts.status }),
1002
1038
  ...(opts.code && { code: opts.code }),
1039
+ strikes,
1003
1040
  at: Date.now(),
1004
1041
  ownerEmail: getRequestUserEmail() ?? null,
1005
1042
  orgId: getRequestOrgId() ?? null,
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -13,11 +13,11 @@ discover them, and the browser mediates execution.
13
13
 
14
14
  The framework supports both directions:
15
15
 
16
- | You want to... | Use |
17
- | --- | --- |
18
- | Make selected actions in your app available to a browser agent | `createAgentNativeWebMcpRegistration` |
19
- | Let Agent-Native chat discover and call WebMCP tools in the current page | `createAgentNativeWebMcpClient` plus `webmcp` on `AgentNativeEmbedded` or `AgentNativeFrame` |
20
- | Connect a headless or remote agent to an app | [MCP Server](/docs/mcp-protocol), [External Agents](/docs/external-agents), or [A2A](/docs/a2a-protocol) |
16
+ | You want to... | Use |
17
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
18
+ | Make selected actions in your app available to a browser agent | `createAgentNativeWebMcpRegistration` |
19
+ | Let Agent-Native chat discover and call WebMCP tools in the current page | `createAgentNativeWebMcpClient` plus `webmcp` on `AgentNativeEmbedded` or `AgentNativeFrame` |
20
+ | Connect a headless or remote agent to an app | [MCP Server](/docs/mcp-protocol), [External Agents](/docs/external-agents), or [A2A](/docs/a2a-protocol) |
21
21
 
22
22
  WebMCP is not a network MCP server and does not make a closed app globally
23
23
  discoverable. A consuming agent needs an open, connected browser page and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.175.3",
3
+ "version": "0.175.4-nightly-20260826190205",
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": {