@algosuite/vo-mcp 0.2.0-beta.22 → 0.2.0-beta.23

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.
@@ -6431,11 +6431,17 @@ function resolveAgentClaimContext(provider, defaultAgent) {
6431
6431
  }
6432
6432
  async function collectAgentAvailability({
6433
6433
  agents = listAgents(),
6434
- runnerFor = (agent) => resolveRunner({ VO_CODE_RUNNER_AGENT: agent }).runner
6434
+ runnerFor = (agent) => resolveRunner({ VO_CODE_RUNNER_AGENT: agent }).runner,
6435
+ probeTimeoutMs = PROBE_TIMEOUT_MS
6435
6436
  } = {}) {
6436
6437
  const probes = agents.map(async (agent) => {
6438
+ const degraded = { agent, installed: false, authenticated: false };
6437
6439
  try {
6438
- const r = await runnerFor(agent).checkAuth();
6440
+ const r = await Promise.race([
6441
+ Promise.resolve().then(() => runnerFor(agent).checkAuth()),
6442
+ new Promise((resolve2) => setTimeout(() => resolve2(null), probeTimeoutMs))
6443
+ ]);
6444
+ if (!r) return degraded;
6439
6445
  return {
6440
6446
  agent,
6441
6447
  installed: Boolean(r?.installed),
@@ -6457,28 +6463,53 @@ function makeAgentAvailabilityProvider({
6457
6463
  } = {}) {
6458
6464
  let cached2 = null;
6459
6465
  let fetchedAt = 0;
6460
- let inFlight = false;
6466
+ let inFlight = null;
6467
+ const refresh = () => {
6468
+ if (inFlight) return inFlight;
6469
+ try {
6470
+ inFlight = Promise.resolve(collect()).then((list) => {
6471
+ cached2 = list;
6472
+ fetchedAt = now();
6473
+ }).catch((e) => onError(e)).finally(() => {
6474
+ inFlight = null;
6475
+ });
6476
+ } catch (e) {
6477
+ inFlight = null;
6478
+ onError(e);
6479
+ return Promise.resolve();
6480
+ }
6481
+ return inFlight;
6482
+ };
6461
6483
  return {
6462
6484
  get() {
6463
- if (!inFlight && now() - fetchedAt >= ttlMs) {
6464
- inFlight = true;
6465
- Promise.resolve(collect()).then((list) => {
6466
- cached2 = list;
6467
- fetchedAt = now();
6468
- }).catch((e) => onError(e)).finally(() => {
6469
- inFlight = false;
6470
- });
6471
- }
6485
+ if (!inFlight && now() - fetchedAt >= ttlMs) refresh();
6486
+ return cached2;
6487
+ },
6488
+ /**
6489
+ * Resolve once a probe has actually completed, so the FIRST heartbeat can
6490
+ * report real agents. Without this the daemon heartbeats immediately with
6491
+ * `available_agents: []` (the cache is null until the first probe lands),
6492
+ * and a supervisor activation attestation — which requires the default
6493
+ * agent present, installed AND authenticated — can never be satisfied. The
6494
+ * supervisor then kills and restarts the child forever: observed on
6495
+ * JacksPC 2026-07-25, uptime stuck at 1s across every heartbeat.
6496
+ *
6497
+ * Bounded on purpose: a wedged probe must delay startup, never prevent it.
6498
+ */
6499
+ async ready(timeoutMs = 2e4) {
6500
+ if (Array.isArray(cached2)) return cached2;
6501
+ await Promise.race([refresh(), new Promise((r) => setTimeout(r, timeoutMs))]);
6472
6502
  return cached2;
6473
6503
  }
6474
6504
  };
6475
6505
  }
6476
- var DEFAULT_TTL_MS;
6506
+ var DEFAULT_TTL_MS, PROBE_TIMEOUT_MS;
6477
6507
  var init_agent_availability = __esm({
6478
6508
  "../../scripts/virtual-office/code-runner/agent-availability.mjs"() {
6479
6509
  "use strict";
6480
6510
  init_resolve_runner();
6481
6511
  DEFAULT_TTL_MS = 5 * 60 * 1e3;
6512
+ PROBE_TIMEOUT_MS = 1e4;
6482
6513
  }
6483
6514
  });
6484
6515
 
@@ -9861,6 +9892,7 @@ async function main({ env: env2 = process.env, once: once2 = false } = {}) {
9861
9892
  const runWatch = makeWatchRunner({ client, log: log2, maxFixAttempts: cfg.watchMaxFix, autoMergeEnabled: cfg.armAutoMerge });
9862
9893
  const watchCoordinator = makeWatchCycleCoordinator({ runWatch, log: log2, intervalMs: cfg.watchIntervalSec * 1e3 });
9863
9894
  const agentAvailability = makeAgentAvailabilityProvider({ onError: (e) => log2(`agent probe failed: ${e.message}`) });
9895
+ await agentAvailability.ready();
9864
9896
  const accountUsage = makeAccountUsageProvider();
9865
9897
  const loopTick = makeLoopTicks({ client, cfg, env: env2, log: log2, getActive: () => active, runnerInstanceId, capacityController, localModelController: createLocalModelRemoteController({ env: env2, log: log2 }), getAgentAvailability: () => agentAvailability.get(), getAccountUsage: () => accountUsage.get() });
9866
9898
  const backoff = makeReconnectBackoff({ baseMs: cfg.pollSec * 1e3, log: log2 });