@algosuite/vo-mcp 0.2.0-beta.49 → 0.2.0-beta.51
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.
- package/README.md +2 -0
- package/dist/cli.js +595 -187
- package/dist/cli.js.map +4 -4
- package/dist/index.js +452 -157
- package/dist/index.js.map +4 -4
- package/dist/runner-cli.js +539 -98
- package/dist/runner-cli.js.map +4 -4
- package/dist/runner-supervisor.js +100 -32
- package/dist/runner-supervisor.js.map +4 -4
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
|
@@ -187,6 +212,49 @@ async function mergeVerifiedPrRequest(req, prNumber, automationContext, onUnauth
|
|
|
187
212
|
};
|
|
188
213
|
}
|
|
189
214
|
|
|
215
|
+
// ../../scripts/virtual-office/code-runner/control-plane-weekly-tokens.mjs
|
|
216
|
+
async function postWeeklyTokensRequest(taskReq, { operatorId, runnerId: runnerId2, tokens, claudeWeeklyPct, claudeWeeklyResetsAt }, onUnauthorized = () => {
|
|
217
|
+
}) {
|
|
218
|
+
const body = {
|
|
219
|
+
operator_id: operatorId,
|
|
220
|
+
runner_id: runnerId2,
|
|
221
|
+
input_tokens: tokens.input_tokens,
|
|
222
|
+
output_tokens: tokens.output_tokens,
|
|
223
|
+
cache_creation_tokens: tokens.cache_creation_tokens,
|
|
224
|
+
cache_read_tokens: tokens.cache_read_tokens
|
|
225
|
+
};
|
|
226
|
+
if (typeof claudeWeeklyPct === "number") {
|
|
227
|
+
body.claude_weekly_pct = claudeWeeklyPct;
|
|
228
|
+
}
|
|
229
|
+
if (claudeWeeklyResetsAt !== void 0) {
|
|
230
|
+
body.claude_weekly_resets_at = claudeWeeklyResetsAt;
|
|
231
|
+
}
|
|
232
|
+
const res = await taskReq("POST", "/api/v1/weekly-tokens", body);
|
|
233
|
+
if (res.status === 401) {
|
|
234
|
+
onUnauthorized();
|
|
235
|
+
throw new Error("weekly-tokens unauthorized (401)");
|
|
236
|
+
}
|
|
237
|
+
if (!res.ok) throw new Error(`weekly-tokens failed: HTTP ${res.status}`);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ../../scripts/virtual-office/code-runner/control-plane-telemetry-relay.mjs
|
|
242
|
+
var TELEMETRY_RELAY_TIMEOUT_MS = 3e4;
|
|
243
|
+
async function relayTelemetryEventsRequest(req, { events, source }, onUnauthorized = () => {
|
|
244
|
+
}) {
|
|
245
|
+
const res = await req("POST", "/api/v1/telemetry/relay", { events, ...source ? { source } : {} }, {
|
|
246
|
+
timeoutMs: TELEMETRY_RELAY_TIMEOUT_MS
|
|
247
|
+
});
|
|
248
|
+
if (res.status === 401) onUnauthorized();
|
|
249
|
+
let body = null;
|
|
250
|
+
try {
|
|
251
|
+
body = await res.json();
|
|
252
|
+
} catch {
|
|
253
|
+
body = null;
|
|
254
|
+
}
|
|
255
|
+
return { status: res.status, body };
|
|
256
|
+
}
|
|
257
|
+
|
|
190
258
|
// ../../scripts/virtual-office/code-runner/claim-gate-notice.mjs
|
|
191
259
|
var REASON_HELP = {
|
|
192
260
|
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)",
|
|
@@ -350,9 +418,22 @@ function createControlPlaneClient({
|
|
|
350
418
|
cachedFirebaseToken = null;
|
|
351
419
|
throw new Error("enqueue unauthorized (401)");
|
|
352
420
|
}
|
|
353
|
-
if (!res.ok)
|
|
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
|
+
}
|
|
354
433
|
const json = await res.json();
|
|
355
|
-
|
|
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;
|
|
356
437
|
},
|
|
357
438
|
/**
|
|
358
439
|
* Resume a failed/cancelled/max-turn partial code-task. The PR watcher uses
|
|
@@ -368,6 +449,10 @@ function createControlPlaneClient({
|
|
|
368
449
|
* The server inspects the current diff, applies deterministic blockers, runs
|
|
369
450
|
* consensus, records a receipt, and direct-merges only the inspected SHA.
|
|
370
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
|
+
}),
|
|
371
456
|
async mergeVerifiedPr(prNumber, automationContext) {
|
|
372
457
|
return mergeVerifiedPrRequest(
|
|
373
458
|
req,
|
|
@@ -431,38 +516,21 @@ function createControlPlaneClient({
|
|
|
431
516
|
if (!res.ok) throw new Error(`knowledge-context failed: HTTP ${res.status}`);
|
|
432
517
|
return res.json();
|
|
433
518
|
},
|
|
519
|
+
/** Weekly Claude token usage report — see control-plane-weekly-tokens.mjs. */
|
|
520
|
+
async postWeeklyTokens(report) {
|
|
521
|
+
return postWeeklyTokensRequest(taskReq, report, () => {
|
|
522
|
+
cachedFirebaseToken = null;
|
|
523
|
+
});
|
|
524
|
+
},
|
|
434
525
|
/**
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* is named explicitly. Best-effort; throws on a non-2xx so the caller can
|
|
439
|
-
* log + move on.
|
|
440
|
-
*
|
|
441
|
-
* `tokens` = { input_tokens, output_tokens, cache_creation_tokens, cache_read_tokens }.
|
|
442
|
-
* Optional: `claudeWeeklyPct` (number) + `claudeWeeklyResetsAt` (ISO string | null).
|
|
526
|
+
* Relay a batch of this machine's local vo-mcp events to vo-telemetry via
|
|
527
|
+
* the control plane (telemetry-forwarder.mjs). Returns { status, body };
|
|
528
|
+
* the forwarder owns backoff/disable policy. See control-plane-telemetry-relay.mjs.
|
|
443
529
|
*/
|
|
444
|
-
async
|
|
445
|
-
|
|
446
|
-
operator_id: operatorId,
|
|
447
|
-
runner_id: runnerId3,
|
|
448
|
-
input_tokens: tokens.input_tokens,
|
|
449
|
-
output_tokens: tokens.output_tokens,
|
|
450
|
-
cache_creation_tokens: tokens.cache_creation_tokens,
|
|
451
|
-
cache_read_tokens: tokens.cache_read_tokens
|
|
452
|
-
};
|
|
453
|
-
if (typeof claudeWeeklyPct === "number") {
|
|
454
|
-
body.claude_weekly_pct = claudeWeeklyPct;
|
|
455
|
-
}
|
|
456
|
-
if (claudeWeeklyResetsAt !== void 0) {
|
|
457
|
-
body.claude_weekly_resets_at = claudeWeeklyResetsAt;
|
|
458
|
-
}
|
|
459
|
-
const res = await taskReq("POST", "/api/v1/weekly-tokens", body);
|
|
460
|
-
if (res.status === 401) {
|
|
530
|
+
async relayTelemetryEvents(batch) {
|
|
531
|
+
return relayTelemetryEventsRequest(req, batch, () => {
|
|
461
532
|
cachedFirebaseToken = null;
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
if (!res.ok) throw new Error(`weekly-tokens failed: HTTP ${res.status}`);
|
|
465
|
-
return true;
|
|
533
|
+
});
|
|
466
534
|
},
|
|
467
535
|
/**
|
|
468
536
|
* Send a liveness heartbeat (M2). The control-plane upserts it under the
|