@wix/evalforge-evaluator 0.10.0 → 0.11.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 +85 -36
- package/build/index.js.map +2 -2
- package/build/index.mjs +85 -36
- package/build/index.mjs.map +2 -2
- package/package.json +2 -2
package/build/index.mjs
CHANGED
|
@@ -6251,45 +6251,94 @@ async function executeWithClaudeCode(skill, scenario, options) {
|
|
|
6251
6251
|
if (options.maxTokens !== void 0) {
|
|
6252
6252
|
queryOptions.maxTokens = options.maxTokens;
|
|
6253
6253
|
}
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6254
|
+
try {
|
|
6255
|
+
for await (const message of query({
|
|
6256
|
+
prompt: scenario.triggerPrompt,
|
|
6257
|
+
options: queryOptions
|
|
6258
|
+
})) {
|
|
6259
|
+
messageCount++;
|
|
6260
|
+
console.log("[SDK Message]", JSON.stringify(message, null, 2));
|
|
6261
|
+
allMessages.push(message);
|
|
6262
|
+
if (messageCount <= 3) {
|
|
6263
|
+
console.error(
|
|
6264
|
+
"[DEBUG-H5] SDK message received",
|
|
6265
|
+
JSON.stringify({
|
|
6266
|
+
messageCount,
|
|
6267
|
+
type: message.type,
|
|
6268
|
+
timestamp: Date.now()
|
|
6269
|
+
})
|
|
6270
|
+
);
|
|
6271
|
+
}
|
|
6272
|
+
if (traceContext && isAssistantMessage(message)) {
|
|
6273
|
+
traceStepNumber++;
|
|
6274
|
+
const traceEvent = createTraceEventFromMessage(
|
|
6275
|
+
message,
|
|
6276
|
+
traceContext,
|
|
6277
|
+
traceStepNumber,
|
|
6278
|
+
false
|
|
6279
|
+
// Not complete yet
|
|
6280
|
+
);
|
|
6281
|
+
emitTraceEvent(
|
|
6282
|
+
traceEvent,
|
|
6283
|
+
traceContext.tracePushUrl,
|
|
6284
|
+
traceContext.routeHeader,
|
|
6285
|
+
traceContext.authToken
|
|
6286
|
+
);
|
|
6287
|
+
}
|
|
6270
6288
|
}
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6289
|
+
console.log(
|
|
6290
|
+
"[executeWithClaudeCode] Claude Agent SDK query completed, received",
|
|
6291
|
+
allMessages.length,
|
|
6292
|
+
"messages"
|
|
6293
|
+
);
|
|
6294
|
+
} catch (sdkError) {
|
|
6295
|
+
const errorMessage = sdkError instanceof Error ? sdkError.message : String(sdkError);
|
|
6296
|
+
const errorStack = sdkError instanceof Error ? sdkError.stack : void 0;
|
|
6297
|
+
console.error("[executeWithClaudeCode] Claude SDK execution FAILED");
|
|
6298
|
+
console.error("[executeWithClaudeCode] Error message:", errorMessage);
|
|
6299
|
+
if (errorStack) {
|
|
6300
|
+
console.error("[executeWithClaudeCode] Stack trace:", errorStack);
|
|
6301
|
+
}
|
|
6302
|
+
if (sdkError && typeof sdkError === "object") {
|
|
6303
|
+
const errObj = sdkError;
|
|
6304
|
+
const extraInfo = {};
|
|
6305
|
+
for (const key of [
|
|
6306
|
+
"code",
|
|
6307
|
+
"status",
|
|
6308
|
+
"stderr",
|
|
6309
|
+
"stdout",
|
|
6310
|
+
"exitCode",
|
|
6311
|
+
"signal",
|
|
6312
|
+
"cause"
|
|
6313
|
+
]) {
|
|
6314
|
+
if (key in errObj && errObj[key] !== void 0) {
|
|
6315
|
+
extraInfo[key] = errObj[key];
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
if (Object.keys(extraInfo).length > 0) {
|
|
6319
|
+
console.error(
|
|
6320
|
+
"[executeWithClaudeCode] Additional error info:",
|
|
6321
|
+
JSON.stringify(extraInfo)
|
|
6322
|
+
);
|
|
6323
|
+
}
|
|
6286
6324
|
}
|
|
6325
|
+
console.error(
|
|
6326
|
+
"[executeWithClaudeCode] Context:",
|
|
6327
|
+
JSON.stringify({
|
|
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
|
+
})
|
|
6336
|
+
);
|
|
6337
|
+
throw new Error(
|
|
6338
|
+
`Claude SDK execution failed after ${messageCount} messages: ${errorMessage}` + (errorStack ? `
|
|
6339
|
+
Stack: ${errorStack.split("\n").slice(0, 3).join("\n")}` : "")
|
|
6340
|
+
);
|
|
6287
6341
|
}
|
|
6288
|
-
console.log(
|
|
6289
|
-
"[executeWithClaudeCode] Claude Agent SDK query completed, received",
|
|
6290
|
-
allMessages.length,
|
|
6291
|
-
"messages"
|
|
6292
|
-
);
|
|
6293
6342
|
if (traceContext) {
|
|
6294
6343
|
emitTraceEvent(
|
|
6295
6344
|
{
|