@agentv/core 4.33.0-next.1 → 4.34.1-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.
package/dist/index.cjs CHANGED
@@ -26886,7 +26886,8 @@ async function inspectResultsRepoGit(repoDir) {
26886
26886
  cwd: repoDir,
26887
26887
  check: false
26888
26888
  });
26889
- const { dirtyPaths, conflictedPaths } = parseGitPorcelainPaths(porcelain);
26889
+ const { dirtyPaths: allDirtyPaths, conflictedPaths } = parseGitPorcelainPaths(porcelain);
26890
+ const dirtyPaths = allDirtyPaths.filter(isSafeResultsRepoPath);
26890
26891
  const { ahead = 0, behind = 0 } = await getAheadBehind(repoDir, upstream);
26891
26892
  const inProgressConflict = await hasInProgressGitConflict(repoDir);
26892
26893
  let syncStatus = "clean";
@@ -26939,9 +26940,6 @@ function lastErrorForGitInspection(status, inspection) {
26939
26940
  if (status.auto_push === false) {
26940
26941
  return "Results repo has uncommitted changes and auto_push is disabled";
26941
26942
  }
26942
- if (!areSafeResultsRepoPaths(inspection.dirtyPaths)) {
26943
- return "Results repo has non-results working tree changes";
26944
- }
26945
26943
  }
26946
26944
  return void 0;
26947
26945
  }
@@ -26964,10 +26962,11 @@ function withActionFlags(status, flags) {
26964
26962
  commit_created: flags.commitCreated
26965
26963
  };
26966
26964
  }
26965
+ function isSafeResultsRepoPath(p) {
26966
+ return p === RESULTS_REPO_RESULTS_DIR || p.startsWith(`${RESULTS_REPO_RESULTS_DIR}/`);
26967
+ }
26967
26968
  function areSafeResultsRepoPaths(paths) {
26968
- return paths.length > 0 && paths.every(
26969
- (p) => p === RESULTS_REPO_RESULTS_DIR || p.startsWith(`${RESULTS_REPO_RESULTS_DIR}/`)
26970
- );
26969
+ return paths.length > 0 && paths.every(isSafeResultsRepoPath);
26971
26970
  }
26972
26971
  async function getAheadPaths(repoDir, upstream) {
26973
26972
  if (!upstream) {
@@ -27079,33 +27078,51 @@ async function syncResultsRepoForProject(config) {
27079
27078
  }
27080
27079
  );
27081
27080
  }
27082
- if (!areSafeResultsRepoPaths(inspection.dirtyPaths)) {
27083
- const status = withGitInspection(getResultsRepoStatus(normalized), inspection);
27084
- updateStatusFile(normalized, {
27085
- last_error: "Results repo has non-results working tree changes"
27086
- });
27087
- return withBlockedStatus(status, "Results repo has non-results working tree changes", {
27088
- pullPerformed,
27089
- pushPerformed,
27090
- commitCreated
27091
- });
27092
- }
27093
27081
  if ((inspection.behind ?? 0) > 0) {
27094
- const status = withGitInspection(getResultsRepoStatus(normalized), inspection);
27095
- const reason = "Results repo has uncommitted result changes and remote changes";
27096
- updateStatusFile(normalized, { last_error: reason });
27097
- return withBlockedStatus(status, reason, {
27098
- pullPerformed,
27099
- pushPerformed,
27100
- commitCreated
27101
- });
27082
+ if (!inspection.upstream) {
27083
+ const status = withGitInspection(getResultsRepoStatus(normalized), inspection);
27084
+ updateStatusFile(normalized, {
27085
+ last_error: "Results repo has no upstream branch to pull from"
27086
+ });
27087
+ return withBlockedStatus(status, "Results repo has no upstream branch to pull from", {
27088
+ pullPerformed,
27089
+ pushPerformed,
27090
+ commitCreated
27091
+ });
27092
+ }
27093
+ try {
27094
+ await runGit(["merge", "--ff-only", inspection.upstream], { cwd: repoDir });
27095
+ pullPerformed = true;
27096
+ inspection = await inspectResultsRepoGit(repoDir);
27097
+ } catch (error) {
27098
+ inspection = await inspectResultsRepoGit(repoDir);
27099
+ const status = withGitInspection(getResultsRepoStatus(normalized), inspection);
27100
+ const reason = `Results repo could not be fast-forwarded: ${getStatusMessage(error)}`;
27101
+ updateStatusFile(normalized, { last_error: reason });
27102
+ return withBlockedStatus(status, reason, {
27103
+ pullPerformed,
27104
+ pushPerformed,
27105
+ commitCreated
27106
+ });
27107
+ }
27108
+ }
27109
+ if (inspection.syncStatus === "dirty") {
27110
+ await runGit(["add", "--all", "--", RESULTS_REPO_RESULTS_DIR], { cwd: repoDir });
27111
+ await runGit(
27112
+ [
27113
+ "commit",
27114
+ "-m",
27115
+ "chore(results): sync local result metadata",
27116
+ "--",
27117
+ RESULTS_REPO_RESULTS_DIR
27118
+ ],
27119
+ {
27120
+ cwd: repoDir
27121
+ }
27122
+ );
27123
+ commitCreated = true;
27124
+ inspection = await inspectResultsRepoGit(repoDir);
27102
27125
  }
27103
- await runGit(["add", "--all", "--", RESULTS_REPO_RESULTS_DIR], { cwd: repoDir });
27104
- await runGit(["commit", "-m", "chore(results): sync local result metadata"], {
27105
- cwd: repoDir
27106
- });
27107
- commitCreated = true;
27108
- inspection = await inspectResultsRepoGit(repoDir);
27109
27126
  }
27110
27127
  if (inspection.syncStatus === "diverged") {
27111
27128
  const status = withGitInspection(getResultsRepoStatus(normalized), inspection);