@botiverse/raft-computer 0.0.56 → 0.0.58
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 +608 -248
- package/dist/lib/index.js +62 -54
- package/package.json +2 -2
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
|
|
324
|
-
import { dirname as
|
|
323
|
+
import { chmod as chmod6, mkdir as mkdir12, readFile as readFile11, rename as rename4, rm as rm3, writeFile as writeFile10 } from "fs/promises";
|
|
324
|
+
import { dirname as dirname10 } from "path";
|
|
325
325
|
import { fetch as fetch4 } from "undici";
|
|
326
326
|
|
|
327
327
|
// src/serverState.ts
|
|
@@ -490,8 +490,8 @@ function readComputerVersion(moduleUrl = import.meta.url) {
|
|
|
490
490
|
var COMPUTER_VERSION = readComputerVersion();
|
|
491
491
|
|
|
492
492
|
// src/service.ts
|
|
493
|
-
import { mkdir as
|
|
494
|
-
import { dirname as
|
|
493
|
+
import { mkdir as mkdir11, readFile as readFile10, writeFile as writeFile9, open, rename as rename3 } from "fs/promises";
|
|
494
|
+
import { dirname as dirname9, join as joinPath } from "path";
|
|
495
495
|
import { fileURLToPath } from "url";
|
|
496
496
|
|
|
497
497
|
// src/cleanup.ts
|
|
@@ -599,60 +599,19 @@ import { join as join4 } from "path";
|
|
|
599
599
|
import { readFile as readFile7, writeFile as writeFile7, mkdir as mkdir8 } from "fs/promises";
|
|
600
600
|
import { dirname as dirname7 } from "path";
|
|
601
601
|
|
|
602
|
-
// src/
|
|
603
|
-
|
|
602
|
+
// src/internal/ipc-server.ts
|
|
603
|
+
import { connect, createServer } from "net";
|
|
604
|
+
import { chmod as chmod5, mkdir as mkdir10, stat as stat4, unlink as unlink5 } from "fs/promises";
|
|
605
|
+
import { dirname as dirname8 } from "path";
|
|
604
606
|
|
|
605
|
-
// src/
|
|
606
|
-
var
|
|
607
|
-
"empty-intersection",
|
|
608
|
-
"explicit-zero",
|
|
609
|
-
"eof",
|
|
610
|
-
"non-tty",
|
|
611
|
-
"server-unavailable"
|
|
612
|
-
];
|
|
613
|
-
async function pickMigrationCandidateFromInput(candidates, read, write) {
|
|
614
|
-
write(
|
|
615
|
-
"Migration: detected legacy daemon(s) on this Computer that match the target server.\n"
|
|
616
|
-
);
|
|
617
|
-
candidates.forEach((c, i) => {
|
|
618
|
-
const host = c.hostname ? ` (${c.hostname})` : "";
|
|
619
|
-
const seen = c.lastSeenAt ? ` last seen ${c.lastSeenAt}` : "";
|
|
620
|
-
write(` ${i + 1}. ${c.machineName}${host}${seen}
|
|
621
|
-
`);
|
|
622
|
-
write(` local: ${c.localPath}
|
|
623
|
-
`);
|
|
624
|
-
});
|
|
625
|
-
write(" 0. Fresh attach (skip migration)\n");
|
|
626
|
-
write(" m. Migrate from a different on-disk path\n");
|
|
627
|
-
while (true) {
|
|
628
|
-
write("Choose [1]: ");
|
|
629
|
-
const { line, eof } = await read();
|
|
630
|
-
if (eof) return { kind: "fresh" };
|
|
631
|
-
const trimmed = line.trim();
|
|
632
|
-
const norm = trimmed.toLowerCase();
|
|
633
|
-
if (norm === "m") {
|
|
634
|
-
write("Path to legacy machine dir or owner.json: ");
|
|
635
|
-
const { line: pathLine } = await read();
|
|
636
|
-
return { kind: "manual", path: pathLine.trim() };
|
|
637
|
-
}
|
|
638
|
-
if (norm.length === 0) return { kind: "candidate", index: 0 };
|
|
639
|
-
if (norm === "0") return { kind: "fresh" };
|
|
640
|
-
const n = Number.parseInt(norm, 10);
|
|
641
|
-
if (Number.isFinite(n) && String(n) === norm && n >= 1 && n <= candidates.length) {
|
|
642
|
-
return { kind: "candidate", index: n - 1 };
|
|
643
|
-
}
|
|
644
|
-
write(
|
|
645
|
-
`Invalid selection "${trimmed}". Enter 1..${candidates.length}, 0, or m.
|
|
646
|
-
`
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
607
|
+
// src/internal/ipc-codec.ts
|
|
608
|
+
var MAX_FRAME_BYTES = 1024 * 1024;
|
|
650
609
|
|
|
651
610
|
// src/status.ts
|
|
652
|
-
import { readFile as
|
|
611
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
653
612
|
async function readUserSession(path2) {
|
|
654
613
|
try {
|
|
655
|
-
const parsed = JSON.parse(await
|
|
614
|
+
const parsed = JSON.parse(await readFile9(path2, "utf8"));
|
|
656
615
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
657
616
|
return { state: "present", session: parsed, error: null };
|
|
658
617
|
}
|
|
@@ -782,6 +741,55 @@ async function listRunners(installRoot, opts = {}) {
|
|
|
782
741
|
return { servers };
|
|
783
742
|
}
|
|
784
743
|
|
|
744
|
+
// src/service.ts
|
|
745
|
+
var seaRequire = createRequire2(import.meta.url);
|
|
746
|
+
|
|
747
|
+
// src/setup.ts
|
|
748
|
+
var MIGRATION_FRESH_TRIGGERS = [
|
|
749
|
+
"empty-intersection",
|
|
750
|
+
"explicit-zero",
|
|
751
|
+
"eof",
|
|
752
|
+
"non-tty",
|
|
753
|
+
"server-unavailable"
|
|
754
|
+
];
|
|
755
|
+
async function pickMigrationCandidateFromInput(candidates, read, write) {
|
|
756
|
+
write(
|
|
757
|
+
"Migration: detected legacy daemon(s) on this Computer that match the target server.\n"
|
|
758
|
+
);
|
|
759
|
+
candidates.forEach((c, i) => {
|
|
760
|
+
const host = c.hostname ? ` (${c.hostname})` : "";
|
|
761
|
+
const seen = c.lastSeenAt ? ` last seen ${c.lastSeenAt}` : "";
|
|
762
|
+
write(` ${i + 1}. ${c.machineName}${host}${seen}
|
|
763
|
+
`);
|
|
764
|
+
write(` local: ${c.localPath}
|
|
765
|
+
`);
|
|
766
|
+
});
|
|
767
|
+
write(" 0. Fresh attach (skip migration)\n");
|
|
768
|
+
write(" m. Migrate from a different on-disk path\n");
|
|
769
|
+
while (true) {
|
|
770
|
+
write("Choose [1]: ");
|
|
771
|
+
const { line, eof } = await read();
|
|
772
|
+
if (eof) return { kind: "fresh" };
|
|
773
|
+
const trimmed = line.trim();
|
|
774
|
+
const norm = trimmed.toLowerCase();
|
|
775
|
+
if (norm === "m") {
|
|
776
|
+
write("Path to legacy machine dir or owner.json: ");
|
|
777
|
+
const { line: pathLine } = await read();
|
|
778
|
+
return { kind: "manual", path: pathLine.trim() };
|
|
779
|
+
}
|
|
780
|
+
if (norm.length === 0) return { kind: "candidate", index: 0 };
|
|
781
|
+
if (norm === "0") return { kind: "fresh" };
|
|
782
|
+
const n = Number.parseInt(norm, 10);
|
|
783
|
+
if (Number.isFinite(n) && String(n) === norm && n >= 1 && n <= candidates.length) {
|
|
784
|
+
return { kind: "candidate", index: n - 1 };
|
|
785
|
+
}
|
|
786
|
+
write(
|
|
787
|
+
`Invalid selection "${trimmed}". Enter 1..${candidates.length}, 0, or m.
|
|
788
|
+
`
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
785
793
|
// src/lib/state.ts
|
|
786
794
|
var RUNNER_STATE_VALUES = [
|
|
787
795
|
"starting",
|
|
@@ -805,7 +813,7 @@ function isServiceState(value) {
|
|
|
805
813
|
}
|
|
806
814
|
|
|
807
815
|
// src/upgradeLog.ts
|
|
808
|
-
import { chmod as
|
|
816
|
+
import { chmod as chmod7, mkdir as mkdir13, open as open2 } from "fs/promises";
|
|
809
817
|
var UPGRADE_ERROR_CODES = [
|
|
810
818
|
"UPGRADE_DEPS_CHANGED",
|
|
811
819
|
"UPGRADE_NETWORK_FAILED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botiverse/raft-computer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.58",
|
|
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.61.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.5.0",
|