agentv 4.17.1 → 4.18.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/README.md +1 -1
- package/dist/artifact-writer-WH3OE42V.js +40 -0
- package/dist/chunk-HBDOJJFY.js +689 -0
- package/dist/chunk-HBDOJJFY.js.map +1 -0
- package/dist/{chunk-ILIM6IIX.js → chunk-MCBERRMC.js} +196 -161
- package/dist/chunk-MCBERRMC.js.map +1 -0
- package/dist/{chunk-IRU2UOWN.js → chunk-RCOAXXHP.js} +194 -197
- package/dist/chunk-RCOAXXHP.js.map +1 -0
- package/dist/{chunk-ZUNYOUFO.js → chunk-VRPCMCLQ.js} +255 -621
- package/dist/chunk-VRPCMCLQ.js.map +1 -0
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +1 -1
- package/dist/{dist-U5EXNMON.js → dist-7W4OI3X2.js} +30 -33
- package/dist/dist-7W4OI3X2.js.map +1 -0
- package/dist/index.js +4 -3
- package/dist/{interactive-LFCOVXPQ.js → interactive-J4QEU5FG.js} +4 -3
- package/dist/{interactive-LFCOVXPQ.js.map → interactive-J4QEU5FG.js.map} +1 -1
- package/dist/studio/assets/{index-Bhv1TEO2.js → index-BTsTcivx.js} +1 -1
- package/dist/studio/assets/{index-vZYHIvCH.js → index-KfPHd-QM.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunk-ILIM6IIX.js.map +0 -1
- package/dist/chunk-IRU2UOWN.js.map +0 -1
- package/dist/chunk-ZUNYOUFO.js.map +0 -1
- /package/dist/{dist-U5EXNMON.js.map → artifact-writer-WH3OE42V.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
runCli
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MCBERRMC.js";
|
|
6
|
+
import "./chunk-VRPCMCLQ.js";
|
|
7
|
+
import "./chunk-HBDOJJFY.js";
|
|
8
|
+
import "./chunk-RCOAXXHP.js";
|
|
8
9
|
import "./chunk-QOBQ5XYF.js";
|
|
9
10
|
import "./chunk-NPVGBFF6.js";
|
|
10
11
|
import "./chunk-HQDCIXVH.js";
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCli } from './index.js';\n\nrunCli()\n .then(() => {\n process.exit(0);\n })\n .catch((error) => {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n if (process.env.DEBUG) {\n console.error(error.stack);\n }\n } else {\n console.error(error);\n }\n process.exit(1);\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCli } from './index.js';\n\nrunCli()\n .then(() => {\n process.exit(0);\n })\n .catch((error) => {\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n if (process.env.DEBUG) {\n console.error(error.stack);\n }\n } else {\n console.error(error);\n }\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,OAAO,EACJ,KAAK,MAAM;AACV,UAAQ,KAAK,CAAC;AAChB,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,MAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,UAAU,MAAM,OAAO,EAAE;AACvC,QAAI,QAAQ,IAAI,OAAO;AACrB,cAAQ,MAAM,MAAM,KAAK;AAAA,IAC3B;AAAA,EACF,OAAO;AACL,YAAQ,MAAM,KAAK;AAAA,EACrB;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
COMMON_TARGET_SETTINGS,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
CodeGrader,
|
|
5
|
+
CompositeGrader,
|
|
6
|
+
CostGrader,
|
|
7
7
|
DEFAULT_CATEGORY,
|
|
8
|
-
DEFAULT_EVALUATOR_TEMPLATE,
|
|
9
8
|
DEFAULT_EVAL_PATTERNS,
|
|
10
9
|
DEFAULT_EXPLORATION_TOOLS,
|
|
10
|
+
DEFAULT_GRADER_TEMPLATE,
|
|
11
11
|
DEFAULT_THRESHOLD,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
DeterministicAssertionGrader,
|
|
13
|
+
ExecutionMetricsGrader,
|
|
14
|
+
FieldAccuracyGrader,
|
|
15
|
+
GraderRegistry,
|
|
16
|
+
LatencyGrader,
|
|
17
|
+
LlmGrader,
|
|
18
18
|
OTEL_BACKEND_PRESETS,
|
|
19
19
|
OtelStreamingObserver,
|
|
20
20
|
OtelTraceExporter,
|
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
ProviderRegistry,
|
|
23
23
|
RepoManager,
|
|
24
24
|
ResponseCache,
|
|
25
|
-
|
|
25
|
+
SkillTriggerGrader,
|
|
26
26
|
TEST_MESSAGE_ROLES,
|
|
27
27
|
TemplateNotDirectoryError,
|
|
28
28
|
TemplateNotFoundError,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
TokenUsageGrader,
|
|
30
|
+
ToolTrajectoryGrader,
|
|
31
31
|
TranscriptProvider,
|
|
32
32
|
WorkspaceCreationError,
|
|
33
33
|
WorkspacePoolManager,
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
isAgentSkillsFormat,
|
|
114
114
|
isContent,
|
|
115
115
|
isContentArray,
|
|
116
|
-
|
|
116
|
+
isGraderKind,
|
|
117
117
|
isJsonObject,
|
|
118
118
|
isJsonValue,
|
|
119
119
|
isNonEmptyString,
|
|
@@ -190,7 +190,7 @@ import {
|
|
|
190
190
|
transpileEvalYaml,
|
|
191
191
|
transpileEvalYamlFile,
|
|
192
192
|
trimBaselineResult
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-RCOAXXHP.js";
|
|
194
194
|
import {
|
|
195
195
|
OtlpJsonFileExporter
|
|
196
196
|
} from "./chunk-QOBQ5XYF.js";
|
|
@@ -204,22 +204,21 @@ import "./chunk-ZKO2LGRR.js";
|
|
|
204
204
|
import "./chunk-5H446C7X.js";
|
|
205
205
|
export {
|
|
206
206
|
COMMON_TARGET_SETTINGS,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
CodeGrader,
|
|
208
|
+
CompositeGrader,
|
|
209
|
+
CostGrader,
|
|
210
210
|
DEFAULT_CATEGORY,
|
|
211
|
-
DEFAULT_EVALUATOR_TEMPLATE,
|
|
212
211
|
DEFAULT_EVAL_PATTERNS,
|
|
213
212
|
DEFAULT_EXPLORATION_TOOLS,
|
|
213
|
+
DEFAULT_GRADER_TEMPLATE,
|
|
214
214
|
DEFAULT_THRESHOLD,
|
|
215
|
-
|
|
215
|
+
DeterministicAssertionGrader,
|
|
216
216
|
DockerWorkspaceProvider,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
LlmGraderEvaluator as LlmJudgeEvaluator,
|
|
217
|
+
ExecutionMetricsGrader,
|
|
218
|
+
FieldAccuracyGrader,
|
|
219
|
+
GraderRegistry,
|
|
220
|
+
LatencyGrader,
|
|
221
|
+
LlmGrader,
|
|
223
222
|
OTEL_BACKEND_PRESETS,
|
|
224
223
|
OtelStreamingObserver,
|
|
225
224
|
OtelTraceExporter,
|
|
@@ -228,18 +227,17 @@ export {
|
|
|
228
227
|
ProviderRegistry,
|
|
229
228
|
RepoManager,
|
|
230
229
|
ResponseCache,
|
|
231
|
-
|
|
230
|
+
SkillTriggerGrader,
|
|
232
231
|
TEST_MESSAGE_ROLES,
|
|
233
232
|
TemplateNotDirectoryError,
|
|
234
233
|
TemplateNotFoundError,
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
TokenUsageGrader,
|
|
235
|
+
ToolTrajectoryGrader,
|
|
237
236
|
TranscriptProvider,
|
|
238
237
|
WorkspaceCreationError,
|
|
239
238
|
WorkspacePoolManager,
|
|
240
239
|
addBenchmark,
|
|
241
240
|
assembleLlmGraderPrompt,
|
|
242
|
-
assembleLlmGraderPrompt as assembleLlmJudgePrompt,
|
|
243
241
|
avgToolDurationMs,
|
|
244
242
|
buildDirectoryChain,
|
|
245
243
|
buildOutputSchema,
|
|
@@ -279,7 +277,6 @@ export {
|
|
|
279
277
|
discoverCodexSessions,
|
|
280
278
|
discoverCopilotSessions,
|
|
281
279
|
discoverGraders,
|
|
282
|
-
discoverGraders as discoverJudges,
|
|
283
280
|
discoverProviders,
|
|
284
281
|
ensureResultsRepoClone,
|
|
285
282
|
ensureVSCodeSubagents,
|
|
@@ -321,7 +318,7 @@ export {
|
|
|
321
318
|
isAgentSkillsFormat,
|
|
322
319
|
isContent,
|
|
323
320
|
isContentArray,
|
|
324
|
-
|
|
321
|
+
isGraderKind,
|
|
325
322
|
isJsonObject,
|
|
326
323
|
isJsonValue,
|
|
327
324
|
isNonEmptyString,
|
|
@@ -399,4 +396,4 @@ export {
|
|
|
399
396
|
transpileEvalYamlFile,
|
|
400
397
|
trimBaselineResult
|
|
401
398
|
};
|
|
402
|
-
//# sourceMappingURL=dist-
|
|
399
|
+
//# sourceMappingURL=dist-7W4OI3X2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
app,
|
|
4
4
|
preprocessArgv,
|
|
5
5
|
runCli
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-MCBERRMC.js";
|
|
7
|
+
import "./chunk-VRPCMCLQ.js";
|
|
8
|
+
import "./chunk-HBDOJJFY.js";
|
|
9
|
+
import "./chunk-RCOAXXHP.js";
|
|
9
10
|
import "./chunk-QOBQ5XYF.js";
|
|
10
11
|
import "./chunk-NPVGBFF6.js";
|
|
11
12
|
import "./chunk-HQDCIXVH.js";
|
|
@@ -7,12 +7,13 @@ import {
|
|
|
7
7
|
findRepoRoot,
|
|
8
8
|
getCategories,
|
|
9
9
|
runEvalCommand
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VRPCMCLQ.js";
|
|
11
|
+
import "./chunk-HBDOJJFY.js";
|
|
11
12
|
import {
|
|
12
13
|
getAgentvConfigDir,
|
|
13
14
|
listTargetNames,
|
|
14
15
|
readTargetDefinitions
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RCOAXXHP.js";
|
|
16
17
|
import "./chunk-QOBQ5XYF.js";
|
|
17
18
|
import "./chunk-NPVGBFF6.js";
|
|
18
19
|
import "./chunk-HQDCIXVH.js";
|
|
@@ -328,4 +329,4 @@ ${ANSI_DIM}Retrying execution errors...${ANSI_RESET}
|
|
|
328
329
|
export {
|
|
329
330
|
launchInteractiveWizard
|
|
330
331
|
};
|
|
331
|
-
//# sourceMappingURL=interactive-
|
|
332
|
+
//# sourceMappingURL=interactive-J4QEU5FG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/eval/interactive.ts","../src/commands/eval/last-config.ts"],"sourcesContent":["import path from 'node:path';\nimport { listTargetNames, readTargetDefinitions } from '@agentv/core';\nimport { checkbox, confirm, number, search, select } from '@inquirer/prompts';\n\nimport { TARGET_FILE_CANDIDATES, fileExists } from '../../utils/targets.js';\nimport {\n type DiscoveredEvalFile,\n discoverEvalFiles,\n filterByCategory,\n getCategories,\n} from './discover.js';\nimport { type LastConfig, loadLastConfig, saveLastConfig } from './last-config.js';\nimport { runEvalCommand } from './run-eval.js';\nimport { findRepoRoot } from './shared.js';\n\nconst ANSI_BOLD = '\\x1b[1m';\nconst ANSI_DIM = '\\x1b[2m';\nconst ANSI_CYAN = '\\x1b[36m';\nconst ANSI_GREEN = '\\x1b[32m';\nconst ANSI_RESET = '\\x1b[0m';\n\nexport interface InteractiveConfig {\n readonly evalPaths: readonly string[];\n readonly target: string;\n readonly workers: number;\n readonly dryRun: boolean;\n readonly cache: boolean;\n}\n\n/**\n * Launch the interactive wizard when `agentv eval` is called with no arguments.\n */\nexport async function launchInteractiveWizard(): Promise<void> {\n const cwd = process.cwd();\n\n console.log(`\\n${ANSI_BOLD}${ANSI_CYAN}AgentV Interactive Mode${ANSI_RESET}\\n`);\n\n const lastConfig = await loadLastConfig();\n const action = await promptMainMenu(lastConfig);\n\n if (action === 'exit') {\n return;\n }\n\n if (action === 'rerun' && lastConfig) {\n console.log(`\\n${ANSI_DIM}Rerunning last configuration...${ANSI_RESET}\\n`);\n await executeConfig({\n evalPaths: lastConfig.evalPaths,\n target: lastConfig.target,\n workers: lastConfig.workers,\n dryRun: lastConfig.dryRun,\n cache: lastConfig.cache,\n });\n return;\n }\n\n // Run new evaluation flow\n const config = await promptNewEvaluation(cwd);\n if (!config) {\n return;\n }\n\n // Review & confirm\n const confirmed = await promptReviewAndConfirm(config, cwd);\n if (!confirmed) {\n return;\n }\n\n // Save last config\n await saveLastConfig({\n timestamp: new Date().toISOString(),\n cwd,\n evalPaths: config.evalPaths,\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n });\n\n await executeConfig(config);\n}\n\nasync function promptMainMenu(\n lastConfig: LastConfig | undefined,\n): Promise<'new' | 'rerun' | 'exit'> {\n type MenuChoice = 'new' | 'rerun' | 'exit';\n const choices: Array<{ name: string; value: MenuChoice; description?: string }> = [];\n\n if (lastConfig) {\n const evalCount = lastConfig.evalPaths.length;\n choices.push({\n name: '🔄 Rerun last config',\n value: 'rerun',\n description: `${evalCount} eval file(s), target: ${lastConfig.target}`,\n });\n }\n\n choices.push({ name: '🚀 Run new evaluation', value: 'new' }, { name: '✕ Exit', value: 'exit' });\n\n return select<MenuChoice>({\n message: 'What would you like to do?',\n choices,\n });\n}\n\nasync function promptNewEvaluation(cwd: string): Promise<InteractiveConfig | undefined> {\n // Step 1: Discover eval files\n console.log(`\\n${ANSI_DIM}Scanning for eval files...${ANSI_RESET}`);\n const allFiles = await discoverEvalFiles(cwd);\n\n if (allFiles.length === 0) {\n console.log(\n '\\n⚠ No eval files found in the current directory.\\n' +\n ' Place .yaml or .jsonl eval files in your project, or use:\\n' +\n ' agentv eval <path-to-eval.yaml>\\n',\n );\n return undefined;\n }\n\n console.log(`${ANSI_DIM}Found ${allFiles.length} eval file(s)${ANSI_RESET}\\n`);\n\n // Step 2: Select eval files (optionally filter by category first)\n const selectedFiles = await promptEvalSelection(allFiles);\n if (selectedFiles.length === 0) {\n console.log('\\nNo eval files selected.');\n return undefined;\n }\n\n // Step 3: Select target\n const target = await promptTargetSelection(cwd, selectedFiles[0].path);\n\n // Step 4: Advanced options\n const advanced = await promptAdvancedOptions();\n\n return {\n evalPaths: selectedFiles.map((f) => f.path),\n target,\n ...advanced,\n };\n}\n\nasync function promptEvalSelection(\n allFiles: readonly DiscoveredEvalFile[],\n): Promise<DiscoveredEvalFile[]> {\n const categories = getCategories(allFiles);\n\n // If only one category or few files, skip category selection\n let filesToSelect: readonly DiscoveredEvalFile[];\n\n if (categories.length > 1) {\n const selectedCategory = await search<string>({\n message: 'Select a category (type to search)',\n source: async (term) => {\n const filtered = term\n ? categories.filter((c) => c.toLowerCase().includes(term.toLowerCase()))\n : categories;\n return [\n { name: '(all categories)', value: '__all__' },\n ...filtered.map((c) => {\n const count = filterByCategory(allFiles, c).length;\n return { name: `${c} (${count} file${count > 1 ? 's' : ''})`, value: c };\n }),\n ];\n },\n });\n\n filesToSelect =\n selectedCategory === '__all__' ? allFiles : filterByCategory(allFiles, selectedCategory);\n } else {\n filesToSelect = allFiles;\n }\n\n return checkbox<DiscoveredEvalFile>({\n message: 'Select eval files to run (space to toggle, enter to confirm)',\n choices: filesToSelect.map((f) => ({\n name: f.relativePath,\n value: f,\n checked: filesToSelect.length <= 5, // auto-select if few files\n })),\n required: true,\n });\n}\n\nasync function promptTargetSelection(cwd: string, firstEvalPath: string): Promise<string> {\n const repoRoot = await findRepoRoot(cwd);\n\n // Try to find targets.yaml — search near the eval file first, then cwd/repoRoot\n const targetsPath = await findTargetsFile(cwd, repoRoot, firstEvalPath);\n\n if (!targetsPath) {\n console.log(`${ANSI_DIM}No targets.yaml found. Using default target.${ANSI_RESET}`);\n return 'default';\n }\n\n const definitions = await readTargetDefinitions(targetsPath);\n const targetNames = listTargetNames(definitions);\n\n if (targetNames.length === 0) {\n return 'default';\n }\n\n if (targetNames.length === 1) {\n console.log(`${ANSI_DIM}Using target: ${targetNames[0]}${ANSI_RESET}`);\n return targetNames[0];\n }\n\n return search<string>({\n message: 'Select a target (type to search)',\n source: async (term) => {\n const filtered = term\n ? targetNames.filter((t) => t.toLowerCase().includes(term.toLowerCase()))\n : targetNames;\n return filtered.map((t) => {\n const def = definitions.find((d) => d.name === t);\n return {\n name: t,\n value: t,\n description: def ? `provider: ${def.provider}` : undefined,\n };\n });\n },\n });\n}\n\nasync function findTargetsFile(\n cwd: string,\n repoRoot: string,\n evalFilePath?: string,\n): Promise<string | undefined> {\n // Build directory chain: eval file dir → cwd → repoRoot (mirrors discoverTargetsFile)\n const dirsToSearch: string[] = [];\n\n if (evalFilePath) {\n const evalDir = path.dirname(evalFilePath);\n if (!dirsToSearch.includes(evalDir)) {\n dirsToSearch.push(evalDir);\n }\n }\n\n if (!dirsToSearch.includes(cwd)) {\n dirsToSearch.push(cwd);\n }\n\n if (repoRoot !== cwd && !dirsToSearch.includes(repoRoot)) {\n dirsToSearch.push(repoRoot);\n }\n\n for (const dir of dirsToSearch) {\n for (const candidate of TARGET_FILE_CANDIDATES) {\n const fullPath = `${dir}/${candidate}`;\n if (await fileExists(fullPath)) {\n return fullPath;\n }\n }\n }\n\n return undefined;\n}\n\nasync function promptAdvancedOptions(): Promise<{\n workers: number;\n dryRun: boolean;\n cache: boolean;\n}> {\n const customize = await confirm({\n message: 'Configure advanced options?',\n default: false,\n });\n\n if (!customize) {\n return { workers: 3, dryRun: false, cache: false };\n }\n\n const workers =\n (await number({\n message: 'Number of parallel workers (1-50)',\n default: 3,\n min: 1,\n max: 50,\n })) ?? 3;\n\n const dryRun = await confirm({\n message: 'Enable dry-run mode (mock responses)?',\n default: false,\n });\n\n const cache = await confirm({\n message: 'Enable response cache?',\n default: false,\n });\n\n return { workers, dryRun, cache };\n}\n\nasync function promptReviewAndConfirm(config: InteractiveConfig, cwd: string): Promise<boolean> {\n const evalDisplay = config.evalPaths\n .map((p) => {\n const rel = p.startsWith(cwd) ? p.slice(cwd.length + 1) : p;\n return ` ${rel}`;\n })\n .join('\\n');\n\n console.log(`\\n${ANSI_BOLD}Review Configuration${ANSI_RESET}`);\n console.log(`${ANSI_DIM}${'─'.repeat(40)}${ANSI_RESET}`);\n console.log(`${ANSI_GREEN}Eval files:${ANSI_RESET}\\n${evalDisplay}`);\n console.log(`${ANSI_GREEN}Target:${ANSI_RESET} ${config.target}`);\n console.log(`${ANSI_GREEN}Workers:${ANSI_RESET} ${config.workers}`);\n console.log(`${ANSI_GREEN}Dry run:${ANSI_RESET} ${config.dryRun ? 'yes' : 'no'}`);\n console.log(`${ANSI_GREEN}Cache:${ANSI_RESET} ${config.cache ? 'yes' : 'no'}`);\n console.log(`${ANSI_DIM}${'─'.repeat(40)}${ANSI_RESET}`);\n\n return confirm({\n message: 'Run evaluation with this configuration?',\n default: true,\n });\n}\n\nasync function executeConfig(config: InteractiveConfig): Promise<void> {\n const rawOptions: Record<string, unknown> = {\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n outputFormat: 'jsonl',\n dryRunDelay: 0,\n dryRunDelayMin: 0,\n dryRunDelayMax: 0,\n agentTimeout: 120,\n maxRetries: 2,\n verbose: false,\n keepWorkspaces: false,\n cleanupWorkspaces: false,\n trace: false,\n };\n\n const result = await runEvalCommand({\n testFiles: [...config.evalPaths],\n rawOptions,\n });\n\n // Prompt to retry errors when execution errors were detected in a TTY\n if (result && result.executionErrorCount > 0 && process.stdin.isTTY) {\n await promptRetryErrors(config, result.outputPath);\n }\n}\n\nasync function promptRetryErrors(config: InteractiveConfig, outputPath: string): Promise<void> {\n const shouldRetry = await confirm({\n message: `Retry ${ANSI_BOLD}execution errors${ANSI_RESET} from this run?`,\n default: true,\n });\n\n if (!shouldRetry) {\n return;\n }\n\n console.log(`\\n${ANSI_DIM}Retrying execution errors...${ANSI_RESET}\\n`);\n\n const rawOptions: Record<string, unknown> = {\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n outputFormat: 'jsonl',\n retryErrors: outputPath,\n out: outputPath,\n dryRunDelay: 0,\n dryRunDelayMin: 0,\n dryRunDelayMax: 0,\n agentTimeout: 120,\n maxRetries: 2,\n verbose: false,\n keepWorkspaces: false,\n cleanupWorkspaces: false,\n trace: false,\n };\n\n const retryResult = await runEvalCommand({\n testFiles: [...config.evalPaths],\n rawOptions,\n });\n\n // Allow chained retries if there are still errors\n if (retryResult && retryResult.executionErrorCount > 0 && process.stdin.isTTY) {\n await promptRetryErrors(config, retryResult.outputPath);\n }\n}\n","import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { getAgentvConfigDir } from '@agentv/core';\n\nconst CONFIG_DIR = getAgentvConfigDir();\nconst LAST_CONFIG_PATH = path.join(CONFIG_DIR, 'last-config.json');\n\nexport interface LastConfig {\n readonly timestamp: string;\n readonly cwd: string;\n readonly evalPaths: readonly string[];\n readonly target: string;\n readonly workers: number;\n readonly dryRun: boolean;\n readonly cache: boolean;\n}\n\nexport async function loadLastConfig(): Promise<LastConfig | undefined> {\n try {\n const content = await readFile(LAST_CONFIG_PATH, 'utf-8');\n return JSON.parse(content) as LastConfig;\n } catch {\n return undefined;\n }\n}\n\nexport async function saveLastConfig(config: LastConfig): Promise<void> {\n await mkdir(CONFIG_DIR, { recursive: true });\n await writeFile(LAST_CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,WAAU;AAEjB,SAAS,UAAU,SAAS,QAAQ,QAAQ,cAAc;;;ACF1D,SAAS,OAAO,UAAU,iBAAiB;AAC3C,OAAO,UAAU;AAGjB,IAAM,aAAa,mBAAmB;AACtC,IAAM,mBAAmB,KAAK,KAAK,YAAY,kBAAkB;AAYjE,eAAsB,iBAAkD;AACtE,MAAI;AACF,UAAM,UAAU,MAAM,SAAS,kBAAkB,OAAO;AACxD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,eAAe,QAAmC;AACtE,QAAM,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC;AAC3C,QAAM,UAAU,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,GAAG,OAAO;AAC5E;;;ADdA,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,aAAa;AAanB,eAAsB,0BAAyC;AAC7D,QAAM,MAAM,QAAQ,IAAI;AAExB,UAAQ,IAAI;AAAA,EAAK,SAAS,GAAG,SAAS,0BAA0B,UAAU;AAAA,CAAI;AAE9E,QAAM,aAAa,MAAM,eAAe;AACxC,QAAM,SAAS,MAAM,eAAe,UAAU;AAE9C,MAAI,WAAW,QAAQ;AACrB;AAAA,EACF;AAEA,MAAI,WAAW,WAAW,YAAY;AACpC,YAAQ,IAAI;AAAA,EAAK,QAAQ,kCAAkC,UAAU;AAAA,CAAI;AACzE,UAAM,cAAc;AAAA,MAClB,WAAW,WAAW;AAAA,MACtB,QAAQ,WAAW;AAAA,MACnB,SAAS,WAAW;AAAA,MACpB,QAAQ,WAAW;A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AA,IAChB,QAAQ,OAAO;AAAA,IACf,OAAO,OAAO;AAAA,IACd,cAAc;AAAA,IACd,aAAa;AAAA,IACb,KAAK;AAAA,IACL,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,OAAO;AAAA,EACT;AAEA,QAAM,cAAc,MAAM,eAAe;AAAA,IACvC,WAAW,CAAC,GAAG,OAAO,SAAS;AAAA,IAC/B;AAAA,EACF,CAAC;AAGD,MAAI,eAAe,YAAY,sBAAsB,KAAK,QAAQ,MAAM,OAAO;AAC7E,UAAM,kBAAkB,QAAQ,YAAY,UAAU;AAAA,EACxD;AACF;","names":["path","path"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/eval/interactive.ts","../src/commands/eval/last-config.ts"],"sourcesContent":["import path from 'node:path';\nimport { listTargetNames, readTargetDefinitions } from '@agentv/core';\nimport { checkbox, confirm, number, search, select } from '@inquirer/prompts';\n\nimport { TARGET_FILE_CANDIDATES, fileExists } from '../../utils/targets.js';\nimport {\n type DiscoveredEvalFile,\n discoverEvalFiles,\n filterByCategory,\n getCategories,\n} from './discover.js';\nimport { type LastConfig, loadLastConfig, saveLastConfig } from './last-config.js';\nimport { runEvalCommand } from './run-eval.js';\nimport { findRepoRoot } from './shared.js';\n\nconst ANSI_BOLD = '\\x1b[1m';\nconst ANSI_DIM = '\\x1b[2m';\nconst ANSI_CYAN = '\\x1b[36m';\nconst ANSI_GREEN = '\\x1b[32m';\nconst ANSI_RESET = '\\x1b[0m';\n\nexport interface InteractiveConfig {\n readonly evalPaths: readonly string[];\n readonly target: string;\n readonly workers: number;\n readonly dryRun: boolean;\n readonly cache: boolean;\n}\n\n/**\n * Launch the interactive wizard when `agentv eval` is called with no arguments.\n */\nexport async function launchInteractiveWizard(): Promise<void> {\n const cwd = process.cwd();\n\n console.log(`\\n${ANSI_BOLD}${ANSI_CYAN}AgentV Interactive Mode${ANSI_RESET}\\n`);\n\n const lastConfig = await loadLastConfig();\n const action = await promptMainMenu(lastConfig);\n\n if (action === 'exit') {\n return;\n }\n\n if (action === 'rerun' && lastConfig) {\n console.log(`\\n${ANSI_DIM}Rerunning last configuration...${ANSI_RESET}\\n`);\n await executeConfig({\n evalPaths: lastConfig.evalPaths,\n target: lastConfig.target,\n workers: lastConfig.workers,\n dryRun: lastConfig.dryRun,\n cache: lastConfig.cache,\n });\n return;\n }\n\n // Run new evaluation flow\n const config = await promptNewEvaluation(cwd);\n if (!config) {\n return;\n }\n\n // Review & confirm\n const confirmed = await promptReviewAndConfirm(config, cwd);\n if (!confirmed) {\n return;\n }\n\n // Save last config\n await saveLastConfig({\n timestamp: new Date().toISOString(),\n cwd,\n evalPaths: config.evalPaths,\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n });\n\n await executeConfig(config);\n}\n\nasync function promptMainMenu(\n lastConfig: LastConfig | undefined,\n): Promise<'new' | 'rerun' | 'exit'> {\n type MenuChoice = 'new' | 'rerun' | 'exit';\n const choices: Array<{ name: string; value: MenuChoice; description?: string }> = [];\n\n if (lastConfig) {\n const evalCount = lastConfig.evalPaths.length;\n choices.push({\n name: '🔄 Rerun last config',\n value: 'rerun',\n description: `${evalCount} eval file(s), target: ${lastConfig.target}`,\n });\n }\n\n choices.push({ name: '🚀 Run new evaluation', value: 'new' }, { name: '✕ Exit', value: 'exit' });\n\n return select<MenuChoice>({\n message: 'What would you like to do?',\n choices,\n });\n}\n\nasync function promptNewEvaluation(cwd: string): Promise<InteractiveConfig | undefined> {\n // Step 1: Discover eval files\n console.log(`\\n${ANSI_DIM}Scanning for eval files...${ANSI_RESET}`);\n const allFiles = await discoverEvalFiles(cwd);\n\n if (allFiles.length === 0) {\n console.log(\n '\\n⚠ No eval files found in the current directory.\\n' +\n ' Place .yaml or .jsonl eval files in your project, or use:\\n' +\n ' agentv eval <path-to-eval.yaml>\\n',\n );\n return undefined;\n }\n\n console.log(`${ANSI_DIM}Found ${allFiles.length} eval file(s)${ANSI_RESET}\\n`);\n\n // Step 2: Select eval files (optionally filter by category first)\n const selectedFiles = await promptEvalSelection(allFiles);\n if (selectedFiles.length === 0) {\n console.log('\\nNo eval files selected.');\n return undefined;\n }\n\n // Step 3: Select target\n const target = await promptTargetSelection(cwd, selectedFiles[0].path);\n\n // Step 4: Advanced options\n const advanced = await promptAdvancedOptions();\n\n return {\n evalPaths: selectedFiles.map((f) => f.path),\n target,\n ...advanced,\n };\n}\n\nasync function promptEvalSelection(\n allFiles: readonly DiscoveredEvalFile[],\n): Promise<DiscoveredEvalFile[]> {\n const categories = getCategories(allFiles);\n\n // If only one category or few files, skip category selection\n let filesToSelect: readonly DiscoveredEvalFile[];\n\n if (categories.length > 1) {\n const selectedCategory = await search<string>({\n message: 'Select a category (type to search)',\n source: async (term) => {\n const filtered = term\n ? categories.filter((c) => c.toLowerCase().includes(term.toLowerCase()))\n : categories;\n return [\n { name: '(all categories)', value: '__all__' },\n ...filtered.map((c) => {\n const count = filterByCategory(allFiles, c).length;\n return { name: `${c} (${count} file${count > 1 ? 's' : ''})`, value: c };\n }),\n ];\n },\n });\n\n filesToSelect =\n selectedCategory === '__all__' ? allFiles : filterByCategory(allFiles, selectedCategory);\n } else {\n filesToSelect = allFiles;\n }\n\n return checkbox<DiscoveredEvalFile>({\n message: 'Select eval files to run (space to toggle, enter to confirm)',\n choices: filesToSelect.map((f) => ({\n name: f.relativePath,\n value: f,\n checked: filesToSelect.length <= 5, // auto-select if few files\n })),\n required: true,\n });\n}\n\nasync function promptTargetSelection(cwd: string, firstEvalPath: string): Promise<string> {\n const repoRoot = await findRepoRoot(cwd);\n\n // Try to find targets.yaml — search near the eval file first, then cwd/repoRoot\n const targetsPath = await findTargetsFile(cwd, repoRoot, firstEvalPath);\n\n if (!targetsPath) {\n console.log(`${ANSI_DIM}No targets.yaml found. Using default target.${ANSI_RESET}`);\n return 'default';\n }\n\n const definitions = await readTargetDefinitions(targetsPath);\n const targetNames = listTargetNames(definitions);\n\n if (targetNames.length === 0) {\n return 'default';\n }\n\n if (targetNames.length === 1) {\n console.log(`${ANSI_DIM}Using target: ${targetNames[0]}${ANSI_RESET}`);\n return targetNames[0];\n }\n\n return search<string>({\n message: 'Select a target (type to search)',\n source: async (term) => {\n const filtered = term\n ? targetNames.filter((t) => t.toLowerCase().includes(term.toLowerCase()))\n : targetNames;\n return filtered.map((t) => {\n const def = definitions.find((d) => d.name === t);\n return {\n name: t,\n value: t,\n description: def ? `provider: ${def.provider}` : undefined,\n };\n });\n },\n });\n}\n\nasync function findTargetsFile(\n cwd: string,\n repoRoot: string,\n evalFilePath?: string,\n): Promise<string | undefined> {\n // Build directory chain: eval file dir → cwd → repoRoot (mirrors discoverTargetsFile)\n const dirsToSearch: string[] = [];\n\n if (evalFilePath) {\n const evalDir = path.dirname(evalFilePath);\n if (!dirsToSearch.includes(evalDir)) {\n dirsToSearch.push(evalDir);\n }\n }\n\n if (!dirsToSearch.includes(cwd)) {\n dirsToSearch.push(cwd);\n }\n\n if (repoRoot !== cwd && !dirsToSearch.includes(repoRoot)) {\n dirsToSearch.push(repoRoot);\n }\n\n for (const dir of dirsToSearch) {\n for (const candidate of TARGET_FILE_CANDIDATES) {\n const fullPath = `${dir}/${candidate}`;\n if (await fileExists(fullPath)) {\n return fullPath;\n }\n }\n }\n\n return undefined;\n}\n\nasync function promptAdvancedOptions(): Promise<{\n workers: number;\n dryRun: boolean;\n cache: boolean;\n}> {\n const customize = await confirm({\n message: 'Configure advanced options?',\n default: false,\n });\n\n if (!customize) {\n return { workers: 3, dryRun: false, cache: false };\n }\n\n const workers =\n (await number({\n message: 'Number of parallel workers (1-50)',\n default: 3,\n min: 1,\n max: 50,\n })) ?? 3;\n\n const dryRun = await confirm({\n message: 'Enable dry-run mode (mock responses)?',\n default: false,\n });\n\n const cache = await confirm({\n message: 'Enable response cache?',\n default: false,\n });\n\n return { workers, dryRun, cache };\n}\n\nasync function promptReviewAndConfirm(config: InteractiveConfig, cwd: string): Promise<boolean> {\n const evalDisplay = config.evalPaths\n .map((p) => {\n const rel = p.startsWith(cwd) ? p.slice(cwd.length + 1) : p;\n return ` ${rel}`;\n })\n .join('\\n');\n\n console.log(`\\n${ANSI_BOLD}Review Configuration${ANSI_RESET}`);\n console.log(`${ANSI_DIM}${'─'.repeat(40)}${ANSI_RESET}`);\n console.log(`${ANSI_GREEN}Eval files:${ANSI_RESET}\\n${evalDisplay}`);\n console.log(`${ANSI_GREEN}Target:${ANSI_RESET} ${config.target}`);\n console.log(`${ANSI_GREEN}Workers:${ANSI_RESET} ${config.workers}`);\n console.log(`${ANSI_GREEN}Dry run:${ANSI_RESET} ${config.dryRun ? 'yes' : 'no'}`);\n console.log(`${ANSI_GREEN}Cache:${ANSI_RESET} ${config.cache ? 'yes' : 'no'}`);\n console.log(`${ANSI_DIM}${'─'.repeat(40)}${ANSI_RESET}`);\n\n return confirm({\n message: 'Run evaluation with this configuration?',\n default: true,\n });\n}\n\nasync function executeConfig(config: InteractiveConfig): Promise<void> {\n const rawOptions: Record<string, unknown> = {\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n outputFormat: 'jsonl',\n dryRunDelay: 0,\n dryRunDelayMin: 0,\n dryRunDelayMax: 0,\n agentTimeout: 120,\n maxRetries: 2,\n verbose: false,\n keepWorkspaces: false,\n cleanupWorkspaces: false,\n trace: false,\n };\n\n const result = await runEvalCommand({\n testFiles: [...config.evalPaths],\n rawOptions,\n });\n\n // Prompt to retry errors when execution errors were detected in a TTY\n if (result && result.executionErrorCount > 0 && process.stdin.isTTY) {\n await promptRetryErrors(config, result.outputPath);\n }\n}\n\nasync function promptRetryErrors(config: InteractiveConfig, outputPath: string): Promise<void> {\n const shouldRetry = await confirm({\n message: `Retry ${ANSI_BOLD}execution errors${ANSI_RESET} from this run?`,\n default: true,\n });\n\n if (!shouldRetry) {\n return;\n }\n\n console.log(`\\n${ANSI_DIM}Retrying execution errors...${ANSI_RESET}\\n`);\n\n const rawOptions: Record<string, unknown> = {\n target: config.target,\n workers: config.workers,\n dryRun: config.dryRun,\n cache: config.cache,\n outputFormat: 'jsonl',\n retryErrors: outputPath,\n out: outputPath,\n dryRunDelay: 0,\n dryRunDelayMin: 0,\n dryRunDelayMax: 0,\n agentTimeout: 120,\n maxRetries: 2,\n verbose: false,\n keepWorkspaces: false,\n cleanupWorkspaces: false,\n trace: false,\n };\n\n const retryResult = await runEvalCommand({\n testFiles: [...config.evalPaths],\n rawOptions,\n });\n\n // Allow chained retries if there are still errors\n if (retryResult && retryResult.executionErrorCount > 0 && process.stdin.isTTY) {\n await promptRetryErrors(config, retryResult.outputPath);\n }\n}\n","import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { getAgentvConfigDir } from '@agentv/core';\n\nconst CONFIG_DIR = getAgentvConfigDir();\nconst LAST_CONFIG_PATH = path.join(CONFIG_DIR, 'last-config.json');\n\nexport interface LastConfig {\n readonly timestamp: string;\n readonly cwd: string;\n readonly evalPaths: readonly string[];\n readonly target: string;\n readonly workers: number;\n readonly dryRun: boolean;\n readonly cache: boolean;\n}\n\nexport async function loadLastConfig(): Promise<LastConfig | undefined> {\n try {\n const content = await readFile(LAST_CONFIG_PATH, 'utf-8');\n return JSON.parse(content) as LastConfig;\n } catch {\n return undefined;\n }\n}\n\nexport async function saveLastConfig(config: LastConfig): Promise<void> {\n await mkdir(CONFIG_DIR, { recursive: true });\n await writeFile(LAST_CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,WAAU;AAEjB,SAAS,UAAU,SAAS,QAAQ,QAAQ,cAAc;;;ACF1D,SAAS,OAAO,UAAU,iBAAiB;AAC3C,OAAO,UAAU;AAGjB,IAAM,aAAa,mBAAmB;AACtC,IAAM,mBAAmB,KAAK,KAAK,YAAY,kBAAkB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