@algosuite/vo-mcp 0.2.0-beta.14 → 0.2.0-beta.16

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.
@@ -2129,7 +2129,7 @@ async function resolveBearer(env2) {
2129
2129
  return cachedFirebaseToken;
2130
2130
  }
2131
2131
  function createControlPlaneClient({
2132
- baseUrl = process.env.VO_CONTROL_PLANE_URL || "",
2132
+ baseUrl,
2133
2133
  env: env2 = process.env,
2134
2134
  fetchImpl = fetch,
2135
2135
  heartbeatTimeoutMs = Math.min(
@@ -2137,10 +2137,11 @@ function createControlPlaneClient({
2137
2137
  6e4
2138
2138
  )
2139
2139
  } = {}) {
2140
- if (!baseUrl) {
2140
+ const resolvedBaseUrl = baseUrl ?? env2.VO_CONTROL_PLANE_URL ?? "";
2141
+ if (!resolvedBaseUrl) {
2141
2142
  throw new Error("VO_CONTROL_PLANE_URL is required for the code-runner daemon");
2142
2143
  }
2143
- const root = baseUrl.replace(/\/+$/, "");
2144
+ const root = resolvedBaseUrl.replace(/\/+$/, "");
2144
2145
  async function req(method, path17, body, { timeoutMs } = {}) {
2145
2146
  const bearer = await resolveBearer(env2);
2146
2147
  const controller = timeoutMs ? new AbortController() : null;
@@ -8466,6 +8467,7 @@ async function main({ env: env2 = process.env, once: once2 = false } = {}) {
8466
8467
  }
8467
8468
  });
8468
8469
  const capacityController = createRunnerCapacityController({ configuredMax: cfg.maxConcurrency });
8470
+ const watchCyclesEnabled = cfg.watchEnabled && !once2;
8469
8471
  log2(
8470
8472
  `up as ${cfg.runnerId} \u2192 ${env2.VO_CONTROL_PLANE_URL} (agent ${cfg.agent} [${cfg.runnerBin}], concurrency ${capacityController.current()}/${cfg.maxConcurrency}, poll ${cfg.pollSec}s, once=${once2})`
8471
8473
  );
@@ -8474,7 +8476,7 @@ async function main({ env: env2 = process.env, once: once2 = false } = {}) {
8474
8476
  cfg.armAutoMerge ? "PR auto-merge arming ON for complete PRs (VO_CODE_RUNNER_ARM_AUTOMERGE=1)" : "PR auto-merge arming OFF (set VO_CODE_RUNNER_ARM_AUTOMERGE=1 for internal dogfood autonomy)"
8475
8477
  );
8476
8478
  log2(
8477
- cfg.watchEnabled ? `PR watcher ON \u2014 auto-fix ${cfg.watchMaxFix}/PR; ${cfg.armAutoMerge ? "receipt-gated merge enabled" : "merge disabled"}; every ${cfg.watchIntervalSec}s (VO_CODE_RUNNER_WATCH=0 to disable)` : "PR watcher OFF (VO_CODE_RUNNER_WATCH=0)"
8479
+ watchCyclesEnabled ? `PR watcher ON \u2014 auto-fix ${cfg.watchMaxFix}/PR; ${cfg.armAutoMerge ? "receipt-gated merge enabled" : "merge disabled"}; every ${cfg.watchIntervalSec}s (VO_CODE_RUNNER_WATCH=0 to disable)` : once2 ? "PR watcher bypassed for --once; dispatched PRs remain tracked" : "PR watcher OFF (VO_CODE_RUNNER_WATCH=0)"
8478
8480
  );
8479
8481
  const runWatch = makeWatchRunner({ client, log: log2, maxFixAttempts: cfg.watchMaxFix, autoMergeEnabled: cfg.armAutoMerge });
8480
8482
  const watchCoordinator = makeWatchCycleCoordinator({ runWatch, log: log2, intervalMs: cfg.watchIntervalSec * 1e3 });
@@ -8484,17 +8486,22 @@ async function main({ env: env2 = process.env, once: once2 = false } = {}) {
8484
8486
  const backoff = makeReconnectBackoff({ baseMs: cfg.pollSec * 1e3, log: log2 });
8485
8487
  while (!stopping) {
8486
8488
  const heartbeatCompletion = loopTick();
8487
- if (cfg.watchEnabled) watchCoordinator.start();
8488
- if (active >= capacityController.current()) {
8489
- await sleep2(cfg.pollSec * 1e3);
8490
- continue;
8491
- }
8489
+ if (watchCyclesEnabled) watchCoordinator.start();
8492
8490
  const claimAgents = resolveAgentClaimContext(agentAvailability, cfg.agent);
8493
8491
  if (!claimAgents) {
8492
+ await heartbeatCompletion;
8494
8493
  await sleep2(cfg.pollSec * 1e3);
8495
8494
  continue;
8496
8495
  }
8497
8496
  await heartbeatCompletion;
8497
+ if (active >= capacityController.current()) {
8498
+ if (once2) {
8499
+ log2("no local execution capacity; --once exiting");
8500
+ break;
8501
+ }
8502
+ await sleep2(cfg.pollSec * 1e3);
8503
+ continue;
8504
+ }
8498
8505
  let task;
8499
8506
  try {
8500
8507
  task = await client.claim(cfg.runnerId, cfg.servedRepos, cfg.servedOperators, { runnerInstanceId, reconcileStale, ...claimAgents });