@botiverse/raft-computer 0.0.38 → 0.0.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.
- package/dist/index.js +18 -36
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32027,39 +32027,41 @@ async function runSeaUpgrade(opts) {
|
|
|
32027
32027
|
emit7("restarting", "restarting service on new version");
|
|
32028
32028
|
return { ok: true, swap };
|
|
32029
32029
|
}
|
|
32030
|
-
async function
|
|
32031
|
-
const url =
|
|
32030
|
+
async function fetchCdnLatestVersion(baseUrl, fetchFn = fetch) {
|
|
32031
|
+
const url = `${baseUrl.replace(/\/$/, "")}/manifest.json`;
|
|
32032
32032
|
const controller = new AbortController();
|
|
32033
32033
|
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
32034
32034
|
try {
|
|
32035
32035
|
const res = await fetchFn(url, { signal: controller.signal, headers: { accept: "application/json" } });
|
|
32036
32036
|
if (!res.ok) return null;
|
|
32037
32037
|
const data = await res.json();
|
|
32038
|
-
return data
|
|
32038
|
+
return typeof data.version === "string" && data.version.length > 0 ? data.version : null;
|
|
32039
32039
|
} catch {
|
|
32040
32040
|
return null;
|
|
32041
32041
|
} finally {
|
|
32042
32042
|
clearTimeout(timeoutId);
|
|
32043
32043
|
}
|
|
32044
32044
|
}
|
|
32045
|
-
async function resolveSeaTargetVersion(channel2,
|
|
32045
|
+
async function resolveSeaTargetVersion(channel2, baseUrl, fetchLatest = fetchCdnLatestVersion) {
|
|
32046
32046
|
if (channel2.startsWith("pinned:")) {
|
|
32047
32047
|
const v = channel2.slice("pinned:".length);
|
|
32048
32048
|
return SEMVER_RE.test(v) ? v : null;
|
|
32049
32049
|
}
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32050
|
+
if (channel2 === "latest") {
|
|
32051
|
+
return await fetchLatest(baseUrl);
|
|
32052
|
+
}
|
|
32053
|
+
return null;
|
|
32053
32054
|
}
|
|
32054
32055
|
async function resolveAndRunSeaUpgrade(opts) {
|
|
32055
32056
|
const d = opts.deps ?? {};
|
|
32057
|
+
const baseUrl = d.baseUrl ?? resolveUpgradeBaseUrl();
|
|
32056
32058
|
let targetVersion;
|
|
32057
32059
|
try {
|
|
32058
32060
|
if (d.resolveTargetVersion) {
|
|
32059
32061
|
targetVersion = await d.resolveTargetVersion();
|
|
32060
32062
|
} else {
|
|
32061
32063
|
const channel2 = await (d.readChannelFn ?? readChannel)(opts.slockHome);
|
|
32062
|
-
targetVersion = await resolveSeaTargetVersion(channel2, d.
|
|
32064
|
+
targetVersion = await resolveSeaTargetVersion(channel2, baseUrl, d.fetchLatestVersion);
|
|
32063
32065
|
}
|
|
32064
32066
|
} catch (e) {
|
|
32065
32067
|
return { ok: false, failedPhase: "resolve", reason: e instanceof Error ? e.message : String(e) };
|
|
@@ -32080,7 +32082,7 @@ async function resolveAndRunSeaUpgrade(opts) {
|
|
|
32080
32082
|
platform: opts.platform,
|
|
32081
32083
|
arch: opts.arch,
|
|
32082
32084
|
deps: {
|
|
32083
|
-
baseUrl
|
|
32085
|
+
baseUrl,
|
|
32084
32086
|
fetchFn: d.fetchFn,
|
|
32085
32087
|
onProgress: d.onProgress,
|
|
32086
32088
|
stageFn: d.stageFn,
|
|
@@ -33737,19 +33739,17 @@ async function runUpgradeCli(slockHome, opts, deps = {}) {
|
|
|
33737
33739
|
} else if (channel2.startsWith("pinned:")) {
|
|
33738
33740
|
targetVersion = channel2.slice("pinned:".length);
|
|
33739
33741
|
} else {
|
|
33740
|
-
const
|
|
33741
|
-
|
|
33742
|
-
|
|
33743
|
-
|
|
33744
|
-
|
|
33745
|
-
|
|
33746
|
-
);
|
|
33742
|
+
const baseUrl = (deps.resolveUpgradeBaseUrlFn ?? resolveUpgradeBaseUrl)();
|
|
33743
|
+
let resolved;
|
|
33744
|
+
try {
|
|
33745
|
+
resolved = await resolveSeaTargetVersion(channel2, baseUrl, deps.fetchLatestVersion);
|
|
33746
|
+
} catch {
|
|
33747
|
+
resolved = null;
|
|
33747
33748
|
}
|
|
33748
|
-
const resolved = tags[channel2];
|
|
33749
33749
|
if (typeof resolved !== "string" || resolved.length === 0) {
|
|
33750
33750
|
fail(
|
|
33751
33751
|
"UPGRADE_VERSION_RESOLVE_FAILED",
|
|
33752
|
-
`
|
|
33752
|
+
`Could not resolve channel "${channel2}" to a version from ${baseUrl}/manifest.json. Only \`latest\` and \`pinned:<semver>\` are served from the CDN \u2014 for any other channel pass --target-version <semver>, or check connectivity.`
|
|
33753
33753
|
);
|
|
33754
33754
|
}
|
|
33755
33755
|
targetVersion = resolved;
|
|
@@ -33847,24 +33847,6 @@ async function runUpgradeCli(slockHome, opts, deps = {}) {
|
|
|
33847
33847
|
`Upgrade failed at phase=${result.failedPhase ?? "stage"}: ${result.reason ?? "unknown"}.`
|
|
33848
33848
|
);
|
|
33849
33849
|
}
|
|
33850
|
-
async function defaultFetchDistTags() {
|
|
33851
|
-
const url = `https://registry.npmjs.org/${COMPUTER_PACKAGE_NAME}`;
|
|
33852
|
-
const controller = new AbortController();
|
|
33853
|
-
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
33854
|
-
try {
|
|
33855
|
-
const res = await fetch(url, {
|
|
33856
|
-
signal: controller.signal,
|
|
33857
|
-
headers: { accept: "application/json" }
|
|
33858
|
-
});
|
|
33859
|
-
if (!res.ok) return null;
|
|
33860
|
-
const data = await res.json();
|
|
33861
|
-
return data["dist-tags"] ?? null;
|
|
33862
|
-
} catch {
|
|
33863
|
-
return null;
|
|
33864
|
-
} finally {
|
|
33865
|
-
clearTimeout(timeoutId);
|
|
33866
|
-
}
|
|
33867
|
-
}
|
|
33868
33850
|
function defaultCurrentBinaryDir() {
|
|
33869
33851
|
const here = fileURLToPath3(import.meta.url);
|
|
33870
33852
|
return dirname12(dirname12(here));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/raft-computer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"description": "Canonical Raft Computer — standalone human/local-machine control-plane CLI (login + attach). Provides raft-computer plus the legacy slock-computer alias; distinct from the agent-facing @botiverse/raft CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
32
|
"proper-lockfile": "^4.1.2",
|
|
33
33
|
"undici": "^7.24.7",
|
|
34
|
-
"@botiverse/raft-daemon": "0.
|
|
34
|
+
"@botiverse/raft-daemon": "0.59.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.5.0",
|