@sverka/arena 0.1.8 → 0.1.10
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/bin.d.mts +13 -1
- package/dist/bin.d.mts.map +1 -0
- package/dist/bin.mjs +156 -6
- package/dist/bin.mjs.map +1 -1
- package/dist/index.d.mts +68 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1079
- package/dist/report-DM4LfVAm.mjs +1245 -0
- package/dist/report-DM4LfVAm.mjs.map +1 -0
- package/package.json +5 -2
- package/dist/index.mjs.map +0 -1
package/dist/bin.d.mts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/bin.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* sverka-arena — CLI for the agent arena: run the benchmark matrix, render
|
|
4
|
+
* saved results, check the environment. Spec: specs/49-arena-cli.
|
|
5
|
+
*/
|
|
6
|
+
interface Io {
|
|
7
|
+
out(s: string): void;
|
|
8
|
+
err(s: string): void;
|
|
9
|
+
}
|
|
10
|
+
/** Entry point — exported for tests; bin calls it with process.argv. */
|
|
11
|
+
export declare function main(argv: readonly string[], io?: Io): Promise<number>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//# sourceMappingURL=bin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.mts","names":[],"sources":["../src/bin.ts"],"mappings":";;;;;UAgBU;EACR,IAAI;EACJ,IAAI;;;wBA+JgB,KACpB,yBACA,KAAI,KACH"}
|
package/dist/bin.mjs
CHANGED
|
@@ -1,13 +1,163 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { i as loadArenaConfig, l as runArena, n as ArenaError, t as renderReport } from "./report-DM4LfVAm.mjs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { delimiter, join, resolve } from "node:path";
|
|
2
6
|
import process from "node:process";
|
|
3
7
|
//#region src/bin.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* sverka-arena — CLI for the agent arena: run the benchmark matrix, render
|
|
10
|
+
* saved results, check the environment. Spec: specs/49-arena-cli.
|
|
11
|
+
*/
|
|
12
|
+
const USAGE = `usage: sverka-arena <command> [options]
|
|
13
|
+
|
|
14
|
+
commands:
|
|
15
|
+
run [--config <path>] [--out <dir>] [--format json|text]
|
|
16
|
+
report <results.json> [--format json|text]
|
|
17
|
+
doctor [--config <path>] [--format json|text]
|
|
18
|
+
`;
|
|
19
|
+
function flagValue(argv, i) {
|
|
20
|
+
const val = argv[i + 1];
|
|
21
|
+
if (val === void 0 || val.startsWith("--")) throw new ArenaError(`${argv[i]} requires a value`, "CONFIG_INVALID");
|
|
22
|
+
return val;
|
|
23
|
+
}
|
|
24
|
+
function parseFormat(val) {
|
|
25
|
+
if (val !== "json" && val !== "text") throw new ArenaError(`invalid --format '${val}'`, "CONFIG_INVALID");
|
|
26
|
+
return val;
|
|
27
|
+
}
|
|
28
|
+
function parseArgs(argv) {
|
|
29
|
+
const positional = [];
|
|
30
|
+
let config = "arena.config.ts";
|
|
31
|
+
let out;
|
|
32
|
+
let format = "text";
|
|
33
|
+
let command;
|
|
34
|
+
for (let i = 0; i < argv.length; i++) {
|
|
35
|
+
const arg = argv[i];
|
|
36
|
+
switch (arg) {
|
|
37
|
+
case "--config":
|
|
38
|
+
config = flagValue(argv, i);
|
|
39
|
+
i += 1;
|
|
40
|
+
break;
|
|
41
|
+
case "--out":
|
|
42
|
+
out = flagValue(argv, i);
|
|
43
|
+
i += 1;
|
|
44
|
+
break;
|
|
45
|
+
case "--format":
|
|
46
|
+
format = parseFormat(flagValue(argv, i));
|
|
47
|
+
i += 1;
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
if (arg.startsWith("--")) throw new ArenaError(`unknown option '${arg}'`, "CONFIG_INVALID");
|
|
51
|
+
if (command === void 0) command = arg;
|
|
52
|
+
else positional.push(arg);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
command,
|
|
57
|
+
positional,
|
|
58
|
+
config,
|
|
59
|
+
out,
|
|
60
|
+
format
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function which(bin) {
|
|
64
|
+
const exts = process.platform === "win32" ? ["", ...(process.env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";")] : [""];
|
|
65
|
+
for (const dir of (process.env.PATH ?? "").split(delimiter)) if (exts.some((ext) => existsSync(join(dir, bin + ext)))) return true;
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
async function cmdReport(args, io) {
|
|
69
|
+
const file = args.positional[0];
|
|
70
|
+
if (file === void 0) {
|
|
71
|
+
io.err("report: missing <results.json> path");
|
|
72
|
+
return 2;
|
|
73
|
+
}
|
|
74
|
+
let result;
|
|
75
|
+
try {
|
|
76
|
+
result = JSON.parse(await readFile(file, "utf8"));
|
|
77
|
+
} catch (err) {
|
|
78
|
+
io.err(`report: cannot read '${file}': ${err instanceof Error ? err.message : String(err)}`);
|
|
79
|
+
return 2;
|
|
80
|
+
}
|
|
81
|
+
if (!Array.isArray(result.aggregates) || !Array.isArray(result.analysis) || !Array.isArray(result.results)) {
|
|
82
|
+
io.err(`report: '${file}' is not a sverka-arena results file\n`);
|
|
83
|
+
return 2;
|
|
84
|
+
}
|
|
85
|
+
if (args.format === "json") io.out(JSON.stringify(result, null, 2) + "\n");
|
|
86
|
+
else io.out(renderReport(result) + "\n");
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
async function cmdRun(args, io) {
|
|
90
|
+
const config = await loadArenaConfig(args.config);
|
|
91
|
+
if (args.out !== void 0) config.outputDir = resolve(args.out);
|
|
92
|
+
const result = await runArena(config);
|
|
93
|
+
if (args.format === "json") io.out(JSON.stringify(result, null, 2) + "\n");
|
|
94
|
+
else io.out(renderReport(result) + "\n");
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
async function cmdDoctor(args, io) {
|
|
98
|
+
const config = await loadArenaConfig(args.config);
|
|
99
|
+
const checks = [];
|
|
100
|
+
const agentFound = which(config.agent.id);
|
|
101
|
+
checks.push({
|
|
102
|
+
name: `agent binary: ${config.agent.id}`,
|
|
103
|
+
ok: agentFound,
|
|
104
|
+
detail: agentFound ? "on PATH" : "not found on PATH"
|
|
105
|
+
});
|
|
106
|
+
const models = config.judge ? [...config.models, config.judge.model] : config.models;
|
|
107
|
+
for (const m of models) {
|
|
108
|
+
if (m.envVar === void 0) continue;
|
|
109
|
+
checks.push({
|
|
110
|
+
name: `env: ${m.envVar} (model ${m.id})`,
|
|
111
|
+
ok: process.env[m.envVar] !== void 0,
|
|
112
|
+
detail: process.env[m.envVar] !== void 0 ? "set" : "not set"
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (args.format === "json") io.out(JSON.stringify({ checks }, null, 2) + "\n");
|
|
116
|
+
else for (const chk of checks) io.out(`${chk.ok ? "ok" : "FAIL"} ${chk.name} — ${chk.detail}\n`);
|
|
117
|
+
return checks.every((chk) => chk.ok) ? 0 : 1;
|
|
118
|
+
}
|
|
119
|
+
const defaultIo = {
|
|
120
|
+
out: (s) => process.stdout.write(s),
|
|
121
|
+
err: (s) => process.stderr.write(s)
|
|
122
|
+
};
|
|
123
|
+
/** Entry point — exported for tests; bin calls it with process.argv. */
|
|
124
|
+
async function main(argv, io = defaultIo) {
|
|
125
|
+
let args;
|
|
126
|
+
try {
|
|
127
|
+
args = parseArgs(argv);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
io.err((err instanceof Error ? err.message : String(err)) + "\n");
|
|
130
|
+
io.err(USAGE);
|
|
131
|
+
return 2;
|
|
132
|
+
}
|
|
133
|
+
if (args.command === void 0) {
|
|
134
|
+
io.err(USAGE);
|
|
135
|
+
return 2;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
switch (args.command) {
|
|
139
|
+
case "run": return await cmdRun(args, io);
|
|
140
|
+
case "report": return await cmdReport(args, io);
|
|
141
|
+
case "doctor": return await cmdDoctor(args, io);
|
|
142
|
+
default:
|
|
143
|
+
io.err(`unknown command '${args.command}'\n`);
|
|
144
|
+
io.err(USAGE);
|
|
145
|
+
return 2;
|
|
146
|
+
}
|
|
147
|
+
} catch (err) {
|
|
148
|
+
if (err instanceof ArenaError) {
|
|
149
|
+
io.err(`error: ${err.message}\n`);
|
|
150
|
+
return 2;
|
|
151
|
+
}
|
|
152
|
+
io.err(`error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
153
|
+
return 3;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
157
|
+
const code = await main(process.argv.slice(2));
|
|
158
|
+
process.exit(code);
|
|
7
159
|
}
|
|
8
|
-
const code = await main();
|
|
9
|
-
process.exit(code);
|
|
10
160
|
//#endregion
|
|
11
|
-
export {};
|
|
161
|
+
export { main };
|
|
12
162
|
|
|
13
163
|
//# sourceMappingURL=bin.mjs.map
|
package/dist/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport process from \"node:process\";\n// Stub — will be implemented in next phase\nasync function main(): Promise<number> {\n process.stderr.write(\"arena CLI — not yet implemented\\n\");\n return 1;\n}\n\nconst code = await main();\nprocess.exit(code);\n"],"mappings":";;;AAGA,eAAe,OAAwB;CACrC,QAAQ,OAAO,MAAM,mCAAmC;CACxD,OAAO;AACT;AAEA,MAAM,OAAO,MAAM,KAAK;AACxB,QAAQ,KAAK,IAAI"}
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * sverka-arena — CLI for the agent arena: run the benchmark matrix, render\n * saved results, check the environment. Spec: specs/49-arena-cli.\n */\n\nimport process from \"node:process\";\nimport { readFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { delimiter, join, resolve } from \"node:path\";\n\nimport type { ArenaResult } from \"./types.js\";\nimport { ArenaError, loadArenaConfig } from \"./config.js\";\nimport { renderReport } from \"./report.js\";\nimport { runArena } from \"./runner.js\";\n\ninterface Io {\n out(s: string): void;\n err(s: string): void;\n}\n\ninterface ParsedArgs {\n command: string | undefined;\n positional: string[];\n config: string;\n out: string | undefined;\n format: \"text\" | \"json\";\n}\n\nconst USAGE = `usage: sverka-arena <command> [options]\n\ncommands:\n run [--config <path>] [--out <dir>] [--format json|text]\n report <results.json> [--format json|text]\n doctor [--config <path>] [--format json|text]\n`;\n\nfunction flagValue(argv: readonly string[], i: number): string {\n const val = argv[i + 1];\n if (val === undefined || val.startsWith(\"--\")) {\n throw new ArenaError(`${argv[i]} requires a value`, \"CONFIG_INVALID\");\n }\n return val;\n}\n\nfunction parseFormat(val: string): \"text\" | \"json\" {\n if (val !== \"json\" && val !== \"text\") {\n throw new ArenaError(`invalid --format '${val}'`, \"CONFIG_INVALID\");\n }\n return val;\n}\n\nfunction parseArgs(argv: readonly string[]): ParsedArgs {\n const positional: string[] = [];\n let config = \"arena.config.ts\";\n let out: string | undefined;\n let format: \"text\" | \"json\" = \"text\";\n let command: string | undefined;\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i]!;\n switch (arg) {\n case \"--config\":\n config = flagValue(argv, i);\n i += 1;\n break;\n case \"--out\":\n out = flagValue(argv, i);\n i += 1;\n break;\n case \"--format\":\n format = parseFormat(flagValue(argv, i));\n i += 1;\n break;\n default:\n if (arg.startsWith(\"--\")) {\n throw new ArenaError(`unknown option '${arg}'`, \"CONFIG_INVALID\");\n }\n if (command === undefined) command = arg;\n else positional.push(arg);\n }\n }\n return { command, positional, config, out, format };\n}\n\nfunction which(bin: string): boolean {\n const exts =\n process.platform === \"win32\"\n ? [\"\", ...(process.env.PATHEXT ?? \".EXE;.CMD;.BAT\").split(\";\")]\n : [\"\"];\n for (const dir of (process.env.PATH ?? \"\").split(delimiter)) {\n if (exts.some((ext) => existsSync(join(dir, bin + ext)))) return true;\n }\n return false;\n}\n\nasync function cmdReport(args: ParsedArgs, io: Io): Promise<number> {\n const file = args.positional[0];\n if (file === undefined) {\n io.err(\"report: missing <results.json> path\");\n return 2;\n }\n let result: ArenaResult;\n try {\n result = JSON.parse(await readFile(file, \"utf8\")) as ArenaResult;\n } catch (err) {\n io.err(\n `report: cannot read '${file}': ${err instanceof Error ? err.message : String(err)}`,\n );\n return 2;\n }\n if (\n !Array.isArray(result.aggregates) ||\n !Array.isArray(result.analysis) ||\n !Array.isArray(result.results)\n ) {\n io.err(`report: '${file}' is not a sverka-arena results file\\n`);\n return 2;\n }\n if (args.format === \"json\") {\n io.out(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n io.out(renderReport(result) + \"\\n\");\n }\n return 0;\n}\n\nasync function cmdRun(args: ParsedArgs, io: Io): Promise<number> {\n const config = await loadArenaConfig(args.config);\n if (args.out !== undefined) config.outputDir = resolve(args.out);\n const result = await runArena(config);\n if (args.format === \"json\") {\n io.out(JSON.stringify(result, null, 2) + \"\\n\");\n } else {\n io.out(renderReport(result) + \"\\n\");\n }\n return 0;\n}\n\nasync function cmdDoctor(args: ParsedArgs, io: Io): Promise<number> {\n const config = await loadArenaConfig(args.config);\n const checks: { name: string; ok: boolean; detail: string }[] = [];\n\n const agentFound = which(config.agent.id);\n checks.push({\n name: `agent binary: ${config.agent.id}`,\n ok: agentFound,\n detail: agentFound ? \"on PATH\" : \"not found on PATH\",\n });\n\n const models = config.judge\n ? [...config.models, config.judge.model]\n : config.models;\n for (const m of models) {\n if (m.envVar === undefined) continue;\n checks.push({\n name: `env: ${m.envVar} (model ${m.id})`,\n ok: process.env[m.envVar] !== undefined,\n detail: process.env[m.envVar] !== undefined ? \"set\" : \"not set\",\n });\n }\n\n if (args.format === \"json\") {\n io.out(JSON.stringify({ checks }, null, 2) + \"\\n\");\n } else {\n for (const chk of checks) {\n io.out(`${chk.ok ? \"ok\" : \"FAIL\"} ${chk.name} — ${chk.detail}\\n`);\n }\n }\n return checks.every((chk) => chk.ok) ? 0 : 1;\n}\n\nconst defaultIo: Io = {\n out: (s) => process.stdout.write(s),\n err: (s) => process.stderr.write(s),\n};\n\n/** Entry point — exported for tests; bin calls it with process.argv. */\nexport async function main(\n argv: readonly string[],\n io: Io = defaultIo,\n): Promise<number> {\n let args: ParsedArgs;\n try {\n args = parseArgs(argv);\n } catch (err) {\n io.err((err instanceof Error ? err.message : String(err)) + \"\\n\");\n io.err(USAGE);\n return 2;\n }\n\n if (args.command === undefined) {\n io.err(USAGE);\n return 2;\n }\n\n try {\n switch (args.command) {\n case \"run\":\n return await cmdRun(args, io);\n case \"report\":\n return await cmdReport(args, io);\n case \"doctor\":\n return await cmdDoctor(args, io);\n default:\n io.err(`unknown command '${args.command}'\\n`);\n io.err(USAGE);\n return 2;\n }\n } catch (err) {\n if (err instanceof ArenaError) {\n io.err(`error: ${err.message}\\n`);\n return 2;\n }\n io.err(`error: ${err instanceof Error ? err.message : String(err)}\\n`);\n return 3;\n }\n}\n\n// Run when invoked directly (not imported by tests).\nif (import.meta.url === `file://${process.argv[1]}`) {\n const code = await main(process.argv.slice(2));\n process.exit(code);\n}\n"],"mappings":";;;;;;;;;;;AA6BA,MAAM,QAAQ;;;;;;;AAQd,SAAS,UAAU,MAAyB,GAAmB;CAC7D,MAAM,MAAM,KAAK,IAAI;CACrB,IAAI,QAAQ,KAAA,KAAa,IAAI,WAAW,IAAI,GAC1C,MAAM,IAAI,WAAW,GAAG,KAAK,GAAG,oBAAoB,gBAAgB;CAEtE,OAAO;AACT;AAEA,SAAS,YAAY,KAA8B;CACjD,IAAI,QAAQ,UAAU,QAAQ,QAC5B,MAAM,IAAI,WAAW,qBAAqB,IAAI,IAAI,gBAAgB;CAEpE,OAAO;AACT;AAEA,SAAS,UAAU,MAAqC;CACtD,MAAM,aAAuB,CAAC;CA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C;CAC7C,QAAQ,KAAK,IAAI;AACnB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChildProcess } from "node:child_process";
|
|
2
2
|
import * as acp from "@agentclientprotocol/sdk";
|
|
3
3
|
import { PromptResponse, SessionUpdate, Usage } from "@agentclientprotocol/sdk";
|
|
4
|
+
import { z } from "zod";
|
|
4
5
|
//#region src/types.d.ts
|
|
5
6
|
/** Agent adapter — pluggable interface for different agent CLIs */
|
|
6
7
|
interface AgentAdapter {
|
|
@@ -43,7 +44,8 @@ interface Task {
|
|
|
43
44
|
/** Optional expected output for deterministic comparison */
|
|
44
45
|
expectedOutput?: string;
|
|
45
46
|
/** Fixture project to copy into the workspace for this task.
|
|
46
|
-
*
|
|
47
|
+
* Relative paths resolve against the arena package root (programmatic
|
|
48
|
+
* use) — `loadArenaConfig` anchors them to the config file's directory.
|
|
47
49
|
* If omitted, the runner uses an empty temp directory. */
|
|
48
50
|
fixture?: string;
|
|
49
51
|
/** Optional deterministic checks to run after the agent finishes.
|
|
@@ -62,6 +64,7 @@ interface ArenaConfig {
|
|
|
62
64
|
agent: AgentAdapter;
|
|
63
65
|
models: ModelConfig[];
|
|
64
66
|
plugins: PluginConfig[];
|
|
67
|
+
/** Base dir for the per-run isolated workspaces (default: system temp). */
|
|
65
68
|
workspace?: string;
|
|
66
69
|
repetitions?: number;
|
|
67
70
|
outputDir: string;
|
|
@@ -422,5 +425,68 @@ export declare function judgeAllRuns(results: RunResult[], tasks: Task[], config
|
|
|
422
425
|
*/
|
|
423
426
|
export declare function compareCombos(baseline: RunResult, candidate: RunResult): ComboComparison;
|
|
424
427
|
//#endregion
|
|
425
|
-
|
|
428
|
+
//#region src/config.d.ts
|
|
429
|
+
export declare class ArenaError extends Error {
|
|
430
|
+
readonly code: "CONFIG_INVALID" | "CONFIG_NOT_FOUND" | "UNKNOWN_AGENT";
|
|
431
|
+
constructor(message: string, code: "CONFIG_INVALID" | "CONFIG_NOT_FOUND" | "UNKNOWN_AGENT");
|
|
432
|
+
}
|
|
433
|
+
export declare function resolveAdapter(name: string): AgentAdapter;
|
|
434
|
+
declare const configFileSchema: z.ZodObject<{
|
|
435
|
+
agent: z.ZodString;
|
|
436
|
+
models: z.ZodArray<z.ZodObject<{
|
|
437
|
+
id: z.ZodString;
|
|
438
|
+
name: z.ZodString;
|
|
439
|
+
envVar: z.ZodOptional<z.ZodString>;
|
|
440
|
+
}, z.core.$strip>>;
|
|
441
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
442
|
+
id: z.ZodString;
|
|
443
|
+
name: z.ZodString;
|
|
444
|
+
path: z.ZodString;
|
|
445
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
446
|
+
installPath: z.ZodOptional<z.ZodString>;
|
|
447
|
+
}, z.core.$strip>>>;
|
|
448
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
449
|
+
id: z.ZodString;
|
|
450
|
+
name: z.ZodString;
|
|
451
|
+
prompt: z.ZodString;
|
|
452
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
453
|
+
successCriteria: z.ZodOptional<z.ZodString>;
|
|
454
|
+
expectedOutput: z.ZodOptional<z.ZodString>;
|
|
455
|
+
fixture: z.ZodOptional<z.ZodString>;
|
|
456
|
+
checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
457
|
+
id: z.ZodString;
|
|
458
|
+
command: z.ZodString;
|
|
459
|
+
description: z.ZodString;
|
|
460
|
+
}, z.core.$strip>>>;
|
|
461
|
+
}, z.core.$strip>>;
|
|
462
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
463
|
+
repetitions: z.ZodOptional<z.ZodNumber>;
|
|
464
|
+
outputDir: z.ZodString;
|
|
465
|
+
judge: z.ZodOptional<z.ZodObject<{
|
|
466
|
+
model: z.ZodObject<{
|
|
467
|
+
id: z.ZodString;
|
|
468
|
+
name: z.ZodString;
|
|
469
|
+
envVar: z.ZodOptional<z.ZodString>;
|
|
470
|
+
}, z.core.$strip>;
|
|
471
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
472
|
+
repetitions: z.ZodOptional<z.ZodNumber>;
|
|
473
|
+
revealPlugins: z.ZodOptional<z.ZodBoolean>;
|
|
474
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
475
|
+
}, z.core.$strip>>;
|
|
476
|
+
}, z.core.$strip>;
|
|
477
|
+
/** Declarative config shape authored in `arena.config.ts`. */
|
|
478
|
+
type ArenaConfigFile = z.input<typeof configFileSchema>;
|
|
479
|
+
/** Type-only identity helper — gives configs full typechecking. */
|
|
480
|
+
export declare function defineConfig(config: ArenaConfigFile): ArenaConfigFile;
|
|
481
|
+
/**
|
|
482
|
+
* Load and validate an arena config file, resolving the named agent
|
|
483
|
+
* (and judge agent, defaulting to the same adapter) to live adapters.
|
|
484
|
+
*/
|
|
485
|
+
export declare function loadArenaConfig(configPath: string): Promise<ArenaConfig>;
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/report.d.ts
|
|
488
|
+
/** Render an ArenaResult as human-readable text. */
|
|
489
|
+
export declare function renderReport(result: ArenaResult): string;
|
|
490
|
+
//#endregion
|
|
491
|
+
export type { AgentAdapter, AgentProcess, AgentSpawnConfig, AggregateMetrics, ArenaConfig, ArenaConfigFile, ArenaResult, CaseAnalysis, CheckResult, ComboComparison, DeterministicCheck, JudgeConfig, JudgeVerdict, ModelConfig, Observation, PluginConfig, RunMetrics, RunResult, Task, ToolCall, ToolCallMessage, ToolCallUpdateMessage, TraceData, TraceStep };
|
|
426
492
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/adapters/devin.ts","../src/acp.ts","../src/runner.ts","../src/judge.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/adapters/devin.ts","../src/acp.ts","../src/runner.ts","../src/judge.ts","../src/config.ts","../src/report.ts"],"mappings":";;;;;;UACiB;EACf;EACA,MAAM,QAAQ,mBAAmB;;UAGlB;EACf,OAAO;EACP;EACA,SAAS;EACT;EACA,MAAM;;UAGS;EACf,IAAI,gBAAgB,oBAAoB,QAAQ;EAChD;;;UAIe;EACf;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;;EAEA;;EAEA;;;;;EAKA;;;EAGA,SAAS;;;UAIM;EACf;EACA;EACA;;;UAIe;EACf,OAAO;EACP,OAAO;EACP,QAAQ;EACR,SAAS;;EAET;EACA;EACA;;EAEA,QAAQ;;;UAIO;;EAEf,OAAO;;EAEP,OAAO;;EAEP;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA,SAAS;EACT,OAAO;;EAEP;EACA;;EAEA,cAAc;EACd;;EAEA,UAAU;;;UAIK;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf;EACA;EACA,OAAO;EACP;IACE;IACA;IACA;IACA;;;;UAKa;EACf;EACA;EACA;EACA;EACA,YAAY;EACZ,eAAe;EACf;;;UAIe;EACf;EACA,WAAW;EACX;;;UAIe;EACf;EACA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;;UAIe;EACf;EACA;IACE;IACA;IACA;IACA;IACA;;EAEF,SAAS;EACT,YAAY;;EAEZ,UAAU;;;UAIK;EACf;EACA;EACA;;EAEA,aAAa;;EAEb;;;UAIe;;EAEf;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;;;;;UCrMQ;EACR;EACA;EACA;EACA;EACA;IACE;IACA;MACE;MACA;;;;;UAMI;EACR;EACA;EACA;EACA;;;UAIQ;EACR;EACA;EACA;IACE;IACA;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