@nimbus-sh/worker 0.1.3 → 0.1.5
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 +2 -2
- package/dist/index.js +2 -2
- 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/router/index.d.ts +1 -1
- package/dist/router/index.js +1 -1
- 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 +63 -39
- 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 +132 -10
- package/dist/runtime/python-repl.d.ts +1 -0
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +8 -4
- package/dist/runtime/python-runner.d.ts.map +1 -1
- package/dist/runtime/python-runner.js +86 -82
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +49 -3
- package/dist/session/nimbus-session.d.ts +1 -0
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +49 -23
- package/dist/shell/unix-commands.d.ts.map +1 -1
- package/dist/shell/unix-commands.js +44 -39
- package/package.json +1 -1
- package/public/s/index.html +169 -7
|
@@ -41,6 +41,7 @@ export function makePythonRunnerFactory(deps) {
|
|
|
41
41
|
const asmWasmVfs = findFile('share/pyodide/pyodide.asm.wasm');
|
|
42
42
|
const asmJsVfs = findFile('share/pyodide/pyodide.asm.js');
|
|
43
43
|
const stdlibVfs = findFile('share/pyodide/python_stdlib.zip');
|
|
44
|
+
let runtimePromise = null;
|
|
44
45
|
return async function pythonBinHandler(ctx) {
|
|
45
46
|
const argv = ctx.args || [];
|
|
46
47
|
const cwd = ctx.cwd || '/home/user';
|
|
@@ -69,9 +70,6 @@ export function makePythonRunnerFactory(deps) {
|
|
|
69
70
|
ctx.stderr.write(`${binName}: python_stdlib.zip missing\n`);
|
|
70
71
|
return 127;
|
|
71
72
|
}
|
|
72
|
-
const asmWasmBytes = vfs.readFile(asmWasmVfs);
|
|
73
|
-
const asmJsBytes = vfs.readFile(asmJsVfs);
|
|
74
|
-
const stdlibBytes = vfs.readFile(stdlibVfs);
|
|
75
73
|
// ── Parse argv ───────────────────────────────────────────────
|
|
76
74
|
// Supported in v1:
|
|
77
75
|
// python -c '<code>' run inline code, args[i+1..] in sys.argv
|
|
@@ -133,10 +131,24 @@ export function makePythonRunnerFactory(deps) {
|
|
|
133
131
|
if (!userEnv.PYTHONUNBUFFERED)
|
|
134
132
|
userEnv.PYTHONUNBUFFERED = '1';
|
|
135
133
|
// ── Dispatch the facet ───────────────────────────────────────
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
let runtime;
|
|
135
|
+
try {
|
|
136
|
+
if (!runtimePromise) {
|
|
137
|
+
runtimePromise = createPythonFacetRuntime(facetMgr, {
|
|
138
|
+
asmWasmVfs,
|
|
139
|
+
asmJsVfs,
|
|
140
|
+
stdlibVfs,
|
|
141
|
+
vfs,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
runtime = await runtimePromise;
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
runtimePromise = null;
|
|
148
|
+
ctx.stderr.write(`${binName}: python runtime warm-up failed: ${e?.message || e}\n`);
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
const result = await dispatchPythonFacet(runtime, {
|
|
140
152
|
userCode,
|
|
141
153
|
pyArgv,
|
|
142
154
|
userEnv,
|
|
@@ -234,70 +246,7 @@ function uint8ToBase64(u8) {
|
|
|
234
246
|
}
|
|
235
247
|
return btoa(s);
|
|
236
248
|
}
|
|
237
|
-
async function dispatchPythonFacet(
|
|
238
|
-
const toAB = (u8) => u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
239
|
-
// pyodide.asm.js is INLINED into the preamble (1 MiB text source).
|
|
240
|
-
// Workerd's CSP allows wasm code-gen AND JS top-level evaluation at
|
|
241
|
-
// module-load time, but BLOCKS `new Function(src)` at request time.
|
|
242
|
-
// The asm.js source declares `var _createPyodideModule = ...` at
|
|
243
|
-
// module-top; spliced into the preamble it becomes a module-scope
|
|
244
|
-
// binding we expose via `globalThis._createPyodideModule = ...`
|
|
245
|
-
// right after.
|
|
246
|
-
//
|
|
247
|
-
// stdlib.zip stays in the context (base64) — it's data not code,
|
|
248
|
-
// and the context blob is evaluated at module-load too.
|
|
249
|
-
let asmJsSrc = new TextDecoder('utf-8').decode(args.asmJsBytes);
|
|
250
|
-
// ── Source-patch the asm.js's "Cannot determine runtime environment" branch ──
|
|
251
|
-
//
|
|
252
|
-
// Even with our globalThis.process / WorkerGlobalScope / self / location
|
|
253
|
-
// shims in place, the asm.js's pyodide_js_init() IIFE's env-detect (via
|
|
254
|
-
// bn → vn) somehow lands d.IN_BROWSER_WEB_WORKER = false at request time
|
|
255
|
-
// on workerd. Our supervisor-side mirror of the same logic returns
|
|
256
|
-
// IN_BROWSER_WEB_WORKER = true with the same shims; the discrepancy
|
|
257
|
-
// remains unidentified after P8-P17 of diagnostic instrumentation.
|
|
258
|
-
//
|
|
259
|
-
// Pragmatic v1 fix: source-patch the if-chain to ALWAYS take the
|
|
260
|
-
// IN_BROWSER_WEB_WORKER branch (regardless of `d`). The branch's body
|
|
261
|
-
// assigns `Fe` to a globalThis.importScripts-based loadScript helper.
|
|
262
|
-
// We don't actually call Fe (Pyodide only invokes loadScript when
|
|
263
|
-
// dynamic-loading a wasm sibling; our instantiateWasm override pre-
|
|
264
|
-
// empts that). So the patch is functionally a no-op other than making
|
|
265
|
-
// the throw unreachable.
|
|
266
|
-
//
|
|
267
|
-
// The patch target string is a literal in the minified asm.js — stable
|
|
268
|
-
// across rebuilds because it's a unique identifier path.
|
|
269
|
-
const PATCH_NEEDLE = 'else throw new Error("Cannot determine runtime environment")';
|
|
270
|
-
const PATCH_REPLACE = '/* nimbus-patch: was: ' + PATCH_NEEDLE + ' */';
|
|
271
|
-
if (asmJsSrc.includes(PATCH_NEEDLE)) {
|
|
272
|
-
asmJsSrc = asmJsSrc.replace(PATCH_NEEDLE, PATCH_REPLACE);
|
|
273
|
-
}
|
|
274
|
-
// Also patch the if-chain head so we ALWAYS set Fe (force-take the
|
|
275
|
-
// first branch — IN_BROWSER_MAIN_THREAD's loadScript path uses
|
|
276
|
-
// `await import(t)` which works in workerd at module-load time).
|
|
277
|
-
// The previous patch alone is insufficient because if NO branch matches,
|
|
278
|
-
// Fe stays undefined → calling it would TypeError later.
|
|
279
|
-
const HEAD_NEEDLE = 'if(d.IN_BROWSER_MAIN_THREAD)';
|
|
280
|
-
const HEAD_REPLACE = 'if(true||d.IN_BROWSER_MAIN_THREAD)';
|
|
281
|
-
if (asmJsSrc.includes(HEAD_NEEDLE)) {
|
|
282
|
-
asmJsSrc = asmJsSrc.replace(HEAD_NEEDLE, HEAD_REPLACE);
|
|
283
|
-
}
|
|
284
|
-
const stdlibB64 = uint8ToBase64(args.stdlibBytes);
|
|
285
|
-
// Build the preamble with stdlib bytes spliced in. The preamble runs
|
|
286
|
-
// the entire Pyodide bootstrap at child-facet module-init time —
|
|
287
|
-
// where workerd's CSP permits `new WebAssembly.Module(rawBytes)` (the
|
|
288
|
-
// convertJsFunctionToWasm code path which is the v1 hang root).
|
|
289
|
-
// Per-call __pyodideRun just executes runPython on the cached
|
|
290
|
-
// Pyodide instance.
|
|
291
|
-
const preamble = buildPyodidePreamble(asmJsSrc, stdlibB64);
|
|
292
|
-
const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
|
|
293
|
-
const env = facetMgr.env;
|
|
294
|
-
const ctx = facetMgr.ctx;
|
|
295
|
-
const pool = new NimbusLoaderPool(env, ctx, {
|
|
296
|
-
tag: 'python-runner',
|
|
297
|
-
concurrency: 1,
|
|
298
|
-
omitSupervisor: true,
|
|
299
|
-
preamble,
|
|
300
|
-
});
|
|
249
|
+
async function dispatchPythonFacet(runtime, args) {
|
|
301
250
|
// v2 simplification: stdlibB64 and asmWasmMod are now embedded in the
|
|
302
251
|
// preamble (stdlib via base64 splice; wasm via __NIMBUS_WASM table set
|
|
303
252
|
// by the loader-pool). The facet fn only needs the per-call inputs.
|
|
@@ -315,15 +264,12 @@ async function dispatchPythonFacet(facetMgr, args) {
|
|
|
315
264
|
});
|
|
316
265
|
};
|
|
317
266
|
try {
|
|
318
|
-
const result = await pool.submit(facetFn, {
|
|
267
|
+
const result = await runtime.pool.submit(facetFn, {
|
|
319
268
|
userCode: args.userCode,
|
|
320
269
|
pyArgv: args.pyArgv,
|
|
321
270
|
userEnv: args.userEnv,
|
|
322
271
|
progName: args.progName,
|
|
323
272
|
}, {
|
|
324
|
-
wasmModules: {
|
|
325
|
-
'pyodide.asm.wasm': toAB(args.asmWasmBytes),
|
|
326
|
-
},
|
|
327
273
|
timeoutMs: 300_000,
|
|
328
274
|
});
|
|
329
275
|
return {
|
|
@@ -342,6 +288,40 @@ async function dispatchPythonFacet(facetMgr, args) {
|
|
|
342
288
|
};
|
|
343
289
|
}
|
|
344
290
|
}
|
|
291
|
+
async function createPythonFacetRuntime(facetMgr, args) {
|
|
292
|
+
const toAB = (u8) => u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
293
|
+
if (!args.asmWasmVfs || !args.asmJsVfs || !args.stdlibVfs) {
|
|
294
|
+
throw new Error('installed Pyodide manifest is missing required files');
|
|
295
|
+
}
|
|
296
|
+
const asmWasmBytes = args.vfs.readFile(args.asmWasmVfs);
|
|
297
|
+
const asmJsBytes = args.vfs.readFile(args.asmJsVfs);
|
|
298
|
+
const stdlibBytes = args.vfs.readFile(args.stdlibVfs);
|
|
299
|
+
let asmJsSrc = new TextDecoder('utf-8').decode(asmJsBytes);
|
|
300
|
+
const PATCH_NEEDLE = 'else throw new Error("Cannot determine runtime environment")';
|
|
301
|
+
const PATCH_REPLACE = '/* nimbus-patch: was: ' + PATCH_NEEDLE + ' */';
|
|
302
|
+
if (asmJsSrc.includes(PATCH_NEEDLE)) {
|
|
303
|
+
asmJsSrc = asmJsSrc.replace(PATCH_NEEDLE, PATCH_REPLACE);
|
|
304
|
+
}
|
|
305
|
+
const HEAD_NEEDLE = 'if(d.IN_BROWSER_MAIN_THREAD)';
|
|
306
|
+
const HEAD_REPLACE = 'if(true||d.IN_BROWSER_MAIN_THREAD)';
|
|
307
|
+
if (asmJsSrc.includes(HEAD_NEEDLE)) {
|
|
308
|
+
asmJsSrc = asmJsSrc.replace(HEAD_NEEDLE, HEAD_REPLACE);
|
|
309
|
+
}
|
|
310
|
+
const preamble = buildPyodidePreamble(asmJsSrc, uint8ToBase64(stdlibBytes));
|
|
311
|
+
const { NimbusLoaderPool } = await import('../loaders/loader-pool.js');
|
|
312
|
+
const env = facetMgr.env;
|
|
313
|
+
const ctx = facetMgr.ctx;
|
|
314
|
+
const pool = new NimbusLoaderPool(env, ctx, {
|
|
315
|
+
tag: 'python-runner',
|
|
316
|
+
concurrency: 1,
|
|
317
|
+
omitSupervisor: true,
|
|
318
|
+
preamble,
|
|
319
|
+
wasmModules: {
|
|
320
|
+
'pyodide.asm.wasm': toAB(asmWasmBytes),
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
return { pool };
|
|
324
|
+
}
|
|
345
325
|
/**
|
|
346
326
|
* Compose the per-call preamble by splicing the pyodide.asm.js source
|
|
347
327
|
* verbatim ahead of the __pyodideRun helper. Workerd compiles this
|
|
@@ -805,15 +785,34 @@ globalThis.__pyodideRun = async function __pyodideRun(args) {
|
|
|
805
785
|
// overwrite sys.argv at request time via a tiny runPython prelude.
|
|
806
786
|
// pyArgv is the user-visible argv (script name first, then args);
|
|
807
787
|
// progName is the executable that prefixes errors.
|
|
788
|
+
const argv = [args.progName].concat((args.pyArgv || []).slice(0));
|
|
789
|
+
// If pyArgv already includes the script as [0], use it directly.
|
|
790
|
+
// Convention from the python-runner caller: pyArgv = [progName,
|
|
791
|
+
// ...args]. We set sys.argv = pyArgv with [0] = progName.
|
|
792
|
+
const effectiveArgv = (args.pyArgv && args.pyArgv.length > 0) ? args.pyArgv : argv;
|
|
793
|
+
|
|
794
|
+
let userGlobals = null;
|
|
795
|
+
try {
|
|
796
|
+
const dictCtor = pyodide.globals?.get?.('dict');
|
|
797
|
+
userGlobals = typeof dictCtor === 'function' ? dictCtor() : null;
|
|
798
|
+
if (userGlobals && typeof userGlobals.set === 'function') {
|
|
799
|
+
userGlobals.set('__name__', '__main__');
|
|
800
|
+
userGlobals.set('__package__', null);
|
|
801
|
+
const argv0 = effectiveArgv[0];
|
|
802
|
+
if (argv0 && argv0 !== '-c' && argv0 !== '-') {
|
|
803
|
+
userGlobals.set('__file__', argv0);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
try { dictCtor?.destroy?.(); } catch {}
|
|
807
|
+
} catch {
|
|
808
|
+
userGlobals = null;
|
|
809
|
+
}
|
|
810
|
+
|
|
808
811
|
try {
|
|
809
|
-
const argv = [args.progName].concat((args.pyArgv || []).slice(0));
|
|
810
|
-
// If pyArgv already includes the script as [0], use it directly.
|
|
811
|
-
// Convention from the python-runner caller: pyArgv = [progName,
|
|
812
|
-
// ...args]. We set sys.argv = pyArgv with [0] = progName.
|
|
813
|
-
const effectiveArgv = (args.pyArgv && args.pyArgv.length > 0) ? args.pyArgv : argv;
|
|
814
812
|
pyodide.runPython(
|
|
815
813
|
'import sys\\nsys.argv = ' +
|
|
816
|
-
JSON.stringify(effectiveArgv)
|
|
814
|
+
JSON.stringify(effectiveArgv),
|
|
815
|
+
userGlobals ? { globals: userGlobals } : undefined
|
|
817
816
|
);
|
|
818
817
|
} catch { /* best-effort */ }
|
|
819
818
|
|
|
@@ -824,7 +823,10 @@ globalThis.__pyodideRun = async function __pyodideRun(args) {
|
|
|
824
823
|
let exitCode = 0;
|
|
825
824
|
if (args.userCode) {
|
|
826
825
|
try {
|
|
827
|
-
pyodide.runPython(
|
|
826
|
+
pyodide.runPython(
|
|
827
|
+
args.userCode,
|
|
828
|
+
userGlobals ? { globals: userGlobals } : undefined
|
|
829
|
+
);
|
|
828
830
|
// If runPython returned normally, exit code is 0 unless onExit
|
|
829
831
|
// was invoked (which can happen if user called sys.exit but
|
|
830
832
|
// Pyodide handled it via ExitStatus before throwing).
|
|
@@ -856,6 +858,8 @@ globalThis.__pyodideRun = async function __pyodideRun(args) {
|
|
|
856
858
|
}
|
|
857
859
|
}
|
|
858
860
|
|
|
861
|
+
try { userGlobals?.destroy?.(); } catch {}
|
|
862
|
+
|
|
859
863
|
return {
|
|
860
864
|
exitCode: exitCode,
|
|
861
865
|
stdout: globalThis.__nimbusPyStdout.slice(stdoutStart).join(''),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/session/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA+DH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC;AAG3E,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,CAu+G/D"}
|
package/dist/session/init.js
CHANGED
|
@@ -42,7 +42,7 @@ import { filterWranglerFlags, detectBundlerBin, checkNodeModulesGuard, detectUns
|
|
|
42
42
|
import { HeredocHandler, LineEditorExtender, FdRedirectNormalizer, SubshellNormalizer, BraceExpander, DollarVarShim, BacktickNormalizer } from '../shell/features.js';
|
|
43
43
|
import { registerUnixCommands } from '../shell/unix-commands.js';
|
|
44
44
|
import { registerGitCommands } from '../git/commands.js';
|
|
45
|
-
import { makeNimbusVerbHandler, rehydrateInstalledRuntimes, registerRunnerFactory, } from '../runtime/package-manager.js';
|
|
45
|
+
import { makeNimbusVerbHandler, createRuntimeCommandHintResolver, rehydrateInstalledRuntimes, registerRunnerFactory, } from '../runtime/package-manager.js';
|
|
46
46
|
import { makeClangRunnerFactory } from '../runtime/clang-runner.js';
|
|
47
47
|
import { makePythonRunnerFactory } from '../runtime/python-runner.js';
|
|
48
48
|
import { makeRubyRunnerFactory } from '../runtime/ruby-runner.js';
|
|
@@ -531,6 +531,35 @@ export function initSession(self, ws) {
|
|
|
531
531
|
vfs: sqliteFs,
|
|
532
532
|
registry: pkgRegistry,
|
|
533
533
|
getHome: nimbusGetHome,
|
|
534
|
+
warmRuntime: async (target, ctx) => {
|
|
535
|
+
if (target.name !== 'python')
|
|
536
|
+
return;
|
|
537
|
+
ctx.stdout.write('[python] warming runtime...\n');
|
|
538
|
+
const stdout = { write(_s) { } };
|
|
539
|
+
const stderrText = [];
|
|
540
|
+
const stderr = { write: (s) => { stderrText.push(String(s)); } };
|
|
541
|
+
const py = await registry.resolve('python');
|
|
542
|
+
if (py) {
|
|
543
|
+
const code = await py({
|
|
544
|
+
...ctx,
|
|
545
|
+
args: ['-c', 'pass'],
|
|
546
|
+
vfs: ctx.vfs ?? sqliteFs,
|
|
547
|
+
signal: new AbortController().signal,
|
|
548
|
+
stdout,
|
|
549
|
+
stderr,
|
|
550
|
+
});
|
|
551
|
+
if (typeof code === 'number' && code !== 0) {
|
|
552
|
+
throw new Error(stderrText.join('').trim() || `python warm-up exited ${code}`);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
const { warmPythonRepl } = await import('../runtime/python-repl.js');
|
|
556
|
+
await warmPythonRepl({
|
|
557
|
+
facetMgr,
|
|
558
|
+
vfs: sqliteFs,
|
|
559
|
+
installRoot: target.root,
|
|
560
|
+
});
|
|
561
|
+
ctx.stdout.write('[python] ready\n');
|
|
562
|
+
},
|
|
534
563
|
}));
|
|
535
564
|
// Rehydration runs here even though the shell hasn't been built
|
|
536
565
|
// yet — that's fine: it accesses VFS + registry which are both
|
|
@@ -2466,6 +2495,7 @@ export function initSession(self, ws) {
|
|
|
2466
2495
|
return false;
|
|
2467
2496
|
}
|
|
2468
2497
|
const upstreamResolve = registry.resolve.bind(registry);
|
|
2498
|
+
const runtimeCommandHint = createRuntimeCommandHintResolver(self.env);
|
|
2469
2499
|
registry.resolve = async function nimbusBinFallbackResolve(name) {
|
|
2470
2500
|
const upstream = await upstreamResolve(name);
|
|
2471
2501
|
if (upstream)
|
|
@@ -2483,8 +2513,24 @@ export function initSession(self, ws) {
|
|
|
2483
2513
|
// built yet (very early init), fall back to /home/user.
|
|
2484
2514
|
const cwd = (self.shell?.cwd || '/home/user').replace(/^\/+/, '');
|
|
2485
2515
|
const binShimPath = cwd + '/node_modules/.bin/' + name;
|
|
2486
|
-
if (!sqliteFs.exists(binShimPath))
|
|
2487
|
-
|
|
2516
|
+
if (!sqliteFs.exists(binShimPath)) {
|
|
2517
|
+
let hint = null;
|
|
2518
|
+
try {
|
|
2519
|
+
hint = await runtimeCommandHint(name);
|
|
2520
|
+
}
|
|
2521
|
+
catch {
|
|
2522
|
+
hint = null;
|
|
2523
|
+
}
|
|
2524
|
+
if (!hint)
|
|
2525
|
+
return undefined;
|
|
2526
|
+
const hintHandler = async (ctx) => {
|
|
2527
|
+
ctx.stderr.write(`${name}: command not found\n`);
|
|
2528
|
+
ctx.stderr.write(`hint: install it with: nimbus install ${hint.installSpec}\n`);
|
|
2529
|
+
return 127;
|
|
2530
|
+
};
|
|
2531
|
+
hintHandler.__nimbusRuntimeInstallHint = true;
|
|
2532
|
+
return hintHandler;
|
|
2533
|
+
}
|
|
2488
2534
|
// Synthesised handler. Each resolve call recomputes (cwd can
|
|
2489
2535
|
// change between invocations); we never cache under `name`.
|
|
2490
2536
|
return async (ctx) => {
|
|
@@ -41,6 +41,7 @@ export { detectCloudflareWorkersProject } from '../runtime/project-detect.js';
|
|
|
41
41
|
* the right boundary. See user-debug-transcript.txt lines 1-5.
|
|
42
42
|
*/
|
|
43
43
|
export declare function renderMotdBanner(version: string): string;
|
|
44
|
+
export declare function renderWelcomeMarkdown(version: string): string;
|
|
44
45
|
export declare class NimbusSession extends CloudflareDurableObject {
|
|
45
46
|
sqliteFs: SqliteVFS | null;
|
|
46
47
|
kernel: Kernel | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nimbus-session.d.ts","sourceRoot":"","sources":["../../src/session/nimbus-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAoCnD,OAAO,EAEL,KAAK,uBAAuB,IAAI,gBAAgB,EACjD,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AAS,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhG,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,gFAAgF;IAChF,eAAe,IAAI,IAAI;IAIvB,0FAA0F;IAC1F,kBAAkB,IAAI,IAAI;CAG3B;AAMD,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,YAAY,GACb,MAAM,eAAe,CAAC"}
|
|
@@ -119,6 +119,53 @@ export function renderMotdBanner(version) {
|
|
|
119
119
|
bot +
|
|
120
120
|
'\x1b[0m\r\n');
|
|
121
121
|
}
|
|
122
|
+
export function renderWelcomeMarkdown(version) {
|
|
123
|
+
return `# Welcome to Nimbus v${version}
|
|
124
|
+
|
|
125
|
+
Cloud-native development environment on Cloudflare Workers.
|
|
126
|
+
|
|
127
|
+
## Start Here
|
|
128
|
+
|
|
129
|
+
| Task | Command |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| Run JavaScript | \`node hello.js\` |
|
|
132
|
+
| Install npm packages | \`npm install <pkg>\` |
|
|
133
|
+
| Start the starter app | \`cd app && npm install && npm run dev\` |
|
|
134
|
+
| Run a Cloudflare Worker locally | \`nimbus-wrangler dev\` |
|
|
135
|
+
|
|
136
|
+
## Install More Runtimes
|
|
137
|
+
|
|
138
|
+
Nimbus installs language runtimes on demand:
|
|
139
|
+
|
|
140
|
+
\`\`\`bash
|
|
141
|
+
nimbus install clang # then: clang hello.c -o hello && ./hello
|
|
142
|
+
nimbus install python # then: python -c 'print("hi")'
|
|
143
|
+
nimbus install ruby # then: ruby -e 'puts "hi"'
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
\`python3\`, \`ruby3\`, and \`wasm-ld\` are command aliases. If an
|
|
147
|
+
installable command is missing, Nimbus prints the matching install command.
|
|
148
|
+
|
|
149
|
+
## Interactive REPLs
|
|
150
|
+
|
|
151
|
+
| Runtime | REPL |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| Python | \`python\` or \`python3\` - Pyodide CPython 3.13 |
|
|
154
|
+
| Ruby | \`ruby\` or \`ruby3\` - ruby.wasm 3.3 |
|
|
155
|
+
| Node | \`node\` - workerd Node compatibility runtime |
|
|
156
|
+
|
|
157
|
+
## System Commands
|
|
158
|
+
|
|
159
|
+
\`\`\`bash
|
|
160
|
+
nimbus install --list # show installed runtimes
|
|
161
|
+
nimbus install --available # show catalog
|
|
162
|
+
df # filesystem + cache stats
|
|
163
|
+
\`\`\`
|
|
164
|
+
|
|
165
|
+
The editor opens this file in Markdown preview mode by default. Use
|
|
166
|
+
\`Ctrl+P\` to open files and \`Ctrl+S\` to save edits.
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
122
169
|
export class NimbusSession extends CloudflareDurableObject {
|
|
123
170
|
// this.ctx and this.env are provided by the DurableObject base class
|
|
124
171
|
sqliteFs = null;
|
|
@@ -1020,29 +1067,8 @@ export class NimbusSession extends CloudflareDurableObject {
|
|
|
1020
1067
|
' return 0;\n' +
|
|
1021
1068
|
'}\n');
|
|
1022
1069
|
}
|
|
1023
|
-
if (!fs.exists('home/user/welcome.
|
|
1024
|
-
fs.writeFile('home/user/welcome.
|
|
1025
|
-
'Cloud-native dev environment on Cloudflare Workers.\n\n' +
|
|
1026
|
-
'JavaScript / TypeScript:\n' +
|
|
1027
|
-
' node hello.js — run in isolated dynamic worker\n' +
|
|
1028
|
-
' npm install <pkg> — install npm packages\n' +
|
|
1029
|
-
' vite — start dev server with HMR\n' +
|
|
1030
|
-
' nimbus-wrangler dev — run Cloudflare Worker locally\n' +
|
|
1031
|
-
'\n' +
|
|
1032
|
-
'More languages (install on demand):\n' +
|
|
1033
|
-
" nimbus install clang — then: clang hello.c -o hello && ./hello\n" +
|
|
1034
|
-
" nimbus install python — then: python -c 'print(\"hi\")'\n" +
|
|
1035
|
-
" nimbus install ruby — then: ruby -e 'puts \"hi\"'\n" +
|
|
1036
|
-
'\n' +
|
|
1037
|
-
'Interactive REPLs (after install):\n' +
|
|
1038
|
-
' python — Pyodide CPython 3.13\n' +
|
|
1039
|
-
' ruby — ruby.wasm 3.3\n' +
|
|
1040
|
-
' node — bare REPL\n' +
|
|
1041
|
-
'\n' +
|
|
1042
|
-
'System:\n' +
|
|
1043
|
-
' nimbus install --list — show installed runtimes\n' +
|
|
1044
|
-
' nimbus install --available — show catalog\n' +
|
|
1045
|
-
' df — filesystem + cache stats\n');
|
|
1070
|
+
if (!fs.exists('home/user/welcome.md')) {
|
|
1071
|
+
fs.writeFile('home/user/welcome.md', renderWelcomeMarkdown(NIMBUS_VERSION));
|
|
1046
1072
|
}
|
|
1047
1073
|
// ── Starter app (Vite + React + TS + Tailwind + Router) ──
|
|
1048
1074
|
// Idempotent: guarded by shouldSeedProject() which checks both a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unix-commands.d.ts","sourceRoot":"","sources":["../../src/shell/unix-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"unix-commands.d.ts","sourceRoot":"","sources":["../../src/shell/unix-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA09FtD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,GAAG,EACb,GAAG,EAAE,SAAS,GACb,IAAI,CAoLN"}
|
|
@@ -24,6 +24,9 @@ function getSymlinkRegistry(vfs) {
|
|
|
24
24
|
}
|
|
25
25
|
return v.__nimbus_symlink_registry;
|
|
26
26
|
}
|
|
27
|
+
function isRuntimeInstallHintHandler(handler) {
|
|
28
|
+
return !!handler && !!handler.__nimbusRuntimeInstallHint;
|
|
29
|
+
}
|
|
27
30
|
// ── Helpers ─────────────────────────────────────────────────────────────
|
|
28
31
|
function resolvePath(cwd, p) {
|
|
29
32
|
if (p.startsWith('/'))
|
|
@@ -134,12 +137,7 @@ const _CANONICAL_BIN_PATHS = {
|
|
|
134
137
|
// Self
|
|
135
138
|
nimbus: '/usr/local/bin/nimbus',
|
|
136
139
|
};
|
|
137
|
-
|
|
138
|
-
* fallback. Returns null if not findable. Skip-canonical when the
|
|
139
|
-
* caller knows the command is a shell builtin (no fallback). */
|
|
140
|
-
function _whichLookup(vfs, name, envPath) {
|
|
141
|
-
// 1. Real on-disk binary in $PATH (npm-installed node_modules/.bin,
|
|
142
|
-
// user-placed scripts, etc.).
|
|
140
|
+
function _pathLookup(vfs, name, envPath) {
|
|
143
141
|
const paths = (envPath || '/usr/local/bin:/usr/bin:/bin').split(':');
|
|
144
142
|
for (const dir of paths) {
|
|
145
143
|
if (!dir)
|
|
@@ -150,12 +148,33 @@ function _whichLookup(vfs, name, envPath) {
|
|
|
150
148
|
return '/' + fp;
|
|
151
149
|
}
|
|
152
150
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
async function _registryResolved(registry, name) {
|
|
154
|
+
try {
|
|
155
|
+
const resolved = typeof registry.resolve === 'function'
|
|
156
|
+
? await registry.resolve(name)
|
|
157
|
+
: null;
|
|
158
|
+
if (resolved && !isRuntimeInstallHintHandler(resolved))
|
|
159
|
+
return resolved;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
// Registry misses are normal for unknown commands.
|
|
156
163
|
}
|
|
157
164
|
return null;
|
|
158
165
|
}
|
|
166
|
+
/** Resolve a command name to a path via PATH-walk + canonical-bin
|
|
167
|
+
* fallback. Returns null if not findable. Skip-canonical when the
|
|
168
|
+
* caller knows the command is a shell builtin (no fallback). */
|
|
169
|
+
async function _whichLookup(vfs, registry, name, envPath) {
|
|
170
|
+
const diskPath = _pathLookup(vfs, name, envPath);
|
|
171
|
+
if (diskPath)
|
|
172
|
+
return diskPath;
|
|
173
|
+
const canonicalPath = _CANONICAL_BIN_PATHS[name];
|
|
174
|
+
if (!canonicalPath)
|
|
175
|
+
return null;
|
|
176
|
+
return await _registryResolved(registry, name) ? canonicalPath : null;
|
|
177
|
+
}
|
|
159
178
|
function mkWhich(vfs, registry) {
|
|
160
179
|
return async (ctx) => {
|
|
161
180
|
// Parse flags. Supports -a (show all matches), -s (silent — no
|
|
@@ -191,16 +210,10 @@ function mkWhich(vfs, registry) {
|
|
|
191
210
|
let anyMissing = false;
|
|
192
211
|
for (const name of names) {
|
|
193
212
|
// Classify: is it a registry-resolvable command (shell builtin)?
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const resolved = typeof registry.resolve === 'function'
|
|
197
|
-
? await registry.resolve(name)
|
|
198
|
-
: null;
|
|
199
|
-
isBuiltin = !!resolved;
|
|
200
|
-
}
|
|
201
|
-
catch { /* registry unavailable; treat as not-builtin */ }
|
|
213
|
+
const resolved = await _registryResolved(registry, name);
|
|
214
|
+
const isBuiltin = !!resolved;
|
|
202
215
|
// 1. PATH-walk + canonical-bin lookup.
|
|
203
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
216
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
204
217
|
let found = false;
|
|
205
218
|
if (path) {
|
|
206
219
|
if (!silent)
|
|
@@ -235,15 +248,15 @@ function mkWhich(vfs, registry) {
|
|
|
235
248
|
* binaries on the virtual VFS; print just the binary path. With no
|
|
236
249
|
* match, print just the name (matches `whereis` behavior on missing).
|
|
237
250
|
*/
|
|
238
|
-
function mkWhereis(vfs) {
|
|
239
|
-
return (ctx) => {
|
|
251
|
+
function mkWhereis(vfs, registry) {
|
|
252
|
+
return async (ctx) => {
|
|
240
253
|
const names = ctx.args.filter(a => !a.startsWith('-'));
|
|
241
254
|
if (names.length === 0) {
|
|
242
255
|
ctx.stderr.write('Usage: whereis name [name ...]\n');
|
|
243
256
|
return 1;
|
|
244
257
|
}
|
|
245
258
|
for (const name of names) {
|
|
246
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
259
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
247
260
|
if (path) {
|
|
248
261
|
ctx.stdout.write(`${name}: ${path}\n`);
|
|
249
262
|
}
|
|
@@ -290,36 +303,28 @@ function mkCommand(vfs, registry) {
|
|
|
290
303
|
if (mode === '-v') {
|
|
291
304
|
// Print path or builtin marker; exit 0 if found.
|
|
292
305
|
const name = args[0];
|
|
293
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
306
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
294
307
|
if (path) {
|
|
295
308
|
ctx.stdout.write(path + '\n');
|
|
296
309
|
return 0;
|
|
297
310
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
ctx.stdout.write(name + '\n');
|
|
302
|
-
return 0;
|
|
303
|
-
}
|
|
311
|
+
if (await _registryResolved(registry, name)) {
|
|
312
|
+
ctx.stdout.write(name + '\n');
|
|
313
|
+
return 0;
|
|
304
314
|
}
|
|
305
|
-
catch { /* registry miss */ }
|
|
306
315
|
return 1;
|
|
307
316
|
}
|
|
308
317
|
if (mode === '-V') {
|
|
309
318
|
const name = args[0];
|
|
310
|
-
const path = _whichLookup(vfs, name, ctx.env.PATH || '');
|
|
319
|
+
const path = await _whichLookup(vfs, registry, name, ctx.env.PATH || '');
|
|
311
320
|
if (path) {
|
|
312
321
|
ctx.stdout.write(`${name} is ${path}\n`);
|
|
313
322
|
return 0;
|
|
314
323
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
319
|
-
return 0;
|
|
320
|
-
}
|
|
324
|
+
if (await _registryResolved(registry, name)) {
|
|
325
|
+
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
326
|
+
return 0;
|
|
321
327
|
}
|
|
322
|
-
catch { /* miss */ }
|
|
323
328
|
ctx.stderr.write(`command: ${name}: not found\n`);
|
|
324
329
|
return 1;
|
|
325
330
|
}
|
|
@@ -368,7 +373,7 @@ function mkType(_vfs, registry) {
|
|
|
368
373
|
for (const name of ctx.args) {
|
|
369
374
|
try {
|
|
370
375
|
const resolved = typeof registry.resolve === 'function' ? await registry.resolve(name) : null;
|
|
371
|
-
if (resolved) {
|
|
376
|
+
if (resolved && !isRuntimeInstallHintHandler(resolved)) {
|
|
372
377
|
ctx.stdout.write(`${name} is a shell builtin\n`);
|
|
373
378
|
}
|
|
374
379
|
else {
|
|
@@ -3517,7 +3522,7 @@ function wrap(fn) {
|
|
|
3517
3522
|
}
|
|
3518
3523
|
export function registerUnixCommands(registry, vfs) {
|
|
3519
3524
|
registry.register('which', wrap(mkWhich(vfs, registry)));
|
|
3520
|
-
registry.register('whereis', wrap(mkWhereis(vfs)));
|
|
3525
|
+
registry.register('whereis', wrap(mkWhereis(vfs, registry)));
|
|
3521
3526
|
registry.register('command', wrap(mkCommand(vfs, registry)));
|
|
3522
3527
|
registry.register('type', wrap(mkType(vfs, registry)));
|
|
3523
3528
|
registry.register('env', wrap(mkEnv()));
|