@algosuite/vo-mcp 0.2.0-beta.50 → 0.2.0-beta.52

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.
@@ -61,6 +61,29 @@ async function fetchInstallationToken({ req, required = false, readOnly = false,
61
61
  }
62
62
  }
63
63
 
64
+ // ../../scripts/virtual-office/code-runner/control-plane-promote.mjs
65
+ async function promoteDraftPrRequest(req, prNumber, automationContext, onUnauthorized = () => {
66
+ }) {
67
+ const res = await req("POST", "/api/v1/admin/pr/promote-draft", { prNumber, automationContext }, { timeoutMs: 6e4 });
68
+ if (res.status === 401) {
69
+ onUnauthorized();
70
+ throw new Error("promote-draft unauthorized (401)");
71
+ }
72
+ const json = await res.json().catch(() => ({}));
73
+ if (res.ok && json?.ok === true) {
74
+ return {
75
+ status: json.promoted === true ? json.auto_merge_disarmed === true ? "promoted (auto-merge disarmed)" : "promoted" : json.already_ready === true ? "already_ready" : "unchanged",
76
+ headSha: typeof json.head_sha === "string" ? json.head_sha : null,
77
+ reason: typeof json.blocked_reason === "string" ? json.blocked_reason : null
78
+ };
79
+ }
80
+ const code = typeof json?.error === "string" ? json.error : null;
81
+ const err = new Error(`promote-draft failed: HTTP ${res.status}${code ? ` (${code})` : ""}${json?.reason ? ` \u2014 ${json.reason}` : ""}`);
82
+ err.status = res.status;
83
+ err.code = code;
84
+ throw err;
85
+ }
86
+
64
87
  // ../../scripts/virtual-office/code-runner/control-plane-task-list.mjs
65
88
  var PAGE_SIZE = 500;
66
89
  async function listAllPrOpenedTasks(request) {
@@ -117,7 +140,9 @@ async function resumeCodeTaskRequest(req, taskId, { automaticRateLimit = false,
117
140
  throw err;
118
141
  }
119
142
  const json = await res.json();
120
- return json && json.task ? json.task : null;
143
+ const task = json && json.task ? json.task : null;
144
+ if (task && typeof json.deduplicated === "boolean") Object.defineProperty(task, "deduplicated", { value: json.deduplicated, enumerable: false });
145
+ return task;
121
146
  }
122
147
 
123
148
  // ../../scripts/virtual-office/code-runner/control-plane-autonomous-admission.mjs
@@ -393,9 +418,22 @@ function createControlPlaneClient({
393
418
  cachedFirebaseToken = null;
394
419
  throw new Error("enqueue unauthorized (401)");
395
420
  }
396
- if (!res.ok) throw new Error(`enqueue failed: HTTP ${res.status}`);
421
+ if (!res.ok) {
422
+ let code = null;
423
+ try {
424
+ const errBody = await res.json();
425
+ code = typeof errBody?.error === "string" ? errBody.error : null;
426
+ } catch {
427
+ }
428
+ const err = new Error(`enqueue failed: HTTP ${res.status}${code ? ` (${code})` : ""}`);
429
+ err.status = res.status;
430
+ err.code = code;
431
+ throw err;
432
+ }
397
433
  const json = await res.json();
398
- return json && json.task ? json.task : null;
434
+ const task = json && json.task ? json.task : null;
435
+ if (task && typeof json.deduplicated === "boolean") Object.defineProperty(task, "deduplicated", { value: json.deduplicated, enumerable: false });
436
+ return task;
399
437
  },
400
438
  /**
401
439
  * Resume a failed/cancelled/max-turn partial code-task. The PR watcher uses
@@ -411,6 +449,10 @@ function createControlPlaneClient({
411
449
  * The server inspects the current diff, applies deterministic blockers, runs
412
450
  * consensus, records a receipt, and direct-merges only the inspected SHA.
413
451
  */
452
+ /** F35: promote a PARTIAL draft to READY via the plane (admin-only; server re-checks; never merges). */
453
+ promoteDraftPr: (prNumber, automationContext) => promoteDraftPrRequest(req, prNumber, automationContext, () => {
454
+ cachedFirebaseToken = null;
455
+ }),
414
456
  async mergeVerifiedPr(prNumber, automationContext) {
415
457
  return mergeVerifiedPrRequest(
416
458
  req,