@algosuite/vo-mcp 0.2.0-beta.37 → 0.2.0-beta.39

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.
@@ -176,6 +176,38 @@ async function mergeVerifiedPrRequest(req, prNumber, automationContext, onUnauth
176
176
  };
177
177
  }
178
178
 
179
+ // ../../scripts/virtual-office/code-runner/claim-gate-notice.mjs
180
+ var REASON_HELP = {
181
+ daemon_version_below_floor: "this daemon is older than the approved release target \u2014 it idles until the governed updater brings it current (operator override: VO_RUNNER_CLAIM_MIN_DAEMON_VERSION / VO_RUNNER_CLAIM_VERSION_GATE=off on the control plane)",
182
+ daemon_version_unreported: "this daemon reports no parseable version in its heartbeat \u2014 too old for the updater to manage, so it may not claim work",
183
+ no_fresh_heartbeat: "the control plane has no fresh heartbeat from this runner \u2014 claims resume once heartbeats land",
184
+ runner_denylisted: "this runner id is on the operator quarantine list (VO_RUNNER_CLAIM_DENYLIST)"
185
+ };
186
+ function describeClaimGate(gate) {
187
+ if (!gate || gate.allowed !== false) return null;
188
+ const reason = String(gate.reason || "denied");
189
+ const floor = gate.floor_version ? ` (floor ${gate.floor_version})` : "";
190
+ return `claim gate: DENIED \u2014 ${reason}${floor}: ${(Object.hasOwn(REASON_HELP, reason) ? REASON_HELP[reason] : null) ?? "the control plane refused this runner's claims"}`;
191
+ }
192
+ function makeClaimGateNotice({ log = () => {
193
+ } } = {}) {
194
+ let last = null;
195
+ let current = null;
196
+ return {
197
+ current: () => current,
198
+ observe(json) {
199
+ const gate = json && typeof json === "object" ? json.claim_gate : null;
200
+ const denied = gate && gate.allowed === false ? gate : null;
201
+ current = denied ? { ...denied, observed_at: (/* @__PURE__ */ new Date()).toISOString() } : null;
202
+ const signature = denied ? `${denied.reason}|${denied.floor_version ?? ""}` : null;
203
+ if (signature === last) return;
204
+ if (denied) log(describeClaimGate(denied));
205
+ else if (last !== null) log("claim gate: allowed again \u2014 this runner may claim work");
206
+ last = signature;
207
+ }
208
+ };
209
+ }
210
+
179
211
  // ../../scripts/virtual-office/code-runner/control-plane-client.mjs
180
212
  var cachedFirebaseToken = null;
181
213
  var ClaimAuthorityChangedError = class extends Error {
@@ -244,7 +276,10 @@ function createControlPlaneClient({
244
276
  }
245
277
  }
246
278
  const taskReq = (method, path2, body, options = {}) => req(method, path2, body, { timeoutMs: taskRequestTimeoutMs, ...options });
279
+ const claimGate = makeClaimGateNotice({ log: (m) => console.warn(`[code-runner ${(/* @__PURE__ */ new Date()).toISOString()}] ${m}`) });
247
280
  return {
281
+ getClaimGate: () => claimGate.current(),
282
+ // last DENIED claim-gate verdict (null when allowed) — for /status + tests
248
283
  ...makeAutonomousDispatchAdmissionClient(
249
284
  req,
250
285
  taskRequestTimeoutMs,
@@ -279,6 +314,7 @@ function createControlPlaneClient({
279
314
  }
280
315
  if (!res.ok) throw new Error(`claim failed: HTTP ${res.status}`);
281
316
  const json = await res.json();
317
+ claimGate.observe(json);
282
318
  return json && json.task ? json.task : null;
283
319
  },
284
320
  /**