@agent-native/core 0.222.2 → 0.222.3-nightly-20261029212408

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.
@@ -3107,7 +3107,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
3107
3107
  }
3108
3108
  yield event;
3109
3109
  }
3110
- if (run.streamClosed || run.terminal)
3110
+ if ((run.streamClosed || run.terminal) && !run.cancelling)
3111
3111
  return;
3112
3112
  await notifyWhenChanged(run, signal);
3113
3113
  }
@@ -3310,27 +3310,39 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
3310
3310
  const cancellation = cancelCoreTurn(run, "user");
3311
3311
  run.streamClosed = true;
3312
3312
  run.terminal = true;
3313
- let result;
3313
+ // Stopping the turn can end its event stream before the cancel settles,
3314
+ // and the pump wakes readers when it does. Without this hold they would
3315
+ // see a closed run and leave before the cancelled events below exist.
3316
+ run.cancelling = true;
3314
3317
  try {
3315
- result = await cancellation;
3316
- }
3317
- catch (error) {
3318
- run.streamClosed = streamWasClosed;
3319
- run.terminal = false;
3320
- ensurePump(run);
3321
- throw error;
3318
+ let result;
3319
+ try {
3320
+ result = await cancellation;
3321
+ }
3322
+ catch (error) {
3323
+ run.streamClosed = streamWasClosed;
3324
+ run.terminal = false;
3325
+ ensurePump(run);
3326
+ throw error;
3327
+ }
3328
+ if (result.status === "unsupported") {
3329
+ run.streamClosed = streamWasClosed;
3330
+ run.terminal = false;
3331
+ ensurePump(run);
3332
+ throw new Error("The Core runtime does not support run cancellation.");
3333
+ }
3334
+ run.waitingForContinuation = false;
3335
+ delete run.pendingApprovalId;
3336
+ run.terminalSource = "local";
3337
+ run.cancelling = false;
3338
+ append(run, { type: "run.status", status: "cancelled" });
3339
+ append(run, { type: "run.cancelled" });
3322
3340
  }
3323
- if (result.status === "unsupported") {
3324
- run.streamClosed = streamWasClosed;
3325
- run.terminal = false;
3326
- ensurePump(run);
3327
- throw new Error("The Core runtime does not support run cancellation.");
3341
+ finally {
3342
+ run.cancelling = false;
3343
+ for (const listener of run.listeners)
3344
+ listener();
3328
3345
  }
3329
- run.waitingForContinuation = false;
3330
- run.pendingApprovalId = undefined;
3331
- run.terminalSource = "local";
3332
- append(run, { type: "run.status", status: "cancelled" });
3333
- append(run, { type: "run.cancelled" });
3334
3346
  },
3335
3347
  async dispose() {
3336
3348
  if (disposed)
@@ -3343,6 +3355,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
3343
3355
  for (const run of runs.values()) {
3344
3356
  run.streamClosed = true;
3345
3357
  run.terminal = true;
3358
+ run.cancelling = false;
3346
3359
  run.waitingForContinuation = false;
3347
3360
  run.pendingApprovalId = undefined;
3348
3361
  for (const listener of run.listeners)
@@ -992,10 +992,7 @@ function patchNetlifyFunctionEntry(functionDir, app, workspaceApps, staticDir, w
992
992
  basePath,
993
993
  `${basePath}.data`,
994
994
  `${basePath}/*`,
995
- ...workspaceOAuthDiscoveryRoutes(app).flatMap(({ path, descendants }) => [
996
- path,
997
- ...(descendants ? [`${path}/*`] : []),
998
- ]),
995
+ ...netlifyOAuthDiscoveryPaths(app),
999
996
  ...rootGoogleCallbackPath,
1000
997
  ];
1001
998
  const normalizeBasePathHelper = app === "dispatch"
@@ -1063,7 +1060,7 @@ export const config = {
1063
1060
  path: ${JSON.stringify(pathConfig)},
1064
1061
  nodeBundler: "none",
1065
1062
  includedFiles: ["**"],
1066
- excludedPath: ${JSON.stringify(netlifyFunctionExcludedPaths(app, staticDir), null, 2)
1063
+ excludedPath: ${JSON.stringify(netlifyFunctionExcludedPaths(app, staticDir, workspaceApps), null, 2)
1067
1064
  .split("\n")
1068
1065
  .join("\n ")},
1069
1066
  preferStatic: false,
@@ -1160,13 +1157,29 @@ export default {
1160
1157
  `;
1161
1158
  fs.writeFileSync(entryPath, entry);
1162
1159
  }
1163
- function netlifyFunctionExcludedPaths(app, staticDir) {
1160
+ function netlifyFunctionExcludedPaths(app, staticDir, workspaceApps) {
1164
1161
  return [
1165
1162
  "/.netlify/*",
1166
1163
  `/${app}/assets/*`,
1167
1164
  ...netlifyPublicAssetPaths(app, staticDir),
1165
+ ...(app === "dispatch" ? netlifyAppOAuthDiscoveryPaths(workspaceApps) : []),
1168
1166
  ];
1169
1167
  }
1168
+ // Netlify does not prefer the most specific function path: when Dispatch's
1169
+ // `/.well-known/*` overlaps an app's exact discovery path, the function whose
1170
+ // name sorts first wins, so apps after "dispatch" got Dispatch's metadata.
1171
+ // Excluding each app's discovery paths from Dispatch leaves one match.
1172
+ function netlifyAppOAuthDiscoveryPaths(workspaceApps) {
1173
+ return workspaceApps
1174
+ .filter((entry) => entry.id !== "dispatch")
1175
+ .flatMap((entry) => netlifyOAuthDiscoveryPaths(entry.id));
1176
+ }
1177
+ function netlifyOAuthDiscoveryPaths(app) {
1178
+ return workspaceOAuthDiscoveryRoutes(app).flatMap(({ path, descendants }) => [
1179
+ path,
1180
+ ...(descendants ? [`${path}/*`] : []),
1181
+ ]);
1182
+ }
1170
1183
  function netlifyPublicAssetPaths(app, staticDir) {
1171
1184
  if (!fs.existsSync(staticDir))
1172
1185
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.222.2",
3
+ "version": "0.222.3-nightly-20261029212408",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -742,7 +742,7 @@
742
742
  "yaml": "^2.9.0",
743
743
  "yjs": "^13.6.33",
744
744
  "zod": "^4.3.6",
745
- "@agent-native/agentkit": "^0.222.2",
745
+ "@agent-native/agentkit": "^0.222.3-nightly-20261029212408",
746
746
  "@agent-native/recap-cli": "^0.5.93"
747
747
  },
748
748
  "devDependencies": {
@@ -814,7 +814,7 @@
814
814
  "xlsx": "^0.18.5"
815
815
  },
816
816
  "peerDependencies": {
817
- "@agent-native/core-corpus": ">=0.196.0",
817
+ "@agent-native/core-corpus": "0.222.3-nightly-20261029212408",
818
818
  "@ai-sdk/anthropic": ">=3",
819
819
  "@ai-sdk/cohere": ">=3",
820
820
  "@ai-sdk/google": ">=3",