@wix/evalforge-evaluator 0.11.0 → 0.13.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 +141 -28
- package/build/index.js.map +2 -2
- package/build/index.mjs +141 -28
- package/build/index.mjs.map +2 -2
- package/package.json +5 -11
package/build/index.mjs
CHANGED
|
@@ -6216,10 +6216,45 @@ async function executeWithClaudeCode(skill, scenario, options) {
|
|
|
6216
6216
|
);
|
|
6217
6217
|
}
|
|
6218
6218
|
const sdkEnv = buildSdkEnvironment(options);
|
|
6219
|
-
console.log("[
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6219
|
+
console.log("[SDK-DEBUG] ====== CLAUDE SDK INITIALIZATION ======");
|
|
6220
|
+
console.log("[SDK-DEBUG] Timestamp:", (/* @__PURE__ */ new Date()).toISOString());
|
|
6221
|
+
console.log("[SDK-DEBUG] Node version:", process.version);
|
|
6222
|
+
console.log("[SDK-DEBUG] Platform:", process.platform, process.arch);
|
|
6223
|
+
console.log("[SDK-DEBUG] CWD:", options.cwd);
|
|
6224
|
+
console.log("[SDK-DEBUG] Process CWD:", process.cwd());
|
|
6225
|
+
console.log("[SDK-DEBUG] SDK Environment:");
|
|
6226
|
+
console.log(
|
|
6227
|
+
"[SDK-DEBUG] ANTHROPIC_API_KEY:",
|
|
6228
|
+
sdkEnv.ANTHROPIC_API_KEY ? `${sdkEnv.ANTHROPIC_API_KEY.substring(0, 15)}...` : "NOT SET"
|
|
6229
|
+
);
|
|
6230
|
+
console.log(
|
|
6231
|
+
"[SDK-DEBUG] ANTHROPIC_AUTH_TOKEN:",
|
|
6232
|
+
sdkEnv.ANTHROPIC_AUTH_TOKEN ? `${sdkEnv.ANTHROPIC_AUTH_TOKEN.substring(0, 15)}...` : "NOT SET"
|
|
6233
|
+
);
|
|
6234
|
+
console.log(
|
|
6235
|
+
"[SDK-DEBUG] ANTHROPIC_BASE_URL:",
|
|
6236
|
+
sdkEnv.ANTHROPIC_BASE_URL || "NOT SET"
|
|
6237
|
+
);
|
|
6238
|
+
console.log(
|
|
6239
|
+
"[SDK-DEBUG] ANTHROPIC_CUSTOM_HEADERS present:",
|
|
6240
|
+
!!sdkEnv.ANTHROPIC_CUSTOM_HEADERS
|
|
6241
|
+
);
|
|
6242
|
+
if (sdkEnv.ANTHROPIC_CUSTOM_HEADERS) {
|
|
6243
|
+
const headerNames = sdkEnv.ANTHROPIC_CUSTOM_HEADERS.split("\n").map((h) => {
|
|
6244
|
+
const colonIdx = h.indexOf(":");
|
|
6245
|
+
return colonIdx > 0 ? h.substring(0, colonIdx) : h;
|
|
6246
|
+
}).join(", ");
|
|
6247
|
+
console.log("[SDK-DEBUG] ANTHROPIC_CUSTOM_HEADERS keys:", headerNames);
|
|
6248
|
+
}
|
|
6249
|
+
console.log("[SDK-DEBUG] PATH available:", !!sdkEnv.PATH);
|
|
6250
|
+
console.log("[SDK-DEBUG] HOME:", sdkEnv.HOME || "NOT SET");
|
|
6251
|
+
console.log("[SDK-DEBUG] Skill:", skill.id, "-", skill.name);
|
|
6252
|
+
console.log("[SDK-DEBUG] Scenario:", scenario.id, "-", scenario.name);
|
|
6253
|
+
console.log(
|
|
6254
|
+
"[SDK-DEBUG] Prompt preview:",
|
|
6255
|
+
scenario.triggerPrompt.substring(0, 100) + "..."
|
|
6256
|
+
);
|
|
6257
|
+
console.log("[SDK-DEBUG] ============================================");
|
|
6223
6258
|
let traceStepNumber = 0;
|
|
6224
6259
|
const traceContext = options.traceContext;
|
|
6225
6260
|
const maxTurns = options.maxTurns ?? 10;
|
|
@@ -6251,6 +6286,27 @@ async function executeWithClaudeCode(skill, scenario, options) {
|
|
|
6251
6286
|
if (options.maxTokens !== void 0) {
|
|
6252
6287
|
queryOptions.maxTokens = options.maxTokens;
|
|
6253
6288
|
}
|
|
6289
|
+
console.log("[SDK-DEBUG] Query options:");
|
|
6290
|
+
console.log("[SDK-DEBUG] model:", queryOptions.model);
|
|
6291
|
+
console.log("[SDK-DEBUG] maxTurns:", queryOptions.maxTurns);
|
|
6292
|
+
console.log(
|
|
6293
|
+
"[SDK-DEBUG] maxThinkingTokens:",
|
|
6294
|
+
queryOptions.maxThinkingTokens
|
|
6295
|
+
);
|
|
6296
|
+
console.log("[SDK-DEBUG] temperature:", queryOptions.temperature);
|
|
6297
|
+
console.log("[SDK-DEBUG] maxTokens:", queryOptions.maxTokens);
|
|
6298
|
+
console.log("[SDK-DEBUG] permissionMode:", queryOptions.permissionMode);
|
|
6299
|
+
console.log(
|
|
6300
|
+
"[SDK-DEBUG] allowDangerouslySkipPermissions:",
|
|
6301
|
+
queryOptions.allowDangerouslySkipPermissions
|
|
6302
|
+
);
|
|
6303
|
+
console.log("[SDK-DEBUG] settingSources:", queryOptions.settingSources);
|
|
6304
|
+
console.log("[SDK-DEBUG] allowedTools:", queryOptions.allowedTools);
|
|
6305
|
+
console.log(
|
|
6306
|
+
"[SDK-DEBUG] mcpServers:",
|
|
6307
|
+
queryOptions.mcpServers ? Object.keys(queryOptions.mcpServers) : "none"
|
|
6308
|
+
);
|
|
6309
|
+
console.log("[SDK-DEBUG] Calling SDK query()...");
|
|
6254
6310
|
try {
|
|
6255
6311
|
for await (const message of query({
|
|
6256
6312
|
prompt: scenario.triggerPrompt,
|
|
@@ -6292,51 +6348,106 @@ async function executeWithClaudeCode(skill, scenario, options) {
|
|
|
6292
6348
|
"messages"
|
|
6293
6349
|
);
|
|
6294
6350
|
} catch (sdkError) {
|
|
6351
|
+
console.error("[SDK-ERROR] ====== CLAUDE SDK EXECUTION FAILED ======");
|
|
6352
|
+
console.error("[SDK-ERROR] Timestamp:", (/* @__PURE__ */ new Date()).toISOString());
|
|
6353
|
+
console.error(
|
|
6354
|
+
"[SDK-ERROR] Messages received before failure:",
|
|
6355
|
+
messageCount
|
|
6356
|
+
);
|
|
6295
6357
|
const errorMessage = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
6296
6358
|
const errorStack = sdkError instanceof Error ? sdkError.stack : void 0;
|
|
6297
|
-
|
|
6298
|
-
console.error("[
|
|
6359
|
+
const errorName = sdkError instanceof Error ? sdkError.name : "Unknown";
|
|
6360
|
+
console.error("[SDK-ERROR] Error name:", errorName);
|
|
6361
|
+
console.error("[SDK-ERROR] Error message:", errorMessage);
|
|
6299
6362
|
if (errorStack) {
|
|
6300
|
-
console.error("[
|
|
6363
|
+
console.error("[SDK-ERROR] Full stack trace:");
|
|
6364
|
+
console.error(errorStack);
|
|
6301
6365
|
}
|
|
6302
6366
|
if (sdkError && typeof sdkError === "object") {
|
|
6303
6367
|
const errObj = sdkError;
|
|
6304
|
-
|
|
6305
|
-
for (const key of
|
|
6368
|
+
console.error("[SDK-ERROR] Error object properties:");
|
|
6369
|
+
for (const key of Object.keys(errObj)) {
|
|
6370
|
+
const value = errObj[key];
|
|
6371
|
+
if (value !== void 0 && key !== "stack") {
|
|
6372
|
+
try {
|
|
6373
|
+
const valueStr = typeof value === "object" ? JSON.stringify(value, null, 2) : String(value);
|
|
6374
|
+
console.error(`[SDK-ERROR] ${key}:`, valueStr.substring(0, 1e3));
|
|
6375
|
+
} catch {
|
|
6376
|
+
console.error(`[SDK-ERROR] ${key}: [cannot serialize]`);
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
6379
|
+
}
|
|
6380
|
+
const sdkErrorKeys = [
|
|
6306
6381
|
"code",
|
|
6307
6382
|
"status",
|
|
6383
|
+
"statusCode",
|
|
6384
|
+
"statusText",
|
|
6308
6385
|
"stderr",
|
|
6309
6386
|
"stdout",
|
|
6387
|
+
"output",
|
|
6310
6388
|
"exitCode",
|
|
6311
6389
|
"signal",
|
|
6312
|
-
"
|
|
6313
|
-
|
|
6390
|
+
"killed",
|
|
6391
|
+
"cause",
|
|
6392
|
+
"reason",
|
|
6393
|
+
"details",
|
|
6394
|
+
"response",
|
|
6395
|
+
"request",
|
|
6396
|
+
"config",
|
|
6397
|
+
"errno",
|
|
6398
|
+
"syscall",
|
|
6399
|
+
"path",
|
|
6400
|
+
"spawnargs"
|
|
6401
|
+
];
|
|
6402
|
+
const extraInfo = {};
|
|
6403
|
+
for (const key of sdkErrorKeys) {
|
|
6314
6404
|
if (key in errObj && errObj[key] !== void 0) {
|
|
6315
6405
|
extraInfo[key] = errObj[key];
|
|
6316
6406
|
}
|
|
6317
6407
|
}
|
|
6318
6408
|
if (Object.keys(extraInfo).length > 0) {
|
|
6319
|
-
console.error(
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6409
|
+
console.error("[SDK-ERROR] SDK-specific error details:");
|
|
6410
|
+
console.error(JSON.stringify(extraInfo, null, 2));
|
|
6411
|
+
}
|
|
6412
|
+
if (errObj.cause && typeof errObj.cause === "object") {
|
|
6413
|
+
console.error("[SDK-ERROR] Error cause:");
|
|
6414
|
+
try {
|
|
6415
|
+
console.error(JSON.stringify(errObj.cause, null, 2));
|
|
6416
|
+
} catch {
|
|
6417
|
+
console.error("[SDK-ERROR] Error cause: [cannot serialize]");
|
|
6418
|
+
}
|
|
6323
6419
|
}
|
|
6324
6420
|
}
|
|
6421
|
+
console.error("[SDK-ERROR] Execution context:");
|
|
6422
|
+
console.error("[SDK-ERROR] skillId:", skill.id);
|
|
6423
|
+
console.error("[SDK-ERROR] skillName:", skill.name);
|
|
6424
|
+
console.error("[SDK-ERROR] scenarioId:", scenario.id);
|
|
6425
|
+
console.error("[SDK-ERROR] scenarioName:", scenario.name);
|
|
6426
|
+
console.error("[SDK-ERROR] cwd:", options.cwd);
|
|
6427
|
+
console.error("[SDK-ERROR] model:", options.model || DEFAULT_MODEL);
|
|
6428
|
+
console.error("[SDK-ERROR] aiGatewayUrl:", options.aiGatewayUrl);
|
|
6325
6429
|
console.error(
|
|
6326
|
-
"[
|
|
6327
|
-
|
|
6328
|
-
skillId: skill.id,
|
|
6329
|
-
skillName: skill.name,
|
|
6330
|
-
scenarioId: scenario.id,
|
|
6331
|
-
scenarioName: scenario.name,
|
|
6332
|
-
messagesReceived: messageCount,
|
|
6333
|
-
cwd: options.cwd,
|
|
6334
|
-
model: options.model || DEFAULT_MODEL
|
|
6335
|
-
})
|
|
6430
|
+
"[SDK-ERROR] hasAiGatewayHeaders:",
|
|
6431
|
+
!!options.aiGatewayHeaders
|
|
6336
6432
|
);
|
|
6433
|
+
console.error("[SDK-ERROR] Environment info:");
|
|
6434
|
+
console.error("[SDK-ERROR] NODE_ENV:", process.env.NODE_ENV);
|
|
6435
|
+
console.error("[SDK-ERROR] HOME:", process.env.HOME);
|
|
6436
|
+
console.error("[SDK-ERROR] USER:", process.env.USER);
|
|
6437
|
+
console.error("[SDK-ERROR] SHELL:", process.env.SHELL);
|
|
6438
|
+
console.error("[SDK-ERROR] ==========================================");
|
|
6439
|
+
const errorDetails = {
|
|
6440
|
+
messageCount,
|
|
6441
|
+
errorName,
|
|
6442
|
+
errorMessage,
|
|
6443
|
+
skillId: skill.id,
|
|
6444
|
+
scenarioId: scenario.id,
|
|
6445
|
+
model: options.model || DEFAULT_MODEL
|
|
6446
|
+
};
|
|
6337
6447
|
throw new Error(
|
|
6338
|
-
`Claude SDK execution failed after ${messageCount} messages: ${errorMessage}
|
|
6339
|
-
|
|
6448
|
+
`Claude SDK execution failed after ${messageCount} messages: ${errorMessage}
|
|
6449
|
+
Details: ${JSON.stringify(errorDetails)}` + (errorStack ? `
|
|
6450
|
+
Stack: ${errorStack.split("\n").slice(0, 5).join("\n")}` : "")
|
|
6340
6451
|
);
|
|
6341
6452
|
}
|
|
6342
6453
|
if (traceContext) {
|
|
@@ -6393,7 +6504,9 @@ async function writeSkillToFilesystem(cwd, skill) {
|
|
|
6393
6504
|
}
|
|
6394
6505
|
function buildSdkEnvironment(options) {
|
|
6395
6506
|
const env = { ...process.env };
|
|
6396
|
-
|
|
6507
|
+
const placeholderApiKey = "sk-ant-api03-placeholder-auth-handled-by-gateway-000000000000000000000000";
|
|
6508
|
+
env.ANTHROPIC_API_KEY = placeholderApiKey;
|
|
6509
|
+
env.ANTHROPIC_AUTH_TOKEN = placeholderApiKey;
|
|
6397
6510
|
if (options.aiGatewayUrl) {
|
|
6398
6511
|
env.ANTHROPIC_BASE_URL = options.aiGatewayUrl;
|
|
6399
6512
|
}
|