agentv 4.42.3 → 4.42.4-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.
@@ -56,7 +56,7 @@ import {
56
56
  validateTargetsFile,
57
57
  validateWorkspacePaths,
58
58
  writeRunTags
59
- } from "./chunk-BACWATIZ.js";
59
+ } from "./chunk-CY5GK73D.js";
60
60
  import {
61
61
  materializeEvalBundle,
62
62
  toSnakeCaseDeep as toSnakeCaseDeep2,
@@ -76,7 +76,7 @@ import {
76
76
  syncProjects,
77
77
  transpileEvalYamlFile,
78
78
  trimBaselineResult
79
- } from "./chunk-SLK6MUSS.js";
79
+ } from "./chunk-RBOP5X36.js";
80
80
  import {
81
81
  DEFAULT_THRESHOLD,
82
82
  EXECUTION_TRACE_SCHEMA_VERSION,
@@ -4806,7 +4806,7 @@ var evalRunCommand = command({
4806
4806
  },
4807
4807
  handler: async (args) => {
4808
4808
  if (args.evalPaths.length === 0 && process.stdin.isTTY) {
4809
- const { launchInteractiveWizard } = await import("./interactive-YDTA2QJF.js");
4809
+ const { launchInteractiveWizard } = await import("./interactive-ZTDOMHZZ.js");
4810
4810
  await launchInteractiveWizard();
4811
4811
  return;
4812
4812
  }
@@ -16726,4 +16726,4 @@ export {
16726
16726
  preprocessArgv,
16727
16727
  runCli
16728
16728
  };
16729
- //# sourceMappingURL=chunk-DZYUOKTI.js.map
16729
+ //# sourceMappingURL=chunk-J7RCSNAC.js.map
@@ -686,6 +686,8 @@ var RESULTS_REPO_COMMIT_EMAIL = "agentv@results-repo";
686
686
  var RESULTS_REPO_COMMIT_NAME = "AgentV Results";
687
687
  var DEFAULT_RESULTS_BRANCH = "agentv/results/v1";
688
688
  var GIT_EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
689
+ var RESULTS_REPO_GENESIS_MESSAGE = "chore(results): initialize AgentV results branch";
690
+ var RESULTS_REPO_GENESIS_DATE = "@0 +0000";
689
691
  var activeResultsRepoSyncs = /* @__PURE__ */ new Set();
690
692
  function sanitizeRepoSlug(repo) {
691
693
  return repo.trim().replace(/[^A-Za-z0-9._-]+/g, "-");
@@ -813,8 +815,17 @@ async function resolveDefaultBranch(repoDir) {
813
815
  }
814
816
  return "main";
815
817
  }
816
- async function fetchResultsRepo(repoDir, remote = "origin") {
818
+ async function fetchResultsRepo(repoDir, remote = "origin", branch) {
817
819
  await runGit(["fetch", remote, "--prune"], { cwd: repoDir });
820
+ if (branch) {
821
+ await fetchResultsBranchRef(repoDir, remote, branch);
822
+ }
823
+ }
824
+ async function fetchResultsBranchRef(repoDir, remote, branch) {
825
+ await runGit(["fetch", remote, `+refs/heads/${branch}:refs/remotes/${remote}/${branch}`], {
826
+ cwd: repoDir,
827
+ check: false
828
+ });
818
829
  }
819
830
  function remoteBranchRef(branch, remote = "origin") {
820
831
  return `${remote}/${branch}`;
@@ -877,12 +888,27 @@ async function checkoutConfiguredResultsBranch(repoDir, config) {
877
888
  return remoteRef;
878
889
  }
879
890
  async function createOrphanResultsBranch(repoDir, branch) {
891
+ await runGit(["update-ref", `refs/heads/${branch}`, await createResultsGenesisCommit(repoDir)], {
892
+ cwd: repoDir
893
+ });
894
+ }
895
+ async function createResultsGenesisCommit(repoDir) {
880
896
  await ensureResultsRepoCommitIdentity(repoDir);
881
897
  const { stdout } = await runGit(
882
- ["commit-tree", GIT_EMPTY_TREE, "-m", "chore(results): initialize AgentV results branch"],
883
- { cwd: repoDir }
898
+ ["commit-tree", GIT_EMPTY_TREE, "-m", RESULTS_REPO_GENESIS_MESSAGE],
899
+ {
900
+ cwd: repoDir,
901
+ env: {
902
+ GIT_AUTHOR_NAME: RESULTS_REPO_COMMIT_NAME,
903
+ GIT_AUTHOR_EMAIL: RESULTS_REPO_COMMIT_EMAIL,
904
+ GIT_COMMITTER_NAME: RESULTS_REPO_COMMIT_NAME,
905
+ GIT_COMMITTER_EMAIL: RESULTS_REPO_COMMIT_EMAIL,
906
+ GIT_AUTHOR_DATE: RESULTS_REPO_GENESIS_DATE,
907
+ GIT_COMMITTER_DATE: RESULTS_REPO_GENESIS_DATE
908
+ }
909
+ }
884
910
  );
885
- await runGit(["update-ref", `refs/heads/${branch}`, stdout.trim()], { cwd: repoDir });
911
+ return stdout.trim();
886
912
  }
887
913
  async function isGitRepository(repoDir) {
888
914
  try {
@@ -1266,14 +1292,18 @@ async function getResultsRepoSyncStatus(config) {
1266
1292
  }
1267
1293
  try {
1268
1294
  if (normalized.repo_path) {
1269
- await fetchResultsRepo(normalized.path, normalized.remote).catch(() => void 0);
1295
+ await fetchResultsRepo(normalized.path, normalized.remote, normalized.branch).catch(
1296
+ () => void 0
1297
+ );
1270
1298
  return withGitInspection(
1271
1299
  baseStatus,
1272
1300
  await inspectResultsStorageBranchGit(normalized.path, normalized)
1273
1301
  );
1274
1302
  }
1275
1303
  if (normalized.branch) {
1276
- await fetchResultsRepo(normalized.path, normalized.remote).catch(() => void 0);
1304
+ await fetchResultsRepo(normalized.path, normalized.remote, normalized.branch).catch(
1305
+ () => void 0
1306
+ );
1277
1307
  await checkoutConfiguredResultsBranch(normalized.path, normalized);
1278
1308
  }
1279
1309
  return withGitInspection(baseStatus, await inspectResultsRepoGit(normalized.path, normalized));
@@ -1290,7 +1320,7 @@ async function syncResultsRepo(config) {
1290
1320
  const normalized = normalizeResultsConfig(config);
1291
1321
  try {
1292
1322
  const repoDir = await ensureResultsRepoClone(normalized);
1293
- await fetchResultsRepo(repoDir, normalized.remote);
1323
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch);
1294
1324
  if (!normalized.repo_path) {
1295
1325
  await checkoutConfiguredResultsBranch(repoDir, normalized);
1296
1326
  }
@@ -1328,7 +1358,7 @@ async function syncResultsRepoForProject(config) {
1328
1358
  const repoDir = await ensureResultsRepoClone(normalized);
1329
1359
  if (normalized.repo_path) {
1330
1360
  try {
1331
- await fetchResultsRepo(repoDir, normalized.remote);
1361
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch);
1332
1362
  } catch (error) {
1333
1363
  if (normalized.require_push) {
1334
1364
  throw error;
@@ -1378,7 +1408,7 @@ async function syncResultsRepoForProject(config) {
1378
1408
  commitCreated
1379
1409
  });
1380
1410
  }
1381
- await fetchResultsRepo(repoDir, normalized.remote);
1411
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch);
1382
1412
  await checkoutConfiguredResultsBranch(repoDir, normalized);
1383
1413
  let inspection = await inspectResultsRepoGit(repoDir, normalized);
1384
1414
  if (inspection.syncStatus === "conflicted") {
@@ -1514,10 +1544,12 @@ async function syncResultsRepoForProject(config) {
1514
1544
  try {
1515
1545
  await runGit(["push", normalized.remote, `HEAD:${targetBranch}`], { cwd: repoDir });
1516
1546
  pushPerformed = true;
1517
- await fetchResultsRepo(repoDir, normalized.remote);
1547
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch);
1518
1548
  inspection = await inspectResultsRepoGit(repoDir, normalized);
1519
1549
  } catch (error) {
1520
- await fetchResultsRepo(repoDir, normalized.remote).catch(() => void 0);
1550
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch).catch(
1551
+ () => void 0
1552
+ );
1521
1553
  inspection = await inspectResultsRepoGit(repoDir, normalized);
1522
1554
  const status = withGitInspection(getResultsRepoStatus(normalized), inspection);
1523
1555
  const reason = `Results repo push was rejected: ${getStatusMessage(error)}`;
@@ -1744,11 +1776,19 @@ async function commitResultsRunWithTemporaryIndex(params) {
1744
1776
  await ensureResultsBranchNotCheckedOut(params.repoDir, normalized);
1745
1777
  const destinationRunPath = normalizeDestinationPath(params.destinationPath);
1746
1778
  const destinationTreePath = path4.posix.join(RESULTS_REPO_RUNS_DIR, destinationRunPath);
1747
- const base = await resolveStorageBranchBase({
1779
+ let base = await resolveStorageBranchBase({
1748
1780
  repoDir: params.repoDir,
1749
1781
  normalized,
1750
1782
  preferRemote: params.preferRemoteBase
1751
1783
  });
1784
+ if (!base.baseRef) {
1785
+ await createOrphanResultsBranch(params.repoDir, normalized.branch);
1786
+ base = await resolveStorageBranchBase({
1787
+ repoDir: params.repoDir,
1788
+ normalized,
1789
+ preferRemote: params.preferRemoteBase
1790
+ });
1791
+ }
1752
1792
  const indexRoot = await mkdtemp(path4.join(os.tmpdir(), "agentv-results-index-"));
1753
1793
  const indexFile = path4.join(indexRoot, "index");
1754
1794
  const indexEnv = { GIT_INDEX_FILE: indexFile };
@@ -1856,12 +1896,14 @@ async function pushDirectResultsToStorageBranch(params) {
1856
1896
  last_synced_at: (/* @__PURE__ */ new Date()).toISOString(),
1857
1897
  last_error: void 0
1858
1898
  });
1859
- await fetchResultsRepo(params.repoDir, params.normalized.remote).catch(() => void 0);
1899
+ await fetchResultsRepo(params.repoDir, params.normalized.remote, params.storageBranch).catch(
1900
+ () => void 0
1901
+ );
1860
1902
  return;
1861
1903
  } catch (error) {
1862
1904
  const message = error instanceof Error ? error.message : String(error);
1863
1905
  if (attempt < DIRECT_PUSH_MAX_RETRIES && message.includes("non-fast-forward")) {
1864
- await fetchResultsRepo(params.repoDir, params.normalized.remote);
1906
+ await fetchResultsRepo(params.repoDir, params.normalized.remote, params.storageBranch);
1865
1907
  const remoteRef = remoteBranchRef(params.storageBranch, params.normalized.remote);
1866
1908
  const localOnlyCount = await gitRefExists(params.repoDir, remoteRef) ? await countUnpushedCommits(params.repoDir, remoteRef, params.storageBranch) : 0;
1867
1909
  if (localOnlyCount > 1) {
@@ -1887,7 +1929,7 @@ async function pushDirectResultsToStorageBranch(params) {
1887
1929
  async function directPushResults(params) {
1888
1930
  const normalized = normalizeResultsConfig(params.config);
1889
1931
  const repoDir = await ensureResultsRepoClone(normalized);
1890
- await fetchResultsRepo(repoDir, normalized.remote).catch((error) => {
1932
+ await fetchResultsRepo(repoDir, normalized.remote, normalized.branch).catch((error) => {
1891
1933
  if (normalized.require_push) {
1892
1934
  throw error;
1893
1935
  }
@@ -2057,7 +2099,7 @@ function buildWipBranchName(runDir) {
2057
2099
  async function setupWipWorktree(params) {
2058
2100
  const normalized = normalizeResultsConfig(params.config);
2059
2101
  const cloneDir = await ensureResultsRepoClone(normalized);
2060
- await fetchResultsRepo(cloneDir, normalized.remote).catch((error) => {
2102
+ await fetchResultsRepo(cloneDir, normalized.remote, normalized.branch).catch((error) => {
2061
2103
  if (normalized.require_push) {
2062
2104
  throw error;
2063
2105
  }
@@ -3418,4 +3460,4 @@ export {
3418
3460
  TranscriptProvider,
3419
3461
  createAgentKernel
3420
3462
  };
3421
- //# sourceMappingURL=chunk-SLK6MUSS.js.map
3463
+ //# sourceMappingURL=chunk-RBOP5X36.js.map