@agentv/core 3.9.2 → 3.10.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/dist/evaluation/validation/index.cjs +1 -1
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +1 -1
- package/dist/evaluation/validation/index.js.map +1 -1
- package/dist/index.cjs +17 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6112,11 +6112,7 @@ var CopilotCliProvider = class {
|
|
|
6112
6112
|
}
|
|
6113
6113
|
}
|
|
6114
6114
|
if (sessionUpdate === "usage_update") {
|
|
6115
|
-
|
|
6116
|
-
tokenUsage = { input: update.used, output: tokenUsage.output };
|
|
6117
|
-
} else {
|
|
6118
|
-
tokenUsage = { input: update.used, output: 0 };
|
|
6119
|
-
}
|
|
6115
|
+
tokenUsage = { input: update.used, output: 0 };
|
|
6120
6116
|
if (update.cost && update.cost.currency === "USD") {
|
|
6121
6117
|
costUsd = (costUsd ?? 0) + update.cost.amount;
|
|
6122
6118
|
}
|
|
@@ -6150,21 +6146,32 @@ var CopilotCliProvider = class {
|
|
|
6150
6146
|
sessionId: session.sessionId,
|
|
6151
6147
|
prompt: promptMessages
|
|
6152
6148
|
});
|
|
6149
|
+
let promptResponse;
|
|
6153
6150
|
if (request.signal) {
|
|
6154
6151
|
const abortHandler = () => {
|
|
6155
6152
|
killProcess(agentProcess);
|
|
6156
6153
|
};
|
|
6157
6154
|
request.signal.addEventListener("abort", abortHandler, { once: true });
|
|
6158
6155
|
try {
|
|
6159
|
-
await this.raceWithTimeout(sendPromise, agentProcess);
|
|
6156
|
+
promptResponse = await this.raceWithTimeout(sendPromise, agentProcess);
|
|
6160
6157
|
} finally {
|
|
6161
6158
|
request.signal.removeEventListener("abort", abortHandler);
|
|
6162
6159
|
}
|
|
6163
6160
|
} else {
|
|
6164
|
-
await this.raceWithTimeout(sendPromise, agentProcess);
|
|
6161
|
+
promptResponse = await this.raceWithTimeout(sendPromise, agentProcess);
|
|
6165
6162
|
}
|
|
6166
6163
|
const endTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
6167
6164
|
const durationMs = Date.now() - startMs;
|
|
6165
|
+
const responseUsage = promptResponse.usage;
|
|
6166
|
+
if (responseUsage && responseUsage.totalTokens > 0) {
|
|
6167
|
+
tokenUsage = {
|
|
6168
|
+
input: responseUsage.inputTokens,
|
|
6169
|
+
output: responseUsage.outputTokens,
|
|
6170
|
+
...responseUsage.thoughtTokens != null ? { reasoning: responseUsage.thoughtTokens } : {},
|
|
6171
|
+
...responseUsage.cachedReadTokens != null ? { cached: responseUsage.cachedReadTokens } : {}
|
|
6172
|
+
};
|
|
6173
|
+
request.streamCallbacks?.onLlmCallEnd?.("copilot", tokenUsage);
|
|
6174
|
+
}
|
|
6168
6175
|
const rejectedCalls = completedToolCalls.filter((tc) => {
|
|
6169
6176
|
const out = tc.output;
|
|
6170
6177
|
return out && (out.code === "rejected" || out.code === "denied");
|
|
@@ -6222,8 +6229,7 @@ var CopilotCliProvider = class {
|
|
|
6222
6229
|
async raceWithTimeout(sendPromise, agentProcess) {
|
|
6223
6230
|
const timeoutMs = this.config.timeoutMs;
|
|
6224
6231
|
if (!timeoutMs) {
|
|
6225
|
-
|
|
6226
|
-
return;
|
|
6232
|
+
return sendPromise;
|
|
6227
6233
|
}
|
|
6228
6234
|
let timer;
|
|
6229
6235
|
const timeoutPromise = new Promise((_, reject) => {
|
|
@@ -6234,7 +6240,7 @@ var CopilotCliProvider = class {
|
|
|
6234
6240
|
timer.unref?.();
|
|
6235
6241
|
});
|
|
6236
6242
|
try {
|
|
6237
|
-
await Promise.race([sendPromise, timeoutPromise]);
|
|
6243
|
+
return await Promise.race([sendPromise, timeoutPromise]);
|
|
6238
6244
|
} finally {
|
|
6239
6245
|
if (timer) clearTimeout(timer);
|
|
6240
6246
|
}
|
|
@@ -9287,7 +9293,7 @@ async function readTargetDefinitions(filePath) {
|
|
|
9287
9293
|
throw new Error(`targets.yaml not found at ${absolutePath}`);
|
|
9288
9294
|
}
|
|
9289
9295
|
const raw = await readFile9(absolutePath, "utf8");
|
|
9290
|
-
const parsed = parse4(raw);
|
|
9296
|
+
const parsed = interpolateEnv(parse4(raw), process.env);
|
|
9291
9297
|
if (!isRecord(parsed)) {
|
|
9292
9298
|
throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
|
|
9293
9299
|
}
|