agentv 4.27.0 → 4.28.0-next.1
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-7AMUD2GX-SDILCAKJ.js → agentv-provider-AYXH7WLW-NJRC6UQX.js} +2 -2
- package/dist/{artifact-writer-VRDVTNSX.js → artifact-writer-WTMNQKPV.js} +5 -5
- package/dist/{chunk-TWBKRGXR.js → chunk-7T6AF75O.js} +3 -3
- package/dist/{chunk-XVFU4XKT.js → chunk-M7BUKBAF.js} +3 -3
- package/dist/chunk-M7BUKBAF.js.map +1 -0
- package/dist/{chunk-PH5MHKPL.js → chunk-UV7G7TWO.js} +316 -257
- package/dist/chunk-UV7G7TWO.js.map +1 -0
- package/dist/{chunk-VOOYHYPR.js → chunk-VTOY4SMC.js} +41 -24
- package/dist/chunk-VTOY4SMC.js.map +1 -0
- package/dist/{chunk-6BAB3XBI.js → chunk-WZVOY2W2.js} +47 -7
- package/dist/chunk-WZVOY2W2.js.map +1 -0
- package/dist/{chunk-VO3THAOI.js → chunk-XM4CHF6C.js} +11 -11
- package/dist/chunk-XM4CHF6C.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/{dist-COH43OLQ.js → dist-VYHXTFO3.js} +8 -4
- package/dist/index.js +6 -6
- package/dist/{interactive-UG4YNLYK.js → interactive-MMQ6OO6X.js} +6 -6
- package/dist/skills/agentv-eval-writer/references/eval-schema.json +598 -2475
- package/dist/{ts-eval-loader-BZ54W52K-KLIY3S3N.js → ts-eval-loader-EMSGL2BQ-P5RV35TE.js} +3 -3
- package/package.json +4 -4
- package/dist/chunk-6BAB3XBI.js.map +0 -1
- package/dist/chunk-PH5MHKPL.js.map +0 -1
- package/dist/chunk-VO3THAOI.js.map +0 -1
- package/dist/chunk-VOOYHYPR.js.map +0 -1
- package/dist/chunk-XVFU4XKT.js.map +0 -1
- /package/dist/{agentv-provider-7AMUD2GX-SDILCAKJ.js.map → agentv-provider-AYXH7WLW-NJRC6UQX.js.map} +0 -0
- /package/dist/{artifact-writer-VRDVTNSX.js.map → artifact-writer-WTMNQKPV.js.map} +0 -0
- /package/dist/{chunk-TWBKRGXR.js.map → chunk-7T6AF75O.js.map} +0 -0
- /package/dist/{dist-COH43OLQ.js.map → dist-VYHXTFO3.js.map} +0 -0
- /package/dist/{interactive-UG4YNLYK.js.map → interactive-MMQ6OO6X.js.map} +0 -0
- /package/dist/{ts-eval-loader-BZ54W52K-KLIY3S3N.js.map → ts-eval-loader-EMSGL2BQ-P5RV35TE.js.map} +0 -0
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
validateFileReferences,
|
|
46
46
|
validateTargetsFile,
|
|
47
47
|
validateWorkspacePaths
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-XM4CHF6C.js";
|
|
49
49
|
import {
|
|
50
50
|
RESULT_INDEX_FILENAME,
|
|
51
51
|
aggregateRunDir,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
resolveRunManifestPath,
|
|
54
54
|
toSnakeCaseDeep as toSnakeCaseDeep2,
|
|
55
55
|
writeArtifactsFromResults
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-7T6AF75O.js";
|
|
57
57
|
import {
|
|
58
58
|
DEFAULT_CATEGORY,
|
|
59
59
|
addBenchmark,
|
|
@@ -69,10 +69,11 @@ import {
|
|
|
69
69
|
removeBenchmark,
|
|
70
70
|
runBeforeSessionHook,
|
|
71
71
|
scanRepoDeps,
|
|
72
|
+
syncBenchmarks,
|
|
72
73
|
toTranscriptJsonLines,
|
|
73
74
|
transpileEvalYamlFile,
|
|
74
75
|
trimBaselineResult
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-WZVOY2W2.js";
|
|
76
77
|
import {
|
|
77
78
|
DEFAULT_THRESHOLD,
|
|
78
79
|
createBuiltinRegistry,
|
|
@@ -102,7 +103,7 @@ import {
|
|
|
102
103
|
runStartsWithAssertion,
|
|
103
104
|
toCamelCaseDeep,
|
|
104
105
|
toSnakeCaseDeep
|
|
105
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-VTOY4SMC.js";
|
|
106
107
|
import {
|
|
107
108
|
__commonJS,
|
|
108
109
|
__require,
|
|
@@ -863,7 +864,7 @@ var require_src = __commonJS({
|
|
|
863
864
|
});
|
|
864
865
|
|
|
865
866
|
// src/index.ts
|
|
866
|
-
import
|
|
867
|
+
import path28 from "node:path";
|
|
867
868
|
|
|
868
869
|
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
869
870
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -3654,8 +3655,63 @@ var createCommand = subcommands({
|
|
|
3654
3655
|
}
|
|
3655
3656
|
});
|
|
3656
3657
|
|
|
3657
|
-
// src/commands/
|
|
3658
|
+
// src/commands/doctor/index.ts
|
|
3659
|
+
import { execFileSync } from "node:child_process";
|
|
3660
|
+
import { existsSync } from "node:fs";
|
|
3658
3661
|
import path3 from "node:path";
|
|
3662
|
+
var DEPS = [];
|
|
3663
|
+
function findBinary(name) {
|
|
3664
|
+
const localBin = path3.join(getAgentvConfigDir(), "bin", name);
|
|
3665
|
+
if (existsSync(localBin)) return localBin;
|
|
3666
|
+
const pathDirs = (process.env.PATH ?? "").split(path3.delimiter);
|
|
3667
|
+
for (const dir of pathDirs) {
|
|
3668
|
+
const candidate = path3.join(dir, name);
|
|
3669
|
+
if (existsSync(candidate)) return candidate;
|
|
3670
|
+
}
|
|
3671
|
+
return void 0;
|
|
3672
|
+
}
|
|
3673
|
+
function getBinaryVersion(binaryPath) {
|
|
3674
|
+
try {
|
|
3675
|
+
const output = execFileSync(binaryPath, ["--version"], { stdio: "pipe", encoding: "utf-8" });
|
|
3676
|
+
return output.trim().split("\n")[0] ?? "unknown";
|
|
3677
|
+
} catch {
|
|
3678
|
+
return "unknown";
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
var doctorCommand = command({
|
|
3682
|
+
name: "doctor",
|
|
3683
|
+
description: "Check external dependencies required by agentv",
|
|
3684
|
+
args: {},
|
|
3685
|
+
handler: () => {
|
|
3686
|
+
const binDir = path3.join(getAgentvConfigDir(), "bin");
|
|
3687
|
+
console.log("agentv doctor\n");
|
|
3688
|
+
console.log(`Local bin dir: ${binDir}
|
|
3689
|
+
`);
|
|
3690
|
+
let allPresent = true;
|
|
3691
|
+
for (const dep of DEPS) {
|
|
3692
|
+
const binaryPath = findBinary(dep.name);
|
|
3693
|
+
if (binaryPath) {
|
|
3694
|
+
const version = getBinaryVersion(binaryPath);
|
|
3695
|
+
console.log(` \u2713 ${dep.name}`);
|
|
3696
|
+
console.log(` path: ${binaryPath}`);
|
|
3697
|
+
console.log(` version: ${version}`);
|
|
3698
|
+
console.log(` note: ${dep.description}`);
|
|
3699
|
+
} else {
|
|
3700
|
+
allPresent = false;
|
|
3701
|
+
console.log(` \u2717 ${dep.name} (not found)`);
|
|
3702
|
+
console.log(` note: ${dep.description}`);
|
|
3703
|
+
console.log(` install: ${dep.installHint}`);
|
|
3704
|
+
}
|
|
3705
|
+
console.log();
|
|
3706
|
+
}
|
|
3707
|
+
if (!allPresent) {
|
|
3708
|
+
process.exit(1);
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
});
|
|
3712
|
+
|
|
3713
|
+
// src/commands/eval/commands/aggregate.ts
|
|
3714
|
+
import path4 from "node:path";
|
|
3659
3715
|
var evalAggregateCommand = command({
|
|
3660
3716
|
name: "aggregate",
|
|
3661
3717
|
description: "Recompute benchmark.json and timing.json from a run directory. Deduplicates by (test_id, target), keeping the last entry.",
|
|
@@ -3667,7 +3723,7 @@ var evalAggregateCommand = command({
|
|
|
3667
3723
|
})
|
|
3668
3724
|
},
|
|
3669
3725
|
handler: async (args) => {
|
|
3670
|
-
const runDir =
|
|
3726
|
+
const runDir = path4.resolve(args.runDir);
|
|
3671
3727
|
const { benchmarkPath, timingPath, testCount, targetCount } = await aggregateRunDir(runDir);
|
|
3672
3728
|
console.log(`Aggregated ${testCount} test result(s) across ${targetCount} target(s)`);
|
|
3673
3729
|
console.log(` Benchmark: ${benchmarkPath}`);
|
|
@@ -3677,7 +3733,7 @@ var evalAggregateCommand = command({
|
|
|
3677
3733
|
|
|
3678
3734
|
// src/commands/eval/commands/assert.ts
|
|
3679
3735
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
3680
|
-
import
|
|
3736
|
+
import path5 from "node:path";
|
|
3681
3737
|
import fg from "fast-glob";
|
|
3682
3738
|
var evalAssertCommand = command({
|
|
3683
3739
|
name: "assert",
|
|
@@ -3708,7 +3764,7 @@ var evalAssertCommand = command({
|
|
|
3708
3764
|
let resolvedOutput;
|
|
3709
3765
|
let resolvedInput;
|
|
3710
3766
|
if (file) {
|
|
3711
|
-
const content = JSON.parse(readFileSync2(
|
|
3767
|
+
const content = JSON.parse(readFileSync2(path5.resolve(file), "utf8"));
|
|
3712
3768
|
resolvedOutput = content.output ?? "";
|
|
3713
3769
|
resolvedInput = content.input ?? "";
|
|
3714
3770
|
} else {
|
|
@@ -3774,11 +3830,11 @@ var evalAssertCommand = command({
|
|
|
3774
3830
|
}
|
|
3775
3831
|
});
|
|
3776
3832
|
async function findGraderScript(graderName, startDir) {
|
|
3777
|
-
let dir =
|
|
3778
|
-
const root =
|
|
3833
|
+
let dir = path5.resolve(startDir);
|
|
3834
|
+
const root = path5.parse(dir).root;
|
|
3779
3835
|
while (dir !== root) {
|
|
3780
3836
|
for (const subdir of ["graders", "judges"]) {
|
|
3781
|
-
const gradersDir =
|
|
3837
|
+
const gradersDir = path5.join(dir, ".agentv", subdir);
|
|
3782
3838
|
const found = await fg([`${graderName}.{ts,js,mts,mjs}`], {
|
|
3783
3839
|
cwd: gradersDir,
|
|
3784
3840
|
absolute: true,
|
|
@@ -3786,7 +3842,7 @@ async function findGraderScript(graderName, startDir) {
|
|
|
3786
3842
|
});
|
|
3787
3843
|
if (found.length > 0) return found[0];
|
|
3788
3844
|
}
|
|
3789
|
-
dir =
|
|
3845
|
+
dir = path5.dirname(dir);
|
|
3790
3846
|
}
|
|
3791
3847
|
return null;
|
|
3792
3848
|
}
|
|
@@ -3997,7 +4053,7 @@ var evalRunCommand = command({
|
|
|
3997
4053
|
},
|
|
3998
4054
|
handler: async (args) => {
|
|
3999
4055
|
if (args.evalPaths.length === 0 && process.stdin.isTTY) {
|
|
4000
|
-
const { launchInteractiveWizard } = await import("./interactive-
|
|
4056
|
+
const { launchInteractiveWizard } = await import("./interactive-MMQ6OO6X.js");
|
|
4001
4057
|
await launchInteractiveWizard();
|
|
4002
4058
|
return;
|
|
4003
4059
|
}
|
|
@@ -4075,7 +4131,7 @@ var evalCommand = subcommands({
|
|
|
4075
4131
|
|
|
4076
4132
|
// src/commands/import/claude.ts
|
|
4077
4133
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
4078
|
-
import
|
|
4134
|
+
import path6 from "node:path";
|
|
4079
4135
|
var importClaudeCommand = command({
|
|
4080
4136
|
name: "claude",
|
|
4081
4137
|
description: "Import a Claude Code session transcript for offline grading",
|
|
@@ -4147,8 +4203,8 @@ var importClaudeCommand = command({
|
|
|
4147
4203
|
const rawJsonl = await readTranscriptFile(sessionFilePath);
|
|
4148
4204
|
const transcript = parseClaudeSession(rawJsonl);
|
|
4149
4205
|
const shortId = (sessionId ?? transcript.source.sessionId).slice(0, 8);
|
|
4150
|
-
const outputPath = output ??
|
|
4151
|
-
await mkdir2(
|
|
4206
|
+
const outputPath = output ?? path6.join(".agentv", "transcripts", `claude-${shortId}.jsonl`);
|
|
4207
|
+
await mkdir2(path6.dirname(outputPath), { recursive: true });
|
|
4152
4208
|
const jsonLines = toTranscriptJsonLines(transcript);
|
|
4153
4209
|
await writeFile2(
|
|
4154
4210
|
outputPath,
|
|
@@ -4192,7 +4248,7 @@ function formatDurationMs(ms) {
|
|
|
4192
4248
|
|
|
4193
4249
|
// src/commands/import/codex.ts
|
|
4194
4250
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
4195
|
-
import
|
|
4251
|
+
import path7 from "node:path";
|
|
4196
4252
|
var importCodexCommand = command({
|
|
4197
4253
|
name: "codex",
|
|
4198
4254
|
description: "Import a Codex CLI session transcript for offline grading",
|
|
@@ -4264,8 +4320,8 @@ var importCodexCommand = command({
|
|
|
4264
4320
|
const rawJsonl = await readTranscriptFile(session.filePath);
|
|
4265
4321
|
const transcript = parseCodexSession(rawJsonl);
|
|
4266
4322
|
const shortId = session.sessionId.slice(0, 8);
|
|
4267
|
-
const outputPath = output ??
|
|
4268
|
-
await mkdir3(
|
|
4323
|
+
const outputPath = output ?? path7.join(".agentv", "transcripts", `codex-${shortId}.jsonl`);
|
|
4324
|
+
await mkdir3(path7.dirname(outputPath), { recursive: true });
|
|
4269
4325
|
const jsonLines = toTranscriptJsonLines(transcript);
|
|
4270
4326
|
await writeFile3(
|
|
4271
4327
|
outputPath,
|
|
@@ -4304,7 +4360,7 @@ function formatDurationMs2(ms) {
|
|
|
4304
4360
|
|
|
4305
4361
|
// src/commands/import/copilot.ts
|
|
4306
4362
|
import { mkdir as mkdir4, readFile, writeFile as writeFile4 } from "node:fs/promises";
|
|
4307
|
-
import
|
|
4363
|
+
import path8 from "node:path";
|
|
4308
4364
|
var importCopilotCommand = command({
|
|
4309
4365
|
name: "copilot",
|
|
4310
4366
|
description: "Import a Copilot CLI session transcript for offline grading",
|
|
@@ -4369,7 +4425,7 @@ var importCopilotCommand = command({
|
|
|
4369
4425
|
);
|
|
4370
4426
|
process.exit(1);
|
|
4371
4427
|
}
|
|
4372
|
-
const eventsPath =
|
|
4428
|
+
const eventsPath = path8.join(sessionDir, "events.jsonl");
|
|
4373
4429
|
const rawJsonl = await readFile(eventsPath, "utf8");
|
|
4374
4430
|
const parsed = parseCopilotEvents(rawJsonl);
|
|
4375
4431
|
const transcript = {
|
|
@@ -4386,8 +4442,8 @@ var importCopilotCommand = command({
|
|
|
4386
4442
|
costUsd: null
|
|
4387
4443
|
};
|
|
4388
4444
|
const shortId = resolvedSessionId.slice(0, 8);
|
|
4389
|
-
const outputPath = output ??
|
|
4390
|
-
await mkdir4(
|
|
4445
|
+
const outputPath = output ?? path8.join(".agentv", "transcripts", `copilot-${shortId}.jsonl`);
|
|
4446
|
+
await mkdir4(path8.dirname(outputPath), { recursive: true });
|
|
4391
4447
|
const jsonLines = toTranscriptJsonLines(transcript);
|
|
4392
4448
|
await writeFile4(
|
|
4393
4449
|
outputPath,
|
|
@@ -4431,16 +4487,16 @@ function formatDurationMs3(ms) {
|
|
|
4431
4487
|
|
|
4432
4488
|
// src/commands/import/huggingface.ts
|
|
4433
4489
|
import { execFile } from "node:child_process";
|
|
4434
|
-
import { existsSync } from "node:fs";
|
|
4435
|
-
import
|
|
4490
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
4491
|
+
import path9 from "node:path";
|
|
4436
4492
|
function findScript() {
|
|
4437
4493
|
const candidates = [
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4494
|
+
path9.resolve(__dirname, "..", "..", "..", "..", "..", "scripts", "import-huggingface.py"),
|
|
4495
|
+
path9.resolve(__dirname, "..", "..", "..", "..", "scripts", "import-huggingface.py"),
|
|
4496
|
+
path9.resolve(process.cwd(), "scripts", "import-huggingface.py")
|
|
4441
4497
|
];
|
|
4442
4498
|
for (const candidate of candidates) {
|
|
4443
|
-
if (
|
|
4499
|
+
if (existsSync2(candidate)) return candidate;
|
|
4444
4500
|
}
|
|
4445
4501
|
return candidates[candidates.length - 1];
|
|
4446
4502
|
}
|
|
@@ -4472,7 +4528,7 @@ var importHuggingFaceCommand = command({
|
|
|
4472
4528
|
},
|
|
4473
4529
|
handler: async ({ repo, split, limit, output }) => {
|
|
4474
4530
|
const scriptPath = findScript();
|
|
4475
|
-
if (!
|
|
4531
|
+
if (!existsSync2(scriptPath)) {
|
|
4476
4532
|
console.error(`Error: Python script not found at ${scriptPath}`);
|
|
4477
4533
|
console.error(
|
|
4478
4534
|
"Make sure you are running from the agentv repository root, or install agentv from source."
|
|
@@ -4548,30 +4604,30 @@ var importCommand = subcommands({
|
|
|
4548
4604
|
});
|
|
4549
4605
|
|
|
4550
4606
|
// src/commands/init/index.ts
|
|
4551
|
-
import { existsSync as
|
|
4552
|
-
import
|
|
4607
|
+
import { existsSync as existsSync3, mkdirSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4608
|
+
import path11 from "node:path";
|
|
4553
4609
|
import * as readline from "node:readline/promises";
|
|
4554
4610
|
|
|
4555
4611
|
// src/templates/index.ts
|
|
4556
4612
|
import { readFileSync as readFileSync3, readdirSync, statSync } from "node:fs";
|
|
4557
|
-
import
|
|
4613
|
+
import path10 from "node:path";
|
|
4558
4614
|
import { fileURLToPath } from "node:url";
|
|
4559
4615
|
function getAgentvTemplates() {
|
|
4560
4616
|
return getTemplatesFromDir(".agentv");
|
|
4561
4617
|
}
|
|
4562
4618
|
function getEnvExampleTemplate() {
|
|
4563
|
-
const currentDir =
|
|
4564
|
-
const templatesBase = currentDir.includes(`${
|
|
4565
|
-
const content = readFileSync3(
|
|
4619
|
+
const currentDir = path10.dirname(fileURLToPath(import.meta.url));
|
|
4620
|
+
const templatesBase = currentDir.includes(`${path10.sep}dist`) ? path10.join(currentDir, "templates") : currentDir;
|
|
4621
|
+
const content = readFileSync3(path10.join(templatesBase, ".env.example"), "utf-8");
|
|
4566
4622
|
return { path: ".env.example", content };
|
|
4567
4623
|
}
|
|
4568
4624
|
function getTemplatesFromDir(subdir) {
|
|
4569
|
-
const currentDir =
|
|
4625
|
+
const currentDir = path10.dirname(fileURLToPath(import.meta.url));
|
|
4570
4626
|
let templatesDir;
|
|
4571
|
-
if (currentDir.includes(`${
|
|
4572
|
-
templatesDir =
|
|
4627
|
+
if (currentDir.includes(`${path10.sep}dist`)) {
|
|
4628
|
+
templatesDir = path10.join(currentDir, "templates", subdir);
|
|
4573
4629
|
} else {
|
|
4574
|
-
templatesDir =
|
|
4630
|
+
templatesDir = path10.join(currentDir, subdir);
|
|
4575
4631
|
}
|
|
4576
4632
|
return readTemplatesRecursively(templatesDir, "");
|
|
4577
4633
|
}
|
|
@@ -4579,15 +4635,15 @@ function readTemplatesRecursively(dir, relativePath) {
|
|
|
4579
4635
|
const templates = [];
|
|
4580
4636
|
const entries2 = readdirSync(dir);
|
|
4581
4637
|
for (const entry of entries2) {
|
|
4582
|
-
const fullPath =
|
|
4638
|
+
const fullPath = path10.join(dir, entry);
|
|
4583
4639
|
const stat3 = statSync(fullPath);
|
|
4584
|
-
const entryRelativePath = relativePath ?
|
|
4640
|
+
const entryRelativePath = relativePath ? path10.join(relativePath, entry) : entry;
|
|
4585
4641
|
if (stat3.isDirectory()) {
|
|
4586
4642
|
templates.push(...readTemplatesRecursively(fullPath, entryRelativePath));
|
|
4587
4643
|
} else {
|
|
4588
4644
|
const content = readFileSync3(fullPath, "utf-8");
|
|
4589
4645
|
templates.push({
|
|
4590
|
-
path: entryRelativePath.split(
|
|
4646
|
+
path: entryRelativePath.split(path10.sep).join("/"),
|
|
4591
4647
|
// Normalize to forward slashes
|
|
4592
4648
|
content
|
|
4593
4649
|
});
|
|
@@ -4618,22 +4674,22 @@ async function promptYesNo(message) {
|
|
|
4618
4674
|
}
|
|
4619
4675
|
}
|
|
4620
4676
|
async function initCommand(options = {}) {
|
|
4621
|
-
const targetPath =
|
|
4622
|
-
const agentvDir =
|
|
4677
|
+
const targetPath = path11.resolve(options.targetPath ?? ".");
|
|
4678
|
+
const agentvDir = path11.join(targetPath, ".agentv");
|
|
4623
4679
|
const otherAgentvTemplates = getAgentvTemplates();
|
|
4624
4680
|
const envTemplate = getEnvExampleTemplate();
|
|
4625
4681
|
const existingFiles = [];
|
|
4626
4682
|
if (envTemplate) {
|
|
4627
|
-
const envFilePath =
|
|
4628
|
-
if (
|
|
4683
|
+
const envFilePath = path11.join(targetPath, ".env.example");
|
|
4684
|
+
if (existsSync3(envFilePath)) {
|
|
4629
4685
|
existingFiles.push(".env.example");
|
|
4630
4686
|
}
|
|
4631
4687
|
}
|
|
4632
|
-
if (
|
|
4688
|
+
if (existsSync3(agentvDir)) {
|
|
4633
4689
|
for (const template of otherAgentvTemplates) {
|
|
4634
|
-
const targetFilePath =
|
|
4635
|
-
if (
|
|
4636
|
-
existingFiles.push(
|
|
4690
|
+
const targetFilePath = path11.join(agentvDir, template.path);
|
|
4691
|
+
if (existsSync3(targetFilePath)) {
|
|
4692
|
+
existingFiles.push(path11.relative(targetPath, targetFilePath));
|
|
4637
4693
|
}
|
|
4638
4694
|
}
|
|
4639
4695
|
}
|
|
@@ -4651,22 +4707,22 @@ async function initCommand(options = {}) {
|
|
|
4651
4707
|
}
|
|
4652
4708
|
console.log();
|
|
4653
4709
|
}
|
|
4654
|
-
if (!
|
|
4710
|
+
if (!existsSync3(agentvDir)) {
|
|
4655
4711
|
mkdirSync(agentvDir, { recursive: true });
|
|
4656
4712
|
}
|
|
4657
4713
|
if (envTemplate) {
|
|
4658
|
-
const envFilePath =
|
|
4714
|
+
const envFilePath = path11.join(targetPath, ".env.example");
|
|
4659
4715
|
writeFileSync2(envFilePath, envTemplate.content, "utf-8");
|
|
4660
4716
|
console.log("Created .env.example");
|
|
4661
4717
|
}
|
|
4662
4718
|
for (const template of otherAgentvTemplates) {
|
|
4663
|
-
const targetFilePath =
|
|
4664
|
-
const targetDirPath =
|
|
4665
|
-
if (!
|
|
4719
|
+
const targetFilePath = path11.join(agentvDir, template.path);
|
|
4720
|
+
const targetDirPath = path11.dirname(targetFilePath);
|
|
4721
|
+
if (!existsSync3(targetDirPath)) {
|
|
4666
4722
|
mkdirSync(targetDirPath, { recursive: true });
|
|
4667
4723
|
}
|
|
4668
4724
|
writeFileSync2(targetFilePath, template.content, "utf-8");
|
|
4669
|
-
console.log(`Created ${
|
|
4725
|
+
console.log(`Created ${path11.relative(targetPath, targetFilePath)}`);
|
|
4670
4726
|
}
|
|
4671
4727
|
console.log("\nAgentV initialized successfully!");
|
|
4672
4728
|
console.log("\nFiles installed to root:");
|
|
@@ -4674,7 +4730,7 @@ async function initCommand(options = {}) {
|
|
|
4674
4730
|
console.log(" - .env.example");
|
|
4675
4731
|
}
|
|
4676
4732
|
console.log(`
|
|
4677
|
-
Files installed to ${
|
|
4733
|
+
Files installed to ${path11.relative(targetPath, agentvDir)}:`);
|
|
4678
4734
|
for (const t of otherAgentvTemplates) {
|
|
4679
4735
|
console.log(` - ${t.path}`);
|
|
4680
4736
|
}
|
|
@@ -4705,14 +4761,14 @@ var initCmdTsCommand = command({
|
|
|
4705
4761
|
});
|
|
4706
4762
|
|
|
4707
4763
|
// src/commands/inspect/filter.ts
|
|
4708
|
-
import { existsSync as
|
|
4709
|
-
import
|
|
4764
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
4765
|
+
import path12 from "node:path";
|
|
4710
4766
|
function collectIndexFiles(dir) {
|
|
4711
4767
|
const files = [];
|
|
4712
4768
|
try {
|
|
4713
4769
|
const entries2 = readdirSync2(dir, { withFileTypes: true });
|
|
4714
4770
|
for (const entry of entries2) {
|
|
4715
|
-
const fullPath =
|
|
4771
|
+
const fullPath = path12.join(dir, entry.name);
|
|
4716
4772
|
if (entry.isDirectory()) {
|
|
4717
4773
|
files.push(...collectIndexFiles(fullPath));
|
|
4718
4774
|
} else if (entry.name === "index.jsonl") {
|
|
@@ -4763,7 +4819,7 @@ function parseFilterableRecords(filePath) {
|
|
|
4763
4819
|
}
|
|
4764
4820
|
let experiment = typeof raw.experiment === "string" ? raw.experiment : void 0;
|
|
4765
4821
|
if (!experiment) {
|
|
4766
|
-
const parts = filePath.split(
|
|
4822
|
+
const parts = filePath.split(path12.sep);
|
|
4767
4823
|
const runsIdx = parts.indexOf("runs");
|
|
4768
4824
|
if (runsIdx !== -1 && parts.length - runsIdx >= 3) {
|
|
4769
4825
|
const candidate = parts[runsIdx + 1];
|
|
@@ -4818,8 +4874,8 @@ function buildFilterPredicate(opts) {
|
|
|
4818
4874
|
}
|
|
4819
4875
|
function discoverFilterSources(searchPath, cwd) {
|
|
4820
4876
|
if (searchPath) {
|
|
4821
|
-
const resolved =
|
|
4822
|
-
if (!
|
|
4877
|
+
const resolved = path12.isAbsolute(searchPath) ? searchPath : path12.resolve(cwd, searchPath);
|
|
4878
|
+
if (!existsSync4(resolved)) {
|
|
4823
4879
|
console.error(`${c.red}Error:${c.reset} Path does not exist: ${resolved}`);
|
|
4824
4880
|
process.exit(1);
|
|
4825
4881
|
}
|
|
@@ -4831,7 +4887,7 @@ function discoverFilterSources(searchPath, cwd) {
|
|
|
4831
4887
|
}
|
|
4832
4888
|
return [resolved];
|
|
4833
4889
|
}
|
|
4834
|
-
return collectIndexFiles(
|
|
4890
|
+
return collectIndexFiles(path12.join(cwd, ".agentv", "results", "runs"));
|
|
4835
4891
|
}
|
|
4836
4892
|
function formatFilterTable(records) {
|
|
4837
4893
|
const lines = [];
|
|
@@ -5303,14 +5359,14 @@ var traceScoreCommand = command({
|
|
|
5303
5359
|
});
|
|
5304
5360
|
|
|
5305
5361
|
// src/commands/inspect/search.ts
|
|
5306
|
-
import { existsSync as
|
|
5307
|
-
import
|
|
5362
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
|
|
5363
|
+
import path13 from "node:path";
|
|
5308
5364
|
function collectJsonlFiles(dir) {
|
|
5309
5365
|
const files = [];
|
|
5310
5366
|
try {
|
|
5311
5367
|
const entries2 = readdirSync3(dir, { withFileTypes: true });
|
|
5312
5368
|
for (const entry of entries2) {
|
|
5313
|
-
const fullPath =
|
|
5369
|
+
const fullPath = path13.join(dir, entry.name);
|
|
5314
5370
|
if (entry.isDirectory()) {
|
|
5315
5371
|
files.push(...collectJsonlFiles(fullPath));
|
|
5316
5372
|
} else if (entry.name.endsWith(".jsonl")) {
|
|
@@ -5369,8 +5425,8 @@ function searchJsonlFile(filePath, regex2, targetFilter, experimentFilter) {
|
|
|
5369
5425
|
}
|
|
5370
5426
|
function discoverSources(basePath, cwd) {
|
|
5371
5427
|
if (basePath) {
|
|
5372
|
-
const resolved =
|
|
5373
|
-
if (!
|
|
5428
|
+
const resolved = path13.isAbsolute(basePath) ? basePath : path13.resolve(cwd, basePath);
|
|
5429
|
+
if (!existsSync5(resolved)) {
|
|
5374
5430
|
console.error(`${c.red}Error:${c.reset} Path does not exist: ${resolved}`);
|
|
5375
5431
|
process.exit(1);
|
|
5376
5432
|
}
|
|
@@ -5383,8 +5439,8 @@ function discoverSources(basePath, cwd) {
|
|
|
5383
5439
|
return [resolved];
|
|
5384
5440
|
}
|
|
5385
5441
|
const sources = [];
|
|
5386
|
-
sources.push(...collectJsonlFiles(
|
|
5387
|
-
sources.push(...collectJsonlFiles(
|
|
5442
|
+
sources.push(...collectJsonlFiles(path13.join(cwd, ".agentv", "results", "runs")));
|
|
5443
|
+
sources.push(...collectJsonlFiles(path13.join(cwd, ".agentv", "transcripts")));
|
|
5388
5444
|
return sources;
|
|
5389
5445
|
}
|
|
5390
5446
|
function formatSearchResults(matches, pattern) {
|
|
@@ -5931,7 +5987,7 @@ var inspectCommand = subcommands({
|
|
|
5931
5987
|
});
|
|
5932
5988
|
|
|
5933
5989
|
// src/commands/pipeline/bench.ts
|
|
5934
|
-
import { existsSync as
|
|
5990
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
5935
5991
|
import { readFile as readFile2, readdir, writeFile as writeFile5 } from "node:fs/promises";
|
|
5936
5992
|
import { join } from "node:path";
|
|
5937
5993
|
var evalBenchCommand = command({
|
|
@@ -6042,7 +6098,7 @@ var evalBenchCommand = command({
|
|
|
6042
6098
|
}));
|
|
6043
6099
|
let executionStatus = "ok";
|
|
6044
6100
|
const timingPath = join(testDir, "timing.json");
|
|
6045
|
-
if (
|
|
6101
|
+
if (existsSync6(timingPath)) {
|
|
6046
6102
|
try {
|
|
6047
6103
|
const timing = JSON.parse(await readFile2(timingPath, "utf8"));
|
|
6048
6104
|
if (typeof timing.execution_status === "string") {
|
|
@@ -6051,7 +6107,7 @@ var evalBenchCommand = command({
|
|
|
6051
6107
|
} catch {
|
|
6052
6108
|
}
|
|
6053
6109
|
}
|
|
6054
|
-
const hasResponse =
|
|
6110
|
+
const hasResponse = existsSync6(join(testDir, "response.md"));
|
|
6055
6111
|
indexLines.push(
|
|
6056
6112
|
JSON.stringify({
|
|
6057
6113
|
timestamp: manifest.timestamp,
|
|
@@ -6596,7 +6652,7 @@ async function writeJson(filePath, data) {
|
|
|
6596
6652
|
|
|
6597
6653
|
// src/commands/pipeline/run.ts
|
|
6598
6654
|
import { exec } from "node:child_process";
|
|
6599
|
-
import { existsSync as
|
|
6655
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, unlinkSync } from "node:fs";
|
|
6600
6656
|
import { mkdir as mkdir7, readFile as readFile5, readdir as readdir3, writeFile as writeFile8 } from "node:fs/promises";
|
|
6601
6657
|
import { tmpdir } from "node:os";
|
|
6602
6658
|
import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve2 } from "node:path";
|
|
@@ -6610,7 +6666,7 @@ function loadEnvFile(dir) {
|
|
|
6610
6666
|
let current = resolve2(dir);
|
|
6611
6667
|
while (true) {
|
|
6612
6668
|
const candidate = join4(current, ".env");
|
|
6613
|
-
if (
|
|
6669
|
+
if (existsSync7(candidate)) {
|
|
6614
6670
|
const env2 = {};
|
|
6615
6671
|
for (const line of readFileSync6(candidate, "utf8").split("\n")) {
|
|
6616
6672
|
const trimmed = line.trim();
|
|
@@ -6809,7 +6865,7 @@ var evalRunCommand2 = command({
|
|
|
6809
6865
|
});
|
|
6810
6866
|
const durationMs = Math.round(performance.now() - start);
|
|
6811
6867
|
let response;
|
|
6812
|
-
if (
|
|
6868
|
+
if (existsSync7(outputFile)) {
|
|
6813
6869
|
response = readFileSync6(outputFile, "utf8");
|
|
6814
6870
|
} else {
|
|
6815
6871
|
response = "ERROR: No output file generated";
|
|
@@ -6842,8 +6898,8 @@ var evalRunCommand2 = command({
|
|
|
6842
6898
|
invCompleted++;
|
|
6843
6899
|
writeInvProgress();
|
|
6844
6900
|
try {
|
|
6845
|
-
if (
|
|
6846
|
-
if (
|
|
6901
|
+
if (existsSync7(promptFile)) unlinkSync(promptFile);
|
|
6902
|
+
if (existsSync7(outputFile)) unlinkSync(outputFile);
|
|
6847
6903
|
} catch {
|
|
6848
6904
|
}
|
|
6849
6905
|
}
|
|
@@ -7010,10 +7066,10 @@ var pipelineCommand = subcommands({
|
|
|
7010
7066
|
});
|
|
7011
7067
|
|
|
7012
7068
|
// src/commands/results/export.ts
|
|
7013
|
-
import
|
|
7069
|
+
import path14 from "node:path";
|
|
7014
7070
|
|
|
7015
7071
|
// src/commands/results/shared.ts
|
|
7016
|
-
import { existsSync as
|
|
7072
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
7017
7073
|
var sourceArg = positional({
|
|
7018
7074
|
type: optional(string),
|
|
7019
7075
|
displayName: "source",
|
|
@@ -7023,7 +7079,7 @@ async function resolveSourceFile(source, cwd) {
|
|
|
7023
7079
|
let sourceFile;
|
|
7024
7080
|
if (source) {
|
|
7025
7081
|
sourceFile = resolveResultSourcePath(source, cwd);
|
|
7026
|
-
if (!
|
|
7082
|
+
if (!existsSync8(sourceFile)) {
|
|
7027
7083
|
console.error(`Error: File not found: ${sourceFile}`);
|
|
7028
7084
|
process.exit(1);
|
|
7029
7085
|
}
|
|
@@ -7031,7 +7087,7 @@ async function resolveSourceFile(source, cwd) {
|
|
|
7031
7087
|
} else {
|
|
7032
7088
|
const cache = await loadRunCache(cwd);
|
|
7033
7089
|
const cachedFile = cache ? resolveRunCacheFile(cache) : "";
|
|
7034
|
-
if (cachedFile &&
|
|
7090
|
+
if (cachedFile && existsSync8(cachedFile)) {
|
|
7035
7091
|
sourceFile = cachedFile;
|
|
7036
7092
|
} else {
|
|
7037
7093
|
const metas = listResultFiles(cwd, 1);
|
|
@@ -7057,20 +7113,20 @@ async function loadResults(source, cwd) {
|
|
|
7057
7113
|
|
|
7058
7114
|
// src/commands/results/export.ts
|
|
7059
7115
|
function deriveOutputDir(cwd, sourceFile) {
|
|
7060
|
-
if (
|
|
7116
|
+
if (path14.basename(sourceFile) !== RESULT_INDEX_FILENAME) {
|
|
7061
7117
|
throw new Error(`Expected a run manifest named ${RESULT_INDEX_FILENAME}: ${sourceFile}`);
|
|
7062
7118
|
}
|
|
7063
|
-
const runDir =
|
|
7064
|
-
const segments =
|
|
7119
|
+
const runDir = path14.dirname(sourceFile);
|
|
7120
|
+
const segments = path14.normalize(runDir).split(path14.sep).filter(Boolean);
|
|
7065
7121
|
const runsIndex = segments.lastIndexOf("runs");
|
|
7066
7122
|
if (runsIndex >= 0 && runsIndex < segments.length - 1) {
|
|
7067
|
-
return
|
|
7123
|
+
return path14.join(cwd, ".agentv", "results", "export", ...segments.slice(runsIndex + 1));
|
|
7068
7124
|
}
|
|
7069
|
-
const parentDir =
|
|
7125
|
+
const parentDir = path14.basename(runDir);
|
|
7070
7126
|
if (parentDir.startsWith("eval_")) {
|
|
7071
|
-
return
|
|
7127
|
+
return path14.join(cwd, ".agentv", "results", "export", parentDir.slice(5));
|
|
7072
7128
|
}
|
|
7073
|
-
return
|
|
7129
|
+
return path14.join(cwd, ".agentv", "results", "export", parentDir);
|
|
7074
7130
|
}
|
|
7075
7131
|
async function loadExportSource(source, cwd) {
|
|
7076
7132
|
const { sourceFile } = await resolveSourceFile(source, cwd);
|
|
@@ -7103,7 +7159,7 @@ var resultsExportCommand = command({
|
|
|
7103
7159
|
const cwd = dir ?? process.cwd();
|
|
7104
7160
|
try {
|
|
7105
7161
|
const { sourceFile, results } = await loadExportSource(source, cwd);
|
|
7106
|
-
const outputDir = out ?
|
|
7162
|
+
const outputDir = out ? path14.isAbsolute(out) ? out : path14.resolve(cwd, out) : deriveOutputDir(cwd, sourceFile);
|
|
7107
7163
|
await writeArtifactsFromResults(results, outputDir, {
|
|
7108
7164
|
evalFile: sourceFile
|
|
7109
7165
|
});
|
|
@@ -7163,8 +7219,8 @@ var resultsFailuresCommand = command({
|
|
|
7163
7219
|
});
|
|
7164
7220
|
|
|
7165
7221
|
// src/commands/results/report.ts
|
|
7166
|
-
import { existsSync as
|
|
7167
|
-
import
|
|
7222
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7223
|
+
import path15 from "node:path";
|
|
7168
7224
|
|
|
7169
7225
|
// src/commands/results/report-template.ts
|
|
7170
7226
|
var RESULTS_REPORT_TEMPLATE = `<!DOCTYPE html>
|
|
@@ -8788,11 +8844,11 @@ function normalizeEvalFileLabel(value) {
|
|
|
8788
8844
|
if (!trimmed) {
|
|
8789
8845
|
return void 0;
|
|
8790
8846
|
}
|
|
8791
|
-
return
|
|
8847
|
+
return path15.basename(trimmed).replace(/\.results\.jsonl$/i, "").replace(/\.eval\.ya?ml$/i, "").replace(/\.ya?ml$/i, "").replace(/\.jsonl$/i, "");
|
|
8792
8848
|
}
|
|
8793
8849
|
function readBenchmarkEvalFile(sourceFile) {
|
|
8794
|
-
const benchmarkPath =
|
|
8795
|
-
if (!
|
|
8850
|
+
const benchmarkPath = path15.join(path15.dirname(sourceFile), "benchmark.json");
|
|
8851
|
+
if (!existsSync9(benchmarkPath)) {
|
|
8796
8852
|
return void 0;
|
|
8797
8853
|
}
|
|
8798
8854
|
try {
|
|
@@ -8803,10 +8859,10 @@ function readBenchmarkEvalFile(sourceFile) {
|
|
|
8803
8859
|
}
|
|
8804
8860
|
}
|
|
8805
8861
|
function deriveReportPath(sourceFile) {
|
|
8806
|
-
return
|
|
8862
|
+
return path15.join(path15.dirname(sourceFile), "report.html");
|
|
8807
8863
|
}
|
|
8808
8864
|
function serializeReportResult(result, sourceFile, manifestRecord, benchmarkEvalFile) {
|
|
8809
|
-
const fallbackEvalFile = normalizeEvalFileLabel(manifestRecord?.eval_file) ?? benchmarkEvalFile ?? normalizeEvalFileLabel(result.suite) ??
|
|
8865
|
+
const fallbackEvalFile = normalizeEvalFileLabel(manifestRecord?.eval_file) ?? benchmarkEvalFile ?? normalizeEvalFileLabel(result.suite) ?? path15.basename(path15.dirname(sourceFile));
|
|
8810
8866
|
return {
|
|
8811
8867
|
timestamp: result.timestamp,
|
|
8812
8868
|
test_id: result.testId,
|
|
@@ -8854,9 +8910,9 @@ function renderResultsReport(results, sourceFile, records, benchmarkEvalFile) {
|
|
|
8854
8910
|
}
|
|
8855
8911
|
async function writeResultsReport(source, outputPath, cwd) {
|
|
8856
8912
|
const { sourceFile, results, records, benchmarkEvalFile } = await loadReportSource(source, cwd);
|
|
8857
|
-
const resolvedOutputPath = outputPath ?
|
|
8913
|
+
const resolvedOutputPath = outputPath ? path15.isAbsolute(outputPath) ? outputPath : path15.resolve(cwd, outputPath) : deriveReportPath(sourceFile);
|
|
8858
8914
|
const html = renderResultsReport(results, sourceFile, records, benchmarkEvalFile);
|
|
8859
|
-
mkdirSync2(
|
|
8915
|
+
mkdirSync2(path15.dirname(resolvedOutputPath), { recursive: true });
|
|
8860
8916
|
writeFileSync3(resolvedOutputPath, html, "utf8");
|
|
8861
8917
|
const written = readFileSync7(resolvedOutputPath, "utf8");
|
|
8862
8918
|
if (written.includes("__DATA_PLACEHOLDER__")) {
|
|
@@ -8977,7 +9033,7 @@ var resultsShowCommand = command({
|
|
|
8977
9033
|
});
|
|
8978
9034
|
|
|
8979
9035
|
// src/commands/results/summary.ts
|
|
8980
|
-
import { existsSync as
|
|
9036
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
|
|
8981
9037
|
function formatSummary(results, grading) {
|
|
8982
9038
|
const total = results.length;
|
|
8983
9039
|
let passed;
|
|
@@ -9028,7 +9084,7 @@ var resultsSummaryCommand = command({
|
|
|
9028
9084
|
const { results, sourceFile } = await loadResults(source, cwd);
|
|
9029
9085
|
let grading;
|
|
9030
9086
|
const gradingPath = sourceFile.replace(/\.jsonl$/, ".grading.json");
|
|
9031
|
-
if (
|
|
9087
|
+
if (existsSync10(gradingPath)) {
|
|
9032
9088
|
try {
|
|
9033
9089
|
grading = JSON.parse(readFileSync8(gradingPath, "utf8"));
|
|
9034
9090
|
} catch {
|
|
@@ -9043,11 +9099,11 @@ var resultsSummaryCommand = command({
|
|
|
9043
9099
|
});
|
|
9044
9100
|
|
|
9045
9101
|
// src/commands/results/validate.ts
|
|
9046
|
-
import { existsSync as
|
|
9047
|
-
import
|
|
9102
|
+
import { existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync4 } from "node:fs";
|
|
9103
|
+
import path16 from "node:path";
|
|
9048
9104
|
function checkDirectoryNaming(runDir) {
|
|
9049
|
-
const dirName =
|
|
9050
|
-
const pathSegments =
|
|
9105
|
+
const dirName = path16.basename(runDir);
|
|
9106
|
+
const pathSegments = path16.normalize(runDir).split(path16.sep).filter(Boolean);
|
|
9051
9107
|
const runsIndex = pathSegments.lastIndexOf("runs");
|
|
9052
9108
|
const diagnostics = [];
|
|
9053
9109
|
if (runsIndex < 0 || runsIndex >= pathSegments.length - 1) {
|
|
@@ -9077,10 +9133,10 @@ function validateRunDirectory(runDir) {
|
|
|
9077
9133
|
return { diagnostics, entries: entries2 };
|
|
9078
9134
|
}
|
|
9079
9135
|
function checkIndexJsonl(runDir) {
|
|
9080
|
-
const indexPath =
|
|
9136
|
+
const indexPath = path16.join(runDir, "index.jsonl");
|
|
9081
9137
|
const diagnostics = [];
|
|
9082
9138
|
const entries2 = [];
|
|
9083
|
-
if (!
|
|
9139
|
+
if (!existsSync11(indexPath)) {
|
|
9084
9140
|
diagnostics.push({ severity: "error", message: "index.jsonl is missing" });
|
|
9085
9141
|
return { diagnostics, entries: entries2 };
|
|
9086
9142
|
}
|
|
@@ -9176,8 +9232,8 @@ function checkArtifactFiles(runDir, entries2) {
|
|
|
9176
9232
|
for (const entry of entries2) {
|
|
9177
9233
|
const testId = entry.test_id ?? "?";
|
|
9178
9234
|
if (entry.grading_path) {
|
|
9179
|
-
const gradingPath =
|
|
9180
|
-
if (!
|
|
9235
|
+
const gradingPath = path16.join(runDir, entry.grading_path);
|
|
9236
|
+
if (!existsSync11(gradingPath)) {
|
|
9181
9237
|
diagnostics.push({
|
|
9182
9238
|
severity: "error",
|
|
9183
9239
|
message: `${testId}: grading.json not found at '${entry.grading_path}'`
|
|
@@ -9206,8 +9262,8 @@ function checkArtifactFiles(runDir, entries2) {
|
|
|
9206
9262
|
}
|
|
9207
9263
|
}
|
|
9208
9264
|
if (entry.timing_path) {
|
|
9209
|
-
const timingPath =
|
|
9210
|
-
if (!
|
|
9265
|
+
const timingPath = path16.join(runDir, entry.timing_path);
|
|
9266
|
+
if (!existsSync11(timingPath)) {
|
|
9211
9267
|
diagnostics.push({
|
|
9212
9268
|
severity: "warning",
|
|
9213
9269
|
message: `${testId}: timing.json not found at '${entry.timing_path}'`
|
|
@@ -9215,8 +9271,8 @@ function checkArtifactFiles(runDir, entries2) {
|
|
|
9215
9271
|
}
|
|
9216
9272
|
}
|
|
9217
9273
|
}
|
|
9218
|
-
const benchmarkPath =
|
|
9219
|
-
if (!
|
|
9274
|
+
const benchmarkPath = path16.join(runDir, "benchmark.json");
|
|
9275
|
+
if (!existsSync11(benchmarkPath)) {
|
|
9220
9276
|
diagnostics.push({ severity: "warning", message: "benchmark.json is missing" });
|
|
9221
9277
|
}
|
|
9222
9278
|
return diagnostics;
|
|
@@ -9232,8 +9288,8 @@ var resultsValidateCommand = command({
|
|
|
9232
9288
|
})
|
|
9233
9289
|
},
|
|
9234
9290
|
handler: async ({ runDir }) => {
|
|
9235
|
-
const resolvedDir =
|
|
9236
|
-
if (!
|
|
9291
|
+
const resolvedDir = path16.resolve(runDir);
|
|
9292
|
+
if (!existsSync11(resolvedDir) || !statSync4(resolvedDir).isDirectory()) {
|
|
9237
9293
|
console.error(`Error: '${runDir}' is not a directory`);
|
|
9238
9294
|
process.exit(1);
|
|
9239
9295
|
}
|
|
@@ -9275,15 +9331,15 @@ var resultsCommand = subcommands({
|
|
|
9275
9331
|
});
|
|
9276
9332
|
|
|
9277
9333
|
// src/commands/results/serve.ts
|
|
9278
|
-
import { existsSync as
|
|
9279
|
-
import
|
|
9334
|
+
import { existsSync as existsSync15, readFileSync as readFileSync12, readdirSync as readdirSync4, statSync as statSync5, writeFileSync as writeFileSync6 } from "node:fs";
|
|
9335
|
+
import path20 from "node:path";
|
|
9280
9336
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
9281
9337
|
import { Hono } from "hono";
|
|
9282
9338
|
|
|
9283
9339
|
// src/commands/results/eval-runner.ts
|
|
9284
|
-
import { execFileSync, spawn } from "node:child_process";
|
|
9285
|
-
import { existsSync as
|
|
9286
|
-
import
|
|
9340
|
+
import { execFileSync as execFileSync2, spawn } from "node:child_process";
|
|
9341
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
9342
|
+
import path17 from "node:path";
|
|
9287
9343
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
9288
9344
|
var activeRuns = /* @__PURE__ */ new Map();
|
|
9289
9345
|
function generateRunId() {
|
|
@@ -9303,7 +9359,7 @@ function pruneFinishedRuns() {
|
|
|
9303
9359
|
}
|
|
9304
9360
|
function getActiveRunTarget(indexJsonlPath) {
|
|
9305
9361
|
for (const run2 of activeRuns.values()) {
|
|
9306
|
-
if (run2.outputDir &&
|
|
9362
|
+
if (run2.outputDir && path17.join(run2.outputDir, "index.jsonl") === indexJsonlPath) {
|
|
9307
9363
|
return run2.target;
|
|
9308
9364
|
}
|
|
9309
9365
|
}
|
|
@@ -9313,16 +9369,16 @@ async function discoverTargetsInProject(cwd) {
|
|
|
9313
9369
|
const repoRoot = await findRepoRoot(cwd) ?? cwd;
|
|
9314
9370
|
let targetsFilePath;
|
|
9315
9371
|
for (const candidate of TARGET_FILE_CANDIDATES) {
|
|
9316
|
-
const fullPath =
|
|
9317
|
-
if (
|
|
9372
|
+
const fullPath = path17.join(cwd, candidate);
|
|
9373
|
+
if (existsSync12(fullPath)) {
|
|
9318
9374
|
targetsFilePath = fullPath;
|
|
9319
9375
|
break;
|
|
9320
9376
|
}
|
|
9321
9377
|
}
|
|
9322
9378
|
if (!targetsFilePath) {
|
|
9323
9379
|
for (const candidate of TARGET_FILE_CANDIDATES) {
|
|
9324
|
-
const fullPath =
|
|
9325
|
-
if (
|
|
9380
|
+
const fullPath = path17.join(repoRoot, candidate);
|
|
9381
|
+
if (existsSync12(fullPath)) {
|
|
9326
9382
|
targetsFilePath = fullPath;
|
|
9327
9383
|
break;
|
|
9328
9384
|
}
|
|
@@ -9395,19 +9451,19 @@ function buildCliPreview(args) {
|
|
|
9395
9451
|
}
|
|
9396
9452
|
function resolveCliPath(cwd) {
|
|
9397
9453
|
const candidates = [
|
|
9398
|
-
|
|
9399
|
-
|
|
9454
|
+
path17.join(cwd, "apps/cli/src/cli.ts"),
|
|
9455
|
+
path17.join(cwd, "apps/cli/dist/cli.js")
|
|
9400
9456
|
];
|
|
9401
9457
|
for (const c4 of candidates) {
|
|
9402
|
-
if (
|
|
9458
|
+
if (existsSync12(c4)) {
|
|
9403
9459
|
return { binPath: "bun", args: [c4] };
|
|
9404
9460
|
}
|
|
9405
9461
|
}
|
|
9406
|
-
const currentDir = typeof __dirname !== "undefined" ? __dirname :
|
|
9407
|
-
const fromSrc =
|
|
9408
|
-
const fromDist =
|
|
9409
|
-
if (
|
|
9410
|
-
if (
|
|
9462
|
+
const currentDir = typeof __dirname !== "undefined" ? __dirname : path17.dirname(fileURLToPath2(import.meta.url));
|
|
9463
|
+
const fromSrc = path17.resolve(currentDir, "../../cli.ts");
|
|
9464
|
+
const fromDist = path17.resolve(currentDir, "cli.js");
|
|
9465
|
+
if (existsSync12(fromSrc)) return { binPath: "bun", args: [fromSrc] };
|
|
9466
|
+
if (existsSync12(fromDist)) return { binPath: "bun", args: [fromDist] };
|
|
9411
9467
|
if (isCommandAvailable("agentv")) {
|
|
9412
9468
|
return { binPath: "agentv", args: [] };
|
|
9413
9469
|
}
|
|
@@ -9415,7 +9471,7 @@ function resolveCliPath(cwd) {
|
|
|
9415
9471
|
}
|
|
9416
9472
|
function isCommandAvailable(cmd) {
|
|
9417
9473
|
try {
|
|
9418
|
-
|
|
9474
|
+
execFileSync2(process.platform === "win32" ? "where" : "which", [cmd], { stdio: "ignore" });
|
|
9419
9475
|
return true;
|
|
9420
9476
|
} catch {
|
|
9421
9477
|
return false;
|
|
@@ -9470,7 +9526,7 @@ function registerEvalRoutes(app2, getCwd, options) {
|
|
|
9470
9526
|
return c4.json({ error: "Cannot locate agentv CLI entry point" }, 500);
|
|
9471
9527
|
}
|
|
9472
9528
|
const args = buildCliArgs(body);
|
|
9473
|
-
const outputDir = body.output?.trim() ?
|
|
9529
|
+
const outputDir = body.output?.trim() ? path17.resolve(cwd, body.output.trim()) : buildDefaultRunDir(cwd);
|
|
9474
9530
|
if (!body.output?.trim()) {
|
|
9475
9531
|
args.push("--output", outputDir);
|
|
9476
9532
|
}
|
|
@@ -9640,7 +9696,7 @@ Process error: ${err2.message}`;
|
|
|
9640
9696
|
return c4.json({ error: "Cannot locate agentv CLI entry point" }, 500);
|
|
9641
9697
|
}
|
|
9642
9698
|
const args = buildCliArgs(body);
|
|
9643
|
-
const outputDir = body.output?.trim() ?
|
|
9699
|
+
const outputDir = body.output?.trim() ? path17.resolve(cwd, body.output.trim()) : buildDefaultRunDir(cwd);
|
|
9644
9700
|
if (!body.output?.trim()) {
|
|
9645
9701
|
args.push("--output", outputDir);
|
|
9646
9702
|
}
|
|
@@ -9754,17 +9810,17 @@ Process error: ${err2.message}`;
|
|
|
9754
9810
|
}
|
|
9755
9811
|
|
|
9756
9812
|
// src/commands/results/run-tags.ts
|
|
9757
|
-
import { existsSync as
|
|
9758
|
-
import
|
|
9813
|
+
import { existsSync as existsSync13, readFileSync as readFileSync10, unlinkSync as unlinkSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
9814
|
+
import path18 from "node:path";
|
|
9759
9815
|
var RUN_TAGS_FILENAME = "tags.json";
|
|
9760
9816
|
var MAX_TAGS_PER_RUN = 20;
|
|
9761
9817
|
var MAX_TAG_LENGTH = 60;
|
|
9762
9818
|
function runTagsPath(manifestPath) {
|
|
9763
|
-
return
|
|
9819
|
+
return path18.join(path18.dirname(manifestPath), RUN_TAGS_FILENAME);
|
|
9764
9820
|
}
|
|
9765
9821
|
function readRunTags(manifestPath) {
|
|
9766
9822
|
const fp = runTagsPath(manifestPath);
|
|
9767
|
-
if (!
|
|
9823
|
+
if (!existsSync13(fp)) return void 0;
|
|
9768
9824
|
try {
|
|
9769
9825
|
const parsed = JSON.parse(readFileSync10(fp, "utf8"));
|
|
9770
9826
|
if (!parsed || typeof parsed !== "object") return void 0;
|
|
@@ -9798,7 +9854,7 @@ function writeRunTags(manifestPath, tags) {
|
|
|
9798
9854
|
}
|
|
9799
9855
|
function deleteRunTags(manifestPath) {
|
|
9800
9856
|
const fp = runTagsPath(manifestPath);
|
|
9801
|
-
if (
|
|
9857
|
+
if (existsSync13(fp)) {
|
|
9802
9858
|
unlinkSync2(fp);
|
|
9803
9859
|
}
|
|
9804
9860
|
}
|
|
@@ -9831,15 +9887,15 @@ function normalizeTags(tags) {
|
|
|
9831
9887
|
}
|
|
9832
9888
|
|
|
9833
9889
|
// src/commands/results/studio-config.ts
|
|
9834
|
-
import { existsSync as
|
|
9835
|
-
import
|
|
9890
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync3, readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "node:fs";
|
|
9891
|
+
import path19 from "node:path";
|
|
9836
9892
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
9837
9893
|
var DEFAULTS = {
|
|
9838
9894
|
threshold: DEFAULT_THRESHOLD
|
|
9839
9895
|
};
|
|
9840
9896
|
function loadStudioConfig(agentvDir) {
|
|
9841
|
-
const configPath =
|
|
9842
|
-
if (!
|
|
9897
|
+
const configPath = path19.join(agentvDir, "config.yaml");
|
|
9898
|
+
if (!existsSync14(configPath)) {
|
|
9843
9899
|
return { ...DEFAULTS };
|
|
9844
9900
|
}
|
|
9845
9901
|
const raw = readFileSync11(configPath, "utf-8");
|
|
@@ -9864,12 +9920,12 @@ function loadStudioConfig(agentvDir) {
|
|
|
9864
9920
|
};
|
|
9865
9921
|
}
|
|
9866
9922
|
function saveStudioConfig(agentvDir, config) {
|
|
9867
|
-
if (!
|
|
9923
|
+
if (!existsSync14(agentvDir)) {
|
|
9868
9924
|
mkdirSync3(agentvDir, { recursive: true });
|
|
9869
9925
|
}
|
|
9870
|
-
const configPath =
|
|
9926
|
+
const configPath = path19.join(agentvDir, "config.yaml");
|
|
9871
9927
|
let existing = {};
|
|
9872
|
-
if (
|
|
9928
|
+
if (existsSync14(configPath)) {
|
|
9873
9929
|
const raw = readFileSync11(configPath, "utf-8");
|
|
9874
9930
|
const parsed = parseYamlValue(raw);
|
|
9875
9931
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
@@ -9893,7 +9949,7 @@ function saveStudioConfig(agentvDir, config) {
|
|
|
9893
9949
|
async function resolveSourceFile2(source, cwd) {
|
|
9894
9950
|
if (source) {
|
|
9895
9951
|
let resolved = resolveResultSourcePath(source, cwd);
|
|
9896
|
-
if (!
|
|
9952
|
+
if (!existsSync15(resolved)) {
|
|
9897
9953
|
throw new Error(`Source file not found: ${resolved}`);
|
|
9898
9954
|
}
|
|
9899
9955
|
resolved = resolveRunManifestPath(resolved);
|
|
@@ -9901,7 +9957,7 @@ async function resolveSourceFile2(source, cwd) {
|
|
|
9901
9957
|
}
|
|
9902
9958
|
const cache = await loadRunCache(cwd);
|
|
9903
9959
|
const cachedFile = cache ? resolveRunCacheFile(cache) : "";
|
|
9904
|
-
if (cachedFile &&
|
|
9960
|
+
if (cachedFile && existsSync15(cachedFile)) {
|
|
9905
9961
|
return cachedFile;
|
|
9906
9962
|
}
|
|
9907
9963
|
const metas = listResultFiles(cwd, 10);
|
|
@@ -9931,11 +9987,11 @@ function resolveDashboardMode(benchmarkCount, options) {
|
|
|
9931
9987
|
return { isMultiBenchmark: benchmarkCount > 1, showMultiWarning: false };
|
|
9932
9988
|
}
|
|
9933
9989
|
function feedbackPath(resultDir) {
|
|
9934
|
-
return
|
|
9990
|
+
return path20.join(resultDir, "feedback.json");
|
|
9935
9991
|
}
|
|
9936
9992
|
function readFeedback(cwd) {
|
|
9937
9993
|
const fp = feedbackPath(cwd);
|
|
9938
|
-
if (!
|
|
9994
|
+
if (!existsSync15(fp)) {
|
|
9939
9995
|
return { reviews: [] };
|
|
9940
9996
|
}
|
|
9941
9997
|
try {
|
|
@@ -9950,7 +10006,7 @@ function writeFeedback(cwd, data) {
|
|
|
9950
10006
|
`, "utf8");
|
|
9951
10007
|
}
|
|
9952
10008
|
function buildFileTree(dirPath, relativeTo) {
|
|
9953
|
-
if (!
|
|
10009
|
+
if (!existsSync15(dirPath) || !statSync5(dirPath).isDirectory()) {
|
|
9954
10010
|
return [];
|
|
9955
10011
|
}
|
|
9956
10012
|
const entries2 = readdirSync4(dirPath, { withFileTypes: true });
|
|
@@ -9958,8 +10014,8 @@ function buildFileTree(dirPath, relativeTo) {
|
|
|
9958
10014
|
if (a.isDirectory() !== b.isDirectory()) return a.isDirectory() ? -1 : 1;
|
|
9959
10015
|
return a.name.localeCompare(b.name);
|
|
9960
10016
|
}).map((entry) => {
|
|
9961
|
-
const fullPath =
|
|
9962
|
-
const relPath =
|
|
10017
|
+
const fullPath = path20.join(dirPath, entry.name);
|
|
10018
|
+
const relPath = path20.relative(relativeTo, fullPath);
|
|
9963
10019
|
if (entry.isDirectory()) {
|
|
9964
10020
|
return {
|
|
9965
10021
|
name: entry.name,
|
|
@@ -9972,7 +10028,7 @@ function buildFileTree(dirPath, relativeTo) {
|
|
|
9972
10028
|
});
|
|
9973
10029
|
}
|
|
9974
10030
|
function inferLanguage(filePath) {
|
|
9975
|
-
const ext =
|
|
10031
|
+
const ext = path20.extname(filePath).toLowerCase();
|
|
9976
10032
|
const langMap = {
|
|
9977
10033
|
".json": "json",
|
|
9978
10034
|
".jsonl": "json",
|
|
@@ -10077,12 +10133,12 @@ async function handleRunDetail(c4, { searchDir }) {
|
|
|
10077
10133
|
}
|
|
10078
10134
|
function deriveResumeMeta(cwd, manifestPath) {
|
|
10079
10135
|
const out = {};
|
|
10080
|
-
const runDir =
|
|
10081
|
-
const relative3 =
|
|
10136
|
+
const runDir = path20.dirname(manifestPath);
|
|
10137
|
+
const relative3 = path20.relative(cwd, runDir);
|
|
10082
10138
|
out.run_dir = relative3 !== "" && !relative3.startsWith("..") ? relative3 : runDir;
|
|
10083
10139
|
try {
|
|
10084
|
-
const benchmarkPath =
|
|
10085
|
-
if (
|
|
10140
|
+
const benchmarkPath = path20.join(runDir, "benchmark.json");
|
|
10141
|
+
if (existsSync15(benchmarkPath)) {
|
|
10086
10142
|
const parsed = JSON.parse(readFileSync12(benchmarkPath, "utf8"));
|
|
10087
10143
|
const evalFile = parsed.metadata?.eval_file;
|
|
10088
10144
|
if (typeof evalFile === "string" && evalFile.trim()) {
|
|
@@ -10214,7 +10270,7 @@ async function handleEvalFiles(c4, { searchDir }) {
|
|
|
10214
10270
|
const records = parseResultManifest(content);
|
|
10215
10271
|
const record = records.find((r) => r.test_id === evalId);
|
|
10216
10272
|
if (!record) return c4.json({ error: "Eval not found" }, 404);
|
|
10217
|
-
const baseDir =
|
|
10273
|
+
const baseDir = path20.dirname(meta.path);
|
|
10218
10274
|
const knownPaths = [
|
|
10219
10275
|
record.grading_path,
|
|
10220
10276
|
record.timing_path,
|
|
@@ -10223,14 +10279,14 @@ async function handleEvalFiles(c4, { searchDir }) {
|
|
|
10223
10279
|
record.response_path
|
|
10224
10280
|
].filter((p) => !!p);
|
|
10225
10281
|
if (knownPaths.length === 0) return c4.json({ files: [] });
|
|
10226
|
-
const artifactDirs = knownPaths.map((p) =>
|
|
10282
|
+
const artifactDirs = knownPaths.map((p) => path20.dirname(p));
|
|
10227
10283
|
let commonDir = artifactDirs[0];
|
|
10228
10284
|
for (const dir of artifactDirs) {
|
|
10229
10285
|
while (!dir.startsWith(commonDir)) {
|
|
10230
|
-
commonDir =
|
|
10286
|
+
commonDir = path20.dirname(commonDir);
|
|
10231
10287
|
}
|
|
10232
10288
|
}
|
|
10233
|
-
const artifactAbsDir =
|
|
10289
|
+
const artifactAbsDir = path20.join(baseDir, commonDir);
|
|
10234
10290
|
const files = buildFileTree(artifactAbsDir, baseDir);
|
|
10235
10291
|
return c4.json({ files });
|
|
10236
10292
|
} catch {
|
|
@@ -10245,12 +10301,12 @@ async function handleEvalFileContent(c4, { searchDir }) {
|
|
|
10245
10301
|
const markerIdx = c4.req.path.indexOf(marker);
|
|
10246
10302
|
const filePath = markerIdx >= 0 ? c4.req.path.slice(markerIdx + marker.length) : "";
|
|
10247
10303
|
if (!filePath) return c4.json({ error: "No file path specified" }, 400);
|
|
10248
|
-
const baseDir =
|
|
10249
|
-
const absolutePath =
|
|
10250
|
-
if (!absolutePath.startsWith(
|
|
10304
|
+
const baseDir = path20.dirname(meta.path);
|
|
10305
|
+
const absolutePath = path20.resolve(baseDir, filePath);
|
|
10306
|
+
if (!absolutePath.startsWith(path20.resolve(baseDir) + path20.sep) && absolutePath !== path20.resolve(baseDir)) {
|
|
10251
10307
|
return c4.json({ error: "Path traversal not allowed" }, 403);
|
|
10252
10308
|
}
|
|
10253
|
-
if (!
|
|
10309
|
+
if (!existsSync15(absolutePath) || !statSync5(absolutePath).isFile()) {
|
|
10254
10310
|
return c4.json({ error: "File not found" }, 404);
|
|
10255
10311
|
}
|
|
10256
10312
|
try {
|
|
@@ -10467,13 +10523,13 @@ function handleConfig(c4, { agentvDir, searchDir }, options) {
|
|
|
10467
10523
|
return c4.json({
|
|
10468
10524
|
...loadStudioConfig(agentvDir),
|
|
10469
10525
|
read_only: options?.readOnly === true,
|
|
10470
|
-
benchmark_name:
|
|
10526
|
+
benchmark_name: path20.basename(searchDir),
|
|
10471
10527
|
multi_benchmark_dashboard: options?.multiBenchmarkDashboard === true
|
|
10472
10528
|
});
|
|
10473
10529
|
}
|
|
10474
10530
|
function handleFeedbackRead(c4, { searchDir }) {
|
|
10475
|
-
const resultsDir =
|
|
10476
|
-
return c4.json(readFeedback(
|
|
10531
|
+
const resultsDir = path20.join(searchDir, ".agentv", "results");
|
|
10532
|
+
return c4.json(readFeedback(existsSync15(resultsDir) ? resultsDir : searchDir));
|
|
10477
10533
|
}
|
|
10478
10534
|
async function handleRunTagsPut(c4, { searchDir }) {
|
|
10479
10535
|
const filename = c4.req.param("filename") ?? "";
|
|
@@ -10521,18 +10577,18 @@ async function handleRunTagsDelete(c4, { searchDir }) {
|
|
|
10521
10577
|
}
|
|
10522
10578
|
function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
10523
10579
|
const searchDir = cwd ?? resultDir;
|
|
10524
|
-
const agentvDir =
|
|
10580
|
+
const agentvDir = path20.join(searchDir, ".agentv");
|
|
10525
10581
|
const defaultCtx = { searchDir, agentvDir };
|
|
10526
10582
|
const readOnly = options?.readOnly === true;
|
|
10527
10583
|
const app2 = new Hono();
|
|
10528
10584
|
function withBenchmark(c4, handler) {
|
|
10529
10585
|
const benchmark = getBenchmark(c4.req.param("benchmarkId") ?? "");
|
|
10530
|
-
if (!benchmark || !
|
|
10586
|
+
if (!benchmark || !existsSync15(benchmark.path)) {
|
|
10531
10587
|
return c4.json({ error: "Benchmark not found" }, 404);
|
|
10532
10588
|
}
|
|
10533
10589
|
return handler(c4, {
|
|
10534
10590
|
searchDir: benchmark.path,
|
|
10535
|
-
agentvDir:
|
|
10591
|
+
agentvDir: path20.join(benchmark.path, ".agentv")
|
|
10536
10592
|
});
|
|
10537
10593
|
}
|
|
10538
10594
|
app2.post("/api/config", async (c4) => {
|
|
@@ -10845,20 +10901,20 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
10845
10901
|
{ readOnly }
|
|
10846
10902
|
);
|
|
10847
10903
|
const studioDistPath = options?.studioDir ?? resolveStudioDistDir();
|
|
10848
|
-
if (!studioDistPath || !
|
|
10904
|
+
if (!studioDistPath || !existsSync15(path20.join(studioDistPath, "index.html"))) {
|
|
10849
10905
|
throw new Error('Studio dist not found. Run "bun run build" in apps/studio/ to build the SPA.');
|
|
10850
10906
|
}
|
|
10851
10907
|
app2.get("/", (c4) => {
|
|
10852
|
-
const indexPath =
|
|
10853
|
-
if (
|
|
10908
|
+
const indexPath = path20.join(studioDistPath, "index.html");
|
|
10909
|
+
if (existsSync15(indexPath)) return c4.html(readFileSync12(indexPath, "utf8"));
|
|
10854
10910
|
return c4.notFound();
|
|
10855
10911
|
});
|
|
10856
10912
|
app2.get("/assets/*", (c4) => {
|
|
10857
10913
|
const assetPath = c4.req.path;
|
|
10858
|
-
const filePath =
|
|
10859
|
-
if (!
|
|
10914
|
+
const filePath = path20.join(studioDistPath, assetPath);
|
|
10915
|
+
if (!existsSync15(filePath)) return c4.notFound();
|
|
10860
10916
|
const content = readFileSync12(filePath);
|
|
10861
|
-
const ext =
|
|
10917
|
+
const ext = path20.extname(filePath);
|
|
10862
10918
|
const mimeTypes = {
|
|
10863
10919
|
".js": "application/javascript",
|
|
10864
10920
|
".css": "text/css",
|
|
@@ -10879,26 +10935,26 @@ function createApp(results, resultDir, cwd, sourceFile, options) {
|
|
|
10879
10935
|
});
|
|
10880
10936
|
app2.get("*", (c4) => {
|
|
10881
10937
|
if (c4.req.path.startsWith("/api/")) return c4.json({ error: "Not found" }, 404);
|
|
10882
|
-
const indexPath =
|
|
10883
|
-
if (
|
|
10938
|
+
const indexPath = path20.join(studioDistPath, "index.html");
|
|
10939
|
+
if (existsSync15(indexPath)) return c4.html(readFileSync12(indexPath, "utf8"));
|
|
10884
10940
|
return c4.notFound();
|
|
10885
10941
|
});
|
|
10886
10942
|
return app2;
|
|
10887
10943
|
}
|
|
10888
10944
|
function resolveStudioDistDir() {
|
|
10889
|
-
const currentDir = typeof __dirname !== "undefined" ? __dirname :
|
|
10945
|
+
const currentDir = typeof __dirname !== "undefined" ? __dirname : path20.dirname(fileURLToPath3(import.meta.url));
|
|
10890
10946
|
const candidates = [
|
|
10891
10947
|
// From src/commands/results/ → sibling apps/studio/dist
|
|
10892
|
-
|
|
10948
|
+
path20.resolve(currentDir, "../../../../studio/dist"),
|
|
10893
10949
|
// From dist/ → sibling apps/studio/dist (monorepo dev)
|
|
10894
|
-
|
|
10950
|
+
path20.resolve(currentDir, "../../studio/dist"),
|
|
10895
10951
|
// Bundled inside CLI dist (published package: dist/studio/)
|
|
10896
|
-
|
|
10952
|
+
path20.resolve(currentDir, "studio"),
|
|
10897
10953
|
// From dist/ in monorepo root context
|
|
10898
|
-
|
|
10954
|
+
path20.resolve(currentDir, "../../../apps/studio/dist")
|
|
10899
10955
|
];
|
|
10900
10956
|
for (const candidate of candidates) {
|
|
10901
|
-
if (
|
|
10957
|
+
if (existsSync15(candidate) && existsSync15(path20.join(candidate, "index.html"))) {
|
|
10902
10958
|
return candidate;
|
|
10903
10959
|
}
|
|
10904
10960
|
}
|
|
@@ -10972,7 +11028,7 @@ var resultsServeCommand = command({
|
|
|
10972
11028
|
return;
|
|
10973
11029
|
}
|
|
10974
11030
|
const repoRoot = await findRepoRoot(cwd);
|
|
10975
|
-
const yamlConfig = await loadConfig(
|
|
11031
|
+
const yamlConfig = await loadConfig(path20.join(cwd, "_"), repoRoot);
|
|
10976
11032
|
if (yamlConfig?.required_version) {
|
|
10977
11033
|
await enforceRequiredVersion(yamlConfig.required_version);
|
|
10978
11034
|
}
|
|
@@ -10981,6 +11037,7 @@ var resultsServeCommand = command({
|
|
|
10981
11037
|
registry.benchmarks.length,
|
|
10982
11038
|
{ multi, single }
|
|
10983
11039
|
);
|
|
11040
|
+
await syncBenchmarks(registry.benchmarks);
|
|
10984
11041
|
try {
|
|
10985
11042
|
let results = [];
|
|
10986
11043
|
let sourceFile;
|
|
@@ -10990,7 +11047,7 @@ var resultsServeCommand = command({
|
|
|
10990
11047
|
} else {
|
|
10991
11048
|
const cache = await loadRunCache(cwd);
|
|
10992
11049
|
const cachedFile = cache ? resolveRunCacheFile(cache) : "";
|
|
10993
|
-
if (cachedFile &&
|
|
11050
|
+
if (cachedFile && existsSync15(cachedFile)) {
|
|
10994
11051
|
sourceFile = cachedFile;
|
|
10995
11052
|
results = loadManifestResults(cachedFile);
|
|
10996
11053
|
} else {
|
|
@@ -11001,7 +11058,7 @@ var resultsServeCommand = command({
|
|
|
11001
11058
|
}
|
|
11002
11059
|
}
|
|
11003
11060
|
}
|
|
11004
|
-
const resultDir = sourceFile ?
|
|
11061
|
+
const resultDir = sourceFile ? path20.dirname(path20.resolve(sourceFile)) : cwd;
|
|
11005
11062
|
const app2 = createApp(results, resultDir, cwd, sourceFile, {
|
|
11006
11063
|
readOnly,
|
|
11007
11064
|
multiBenchmarkDashboard: isMultiBenchmark
|
|
@@ -11095,14 +11152,14 @@ var selfCommand = subcommands({
|
|
|
11095
11152
|
});
|
|
11096
11153
|
|
|
11097
11154
|
// src/commands/skills/index.ts
|
|
11098
|
-
import { existsSync as
|
|
11099
|
-
import
|
|
11155
|
+
import { existsSync as existsSync16, readFileSync as readFileSync13, readdirSync as readdirSync5 } from "node:fs";
|
|
11156
|
+
import path21 from "node:path";
|
|
11100
11157
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
11101
11158
|
function isValidSkillsDir(dir) {
|
|
11102
|
-
if (!
|
|
11159
|
+
if (!existsSync16(dir)) return false;
|
|
11103
11160
|
try {
|
|
11104
11161
|
return readdirSync5(dir, { withFileTypes: true }).some(
|
|
11105
|
-
(e) => e.isDirectory() &&
|
|
11162
|
+
(e) => e.isDirectory() && existsSync16(path21.join(dir, e.name, "SKILL.md"))
|
|
11106
11163
|
);
|
|
11107
11164
|
} catch {
|
|
11108
11165
|
return false;
|
|
@@ -11110,15 +11167,15 @@ function isValidSkillsDir(dir) {
|
|
|
11110
11167
|
}
|
|
11111
11168
|
function findSkillsDir() {
|
|
11112
11169
|
const selfFile = fileURLToPath4(import.meta.url);
|
|
11113
|
-
let dir =
|
|
11170
|
+
let dir = path21.dirname(selfFile);
|
|
11114
11171
|
for (let i = 0; i < 6; i++) {
|
|
11115
|
-
const distCandidate =
|
|
11172
|
+
const distCandidate = path21.join(dir, "dist", "skills");
|
|
11116
11173
|
if (isValidSkillsDir(distCandidate)) return distCandidate;
|
|
11117
|
-
const repoRootCandidate =
|
|
11174
|
+
const repoRootCandidate = path21.join(dir, "skills-data");
|
|
11118
11175
|
if (isValidSkillsDir(repoRootCandidate)) return repoRootCandidate;
|
|
11119
|
-
const legacyCandidate =
|
|
11176
|
+
const legacyCandidate = path21.join(dir, "skills");
|
|
11120
11177
|
if (isValidSkillsDir(legacyCandidate)) return legacyCandidate;
|
|
11121
|
-
dir =
|
|
11178
|
+
dir = path21.dirname(dir);
|
|
11122
11179
|
}
|
|
11123
11180
|
return null;
|
|
11124
11181
|
}
|
|
@@ -11133,40 +11190,40 @@ function requireSkillsDir() {
|
|
|
11133
11190
|
return dir;
|
|
11134
11191
|
}
|
|
11135
11192
|
function listSkillNames(skillsDir) {
|
|
11136
|
-
if (!
|
|
11193
|
+
if (!existsSync16(skillsDir)) return [];
|
|
11137
11194
|
return readdirSync5(skillsDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
11138
11195
|
}
|
|
11139
11196
|
function readSkillFile(skillDir, relPath) {
|
|
11140
|
-
const full =
|
|
11141
|
-
if (!
|
|
11197
|
+
const full = path21.join(skillDir, relPath);
|
|
11198
|
+
if (!existsSync16(full)) return null;
|
|
11142
11199
|
return readFileSync13(full, "utf-8");
|
|
11143
11200
|
}
|
|
11144
11201
|
function collectDir(dir, prefix = "") {
|
|
11145
11202
|
const result = {};
|
|
11146
|
-
if (!
|
|
11203
|
+
if (!existsSync16(dir)) return result;
|
|
11147
11204
|
for (const entry of readdirSync5(dir, { withFileTypes: true })) {
|
|
11148
11205
|
const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
11149
11206
|
if (entry.isDirectory()) {
|
|
11150
|
-
Object.assign(result, collectDir(
|
|
11207
|
+
Object.assign(result, collectDir(path21.join(dir, entry.name), relPath));
|
|
11151
11208
|
} else {
|
|
11152
|
-
result[relPath] = readFileSync13(
|
|
11209
|
+
result[relPath] = readFileSync13(path21.join(dir, entry.name), "utf-8");
|
|
11153
11210
|
}
|
|
11154
11211
|
}
|
|
11155
11212
|
return result;
|
|
11156
11213
|
}
|
|
11157
11214
|
function listSkillSubdirs(skillDir) {
|
|
11158
|
-
if (!
|
|
11215
|
+
if (!existsSync16(skillDir)) return [];
|
|
11159
11216
|
return readdirSync5(skillDir, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
11160
11217
|
}
|
|
11161
11218
|
function readSkill(skillsDir, name, full) {
|
|
11162
|
-
const skillDir =
|
|
11163
|
-
if (!
|
|
11219
|
+
const skillDir = path21.join(skillsDir, name);
|
|
11220
|
+
if (!existsSync16(skillDir)) return null;
|
|
11164
11221
|
const content = readSkillFile(skillDir, "SKILL.md");
|
|
11165
11222
|
if (content === null) return null;
|
|
11166
11223
|
if (!full) return { name, content };
|
|
11167
11224
|
const files = {};
|
|
11168
11225
|
for (const sub of listSkillSubdirs(skillDir)) {
|
|
11169
|
-
const subDir =
|
|
11226
|
+
const subDir = path21.join(skillDir, sub);
|
|
11170
11227
|
const collected = collectDir(subDir, sub);
|
|
11171
11228
|
Object.assign(files, collected);
|
|
11172
11229
|
}
|
|
@@ -11176,15 +11233,15 @@ function findRefFile(skillDir, refName) {
|
|
|
11176
11233
|
const candidates = refName.endsWith(".md") ? [refName] : [refName, `${refName}.md`];
|
|
11177
11234
|
for (const sub of listSkillSubdirs(skillDir)) {
|
|
11178
11235
|
for (const candidate of candidates) {
|
|
11179
|
-
const filePath =
|
|
11180
|
-
if (
|
|
11236
|
+
const filePath = path21.join(skillDir, sub, candidate);
|
|
11237
|
+
if (existsSync16(filePath)) {
|
|
11181
11238
|
return { relPath: `${sub}/${candidate}`, content: readFileSync13(filePath, "utf-8") };
|
|
11182
11239
|
}
|
|
11183
11240
|
}
|
|
11184
11241
|
}
|
|
11185
11242
|
for (const candidate of candidates) {
|
|
11186
|
-
const filePath =
|
|
11187
|
-
if (
|
|
11243
|
+
const filePath = path21.join(skillDir, candidate);
|
|
11244
|
+
if (existsSync16(filePath)) {
|
|
11188
11245
|
return { relPath: candidate, content: readFileSync13(filePath, "utf-8") };
|
|
11189
11246
|
}
|
|
11190
11247
|
}
|
|
@@ -11193,7 +11250,7 @@ function findRefFile(skillDir, refName) {
|
|
|
11193
11250
|
function listRefFiles(skillDir) {
|
|
11194
11251
|
const out = [];
|
|
11195
11252
|
for (const sub of listSkillSubdirs(skillDir)) {
|
|
11196
|
-
const subDir =
|
|
11253
|
+
const subDir = path21.join(skillDir, sub);
|
|
11197
11254
|
for (const entry of readdirSync5(subDir, { withFileTypes: true })) {
|
|
11198
11255
|
if (entry.isFile()) out.push(`${sub}/${entry.name}`);
|
|
11199
11256
|
}
|
|
@@ -11277,8 +11334,8 @@ var skillsGetCommand = command({
|
|
|
11277
11334
|
}
|
|
11278
11335
|
process.exit(1);
|
|
11279
11336
|
}
|
|
11280
|
-
const skillDir =
|
|
11281
|
-
if (!
|
|
11337
|
+
const skillDir = path21.join(skillsDir, name);
|
|
11338
|
+
if (!existsSync16(skillDir)) {
|
|
11282
11339
|
const msg = `skill '${name}' not found`;
|
|
11283
11340
|
if (json) {
|
|
11284
11341
|
process.stdout.write(`${JSON.stringify({ success: false, error: msg })}
|
|
@@ -11366,8 +11423,8 @@ var skillsPathCommand = command({
|
|
|
11366
11423
|
handler: ({ name }) => {
|
|
11367
11424
|
const skillsDir = requireSkillsDir();
|
|
11368
11425
|
if (name) {
|
|
11369
|
-
const skillDir =
|
|
11370
|
-
if (!
|
|
11426
|
+
const skillDir = path21.join(skillsDir, name);
|
|
11427
|
+
if (!existsSync16(skillDir)) {
|
|
11371
11428
|
console.error(`Error: skill '${name}' not found`);
|
|
11372
11429
|
process.exit(1);
|
|
11373
11430
|
}
|
|
@@ -11389,7 +11446,7 @@ var skillsCommand = subcommands({
|
|
|
11389
11446
|
|
|
11390
11447
|
// src/commands/transpile/index.ts
|
|
11391
11448
|
import { writeFileSync as writeFileSync7 } from "node:fs";
|
|
11392
|
-
import
|
|
11449
|
+
import path22 from "node:path";
|
|
11393
11450
|
var transpileCommand = command({
|
|
11394
11451
|
name: "transpile",
|
|
11395
11452
|
description: "Convert an EVAL.yaml file to Agent Skills evals.json format",
|
|
@@ -11413,7 +11470,7 @@ var transpileCommand = command({
|
|
|
11413
11470
|
handler: async ({ input, outDir, stdout }) => {
|
|
11414
11471
|
let result;
|
|
11415
11472
|
try {
|
|
11416
|
-
result = transpileEvalYamlFile(
|
|
11473
|
+
result = transpileEvalYamlFile(path22.resolve(input));
|
|
11417
11474
|
} catch (error) {
|
|
11418
11475
|
console.error(`Error: ${error.message}`);
|
|
11419
11476
|
process.exit(1);
|
|
@@ -11437,11 +11494,11 @@ var transpileCommand = command({
|
|
|
11437
11494
|
process.stdout.write("\n");
|
|
11438
11495
|
return;
|
|
11439
11496
|
}
|
|
11440
|
-
const outputDir = outDir ?
|
|
11497
|
+
const outputDir = outDir ? path22.resolve(outDir) : path22.dirname(path22.resolve(input));
|
|
11441
11498
|
const fileNames = getOutputFilenames(result);
|
|
11442
11499
|
for (const [skill, evalsJson] of result.files) {
|
|
11443
11500
|
const fileName = fileNames.get(skill) ?? "evals.json";
|
|
11444
|
-
const outputPath =
|
|
11501
|
+
const outputPath = path22.join(outputDir, fileName);
|
|
11445
11502
|
writeFileSync7(outputPath, `${JSON.stringify(evalsJson, null, 2)}
|
|
11446
11503
|
`);
|
|
11447
11504
|
console.log(`Transpiled to ${outputPath}`);
|
|
@@ -11450,7 +11507,7 @@ var transpileCommand = command({
|
|
|
11450
11507
|
});
|
|
11451
11508
|
|
|
11452
11509
|
// src/commands/trend/index.ts
|
|
11453
|
-
import
|
|
11510
|
+
import path23 from "node:path";
|
|
11454
11511
|
var colors2 = {
|
|
11455
11512
|
reset: "\x1B[0m",
|
|
11456
11513
|
bold: "\x1B[1m",
|
|
@@ -11500,7 +11557,7 @@ function colorizeSlope(value) {
|
|
|
11500
11557
|
}
|
|
11501
11558
|
function ensureTrendIndexPath(source, cwd) {
|
|
11502
11559
|
const resolved = resolveResultSourcePath(source, cwd);
|
|
11503
|
-
if (
|
|
11560
|
+
if (path23.basename(resolved) !== RESULT_INDEX_FILENAME) {
|
|
11504
11561
|
throw new Error(
|
|
11505
11562
|
`Unsupported result source for trend: ${source}. Use a run workspace directory or ${RESULT_INDEX_FILENAME} manifest.`
|
|
11506
11563
|
);
|
|
@@ -11520,7 +11577,7 @@ function resolveTrendSources(cwd, sources, last) {
|
|
|
11520
11577
|
if (last < 2) {
|
|
11521
11578
|
throw new Error("--last must be at least 2");
|
|
11522
11579
|
}
|
|
11523
|
-
const metas = listResultFiles(cwd).filter((meta) =>
|
|
11580
|
+
const metas = listResultFiles(cwd).filter((meta) => path23.basename(meta.path) === RESULT_INDEX_FILENAME).slice(0, last);
|
|
11524
11581
|
if (metas.length < 2) {
|
|
11525
11582
|
throw new Error(
|
|
11526
11583
|
"Trend analysis requires at least 2 canonical run workspaces in .agentv/results/runs/"
|
|
@@ -11535,10 +11592,10 @@ function getRunLabel(sourcePath, timestamp) {
|
|
|
11535
11592
|
if (timestamp) {
|
|
11536
11593
|
return timestamp;
|
|
11537
11594
|
}
|
|
11538
|
-
return
|
|
11595
|
+
return path23.basename(path23.dirname(sourcePath));
|
|
11539
11596
|
}
|
|
11540
11597
|
function getRunSortKey(sourcePath, timestamp) {
|
|
11541
|
-
return timestamp ??
|
|
11598
|
+
return timestamp ?? path23.basename(path23.dirname(sourcePath));
|
|
11542
11599
|
}
|
|
11543
11600
|
function mean2(values) {
|
|
11544
11601
|
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
@@ -11919,7 +11976,7 @@ function isTTY() {
|
|
|
11919
11976
|
// src/commands/validate/validate-files.ts
|
|
11920
11977
|
import { constants } from "node:fs";
|
|
11921
11978
|
import { access, readdir as readdir4, stat } from "node:fs/promises";
|
|
11922
|
-
import
|
|
11979
|
+
import path24 from "node:path";
|
|
11923
11980
|
import fg2 from "fast-glob";
|
|
11924
11981
|
async function validateFiles(paths) {
|
|
11925
11982
|
const filePaths = await expandPaths(paths);
|
|
@@ -11934,7 +11991,7 @@ async function validateFiles(paths) {
|
|
|
11934
11991
|
};
|
|
11935
11992
|
}
|
|
11936
11993
|
async function validateSingleFile(filePath) {
|
|
11937
|
-
const absolutePath =
|
|
11994
|
+
const absolutePath = path24.resolve(filePath);
|
|
11938
11995
|
const fileType = await detectFileType(absolutePath);
|
|
11939
11996
|
let result;
|
|
11940
11997
|
if (fileType === "eval") {
|
|
@@ -11978,7 +12035,7 @@ async function validateSingleFile(filePath) {
|
|
|
11978
12035
|
async function expandPaths(paths) {
|
|
11979
12036
|
const expanded = /* @__PURE__ */ new Set();
|
|
11980
12037
|
for (const inputPath of paths) {
|
|
11981
|
-
const absolutePath =
|
|
12038
|
+
const absolutePath = path24.resolve(inputPath);
|
|
11982
12039
|
try {
|
|
11983
12040
|
await access(absolutePath, constants.F_OK);
|
|
11984
12041
|
const stats = await stat(absolutePath);
|
|
@@ -12006,7 +12063,7 @@ async function expandPaths(paths) {
|
|
|
12006
12063
|
if (yamlMatches.length === 0) {
|
|
12007
12064
|
console.warn(`Warning: No YAML files matched pattern: ${inputPath}`);
|
|
12008
12065
|
}
|
|
12009
|
-
for (const f of yamlMatches) expanded.add(
|
|
12066
|
+
for (const f of yamlMatches) expanded.add(path24.normalize(f));
|
|
12010
12067
|
}
|
|
12011
12068
|
const sorted = Array.from(expanded);
|
|
12012
12069
|
sorted.sort();
|
|
@@ -12017,7 +12074,7 @@ async function findYamlFiles(dirPath) {
|
|
|
12017
12074
|
try {
|
|
12018
12075
|
const entries2 = await readdir4(dirPath, { withFileTypes: true });
|
|
12019
12076
|
for (const entry of entries2) {
|
|
12020
|
-
const fullPath =
|
|
12077
|
+
const fullPath = path24.join(dirPath, entry.name);
|
|
12021
12078
|
if (entry.isDirectory()) {
|
|
12022
12079
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
12023
12080
|
continue;
|
|
@@ -12034,11 +12091,11 @@ async function findYamlFiles(dirPath) {
|
|
|
12034
12091
|
return results;
|
|
12035
12092
|
}
|
|
12036
12093
|
function isYamlFile(filePath) {
|
|
12037
|
-
const ext =
|
|
12094
|
+
const ext = path24.extname(filePath).toLowerCase();
|
|
12038
12095
|
return ext === ".yaml" || ext === ".yml";
|
|
12039
12096
|
}
|
|
12040
12097
|
function isEvalYamlFile(filePath) {
|
|
12041
|
-
const lower =
|
|
12098
|
+
const lower = path24.basename(filePath).toLowerCase();
|
|
12042
12099
|
return lower.endsWith(".eval.yaml") || lower.endsWith(".eval.yml");
|
|
12043
12100
|
}
|
|
12044
12101
|
|
|
@@ -12093,9 +12150,9 @@ var validateCommand = command({
|
|
|
12093
12150
|
});
|
|
12094
12151
|
|
|
12095
12152
|
// src/commands/workspace/clean.ts
|
|
12096
|
-
import { existsSync as
|
|
12153
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
12097
12154
|
import { readFile as readFile6, readdir as readdir5, rm } from "node:fs/promises";
|
|
12098
|
-
import
|
|
12155
|
+
import path25 from "node:path";
|
|
12099
12156
|
async function confirm(message) {
|
|
12100
12157
|
const readline2 = await import("node:readline");
|
|
12101
12158
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -12122,7 +12179,7 @@ var cleanCommand = command({
|
|
|
12122
12179
|
},
|
|
12123
12180
|
handler: async ({ repo, force }) => {
|
|
12124
12181
|
const poolRoot = getWorkspacePoolRoot();
|
|
12125
|
-
if (!
|
|
12182
|
+
if (!existsSync17(poolRoot)) {
|
|
12126
12183
|
console.log("No workspace pool entries found.");
|
|
12127
12184
|
return;
|
|
12128
12185
|
}
|
|
@@ -12131,8 +12188,8 @@ var cleanCommand = command({
|
|
|
12131
12188
|
const poolDirs = entries2.filter((e) => e.isDirectory());
|
|
12132
12189
|
const matchingDirs = [];
|
|
12133
12190
|
for (const dir of poolDirs) {
|
|
12134
|
-
const poolDir =
|
|
12135
|
-
const metadataPath =
|
|
12191
|
+
const poolDir = path25.join(poolRoot, dir.name);
|
|
12192
|
+
const metadataPath = path25.join(poolDir, "metadata.json");
|
|
12136
12193
|
try {
|
|
12137
12194
|
const raw = await readFile6(metadataPath, "utf-8");
|
|
12138
12195
|
const metadata = JSON.parse(raw);
|
|
@@ -12163,7 +12220,7 @@ var cleanCommand = command({
|
|
|
12163
12220
|
}
|
|
12164
12221
|
for (const dir of matchingDirs) {
|
|
12165
12222
|
await rm(dir, { recursive: true, force: true });
|
|
12166
|
-
console.log(`Removed: ${
|
|
12223
|
+
console.log(`Removed: ${path25.basename(dir).slice(0, 12)}...`);
|
|
12167
12224
|
}
|
|
12168
12225
|
console.log("Done.");
|
|
12169
12226
|
} else {
|
|
@@ -12181,7 +12238,7 @@ var cleanCommand = command({
|
|
|
12181
12238
|
});
|
|
12182
12239
|
|
|
12183
12240
|
// src/commands/workspace/deps.ts
|
|
12184
|
-
import
|
|
12241
|
+
import path26 from "node:path";
|
|
12185
12242
|
var depsCommand = command({
|
|
12186
12243
|
name: "deps",
|
|
12187
12244
|
description: "Scan eval files and list git repo dependencies needed by workspaces",
|
|
@@ -12205,7 +12262,7 @@ var depsCommand = command({
|
|
|
12205
12262
|
const resolvedPaths = await resolveEvalPaths(evalPaths, cwd);
|
|
12206
12263
|
const result = await scanRepoDeps(resolvedPaths);
|
|
12207
12264
|
for (const err2 of result.errors) {
|
|
12208
|
-
console.error(`warning: ${
|
|
12265
|
+
console.error(`warning: ${path26.relative(cwd, err2.file)}: ${err2.message}`);
|
|
12209
12266
|
}
|
|
12210
12267
|
const output = {
|
|
12211
12268
|
repos: result.repos.map((r) => ({
|
|
@@ -12213,7 +12270,7 @@ var depsCommand = command({
|
|
|
12213
12270
|
...r.ref !== void 0 && { ref: r.ref },
|
|
12214
12271
|
...r.clone !== void 0 && { clone: r.clone },
|
|
12215
12272
|
...r.checkout !== void 0 && { checkout: r.checkout },
|
|
12216
|
-
...usedBy && { used_by: r.usedBy.map((p) =>
|
|
12273
|
+
...usedBy && { used_by: r.usedBy.map((p) => path26.relative(cwd, p)) }
|
|
12217
12274
|
}))
|
|
12218
12275
|
};
|
|
12219
12276
|
console.log(JSON.stringify(output, null, 2));
|
|
@@ -12221,15 +12278,15 @@ var depsCommand = command({
|
|
|
12221
12278
|
});
|
|
12222
12279
|
|
|
12223
12280
|
// src/commands/workspace/list.ts
|
|
12224
|
-
import { existsSync as
|
|
12281
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
12225
12282
|
import { readFile as readFile7, readdir as readdir6, stat as stat2 } from "node:fs/promises";
|
|
12226
|
-
import
|
|
12283
|
+
import path27 from "node:path";
|
|
12227
12284
|
async function getDirectorySize(dirPath) {
|
|
12228
12285
|
let totalSize = 0;
|
|
12229
12286
|
try {
|
|
12230
12287
|
const entries2 = await readdir6(dirPath, { withFileTypes: true });
|
|
12231
12288
|
for (const entry of entries2) {
|
|
12232
|
-
const fullPath =
|
|
12289
|
+
const fullPath = path27.join(dirPath, entry.name);
|
|
12233
12290
|
if (entry.isDirectory()) {
|
|
12234
12291
|
totalSize += await getDirectorySize(fullPath);
|
|
12235
12292
|
} else {
|
|
@@ -12253,7 +12310,7 @@ var listCommand = command({
|
|
|
12253
12310
|
args: {},
|
|
12254
12311
|
handler: async () => {
|
|
12255
12312
|
const poolRoot = getWorkspacePoolRoot();
|
|
12256
|
-
if (!
|
|
12313
|
+
if (!existsSync18(poolRoot)) {
|
|
12257
12314
|
console.log("No workspace pool entries found.");
|
|
12258
12315
|
return;
|
|
12259
12316
|
}
|
|
@@ -12264,11 +12321,11 @@ var listCommand = command({
|
|
|
12264
12321
|
return;
|
|
12265
12322
|
}
|
|
12266
12323
|
for (const dir of poolDirs) {
|
|
12267
|
-
const poolDir =
|
|
12324
|
+
const poolDir = path27.join(poolRoot, dir.name);
|
|
12268
12325
|
const fingerprint = dir.name;
|
|
12269
12326
|
const poolEntries = await readdir6(poolDir, { withFileTypes: true });
|
|
12270
12327
|
const slots = poolEntries.filter((e) => e.isDirectory() && e.name.startsWith("slot-"));
|
|
12271
|
-
const metadataPath =
|
|
12328
|
+
const metadataPath = path27.join(poolDir, "metadata.json");
|
|
12272
12329
|
let metadata = null;
|
|
12273
12330
|
try {
|
|
12274
12331
|
const raw = await readFile7(metadataPath, "utf-8");
|
|
@@ -12315,8 +12372,8 @@ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
|
12315
12372
|
var CONFIG_DIR = getAgentvConfigDir();
|
|
12316
12373
|
var CACHE_FILE = "version-check.json";
|
|
12317
12374
|
var NPM_REGISTRY_BASE = "https://registry.npmjs.org/agentv/";
|
|
12318
|
-
async function getCachedUpdateInfo(
|
|
12319
|
-
const filePath =
|
|
12375
|
+
async function getCachedUpdateInfo(path29) {
|
|
12376
|
+
const filePath = path29 ?? join5(CONFIG_DIR, CACHE_FILE);
|
|
12320
12377
|
try {
|
|
12321
12378
|
const raw = await readFile8(filePath, "utf-8");
|
|
12322
12379
|
const data = JSON.parse(raw);
|
|
@@ -12406,6 +12463,7 @@ var app = subcommands({
|
|
|
12406
12463
|
compare: compareCommand,
|
|
12407
12464
|
convert: convertCommand,
|
|
12408
12465
|
create: createCommand,
|
|
12466
|
+
doctor: doctorCommand,
|
|
12409
12467
|
init: initCmdTsCommand,
|
|
12410
12468
|
pipeline: pipelineCommand,
|
|
12411
12469
|
results: resultsCommand,
|
|
@@ -12428,6 +12486,7 @@ var TOP_LEVEL_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
12428
12486
|
"compare",
|
|
12429
12487
|
"convert",
|
|
12430
12488
|
"create",
|
|
12489
|
+
"doctor",
|
|
12431
12490
|
"init",
|
|
12432
12491
|
"pipeline",
|
|
12433
12492
|
"results",
|
|
@@ -12477,7 +12536,7 @@ ${updateNotice}
|
|
|
12477
12536
|
const processedArgv = preprocessArgv(argv);
|
|
12478
12537
|
const cwd = process.cwd();
|
|
12479
12538
|
const repoRoot = await findRepoRoot(cwd);
|
|
12480
|
-
const sessionConfig = await loadConfig(
|
|
12539
|
+
const sessionConfig = await loadConfig(path28.join(cwd, "_"), repoRoot);
|
|
12481
12540
|
const beforeSessionCommand = sessionConfig?.hooks?.before_session;
|
|
12482
12541
|
if (beforeSessionCommand) {
|
|
12483
12542
|
runBeforeSessionHook(beforeSessionCommand);
|
|
@@ -12490,4 +12549,4 @@ export {
|
|
|
12490
12549
|
preprocessArgv,
|
|
12491
12550
|
runCli
|
|
12492
12551
|
};
|
|
12493
|
-
//# sourceMappingURL=chunk-
|
|
12552
|
+
//# sourceMappingURL=chunk-UV7G7TWO.js.map
|