agent-valley 4.13.0 → 4.13.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "av",
4
- "version": "4.13.0",
4
+ "version": "4.13.1",
5
5
  "description": "Delegate repository goals to Agent Valley and inspect mission progress and verification evidence.",
6
6
  "author": {
7
7
  "name": "Agent Valley"
package/dist/index.js CHANGED
@@ -79680,6 +79680,43 @@ init_parallel_contract();
79680
79680
  import { randomUUID as randomUUID17 } from "node:crypto";
79681
79681
  import { rm as rm8, writeFile as writeFile11 } from "node:fs/promises";
79682
79682
  import { dirname as dirname9, join as join39 } from "node:path";
79683
+ var imageKey = (image) => image ? `${image.mode} ${image.oid}` : "absent";
79684
+ async function acceptedLineageImages(baselinePath, commit, sourceHead, paths) {
79685
+ const images = new Map;
79686
+ for (let start = 0;start < paths.length; start += 200) {
79687
+ const out = await parallelGit(baselinePath, [
79688
+ "log",
79689
+ "--first-parent",
79690
+ "--diff-merges=first-parent",
79691
+ "--no-renames",
79692
+ "--raw",
79693
+ "--no-abbrev",
79694
+ "-z",
79695
+ "--format=",
79696
+ commit,
79697
+ "--not",
79698
+ sourceHead,
79699
+ "--",
79700
+ ...paths.slice(start, start + 200)
79701
+ ], { GIT_LITERAL_PATHSPECS: "1" });
79702
+ const tokens = out.split("\x00");
79703
+ for (let index = 0;index + 1 < tokens.length; index++) {
79704
+ const meta = tokens[index]?.trim() ?? "";
79705
+ if (!meta.startsWith(":"))
79706
+ continue;
79707
+ const [oldMode = "", newMode = "", oldOid = "", newOid = ""] = meta.slice(1).split(" ");
79708
+ const path = tokens[++index] ?? "";
79709
+ const seen = images.get(path) ?? new Set;
79710
+ for (const [mode, oid] of [
79711
+ [oldMode, oldOid],
79712
+ [newMode, newOid]
79713
+ ])
79714
+ seen.add(/^0+$/.test(mode ?? "") ? "absent" : `${mode} ${oid}`);
79715
+ images.set(path, seen);
79716
+ }
79717
+ }
79718
+ return images;
79719
+ }
79683
79720
  async function synchronizeContinuousBaselineWithSource(operation, baseline = operation.baseline, signal) {
79684
79721
  signal?.throwIfAborted();
79685
79722
  const policy = operation.sourceIntegrationPolicy;
@@ -79699,6 +79736,7 @@ async function synchronizeContinuousBaselineWithSource(operation, baseline = ope
79699
79736
  const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
79700
79737
  const removed = [];
79701
79738
  const upserted = [];
79739
+ const contested = [];
79702
79740
  for (const path of [...new Set([...baseImages.keys(), ...headImages.keys()])].sort()) {
79703
79741
  if (!productPath(path))
79704
79742
  continue;
@@ -79711,11 +79749,24 @@ async function synchronizeContinuousBaselineWithSource(operation, baseline = ope
79711
79749
  const existing = baselineImages.get(path) ?? null;
79712
79750
  if (same(existing, after))
79713
79751
  continue;
79714
- if (!after)
79752
+ if (!same(existing, before))
79753
+ contested.push({ path, after });
79754
+ else if (!after)
79715
79755
  removed.push(path);
79716
79756
  else
79717
79757
  upserted.push({ path, image: after });
79718
79758
  }
79759
+ if (contested.length) {
79760
+ const lineage = await acceptedLineageImages(current.path, current.commit, policy.head, contested.map((entry) => entry.path));
79761
+ for (const { path, after } of contested) {
79762
+ if (lineage.get(path)?.has(imageKey(after)))
79763
+ continue;
79764
+ if (!after)
79765
+ removed.push(path);
79766
+ else
79767
+ upserted.push({ path, image: after });
79768
+ }
79769
+ }
79719
79770
  let nextTree = current.baselineTree;
79720
79771
  if (removed.length || upserted.length) {
79721
79772
  const index = join39(current.path, ".git", `av-sync-index-${randomUUID17()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-valley",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=26.10.0",