@tangle-network/agent-app 0.60.286 → 0.60.287

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.
@@ -2106,7 +2106,11 @@ function isSandboxNotFoundError(value) {
2106
2106
  const error = record(value);
2107
2107
  return error?.name === "NotFoundError" || error?.code === "NOT_FOUND" || error?.status === 404;
2108
2108
  }
2109
- function terminalFailureMessage(error) {
2109
+ function isCanonicalUserStop(error) {
2110
+ return error === "Execution cancelled by user" || error === "Execution cancelled by the user";
2111
+ }
2112
+ function terminalFailureMessage(error, provenUserStop) {
2113
+ if (provenUserStop) return "Execution cancelled by the user";
2110
2114
  if (/\bENOSPC\b|no space left on device/i.test(error)) {
2111
2115
  return "The Sandbox ran out of disk space before the execution finished.";
2112
2116
  }
@@ -2276,7 +2280,7 @@ async function observeNativeCompletion(options) {
2276
2280
  parts: [],
2277
2281
  usage: usageFromResult(result),
2278
2282
  ...attributionFromResult(result),
2279
- error: terminalFailureMessage(result.error)
2283
+ error: terminalFailureMessage(result.error, run.status === "cancelled" && isCanonicalUserStop(result.error))
2280
2284
  });
2281
2285
  continue;
2282
2286
  }
@@ -2284,6 +2288,7 @@ async function observeNativeCompletion(options) {
2284
2288
  if ((run.status === "failed" || run.status === "cancelled") && interrupted.length === 1) {
2285
2289
  const message = recoverSandboxAssistantMessage(interrupted[0]);
2286
2290
  const result = replayableExecution(run) ? await exactSession.result({ executionId: turnId }) : void 0;
2291
+ const provenUserStop = run.status === "cancelled" && (isCanonicalUserStop(interrupted[0].metadata?.interruptReason) || isCanonicalUserStop(exactFailedResult(result, turnId, options.sessionId)?.error));
2287
2292
  recovered.push({
2288
2293
  turnId,
2289
2294
  state: "failed",
@@ -2291,7 +2296,7 @@ async function observeNativeCompletion(options) {
2291
2296
  parts: message.parts ?? [],
2292
2297
  usage: { ...message.usage, ...usageFromResult(result) },
2293
2298
  ...attributionFromResult(result),
2294
- error: terminalFailureMessage((typeof result?.error === "string" ? result.error : void 0) ?? interrupted[0].metadata?.interruptReason ?? (restarted ? RUNTIME_RESTARTED_ERROR : void 0) ?? status.failureReason?.message ?? "Native Sandbox execution failed.")
2299
+ error: terminalFailureMessage((typeof result?.error === "string" ? result.error : void 0) ?? interrupted[0].metadata?.interruptReason ?? (restarted ? RUNTIME_RESTARTED_ERROR : void 0) ?? status.failureReason?.message ?? "Native Sandbox execution failed.", provenUserStop)
2295
2300
  });
2296
2301
  continue;
2297
2302
  }