@agentv/core 3.13.2 → 3.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/dist/{chunk-ZB3AUPES.js → chunk-HP5PFOVK.js} +48 -1
- package/dist/{chunk-ZB3AUPES.js.map → chunk-HP5PFOVK.js.map} +1 -1
- package/dist/evaluation/validation/index.cjs +1 -0
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +1 -1
- package/dist/index.cjs +763 -415
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +614 -314
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/dist/index.cjs
CHANGED
|
@@ -1315,12 +1315,12 @@ function serializeAttributeValue(value) {
|
|
|
1315
1315
|
if (Array.isArray(value)) return { arrayValue: { values: value.map(serializeAttributeValue) } };
|
|
1316
1316
|
return { stringValue: String(value) };
|
|
1317
1317
|
}
|
|
1318
|
-
var
|
|
1318
|
+
var import_promises35, import_node_path51, OtlpJsonFileExporter;
|
|
1319
1319
|
var init_otlp_json_file_exporter = __esm({
|
|
1320
1320
|
"src/observability/otlp-json-file-exporter.ts"() {
|
|
1321
1321
|
"use strict";
|
|
1322
|
-
|
|
1323
|
-
|
|
1322
|
+
import_promises35 = require("fs/promises");
|
|
1323
|
+
import_node_path51 = require("path");
|
|
1324
1324
|
OtlpJsonFileExporter = class {
|
|
1325
1325
|
// biome-ignore lint/suspicious/noExplicitAny: serialized span data
|
|
1326
1326
|
spans = [];
|
|
@@ -1359,7 +1359,7 @@ var init_otlp_json_file_exporter = __esm({
|
|
|
1359
1359
|
}
|
|
1360
1360
|
async flush() {
|
|
1361
1361
|
if (this.spans.length === 0) return;
|
|
1362
|
-
await (0,
|
|
1362
|
+
await (0, import_promises35.mkdir)((0, import_node_path51.dirname)(this.filePath), { recursive: true });
|
|
1363
1363
|
const otlpJson = {
|
|
1364
1364
|
resourceSpans: [
|
|
1365
1365
|
{
|
|
@@ -1441,6 +1441,7 @@ __export(index_exports, {
|
|
|
1441
1441
|
defineConfig: () => defineConfig,
|
|
1442
1442
|
detectFormat: () => detectFormat,
|
|
1443
1443
|
discoverAssertions: () => discoverAssertions,
|
|
1444
|
+
discoverCopilotSessions: () => discoverCopilotSessions,
|
|
1444
1445
|
discoverGraders: () => discoverGraders,
|
|
1445
1446
|
discoverJudges: () => discoverGraders,
|
|
1446
1447
|
discoverProviders: () => discoverProviders,
|
|
@@ -8246,10 +8247,268 @@ function summarizeAcpEvent(eventType, data) {
|
|
|
8246
8247
|
}
|
|
8247
8248
|
}
|
|
8248
8249
|
|
|
8249
|
-
// src/evaluation/providers/copilot-
|
|
8250
|
-
var
|
|
8250
|
+
// src/evaluation/providers/copilot-log.ts
|
|
8251
|
+
var import_promises16 = require("fs/promises");
|
|
8252
|
+
var import_node_os4 = require("os");
|
|
8253
|
+
var import_node_path19 = __toESM(require("path"), 1);
|
|
8254
|
+
|
|
8255
|
+
// src/evaluation/providers/copilot-log-parser.ts
|
|
8256
|
+
function parseCopilotEvents(eventsJsonl) {
|
|
8257
|
+
const messages = [];
|
|
8258
|
+
const meta = { sessionId: "", model: "", cwd: "" };
|
|
8259
|
+
let totalInputTokens = 0;
|
|
8260
|
+
let totalOutputTokens = 0;
|
|
8261
|
+
let hasUsage = false;
|
|
8262
|
+
let startTimestamp;
|
|
8263
|
+
let endTimestamp;
|
|
8264
|
+
const toolCallsInProgress = /* @__PURE__ */ new Map();
|
|
8265
|
+
const lines = eventsJsonl.split("\n").filter((l) => l.trim().length > 0);
|
|
8266
|
+
for (const line of lines) {
|
|
8267
|
+
let event;
|
|
8268
|
+
try {
|
|
8269
|
+
event = JSON.parse(line);
|
|
8270
|
+
} catch {
|
|
8271
|
+
continue;
|
|
8272
|
+
}
|
|
8273
|
+
const eventType = event.type;
|
|
8274
|
+
if (!eventType) continue;
|
|
8275
|
+
const data = event.data ?? {};
|
|
8276
|
+
switch (eventType) {
|
|
8277
|
+
case "session.start": {
|
|
8278
|
+
meta.sessionId = String(data.sessionId ?? "");
|
|
8279
|
+
const ctx = data.context;
|
|
8280
|
+
meta.cwd = String(ctx?.cwd ?? "");
|
|
8281
|
+
meta.repository = ctx?.repository ? String(ctx.repository) : void 0;
|
|
8282
|
+
meta.branch = ctx?.branch ? String(ctx.branch) : void 0;
|
|
8283
|
+
const ts = event.timestamp ?? data.startTime;
|
|
8284
|
+
meta.startedAt = ts ? String(ts) : void 0;
|
|
8285
|
+
startTimestamp = ts ? String(ts) : void 0;
|
|
8286
|
+
break;
|
|
8287
|
+
}
|
|
8288
|
+
case "user.message": {
|
|
8289
|
+
messages.push({
|
|
8290
|
+
role: "user",
|
|
8291
|
+
content: data.content != null ? String(data.content) : ""
|
|
8292
|
+
});
|
|
8293
|
+
break;
|
|
8294
|
+
}
|
|
8295
|
+
case "assistant.message": {
|
|
8296
|
+
const toolRequests = data.toolRequests;
|
|
8297
|
+
const toolCalls = (toolRequests ?? []).map((req) => ({
|
|
8298
|
+
tool: String(req.name ?? req.toolName ?? ""),
|
|
8299
|
+
input: req.arguments,
|
|
8300
|
+
id: req.toolCallId ? String(req.toolCallId) : void 0
|
|
8301
|
+
}));
|
|
8302
|
+
messages.push({
|
|
8303
|
+
role: "assistant",
|
|
8304
|
+
content: data.content != null ? String(data.content) : void 0,
|
|
8305
|
+
toolCalls: toolCalls.length > 0 ? toolCalls : void 0
|
|
8306
|
+
});
|
|
8307
|
+
break;
|
|
8308
|
+
}
|
|
8309
|
+
case "skill.invoked": {
|
|
8310
|
+
const skillName = String(data.name ?? "");
|
|
8311
|
+
messages.push({
|
|
8312
|
+
role: "assistant",
|
|
8313
|
+
toolCalls: [
|
|
8314
|
+
{
|
|
8315
|
+
tool: "Skill",
|
|
8316
|
+
input: { skill: skillName }
|
|
8317
|
+
}
|
|
8318
|
+
]
|
|
8319
|
+
});
|
|
8320
|
+
break;
|
|
8321
|
+
}
|
|
8322
|
+
case "tool.execution_start": {
|
|
8323
|
+
const toolCallId = String(data.toolCallId ?? "");
|
|
8324
|
+
if (toolCallId) {
|
|
8325
|
+
toolCallsInProgress.set(toolCallId, {
|
|
8326
|
+
toolName: String(data.toolName ?? ""),
|
|
8327
|
+
input: data.arguments,
|
|
8328
|
+
toolCallId
|
|
8329
|
+
});
|
|
8330
|
+
}
|
|
8331
|
+
break;
|
|
8332
|
+
}
|
|
8333
|
+
case "tool.execution_complete": {
|
|
8334
|
+
const toolCallId = String(data.toolCallId ?? "");
|
|
8335
|
+
const started = toolCallsInProgress.get(toolCallId);
|
|
8336
|
+
if (started) {
|
|
8337
|
+
toolCallsInProgress.delete(toolCallId);
|
|
8338
|
+
messages.push({
|
|
8339
|
+
role: "assistant",
|
|
8340
|
+
toolCalls: [
|
|
8341
|
+
{
|
|
8342
|
+
tool: started.toolName,
|
|
8343
|
+
input: started.input,
|
|
8344
|
+
output: data.result,
|
|
8345
|
+
id: toolCallId
|
|
8346
|
+
}
|
|
8347
|
+
]
|
|
8348
|
+
});
|
|
8349
|
+
}
|
|
8350
|
+
break;
|
|
8351
|
+
}
|
|
8352
|
+
case "session.shutdown": {
|
|
8353
|
+
endTimestamp = event.timestamp ? String(event.timestamp) : void 0;
|
|
8354
|
+
const modelMetrics = data.modelMetrics;
|
|
8355
|
+
if (modelMetrics) {
|
|
8356
|
+
for (const metrics of Object.values(modelMetrics)) {
|
|
8357
|
+
if (metrics.usage) {
|
|
8358
|
+
hasUsage = true;
|
|
8359
|
+
totalInputTokens += Number(metrics.usage.inputTokens ?? 0);
|
|
8360
|
+
totalOutputTokens += Number(metrics.usage.outputTokens ?? 0);
|
|
8361
|
+
}
|
|
8362
|
+
}
|
|
8363
|
+
}
|
|
8364
|
+
const currentModel = data.currentModel;
|
|
8365
|
+
if (currentModel && !meta.model) {
|
|
8366
|
+
meta.model = String(currentModel);
|
|
8367
|
+
}
|
|
8368
|
+
break;
|
|
8369
|
+
}
|
|
8370
|
+
}
|
|
8371
|
+
}
|
|
8372
|
+
let durationMs;
|
|
8373
|
+
if (startTimestamp && endTimestamp) {
|
|
8374
|
+
durationMs = new Date(endTimestamp).getTime() - new Date(startTimestamp).getTime();
|
|
8375
|
+
}
|
|
8376
|
+
return {
|
|
8377
|
+
messages,
|
|
8378
|
+
meta,
|
|
8379
|
+
tokenUsage: hasUsage ? { input: totalInputTokens, output: totalOutputTokens } : void 0,
|
|
8380
|
+
durationMs
|
|
8381
|
+
};
|
|
8382
|
+
}
|
|
8383
|
+
|
|
8384
|
+
// src/evaluation/providers/copilot-session-discovery.ts
|
|
8251
8385
|
var import_promises15 = require("fs/promises");
|
|
8386
|
+
var import_node_os3 = require("os");
|
|
8252
8387
|
var import_node_path18 = __toESM(require("path"), 1);
|
|
8388
|
+
var import_yaml6 = require("yaml");
|
|
8389
|
+
var DEFAULT_SESSION_STATE_DIR = () => import_node_path18.default.join((0, import_node_os3.homedir)(), ".copilot", "session-state");
|
|
8390
|
+
async function discoverCopilotSessions(opts) {
|
|
8391
|
+
const sessionStateDir = opts?.sessionStateDir ?? DEFAULT_SESSION_STATE_DIR();
|
|
8392
|
+
const limit = opts?.limit ?? 10;
|
|
8393
|
+
let entries;
|
|
8394
|
+
try {
|
|
8395
|
+
entries = await (0, import_promises15.readdir)(sessionStateDir);
|
|
8396
|
+
} catch {
|
|
8397
|
+
return [];
|
|
8398
|
+
}
|
|
8399
|
+
const sessions = [];
|
|
8400
|
+
for (const entry of entries) {
|
|
8401
|
+
const sessionDir = import_node_path18.default.join(sessionStateDir, entry);
|
|
8402
|
+
const workspacePath = import_node_path18.default.join(sessionDir, "workspace.yaml");
|
|
8403
|
+
const eventsPath = import_node_path18.default.join(sessionDir, "events.jsonl");
|
|
8404
|
+
try {
|
|
8405
|
+
const workspaceContent = await (0, import_promises15.readFile)(workspacePath, "utf8");
|
|
8406
|
+
const workspace = (0, import_yaml6.parse)(workspaceContent) ?? {};
|
|
8407
|
+
const cwd = String(workspace.cwd ?? "");
|
|
8408
|
+
let updatedAt;
|
|
8409
|
+
try {
|
|
8410
|
+
const eventsStat = await (0, import_promises15.stat)(eventsPath);
|
|
8411
|
+
updatedAt = eventsStat.mtime;
|
|
8412
|
+
} catch {
|
|
8413
|
+
updatedAt = /* @__PURE__ */ new Date(0);
|
|
8414
|
+
}
|
|
8415
|
+
let isActive = true;
|
|
8416
|
+
try {
|
|
8417
|
+
const fd = await import("fs/promises").then((fs3) => fs3.open(eventsPath, "r"));
|
|
8418
|
+
try {
|
|
8419
|
+
const fstat = await fd.stat();
|
|
8420
|
+
const tailSize = Math.min(fstat.size, 4096);
|
|
8421
|
+
const buf = Buffer.alloc(tailSize);
|
|
8422
|
+
await fd.read(buf, 0, tailSize, Math.max(0, fstat.size - tailSize));
|
|
8423
|
+
isActive = !buf.toString("utf8").includes('"session.shutdown"');
|
|
8424
|
+
} finally {
|
|
8425
|
+
await fd.close();
|
|
8426
|
+
}
|
|
8427
|
+
} catch {
|
|
8428
|
+
}
|
|
8429
|
+
sessions.push({
|
|
8430
|
+
sessionId: entry,
|
|
8431
|
+
sessionDir,
|
|
8432
|
+
cwd,
|
|
8433
|
+
repository: workspace.repository ? String(workspace.repository) : void 0,
|
|
8434
|
+
updatedAt,
|
|
8435
|
+
isActive
|
|
8436
|
+
});
|
|
8437
|
+
} catch {
|
|
8438
|
+
}
|
|
8439
|
+
}
|
|
8440
|
+
let filtered = sessions;
|
|
8441
|
+
if (opts?.cwd) {
|
|
8442
|
+
filtered = filtered.filter((s) => s.cwd === opts.cwd);
|
|
8443
|
+
}
|
|
8444
|
+
if (opts?.repository) {
|
|
8445
|
+
filtered = filtered.filter((s) => s.repository === opts.repository);
|
|
8446
|
+
}
|
|
8447
|
+
filtered.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
8448
|
+
return filtered.slice(0, limit);
|
|
8449
|
+
}
|
|
8450
|
+
|
|
8451
|
+
// src/evaluation/providers/copilot-log.ts
|
|
8452
|
+
var CopilotLogProvider = class {
|
|
8453
|
+
id;
|
|
8454
|
+
kind = "copilot-log";
|
|
8455
|
+
targetName;
|
|
8456
|
+
config;
|
|
8457
|
+
constructor(targetName, config) {
|
|
8458
|
+
this.targetName = targetName;
|
|
8459
|
+
this.id = `copilot-log:${targetName}`;
|
|
8460
|
+
this.config = config;
|
|
8461
|
+
}
|
|
8462
|
+
async invoke(_request) {
|
|
8463
|
+
const sessionDir = await this.resolveSessionDir();
|
|
8464
|
+
const eventsPath = import_node_path19.default.join(sessionDir, "events.jsonl");
|
|
8465
|
+
let eventsContent;
|
|
8466
|
+
try {
|
|
8467
|
+
eventsContent = await (0, import_promises16.readFile)(eventsPath, "utf8");
|
|
8468
|
+
} catch (err) {
|
|
8469
|
+
throw new Error(
|
|
8470
|
+
`Failed to read Copilot session transcript at ${eventsPath}: ${err instanceof Error ? err.message : String(err)}`
|
|
8471
|
+
);
|
|
8472
|
+
}
|
|
8473
|
+
const parsed = parseCopilotEvents(eventsContent);
|
|
8474
|
+
return {
|
|
8475
|
+
output: parsed.messages,
|
|
8476
|
+
tokenUsage: parsed.tokenUsage,
|
|
8477
|
+
durationMs: parsed.durationMs,
|
|
8478
|
+
startTime: parsed.meta.startedAt
|
|
8479
|
+
};
|
|
8480
|
+
}
|
|
8481
|
+
async resolveSessionDir() {
|
|
8482
|
+
if (this.config.sessionDir) {
|
|
8483
|
+
return this.config.sessionDir;
|
|
8484
|
+
}
|
|
8485
|
+
if (this.config.sessionId) {
|
|
8486
|
+
const stateDir = this.config.sessionStateDir ?? import_node_path19.default.join((0, import_node_os4.homedir)(), ".copilot", "session-state");
|
|
8487
|
+
return import_node_path19.default.join(stateDir, this.config.sessionId);
|
|
8488
|
+
}
|
|
8489
|
+
if (this.config.discover === "latest") {
|
|
8490
|
+
const sessions = await discoverCopilotSessions({
|
|
8491
|
+
sessionStateDir: this.config.sessionStateDir,
|
|
8492
|
+
cwd: this.config.cwd,
|
|
8493
|
+
limit: 1
|
|
8494
|
+
});
|
|
8495
|
+
if (sessions.length === 0) {
|
|
8496
|
+
throw new Error(
|
|
8497
|
+
`No Copilot CLI sessions found${this.config.cwd ? ` for cwd=${this.config.cwd}` : ""}. Check that sessions exist in ${this.config.sessionStateDir ?? "~/.copilot/session-state/"}`
|
|
8498
|
+
);
|
|
8499
|
+
}
|
|
8500
|
+
return sessions[0].sessionDir;
|
|
8501
|
+
}
|
|
8502
|
+
throw new Error(
|
|
8503
|
+
'CopilotLogProvider requires one of: sessionDir, sessionId, or discover="latest"'
|
|
8504
|
+
);
|
|
8505
|
+
}
|
|
8506
|
+
};
|
|
8507
|
+
|
|
8508
|
+
// src/evaluation/providers/copilot-sdk.ts
|
|
8509
|
+
var import_node_crypto6 = require("crypto");
|
|
8510
|
+
var import_promises17 = require("fs/promises");
|
|
8511
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
8253
8512
|
|
|
8254
8513
|
// src/evaluation/providers/copilot-sdk-log-tracker.ts
|
|
8255
8514
|
var GLOBAL_LOGS_KEY4 = Symbol.for("agentv.copilotSdkLogs");
|
|
@@ -8539,10 +8798,10 @@ var CopilotSdkProvider = class {
|
|
|
8539
8798
|
}
|
|
8540
8799
|
resolveCwd(cwdOverride) {
|
|
8541
8800
|
if (cwdOverride) {
|
|
8542
|
-
return
|
|
8801
|
+
return import_node_path20.default.resolve(cwdOverride);
|
|
8543
8802
|
}
|
|
8544
8803
|
if (this.config.cwd) {
|
|
8545
|
-
return
|
|
8804
|
+
return import_node_path20.default.resolve(this.config.cwd);
|
|
8546
8805
|
}
|
|
8547
8806
|
return void 0;
|
|
8548
8807
|
}
|
|
@@ -8551,9 +8810,9 @@ var CopilotSdkProvider = class {
|
|
|
8551
8810
|
return void 0;
|
|
8552
8811
|
}
|
|
8553
8812
|
if (this.config.logDir) {
|
|
8554
|
-
return
|
|
8813
|
+
return import_node_path20.default.resolve(this.config.logDir);
|
|
8555
8814
|
}
|
|
8556
|
-
return
|
|
8815
|
+
return import_node_path20.default.join(process.cwd(), ".agentv", "logs", "copilot-sdk");
|
|
8557
8816
|
}
|
|
8558
8817
|
async createStreamLogger(request) {
|
|
8559
8818
|
const logDir = this.resolveLogDirectory();
|
|
@@ -8561,13 +8820,13 @@ var CopilotSdkProvider = class {
|
|
|
8561
8820
|
return void 0;
|
|
8562
8821
|
}
|
|
8563
8822
|
try {
|
|
8564
|
-
await (0,
|
|
8823
|
+
await (0, import_promises17.mkdir)(logDir, { recursive: true });
|
|
8565
8824
|
} catch (error) {
|
|
8566
8825
|
const message = error instanceof Error ? error.message : String(error);
|
|
8567
8826
|
console.warn(`Skipping Copilot SDK stream logging (could not create ${logDir}): ${message}`);
|
|
8568
8827
|
return void 0;
|
|
8569
8828
|
}
|
|
8570
|
-
const filePath =
|
|
8829
|
+
const filePath = import_node_path20.default.join(logDir, buildLogFilename4(request, this.targetName, "copilot-sdk"));
|
|
8571
8830
|
try {
|
|
8572
8831
|
const logger = await CopilotStreamLogger.create(
|
|
8573
8832
|
{
|
|
@@ -8662,9 +8921,9 @@ var MockProvider = class {
|
|
|
8662
8921
|
var import_node_child_process4 = require("child_process");
|
|
8663
8922
|
var import_node_crypto7 = require("crypto");
|
|
8664
8923
|
var import_node_fs8 = require("fs");
|
|
8665
|
-
var
|
|
8666
|
-
var
|
|
8667
|
-
var
|
|
8924
|
+
var import_promises18 = require("fs/promises");
|
|
8925
|
+
var import_node_os5 = require("os");
|
|
8926
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
8668
8927
|
|
|
8669
8928
|
// src/evaluation/providers/pi-log-tracker.ts
|
|
8670
8929
|
var GLOBAL_LOGS_KEY5 = Symbol.for("agentv.piLogs");
|
|
@@ -8767,13 +9026,14 @@ var PiCliProvider = class {
|
|
|
8767
9026
|
const inputFiles = normalizeInputFiles(request.inputFiles);
|
|
8768
9027
|
const startTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
8769
9028
|
const startMs = Date.now();
|
|
8770
|
-
const
|
|
9029
|
+
const hasExternalCwd = !!(request.cwd || this.config.cwd);
|
|
9030
|
+
const workspaceRoot = hasExternalCwd ? void 0 : await this.createWorkspace();
|
|
9031
|
+
const cwd = this.resolveCwd(workspaceRoot, request.cwd);
|
|
8771
9032
|
const logger = await this.createStreamLogger(request).catch(() => void 0);
|
|
8772
9033
|
try {
|
|
8773
|
-
const promptFile =
|
|
8774
|
-
await (0,
|
|
9034
|
+
const promptFile = import_node_path21.default.join(cwd, PROMPT_FILENAME);
|
|
9035
|
+
await (0, import_promises18.writeFile)(promptFile, request.question, "utf8");
|
|
8775
9036
|
const args = this.buildPiArgs(request.question, inputFiles);
|
|
8776
|
-
const cwd = this.resolveCwd(workspaceRoot, request.cwd);
|
|
8777
9037
|
const result = await this.executePi(args, cwd, request.signal, logger);
|
|
8778
9038
|
if (result.timedOut) {
|
|
8779
9039
|
throw new Error(
|
|
@@ -8815,7 +9075,7 @@ var PiCliProvider = class {
|
|
|
8815
9075
|
args,
|
|
8816
9076
|
executable: this.config.executable,
|
|
8817
9077
|
promptFile,
|
|
8818
|
-
workspace: workspaceRoot,
|
|
9078
|
+
workspace: workspaceRoot ?? cwd,
|
|
8819
9079
|
inputFiles,
|
|
8820
9080
|
logFile: logger?.filePath
|
|
8821
9081
|
},
|
|
@@ -8827,17 +9087,22 @@ var PiCliProvider = class {
|
|
|
8827
9087
|
};
|
|
8828
9088
|
} finally {
|
|
8829
9089
|
await logger?.close();
|
|
8830
|
-
|
|
9090
|
+
if (workspaceRoot) {
|
|
9091
|
+
await this.cleanupWorkspace(workspaceRoot);
|
|
9092
|
+
}
|
|
8831
9093
|
}
|
|
8832
9094
|
}
|
|
8833
9095
|
resolveCwd(workspaceRoot, cwdOverride) {
|
|
8834
9096
|
if (cwdOverride) {
|
|
8835
|
-
return
|
|
9097
|
+
return import_node_path21.default.resolve(cwdOverride);
|
|
8836
9098
|
}
|
|
8837
|
-
if (
|
|
9099
|
+
if (this.config.cwd) {
|
|
9100
|
+
return import_node_path21.default.resolve(this.config.cwd);
|
|
9101
|
+
}
|
|
9102
|
+
if (workspaceRoot) {
|
|
8838
9103
|
return workspaceRoot;
|
|
8839
9104
|
}
|
|
8840
|
-
return
|
|
9105
|
+
return process.cwd();
|
|
8841
9106
|
}
|
|
8842
9107
|
buildPiArgs(prompt, inputFiles) {
|
|
8843
9108
|
const args = [];
|
|
@@ -8918,19 +9183,19 @@ ${prompt}` : prompt;
|
|
|
8918
9183
|
return env;
|
|
8919
9184
|
}
|
|
8920
9185
|
async createWorkspace() {
|
|
8921
|
-
return await (0,
|
|
9186
|
+
return await (0, import_promises18.mkdtemp)(import_node_path21.default.join((0, import_node_os5.tmpdir)(), WORKSPACE_PREFIX));
|
|
8922
9187
|
}
|
|
8923
9188
|
async cleanupWorkspace(workspaceRoot) {
|
|
8924
9189
|
try {
|
|
8925
|
-
await (0,
|
|
9190
|
+
await (0, import_promises18.rm)(workspaceRoot, { recursive: true, force: true });
|
|
8926
9191
|
} catch {
|
|
8927
9192
|
}
|
|
8928
9193
|
}
|
|
8929
9194
|
resolveLogDirectory() {
|
|
8930
9195
|
if (this.config.logDir) {
|
|
8931
|
-
return
|
|
9196
|
+
return import_node_path21.default.resolve(this.config.logDir);
|
|
8932
9197
|
}
|
|
8933
|
-
return
|
|
9198
|
+
return import_node_path21.default.join(process.cwd(), ".agentv", "logs", "pi-cli");
|
|
8934
9199
|
}
|
|
8935
9200
|
async createStreamLogger(request) {
|
|
8936
9201
|
const logDir = this.resolveLogDirectory();
|
|
@@ -8938,13 +9203,13 @@ ${prompt}` : prompt;
|
|
|
8938
9203
|
return void 0;
|
|
8939
9204
|
}
|
|
8940
9205
|
try {
|
|
8941
|
-
await (0,
|
|
9206
|
+
await (0, import_promises18.mkdir)(logDir, { recursive: true });
|
|
8942
9207
|
} catch (error) {
|
|
8943
9208
|
const message = error instanceof Error ? error.message : String(error);
|
|
8944
9209
|
console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
|
|
8945
9210
|
return void 0;
|
|
8946
9211
|
}
|
|
8947
|
-
const filePath =
|
|
9212
|
+
const filePath = import_node_path21.default.join(logDir, buildLogFilename5(request, this.targetName));
|
|
8948
9213
|
try {
|
|
8949
9214
|
const logger = await PiStreamLogger.create({
|
|
8950
9215
|
filePath,
|
|
@@ -9384,14 +9649,17 @@ async function defaultPiRunner(options) {
|
|
|
9384
9649
|
var import_node_child_process5 = require("child_process");
|
|
9385
9650
|
var import_node_crypto8 = require("crypto");
|
|
9386
9651
|
var import_node_fs9 = require("fs");
|
|
9387
|
-
var
|
|
9388
|
-
var
|
|
9652
|
+
var import_promises19 = require("fs/promises");
|
|
9653
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
9389
9654
|
var import_node_readline = require("readline");
|
|
9655
|
+
var import_node_url3 = require("url");
|
|
9656
|
+
var import_meta2 = {};
|
|
9390
9657
|
var piCodingAgentModule = null;
|
|
9391
9658
|
var piAiModule = null;
|
|
9659
|
+
var loadingPromise = null;
|
|
9392
9660
|
async function promptInstall() {
|
|
9393
9661
|
if (!process.stdout.isTTY) return false;
|
|
9394
|
-
const rl = (0, import_node_readline.createInterface)({ input: process.stdin, output: process.
|
|
9662
|
+
const rl = (0, import_node_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
9395
9663
|
try {
|
|
9396
9664
|
return await new Promise((resolve) => {
|
|
9397
9665
|
rl.question(
|
|
@@ -9403,43 +9671,74 @@ async function promptInstall() {
|
|
|
9403
9671
|
rl.close();
|
|
9404
9672
|
}
|
|
9405
9673
|
}
|
|
9406
|
-
|
|
9407
|
-
|
|
9674
|
+
function findAgentvRoot() {
|
|
9675
|
+
const thisFile = (0, import_node_url3.fileURLToPath)(import_meta2.url);
|
|
9676
|
+
let dir = import_node_path22.default.dirname(thisFile);
|
|
9677
|
+
for (let i = 0; i < 10; i++) {
|
|
9408
9678
|
try {
|
|
9679
|
+
const pkg = import_node_path22.default.join(dir, "package.json");
|
|
9680
|
+
(0, import_node_fs9.accessSync)(pkg);
|
|
9681
|
+
return dir;
|
|
9682
|
+
} catch {
|
|
9683
|
+
const parent = import_node_path22.default.dirname(dir);
|
|
9684
|
+
if (parent === dir) break;
|
|
9685
|
+
dir = parent;
|
|
9686
|
+
}
|
|
9687
|
+
}
|
|
9688
|
+
return import_node_path22.default.dirname(thisFile);
|
|
9689
|
+
}
|
|
9690
|
+
async function doLoadSdkModules() {
|
|
9691
|
+
try {
|
|
9692
|
+
[piCodingAgentModule, piAiModule] = await Promise.all([
|
|
9693
|
+
import("@mariozechner/pi-coding-agent"),
|
|
9694
|
+
import("@mariozechner/pi-ai")
|
|
9695
|
+
]);
|
|
9696
|
+
} catch {
|
|
9697
|
+
if (await promptInstall()) {
|
|
9698
|
+
const installDir = findAgentvRoot();
|
|
9699
|
+
console.error(`Installing @mariozechner/pi-coding-agent into ${installDir}...`);
|
|
9700
|
+
(0, import_node_child_process5.execSync)("bun add @mariozechner/pi-coding-agent", {
|
|
9701
|
+
cwd: installDir,
|
|
9702
|
+
stdio: "inherit"
|
|
9703
|
+
});
|
|
9409
9704
|
[piCodingAgentModule, piAiModule] = await Promise.all([
|
|
9410
9705
|
import("@mariozechner/pi-coding-agent"),
|
|
9411
9706
|
import("@mariozechner/pi-ai")
|
|
9412
9707
|
]);
|
|
9413
|
-
}
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9708
|
+
} else {
|
|
9709
|
+
throw new Error(
|
|
9710
|
+
"pi-coding-agent SDK is not installed. Install it with:\n bun add @mariozechner/pi-coding-agent"
|
|
9711
|
+
);
|
|
9712
|
+
}
|
|
9713
|
+
}
|
|
9714
|
+
}
|
|
9715
|
+
async function loadSdkModules() {
|
|
9716
|
+
if (!piCodingAgentModule || !piAiModule) {
|
|
9717
|
+
if (!loadingPromise) {
|
|
9718
|
+
loadingPromise = doLoadSdkModules().catch((err) => {
|
|
9719
|
+
loadingPromise = null;
|
|
9720
|
+
throw err;
|
|
9721
|
+
});
|
|
9426
9722
|
}
|
|
9723
|
+
await loadingPromise;
|
|
9427
9724
|
}
|
|
9725
|
+
const piSdk = piCodingAgentModule;
|
|
9726
|
+
const piAi = piAiModule;
|
|
9428
9727
|
const toolMap = {
|
|
9429
|
-
read:
|
|
9430
|
-
bash:
|
|
9431
|
-
edit:
|
|
9432
|
-
write:
|
|
9433
|
-
grep:
|
|
9434
|
-
find:
|
|
9435
|
-
ls:
|
|
9728
|
+
read: piSdk.readTool,
|
|
9729
|
+
bash: piSdk.bashTool,
|
|
9730
|
+
edit: piSdk.editTool,
|
|
9731
|
+
write: piSdk.writeTool,
|
|
9732
|
+
grep: piSdk.grepTool,
|
|
9733
|
+
find: piSdk.findTool,
|
|
9734
|
+
ls: piSdk.lsTool
|
|
9436
9735
|
};
|
|
9437
9736
|
return {
|
|
9438
|
-
createAgentSession:
|
|
9439
|
-
codingTools:
|
|
9737
|
+
createAgentSession: piSdk.createAgentSession,
|
|
9738
|
+
codingTools: piSdk.codingTools,
|
|
9440
9739
|
toolMap,
|
|
9441
|
-
SessionManager:
|
|
9442
|
-
getModel:
|
|
9740
|
+
SessionManager: piSdk.SessionManager,
|
|
9741
|
+
getModel: piAi.getModel
|
|
9443
9742
|
};
|
|
9444
9743
|
}
|
|
9445
9744
|
var PiCodingAgentProvider = class {
|
|
@@ -9628,10 +9927,10 @@ ${fileList}`;
|
|
|
9628
9927
|
}
|
|
9629
9928
|
resolveCwd(cwdOverride) {
|
|
9630
9929
|
if (cwdOverride) {
|
|
9631
|
-
return
|
|
9930
|
+
return import_node_path22.default.resolve(cwdOverride);
|
|
9632
9931
|
}
|
|
9633
9932
|
if (this.config.cwd) {
|
|
9634
|
-
return
|
|
9933
|
+
return import_node_path22.default.resolve(this.config.cwd);
|
|
9635
9934
|
}
|
|
9636
9935
|
return process.cwd();
|
|
9637
9936
|
}
|
|
@@ -9650,9 +9949,9 @@ ${fileList}`;
|
|
|
9650
9949
|
}
|
|
9651
9950
|
resolveLogDirectory() {
|
|
9652
9951
|
if (this.config.logDir) {
|
|
9653
|
-
return
|
|
9952
|
+
return import_node_path22.default.resolve(this.config.logDir);
|
|
9654
9953
|
}
|
|
9655
|
-
return
|
|
9954
|
+
return import_node_path22.default.join(process.cwd(), ".agentv", "logs", "pi-coding-agent");
|
|
9656
9955
|
}
|
|
9657
9956
|
async createStreamLogger(request) {
|
|
9658
9957
|
const logDir = this.resolveLogDirectory();
|
|
@@ -9660,13 +9959,13 @@ ${fileList}`;
|
|
|
9660
9959
|
return void 0;
|
|
9661
9960
|
}
|
|
9662
9961
|
try {
|
|
9663
|
-
await (0,
|
|
9962
|
+
await (0, import_promises19.mkdir)(logDir, { recursive: true });
|
|
9664
9963
|
} catch (error) {
|
|
9665
9964
|
const message = error instanceof Error ? error.message : String(error);
|
|
9666
9965
|
console.warn(`Skipping Pi stream logging (could not create ${logDir}): ${message}`);
|
|
9667
9966
|
return void 0;
|
|
9668
9967
|
}
|
|
9669
|
-
const filePath =
|
|
9968
|
+
const filePath = import_node_path22.default.join(logDir, buildLogFilename6(request, this.targetName));
|
|
9670
9969
|
try {
|
|
9671
9970
|
const logger = await PiStreamLogger2.create({
|
|
9672
9971
|
filePath,
|
|
@@ -9878,7 +10177,7 @@ var ProviderRegistry = class {
|
|
|
9878
10177
|
};
|
|
9879
10178
|
|
|
9880
10179
|
// src/evaluation/providers/targets.ts
|
|
9881
|
-
var
|
|
10180
|
+
var import_node_path23 = __toESM(require("path"), 1);
|
|
9882
10181
|
var import_zod3 = require("zod");
|
|
9883
10182
|
var CliHealthcheckHttpInputSchema = import_zod3.z.object({
|
|
9884
10183
|
url: import_zod3.z.string().min(1, "healthcheck URL is required"),
|
|
@@ -9975,11 +10274,11 @@ function normalizeCliHealthcheck(input, env, targetName, evalFilePath) {
|
|
|
9975
10274
|
allowLiteral: true,
|
|
9976
10275
|
optionalEnv: true
|
|
9977
10276
|
});
|
|
9978
|
-
if (cwd && evalFilePath && !
|
|
9979
|
-
cwd =
|
|
10277
|
+
if (cwd && evalFilePath && !import_node_path23.default.isAbsolute(cwd)) {
|
|
10278
|
+
cwd = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), cwd);
|
|
9980
10279
|
}
|
|
9981
10280
|
if (!cwd && evalFilePath) {
|
|
9982
|
-
cwd =
|
|
10281
|
+
cwd = import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath));
|
|
9983
10282
|
}
|
|
9984
10283
|
return {
|
|
9985
10284
|
command,
|
|
@@ -10002,15 +10301,15 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
|
|
|
10002
10301
|
optionalEnv: true
|
|
10003
10302
|
}
|
|
10004
10303
|
);
|
|
10005
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10006
|
-
workspaceTemplate =
|
|
10304
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
10305
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10007
10306
|
}
|
|
10008
10307
|
let cwd = resolveOptionalString(input.cwd, env, `${targetName} working directory`, {
|
|
10009
10308
|
allowLiteral: true,
|
|
10010
10309
|
optionalEnv: true
|
|
10011
10310
|
});
|
|
10012
|
-
if (cwd && evalFilePath && !
|
|
10013
|
-
cwd =
|
|
10311
|
+
if (cwd && evalFilePath && !import_node_path23.default.isAbsolute(cwd)) {
|
|
10312
|
+
cwd = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), cwd);
|
|
10014
10313
|
}
|
|
10015
10314
|
if (cwd && workspaceTemplate) {
|
|
10016
10315
|
throw new Error(
|
|
@@ -10018,7 +10317,7 @@ function normalizeCliTargetInput(input, env, evalFilePath) {
|
|
|
10018
10317
|
);
|
|
10019
10318
|
}
|
|
10020
10319
|
if (!cwd && !workspaceTemplate && evalFilePath) {
|
|
10021
|
-
cwd =
|
|
10320
|
+
cwd = import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath));
|
|
10022
10321
|
}
|
|
10023
10322
|
const timeoutSeconds = input.timeout_seconds ?? input.timeoutSeconds;
|
|
10024
10323
|
const timeoutMs = timeoutSeconds !== void 0 ? Math.floor(timeoutSeconds * 1e3) : void 0;
|
|
@@ -10196,6 +10495,15 @@ function resolveTargetDefinition(definition, env = process.env, evalFilePath) {
|
|
|
10196
10495
|
providerBatching,
|
|
10197
10496
|
config: resolveCopilotCliConfig(parsed, env, evalFilePath)
|
|
10198
10497
|
};
|
|
10498
|
+
case "copilot-log":
|
|
10499
|
+
return {
|
|
10500
|
+
kind: "copilot-log",
|
|
10501
|
+
name: parsed.name,
|
|
10502
|
+
graderTarget: parsed.grader_target ?? parsed.judge_target,
|
|
10503
|
+
workers: parsed.workers,
|
|
10504
|
+
providerBatching,
|
|
10505
|
+
config: resolveCopilotLogConfig(parsed, env)
|
|
10506
|
+
};
|
|
10199
10507
|
case "pi":
|
|
10200
10508
|
case "pi-coding-agent":
|
|
10201
10509
|
return {
|
|
@@ -10440,8 +10748,8 @@ function resolveCodexConfig(target, env, evalFilePath) {
|
|
|
10440
10748
|
optionalEnv: true
|
|
10441
10749
|
}
|
|
10442
10750
|
);
|
|
10443
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10444
|
-
workspaceTemplate =
|
|
10751
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
10752
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10445
10753
|
}
|
|
10446
10754
|
if (cwd && workspaceTemplate) {
|
|
10447
10755
|
throw new Error(
|
|
@@ -10525,8 +10833,8 @@ function resolveCopilotSdkConfig(target, env, evalFilePath) {
|
|
|
10525
10833
|
optionalEnv: true
|
|
10526
10834
|
}
|
|
10527
10835
|
);
|
|
10528
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10529
|
-
workspaceTemplate =
|
|
10836
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
10837
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10530
10838
|
}
|
|
10531
10839
|
if (cwd && workspaceTemplate) {
|
|
10532
10840
|
throw new Error(
|
|
@@ -10590,8 +10898,8 @@ function resolveCopilotCliConfig(target, env, evalFilePath) {
|
|
|
10590
10898
|
optionalEnv: true
|
|
10591
10899
|
}
|
|
10592
10900
|
);
|
|
10593
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10594
|
-
workspaceTemplate =
|
|
10901
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
10902
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10595
10903
|
}
|
|
10596
10904
|
if (cwd && workspaceTemplate) {
|
|
10597
10905
|
throw new Error(
|
|
@@ -10679,8 +10987,8 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
|
|
|
10679
10987
|
optionalEnv: true
|
|
10680
10988
|
}
|
|
10681
10989
|
);
|
|
10682
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10683
|
-
workspaceTemplate =
|
|
10990
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
10991
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10684
10992
|
}
|
|
10685
10993
|
if (cwd && workspaceTemplate) {
|
|
10686
10994
|
throw new Error(
|
|
@@ -10759,8 +11067,8 @@ function resolvePiCliConfig(target, env, evalFilePath) {
|
|
|
10759
11067
|
`${target.name} pi-cli workspace template`,
|
|
10760
11068
|
{ allowLiteral: true, optionalEnv: true }
|
|
10761
11069
|
);
|
|
10762
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10763
|
-
workspaceTemplate =
|
|
11070
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
11071
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10764
11072
|
}
|
|
10765
11073
|
if (cwd && workspaceTemplate) {
|
|
10766
11074
|
throw new Error(`${target.name}: 'cwd' and 'workspace_template' are mutually exclusive.`);
|
|
@@ -10813,8 +11121,8 @@ function resolveClaudeConfig(target, env, evalFilePath) {
|
|
|
10813
11121
|
optionalEnv: true
|
|
10814
11122
|
}
|
|
10815
11123
|
);
|
|
10816
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10817
|
-
workspaceTemplate =
|
|
11124
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
11125
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10818
11126
|
}
|
|
10819
11127
|
if (cwd && workspaceTemplate) {
|
|
10820
11128
|
throw new Error(
|
|
@@ -10872,8 +11180,8 @@ function resolveVSCodeConfig(target, env, insiders, evalFilePath) {
|
|
|
10872
11180
|
optionalEnv: true
|
|
10873
11181
|
}
|
|
10874
11182
|
) : void 0;
|
|
10875
|
-
if (workspaceTemplate && evalFilePath && !
|
|
10876
|
-
workspaceTemplate =
|
|
11183
|
+
if (workspaceTemplate && evalFilePath && !import_node_path23.default.isAbsolute(workspaceTemplate)) {
|
|
11184
|
+
workspaceTemplate = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), workspaceTemplate);
|
|
10877
11185
|
}
|
|
10878
11186
|
const executableSource = target.executable;
|
|
10879
11187
|
const waitSource = target.wait;
|
|
@@ -10914,8 +11222,8 @@ function resolveCliConfig(target, env, evalFilePath) {
|
|
|
10914
11222
|
const parseResult = CliTargetInputSchema.safeParse(target, { errorMap: cliErrorMap });
|
|
10915
11223
|
if (!parseResult.success) {
|
|
10916
11224
|
const firstError = parseResult.error.errors[0];
|
|
10917
|
-
const
|
|
10918
|
-
const prefix =
|
|
11225
|
+
const path50 = firstError?.path.join(".") || "";
|
|
11226
|
+
const prefix = path50 ? `${target.name} ${path50}: ` : `${target.name}: `;
|
|
10919
11227
|
throw new Error(`${prefix}${firstError?.message}`);
|
|
10920
11228
|
}
|
|
10921
11229
|
const normalized = normalizeCliTargetInput(parseResult.data, env, evalFilePath);
|
|
@@ -10936,11 +11244,11 @@ function resolveDiscoveredProviderConfig(target, providerKind, env, evalFilePath
|
|
|
10936
11244
|
allowLiteral: true,
|
|
10937
11245
|
optionalEnv: true
|
|
10938
11246
|
});
|
|
10939
|
-
if (cwd && evalFilePath && !
|
|
10940
|
-
cwd =
|
|
11247
|
+
if (cwd && evalFilePath && !import_node_path23.default.isAbsolute(cwd)) {
|
|
11248
|
+
cwd = import_node_path23.default.resolve(import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath)), cwd);
|
|
10941
11249
|
}
|
|
10942
11250
|
if (!cwd && evalFilePath) {
|
|
10943
|
-
cwd =
|
|
11251
|
+
cwd = import_node_path23.default.dirname(import_node_path23.default.resolve(evalFilePath));
|
|
10944
11252
|
}
|
|
10945
11253
|
return {
|
|
10946
11254
|
command,
|
|
@@ -10988,6 +11296,43 @@ function resolveString(source, env, description, allowLiteral = false) {
|
|
|
10988
11296
|
}
|
|
10989
11297
|
return value;
|
|
10990
11298
|
}
|
|
11299
|
+
function resolveDiscover(value, targetName) {
|
|
11300
|
+
if (value === void 0 || value === null) return void 0;
|
|
11301
|
+
if (value === "latest") return "latest";
|
|
11302
|
+
throw new Error(`Target "${targetName}": discover must be "latest" (got "${String(value)}")`);
|
|
11303
|
+
}
|
|
11304
|
+
function resolveCopilotLogConfig(target, env) {
|
|
11305
|
+
const sessionDirSource = target.session_dir ?? target.sessionDir;
|
|
11306
|
+
const sessionIdSource = target.session_id ?? target.sessionId;
|
|
11307
|
+
const discoverSource = target.discover;
|
|
11308
|
+
const sessionStateDirSource = target.session_state_dir ?? target.sessionStateDir;
|
|
11309
|
+
const cwdSource = target.cwd;
|
|
11310
|
+
return {
|
|
11311
|
+
sessionDir: resolveOptionalString(
|
|
11312
|
+
sessionDirSource,
|
|
11313
|
+
env,
|
|
11314
|
+
`${target.name} copilot-log session_dir`,
|
|
11315
|
+
{ allowLiteral: true, optionalEnv: true }
|
|
11316
|
+
),
|
|
11317
|
+
sessionId: resolveOptionalString(
|
|
11318
|
+
sessionIdSource,
|
|
11319
|
+
env,
|
|
11320
|
+
`${target.name} copilot-log session_id`,
|
|
11321
|
+
{ allowLiteral: true, optionalEnv: true }
|
|
11322
|
+
),
|
|
11323
|
+
discover: resolveDiscover(discoverSource, target.name),
|
|
11324
|
+
sessionStateDir: resolveOptionalString(
|
|
11325
|
+
sessionStateDirSource,
|
|
11326
|
+
env,
|
|
11327
|
+
`${target.name} copilot-log session_state_dir`,
|
|
11328
|
+
{ allowLiteral: true, optionalEnv: true }
|
|
11329
|
+
),
|
|
11330
|
+
cwd: resolveOptionalString(cwdSource, env, `${target.name} copilot-log cwd`, {
|
|
11331
|
+
allowLiteral: true,
|
|
11332
|
+
optionalEnv: true
|
|
11333
|
+
})
|
|
11334
|
+
};
|
|
11335
|
+
}
|
|
10991
11336
|
function resolveOptionalString(source, env, description, options) {
|
|
10992
11337
|
if (source === void 0 || source === null) {
|
|
10993
11338
|
return void 0;
|
|
@@ -11124,40 +11469,40 @@ function resolveOptionalNumberArray(source, description) {
|
|
|
11124
11469
|
|
|
11125
11470
|
// src/evaluation/providers/vscode-provider.ts
|
|
11126
11471
|
var import_node_child_process7 = require("child_process");
|
|
11127
|
-
var
|
|
11128
|
-
var
|
|
11472
|
+
var import_promises26 = require("fs/promises");
|
|
11473
|
+
var import_node_path35 = __toESM(require("path"), 1);
|
|
11129
11474
|
var import_node_util3 = require("util");
|
|
11130
11475
|
|
|
11131
11476
|
// src/evaluation/providers/vscode/dispatch/agentDispatch.ts
|
|
11132
|
-
var
|
|
11133
|
-
var
|
|
11477
|
+
var import_promises24 = require("fs/promises");
|
|
11478
|
+
var import_node_path33 = __toESM(require("path"), 1);
|
|
11134
11479
|
|
|
11135
11480
|
// src/evaluation/providers/vscode/utils/fs.ts
|
|
11136
11481
|
var import_node_fs10 = require("fs");
|
|
11137
|
-
var
|
|
11138
|
-
var
|
|
11482
|
+
var import_promises20 = require("fs/promises");
|
|
11483
|
+
var import_node_path24 = __toESM(require("path"), 1);
|
|
11139
11484
|
async function pathExists(target) {
|
|
11140
11485
|
try {
|
|
11141
|
-
await (0,
|
|
11486
|
+
await (0, import_promises20.access)(target, import_node_fs10.constants.F_OK);
|
|
11142
11487
|
return true;
|
|
11143
11488
|
} catch {
|
|
11144
11489
|
return false;
|
|
11145
11490
|
}
|
|
11146
11491
|
}
|
|
11147
11492
|
async function ensureDir(target) {
|
|
11148
|
-
await (0,
|
|
11493
|
+
await (0, import_promises20.mkdir)(target, { recursive: true });
|
|
11149
11494
|
}
|
|
11150
11495
|
async function readDirEntries(target) {
|
|
11151
|
-
const entries = await (0,
|
|
11496
|
+
const entries = await (0, import_promises20.readdir)(target, { withFileTypes: true });
|
|
11152
11497
|
return entries.map((entry) => ({
|
|
11153
11498
|
name: entry.name,
|
|
11154
|
-
absolutePath:
|
|
11499
|
+
absolutePath: import_node_path24.default.join(target, entry.name),
|
|
11155
11500
|
isDirectory: entry.isDirectory()
|
|
11156
11501
|
}));
|
|
11157
11502
|
}
|
|
11158
11503
|
async function removeIfExists(target) {
|
|
11159
11504
|
try {
|
|
11160
|
-
await (0,
|
|
11505
|
+
await (0, import_promises20.rm)(target, { force: true, recursive: false });
|
|
11161
11506
|
} catch (error) {
|
|
11162
11507
|
if (error.code !== "ENOENT") {
|
|
11163
11508
|
throw error;
|
|
@@ -11166,9 +11511,9 @@ async function removeIfExists(target) {
|
|
|
11166
11511
|
}
|
|
11167
11512
|
|
|
11168
11513
|
// src/evaluation/providers/vscode/utils/path.ts
|
|
11169
|
-
var
|
|
11514
|
+
var import_node_path25 = __toESM(require("path"), 1);
|
|
11170
11515
|
function pathToFileUri2(filePath) {
|
|
11171
|
-
const absolutePath =
|
|
11516
|
+
const absolutePath = import_node_path25.default.isAbsolute(filePath) ? filePath : import_node_path25.default.resolve(filePath);
|
|
11172
11517
|
const normalizedPath = absolutePath.replace(/\\/g, "/");
|
|
11173
11518
|
if (/^[a-zA-Z]:\//.test(normalizedPath)) {
|
|
11174
11519
|
return `file:///${normalizedPath}`;
|
|
@@ -11177,7 +11522,7 @@ function pathToFileUri2(filePath) {
|
|
|
11177
11522
|
}
|
|
11178
11523
|
|
|
11179
11524
|
// src/evaluation/providers/vscode/dispatch/promptBuilder.ts
|
|
11180
|
-
var
|
|
11525
|
+
var import_node_path26 = __toESM(require("path"), 1);
|
|
11181
11526
|
|
|
11182
11527
|
// src/evaluation/providers/vscode/utils/template.ts
|
|
11183
11528
|
function renderTemplate2(content, variables) {
|
|
@@ -11269,8 +11614,8 @@ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal,
|
|
|
11269
11614
|
});
|
|
11270
11615
|
}
|
|
11271
11616
|
function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
|
|
11272
|
-
const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${
|
|
11273
|
-
const responseList = responseFiles.map((file) => `"${
|
|
11617
|
+
const requestLines = requestFiles.map((file, index) => `${index + 1}. messages/${import_node_path26.default.basename(file)}`).join("\n");
|
|
11618
|
+
const responseList = responseFiles.map((file) => `"${import_node_path26.default.basename(file)}"`).join(", ");
|
|
11274
11619
|
return renderTemplate2(templateContent, {
|
|
11275
11620
|
requestFiles: requestLines,
|
|
11276
11621
|
responseList
|
|
@@ -11278,8 +11623,8 @@ function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateCont
|
|
|
11278
11623
|
}
|
|
11279
11624
|
|
|
11280
11625
|
// src/evaluation/providers/vscode/dispatch/responseWaiter.ts
|
|
11281
|
-
var
|
|
11282
|
-
var
|
|
11626
|
+
var import_promises21 = require("fs/promises");
|
|
11627
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
|
11283
11628
|
|
|
11284
11629
|
// src/evaluation/providers/vscode/utils/time.ts
|
|
11285
11630
|
function sleep2(ms) {
|
|
@@ -11317,7 +11662,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
|
|
|
11317
11662
|
const maxAttempts = 10;
|
|
11318
11663
|
while (attempts < maxAttempts) {
|
|
11319
11664
|
try {
|
|
11320
|
-
const content = await (0,
|
|
11665
|
+
const content = await (0, import_promises21.readFile)(responseFileFinal, { encoding: "utf8" });
|
|
11321
11666
|
if (!silent) {
|
|
11322
11667
|
process.stdout.write(`${content}
|
|
11323
11668
|
`);
|
|
@@ -11338,7 +11683,7 @@ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, sile
|
|
|
11338
11683
|
}
|
|
11339
11684
|
async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
11340
11685
|
if (!silent) {
|
|
11341
|
-
const fileList = responseFilesFinal.map((file) =>
|
|
11686
|
+
const fileList = responseFilesFinal.map((file) => import_node_path27.default.basename(file)).join(", ");
|
|
11342
11687
|
console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
|
|
11343
11688
|
}
|
|
11344
11689
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -11347,7 +11692,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
|
|
|
11347
11692
|
while (pending.size > 0) {
|
|
11348
11693
|
if (Date.now() >= deadline) {
|
|
11349
11694
|
if (!silent) {
|
|
11350
|
-
const remaining = [...pending].map((f) =>
|
|
11695
|
+
const remaining = [...pending].map((f) => import_node_path27.default.basename(f)).join(", ");
|
|
11351
11696
|
console.error(
|
|
11352
11697
|
`error: timed out after ${Math.round(timeoutMs / 1e3)}s waiting for batch responses. Still pending: ${remaining}`
|
|
11353
11698
|
);
|
|
@@ -11374,7 +11719,7 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
|
|
|
11374
11719
|
const maxAttempts = 10;
|
|
11375
11720
|
while (attempts < maxAttempts) {
|
|
11376
11721
|
try {
|
|
11377
|
-
const content = await (0,
|
|
11722
|
+
const content = await (0, import_promises21.readFile)(file, { encoding: "utf8" });
|
|
11378
11723
|
if (!silent) {
|
|
11379
11724
|
process.stdout.write(`${content}
|
|
11380
11725
|
`);
|
|
@@ -11397,16 +11742,16 @@ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, sil
|
|
|
11397
11742
|
|
|
11398
11743
|
// src/evaluation/providers/vscode/dispatch/vscodeProcess.ts
|
|
11399
11744
|
var import_node_child_process6 = require("child_process");
|
|
11400
|
-
var
|
|
11401
|
-
var
|
|
11745
|
+
var import_promises22 = require("fs/promises");
|
|
11746
|
+
var import_node_path30 = __toESM(require("path"), 1);
|
|
11402
11747
|
var import_node_util2 = require("util");
|
|
11403
11748
|
|
|
11404
11749
|
// src/evaluation/providers/vscode/dispatch/constants.ts
|
|
11405
|
-
var
|
|
11750
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
11406
11751
|
|
|
11407
11752
|
// src/paths.ts
|
|
11408
|
-
var
|
|
11409
|
-
var
|
|
11753
|
+
var import_node_os6 = __toESM(require("os"), 1);
|
|
11754
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
11410
11755
|
var logged = false;
|
|
11411
11756
|
function getAgentvHome() {
|
|
11412
11757
|
const envHome = process.env.AGENTV_HOME;
|
|
@@ -11417,19 +11762,19 @@ function getAgentvHome() {
|
|
|
11417
11762
|
}
|
|
11418
11763
|
return envHome;
|
|
11419
11764
|
}
|
|
11420
|
-
return
|
|
11765
|
+
return import_node_path28.default.join(import_node_os6.default.homedir(), ".agentv");
|
|
11421
11766
|
}
|
|
11422
11767
|
function getWorkspacesRoot() {
|
|
11423
|
-
return
|
|
11768
|
+
return import_node_path28.default.join(getAgentvHome(), "workspaces");
|
|
11424
11769
|
}
|
|
11425
11770
|
function getSubagentsRoot() {
|
|
11426
|
-
return
|
|
11771
|
+
return import_node_path28.default.join(getAgentvHome(), "subagents");
|
|
11427
11772
|
}
|
|
11428
11773
|
function getTraceStateRoot() {
|
|
11429
|
-
return
|
|
11774
|
+
return import_node_path28.default.join(getAgentvHome(), "trace-state");
|
|
11430
11775
|
}
|
|
11431
11776
|
function getWorkspacePoolRoot() {
|
|
11432
|
-
return
|
|
11777
|
+
return import_node_path28.default.join(getAgentvHome(), "workspace-pool");
|
|
11433
11778
|
}
|
|
11434
11779
|
|
|
11435
11780
|
// src/evaluation/providers/vscode/dispatch/constants.ts
|
|
@@ -11437,7 +11782,7 @@ var DEFAULT_LOCK_NAME = "subagent.lock";
|
|
|
11437
11782
|
var DEFAULT_ALIVE_FILENAME = ".alive";
|
|
11438
11783
|
function getDefaultSubagentRoot(vscodeCmd = "code") {
|
|
11439
11784
|
const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
|
|
11440
|
-
return
|
|
11785
|
+
return import_node_path29.default.join(getSubagentsRoot(), folder);
|
|
11441
11786
|
}
|
|
11442
11787
|
var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
|
|
11443
11788
|
|
|
@@ -11504,12 +11849,12 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
|
|
|
11504
11849
|
await raceSpawnError(child);
|
|
11505
11850
|
return true;
|
|
11506
11851
|
}
|
|
11507
|
-
const aliveFile =
|
|
11852
|
+
const aliveFile = import_node_path30.default.join(subagentDir, DEFAULT_ALIVE_FILENAME);
|
|
11508
11853
|
await removeIfExists(aliveFile);
|
|
11509
|
-
const githubAgentsDir =
|
|
11510
|
-
await (0,
|
|
11511
|
-
const wakeupDst =
|
|
11512
|
-
await (0,
|
|
11854
|
+
const githubAgentsDir = import_node_path30.default.join(subagentDir, ".github", "agents");
|
|
11855
|
+
await (0, import_promises22.mkdir)(githubAgentsDir, { recursive: true });
|
|
11856
|
+
const wakeupDst = import_node_path30.default.join(githubAgentsDir, "wakeup.md");
|
|
11857
|
+
await (0, import_promises22.writeFile)(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
|
|
11513
11858
|
const workspaceChild = spawnVsCode(vscodeCmd, [workspacePath], {
|
|
11514
11859
|
label: "open-workspace"
|
|
11515
11860
|
});
|
|
@@ -11521,7 +11866,7 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
|
|
|
11521
11866
|
"chat",
|
|
11522
11867
|
"-m",
|
|
11523
11868
|
wakeupChatId,
|
|
11524
|
-
`create a file named .alive in the ${
|
|
11869
|
+
`create a file named .alive in the ${import_node_path30.default.basename(subagentDir)} folder`
|
|
11525
11870
|
];
|
|
11526
11871
|
const wakeupChild = spawnVsCode(vscodeCmd, chatArgs, { label: "send-wakeup-chat" });
|
|
11527
11872
|
await raceSpawnError(wakeupChild);
|
|
@@ -11536,27 +11881,27 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
|
|
|
11536
11881
|
return true;
|
|
11537
11882
|
}
|
|
11538
11883
|
async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
|
|
11539
|
-
const workspacePath =
|
|
11540
|
-
const messagesDir =
|
|
11541
|
-
await (0,
|
|
11542
|
-
const reqFile =
|
|
11543
|
-
await (0,
|
|
11884
|
+
const workspacePath = import_node_path30.default.join(subagentDir, `${import_node_path30.default.basename(subagentDir)}.code-workspace`);
|
|
11885
|
+
const messagesDir = import_node_path30.default.join(subagentDir, "messages");
|
|
11886
|
+
await (0, import_promises22.mkdir)(messagesDir, { recursive: true });
|
|
11887
|
+
const reqFile = import_node_path30.default.join(messagesDir, `${timestamp}_req.md`);
|
|
11888
|
+
await (0, import_promises22.writeFile)(reqFile, requestInstructions, { encoding: "utf8" });
|
|
11544
11889
|
const reqUri = pathToFileUri2(reqFile);
|
|
11545
11890
|
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
11546
11891
|
for (const attachment of attachmentPaths) {
|
|
11547
11892
|
chatArgs.push("-a", attachment);
|
|
11548
11893
|
}
|
|
11549
11894
|
chatArgs.push("-a", reqFile);
|
|
11550
|
-
chatArgs.push(`Follow instructions in [${
|
|
11895
|
+
chatArgs.push(`Follow instructions in [${import_node_path30.default.basename(reqFile)}](${reqUri})`);
|
|
11551
11896
|
const workspaceReady = await ensureWorkspaceFocused(
|
|
11552
11897
|
workspacePath,
|
|
11553
|
-
|
|
11898
|
+
import_node_path30.default.basename(subagentDir),
|
|
11554
11899
|
subagentDir,
|
|
11555
11900
|
vscodeCmd
|
|
11556
11901
|
);
|
|
11557
11902
|
if (!workspaceReady) {
|
|
11558
11903
|
throw new Error(
|
|
11559
|
-
`VS Code workspace '${
|
|
11904
|
+
`VS Code workspace '${import_node_path30.default.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
|
|
11560
11905
|
);
|
|
11561
11906
|
}
|
|
11562
11907
|
await sleep2(500);
|
|
@@ -11564,9 +11909,9 @@ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, reques
|
|
|
11564
11909
|
await raceSpawnError(child);
|
|
11565
11910
|
}
|
|
11566
11911
|
async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
|
|
11567
|
-
const workspacePath =
|
|
11568
|
-
const messagesDir =
|
|
11569
|
-
await (0,
|
|
11912
|
+
const workspacePath = import_node_path30.default.join(subagentDir, `${import_node_path30.default.basename(subagentDir)}.code-workspace`);
|
|
11913
|
+
const messagesDir = import_node_path30.default.join(subagentDir, "messages");
|
|
11914
|
+
await (0, import_promises22.mkdir)(messagesDir, { recursive: true });
|
|
11570
11915
|
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
11571
11916
|
for (const attachment of attachmentPaths) {
|
|
11572
11917
|
chatArgs.push("-a", attachment);
|
|
@@ -11574,13 +11919,13 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
|
|
|
11574
11919
|
chatArgs.push(chatInstruction);
|
|
11575
11920
|
const workspaceReady = await ensureWorkspaceFocused(
|
|
11576
11921
|
workspacePath,
|
|
11577
|
-
|
|
11922
|
+
import_node_path30.default.basename(subagentDir),
|
|
11578
11923
|
subagentDir,
|
|
11579
11924
|
vscodeCmd
|
|
11580
11925
|
);
|
|
11581
11926
|
if (!workspaceReady) {
|
|
11582
11927
|
throw new Error(
|
|
11583
|
-
`VS Code workspace '${
|
|
11928
|
+
`VS Code workspace '${import_node_path30.default.basename(subagentDir)}' failed to become ready within the timeout. Check that '${vscodeCmd}' can open workspaces.`
|
|
11584
11929
|
);
|
|
11585
11930
|
}
|
|
11586
11931
|
await sleep2(500);
|
|
@@ -11589,11 +11934,11 @@ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, c
|
|
|
11589
11934
|
}
|
|
11590
11935
|
|
|
11591
11936
|
// src/evaluation/providers/vscode/dispatch/workspaceManager.ts
|
|
11592
|
-
var
|
|
11593
|
-
var
|
|
11937
|
+
var import_promises23 = require("fs/promises");
|
|
11938
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
|
11594
11939
|
|
|
11595
11940
|
// src/evaluation/providers/vscode/utils/workspace.ts
|
|
11596
|
-
var
|
|
11941
|
+
var import_node_path31 = __toESM(require("path"), 1);
|
|
11597
11942
|
var import_json5 = __toESM(require("json5"), 1);
|
|
11598
11943
|
function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
11599
11944
|
let workspace;
|
|
@@ -11610,10 +11955,10 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
11610
11955
|
}
|
|
11611
11956
|
const transformedFolders = workspace.folders.map((folder) => {
|
|
11612
11957
|
const folderPath = folder.path;
|
|
11613
|
-
if (
|
|
11958
|
+
if (import_node_path31.default.isAbsolute(folderPath)) {
|
|
11614
11959
|
return folder;
|
|
11615
11960
|
}
|
|
11616
|
-
const absolutePath =
|
|
11961
|
+
const absolutePath = import_node_path31.default.resolve(templateDir, folderPath);
|
|
11617
11962
|
return {
|
|
11618
11963
|
...folder,
|
|
11619
11964
|
path: absolutePath
|
|
@@ -11635,19 +11980,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
11635
11980
|
if (locationMap && typeof locationMap === "object") {
|
|
11636
11981
|
const transformedMap = {};
|
|
11637
11982
|
for (const [locationPath, value] of Object.entries(locationMap)) {
|
|
11638
|
-
const isAbsolute =
|
|
11983
|
+
const isAbsolute = import_node_path31.default.isAbsolute(locationPath);
|
|
11639
11984
|
if (isAbsolute) {
|
|
11640
11985
|
transformedMap[locationPath] = value;
|
|
11641
11986
|
} else {
|
|
11642
11987
|
const firstGlobIndex = locationPath.search(/[*]/);
|
|
11643
11988
|
if (firstGlobIndex === -1) {
|
|
11644
|
-
const resolvedPath =
|
|
11989
|
+
const resolvedPath = import_node_path31.default.resolve(templateDir, locationPath).replace(/\\/g, "/");
|
|
11645
11990
|
transformedMap[resolvedPath] = value;
|
|
11646
11991
|
} else {
|
|
11647
11992
|
const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
|
|
11648
11993
|
const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
|
|
11649
11994
|
const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
|
|
11650
|
-
const resolvedPath = (
|
|
11995
|
+
const resolvedPath = (import_node_path31.default.resolve(templateDir, basePath) + patternPath).replace(
|
|
11651
11996
|
/\\/g,
|
|
11652
11997
|
"/"
|
|
11653
11998
|
);
|
|
@@ -11688,7 +12033,7 @@ async function findUnlockedSubagent(subagentRoot) {
|
|
|
11688
12033
|
number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
|
|
11689
12034
|
})).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
|
|
11690
12035
|
for (const subagent of subagents) {
|
|
11691
|
-
const lockFile =
|
|
12036
|
+
const lockFile = import_node_path32.default.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
|
|
11692
12037
|
if (!await pathExists(lockFile)) {
|
|
11693
12038
|
return subagent.absolutePath;
|
|
11694
12039
|
}
|
|
@@ -11698,26 +12043,26 @@ async function findUnlockedSubagent(subagentRoot) {
|
|
|
11698
12043
|
async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
|
|
11699
12044
|
let workspaceContent;
|
|
11700
12045
|
if (workspaceTemplate) {
|
|
11701
|
-
const workspaceSrc =
|
|
12046
|
+
const workspaceSrc = import_node_path32.default.resolve(workspaceTemplate);
|
|
11702
12047
|
if (!await pathExists(workspaceSrc)) {
|
|
11703
12048
|
throw new Error(`workspace template not found: ${workspaceSrc}`);
|
|
11704
12049
|
}
|
|
11705
|
-
const stats = await (0,
|
|
12050
|
+
const stats = await (0, import_promises23.stat)(workspaceSrc);
|
|
11706
12051
|
if (!stats.isFile()) {
|
|
11707
12052
|
throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
|
|
11708
12053
|
}
|
|
11709
|
-
const templateText = await (0,
|
|
12054
|
+
const templateText = await (0, import_promises23.readFile)(workspaceSrc, "utf8");
|
|
11710
12055
|
workspaceContent = JSON.parse(templateText);
|
|
11711
12056
|
} else {
|
|
11712
12057
|
workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
|
|
11713
12058
|
}
|
|
11714
|
-
const workspaceName = `${
|
|
11715
|
-
const workspaceDst =
|
|
11716
|
-
const templateDir = workspaceTemplate ?
|
|
12059
|
+
const workspaceName = `${import_node_path32.default.basename(subagentDir)}.code-workspace`;
|
|
12060
|
+
const workspaceDst = import_node_path32.default.join(subagentDir, workspaceName);
|
|
12061
|
+
const templateDir = workspaceTemplate ? import_node_path32.default.dirname(import_node_path32.default.resolve(workspaceTemplate)) : subagentDir;
|
|
11717
12062
|
const workspaceJson = JSON.stringify(workspaceContent, null, 2);
|
|
11718
12063
|
let transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
|
|
11719
12064
|
if (cwd) {
|
|
11720
|
-
const absCwd =
|
|
12065
|
+
const absCwd = import_node_path32.default.resolve(cwd);
|
|
11721
12066
|
const parsed = JSON.parse(transformedContent);
|
|
11722
12067
|
const alreadyPresent = parsed.folders.some((f) => f.path === absCwd);
|
|
11723
12068
|
if (!alreadyPresent) {
|
|
@@ -11725,36 +12070,36 @@ async function copyAgentConfig(subagentDir, workspaceTemplate, cwd) {
|
|
|
11725
12070
|
transformedContent = JSON.stringify(parsed, null, 2);
|
|
11726
12071
|
}
|
|
11727
12072
|
}
|
|
11728
|
-
await (0,
|
|
11729
|
-
const messagesDir =
|
|
11730
|
-
await (0,
|
|
12073
|
+
await (0, import_promises23.writeFile)(workspaceDst, transformedContent, "utf8");
|
|
12074
|
+
const messagesDir = import_node_path32.default.join(subagentDir, "messages");
|
|
12075
|
+
await (0, import_promises23.mkdir)(messagesDir, { recursive: true });
|
|
11731
12076
|
return { workspace: workspaceDst, messagesDir };
|
|
11732
12077
|
}
|
|
11733
12078
|
async function createSubagentLock(subagentDir) {
|
|
11734
|
-
const messagesDir =
|
|
12079
|
+
const messagesDir = import_node_path32.default.join(subagentDir, "messages");
|
|
11735
12080
|
if (await pathExists(messagesDir)) {
|
|
11736
|
-
const files = await (0,
|
|
12081
|
+
const files = await (0, import_promises23.readdir)(messagesDir);
|
|
11737
12082
|
await Promise.all(
|
|
11738
12083
|
files.map(async (file) => {
|
|
11739
|
-
const target =
|
|
12084
|
+
const target = import_node_path32.default.join(messagesDir, file);
|
|
11740
12085
|
await removeIfExists(target);
|
|
11741
12086
|
})
|
|
11742
12087
|
);
|
|
11743
12088
|
}
|
|
11744
|
-
const githubAgentsDir =
|
|
12089
|
+
const githubAgentsDir = import_node_path32.default.join(subagentDir, ".github", "agents");
|
|
11745
12090
|
if (await pathExists(githubAgentsDir)) {
|
|
11746
|
-
const agentFiles = await (0,
|
|
12091
|
+
const agentFiles = await (0, import_promises23.readdir)(githubAgentsDir);
|
|
11747
12092
|
const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
|
|
11748
12093
|
await Promise.all(
|
|
11749
|
-
agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(
|
|
12094
|
+
agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(import_node_path32.default.join(githubAgentsDir, file)))
|
|
11750
12095
|
);
|
|
11751
12096
|
}
|
|
11752
|
-
const lockFile =
|
|
11753
|
-
await (0,
|
|
12097
|
+
const lockFile = import_node_path32.default.join(subagentDir, DEFAULT_LOCK_NAME);
|
|
12098
|
+
await (0, import_promises23.writeFile)(lockFile, "", { encoding: "utf8" });
|
|
11754
12099
|
return lockFile;
|
|
11755
12100
|
}
|
|
11756
12101
|
async function removeSubagentLock(subagentDir) {
|
|
11757
|
-
const lockFile =
|
|
12102
|
+
const lockFile = import_node_path32.default.join(subagentDir, DEFAULT_LOCK_NAME);
|
|
11758
12103
|
await removeIfExists(lockFile);
|
|
11759
12104
|
}
|
|
11760
12105
|
async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun, cwd) {
|
|
@@ -11774,11 +12119,11 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
|
|
|
11774
12119
|
return 1;
|
|
11775
12120
|
}
|
|
11776
12121
|
if (promptFile) {
|
|
11777
|
-
const githubAgentsDir =
|
|
11778
|
-
await (0,
|
|
11779
|
-
const agentFile =
|
|
12122
|
+
const githubAgentsDir = import_node_path32.default.join(subagentDir, ".github", "agents");
|
|
12123
|
+
await (0, import_promises23.mkdir)(githubAgentsDir, { recursive: true });
|
|
12124
|
+
const agentFile = import_node_path32.default.join(githubAgentsDir, `${chatId}.md`);
|
|
11780
12125
|
try {
|
|
11781
|
-
await (0,
|
|
12126
|
+
await (0, import_promises23.copyFile)(promptFile, agentFile);
|
|
11782
12127
|
} catch (error) {
|
|
11783
12128
|
console.error(`error: Failed to copy prompt file to agent mode: ${error.message}`);
|
|
11784
12129
|
return 1;
|
|
@@ -11795,11 +12140,11 @@ async function resolvePromptFile(promptFile) {
|
|
|
11795
12140
|
if (!promptFile) {
|
|
11796
12141
|
return void 0;
|
|
11797
12142
|
}
|
|
11798
|
-
const resolvedPrompt =
|
|
12143
|
+
const resolvedPrompt = import_node_path33.default.resolve(promptFile);
|
|
11799
12144
|
if (!await pathExists(resolvedPrompt)) {
|
|
11800
12145
|
throw new Error(`Prompt file not found: ${resolvedPrompt}`);
|
|
11801
12146
|
}
|
|
11802
|
-
const promptStats = await (0,
|
|
12147
|
+
const promptStats = await (0, import_promises24.stat)(resolvedPrompt);
|
|
11803
12148
|
if (!promptStats.isFile()) {
|
|
11804
12149
|
throw new Error(`Prompt file must be a file, not a directory: ${resolvedPrompt}`);
|
|
11805
12150
|
}
|
|
@@ -11811,7 +12156,7 @@ async function resolveAttachments(extraAttachments) {
|
|
|
11811
12156
|
}
|
|
11812
12157
|
const resolved = [];
|
|
11813
12158
|
for (const attachment of extraAttachments) {
|
|
11814
|
-
const resolvedPath =
|
|
12159
|
+
const resolvedPath = import_node_path33.default.resolve(attachment);
|
|
11815
12160
|
if (!await pathExists(resolvedPath)) {
|
|
11816
12161
|
throw new Error(`Attachment not found: ${resolvedPath}`);
|
|
11817
12162
|
}
|
|
@@ -11853,7 +12198,7 @@ async function dispatchAgentSession(options) {
|
|
|
11853
12198
|
error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
|
|
11854
12199
|
};
|
|
11855
12200
|
}
|
|
11856
|
-
const subagentName =
|
|
12201
|
+
const subagentName = import_node_path33.default.basename(subagentDir);
|
|
11857
12202
|
const chatId = Math.random().toString(16).slice(2, 10);
|
|
11858
12203
|
const preparationResult = await prepareSubagentDirectory(
|
|
11859
12204
|
subagentDir,
|
|
@@ -11881,9 +12226,9 @@ async function dispatchAgentSession(options) {
|
|
|
11881
12226
|
};
|
|
11882
12227
|
}
|
|
11883
12228
|
const timestamp = generateTimestamp();
|
|
11884
|
-
const messagesDir =
|
|
11885
|
-
const responseFileTmp =
|
|
11886
|
-
const responseFileFinal =
|
|
12229
|
+
const messagesDir = import_node_path33.default.join(subagentDir, "messages");
|
|
12230
|
+
const responseFileTmp = import_node_path33.default.join(messagesDir, `${timestamp}_res.tmp.md`);
|
|
12231
|
+
const responseFileFinal = import_node_path33.default.join(messagesDir, `${timestamp}_res.md`);
|
|
11887
12232
|
const requestInstructions = createRequestPrompt(
|
|
11888
12233
|
userQuery,
|
|
11889
12234
|
responseFileTmp,
|
|
@@ -11988,7 +12333,7 @@ async function dispatchBatchAgent(options) {
|
|
|
11988
12333
|
error: "No unlocked subagents available. Provision additional subagents with: subagent code provision --subagents <desired_total>"
|
|
11989
12334
|
};
|
|
11990
12335
|
}
|
|
11991
|
-
subagentName =
|
|
12336
|
+
subagentName = import_node_path33.default.basename(subagentDir);
|
|
11992
12337
|
const chatId = Math.random().toString(16).slice(2, 10);
|
|
11993
12338
|
const preparationResult = await prepareSubagentDirectory(
|
|
11994
12339
|
subagentDir,
|
|
@@ -12019,24 +12364,24 @@ async function dispatchBatchAgent(options) {
|
|
|
12019
12364
|
};
|
|
12020
12365
|
}
|
|
12021
12366
|
const timestamp = generateTimestamp();
|
|
12022
|
-
const messagesDir =
|
|
12367
|
+
const messagesDir = import_node_path33.default.join(subagentDir, "messages");
|
|
12023
12368
|
requestFiles = userQueries.map(
|
|
12024
|
-
(_, index) =>
|
|
12369
|
+
(_, index) => import_node_path33.default.join(messagesDir, `${timestamp}_${index}_req.md`)
|
|
12025
12370
|
);
|
|
12026
12371
|
const responseTmpFiles = userQueries.map(
|
|
12027
|
-
(_, index) =>
|
|
12372
|
+
(_, index) => import_node_path33.default.join(messagesDir, `${timestamp}_${index}_res.tmp.md`)
|
|
12028
12373
|
);
|
|
12029
12374
|
responseFilesFinal = userQueries.map(
|
|
12030
|
-
(_, index) =>
|
|
12375
|
+
(_, index) => import_node_path33.default.join(messagesDir, `${timestamp}_${index}_res.md`)
|
|
12031
12376
|
);
|
|
12032
|
-
const orchestratorFile =
|
|
12377
|
+
const orchestratorFile = import_node_path33.default.join(messagesDir, `${timestamp}_orchestrator.md`);
|
|
12033
12378
|
if (!dryRun) {
|
|
12034
12379
|
await Promise.all(
|
|
12035
12380
|
userQueries.map((query, index) => {
|
|
12036
12381
|
const reqFile = requestFiles[index];
|
|
12037
12382
|
const tmpFile = responseTmpFiles[index];
|
|
12038
12383
|
const finalFile = responseFilesFinal[index];
|
|
12039
|
-
return (0,
|
|
12384
|
+
return (0, import_promises24.writeFile)(
|
|
12040
12385
|
reqFile,
|
|
12041
12386
|
createBatchRequestPrompt(query, tmpFile, finalFile, batchRequestTemplateContent),
|
|
12042
12387
|
{ encoding: "utf8" }
|
|
@@ -12048,7 +12393,7 @@ async function dispatchBatchAgent(options) {
|
|
|
12048
12393
|
responseFilesFinal,
|
|
12049
12394
|
orchestratorTemplateContent
|
|
12050
12395
|
);
|
|
12051
|
-
await (0,
|
|
12396
|
+
await (0, import_promises24.writeFile)(orchestratorFile, orchestratorContent, { encoding: "utf8" });
|
|
12052
12397
|
}
|
|
12053
12398
|
const chatAttachments = [orchestratorFile, ...attachments];
|
|
12054
12399
|
const orchestratorUri = pathToFileUri2(orchestratorFile);
|
|
@@ -12114,8 +12459,8 @@ async function dispatchBatchAgent(options) {
|
|
|
12114
12459
|
}
|
|
12115
12460
|
|
|
12116
12461
|
// src/evaluation/providers/vscode/dispatch/provision.ts
|
|
12117
|
-
var
|
|
12118
|
-
var
|
|
12462
|
+
var import_promises25 = require("fs/promises");
|
|
12463
|
+
var import_node_path34 = __toESM(require("path"), 1);
|
|
12119
12464
|
var DEFAULT_WORKSPACE_TEMPLATE2 = {
|
|
12120
12465
|
folders: [
|
|
12121
12466
|
{
|
|
@@ -12146,7 +12491,7 @@ async function provisionSubagents(options) {
|
|
|
12146
12491
|
if (!Number.isInteger(subagents) || subagents < 1) {
|
|
12147
12492
|
throw new Error("subagents must be a positive integer");
|
|
12148
12493
|
}
|
|
12149
|
-
const targetPath =
|
|
12494
|
+
const targetPath = import_node_path34.default.resolve(targetRoot);
|
|
12150
12495
|
if (!dryRun) {
|
|
12151
12496
|
await ensureDir(targetPath);
|
|
12152
12497
|
}
|
|
@@ -12166,7 +12511,7 @@ async function provisionSubagents(options) {
|
|
|
12166
12511
|
continue;
|
|
12167
12512
|
}
|
|
12168
12513
|
highestNumber = Math.max(highestNumber, parsed);
|
|
12169
|
-
const lockFile =
|
|
12514
|
+
const lockFile = import_node_path34.default.join(entry.absolutePath, lockName);
|
|
12170
12515
|
const locked = await pathExists(lockFile);
|
|
12171
12516
|
if (locked) {
|
|
12172
12517
|
lockedSubagents.add(entry.absolutePath);
|
|
@@ -12183,10 +12528,10 @@ async function provisionSubagents(options) {
|
|
|
12183
12528
|
break;
|
|
12184
12529
|
}
|
|
12185
12530
|
const subagentDir = subagent.absolutePath;
|
|
12186
|
-
const githubAgentsDir =
|
|
12187
|
-
const lockFile =
|
|
12188
|
-
const workspaceDst =
|
|
12189
|
-
const wakeupDst =
|
|
12531
|
+
const githubAgentsDir = import_node_path34.default.join(subagentDir, ".github", "agents");
|
|
12532
|
+
const lockFile = import_node_path34.default.join(subagentDir, lockName);
|
|
12533
|
+
const workspaceDst = import_node_path34.default.join(subagentDir, `${import_node_path34.default.basename(subagentDir)}.code-workspace`);
|
|
12534
|
+
const wakeupDst = import_node_path34.default.join(githubAgentsDir, "wakeup.md");
|
|
12190
12535
|
const isLocked = await pathExists(lockFile);
|
|
12191
12536
|
if (isLocked && !force) {
|
|
12192
12537
|
continue;
|
|
@@ -12195,8 +12540,8 @@ async function provisionSubagents(options) {
|
|
|
12195
12540
|
if (!dryRun) {
|
|
12196
12541
|
await removeIfExists(lockFile);
|
|
12197
12542
|
await ensureDir(githubAgentsDir);
|
|
12198
|
-
await (0,
|
|
12199
|
-
await (0,
|
|
12543
|
+
await (0, import_promises25.writeFile)(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
12544
|
+
await (0, import_promises25.writeFile)(wakeupDst, wakeupContent, "utf8");
|
|
12200
12545
|
}
|
|
12201
12546
|
created.push(subagentDir);
|
|
12202
12547
|
lockedSubagents.delete(subagentDir);
|
|
@@ -12206,8 +12551,8 @@ async function provisionSubagents(options) {
|
|
|
12206
12551
|
if (!isLocked && force) {
|
|
12207
12552
|
if (!dryRun) {
|
|
12208
12553
|
await ensureDir(githubAgentsDir);
|
|
12209
|
-
await (0,
|
|
12210
|
-
await (0,
|
|
12554
|
+
await (0, import_promises25.writeFile)(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
12555
|
+
await (0, import_promises25.writeFile)(wakeupDst, wakeupContent, "utf8");
|
|
12211
12556
|
}
|
|
12212
12557
|
created.push(subagentDir);
|
|
12213
12558
|
subagentsProvisioned += 1;
|
|
@@ -12215,8 +12560,8 @@ async function provisionSubagents(options) {
|
|
|
12215
12560
|
}
|
|
12216
12561
|
if (!dryRun && !await pathExists(workspaceDst)) {
|
|
12217
12562
|
await ensureDir(githubAgentsDir);
|
|
12218
|
-
await (0,
|
|
12219
|
-
await (0,
|
|
12563
|
+
await (0, import_promises25.writeFile)(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
12564
|
+
await (0, import_promises25.writeFile)(wakeupDst, wakeupContent, "utf8");
|
|
12220
12565
|
}
|
|
12221
12566
|
skippedExisting.push(subagentDir);
|
|
12222
12567
|
subagentsProvisioned += 1;
|
|
@@ -12224,15 +12569,15 @@ async function provisionSubagents(options) {
|
|
|
12224
12569
|
let nextIndex = highestNumber;
|
|
12225
12570
|
while (subagentsProvisioned < subagents) {
|
|
12226
12571
|
nextIndex += 1;
|
|
12227
|
-
const subagentDir =
|
|
12228
|
-
const githubAgentsDir =
|
|
12229
|
-
const workspaceDst =
|
|
12230
|
-
const wakeupDst =
|
|
12572
|
+
const subagentDir = import_node_path34.default.join(targetPath, `subagent-${nextIndex}`);
|
|
12573
|
+
const githubAgentsDir = import_node_path34.default.join(subagentDir, ".github", "agents");
|
|
12574
|
+
const workspaceDst = import_node_path34.default.join(subagentDir, `${import_node_path34.default.basename(subagentDir)}.code-workspace`);
|
|
12575
|
+
const wakeupDst = import_node_path34.default.join(githubAgentsDir, "wakeup.md");
|
|
12231
12576
|
if (!dryRun) {
|
|
12232
12577
|
await ensureDir(subagentDir);
|
|
12233
12578
|
await ensureDir(githubAgentsDir);
|
|
12234
|
-
await (0,
|
|
12235
|
-
await (0,
|
|
12579
|
+
await (0, import_promises25.writeFile)(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
12580
|
+
await (0, import_promises25.writeFile)(wakeupDst, wakeupContent, "utf8");
|
|
12236
12581
|
}
|
|
12237
12582
|
created.push(subagentDir);
|
|
12238
12583
|
subagentsProvisioned += 1;
|
|
@@ -12417,9 +12762,9 @@ var VSCodeProvider = class {
|
|
|
12417
12762
|
async function locateVSCodeExecutable(candidate) {
|
|
12418
12763
|
const includesPathSeparator = candidate.includes("/") || candidate.includes("\\");
|
|
12419
12764
|
if (includesPathSeparator) {
|
|
12420
|
-
const resolved =
|
|
12765
|
+
const resolved = import_node_path35.default.isAbsolute(candidate) ? candidate : import_node_path35.default.resolve(candidate);
|
|
12421
12766
|
try {
|
|
12422
|
-
await (0,
|
|
12767
|
+
await (0, import_promises26.access)(resolved, import_promises26.constants.F_OK);
|
|
12423
12768
|
return resolved;
|
|
12424
12769
|
} catch {
|
|
12425
12770
|
throw new Error(
|
|
@@ -12432,7 +12777,7 @@ async function locateVSCodeExecutable(candidate) {
|
|
|
12432
12777
|
const { stdout } = await execAsync3(`${locator} ${candidate}`);
|
|
12433
12778
|
const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
12434
12779
|
if (lines.length > 0 && lines[0]) {
|
|
12435
|
-
await (0,
|
|
12780
|
+
await (0, import_promises26.access)(lines[0], import_promises26.constants.F_OK);
|
|
12436
12781
|
return lines[0];
|
|
12437
12782
|
}
|
|
12438
12783
|
} catch {
|
|
@@ -12446,7 +12791,7 @@ async function resolveWorkspaceTemplateFile(template) {
|
|
|
12446
12791
|
return void 0;
|
|
12447
12792
|
}
|
|
12448
12793
|
try {
|
|
12449
|
-
const stats = await (0,
|
|
12794
|
+
const stats = await (0, import_promises26.stat)(import_node_path35.default.resolve(template));
|
|
12450
12795
|
return stats.isFile() ? template : void 0;
|
|
12451
12796
|
} catch {
|
|
12452
12797
|
return template;
|
|
@@ -12470,7 +12815,7 @@ function buildMandatoryPrereadBlock2(attachmentFiles) {
|
|
|
12470
12815
|
return "";
|
|
12471
12816
|
}
|
|
12472
12817
|
const buildList = (files) => files.map((absolutePath) => {
|
|
12473
|
-
const fileName =
|
|
12818
|
+
const fileName = import_node_path35.default.basename(absolutePath);
|
|
12474
12819
|
const fileUri = pathToFileUri3(absolutePath);
|
|
12475
12820
|
return `* [${fileName}](${fileUri})`;
|
|
12476
12821
|
});
|
|
@@ -12491,7 +12836,7 @@ function collectAttachmentFiles(attachments) {
|
|
|
12491
12836
|
}
|
|
12492
12837
|
const unique = /* @__PURE__ */ new Map();
|
|
12493
12838
|
for (const attachment of attachments) {
|
|
12494
|
-
const absolutePath =
|
|
12839
|
+
const absolutePath = import_node_path35.default.resolve(attachment);
|
|
12495
12840
|
if (!unique.has(absolutePath)) {
|
|
12496
12841
|
unique.set(absolutePath, absolutePath);
|
|
12497
12842
|
}
|
|
@@ -12499,7 +12844,7 @@ function collectAttachmentFiles(attachments) {
|
|
|
12499
12844
|
return Array.from(unique.values());
|
|
12500
12845
|
}
|
|
12501
12846
|
function pathToFileUri3(filePath) {
|
|
12502
|
-
const absolutePath =
|
|
12847
|
+
const absolutePath = import_node_path35.default.isAbsolute(filePath) ? filePath : import_node_path35.default.resolve(filePath);
|
|
12503
12848
|
const normalizedPath = absolutePath.replace(/\\/g, "/");
|
|
12504
12849
|
if (/^[a-zA-Z]:\//.test(normalizedPath)) {
|
|
12505
12850
|
return `file:///${normalizedPath}`;
|
|
@@ -12512,7 +12857,7 @@ function normalizeAttachments(attachments) {
|
|
|
12512
12857
|
}
|
|
12513
12858
|
const deduped = /* @__PURE__ */ new Set();
|
|
12514
12859
|
for (const attachment of attachments) {
|
|
12515
|
-
deduped.add(
|
|
12860
|
+
deduped.add(import_node_path35.default.resolve(attachment));
|
|
12516
12861
|
}
|
|
12517
12862
|
return Array.from(deduped);
|
|
12518
12863
|
}
|
|
@@ -12521,7 +12866,7 @@ function mergeAttachments(all) {
|
|
|
12521
12866
|
for (const list of all) {
|
|
12522
12867
|
if (!list) continue;
|
|
12523
12868
|
for (const inputFile of list) {
|
|
12524
|
-
deduped.add(
|
|
12869
|
+
deduped.add(import_node_path35.default.resolve(inputFile));
|
|
12525
12870
|
}
|
|
12526
12871
|
}
|
|
12527
12872
|
return deduped.size > 0 ? Array.from(deduped) : void 0;
|
|
@@ -12569,9 +12914,9 @@ total unlocked subagents available: ${result.created.length + result.skippedExis
|
|
|
12569
12914
|
|
|
12570
12915
|
// src/evaluation/providers/targets-file.ts
|
|
12571
12916
|
var import_node_fs11 = require("fs");
|
|
12572
|
-
var
|
|
12573
|
-
var
|
|
12574
|
-
var
|
|
12917
|
+
var import_promises27 = require("fs/promises");
|
|
12918
|
+
var import_node_path36 = __toESM(require("path"), 1);
|
|
12919
|
+
var import_yaml7 = require("yaml");
|
|
12575
12920
|
function isRecord(value) {
|
|
12576
12921
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12577
12922
|
}
|
|
@@ -12600,19 +12945,19 @@ function assertTargetDefinition(value, index, filePath) {
|
|
|
12600
12945
|
}
|
|
12601
12946
|
async function fileExists3(filePath) {
|
|
12602
12947
|
try {
|
|
12603
|
-
await (0,
|
|
12948
|
+
await (0, import_promises27.access)(filePath, import_node_fs11.constants.F_OK);
|
|
12604
12949
|
return true;
|
|
12605
12950
|
} catch {
|
|
12606
12951
|
return false;
|
|
12607
12952
|
}
|
|
12608
12953
|
}
|
|
12609
12954
|
async function readTargetDefinitions(filePath) {
|
|
12610
|
-
const absolutePath =
|
|
12955
|
+
const absolutePath = import_node_path36.default.resolve(filePath);
|
|
12611
12956
|
if (!await fileExists3(absolutePath)) {
|
|
12612
12957
|
throw new Error(`targets.yaml not found at ${absolutePath}`);
|
|
12613
12958
|
}
|
|
12614
|
-
const raw = await (0,
|
|
12615
|
-
const parsed = (0,
|
|
12959
|
+
const raw = await (0, import_promises27.readFile)(absolutePath, "utf8");
|
|
12960
|
+
const parsed = (0, import_yaml7.parse)(raw);
|
|
12616
12961
|
if (!isRecord(parsed)) {
|
|
12617
12962
|
throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
|
|
12618
12963
|
}
|
|
@@ -12627,16 +12972,16 @@ function listTargetNames(definitions) {
|
|
|
12627
12972
|
}
|
|
12628
12973
|
|
|
12629
12974
|
// src/evaluation/providers/provider-discovery.ts
|
|
12630
|
-
var
|
|
12975
|
+
var import_node_path37 = __toESM(require("path"), 1);
|
|
12631
12976
|
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
12632
12977
|
async function discoverProviders(registry, baseDir) {
|
|
12633
12978
|
const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
|
|
12634
12979
|
const candidateDirs = [];
|
|
12635
|
-
let dir =
|
|
12636
|
-
const root =
|
|
12980
|
+
let dir = import_node_path37.default.resolve(baseDir);
|
|
12981
|
+
const root = import_node_path37.default.parse(dir).root;
|
|
12637
12982
|
while (dir !== root) {
|
|
12638
|
-
candidateDirs.push(
|
|
12639
|
-
dir =
|
|
12983
|
+
candidateDirs.push(import_node_path37.default.join(dir, ".agentv", "providers"));
|
|
12984
|
+
dir = import_node_path37.default.dirname(dir);
|
|
12640
12985
|
}
|
|
12641
12986
|
let files = [];
|
|
12642
12987
|
for (const providersDir of candidateDirs) {
|
|
@@ -12652,7 +12997,7 @@ async function discoverProviders(registry, baseDir) {
|
|
|
12652
12997
|
}
|
|
12653
12998
|
const discoveredKinds = [];
|
|
12654
12999
|
for (const filePath of files) {
|
|
12655
|
-
const basename =
|
|
13000
|
+
const basename = import_node_path37.default.basename(filePath);
|
|
12656
13001
|
const kindName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
|
|
12657
13002
|
if (registry.has(kindName)) {
|
|
12658
13003
|
continue;
|
|
@@ -12670,7 +13015,7 @@ async function discoverProviders(registry, baseDir) {
|
|
|
12670
13015
|
// src/evaluation/providers/index.ts
|
|
12671
13016
|
function createBuiltinProviderRegistry() {
|
|
12672
13017
|
const registry = new ProviderRegistry();
|
|
12673
|
-
registry.register("openai", (t) => new OpenAIProvider(t.name, t.config)).register("openrouter", (t) => new OpenRouterProvider(t.name, t.config)).register("azure", (t) => new AzureProvider(t.name, t.config)).register("anthropic", (t) => new AnthropicProvider(t.name, t.config)).register("gemini", (t) => new GeminiProvider(t.name, t.config)).register("cli", (t) => new CliProvider(t.name, t.config)).register("codex", (t) => new CodexProvider(t.name, t.config)).register("copilot-sdk", (t) => new CopilotSdkProvider(t.name, t.config)).register("copilot-cli", (t) => new CopilotCliProvider(t.name, t.config)).register("pi-coding-agent", (t) => new PiCodingAgentProvider(t.name, t.config)).register("pi-cli", (t) => new PiCliProvider(t.name, t.config)).register("claude-cli", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude-sdk", (t) => new ClaudeSdkProvider(t.name, t.config)).register("mock", (t) => new MockProvider(t.name, t.config)).register("agentv", (t) => new AgentvProvider(t.name, t.config)).register("vscode", (t) => new VSCodeProvider(t.name, t.config, "vscode")).register(
|
|
13018
|
+
registry.register("openai", (t) => new OpenAIProvider(t.name, t.config)).register("openrouter", (t) => new OpenRouterProvider(t.name, t.config)).register("azure", (t) => new AzureProvider(t.name, t.config)).register("anthropic", (t) => new AnthropicProvider(t.name, t.config)).register("gemini", (t) => new GeminiProvider(t.name, t.config)).register("cli", (t) => new CliProvider(t.name, t.config)).register("codex", (t) => new CodexProvider(t.name, t.config)).register("copilot-sdk", (t) => new CopilotSdkProvider(t.name, t.config)).register("copilot-cli", (t) => new CopilotCliProvider(t.name, t.config)).register("copilot-log", (t) => new CopilotLogProvider(t.name, t.config)).register("pi-coding-agent", (t) => new PiCodingAgentProvider(t.name, t.config)).register("pi-cli", (t) => new PiCliProvider(t.name, t.config)).register("claude-cli", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude", (t) => new ClaudeCliProvider(t.name, t.config)).register("claude-sdk", (t) => new ClaudeSdkProvider(t.name, t.config)).register("mock", (t) => new MockProvider(t.name, t.config)).register("agentv", (t) => new AgentvProvider(t.name, t.config)).register("vscode", (t) => new VSCodeProvider(t.name, t.config, "vscode")).register(
|
|
12674
13019
|
"vscode-insiders",
|
|
12675
13020
|
(t) => new VSCodeProvider(t.name, t.config, "vscode-insiders")
|
|
12676
13021
|
);
|
|
@@ -12775,9 +13120,9 @@ function negateScore(score) {
|
|
|
12775
13120
|
}
|
|
12776
13121
|
|
|
12777
13122
|
// src/evaluation/evaluators/code-evaluator.ts
|
|
12778
|
-
var
|
|
12779
|
-
var
|
|
12780
|
-
var
|
|
13123
|
+
var import_promises28 = require("fs/promises");
|
|
13124
|
+
var import_node_os7 = require("os");
|
|
13125
|
+
var import_node_path38 = require("path");
|
|
12781
13126
|
|
|
12782
13127
|
// src/runtime/exec.ts
|
|
12783
13128
|
function shellEscapePath(value) {
|
|
@@ -12877,15 +13222,15 @@ async function execFileWithStdinNode(argv, stdinPayload, options) {
|
|
|
12877
13222
|
});
|
|
12878
13223
|
}
|
|
12879
13224
|
async function execShellWithStdin(command, stdinPayload, options = {}) {
|
|
12880
|
-
const { mkdir: mkdir17, readFile:
|
|
13225
|
+
const { mkdir: mkdir17, readFile: readFile16, rm: rm6, writeFile: writeFile9 } = await import("fs/promises");
|
|
12881
13226
|
const { tmpdir: tmpdir3 } = await import("os");
|
|
12882
|
-
const
|
|
13227
|
+
const path50 = await import("path");
|
|
12883
13228
|
const { randomUUID: randomUUID10 } = await import("crypto");
|
|
12884
|
-
const dir =
|
|
13229
|
+
const dir = path50.join(tmpdir3(), `agentv-exec-${randomUUID10()}`);
|
|
12885
13230
|
await mkdir17(dir, { recursive: true });
|
|
12886
|
-
const stdinPath =
|
|
12887
|
-
const stdoutPath =
|
|
12888
|
-
const stderrPath =
|
|
13231
|
+
const stdinPath = path50.join(dir, "stdin.txt");
|
|
13232
|
+
const stdoutPath = path50.join(dir, "stdout.txt");
|
|
13233
|
+
const stderrPath = path50.join(dir, "stderr.txt");
|
|
12889
13234
|
await writeFile9(stdinPath, stdinPayload, "utf8");
|
|
12890
13235
|
const wrappedCommand = process.platform === "win32" ? `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
|
|
12891
13236
|
const { spawn: spawn5 } = await import("child_process");
|
|
@@ -12915,8 +13260,8 @@ async function execShellWithStdin(command, stdinPayload, options = {}) {
|
|
|
12915
13260
|
resolve(code ?? 0);
|
|
12916
13261
|
});
|
|
12917
13262
|
});
|
|
12918
|
-
const stdout = (await
|
|
12919
|
-
const stderr = (await
|
|
13263
|
+
const stdout = (await readFile16(stdoutPath, "utf8")).replace(/\r\n/g, "\n");
|
|
13264
|
+
const stderr = (await readFile16(stderrPath, "utf8")).replace(/\r\n/g, "\n");
|
|
12920
13265
|
return { stdout, stderr, exitCode };
|
|
12921
13266
|
} finally {
|
|
12922
13267
|
await rm6(dir, { recursive: true, force: true });
|
|
@@ -13221,9 +13566,9 @@ var CodeEvaluator = class {
|
|
|
13221
13566
|
if (outputForPayload) {
|
|
13222
13567
|
const serialized = JSON.stringify(outputForPayload);
|
|
13223
13568
|
if (serialized.length > FILE_BACKED_OUTPUT_THRESHOLD) {
|
|
13224
|
-
const tmpDir = await (0,
|
|
13225
|
-
outputPath = (0,
|
|
13226
|
-
await (0,
|
|
13569
|
+
const tmpDir = await (0, import_promises28.mkdtemp)((0, import_node_path38.join)((0, import_node_os7.tmpdir)(), "agentv-grader-"));
|
|
13570
|
+
outputPath = (0, import_node_path38.join)(tmpDir, "output.json");
|
|
13571
|
+
await (0, import_promises28.writeFile)(outputPath, serialized);
|
|
13227
13572
|
outputForPayload = null;
|
|
13228
13573
|
}
|
|
13229
13574
|
}
|
|
@@ -13332,7 +13677,7 @@ var CodeEvaluator = class {
|
|
|
13332
13677
|
await proxyShutdown();
|
|
13333
13678
|
}
|
|
13334
13679
|
if (outputPath) {
|
|
13335
|
-
await (0,
|
|
13680
|
+
await (0, import_promises28.rm)((0, import_node_path38.dirname)(outputPath), { recursive: true, force: true }).catch(() => {
|
|
13336
13681
|
});
|
|
13337
13682
|
}
|
|
13338
13683
|
}
|
|
@@ -13395,8 +13740,8 @@ function isAgentProvider(provider) {
|
|
|
13395
13740
|
}
|
|
13396
13741
|
|
|
13397
13742
|
// src/evaluation/evaluators/llm-grader.ts
|
|
13398
|
-
var
|
|
13399
|
-
var
|
|
13743
|
+
var import_promises29 = __toESM(require("fs/promises"), 1);
|
|
13744
|
+
var import_node_path39 = __toESM(require("path"), 1);
|
|
13400
13745
|
var import_ai2 = require("ai");
|
|
13401
13746
|
var import_zod4 = require("zod");
|
|
13402
13747
|
var DEFAULT_MAX_STEPS = 10;
|
|
@@ -14251,8 +14596,8 @@ function calculateScoreRangeResult(result, rubrics) {
|
|
|
14251
14596
|
};
|
|
14252
14597
|
}
|
|
14253
14598
|
function resolveSandboxed(basePath, relativePath) {
|
|
14254
|
-
const resolved =
|
|
14255
|
-
if (!resolved.startsWith(basePath +
|
|
14599
|
+
const resolved = import_node_path39.default.resolve(basePath, relativePath);
|
|
14600
|
+
if (!resolved.startsWith(basePath + import_node_path39.default.sep) && resolved !== basePath) {
|
|
14256
14601
|
throw new Error(`Path '${relativePath}' is outside the workspace`);
|
|
14257
14602
|
}
|
|
14258
14603
|
return resolved;
|
|
@@ -14267,7 +14612,7 @@ function createFilesystemTools(workspacePath) {
|
|
|
14267
14612
|
execute: async (input) => {
|
|
14268
14613
|
try {
|
|
14269
14614
|
const resolved = resolveSandboxed(workspacePath, input.path);
|
|
14270
|
-
const entries = await
|
|
14615
|
+
const entries = await import_promises29.default.readdir(resolved, { withFileTypes: true });
|
|
14271
14616
|
return entries.map((e) => ({
|
|
14272
14617
|
name: e.name,
|
|
14273
14618
|
type: e.isDirectory() ? "directory" : "file"
|
|
@@ -14285,20 +14630,20 @@ function createFilesystemTools(workspacePath) {
|
|
|
14285
14630
|
execute: async (input) => {
|
|
14286
14631
|
try {
|
|
14287
14632
|
const resolved = resolveSandboxed(workspacePath, input.path);
|
|
14288
|
-
const
|
|
14289
|
-
if (
|
|
14633
|
+
const stat9 = await import_promises29.default.stat(resolved);
|
|
14634
|
+
if (stat9.isDirectory()) {
|
|
14290
14635
|
return { error: `'${input.path}' is a directory, not a file` };
|
|
14291
14636
|
}
|
|
14292
|
-
const buffer = Buffer.alloc(Math.min(
|
|
14293
|
-
const fd = await
|
|
14637
|
+
const buffer = Buffer.alloc(Math.min(stat9.size, MAX_FILE_SIZE));
|
|
14638
|
+
const fd = await import_promises29.default.open(resolved, "r");
|
|
14294
14639
|
try {
|
|
14295
14640
|
await fd.read(buffer, 0, buffer.length, 0);
|
|
14296
14641
|
} finally {
|
|
14297
14642
|
await fd.close();
|
|
14298
14643
|
}
|
|
14299
14644
|
const content = buffer.toString("utf-8");
|
|
14300
|
-
const truncated =
|
|
14301
|
-
return { content, truncated, size:
|
|
14645
|
+
const truncated = stat9.size > MAX_FILE_SIZE;
|
|
14646
|
+
return { content, truncated, size: stat9.size };
|
|
14302
14647
|
} catch (error) {
|
|
14303
14648
|
return { error: error instanceof Error ? error.message : String(error) };
|
|
14304
14649
|
}
|
|
@@ -14335,30 +14680,30 @@ async function searchDirectory(dirPath, workspacePath, regex, matches) {
|
|
|
14335
14680
|
if (matches.length >= MAX_SEARCH_MATCHES) return;
|
|
14336
14681
|
let entries;
|
|
14337
14682
|
try {
|
|
14338
|
-
entries = await
|
|
14683
|
+
entries = await import_promises29.default.readdir(dirPath, { withFileTypes: true });
|
|
14339
14684
|
} catch {
|
|
14340
14685
|
return;
|
|
14341
14686
|
}
|
|
14342
14687
|
for (const entry of entries) {
|
|
14343
14688
|
if (matches.length >= MAX_SEARCH_MATCHES) return;
|
|
14344
14689
|
if (SEARCH_SKIP_DIRS.has(entry.name)) continue;
|
|
14345
|
-
const fullPath =
|
|
14690
|
+
const fullPath = import_node_path39.default.join(dirPath, entry.name);
|
|
14346
14691
|
if (entry.isDirectory()) {
|
|
14347
14692
|
await searchDirectory(fullPath, workspacePath, regex, matches);
|
|
14348
14693
|
} else if (entry.isFile()) {
|
|
14349
|
-
const ext =
|
|
14694
|
+
const ext = import_node_path39.default.extname(entry.name).toLowerCase();
|
|
14350
14695
|
if (BINARY_EXTENSIONS.has(ext)) continue;
|
|
14351
14696
|
try {
|
|
14352
|
-
const
|
|
14353
|
-
if (
|
|
14354
|
-
const content = await
|
|
14697
|
+
const stat9 = await import_promises29.default.stat(fullPath);
|
|
14698
|
+
if (stat9.size > MAX_FILE_SIZE) continue;
|
|
14699
|
+
const content = await import_promises29.default.readFile(fullPath, "utf-8");
|
|
14355
14700
|
const lines = content.split("\n");
|
|
14356
14701
|
for (let i = 0; i < lines.length; i++) {
|
|
14357
14702
|
if (matches.length >= MAX_SEARCH_MATCHES) return;
|
|
14358
14703
|
regex.lastIndex = 0;
|
|
14359
14704
|
if (regex.test(lines[i])) {
|
|
14360
14705
|
matches.push({
|
|
14361
|
-
file:
|
|
14706
|
+
file: import_node_path39.default.relative(workspacePath, fullPath),
|
|
14362
14707
|
line: i + 1,
|
|
14363
14708
|
text: lines[i].substring(0, 200)
|
|
14364
14709
|
});
|
|
@@ -14991,115 +15336,115 @@ var FieldAccuracyEvaluator = class {
|
|
|
14991
15336
|
* Evaluate a single field against the expected value.
|
|
14992
15337
|
*/
|
|
14993
15338
|
evaluateField(fieldConfig, candidateData, expectedData) {
|
|
14994
|
-
const { path:
|
|
14995
|
-
const candidateValue = resolvePath(candidateData,
|
|
14996
|
-
const expectedValue = resolvePath(expectedData,
|
|
15339
|
+
const { path: path50, match, required = true, weight = 1 } = fieldConfig;
|
|
15340
|
+
const candidateValue = resolvePath(candidateData, path50);
|
|
15341
|
+
const expectedValue = resolvePath(expectedData, path50);
|
|
14997
15342
|
if (expectedValue === void 0) {
|
|
14998
15343
|
return {
|
|
14999
|
-
path:
|
|
15344
|
+
path: path50,
|
|
15000
15345
|
score: 1,
|
|
15001
15346
|
// No expected value means no comparison needed
|
|
15002
15347
|
weight,
|
|
15003
15348
|
hit: true,
|
|
15004
|
-
message: `${
|
|
15349
|
+
message: `${path50}: no expected value`
|
|
15005
15350
|
};
|
|
15006
15351
|
}
|
|
15007
15352
|
if (candidateValue === void 0) {
|
|
15008
15353
|
if (required) {
|
|
15009
15354
|
return {
|
|
15010
|
-
path:
|
|
15355
|
+
path: path50,
|
|
15011
15356
|
score: 0,
|
|
15012
15357
|
weight,
|
|
15013
15358
|
hit: false,
|
|
15014
|
-
message: `${
|
|
15359
|
+
message: `${path50} (required, missing)`
|
|
15015
15360
|
};
|
|
15016
15361
|
}
|
|
15017
15362
|
return {
|
|
15018
|
-
path:
|
|
15363
|
+
path: path50,
|
|
15019
15364
|
score: 1,
|
|
15020
15365
|
// Don't penalize missing optional fields
|
|
15021
15366
|
weight: 0,
|
|
15022
15367
|
// Zero weight means it won't affect the score
|
|
15023
15368
|
hit: true,
|
|
15024
|
-
message: `${
|
|
15369
|
+
message: `${path50}: optional field missing`
|
|
15025
15370
|
};
|
|
15026
15371
|
}
|
|
15027
15372
|
switch (match) {
|
|
15028
15373
|
case "exact":
|
|
15029
|
-
return this.compareExact(
|
|
15374
|
+
return this.compareExact(path50, candidateValue, expectedValue, weight);
|
|
15030
15375
|
case "numeric_tolerance":
|
|
15031
15376
|
return this.compareNumericTolerance(
|
|
15032
|
-
|
|
15377
|
+
path50,
|
|
15033
15378
|
candidateValue,
|
|
15034
15379
|
expectedValue,
|
|
15035
15380
|
fieldConfig,
|
|
15036
15381
|
weight
|
|
15037
15382
|
);
|
|
15038
15383
|
case "date":
|
|
15039
|
-
return this.compareDate(
|
|
15384
|
+
return this.compareDate(path50, candidateValue, expectedValue, fieldConfig, weight);
|
|
15040
15385
|
default:
|
|
15041
15386
|
return {
|
|
15042
|
-
path:
|
|
15387
|
+
path: path50,
|
|
15043
15388
|
score: 0,
|
|
15044
15389
|
weight,
|
|
15045
15390
|
hit: false,
|
|
15046
|
-
message: `${
|
|
15391
|
+
message: `${path50}: unknown match type "${match}"`
|
|
15047
15392
|
};
|
|
15048
15393
|
}
|
|
15049
15394
|
}
|
|
15050
15395
|
/**
|
|
15051
15396
|
* Exact equality comparison.
|
|
15052
15397
|
*/
|
|
15053
|
-
compareExact(
|
|
15398
|
+
compareExact(path50, candidateValue, expectedValue, weight) {
|
|
15054
15399
|
if (deepEqual(candidateValue, expectedValue)) {
|
|
15055
15400
|
return {
|
|
15056
|
-
path:
|
|
15401
|
+
path: path50,
|
|
15057
15402
|
score: 1,
|
|
15058
15403
|
weight,
|
|
15059
15404
|
hit: true,
|
|
15060
|
-
message:
|
|
15405
|
+
message: path50
|
|
15061
15406
|
};
|
|
15062
15407
|
}
|
|
15063
15408
|
if (typeof candidateValue !== typeof expectedValue) {
|
|
15064
15409
|
return {
|
|
15065
|
-
path:
|
|
15410
|
+
path: path50,
|
|
15066
15411
|
score: 0,
|
|
15067
15412
|
weight,
|
|
15068
15413
|
hit: false,
|
|
15069
|
-
message: `${
|
|
15414
|
+
message: `${path50} (type mismatch: got ${typeof candidateValue}, expected ${typeof expectedValue})`
|
|
15070
15415
|
};
|
|
15071
15416
|
}
|
|
15072
15417
|
return {
|
|
15073
|
-
path:
|
|
15418
|
+
path: path50,
|
|
15074
15419
|
score: 0,
|
|
15075
15420
|
weight,
|
|
15076
15421
|
hit: false,
|
|
15077
|
-
message: `${
|
|
15422
|
+
message: `${path50} (value mismatch)`
|
|
15078
15423
|
};
|
|
15079
15424
|
}
|
|
15080
15425
|
/**
|
|
15081
15426
|
* Numeric comparison with absolute or relative tolerance.
|
|
15082
15427
|
*/
|
|
15083
|
-
compareNumericTolerance(
|
|
15428
|
+
compareNumericTolerance(path50, candidateValue, expectedValue, fieldConfig, weight) {
|
|
15084
15429
|
const { tolerance = 0, relative = false } = fieldConfig;
|
|
15085
15430
|
const candidateNum = toNumber(candidateValue);
|
|
15086
15431
|
const expectedNum = toNumber(expectedValue);
|
|
15087
15432
|
if (candidateNum === null || expectedNum === null) {
|
|
15088
15433
|
return {
|
|
15089
|
-
path:
|
|
15434
|
+
path: path50,
|
|
15090
15435
|
score: 0,
|
|
15091
15436
|
weight,
|
|
15092
15437
|
hit: false,
|
|
15093
|
-
message: `${
|
|
15438
|
+
message: `${path50} (non-numeric value)`
|
|
15094
15439
|
};
|
|
15095
15440
|
}
|
|
15096
15441
|
if (!Number.isFinite(candidateNum) || !Number.isFinite(expectedNum)) {
|
|
15097
15442
|
return {
|
|
15098
|
-
path:
|
|
15443
|
+
path: path50,
|
|
15099
15444
|
score: 0,
|
|
15100
15445
|
weight,
|
|
15101
15446
|
hit: false,
|
|
15102
|
-
message: `${
|
|
15447
|
+
message: `${path50} (invalid numeric value)`
|
|
15103
15448
|
};
|
|
15104
15449
|
}
|
|
15105
15450
|
const diff = Math.abs(candidateNum - expectedNum);
|
|
@@ -15112,61 +15457,61 @@ var FieldAccuracyEvaluator = class {
|
|
|
15112
15457
|
}
|
|
15113
15458
|
if (withinTolerance) {
|
|
15114
15459
|
return {
|
|
15115
|
-
path:
|
|
15460
|
+
path: path50,
|
|
15116
15461
|
score: 1,
|
|
15117
15462
|
weight,
|
|
15118
15463
|
hit: true,
|
|
15119
|
-
message: `${
|
|
15464
|
+
message: `${path50} (within tolerance: diff=${diff.toFixed(2)})`
|
|
15120
15465
|
};
|
|
15121
15466
|
}
|
|
15122
15467
|
return {
|
|
15123
|
-
path:
|
|
15468
|
+
path: path50,
|
|
15124
15469
|
score: 0,
|
|
15125
15470
|
weight,
|
|
15126
15471
|
hit: false,
|
|
15127
|
-
message: `${
|
|
15472
|
+
message: `${path50} (outside tolerance: diff=${diff.toFixed(2)}, tolerance=${tolerance})`
|
|
15128
15473
|
};
|
|
15129
15474
|
}
|
|
15130
15475
|
/**
|
|
15131
15476
|
* Date comparison with format normalization.
|
|
15132
15477
|
*/
|
|
15133
|
-
compareDate(
|
|
15478
|
+
compareDate(path50, candidateValue, expectedValue, fieldConfig, weight) {
|
|
15134
15479
|
const formats = fieldConfig.formats ?? DEFAULT_DATE_FORMATS;
|
|
15135
15480
|
const candidateDate = parseDate(String(candidateValue), formats);
|
|
15136
15481
|
const expectedDate = parseDate(String(expectedValue), formats);
|
|
15137
15482
|
if (candidateDate === null) {
|
|
15138
15483
|
return {
|
|
15139
|
-
path:
|
|
15484
|
+
path: path50,
|
|
15140
15485
|
score: 0,
|
|
15141
15486
|
weight,
|
|
15142
15487
|
hit: false,
|
|
15143
|
-
message: `${
|
|
15488
|
+
message: `${path50} (unparseable candidate date)`
|
|
15144
15489
|
};
|
|
15145
15490
|
}
|
|
15146
15491
|
if (expectedDate === null) {
|
|
15147
15492
|
return {
|
|
15148
|
-
path:
|
|
15493
|
+
path: path50,
|
|
15149
15494
|
score: 0,
|
|
15150
15495
|
weight,
|
|
15151
15496
|
hit: false,
|
|
15152
|
-
message: `${
|
|
15497
|
+
message: `${path50} (unparseable expected date)`
|
|
15153
15498
|
};
|
|
15154
15499
|
}
|
|
15155
15500
|
if (candidateDate.getFullYear() === expectedDate.getFullYear() && candidateDate.getMonth() === expectedDate.getMonth() && candidateDate.getDate() === expectedDate.getDate()) {
|
|
15156
15501
|
return {
|
|
15157
|
-
path:
|
|
15502
|
+
path: path50,
|
|
15158
15503
|
score: 1,
|
|
15159
15504
|
weight,
|
|
15160
15505
|
hit: true,
|
|
15161
|
-
message:
|
|
15506
|
+
message: path50
|
|
15162
15507
|
};
|
|
15163
15508
|
}
|
|
15164
15509
|
return {
|
|
15165
|
-
path:
|
|
15510
|
+
path: path50,
|
|
15166
15511
|
score: 0,
|
|
15167
15512
|
weight,
|
|
15168
15513
|
hit: false,
|
|
15169
|
-
message: `${
|
|
15514
|
+
message: `${path50} (date mismatch: got ${formatDateISO(candidateDate)}, expected ${formatDateISO(expectedDate)})`
|
|
15170
15515
|
};
|
|
15171
15516
|
}
|
|
15172
15517
|
/**
|
|
@@ -15199,11 +15544,11 @@ var FieldAccuracyEvaluator = class {
|
|
|
15199
15544
|
};
|
|
15200
15545
|
}
|
|
15201
15546
|
};
|
|
15202
|
-
function resolvePath(obj,
|
|
15203
|
-
if (!
|
|
15547
|
+
function resolvePath(obj, path50) {
|
|
15548
|
+
if (!path50 || !obj) {
|
|
15204
15549
|
return void 0;
|
|
15205
15550
|
}
|
|
15206
|
-
const parts =
|
|
15551
|
+
const parts = path50.split(/\.|\[|\]/).filter((p) => p.length > 0);
|
|
15207
15552
|
let current = obj;
|
|
15208
15553
|
for (const part of parts) {
|
|
15209
15554
|
if (current === null || current === void 0) {
|
|
@@ -15371,6 +15716,7 @@ var PROVIDER_TOOL_SEMANTICS = {
|
|
|
15371
15716
|
"pi-coding-agent": PI_CODING_AGENT_MATCHER,
|
|
15372
15717
|
"pi-cli": PI_CODING_AGENT_MATCHER,
|
|
15373
15718
|
"copilot-cli": COPILOT_MATCHER,
|
|
15719
|
+
"copilot-log": COPILOT_MATCHER,
|
|
15374
15720
|
"copilot-sdk": COPILOT_MATCHER,
|
|
15375
15721
|
vscode: COPILOT_MATCHER,
|
|
15376
15722
|
"vscode-insiders": COPILOT_MATCHER
|
|
@@ -15397,8 +15743,9 @@ var SkillTriggerEvaluator = class {
|
|
|
15397
15743
|
let triggered = false;
|
|
15398
15744
|
let evidence = "";
|
|
15399
15745
|
for (const toolCall of allToolCalls) {
|
|
15746
|
+
const toolName = toolCall.tool ?? "";
|
|
15400
15747
|
const input = toolCall.input ?? {};
|
|
15401
|
-
if (matcher.skillTools.includes(
|
|
15748
|
+
if (matcher.skillTools.includes(toolName)) {
|
|
15402
15749
|
const skillArg = String(input[matcher.skillInputField] ?? "");
|
|
15403
15750
|
if (skillArg.includes(skillName)) {
|
|
15404
15751
|
triggered = true;
|
|
@@ -15406,12 +15753,12 @@ var SkillTriggerEvaluator = class {
|
|
|
15406
15753
|
break;
|
|
15407
15754
|
}
|
|
15408
15755
|
} else if (matcher.skillToolPrefixes?.some(
|
|
15409
|
-
(prefix) =>
|
|
15756
|
+
(prefix) => toolName.startsWith(prefix) && toolName.includes(skillName)
|
|
15410
15757
|
)) {
|
|
15411
15758
|
triggered = true;
|
|
15412
|
-
evidence = `Skill tool invoked via tool name "${
|
|
15759
|
+
evidence = `Skill tool invoked via tool name "${toolName}"`;
|
|
15413
15760
|
break;
|
|
15414
|
-
} else if (matcher.readTools.includes(
|
|
15761
|
+
} else if (matcher.readTools.includes(toolName)) {
|
|
15415
15762
|
const filePath = this.readPathFromInput(input, matcher);
|
|
15416
15763
|
if (filePath.includes(skillName)) {
|
|
15417
15764
|
triggered = true;
|
|
@@ -15419,10 +15766,10 @@ var SkillTriggerEvaluator = class {
|
|
|
15419
15766
|
break;
|
|
15420
15767
|
}
|
|
15421
15768
|
} else if (matcher.readToolPrefixes?.some(
|
|
15422
|
-
(prefix) =>
|
|
15769
|
+
(prefix) => toolName.startsWith(prefix) && toolName.includes(skillName)
|
|
15423
15770
|
)) {
|
|
15424
15771
|
triggered = true;
|
|
15425
|
-
evidence = `Read tool loaded skill file via tool name "${
|
|
15772
|
+
evidence = `Read tool loaded skill file via tool name "${toolName}"`;
|
|
15426
15773
|
break;
|
|
15427
15774
|
}
|
|
15428
15775
|
}
|
|
@@ -15684,8 +16031,8 @@ var TokenUsageEvaluator = class {
|
|
|
15684
16031
|
};
|
|
15685
16032
|
|
|
15686
16033
|
// src/evaluation/evaluators/tool-trajectory.ts
|
|
15687
|
-
function getNestedValue(obj,
|
|
15688
|
-
const parts =
|
|
16034
|
+
function getNestedValue(obj, path50) {
|
|
16035
|
+
const parts = path50.split(".");
|
|
15689
16036
|
let current = obj;
|
|
15690
16037
|
for (const part of parts) {
|
|
15691
16038
|
if (current === null || current === void 0 || typeof current !== "object") {
|
|
@@ -16306,8 +16653,8 @@ function runEqualsAssertion(output, value) {
|
|
|
16306
16653
|
|
|
16307
16654
|
// src/evaluation/orchestrator.ts
|
|
16308
16655
|
var import_node_crypto11 = require("crypto");
|
|
16309
|
-
var
|
|
16310
|
-
var
|
|
16656
|
+
var import_promises33 = require("fs/promises");
|
|
16657
|
+
var import_node_path48 = __toESM(require("path"), 1);
|
|
16311
16658
|
var import_micromatch3 = __toESM(require("micromatch"), 1);
|
|
16312
16659
|
|
|
16313
16660
|
// ../../node_modules/.bun/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
@@ -16521,7 +16868,7 @@ var InlineAssertEvaluator = class {
|
|
|
16521
16868
|
};
|
|
16522
16869
|
|
|
16523
16870
|
// src/evaluation/evaluators/prompt-resolution.ts
|
|
16524
|
-
var
|
|
16871
|
+
var import_node_path40 = __toESM(require("path"), 1);
|
|
16525
16872
|
async function resolveCustomPrompt(promptConfig, context2, timeoutMs) {
|
|
16526
16873
|
if (promptConfig.resolvedPromptScript && promptConfig.resolvedPromptScript.length > 0) {
|
|
16527
16874
|
if (!context2) {
|
|
@@ -16567,7 +16914,7 @@ async function executePromptTemplate(script, context2, config, timeoutMs) {
|
|
|
16567
16914
|
};
|
|
16568
16915
|
const inputJson = JSON.stringify(toSnakeCaseDeep(payload), null, 2);
|
|
16569
16916
|
const scriptPath = script[script.length - 1];
|
|
16570
|
-
const cwd =
|
|
16917
|
+
const cwd = import_node_path40.default.dirname(scriptPath);
|
|
16571
16918
|
try {
|
|
16572
16919
|
const stdout = await executeScript(script, inputJson, timeoutMs, cwd);
|
|
16573
16920
|
const prompt = stdout.trim();
|
|
@@ -16839,16 +17186,16 @@ function createBuiltinRegistry() {
|
|
|
16839
17186
|
}
|
|
16840
17187
|
|
|
16841
17188
|
// src/evaluation/registry/assertion-discovery.ts
|
|
16842
|
-
var
|
|
17189
|
+
var import_node_path41 = __toESM(require("path"), 1);
|
|
16843
17190
|
var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
16844
17191
|
async function discoverAssertions(registry, baseDir) {
|
|
16845
17192
|
const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
|
|
16846
17193
|
const candidateDirs = [];
|
|
16847
|
-
let dir =
|
|
16848
|
-
const root =
|
|
17194
|
+
let dir = import_node_path41.default.resolve(baseDir);
|
|
17195
|
+
const root = import_node_path41.default.parse(dir).root;
|
|
16849
17196
|
while (dir !== root) {
|
|
16850
|
-
candidateDirs.push(
|
|
16851
|
-
dir =
|
|
17197
|
+
candidateDirs.push(import_node_path41.default.join(dir, ".agentv", "assertions"));
|
|
17198
|
+
dir = import_node_path41.default.dirname(dir);
|
|
16852
17199
|
}
|
|
16853
17200
|
let files = [];
|
|
16854
17201
|
for (const assertionsDir of candidateDirs) {
|
|
@@ -16864,7 +17211,7 @@ async function discoverAssertions(registry, baseDir) {
|
|
|
16864
17211
|
}
|
|
16865
17212
|
const discoveredTypes = [];
|
|
16866
17213
|
for (const filePath of files) {
|
|
16867
|
-
const basename =
|
|
17214
|
+
const basename = import_node_path41.default.basename(filePath);
|
|
16868
17215
|
const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
|
|
16869
17216
|
if (registry.has(typeName)) {
|
|
16870
17217
|
continue;
|
|
@@ -16882,17 +17229,17 @@ async function discoverAssertions(registry, baseDir) {
|
|
|
16882
17229
|
}
|
|
16883
17230
|
|
|
16884
17231
|
// src/evaluation/registry/grader-discovery.ts
|
|
16885
|
-
var
|
|
17232
|
+
var import_node_path42 = __toESM(require("path"), 1);
|
|
16886
17233
|
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
16887
17234
|
async function discoverGraders(registry, baseDir) {
|
|
16888
17235
|
const patterns = ["*.ts", "*.js", "*.mts", "*.mjs"];
|
|
16889
17236
|
const candidateDirs = [];
|
|
16890
|
-
let dir =
|
|
16891
|
-
const root =
|
|
17237
|
+
let dir = import_node_path42.default.resolve(baseDir);
|
|
17238
|
+
const root = import_node_path42.default.parse(dir).root;
|
|
16892
17239
|
while (dir !== root) {
|
|
16893
|
-
candidateDirs.push(
|
|
16894
|
-
candidateDirs.push(
|
|
16895
|
-
dir =
|
|
17240
|
+
candidateDirs.push(import_node_path42.default.join(dir, ".agentv", "graders"));
|
|
17241
|
+
candidateDirs.push(import_node_path42.default.join(dir, ".agentv", "judges"));
|
|
17242
|
+
dir = import_node_path42.default.dirname(dir);
|
|
16896
17243
|
}
|
|
16897
17244
|
let files = [];
|
|
16898
17245
|
for (const gradersDir of candidateDirs) {
|
|
@@ -16908,7 +17255,7 @@ async function discoverGraders(registry, baseDir) {
|
|
|
16908
17255
|
}
|
|
16909
17256
|
const discoveredTypes = [];
|
|
16910
17257
|
for (const filePath of files) {
|
|
16911
|
-
const basename =
|
|
17258
|
+
const basename = import_node_path42.default.basename(filePath);
|
|
16912
17259
|
const typeName = basename.replace(/\.(ts|js|mts|mjs)$/, "");
|
|
16913
17260
|
if (registry.has(typeName)) {
|
|
16914
17261
|
continue;
|
|
@@ -17068,7 +17415,7 @@ function getTCritical(df) {
|
|
|
17068
17415
|
// src/evaluation/workspace/file-changes.ts
|
|
17069
17416
|
var import_node_child_process8 = require("child_process");
|
|
17070
17417
|
var import_node_fs12 = require("fs");
|
|
17071
|
-
var
|
|
17418
|
+
var import_node_path43 = __toESM(require("path"), 1);
|
|
17072
17419
|
var import_node_util4 = require("util");
|
|
17073
17420
|
var execAsync4 = (0, import_node_util4.promisify)(import_node_child_process8.exec);
|
|
17074
17421
|
function gitExecOpts(workspacePath) {
|
|
@@ -17102,10 +17449,10 @@ async function stageNestedRepoChanges(workspacePath) {
|
|
|
17102
17449
|
}
|
|
17103
17450
|
for (const entry of entries) {
|
|
17104
17451
|
if (entry === ".git" || entry === "node_modules") continue;
|
|
17105
|
-
const childPath =
|
|
17452
|
+
const childPath = import_node_path43.default.join(workspacePath, entry);
|
|
17106
17453
|
try {
|
|
17107
17454
|
if (!(0, import_node_fs12.statSync)(childPath).isDirectory()) continue;
|
|
17108
|
-
if (!(0, import_node_fs12.statSync)(
|
|
17455
|
+
if (!(0, import_node_fs12.statSync)(import_node_path43.default.join(childPath, ".git")).isDirectory()) continue;
|
|
17109
17456
|
} catch {
|
|
17110
17457
|
continue;
|
|
17111
17458
|
}
|
|
@@ -17115,8 +17462,8 @@ async function stageNestedRepoChanges(workspacePath) {
|
|
|
17115
17462
|
}
|
|
17116
17463
|
|
|
17117
17464
|
// src/evaluation/workspace/manager.ts
|
|
17118
|
-
var
|
|
17119
|
-
var
|
|
17465
|
+
var import_promises30 = require("fs/promises");
|
|
17466
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
|
17120
17467
|
var TemplateNotFoundError = class extends Error {
|
|
17121
17468
|
constructor(templatePath) {
|
|
17122
17469
|
super(`Workspace template not found: ${templatePath}`);
|
|
@@ -17138,7 +17485,7 @@ var WorkspaceCreationError = class extends Error {
|
|
|
17138
17485
|
};
|
|
17139
17486
|
async function isDirectory(filePath) {
|
|
17140
17487
|
try {
|
|
17141
|
-
const stats = await (0,
|
|
17488
|
+
const stats = await (0, import_promises30.stat)(filePath);
|
|
17142
17489
|
return stats.isDirectory();
|
|
17143
17490
|
} catch {
|
|
17144
17491
|
return false;
|
|
@@ -17146,26 +17493,26 @@ async function isDirectory(filePath) {
|
|
|
17146
17493
|
}
|
|
17147
17494
|
function getWorkspacePath(evalRunId, caseId, workspaceRoot) {
|
|
17148
17495
|
const root = workspaceRoot ?? getWorkspacesRoot();
|
|
17149
|
-
return
|
|
17496
|
+
return import_node_path44.default.join(root, evalRunId, caseId);
|
|
17150
17497
|
}
|
|
17151
17498
|
async function copyDirectoryRecursive(src, dest) {
|
|
17152
|
-
await (0,
|
|
17153
|
-
const entries = await (0,
|
|
17499
|
+
await (0, import_promises30.mkdir)(dest, { recursive: true });
|
|
17500
|
+
const entries = await (0, import_promises30.readdir)(src, { withFileTypes: true });
|
|
17154
17501
|
for (const entry of entries) {
|
|
17155
|
-
const srcPath =
|
|
17156
|
-
const destPath =
|
|
17502
|
+
const srcPath = import_node_path44.default.join(src, entry.name);
|
|
17503
|
+
const destPath = import_node_path44.default.join(dest, entry.name);
|
|
17157
17504
|
if (entry.name === ".git") {
|
|
17158
17505
|
continue;
|
|
17159
17506
|
}
|
|
17160
17507
|
if (entry.isDirectory()) {
|
|
17161
17508
|
await copyDirectoryRecursive(srcPath, destPath);
|
|
17162
17509
|
} else {
|
|
17163
|
-
await (0,
|
|
17510
|
+
await (0, import_promises30.cp)(srcPath, destPath, { preserveTimestamps: true });
|
|
17164
17511
|
}
|
|
17165
17512
|
}
|
|
17166
17513
|
}
|
|
17167
17514
|
async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoot) {
|
|
17168
|
-
const resolvedTemplatePath =
|
|
17515
|
+
const resolvedTemplatePath = import_node_path44.default.resolve(templatePath);
|
|
17169
17516
|
if (!await fileExists2(resolvedTemplatePath)) {
|
|
17170
17517
|
throw new TemplateNotFoundError(resolvedTemplatePath);
|
|
17171
17518
|
}
|
|
@@ -17175,7 +17522,7 @@ async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoo
|
|
|
17175
17522
|
const workspacePath = getWorkspacePath(evalRunId, caseId, workspaceRoot);
|
|
17176
17523
|
try {
|
|
17177
17524
|
if (await fileExists2(workspacePath)) {
|
|
17178
|
-
await (0,
|
|
17525
|
+
await (0, import_promises30.rm)(workspacePath, { recursive: true, force: true });
|
|
17179
17526
|
}
|
|
17180
17527
|
await copyDirectoryRecursive(resolvedTemplatePath, workspacePath);
|
|
17181
17528
|
return workspacePath;
|
|
@@ -17209,14 +17556,14 @@ async function createTempWorkspace(templatePath, evalRunId, caseId, workspaceRoo
|
|
|
17209
17556
|
}
|
|
17210
17557
|
async function cleanupWorkspace(workspacePath) {
|
|
17211
17558
|
if (await fileExists2(workspacePath)) {
|
|
17212
|
-
await (0,
|
|
17559
|
+
await (0, import_promises30.rm)(workspacePath, { recursive: true, force: true });
|
|
17213
17560
|
}
|
|
17214
17561
|
}
|
|
17215
17562
|
async function cleanupEvalWorkspaces(evalRunId, workspaceRoot) {
|
|
17216
17563
|
const root = workspaceRoot ?? getWorkspacesRoot();
|
|
17217
|
-
const evalDir =
|
|
17564
|
+
const evalDir = import_node_path44.default.join(root, evalRunId);
|
|
17218
17565
|
if (await fileExists2(evalDir)) {
|
|
17219
|
-
await (0,
|
|
17566
|
+
await (0, import_promises30.rm)(evalDir, { recursive: true, force: true });
|
|
17220
17567
|
}
|
|
17221
17568
|
}
|
|
17222
17569
|
|
|
@@ -17224,8 +17571,8 @@ async function cleanupEvalWorkspaces(evalRunId, workspaceRoot) {
|
|
|
17224
17571
|
var import_node_child_process9 = require("child_process");
|
|
17225
17572
|
var import_node_crypto10 = require("crypto");
|
|
17226
17573
|
var import_node_fs13 = require("fs");
|
|
17227
|
-
var
|
|
17228
|
-
var
|
|
17574
|
+
var import_promises31 = require("fs/promises");
|
|
17575
|
+
var import_node_path45 = __toESM(require("path"), 1);
|
|
17229
17576
|
var import_node_util5 = require("util");
|
|
17230
17577
|
var execFileAsync = (0, import_node_util5.promisify)(import_node_child_process9.execFile);
|
|
17231
17578
|
function gitEnv() {
|
|
@@ -17276,11 +17623,11 @@ function computeWorkspaceFingerprint(repos) {
|
|
|
17276
17623
|
return (0, import_node_crypto10.createHash)("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
17277
17624
|
}
|
|
17278
17625
|
async function copyDirectoryRecursive2(src, dest, skipDirs) {
|
|
17279
|
-
await (0,
|
|
17280
|
-
const entries = await (0,
|
|
17626
|
+
await (0, import_promises31.mkdir)(dest, { recursive: true });
|
|
17627
|
+
const entries = await (0, import_promises31.readdir)(src, { withFileTypes: true });
|
|
17281
17628
|
for (const entry of entries) {
|
|
17282
|
-
const srcPath =
|
|
17283
|
-
const destPath =
|
|
17629
|
+
const srcPath = import_node_path45.default.join(src, entry.name);
|
|
17630
|
+
const destPath = import_node_path45.default.join(dest, entry.name);
|
|
17284
17631
|
if (entry.name === ".git") {
|
|
17285
17632
|
continue;
|
|
17286
17633
|
}
|
|
@@ -17290,7 +17637,7 @@ async function copyDirectoryRecursive2(src, dest, skipDirs) {
|
|
|
17290
17637
|
}
|
|
17291
17638
|
await copyDirectoryRecursive2(srcPath, destPath, skipDirs);
|
|
17292
17639
|
} else {
|
|
17293
|
-
await (0,
|
|
17640
|
+
await (0, import_promises31.cp)(srcPath, destPath, { preserveTimestamps: true, force: true });
|
|
17294
17641
|
}
|
|
17295
17642
|
}
|
|
17296
17643
|
}
|
|
@@ -17313,8 +17660,8 @@ var WorkspacePoolManager = class {
|
|
|
17313
17660
|
async acquireWorkspace(options) {
|
|
17314
17661
|
const { templatePath, repos, maxSlots, repoManager, poolReset } = options;
|
|
17315
17662
|
const fingerprint = computeWorkspaceFingerprint(repos);
|
|
17316
|
-
const poolDir =
|
|
17317
|
-
await (0,
|
|
17663
|
+
const poolDir = import_node_path45.default.join(this.poolRoot, fingerprint);
|
|
17664
|
+
await (0, import_promises31.mkdir)(poolDir, { recursive: true });
|
|
17318
17665
|
const drifted = await this.checkDrift(poolDir, fingerprint);
|
|
17319
17666
|
if (drifted) {
|
|
17320
17667
|
console.warn(
|
|
@@ -17323,7 +17670,7 @@ var WorkspacePoolManager = class {
|
|
|
17323
17670
|
await this.removeAllSlots(poolDir);
|
|
17324
17671
|
}
|
|
17325
17672
|
for (let i = 0; i < maxSlots; i++) {
|
|
17326
|
-
const slotPath =
|
|
17673
|
+
const slotPath = import_node_path45.default.join(poolDir, `slot-${i}`);
|
|
17327
17674
|
const lockPath = `${slotPath}.lock`;
|
|
17328
17675
|
const locked = await this.tryLock(lockPath);
|
|
17329
17676
|
if (!locked) {
|
|
@@ -17341,7 +17688,7 @@ var WorkspacePoolManager = class {
|
|
|
17341
17688
|
poolDir
|
|
17342
17689
|
};
|
|
17343
17690
|
}
|
|
17344
|
-
await (0,
|
|
17691
|
+
await (0, import_promises31.mkdir)(slotPath, { recursive: true });
|
|
17345
17692
|
if (templatePath) {
|
|
17346
17693
|
await copyDirectoryRecursive2(templatePath, slotPath);
|
|
17347
17694
|
}
|
|
@@ -17365,7 +17712,7 @@ var WorkspacePoolManager = class {
|
|
|
17365
17712
|
/** Remove lock file to release a slot. */
|
|
17366
17713
|
async releaseSlot(slot) {
|
|
17367
17714
|
try {
|
|
17368
|
-
await (0,
|
|
17715
|
+
await (0, import_promises31.unlink)(slot.lockPath);
|
|
17369
17716
|
} catch {
|
|
17370
17717
|
}
|
|
17371
17718
|
}
|
|
@@ -17378,21 +17725,21 @@ var WorkspacePoolManager = class {
|
|
|
17378
17725
|
async tryLock(lockPath) {
|
|
17379
17726
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17380
17727
|
try {
|
|
17381
|
-
await (0,
|
|
17728
|
+
await (0, import_promises31.writeFile)(lockPath, String(process.pid), { flag: "wx" });
|
|
17382
17729
|
return true;
|
|
17383
17730
|
} catch (err) {
|
|
17384
17731
|
if (err.code !== "EEXIST") {
|
|
17385
17732
|
throw err;
|
|
17386
17733
|
}
|
|
17387
17734
|
try {
|
|
17388
|
-
const pidStr = await (0,
|
|
17735
|
+
const pidStr = await (0, import_promises31.readFile)(lockPath, "utf-8");
|
|
17389
17736
|
const pid = Number.parseInt(pidStr.trim(), 10);
|
|
17390
17737
|
if (!Number.isNaN(pid)) {
|
|
17391
17738
|
try {
|
|
17392
17739
|
process.kill(pid, 0);
|
|
17393
17740
|
return false;
|
|
17394
17741
|
} catch {
|
|
17395
|
-
await (0,
|
|
17742
|
+
await (0, import_promises31.unlink)(lockPath).catch(() => {
|
|
17396
17743
|
});
|
|
17397
17744
|
continue;
|
|
17398
17745
|
}
|
|
@@ -17410,9 +17757,9 @@ var WorkspacePoolManager = class {
|
|
|
17410
17757
|
* Returns false (no drift) if metadata.json doesn't exist (first use).
|
|
17411
17758
|
*/
|
|
17412
17759
|
async checkDrift(poolDir, fingerprint) {
|
|
17413
|
-
const metadataPath =
|
|
17760
|
+
const metadataPath = import_node_path45.default.join(poolDir, "metadata.json");
|
|
17414
17761
|
try {
|
|
17415
|
-
const raw = await (0,
|
|
17762
|
+
const raw = await (0, import_promises31.readFile)(metadataPath, "utf-8");
|
|
17416
17763
|
const metadata = JSON.parse(raw);
|
|
17417
17764
|
return metadata.fingerprint !== fingerprint;
|
|
17418
17765
|
} catch {
|
|
@@ -17427,17 +17774,17 @@ var WorkspacePoolManager = class {
|
|
|
17427
17774
|
repos,
|
|
17428
17775
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
17429
17776
|
};
|
|
17430
|
-
await (0,
|
|
17777
|
+
await (0, import_promises31.writeFile)(import_node_path45.default.join(poolDir, "metadata.json"), JSON.stringify(metadata, null, 2));
|
|
17431
17778
|
}
|
|
17432
17779
|
/** Remove all slot directories and their lock files from a pool directory. */
|
|
17433
17780
|
async removeAllSlots(poolDir) {
|
|
17434
|
-
const entries = await (0,
|
|
17781
|
+
const entries = await (0, import_promises31.readdir)(poolDir);
|
|
17435
17782
|
for (const entry of entries) {
|
|
17436
17783
|
if (entry.startsWith("slot-") && !entry.endsWith(".lock")) {
|
|
17437
|
-
const lockPath =
|
|
17784
|
+
const lockPath = import_node_path45.default.join(poolDir, `${entry}.lock`);
|
|
17438
17785
|
if ((0, import_node_fs13.existsSync)(lockPath)) {
|
|
17439
17786
|
try {
|
|
17440
|
-
const pidStr = await (0,
|
|
17787
|
+
const pidStr = await (0, import_promises31.readFile)(lockPath, "utf-8");
|
|
17441
17788
|
const pid = Number.parseInt(pidStr.trim(), 10);
|
|
17442
17789
|
if (!Number.isNaN(pid)) {
|
|
17443
17790
|
try {
|
|
@@ -17450,12 +17797,12 @@ var WorkspacePoolManager = class {
|
|
|
17450
17797
|
} catch {
|
|
17451
17798
|
}
|
|
17452
17799
|
}
|
|
17453
|
-
await (0,
|
|
17454
|
-
await (0,
|
|
17800
|
+
await (0, import_promises31.rm)(import_node_path45.default.join(poolDir, entry), { recursive: true, force: true });
|
|
17801
|
+
await (0, import_promises31.rm)(lockPath, { force: true }).catch(() => {
|
|
17455
17802
|
});
|
|
17456
17803
|
}
|
|
17457
17804
|
}
|
|
17458
|
-
await (0,
|
|
17805
|
+
await (0, import_promises31.rm)(import_node_path45.default.join(poolDir, "metadata.json"), { force: true }).catch(() => {
|
|
17459
17806
|
});
|
|
17460
17807
|
}
|
|
17461
17808
|
/**
|
|
@@ -17465,7 +17812,7 @@ var WorkspacePoolManager = class {
|
|
|
17465
17812
|
*/
|
|
17466
17813
|
async resetSlot(slotPath, templatePath, repos, poolReset = "fast") {
|
|
17467
17814
|
for (const repo of repos) {
|
|
17468
|
-
const repoDir =
|
|
17815
|
+
const repoDir = import_node_path45.default.join(slotPath, repo.path);
|
|
17469
17816
|
if (!(0, import_node_fs13.existsSync)(repoDir)) {
|
|
17470
17817
|
continue;
|
|
17471
17818
|
}
|
|
@@ -17492,7 +17839,7 @@ var WorkspacePoolManager = class {
|
|
|
17492
17839
|
// src/evaluation/workspace/repo-manager.ts
|
|
17493
17840
|
var import_node_child_process10 = require("child_process");
|
|
17494
17841
|
var import_node_fs14 = require("fs");
|
|
17495
|
-
var
|
|
17842
|
+
var import_node_path46 = __toESM(require("path"), 1);
|
|
17496
17843
|
var import_node_util6 = require("util");
|
|
17497
17844
|
var execFileAsync2 = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
|
|
17498
17845
|
var DEFAULT_TIMEOUT_MS2 = 3e5;
|
|
@@ -17592,7 +17939,7 @@ ${lines.join("\n")}`;
|
|
|
17592
17939
|
* Handles checkout, ref resolution, ancestor walking, shallow clone, sparse checkout.
|
|
17593
17940
|
*/
|
|
17594
17941
|
async materialize(repo, workspacePath) {
|
|
17595
|
-
const targetDir =
|
|
17942
|
+
const targetDir = import_node_path46.default.join(workspacePath, repo.path);
|
|
17596
17943
|
const sourceUrl = getSourceUrl(repo.source);
|
|
17597
17944
|
const startedAt = Date.now();
|
|
17598
17945
|
if (this.verbose) {
|
|
@@ -17683,7 +18030,7 @@ ${lines.join("\n")}`;
|
|
|
17683
18030
|
async reset(repos, workspacePath, reset) {
|
|
17684
18031
|
const cleanFlag = reset === "strict" ? "-fdx" : "-fd";
|
|
17685
18032
|
for (const repo of repos) {
|
|
17686
|
-
const targetDir =
|
|
18033
|
+
const targetDir = import_node_path46.default.join(workspacePath, repo.path);
|
|
17687
18034
|
await this.runGit(["reset", "--hard", "HEAD"], { cwd: targetDir });
|
|
17688
18035
|
await this.runGit(["clean", cleanFlag], { cwd: targetDir });
|
|
17689
18036
|
}
|
|
@@ -17691,36 +18038,36 @@ ${lines.join("\n")}`;
|
|
|
17691
18038
|
};
|
|
17692
18039
|
|
|
17693
18040
|
// src/evaluation/workspace/resolve.ts
|
|
17694
|
-
var
|
|
17695
|
-
var
|
|
18041
|
+
var import_promises32 = require("fs/promises");
|
|
18042
|
+
var import_node_path47 = __toESM(require("path"), 1);
|
|
17696
18043
|
async function resolveWorkspaceTemplate(templatePath) {
|
|
17697
18044
|
if (!templatePath) {
|
|
17698
18045
|
return void 0;
|
|
17699
18046
|
}
|
|
17700
|
-
const resolved =
|
|
17701
|
-
const stats = await (0,
|
|
18047
|
+
const resolved = import_node_path47.default.resolve(templatePath);
|
|
18048
|
+
const stats = await (0, import_promises32.stat)(resolved);
|
|
17702
18049
|
if (stats.isFile()) {
|
|
17703
18050
|
return {
|
|
17704
|
-
dir:
|
|
18051
|
+
dir: import_node_path47.default.dirname(resolved),
|
|
17705
18052
|
workspaceFile: resolved
|
|
17706
18053
|
};
|
|
17707
18054
|
}
|
|
17708
18055
|
if (!stats.isDirectory()) {
|
|
17709
18056
|
throw new Error(`workspace template is neither a file nor a directory: ${resolved}`);
|
|
17710
18057
|
}
|
|
17711
|
-
const entries = await (0,
|
|
18058
|
+
const entries = await (0, import_promises32.readdir)(resolved);
|
|
17712
18059
|
const workspaceFiles = entries.filter((e) => e.endsWith(".code-workspace"));
|
|
17713
18060
|
if (workspaceFiles.length === 1) {
|
|
17714
18061
|
return {
|
|
17715
18062
|
dir: resolved,
|
|
17716
|
-
workspaceFile:
|
|
18063
|
+
workspaceFile: import_node_path47.default.join(resolved, workspaceFiles[0])
|
|
17717
18064
|
};
|
|
17718
18065
|
}
|
|
17719
18066
|
if (workspaceFiles.length > 1) {
|
|
17720
18067
|
const conventionFile = workspaceFiles.find((f) => f === "template.code-workspace");
|
|
17721
18068
|
return {
|
|
17722
18069
|
dir: resolved,
|
|
17723
|
-
workspaceFile: conventionFile ?
|
|
18070
|
+
workspaceFile: conventionFile ? import_node_path47.default.join(resolved, conventionFile) : void 0
|
|
17724
18071
|
};
|
|
17725
18072
|
}
|
|
17726
18073
|
return { dir: resolved };
|
|
@@ -17936,7 +18283,7 @@ async function runEvaluation(options) {
|
|
|
17936
18283
|
];
|
|
17937
18284
|
const evaluatorRegistry = buildEvaluatorRegistry(evaluators, resolveGraderProvider);
|
|
17938
18285
|
const typeRegistry = createBuiltinRegistry();
|
|
17939
|
-
const discoveryBaseDir = evalFilePath ?
|
|
18286
|
+
const discoveryBaseDir = evalFilePath ? import_node_path48.default.dirname(import_node_path48.default.resolve(evalFilePath)) : process.cwd();
|
|
17940
18287
|
const evalDir = discoveryBaseDir;
|
|
17941
18288
|
await discoverAssertions(typeRegistry, discoveryBaseDir);
|
|
17942
18289
|
await discoverGraders(typeRegistry, discoveryBaseDir);
|
|
@@ -18076,14 +18423,14 @@ async function runEvaluation(options) {
|
|
|
18076
18423
|
let staticMaterialised = false;
|
|
18077
18424
|
if (useStaticWorkspace && configuredStaticPath) {
|
|
18078
18425
|
const isYamlConfiguredPath = !cliWorkspacePath && !!yamlWorkspacePath;
|
|
18079
|
-
const dirExists = await (0,
|
|
18426
|
+
const dirExists = await (0, import_promises33.stat)(configuredStaticPath).then(
|
|
18080
18427
|
(s) => s.isDirectory(),
|
|
18081
18428
|
() => false
|
|
18082
18429
|
);
|
|
18083
|
-
const isEmpty = dirExists ? (await (0,
|
|
18430
|
+
const isEmpty = dirExists ? (await (0, import_promises33.readdir)(configuredStaticPath)).length === 0 : false;
|
|
18084
18431
|
if (isYamlConfiguredPath && (!dirExists || isEmpty)) {
|
|
18085
18432
|
if (!dirExists) {
|
|
18086
|
-
await (0,
|
|
18433
|
+
await (0, import_promises33.mkdir)(configuredStaticPath, { recursive: true });
|
|
18087
18434
|
}
|
|
18088
18435
|
if (workspaceTemplate) {
|
|
18089
18436
|
await copyDirectoryRecursive(workspaceTemplate, configuredStaticPath);
|
|
@@ -18128,14 +18475,14 @@ async function runEvaluation(options) {
|
|
|
18128
18475
|
}
|
|
18129
18476
|
} else if (suiteWorkspace?.hooks || suiteWorkspace?.repos?.length && !isPerTestIsolation) {
|
|
18130
18477
|
sharedWorkspacePath = getWorkspacePath(evalRunId, "shared");
|
|
18131
|
-
await (0,
|
|
18478
|
+
await (0, import_promises33.mkdir)(sharedWorkspacePath, { recursive: true });
|
|
18132
18479
|
setupLog(`created empty shared workspace at: ${sharedWorkspacePath}`);
|
|
18133
18480
|
}
|
|
18134
18481
|
try {
|
|
18135
18482
|
if (suiteWorkspaceFile && sharedWorkspacePath) {
|
|
18136
|
-
const copiedWorkspaceFile =
|
|
18483
|
+
const copiedWorkspaceFile = import_node_path48.default.join(sharedWorkspacePath, import_node_path48.default.basename(suiteWorkspaceFile));
|
|
18137
18484
|
try {
|
|
18138
|
-
await (0,
|
|
18485
|
+
await (0, import_promises33.stat)(copiedWorkspaceFile);
|
|
18139
18486
|
suiteWorkspaceFile = copiedWorkspaceFile;
|
|
18140
18487
|
} catch {
|
|
18141
18488
|
}
|
|
@@ -18715,9 +19062,9 @@ async function runEvalCase(options) {
|
|
|
18715
19062
|
);
|
|
18716
19063
|
}
|
|
18717
19064
|
if (caseWorkspaceFile && workspacePath) {
|
|
18718
|
-
const copiedFile =
|
|
19065
|
+
const copiedFile = import_node_path48.default.join(workspacePath, import_node_path48.default.basename(caseWorkspaceFile));
|
|
18719
19066
|
try {
|
|
18720
|
-
await (0,
|
|
19067
|
+
await (0, import_promises33.stat)(copiedFile);
|
|
18721
19068
|
caseWorkspaceFile = copiedFile;
|
|
18722
19069
|
} catch {
|
|
18723
19070
|
}
|
|
@@ -18725,7 +19072,7 @@ async function runEvalCase(options) {
|
|
|
18725
19072
|
}
|
|
18726
19073
|
if (!workspacePath && (evalCase.workspace?.hooks || evalCase.workspace?.repos?.length) && evalRunId) {
|
|
18727
19074
|
workspacePath = getWorkspacePath(evalRunId, evalCase.id);
|
|
18728
|
-
await (0,
|
|
19075
|
+
await (0, import_promises33.mkdir)(workspacePath, { recursive: true });
|
|
18729
19076
|
}
|
|
18730
19077
|
if (evalCase.workspace?.repos?.length && workspacePath) {
|
|
18731
19078
|
const localPathErrors = RepoManager.validateLocalPaths(evalCase.workspace.repos);
|
|
@@ -18777,11 +19124,11 @@ async function runEvalCase(options) {
|
|
|
18777
19124
|
const files = evalCase.metadata.agent_skills_files;
|
|
18778
19125
|
if (baseDir && files.length > 0) {
|
|
18779
19126
|
for (const relPath of files) {
|
|
18780
|
-
const srcPath =
|
|
18781
|
-
const destPath =
|
|
19127
|
+
const srcPath = import_node_path48.default.resolve(baseDir, relPath);
|
|
19128
|
+
const destPath = import_node_path48.default.resolve(workspacePath, relPath);
|
|
18782
19129
|
try {
|
|
18783
|
-
await (0,
|
|
18784
|
-
await (0,
|
|
19130
|
+
await (0, import_promises33.mkdir)(import_node_path48.default.dirname(destPath), { recursive: true });
|
|
19131
|
+
await (0, import_promises33.copyFile)(srcPath, destPath);
|
|
18785
19132
|
} catch (error) {
|
|
18786
19133
|
const message = error instanceof Error ? error.message : String(error);
|
|
18787
19134
|
return buildErrorResult(
|
|
@@ -19426,7 +19773,7 @@ async function runEvaluatorList(options) {
|
|
|
19426
19773
|
fileChanges,
|
|
19427
19774
|
workspacePath
|
|
19428
19775
|
};
|
|
19429
|
-
const evalFileDir = evalCase.file_paths[0] ?
|
|
19776
|
+
const evalFileDir = evalCase.file_paths[0] ? import_node_path48.default.dirname(evalCase.file_paths[0]) : process.cwd();
|
|
19430
19777
|
const dispatchContext = {
|
|
19431
19778
|
graderProvider,
|
|
19432
19779
|
targetResolver,
|
|
@@ -19760,7 +20107,7 @@ function computeWeightedMean(entries) {
|
|
|
19760
20107
|
|
|
19761
20108
|
// src/evaluation/evaluate.ts
|
|
19762
20109
|
var import_node_fs15 = require("fs");
|
|
19763
|
-
var
|
|
20110
|
+
var import_node_path49 = __toESM(require("path"), 1);
|
|
19764
20111
|
|
|
19765
20112
|
// src/evaluation/providers/function-provider.ts
|
|
19766
20113
|
function createFunctionProvider(taskFn) {
|
|
@@ -19797,7 +20144,7 @@ async function evaluate(config) {
|
|
|
19797
20144
|
}
|
|
19798
20145
|
const gitRoot = await findGitRoot(process.cwd());
|
|
19799
20146
|
const repoRoot = gitRoot ?? process.cwd();
|
|
19800
|
-
const testFilePath = config.specFile ?
|
|
20147
|
+
const testFilePath = config.specFile ? import_node_path49.default.resolve(config.specFile) : import_node_path49.default.join(process.cwd(), "__programmatic__.yaml");
|
|
19801
20148
|
await loadEnvHierarchy(repoRoot, testFilePath);
|
|
19802
20149
|
let resolvedTarget;
|
|
19803
20150
|
let taskProvider;
|
|
@@ -19918,10 +20265,10 @@ function computeSummary(results, durationMs) {
|
|
|
19918
20265
|
var TARGET_FILE_CANDIDATES = [".agentv/targets.yaml", ".agentv/targets.yml"];
|
|
19919
20266
|
async function discoverDefaultTarget(repoRoot) {
|
|
19920
20267
|
const cwd = process.cwd();
|
|
19921
|
-
const chain = buildDirectoryChain2(
|
|
20268
|
+
const chain = buildDirectoryChain2(import_node_path49.default.join(cwd, "_placeholder"), repoRoot);
|
|
19922
20269
|
for (const dir of chain) {
|
|
19923
20270
|
for (const candidate of TARGET_FILE_CANDIDATES) {
|
|
19924
|
-
const targetsPath =
|
|
20271
|
+
const targetsPath = import_node_path49.default.join(dir, candidate);
|
|
19925
20272
|
if (!(0, import_node_fs15.existsSync)(targetsPath)) continue;
|
|
19926
20273
|
try {
|
|
19927
20274
|
const definitions = await readTargetDefinitions(targetsPath);
|
|
@@ -19938,7 +20285,7 @@ async function loadEnvHierarchy(repoRoot, startPath) {
|
|
|
19938
20285
|
const chain = buildDirectoryChain2(startPath, repoRoot);
|
|
19939
20286
|
const envFiles = [];
|
|
19940
20287
|
for (const dir of chain) {
|
|
19941
|
-
const envPath =
|
|
20288
|
+
const envPath = import_node_path49.default.join(dir, ".env");
|
|
19942
20289
|
if ((0, import_node_fs15.existsSync)(envPath)) envFiles.push(envPath);
|
|
19943
20290
|
}
|
|
19944
20291
|
for (let i = 0; i < envFiles.length; i++) {
|
|
@@ -20117,8 +20464,8 @@ function buildPrompt(criteria, question, referenceAnswer) {
|
|
|
20117
20464
|
}
|
|
20118
20465
|
|
|
20119
20466
|
// src/evaluation/cache/response-cache.ts
|
|
20120
|
-
var
|
|
20121
|
-
var
|
|
20467
|
+
var import_promises34 = require("fs/promises");
|
|
20468
|
+
var import_node_path50 = __toESM(require("path"), 1);
|
|
20122
20469
|
var DEFAULT_CACHE_PATH = ".agentv/cache";
|
|
20123
20470
|
var ResponseCache = class {
|
|
20124
20471
|
cachePath;
|
|
@@ -20128,7 +20475,7 @@ var ResponseCache = class {
|
|
|
20128
20475
|
async get(key) {
|
|
20129
20476
|
const filePath = this.keyToPath(key);
|
|
20130
20477
|
try {
|
|
20131
|
-
const data = await (0,
|
|
20478
|
+
const data = await (0, import_promises34.readFile)(filePath, "utf8");
|
|
20132
20479
|
return JSON.parse(data);
|
|
20133
20480
|
} catch {
|
|
20134
20481
|
return void 0;
|
|
@@ -20136,13 +20483,13 @@ var ResponseCache = class {
|
|
|
20136
20483
|
}
|
|
20137
20484
|
async set(key, value) {
|
|
20138
20485
|
const filePath = this.keyToPath(key);
|
|
20139
|
-
const dir =
|
|
20140
|
-
await (0,
|
|
20141
|
-
await (0,
|
|
20486
|
+
const dir = import_node_path50.default.dirname(filePath);
|
|
20487
|
+
await (0, import_promises34.mkdir)(dir, { recursive: true });
|
|
20488
|
+
await (0, import_promises34.writeFile)(filePath, JSON.stringify(value, null, 2), "utf8");
|
|
20142
20489
|
}
|
|
20143
20490
|
keyToPath(key) {
|
|
20144
20491
|
const prefix = key.slice(0, 2);
|
|
20145
|
-
return
|
|
20492
|
+
return import_node_path50.default.join(this.cachePath, prefix, `${key}.json`);
|
|
20146
20493
|
}
|
|
20147
20494
|
};
|
|
20148
20495
|
function shouldEnableCache(params) {
|
|
@@ -20767,6 +21114,7 @@ function createAgentKernel() {
|
|
|
20767
21114
|
defineConfig,
|
|
20768
21115
|
detectFormat,
|
|
20769
21116
|
discoverAssertions,
|
|
21117
|
+
discoverCopilotSessions,
|
|
20770
21118
|
discoverGraders,
|
|
20771
21119
|
discoverJudges,
|
|
20772
21120
|
discoverProviders,
|