@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.mjs CHANGED
@@ -6364,10 +6364,10 @@ async function executeWithClaudeCode(skill, scenario, options) {
6364
6364
  console.error(errorStack);
6365
6365
  }
6366
6366
  if (sdkError && typeof sdkError === "object") {
6367
- const errObj = sdkError;
6367
+ const errObj2 = sdkError;
6368
6368
  console.error("[SDK-ERROR] Error object properties:");
6369
- for (const key of Object.keys(errObj)) {
6370
- const value = errObj[key];
6369
+ for (const key of Object.keys(errObj2)) {
6370
+ const value = errObj2[key];
6371
6371
  if (value !== void 0 && key !== "stack") {
6372
6372
  try {
6373
6373
  const valueStr = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
@@ -6377,7 +6377,7 @@ async function executeWithClaudeCode(skill, scenario, options) {
6377
6377
  }
6378
6378
  }
6379
6379
  }
6380
- const sdkErrorKeys = [
6380
+ const sdkErrorKeys2 = [
6381
6381
  "code",
6382
6382
  "status",
6383
6383
  "statusCode",
@@ -6400,19 +6400,19 @@ async function executeWithClaudeCode(skill, scenario, options) {
6400
6400
  "spawnargs"
6401
6401
  ];
6402
6402
  const extraInfo = {};
6403
- for (const key of sdkErrorKeys) {
6404
- if (key in errObj && errObj[key] !== void 0) {
6405
- extraInfo[key] = errObj[key];
6403
+ for (const key of sdkErrorKeys2) {
6404
+ if (key in errObj2 && errObj2[key] !== void 0) {
6405
+ extraInfo[key] = errObj2[key];
6406
6406
  }
6407
6407
  }
6408
6408
  if (Object.keys(extraInfo).length > 0) {
6409
6409
  console.error("[SDK-ERROR] SDK-specific error details:");
6410
6410
  console.error(JSON.stringify(extraInfo, null, 2));
6411
6411
  }
6412
- if (errObj.cause && typeof errObj.cause === "object") {
6412
+ if (errObj2.cause && typeof errObj2.cause === "object") {
6413
6413
  console.error("[SDK-ERROR] Error cause:");
6414
6414
  try {
6415
- console.error(JSON.stringify(errObj.cause, null, 2));
6415
+ console.error(JSON.stringify(errObj2.cause, null, 2));
6416
6416
  } catch {
6417
6417
  console.error("[SDK-ERROR] Error cause: [cannot serialize]");
6418
6418
  }
@@ -6436,17 +6436,60 @@ async function executeWithClaudeCode(skill, scenario, options) {
6436
6436
  console.error("[SDK-ERROR] USER:", process.env.USER);
6437
6437
  console.error("[SDK-ERROR] SHELL:", process.env.SHELL);
6438
6438
  console.error("[SDK-ERROR] ==========================================");
6439
+ const errObj = sdkError;
6440
+ const sdkSpecificInfo = {};
6441
+ const sdkErrorKeys = [
6442
+ "exitCode",
6443
+ "stderr",
6444
+ "stdout",
6445
+ "signal",
6446
+ "killed",
6447
+ "code",
6448
+ "status",
6449
+ "errno",
6450
+ "syscall",
6451
+ "spawnargs"
6452
+ ];
6453
+ for (const key of sdkErrorKeys) {
6454
+ if (errObj && key in errObj && errObj[key] !== void 0) {
6455
+ const val = errObj[key];
6456
+ if (typeof val === "string" && val.length > 500) {
6457
+ sdkSpecificInfo[key] = val.substring(0, 500) + "... [truncated]";
6458
+ } else {
6459
+ sdkSpecificInfo[key] = val;
6460
+ }
6461
+ }
6462
+ }
6463
+ let causeInfo;
6464
+ if (errObj?.cause && typeof errObj.cause === "object") {
6465
+ try {
6466
+ const causeStr = JSON.stringify(errObj.cause, null, 2);
6467
+ causeInfo = causeStr.length > 500 ? causeStr.substring(0, 500) + "... [truncated]" : causeStr;
6468
+ } catch {
6469
+ causeInfo = "[cannot serialize cause]";
6470
+ }
6471
+ }
6472
+ const sdkEnvDebug = {
6473
+ ANTHROPIC_BASE_URL: sdkEnv.ANTHROPIC_BASE_URL,
6474
+ hasANTHROPIC_API_KEY: !!sdkEnv.ANTHROPIC_API_KEY,
6475
+ hasANTHROPIC_AUTH_TOKEN: !!sdkEnv.ANTHROPIC_AUTH_TOKEN,
6476
+ hasANTHROPIC_CUSTOM_HEADERS: !!sdkEnv.ANTHROPIC_CUSTOM_HEADERS,
6477
+ ANTHROPIC_CUSTOM_HEADERS_preview: sdkEnv.ANTHROPIC_CUSTOM_HEADERS ? sdkEnv.ANTHROPIC_CUSTOM_HEADERS.split("\n").map((h) => h.split(":")[0]).join(", ") : void 0
6478
+ };
6439
6479
  const errorDetails = {
6440
6480
  messageCount,
6441
6481
  errorName,
6442
6482
  errorMessage,
6443
6483
  skillId: skill.id,
6444
6484
  scenarioId: scenario.id,
6445
- model: options.model || DEFAULT_MODEL
6485
+ model: options.model || DEFAULT_MODEL,
6486
+ sdkEnv: sdkEnvDebug,
6487
+ sdkError: Object.keys(sdkSpecificInfo).length > 0 ? sdkSpecificInfo : void 0,
6488
+ cause: causeInfo
6446
6489
  };
6447
6490
  throw new Error(
6448
6491
  `Claude SDK execution failed after ${messageCount} messages: ${errorMessage}
6449
- Details: ${JSON.stringify(errorDetails)}` + (errorStack ? `
6492
+ Details: ${JSON.stringify(errorDetails, null, 2)}` + (errorStack ? `
6450
6493
  Stack: ${errorStack.split("\n").slice(0, 5).join("\n")}` : "")
6451
6494
  );
6452
6495
  }