@lelouchhe/agent-evals 0.0.0-stage → 0.2.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.
Files changed (105) hide show
  1. package/.env.example +27 -0
  2. package/LICENSE +21 -0
  3. package/README.md +121 -2
  4. package/dist/checkers/file/index.d.ts +26 -0
  5. package/dist/checkers/file/index.js +396 -0
  6. package/dist/checkers/judge/index.d.ts +20 -0
  7. package/dist/checkers/judge/index.js +474 -0
  8. package/dist/checkers/judge/prompt.d.ts +19 -0
  9. package/dist/checkers/judge/prompt.js +55 -0
  10. package/dist/checkers/judge/trace.d.ts +6 -0
  11. package/dist/checkers/judge/trace.js +41 -0
  12. package/dist/checkers/mock/index.d.ts +18 -0
  13. package/dist/checkers/mock/index.js +127 -0
  14. package/dist/checkers/shell/index.d.ts +10 -0
  15. package/dist/checkers/shell/index.js +61 -0
  16. package/dist/checkers/trace/index.d.ts +22 -0
  17. package/dist/checkers/trace/index.js +183 -0
  18. package/dist/cli.d.ts +2 -0
  19. package/dist/cli.js +453 -0
  20. package/dist/engine/authoring.d.ts +24 -0
  21. package/dist/engine/authoring.js +356 -0
  22. package/dist/engine/check-runner.d.ts +1 -0
  23. package/dist/engine/check-runner.js +127 -0
  24. package/dist/engine/check-sandbox.d.ts +18 -0
  25. package/dist/engine/check-sandbox.js +171 -0
  26. package/dist/engine/config.d.ts +171 -0
  27. package/dist/engine/config.js +368 -0
  28. package/dist/engine/env-source.d.ts +10 -0
  29. package/dist/engine/env-source.js +114 -0
  30. package/dist/engine/files.d.ts +84 -0
  31. package/dist/engine/files.js +304 -0
  32. package/dist/engine/forwarder.sh +61 -0
  33. package/dist/engine/ignore.d.ts +29 -0
  34. package/dist/engine/ignore.js +67 -0
  35. package/dist/engine/messages.d.ts +8 -0
  36. package/dist/engine/messages.js +9 -0
  37. package/dist/engine/mock-match.d.ts +44 -0
  38. package/dist/engine/mock-match.js +104 -0
  39. package/dist/engine/mocks.d.ts +35 -0
  40. package/dist/engine/mocks.js +336 -0
  41. package/dist/engine/params.d.ts +18 -0
  42. package/dist/engine/params.js +96 -0
  43. package/dist/engine/placement.d.ts +26 -0
  44. package/dist/engine/placement.js +107 -0
  45. package/dist/engine/regex.d.ts +10 -0
  46. package/dist/engine/regex.js +16 -0
  47. package/dist/engine/registry.d.ts +243 -0
  48. package/dist/engine/registry.js +127 -0
  49. package/dist/engine/report.d.ts +17 -0
  50. package/dist/engine/report.js +420 -0
  51. package/dist/engine/results.d.ts +50 -0
  52. package/dist/engine/results.js +42 -0
  53. package/dist/engine/run.d.ts +50 -0
  54. package/dist/engine/run.js +710 -0
  55. package/dist/engine/runtime-assets.d.ts +6 -0
  56. package/dist/engine/runtime-assets.js +11 -0
  57. package/dist/engine/skills.d.ts +49 -0
  58. package/dist/engine/skills.js +270 -0
  59. package/dist/engine/truncate.d.ts +3 -0
  60. package/dist/engine/truncate.js +7 -0
  61. package/dist/engine/values.d.ts +18 -0
  62. package/dist/engine/values.js +75 -0
  63. package/dist/engine/view.d.ts +10 -0
  64. package/dist/engine/view.js +150 -0
  65. package/dist/engine/workspace.d.ts +63 -0
  66. package/dist/engine/workspace.js +305 -0
  67. package/dist/index.d.ts +16 -0
  68. package/dist/index.js +7 -0
  69. package/dist/platform/macos/launch.d.ts +13 -0
  70. package/dist/platform/macos/launch.js +14 -0
  71. package/dist/platform/macos/policy.d.ts +33 -0
  72. package/dist/platform/macos/policy.js +131 -0
  73. package/dist/platform/macos/supervise.d.ts +26 -0
  74. package/dist/platform/macos/supervise.js +98 -0
  75. package/dist/platform/macos/supervisor.sh +13 -0
  76. package/dist/runners/acp/agent.d.ts +17 -0
  77. package/dist/runners/acp/agent.js +38 -0
  78. package/dist/runners/acp/commands.d.ts +2 -0
  79. package/dist/runners/acp/commands.js +112 -0
  80. package/dist/runners/acp/environment.d.ts +71 -0
  81. package/dist/runners/acp/environment.js +280 -0
  82. package/dist/runners/acp/index.d.ts +21 -0
  83. package/dist/runners/acp/index.js +135 -0
  84. package/dist/runners/acp/session.d.ts +7 -0
  85. package/dist/runners/acp/session.js +48 -0
  86. package/dist/runners/acp/trace.d.ts +23 -0
  87. package/dist/runners/acp/trace.js +44 -0
  88. package/dist/runners/acp/usage.d.ts +12 -0
  89. package/dist/runners/acp/usage.js +56 -0
  90. package/dist/runners/noop/index.d.ts +12 -0
  91. package/dist/runners/noop/index.js +22 -0
  92. package/dist/runners/pi/index.d.ts +21 -0
  93. package/dist/runners/pi/index.js +116 -0
  94. package/dist/runners/pi/params.d.ts +10 -0
  95. package/dist/runners/pi/params.js +3 -0
  96. package/dist/runners/pi/rpc.d.ts +30 -0
  97. package/dist/runners/pi/rpc.js +341 -0
  98. package/dist/runners/pi/safe-process-group.d.ts +7 -0
  99. package/dist/runners/pi/safe-process-group.js +13 -0
  100. package/dist/runners/pi/session.d.ts +56 -0
  101. package/dist/runners/pi/session.js +298 -0
  102. package/dist/runners/pi/shell-wrapper.sh +46 -0
  103. package/dist/runners/pi/supervisor.d.ts +1 -0
  104. package/dist/runners/pi/supervisor.js +101 -0
  105. package/package.json +77 -4
@@ -0,0 +1,298 @@
1
+ import { access, mkdir, readFile, realpath, stat, writeFile } from "node:fs/promises";
2
+ import { constants } from "node:fs";
3
+ import { basename, dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { ConfigError, errorMessage } from "../../engine/config.js";
6
+ import { truncate } from "../../engine/truncate.js";
7
+ import { siblingRuntimeModule } from "../../engine/runtime-assets.js";
8
+ import { spawnSandboxed } from "../../platform/macos/launch.js";
9
+ import { writeSeatbeltPolicy } from "../../platform/macos/policy.js";
10
+ import { PiProcess, PiRpcError } from "./rpc.js";
11
+ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
12
+ export class PiSessionError extends Error {
13
+ diagnostics;
14
+ constructor(message, diagnostics = []) {
15
+ super(message);
16
+ this.name = "PiSessionError";
17
+ this.diagnostics = diagnostics;
18
+ }
19
+ }
20
+ /** Resolve the configured executable through PATH and canonicalize it. */
21
+ export async function resolvePiExecutable(executable) {
22
+ if (executable.length === 0) {
23
+ throw new ConfigError("pi executable must be a non-empty string");
24
+ }
25
+ const candidate = executable.includes("/") ? resolve(executable) : await findOnPath(executable);
26
+ if (candidate === undefined) {
27
+ throw new ConfigError(`pi executable not found on PATH: ${executable}`);
28
+ }
29
+ try {
30
+ return await realpath(candidate);
31
+ }
32
+ catch (error) {
33
+ throw new ConfigError(`pi executable is not accessible: ${candidate}: ${errorMessage(error)}`);
34
+ }
35
+ }
36
+ /**
37
+ * Run one isolated Pi RPC invocation. The Pi process and its descendants are
38
+ * always stopped before this function returns or throws.
39
+ */
40
+ export async function invokePi(config, message, options) {
41
+ if (options.signal.aborted) {
42
+ throw new PiSessionError("Pi invocation was aborted before launch");
43
+ }
44
+ const process = await createPiProcess(config);
45
+ const settled = process.waitForEvent("agent_settled", options.timeoutMs, options.signal);
46
+ // A startup failure can reject this waiter before it is awaited below.
47
+ settled.catch(() => { });
48
+ options.onProcess?.(() => process.stop());
49
+ try {
50
+ const response = (await process.command("prompt", { message }));
51
+ const disposition = response?.disposition;
52
+ if (disposition !== "started") {
53
+ throw new PiSessionError(`Pi did not start a run for the prompt (disposition: ${String(disposition)})`, diagnosticsOf(process));
54
+ }
55
+ const event = await settled;
56
+ if (event.aborted === true) {
57
+ throw new PiSessionError("Pi reported that the run was aborted", diagnosticsOf(process));
58
+ }
59
+ await assertFinalAssistantHealthy(process);
60
+ const data = (await process.command("get_last_assistant_text"));
61
+ const finalText = typeof data?.text === "string" ? data.text : null;
62
+ return { finalText, diagnostics: diagnosticsOf(process) };
63
+ }
64
+ catch (error) {
65
+ if (error instanceof PiSessionError) {
66
+ throw error;
67
+ }
68
+ if (error instanceof PiRpcError) {
69
+ throw new PiSessionError(error.message, error.diagnostics);
70
+ }
71
+ throw new PiSessionError(errorMessage(error), diagnosticsOf(process));
72
+ }
73
+ finally {
74
+ await stopPiSession(process);
75
+ }
76
+ }
77
+ /**
78
+ * Stop Pi. The in-sandbox supervisor terminates tracked shell groups and exits
79
+ * before this resolves; the host never signals groups from registry data.
80
+ */
81
+ export async function stopPiSession(process) {
82
+ await process.stop();
83
+ }
84
+ export function shellToolsDirectory(config) {
85
+ return join(config.runRootDir, "tools");
86
+ }
87
+ export function shellStateDirectory(config) {
88
+ return join(config.dirs.scratchDir, "shell-groups");
89
+ }
90
+ /** Prepare isolated state and start an RPC process without prompting it. */
91
+ export async function createPiProcess(config) {
92
+ const executable = await resolvePiExecutable(config.executable);
93
+ await mkdir(config.dirs.homeDir, { recursive: true, mode: 0o700 });
94
+ await mkdir(config.dirs.scratchDir, { recursive: true, mode: 0o700 });
95
+ await mkdir(config.dirs.configDir, { recursive: true, mode: 0o700 });
96
+ const toolsDir = shellToolsDirectory(config);
97
+ await mkdir(toolsDir, { recursive: true, mode: 0o700 });
98
+ const supervisorSource = siblingRuntimeModule(import.meta.url, "supervisor");
99
+ const safeGroupSource = siblingRuntimeModule(import.meta.url, "safe-process-group");
100
+ const supervisorPath = join(toolsDir, basename(fileURLToPath(supervisorSource)));
101
+ const safeGroupPath = join(toolsDir, basename(fileURLToPath(safeGroupSource)));
102
+ await writeFile(supervisorPath, await readFile(supervisorSource, "utf8"), { mode: 0o700 });
103
+ await writeFile(safeGroupPath, await readFile(safeGroupSource, "utf8"), { mode: 0o700 });
104
+ let shellPath;
105
+ if (config.tools !== null) {
106
+ shellPath = join(toolsDir, "shell-wrapper.sh");
107
+ await writeFile(shellPath, await readFile(new URL("./shell-wrapper.sh", import.meta.url), "utf8"), { mode: 0o700 });
108
+ await mkdir(shellStateDirectory(config), { recursive: true, mode: 0o700 });
109
+ }
110
+ await writeIsolatedSettings(config.dirs.configDir, shellPath);
111
+ if (config.apiKey !== undefined) {
112
+ await writeApiKeyConfig(config.dirs.configDir, config);
113
+ }
114
+ const policy = await buildPolicy(executable, config);
115
+ const policyPath = await writeSeatbeltPolicy(config.dirs.scratchDir, policy);
116
+ const args = buildPiArgs(config);
117
+ const env = buildEnvironment(config);
118
+ const nodeExecutable = await realpath(process.execPath);
119
+ return new PiProcess({
120
+ spawn: () => spawnSandboxed({
121
+ policyPath,
122
+ command: nodeExecutable,
123
+ args: [supervisorPath, executable, ...args],
124
+ cwd: config.dirs.workspaceDir,
125
+ env,
126
+ }),
127
+ });
128
+ }
129
+ export async function buildPolicy(executable, config) {
130
+ const nodeExecutable = await realpath(process.execPath);
131
+ const nodeDirectory = dirname(nodeExecutable);
132
+ const readableRoots = new Set([
133
+ "/System",
134
+ "/usr",
135
+ "/bin",
136
+ "/sbin",
137
+ "/private/etc",
138
+ "/Library",
139
+ "/dev",
140
+ "/private/var/select",
141
+ "/private/var/db/timezone",
142
+ nodeDirectory,
143
+ ]);
144
+ if (basename(nodeDirectory) === "bin") {
145
+ readableRoots.add(dirname(nodeDirectory));
146
+ }
147
+ // A managed Pi launcher lives in <root>/bin and reads <root>/install.
148
+ const executableDirectory = dirname(executable);
149
+ readableRoots.add(executableDirectory);
150
+ const installRoot = join(dirname(executableDirectory), "install");
151
+ if (await isDirectory(installRoot)) {
152
+ readableRoots.add(installRoot);
153
+ }
154
+ const nodeModulesRoot = findAncestor(executable, "node_modules");
155
+ if (nodeModulesRoot !== undefined) {
156
+ readableRoots.add(nodeModulesRoot);
157
+ }
158
+ readableRoots.add(shellToolsDirectory(config));
159
+ return {
160
+ writableRoots: [config.dirs.workspaceDir, config.dirs.homeDir, config.dirs.configDir, config.dirs.scratchDir],
161
+ readableRoots: [...readableRoots],
162
+ // The resolver's fallback stats `/etc` and `/var` (symlinks to `/private/...`) before it
163
+ // reads `/private/etc/resolv.conf`; without them a sandboxed Node fails DNS with ENOTFOUND.
164
+ readableFiles: [executable, "/etc", "/var"],
165
+ allowNetwork: config.allowNetwork,
166
+ };
167
+ }
168
+ function buildPiArgs(config) {
169
+ const args = [
170
+ "--mode",
171
+ "rpc",
172
+ "--no-session",
173
+ "--no-skills",
174
+ ...config.skills.flatMap((skill) => ["--skill", skill]),
175
+ "--no-extensions",
176
+ "--no-mcp",
177
+ "--no-context-files",
178
+ "--no-prompt-templates",
179
+ "--no-themes",
180
+ "--no-approve",
181
+ config.tools === null ? "--no-tools" : "--tools",
182
+ ...(config.tools === null ? [] : [config.tools.join(",")]),
183
+ ...(config.model === undefined ? [] : ["--model", config.model]),
184
+ "--thinking",
185
+ config.thinking,
186
+ ];
187
+ return args;
188
+ }
189
+ function buildEnvironment(config) {
190
+ const nodeDirectory = dirname(process.execPath);
191
+ const env = {
192
+ PATH: [nodeDirectory, "/usr/bin", "/bin", "/usr/sbin", "/sbin"].join(":"),
193
+ HOME: config.dirs.homeDir,
194
+ TMPDIR: config.dirs.scratchDir,
195
+ TMP: config.dirs.scratchDir,
196
+ TEMP: config.dirs.scratchDir,
197
+ PI_CODING_AGENT_DIR: config.dirs.configDir,
198
+ PI_SKIP_VERSION_CHECK: "1",
199
+ PI_TELEMETRY: "0",
200
+ LANG: "en_US.UTF-8",
201
+ ...(config.tools === null ? {} : { AGENT_EVALS_SHELL_STATE_DIR: shellStateDirectory(config) }),
202
+ ...(config.apiKey === undefined ? {} : { [API_KEY_ENV]: config.apiKey }),
203
+ };
204
+ return env;
205
+ }
206
+ const API_KEY_ENV = "AGENT_EVALS_PI_API_KEY";
207
+ async function writeApiKeyConfig(configDir, config) {
208
+ if (config.model === undefined) {
209
+ throw new ConfigError("pi apiKey requires a model");
210
+ }
211
+ const separator = config.model.indexOf("/");
212
+ if (separator <= 0 || separator === config.model.length - 1) {
213
+ throw new ConfigError("pi apiKey requires a provider-qualified model (provider/model)");
214
+ }
215
+ const provider = config.model.slice(0, separator);
216
+ const models = { providers: { [provider]: { apiKey: `$${API_KEY_ENV}` } } };
217
+ await writeFile(join(configDir, "models.json"), JSON.stringify(models, null, 2) + "\n", { mode: 0o600 });
218
+ }
219
+ async function writeIsolatedSettings(configDir, shellPath) {
220
+ const settings = {
221
+ quietStartup: true,
222
+ defaultProjectTrust: "never",
223
+ enableInstallTelemetry: false,
224
+ retry: { enabled: false },
225
+ ...(shellPath === undefined ? {} : { shellPath }),
226
+ };
227
+ await writeFile(join(configDir, "settings.json"), JSON.stringify(settings, null, 2) + "\n", { mode: 0o600 });
228
+ }
229
+ async function findOnPath(name) {
230
+ const path = process.env.PATH ?? "";
231
+ for (const directory of path.split(":")) {
232
+ if (directory.length === 0) {
233
+ continue;
234
+ }
235
+ const candidate = join(directory, name);
236
+ try {
237
+ await access(candidate, constants.X_OK);
238
+ return candidate;
239
+ }
240
+ catch {
241
+ // Keep searching.
242
+ }
243
+ }
244
+ return undefined;
245
+ }
246
+ async function isDirectory(path) {
247
+ try {
248
+ return (await stat(path)).isDirectory();
249
+ }
250
+ catch {
251
+ return false;
252
+ }
253
+ }
254
+ function findAncestor(path, name) {
255
+ let current = dirname(path);
256
+ for (let depth = 0; depth < 12; depth += 1) {
257
+ if (basename(current) === name) {
258
+ return current;
259
+ }
260
+ const parent = dirname(current);
261
+ if (parent === current) {
262
+ return undefined;
263
+ }
264
+ current = parent;
265
+ }
266
+ return undefined;
267
+ }
268
+ async function assertFinalAssistantHealthy(process) {
269
+ const data = (await process.command("get_messages"));
270
+ const messages = Array.isArray(data?.messages) ? data.messages : [];
271
+ let last;
272
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
273
+ const message = messages[index];
274
+ if (typeof message === "object" && message !== null && message.role === "assistant") {
275
+ last = message;
276
+ break;
277
+ }
278
+ }
279
+ if (last === undefined) {
280
+ throw new PiSessionError("Pi settled without a final assistant message", diagnosticsOf(process));
281
+ }
282
+ if (last.stopReason === "error") {
283
+ const detail = typeof last.errorMessage === "string" && last.errorMessage.length > 0
284
+ ? truncate(last.errorMessage, 500)
285
+ : "the provider or model run failed";
286
+ throw new PiSessionError(`model request failed: ${detail}`, [
287
+ ...diagnosticsOf(process),
288
+ `assistant error: ${detail}`,
289
+ ]);
290
+ }
291
+ }
292
+ function diagnosticsOf(process) {
293
+ const diagnostics = [...process.protocolErrors, ...process.errorEvents];
294
+ if (process.stderrTail.trim().length > 0) {
295
+ diagnostics.push(`stderr: ${process.stderrTail.trim().slice(-4_000)}`);
296
+ }
297
+ return diagnostics;
298
+ }
@@ -0,0 +1,46 @@
1
+ #!/bin/sh
2
+ # Pi custom shell wrapper.
3
+ #
4
+ # Pi starts each bash tool invocation as a detached process-group leader. The
5
+ # wrapper keeps itself in that group but starts the requested shell in its own
6
+ # process group. After the shell exits, the wrapper kills the shell's group,
7
+ # which includes ordinary background jobs that outlived the shell. It records
8
+ # both group ids so the evaluator can terminate them if Pi is stopped early.
9
+ #
10
+ # Arguments follow Pi's custom-shell convention: -c <command>.
11
+ command=${2-}
12
+ shell=/bin/bash
13
+ [ -x "$shell" ] || shell=/bin/sh
14
+ state_dir=${AGENT_EVALS_SHELL_STATE_DIR:-}
15
+ wrapper_pgid=
16
+ if kill -0 -"$$" 2>/dev/null; then
17
+ wrapper_pgid=$$
18
+ fi
19
+
20
+ record_group() {
21
+ if [ -n "$state_dir" ] && [ -n "$1" ]; then
22
+ /bin/mkdir -p "$state_dir" 2>/dev/null || true
23
+ printf '%s\n' "$1" > "$state_dir/$1" 2>/dev/null || true
24
+ fi
25
+ }
26
+
27
+ record_group "$wrapper_pgid"
28
+
29
+ set -m
30
+ "$shell" -c "$command" &
31
+ child=$!
32
+ record_group "$child"
33
+ wait "$child"
34
+ status=$?
35
+
36
+ if [ -n "$child" ]; then
37
+ kill -9 -"$child" 2>/dev/null || true
38
+ if ! kill -0 -"$child" 2>/dev/null; then
39
+ if [ -n "$state_dir" ]; then
40
+ [ -n "$child" ] && /bin/rm -f "$state_dir/$child" 2>/dev/null || true
41
+ [ -n "$wrapper_pgid" ] && /bin/rm -f "$state_dir/$wrapper_pgid" 2>/dev/null || true
42
+ fi
43
+ fi
44
+ fi
45
+
46
+ exit "$status"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,101 @@
1
+ import { spawn } from "node:child_process";
2
+ import { readdirSync, rmSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { isSafeProcessGroup } from "./safe-process-group.js";
5
+ /**
6
+ * Sandbox-resident Pi supervisor.
7
+ *
8
+ * Pi runs as this process's child under one Seatbelt sandbox. On Pi exit or a
9
+ * stop signal, the supervisor reads the agent-writable shell-group registry and
10
+ * signals matching groups. Because the supervisor is inside the same sandbox,
11
+ * Seatbelt's `(allow signal (target same-sandbox))` restriction applies: a
12
+ * forged entry can at most target a process in this sandbox, never an unrelated
13
+ * host process. The host evaluator never signals groups from registry data.
14
+ */
15
+ const stateDir = process.env.AGENT_EVALS_SHELL_STATE_DIR;
16
+ const [command, ...args] = process.argv.slice(2);
17
+ if (command === undefined || command.length === 0) {
18
+ process.exit(2);
19
+ }
20
+ let finished = false;
21
+ let names = [];
22
+ function cleanup() {
23
+ if (stateDir === undefined) {
24
+ return;
25
+ }
26
+ try {
27
+ names = readdirSync(stateDir);
28
+ }
29
+ catch {
30
+ return;
31
+ }
32
+ const groups = new Set();
33
+ for (const name of names) {
34
+ if (isSafeProcessGroup(name)) {
35
+ groups.add(Number(name));
36
+ }
37
+ }
38
+ // Freeze first so a process cannot run user code between the two signals.
39
+ for (const pgid of groups) {
40
+ try {
41
+ process.kill(-pgid, "SIGSTOP");
42
+ }
43
+ catch {
44
+ // Forged external groups and already-dead groups are denied or absent.
45
+ }
46
+ }
47
+ for (const pgid of groups) {
48
+ try {
49
+ process.kill(-pgid, "SIGKILL");
50
+ }
51
+ catch {
52
+ // Forged external groups and already-dead groups are denied or absent.
53
+ }
54
+ }
55
+ for (const name of names) {
56
+ try {
57
+ rmSync(join(stateDir, name), { force: true });
58
+ }
59
+ catch {
60
+ // Ignore cleanup failures; the run root is removed by the engine.
61
+ }
62
+ }
63
+ }
64
+ function finish(code) {
65
+ if (finished) {
66
+ return;
67
+ }
68
+ finished = true;
69
+ cleanup();
70
+ process.exit(code);
71
+ }
72
+ const child = spawn(command, args, {
73
+ stdio: ["inherit", "inherit", "inherit"],
74
+ env: process.env,
75
+ });
76
+ let stopping = false;
77
+ function stop() {
78
+ if (stopping || finished) {
79
+ return;
80
+ }
81
+ stopping = true;
82
+ try {
83
+ child.kill("SIGTERM");
84
+ }
85
+ catch {
86
+ // The child may already be gone.
87
+ }
88
+ const force = setTimeout(() => {
89
+ try {
90
+ child.kill("SIGKILL");
91
+ }
92
+ catch {
93
+ // The child may already be gone.
94
+ }
95
+ }, 750);
96
+ force.unref();
97
+ }
98
+ process.on("SIGTERM", stop);
99
+ process.on("SIGINT", stop);
100
+ child.on("exit", (code, signal) => finish(code ?? (signal === null ? 1 : 1)));
101
+ child.on("error", () => finish(1));
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@lelouchhe/agent-evals",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "description": "A toolkit for evaluating AI agent systems.",
6
+ "license": "MIT",
7
+ "engines": {
8
+ "node": ">=24"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "bin": {
17
+ "agent-evals": "dist/cli.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ ".env.example"
22
+ ],
23
+ "scripts": {
24
+ "build": "node scripts/build.mjs",
25
+ "lint": "eslint src tests scripts eslint.config.mjs",
26
+ "lint:fix": "npm run lint -- --fix",
27
+ "format": "prettier --write .",
28
+ "format:check": "prettier --check .",
29
+ "typecheck": "tsc --noEmit",
30
+ "test": "node --test --test-timeout=30000",
31
+ "test:package": "node --test --test-timeout=180000 tests/package-install.ts",
32
+ "pretest": "npm run build",
33
+ "check": "npm run lint && npm run format:check && npm run typecheck && npm test",
34
+ "prepare": "node -e \"const fs=require('node:fs');const cp=require('node:child_process');if(!fs.existsSync('.git')||!fs.existsSync('node_modules/husky'))process.exit(0);const r=cp.spawnSync(process.execPath,['node_modules/husky/bin.js'],{stdio:'inherit'});process.exit(r.status??1)\"",
35
+ "prepack": "npm run build",
36
+ "preeval": "npm run build",
37
+ "eval": "node dist/cli.js"
38
+ },
39
+ "dependencies": {
40
+ "@agentclientprotocol/sdk": "2.6.0",
41
+ "ignore": "7.0.14",
42
+ "re2js": "^2.10.0",
43
+ "yaml": "2.9.1",
44
+ "zod": "4.6.7"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/js": "10.0.1",
48
+ "@types/node": "24.19.2",
49
+ "eslint": "10.14.0",
50
+ "globals": "17.14.0",
51
+ "husky": "9.1.7",
52
+ "prettier": "3.9.10",
53
+ "typescript": "5.9.3",
54
+ "typescript-eslint": "8.72.2"
55
+ },
56
+ "author": "Lelouch He",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "https://github.com/LelouchHe/agent-evals.git"
60
+ },
61
+ "homepage": "https://github.com/LelouchHe/agent-evals#readme",
62
+ "bugs": {
63
+ "url": "https://github.com/LelouchHe/agent-evals/issues"
64
+ },
65
+ "keywords": [
66
+ "evaluation",
67
+ "ai-agents",
68
+ "harness",
69
+ "acp",
70
+ "sandbox",
71
+ "testing"
72
+ ],
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "os": [
77
+ "darwin"
78
+ ]
79
+ }