@botiverse/raft-computer 0.0.58 → 0.0.59
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 +818 -437
- package/dist/lib/index.d.ts +9 -5
- package/dist/lib/index.js +38 -51
- package/package.json +2 -2
package/dist/lib/index.d.ts
CHANGED
|
@@ -608,12 +608,16 @@ declare function listRunners(installRoot: string, opts?: {
|
|
|
608
608
|
|
|
609
609
|
type UpgradeTrigger = "cli" | "web" | "tray";
|
|
610
610
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
611
|
+
* Closed-set of upgrade-failure codes. Adding / renaming / deleting any value
|
|
612
|
+
* requires an RFC bump (locked discipline). This constant array is the runtime
|
|
613
|
+
* source of truth for the `assertUpgradeLogEntry` membership check; the type
|
|
614
|
+
* alias below mirrors it.
|
|
615
|
+
*
|
|
616
|
+
* `UPGRADE_DEPS_CHANGED` / `UPGRADE_RESTART_FAILED` were carried over from the
|
|
617
|
+
* retired npm-pack upgrade path and never emitted on the SEA-only path; they
|
|
618
|
+
* are removed (no released consumer existed — Computer is unreleased).
|
|
615
619
|
*/
|
|
616
|
-
declare const UPGRADE_ERROR_CODES: readonly ["
|
|
620
|
+
declare const UPGRADE_ERROR_CODES: readonly ["UPGRADE_NETWORK_FAILED", "UPGRADE_INTEGRITY_FAILED", "UPGRADE_SWAP_FAILED", "UPGRADE_NO_TARGET", "UPGRADE_ALREADY_RUNNING"];
|
|
617
621
|
type UpgradeErrorCode = (typeof UPGRADE_ERROR_CODES)[number];
|
|
618
622
|
interface UpgradeBundle {
|
|
619
623
|
computerVersion: string;
|
package/dist/lib/index.js
CHANGED
|
@@ -320,8 +320,8 @@ var RunnersClient = class {
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
// src/setup.ts
|
|
323
|
-
import { chmod as chmod6, mkdir as
|
|
324
|
-
import { dirname as
|
|
323
|
+
import { chmod as chmod6, mkdir as mkdir13, readFile as readFile12, rename as rename4, rm as rm3, writeFile as writeFile11 } from "fs/promises";
|
|
324
|
+
import { dirname as dirname11 } from "path";
|
|
325
325
|
import { fetch as fetch4 } from "undici";
|
|
326
326
|
|
|
327
327
|
// src/serverState.ts
|
|
@@ -358,9 +358,6 @@ function serverDir(slockHome, serverId) {
|
|
|
358
358
|
function serverAttachmentPath(slockHome, serverId) {
|
|
359
359
|
return path.join(serverDir(slockHome, serverId), "runner.state.json");
|
|
360
360
|
}
|
|
361
|
-
function legacyServerAttachmentPath(slockHome, serverId) {
|
|
362
|
-
return path.join(serverDir(slockHome, serverId), "attachment.json");
|
|
363
|
-
}
|
|
364
361
|
function serverRunnerPidPath(slockHome, serverId) {
|
|
365
362
|
return path.join(serverDir(slockHome, serverId), "server-runner.pid");
|
|
366
363
|
}
|
|
@@ -376,18 +373,8 @@ function serviceRunDir(slockHome) {
|
|
|
376
373
|
function servicePidPath(slockHome) {
|
|
377
374
|
return path.join(serviceRunDir(slockHome), "service.pid");
|
|
378
375
|
}
|
|
379
|
-
function legacyServicePidPath(slockHome) {
|
|
380
|
-
return path.join(computerDir(slockHome), "service.pid");
|
|
381
|
-
}
|
|
382
|
-
function legacySupervisorPidPath(slockHome) {
|
|
383
|
-
return path.join(computerDir(slockHome), "supervisor.pid");
|
|
384
|
-
}
|
|
385
376
|
function servicePidReadFallback(slockHome) {
|
|
386
|
-
return [
|
|
387
|
-
servicePidPath(slockHome),
|
|
388
|
-
legacyServicePidPath(slockHome),
|
|
389
|
-
legacySupervisorPidPath(slockHome)
|
|
390
|
-
];
|
|
377
|
+
return [servicePidPath(slockHome)];
|
|
391
378
|
}
|
|
392
379
|
function serviceLogPath(slockHome) {
|
|
393
380
|
return path.join(serviceRunDir(slockHome), "service.log");
|
|
@@ -423,14 +410,7 @@ async function readAttachmentAt(path2) {
|
|
|
423
410
|
}
|
|
424
411
|
async function readServerAttachment(slockHome, serverId) {
|
|
425
412
|
if (!isValidServerId(serverId)) return null;
|
|
426
|
-
|
|
427
|
-
const legacy = await readAttachmentAt(legacyServerAttachmentPath(slockHome, serverId));
|
|
428
|
-
if (!current) return legacy;
|
|
429
|
-
if (!legacy) return current;
|
|
430
|
-
if (legacy.adoptedFromLegacy === true && current.adoptedFromLegacy !== true && legacy.serverMachineId !== current.serverMachineId) {
|
|
431
|
-
return legacy;
|
|
432
|
-
}
|
|
433
|
-
return current;
|
|
413
|
+
return readAttachmentAt(serverAttachmentPath(slockHome, serverId));
|
|
434
414
|
}
|
|
435
415
|
async function listAttachedServerIds(slockHome) {
|
|
436
416
|
let entries;
|
|
@@ -490,8 +470,8 @@ function readComputerVersion(moduleUrl = import.meta.url) {
|
|
|
490
470
|
var COMPUTER_VERSION = readComputerVersion();
|
|
491
471
|
|
|
492
472
|
// src/service.ts
|
|
493
|
-
import { mkdir as
|
|
494
|
-
import { dirname as
|
|
473
|
+
import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile10, open, rename as rename3 } from "fs/promises";
|
|
474
|
+
import { dirname as dirname10, join as joinPath } from "path";
|
|
495
475
|
import { fileURLToPath } from "url";
|
|
496
476
|
|
|
497
477
|
// src/cleanup.ts
|
|
@@ -741,7 +721,38 @@ async function listRunners(installRoot, opts = {}) {
|
|
|
741
721
|
return { servers };
|
|
742
722
|
}
|
|
743
723
|
|
|
724
|
+
// src/serviceState.ts
|
|
725
|
+
import { mkdir as mkdir11, readFile as readFile10, writeFile as writeFile9, appendFile as appendFile3 } from "fs/promises";
|
|
726
|
+
import { dirname as dirname9 } from "path";
|
|
727
|
+
|
|
728
|
+
// src/lib/state.ts
|
|
729
|
+
var RUNNER_STATE_VALUES = [
|
|
730
|
+
"starting",
|
|
731
|
+
"running",
|
|
732
|
+
"degraded",
|
|
733
|
+
"crashed",
|
|
734
|
+
"stopped"
|
|
735
|
+
];
|
|
736
|
+
function isRunnerState(value) {
|
|
737
|
+
return typeof value === "string" && RUNNER_STATE_VALUES.includes(value);
|
|
738
|
+
}
|
|
739
|
+
var SERVICE_STATE_VALUES = [
|
|
740
|
+
"starting",
|
|
741
|
+
"running",
|
|
742
|
+
"degraded",
|
|
743
|
+
"stopping",
|
|
744
|
+
"stopped"
|
|
745
|
+
];
|
|
746
|
+
function isServiceState(value) {
|
|
747
|
+
return typeof value === "string" && SERVICE_STATE_VALUES.includes(value);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// src/lib/ipc-client.ts
|
|
751
|
+
import { connect as connect2 } from "net";
|
|
752
|
+
import { randomUUID } from "crypto";
|
|
753
|
+
|
|
744
754
|
// src/service.ts
|
|
755
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
745
756
|
var seaRequire = createRequire2(import.meta.url);
|
|
746
757
|
|
|
747
758
|
// src/setup.ts
|
|
@@ -790,36 +801,12 @@ async function pickMigrationCandidateFromInput(candidates, read, write) {
|
|
|
790
801
|
}
|
|
791
802
|
}
|
|
792
803
|
|
|
793
|
-
// src/lib/state.ts
|
|
794
|
-
var RUNNER_STATE_VALUES = [
|
|
795
|
-
"starting",
|
|
796
|
-
"running",
|
|
797
|
-
"degraded",
|
|
798
|
-
"crashed",
|
|
799
|
-
"stopped"
|
|
800
|
-
];
|
|
801
|
-
function isRunnerState(value) {
|
|
802
|
-
return typeof value === "string" && RUNNER_STATE_VALUES.includes(value);
|
|
803
|
-
}
|
|
804
|
-
var SERVICE_STATE_VALUES = [
|
|
805
|
-
"starting",
|
|
806
|
-
"running",
|
|
807
|
-
"degraded",
|
|
808
|
-
"stopping",
|
|
809
|
-
"stopped"
|
|
810
|
-
];
|
|
811
|
-
function isServiceState(value) {
|
|
812
|
-
return typeof value === "string" && SERVICE_STATE_VALUES.includes(value);
|
|
813
|
-
}
|
|
814
|
-
|
|
815
804
|
// src/upgradeLog.ts
|
|
816
|
-
import { chmod as chmod7, mkdir as
|
|
805
|
+
import { chmod as chmod7, mkdir as mkdir14, open as open2 } from "fs/promises";
|
|
817
806
|
var UPGRADE_ERROR_CODES = [
|
|
818
|
-
"UPGRADE_DEPS_CHANGED",
|
|
819
807
|
"UPGRADE_NETWORK_FAILED",
|
|
820
808
|
"UPGRADE_INTEGRITY_FAILED",
|
|
821
809
|
"UPGRADE_SWAP_FAILED",
|
|
822
|
-
"UPGRADE_RESTART_FAILED",
|
|
823
810
|
"UPGRADE_NO_TARGET",
|
|
824
811
|
"UPGRADE_ALREADY_RUNNING"
|
|
825
812
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/raft-computer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
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.62.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.5.0",
|