@nimbus-sh/worker 0.1.4 → 0.1.6
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/README.md +37 -0
- package/dist/_shared/crypto.d.ts +15 -0
- package/dist/_shared/crypto.d.ts.map +1 -0
- package/dist/_shared/crypto.js +122 -0
- package/dist/facets/manager.d.ts +24 -0
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +279 -70
- package/dist/facets/process.d.ts +11 -2
- package/dist/facets/process.d.ts.map +1 -1
- package/dist/facets/process.js +187 -21
- package/dist/facets/vite-dev-server.d.ts +2 -0
- package/dist/facets/vite-dev-server.d.ts.map +1 -1
- package/dist/facets/vite-dev-server.js +39 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/loaders/child-process/spawn-facet.d.ts +1 -3
- package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-facet.js +1 -12
- package/dist/loaders/child-process/spawn-pool.d.ts +1 -1
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +1 -6
- package/dist/loaders/loader-pool.d.ts +7 -0
- package/dist/loaders/loader-pool.d.ts.map +1 -1
- package/dist/loaders/loader-pool.js +3 -1
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +47 -27
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
- package/dist/npm/pre-bundle-facet.js +2 -1
- package/dist/npm/resolve-one-facet.d.ts.map +1 -1
- package/dist/npm/resolve-one-facet.js +41 -13
- package/dist/npm/resolver.d.ts.map +1 -1
- package/dist/npm/resolver.js +70 -35
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +45 -21
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +29 -8
- package/dist/runtime/barrel-synthesizer.d.ts +7 -0
- package/dist/runtime/barrel-synthesizer.d.ts.map +1 -1
- package/dist/runtime/barrel-synthesizer.js +11 -0
- package/dist/runtime/clang-runner.d.ts +2 -2
- package/dist/runtime/clang-runner.d.ts.map +1 -1
- package/dist/runtime/clang-runner.js +64 -47
- package/dist/runtime/esbuild-service.d.ts +12 -5
- package/dist/runtime/esbuild-service.d.ts.map +1 -1
- package/dist/runtime/esbuild-service.js +28 -14
- package/dist/runtime/node-runner.d.ts +2 -0
- package/dist/runtime/node-runner.d.ts.map +1 -1
- package/dist/runtime/node-shims.d.ts +4 -2
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +404 -55
- package/dist/runtime/os-contracts.d.ts +128 -0
- package/dist/runtime/os-contracts.d.ts.map +1 -0
- package/dist/runtime/os-contracts.js +1 -0
- package/dist/runtime/package-manager.d.ts +31 -0
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +162 -15
- package/dist/runtime/port-registry.d.ts +5 -0
- package/dist/runtime/port-registry.d.ts.map +1 -1
- package/dist/runtime/port-registry.js +22 -1
- package/dist/runtime/pyodide-runtime-assets.d.ts +19 -0
- package/dist/runtime/pyodide-runtime-assets.d.ts.map +1 -0
- package/dist/runtime/pyodide-runtime-assets.js +44 -0
- package/dist/runtime/python-repl.d.ts +3 -0
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +18 -32
- package/dist/runtime/python-runner.d.ts +8 -9
- package/dist/runtime/python-runner.d.ts.map +1 -1
- package/dist/runtime/python-runner.js +958 -118
- package/dist/runtime/python-socket-shim.d.ts +11 -0
- package/dist/runtime/python-socket-shim.d.ts.map +1 -0
- package/dist/runtime/python-socket-shim.js +526 -0
- package/dist/runtime/require-resolver.d.ts.map +1 -1
- package/dist/runtime/require-resolver.js +2 -11
- package/dist/runtime/ruby-gems.d.ts +25 -0
- package/dist/runtime/ruby-gems.d.ts.map +1 -0
- package/dist/runtime/ruby-gems.js +582 -0
- package/dist/runtime/ruby-runner.d.ts +2 -4
- package/dist/runtime/ruby-runner.d.ts.map +1 -1
- package/dist/runtime/ruby-runner.js +335 -34
- package/dist/runtime/runtime-catalog.d.ts +16 -4
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +21 -10
- package/dist/runtime/runtime-registry.d.ts +3 -0
- package/dist/runtime/runtime-registry.d.ts.map +1 -1
- package/dist/runtime/runtime-registry.js +4 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.d.ts +43 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.d.ts.map +1 -0
- package/dist/runtime/sqlite-runtime-fs-bridge.js +224 -0
- package/dist/runtime/static-server.d.ts +3 -0
- package/dist/runtime/static-server.d.ts.map +1 -0
- package/dist/runtime/static-server.js +121 -0
- package/dist/runtime/vfs-snapshot.d.ts +57 -0
- package/dist/runtime/vfs-snapshot.d.ts.map +1 -0
- package/dist/runtime/vfs-snapshot.js +141 -0
- package/dist/runtime/virtual-socket-kernel.d.ts +16 -0
- package/dist/runtime/virtual-socket-kernel.d.ts.map +1 -0
- package/dist/runtime/virtual-socket-kernel.js +360 -0
- package/dist/runtime/wasi-instance.d.ts +6 -3
- package/dist/runtime/wasi-instance.d.ts.map +1 -1
- package/dist/runtime/wasm-runner.d.ts +1 -25
- package/dist/runtime/wasm-runner.d.ts.map +1 -1
- package/dist/runtime/wasm-runner.js +1 -160
- package/dist/session/agent.d.ts +43 -0
- package/dist/session/agent.d.ts.map +1 -0
- package/dist/session/agent.js +1252 -0
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +64 -19
- package/dist/session/nimbus-session.d.ts +14 -2
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +104 -30
- package/dist/session/programmatic.d.ts +10 -0
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +121 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +19 -1
- package/dist/session/rpc.d.ts +11 -0
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +56 -43
- package/dist/session/supervisor-rpc.d.ts +15 -0
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +32 -0
- package/dist/session/ws.d.ts +4 -3
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +11 -1
- package/dist/shell/unix-commands.d.ts.map +1 -1
- package/dist/shell/unix-commands.js +52 -51
- package/dist/vfs/path.d.ts +8 -4
- package/dist/vfs/path.d.ts.map +1 -1
- package/dist/vfs/path.js +16 -4
- package/dist/vfs/sqlite-vfs.d.ts +2 -0
- package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
- package/dist/vfs/sqlite-vfs.js +11 -0
- package/dist/vfs/symlink-registry.d.ts +7 -1
- package/dist/vfs/symlink-registry.d.ts.map +1 -1
- package/dist/vfs/symlink-registry.js +16 -11
- package/package.json +4 -1
- package/public/index.html +240 -0
- package/public/s/index.html +1316 -128
- package/runtime-contracts/pyodide-workerd-adapter.json +18 -0
- package/scripts/bundle-runtime.mjs +99 -24
package/dist/facets/manager.js
CHANGED
|
@@ -85,6 +85,65 @@ function _reviveVfsWriteCell(v) {
|
|
|
85
85
|
}
|
|
86
86
|
// ── Code generators ─────────────────────────────────────────────────────
|
|
87
87
|
const SHIMS = generateShimsCode();
|
|
88
|
+
const ENTRYPOINT_PROMISE_TRACKER = `
|
|
89
|
+
function __makeEntrypointPromiseTracker() {
|
|
90
|
+
const __tracked = new Set();
|
|
91
|
+
const __origThen = Promise.prototype.then;
|
|
92
|
+
const __origCatch = Promise.prototype.catch;
|
|
93
|
+
const __origFinally = Promise.prototype.finally;
|
|
94
|
+
let __active = false;
|
|
95
|
+
const __track = (p) => {
|
|
96
|
+
if (!p || typeof p.then !== "function") return p;
|
|
97
|
+
__tracked.add(p);
|
|
98
|
+
try {
|
|
99
|
+
__origThen.call(p, () => { __tracked.delete(p); }, () => { __tracked.delete(p); });
|
|
100
|
+
} catch {
|
|
101
|
+
__tracked.delete(p);
|
|
102
|
+
}
|
|
103
|
+
return p;
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
start() {
|
|
107
|
+
__active = true;
|
|
108
|
+
try {
|
|
109
|
+
Promise.prototype.then = function(...args) {
|
|
110
|
+
const __next = __origThen.apply(this, args);
|
|
111
|
+
if (__active) __track(__next);
|
|
112
|
+
return __next;
|
|
113
|
+
};
|
|
114
|
+
Promise.prototype.catch = function(...args) {
|
|
115
|
+
const __next = __origCatch.apply(this, args);
|
|
116
|
+
if (__active) __track(__next);
|
|
117
|
+
return __next;
|
|
118
|
+
};
|
|
119
|
+
Promise.prototype.finally = function(...args) {
|
|
120
|
+
const __next = __origFinally.apply(this, args);
|
|
121
|
+
if (__active) __track(__next);
|
|
122
|
+
return __next;
|
|
123
|
+
};
|
|
124
|
+
} catch {
|
|
125
|
+
__active = false;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
stop() {
|
|
129
|
+
__active = false;
|
|
130
|
+
try {
|
|
131
|
+
Promise.prototype.then = __origThen;
|
|
132
|
+
Promise.prototype.catch = __origCatch;
|
|
133
|
+
Promise.prototype.finally = __origFinally;
|
|
134
|
+
} catch {}
|
|
135
|
+
},
|
|
136
|
+
track: __track,
|
|
137
|
+
async drain() {
|
|
138
|
+
while (__tracked.size > 0) {
|
|
139
|
+
const __slice = Array.from(__tracked);
|
|
140
|
+
await Promise.allSettled(__slice);
|
|
141
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
88
147
|
/**
|
|
89
148
|
* Static `import * as __real_X from 'node:X'` block. Prepended to both
|
|
90
149
|
* facet-code templates (NodeProcess + LOADER.load fallback) so the
|
|
@@ -316,7 +375,7 @@ class __ProcessExit extends Error {
|
|
|
316
375
|
export class NodeProcess extends DurableObject {
|
|
317
376
|
async run(argsJson) {
|
|
318
377
|
const args = JSON.parse(argsJson);
|
|
319
|
-
const { argv, env, cwd: _cwd, filename, dirname } = args;
|
|
378
|
+
const { argv, env, cwd: _cwd, filename, dirname, stdin, captureOutput } = args;
|
|
320
379
|
const __vfsBundle = __MODULE_VFS_BUNDLE;
|
|
321
380
|
const __vfsManifest = __MODULE_VFS_MANIFEST;
|
|
322
381
|
const __supervisor = this.env?.SUPERVISOR || null;
|
|
@@ -334,6 +393,14 @@ export class NodeProcess extends DurableObject {
|
|
|
334
393
|
__rpcDropBytes += bytes | 0;
|
|
335
394
|
if (e) { __rpcLastError = (e && e.message) || String(e); }
|
|
336
395
|
};
|
|
396
|
+
let __rpcWriteChain = Promise.resolve();
|
|
397
|
+
const __queueRpcWrite = (method, s) => {
|
|
398
|
+
const __task = __rpcWriteChain
|
|
399
|
+
.then(() => __supervisor[method](s))
|
|
400
|
+
.catch((e) => __onRpcDrop(s.length, e));
|
|
401
|
+
__rpcWriteChain = __task.then(() => {}, () => {});
|
|
402
|
+
__pendingIO.push(__task);
|
|
403
|
+
};
|
|
337
404
|
let cwd = _cwd || "/home/user";
|
|
338
405
|
let stdout = "", stderr = "";
|
|
339
406
|
let exitCode = 0;
|
|
@@ -342,16 +409,18 @@ export class NodeProcess extends DurableObject {
|
|
|
342
409
|
|
|
343
410
|
${SHIMS}
|
|
344
411
|
|
|
412
|
+
${ENTRYPOINT_PROMISE_TRACKER}
|
|
413
|
+
|
|
345
414
|
// Override console AND process.stdout/stderr for live SUPERVISOR streaming
|
|
346
|
-
if (__supervisor) {
|
|
347
|
-
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s;
|
|
348
|
-
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s;
|
|
415
|
+
if (__supervisor && !captureOutput) {
|
|
416
|
+
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s; __queueRpcWrite("stdout", s); };
|
|
417
|
+
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s; __queueRpcWrite("stderr", s); };
|
|
349
418
|
__consoleMod.warn = __consoleMod.error;
|
|
350
419
|
__consoleMod.info = __consoleMod.log;
|
|
351
420
|
__consoleMod.debug = __consoleMod.log;
|
|
352
421
|
// Hook process.stdout/stderr.write for live streaming (libraries use this directly)
|
|
353
|
-
__processMod.stdout.write = (d) => { const s = String(d); stdout += s;
|
|
354
|
-
__processMod.stderr.write = (d) => { const s = String(d); stderr += s;
|
|
422
|
+
__processMod.stdout.write = (d) => { const s = String(d); stdout += s; __queueRpcWrite("stdout", s); return true; };
|
|
423
|
+
__processMod.stderr.write = (d) => { const s = String(d); stderr += s; __queueRpcWrite("stderr", s); return true; };
|
|
355
424
|
}
|
|
356
425
|
|
|
357
426
|
// ── console-facet (2026-05-12): expose the shimmed console on
|
|
@@ -431,7 +500,7 @@ ${SHIMS}
|
|
|
431
500
|
: (reason && reason.message ? String(reason.message) : String(reason));
|
|
432
501
|
const line = label + ": " + text + "\\n";
|
|
433
502
|
stderr += line;
|
|
434
|
-
if (__supervisor) {
|
|
503
|
+
if (__supervisor && !captureOutput) {
|
|
435
504
|
try {
|
|
436
505
|
__pendingIO.push(__supervisor.stderr(line).catch((e) =>
|
|
437
506
|
__onRpcDrop(line.length, e)));
|
|
@@ -465,12 +534,22 @@ ${SHIMS}
|
|
|
465
534
|
// makes the check true exactly when the file is the entry.
|
|
466
535
|
__require.main = mod;
|
|
467
536
|
try {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
537
|
+
const __entryPromises = __makeEntrypointPromiseTracker();
|
|
538
|
+
let __entryResult;
|
|
539
|
+
__entryPromises.start();
|
|
540
|
+
try {
|
|
541
|
+
__entryResult = __compiledFn(
|
|
542
|
+
mod.exports, __require, mod, filename || "/home/user/script.js", dirname || "/home/user",
|
|
543
|
+
__consoleMod, __processMod, __BufferMod,
|
|
544
|
+
globalThis.setTimeout, globalThis.setInterval, globalThis.clearTimeout, globalThis.clearInterval,
|
|
545
|
+
globalThis, argv || []
|
|
546
|
+
);
|
|
547
|
+
} finally {
|
|
548
|
+
__entryPromises.stop();
|
|
549
|
+
}
|
|
550
|
+
__entryPromises.track(__entryResult);
|
|
551
|
+
if (__entryResult && typeof __entryResult.then === "function") await __entryResult;
|
|
552
|
+
await __entryPromises.drain();
|
|
474
553
|
} catch (e) {
|
|
475
554
|
if (e instanceof __ProcessExit) { exitCode = e.code; }
|
|
476
555
|
else {
|
|
@@ -481,14 +560,24 @@ ${SHIMS}
|
|
|
481
560
|
// Without this, the error is visible only in the local 'stderr'
|
|
482
561
|
// string which gets zeroed below when __supervisor is attached,
|
|
483
562
|
// leaving the user with an empty prompt after a crash.
|
|
484
|
-
if (__supervisor) {
|
|
563
|
+
if (__supervisor && !captureOutput) {
|
|
485
564
|
try { __pendingIO.push(__supervisor.stderr(trace + "\\n").catch((e2) => __onRpcDrop((trace || "").length + 1, e2))); } catch {}
|
|
486
565
|
}
|
|
487
566
|
}
|
|
488
567
|
}
|
|
489
568
|
|
|
490
|
-
|
|
491
|
-
|
|
569
|
+
async function __drainPendingIO(maxPasses = 12) {
|
|
570
|
+
let __settledIO = 0;
|
|
571
|
+
for (let __pass = 0; __pass < maxPasses; __pass++) {
|
|
572
|
+
await new Promise(r => setTimeout(r, 0));
|
|
573
|
+
if (__pendingIO.length <= __settledIO) break;
|
|
574
|
+
const __slice = __pendingIO.slice(__settledIO);
|
|
575
|
+
__settledIO = __pendingIO.length;
|
|
576
|
+
await Promise.allSettled(__slice);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
await __drainPendingIO();
|
|
492
581
|
|
|
493
582
|
// Flush writes via SUPERVISOR RPC if available (live VFS writes)
|
|
494
583
|
const __failedWrites = {};
|
|
@@ -499,22 +588,7 @@ ${SHIMS}
|
|
|
499
588
|
);
|
|
500
589
|
}
|
|
501
590
|
}
|
|
502
|
-
|
|
503
|
-
// Await all pending I/O (live stdout, writes)
|
|
504
|
-
if (__pendingIO.length > 0) {
|
|
505
|
-
await Promise.allSettled(__pendingIO);
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// Fix 6: a second drain pass. If any setTimeout-scheduled callback
|
|
509
|
-
// fired during the first allSettled and pushed more writes, they sit
|
|
510
|
-
// on __pendingIO past the first drain. Yield once more, then re-settle
|
|
511
|
-
// if new items arrived. Capped at one additional round so a run-away
|
|
512
|
-
// setInterval can't hold the facet open forever.
|
|
513
|
-
const __preSecondDrain = __pendingIO.length;
|
|
514
|
-
await new Promise(r => setTimeout(r, 0));
|
|
515
|
-
if (__pendingIO.length > __preSecondDrain) {
|
|
516
|
-
await Promise.allSettled(__pendingIO.slice(__preSecondDrain));
|
|
517
|
-
}
|
|
591
|
+
await __drainPendingIO();
|
|
518
592
|
|
|
519
593
|
// W8 BLOCKER-1 fix: parent-exit synchronous flush of any live
|
|
520
594
|
// child_process children. Without this, output from spawn-and-forget
|
|
@@ -555,8 +629,8 @@ ${SHIMS}
|
|
|
555
629
|
// - Failed writes fall back to the old vfsWrites path for supervisor-side flush
|
|
556
630
|
return JSON.stringify({
|
|
557
631
|
exitCode,
|
|
558
|
-
stdout: __supervisor ? "" : stdout,
|
|
559
|
-
stderr: __supervisor ? "" : stderr,
|
|
632
|
+
stdout: (__supervisor && !captureOutput) ? "" : stdout,
|
|
633
|
+
stderr: (__supervisor && !captureOutput) ? "" : stderr,
|
|
560
634
|
vfsWrites: __supervisor ? __failedWrites : __vfsWrites,
|
|
561
635
|
});
|
|
562
636
|
}
|
|
@@ -632,7 +706,7 @@ class __ProcessExit extends Error {
|
|
|
632
706
|
export default {
|
|
633
707
|
async fetch(request, workerEnv) {
|
|
634
708
|
const args = await request.json();
|
|
635
|
-
const { argv, env, cwd: _cwd, filename, dirname } = args;
|
|
709
|
+
const { argv, env, cwd: _cwd, filename, dirname, stdin, captureOutput } = args;
|
|
636
710
|
const __vfsBundle = __MODULE_VFS_BUNDLE;
|
|
637
711
|
const __vfsManifest = __MODULE_VFS_MANIFEST;
|
|
638
712
|
const __supervisor = workerEnv?.SUPERVISOR || null;
|
|
@@ -647,6 +721,14 @@ export default {
|
|
|
647
721
|
__rpcDropBytes += bytes | 0;
|
|
648
722
|
if (e) { __rpcLastError = (e && e.message) || String(e); }
|
|
649
723
|
};
|
|
724
|
+
let __rpcWriteChain = Promise.resolve();
|
|
725
|
+
const __queueRpcWrite = (method, s) => {
|
|
726
|
+
const __task = __rpcWriteChain
|
|
727
|
+
.then(() => __supervisor[method](s))
|
|
728
|
+
.catch((e) => __onRpcDrop(s.length, e));
|
|
729
|
+
__rpcWriteChain = __task.then(() => {}, () => {});
|
|
730
|
+
__pendingIO.push(__task);
|
|
731
|
+
};
|
|
650
732
|
let cwd = _cwd || "/home/user";
|
|
651
733
|
let stdout = "", stderr = "";
|
|
652
734
|
let exitCode = 0;
|
|
@@ -655,15 +737,17 @@ export default {
|
|
|
655
737
|
|
|
656
738
|
${SHIMS}
|
|
657
739
|
|
|
740
|
+
${ENTRYPOINT_PROMISE_TRACKER}
|
|
741
|
+
|
|
658
742
|
// Override console AND process.stdout/stderr for live SUPERVISOR streaming
|
|
659
|
-
if (__supervisor) {
|
|
660
|
-
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s;
|
|
661
|
-
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s;
|
|
743
|
+
if (__supervisor && !captureOutput) {
|
|
744
|
+
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s; __queueRpcWrite("stdout", s); };
|
|
745
|
+
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s; __queueRpcWrite("stderr", s); };
|
|
662
746
|
__consoleMod.warn = __consoleMod.error;
|
|
663
747
|
__consoleMod.info = __consoleMod.log;
|
|
664
748
|
__consoleMod.debug = __consoleMod.log;
|
|
665
|
-
__processMod.stdout.write = (d) => { const s = String(d); stdout += s;
|
|
666
|
-
__processMod.stderr.write = (d) => { const s = String(d); stderr += s;
|
|
749
|
+
__processMod.stdout.write = (d) => { const s = String(d); stdout += s; __queueRpcWrite("stdout", s); return true; };
|
|
750
|
+
__processMod.stderr.write = (d) => { const s = String(d); stderr += s; __queueRpcWrite("stderr", s); return true; };
|
|
667
751
|
}
|
|
668
752
|
|
|
669
753
|
// console-facet (2026-05-12): mirror the shimmed console onto
|
|
@@ -676,25 +760,46 @@ ${SHIMS}
|
|
|
676
760
|
// G2 (runtime-pkg wave): see corresponding comment in NodeProcess.run.
|
|
677
761
|
__require.main = mod;
|
|
678
762
|
try {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
763
|
+
const __entryPromises = __makeEntrypointPromiseTracker();
|
|
764
|
+
let __entryResult;
|
|
765
|
+
__entryPromises.start();
|
|
766
|
+
try {
|
|
767
|
+
__entryResult = __compiledFn(
|
|
768
|
+
mod.exports, __require, mod, filename || "/home/user/script.js", dirname || "/home/user",
|
|
769
|
+
__consoleMod, __processMod, __BufferMod,
|
|
770
|
+
globalThis.setTimeout, globalThis.setInterval, globalThis.clearTimeout, globalThis.clearInterval,
|
|
771
|
+
globalThis, argv || []
|
|
772
|
+
);
|
|
773
|
+
} finally {
|
|
774
|
+
__entryPromises.stop();
|
|
775
|
+
}
|
|
776
|
+
__entryPromises.track(__entryResult);
|
|
777
|
+
if (__entryResult && typeof __entryResult.then === "function") await __entryResult;
|
|
778
|
+
await __entryPromises.drain();
|
|
685
779
|
} catch (e) {
|
|
686
780
|
if (e instanceof __ProcessExit) { exitCode = e.code; }
|
|
687
781
|
else {
|
|
688
782
|
const trace = (e && e.stack) || (e && e.message) || String(e);
|
|
689
783
|
stderr += trace + "\\n";
|
|
690
784
|
exitCode = 1;
|
|
691
|
-
if (__supervisor) {
|
|
785
|
+
if (__supervisor && !captureOutput) {
|
|
692
786
|
try { __pendingIO.push(__supervisor.stderr(trace + "\\n").catch((e2) => __onRpcDrop((trace || "").length + 1, e2))); } catch {}
|
|
693
787
|
}
|
|
694
788
|
}
|
|
695
789
|
}
|
|
696
790
|
|
|
697
|
-
|
|
791
|
+
async function __drainPendingIO(maxPasses = 12) {
|
|
792
|
+
let __settledIO = 0;
|
|
793
|
+
for (let __pass = 0; __pass < maxPasses; __pass++) {
|
|
794
|
+
await new Promise(r => setTimeout(r, 0));
|
|
795
|
+
if (__pendingIO.length <= __settledIO) break;
|
|
796
|
+
const __slice = __pendingIO.slice(__settledIO);
|
|
797
|
+
__settledIO = __pendingIO.length;
|
|
798
|
+
await Promise.allSettled(__slice);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
await __drainPendingIO();
|
|
698
803
|
|
|
699
804
|
const __failedWrites = {};
|
|
700
805
|
if (__supervisor && Object.keys(__vfsWrites).length > 0) {
|
|
@@ -702,15 +807,7 @@ ${SHIMS}
|
|
|
702
807
|
__pendingIO.push(__supervisor.writeFile(path, content).catch(() => { __failedWrites[path] = content; }));
|
|
703
808
|
}
|
|
704
809
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
// Fix 6: second drain pass for any setTimeout-scheduled writes that
|
|
708
|
-
// landed after the first allSettled. Bounded to one additional round.
|
|
709
|
-
const __preSecondDrain = __pendingIO.length;
|
|
710
|
-
await new Promise(r => setTimeout(r, 0));
|
|
711
|
-
if (__pendingIO.length > __preSecondDrain) {
|
|
712
|
-
await Promise.allSettled(__pendingIO.slice(__preSecondDrain));
|
|
713
|
-
}
|
|
810
|
+
await __drainPendingIO();
|
|
714
811
|
|
|
715
812
|
// W8 BLOCKER-1 fix: parent-exit synchronous flush of child_process
|
|
716
813
|
// children. See generateFacetCode for the rationale.
|
|
@@ -735,8 +832,8 @@ ${SHIMS}
|
|
|
735
832
|
|
|
736
833
|
return Response.json({
|
|
737
834
|
exitCode,
|
|
738
|
-
stdout: __supervisor ? "" : stdout,
|
|
739
|
-
stderr: __supervisor ? "" : stderr,
|
|
835
|
+
stdout: (__supervisor && !captureOutput) ? "" : stdout,
|
|
836
|
+
stderr: (__supervisor && !captureOutput) ? "" : stderr,
|
|
740
837
|
vfsWrites: __supervisor ? __failedWrites : __vfsWrites,
|
|
741
838
|
});
|
|
742
839
|
}
|
|
@@ -758,6 +855,7 @@ function generateLongRunningNodeCode(userCode, vfsState, opts) {
|
|
|
758
855
|
cwd: opts.cwd || '/home/user',
|
|
759
856
|
filename: opts.filename || '<script>',
|
|
760
857
|
dirname: opts.dirname || opts.cwd || '/home/user',
|
|
858
|
+
stdin: opts.stdin || '',
|
|
761
859
|
});
|
|
762
860
|
const safeBundle = _serializeBundleForFacet(vfsState.bundle);
|
|
763
861
|
const safeManifest = JSON.stringify(vfsState.manifest);
|
|
@@ -820,7 +918,9 @@ async function __nimbusFlushRuntime() {
|
|
|
820
918
|
rt.pendingIO.push(rt.supervisor.writeFile(path, content).catch(() => {}));
|
|
821
919
|
}
|
|
822
920
|
}
|
|
823
|
-
|
|
921
|
+
for (let pass = 0; pass < 12; pass++) {
|
|
922
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
923
|
+
if (rt.pendingIO.length <= rt.settledIO) break;
|
|
824
924
|
const slice = rt.pendingIO.slice(rt.settledIO);
|
|
825
925
|
rt.settledIO = rt.pendingIO.length;
|
|
826
926
|
await Promise.allSettled(slice);
|
|
@@ -832,7 +932,7 @@ async function __nimbusEnsureStarted(workerEnv) {
|
|
|
832
932
|
if (__nimbusStarting) return __nimbusStarting;
|
|
833
933
|
__nimbusStarting = (async () => {
|
|
834
934
|
const args = __NIMBUS_ARGS;
|
|
835
|
-
const { argv, env, cwd: _cwd, filename, dirname } = args;
|
|
935
|
+
const { argv, env, cwd: _cwd, filename, dirname, stdin, captureOutput } = args;
|
|
836
936
|
const __vfsBundle = __MODULE_VFS_BUNDLE;
|
|
837
937
|
const __vfsManifest = __MODULE_VFS_MANIFEST;
|
|
838
938
|
const __supervisor = workerEnv?.SUPERVISOR || null;
|
|
@@ -845,6 +945,14 @@ async function __nimbusEnsureStarted(workerEnv) {
|
|
|
845
945
|
__rpcDropBytes += bytes | 0;
|
|
846
946
|
if (e) __rpcLastError = (e && e.message) || String(e);
|
|
847
947
|
};
|
|
948
|
+
let __rpcWriteChain = Promise.resolve();
|
|
949
|
+
const __queueRpcWrite = (method, s) => {
|
|
950
|
+
const __task = __rpcWriteChain
|
|
951
|
+
.then(() => __supervisor[method](s))
|
|
952
|
+
.catch((e) => __onRpcDrop(s.length, e));
|
|
953
|
+
__rpcWriteChain = __task.then(() => {}, () => {});
|
|
954
|
+
__pendingIO.push(__task);
|
|
955
|
+
};
|
|
848
956
|
let cwd = _cwd || "/home/user";
|
|
849
957
|
let stdout = "", stderr = "";
|
|
850
958
|
let exitCode = 0;
|
|
@@ -853,14 +961,14 @@ async function __nimbusEnsureStarted(workerEnv) {
|
|
|
853
961
|
|
|
854
962
|
${SHIMS}
|
|
855
963
|
|
|
856
|
-
if (__supervisor) {
|
|
857
|
-
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s;
|
|
858
|
-
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s;
|
|
964
|
+
if (__supervisor && !captureOutput) {
|
|
965
|
+
__consoleMod.log = (...a) => { const s = __utilMod.format(...a) + "\\n"; stdout += s; __queueRpcWrite("stdout", s); };
|
|
966
|
+
__consoleMod.error = (...a) => { const s = __utilMod.format(...a) + "\\n"; stderr += s; __queueRpcWrite("stderr", s); };
|
|
859
967
|
__consoleMod.warn = __consoleMod.error;
|
|
860
968
|
__consoleMod.info = __consoleMod.log;
|
|
861
969
|
__consoleMod.debug = __consoleMod.log;
|
|
862
|
-
__processMod.stdout.write = (d) => { const s = String(d); stdout += s;
|
|
863
|
-
__processMod.stderr.write = (d) => { const s = String(d); stderr += s;
|
|
970
|
+
__processMod.stdout.write = (d) => { const s = String(d); stdout += s; __queueRpcWrite("stdout", s); return true; };
|
|
971
|
+
__processMod.stderr.write = (d) => { const s = String(d); stderr += s; __queueRpcWrite("stderr", s); return true; };
|
|
864
972
|
}
|
|
865
973
|
|
|
866
974
|
try { globalThis.console = __consoleMod; } catch {}
|
|
@@ -868,12 +976,13 @@ ${SHIMS}
|
|
|
868
976
|
const mod = { exports: {} };
|
|
869
977
|
__require.main = mod;
|
|
870
978
|
try {
|
|
871
|
-
__compiledFn(
|
|
979
|
+
const __entryResult = __compiledFn(
|
|
872
980
|
mod.exports, __require, mod, filename || "/home/user/script.js", dirname || "/home/user",
|
|
873
981
|
__consoleMod, __processMod, __BufferMod,
|
|
874
982
|
globalThis.setTimeout, globalThis.setInterval, globalThis.clearTimeout, globalThis.clearInterval,
|
|
875
983
|
globalThis, argv || []
|
|
876
984
|
);
|
|
985
|
+
if (__entryResult && typeof __entryResult.then === "function") await __entryResult;
|
|
877
986
|
} catch (e) {
|
|
878
987
|
if (e instanceof __ProcessExit) {
|
|
879
988
|
exitCode = e.code;
|
|
@@ -881,7 +990,7 @@ ${SHIMS}
|
|
|
881
990
|
const trace = (e && e.stack) || (e && e.message) || String(e);
|
|
882
991
|
stderr += trace + "\\n";
|
|
883
992
|
exitCode = 1;
|
|
884
|
-
if (__supervisor) {
|
|
993
|
+
if (__supervisor && !captureOutput) {
|
|
885
994
|
try { __pendingIO.push(__supervisor.stderr(trace + "\\n").catch((e2) => __onRpcDrop((trace || "").length + 1, e2))); } catch {}
|
|
886
995
|
}
|
|
887
996
|
}
|
|
@@ -1718,6 +1827,59 @@ function addBinTargetSiblings(vfs, scriptPath, bundle, budgetState) {
|
|
|
1718
1827
|
}
|
|
1719
1828
|
return { added };
|
|
1720
1829
|
}
|
|
1830
|
+
function addCwdProjectFiles(vfs, cwd, bundle, budgetState) {
|
|
1831
|
+
const root = (cwd || '/home/user').replace(/^\/+/, '').replace(/\/+$/, '') || 'home/user';
|
|
1832
|
+
const MAX_PROJECT_FILES = 512;
|
|
1833
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', '.nimbus']);
|
|
1834
|
+
let added = 0;
|
|
1835
|
+
let visited = 0;
|
|
1836
|
+
const queue = [root];
|
|
1837
|
+
while (queue.length > 0 && visited < MAX_PROJECT_FILES) {
|
|
1838
|
+
const dir = queue.shift();
|
|
1839
|
+
let entries;
|
|
1840
|
+
try {
|
|
1841
|
+
entries = vfs.readdir(dir);
|
|
1842
|
+
}
|
|
1843
|
+
catch {
|
|
1844
|
+
continue;
|
|
1845
|
+
}
|
|
1846
|
+
for (const e of entries) {
|
|
1847
|
+
if (visited >= MAX_PROJECT_FILES)
|
|
1848
|
+
break;
|
|
1849
|
+
visited++;
|
|
1850
|
+
if (e.name === '.' || e.name === '..')
|
|
1851
|
+
continue;
|
|
1852
|
+
if (e.type === 'directory' && SKIP_DIRS.has(e.name))
|
|
1853
|
+
continue;
|
|
1854
|
+
const child = dir + '/' + e.name;
|
|
1855
|
+
if (e.type === 'directory') {
|
|
1856
|
+
queue.push(child);
|
|
1857
|
+
continue;
|
|
1858
|
+
}
|
|
1859
|
+
if (bundle[child] !== undefined)
|
|
1860
|
+
continue;
|
|
1861
|
+
if (budgetState.fileCount >= VFS_BUNDLE_MAX_FILES)
|
|
1862
|
+
return { added };
|
|
1863
|
+
if (budgetState.totalBytes >= VFS_BUNDLE_MAX_BYTES)
|
|
1864
|
+
return { added };
|
|
1865
|
+
let content;
|
|
1866
|
+
try {
|
|
1867
|
+
content = _readBundleCell(vfs, child);
|
|
1868
|
+
}
|
|
1869
|
+
catch {
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1872
|
+
const cellLen = _bundleCellLength(content);
|
|
1873
|
+
if (budgetState.totalBytes + cellLen > VFS_BUNDLE_MAX_BYTES)
|
|
1874
|
+
return { added };
|
|
1875
|
+
bundle[child] = content;
|
|
1876
|
+
budgetState.totalBytes += cellLen;
|
|
1877
|
+
budgetState.fileCount++;
|
|
1878
|
+
added++;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return { added };
|
|
1882
|
+
}
|
|
1721
1883
|
/**
|
|
1722
1884
|
* shell compatibility (2026-05-11): scan entry code (and any already-bundled
|
|
1723
1885
|
* .js/.mjs/.cjs sources) for ABSOLUTE-PATH string literals that look
|
|
@@ -2078,6 +2240,15 @@ async function buildPrefetchBundle(vfs, scriptPath, cwd, entryCode, esbuild) {
|
|
|
2078
2240
|
void binSiblingAdd;
|
|
2079
2241
|
totalBytes = budgetState.totalBytes;
|
|
2080
2242
|
fileCount = budgetState.fileCount;
|
|
2243
|
+
// 2.34 project-data snapshot: sync Node fs cannot await the
|
|
2244
|
+
// supervisor. Include a bounded snapshot of the current working tree
|
|
2245
|
+
// for common relative project-file reads while skipping dependency
|
|
2246
|
+
// and Nimbus cache directories. Async fs still uses live supervisor
|
|
2247
|
+
// reads and child-process staleness fallback.
|
|
2248
|
+
const cwdProjectAdd = addCwdProjectFiles(vfs, cwd, bundle, budgetState);
|
|
2249
|
+
void cwdProjectAdd;
|
|
2250
|
+
totalBytes = budgetState.totalBytes;
|
|
2251
|
+
fileCount = budgetState.fileCount;
|
|
2081
2252
|
// 2.35 shell compatibility: absolute-path readFileSync scanner.
|
|
2082
2253
|
//
|
|
2083
2254
|
// Pre-fix `node -e 'fs.readFileSync("/home/user/er.txt")'` returned
|
|
@@ -2415,6 +2586,8 @@ export class FacetManager {
|
|
|
2415
2586
|
cwd: opts.cwd || '/home/user',
|
|
2416
2587
|
filename: opts.filename || '<eval>',
|
|
2417
2588
|
dirname: opts.dirname || '/home/user',
|
|
2589
|
+
stdin: opts.stdin || '',
|
|
2590
|
+
captureOutput: !!opts.captureOutput,
|
|
2418
2591
|
});
|
|
2419
2592
|
// Clean up the facet (free SQLite storage) regardless of outcome.
|
|
2420
2593
|
// AUDIT.md M3 / STABILITY-AUDIT.md M-S2 / TOP-5-NEXT.md #3 (A3):
|
|
@@ -2457,6 +2630,8 @@ export class FacetManager {
|
|
|
2457
2630
|
cwd: opts.cwd || '/home/user',
|
|
2458
2631
|
filename: opts.filename || '<eval>',
|
|
2459
2632
|
dirname: opts.dirname || '/home/user',
|
|
2633
|
+
stdin: opts.stdin || '',
|
|
2634
|
+
captureOutput: !!opts.captureOutput,
|
|
2460
2635
|
});
|
|
2461
2636
|
const response = await entrypoint.fetch(new Request('http://facet/run', {
|
|
2462
2637
|
method: 'POST',
|
|
@@ -2611,6 +2786,20 @@ export class FacetManager {
|
|
|
2611
2786
|
* @returns Process entry with pid and facet stub
|
|
2612
2787
|
*/
|
|
2613
2788
|
spawn(workerCode, command, cwd, opts = {}) {
|
|
2789
|
+
return this.spawnWorker(workerCode, command, cwd, {
|
|
2790
|
+
port: opts.port,
|
|
2791
|
+
compatibilityFlags: ['nodejs_compat'],
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Spawn a long-running dynamic Worker and register its routeable port.
|
|
2796
|
+
*
|
|
2797
|
+
* This is the shared primitive for any runtime that exposes
|
|
2798
|
+
* handleHttpRequest(Request): Node facets, Vite adapters, Python virtual
|
|
2799
|
+
* sockets, and future WASI socket servers should use
|
|
2800
|
+
* this path instead of each owning process-table and PortRegistry plumbing.
|
|
2801
|
+
*/
|
|
2802
|
+
spawnWorker(workerCode, command, cwd, opts = {}) {
|
|
2614
2803
|
this.processTable.reap();
|
|
2615
2804
|
const entry = this.processTable.spawn(command, [], cwd);
|
|
2616
2805
|
// child-process isolation gap #2: stamp the explicit longRunning flag on the
|
|
@@ -2631,17 +2820,37 @@ export class FacetManager {
|
|
|
2631
2820
|
: undefined;
|
|
2632
2821
|
const worker = this.env.LOADER.load({
|
|
2633
2822
|
compatibilityDate: CF_COMPAT_DATE,
|
|
2634
|
-
compatibilityFlags: ['nodejs_compat'],
|
|
2823
|
+
compatibilityFlags: opts.compatibilityFlags || ['nodejs_compat'],
|
|
2635
2824
|
mainModule: 'worker.js',
|
|
2636
|
-
modules: { 'worker.js': workerCode },
|
|
2825
|
+
modules: { 'worker.js': workerCode, ...(opts.modules || {}) },
|
|
2637
2826
|
...(supervisorBinding ? { env: { SUPERVISOR: supervisorBinding } } : {}),
|
|
2638
2827
|
});
|
|
2639
2828
|
const facetStub = worker.getEntrypoint();
|
|
2829
|
+
this.portRegistry.bindFacetStub(entry.pid, facetStub);
|
|
2640
2830
|
if (opts.port && opts.port > 0 && opts.port < 65536) {
|
|
2641
2831
|
this.portRegistry.register(opts.port, entry.pid, facetStub);
|
|
2642
2832
|
}
|
|
2643
2833
|
return { pid: entry.pid, facetStub };
|
|
2644
2834
|
}
|
|
2835
|
+
registerPort(pid, port, facetStub) {
|
|
2836
|
+
if (port > 0 && port < 65536) {
|
|
2837
|
+
this.portRegistry.register(port, pid, facetStub);
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
attachReservedPorts(pid, facetStub) {
|
|
2841
|
+
return this.portRegistry.attachFacetStubByPid(pid, facetStub);
|
|
2842
|
+
}
|
|
2843
|
+
finishProcess(pid, exitCode, reason = 'exited') {
|
|
2844
|
+
this.portRegistry.unregisterByPid(pid);
|
|
2845
|
+
this.processTable.exit(pid, exitCode);
|
|
2846
|
+
if (exitCode !== 0) {
|
|
2847
|
+
this._w5RecordTermination(pid, exitCode, 'facet', reason);
|
|
2848
|
+
try {
|
|
2849
|
+
this.hooks.onExternalExit?.(pid, exitCode, reason);
|
|
2850
|
+
}
|
|
2851
|
+
catch { }
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2645
2854
|
/** Kill a running process by PID. */
|
|
2646
2855
|
kill(pid) {
|
|
2647
2856
|
const entry = this.processTable.get(pid);
|
package/dist/facets/process.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ export interface OutputHooks {
|
|
|
136
136
|
* Command resolution. The shell registry returns whatever shape it likes;
|
|
137
137
|
* we adapt to a normalized 3-state result.
|
|
138
138
|
*/
|
|
139
|
-
export type CommandKind = 'pure-builtin' | 'facet-direct' | 'unknown';
|
|
139
|
+
export type CommandKind = 'pure-builtin' | 'facet-direct' | 'shell-direct' | 'unknown';
|
|
140
140
|
/**
|
|
141
141
|
* The minimum shape we need from the FacetManager. Production passes
|
|
142
142
|
* the real FacetManager; tests pass a mock with execStream.
|
|
@@ -159,6 +159,9 @@ export interface CommandRegistryLike {
|
|
|
159
159
|
} | null;
|
|
160
160
|
runPureBuiltin(name: string, args: string[], env: Record<string, string>, cwd: string, stdin: string, hooks: OutputHooks): Promise<number>;
|
|
161
161
|
}
|
|
162
|
+
export interface ShellExecutorLike {
|
|
163
|
+
execute(commandLine: string, env: Record<string, string>, cwd: string, stdin: string, hooks: OutputHooks): Promise<number>;
|
|
164
|
+
}
|
|
162
165
|
/**
|
|
163
166
|
* The minimum shape we need from the ProcessLogStore.
|
|
164
167
|
*/
|
|
@@ -188,6 +191,7 @@ export interface FacetProcessManagerDeps {
|
|
|
188
191
|
isDirectory(p: string): boolean;
|
|
189
192
|
};
|
|
190
193
|
commandRegistry: CommandRegistryLike;
|
|
194
|
+
shellExecutor?: ShellExecutorLike;
|
|
191
195
|
/** Optional: ctx for facets.abort/delete in production. */
|
|
192
196
|
ctx?: {
|
|
193
197
|
facets?: {
|
|
@@ -204,7 +208,7 @@ export interface FacetProcessManagerDeps {
|
|
|
204
208
|
* always supplies it).
|
|
205
209
|
*/
|
|
206
210
|
spawnPool?: {
|
|
207
|
-
runOne: (req: any, kind:
|
|
211
|
+
runOne: (req: any, kind: CommandKind, hooks: {
|
|
208
212
|
onStdout: (d: string) => void;
|
|
209
213
|
onStderr: (d: string) => void;
|
|
210
214
|
}, childId: number | string) => Promise<number>;
|
|
@@ -252,7 +256,12 @@ export declare class FacetProcessManager {
|
|
|
252
256
|
* on full stdin so we have to commit upfront — the parent should have
|
|
253
257
|
* called stdinEnd() before the wait ticks expire.
|
|
254
258
|
*/
|
|
259
|
+
private _waitForStdinEvent;
|
|
255
260
|
private _drainStdinForBuiltin;
|
|
261
|
+
private _shellPlanFor;
|
|
262
|
+
private _dispatchShell;
|
|
263
|
+
private _drainStdinForShell;
|
|
264
|
+
private _runShellLine;
|
|
256
265
|
stdinWrite(childPid: number, data: string): {
|
|
257
266
|
ok: boolean;
|
|
258
267
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/facets/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,CAAC;IAInE,OAAO,EAAE;QACP,CAAC,EAAE,WAAW,EAAE,CAAC;QACjB,CAAC,EAAE,WAAW,EAAE,CAAC;KAClB,CAAC;IACF,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,aAAa,EAAE,KAAK,CAAC;QA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