agentv 2.14.3 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-D3WKMO6D.js → chunk-JZ62HLUC.js} +254 -119
- package/dist/chunk-JZ62HLUC.js.map +1 -0
- package/dist/{chunk-TK4PB62M.js → chunk-LZ5MPQFM.js} +1085 -620
- package/dist/chunk-LZ5MPQFM.js.map +1 -0
- package/dist/{chunk-MDAFSKDI.js → chunk-QLCVA3ZS.js} +56 -12
- package/dist/chunk-QLCVA3ZS.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/{dist-F62E44UQ.js → dist-BMNEH377.js} +8 -4
- package/dist/index.js +3 -3
- package/dist/{interactive-SQSP4PL3.js → interactive-ZXYNPRCT.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-D3WKMO6D.js.map +0 -1
- package/dist/chunk-MDAFSKDI.js.map +0 -1
- package/dist/chunk-TK4PB62M.js.map +0 -1
- /package/dist/{dist-F62E44UQ.js.map → dist-BMNEH377.js.map} +0 -0
- /package/dist/{interactive-SQSP4PL3.js.map → interactive-ZXYNPRCT.js.map} +0 -0
|
@@ -6,14 +6,13 @@ import {
|
|
|
6
6
|
resolveEvalPaths,
|
|
7
7
|
runEvalCommand,
|
|
8
8
|
selectTarget,
|
|
9
|
-
toSnakeCaseDeep
|
|
9
|
+
toSnakeCaseDeep,
|
|
10
10
|
validateConfigFile,
|
|
11
11
|
validateEvalFile,
|
|
12
12
|
validateFileReferences,
|
|
13
13
|
validateTargetsFile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QLCVA3ZS.js";
|
|
15
15
|
import {
|
|
16
|
-
RepoManager,
|
|
17
16
|
assembleLlmJudgePrompt,
|
|
18
17
|
buildPromptInputs,
|
|
19
18
|
createBuiltinRegistry,
|
|
@@ -21,14 +20,14 @@ import {
|
|
|
21
20
|
executeScript,
|
|
22
21
|
generateRubrics,
|
|
23
22
|
getAgentvHome,
|
|
24
|
-
|
|
23
|
+
getWorkspacePoolRoot,
|
|
25
24
|
loadTestById,
|
|
26
25
|
loadTests,
|
|
27
26
|
normalizeLineEndings,
|
|
28
27
|
toCamelCaseDeep,
|
|
29
|
-
toSnakeCaseDeep,
|
|
28
|
+
toSnakeCaseDeep as toSnakeCaseDeep2,
|
|
30
29
|
trimBaselineResult
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LZ5MPQFM.js";
|
|
32
31
|
import {
|
|
33
32
|
__commonJS,
|
|
34
33
|
__esm,
|
|
@@ -2878,90 +2877,6 @@ function oneOf(literals) {
|
|
|
2878
2877
|
};
|
|
2879
2878
|
}
|
|
2880
2879
|
|
|
2881
|
-
// src/commands/cache/add.ts
|
|
2882
|
-
import { existsSync } from "node:fs";
|
|
2883
|
-
import { join, resolve } from "node:path";
|
|
2884
|
-
var addCommand = command({
|
|
2885
|
-
name: "add",
|
|
2886
|
-
description: "Seed cache from a local git repository",
|
|
2887
|
-
args: {
|
|
2888
|
-
url: option({
|
|
2889
|
-
long: "url",
|
|
2890
|
-
description: "Remote URL to associate with the cache entry",
|
|
2891
|
-
type: string
|
|
2892
|
-
}),
|
|
2893
|
-
from: option({
|
|
2894
|
-
long: "from",
|
|
2895
|
-
description: "Path to local git repository to clone from",
|
|
2896
|
-
type: string
|
|
2897
|
-
}),
|
|
2898
|
-
force: flag({
|
|
2899
|
-
long: "force",
|
|
2900
|
-
short: "f",
|
|
2901
|
-
description: "Overwrite existing cache entry"
|
|
2902
|
-
})
|
|
2903
|
-
},
|
|
2904
|
-
handler: async ({ url, from, force }) => {
|
|
2905
|
-
const localPath = resolve(from);
|
|
2906
|
-
if (!existsSync(localPath)) {
|
|
2907
|
-
console.error(`Error: local path does not exist: ${localPath}`);
|
|
2908
|
-
process.exit(1);
|
|
2909
|
-
}
|
|
2910
|
-
if (!existsSync(join(localPath, ".git")) && !existsSync(join(localPath, "HEAD"))) {
|
|
2911
|
-
console.error(`Error: ${localPath} does not appear to be a git repository`);
|
|
2912
|
-
process.exit(1);
|
|
2913
|
-
}
|
|
2914
|
-
const manager = new RepoManager();
|
|
2915
|
-
try {
|
|
2916
|
-
const cachePath = await manager.seedCache(localPath, url, { force });
|
|
2917
|
-
console.log(`Cache seeded from ${localPath}`);
|
|
2918
|
-
console.log(` Remote URL: ${url}`);
|
|
2919
|
-
console.log(` Cache path: ${cachePath}`);
|
|
2920
|
-
} catch (err2) {
|
|
2921
|
-
console.error(`Error: ${err2 instanceof Error ? err2.message : err2}`);
|
|
2922
|
-
process.exit(1);
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
});
|
|
2926
|
-
|
|
2927
|
-
// src/commands/cache/index.ts
|
|
2928
|
-
var cleanCommand = command({
|
|
2929
|
-
name: "clean",
|
|
2930
|
-
description: "Remove all cached git repositories",
|
|
2931
|
-
args: {
|
|
2932
|
-
force: flag({
|
|
2933
|
-
long: "force",
|
|
2934
|
-
short: "f",
|
|
2935
|
-
description: "Skip confirmation prompt"
|
|
2936
|
-
})
|
|
2937
|
-
},
|
|
2938
|
-
handler: async ({ force }) => {
|
|
2939
|
-
if (!force) {
|
|
2940
|
-
const readline2 = await import("node:readline");
|
|
2941
|
-
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
2942
|
-
const answer = await new Promise((resolve2) => {
|
|
2943
|
-
rl.question(`Remove all cached git repos from ${getGitCacheRoot()}? [y/N] `, resolve2);
|
|
2944
|
-
});
|
|
2945
|
-
rl.close();
|
|
2946
|
-
if (answer.toLowerCase() !== "y") {
|
|
2947
|
-
console.log("Cancelled.");
|
|
2948
|
-
return;
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
const manager = new RepoManager();
|
|
2952
|
-
await manager.cleanCache();
|
|
2953
|
-
console.log("Cache cleaned.");
|
|
2954
|
-
}
|
|
2955
|
-
});
|
|
2956
|
-
var cacheCommand = subcommands({
|
|
2957
|
-
name: "cache",
|
|
2958
|
-
description: "Manage AgentV cache",
|
|
2959
|
-
cmds: {
|
|
2960
|
-
add: addCommand,
|
|
2961
|
-
clean: cleanCommand
|
|
2962
|
-
}
|
|
2963
|
-
});
|
|
2964
|
-
|
|
2965
2880
|
// src/commands/compare/index.ts
|
|
2966
2881
|
import { readFileSync } from "node:fs";
|
|
2967
2882
|
var colors = {
|
|
@@ -3305,7 +3220,7 @@ var compareCommand = command({
|
|
|
3305
3220
|
const results2 = loadJsonlResults(results[1]);
|
|
3306
3221
|
const comparison = compareResults(results1, results2, effectiveThreshold);
|
|
3307
3222
|
if (outputFormat === "json") {
|
|
3308
|
-
console.log(JSON.stringify(
|
|
3223
|
+
console.log(JSON.stringify(toSnakeCaseDeep(comparison), null, 2));
|
|
3309
3224
|
} else {
|
|
3310
3225
|
console.log(formatTable(comparison, results[0], results[1]));
|
|
3311
3226
|
}
|
|
@@ -3351,7 +3266,7 @@ var compareCommand = command({
|
|
|
3351
3266
|
}
|
|
3352
3267
|
const comparison = compareResults(baselineResults, candidateResults, effectiveThreshold);
|
|
3353
3268
|
if (outputFormat === "json") {
|
|
3354
|
-
console.log(JSON.stringify(
|
|
3269
|
+
console.log(JSON.stringify(toSnakeCaseDeep(comparison), null, 2));
|
|
3355
3270
|
} else {
|
|
3356
3271
|
console.log(formatTable(comparison, baseline, candidate));
|
|
3357
3272
|
}
|
|
@@ -3360,7 +3275,7 @@ var compareCommand = command({
|
|
|
3360
3275
|
} else {
|
|
3361
3276
|
const matrixOutput = compareMatrix(groups, effectiveThreshold);
|
|
3362
3277
|
if (outputFormat === "json") {
|
|
3363
|
-
console.log(JSON.stringify(
|
|
3278
|
+
console.log(JSON.stringify(toSnakeCaseDeep(matrixOutput), null, 2));
|
|
3364
3279
|
} else {
|
|
3365
3280
|
console.log(formatMatrix(matrixOutput, baseline));
|
|
3366
3281
|
}
|
|
@@ -3803,7 +3718,7 @@ async function processEvaluator(config, evalCase, candidate, promptInputs) {
|
|
|
3803
3718
|
config: codeConfig.config ?? null
|
|
3804
3719
|
};
|
|
3805
3720
|
try {
|
|
3806
|
-
const inputPayload = JSON.stringify(
|
|
3721
|
+
const inputPayload = JSON.stringify(toSnakeCaseDeep2(payload), null, 2);
|
|
3807
3722
|
const stdout = await executeScript(script, inputPayload, 6e4, scriptCwd);
|
|
3808
3723
|
const parsed = JSON.parse(stdout);
|
|
3809
3724
|
return {
|
|
@@ -4050,6 +3965,44 @@ var evalRunCommand = command({
|
|
|
4050
3965
|
long: "cleanup-workspaces",
|
|
4051
3966
|
description: "Always cleanup temporary workspaces, even on failure"
|
|
4052
3967
|
}),
|
|
3968
|
+
poolWorkspaces: flag({
|
|
3969
|
+
long: "pool-workspaces",
|
|
3970
|
+
description: "Enable workspace pooling (default for shared workspaces with repos)"
|
|
3971
|
+
}),
|
|
3972
|
+
noPool: flag({
|
|
3973
|
+
long: "no-pool",
|
|
3974
|
+
description: "Disable workspace pooling (clone fresh each run)"
|
|
3975
|
+
}),
|
|
3976
|
+
workspace: option({
|
|
3977
|
+
type: optional(string),
|
|
3978
|
+
long: "workspace",
|
|
3979
|
+
description: "Use an existing directory as the workspace directly (skips clone/copy/pool)"
|
|
3980
|
+
}),
|
|
3981
|
+
workspaceMode: option({
|
|
3982
|
+
type: optional(string),
|
|
3983
|
+
long: "workspace-mode",
|
|
3984
|
+
description: "Workspace mode: 'pooled', 'ephemeral', or 'static'"
|
|
3985
|
+
}),
|
|
3986
|
+
workspacePath: option({
|
|
3987
|
+
type: optional(string),
|
|
3988
|
+
long: "workspace-path",
|
|
3989
|
+
description: "Static workspace directory path (used when workspace mode is static)"
|
|
3990
|
+
}),
|
|
3991
|
+
workspaceClean: option({
|
|
3992
|
+
type: optional(string),
|
|
3993
|
+
long: "workspace-clean",
|
|
3994
|
+
description: "Pooled reset clean mode: 'standard' or 'full'"
|
|
3995
|
+
}),
|
|
3996
|
+
retainOnSuccess: option({
|
|
3997
|
+
type: optional(string),
|
|
3998
|
+
long: "retain-on-success",
|
|
3999
|
+
description: "Workspace retention on success: 'keep' or 'cleanup'"
|
|
4000
|
+
}),
|
|
4001
|
+
retainOnFailure: option({
|
|
4002
|
+
type: optional(string),
|
|
4003
|
+
long: "retain-on-failure",
|
|
4004
|
+
description: "Workspace retention on failure: 'keep' or 'cleanup'"
|
|
4005
|
+
}),
|
|
4053
4006
|
otelFile: option({
|
|
4054
4007
|
type: optional(string),
|
|
4055
4008
|
long: "otel-file",
|
|
@@ -4089,7 +4042,7 @@ var evalRunCommand = command({
|
|
|
4089
4042
|
},
|
|
4090
4043
|
handler: async (args) => {
|
|
4091
4044
|
if (args.evalPaths.length === 0 && process.stdin.isTTY) {
|
|
4092
|
-
const { launchInteractiveWizard } = await import("./interactive-
|
|
4045
|
+
const { launchInteractiveWizard } = await import("./interactive-ZXYNPRCT.js");
|
|
4093
4046
|
await launchInteractiveWizard();
|
|
4094
4047
|
return;
|
|
4095
4048
|
}
|
|
@@ -4113,6 +4066,14 @@ var evalRunCommand = command({
|
|
|
4113
4066
|
verbose: args.verbose,
|
|
4114
4067
|
keepWorkspaces: args.keepWorkspaces,
|
|
4115
4068
|
cleanupWorkspaces: args.cleanupWorkspaces,
|
|
4069
|
+
poolWorkspaces: args.poolWorkspaces,
|
|
4070
|
+
noPool: args.noPool,
|
|
4071
|
+
workspace: args.workspace,
|
|
4072
|
+
workspaceMode: args.workspaceMode,
|
|
4073
|
+
workspacePath: args.workspacePath,
|
|
4074
|
+
workspaceClean: args.workspaceClean,
|
|
4075
|
+
retainOnSuccess: args.retainOnSuccess,
|
|
4076
|
+
retainOnFailure: args.retainOnFailure,
|
|
4116
4077
|
trace: false,
|
|
4117
4078
|
otelFile: args.otelFile,
|
|
4118
4079
|
traceFile: args.traceFile,
|
|
@@ -4309,7 +4270,7 @@ var generateCommand = subcommands({
|
|
|
4309
4270
|
});
|
|
4310
4271
|
|
|
4311
4272
|
// src/commands/init/index.ts
|
|
4312
|
-
import { existsSync
|
|
4273
|
+
import { existsSync, mkdirSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4313
4274
|
import path5 from "node:path";
|
|
4314
4275
|
import * as readline from "node:readline/promises";
|
|
4315
4276
|
|
|
@@ -4335,9 +4296,9 @@ function readTemplatesRecursively(dir, relativePath) {
|
|
|
4335
4296
|
const entries2 = readdirSync(dir);
|
|
4336
4297
|
for (const entry of entries2) {
|
|
4337
4298
|
const fullPath = path4.join(dir, entry);
|
|
4338
|
-
const
|
|
4299
|
+
const stat3 = statSync(fullPath);
|
|
4339
4300
|
const entryRelativePath = relativePath ? path4.join(relativePath, entry) : entry;
|
|
4340
|
-
if (
|
|
4301
|
+
if (stat3.isDirectory()) {
|
|
4341
4302
|
templates.push(...readTemplatesRecursively(fullPath, entryRelativePath));
|
|
4342
4303
|
} else {
|
|
4343
4304
|
const content = readFileSync3(fullPath, "utf-8");
|
|
@@ -4379,14 +4340,14 @@ async function initCommand(options = {}) {
|
|
|
4379
4340
|
const existingFiles = [];
|
|
4380
4341
|
if (envTemplate) {
|
|
4381
4342
|
const envFilePath = path5.join(targetPath, ".env.example");
|
|
4382
|
-
if (
|
|
4343
|
+
if (existsSync(envFilePath)) {
|
|
4383
4344
|
existingFiles.push(".env.example");
|
|
4384
4345
|
}
|
|
4385
4346
|
}
|
|
4386
|
-
if (
|
|
4347
|
+
if (existsSync(agentvDir)) {
|
|
4387
4348
|
for (const template of otherAgentvTemplates) {
|
|
4388
4349
|
const targetFilePath = path5.join(agentvDir, template.path);
|
|
4389
|
-
if (
|
|
4350
|
+
if (existsSync(targetFilePath)) {
|
|
4390
4351
|
existingFiles.push(path5.relative(targetPath, targetFilePath));
|
|
4391
4352
|
}
|
|
4392
4353
|
}
|
|
@@ -4405,7 +4366,7 @@ async function initCommand(options = {}) {
|
|
|
4405
4366
|
}
|
|
4406
4367
|
console.log();
|
|
4407
4368
|
}
|
|
4408
|
-
if (!
|
|
4369
|
+
if (!existsSync(agentvDir)) {
|
|
4409
4370
|
mkdirSync(agentvDir, { recursive: true });
|
|
4410
4371
|
}
|
|
4411
4372
|
if (envTemplate) {
|
|
@@ -4416,7 +4377,7 @@ async function initCommand(options = {}) {
|
|
|
4416
4377
|
for (const template of otherAgentvTemplates) {
|
|
4417
4378
|
const targetFilePath = path5.join(agentvDir, template.path);
|
|
4418
4379
|
const targetDirPath = path5.dirname(targetFilePath);
|
|
4419
|
-
if (!
|
|
4380
|
+
if (!existsSync(targetDirPath)) {
|
|
4420
4381
|
mkdirSync(targetDirPath, { recursive: true });
|
|
4421
4382
|
}
|
|
4422
4383
|
writeFileSync2(targetFilePath, template.content, "utf-8");
|
|
@@ -4470,7 +4431,7 @@ function detectPackageManager() {
|
|
|
4470
4431
|
return detectPackageManagerFromPath(process.argv[1] ?? "");
|
|
4471
4432
|
}
|
|
4472
4433
|
function runCommand(cmd, args) {
|
|
4473
|
-
return new Promise((
|
|
4434
|
+
return new Promise((resolve, reject) => {
|
|
4474
4435
|
const child = spawn(cmd, args, { stdio: ["inherit", "pipe", "inherit"], shell: true });
|
|
4475
4436
|
let stdout = "";
|
|
4476
4437
|
child.stdout?.on("data", (data) => {
|
|
@@ -4478,7 +4439,7 @@ function runCommand(cmd, args) {
|
|
|
4478
4439
|
stdout += data.toString();
|
|
4479
4440
|
});
|
|
4480
4441
|
child.on("error", reject);
|
|
4481
|
-
child.on("close", (code) =>
|
|
4442
|
+
child.on("close", (code) => resolve({ exitCode: code ?? 1, stdout }));
|
|
4482
4443
|
});
|
|
4483
4444
|
}
|
|
4484
4445
|
var updateCommand = command({
|
|
@@ -4600,7 +4561,7 @@ function listResultFiles(cwd, limit) {
|
|
|
4600
4561
|
for (const filename of files) {
|
|
4601
4562
|
const filePath = path6.join(resultsDir, filename);
|
|
4602
4563
|
try {
|
|
4603
|
-
const
|
|
4564
|
+
const stat3 = statSync2(filePath);
|
|
4604
4565
|
const results = loadResultFile(filePath);
|
|
4605
4566
|
const testCount = results.length;
|
|
4606
4567
|
const passCount = results.filter((r) => r.score >= 1).length;
|
|
@@ -4615,7 +4576,7 @@ function listResultFiles(cwd, limit) {
|
|
|
4615
4576
|
testCount,
|
|
4616
4577
|
passRate,
|
|
4617
4578
|
avgScore,
|
|
4618
|
-
sizeBytes:
|
|
4579
|
+
sizeBytes: stat3.size
|
|
4619
4580
|
});
|
|
4620
4581
|
} catch {
|
|
4621
4582
|
}
|
|
@@ -4707,7 +4668,7 @@ var traceListCommand = command({
|
|
|
4707
4668
|
try {
|
|
4708
4669
|
const metas = listResultFiles(cwd, limit);
|
|
4709
4670
|
if (outputFormat === "json") {
|
|
4710
|
-
console.log(JSON.stringify(
|
|
4671
|
+
console.log(JSON.stringify(toSnakeCaseDeep(metas), null, 2));
|
|
4711
4672
|
} else {
|
|
4712
4673
|
console.log(formatListTable(metas));
|
|
4713
4674
|
}
|
|
@@ -5374,7 +5335,7 @@ var traceStatsCommand = command({
|
|
|
5374
5335
|
const groups = groupResults(results, groupBy2);
|
|
5375
5336
|
if (outputFormat === "json") {
|
|
5376
5337
|
const statsJson = computeStatsJson(groups, file);
|
|
5377
|
-
console.log(JSON.stringify(
|
|
5338
|
+
console.log(JSON.stringify(toSnakeCaseDeep(statsJson), null, 2));
|
|
5378
5339
|
} else {
|
|
5379
5340
|
console.log(formatStatsTable(groups, file));
|
|
5380
5341
|
}
|
|
@@ -5423,7 +5384,7 @@ var trimCommand = command({
|
|
|
5423
5384
|
const record = JSON.parse(line);
|
|
5424
5385
|
const camel = toCamelCaseDeep(record);
|
|
5425
5386
|
const trimmed = trimBaselineResult(camel);
|
|
5426
|
-
const snake =
|
|
5387
|
+
const snake = toSnakeCaseDeep2(trimmed);
|
|
5427
5388
|
return JSON.stringify(snake);
|
|
5428
5389
|
});
|
|
5429
5390
|
const output = `${trimmedLines.join("\n")}
|
|
@@ -5645,18 +5606,192 @@ var validateCommand = command({
|
|
|
5645
5606
|
}
|
|
5646
5607
|
});
|
|
5647
5608
|
|
|
5609
|
+
// src/commands/workspace/clean.ts
|
|
5610
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
5611
|
+
import { readFile as readFile3, readdir as readdir2, rm } from "node:fs/promises";
|
|
5612
|
+
import path8 from "node:path";
|
|
5613
|
+
async function confirm(message) {
|
|
5614
|
+
const readline2 = await import("node:readline");
|
|
5615
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
5616
|
+
const answer = await new Promise((resolve) => {
|
|
5617
|
+
rl.question(`${message} [y/N] `, resolve);
|
|
5618
|
+
});
|
|
5619
|
+
rl.close();
|
|
5620
|
+
return answer.toLowerCase() === "y";
|
|
5621
|
+
}
|
|
5622
|
+
var cleanCommand = command({
|
|
5623
|
+
name: "clean",
|
|
5624
|
+
description: "Remove workspace pool entries",
|
|
5625
|
+
args: {
|
|
5626
|
+
repo: option({
|
|
5627
|
+
type: optional(string),
|
|
5628
|
+
long: "repo",
|
|
5629
|
+
description: "Only remove pools containing this repo URL"
|
|
5630
|
+
}),
|
|
5631
|
+
force: flag({
|
|
5632
|
+
long: "force",
|
|
5633
|
+
short: "f",
|
|
5634
|
+
description: "Skip confirmation prompt"
|
|
5635
|
+
})
|
|
5636
|
+
},
|
|
5637
|
+
handler: async ({ repo, force }) => {
|
|
5638
|
+
const poolRoot = getWorkspacePoolRoot();
|
|
5639
|
+
if (!existsSync2(poolRoot)) {
|
|
5640
|
+
console.log("No workspace pool entries found.");
|
|
5641
|
+
return;
|
|
5642
|
+
}
|
|
5643
|
+
if (repo) {
|
|
5644
|
+
const entries2 = await readdir2(poolRoot, { withFileTypes: true });
|
|
5645
|
+
const poolDirs = entries2.filter((e) => e.isDirectory());
|
|
5646
|
+
const matchingDirs = [];
|
|
5647
|
+
for (const dir of poolDirs) {
|
|
5648
|
+
const poolDir = path8.join(poolRoot, dir.name);
|
|
5649
|
+
const metadataPath = path8.join(poolDir, "metadata.json");
|
|
5650
|
+
try {
|
|
5651
|
+
const raw = await readFile3(metadataPath, "utf-8");
|
|
5652
|
+
const metadata = JSON.parse(raw);
|
|
5653
|
+
const hasRepo = metadata.repos?.some((r) => {
|
|
5654
|
+
if (r.source.type === "git" && r.source.url) {
|
|
5655
|
+
return r.source.url.toLowerCase().includes(repo.toLowerCase());
|
|
5656
|
+
}
|
|
5657
|
+
return false;
|
|
5658
|
+
});
|
|
5659
|
+
if (hasRepo) {
|
|
5660
|
+
matchingDirs.push(poolDir);
|
|
5661
|
+
}
|
|
5662
|
+
} catch {
|
|
5663
|
+
}
|
|
5664
|
+
}
|
|
5665
|
+
if (matchingDirs.length === 0) {
|
|
5666
|
+
console.log(`No workspace pool entries found matching repo "${repo}".`);
|
|
5667
|
+
return;
|
|
5668
|
+
}
|
|
5669
|
+
if (!force) {
|
|
5670
|
+
const confirmed = await confirm(
|
|
5671
|
+
`Remove ${matchingDirs.length} pool entry(s) matching repo "${repo}"?`
|
|
5672
|
+
);
|
|
5673
|
+
if (!confirmed) {
|
|
5674
|
+
console.log("Cancelled.");
|
|
5675
|
+
return;
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
for (const dir of matchingDirs) {
|
|
5679
|
+
await rm(dir, { recursive: true, force: true });
|
|
5680
|
+
console.log(`Removed: ${path8.basename(dir).slice(0, 12)}...`);
|
|
5681
|
+
}
|
|
5682
|
+
console.log("Done.");
|
|
5683
|
+
} else {
|
|
5684
|
+
if (!force) {
|
|
5685
|
+
const confirmed = await confirm(`Remove all workspace pool entries from ${poolRoot}?`);
|
|
5686
|
+
if (!confirmed) {
|
|
5687
|
+
console.log("Cancelled.");
|
|
5688
|
+
return;
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5691
|
+
await rm(poolRoot, { recursive: true, force: true });
|
|
5692
|
+
console.log("Workspace pool cleaned.");
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
});
|
|
5696
|
+
|
|
5697
|
+
// src/commands/workspace/list.ts
|
|
5698
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
5699
|
+
import { readFile as readFile4, readdir as readdir3, stat as stat2 } from "node:fs/promises";
|
|
5700
|
+
import path9 from "node:path";
|
|
5701
|
+
async function getDirectorySize(dirPath) {
|
|
5702
|
+
let totalSize = 0;
|
|
5703
|
+
try {
|
|
5704
|
+
const entries2 = await readdir3(dirPath, { withFileTypes: true });
|
|
5705
|
+
for (const entry of entries2) {
|
|
5706
|
+
const fullPath = path9.join(dirPath, entry.name);
|
|
5707
|
+
if (entry.isDirectory()) {
|
|
5708
|
+
totalSize += await getDirectorySize(fullPath);
|
|
5709
|
+
} else {
|
|
5710
|
+
const stats = await stat2(fullPath);
|
|
5711
|
+
totalSize += stats.size;
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
} catch {
|
|
5715
|
+
}
|
|
5716
|
+
return totalSize;
|
|
5717
|
+
}
|
|
5718
|
+
function formatSize2(bytes) {
|
|
5719
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
5720
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
5721
|
+
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
5722
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
5723
|
+
}
|
|
5724
|
+
var listCommand = command({
|
|
5725
|
+
name: "list",
|
|
5726
|
+
description: "List workspace pool entries",
|
|
5727
|
+
args: {},
|
|
5728
|
+
handler: async () => {
|
|
5729
|
+
const poolRoot = getWorkspacePoolRoot();
|
|
5730
|
+
if (!existsSync3(poolRoot)) {
|
|
5731
|
+
console.log("No workspace pool entries found.");
|
|
5732
|
+
return;
|
|
5733
|
+
}
|
|
5734
|
+
const entries2 = await readdir3(poolRoot, { withFileTypes: true });
|
|
5735
|
+
const poolDirs = entries2.filter((e) => e.isDirectory());
|
|
5736
|
+
if (poolDirs.length === 0) {
|
|
5737
|
+
console.log("No workspace pool entries found.");
|
|
5738
|
+
return;
|
|
5739
|
+
}
|
|
5740
|
+
for (const dir of poolDirs) {
|
|
5741
|
+
const poolDir = path9.join(poolRoot, dir.name);
|
|
5742
|
+
const fingerprint = dir.name;
|
|
5743
|
+
const poolEntries = await readdir3(poolDir, { withFileTypes: true });
|
|
5744
|
+
const slots = poolEntries.filter((e) => e.isDirectory() && e.name.startsWith("slot-"));
|
|
5745
|
+
const metadataPath = path9.join(poolDir, "metadata.json");
|
|
5746
|
+
let metadata = null;
|
|
5747
|
+
try {
|
|
5748
|
+
const raw = await readFile4(metadataPath, "utf-8");
|
|
5749
|
+
metadata = JSON.parse(raw);
|
|
5750
|
+
} catch {
|
|
5751
|
+
}
|
|
5752
|
+
const size = await getDirectorySize(poolDir);
|
|
5753
|
+
console.log(` ${fingerprint.slice(0, 12)}...`);
|
|
5754
|
+
console.log(` Slots: ${slots.length}`);
|
|
5755
|
+
console.log(` Size: ${formatSize2(size)}`);
|
|
5756
|
+
if (metadata) {
|
|
5757
|
+
if (metadata.templatePath) {
|
|
5758
|
+
console.log(` Template: ${metadata.templatePath}`);
|
|
5759
|
+
}
|
|
5760
|
+
if (metadata.repos && metadata.repos.length > 0) {
|
|
5761
|
+
const repoSources = metadata.repos.map(
|
|
5762
|
+
(r) => r.source.type === "git" ? r.source.url : r.source.path
|
|
5763
|
+
);
|
|
5764
|
+
console.log(` Repos: ${repoSources.join(", ")}`);
|
|
5765
|
+
}
|
|
5766
|
+
console.log(` Created: ${metadata.createdAt}`);
|
|
5767
|
+
}
|
|
5768
|
+
console.log();
|
|
5769
|
+
}
|
|
5770
|
+
}
|
|
5771
|
+
});
|
|
5772
|
+
|
|
5773
|
+
// src/commands/workspace/index.ts
|
|
5774
|
+
var workspaceCommand = subcommands({
|
|
5775
|
+
name: "workspace",
|
|
5776
|
+
description: "Manage workspace pool",
|
|
5777
|
+
cmds: {
|
|
5778
|
+
list: listCommand,
|
|
5779
|
+
clean: cleanCommand
|
|
5780
|
+
}
|
|
5781
|
+
});
|
|
5782
|
+
|
|
5648
5783
|
// src/update-check.ts
|
|
5649
5784
|
import { spawn as spawn2 } from "node:child_process";
|
|
5650
|
-
import { readFile as
|
|
5651
|
-
import { join
|
|
5785
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
5786
|
+
import { join } from "node:path";
|
|
5652
5787
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
5653
5788
|
var AGENTV_DIR = getAgentvHome();
|
|
5654
5789
|
var CACHE_FILE = "version-check.json";
|
|
5655
5790
|
var NPM_REGISTRY_URL = "https://registry.npmjs.org/agentv/latest";
|
|
5656
|
-
async function getCachedUpdateInfo(
|
|
5657
|
-
const filePath =
|
|
5791
|
+
async function getCachedUpdateInfo(path10) {
|
|
5792
|
+
const filePath = path10 ?? join(AGENTV_DIR, CACHE_FILE);
|
|
5658
5793
|
try {
|
|
5659
|
-
const raw = await
|
|
5794
|
+
const raw = await readFile5(filePath, "utf-8");
|
|
5660
5795
|
const data = JSON.parse(raw);
|
|
5661
5796
|
if (typeof data.latestVersion === "string" && typeof data.lastCheckedAt === "string") {
|
|
5662
5797
|
return data;
|
|
@@ -5688,7 +5823,7 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
5688
5823
|
}
|
|
5689
5824
|
function backgroundUpdateCheck() {
|
|
5690
5825
|
const dir = AGENTV_DIR;
|
|
5691
|
-
const filePath =
|
|
5826
|
+
const filePath = join(dir, CACHE_FILE);
|
|
5692
5827
|
const script = `
|
|
5693
5828
|
const https = require('https');
|
|
5694
5829
|
const fs = require('fs');
|
|
@@ -5737,7 +5872,6 @@ var app = subcommands({
|
|
|
5737
5872
|
description: "AgentV CLI",
|
|
5738
5873
|
version: package_default.version,
|
|
5739
5874
|
cmds: {
|
|
5740
|
-
cache: cacheCommand,
|
|
5741
5875
|
eval: evalRunCommand,
|
|
5742
5876
|
prompt: evalPromptCommand,
|
|
5743
5877
|
compare: compareCommand,
|
|
@@ -5748,7 +5882,8 @@ var app = subcommands({
|
|
|
5748
5882
|
self: selfCommand,
|
|
5749
5883
|
trace: traceCommand,
|
|
5750
5884
|
trim: trimCommand,
|
|
5751
|
-
validate: validateCommand
|
|
5885
|
+
validate: validateCommand,
|
|
5886
|
+
workspace: workspaceCommand
|
|
5752
5887
|
}
|
|
5753
5888
|
});
|
|
5754
5889
|
var PROMPT_EVAL_SUBCOMMANDS = /* @__PURE__ */ new Set(["overview", "input", "judge"]);
|
|
@@ -5794,4 +5929,4 @@ export {
|
|
|
5794
5929
|
preprocessArgv,
|
|
5795
5930
|
runCli
|
|
5796
5931
|
};
|
|
5797
|
-
//# sourceMappingURL=chunk-
|
|
5932
|
+
//# sourceMappingURL=chunk-JZ62HLUC.js.map
|