agentv 4.3.1 → 4.3.2
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/{agentv-provider-NFFLXG5M-TJAWCWCX.js → agentv-provider-TXM4UEUT-SUZSAXWZ.js} +2 -2
- package/dist/{chunk-LTALLYDW.js → chunk-EM2JOZFS.js} +4 -12
- package/dist/{chunk-LTALLYDW.js.map → chunk-EM2JOZFS.js.map} +1 -1
- package/dist/{chunk-BEFW6WZ6.js → chunk-FXN26R2H.js} +161 -90
- package/dist/chunk-FXN26R2H.js.map +1 -0
- package/dist/{chunk-URQXFJEB.js → chunk-HMOXP7T5.js} +7 -7
- package/dist/{chunk-C5GOHBQM.js → chunk-QOBQ5XYF.js} +2 -2
- package/dist/{chunk-BJV6MDBE.js → chunk-ZKO2LGRR.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/{dist-GQ2YNG7B.js → dist-M7R6II6Y.js} +4 -4
- package/dist/{esm-5Q4BZALM-5REQWAUV.js → esm-ZADQ4XQH-5LX2IKZV.js} +2 -2
- package/dist/index.js +5 -5
- package/dist/{interactive-UZBC7V4B.js → interactive-FMOEUIKE.js} +5 -5
- package/dist/{otlp-json-file-exporter-77FDBRSY-EZAPHWP6.js → otlp-json-file-exporter-RJFPCKVK-T6N4OGWG.js} +2 -2
- package/dist/studio/assets/{index-DofvSOmX.js → index-Bv9YUyqt.js} +1 -1
- package/dist/studio/assets/index-CElXpUjl.css +1 -0
- package/dist/studio/assets/index-CaOaajcd.js +65 -0
- package/dist/studio/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-BEFW6WZ6.js.map +0 -1
- package/dist/studio/assets/index-CDGReinH.js +0 -71
- package/dist/studio/assets/index-izxfmBKC.css +0 -1
- /package/dist/{agentv-provider-NFFLXG5M-TJAWCWCX.js.map → agentv-provider-TXM4UEUT-SUZSAXWZ.js.map} +0 -0
- /package/dist/{chunk-URQXFJEB.js.map → chunk-HMOXP7T5.js.map} +0 -0
- /package/dist/{chunk-C5GOHBQM.js.map → chunk-QOBQ5XYF.js.map} +0 -0
- /package/dist/{chunk-BJV6MDBE.js.map → chunk-ZKO2LGRR.js.map} +0 -0
- /package/dist/{dist-GQ2YNG7B.js.map → dist-M7R6II6Y.js.map} +0 -0
- /package/dist/{esm-5Q4BZALM-5REQWAUV.js.map → esm-ZADQ4XQH-5LX2IKZV.js.map} +0 -0
- /package/dist/{interactive-UZBC7V4B.js.map → interactive-FMOEUIKE.js.map} +0 -0
- /package/dist/{otlp-json-file-exporter-77FDBRSY-EZAPHWP6.js.map → otlp-json-file-exporter-RJFPCKVK-T6N4OGWG.js.map} +0 -0
|
@@ -24,9 +24,10 @@ import {
|
|
|
24
24
|
validateFileReferences,
|
|
25
25
|
validateTargetsFile,
|
|
26
26
|
writeArtifactsFromResults
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-EM2JOZFS.js";
|
|
28
28
|
import {
|
|
29
29
|
DEFAULT_CATEGORY,
|
|
30
|
+
PASS_THRESHOLD,
|
|
30
31
|
createBuiltinRegistry,
|
|
31
32
|
deriveCategory,
|
|
32
33
|
executeScript,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
toSnakeCaseDeep as toSnakeCaseDeep2,
|
|
44
45
|
transpileEvalYamlFile,
|
|
45
46
|
trimBaselineResult
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-HMOXP7T5.js";
|
|
47
48
|
import {
|
|
48
49
|
__commonJS,
|
|
49
50
|
__esm,
|
|
@@ -4217,7 +4218,7 @@ var evalRunCommand = command({
|
|
|
4217
4218
|
},
|
|
4218
4219
|
handler: async (args) => {
|
|
4219
4220
|
if (args.evalPaths.length === 0 && process.stdin.isTTY) {
|
|
4220
|
-
const { launchInteractiveWizard } = await import("./interactive-
|
|
4221
|
+
const { launchInteractiveWizard } = await import("./interactive-FMOEUIKE.js");
|
|
4221
4222
|
await launchInteractiveWizard();
|
|
4222
4223
|
return;
|
|
4223
4224
|
}
|
|
@@ -5662,7 +5663,7 @@ function listResultFiles(cwd, limit) {
|
|
|
5662
5663
|
const fileStat = statSync2(filePath);
|
|
5663
5664
|
const results = loadResultFile(filePath);
|
|
5664
5665
|
const testCount = results.length;
|
|
5665
|
-
const passCount = results.filter((r) => r.score >=
|
|
5666
|
+
const passCount = results.filter((r) => r.score >= PASS_THRESHOLD).length;
|
|
5666
5667
|
const passRate = testCount > 0 ? passCount / testCount : 0;
|
|
5667
5668
|
const avgScore = testCount > 0 ? results.reduce((sum, r) => sum + r.score, 0) / testCount : 0;
|
|
5668
5669
|
const filenameTimestamp = extractTimestampFromFilename(displayName);
|
|
@@ -6232,40 +6233,89 @@ var resultsCommand = subcommands({
|
|
|
6232
6233
|
});
|
|
6233
6234
|
|
|
6234
6235
|
// src/commands/results/serve.ts
|
|
6235
|
-
import { existsSync as
|
|
6236
|
-
import
|
|
6236
|
+
import { existsSync as existsSync8, readFileSync as readFileSync9, readdirSync as readdirSync3, statSync as statSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
6237
|
+
import path10 from "node:path";
|
|
6237
6238
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6238
6239
|
import { Hono } from "hono";
|
|
6240
|
+
|
|
6241
|
+
// src/commands/results/studio-config.ts
|
|
6242
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
|
|
6243
|
+
import path9 from "node:path";
|
|
6244
|
+
import { parse as parseYaml, stringify as stringifyYaml2 } from "yaml";
|
|
6245
|
+
var DEFAULTS = {
|
|
6246
|
+
pass_threshold: PASS_THRESHOLD
|
|
6247
|
+
};
|
|
6248
|
+
function loadStudioConfig(agentvDir) {
|
|
6249
|
+
const configPath = path9.join(agentvDir, "config.yaml");
|
|
6250
|
+
if (!existsSync7(configPath)) {
|
|
6251
|
+
return { ...DEFAULTS };
|
|
6252
|
+
}
|
|
6253
|
+
const raw = readFileSync8(configPath, "utf-8");
|
|
6254
|
+
const parsed = parseYaml(raw);
|
|
6255
|
+
if (!parsed || typeof parsed !== "object") {
|
|
6256
|
+
return { ...DEFAULTS };
|
|
6257
|
+
}
|
|
6258
|
+
const threshold = typeof parsed.pass_threshold === "number" ? parsed.pass_threshold : DEFAULTS.pass_threshold;
|
|
6259
|
+
return {
|
|
6260
|
+
pass_threshold: Math.min(1, Math.max(0, threshold))
|
|
6261
|
+
};
|
|
6262
|
+
}
|
|
6263
|
+
function saveStudioConfig(agentvDir, config) {
|
|
6264
|
+
if (!existsSync7(agentvDir)) {
|
|
6265
|
+
mkdirSync2(agentvDir, { recursive: true });
|
|
6266
|
+
}
|
|
6267
|
+
const configPath = path9.join(agentvDir, "config.yaml");
|
|
6268
|
+
const yamlStr = stringifyYaml2(config);
|
|
6269
|
+
writeFileSync3(configPath, yamlStr, "utf-8");
|
|
6270
|
+
}
|
|
6271
|
+
|
|
6272
|
+
// src/commands/results/serve.ts
|
|
6239
6273
|
function feedbackPath(resultDir) {
|
|
6240
|
-
return
|
|
6274
|
+
return path10.join(resultDir, "feedback.json");
|
|
6241
6275
|
}
|
|
6242
6276
|
function readFeedback(cwd) {
|
|
6243
6277
|
const fp = feedbackPath(cwd);
|
|
6244
|
-
if (!
|
|
6278
|
+
if (!existsSync8(fp)) {
|
|
6245
6279
|
return { reviews: [] };
|
|
6246
6280
|
}
|
|
6247
6281
|
try {
|
|
6248
|
-
return JSON.parse(
|
|
6282
|
+
return JSON.parse(readFileSync9(fp, "utf8"));
|
|
6249
6283
|
} catch (err2) {
|
|
6250
6284
|
console.error(`Warning: could not parse ${fp}, starting fresh: ${err2.message}`);
|
|
6251
6285
|
return { reviews: [] };
|
|
6252
6286
|
}
|
|
6253
6287
|
}
|
|
6254
6288
|
function writeFeedback(cwd, data) {
|
|
6255
|
-
|
|
6289
|
+
writeFileSync4(feedbackPath(cwd), `${JSON.stringify(data, null, 2)}
|
|
6256
6290
|
`, "utf8");
|
|
6257
6291
|
}
|
|
6258
6292
|
function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
6259
6293
|
const searchDir = cwd ?? resultDir;
|
|
6294
|
+
const agentvDir = path10.join(searchDir, ".agentv");
|
|
6260
6295
|
const app2 = new Hono();
|
|
6296
|
+
app2.get("/api/config", (c3) => c3.json(loadStudioConfig(agentvDir)));
|
|
6297
|
+
app2.post("/api/config", async (c3) => {
|
|
6298
|
+
try {
|
|
6299
|
+
const body = await c3.req.json();
|
|
6300
|
+
const current = loadStudioConfig(agentvDir);
|
|
6301
|
+
const updated = { ...current, ...body };
|
|
6302
|
+
if (typeof updated.pass_threshold === "number") {
|
|
6303
|
+
updated.pass_threshold = Math.min(1, Math.max(0, updated.pass_threshold));
|
|
6304
|
+
}
|
|
6305
|
+
saveStudioConfig(agentvDir, updated);
|
|
6306
|
+
return c3.json(updated);
|
|
6307
|
+
} catch {
|
|
6308
|
+
return c3.json({ error: "Failed to save config" }, 500);
|
|
6309
|
+
}
|
|
6310
|
+
});
|
|
6261
6311
|
const studioDistPath = options?.studioDir ?? resolveStudioDistDir();
|
|
6262
|
-
if (!studioDistPath || !
|
|
6312
|
+
if (!studioDistPath || !existsSync8(path10.join(studioDistPath, "index.html"))) {
|
|
6263
6313
|
throw new Error('Studio dist not found. Run "bun run build" in apps/studio/ to build the SPA.');
|
|
6264
6314
|
}
|
|
6265
6315
|
app2.get("/", (c3) => {
|
|
6266
|
-
const indexPath =
|
|
6267
|
-
if (
|
|
6268
|
-
return c3.html(
|
|
6316
|
+
const indexPath = path10.join(studioDistPath, "index.html");
|
|
6317
|
+
if (existsSync8(indexPath)) {
|
|
6318
|
+
return c3.html(readFileSync9(indexPath, "utf8"));
|
|
6269
6319
|
}
|
|
6270
6320
|
return c3.notFound();
|
|
6271
6321
|
});
|
|
@@ -6363,12 +6413,13 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6363
6413
|
}
|
|
6364
6414
|
try {
|
|
6365
6415
|
const loaded = patchTestIds(loadManifestResults(meta.path));
|
|
6416
|
+
const { pass_threshold } = loadStudioConfig(agentvDir);
|
|
6366
6417
|
const datasetMap = /* @__PURE__ */ new Map();
|
|
6367
6418
|
for (const r of loaded) {
|
|
6368
6419
|
const ds = r.dataset ?? r.target ?? "default";
|
|
6369
6420
|
const entry = datasetMap.get(ds) ?? { total: 0, passed: 0, scoreSum: 0 };
|
|
6370
6421
|
entry.total++;
|
|
6371
|
-
if (r.score >=
|
|
6422
|
+
if (r.score >= pass_threshold) entry.passed++;
|
|
6372
6423
|
entry.scoreSum += r.score;
|
|
6373
6424
|
datasetMap.set(ds, entry);
|
|
6374
6425
|
}
|
|
@@ -6393,6 +6444,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6393
6444
|
}
|
|
6394
6445
|
try {
|
|
6395
6446
|
const loaded = patchTestIds(loadManifestResults(meta.path));
|
|
6447
|
+
const { pass_threshold } = loadStudioConfig(agentvDir);
|
|
6396
6448
|
const categoryMap = /* @__PURE__ */ new Map();
|
|
6397
6449
|
for (const r of loaded) {
|
|
6398
6450
|
const cat = r.category ?? DEFAULT_CATEGORY;
|
|
@@ -6403,7 +6455,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6403
6455
|
datasets: /* @__PURE__ */ new Set()
|
|
6404
6456
|
};
|
|
6405
6457
|
entry.total++;
|
|
6406
|
-
if (r.score >=
|
|
6458
|
+
if (r.score >= pass_threshold) entry.passed++;
|
|
6407
6459
|
entry.scoreSum += r.score;
|
|
6408
6460
|
entry.datasets.add(r.dataset ?? r.target ?? "default");
|
|
6409
6461
|
categoryMap.set(cat, entry);
|
|
@@ -6431,13 +6483,14 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6431
6483
|
}
|
|
6432
6484
|
try {
|
|
6433
6485
|
const loaded = patchTestIds(loadManifestResults(meta.path));
|
|
6486
|
+
const { pass_threshold } = loadStudioConfig(agentvDir);
|
|
6434
6487
|
const filtered = loaded.filter((r) => (r.category ?? DEFAULT_CATEGORY) === category);
|
|
6435
6488
|
const datasetMap = /* @__PURE__ */ new Map();
|
|
6436
6489
|
for (const r of filtered) {
|
|
6437
6490
|
const ds = r.dataset ?? r.target ?? "default";
|
|
6438
6491
|
const entry = datasetMap.get(ds) ?? { total: 0, passed: 0, scoreSum: 0 };
|
|
6439
6492
|
entry.total++;
|
|
6440
|
-
if (r.score >=
|
|
6493
|
+
if (r.score >= pass_threshold) entry.passed++;
|
|
6441
6494
|
entry.scoreSum += r.score;
|
|
6442
6495
|
datasetMap.set(ds, entry);
|
|
6443
6496
|
}
|
|
@@ -6493,7 +6546,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6493
6546
|
return c3.json({ entries: entries2 });
|
|
6494
6547
|
});
|
|
6495
6548
|
function buildFileTree(dirPath, relativeTo) {
|
|
6496
|
-
if (!
|
|
6549
|
+
if (!existsSync8(dirPath) || !statSync4(dirPath).isDirectory()) {
|
|
6497
6550
|
return [];
|
|
6498
6551
|
}
|
|
6499
6552
|
const entries2 = readdirSync3(dirPath, { withFileTypes: true });
|
|
@@ -6501,8 +6554,8 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6501
6554
|
if (a.isDirectory() !== b.isDirectory()) return a.isDirectory() ? -1 : 1;
|
|
6502
6555
|
return a.name.localeCompare(b.name);
|
|
6503
6556
|
}).map((entry) => {
|
|
6504
|
-
const fullPath =
|
|
6505
|
-
const relPath =
|
|
6557
|
+
const fullPath = path10.join(dirPath, entry.name);
|
|
6558
|
+
const relPath = path10.relative(relativeTo, fullPath);
|
|
6506
6559
|
if (entry.isDirectory()) {
|
|
6507
6560
|
return {
|
|
6508
6561
|
name: entry.name,
|
|
@@ -6515,7 +6568,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6515
6568
|
});
|
|
6516
6569
|
}
|
|
6517
6570
|
function inferLanguage(filePath) {
|
|
6518
|
-
const ext =
|
|
6571
|
+
const ext = path10.extname(filePath).toLowerCase();
|
|
6519
6572
|
const langMap = {
|
|
6520
6573
|
".json": "json",
|
|
6521
6574
|
".jsonl": "json",
|
|
@@ -6550,13 +6603,13 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6550
6603
|
return c3.json({ error: "Run not found" }, 404);
|
|
6551
6604
|
}
|
|
6552
6605
|
try {
|
|
6553
|
-
const content =
|
|
6606
|
+
const content = readFileSync9(meta.path, "utf8");
|
|
6554
6607
|
const records = parseResultManifest(content);
|
|
6555
6608
|
const record = records.find((r) => (r.test_id ?? r.eval_id) === evalId);
|
|
6556
6609
|
if (!record) {
|
|
6557
6610
|
return c3.json({ error: "Eval not found" }, 404);
|
|
6558
6611
|
}
|
|
6559
|
-
const baseDir =
|
|
6612
|
+
const baseDir = path10.dirname(meta.path);
|
|
6560
6613
|
const knownPaths = [
|
|
6561
6614
|
record.grading_path,
|
|
6562
6615
|
record.timing_path,
|
|
@@ -6567,14 +6620,14 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6567
6620
|
if (knownPaths.length === 0) {
|
|
6568
6621
|
return c3.json({ files: [] });
|
|
6569
6622
|
}
|
|
6570
|
-
const artifactDirs = knownPaths.map((p) =>
|
|
6623
|
+
const artifactDirs = knownPaths.map((p) => path10.dirname(p));
|
|
6571
6624
|
let commonDir = artifactDirs[0];
|
|
6572
6625
|
for (const dir of artifactDirs) {
|
|
6573
6626
|
while (!dir.startsWith(commonDir)) {
|
|
6574
|
-
commonDir =
|
|
6627
|
+
commonDir = path10.dirname(commonDir);
|
|
6575
6628
|
}
|
|
6576
6629
|
}
|
|
6577
|
-
const artifactAbsDir =
|
|
6630
|
+
const artifactAbsDir = path10.join(baseDir, commonDir);
|
|
6578
6631
|
const files = buildFileTree(artifactAbsDir, baseDir);
|
|
6579
6632
|
return c3.json({ files });
|
|
6580
6633
|
} catch {
|
|
@@ -6595,16 +6648,16 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6595
6648
|
if (!filePath) {
|
|
6596
6649
|
return c3.json({ error: "No file path specified" }, 400);
|
|
6597
6650
|
}
|
|
6598
|
-
const baseDir =
|
|
6599
|
-
const absolutePath =
|
|
6600
|
-
if (!absolutePath.startsWith(
|
|
6651
|
+
const baseDir = path10.dirname(meta.path);
|
|
6652
|
+
const absolutePath = path10.resolve(baseDir, filePath);
|
|
6653
|
+
if (!absolutePath.startsWith(path10.resolve(baseDir) + path10.sep) && absolutePath !== path10.resolve(baseDir)) {
|
|
6601
6654
|
return c3.json({ error: "Path traversal not allowed" }, 403);
|
|
6602
6655
|
}
|
|
6603
|
-
if (!
|
|
6656
|
+
if (!existsSync8(absolutePath) || !statSync4(absolutePath).isFile()) {
|
|
6604
6657
|
return c3.json({ error: "File not found" }, 404);
|
|
6605
6658
|
}
|
|
6606
6659
|
try {
|
|
6607
|
-
const fileContent =
|
|
6660
|
+
const fileContent = readFileSync9(absolutePath, "utf8");
|
|
6608
6661
|
const language = inferLanguage(absolutePath);
|
|
6609
6662
|
return c3.json({ content: fileContent, language });
|
|
6610
6663
|
} catch {
|
|
@@ -6613,6 +6666,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6613
6666
|
});
|
|
6614
6667
|
app2.get("/api/experiments", (c3) => {
|
|
6615
6668
|
const metas = listResultFiles(searchDir);
|
|
6669
|
+
const { pass_threshold } = loadStudioConfig(agentvDir);
|
|
6616
6670
|
const experimentMap = /* @__PURE__ */ new Map();
|
|
6617
6671
|
for (const m of metas) {
|
|
6618
6672
|
try {
|
|
@@ -6629,7 +6683,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6629
6683
|
entry.runFilenames.add(m.filename);
|
|
6630
6684
|
if (r.target) entry.targets.add(r.target);
|
|
6631
6685
|
entry.evalCount++;
|
|
6632
|
-
if (r.score >=
|
|
6686
|
+
if (r.score >= pass_threshold) entry.passedCount++;
|
|
6633
6687
|
if (r.timestamp && r.timestamp > entry.lastTimestamp) {
|
|
6634
6688
|
entry.lastTimestamp = r.timestamp;
|
|
6635
6689
|
}
|
|
@@ -6651,6 +6705,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6651
6705
|
});
|
|
6652
6706
|
app2.get("/api/targets", (c3) => {
|
|
6653
6707
|
const metas = listResultFiles(searchDir);
|
|
6708
|
+
const { pass_threshold } = loadStudioConfig(agentvDir);
|
|
6654
6709
|
const targetMap = /* @__PURE__ */ new Map();
|
|
6655
6710
|
for (const m of metas) {
|
|
6656
6711
|
try {
|
|
@@ -6666,7 +6721,7 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6666
6721
|
entry.runFilenames.add(m.filename);
|
|
6667
6722
|
if (r.experiment) entry.experiments.add(r.experiment);
|
|
6668
6723
|
entry.evalCount++;
|
|
6669
|
-
if (r.score >=
|
|
6724
|
+
if (r.score >= pass_threshold) entry.passedCount++;
|
|
6670
6725
|
targetMap.set(target, entry);
|
|
6671
6726
|
}
|
|
6672
6727
|
} catch {
|
|
@@ -6684,12 +6739,12 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6684
6739
|
});
|
|
6685
6740
|
app2.get("/assets/*", (c3) => {
|
|
6686
6741
|
const assetPath = c3.req.path;
|
|
6687
|
-
const filePath =
|
|
6688
|
-
if (!
|
|
6742
|
+
const filePath = path10.join(studioDistPath, assetPath);
|
|
6743
|
+
if (!existsSync8(filePath)) {
|
|
6689
6744
|
return c3.notFound();
|
|
6690
6745
|
}
|
|
6691
|
-
const content =
|
|
6692
|
-
const ext =
|
|
6746
|
+
const content = readFileSync9(filePath);
|
|
6747
|
+
const ext = path10.extname(filePath);
|
|
6693
6748
|
const mimeTypes = {
|
|
6694
6749
|
".js": "application/javascript",
|
|
6695
6750
|
".css": "text/css",
|
|
@@ -6712,28 +6767,28 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
6712
6767
|
if (c3.req.path.startsWith("/api/")) {
|
|
6713
6768
|
return c3.json({ error: "Not found" }, 404);
|
|
6714
6769
|
}
|
|
6715
|
-
const indexPath =
|
|
6716
|
-
if (
|
|
6717
|
-
return c3.html(
|
|
6770
|
+
const indexPath = path10.join(studioDistPath, "index.html");
|
|
6771
|
+
if (existsSync8(indexPath)) {
|
|
6772
|
+
return c3.html(readFileSync9(indexPath, "utf8"));
|
|
6718
6773
|
}
|
|
6719
6774
|
return c3.notFound();
|
|
6720
6775
|
});
|
|
6721
6776
|
return app2;
|
|
6722
6777
|
}
|
|
6723
6778
|
function resolveStudioDistDir() {
|
|
6724
|
-
const currentDir = typeof __dirname !== "undefined" ? __dirname :
|
|
6779
|
+
const currentDir = typeof __dirname !== "undefined" ? __dirname : path10.dirname(fileURLToPath2(import.meta.url));
|
|
6725
6780
|
const candidates = [
|
|
6726
6781
|
// From src/commands/results/ → sibling apps/studio/dist
|
|
6727
|
-
|
|
6782
|
+
path10.resolve(currentDir, "../../../../studio/dist"),
|
|
6728
6783
|
// From dist/ → sibling apps/studio/dist (monorepo dev)
|
|
6729
|
-
|
|
6784
|
+
path10.resolve(currentDir, "../../studio/dist"),
|
|
6730
6785
|
// Bundled inside CLI dist (published package: dist/studio/)
|
|
6731
|
-
|
|
6786
|
+
path10.resolve(currentDir, "studio"),
|
|
6732
6787
|
// From dist/ in monorepo root context
|
|
6733
|
-
|
|
6788
|
+
path10.resolve(currentDir, "../../../apps/studio/dist")
|
|
6734
6789
|
];
|
|
6735
6790
|
for (const candidate of candidates) {
|
|
6736
|
-
if (
|
|
6791
|
+
if (existsSync8(candidate) && existsSync8(path10.join(candidate, "index.html"))) {
|
|
6737
6792
|
return candidate;
|
|
6738
6793
|
}
|
|
6739
6794
|
}
|
|
@@ -6781,7 +6836,7 @@ var resultsServeCommand = command({
|
|
|
6781
6836
|
let sourceFile;
|
|
6782
6837
|
if (source) {
|
|
6783
6838
|
const resolved = resolveResultSourcePath(source, cwd);
|
|
6784
|
-
if (!
|
|
6839
|
+
if (!existsSync8(resolved)) {
|
|
6785
6840
|
console.error(`Error: Source file not found: ${resolved}`);
|
|
6786
6841
|
process.exit(1);
|
|
6787
6842
|
}
|
|
@@ -6790,7 +6845,7 @@ var resultsServeCommand = command({
|
|
|
6790
6845
|
} else {
|
|
6791
6846
|
const cache = await loadRunCache(cwd);
|
|
6792
6847
|
const cachedFile = cache ? resolveRunCacheFile(cache) : "";
|
|
6793
|
-
if (cachedFile &&
|
|
6848
|
+
if (cachedFile && existsSync8(cachedFile)) {
|
|
6794
6849
|
sourceFile = cachedFile;
|
|
6795
6850
|
results = patchTestIds(loadManifestResults(cachedFile));
|
|
6796
6851
|
} else {
|
|
@@ -6801,7 +6856,7 @@ var resultsServeCommand = command({
|
|
|
6801
6856
|
}
|
|
6802
6857
|
}
|
|
6803
6858
|
}
|
|
6804
|
-
const resultDir = sourceFile ?
|
|
6859
|
+
const resultDir = sourceFile ? path10.dirname(path10.resolve(sourceFile)) : cwd;
|
|
6805
6860
|
const app2 = createApp(results, resultDir, cwd, sourceFile);
|
|
6806
6861
|
if (results.length > 0 && sourceFile) {
|
|
6807
6862
|
console.log(`Serving ${results.length} result(s) from ${sourceFile}`);
|
|
@@ -7694,8 +7749,8 @@ var traceCommand = subcommands({
|
|
|
7694
7749
|
});
|
|
7695
7750
|
|
|
7696
7751
|
// src/commands/transpile/index.ts
|
|
7697
|
-
import { writeFileSync as
|
|
7698
|
-
import
|
|
7752
|
+
import { writeFileSync as writeFileSync5 } from "node:fs";
|
|
7753
|
+
import path11 from "node:path";
|
|
7699
7754
|
var transpileCommand = command({
|
|
7700
7755
|
name: "transpile",
|
|
7701
7756
|
description: "Convert an EVAL.yaml file to Agent Skills evals.json format",
|
|
@@ -7719,7 +7774,7 @@ var transpileCommand = command({
|
|
|
7719
7774
|
handler: async ({ input, outDir, stdout }) => {
|
|
7720
7775
|
let result;
|
|
7721
7776
|
try {
|
|
7722
|
-
result = transpileEvalYamlFile(
|
|
7777
|
+
result = transpileEvalYamlFile(path11.resolve(input));
|
|
7723
7778
|
} catch (error) {
|
|
7724
7779
|
console.error(`Error: ${error.message}`);
|
|
7725
7780
|
process.exit(1);
|
|
@@ -7743,12 +7798,12 @@ var transpileCommand = command({
|
|
|
7743
7798
|
process.stdout.write("\n");
|
|
7744
7799
|
return;
|
|
7745
7800
|
}
|
|
7746
|
-
const outputDir = outDir ?
|
|
7801
|
+
const outputDir = outDir ? path11.resolve(outDir) : path11.dirname(path11.resolve(input));
|
|
7747
7802
|
const fileNames = getOutputFilenames(result);
|
|
7748
7803
|
for (const [skill, evalsJson] of result.files) {
|
|
7749
7804
|
const fileName = fileNames.get(skill) ?? "evals.json";
|
|
7750
|
-
const outputPath =
|
|
7751
|
-
|
|
7805
|
+
const outputPath = path11.join(outputDir, fileName);
|
|
7806
|
+
writeFileSync5(outputPath, `${JSON.stringify(evalsJson, null, 2)}
|
|
7752
7807
|
`);
|
|
7753
7808
|
console.log(`Transpiled to ${outputPath}`);
|
|
7754
7809
|
}
|
|
@@ -7756,7 +7811,7 @@ var transpileCommand = command({
|
|
|
7756
7811
|
});
|
|
7757
7812
|
|
|
7758
7813
|
// src/commands/trim/index.ts
|
|
7759
|
-
import { readFileSync as
|
|
7814
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "node:fs";
|
|
7760
7815
|
var trimCommand = command({
|
|
7761
7816
|
name: "trim",
|
|
7762
7817
|
description: "Trim evaluation results for baseline storage (strips debug/audit fields)",
|
|
@@ -7775,7 +7830,7 @@ var trimCommand = command({
|
|
|
7775
7830
|
},
|
|
7776
7831
|
handler: async ({ input, out }) => {
|
|
7777
7832
|
try {
|
|
7778
|
-
const content =
|
|
7833
|
+
const content = readFileSync10(input, "utf8");
|
|
7779
7834
|
const lines = content.trim().split("\n").filter((line) => line.trim());
|
|
7780
7835
|
const trimmedLines = lines.map((line) => {
|
|
7781
7836
|
const record = JSON.parse(line);
|
|
@@ -7787,7 +7842,7 @@ var trimCommand = command({
|
|
|
7787
7842
|
const output = `${trimmedLines.join("\n")}
|
|
7788
7843
|
`;
|
|
7789
7844
|
if (out) {
|
|
7790
|
-
|
|
7845
|
+
writeFileSync6(out, output, "utf8");
|
|
7791
7846
|
console.error(`Trimmed ${lines.length} record(s) \u2192 ${out}`);
|
|
7792
7847
|
} else {
|
|
7793
7848
|
process.stdout.write(output);
|
|
@@ -7882,7 +7937,8 @@ function isTTY() {
|
|
|
7882
7937
|
// src/commands/validate/validate-files.ts
|
|
7883
7938
|
import { constants } from "node:fs";
|
|
7884
7939
|
import { access, readdir as readdir4, stat } from "node:fs/promises";
|
|
7885
|
-
import
|
|
7940
|
+
import path12 from "node:path";
|
|
7941
|
+
import fg2 from "fast-glob";
|
|
7886
7942
|
async function validateFiles(paths) {
|
|
7887
7943
|
const filePaths = await expandPaths(paths);
|
|
7888
7944
|
const results = [];
|
|
@@ -7900,7 +7956,7 @@ async function validateFiles(paths) {
|
|
|
7900
7956
|
};
|
|
7901
7957
|
}
|
|
7902
7958
|
async function validateSingleFile(filePath) {
|
|
7903
|
-
const absolutePath =
|
|
7959
|
+
const absolutePath = path12.resolve(filePath);
|
|
7904
7960
|
const fileType = await detectFileType(absolutePath);
|
|
7905
7961
|
let result;
|
|
7906
7962
|
if (fileType === "eval") {
|
|
@@ -7923,33 +7979,48 @@ async function validateSingleFile(filePath) {
|
|
|
7923
7979
|
return result;
|
|
7924
7980
|
}
|
|
7925
7981
|
async function expandPaths(paths) {
|
|
7926
|
-
const expanded =
|
|
7982
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
7927
7983
|
for (const inputPath of paths) {
|
|
7928
|
-
const absolutePath =
|
|
7984
|
+
const absolutePath = path12.resolve(inputPath);
|
|
7929
7985
|
try {
|
|
7930
7986
|
await access(absolutePath, constants.F_OK);
|
|
7987
|
+
const stats = await stat(absolutePath);
|
|
7988
|
+
if (stats.isFile()) {
|
|
7989
|
+
if (isYamlFile(absolutePath)) expanded.add(absolutePath);
|
|
7990
|
+
continue;
|
|
7991
|
+
}
|
|
7992
|
+
if (stats.isDirectory()) {
|
|
7993
|
+
const yamlFiles = await findYamlFiles(absolutePath);
|
|
7994
|
+
for (const f of yamlFiles) expanded.add(f);
|
|
7995
|
+
continue;
|
|
7996
|
+
}
|
|
7931
7997
|
} catch {
|
|
7932
|
-
console.warn(`Warning: Path not found: ${inputPath}`);
|
|
7933
|
-
continue;
|
|
7934
7998
|
}
|
|
7935
|
-
const
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7999
|
+
const globPattern = inputPath.includes("\\") ? inputPath.replace(/\\/g, "/") : inputPath;
|
|
8000
|
+
const matches = await fg2(globPattern, {
|
|
8001
|
+
cwd: process.cwd(),
|
|
8002
|
+
absolute: true,
|
|
8003
|
+
onlyFiles: true,
|
|
8004
|
+
unique: true,
|
|
8005
|
+
dot: false,
|
|
8006
|
+
followSymbolicLinks: true
|
|
8007
|
+
});
|
|
8008
|
+
const yamlMatches = matches.filter((f) => isYamlFile(f));
|
|
8009
|
+
if (yamlMatches.length === 0) {
|
|
8010
|
+
console.warn(`Warning: No YAML files matched pattern: ${inputPath}`);
|
|
7943
8011
|
}
|
|
8012
|
+
for (const f of yamlMatches) expanded.add(path12.normalize(f));
|
|
7944
8013
|
}
|
|
7945
|
-
|
|
8014
|
+
const sorted = Array.from(expanded);
|
|
8015
|
+
sorted.sort();
|
|
8016
|
+
return sorted;
|
|
7946
8017
|
}
|
|
7947
8018
|
async function findYamlFiles(dirPath) {
|
|
7948
8019
|
const results = [];
|
|
7949
8020
|
try {
|
|
7950
8021
|
const entries2 = await readdir4(dirPath, { withFileTypes: true });
|
|
7951
8022
|
for (const entry of entries2) {
|
|
7952
|
-
const fullPath =
|
|
8023
|
+
const fullPath = path12.join(dirPath, entry.name);
|
|
7953
8024
|
if (entry.isDirectory()) {
|
|
7954
8025
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
7955
8026
|
continue;
|
|
@@ -7966,7 +8037,7 @@ async function findYamlFiles(dirPath) {
|
|
|
7966
8037
|
return results;
|
|
7967
8038
|
}
|
|
7968
8039
|
function isYamlFile(filePath) {
|
|
7969
|
-
const ext =
|
|
8040
|
+
const ext = path12.extname(filePath).toLowerCase();
|
|
7970
8041
|
return ext === ".yaml" || ext === ".yml";
|
|
7971
8042
|
}
|
|
7972
8043
|
|
|
@@ -8004,9 +8075,9 @@ var validateCommand = command({
|
|
|
8004
8075
|
});
|
|
8005
8076
|
|
|
8006
8077
|
// src/commands/workspace/clean.ts
|
|
8007
|
-
import { existsSync as
|
|
8078
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
8008
8079
|
import { readFile as readFile5, readdir as readdir5, rm } from "node:fs/promises";
|
|
8009
|
-
import
|
|
8080
|
+
import path13 from "node:path";
|
|
8010
8081
|
async function confirm(message) {
|
|
8011
8082
|
const readline2 = await import("node:readline");
|
|
8012
8083
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -8033,7 +8104,7 @@ var cleanCommand = command({
|
|
|
8033
8104
|
},
|
|
8034
8105
|
handler: async ({ repo, force }) => {
|
|
8035
8106
|
const poolRoot = getWorkspacePoolRoot();
|
|
8036
|
-
if (!
|
|
8107
|
+
if (!existsSync9(poolRoot)) {
|
|
8037
8108
|
console.log("No workspace pool entries found.");
|
|
8038
8109
|
return;
|
|
8039
8110
|
}
|
|
@@ -8042,8 +8113,8 @@ var cleanCommand = command({
|
|
|
8042
8113
|
const poolDirs = entries2.filter((e) => e.isDirectory());
|
|
8043
8114
|
const matchingDirs = [];
|
|
8044
8115
|
for (const dir of poolDirs) {
|
|
8045
|
-
const poolDir =
|
|
8046
|
-
const metadataPath =
|
|
8116
|
+
const poolDir = path13.join(poolRoot, dir.name);
|
|
8117
|
+
const metadataPath = path13.join(poolDir, "metadata.json");
|
|
8047
8118
|
try {
|
|
8048
8119
|
const raw = await readFile5(metadataPath, "utf-8");
|
|
8049
8120
|
const metadata = JSON.parse(raw);
|
|
@@ -8074,7 +8145,7 @@ var cleanCommand = command({
|
|
|
8074
8145
|
}
|
|
8075
8146
|
for (const dir of matchingDirs) {
|
|
8076
8147
|
await rm(dir, { recursive: true, force: true });
|
|
8077
|
-
console.log(`Removed: ${
|
|
8148
|
+
console.log(`Removed: ${path13.basename(dir).slice(0, 12)}...`);
|
|
8078
8149
|
}
|
|
8079
8150
|
console.log("Done.");
|
|
8080
8151
|
} else {
|
|
@@ -8092,15 +8163,15 @@ var cleanCommand = command({
|
|
|
8092
8163
|
});
|
|
8093
8164
|
|
|
8094
8165
|
// src/commands/workspace/list.ts
|
|
8095
|
-
import { existsSync as
|
|
8166
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
8096
8167
|
import { readFile as readFile6, readdir as readdir6, stat as stat2 } from "node:fs/promises";
|
|
8097
|
-
import
|
|
8168
|
+
import path14 from "node:path";
|
|
8098
8169
|
async function getDirectorySize(dirPath) {
|
|
8099
8170
|
let totalSize = 0;
|
|
8100
8171
|
try {
|
|
8101
8172
|
const entries2 = await readdir6(dirPath, { withFileTypes: true });
|
|
8102
8173
|
for (const entry of entries2) {
|
|
8103
|
-
const fullPath =
|
|
8174
|
+
const fullPath = path14.join(dirPath, entry.name);
|
|
8104
8175
|
if (entry.isDirectory()) {
|
|
8105
8176
|
totalSize += await getDirectorySize(fullPath);
|
|
8106
8177
|
} else {
|
|
@@ -8124,7 +8195,7 @@ var listCommand = command({
|
|
|
8124
8195
|
args: {},
|
|
8125
8196
|
handler: async () => {
|
|
8126
8197
|
const poolRoot = getWorkspacePoolRoot();
|
|
8127
|
-
if (!
|
|
8198
|
+
if (!existsSync10(poolRoot)) {
|
|
8128
8199
|
console.log("No workspace pool entries found.");
|
|
8129
8200
|
return;
|
|
8130
8201
|
}
|
|
@@ -8135,11 +8206,11 @@ var listCommand = command({
|
|
|
8135
8206
|
return;
|
|
8136
8207
|
}
|
|
8137
8208
|
for (const dir of poolDirs) {
|
|
8138
|
-
const poolDir =
|
|
8209
|
+
const poolDir = path14.join(poolRoot, dir.name);
|
|
8139
8210
|
const fingerprint = dir.name;
|
|
8140
8211
|
const poolEntries = await readdir6(poolDir, { withFileTypes: true });
|
|
8141
8212
|
const slots = poolEntries.filter((e) => e.isDirectory() && e.name.startsWith("slot-"));
|
|
8142
|
-
const metadataPath =
|
|
8213
|
+
const metadataPath = path14.join(poolDir, "metadata.json");
|
|
8143
8214
|
let metadata = null;
|
|
8144
8215
|
try {
|
|
8145
8216
|
const raw = await readFile6(metadataPath, "utf-8");
|
|
@@ -8185,8 +8256,8 @@ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
|
8185
8256
|
var AGENTV_DIR = getAgentvHome();
|
|
8186
8257
|
var CACHE_FILE = "version-check.json";
|
|
8187
8258
|
var NPM_REGISTRY_URL = "https://registry.npmjs.org/agentv/latest";
|
|
8188
|
-
async function getCachedUpdateInfo(
|
|
8189
|
-
const filePath =
|
|
8259
|
+
async function getCachedUpdateInfo(path15) {
|
|
8260
|
+
const filePath = path15 ?? join5(AGENTV_DIR, CACHE_FILE);
|
|
8190
8261
|
try {
|
|
8191
8262
|
const raw = await readFile7(filePath, "utf-8");
|
|
8192
8263
|
const data = JSON.parse(raw);
|
|
@@ -8343,4 +8414,4 @@ export {
|
|
|
8343
8414
|
preprocessArgv,
|
|
8344
8415
|
runCli
|
|
8345
8416
|
};
|
|
8346
|
-
//# sourceMappingURL=chunk-
|
|
8417
|
+
//# sourceMappingURL=chunk-FXN26R2H.js.map
|