agent-valley 4.1.0 → 4.2.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 +41 -10
- 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.2.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
|
@@ -69239,7 +69239,8 @@ var codeDeliveryPolicySchema = strictObject({
|
|
|
69239
69239
|
remote: string2().min(1).max(100).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
|
|
69240
69240
|
paths: array(string2().refine(codeDeliveryPath, "Select exact product paths; private/runtime paths cannot be delivered.")).min(1).max(100).refine((paths) => new Set(paths).size === paths.length, "Select each delivery path once."),
|
|
69241
69241
|
message: string2().trim().min(1).max(8000),
|
|
69242
|
-
baseSha: sha
|
|
69242
|
+
baseSha: sha,
|
|
69243
|
+
skipPrePush: boolean2().optional()
|
|
69243
69244
|
});
|
|
69244
69245
|
var codeDeliverySchema = strictObject({
|
|
69245
69246
|
policy: codeDeliveryPolicySchema,
|
|
@@ -73913,13 +73914,15 @@ import { createHash as createHash21 } from "node:crypto";
|
|
|
73913
73914
|
class ContractViolation extends Error {
|
|
73914
73915
|
}
|
|
73915
73916
|
function createMissionContract(mission) {
|
|
73917
|
+
const originalDelivery = mission.codeDelivery ? structuredClone(mission.codeDelivery) : undefined;
|
|
73916
73918
|
const immutable = {
|
|
73917
73919
|
goal: mission.goal,
|
|
73918
73920
|
verifyCommand: mission.verifyCommand,
|
|
73919
73921
|
operatingPolicy: JSON.stringify(mission.operatingPolicy),
|
|
73920
73922
|
executionPolicy: JSON.stringify(mission.executionPolicy),
|
|
73921
73923
|
metricSourcePolicy: JSON.stringify(mission.metricSourcePolicy),
|
|
73922
|
-
containerObservationPolicy: JSON.stringify(mission.containerObservationPolicy)
|
|
73924
|
+
containerObservationPolicy: JSON.stringify(mission.containerObservationPolicy),
|
|
73925
|
+
codeDeliveryPolicy: JSON.stringify(mission.codeDelivery?.policy)
|
|
73923
73926
|
};
|
|
73924
73927
|
let brief = mission.goalBrief ? JSON.stringify(mission.goalBrief) : undefined;
|
|
73925
73928
|
let checks = mission.verificationContract ? JSON.stringify(mission.verificationContract) : undefined;
|
|
@@ -73931,7 +73934,7 @@ function createMissionContract(mission) {
|
|
|
73931
73934
|
digest = mission.verificationContractSha256;
|
|
73932
73935
|
},
|
|
73933
73936
|
assert() {
|
|
73934
|
-
if (mission.goal === immutable.goal && mission.verifyCommand === immutable.verifyCommand && JSON.stringify(mission.operatingPolicy) === immutable.operatingPolicy && JSON.stringify(mission.executionPolicy) === immutable.executionPolicy && JSON.stringify(mission.metricSourcePolicy) === immutable.metricSourcePolicy && JSON.stringify(mission.containerObservationPolicy) === immutable.containerObservationPolicy && (!brief || JSON.stringify(mission.goalBrief) === brief) && (!checks || JSON.stringify(mission.verificationContract) === checks) && mission.verificationContractSha256 === digest)
|
|
73937
|
+
if (mission.goal === immutable.goal && mission.verifyCommand === immutable.verifyCommand && JSON.stringify(mission.operatingPolicy) === immutable.operatingPolicy && JSON.stringify(mission.executionPolicy) === immutable.executionPolicy && JSON.stringify(mission.metricSourcePolicy) === immutable.metricSourcePolicy && JSON.stringify(mission.containerObservationPolicy) === immutable.containerObservationPolicy && JSON.stringify(mission.codeDelivery?.policy) === immutable.codeDeliveryPolicy && (!brief || JSON.stringify(mission.goalBrief) === brief) && (!checks || JSON.stringify(mission.verificationContract) === checks) && mission.verificationContractSha256 === digest)
|
|
73935
73938
|
return;
|
|
73936
73939
|
mission.goal = immutable.goal;
|
|
73937
73940
|
mission.verifyCommand = immutable.verifyCommand;
|
|
@@ -73939,6 +73942,11 @@ function createMissionContract(mission) {
|
|
|
73939
73942
|
mission.executionPolicy = immutable.executionPolicy ? JSON.parse(immutable.executionPolicy) : undefined;
|
|
73940
73943
|
mission.metricSourcePolicy = immutable.metricSourcePolicy ? JSON.parse(immutable.metricSourcePolicy) : undefined;
|
|
73941
73944
|
mission.containerObservationPolicy = immutable.containerObservationPolicy ? JSON.parse(immutable.containerObservationPolicy) : undefined;
|
|
73945
|
+
if (originalDelivery && immutable.codeDeliveryPolicy) {
|
|
73946
|
+
mission.codeDelivery ??= structuredClone(originalDelivery);
|
|
73947
|
+
mission.codeDelivery.policy = JSON.parse(immutable.codeDeliveryPolicy);
|
|
73948
|
+
} else
|
|
73949
|
+
delete mission.codeDelivery;
|
|
73942
73950
|
if (brief)
|
|
73943
73951
|
mission.goalBrief = JSON.parse(brief);
|
|
73944
73952
|
if (checks)
|
|
@@ -76433,7 +76441,8 @@ var orderKeys = [
|
|
|
76433
76441
|
"deliver",
|
|
76434
76442
|
"deliveryPaths",
|
|
76435
76443
|
"deliveryMessage",
|
|
76436
|
-
"deliveryRemote"
|
|
76444
|
+
"deliveryRemote",
|
|
76445
|
+
"deliverySkipPrePush"
|
|
76437
76446
|
];
|
|
76438
76447
|
var decisionBudgetKeys = ["runs", "duration", "cost", "accountRun", "accountCost"];
|
|
76439
76448
|
function integerOption(value, name, maximum) {
|
|
@@ -76470,6 +76479,8 @@ async function restoreOperationOrigin(repository, workspace) {
|
|
|
76470
76479
|
}
|
|
76471
76480
|
}
|
|
76472
76481
|
async function newOperation(charter, options, root, id) {
|
|
76482
|
+
if (options.deliverySkipPrePush !== undefined && !options.deliver)
|
|
76483
|
+
throw new Error("Set --deliver <branch> with --delivery-skip-pre-push before starting an order.");
|
|
76473
76484
|
if (options.accountRun !== undefined || options.accountCost !== undefined)
|
|
76474
76485
|
throw new Error("Use --resume <operation-id> to reconcile an active decision run's observed cost.");
|
|
76475
76486
|
if (!charter?.trim() || charter.length > 32000)
|
|
@@ -129744,7 +129755,7 @@ async function artifact(path, content) {
|
|
|
129744
129755
|
}
|
|
129745
129756
|
async function prepareCodeDelivery(repository, options) {
|
|
129746
129757
|
if (!options.deliver) {
|
|
129747
|
-
if (options.deliveryPaths || options.deliveryMessage || options.deliveryRemote)
|
|
129758
|
+
if (options.deliveryPaths || options.deliveryMessage || options.deliveryRemote || options.deliverySkipPrePush !== undefined)
|
|
129748
129759
|
throw new Error("Set --deliver <branch> with explicit --delivery-paths before requesting code delivery.");
|
|
129749
129760
|
return;
|
|
129750
129761
|
}
|
|
@@ -129761,7 +129772,8 @@ async function prepareCodeDelivery(repository, options) {
|
|
|
129761
129772
|
remote,
|
|
129762
129773
|
paths: options.deliveryPaths,
|
|
129763
129774
|
message: options.deliveryMessage ?? "fix: apply verified Agent Valley mission",
|
|
129764
|
-
baseSha: (await gitRead(root, ["rev-parse", "HEAD"])).trim()
|
|
129775
|
+
baseSha: (await gitRead(root, ["rev-parse", "HEAD"])).trim(),
|
|
129776
|
+
...options.deliverySkipPrePush !== undefined ? { skipPrePush: options.deliverySkipPrePush } : {}
|
|
129765
129777
|
});
|
|
129766
129778
|
await gitRead(root, ["remote", "get-url", policy.remote]);
|
|
129767
129779
|
return { policy, phase: "pending", attempts: 0, updatedAt: new Date().toISOString() };
|
|
@@ -129964,8 +129976,21 @@ AV-Delivery: ${delivery.nonce}
|
|
|
129964
129976
|
await save();
|
|
129965
129977
|
}
|
|
129966
129978
|
if (await remoteState(mission, store, root, delivery, signal) !== "delivered") {
|
|
129979
|
+
if (delivery.policy.skipPrePush) {
|
|
129980
|
+
mission.history.push({
|
|
129981
|
+
at: new Date().toISOString(),
|
|
129982
|
+
stage: "code-delivery-pre-push",
|
|
129983
|
+
message: "The operator authorized --delivery-skip-pre-push. This push attempt omits the pre-push hook; no pre-push check result is claimed. Commit hooks remain enabled."
|
|
129984
|
+
});
|
|
129985
|
+
await save();
|
|
129986
|
+
}
|
|
129967
129987
|
try {
|
|
129968
|
-
await managedGit(mission, store, root, [
|
|
129988
|
+
await managedGit(mission, store, root, [
|
|
129989
|
+
"push",
|
|
129990
|
+
...delivery.policy.skipPrePush ? ["--no-verify"] : [],
|
|
129991
|
+
delivery.policy.remote,
|
|
129992
|
+
`${delivery.commitSha}:refs/heads/${delivery.policy.branch}`
|
|
129993
|
+
], signal);
|
|
129969
129994
|
} catch (error) {
|
|
129970
129995
|
if (signal?.aborted || error instanceof MissionPause)
|
|
129971
129996
|
throw error;
|
|
@@ -130260,8 +130285,14 @@ async function organizationContext2(repository, mission) {
|
|
|
130260
130285
|
}
|
|
130261
130286
|
async function runOrder(goal, options, root = process.cwd()) {
|
|
130262
130287
|
assertNotManagedRun();
|
|
130263
|
-
if (options.resume && [
|
|
130264
|
-
|
|
130288
|
+
if (options.resume && [
|
|
130289
|
+
options.deliver,
|
|
130290
|
+
options.deliveryPaths,
|
|
130291
|
+
options.deliveryMessage,
|
|
130292
|
+
options.deliveryRemote,
|
|
130293
|
+
options.deliverySkipPrePush
|
|
130294
|
+
].some((value) => value !== undefined))
|
|
130295
|
+
throw new Error("Code delivery retains its saved branch, paths, commit message and hook policy. Resume without replacement delivery options.");
|
|
130265
130296
|
if (!options.resume && [options.retry, options.resolveEffect, options.effectResult, options.accountRun, options.accountCost].some((value) => value !== undefined && value !== false))
|
|
130266
130297
|
throw new Error("Use --resume <id> for retry, external-effect resolution or cost reconciliation.");
|
|
130267
130298
|
const store = new MissionStore(join51(root, ".agent-valley/missions"));
|
|
@@ -130502,7 +130533,7 @@ async function dispatchOrder(goal, options, root = process.cwd(), dependencies =
|
|
|
130502
130533
|
}
|
|
130503
130534
|
function registerChiefCommands(program) {
|
|
130504
130535
|
registerContinuousCommands(program);
|
|
130505
|
-
program.command("order [goal]").description("Give the Chief Director a goal; continuously select, execute, review and verify improvements").option("--once", "Stop after one verified goal instead of continuing improvements").option("--cycles <count>", "Cumulative verified improvement limit; default continues until stopped").option("--interval <seconds>", "Wait before selecting again when no new goal is justified (default 300)").option("--workspace <path>", "Target Git repository (defaults to av.yaml)").option("--verify <command>", "Trusted completion check (defaults to av.yaml)").option("--deliver <branch>", "Commit and push only verified, reviewed work to the selected source branch").option("--delivery-paths <json>", "JSON array of exact product files allowed for code delivery").option("--delivery-message <text>", "Commit message for the approved delivery, including required repository trailers").option("--delivery-remote <name>", "Configured Git remote for code delivery (default origin)").option("--actor <type>", "Chief Director CLI (default: saved actor.type, otherwise an authenticated CLI)").option("--model <id>", "Chief Director model (default: actor.model from config, otherwise the CLI default)").option("--director <id>", "Chief Director Actor ID").option("--actors <file>", "Use a configured YAML Actor roster instead of generating goal-specific Actors").addOption(new Option("--agent <type>", "Legacy alias for --actor").hideHelp()).addOption(new Option("--chief <id>", "Legacy alias for --director").hideHelp()).addOption(new Option("--personas <file>", "Legacy alias for --actors").hideHelp()).option("--oma", "Require OMA completion receipts for workers (installed skill selection is automatic)").option("--timeout <seconds>", "Timeout per actor/check (default 600 or actor.timeout)").option("--repairs <count>", "Repair limit per task/final review (default 2)").option("--rounds <count>", "Chief Director recovery decision limit, preserved on resume (default 8, maximum 50)").option("--parallel <count>", "Independent Actor concurrency (default 3, maximum 8)").option("--runs <count>", "Actor call limit per goal/decision; may be increased on saved checkpoint resume (default 200)").option("--duration <seconds>", "Wall-time limit per goal/decision; may be increased on resume (default 86400)").option("--cost <usd>", "Configured-price estimated cost limit; unknown cost pauses further calls").option("--account-run <run-id>", "Reconcile a finished run whose usage/cost was lost").option("--account-cost <usd>", "Operator-observed USD cost for --account-run; stored separately from native usage").option("--retry", "Resume after repairing a blocker; retain prior evidence and spent budget").option("--resolve-effect <task-id>", "Reconcile an interrupted external action before resuming").option("--effect-result <result>", "External destination inspection result: completed or not-applied").option("--no-supervise", "With --once, run directly without worker crash restart or observation polling").addOption(new Option("--worker", "Internal supervised worker").hideHelp()).addOption(new Option("--mission-id <id>", "Internal mission identity").hideHelp()).addOption(new Option("--baseline-workspace <path>", "Internal accepted operation snapshot").hideHelp()).addOption(new Option("--operation-id <id>", "Internal operation identity").hideHelp()).addOption(new Option("--native-model", "Internal pinned Chief native model default").hideHelp()).option("--resume <id>", "Resume the saved continuing order or single mission with its original contract").action(async (goal, options) => {
|
|
130536
|
+
program.command("order [goal]").description("Give the Chief Director a goal; continuously select, execute, review and verify improvements").option("--once", "Stop after one verified goal instead of continuing improvements").option("--cycles <count>", "Cumulative verified improvement limit; default continues until stopped").option("--interval <seconds>", "Wait before selecting again when no new goal is justified (default 300)").option("--workspace <path>", "Target Git repository (defaults to av.yaml)").option("--verify <command>", "Trusted completion check (defaults to av.yaml)").option("--deliver <branch>", "Commit and push only verified, reviewed work to the selected source branch").option("--delivery-paths <json>", "JSON array of exact product files allowed for code delivery").option("--delivery-message <text>", "Commit message for the approved delivery, including required repository trailers").option("--delivery-remote <name>", "Configured Git remote for code delivery (default origin)").option("--delivery-skip-pre-push", "Authorize git push --no-verify for this delivery; commit hooks remain enabled").option("--actor <type>", "Chief Director CLI (default: saved actor.type, otherwise an authenticated CLI)").option("--model <id>", "Chief Director model (default: actor.model from config, otherwise the CLI default)").option("--director <id>", "Chief Director Actor ID").option("--actors <file>", "Use a configured YAML Actor roster instead of generating goal-specific Actors").addOption(new Option("--agent <type>", "Legacy alias for --actor").hideHelp()).addOption(new Option("--chief <id>", "Legacy alias for --director").hideHelp()).addOption(new Option("--personas <file>", "Legacy alias for --actors").hideHelp()).option("--oma", "Require OMA completion receipts for workers (installed skill selection is automatic)").option("--timeout <seconds>", "Timeout per actor/check (default 600 or actor.timeout)").option("--repairs <count>", "Repair limit per task/final review (default 2)").option("--rounds <count>", "Chief Director recovery decision limit, preserved on resume (default 8, maximum 50)").option("--parallel <count>", "Independent Actor concurrency (default 3, maximum 8)").option("--runs <count>", "Actor call limit per goal/decision; may be increased on saved checkpoint resume (default 200)").option("--duration <seconds>", "Wall-time limit per goal/decision; may be increased on resume (default 86400)").option("--cost <usd>", "Configured-price estimated cost limit; unknown cost pauses further calls").option("--account-run <run-id>", "Reconcile a finished run whose usage/cost was lost").option("--account-cost <usd>", "Operator-observed USD cost for --account-run; stored separately from native usage").option("--retry", "Resume after repairing a blocker; retain prior evidence and spent budget").option("--resolve-effect <task-id>", "Reconcile an interrupted external action before resuming").option("--effect-result <result>", "External destination inspection result: completed or not-applied").option("--no-supervise", "With --once, run directly without worker crash restart or observation polling").addOption(new Option("--worker", "Internal supervised worker").hideHelp()).addOption(new Option("--mission-id <id>", "Internal mission identity").hideHelp()).addOption(new Option("--baseline-workspace <path>", "Internal accepted operation snapshot").hideHelp()).addOption(new Option("--operation-id <id>", "Internal operation identity").hideHelp()).addOption(new Option("--native-model", "Internal pinned Chief native model default").hideHelp()).option("--resume <id>", "Resume the saved continuing order or single mission with its original contract").action(async (goal, options) => {
|
|
130506
130537
|
const result = await dispatchOrder(goal, options);
|
|
130507
130538
|
if ("phase" in result) {
|
|
130508
130539
|
console.log(`Order ${result.id}: ${result.phase}; ${result.completedCycles} verified improvements.`);
|