agent-valley 4.9.9 → 4.10.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.
@@ -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.9.9",
4
+ "version": "4.10.1",
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
@@ -7134,7 +7134,10 @@ function chiefRecoveryStopped(mission) {
7134
7134
  return !Number.isFinite(stoppedAt) || !Number.isFinite(intervenedAt) || intervenedAt <= stoppedAt;
7135
7135
  }
7136
7136
  function isNativeAgentTimeout(reason) {
7137
- return /^Agent timed out after \d+(?:\.\d+)?s$/i.test(reason);
7137
+ return /^Agent timed out after \d+(?:\.\d+)?s$/i.test(reason) || isNativeAgentStall(reason);
7138
+ }
7139
+ function isNativeAgentStall(reason) {
7140
+ return /^Agent stalled: no activity for \d+s$/i.test(reason);
7138
7141
  }
7139
7142
  function isUnavailableAgentModel(reason) {
7140
7143
  const normalized = reason.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ");
@@ -35786,11 +35789,21 @@ async function registerBuiltinSessions() {
35786
35789
  }
35787
35790
 
35788
35791
  // ../../packages/core/src/sessions/adapters/agent-runner-service.ts
35792
+ var DEFAULT_INACTIVITY_TIMEOUT_SEC = 1800;
35793
+ function resolveInactivityTimeoutSec(requested, source = process.env) {
35794
+ const configured = Number.parseInt(source.AV_AGENT_INACTIVITY_TIMEOUT_SEC ?? "", 10);
35795
+ const seconds = requested ?? (Number.isFinite(configured) ? configured : DEFAULT_INACTIVITY_TIMEOUT_SEC);
35796
+ return Number.isFinite(seconds) && seconds > 0 ? Math.round(seconds) : 0;
35797
+ }
35798
+ function agentStallMessage(seconds) {
35799
+ return `Agent stalled: no activity for ${seconds}s`;
35800
+ }
35789
35801
  var MAX_OUTPUT_SNIPPET = 24;
35790
35802
 
35791
35803
  class AgentRunnerService {
35792
35804
  activeSessions = new Map;
35793
35805
  activeTimers = new Map;
35806
+ activeIdleTimers = new Map;
35794
35807
  lastOutputs = new Map;
35795
35808
  activeAgentTypes = new Map;
35796
35809
  cancelAttempts = new Map;
@@ -35889,6 +35902,10 @@ class AgentRunnerService {
35889
35902
  if (timer)
35890
35903
  clearTimeout(timer);
35891
35904
  this.activeTimers.delete(attempt.id);
35905
+ const idleTimer = this.activeIdleTimers.get(attempt.id);
35906
+ if (idleTimer)
35907
+ clearTimeout(idleTimer);
35908
+ this.activeIdleTimers.delete(attempt.id);
35892
35909
  this.activeSessions.delete(attempt.id);
35893
35910
  this.activeAgentTypes.delete(attempt.id);
35894
35911
  this.lastOutputs.delete(attempt.id);
@@ -35933,17 +35950,43 @@ class AgentRunnerService {
35933
35950
  handled = true;
35934
35951
  cleanup(false);
35935
35952
  });
35953
+ const inactivitySec = resolveInactivityTimeoutSec(options.inactivityTimeout);
35954
+ const touch = () => {
35955
+ if (!inactivitySec || handled)
35956
+ return;
35957
+ const previous = this.activeIdleTimers.get(attempt.id);
35958
+ if (previous)
35959
+ clearTimeout(previous);
35960
+ this.activeIdleTimers.set(attempt.id, setTimeout(async () => {
35961
+ this.activeIdleTimers.delete(attempt.id);
35962
+ if (handled || !this.activeSessions.has(attempt.id))
35963
+ return;
35964
+ logger.warn("orchestrator", "Agent stalled", {
35965
+ attemptId: attempt.id,
35966
+ issueId: attempt.issueId,
35967
+ inactivityMs: inactivitySec * 1000
35968
+ });
35969
+ handled = true;
35970
+ await this.kill(attempt.id);
35971
+ callbacks.onError({ code: "TIMEOUT", message: agentStallMessage(inactivitySec), recoverable: true });
35972
+ }, inactivitySec * 1000));
35973
+ };
35936
35974
  session.on("spawned", (e) => {
35975
+ touch();
35937
35976
  if (!handled)
35938
35977
  callbacks.onSpawned?.(e.pid);
35939
35978
  });
35940
35979
  session.on("heartbeat", (e) => {
35980
+ touch();
35941
35981
  if (!handled)
35942
35982
  callbacks.onHeartbeat(e.timestamp);
35943
35983
  });
35984
+ session.on("toolUse", () => touch());
35985
+ session.on("fileChange", () => touch());
35944
35986
  session.on("output", (e) => {
35945
35987
  if (handled)
35946
35988
  return;
35989
+ touch();
35947
35990
  callbacks.onOutput?.(e.chunk);
35948
35991
  const snippet = e.chunk.trim().replace(/\s+/g, " ").slice(-MAX_OUTPUT_SNIPPET);
35949
35992
  if (snippet)
@@ -36009,6 +36052,7 @@ class AgentRunnerService {
36009
36052
  executing.then(forgetExecution, forgetExecution);
36010
36053
  if (handled)
36011
36054
  return;
36055
+ touch();
36012
36056
  const timer = setTimeout(async () => {
36013
36057
  if (this.activeSessions.has(attempt.id)) {
36014
36058
  logger.warn("orchestrator", "Agent timed out", {
@@ -57818,7 +57862,7 @@ var goalVerificationResultSchema = strictObject({
57818
57862
  evidence: array(strictObject({
57819
57863
  criterion: string2().min(1).max(4000),
57820
57864
  passed: boolean2(),
57821
- checks: array(checkEvidenceSchema).min(1).max(10)
57865
+ checks: array(checkEvidenceSchema).min(1).max(20)
57822
57866
  })).min(1).max(20)
57823
57867
  });
57824
57868
  function checkDigest(check) {
@@ -76203,6 +76247,8 @@ function taskDecompositionGuidance(mission, phase) {
76203
76247
  var CHIEF_DIRECTOR_ROLE = "Act as the Chief Director, the autonomous executive responsible for realizing the user's intent. Understand the product, customers, market and operating context; interpret abstract goals, identify opportunities and anticipate consequences. Synthesize Technical Director, Design Director and Marketing Director advice, resolve their competing interests and make the final business judgment. Form a strategy, mobilize Actors and installed skills, test assumptions against actual outcomes and adapt the strategy when evidence changes. Maximize the user's benefit and profit with initiative, including uncertain or unconventional opportunities. Own the team's decisions, execution and explanation; the operator retains ultimate operational responsibility.";
76204
76248
  var CHIEF_DECISION_RESPONSIBILITY = "The user supplies intent and receives reports. Own decisions across discovery, product direction, technology, design, marketing, execution and evaluation within the original charter, available permissions and saved limits. Resolve ambiguity with justified assumptions rather than handing a menu of choices back to the user. Consider several plausible explanations and opportunities, choose a course of action and explain why it serves the outcome. Seek evidence through authorized research, experiments and Actor work; distinguish measured facts from judgment and uncertainty. Reconsider a failing strategy and act on useful opportunities without waiting for step-by-step instructions. Report decisions made, alternatives considered, actual results, lessons and next actions. Missing authorization, credentials or trustworthy evidence remain unmet prerequisites; never invent them or claim completion without evidence.";
76205
76249
  var PARALLEL_SOURCE_PROVENANCE = "Parallel source provenance: in each sourceEvidence record, baselineHead is the accepted committed source baseline for cross-workspace citations, and baselineTree is the product tree of that exact commit (git rev-parse <baselineHead>^{tree}). When supplied, snapshotCommit and snapshotRef identify the Actor's initial isolated input snapshot, and snapshotTree is that snapshot's input tree, which may include an uncommitted source overlay absent from the committed baseline. workerRef preserves the Actor's checked-out HEAD at collection; uncommitted task edits may be absent from that commit and must be verified in the integrated worktree, using the delivery receipt when available. Label observations of the Actor's local HEAD, snapshot or uncommitted diffs with that scope and the actual inspected revision and paths; do not claim local changes are already in the committed baseline. An Actor-local file being tracked at its snapshot revision does not imply that it is already tracked in the review checkout. The Actor's snapshot HEAD and the review workspace's current HEAD can differ. Preserve actual source hashes; never substitute another checkout's HEAD or invent a missing revision.";
76250
+ var EXHAUSTIVE_REVIEW_RULE = "Enumerate every blocking defect across the whole deliverable in this single review so that one repair round can resolve them all; do not reserve findings for a later round, and do not escalate the acceptance bar beyond the task's own acceptance and the mission goal.";
76251
+ var REPAIR_REVIEW_RULE = "This is a repair review: previousReview lists the findings the Actor was asked to fix. Verify each one is resolved. Additional blocking findings are limited to defects in the repaired or newly changed code and severe pre-existing defects (data loss, deadlock, leaked permits or locks, security exposure, silent failure). Record other pre-existing concerns in summary as non-blocking notes, not findings.";
76206
76252
  function context(mission) {
76207
76253
  const unavailableAdvice = unavailableDirectorAdvice(mission);
76208
76254
  return JSON.stringify({
@@ -76369,6 +76415,7 @@ function reviewPrompt(mission, task, state) {
76369
76415
  "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."
76370
76416
  ],
76371
76417
  "Reject incomplete requirements, missing deliverables, weakened tests, correctness defects, or missing evidence.",
76418
+ ...task ? [EXHAUSTIVE_REVIEW_RULE, ...state?.review ? [REPAIR_REVIEW_RULE] : []] : [],
76372
76419
  ...mission.technicalLeadId ? [
76373
76420
  "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."
76374
76421
  ] : [],
@@ -7126,7 +7126,10 @@ function chiefRecoveryStopped(mission) {
7126
7126
  return !Number.isFinite(stoppedAt) || !Number.isFinite(intervenedAt) || intervenedAt <= stoppedAt;
7127
7127
  }
7128
7128
  function isNativeAgentTimeout(reason) {
7129
- return /^Agent timed out after \d+(?:\.\d+)?s$/i.test(reason);
7129
+ return /^Agent timed out after \d+(?:\.\d+)?s$/i.test(reason) || isNativeAgentStall(reason);
7130
+ }
7131
+ function isNativeAgentStall(reason) {
7132
+ return /^Agent stalled: no activity for \d+s$/i.test(reason);
7130
7133
  }
7131
7134
  function isUnavailableAgentModel(reason) {
7132
7135
  const normalized = reason.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-valley",
3
- "version": "4.9.9",
3
+ "version": "4.10.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=26.10.0",