agent-valley 4.14.1 → 4.14.3

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.14.1",
4
+ "version": "4.14.3",
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
@@ -76377,6 +76377,85 @@ function unavailableDirectorAdvice(mission) {
76377
76377
  });
76378
76378
  }
76379
76379
 
76380
+ // ../../packages/core/src/chief/parallel.ts
76381
+ function readyTaskWave(plan, states, limit) {
76382
+ if (!Number.isInteger(limit) || limit < 1 || limit > 20)
76383
+ throw new Error("Use a parallel Actor limit between 1 and 20.");
76384
+ const completed = new Set(states.filter((state) => state.status === "completed").map((state) => state.id));
76385
+ return plan.tasks.filter((task) => !completed.has(task.id) && task.dependencies.every((id) => completed.has(id))).slice(0, limit);
76386
+ }
76387
+ function planWaveWidths(tasks) {
76388
+ const completed = new Set;
76389
+ const widths = [];
76390
+ let remaining = [...tasks];
76391
+ while (remaining.length) {
76392
+ const ready = remaining.filter((task) => task.dependencies.every((id) => completed.has(id)));
76393
+ if (!ready.length)
76394
+ break;
76395
+ for (const task of ready)
76396
+ completed.add(task.id);
76397
+ remaining = remaining.filter((task) => !completed.has(task.id));
76398
+ widths.push(ready.length);
76399
+ }
76400
+ return widths;
76401
+ }
76402
+ function planWaveOf(tasks, id) {
76403
+ const completed = new Set;
76404
+ let remaining = [...tasks];
76405
+ while (remaining.length) {
76406
+ const ready = remaining.filter((task) => task.dependencies.every((entry) => completed.has(entry)));
76407
+ if (!ready.length)
76408
+ break;
76409
+ if (ready.some((task) => task.id === id)) {
76410
+ const wave = new Set(ready.map((task) => task.id));
76411
+ return {
76412
+ peers: [...wave].filter((entry) => entry !== id),
76413
+ dependents: tasks.filter((task) => !wave.has(task.id) && task.dependencies.some((entry) => wave.has(entry))).map((task) => task.id)
76414
+ };
76415
+ }
76416
+ for (const task of ready)
76417
+ completed.add(task.id);
76418
+ remaining = remaining.filter((task) => !completed.has(task.id));
76419
+ }
76420
+ return { peers: [], dependents: [] };
76421
+ }
76422
+ async function runJoinedWave(items, run, signal, limit = Math.max(1, items.length)) {
76423
+ signal?.throwIfAborted();
76424
+ if (!Number.isInteger(limit) || limit < 1)
76425
+ throw new Error("Use a positive integer parallel Actor limit.");
76426
+ const children = items.map(() => new AbortController);
76427
+ const abort = () => {
76428
+ for (const child of children)
76429
+ child.abort(signal?.reason);
76430
+ };
76431
+ signal?.addEventListener("abort", abort, { once: true });
76432
+ try {
76433
+ if (signal?.aborted)
76434
+ abort();
76435
+ const results = new Array(items.length);
76436
+ let next = 0;
76437
+ const worker = async () => {
76438
+ while (next < items.length) {
76439
+ const index = next++;
76440
+ const child = children[index];
76441
+ const item = items[index];
76442
+ if (!child || item === undefined)
76443
+ throw new Error("Restore the parallel Actor wave before continuing.");
76444
+ try {
76445
+ child.signal.throwIfAborted();
76446
+ results[index] = { status: "fulfilled", value: await run(item, child.signal) };
76447
+ } catch (error) {
76448
+ results[index] = { status: "rejected", reason: error };
76449
+ }
76450
+ }
76451
+ };
76452
+ await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
76453
+ return results;
76454
+ } finally {
76455
+ signal?.removeEventListener("abort", abort);
76456
+ }
76457
+ }
76458
+
76380
76459
  // ../../packages/core/src/chief/task-decomposition-guidance.ts
76381
76460
  var sharedOwnershipGuidance = "Preserve other Actors' work and respect assigned file ownership. Shared manifests, lockfiles and registries have one assigned writer per execution wave; any ownership handoff requires an actual artifact dependency. Report needed changes outside the assignment to the Chief for coordination.";
76382
76461
  function taskDecompositionGuidance(mission, phase) {
@@ -76390,7 +76469,8 @@ function taskDecompositionGuidance(mission, phase) {
76390
76469
  return [
76391
76470
  `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.`,
76392
76471
  ...limit > 1 ? [
76393
- `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.`
76472
+ `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.`,
76473
+ "Tasks of one wave run in separate workspaces and are merged afterwards, so two of them can never edit the same file. A wave task's own tests must pass with only its files and its dependencies' deliveries: wiring that every wave task needs (dispatch, registration, routing) is delivered by the preceding contract task, and tests that need wiring done after the wave belong to the later integration task."
76394
76474
  ] : [],
76395
76475
  "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.",
76396
76476
  "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.",
@@ -76519,6 +76599,23 @@ var BUILD_AUTHORIZATION_RULE = "Build authorization: when the mission goal, char
76519
76599
  var HANDOFF_PATH_RULE = "Handoff transport: files move between task workspaces only as Git-visible changes; there is no separate artifact channel. A file written under a path the repository ignores (build output, caches, local result folders) is not delivered from an isolated task workspace, so reviewers and later tasks never see it. Put every deliverable or handoff file that a reviewer or another task must read at a non-ignored path; a deliverable missing for this reason is repaired by writing it at a non-ignored path.";
76520
76600
  var INTEGRATION_CHECK_RULE = "integrationCheck is what AV itself observed by running the operator's integration command, or otherwise the verification contract's commands, on the integrated tree after this delivery, before this review. Treat it as executed evidence. A failing test or lint that existed before, or that covers code this delivery or its wave changed, is a blocking finding for this task: name the failing check and the repair. The Actor of the task under review repairs such a failure in this task; do not direct it to another owner or to the Chief. A command that fails only because a later planned task has not yet delivered the files it names is not a finding; say so in the summary.";
76521
76601
  var OWN_REPAIR_RULE = "Repair ownership: when a review finding, integrationCheck or your own run shows a failing test, lint or build in this repository, repair it in this task even when the failing code was delivered by an earlier task or lies outside this task's stated files. Recording the failure for another owner or for the Chief is not a repair and will be rejected again. Hand back only a prerequisite you cannot change from this workspace, such as missing credentials or an external service.";
76602
+ function waveOf(mission, task) {
76603
+ return planWaveOf(mission.plan?.tasks ?? [], task.id);
76604
+ }
76605
+ function waveRepairRule(mission, task) {
76606
+ const { peers, dependents } = waveOf(mission, task);
76607
+ if (!peers.length)
76608
+ return;
76609
+ const later = dependents.length ? `the later task that integrates this wave (${dependents.join(", ")})` : "the Chief Director";
76610
+ return `Concurrent wave: ${peers.join(", ")} run at the same time as this task in separate workspaces, and the deliveries are merged afterwards. This limits the repair ownership rule above: edit only the files this assignment owns. A file that another wave task owns or also has to change cannot be merged twice, so do not edit it; when a failure needs such a change, report the file and the exact change needed for ${later} instead. A failure located in another wave task's files is that task's to repair.`;
76611
+ }
76612
+ function waveReviewRule(mission, task) {
76613
+ const { peers, dependents } = waveOf(mission, task);
76614
+ if (!peers.length)
76615
+ return;
76616
+ const shared = dependents.length ? `belongs to the later task that integrates this wave (${dependents.join(", ")}): record it in the summary and do not block this task on it` : `is repaired by the first of ${[task.id, ...peers].sort().join(", ")} only`;
76617
+ return `Wave ownership: this task was delivered in one wave with ${peers.join(", ")}, and integrationCheck ran once on their combined tree. This limits the rule above. Hold this task responsible only for failures caused by or located in the files of its own changeSet and assignment. A failure located in another wave task's files is that task's finding: name that task in the summary and do not ask this task's Actor to edit those files. A failure that needs a change to a file outside every wave task's assignment, such as shared wiring, registration or manifests, ${shared}.`;
76618
+ }
76522
76619
  var OPERATOR_NOTES_RULE = "mission.operatorNotes are operator instructions recorded after earlier attempts. When a note reports an environment or prerequisite change, re-run the affected check in the current environment instead of relying on evidence that predates the note; a note never changes the goal, acceptance criteria or verification command.";
76523
76620
  function workPrompt(mission, task, state, persona) {
76524
76621
  const dependencies = mission.tasks.filter((entry) => task.dependencies.includes(entry.id)).map((entry) => ({
@@ -76539,6 +76636,7 @@ function workPrompt(mission, task, state, persona) {
76539
76636
  OPERATOR_NOTES_RULE,
76540
76637
  BUILD_AUTHORIZATION_RULE,
76541
76638
  OWN_REPAIR_RULE,
76639
+ ...[waveRepairRule(mission, task)].filter((rule) => rule !== undefined),
76542
76640
  HANDOFF_PATH_RULE,
76543
76641
  VERIFICATION_TIMEOUT_RULE,
76544
76642
  "Do not weaken tests or acceptance criteria to make verification pass. Do not alter the operator's verification command.",
@@ -76586,7 +76684,7 @@ function reviewPrompt(mission, task, state) {
76586
76684
  "No container or service observation policy is configured for this mission: do not require a deployment target inventory, target health, availability or recent-error observations, and do not treat the sandbox's deliberate av.yaml read denial as a blocker. Numeric targets in goal criteria mean the goal's own documented targets."
76587
76685
  ],
76588
76686
  "Reject incomplete requirements, missing deliverables, weakened tests, correctness defects, or missing evidence.",
76589
- ...task && state?.integrationCheck ? [INTEGRATION_CHECK_RULE] : [],
76687
+ ...task && state?.integrationCheck ? [INTEGRATION_CHECK_RULE, waveReviewRule(mission, task)].filter((rule) => rule !== undefined) : [],
76590
76688
  ...task ? [HANDOFF_PATH_RULE, EXHAUSTIVE_REVIEW_RULE, ...state?.review ? [REPAIR_REVIEW_RULE] : []] : [],
76591
76689
  ...mission.technicalLeadId ? [
76592
76690
  "The Technical Director's technical preferences are advisory. Do not reject an authorized Chief Director strategy merely for choosing higher cost or a different stack; assess actual goal, acceptance, correctness and evidence."
@@ -138409,6 +138507,7 @@ function recoveryResetTaskIds(previousPlan, plan, targetId) {
138409
138507
  return reset;
138410
138508
  }
138411
138509
  }
138510
+ var recoveryScope = (attempt) => `This recovery text was written for attempt ${attempt}. A limit it sets for a single attempt, such as changing only named files, ends with that attempt; a later attempt repairs the repairFindings of the newest review.`;
138412
138511
  function applyRecovery(mission, response) {
138413
138512
  if (!mission.plan)
138414
138513
  throw new Error("Chief Director recovery needs an existing plan. Restore the mission checkpoint.");
@@ -138430,10 +138529,13 @@ function applyRecovery(mission, response) {
138430
138529
  continue;
138431
138530
  if (response.action === "reassign")
138432
138531
  task.personaId = response.personaId;
138532
+ const attempt = (previousStates.find((state) => state.id === task.id)?.attempts ?? 0) + 1;
138433
138533
  task.instructions = `${task.instructions.split(/\n\nChief(?: Director)? recovery:\n/)[0]}
138434
138534
 
138435
138535
  Chief Director recovery:
138436
- ${response.instructions}`;
138536
+ ${response.instructions}
138537
+
138538
+ ${recoveryScope(attempt)}`;
138437
138539
  }
138438
138540
  plan = mission.plan;
138439
138541
  }
@@ -138815,67 +138917,6 @@ async function reportMission(context) {
138815
138917
 
138816
138918
  // ../../packages/core/src/chief/coordinator-preparation.ts
138817
138919
  init_execution();
138818
-
138819
- // ../../packages/core/src/chief/parallel.ts
138820
- function readyTaskWave(plan, states, limit) {
138821
- if (!Number.isInteger(limit) || limit < 1 || limit > 20)
138822
- throw new Error("Use a parallel Actor limit between 1 and 20.");
138823
- const completed = new Set(states.filter((state) => state.status === "completed").map((state) => state.id));
138824
- return plan.tasks.filter((task) => !completed.has(task.id) && task.dependencies.every((id) => completed.has(id))).slice(0, limit);
138825
- }
138826
- function planWaveWidths(tasks) {
138827
- const completed = new Set;
138828
- const widths = [];
138829
- let remaining = [...tasks];
138830
- while (remaining.length) {
138831
- const ready = remaining.filter((task) => task.dependencies.every((id) => completed.has(id)));
138832
- if (!ready.length)
138833
- break;
138834
- for (const task of ready)
138835
- completed.add(task.id);
138836
- remaining = remaining.filter((task) => !completed.has(task.id));
138837
- widths.push(ready.length);
138838
- }
138839
- return widths;
138840
- }
138841
- async function runJoinedWave(items, run, signal, limit = Math.max(1, items.length)) {
138842
- signal?.throwIfAborted();
138843
- if (!Number.isInteger(limit) || limit < 1)
138844
- throw new Error("Use a positive integer parallel Actor limit.");
138845
- const children = items.map(() => new AbortController);
138846
- const abort = () => {
138847
- for (const child of children)
138848
- child.abort(signal?.reason);
138849
- };
138850
- signal?.addEventListener("abort", abort, { once: true });
138851
- try {
138852
- if (signal?.aborted)
138853
- abort();
138854
- const results = new Array(items.length);
138855
- let next = 0;
138856
- const worker = async () => {
138857
- while (next < items.length) {
138858
- const index = next++;
138859
- const child = children[index];
138860
- const item = items[index];
138861
- if (!child || item === undefined)
138862
- throw new Error("Restore the parallel Actor wave before continuing.");
138863
- try {
138864
- child.signal.throwIfAborted();
138865
- results[index] = { status: "fulfilled", value: await run(item, child.signal) };
138866
- } catch (error) {
138867
- results[index] = { status: "rejected", reason: error };
138868
- }
138869
- }
138870
- };
138871
- await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()));
138872
- return results;
138873
- } finally {
138874
- signal?.removeEventListener("abort", abort);
138875
- }
138876
- }
138877
-
138878
- // ../../packages/core/src/chief/coordinator-preparation.ts
138879
138920
  async function resumeMission(context) {
138880
138921
  const { mission, ports, operatorGoal, operatorVerify, checkAbort, save } = context;
138881
138922
  finalizeAbandonedRuns(mission);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-valley",
3
- "version": "4.14.1",
3
+ "version": "4.14.3",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=26.10.0",