@wix/evalforge-evaluator 0.13.0 → 0.14.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
@@ -6381,10 +6381,10 @@ async function executeWithClaudeCode(skill, scenario, options) {
6381
6381
  console.error(errorStack);
6382
6382
  }
6383
6383
  if (sdkError && typeof sdkError === "object") {
6384
- const errObj = sdkError;
6384
+ const errObj2 = sdkError;
6385
6385
  console.error("[SDK-ERROR] Error object properties:");
6386
- for (const key of Object.keys(errObj)) {
6387
- const value = errObj[key];
6386
+ for (const key of Object.keys(errObj2)) {
6387
+ const value = errObj2[key];
6388
6388
  if (value !== void 0 && key !== "stack") {
6389
6389
  try {
6390
6390
  const valueStr = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
@@ -6394,7 +6394,7 @@ async function executeWithClaudeCode(skill, scenario, options) {
6394
6394
  }
6395
6395
  }
6396
6396
  }
6397
- const sdkErrorKeys = [
6397
+ const sdkErrorKeys2 = [
6398
6398
  "code",
6399
6399
  "status",
6400
6400
  "statusCode",
@@ -6417,19 +6417,19 @@ async function executeWithClaudeCode(skill, scenario, options) {
6417
6417
  "spawnargs"
6418
6418
  ];
6419
6419
  const extraInfo = {};
6420
- for (const key of sdkErrorKeys) {
6421
- if (key in errObj && errObj[key] !== void 0) {
6422
- extraInfo[key] = errObj[key];
6420
+ for (const key of sdkErrorKeys2) {
6421
+ if (key in errObj2 && errObj2[key] !== void 0) {
6422
+ extraInfo[key] = errObj2[key];
6423
6423
  }
6424
6424
  }
6425
6425
  if (Object.keys(extraInfo).length > 0) {
6426
6426
  console.error("[SDK-ERROR] SDK-specific error details:");
6427
6427
  console.error(JSON.stringify(extraInfo, null, 2));
6428
6428
  }
6429
- if (errObj.cause && typeof errObj.cause === "object") {
6429
+ if (errObj2.cause && typeof errObj2.cause === "object") {
6430
6430
  console.error("[SDK-ERROR] Error cause:");
6431
6431
  try {
6432
- console.error(JSON.stringify(errObj.cause, null, 2));
6432
+ console.error(JSON.stringify(errObj2.cause, null, 2));
6433
6433
  } catch {
6434
6434
  console.error("[SDK-ERROR] Error cause: [cannot serialize]");
6435
6435
  }
@@ -6453,17 +6453,60 @@ async function executeWithClaudeCode(skill, scenario, options) {
6453
6453
  console.error("[SDK-ERROR] USER:", process.env.USER);
6454
6454
  console.error("[SDK-ERROR] SHELL:", process.env.SHELL);
6455
6455
  console.error("[SDK-ERROR] ==========================================");
6456
+ const errObj = sdkError;
6457
+ const sdkSpecificInfo = {};
6458
+ const sdkErrorKeys = [
6459
+ "exitCode",
6460
+ "stderr",
6461
+ "stdout",
6462
+ "signal",
6463
+ "killed",
6464
+ "code",
6465
+ "status",
6466
+ "errno",
6467
+ "syscall",
6468
+ "spawnargs"
6469
+ ];
6470
+ for (const key of sdkErrorKeys) {
6471
+ if (errObj && key in errObj && errObj[key] !== void 0) {
6472
+ const val = errObj[key];
6473
+ if (typeof val === "string" && val.length > 500) {
6474
+ sdkSpecificInfo[key] = val.substring(0, 500) + "... [truncated]";
6475
+ } else {
6476
+ sdkSpecificInfo[key] = val;
6477
+ }
6478
+ }
6479
+ }
6480
+ let causeInfo;
6481
+ if (errObj?.cause && typeof errObj.cause === "object") {
6482
+ try {
6483
+ const causeStr = JSON.stringify(errObj.cause, null, 2);
6484
+ causeInfo = causeStr.length > 500 ? causeStr.substring(0, 500) + "... [truncated]" : causeStr;
6485
+ } catch {
6486
+ causeInfo = "[cannot serialize cause]";
6487
+ }
6488
+ }
6489
+ const sdkEnvDebug = {
6490
+ ANTHROPIC_BASE_URL: sdkEnv.ANTHROPIC_BASE_URL,
6491
+ hasANTHROPIC_API_KEY: !!sdkEnv.ANTHROPIC_API_KEY,
6492
+ hasANTHROPIC_AUTH_TOKEN: !!sdkEnv.ANTHROPIC_AUTH_TOKEN,
6493
+ hasANTHROPIC_CUSTOM_HEADERS: !!sdkEnv.ANTHROPIC_CUSTOM_HEADERS,
6494
+ ANTHROPIC_CUSTOM_HEADERS_preview: sdkEnv.ANTHROPIC_CUSTOM_HEADERS ? sdkEnv.ANTHROPIC_CUSTOM_HEADERS.split("\n").map((h) => h.split(":")[0]).join(", ") : void 0
6495
+ };
6456
6496
  const errorDetails = {
6457
6497
  messageCount,
6458
6498
  errorName,
6459
6499
  errorMessage,
6460
6500
  skillId: skill.id,
6461
6501
  scenarioId: scenario.id,
6462
- model: options.model || DEFAULT_MODEL
6502
+ model: options.model || DEFAULT_MODEL,
6503
+ sdkEnv: sdkEnvDebug,
6504
+ sdkError: Object.keys(sdkSpecificInfo).length > 0 ? sdkSpecificInfo : void 0,
6505
+ cause: causeInfo
6463
6506
  };
6464
6507
  throw new Error(
6465
6508
  `Claude SDK execution failed after ${messageCount} messages: ${errorMessage}
6466
- Details: ${JSON.stringify(errorDetails)}` + (errorStack ? `
6509
+ Details: ${JSON.stringify(errorDetails, null, 2)}` + (errorStack ? `
6467
6510
  Stack: ${errorStack.split("\n").slice(0, 5).join("\n")}` : "")
6468
6511
  );
6469
6512
  }