agent-valley 2.1.0 → 2.2.1
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/README.md +3 -3
- package/dist/assets/plugin.json +1 -1
- package/dist/assets/skills/av/SKILL.md +7 -5
- package/dist/index.js +2968 -2333
- package/dist/supervisor.js +28 -11
- package/package.json +1 -1
package/dist/supervisor.js
CHANGED
|
@@ -6694,6 +6694,14 @@ var init_container_observation_policy = __esm(() => {
|
|
|
6694
6694
|
|
|
6695
6695
|
// ../../packages/core/src/chief/execution.ts
|
|
6696
6696
|
import { createHash } from "node:crypto";
|
|
6697
|
+
function chiefRecoveryStopped(mission) {
|
|
6698
|
+
const decision = mission.supervision?.decisions.at(-1);
|
|
6699
|
+
if (decision?.action !== "stop")
|
|
6700
|
+
return false;
|
|
6701
|
+
const stoppedAt = Date.parse(decision.at);
|
|
6702
|
+
const intervenedAt = Date.parse(mission.execution?.interventionAt ?? "");
|
|
6703
|
+
return !Number.isFinite(stoppedAt) || !Number.isFinite(intervenedAt) || intervenedAt <= stoppedAt;
|
|
6704
|
+
}
|
|
6697
6705
|
function classifyFailure(reason) {
|
|
6698
6706
|
if (/unauthori[sz]ed|authentication|login required|log in|expired token|invalid.*(?:token|api.key)|\b401\b|\b403\b/i.test(reason))
|
|
6699
6707
|
return "authentication";
|
|
@@ -6728,21 +6736,21 @@ function assertExecutionBudget(mission, now = Date.now()) {
|
|
|
6728
6736
|
return;
|
|
6729
6737
|
const state = executionState(mission);
|
|
6730
6738
|
if (now - Date.parse(state.startedAt) >= policy.maxDurationSec * 1000)
|
|
6731
|
-
throw new MissionPause("Mission time limit reached.
|
|
6739
|
+
throw new MissionPause("Mission time limit reached. The original goal remains unresolved within its saved duration.", "budget");
|
|
6732
6740
|
if (state.runsStarted >= policy.maxRuns)
|
|
6733
|
-
throw new MissionPause("Mission Actor call limit reached.
|
|
6741
|
+
throw new MissionPause("Mission Actor call limit reached. The original goal remains unresolved within its saved call budget.", "budget");
|
|
6734
6742
|
if (policy.maxEstimatedCostUsd !== undefined) {
|
|
6735
6743
|
const finished = mission.operations?.runs.filter((run) => run.finishedAt) ?? [];
|
|
6736
6744
|
const reconciled = new Map(state.costReconciliations?.map((entry) => [entry.runId, entry.costUsd]));
|
|
6737
6745
|
if (finished.some((run) => run.costUsd === null && !reconciled.has(run.runId)))
|
|
6738
|
-
throw new MissionPause("Cost headroom is unknown.
|
|
6746
|
+
throw new MissionPause("Cost headroom is unknown. Unresolved billing evidence prevents further calls; no zero-cost assumption was made.", "budget");
|
|
6739
6747
|
if (finished.reduce((sum, run) => sum + (run.costUsd ?? reconciled.get(run.runId) ?? 0), 0) >= policy.maxEstimatedCostUsd)
|
|
6740
|
-
throw new MissionPause("Configured-price estimated cost limit reached.
|
|
6748
|
+
throw new MissionPause("Configured-price estimated cost limit reached. The goal remains unresolved within its saved cost budget.", "budget");
|
|
6741
6749
|
}
|
|
6742
6750
|
}
|
|
6743
6751
|
function assertExecutionDeadline(mission, now = Date.now()) {
|
|
6744
6752
|
if (mission.executionPolicy && now - Date.parse(executionState(mission).startedAt) >= mission.executionPolicy.maxDurationSec * 1000)
|
|
6745
|
-
throw new MissionPause("Mission time limit reached.
|
|
6753
|
+
throw new MissionPause("Mission time limit reached. The original goal remains unresolved within its saved duration.", "budget");
|
|
6746
6754
|
}
|
|
6747
6755
|
function reconcileRunCost(mission, runId, costUsd) {
|
|
6748
6756
|
const run = mission.operations?.runs.find((entry) => entry.runId === runId);
|
|
@@ -6778,16 +6786,22 @@ function pauseForFailure(mission, reason, taskId) {
|
|
|
6778
6786
|
const state = mission.tasks.find((entry) => entry.id === taskId);
|
|
6779
6787
|
if (task?.effectScope === "external" && state?.effectState === "running") {
|
|
6780
6788
|
state.effectState = "unknown";
|
|
6781
|
-
throw new MissionPause(`External effect for ${taskId} is uncertain.
|
|
6789
|
+
throw new MissionPause(`External effect for ${taskId} is uncertain. Its destination outcome has not been established; it will not be repeated.`, "unknown-effect");
|
|
6782
6790
|
}
|
|
6783
6791
|
const kind = classifyFailure(reason);
|
|
6784
|
-
if (kind === "authentication" || kind === "environment")
|
|
6785
|
-
|
|
6792
|
+
if (kind === "authentication" || kind === "environment") {
|
|
6793
|
+
if (mission.supervision)
|
|
6794
|
+
return;
|
|
6795
|
+
throw new MissionPause(`${reason} Required source access is unavailable; the goal remains unresolved.`, kind);
|
|
6796
|
+
}
|
|
6786
6797
|
if (kind !== "rate-limit" && kind !== "provider")
|
|
6787
6798
|
return;
|
|
6788
6799
|
const execution = executionState(mission);
|
|
6789
|
-
if (execution.retries >= mission.executionPolicy.maxRetries)
|
|
6790
|
-
|
|
6800
|
+
if (execution.retries >= mission.executionPolicy.maxRetries) {
|
|
6801
|
+
if (mission.supervision)
|
|
6802
|
+
return;
|
|
6803
|
+
throw new MissionPause(`${reason} Automatic retries exhausted; the goal remains unresolved.`, kind);
|
|
6804
|
+
}
|
|
6791
6805
|
execution.retries += 1;
|
|
6792
6806
|
const delay = Math.min(300000, mission.executionPolicy.retryDelayMs * 2 ** (execution.retries - 1));
|
|
6793
6807
|
throw new MissionPause(reason, kind, new Date(Date.now() + delay).toISOString());
|
|
@@ -6845,7 +6859,10 @@ var init_execution = __esm(() => {
|
|
|
6845
6859
|
"implementation",
|
|
6846
6860
|
"unknown-effect",
|
|
6847
6861
|
"budget",
|
|
6848
|
-
"interrupted"
|
|
6862
|
+
"interrupted",
|
|
6863
|
+
"chief-wait",
|
|
6864
|
+
"chief-unavailable",
|
|
6865
|
+
"integrity"
|
|
6849
6866
|
]).optional(),
|
|
6850
6867
|
progressKey: string2().optional(),
|
|
6851
6868
|
interventionAt: exports_iso.datetime().optional(),
|