agent-valley 4.16.1 → 4.16.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.
@@ -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.16.1",
4
+ "version": "4.16.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
@@ -7143,6 +7143,12 @@ function isUnavailableAgentModel(reason) {
7143
7143
  const normalized = reason.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ");
7144
7144
  return /\bmodel not (?:found|available)\b|(?:^|:\s*)(?:the )?model (?:is )?unavailable(?:[.!:]|$)/i.test(normalized);
7145
7145
  }
7146
+ function isProviderOutage(reason) {
7147
+ return PROVIDER_OUTAGE.test(reason);
7148
+ }
7149
+ function outagePause(reason, now = Date.now()) {
7150
+ return new MissionPause(reason, "provider", new Date(now + OUTAGE_RETRY_MS).toISOString());
7151
+ }
7146
7152
  function classifyFailure(reason) {
7147
7153
  if (TRANSIENT_TRANSPORT.test(reason))
7148
7154
  return "provider";
@@ -7279,6 +7285,8 @@ function pauseForFailure(mission, reason, taskId) {
7279
7285
  }
7280
7286
  if (kind !== "rate-limit" && kind !== "provider")
7281
7287
  return;
7288
+ if (mission.supervision && isProviderOutage(reason))
7289
+ throw outagePause(reason);
7282
7290
  const execution = executionState(mission);
7283
7291
  if (execution.retries >= mission.executionPolicy.maxRetries) {
7284
7292
  if (mission.supervision)
@@ -7315,7 +7323,7 @@ function resolveExternalEffect(mission, taskId, result) {
7315
7323
  message: `Operator reconciled external effect: ${result}.`
7316
7324
  });
7317
7325
  }
7318
- var MissionPause, TRANSIENT_TRANSPORT;
7326
+ var MissionPause, TRANSIENT_TRANSPORT, PROVIDER_OUTAGE, OUTAGE_RETRY_MS = 180000;
7319
7327
  var init_execution = __esm(() => {
7320
7328
  init_contracts();
7321
7329
  MissionPause = class MissionPause extends Error {
@@ -7328,6 +7336,7 @@ var init_execution = __esm(() => {
7328
7336
  }
7329
7337
  };
7330
7338
  TRANSIENT_TRANSPORT = /\bRPC timeout for\b|\bworkspace routing discovery failed\b/i;
7339
+ PROVIDER_OUTAGE = /\bRPC timeout for\b|\bworkspace routing discovery failed\b|enotfound|eai_again|enetunreach|ehostunreach|network is unreachable/i;
7331
7340
  });
7332
7341
 
7333
7342
  // ../../packages/core/src/chief/parallel-contract.ts
@@ -83339,14 +83348,14 @@ async function runStructuredStage(options) {
83339
83348
 
83340
83349
  The previous response did not validate: ${JSON.stringify(reason)}. Return only one JSON object matching the original schema. Preserve the original goal, criteria, Actor identity and permissions. Do not add Markdown or commentary.`);
83341
83350
  } catch (error) {
83342
- if (error instanceof Error && !(error instanceof MissionPause) && !(error instanceof AgentRunError && error.outcomeUnknown) && isNativeAgentTimeout(error.message)) {
83351
+ if (error instanceof Error && !(error instanceof MissionPause) && !(error instanceof AgentRunError && error.outcomeUnknown) && (isNativeAgentTimeout(error.message) || isProviderOutage(error.message))) {
83343
83352
  assertNoUncertainExecution(mission);
83344
83353
  mission.history.push({
83345
83354
  at: new Date().toISOString(),
83346
83355
  stage: "structured-stage-transient",
83347
83356
  message: JSON.stringify({ key, attempts, reservationAt })
83348
83357
  });
83349
- await save("structured-output", `${stage} ended at its native deadline without a response. Retained the JSON correction allowance; Actor calls, elapsed time, cost and provider retries remain spent.`);
83358
+ await save("structured-output", `${stage} ended ${isProviderOutage(error.message) ? "because the provider was unreachable" : "at its native deadline"} without a response. Retained the JSON correction allowance; Actor calls, elapsed time, cost and provider retries remain spent.`);
83350
83359
  }
83351
83360
  throw error;
83352
83361
  }
@@ -139606,6 +139615,13 @@ function createChiefRecovery(mission, ports, hooks) {
139606
139615
  throw new Error(reason);
139607
139616
  hooks.checkAbort();
139608
139617
  assertExecutionDeadline(mission);
139618
+ if (isProviderOutage(reason)) {
139619
+ delete supervision.pendingRecovery;
139620
+ const pause = outagePause(reason);
139621
+ recordPause(mission, pause);
139622
+ await hooks.save("supervise-wait", `The provider is unreachable (${reason.slice(0, 300)}). No Chief Director recovery round is spent; the failed call is retried at ${pause.nextRunAt}.`, taskId);
139623
+ throw pause;
139624
+ }
139609
139625
  supervision.pendingRecovery = { reason: reason.slice(-32000), ...taskId ? { taskId } : {} };
139610
139626
  await hooks.save("recovery-requested", reason, taskId);
139611
139627
  const fingerprint = await ports.fingerprint(mission);
@@ -139636,6 +139652,16 @@ function createChiefRecovery(mission, ports, hooks) {
139636
139652
  run: (prompt) => hooks.run(hooks.persona(mission.chiefId), prompt, "supervise"),
139637
139653
  parse: (output) => parseSupervisionResponse(output, mission),
139638
139654
  save: (stage, message) => hooks.save(stage, message, taskId)
139655
+ }).catch(async (error) => {
139656
+ const failure = error instanceof Error ? error.message : String(error);
139657
+ if (error instanceof MissionPause || error instanceof AgentRunError && error.outcomeUnknown || !isProviderOutage(failure))
139658
+ throw error;
139659
+ supervision.rounds -= 1;
139660
+ supervision.stalledRounds = previousStalled;
139661
+ const pause = outagePause(failure);
139662
+ recordPause(mission, pause);
139663
+ await hooks.save("supervise-wait", `The Chief Director could not be reached (${failure.slice(0, 300)}). Recovery round ${supervision.rounds + 1} is not spent; the same request is asked again at ${pause.nextRunAt}.`, taskId);
139664
+ throw pause;
139639
139665
  });
139640
139666
  const decision = recordDecision(mission, response, fingerprint);
139641
139667
  if (response.action === "stop") {
@@ -7135,6 +7135,12 @@ function isUnavailableAgentModel(reason) {
7135
7135
  const normalized = reason.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ");
7136
7136
  return /\bmodel not (?:found|available)\b|(?:^|:\s*)(?:the )?model (?:is )?unavailable(?:[.!:]|$)/i.test(normalized);
7137
7137
  }
7138
+ function isProviderOutage(reason) {
7139
+ return PROVIDER_OUTAGE.test(reason);
7140
+ }
7141
+ function outagePause(reason, now = Date.now()) {
7142
+ return new MissionPause(reason, "provider", new Date(now + OUTAGE_RETRY_MS).toISOString());
7143
+ }
7138
7144
  function classifyFailure(reason) {
7139
7145
  if (TRANSIENT_TRANSPORT.test(reason))
7140
7146
  return "provider";
@@ -7271,6 +7277,8 @@ function pauseForFailure(mission, reason, taskId) {
7271
7277
  }
7272
7278
  if (kind !== "rate-limit" && kind !== "provider")
7273
7279
  return;
7280
+ if (mission.supervision && isProviderOutage(reason))
7281
+ throw outagePause(reason);
7274
7282
  const execution = executionState(mission);
7275
7283
  if (execution.retries >= mission.executionPolicy.maxRetries) {
7276
7284
  if (mission.supervision)
@@ -7307,7 +7315,7 @@ function resolveExternalEffect(mission, taskId, result) {
7307
7315
  message: `Operator reconciled external effect: ${result}.`
7308
7316
  });
7309
7317
  }
7310
- var MissionPause, TRANSIENT_TRANSPORT;
7318
+ var MissionPause, TRANSIENT_TRANSPORT, PROVIDER_OUTAGE, OUTAGE_RETRY_MS = 180000;
7311
7319
  var init_execution = __esm(() => {
7312
7320
  init_contracts();
7313
7321
  MissionPause = class MissionPause extends Error {
@@ -7320,6 +7328,7 @@ var init_execution = __esm(() => {
7320
7328
  }
7321
7329
  };
7322
7330
  TRANSIENT_TRANSPORT = /\bRPC timeout for\b|\bworkspace routing discovery failed\b/i;
7331
+ PROVIDER_OUTAGE = /\bRPC timeout for\b|\bworkspace routing discovery failed\b|enotfound|eai_again|enetunreach|ehostunreach|network is unreachable/i;
7323
7332
  });
7324
7333
 
7325
7334
  // ../../packages/core/src/chief/parallel-contract.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-valley",
3
- "version": "4.16.1",
3
+ "version": "4.16.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=26.10.0",