@rotifer/playground 0.8.6 → 0.9.0
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/CHANGELOG.md +75 -0
- package/README.md +16 -18
- package/README.zh.md +15 -17
- package/dist/cloud/auth.d.ts +14 -4
- package/dist/cloud/auth.d.ts.map +1 -1
- package/dist/cloud/auth.js +19 -7
- package/dist/cloud/auth.js.map +1 -1
- package/dist/cloud/badge.d.ts +42 -0
- package/dist/cloud/badge.d.ts.map +1 -0
- package/dist/cloud/badge.js +67 -0
- package/dist/cloud/badge.js.map +1 -0
- package/dist/cloud/client.d.ts +14 -0
- package/dist/cloud/client.d.ts.map +1 -1
- package/dist/cloud/client.js +54 -13
- package/dist/cloud/client.js.map +1 -1
- package/dist/cloud/gene-ref.d.ts +41 -0
- package/dist/cloud/gene-ref.d.ts.map +1 -0
- package/dist/cloud/gene-ref.js +45 -0
- package/dist/cloud/gene-ref.js.map +1 -0
- package/dist/cloud/index.d.ts +1 -0
- package/dist/cloud/index.d.ts.map +1 -1
- package/dist/cloud/index.js +1 -0
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/types.d.ts +2 -0
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/types.js +2 -1
- package/dist/cloud/types.js.map +1 -1
- package/dist/commands/agent-list.d.ts.map +1 -1
- package/dist/commands/agent-list.js +8 -1
- package/dist/commands/agent-list.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +21 -5
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +58 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/hello.d.ts.map +1 -1
- package/dist/commands/hello.js +45 -6
- package/dist/commands/hello.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.js +3 -3
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +172 -64
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +47 -0
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/reputation.d.ts.map +1 -1
- package/dist/commands/reputation.js +51 -10
- package/dist/commands/reputation.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +7 -1
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/user-config.js +2 -2
- package/dist/commands/user-config.js.map +1 -1
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +34 -3
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/vg.d.ts.map +1 -1
- package/dist/commands/vg.js +7 -25
- package/dist/commands/vg.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +7 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/wrap.d.ts.map +1 -1
- package/dist/commands/wrap.js +25 -2
- package/dist/commands/wrap.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types/phenotype.d.ts +181 -0
- package/dist/types/phenotype.d.ts.map +1 -0
- package/dist/types/phenotype.js +87 -0
- package/dist/types/phenotype.js.map +1 -0
- package/dist/utils/binding.d.ts +28 -4
- package/dist/utils/binding.d.ts.map +1 -1
- package/dist/utils/binding.js +34 -12
- package/dist/utils/binding.js.map +1 -1
- package/dist/utils/config.js +1 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/javy-compiler.d.ts +32 -1
- package/dist/utils/javy-compiler.d.ts.map +1 -1
- package/dist/utils/javy-compiler.js +136 -12
- package/dist/utils/javy-compiler.js.map +1 -1
- package/dist/utils/p2p-daemon.d.ts +30 -0
- package/dist/utils/p2p-daemon.d.ts.map +1 -0
- package/dist/utils/p2p-daemon.js +199 -0
- package/dist/utils/p2p-daemon.js.map +1 -0
- package/dist/utils/phenotype-validator.d.ts.map +1 -1
- package/dist/utils/phenotype-validator.js +197 -2
- package/dist/utils/phenotype-validator.js.map +1 -1
- package/dist/utils/project-root.js +1 -1
- package/dist/utils/project-root.js.map +1 -1
- package/dist/utils/user-config.d.ts +2 -0
- package/dist/utils/user-config.d.ts.map +1 -1
- package/dist/utils/user-config.js +12 -2
- package/dist/utils/user-config.js.map +1 -1
- package/package.json +13 -10
- package/scripts/postinstall.js +1 -1
|
@@ -33,6 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ToolchainError = exports.AsyncExpressError = void 0;
|
|
37
|
+
exports.detectAsyncExpress = detectAsyncExpress;
|
|
38
|
+
exports.preflightToolchain = preflightToolchain;
|
|
39
|
+
exports.resolveActiveNpxPath = resolveActiveNpxPath;
|
|
40
|
+
exports.toolchainOk = toolchainOk;
|
|
41
|
+
exports.formatToolchainReport = formatToolchainReport;
|
|
42
|
+
exports.buildToolchainErrorMessage = buildToolchainErrorMessage;
|
|
43
|
+
exports.isWasmStale = isWasmStale;
|
|
36
44
|
exports.compileTypeScriptToWasm = compileTypeScriptToWasm;
|
|
37
45
|
exports.isJavyAvailable = isJavyAvailable;
|
|
38
46
|
exports.findGeneSource = findGeneSource;
|
|
@@ -40,6 +48,114 @@ const node_child_process_1 = require("node:child_process");
|
|
|
40
48
|
const node_fs_1 = require("node:fs");
|
|
41
49
|
const node_path_1 = require("node:path");
|
|
42
50
|
const display = __importStar(require("./display.js"));
|
|
51
|
+
/** Gene source declares an async/Promise-returning express() — incompatible with Javy/QuickJS (#57). */
|
|
52
|
+
class AsyncExpressError extends Error {
|
|
53
|
+
name = "AsyncExpressError";
|
|
54
|
+
}
|
|
55
|
+
exports.AsyncExpressError = AsyncExpressError;
|
|
56
|
+
/** TS→WASM toolchain (esbuild / javy) unavailable; message carries the full diagnosis (#58). */
|
|
57
|
+
class ToolchainError extends Error {
|
|
58
|
+
name = "ToolchainError";
|
|
59
|
+
}
|
|
60
|
+
exports.ToolchainError = ToolchainError;
|
|
61
|
+
// High-confidence shapes only — the runtime guard in WASI_SHIM_FOOTER backstops
|
|
62
|
+
// anything the static patterns miss (e.g. a sync express() returning a Promise value).
|
|
63
|
+
const ASYNC_EXPRESS_PATTERNS = [
|
|
64
|
+
[/\basync\s+function\s+express\b/, "async function express"],
|
|
65
|
+
[/\bexpress\s*=\s*async\b/, "express = async (…)"],
|
|
66
|
+
[/\bfunction\s+express\s*\([^)]*\)\s*:\s*Promise\s*</, "express() declared to return Promise<…>"],
|
|
67
|
+
];
|
|
68
|
+
/**
|
|
69
|
+
* Detect an async/Promise-returning express() in gene source.
|
|
70
|
+
* Returns a human-readable description of the offending shape, or null if clean.
|
|
71
|
+
*/
|
|
72
|
+
function detectAsyncExpress(source) {
|
|
73
|
+
for (const [pattern, label] of ASYNC_EXPRESS_PATTERNS) {
|
|
74
|
+
if (pattern.test(source))
|
|
75
|
+
return label;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
// Bare binaries first: a PATH lookup is instant (covers global installs and
|
|
80
|
+
// node_modules/.bin when invoked via npm scripts). `npx --no-install` is the
|
|
81
|
+
// fallback for project-local installs — it never touches the npm registry, so a
|
|
82
|
+
// missing tool fails fast instead of hanging on a blocked proxy (#58:
|
|
83
|
+
// `spawnSync npx ETIMEDOUT`). javy-cli@3 installs its binary as `javy`.
|
|
84
|
+
const ESBUILD_CANDIDATES = [["esbuild"], ["npx", "--no-install", "esbuild"]];
|
|
85
|
+
const JAVY_CANDIDATES = [
|
|
86
|
+
["javy"],
|
|
87
|
+
["npx", "--no-install", "javy-cli"],
|
|
88
|
+
["npx", "--no-install", "javy"],
|
|
89
|
+
];
|
|
90
|
+
function canRun(command) {
|
|
91
|
+
try {
|
|
92
|
+
(0, node_child_process_1.execFileSync)(command[0], [...command.slice(1), "--version"], { stdio: "pipe", timeout: 10_000 });
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function resolveCommand(candidates) {
|
|
100
|
+
for (const candidate of candidates) {
|
|
101
|
+
if (canRun(candidate))
|
|
102
|
+
return candidate;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
/** Resolve the TS→WASM toolchain without ever hitting the network. */
|
|
107
|
+
function preflightToolchain() {
|
|
108
|
+
return {
|
|
109
|
+
esbuild: resolveCommand(ESBUILD_CANDIDATES),
|
|
110
|
+
javy: resolveCommand(JAVY_CANDIDATES),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Full diagnosis for a failed preflight: per-tool status, environment, exact fixes. */
|
|
114
|
+
/** Resolve the active `npx` path (impure: PATH lookup). Returns "not found" if absent. */
|
|
115
|
+
function resolveActiveNpxPath() {
|
|
116
|
+
try {
|
|
117
|
+
return (0, node_child_process_1.execFileSync)(process.platform === "win32" ? "where" : "which", ["npx"], {
|
|
118
|
+
stdio: "pipe", timeout: 5_000,
|
|
119
|
+
}).toString().trim().split("\n")[0];
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return "not found";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** True when both tools resolved. */
|
|
126
|
+
function toolchainOk(status) {
|
|
127
|
+
return status.esbuild !== null && status.javy !== null;
|
|
128
|
+
}
|
|
129
|
+
/** Per-tool status + environment, as report lines. Pure (no I/O — pass npxPath in). */
|
|
130
|
+
function formatToolchainReport(status, npxPath) {
|
|
131
|
+
return [
|
|
132
|
+
` esbuild: ${status.esbuild ? "ok (" + status.esbuild.join(" ") + ")" : "missing (tried: esbuild on PATH, npx --no-install esbuild)"}`,
|
|
133
|
+
` javy: ${status.javy ? "ok (" + status.javy.join(" ") + ")" : "missing (tried: javy on PATH, npx --no-install javy-cli / javy)"}`,
|
|
134
|
+
` active npx: ${npxPath}`,
|
|
135
|
+
` node: ${process.execPath}`,
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
function buildToolchainErrorMessage(status) {
|
|
139
|
+
return [
|
|
140
|
+
"TypeScript → WASM toolchain unavailable:",
|
|
141
|
+
...formatToolchainReport(status, resolveActiveNpxPath()),
|
|
142
|
+
"",
|
|
143
|
+
"Install: npm i -g esbuild javy-cli (javy-cli installs a binary named `javy` — both are detected)",
|
|
144
|
+
"If already installed: make sure the Node prefix that owns `rotifer` is first in PATH;",
|
|
145
|
+
"an `npx` from another Node installation may try the npm registry and time out behind a proxy.",
|
|
146
|
+
].join("\n");
|
|
147
|
+
}
|
|
148
|
+
/** True when the gene source has been edited after the WASM was last compiled (#58). */
|
|
149
|
+
function isWasmStale(wasmPath, sourcePath) {
|
|
150
|
+
if (!(0, node_fs_1.existsSync)(wasmPath) || !(0, node_fs_1.existsSync)(sourcePath))
|
|
151
|
+
return false;
|
|
152
|
+
try {
|
|
153
|
+
return (0, node_fs_1.statSync)(sourcePath).mtimeMs > (0, node_fs_1.statSync)(wasmPath).mtimeMs;
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
43
159
|
const WASI_SHIM_HEADER = `\
|
|
44
160
|
function __readStdin(){var s=1024,c=[],t=0;while(1){var b=new Uint8Array(s);var r=Javy.IO.readSync(0,b);t+=r;if(r===0)break;c.push(b.subarray(0,r))}var o=new Uint8Array(t);var p=0;for(var i=0;i<c.length;i++){o.set(c[i],p);p+=c[i].length}return JSON.parse(new TextDecoder().decode(o))}
|
|
45
161
|
function __writeStdout(v){var b=new TextEncoder().encode(JSON.stringify(v));Javy.IO.writeSync(1,b)}
|
|
@@ -57,14 +173,28 @@ __writeStdout(__result);
|
|
|
57
173
|
*/
|
|
58
174
|
function compileTypeScriptToWasm(geneSrcPath, outputWasmPath) {
|
|
59
175
|
const startTime = Date.now();
|
|
176
|
+
// #57: fail at compile time with an actionable message — the runtime guard's
|
|
177
|
+
// error is thrown inside QuickJS and surfaces as an opaque WASM backtrace.
|
|
178
|
+
const asyncShape = detectAsyncExpress((0, node_fs_1.readFileSync)(geneSrcPath, "utf-8"));
|
|
179
|
+
if (asyncShape) {
|
|
180
|
+
throw new AsyncExpressError(`Native (Javy/QuickJS) WASM Genes must export a synchronous express(input) — ` +
|
|
181
|
+
`found ${asyncShape} in ${geneSrcPath}. Make express() synchronous, or keep it ` +
|
|
182
|
+
`async and run via Node (--no-sandbox) / a Hybrid Gene for async I/O.`);
|
|
183
|
+
}
|
|
184
|
+
// #58: preflight the toolchain offline; a missing tool gets a diagnosis instead
|
|
185
|
+
// of `spawnSync npx ETIMEDOUT` from npx hitting the registry through a proxy.
|
|
186
|
+
const toolchain = preflightToolchain();
|
|
187
|
+
if (!toolchain.esbuild || !toolchain.javy) {
|
|
188
|
+
throw new ToolchainError(buildToolchainErrorMessage(toolchain));
|
|
189
|
+
}
|
|
60
190
|
const tmpDir = (0, node_path_1.join)((0, node_path_1.dirname)(outputWasmPath), ".rotifer-build");
|
|
61
191
|
(0, node_fs_1.mkdirSync)(tmpDir, { recursive: true });
|
|
62
192
|
const bundlePath = (0, node_path_1.join)(tmpDir, "bundle.js");
|
|
63
193
|
const shimPath = (0, node_path_1.join)(tmpDir, "gene-shim.js");
|
|
64
194
|
try {
|
|
65
195
|
display.info(" Step 1/3: TypeScript → JavaScript (esbuild)");
|
|
66
|
-
(0, node_child_process_1.execFileSync)(
|
|
67
|
-
|
|
196
|
+
(0, node_child_process_1.execFileSync)(toolchain.esbuild[0], [
|
|
197
|
+
...toolchain.esbuild.slice(1), geneSrcPath,
|
|
68
198
|
"--bundle", "--format=iife", "--global-name=__gene",
|
|
69
199
|
`--outfile=${bundlePath}`, "--log-level=warning",
|
|
70
200
|
], { stdio: "pipe", timeout: 30_000 });
|
|
@@ -75,8 +205,8 @@ function compileTypeScriptToWasm(geneSrcPath, outputWasmPath) {
|
|
|
75
205
|
const shimCode = WASI_SHIM_HEADER + bundleCode + "\n" + WASI_SHIM_FOOTER;
|
|
76
206
|
(0, node_fs_1.writeFileSync)(shimPath, shimCode);
|
|
77
207
|
display.info(" Step 3/3: JavaScript → WASM (Javy / QuickJS)");
|
|
78
|
-
(0, node_child_process_1.execFileSync)(
|
|
79
|
-
|
|
208
|
+
(0, node_child_process_1.execFileSync)(toolchain.javy[0], [
|
|
209
|
+
...toolchain.javy.slice(1), "compile", shimPath, "-o", outputWasmPath,
|
|
80
210
|
], { stdio: "pipe", timeout: 60_000 });
|
|
81
211
|
const wasmSize = (0, node_fs_1.readFileSync)(outputWasmPath).length;
|
|
82
212
|
const durationMs = Date.now() - startTime;
|
|
@@ -99,16 +229,10 @@ function compileTypeScriptToWasm(geneSrcPath, outputWasmPath) {
|
|
|
99
229
|
}
|
|
100
230
|
}
|
|
101
231
|
/**
|
|
102
|
-
* Check whether the Javy CLI is available.
|
|
232
|
+
* Check whether the Javy CLI is available (offline check; never hits the registry).
|
|
103
233
|
*/
|
|
104
234
|
function isJavyAvailable() {
|
|
105
|
-
|
|
106
|
-
(0, node_child_process_1.execFileSync)("npx", ["javy-cli", "--version"], { stdio: "pipe", timeout: 30_000 });
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
235
|
+
return resolveCommand(JAVY_CANDIDATES) !== null;
|
|
112
236
|
}
|
|
113
237
|
/**
|
|
114
238
|
* Detect the gene source file in a gene directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javy-compiler.js","sourceRoot":"","sources":["../../src/utils/javy-compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"javy-compiler.js","sourceRoot":"","sources":["../../src/utils/javy-compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,gDAK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I,CAAC;YAAC,IAAA,oBAAU,EAAC,QAAQ,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,CAAC;YAAC,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe;IAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC5C,KAAK,MAAM,IAAI,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,IAAA,gBAAI,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAA,oBAAU,EAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface DaemonState {
|
|
2
|
+
pid: number;
|
|
3
|
+
/** Loopback control-server port (OS-assigned). */
|
|
4
|
+
port: number;
|
|
5
|
+
/** Per-daemon bearer token for the control endpoints. */
|
|
6
|
+
token: string;
|
|
7
|
+
peerId: string;
|
|
8
|
+
startedAt: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function readDaemonState(): DaemonState | null;
|
|
11
|
+
export declare function clearDaemonState(): void;
|
|
12
|
+
export interface ControlResult {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
status: number;
|
|
15
|
+
body: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send a control request to the running daemon. Returns null when no daemon is
|
|
19
|
+
* recorded or it is unreachable (so callers can report "not running").
|
|
20
|
+
*/
|
|
21
|
+
export declare function controlRequest(method: string, path: string, body?: unknown): Promise<ControlResult | null>;
|
|
22
|
+
/** Whether a daemon is recorded and answering its control server. */
|
|
23
|
+
export declare function isDaemonRunning(): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Run the daemon: start the libp2p node, expose a token-gated loopback control
|
|
26
|
+
* server, record the state file, and stay alive until stopped. Called from the
|
|
27
|
+
* hidden `network __daemon` subcommand in a detached process.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runDaemon(listenHost: string, listenPort: number, bootstrapPeers: string[]): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=p2p-daemon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p2p-daemon.d.ts","sourceRoot":"","sources":["../../src/utils/p2p-daemon.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,eAAe,IAAI,WAAW,GAAG,IAAI,CAOpD;AAQD,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA6C/B;AAED,qEAAqE;AACrE,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAGxD;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,IAAI,CAAC,CAwFf"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readDaemonState = readDaemonState;
|
|
4
|
+
exports.clearDaemonState = clearDaemonState;
|
|
5
|
+
exports.controlRequest = controlRequest;
|
|
6
|
+
exports.isDaemonRunning = isDaemonRunning;
|
|
7
|
+
exports.runDaemon = runDaemon;
|
|
8
|
+
/**
|
|
9
|
+
* P2P daemon + local control channel (§3.1 phase 2).
|
|
10
|
+
*
|
|
11
|
+
* Phase 1 ran the libp2p node only in the foreground (`start`) or one-shot
|
|
12
|
+
* (`announce`). Phase 2 runs it as a persistent background daemon and lets
|
|
13
|
+
* separate `rotifer network` commands talk to it over a loopback HTTP control
|
|
14
|
+
* server (127.0.0.1, OS-assigned port), authenticated with a per-daemon token.
|
|
15
|
+
*
|
|
16
|
+
* State (PID + control port + token + PeerId) lives in `~/.rotifer/daemon.json`
|
|
17
|
+
* (mode 0600). The token gates the control endpoints so other local processes
|
|
18
|
+
* cannot drive the node.
|
|
19
|
+
*/
|
|
20
|
+
const node_http_1 = require("node:http");
|
|
21
|
+
const node_fs_1 = require("node:fs");
|
|
22
|
+
const node_path_1 = require("node:path");
|
|
23
|
+
const node_crypto_1 = require("node:crypto");
|
|
24
|
+
const private_fs_js_1 = require("./private-fs.js");
|
|
25
|
+
const binding_js_1 = require("./binding.js");
|
|
26
|
+
const ROTIFER_HOME = (0, node_path_1.join)(process.env.HOME || process.env.USERPROFILE || "/tmp", ".rotifer");
|
|
27
|
+
const DAEMON_STATE = (0, node_path_1.join)(ROTIFER_HOME, "daemon.json");
|
|
28
|
+
const TOKEN_HEADER = "x-rotifer-token";
|
|
29
|
+
const CONTROL_HOST = "127.0.0.1";
|
|
30
|
+
function readDaemonState() {
|
|
31
|
+
if (!(0, node_fs_1.existsSync)(DAEMON_STATE))
|
|
32
|
+
return null;
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse((0, node_fs_1.readFileSync)(DAEMON_STATE, "utf-8"));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function writeDaemonState(state) {
|
|
41
|
+
(0, private_fs_js_1.ensurePrivateDir)(ROTIFER_HOME);
|
|
42
|
+
(0, node_fs_1.writeFileSync)(DAEMON_STATE, JSON.stringify(state, null, 2) + "\n");
|
|
43
|
+
(0, private_fs_js_1.tightenPrivateFile)(DAEMON_STATE);
|
|
44
|
+
}
|
|
45
|
+
function clearDaemonState() {
|
|
46
|
+
try {
|
|
47
|
+
(0, node_fs_1.rmSync)(DAEMON_STATE, { force: true });
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
/* best effort */
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Send a control request to the running daemon. Returns null when no daemon is
|
|
55
|
+
* recorded or it is unreachable (so callers can report "not running").
|
|
56
|
+
*/
|
|
57
|
+
function controlRequest(method, path, body) {
|
|
58
|
+
const state = readDaemonState();
|
|
59
|
+
if (!state)
|
|
60
|
+
return Promise.resolve(null);
|
|
61
|
+
const payload = body === undefined ? undefined : JSON.stringify(body);
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const req = (0, node_http_1.request)({
|
|
64
|
+
host: CONTROL_HOST,
|
|
65
|
+
port: state.port,
|
|
66
|
+
path,
|
|
67
|
+
method,
|
|
68
|
+
headers: {
|
|
69
|
+
[TOKEN_HEADER]: state.token,
|
|
70
|
+
...(payload
|
|
71
|
+
? {
|
|
72
|
+
"content-type": "application/json",
|
|
73
|
+
"content-length": Buffer.byteLength(payload),
|
|
74
|
+
}
|
|
75
|
+
: {}),
|
|
76
|
+
},
|
|
77
|
+
timeout: 5000,
|
|
78
|
+
}, (res) => {
|
|
79
|
+
let data = "";
|
|
80
|
+
res.on("data", (chunk) => (data += chunk));
|
|
81
|
+
res.on("end", () => {
|
|
82
|
+
let parsed = null;
|
|
83
|
+
try {
|
|
84
|
+
parsed = data ? JSON.parse(data) : null;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
parsed = data;
|
|
88
|
+
}
|
|
89
|
+
resolve({ ok: (res.statusCode ?? 0) < 400, status: res.statusCode ?? 0, body: parsed });
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
req.on("error", () => resolve(null));
|
|
93
|
+
req.on("timeout", () => {
|
|
94
|
+
req.destroy();
|
|
95
|
+
resolve(null);
|
|
96
|
+
});
|
|
97
|
+
if (payload)
|
|
98
|
+
req.write(payload);
|
|
99
|
+
req.end();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Whether a daemon is recorded and answering its control server. */
|
|
103
|
+
async function isDaemonRunning() {
|
|
104
|
+
const result = await controlRequest("GET", "/status");
|
|
105
|
+
return result?.ok ?? false;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Run the daemon: start the libp2p node, expose a token-gated loopback control
|
|
109
|
+
* server, record the state file, and stay alive until stopped. Called from the
|
|
110
|
+
* hidden `network __daemon` subcommand in a detached process.
|
|
111
|
+
*/
|
|
112
|
+
async function runDaemon(listenHost, listenPort, bootstrapPeers) {
|
|
113
|
+
const maybeNode = (0, binding_js_1.loadP2pNode)(listenHost, listenPort, bootstrapPeers);
|
|
114
|
+
if (!maybeNode) {
|
|
115
|
+
process.stderr.write("native P2P node unavailable; daemon cannot start\n");
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
const node = maybeNode; // non-null below (incl. inside the control-server closure)
|
|
119
|
+
node.start();
|
|
120
|
+
const token = (0, node_crypto_1.randomBytes)(24).toString("hex");
|
|
121
|
+
const startedAt = Date.now();
|
|
122
|
+
let isShuttingDown = false;
|
|
123
|
+
const server = (0, node_http_1.createServer)((req, res) => {
|
|
124
|
+
const send = (code, obj) => {
|
|
125
|
+
res.writeHead(code, { "content-type": "application/json" });
|
|
126
|
+
res.end(JSON.stringify(obj));
|
|
127
|
+
};
|
|
128
|
+
if (req.headers[TOKEN_HEADER] !== token) {
|
|
129
|
+
send(403, { error: "forbidden" });
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const url = new URL(req.url ?? "/", `http://${CONTROL_HOST}`);
|
|
133
|
+
if (req.method === "GET" && url.pathname === "/status") {
|
|
134
|
+
send(200, {
|
|
135
|
+
peerId: node.peerId(),
|
|
136
|
+
listenAddrs: node.listenAddrs(),
|
|
137
|
+
peers: node.discoveredPeers().length,
|
|
138
|
+
startedAt,
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (req.method === "GET" && url.pathname === "/peers") {
|
|
143
|
+
send(200, { peers: node.discoveredPeers() });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (req.method === "GET" && url.pathname === "/received") {
|
|
147
|
+
send(200, { announcements: node.receivedAnnouncements() });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (req.method === "POST" && url.pathname === "/announce") {
|
|
151
|
+
let data = "";
|
|
152
|
+
req.on("data", (chunk) => (data += chunk));
|
|
153
|
+
req.on("end", () => {
|
|
154
|
+
try {
|
|
155
|
+
const g = JSON.parse(data);
|
|
156
|
+
node.announceGene(g.geneId, g.name, g.domain, g.version, g.fidelity);
|
|
157
|
+
send(200, { ok: true });
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
send(400, { error: err.message });
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (req.method === "POST" && url.pathname === "/stop") {
|
|
166
|
+
send(200, { ok: true });
|
|
167
|
+
shutdown();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
send(404, { error: "not found" });
|
|
171
|
+
});
|
|
172
|
+
function shutdown() {
|
|
173
|
+
if (isShuttingDown)
|
|
174
|
+
return;
|
|
175
|
+
isShuttingDown = true;
|
|
176
|
+
try {
|
|
177
|
+
node.stop();
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
/* best effort */
|
|
181
|
+
}
|
|
182
|
+
server.close();
|
|
183
|
+
clearDaemonState();
|
|
184
|
+
process.exit(0);
|
|
185
|
+
}
|
|
186
|
+
process.on("SIGINT", shutdown);
|
|
187
|
+
process.on("SIGTERM", shutdown);
|
|
188
|
+
await new Promise((resolve, reject) => {
|
|
189
|
+
server.listen(0, CONTROL_HOST, () => {
|
|
190
|
+
const addr = server.address();
|
|
191
|
+
const port = typeof addr === "object" && addr ? addr.port : 0;
|
|
192
|
+
writeDaemonState({ pid: process.pid, port, token, peerId: node.peerId(), startedAt });
|
|
193
|
+
resolve();
|
|
194
|
+
});
|
|
195
|
+
server.on("error", reject);
|
|
196
|
+
});
|
|
197
|
+
// The listening control server keeps the process alive; it exits via shutdown().
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=p2p-daemon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p2p-daemon.js","sourceRoot":"","sources":["../../src/utils/p2p-daemon.ts"],"names":[],"mappings":";;AAsCA,0CAOC;AAQD,4CAMC;AAYD,wCAiDC;AAGD,0CAGC;AAOD,8BA4FC;AAjOD;;;;;;;;;;;GAWG;AACH,yCAAkD;AAClD,qCAA0E;AAC1E,yCAAiC;AACjC,6CAA0C;AAC1C,mDAAuE;AACvE,6CAA2C;AAE3C,MAAM,YAAY,GAAG,IAAA,gBAAI,EACvB,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,MAAM,EACrD,UAAU,CACX,CAAC;AACF,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEvD,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,YAAY,GAAG,WAAW,CAAC;AAYjC,SAAgB,eAAe;IA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AAQ,CAAC,CAAC;IAEhC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE;YAClC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,gBAAgB,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACtF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,iFAAiF;AACnF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phenotype-validator.d.ts","sourceRoot":"","sources":["../../src/utils/phenotype-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phenotype-validator.d.ts","sourceRoot":"","sources":["../../src/utils/phenotype-validator.ts"],"names":[],"mappings":"AA6UA,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,GACf,IAAI,CAoBN"}
|