@lelouchhe/agent-evals 0.1.1 → 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.
@@ -1,6 +1,6 @@
1
1
  import { constants } from "node:fs";
2
2
  import { lstat, open, readdir, realpath } from "node:fs/promises";
3
- import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
+ import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
4
4
  import { ConfigError, errorMessage } from "./config.js";
5
5
  /** Largest file a check will read. Checks stay bounded and predictable. */
6
6
  export const MAX_CHECK_BYTES = 1024 * 1024;
@@ -278,3 +278,28 @@ export function isMissing(error) {
278
278
  "code" in error &&
279
279
  (error.code === "ENOENT" || error.code === "ENOTDIR"));
280
280
  }
281
+ /** The identity a filesystem uses for one file, independent of the spelling that reached it. */
282
+ export function fileIdentity(info) {
283
+ return `${info.dev}:${info.ino}`;
284
+ }
285
+ /** True when `relativePath` is or lies under any protected HOME-relative path. */
286
+ export function isProtectedHomePath(relativePath, protectedPaths) {
287
+ if (protectedPaths.length === 0)
288
+ return false;
289
+ const candidate = normalizeProtectedPath(relativePath);
290
+ if (candidate.length === 0)
291
+ return false;
292
+ return protectedPaths.some((entry) => {
293
+ const excluded = normalizeProtectedPath(entry);
294
+ return excluded.length > 0 && (candidate === excluded || candidate.startsWith(`${excluded}/`));
295
+ });
296
+ }
297
+ function normalizeProtectedPath(path) {
298
+ const cleaned = path.replace(/^\/+/u, "").replace(/\/+$/u, "");
299
+ if (cleaned.length === 0)
300
+ return "";
301
+ const normalized = posix.normalize(cleaned).replace(/\/+$/u, "");
302
+ if (normalized === ".")
303
+ return "";
304
+ return process.platform === "darwin" ? normalized.toLowerCase() : normalized;
305
+ }
package/dist/index.d.ts CHANGED
@@ -4,13 +4,13 @@
4
4
  * access a built-in checker uses. Everything not exported here is internal; a built-in that
5
5
  * needs something absent from this file is a missing capability, not a private exception.
6
6
  */
7
- export type { Checker, CheckerContext, CheckerDefinition, CheckResult, CheckSandbox, CheckSandboxOutcome, CheckStatus, ImplementationContext, MockRecord, MockWiring, PreparedRunner, Runner, RunnerContext, RunnerDefinition, RunnerOutcome, RunnerTokens, RunnerUsage, TraceEntry, } from "./engine/registry.js";
7
+ export type { Checker, CheckerContext, CheckerDefinition, CheckResult, CheckSandbox, CheckSandboxOutcome, CheckStatus, HomeProtection, ImplementationContext, MockRecord, MockWiring, PreparedRunner, Runner, RunnerContext, RunnerDefinition, RunnerOutcome, RunnerTokens, RunnerUsage, TraceEntry, } from "./engine/registry.js";
8
8
  export type { EnvSource } from "./engine/env-source.js";
9
9
  export type { RunVariables, ValueSource } from "./engine/values.js";
10
- export { ConfigError, expectMockArgs, expectMockTarget, mockTargetIdentity, type MockArgs, type MockArgument, type MockPattern, type PatternSyntax, } from "./engine/config.js";
10
+ export { ConfigError, expectMockArgs, expectMockTarget, mockTargetIdentity, type ImplementationRecord, type MockArgs, type MockArgument, type MockPattern, type PatternSyntax, } from "./engine/config.js";
11
11
  export { compileMockArgs } from "./engine/mock-match.js";
12
- export { patternListSchema, patternSyntaxSchema, runRelativePathSchema } from "./engine/params.js";
12
+ export { patternListSchema, patternSyntaxSchema, runFilePathSchema, runRelativePathSchema } from "./engine/params.js";
13
13
  export { searches } from "./engine/regex.js";
14
- export { MAX_CHECK_BYTES, WorkspacePathError, isMissing, readRunFile, readRunTree, runPathExists, type RunEntryKind, type RunRoot, type RunTree, type RunTreeEntry, } from "./engine/workspace.js";
14
+ export { MAX_CHECK_BYTES, WorkspacePathError, assertRunRoot, fileIdentity, isMissing, isProtectedHomePath, readRunFile, readRunTree, resolveWorkspacePath, runPathExists, type RunEntryKind, type RunRoot, type RunTree, type RunTreeEntry, } from "./engine/workspace.js";
15
15
  export { messageText } from "./engine/messages.js";
16
16
  export { shellSkillAccess, skillConsultations, type ShellSkillAccess, type SkillConsultation, type SkillSources, } from "./engine/skills.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { ConfigError, expectMockArgs, expectMockTarget, mockTargetIdentity, } from "./engine/config.js";
2
2
  export { compileMockArgs } from "./engine/mock-match.js";
3
- export { patternListSchema, patternSyntaxSchema, runRelativePathSchema } from "./engine/params.js";
3
+ export { patternListSchema, patternSyntaxSchema, runFilePathSchema, runRelativePathSchema } from "./engine/params.js";
4
4
  export { searches } from "./engine/regex.js";
5
- export { MAX_CHECK_BYTES, WorkspacePathError, isMissing, readRunFile, readRunTree, runPathExists, } from "./engine/workspace.js";
5
+ export { MAX_CHECK_BYTES, WorkspacePathError, assertRunRoot, fileIdentity, isMissing, isProtectedHomePath, readRunFile, readRunTree, resolveWorkspacePath, runPathExists, } from "./engine/workspace.js";
6
6
  export { messageText } from "./engine/messages.js";
7
7
  export { shellSkillAccess, skillConsultations, } from "./engine/skills.js";
@@ -31,6 +31,7 @@ class AcpRunner {
31
31
  #command;
32
32
  #home;
33
33
  homeFiles;
34
+ concurrencyKey;
34
35
  #config;
35
36
  #process;
36
37
  #copyBack;
@@ -41,6 +42,9 @@ class AcpRunner {
41
42
  this.#command = command;
42
43
  this.#home = home;
43
44
  this.homeFiles = home.login?.files ?? [];
45
+ if (home.login !== undefined) {
46
+ this.concurrencyKey = home.login.dir;
47
+ }
44
48
  this.#config = config;
45
49
  }
46
50
  /** Place the agent file's HOME content and login state before the case's own `~/` entries. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lelouchhe/agent-evals",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "A toolkit for evaluating AI agent systems.",
6
6
  "license": "MIT",