agent-valley 4.14.2 → 4.15.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 +84 -8
- 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.15.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
|
@@ -78183,7 +78183,7 @@ class ContinuousOperationStore {
|
|
|
78183
78183
|
}
|
|
78184
78184
|
|
|
78185
78185
|
// src/chief-continuous.ts
|
|
78186
|
-
import { execFile as
|
|
78186
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
78187
78187
|
import { randomUUID as randomUUID23 } from "node:crypto";
|
|
78188
78188
|
import { realpath as realpath31 } from "node:fs/promises";
|
|
78189
78189
|
import { join as join58, resolve as resolve33 } from "node:path";
|
|
@@ -82371,6 +82371,63 @@ function unattendedVerificationGuidance(stage) {
|
|
|
82371
82371
|
`);
|
|
82372
82372
|
}
|
|
82373
82373
|
|
|
82374
|
+
// ../../packages/core/src/chief/workspace-growth.ts
|
|
82375
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
82376
|
+
var GIB2 = 1024 ** 3;
|
|
82377
|
+
var INTEGRATION_CHECK_GROWTH_ENV = "AV_INTEGRATION_CHECK_GROWTH_GIB";
|
|
82378
|
+
var DEFAULT_INTEGRATION_CHECK_GROWTH_GIB = 1;
|
|
82379
|
+
var STORAGE_NOTE_PREFIX = "Storage:";
|
|
82380
|
+
function growthThresholdBytes(env = process.env) {
|
|
82381
|
+
const raw = env[INTEGRATION_CHECK_GROWTH_ENV]?.trim();
|
|
82382
|
+
if (!raw)
|
|
82383
|
+
return DEFAULT_INTEGRATION_CHECK_GROWTH_GIB * GIB2;
|
|
82384
|
+
const value = Number(raw);
|
|
82385
|
+
if (!Number.isFinite(value) || value < 0)
|
|
82386
|
+
throw new Error(`${INTEGRATION_CHECK_GROWTH_ENV}=${raw} is invalid. Set it to a non-negative number of GiB (for example ${DEFAULT_INTEGRATION_CHECK_GROWTH_GIB}), or 0 to disable the storage report.`);
|
|
82387
|
+
return value * GIB2;
|
|
82388
|
+
}
|
|
82389
|
+
function directorySizes(path, timeoutMs = 60000) {
|
|
82390
|
+
return new Promise((resolve) => {
|
|
82391
|
+
execFile7("du", ["-k", "-d", "3", path], { timeout: timeoutMs, maxBuffer: 64 * 1024 * 1024 }, (error, stdout) => {
|
|
82392
|
+
if (error && !stdout)
|
|
82393
|
+
return resolve(undefined);
|
|
82394
|
+
const sizes = new Map;
|
|
82395
|
+
for (const line of stdout.split(`
|
|
82396
|
+
`)) {
|
|
82397
|
+
const tab = line.indexOf("\t");
|
|
82398
|
+
const kib = Number(line.slice(0, tab));
|
|
82399
|
+
if (tab < 1 || !Number.isFinite(kib))
|
|
82400
|
+
continue;
|
|
82401
|
+
const entry = line.slice(tab + 1);
|
|
82402
|
+
if (entry !== path && !entry.startsWith(`${path}/`))
|
|
82403
|
+
continue;
|
|
82404
|
+
sizes.set(entry.slice(path.length + 1), kib * 1024);
|
|
82405
|
+
}
|
|
82406
|
+
resolve(sizes.has("") ? sizes : undefined);
|
|
82407
|
+
});
|
|
82408
|
+
});
|
|
82409
|
+
}
|
|
82410
|
+
var owned = (entry) => [".git", ".agent-valley"].some((root) => entry === root || entry.startsWith(`${root}/`));
|
|
82411
|
+
function growthReport(before, after, thresholdBytes) {
|
|
82412
|
+
if (!before || !after || thresholdBytes <= 0)
|
|
82413
|
+
return;
|
|
82414
|
+
const delta = (entry) => (after.get(entry) ?? 0) - (before.get(entry) ?? 0);
|
|
82415
|
+
const total = delta("") - [".git", ".agent-valley"].reduce((sum, root) => sum + delta(root), 0);
|
|
82416
|
+
if (total < thresholdBytes)
|
|
82417
|
+
return;
|
|
82418
|
+
const floor = Math.max(total / 10, 64 * 1024 ** 2);
|
|
82419
|
+
const depth = (entry) => entry.split("/").length;
|
|
82420
|
+
const grown = [...after.keys()].filter((entry) => entry && !owned(entry) && delta(entry) >= floor).sort((a, b) => depth(b) - depth(a) || delta(b) - delta(a));
|
|
82421
|
+
const picked = [];
|
|
82422
|
+
for (const entry of grown)
|
|
82423
|
+
if (!picked.some((child) => child.startsWith(`${entry}/`)))
|
|
82424
|
+
picked.push(entry);
|
|
82425
|
+
const gib = (bytes) => `${(bytes / GIB2).toFixed(1)} GiB`;
|
|
82426
|
+
const where = picked.sort((a, b) => delta(b) - delta(a)).slice(0, 3).map((entry) => `${entry} (+${gib(delta(entry))})`);
|
|
82427
|
+
const size = (after.get("") ?? 0) - (after.get(".git") ?? 0) - (after.get(".agent-valley") ?? 0);
|
|
82428
|
+
return `${STORAGE_NOTE_PREFIX} this check left ${gib(total)} of new files in the workspace (${gib(size)} in total)${where.length ? `, mostly under ${where.join(", ")}` : ""}. Nothing removes them, so repeated checks fill the disk; the tests or scripts that create these files have to remove them.`;
|
|
82429
|
+
}
|
|
82430
|
+
|
|
82374
82431
|
// ../../packages/core/src/chief/runtime-integration-check.ts
|
|
82375
82432
|
var INTEGRATION_CHECK_ENV = "AV_INTEGRATION_CHECK";
|
|
82376
82433
|
var INTEGRATION_CHECK_COMMAND_ENV = "AV_INTEGRATION_CHECK_COMMAND";
|
|
@@ -82417,6 +82474,16 @@ async function runIntegrationCheck(mission, active, signal, source = process.env
|
|
|
82417
82474
|
if (!command && !mission.verificationContract)
|
|
82418
82475
|
return;
|
|
82419
82476
|
await assertMissionWorkspace(mission);
|
|
82477
|
+
const threshold = growthThresholdBytes(source);
|
|
82478
|
+
const before = threshold > 0 ? await directorySizes(mission.workspace.path) : undefined;
|
|
82479
|
+
const result = await checkIntegratedTree(mission, active, command, signal, source);
|
|
82480
|
+
if (!result || !before)
|
|
82481
|
+
return result;
|
|
82482
|
+
const storage = growthReport(before, await directorySizes(mission.workspace.path), threshold);
|
|
82483
|
+
return storage ? { ok: result.ok, output: `${storage}
|
|
82484
|
+
${result.output}`.slice(0, 8000) } : result;
|
|
82485
|
+
}
|
|
82486
|
+
async function checkIntegratedTree(mission, active, command, signal, source) {
|
|
82420
82487
|
active.begin("verify");
|
|
82421
82488
|
try {
|
|
82422
82489
|
const operator = async () => operatorIntegrationResult(command ?? "", await runVerificationGate(mission.workspace, command ?? "", {
|
|
@@ -86120,7 +86187,7 @@ async function resumeSourceIntegration(operation, mode, storageRoot, signal, sav
|
|
|
86120
86187
|
}
|
|
86121
86188
|
|
|
86122
86189
|
// src/chief-continuous.ts
|
|
86123
|
-
var execute3 = promisify5(
|
|
86190
|
+
var execute3 = promisify5(execFile8);
|
|
86124
86191
|
var orderKeys = [
|
|
86125
86192
|
"workspace",
|
|
86126
86193
|
"verify",
|
|
@@ -138507,6 +138574,7 @@ function recoveryResetTaskIds(previousPlan, plan, targetId) {
|
|
|
138507
138574
|
return reset;
|
|
138508
138575
|
}
|
|
138509
138576
|
}
|
|
138577
|
+
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.`;
|
|
138510
138578
|
function applyRecovery(mission, response) {
|
|
138511
138579
|
if (!mission.plan)
|
|
138512
138580
|
throw new Error("Chief Director recovery needs an existing plan. Restore the mission checkpoint.");
|
|
@@ -138528,10 +138596,13 @@ function applyRecovery(mission, response) {
|
|
|
138528
138596
|
continue;
|
|
138529
138597
|
if (response.action === "reassign")
|
|
138530
138598
|
task.personaId = response.personaId;
|
|
138599
|
+
const attempt = (previousStates.find((state) => state.id === task.id)?.attempts ?? 0) + 1;
|
|
138531
138600
|
task.instructions = `${task.instructions.split(/\n\nChief(?: Director)? recovery:\n/)[0]}
|
|
138532
138601
|
|
|
138533
138602
|
Chief Director recovery:
|
|
138534
|
-
${response.instructions}
|
|
138603
|
+
${response.instructions}
|
|
138604
|
+
|
|
138605
|
+
${recoveryScope(attempt)}`;
|
|
138535
138606
|
}
|
|
138536
138607
|
plan = mission.plan;
|
|
138537
138608
|
}
|
|
@@ -138992,6 +139063,11 @@ async function planMission(context) {
|
|
|
138992
139063
|
|
|
138993
139064
|
// ../../packages/core/src/chief/coordinator-integration.ts
|
|
138994
139065
|
init_execution();
|
|
139066
|
+
var storageNote = (output) => {
|
|
139067
|
+
const first = output.split(`
|
|
139068
|
+
`, 1)[0] ?? "";
|
|
139069
|
+
return first.startsWith(STORAGE_NOTE_PREFIX) ? ` ${first}` : "";
|
|
139070
|
+
};
|
|
138995
139071
|
async function recordIntegrationCheck(mission, ports, states, save) {
|
|
138996
139072
|
if (!ports.integrationCheck)
|
|
138997
139073
|
return;
|
|
@@ -139018,7 +139094,7 @@ async function recordIntegrationCheck(mission, ports, states, save) {
|
|
|
139018
139094
|
const observed = { at: new Date().toISOString(), ok: result.ok, output: result.output.slice(0, 8000) };
|
|
139019
139095
|
for (const state of targets)
|
|
139020
139096
|
state.integrationCheck = observed;
|
|
139021
|
-
await save("integration-check", `${result.ok ? "Contract command checks pass" : "Contract command checks fail"} on the integrated tree before review of ${targets.map((state) => state.id).join(", ")}.${result.ok ?
|
|
139097
|
+
await save("integration-check", `${result.ok ? "Contract command checks pass" : "Contract command checks fail"} on the integrated tree before review of ${targets.map((state) => state.id).join(", ")}.${result.ok ? storageNote(result.output) : ` ${result.output.slice(0, 1500)}`}`, first.id);
|
|
139022
139098
|
}
|
|
139023
139099
|
|
|
139024
139100
|
// ../../packages/core/src/chief/coordinator-parallel.ts
|
|
@@ -142468,12 +142544,12 @@ async function readStatus(port) {
|
|
|
142468
142544
|
}
|
|
142469
142545
|
|
|
142470
142546
|
// src/storage-gc-command.ts
|
|
142471
|
-
import { execFile as
|
|
142547
|
+
import { execFile as execFile9 } from "node:child_process";
|
|
142472
142548
|
import { promisify as promisify6 } from "node:util";
|
|
142473
142549
|
init_disk_budget();
|
|
142474
|
-
var exec5 = promisify6(
|
|
142475
|
-
var
|
|
142476
|
-
var gib = (bytes) => `${(bytes /
|
|
142550
|
+
var exec5 = promisify6(execFile9);
|
|
142551
|
+
var GIB3 = 1024 ** 3;
|
|
142552
|
+
var gib = (bytes) => `${(bytes / GIB3).toFixed(1)} GiB`;
|
|
142477
142553
|
async function diskUsage(path) {
|
|
142478
142554
|
try {
|
|
142479
142555
|
const { stdout } = await exec5("du", ["-sk", path]);
|