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