agent-valley 4.13.0 → 4.14.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.
- package/dist/assets/plugin.json +1 -1
- package/dist/index.js +122 -50
- package/package.json +1 -1
package/dist/assets/plugin.json
CHANGED
|
@@ -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.
|
|
4
|
+
"version": "4.14.0",
|
|
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
|
@@ -76367,13 +76367,17 @@ function taskDecompositionGuidance(mission, phase) {
|
|
|
76367
76367
|
sharedOwnershipGuidance
|
|
76368
76368
|
].join(`
|
|
76369
76369
|
`);
|
|
76370
|
+
const limit = mission.executionPolicy?.maxParallel ?? 1;
|
|
76370
76371
|
return [
|
|
76371
|
-
`For substantial work spanning real modules, services, domains or layers, divide tasks by independently owned deliverables when this improves execution. The saved workspace concurrency limit is ${
|
|
76372
|
+
`For substantial work spanning real modules, services, domains or layers, divide tasks by independently owned deliverables when this improves execution. The saved workspace concurrency limit is ${limit}; plan within it. Keep a small coherent request as one task and keep genuinely coupled changes together. Do not invent work to fill parallel slots.`,
|
|
76373
|
+
...limit > 1 ? [
|
|
76374
|
+
`Up to ${limit} ready tasks run at once, and a wave with one ready task leaves the other slots idle for its whole duration. When the work is substantial, shape the plan so several tasks are ready together: split implementation by disjoint owned paths (package, module, surface) rather than by layer, role or step, and keep each unit's tests in the task that implements that unit instead of a later test-only task.`
|
|
76375
|
+
] : [],
|
|
76372
76376
|
"Reuse existing stable interfaces. If independent consumers need a missing or changing contract, assign a concise contract-producing task first to establish the shared types, API, protocol or artifact and its acceptance evidence. Consumers may then depend on that contract without waiting for unrelated implementation work.",
|
|
76373
76377
|
"Document each task's boundaries in its existing instructions and acceptance: owned files, required input artifacts, output artifacts and interface expectations. Assign the writer for shared files. Record these details only in existing Task instructions/acceptance; do not introduce Task or response-root schema keys.",
|
|
76374
76378
|
sharedOwnershipGuidance,
|
|
76375
76379
|
"An independent verification or QA task delivers evidence: its acceptance is the accuracy, completeness and reproducibility of its report and receipts, never the absence of defects in another task's deliverable. A reproducible defect it finds is reported as a blocker for the owning implementation task; repairing the QA task cannot fix product code, so do not phrase QA acceptance as the blocker being cleared.",
|
|
76376
|
-
"A dependency means the task needs an actual preceding deliverable. Do not chain tasks merely because of layer names, team roles or plan order, and do not remove a genuine dependency to force concurrency. Independent consumers of the same stable contract can share that prerequisite. Add an integration task only when real wiring or combined acceptance checks are needed, depending on the relevant implementations; retain the framework's independent task reviews and final verification.",
|
|
76380
|
+
"A dependency means the task needs an actual preceding deliverable; name that delivered file or interface in the dependent task's instructions. Do not chain tasks merely because of layer names, team roles or plan order, and do not remove a genuine dependency to force concurrency. Independent consumers of the same stable contract can share that prerequisite. Add an integration task only when real wiring or combined acceptance checks are needed, depending on the relevant implementations; retain the framework's independent task reviews and final verification.",
|
|
76377
76381
|
...phase === "replan" ? [
|
|
76378
76382
|
"During recovery, reuse verified deliverables and retained interfaces. Repartition only the remaining work when it helps the original outcome; preserve every original acceptance obligation, the existing roster, Chief identity and spent budgets."
|
|
76379
76383
|
] : []
|
|
@@ -79680,6 +79684,43 @@ init_parallel_contract();
|
|
|
79680
79684
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
79681
79685
|
import { rm as rm8, writeFile as writeFile11 } from "node:fs/promises";
|
|
79682
79686
|
import { dirname as dirname9, join as join39 } from "node:path";
|
|
79687
|
+
var imageKey = (image) => image ? `${image.mode} ${image.oid}` : "absent";
|
|
79688
|
+
async function acceptedLineageImages(baselinePath, commit, sourceHead, paths) {
|
|
79689
|
+
const images = new Map;
|
|
79690
|
+
for (let start = 0;start < paths.length; start += 200) {
|
|
79691
|
+
const out = await parallelGit(baselinePath, [
|
|
79692
|
+
"log",
|
|
79693
|
+
"--first-parent",
|
|
79694
|
+
"--diff-merges=first-parent",
|
|
79695
|
+
"--no-renames",
|
|
79696
|
+
"--raw",
|
|
79697
|
+
"--no-abbrev",
|
|
79698
|
+
"-z",
|
|
79699
|
+
"--format=",
|
|
79700
|
+
commit,
|
|
79701
|
+
"--not",
|
|
79702
|
+
sourceHead,
|
|
79703
|
+
"--",
|
|
79704
|
+
...paths.slice(start, start + 200)
|
|
79705
|
+
], { GIT_LITERAL_PATHSPECS: "1" });
|
|
79706
|
+
const tokens = out.split("\x00");
|
|
79707
|
+
for (let index = 0;index + 1 < tokens.length; index++) {
|
|
79708
|
+
const meta = tokens[index]?.trim() ?? "";
|
|
79709
|
+
if (!meta.startsWith(":"))
|
|
79710
|
+
continue;
|
|
79711
|
+
const [oldMode = "", newMode = "", oldOid = "", newOid = ""] = meta.slice(1).split(" ");
|
|
79712
|
+
const path = tokens[++index] ?? "";
|
|
79713
|
+
const seen = images.get(path) ?? new Set;
|
|
79714
|
+
for (const [mode, oid] of [
|
|
79715
|
+
[oldMode, oldOid],
|
|
79716
|
+
[newMode, newOid]
|
|
79717
|
+
])
|
|
79718
|
+
seen.add(/^0+$/.test(mode ?? "") ? "absent" : `${mode} ${oid}`);
|
|
79719
|
+
images.set(path, seen);
|
|
79720
|
+
}
|
|
79721
|
+
}
|
|
79722
|
+
return images;
|
|
79723
|
+
}
|
|
79683
79724
|
async function synchronizeContinuousBaselineWithSource(operation, baseline = operation.baseline, signal) {
|
|
79684
79725
|
signal?.throwIfAborted();
|
|
79685
79726
|
const policy = operation.sourceIntegrationPolicy;
|
|
@@ -79699,6 +79740,7 @@ async function synchronizeContinuousBaselineWithSource(operation, baseline = ope
|
|
|
79699
79740
|
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
79700
79741
|
const removed = [];
|
|
79701
79742
|
const upserted = [];
|
|
79743
|
+
const contested = [];
|
|
79702
79744
|
for (const path of [...new Set([...baseImages.keys(), ...headImages.keys()])].sort()) {
|
|
79703
79745
|
if (!productPath(path))
|
|
79704
79746
|
continue;
|
|
@@ -79711,11 +79753,24 @@ async function synchronizeContinuousBaselineWithSource(operation, baseline = ope
|
|
|
79711
79753
|
const existing = baselineImages.get(path) ?? null;
|
|
79712
79754
|
if (same(existing, after))
|
|
79713
79755
|
continue;
|
|
79714
|
-
if (!
|
|
79756
|
+
if (!same(existing, before))
|
|
79757
|
+
contested.push({ path, after });
|
|
79758
|
+
else if (!after)
|
|
79715
79759
|
removed.push(path);
|
|
79716
79760
|
else
|
|
79717
79761
|
upserted.push({ path, image: after });
|
|
79718
79762
|
}
|
|
79763
|
+
if (contested.length) {
|
|
79764
|
+
const lineage = await acceptedLineageImages(current.path, current.commit, policy.head, contested.map((entry) => entry.path));
|
|
79765
|
+
for (const { path, after } of contested) {
|
|
79766
|
+
if (lineage.get(path)?.has(imageKey(after)))
|
|
79767
|
+
continue;
|
|
79768
|
+
if (!after)
|
|
79769
|
+
removed.push(path);
|
|
79770
|
+
else
|
|
79771
|
+
upserted.push({ path, image: after });
|
|
79772
|
+
}
|
|
79773
|
+
}
|
|
79719
79774
|
let nextTree = current.baselineTree;
|
|
79720
79775
|
if (removed.length || upserted.length) {
|
|
79721
79776
|
const index = join39(current.path, ".git", `av-sync-index-${randomUUID17()}`);
|
|
@@ -138698,6 +138753,67 @@ async function reportMission(context) {
|
|
|
138698
138753
|
|
|
138699
138754
|
// ../../packages/core/src/chief/coordinator-preparation.ts
|
|
138700
138755
|
init_execution();
|
|
138756
|
+
|
|
138757
|
+
// ../../packages/core/src/chief/parallel.ts
|
|
138758
|
+
function readyTaskWave(plan, states, limit) {
|
|
138759
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 20)
|
|
138760
|
+
throw new Error("Use a parallel Actor limit between 1 and 20.");
|
|
138761
|
+
const completed = new Set(states.filter((state) => state.status === "completed").map((state) => state.id));
|
|
138762
|
+
return plan.tasks.filter((task) => !completed.has(task.id) && task.dependencies.every((id) => completed.has(id))).slice(0, limit);
|
|
138763
|
+
}
|
|
138764
|
+
function planWaveWidths(tasks) {
|
|
138765
|
+
const completed = new Set;
|
|
138766
|
+
const widths = [];
|
|
138767
|
+
let remaining = [...tasks];
|
|
138768
|
+
while (remaining.length) {
|
|
138769
|
+
const ready = remaining.filter((task) => task.dependencies.every((id) => completed.has(id)));
|
|
138770
|
+
if (!ready.length)
|
|
138771
|
+
break;
|
|
138772
|
+
for (const task of ready)
|
|
138773
|
+
completed.add(task.id);
|
|
138774
|
+
remaining = remaining.filter((task) => !completed.has(task.id));
|
|
138775
|
+
widths.push(ready.length);
|
|
138776
|
+
}
|
|
138777
|
+
return widths;
|
|
138778
|
+
}
|
|
138779
|
+
async function runJoinedWave(items, run, signal, limit = Math.max(1, items.length)) {
|
|
138780
|
+
signal?.throwIfAborted();
|
|
138781
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
138782
|
+
throw new Error("Use a positive integer parallel Actor limit.");
|
|
138783
|
+
const children = items.map(() => new AbortController);
|
|
138784
|
+
const abort = () => {
|
|
138785
|
+
for (const child of children)
|
|
138786
|
+
child.abort(signal?.reason);
|
|
138787
|
+
};
|
|
138788
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
138789
|
+
try {
|
|
138790
|
+
if (signal?.aborted)
|
|
138791
|
+
abort();
|
|
138792
|
+
const results = new Array(items.length);
|
|
138793
|
+
let next = 0;
|
|
138794
|
+
const worker = async () => {
|
|
138795
|
+
while (next < items.length) {
|
|
138796
|
+
const index = next++;
|
|
138797
|
+
const child = children[index];
|
|
138798
|
+
const item = items[index];
|
|
138799
|
+
if (!child || item === undefined)
|
|
138800
|
+
throw new Error("Restore the parallel Actor wave before continuing.");
|
|
138801
|
+
try {
|
|
138802
|
+
child.signal.throwIfAborted();
|
|
138803
|
+
results[index] = { status: "fulfilled", value: await run(item, child.signal) };
|
|
138804
|
+
} catch (error) {
|
|
138805
|
+
results[index] = { status: "rejected", reason: error };
|
|
138806
|
+
}
|
|
138807
|
+
}
|
|
138808
|
+
};
|
|
138809
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
138810
|
+
return results;
|
|
138811
|
+
} finally {
|
|
138812
|
+
signal?.removeEventListener("abort", abort);
|
|
138813
|
+
}
|
|
138814
|
+
}
|
|
138815
|
+
|
|
138816
|
+
// ../../packages/core/src/chief/coordinator-preparation.ts
|
|
138701
138817
|
async function resumeMission(context) {
|
|
138702
138818
|
const { mission, ports, operatorGoal, operatorVerify, checkAbort, save } = context;
|
|
138703
138819
|
finalizeAbandonedRuns(mission);
|
|
@@ -138764,7 +138880,9 @@ async function planMission(context) {
|
|
|
138764
138880
|
});
|
|
138765
138881
|
applyPlanningResult(mission, planned);
|
|
138766
138882
|
contract.pin();
|
|
138767
|
-
|
|
138883
|
+
const widths = planWaveWidths(planned.plan.tasks);
|
|
138884
|
+
const limit = mission.executionPolicy?.maxParallel ?? 1;
|
|
138885
|
+
await save("plan", `Chief Director planned ${mission.tasks.length} tasks${widths.length && limit > 1 ? ` in ${widths.length} dependency waves (widest ${Math.min(Math.max(...widths), limit)} of ${limit} slots; waves ${widths.join("-")})` : ""}.`);
|
|
138768
138886
|
}
|
|
138769
138887
|
if (mission.supervision?.pendingRecovery) {
|
|
138770
138888
|
const pending = mission.supervision.pendingRecovery;
|
|
@@ -138806,52 +138924,6 @@ async function recordIntegrationCheck(mission, ports, states, save) {
|
|
|
138806
138924
|
|
|
138807
138925
|
// ../../packages/core/src/chief/coordinator-parallel.ts
|
|
138808
138926
|
init_execution();
|
|
138809
|
-
|
|
138810
|
-
// ../../packages/core/src/chief/parallel.ts
|
|
138811
|
-
function readyTaskWave(plan, states, limit) {
|
|
138812
|
-
if (!Number.isInteger(limit) || limit < 1 || limit > 20)
|
|
138813
|
-
throw new Error("Use a parallel Actor limit between 1 and 20.");
|
|
138814
|
-
const completed = new Set(states.filter((state) => state.status === "completed").map((state) => state.id));
|
|
138815
|
-
return plan.tasks.filter((task) => !completed.has(task.id) && task.dependencies.every((id) => completed.has(id))).slice(0, limit);
|
|
138816
|
-
}
|
|
138817
|
-
async function runJoinedWave(items, run, signal, limit = Math.max(1, items.length)) {
|
|
138818
|
-
signal?.throwIfAborted();
|
|
138819
|
-
if (!Number.isInteger(limit) || limit < 1)
|
|
138820
|
-
throw new Error("Use a positive integer parallel Actor limit.");
|
|
138821
|
-
const children = items.map(() => new AbortController);
|
|
138822
|
-
const abort = () => {
|
|
138823
|
-
for (const child of children)
|
|
138824
|
-
child.abort(signal?.reason);
|
|
138825
|
-
};
|
|
138826
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
138827
|
-
try {
|
|
138828
|
-
if (signal?.aborted)
|
|
138829
|
-
abort();
|
|
138830
|
-
const results = new Array(items.length);
|
|
138831
|
-
let next = 0;
|
|
138832
|
-
const worker = async () => {
|
|
138833
|
-
while (next < items.length) {
|
|
138834
|
-
const index = next++;
|
|
138835
|
-
const child = children[index];
|
|
138836
|
-
const item = items[index];
|
|
138837
|
-
if (!child || item === undefined)
|
|
138838
|
-
throw new Error("Restore the parallel Actor wave before continuing.");
|
|
138839
|
-
try {
|
|
138840
|
-
child.signal.throwIfAborted();
|
|
138841
|
-
results[index] = { status: "fulfilled", value: await run(item, child.signal) };
|
|
138842
|
-
} catch (error) {
|
|
138843
|
-
results[index] = { status: "rejected", reason: error };
|
|
138844
|
-
}
|
|
138845
|
-
}
|
|
138846
|
-
};
|
|
138847
|
-
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
|
|
138848
|
-
return results;
|
|
138849
|
-
} finally {
|
|
138850
|
-
signal?.removeEventListener("abort", abort);
|
|
138851
|
-
}
|
|
138852
|
-
}
|
|
138853
|
-
|
|
138854
|
-
// ../../packages/core/src/chief/coordinator-parallel.ts
|
|
138855
138927
|
class ParallelTaskReviewRejected extends Error {
|
|
138856
138928
|
}
|
|
138857
138929
|
async function performParallelWave(mission, ports, wave, hooks) {
|