agent-valley 4.8.1 → 4.8.2
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 +108 -48
- 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.8.
|
|
4
|
+
"version": "4.8.2",
|
|
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
|
@@ -54470,6 +54470,61 @@ function validateFinalReview(review, mission) {
|
|
|
54470
54470
|
return review;
|
|
54471
54471
|
}
|
|
54472
54472
|
|
|
54473
|
+
// ../../packages/core/src/chief/bounded-work-routing.ts
|
|
54474
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
54475
|
+
function repairDecision(mission, taskId, taskRuns) {
|
|
54476
|
+
return mission.supervision?.decisions.findLast((entry) => ["repair", "reassign", "replan"].includes(entry.action) && (!entry.taskId || entry.taskId === taskId) && entry.round > 0 && entry.round <= (mission.supervision?.maxRounds ?? 0) && entry.round <= (mission.supervision?.rounds ?? 0) && Number.isFinite(Date.parse(entry.at)) && taskRuns.some((run) => Number.isFinite(Date.parse(run.finishedAt ?? "")) && Date.parse(run.finishedAt ?? "") < Date.parse(entry.at)));
|
|
54477
|
+
}
|
|
54478
|
+
function unreviewed(run, decision) {
|
|
54479
|
+
const finished = Date.parse(run.finishedAt ?? "");
|
|
54480
|
+
return run.outcome === "pending" && (!decision || !Number.isFinite(finished) || finished >= Date.parse(decision.at));
|
|
54481
|
+
}
|
|
54482
|
+
function hasUnreviewedRoutingProbe(mission, taskId, taskRuns) {
|
|
54483
|
+
const decision = repairDecision(mission, taskId, taskRuns);
|
|
54484
|
+
return taskRuns.some((run) => run.routingReason?.startsWith("Bounded routing probe ") && unreviewed(run, decision));
|
|
54485
|
+
}
|
|
54486
|
+
function boundedWorkRoute(mission, taskId, candidates, evidence, taskRuns, failed, routeKey) {
|
|
54487
|
+
if (!taskId)
|
|
54488
|
+
return;
|
|
54489
|
+
const task = mission.plan?.tasks.find((entry) => entry.id === taskId);
|
|
54490
|
+
const state = mission.tasks.find((entry) => entry.id === taskId);
|
|
54491
|
+
if (!task || !state || state.status === "completed" || (state.repairRound ?? 0) > mission.maxRepairs)
|
|
54492
|
+
return;
|
|
54493
|
+
if (mission.tasks.some((entry) => entry.effectState === "unknown" || entry.effectState === "running") || state.effectState === "completed" || mission.operations?.runs.some((run) => run.executionState === "unknown" || run.taskId === taskId && (run.executionState === "running" || !Number.isFinite(Date.parse(run.startedAt)) || !Number.isFinite(Date.parse(run.finishedAt ?? "")))))
|
|
54494
|
+
return;
|
|
54495
|
+
const decision = repairDecision(mission, taskId, taskRuns);
|
|
54496
|
+
if (taskRuns.some((run) => unreviewed(run, decision)))
|
|
54497
|
+
return;
|
|
54498
|
+
const scope = createHash13("sha256").update(JSON.stringify({
|
|
54499
|
+
taskId,
|
|
54500
|
+
repairRound: state.repairRound ?? 0,
|
|
54501
|
+
...decision ? { chief: [decision.round, decision.at, decision.action, decision.taskId ?? null] } : {}
|
|
54502
|
+
})).digest("hex");
|
|
54503
|
+
const prefix = `Bounded routing probe ${scope}: `;
|
|
54504
|
+
const used = new Set(taskRuns.filter((run) => run.routingReason?.startsWith(prefix)).map(routeKey));
|
|
54505
|
+
const available = candidates.filter((candidate) => {
|
|
54506
|
+
if (used.has(routeKey(candidate)))
|
|
54507
|
+
return false;
|
|
54508
|
+
if (!failed.has(routeKey(candidate)))
|
|
54509
|
+
return true;
|
|
54510
|
+
const failure = taskRuns.findLast((run) => routeKey(run) === routeKey(candidate) && (run.outcome === "failed" || run.outcome === "rejected"));
|
|
54511
|
+
return decision !== undefined && failure !== undefined && Number.isFinite(Date.parse(failure.finishedAt ?? "")) && Date.parse(failure.finishedAt ?? "") < Date.parse(decision.at);
|
|
54512
|
+
});
|
|
54513
|
+
const observed = (candidate) => evidence.find((entry) => routeKey(entry) === routeKey(candidate));
|
|
54514
|
+
const successRate = (candidate) => {
|
|
54515
|
+
const record = observed(candidate);
|
|
54516
|
+
return record?.samples ? record.successes / record.samples : -1;
|
|
54517
|
+
};
|
|
54518
|
+
const cost = (candidate) => observed(candidate)?.successfulDeliverableCostUsd ?? Number.POSITIVE_INFINITY;
|
|
54519
|
+
const candidate = available.sort((a, b) => successRate(b) - successRate(a) || cost(a) - cost(b)).at(0);
|
|
54520
|
+
if (!candidate)
|
|
54521
|
+
return;
|
|
54522
|
+
return {
|
|
54523
|
+
candidate,
|
|
54524
|
+
reason: `${prefix}No fresh route met the measured quality preference. Selected ${candidate.actorType}/${candidate.model ?? "native default"} from the saved ready, compatible pool for one probe at this checkpoint; ` + "below-threshold evidence, task failures and spent execution limits remain unchanged."
|
|
54525
|
+
};
|
|
54526
|
+
}
|
|
54527
|
+
|
|
54473
54528
|
// ../../packages/core/src/chief/handoff-contract.ts
|
|
54474
54529
|
init_zod();
|
|
54475
54530
|
var handoffRouteSchema = strictObject({
|
|
@@ -54558,15 +54613,13 @@ function selectWorkActor(mission, actor, taskId, compatibleRoutes) {
|
|
|
54558
54613
|
const observed = evidence.find((item) => routeKey(item) === routeKey(candidate));
|
|
54559
54614
|
return !observed || observed.samples < routing.minSamples || observed.successes / observed.samples >= routing.minSuccessRate;
|
|
54560
54615
|
});
|
|
54561
|
-
if (!eligible.length)
|
|
54562
|
-
throw new Error("No routing candidate meets the measured minimum success rate. Inspect real failures or configure a new candidate before starting another mission.");
|
|
54563
54616
|
const qualified = eligible.map((candidate) => ({ candidate, evidence: evidence.find((item) => routeKey(item) === routeKey(candidate)) })).filter((item) => item.evidence !== undefined && item.evidence.samples >= routing.minSamples && item.evidence.successes / item.evidence.samples >= routing.minSuccessRate && item.evidence.successfulDeliverableCostUsd !== null).sort((a, b) => a.evidence.successfulDeliverableCostUsd - b.evidence.successfulDeliverableCostUsd);
|
|
54564
54617
|
const measured = qualified.at(0);
|
|
54565
54618
|
const initial = measured?.candidate ?? [...eligible].sort((a, b) => price2(a) - price2(b)).at(0);
|
|
54566
|
-
if (!initial)
|
|
54567
|
-
throw new Error("Restore a ready work routing candidate before continuing this mission.");
|
|
54568
54619
|
const cancelled = cancelledWorkRunProofs(mission);
|
|
54569
54620
|
const taskRuns = (mission.operations?.runs ?? []).filter((run) => run.stage === "work" && run.taskId === taskId && !cancelled.has(run.runId));
|
|
54621
|
+
if (hasUnreviewedRoutingProbe(mission, taskId, taskRuns))
|
|
54622
|
+
throw new Error("This task has an unreviewed bounded routing probe. Resume its retained review or obtain a later Chief repair decision before dispatching more work.");
|
|
54570
54623
|
const failed = new Set;
|
|
54571
54624
|
for (let i = taskRuns.length - 1;i >= 0; i--) {
|
|
54572
54625
|
const run = taskRuns[i];
|
|
@@ -54578,12 +54631,19 @@ function selectWorkActor(mission, actor, taskId, compatibleRoutes) {
|
|
|
54578
54631
|
failed.add(routeKey(run));
|
|
54579
54632
|
}
|
|
54580
54633
|
const ordered = [
|
|
54581
|
-
initial,
|
|
54582
|
-
...eligible.filter((item) => routeKey(item) !== routeKey(initial)).sort((a, b) => price2(a) - price2(b))
|
|
54634
|
+
...initial ? [initial] : [],
|
|
54635
|
+
...eligible.filter((item) => !initial || routeKey(item) !== routeKey(initial)).sort((a, b) => price2(a) - price2(b))
|
|
54583
54636
|
];
|
|
54584
54637
|
const selected = ordered.find((item) => !failed.has(routeKey(item)));
|
|
54585
|
-
if (!selected)
|
|
54586
|
-
|
|
54638
|
+
if (!selected) {
|
|
54639
|
+
const probe = boundedWorkRoute(mission, taskId, compatible, evidence, taskRuns, failed, routeKey);
|
|
54640
|
+
if (probe)
|
|
54641
|
+
return {
|
|
54642
|
+
actor: { ...actor, agentType: probe.candidate.actorType, model: probe.candidate.model },
|
|
54643
|
+
reason: probe.reason
|
|
54644
|
+
};
|
|
54645
|
+
throw new Error(eligible.length ? "Every configured routing candidate failed this task. Its bounded probes are spent; obtain a Chief repair decision or reconcile the recorded failures before continuing." : "No routing candidate meets the measured minimum success rate and this task has no remaining bounded probe. Inspect its saved failures and Chief repair checkpoint before continuing.");
|
|
54646
|
+
}
|
|
54587
54647
|
const reason = failed.size ? `Escalated after ${failed.size} actually rejected/failed route(s) for this task.` : measured ? `Selected observed successful-deliverable cost after ${measured.evidence.samples} real samples.` : Number.isFinite(price2(selected)) ? "No qualifying measured route; selected the lowest configured input/output price sum (not a measured run cost)." : "No qualifying measured cost or complete prices; selected configured candidate order with unknown cost.";
|
|
54588
54648
|
return { actor: { ...actor, agentType: selected.actorType, model: selected.model }, reason };
|
|
54589
54649
|
}
|
|
@@ -55242,7 +55302,7 @@ import { isAbsolute as isAbsolute10 } from "node:path";
|
|
|
55242
55302
|
|
|
55243
55303
|
// ../../packages/core/src/chief/capture.ts
|
|
55244
55304
|
import { spawn as spawn7 } from "node:child_process";
|
|
55245
|
-
import { createHash as
|
|
55305
|
+
import { createHash as createHash14, randomUUID as randomUUID11 } from "node:crypto";
|
|
55246
55306
|
import { chmod as chmod4, mkdir as mkdir9, readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
|
|
55247
55307
|
import { join as join19 } from "node:path";
|
|
55248
55308
|
|
|
@@ -69762,7 +69822,7 @@ class MissionCapture {
|
|
|
69762
69822
|
name,
|
|
69763
69823
|
mimeType,
|
|
69764
69824
|
sizeBytes: contents.length,
|
|
69765
|
-
sha256:
|
|
69825
|
+
sha256: createHash14("sha256").update(contents).digest("hex")
|
|
69766
69826
|
};
|
|
69767
69827
|
}
|
|
69768
69828
|
async frame() {
|
|
@@ -69926,7 +69986,7 @@ ${JSON.stringify(rejected)}`
|
|
|
69926
69986
|
}
|
|
69927
69987
|
|
|
69928
69988
|
// ../../packages/core/src/chief/technical-lead.ts
|
|
69929
|
-
import { createHash as
|
|
69989
|
+
import { createHash as createHash15 } from "node:crypto";
|
|
69930
69990
|
var TECHNICAL_DIRECTOR_ROLE = "Serve as the Chief Director's permanent Technical Director counterpart. Rigorously minimize total cost and wasted work while maximizing execution efficiency. Protect the user goal and quality requirements; standardize on the existing stack, reuse maintained modules and native integrations, keep dependencies justified and consistent, and favor the smallest maintainable solution.";
|
|
69931
69991
|
var CTO_ROLE = TECHNICAL_DIRECTOR_ROLE;
|
|
69932
69992
|
function missionAdviceKey(mission) {
|
|
@@ -69961,7 +70021,7 @@ function missionAdviceKey(mission) {
|
|
|
69961
70021
|
dependencies: [...dependencies].sort()
|
|
69962
70022
|
}))
|
|
69963
70023
|
};
|
|
69964
|
-
return
|
|
70024
|
+
return createHash15("sha256").update(JSON.stringify(input)).digest("hex");
|
|
69965
70025
|
}
|
|
69966
70026
|
var technicalPlanKey = missionAdviceKey;
|
|
69967
70027
|
function technicalReviewPrompt(mission) {
|
|
@@ -70101,7 +70161,7 @@ init_metric_source_policy();
|
|
|
70101
70161
|
|
|
70102
70162
|
// ../../packages/core/src/chief/oma-actor.ts
|
|
70103
70163
|
init_dist();
|
|
70104
|
-
import { createHash as
|
|
70164
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
70105
70165
|
import { constants as constants8 } from "node:fs";
|
|
70106
70166
|
import { open as open10, readdir as readdir6, realpath as realpath14, stat as stat3 } from "node:fs/promises";
|
|
70107
70167
|
import { isAbsolute as isAbsolute9, join as join21, relative as relative10, sep as sep10 } from "node:path";
|
|
@@ -70514,7 +70574,7 @@ ${chosen.source}`, bodies].join(`
|
|
|
70514
70574
|
`);
|
|
70515
70575
|
if (Buffer.byteLength(guidance) > MAX_GUIDANCE_BYTES)
|
|
70516
70576
|
throw new Error("The OMA agent and bound skill instructions exceed 256 KB. Reduce assigned instructions before resuming.");
|
|
70517
|
-
return { agentId: chosen.agentId, guidance, skills, digest:
|
|
70577
|
+
return { agentId: chosen.agentId, guidance, skills, digest: createHash16("sha256").update(guidance).digest("hex") };
|
|
70518
70578
|
}
|
|
70519
70579
|
|
|
70520
70580
|
// ../../packages/core/src/chief/schemas.ts
|
|
@@ -71407,7 +71467,7 @@ import { realpath as realpath17 } from "node:fs/promises";
|
|
|
71407
71467
|
import { join as join28 } from "node:path";
|
|
71408
71468
|
|
|
71409
71469
|
// src/chief-code-delivery.ts
|
|
71410
|
-
import { createHash as
|
|
71470
|
+
import { createHash as createHash18, randomUUID as randomUUID12 } from "node:crypto";
|
|
71411
71471
|
import { lstat as lstat12, mkdir as mkdir12, readFile as readFile9, realpath as realpath16, writeFile as writeFile7 } from "node:fs/promises";
|
|
71412
71472
|
import { join as join27, resolve as resolve20 } from "node:path";
|
|
71413
71473
|
init_execution();
|
|
@@ -71502,7 +71562,7 @@ function recordServiceShutdown(mission, unconfirmedTermination) {
|
|
|
71502
71562
|
|
|
71503
71563
|
// src/chief-code-delivery-git.ts
|
|
71504
71564
|
import { execFile as execFile2 } from "node:child_process";
|
|
71505
|
-
import { createHash as
|
|
71565
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
71506
71566
|
import { lstat as lstat11, mkdtemp, realpath as realpath15, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
|
|
71507
71567
|
import { isAbsolute as isAbsolute12, join as join26, relative as relative11, resolve as resolve19, sep as sep11 } from "node:path";
|
|
71508
71568
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -71618,7 +71678,7 @@ async function prepareDeliveryPatch(workspace, baseSha, allowedPaths, directory)
|
|
|
71618
71678
|
], env);
|
|
71619
71679
|
const treeSha = (await gitRead(workspace, ["write-tree"], env)).trim();
|
|
71620
71680
|
await writeFile6(patchPath, patch, { encoding: "utf8", mode: 384, flag: "wx" });
|
|
71621
|
-
return { treeSha, patchSha256:
|
|
71681
|
+
return { treeSha, patchSha256: createHash17("sha256").update(patch).digest("hex"), changedPaths, patchPath };
|
|
71622
71682
|
} finally {
|
|
71623
71683
|
await rm3(indexPath, { force: true });
|
|
71624
71684
|
await rm3(`${indexPath}.lock`, { force: true });
|
|
@@ -71818,7 +71878,7 @@ async function deliverMissionCode(mission, store, signal) {
|
|
|
71818
71878
|
}
|
|
71819
71879
|
if (!delivery.nonce || delivery.verifiedFingerprint !== mission.fingerprint)
|
|
71820
71880
|
throw new DeliveryBlocked("Restore the prepared delivery nonce and verified fingerprint before resuming.");
|
|
71821
|
-
if (
|
|
71881
|
+
if (createHash18("sha256").update(await readFile9(patchPath)).digest("hex") !== delivery.patchSha256)
|
|
71822
71882
|
throw new DeliveryBlocked("Prepared patch bytes changed. Preserve the delivery record and restore its original patch.");
|
|
71823
71883
|
const message = `${delivery.policy.message}
|
|
71824
71884
|
|
|
@@ -72123,7 +72183,7 @@ function applyResumeOptions(mission, goal, options) {
|
|
|
72123
72183
|
}
|
|
72124
72184
|
|
|
72125
72185
|
// src/mission-jobs.ts
|
|
72126
|
-
import { createHash as
|
|
72186
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
72127
72187
|
import { lstat as lstat13, mkdir as mkdir13, readdir as readdir8, readFile as readFile10 } from "node:fs/promises";
|
|
72128
72188
|
import { join as join29 } from "node:path";
|
|
72129
72189
|
init_atomic_json();
|
|
@@ -72144,7 +72204,7 @@ var jobSchema = object({
|
|
|
72144
72204
|
cancelRequestedAt: string2().optional()
|
|
72145
72205
|
});
|
|
72146
72206
|
function digest6(value) {
|
|
72147
|
-
return
|
|
72207
|
+
return createHash19("sha256").update(value).digest("hex");
|
|
72148
72208
|
}
|
|
72149
72209
|
function jobLiveness(job) {
|
|
72150
72210
|
if (job.phase !== "started" || !job.pid)
|
|
@@ -72549,7 +72609,7 @@ var executeContainerCommand = (command) => new Promise((resolve, reject) => {
|
|
|
72549
72609
|
});
|
|
72550
72610
|
|
|
72551
72611
|
// ../../packages/core/src/chief/container-observation-text.ts
|
|
72552
|
-
import { createHash as
|
|
72612
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
72553
72613
|
var secretName = /(?:password|passwd|secret|token|(?:api|access|private)[_-]?key|credential|authorization|cookie)/i;
|
|
72554
72614
|
function sanitizeContainerText(value, env) {
|
|
72555
72615
|
const secrets = Object.entries(env).filter(([name, secret]) => secretName.test(name) && Boolean(secret)).flatMap(([, secret]) => [
|
|
@@ -72564,7 +72624,7 @@ function sanitizeContainerText(value, env) {
|
|
|
72564
72624
|
return escaped.length ? reduced.replace(new RegExp(escaped.join("|"), "g"), "[redacted]") : reduced;
|
|
72565
72625
|
}
|
|
72566
72626
|
function containerDigest(value) {
|
|
72567
|
-
return
|
|
72627
|
+
return createHash20("sha256").update(JSON.stringify(value)).digest("hex");
|
|
72568
72628
|
}
|
|
72569
72629
|
function containerErrorEvidence(text) {
|
|
72570
72630
|
return text.split(/\r?\n/).filter((line) => /\b(?:error|fatal|panic|exception|traceback|segmentation fault|out of memory)\b/i.test(line)).filter((line) => !/\b(?:0|zero|no|without)\s+errors?\b|\berror(?:s)?\s*[=:]\s*0\b/i.test(line)).map((line) => line.replace(/^\d{4}-\d\d-\d\d[T ][\d:.]+(?:Z|[+-]\d\d:\d\d)?\s+/, "").trim()).filter(Boolean).slice(-20);
|
|
@@ -73043,7 +73103,7 @@ async function recordContinuousAcceptance(operation) {
|
|
|
73043
73103
|
}
|
|
73044
73104
|
|
|
73045
73105
|
// ../../packages/core/src/chief/continuous-operation.ts
|
|
73046
|
-
import { createHash as
|
|
73106
|
+
import { createHash as createHash21, randomUUID as randomUUID13 } from "node:crypto";
|
|
73047
73107
|
|
|
73048
73108
|
// ../../packages/core/src/chief/continuous-acceptance.ts
|
|
73049
73109
|
async function acceptContinuousChild(operation, mission, ports, save, now) {
|
|
@@ -73099,7 +73159,7 @@ async function acceptContinuousChild(operation, mission, ports, save, now) {
|
|
|
73099
73159
|
// ../../packages/core/src/chief/continuous-operation.ts
|
|
73100
73160
|
init_execution();
|
|
73101
73161
|
function continuousDecisionKey(decision, observationFingerprint, observationRevision) {
|
|
73102
|
-
return
|
|
73162
|
+
return createHash21("sha256").update(JSON.stringify({ goal: decision.goal, evidence: decision.evidence, observationFingerprint, observationRevision })).digest("hex");
|
|
73103
73163
|
}
|
|
73104
73164
|
async function runContinuousOperation(operation, ports) {
|
|
73105
73165
|
operationSchema.parse(operation);
|
|
@@ -73163,7 +73223,7 @@ async function runContinuousOperation(operation, ports) {
|
|
|
73163
73223
|
const previous = operation.recovery?.target === "child" && operation.recovery.checkpointId === mission.id ? operation.recovery : undefined;
|
|
73164
73224
|
const prior = previous?.attempts ?? 0;
|
|
73165
73225
|
const failedAttempts = previous?.failedAttempts ?? prior;
|
|
73166
|
-
const waitKey = scheduledChiefWait(mission) ?
|
|
73226
|
+
const waitKey = scheduledChiefWait(mission) ? createHash21("sha256").update(JSON.stringify({
|
|
73167
73227
|
decision: mission.supervision?.decisions.at(-1),
|
|
73168
73228
|
nextRunAt: mission.execution?.nextRunAt
|
|
73169
73229
|
})).digest("hex") : undefined;
|
|
@@ -73256,9 +73316,9 @@ async function runContinuousOperation(operation, ports) {
|
|
|
73256
73316
|
};
|
|
73257
73317
|
if (operation.phase === "completed")
|
|
73258
73318
|
return operation;
|
|
73259
|
-
const observingResumedChild = ["paused", "running", "accepting"].includes(operation.phase) && operation.recovery?.target === "child" && operation.recovery.checkpointId === operation.currentMissionId && operation.recovery.disposition === "protected"
|
|
73319
|
+
const observingResumedChild = ["paused", "running", "accepting"].includes(operation.phase) && operation.recovery?.target === "child" && operation.recovery.checkpointId === operation.currentMissionId && operation.recovery.disposition === "protected";
|
|
73260
73320
|
if (observingResumedChild && operation.recovery)
|
|
73261
|
-
operation.recovery.reason = "Operation resumed; observing the original child checkpoint before deciding recovery.
|
|
73321
|
+
operation.recovery.reason = "Operation resumed; observing the original child checkpoint before deciding recovery. Previous protection evidence remains in the child checkpoint; its protections and spent limits remain in force.";
|
|
73262
73322
|
if (operation.phase === "paused") {
|
|
73263
73323
|
operation.phase = operation.resumePhase ?? (operation.currentMissionId ? "running" : operation.nextRunAt ? "waiting" : "deciding");
|
|
73264
73324
|
operation.resumePhase = undefined;
|
|
@@ -73426,12 +73486,12 @@ async function runContinuousOperation(operation, ports) {
|
|
|
73426
73486
|
|
|
73427
73487
|
// ../../packages/core/src/chief/continuous-source-integration.ts
|
|
73428
73488
|
init_zod();
|
|
73429
|
-
import { createHash as
|
|
73489
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
73430
73490
|
import { lstat as lstat18, mkdir as mkdir17, readdir as readdir10, readFile as readFile15, realpath as realpath22, writeFile as writeFile10 } from "node:fs/promises";
|
|
73431
73491
|
import { join as join35, resolve as resolve25 } from "node:path";
|
|
73432
73492
|
|
|
73433
73493
|
// ../../packages/core/src/chief/content-transaction.ts
|
|
73434
|
-
import { createHash as
|
|
73494
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
73435
73495
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
73436
73496
|
|
|
73437
73497
|
// ../../packages/core/src/chief/parallel-git.ts
|
|
@@ -73526,7 +73586,7 @@ async function parallelTreeImages(workspace, tree) {
|
|
|
73526
73586
|
async function integrateContentTransaction(workspace, transaction, hooks) {
|
|
73527
73587
|
await hooks.assertLive?.();
|
|
73528
73588
|
const patch = await readFile12(transaction.patchPath);
|
|
73529
|
-
if (
|
|
73589
|
+
if (createHash22("sha256").update(patch).digest("hex") !== transaction.patchSha256)
|
|
73530
73590
|
throw new Error("Integration patch changed. Restore its saved SHA256 before integration.");
|
|
73531
73591
|
const current = await captureParallelBaseline(workspace);
|
|
73532
73592
|
const images = await parallelTreeImages(workspace, current.tree);
|
|
@@ -74096,7 +74156,7 @@ async function integrateContinuousSource(operation, previous, next, signal) {
|
|
|
74096
74156
|
let patch = await sourcePatch(next.path, previous.baselineTree, next.baselineTree, changes.filter((change) => !projected || change.path !== ".gitignore").map((change) => change.path));
|
|
74097
74157
|
if (projected && changes.some((change) => change.path === ".gitignore"))
|
|
74098
74158
|
patch += projected.patch;
|
|
74099
|
-
const patchSha256 =
|
|
74159
|
+
const patchSha256 = createHash23("sha256").update(patch).digest("hex");
|
|
74100
74160
|
const identity = {
|
|
74101
74161
|
version: 1,
|
|
74102
74162
|
operationId: operation.id,
|
|
@@ -74890,7 +74950,7 @@ function ensureLatestOmaCli(options = {}) {
|
|
|
74890
74950
|
}
|
|
74891
74951
|
|
|
74892
74952
|
// ../../packages/core/src/oma/receipt-storage.ts
|
|
74893
|
-
import { createHash as
|
|
74953
|
+
import { createHash as createHash24 } from "node:crypto";
|
|
74894
74954
|
import { lstatSync as lstatSync2, readdirSync, realpathSync as realpathSync6 } from "node:fs";
|
|
74895
74955
|
import { homedir as homedir7 } from "node:os";
|
|
74896
74956
|
import { basename, dirname as dirname8, isAbsolute as isAbsolute13, join as join37, relative as relative13, resolve as resolve26, sep as sep13 } from "node:path";
|
|
@@ -74906,7 +74966,7 @@ function omaReceiptDirectories(workspace, options = {}) {
|
|
|
74906
74966
|
if (!/^(0|[1-9][0-9]{0,9})$/.test(profile))
|
|
74907
74967
|
throw new Error("OMA_PROFILE must be a non-negative profile number");
|
|
74908
74968
|
const stateHome = env.OMA_STATE_HOME === undefined ? absolutePath(env.OMA_HOME || join37(options.home ?? homedir7(), ".oma"), "OMA_HOME") : absolutePath(env.OMA_STATE_HOME, "OMA_STATE_HOME");
|
|
74909
|
-
const project =
|
|
74969
|
+
const project = createHash24("sha256").update(realpathSync6(resolve26(workspace))).digest("hex");
|
|
74910
74970
|
return [
|
|
74911
74971
|
join37(stateHome, "u", profile, "projects", project, "agent-runs"),
|
|
74912
74972
|
...profile === "0" ? [join37(resolve26(workspace), ".agents", "state", "agent-runs")] : []
|
|
@@ -75407,7 +75467,7 @@ init_worktree_lifecycle();
|
|
|
75407
75467
|
init_execution();
|
|
75408
75468
|
|
|
75409
75469
|
// ../../packages/core/src/chief/parallel-workspace.ts
|
|
75410
|
-
import { createHash as
|
|
75470
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
75411
75471
|
import { lstat as lstat19, mkdir as mkdir19, readFile as readFile16, realpath as realpath24, rm as rm6, writeFile as writeFile12 } from "node:fs/promises";
|
|
75412
75472
|
import { dirname as dirname10, join as join39, sep as sep15 } from "node:path";
|
|
75413
75473
|
init_parallel_contract();
|
|
@@ -75430,7 +75490,7 @@ async function assertMissionWorkspace(mission) {
|
|
|
75430
75490
|
|
|
75431
75491
|
// ../../packages/core/src/chief/parallel-workspace.ts
|
|
75432
75492
|
init_parallel_contract();
|
|
75433
|
-
var hash2 = (value) =>
|
|
75493
|
+
var hash2 = (value) => createHash25("sha256").update(value).digest("hex");
|
|
75434
75494
|
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
75435
75495
|
function identity3(missionId, taskId, attempt) {
|
|
75436
75496
|
if (!taskId || taskId.length > 200 || !Number.isSafeInteger(attempt) || attempt < 1)
|
|
@@ -76013,7 +76073,7 @@ function resetHandoffForRetry(mission, retry) {
|
|
|
76013
76073
|
}
|
|
76014
76074
|
|
|
76015
76075
|
// ../../packages/core/src/chief/structured-stage.ts
|
|
76016
|
-
import { createHash as
|
|
76076
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
76017
76077
|
|
|
76018
76078
|
// ../../packages/core/src/chief/coordinator-state.ts
|
|
76019
76079
|
class ContractViolation extends Error {
|
|
@@ -76211,7 +76271,7 @@ function legacyPlanningTimeout(mission, stage, key) {
|
|
|
76211
76271
|
}
|
|
76212
76272
|
async function runStructuredStage(options) {
|
|
76213
76273
|
const { mission, stage, prompt, run, parse, save } = options;
|
|
76214
|
-
const key =
|
|
76274
|
+
const key = createHash26("sha256").update(`${stage}\x00${options.scopeKey ?? stage}`).digest("hex");
|
|
76215
76275
|
let attempts = 0;
|
|
76216
76276
|
let reason = "No validated response is available for this saved context.";
|
|
76217
76277
|
const legacy = legacyPlanningTimeout(mission, stage, key);
|
|
@@ -76474,7 +76534,7 @@ import { randomUUID as randomUUID17 } from "node:crypto";
|
|
|
76474
76534
|
import { join as join44 } from "node:path";
|
|
76475
76535
|
init_execution();
|
|
76476
76536
|
// src/chief-delivery.ts
|
|
76477
|
-
import { createHash as
|
|
76537
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
76478
76538
|
import { mkdir as mkdir21, writeFile as writeFile13 } from "node:fs/promises";
|
|
76479
76539
|
import { join as join43 } from "node:path";
|
|
76480
76540
|
|
|
@@ -76861,7 +76921,7 @@ init_report_delivery_contract();
|
|
|
76861
76921
|
init_zod();
|
|
76862
76922
|
init_atomic_json();
|
|
76863
76923
|
init_report_delivery_contract();
|
|
76864
|
-
import { createHash as
|
|
76924
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
76865
76925
|
import { constants as constants13 } from "node:fs";
|
|
76866
76926
|
import { mkdir as mkdir20, open as open15, readdir as readdir11, readFile as readFile17, realpath as realpath25 } from "node:fs/promises";
|
|
76867
76927
|
import { isAbsolute as isAbsolute15, join as join41, relative as relative15, resolve as resolve29 } from "node:path";
|
|
@@ -76888,7 +76948,7 @@ var outboxRecordSchema = strictObject({
|
|
|
76888
76948
|
message: string2().max(1000)
|
|
76889
76949
|
}).refine((record) => record.nextPart <= record.parts && (record.status !== "delivered" || record.nextPart === record.parts));
|
|
76890
76950
|
function sha2562(content) {
|
|
76891
|
-
return
|
|
76951
|
+
return createHash27("sha256").update(content).digest("hex");
|
|
76892
76952
|
}
|
|
76893
76953
|
function receipt(record) {
|
|
76894
76954
|
const {
|
|
@@ -76971,7 +77031,7 @@ async function verifiedAttachment(attachment, artifactRoot, readBytes) {
|
|
|
76971
77031
|
if (!stat.isFile() || stat.size !== attachment.sizeBytes)
|
|
76972
77032
|
throw failure;
|
|
76973
77033
|
if (!readBytes) {
|
|
76974
|
-
const digest =
|
|
77034
|
+
const digest = createHash27("sha256");
|
|
76975
77035
|
for await (const chunk of file.createReadStream({ autoClose: false }))
|
|
76976
77036
|
digest.update(chunk);
|
|
76977
77037
|
if (digest.digest("hex") !== attachment.sha256)
|
|
@@ -77218,7 +77278,7 @@ ${explanation.eli5}`);
|
|
|
77218
77278
|
const artifactRoot = join43(repository, ".agent-valley/captures");
|
|
77219
77279
|
if (config.reporting?.destinations.length) {
|
|
77220
77280
|
const bytes = Buffer.from(report);
|
|
77221
|
-
const sha256 =
|
|
77281
|
+
const sha256 = createHash28("sha256").update(bytes).digest("hex");
|
|
77222
77282
|
const reportDirectory = join43(artifactRoot, mission.id);
|
|
77223
77283
|
const attachmentPath = join43(reportDirectory, `report-${sha256}.md`);
|
|
77224
77284
|
await mkdir21(reportDirectory, { recursive: true, mode: 448 });
|
|
@@ -79151,11 +79211,11 @@ import { realpath as realpath30 } from "node:fs/promises";
|
|
|
79151
79211
|
|
|
79152
79212
|
// ../../packages/core/src/chief/continuous-retention.ts
|
|
79153
79213
|
init_zod();
|
|
79154
|
-
import { createHash as
|
|
79214
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
79155
79215
|
import { constants as constants17 } from "node:fs";
|
|
79156
79216
|
import { lstat as lstat23, open as open18, readdir as readdir12, realpath as realpath29, rename as rename4, rm as rm7 } from "node:fs/promises";
|
|
79157
79217
|
import { dirname as dirname11, join as join51, resolve as resolve32 } from "node:path";
|
|
79158
|
-
var digest7 = (content) =>
|
|
79218
|
+
var digest7 = (content) => createHash29("sha256").update(content).digest("hex");
|
|
79159
79219
|
var sha2 = string2().regex(/^[a-f0-9]{40,64}$/);
|
|
79160
79220
|
var preparedSchema = strictObject({
|
|
79161
79221
|
version: literal(1),
|
|
@@ -134183,7 +134243,7 @@ async function readStatus(port) {
|
|
|
134183
134243
|
init_team_schema();
|
|
134184
134244
|
init_yaml_loader();
|
|
134185
134245
|
init_credentials();
|
|
134186
|
-
import { createHash as
|
|
134246
|
+
import { createHash as createHash31, randomUUID as randomUUID25 } from "node:crypto";
|
|
134187
134247
|
import { closeSync, fsyncSync, mkdirSync as mkdirSync8, openSync, readFileSync as readFileSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync7 } from "node:fs";
|
|
134188
134248
|
import { dirname as dirname17, resolve as resolve47 } from "node:path";
|
|
134189
134249
|
|
|
@@ -134193,7 +134253,7 @@ init_team_event_codec();
|
|
|
134193
134253
|
import { isDeepStrictEqual } from "node:util";
|
|
134194
134254
|
|
|
134195
134255
|
// ../../packages/core/src/relay/turso-team-store.ts
|
|
134196
|
-
import { createHash as
|
|
134256
|
+
import { createHash as createHash30, randomBytes as randomBytes3 } from "node:crypto";
|
|
134197
134257
|
import { createClient as createClient2 } from "@libsql/client";
|
|
134198
134258
|
|
|
134199
134259
|
// ../../node_modules/.bun/drizzle-orm@0.45.4+0c7b544c7f7b61ad/node_modules/drizzle-orm/entity.js
|
|
@@ -138486,7 +138546,7 @@ var invalidRequest = () => new TeamRelayError("invalid_request", "Supply a valid
|
|
|
138486
138546
|
function tokenHash(token) {
|
|
138487
138547
|
if (!/^avt_[A-Za-z0-9_-]{43}$/.test(token))
|
|
138488
138548
|
throw sessionError();
|
|
138489
|
-
return
|
|
138549
|
+
return createHash30("sha256").update(token).digest("hex");
|
|
138490
138550
|
}
|
|
138491
138551
|
function assertTeamForeignKeys(value) {
|
|
138492
138552
|
if (value !== 1)
|
|
@@ -138840,7 +138900,7 @@ function expiration(days) {
|
|
|
138840
138900
|
async function removeUndeliveredToken(store, token) {
|
|
138841
138901
|
await store.client.execute({
|
|
138842
138902
|
sql: "delete from team_tokens where token_hash=?",
|
|
138843
|
-
args: [
|
|
138903
|
+
args: [createHash31("sha256").update(token).digest("hex")]
|
|
138844
138904
|
});
|
|
138845
138905
|
}
|
|
138846
138906
|
function registerTeamCommands(program, deps = {}) {
|