agentv 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-6LP5Z5Y4.js → chunk-A7ZDUB46.js} +233 -115
- package/dist/chunk-A7ZDUB46.js.map +1 -0
- package/dist/{chunk-5M3K2DMV.js → chunk-GOZV2HN2.js} +167 -80
- package/dist/chunk-GOZV2HN2.js.map +1 -0
- package/dist/{chunk-4ZMSAQWS.js → chunk-RE5I3U2S.js} +156 -46
- package/dist/chunk-RE5I3U2S.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{dist-OC53WD3P.js → dist-AFDYFH6Y.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/{interactive-NA6SAIAG.js → interactive-WXXTZ7PD.js} +44 -4
- package/dist/interactive-WXXTZ7PD.js.map +1 -0
- package/dist/templates/.agentv/.env.example +11 -9
- package/dist/templates/.agentv/config.yaml +5 -0
- package/dist/templates/.agentv/targets.yaml +0 -16
- package/package.json +2 -2
- package/dist/chunk-4ZMSAQWS.js.map +0 -1
- package/dist/chunk-5M3K2DMV.js.map +0 -1
- package/dist/chunk-6LP5Z5Y4.js.map +0 -1
- package/dist/interactive-NA6SAIAG.js.map +0 -1
- /package/dist/{dist-OC53WD3P.js.map → dist-AFDYFH6Y.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
HtmlWriter,
|
|
4
|
+
buildBenchmarkArtifact,
|
|
5
|
+
buildGradingArtifact,
|
|
6
|
+
buildTimingArtifact,
|
|
4
7
|
detectFileType,
|
|
5
8
|
findRepoRoot,
|
|
6
9
|
package_default,
|
|
10
|
+
parseJsonlResults,
|
|
7
11
|
resolveEvalPaths,
|
|
8
12
|
runEvalCommand,
|
|
9
13
|
selectTarget,
|
|
@@ -12,7 +16,7 @@ import {
|
|
|
12
16
|
validateEvalFile,
|
|
13
17
|
validateFileReferences,
|
|
14
18
|
validateTargetsFile
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RE5I3U2S.js";
|
|
16
20
|
import {
|
|
17
21
|
createBuiltinRegistry,
|
|
18
22
|
createProvider,
|
|
@@ -30,7 +34,7 @@ import {
|
|
|
30
34
|
toSnakeCaseDeep as toSnakeCaseDeep2,
|
|
31
35
|
transpileEvalYamlFile,
|
|
32
36
|
trimBaselineResult
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GOZV2HN2.js";
|
|
34
38
|
import {
|
|
35
39
|
__commonJS,
|
|
36
40
|
__esm,
|
|
@@ -4181,7 +4185,7 @@ var evalRunCommand = command({
|
|
|
4181
4185
|
},
|
|
4182
4186
|
handler: async (args) => {
|
|
4183
4187
|
if (args.evalPaths.length === 0 && process.stdin.isTTY) {
|
|
4184
|
-
const { launchInteractiveWizard } = await import("./interactive-
|
|
4188
|
+
const { launchInteractiveWizard } = await import("./interactive-WXXTZ7PD.js");
|
|
4185
4189
|
await launchInteractiveWizard();
|
|
4186
4190
|
return;
|
|
4187
4191
|
}
|
|
@@ -4565,93 +4569,9 @@ var initCmdTsCommand = command({
|
|
|
4565
4569
|
}
|
|
4566
4570
|
});
|
|
4567
4571
|
|
|
4568
|
-
// src/commands/
|
|
4569
|
-
import {
|
|
4570
|
-
|
|
4571
|
-
if (scriptPath.includes(".bun")) {
|
|
4572
|
-
return "bun";
|
|
4573
|
-
}
|
|
4574
|
-
return "npm";
|
|
4575
|
-
}
|
|
4576
|
-
function detectPackageManager() {
|
|
4577
|
-
return detectPackageManagerFromPath(process.argv[1] ?? "");
|
|
4578
|
-
}
|
|
4579
|
-
function runCommand(cmd, args) {
|
|
4580
|
-
return new Promise((resolve, reject) => {
|
|
4581
|
-
const child = spawn(cmd, args, { stdio: ["inherit", "pipe", "inherit"], shell: true });
|
|
4582
|
-
let stdout = "";
|
|
4583
|
-
child.stdout?.on("data", (data) => {
|
|
4584
|
-
process.stdout.write(data);
|
|
4585
|
-
stdout += data.toString();
|
|
4586
|
-
});
|
|
4587
|
-
child.on("error", reject);
|
|
4588
|
-
child.on("close", (code) => resolve({ exitCode: code ?? 1, stdout }));
|
|
4589
|
-
});
|
|
4590
|
-
}
|
|
4591
|
-
var updateCommand = command({
|
|
4592
|
-
name: "update",
|
|
4593
|
-
description: "Update agentv to the latest version",
|
|
4594
|
-
args: {
|
|
4595
|
-
npm: flag({ long: "npm", description: "Force update using npm" }),
|
|
4596
|
-
bun: flag({ long: "bun", description: "Force update using bun" })
|
|
4597
|
-
},
|
|
4598
|
-
handler: async ({ npm, bun }) => {
|
|
4599
|
-
if (npm && bun) {
|
|
4600
|
-
console.error("Error: Cannot specify both --npm and --bun");
|
|
4601
|
-
process.exit(1);
|
|
4602
|
-
}
|
|
4603
|
-
let pm;
|
|
4604
|
-
if (npm) {
|
|
4605
|
-
pm = "npm";
|
|
4606
|
-
} else if (bun) {
|
|
4607
|
-
pm = "bun";
|
|
4608
|
-
} else {
|
|
4609
|
-
pm = detectPackageManager();
|
|
4610
|
-
}
|
|
4611
|
-
const currentVersion = package_default.version;
|
|
4612
|
-
console.log(`Current version: ${currentVersion}`);
|
|
4613
|
-
console.log(`Updating agentv using ${pm}...
|
|
4614
|
-
`);
|
|
4615
|
-
const args = pm === "npm" ? ["install", "-g", "agentv@latest"] : ["add", "-g", "agentv@latest"];
|
|
4616
|
-
try {
|
|
4617
|
-
const result = await runCommand(pm, args);
|
|
4618
|
-
if (result.exitCode !== 0) {
|
|
4619
|
-
console.error("\nUpdate failed.");
|
|
4620
|
-
process.exit(1);
|
|
4621
|
-
}
|
|
4622
|
-
let newVersion;
|
|
4623
|
-
try {
|
|
4624
|
-
const versionResult = await runCommand("agentv", ["--version"]);
|
|
4625
|
-
newVersion = versionResult.stdout.trim();
|
|
4626
|
-
} catch {
|
|
4627
|
-
}
|
|
4628
|
-
if (newVersion) {
|
|
4629
|
-
console.log(`
|
|
4630
|
-
Update complete: ${currentVersion} \u2192 ${newVersion}`);
|
|
4631
|
-
} else {
|
|
4632
|
-
console.log("\nUpdate complete.");
|
|
4633
|
-
}
|
|
4634
|
-
} catch (error) {
|
|
4635
|
-
if (error instanceof Error) {
|
|
4636
|
-
if (error.message.includes("ENOENT") || error.message.includes("not found")) {
|
|
4637
|
-
const alternative = pm === "npm" ? "bun" : "npm";
|
|
4638
|
-
console.error(`Error: ${pm} not found. Try using --${alternative} flag.`);
|
|
4639
|
-
} else {
|
|
4640
|
-
console.error(`Error: ${error.message}`);
|
|
4641
|
-
}
|
|
4642
|
-
process.exit(1);
|
|
4643
|
-
}
|
|
4644
|
-
throw error;
|
|
4645
|
-
}
|
|
4646
|
-
}
|
|
4647
|
-
});
|
|
4648
|
-
var selfCommand = subcommands({
|
|
4649
|
-
name: "self",
|
|
4650
|
-
description: "Manage the agentv installation",
|
|
4651
|
-
cmds: {
|
|
4652
|
-
update: updateCommand
|
|
4653
|
-
}
|
|
4654
|
-
});
|
|
4572
|
+
// src/commands/results/export.ts
|
|
4573
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
4574
|
+
import path8 from "node:path";
|
|
4655
4575
|
|
|
4656
4576
|
// src/commands/trace/utils.ts
|
|
4657
4577
|
import { readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
@@ -4757,6 +4677,202 @@ function formatScore(score) {
|
|
|
4757
4677
|
return `${(score * 100).toFixed(0)}%`;
|
|
4758
4678
|
}
|
|
4759
4679
|
|
|
4680
|
+
// src/commands/results/export.ts
|
|
4681
|
+
function exportResults(sourceFile, content, outputDir) {
|
|
4682
|
+
const results = parseJsonlResults(content);
|
|
4683
|
+
if (results.length === 0) {
|
|
4684
|
+
throw new Error(`No results found in ${sourceFile}`);
|
|
4685
|
+
}
|
|
4686
|
+
const patched = results.map((r) => {
|
|
4687
|
+
if (!r.testId && r.evalId) {
|
|
4688
|
+
return { ...r, testId: String(r.evalId) };
|
|
4689
|
+
}
|
|
4690
|
+
return r;
|
|
4691
|
+
});
|
|
4692
|
+
mkdirSync2(outputDir, { recursive: true });
|
|
4693
|
+
const benchmark = buildBenchmarkArtifact(patched, sourceFile);
|
|
4694
|
+
writeFileSync3(path8.join(outputDir, "benchmark.json"), `${JSON.stringify(benchmark, null, 2)}
|
|
4695
|
+
`);
|
|
4696
|
+
const timing = buildTimingArtifact(patched);
|
|
4697
|
+
writeFileSync3(path8.join(outputDir, "timing.json"), `${JSON.stringify(timing, null, 2)}
|
|
4698
|
+
`);
|
|
4699
|
+
const gradingDir = path8.join(outputDir, "grading");
|
|
4700
|
+
mkdirSync2(gradingDir, { recursive: true });
|
|
4701
|
+
for (const result of patched) {
|
|
4702
|
+
const id = safeTestId(result);
|
|
4703
|
+
const grading = buildGradingArtifact(result);
|
|
4704
|
+
writeFileSync3(path8.join(gradingDir, `${id}.json`), `${JSON.stringify(grading, null, 2)}
|
|
4705
|
+
`);
|
|
4706
|
+
}
|
|
4707
|
+
const outputsDir = path8.join(outputDir, "outputs");
|
|
4708
|
+
mkdirSync2(outputsDir, { recursive: true });
|
|
4709
|
+
for (const result of patched) {
|
|
4710
|
+
const answer = result.answer;
|
|
4711
|
+
if (answer) {
|
|
4712
|
+
const id = safeTestId(result);
|
|
4713
|
+
writeFileSync3(path8.join(outputsDir, `${id}.txt`), answer);
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
function safeTestId(result) {
|
|
4718
|
+
const raw = result.testId ?? result.evalId ?? "unknown";
|
|
4719
|
+
return String(raw).replace(/[/\\:*?"<>|]/g, "_");
|
|
4720
|
+
}
|
|
4721
|
+
function deriveOutputDir(cwd, sourceFile) {
|
|
4722
|
+
const basename = path8.basename(sourceFile, ".jsonl");
|
|
4723
|
+
const dirName = basename.startsWith("eval_") ? basename.slice(5) : basename;
|
|
4724
|
+
return path8.join(cwd, ".agentv", "results", dirName);
|
|
4725
|
+
}
|
|
4726
|
+
var resultsExportCommand = command({
|
|
4727
|
+
name: "export",
|
|
4728
|
+
description: "Export JSONL eval results into a per-test directory structure",
|
|
4729
|
+
args: {
|
|
4730
|
+
source: positional({
|
|
4731
|
+
type: optional(string),
|
|
4732
|
+
displayName: "source",
|
|
4733
|
+
description: "JSONL result file to export (defaults to most recent in .agentv/results/)"
|
|
4734
|
+
}),
|
|
4735
|
+
out: option({
|
|
4736
|
+
type: optional(string),
|
|
4737
|
+
long: "out",
|
|
4738
|
+
short: "o",
|
|
4739
|
+
description: "Output directory (defaults to .agentv/results/<run-timestamp>/)"
|
|
4740
|
+
}),
|
|
4741
|
+
dir: option({
|
|
4742
|
+
type: optional(string),
|
|
4743
|
+
long: "dir",
|
|
4744
|
+
short: "d",
|
|
4745
|
+
description: "Working directory (default: current directory)"
|
|
4746
|
+
})
|
|
4747
|
+
},
|
|
4748
|
+
handler: async ({ source, out, dir }) => {
|
|
4749
|
+
const cwd = dir ?? process.cwd();
|
|
4750
|
+
try {
|
|
4751
|
+
let sourceFile;
|
|
4752
|
+
if (source) {
|
|
4753
|
+
sourceFile = path8.isAbsolute(source) ? source : path8.resolve(cwd, source);
|
|
4754
|
+
} else {
|
|
4755
|
+
const metas = listResultFiles(cwd, 1);
|
|
4756
|
+
if (metas.length === 0) {
|
|
4757
|
+
console.error("Error: No result files found in .agentv/results/");
|
|
4758
|
+
console.error("Run an evaluation first: agentv eval <eval-file>");
|
|
4759
|
+
process.exit(1);
|
|
4760
|
+
}
|
|
4761
|
+
sourceFile = metas[0].path;
|
|
4762
|
+
}
|
|
4763
|
+
const content = readFileSync6(sourceFile, "utf8");
|
|
4764
|
+
const outputDir = out ? path8.isAbsolute(out) ? out : path8.resolve(cwd, out) : deriveOutputDir(cwd, sourceFile);
|
|
4765
|
+
exportResults(sourceFile, content, outputDir);
|
|
4766
|
+
const results = parseJsonlResults(content);
|
|
4767
|
+
console.log(`Exported ${results.length} test(s) to ${outputDir}`);
|
|
4768
|
+
for (const result of results) {
|
|
4769
|
+
const id = result.testId ?? result.evalId ?? "unknown";
|
|
4770
|
+
console.log(` ${id}`);
|
|
4771
|
+
}
|
|
4772
|
+
} catch (error) {
|
|
4773
|
+
console.error(`Error: ${error.message}`);
|
|
4774
|
+
process.exit(1);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
});
|
|
4778
|
+
|
|
4779
|
+
// src/commands/results/index.ts
|
|
4780
|
+
var resultsCommand = subcommands({
|
|
4781
|
+
name: "results",
|
|
4782
|
+
description: "Inspect, export, and manage evaluation results",
|
|
4783
|
+
cmds: {
|
|
4784
|
+
export: resultsExportCommand
|
|
4785
|
+
}
|
|
4786
|
+
});
|
|
4787
|
+
|
|
4788
|
+
// src/commands/self/index.ts
|
|
4789
|
+
import { spawn } from "node:child_process";
|
|
4790
|
+
function detectPackageManagerFromPath(scriptPath) {
|
|
4791
|
+
if (scriptPath.includes(".bun")) {
|
|
4792
|
+
return "bun";
|
|
4793
|
+
}
|
|
4794
|
+
return "npm";
|
|
4795
|
+
}
|
|
4796
|
+
function detectPackageManager() {
|
|
4797
|
+
return detectPackageManagerFromPath(process.argv[1] ?? "");
|
|
4798
|
+
}
|
|
4799
|
+
function runCommand(cmd, args) {
|
|
4800
|
+
return new Promise((resolve, reject) => {
|
|
4801
|
+
const child = spawn(cmd, args, { stdio: ["inherit", "pipe", "inherit"], shell: true });
|
|
4802
|
+
let stdout = "";
|
|
4803
|
+
child.stdout?.on("data", (data) => {
|
|
4804
|
+
process.stdout.write(data);
|
|
4805
|
+
stdout += data.toString();
|
|
4806
|
+
});
|
|
4807
|
+
child.on("error", reject);
|
|
4808
|
+
child.on("close", (code) => resolve({ exitCode: code ?? 1, stdout }));
|
|
4809
|
+
});
|
|
4810
|
+
}
|
|
4811
|
+
var updateCommand = command({
|
|
4812
|
+
name: "update",
|
|
4813
|
+
description: "Update agentv to the latest version",
|
|
4814
|
+
args: {
|
|
4815
|
+
npm: flag({ long: "npm", description: "Force update using npm" }),
|
|
4816
|
+
bun: flag({ long: "bun", description: "Force update using bun" })
|
|
4817
|
+
},
|
|
4818
|
+
handler: async ({ npm, bun }) => {
|
|
4819
|
+
if (npm && bun) {
|
|
4820
|
+
console.error("Error: Cannot specify both --npm and --bun");
|
|
4821
|
+
process.exit(1);
|
|
4822
|
+
}
|
|
4823
|
+
let pm;
|
|
4824
|
+
if (npm) {
|
|
4825
|
+
pm = "npm";
|
|
4826
|
+
} else if (bun) {
|
|
4827
|
+
pm = "bun";
|
|
4828
|
+
} else {
|
|
4829
|
+
pm = detectPackageManager();
|
|
4830
|
+
}
|
|
4831
|
+
const currentVersion = package_default.version;
|
|
4832
|
+
console.log(`Current version: ${currentVersion}`);
|
|
4833
|
+
console.log(`Updating agentv using ${pm}...
|
|
4834
|
+
`);
|
|
4835
|
+
const args = pm === "npm" ? ["install", "-g", "agentv@latest"] : ["add", "-g", "agentv@latest"];
|
|
4836
|
+
try {
|
|
4837
|
+
const result = await runCommand(pm, args);
|
|
4838
|
+
if (result.exitCode !== 0) {
|
|
4839
|
+
console.error("\nUpdate failed.");
|
|
4840
|
+
process.exit(1);
|
|
4841
|
+
}
|
|
4842
|
+
let newVersion;
|
|
4843
|
+
try {
|
|
4844
|
+
const versionResult = await runCommand("agentv", ["--version"]);
|
|
4845
|
+
newVersion = versionResult.stdout.trim();
|
|
4846
|
+
} catch {
|
|
4847
|
+
}
|
|
4848
|
+
if (newVersion) {
|
|
4849
|
+
console.log(`
|
|
4850
|
+
Update complete: ${currentVersion} \u2192 ${newVersion}`);
|
|
4851
|
+
} else {
|
|
4852
|
+
console.log("\nUpdate complete.");
|
|
4853
|
+
}
|
|
4854
|
+
} catch (error) {
|
|
4855
|
+
if (error instanceof Error) {
|
|
4856
|
+
if (error.message.includes("ENOENT") || error.message.includes("not found")) {
|
|
4857
|
+
const alternative = pm === "npm" ? "bun" : "npm";
|
|
4858
|
+
console.error(`Error: ${pm} not found. Try using --${alternative} flag.`);
|
|
4859
|
+
} else {
|
|
4860
|
+
console.error(`Error: ${error.message}`);
|
|
4861
|
+
}
|
|
4862
|
+
process.exit(1);
|
|
4863
|
+
}
|
|
4864
|
+
throw error;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
});
|
|
4868
|
+
var selfCommand = subcommands({
|
|
4869
|
+
name: "self",
|
|
4870
|
+
description: "Manage the agentv installation",
|
|
4871
|
+
cmds: {
|
|
4872
|
+
update: updateCommand
|
|
4873
|
+
}
|
|
4874
|
+
});
|
|
4875
|
+
|
|
4760
4876
|
// src/commands/trace/list.ts
|
|
4761
4877
|
function formatListTable(metas) {
|
|
4762
4878
|
const lines = [];
|
|
@@ -5505,8 +5621,8 @@ var traceCommand = subcommands({
|
|
|
5505
5621
|
});
|
|
5506
5622
|
|
|
5507
5623
|
// src/commands/transpile/index.ts
|
|
5508
|
-
import { writeFileSync as
|
|
5509
|
-
import
|
|
5624
|
+
import { writeFileSync as writeFileSync4 } from "node:fs";
|
|
5625
|
+
import path9 from "node:path";
|
|
5510
5626
|
var transpileCommand = command({
|
|
5511
5627
|
name: "transpile",
|
|
5512
5628
|
description: "Convert an EVAL.yaml file to Agent Skills evals.json format",
|
|
@@ -5530,7 +5646,7 @@ var transpileCommand = command({
|
|
|
5530
5646
|
handler: async ({ input, outDir, stdout }) => {
|
|
5531
5647
|
let result;
|
|
5532
5648
|
try {
|
|
5533
|
-
result = transpileEvalYamlFile(
|
|
5649
|
+
result = transpileEvalYamlFile(path9.resolve(input));
|
|
5534
5650
|
} catch (error) {
|
|
5535
5651
|
console.error(`Error: ${error.message}`);
|
|
5536
5652
|
process.exit(1);
|
|
@@ -5554,12 +5670,12 @@ var transpileCommand = command({
|
|
|
5554
5670
|
process.stdout.write("\n");
|
|
5555
5671
|
return;
|
|
5556
5672
|
}
|
|
5557
|
-
const outputDir = outDir ?
|
|
5673
|
+
const outputDir = outDir ? path9.resolve(outDir) : path9.dirname(path9.resolve(input));
|
|
5558
5674
|
const fileNames = getOutputFilenames(result);
|
|
5559
5675
|
for (const [skill, evalsJson] of result.files) {
|
|
5560
5676
|
const fileName = fileNames.get(skill) ?? "evals.json";
|
|
5561
|
-
const outputPath =
|
|
5562
|
-
|
|
5677
|
+
const outputPath = path9.join(outputDir, fileName);
|
|
5678
|
+
writeFileSync4(outputPath, `${JSON.stringify(evalsJson, null, 2)}
|
|
5563
5679
|
`);
|
|
5564
5680
|
console.log(`Transpiled to ${outputPath}`);
|
|
5565
5681
|
}
|
|
@@ -5567,7 +5683,7 @@ var transpileCommand = command({
|
|
|
5567
5683
|
});
|
|
5568
5684
|
|
|
5569
5685
|
// src/commands/trim/index.ts
|
|
5570
|
-
import { readFileSync as
|
|
5686
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
|
|
5571
5687
|
var trimCommand = command({
|
|
5572
5688
|
name: "trim",
|
|
5573
5689
|
description: "Trim evaluation results for baseline storage (strips debug/audit fields)",
|
|
@@ -5586,7 +5702,7 @@ var trimCommand = command({
|
|
|
5586
5702
|
},
|
|
5587
5703
|
handler: async ({ input, out }) => {
|
|
5588
5704
|
try {
|
|
5589
|
-
const content =
|
|
5705
|
+
const content = readFileSync7(input, "utf8");
|
|
5590
5706
|
const lines = content.trim().split("\n").filter((line) => line.trim());
|
|
5591
5707
|
const trimmedLines = lines.map((line) => {
|
|
5592
5708
|
const record = JSON.parse(line);
|
|
@@ -5598,7 +5714,7 @@ var trimCommand = command({
|
|
|
5598
5714
|
const output = `${trimmedLines.join("\n")}
|
|
5599
5715
|
`;
|
|
5600
5716
|
if (out) {
|
|
5601
|
-
|
|
5717
|
+
writeFileSync5(out, output, "utf8");
|
|
5602
5718
|
console.error(`Trimmed ${lines.length} record(s) \u2192 ${out}`);
|
|
5603
5719
|
} else {
|
|
5604
5720
|
process.stdout.write(output);
|
|
@@ -5693,7 +5809,7 @@ function isTTY() {
|
|
|
5693
5809
|
// src/commands/validate/validate-files.ts
|
|
5694
5810
|
import { constants } from "node:fs";
|
|
5695
5811
|
import { access, readdir, stat } from "node:fs/promises";
|
|
5696
|
-
import
|
|
5812
|
+
import path10 from "node:path";
|
|
5697
5813
|
async function validateFiles(paths) {
|
|
5698
5814
|
const filePaths = await expandPaths(paths);
|
|
5699
5815
|
const results = [];
|
|
@@ -5711,7 +5827,7 @@ async function validateFiles(paths) {
|
|
|
5711
5827
|
};
|
|
5712
5828
|
}
|
|
5713
5829
|
async function validateSingleFile(filePath) {
|
|
5714
|
-
const absolutePath =
|
|
5830
|
+
const absolutePath = path10.resolve(filePath);
|
|
5715
5831
|
const fileType = await detectFileType(absolutePath);
|
|
5716
5832
|
let result;
|
|
5717
5833
|
if (fileType === "eval") {
|
|
@@ -5736,7 +5852,7 @@ async function validateSingleFile(filePath) {
|
|
|
5736
5852
|
async function expandPaths(paths) {
|
|
5737
5853
|
const expanded = [];
|
|
5738
5854
|
for (const inputPath of paths) {
|
|
5739
|
-
const absolutePath =
|
|
5855
|
+
const absolutePath = path10.resolve(inputPath);
|
|
5740
5856
|
try {
|
|
5741
5857
|
await access(absolutePath, constants.F_OK);
|
|
5742
5858
|
} catch {
|
|
@@ -5760,7 +5876,7 @@ async function findYamlFiles(dirPath) {
|
|
|
5760
5876
|
try {
|
|
5761
5877
|
const entries2 = await readdir(dirPath, { withFileTypes: true });
|
|
5762
5878
|
for (const entry of entries2) {
|
|
5763
|
-
const fullPath =
|
|
5879
|
+
const fullPath = path10.join(dirPath, entry.name);
|
|
5764
5880
|
if (entry.isDirectory()) {
|
|
5765
5881
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
5766
5882
|
continue;
|
|
@@ -5777,7 +5893,7 @@ async function findYamlFiles(dirPath) {
|
|
|
5777
5893
|
return results;
|
|
5778
5894
|
}
|
|
5779
5895
|
function isYamlFile(filePath) {
|
|
5780
|
-
const ext =
|
|
5896
|
+
const ext = path10.extname(filePath).toLowerCase();
|
|
5781
5897
|
return ext === ".yaml" || ext === ".yml";
|
|
5782
5898
|
}
|
|
5783
5899
|
|
|
@@ -5817,7 +5933,7 @@ var validateCommand = command({
|
|
|
5817
5933
|
// src/commands/workspace/clean.ts
|
|
5818
5934
|
import { existsSync as existsSync2 } from "node:fs";
|
|
5819
5935
|
import { readFile as readFile2, readdir as readdir2, rm } from "node:fs/promises";
|
|
5820
|
-
import
|
|
5936
|
+
import path11 from "node:path";
|
|
5821
5937
|
async function confirm(message) {
|
|
5822
5938
|
const readline2 = await import("node:readline");
|
|
5823
5939
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -5853,8 +5969,8 @@ var cleanCommand = command({
|
|
|
5853
5969
|
const poolDirs = entries2.filter((e) => e.isDirectory());
|
|
5854
5970
|
const matchingDirs = [];
|
|
5855
5971
|
for (const dir of poolDirs) {
|
|
5856
|
-
const poolDir =
|
|
5857
|
-
const metadataPath =
|
|
5972
|
+
const poolDir = path11.join(poolRoot, dir.name);
|
|
5973
|
+
const metadataPath = path11.join(poolDir, "metadata.json");
|
|
5858
5974
|
try {
|
|
5859
5975
|
const raw = await readFile2(metadataPath, "utf-8");
|
|
5860
5976
|
const metadata = JSON.parse(raw);
|
|
@@ -5885,7 +6001,7 @@ var cleanCommand = command({
|
|
|
5885
6001
|
}
|
|
5886
6002
|
for (const dir of matchingDirs) {
|
|
5887
6003
|
await rm(dir, { recursive: true, force: true });
|
|
5888
|
-
console.log(`Removed: ${
|
|
6004
|
+
console.log(`Removed: ${path11.basename(dir).slice(0, 12)}...`);
|
|
5889
6005
|
}
|
|
5890
6006
|
console.log("Done.");
|
|
5891
6007
|
} else {
|
|
@@ -5905,13 +6021,13 @@ var cleanCommand = command({
|
|
|
5905
6021
|
// src/commands/workspace/list.ts
|
|
5906
6022
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5907
6023
|
import { readFile as readFile3, readdir as readdir3, stat as stat2 } from "node:fs/promises";
|
|
5908
|
-
import
|
|
6024
|
+
import path12 from "node:path";
|
|
5909
6025
|
async function getDirectorySize(dirPath) {
|
|
5910
6026
|
let totalSize = 0;
|
|
5911
6027
|
try {
|
|
5912
6028
|
const entries2 = await readdir3(dirPath, { withFileTypes: true });
|
|
5913
6029
|
for (const entry of entries2) {
|
|
5914
|
-
const fullPath =
|
|
6030
|
+
const fullPath = path12.join(dirPath, entry.name);
|
|
5915
6031
|
if (entry.isDirectory()) {
|
|
5916
6032
|
totalSize += await getDirectorySize(fullPath);
|
|
5917
6033
|
} else {
|
|
@@ -5946,11 +6062,11 @@ var listCommand = command({
|
|
|
5946
6062
|
return;
|
|
5947
6063
|
}
|
|
5948
6064
|
for (const dir of poolDirs) {
|
|
5949
|
-
const poolDir =
|
|
6065
|
+
const poolDir = path12.join(poolRoot, dir.name);
|
|
5950
6066
|
const fingerprint = dir.name;
|
|
5951
6067
|
const poolEntries = await readdir3(poolDir, { withFileTypes: true });
|
|
5952
6068
|
const slots = poolEntries.filter((e) => e.isDirectory() && e.name.startsWith("slot-"));
|
|
5953
|
-
const metadataPath =
|
|
6069
|
+
const metadataPath = path12.join(poolDir, "metadata.json");
|
|
5954
6070
|
let metadata = null;
|
|
5955
6071
|
try {
|
|
5956
6072
|
const raw = await readFile3(metadataPath, "utf-8");
|
|
@@ -5996,8 +6112,8 @@ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
|
5996
6112
|
var AGENTV_DIR = getAgentvHome();
|
|
5997
6113
|
var CACHE_FILE = "version-check.json";
|
|
5998
6114
|
var NPM_REGISTRY_URL = "https://registry.npmjs.org/agentv/latest";
|
|
5999
|
-
async function getCachedUpdateInfo(
|
|
6000
|
-
const filePath =
|
|
6115
|
+
async function getCachedUpdateInfo(path13) {
|
|
6116
|
+
const filePath = path13 ?? join(AGENTV_DIR, CACHE_FILE);
|
|
6001
6117
|
try {
|
|
6002
6118
|
const raw = await readFile4(filePath, "utf-8");
|
|
6003
6119
|
const data = JSON.parse(raw);
|
|
@@ -6087,6 +6203,7 @@ var app = subcommands({
|
|
|
6087
6203
|
create: createCommand,
|
|
6088
6204
|
generate: generateCommand,
|
|
6089
6205
|
init: initCmdTsCommand,
|
|
6206
|
+
results: resultsCommand,
|
|
6090
6207
|
self: selfCommand,
|
|
6091
6208
|
trace: traceCommand,
|
|
6092
6209
|
transpile: transpileCommand,
|
|
@@ -6103,6 +6220,7 @@ var TOP_LEVEL_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
6103
6220
|
"create",
|
|
6104
6221
|
"generate",
|
|
6105
6222
|
"init",
|
|
6223
|
+
"results",
|
|
6106
6224
|
"self",
|
|
6107
6225
|
"trace",
|
|
6108
6226
|
"transpile",
|
|
@@ -6150,4 +6268,4 @@ export {
|
|
|
6150
6268
|
preprocessArgv,
|
|
6151
6269
|
runCli
|
|
6152
6270
|
};
|
|
6153
|
-
//# sourceMappingURL=chunk-
|
|
6271
|
+
//# sourceMappingURL=chunk-A7ZDUB46.js.map
|