@algosuite/vo-mcp 0.2.0-beta.30 → 0.2.0-beta.34

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.
@@ -2060,6 +2060,92 @@ async function finishPendingActivation({
2060
2060
  }
2061
2061
  }
2062
2062
 
2063
+ // src/runner/supervisor-child-entry.mjs
2064
+ var VERSION_RE2 = /^(?:[\w.-]+\/)?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u;
2065
+ function parseRuntimeVersion(value) {
2066
+ if (typeof value !== "string") return null;
2067
+ const match = VERSION_RE2.exec(value.trim());
2068
+ if (!match) return null;
2069
+ const prerelease = match[4] ? match[4].split(".").map((part) => /^\d+$/u.test(part) ? Number(part) : part) : null;
2070
+ return { release: [Number(match[1]), Number(match[2]), Number(match[3])], prerelease };
2071
+ }
2072
+ function compareRuntimeVersions(a, b) {
2073
+ for (let i = 0; i < 3; i += 1) {
2074
+ const av = a.release[i] ?? 0;
2075
+ const bv = b.release[i] ?? 0;
2076
+ if (av !== bv) return av < bv ? -1 : 1;
2077
+ }
2078
+ if (!a.prerelease && !b.prerelease) return 0;
2079
+ if (!a.prerelease) return 1;
2080
+ if (!b.prerelease) return -1;
2081
+ const len = Math.max(a.prerelease.length, b.prerelease.length);
2082
+ for (let i = 0; i < len; i += 1) {
2083
+ const av = a.prerelease[i];
2084
+ const bv = b.prerelease[i];
2085
+ if (av === void 0) return -1;
2086
+ if (bv === void 0) return 1;
2087
+ if (av === bv) continue;
2088
+ const aNum = typeof av === "number";
2089
+ const bNum = typeof bv === "number";
2090
+ if (aNum && bNum) return av < bv ? -1 : 1;
2091
+ if (aNum !== bNum) return aNum ? -1 : 1;
2092
+ return String(av) < String(bv) ? -1 : 1;
2093
+ }
2094
+ return 0;
2095
+ }
2096
+ function resolveSupervisorChildEntry({
2097
+ runtimeRoot,
2098
+ bundledEntry,
2099
+ bundledVersion,
2100
+ readPointer = readActivation,
2101
+ validate = validateSlot
2102
+ }) {
2103
+ const bundled = (detail) => ({
2104
+ // The bundled entry is `dist/runner-cli.js`, which IS the daemon and takes
2105
+ // no subcommand. The slot entry is `bin/vo-mcp`, the multiplexed CLI, which
2106
+ // needs the `runner` subcommand — the same argv the proven rollback path
2107
+ // (`launchPreviousChild`) uses.
2108
+ args: [bundledEntry],
2109
+ entry: bundledEntry,
2110
+ source: "bundled",
2111
+ version: String(bundledVersion || "unknown"),
2112
+ descriptor: `bundled ${bundledVersion || "unknown"} ${bundledEntry}`,
2113
+ detail
2114
+ });
2115
+ if (!runtimeRoot) return bundled("no runtime root");
2116
+ let pointer;
2117
+ try {
2118
+ pointer = readPointer(runtimeRoot);
2119
+ } catch (error) {
2120
+ return bundled(`activation pointer unreadable: ${error instanceof Error ? error.message : String(error)}`);
2121
+ }
2122
+ if (!pointer?.active) return bundled("no activated runtime slot");
2123
+ if (pointer.pending) return bundled("runtime activation still pending");
2124
+ const activeVersion = parseRuntimeVersion(pointer.active.version);
2125
+ const currentVersion = parseRuntimeVersion(bundledVersion);
2126
+ if (!activeVersion) return bundled(`active slot version unparseable: ${String(pointer.active.version)}`);
2127
+ if (!currentVersion) return bundled(`bundled version unparseable: ${String(bundledVersion)}`);
2128
+ if (compareRuntimeVersions(activeVersion, currentVersion) <= 0) {
2129
+ return bundled(`active slot ${pointer.active.version} is not newer than bundled ${bundledVersion}`);
2130
+ }
2131
+ let validated;
2132
+ try {
2133
+ validated = validate(runtimeRoot, pointer.active);
2134
+ } catch (error) {
2135
+ return bundled(`slot validation threw: ${error instanceof Error ? error.message : String(error)}`);
2136
+ }
2137
+ if (!validated?.ok) return bundled(`active slot invalid: ${validated?.detail || "unknown"}`);
2138
+ const entry = validated.paths.entry;
2139
+ return {
2140
+ args: [entry, "runner"],
2141
+ entry,
2142
+ source: "active-slot",
2143
+ version: pointer.active.version,
2144
+ descriptor: `active-slot ${pointer.active.version} ${entry}`,
2145
+ detail: `activated slot ${pointer.active.slot_id}`
2146
+ };
2147
+ }
2148
+
2063
2149
  // src/runner/supervisor-child-env.mjs
2064
2150
  import { hostname as systemHostname } from "node:os";
2065
2151
 
@@ -2283,7 +2369,8 @@ var CHILD_START_MS = 1500;
2283
2369
  var SUPERVISOR_CAPABILITIES = ["bundled-runtime-slots-v1", "legacy-orphan-purge-v1"];
2284
2370
  var UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
2285
2371
  var selfPath = fileURLToPath3(import.meta.url);
2286
- var childEntry = join5(dirname4(selfPath), "runner-cli.js");
2372
+ var bundledChildEntry = join5(dirname4(selfPath), "runner-cli.js");
2373
+ var supervisorRuntimeRoot = runtimeRootFromEnv(process.env);
2287
2374
  var sleep = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
2288
2375
  var runnerId = resolveSupervisorRunnerId(process.env);
2289
2376
  function packageVersion() {
@@ -2304,8 +2391,18 @@ var supervisorControlIdentity = {
2304
2391
  supervisorVersion,
2305
2392
  capabilities: SUPERVISOR_CAPABILITIES
2306
2393
  };
2394
+ var lastResolvedChildDescriptor = null;
2307
2395
  function spawnChild(childEnv) {
2308
- return spawn(process.execPath, [childEntry], {
2396
+ const resolved = resolveSupervisorChildEntry({
2397
+ runtimeRoot: supervisorRuntimeRoot,
2398
+ bundledEntry: bundledChildEntry,
2399
+ bundledVersion: supervisorVersion
2400
+ });
2401
+ if (resolved.descriptor !== lastResolvedChildDescriptor) {
2402
+ console.error(`[vo-runner supervisor] child entry -> ${resolved.descriptor} (${resolved.detail})`);
2403
+ lastResolvedChildDescriptor = resolved.descriptor;
2404
+ }
2405
+ return spawn(process.execPath, resolved.args, {
2309
2406
  env: childEnv,
2310
2407
  stdio: "inherit",
2311
2408
  windowsHide: true