@tangle-network/agent-app 0.63.34 → 0.63.35

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.
@@ -38,7 +38,7 @@
38
38
  import type { SandboxInstance } from '@tangle-network/sandbox';
39
39
  import type { RouterTurnTool } from '../runtime/router-turn';
40
40
  import { type EscalationHint, type EscalationInput } from '../sandbox/escalation-speculator';
41
- import { type SandboxRunToolOptions } from '../sandbox/sandbox-run-tool';
41
+ import { SandboxRunError, type SandboxRunToolOptions } from '../sandbox/sandbox-run-tool';
42
42
  import { type ComputerStepOptions } from '../sandbox/computer-step';
43
43
  import type { PersistedChatMessageForTurn } from '../stream/index';
44
44
  import { type RouterTurnProducerOptions } from './router-producer';
@@ -64,6 +64,10 @@ export interface HybridTurnBox {
64
64
  /** Every computer failure with its cause. The producer already persists the redacted cause chain on the turn's
65
65
  * warning notice (`detail`), and logs it when this is omitted. */
66
66
  onFailure?: SandboxRunToolOptions['onFailure'];
67
+ /** What the turn's warning notice keeps as `detail` for a failed call. Members read that notice in the transcript.
68
+ * Default: the redacted cause chain ({@link sandboxRunFailureDetail}). Return undefined to keep a cause that holds
69
+ * private platform diagnostics off the transcript; `onFailure` still receives the full error. */
70
+ failureDetail?(error: SandboxRunError): string | undefined;
67
71
  /** The tool's name and description. Default `sandbox_run` and its shared description. */
68
72
  name?: string;
69
73
  description?: string;
@@ -79,7 +79,7 @@ import {
79
79
  turnCarriesFiles,
80
80
  turnPromptText,
81
81
  withProducerStream
82
- } from "../chunk-4CEIZZTH.js";
82
+ } from "../chunk-KYBE4UYT.js";
83
83
  import "../chunk-CWO2LHXH.js";
84
84
  import {
85
85
  sniffMimeFromName
@@ -465,10 +465,15 @@ function createHybridTurnProducer(options) {
465
465
  signal: stop,
466
466
  ...box.warm ? { warm: box.warm } : {},
467
467
  onFailure: (error, call) => {
468
- const detail = sandboxRunFailureDetail(error);
469
- if (call.callId) details.set(call.callId, detail);
468
+ const detail = box.failureDetail ? box.failureDetail(error) : sandboxRunFailureDetail(error);
469
+ if (call.callId && detail) details.set(call.callId, detail);
470
470
  if (box.onFailure) box.onFailure(error, call);
471
- else console.error(JSON.stringify({ event: "agent_app_sandbox_run_failed", callId: call.callId ?? null, code: error.code, detail }));
471
+ else console.error(JSON.stringify({
472
+ event: "agent_app_sandbox_run_failed",
473
+ callId: call.callId ?? null,
474
+ code: error.code,
475
+ detail: sandboxRunFailureDetail(error)
476
+ }));
472
477
  },
473
478
  ...box.name ? { name: box.name } : {},
474
479
  ...box.description ? { description: box.description } : {}
@@ -3943,4 +3948,4 @@ export {
3943
3948
  createChatTurnRoutes,
3944
3949
  streamChatRouteAsSandboxEvents
3945
3950
  };
3946
- //# sourceMappingURL=chunk-4CEIZZTH.js.map
3951
+ //# sourceMappingURL=chunk-KYBE4UYT.js.map