@wix/evalforge-evaluator 0.116.0 → 0.118.0

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.
package/build/index.mjs CHANGED
@@ -3113,9 +3113,24 @@ async function executeWithOpenCode(skills, scenario, options) {
3113
3113
  const errorMessage = sdkError instanceof Error ? sdkError.message : String(sdkError);
3114
3114
  const errorStack = sdkError instanceof Error ? sdkError.stack : void 0;
3115
3115
  const errorName = sdkError instanceof Error ? sdkError.name : "Unknown";
3116
+ const causeDetails = [];
3117
+ let current = sdkError;
3118
+ while (current instanceof Error && current.cause) {
3119
+ current = current.cause;
3120
+ if (current instanceof Error) {
3121
+ causeDetails.push(`${current.name}: ${current.message}`);
3122
+ } else {
3123
+ causeDetails.push(String(current));
3124
+ }
3125
+ }
3126
+ const causeChain = causeDetails.length > 0 ? `
3127
+ Cause chain: ${causeDetails.join(" -> ")}` : "";
3116
3128
  console.error("[SDK-ERROR] ====== OPENCODE SDK EXECUTION FAILED ======");
3117
3129
  console.error("[SDK-ERROR] Error name:", errorName);
3118
3130
  console.error("[SDK-ERROR] Error message:", errorMessage);
3131
+ if (causeDetails.length > 0) {
3132
+ console.error("[SDK-ERROR] Cause chain:", causeDetails.join(" -> "));
3133
+ }
3119
3134
  if (errorStack) {
3120
3135
  console.error("[SDK-ERROR] Stack:", errorStack);
3121
3136
  }
@@ -3132,7 +3147,10 @@ async function executeWithOpenCode(skills, scenario, options) {
3132
3147
  outputPreview: JSON.stringify({
3133
3148
  event: "sdk-execution-failed",
3134
3149
  error: errorMessage,
3135
- errorName
3150
+ errorName,
3151
+ ...causeDetails.length > 0 && {
3152
+ causeChain: causeDetails.join(" -> ")
3153
+ }
3136
3154
  }).slice(0, 2e3),
3137
3155
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3138
3156
  isComplete: true
@@ -3143,7 +3161,7 @@ async function executeWithOpenCode(skills, scenario, options) {
3143
3161
  );
3144
3162
  }
3145
3163
  throw new Error(
3146
- `OpenCode SDK execution failed: ${errorMessage}` + (errorStack ? `
3164
+ `OpenCode SDK execution failed: ${errorMessage}` + causeChain + (errorStack ? `
3147
3165
  Stack: ${errorStack.split("\n").slice(0, 5).join("\n")}` : "")
3148
3166
  );
3149
3167
  } finally {