@agentv/core 4.27.0 → 4.28.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.
@@ -12,7 +12,7 @@ import {
12
12
  loadCasesFromFile,
13
13
  parseYamlValue,
14
14
  resolveFileReference
15
- } from "../../chunk-7LQI7772.js";
15
+ } from "../../chunk-YFXMMBUG.js";
16
16
 
17
17
  // src/evaluation/validation/file-type.ts
18
18
  import { readFile } from "node:fs/promises";
package/dist/index.cjs CHANGED
@@ -9059,7 +9059,7 @@ var init_llm_providers = __esm({
9059
9059
  "src/evaluation/providers/llm-providers.ts"() {
9060
9060
  "use strict";
9061
9061
  init_cjs_shims();
9062
- import_pi_ai = require("@mariozechner/pi-ai");
9062
+ import_pi_ai = require("@earendil-works/pi-ai");
9063
9063
  (0, import_pi_ai.registerBuiltInApiProviders)();
9064
9064
  DEFAULT_SYSTEM_PROMPT = "You are a careful assistant. Follow all provided instructions and do not fabricate results.";
9065
9065
  OpenAIProvider = class {
@@ -9950,6 +9950,9 @@ var init_claude_cli = __esm({
9950
9950
  "--include-partial-messages",
9951
9951
  "--verbose"
9952
9952
  ];
9953
+ if (this.config.bypassPermissions !== false) {
9954
+ args.push("--dangerously-skip-permissions");
9955
+ }
9953
9956
  if (this.config.model) {
9954
9957
  args.push("--model", this.config.model);
9955
9958
  }
@@ -14166,7 +14169,7 @@ async function promptInstall() {
14166
14169
  try {
14167
14170
  return await new Promise((resolve) => {
14168
14171
  rl.question(
14169
- "@mariozechner/pi-coding-agent is not installed. Install it now? (y/N) ",
14172
+ "@earendil-works/pi-coding-agent is not installed. Install it now? (y/N) ",
14170
14173
  (answer) => resolve(answer.trim().toLowerCase() === "y")
14171
14174
  );
14172
14175
  });
@@ -14204,8 +14207,8 @@ function findAccessiblePath(paths) {
14204
14207
  async function tryImportLocalSdkModules() {
14205
14208
  try {
14206
14209
  [piCodingAgentModule, piAiModule] = await Promise.all([
14207
- import("@mariozechner/pi-coding-agent"),
14208
- import("@mariozechner/pi-ai")
14210
+ import("@earendil-works/pi-coding-agent"),
14211
+ import("@earendil-works/pi-ai")
14209
14212
  ]);
14210
14213
  return true;
14211
14214
  } catch {
@@ -14215,17 +14218,24 @@ async function tryImportLocalSdkModules() {
14215
14218
  async function tryImportManagedSdkModules() {
14216
14219
  const managedRoot = findManagedSdkInstallRoot();
14217
14220
  const piCodingAgentEntry = findAccessiblePath([
14218
- import_node_path25.default.join(managedRoot, "node_modules", "@mariozechner", "pi-coding-agent", "dist", "index.js")
14221
+ import_node_path25.default.join(
14222
+ managedRoot,
14223
+ "node_modules",
14224
+ "@earendil-works",
14225
+ "pi-coding-agent",
14226
+ "dist",
14227
+ "index.js"
14228
+ )
14219
14229
  ]);
14220
14230
  const piAiEntry = findAccessiblePath([
14221
- import_node_path25.default.join(managedRoot, "node_modules", "@mariozechner", "pi-ai", "dist", "index.js"),
14231
+ import_node_path25.default.join(managedRoot, "node_modules", "@earendil-works", "pi-ai", "dist", "index.js"),
14222
14232
  import_node_path25.default.join(
14223
14233
  managedRoot,
14224
14234
  "node_modules",
14225
- "@mariozechner",
14235
+ "@earendil-works",
14226
14236
  "pi-coding-agent",
14227
14237
  "node_modules",
14228
- "@mariozechner",
14238
+ "@earendil-works",
14229
14239
  "pi-ai",
14230
14240
  "dist",
14231
14241
  "index.js"
@@ -14246,16 +14256,16 @@ async function tryImportGlobalSdkModules() {
14246
14256
  const globalNpmRoot = resolveGlobalNpmRoot();
14247
14257
  if (!globalNpmRoot) return false;
14248
14258
  const piCodingAgentEntry = findAccessiblePath([
14249
- buildGlobalModuleEntry("@mariozechner/pi-coding-agent", globalNpmRoot)
14259
+ buildGlobalModuleEntry("@earendil-works/pi-coding-agent", globalNpmRoot)
14250
14260
  ]);
14251
14261
  const piAiEntry = findAccessiblePath([
14252
- buildGlobalModuleEntry("@mariozechner/pi-ai", globalNpmRoot),
14262
+ buildGlobalModuleEntry("@earendil-works/pi-ai", globalNpmRoot),
14253
14263
  import_node_path25.default.join(
14254
14264
  globalNpmRoot,
14255
- "@mariozechner",
14265
+ "@earendil-works",
14256
14266
  "pi-coding-agent",
14257
14267
  "node_modules",
14258
- "@mariozechner",
14268
+ "@earendil-works",
14259
14269
  "pi-ai",
14260
14270
  "dist",
14261
14271
  "index.js"
@@ -14273,9 +14283,9 @@ async function tryImportGlobalSdkModules() {
14273
14283
  }
14274
14284
  }
14275
14285
  function installSdkModules(installDir) {
14276
- console.error(`Installing @mariozechner/pi-coding-agent into ${installDir} via npm...`);
14286
+ console.error(`Installing @earendil-works/pi-coding-agent into ${installDir} via npm...`);
14277
14287
  (0, import_node_fs10.mkdirSync)(installDir, { recursive: true });
14278
- (0, import_node_child_process6.execSync)("npm install --no-save --no-package-lock @mariozechner/pi-coding-agent", {
14288
+ (0, import_node_child_process6.execSync)("npm install --no-save --no-package-lock @earendil-works/pi-coding-agent", {
14279
14289
  cwd: installDir,
14280
14290
  stdio: "inherit"
14281
14291
  });
@@ -14292,7 +14302,7 @@ async function doLoadSdkModules() {
14292
14302
  }
14293
14303
  }
14294
14304
  throw new Error(
14295
- "pi-coding-agent SDK is not installed. Install it with:\n npm install @mariozechner/pi-coding-agent"
14305
+ "pi-coding-agent SDK is not installed. Install it with:\n npm install @earendil-works/pi-coding-agent"
14296
14306
  );
14297
14307
  }
14298
14308
  async function loadSdkModules() {
@@ -15782,6 +15792,7 @@ function resolveClaudeConfig(target, env, _evalFilePath) {
15782
15792
  const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
15783
15793
  const maxTurns = typeof target.max_turns === "number" ? target.max_turns : void 0;
15784
15794
  const maxBudgetUsd = typeof target.max_budget_usd === "number" ? target.max_budget_usd : void 0;
15795
+ const bypassPermissions = target.bypass_permissions !== void 0 ? resolveOptionalBoolean(target.bypass_permissions) : void 0;
15785
15796
  return {
15786
15797
  executable,
15787
15798
  model,
@@ -15792,7 +15803,8 @@ function resolveClaudeConfig(target, env, _evalFilePath) {
15792
15803
  maxBudgetUsd,
15793
15804
  logDir,
15794
15805
  logFormat,
15795
- streamLog: streamLogResult.streamLog
15806
+ streamLog: streamLogResult.streamLog,
15807
+ bypassPermissions
15796
15808
  };
15797
15809
  }
15798
15810
  function resolveCcMirrorBinaryPath(variant) {
@@ -19086,6 +19098,9 @@ function gitEnv2() {
19086
19098
  function getSourceUrl(source) {
19087
19099
  return source.type === "git" ? source.url : source.path;
19088
19100
  }
19101
+ function isFullCommitSha(ref) {
19102
+ return typeof ref === "string" && /^[0-9a-f]{40}$/i.test(ref);
19103
+ }
19089
19104
  async function git2(args, opts) {
19090
19105
  const { stdout } = await execFileAsync2("git", args, {
19091
19106
  cwd: opts?.cwd,
@@ -19208,8 +19223,10 @@ ${lines.join("\n")}`;
19208
19223
  }
19209
19224
  const ref = getRepoCheckoutRef(repo.checkout);
19210
19225
  const resolve = repo.checkout?.resolve ?? "remote";
19226
+ const baseCommit = repo.checkout?.base_commit;
19227
+ const shouldResolveLocally = resolve === "local" || repo.source.type === "git" && isFullCommitSha(baseCommit);
19211
19228
  let resolvedSha;
19212
- if (resolve === "remote" && repo.source.type === "git") {
19229
+ if (!shouldResolveLocally && repo.source.type === "git") {
19213
19230
  const url = getSourceUrl(repo.source);
19214
19231
  try {
19215
19232
  const lsOutput = await this.runGit(["ls-remote", url, ref]);
@@ -24808,6 +24825,8 @@ __export(index_exports, {
24808
24825
  subscribeToCopilotSdkLogEntries: () => subscribeToCopilotSdkLogEntries,
24809
24826
  subscribeToPiLogEntries: () => subscribeToPiLogEntries,
24810
24827
  substituteVariables: () => substituteVariables,
24828
+ syncBenchmark: () => syncBenchmark,
24829
+ syncBenchmarks: () => syncBenchmarks,
24811
24830
  syncResultsRepo: () => syncResultsRepo,
24812
24831
  toCamelCaseDeep: () => toCamelCaseDeep,
24813
24832
  toSnakeCaseDeep: () => toSnakeCaseDeep,
@@ -25163,12 +25182,12 @@ var CONFIG_FILE_NAMES = [
25163
25182
  ".agentv/config.js"
25164
25183
  ];
25165
25184
  async function loadTsConfig(projectRoot) {
25166
- const { existsSync: existsSync10 } = await import("fs");
25185
+ const { existsSync: existsSync11 } = await import("fs");
25167
25186
  const { pathToFileURL: pathToFileURL3 } = await import("url");
25168
25187
  const { join: join2 } = await import("path");
25169
25188
  for (const fileName of CONFIG_FILE_NAMES) {
25170
25189
  const filePath = join2(projectRoot, fileName);
25171
- if (!existsSync10(filePath)) {
25190
+ if (!existsSync11(filePath)) {
25172
25191
  continue;
25173
25192
  }
25174
25193
  try {
@@ -25752,6 +25771,7 @@ init_cjs_shims();
25752
25771
  var import_node_fs20 = require("fs");
25753
25772
  var import_node_path55 = __toESM(require("path"), 1);
25754
25773
  var import_yaml2 = require("yaml");
25774
+ init_interpolation();
25755
25775
  init_yaml_loader();
25756
25776
  init_paths();
25757
25777
  function getBenchmarksRegistryPath() {
@@ -25763,22 +25783,33 @@ function fromYaml(raw) {
25763
25783
  if (typeof e.id !== "string" || typeof e.name !== "string" || typeof e.path !== "string") {
25764
25784
  return null;
25765
25785
  }
25766
- return {
25786
+ const entry = {
25767
25787
  id: e.id,
25768
25788
  name: e.name,
25769
25789
  path: e.path,
25770
25790
  addedAt: typeof e.added_at === "string" ? e.added_at : "",
25771
25791
  lastOpenedAt: typeof e.last_opened_at === "string" ? e.last_opened_at : ""
25772
25792
  };
25793
+ if (e.source && typeof e.source === "object") {
25794
+ const s = e.source;
25795
+ if (typeof s.url === "string" && typeof s.ref === "string") {
25796
+ entry.source = { url: s.url, ref: s.ref };
25797
+ }
25798
+ }
25799
+ return entry;
25773
25800
  }
25774
25801
  function toYaml(entry) {
25775
- return {
25802
+ const yaml = {
25776
25803
  id: entry.id,
25777
25804
  name: entry.name,
25778
25805
  path: entry.path,
25779
25806
  added_at: entry.addedAt,
25780
25807
  last_opened_at: entry.lastOpenedAt
25781
25808
  };
25809
+ if (entry.source) {
25810
+ yaml.source = { url: entry.source.url, ref: entry.source.ref };
25811
+ }
25812
+ return yaml;
25782
25813
  }
25783
25814
  function loadBenchmarkRegistry() {
25784
25815
  const registryPath = getBenchmarksRegistryPath();
@@ -25791,7 +25822,8 @@ function loadBenchmarkRegistry() {
25791
25822
  if (!parsed || typeof parsed !== "object") {
25792
25823
  return { benchmarks: [] };
25793
25824
  }
25794
- const benchmarks = Array.isArray(parsed.benchmarks) ? parsed.benchmarks.map(fromYaml).filter((e) => e !== null) : [];
25825
+ const env = process.env;
25826
+ const benchmarks = Array.isArray(parsed.benchmarks) ? parsed.benchmarks.map((e) => fromYaml(interpolateEnv(e, env))).filter((e) => e !== null) : [];
25795
25827
  return { benchmarks };
25796
25828
  } catch {
25797
25829
  return { benchmarks: [] };
@@ -25890,6 +25922,35 @@ function discoverBenchmarks(rootDir, maxDepth = 2) {
25890
25922
  return results.sort();
25891
25923
  }
25892
25924
 
25925
+ // src/benchmark-sync.ts
25926
+ init_cjs_shims();
25927
+ var childProcess = __toESM(require("child_process"), 1);
25928
+ var import_node_fs21 = require("fs");
25929
+ async function syncBenchmark(entry) {
25930
+ if (!entry.source) {
25931
+ throw new Error(`Benchmark '${entry.id}' has no source defined`);
25932
+ }
25933
+ const { url, ref } = entry.source;
25934
+ const dest = entry.path;
25935
+ if ((0, import_node_fs21.existsSync)(`${dest}/.git`)) {
25936
+ childProcess.execFileSync("git", ["-C", dest, "pull", "--ff-only"], { stdio: "inherit" });
25937
+ } else {
25938
+ childProcess.execFileSync(
25939
+ "git",
25940
+ ["clone", "--depth", "1", "--filter=blob:none", "--branch", ref, url, dest],
25941
+ { stdio: "inherit" }
25942
+ );
25943
+ }
25944
+ }
25945
+ async function syncBenchmarks(entries) {
25946
+ for (const entry of entries) {
25947
+ if (!entry.source) continue;
25948
+ console.log(`Syncing benchmark '${entry.id}' from ${entry.source.url}...`);
25949
+ await syncBenchmark(entry);
25950
+ console.log(`Benchmark '${entry.id}' synced.`);
25951
+ }
25952
+ }
25953
+
25893
25954
  // src/evaluation/baseline.ts
25894
25955
  init_cjs_shims();
25895
25956
  var STRIPPED_TOP_LEVEL_FIELDS = /* @__PURE__ */ new Set([
@@ -27379,6 +27440,8 @@ function createAgentKernel() {
27379
27440
  subscribeToCopilotSdkLogEntries,
27380
27441
  subscribeToPiLogEntries,
27381
27442
  substituteVariables,
27443
+ syncBenchmark,
27444
+ syncBenchmarks,
27382
27445
  syncResultsRepo,
27383
27446
  toCamelCaseDeep,
27384
27447
  toSnakeCaseDeep,