@nimbus-sh/worker 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/facets/manager.d.ts +47 -2
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +139 -15
- package/dist/runtime/bash-repl.d.ts +1 -1
- package/dist/runtime/bash-repl.d.ts.map +1 -1
- package/dist/runtime/bash-repl.js +3 -2
- package/dist/runtime/clang-runner.d.ts +1 -1
- package/dist/runtime/clang-runner.d.ts.map +1 -1
- package/dist/runtime/cpython-resident.d.ts +27 -0
- package/dist/runtime/cpython-resident.d.ts.map +1 -0
- package/dist/runtime/cpython-resident.js +133 -0
- package/dist/runtime/facet-loader-host.d.ts +15 -1
- package/dist/runtime/facet-loader-host.d.ts.map +1 -1
- package/dist/runtime/facet-loader-host.js +41 -0
- package/dist/runtime/package-manager.d.ts +3 -58
- package/dist/runtime/package-manager.d.ts.map +1 -1
- package/dist/runtime/package-manager.js +6 -143
- package/dist/runtime/python-repl.d.ts +1 -1
- package/dist/runtime/python-repl.d.ts.map +1 -1
- package/dist/runtime/python-repl.js +2 -2
- package/dist/runtime/ruby-runner.d.ts +1 -1
- package/dist/runtime/ruby-runner.d.ts.map +1 -1
- package/dist/runtime/ruby-runner.js +1 -1
- package/dist/runtime/runtime-catalog.d.ts +4 -80
- package/dist/runtime/runtime-catalog.d.ts.map +1 -1
- package/dist/runtime/runtime-catalog.js +4 -67
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +29 -41
- package/dist/session/keys.d.ts +13 -0
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +13 -0
- package/dist/session/nimbus-session.d.ts +19 -1
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +36 -1
- package/dist/session/programmatic.d.ts +2 -2
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +2 -1
- package/dist/session/supervisor-rpc.d.ts +6 -13
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +7 -17
- package/package.json +2 -2
- package/scripts/bundle-facet-workers.mjs +5 -5
- package/dist/runtime/bash-runner.d.ts +0 -63
- package/dist/runtime/bash-runner.d.ts.map +0 -1
- package/dist/runtime/bash-runner.generated.d.ts +0 -14
- package/dist/runtime/bash-runner.generated.d.ts.map +0 -1
- package/dist/runtime/bash-runner.generated.js +0 -13
- package/dist/runtime/bash-runner.js +0 -291
- package/dist/runtime/cpython-runner.d.ts +0 -71
- package/dist/runtime/cpython-runner.d.ts.map +0 -1
- package/dist/runtime/cpython-runner.js +0 -535
- package/dist/runtime/python-pip.d.ts +0 -38
- package/dist/runtime/python-pip.d.ts.map +0 -1
- package/dist/runtime/python-pip.js +0 -1063
- package/dist/runtime/runtime-registry.d.ts +0 -162
- package/dist/runtime/runtime-registry.d.ts.map +0 -1
- package/dist/runtime/runtime-registry.js +0 -364
- package/dist/runtime/virtual-socket-kernel.generated.d.ts +0 -14
- package/dist/runtime/virtual-socket-kernel.generated.d.ts.map +0 -1
- package/dist/runtime/virtual-socket-kernel.generated.js +0 -13
- package/dist/runtime/wasm-runner.d.ts +0 -70
- package/dist/runtime/wasm-runner.d.ts.map +0 -1
- package/dist/runtime/wasm-runner.js +0 -664
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* wasm-runner.ts — native-WASM runner via the LOADER-modules transport.
|
|
3
|
-
*
|
|
4
|
-
* Direct `WebAssembly.instantiate(bytes)` is blocked by workerd CSP at
|
|
5
|
-
* request time in both the supervisor and facet isolates. This runner routes
|
|
6
|
-
* through the LOADER modules map:
|
|
7
|
-
* bytes ride INSIDE the worker code blob, workerd compiles them
|
|
8
|
-
* during the inner worker's MODULE-LOAD phase (the one phase where
|
|
9
|
-
* wasm code generation IS allowed), and the resulting
|
|
10
|
-
* WebAssembly.Module is exposed to the user fn via the
|
|
11
|
-
* NimbusLoaderPool's `globalThis.__NIMBUS_WASM[<name>]` table.
|
|
12
|
-
*
|
|
13
|
-
* Shell command shape
|
|
14
|
-
* ───────────────────
|
|
15
|
-
*
|
|
16
|
-
* wasm-runner --version
|
|
17
|
-
* wasm-runner <file.wasm> <exportName> [int args...]
|
|
18
|
-
*
|
|
19
|
-
* Each invocation:
|
|
20
|
-
* 1. Reads bytes from VFS (or any caller-supplied source).
|
|
21
|
-
* 2. Allocates a PID via the process supervisor (Process tab integration).
|
|
22
|
-
* 3. NimbusLoaderPool.submit() with wasmModules: { 'user.wasm': bytes }
|
|
23
|
-
* — pool merges per-call wasm with constructor-time entries,
|
|
24
|
-
* generates a worker.js that imports './user.wasm', and ships
|
|
25
|
-
* the modules map to env.LOADER.get(...).
|
|
26
|
-
* 4. The submitted fn runs inside the inner facet:
|
|
27
|
-
* - reads globalThis.__NIMBUS_WASM['user.wasm'] (the precompiled
|
|
28
|
-
* Module the pool registered)
|
|
29
|
-
* - WebAssembly.instantiate(module, {}) — allowed because the
|
|
30
|
-
* Module is precompiled
|
|
31
|
-
* - looks up the export, calls with parsed integer args, returns
|
|
32
|
-
* the result + the export list
|
|
33
|
-
* 5. Supervisor formats and writes stdout/stderr; exit code 0/1.
|
|
34
|
-
*
|
|
35
|
-
* Limitations (documented in --help):
|
|
36
|
-
* - Function args are integers only (parseInt). Float / string /
|
|
37
|
-
* multi-arg-shapes need a wrapper module.
|
|
38
|
-
* - Only WebAssembly.Memory and integer return values are surfaced.
|
|
39
|
-
* - WASI imports are NOT provided. Modules expecting wasi_snapshot
|
|
40
|
-
* won't instantiate (fail at the in-facet instantiate step).
|
|
41
|
-
*
|
|
42
|
-
* Dispatch constraints
|
|
43
|
-
* ────────────────────
|
|
44
|
-
* - No sleeps, caller-side retries, or catch-and-continue around loader
|
|
45
|
-
* failures. The pool's resilience options own retry behavior.
|
|
46
|
-
* - The try/catch around vfs.readFile is a legitimate I/O boundary;
|
|
47
|
-
* the diagnostic propagates as exitCode 1 + stderr line.
|
|
48
|
-
* - NO direct WebAssembly.instantiate(bytes) at request time —
|
|
49
|
-
* workerd CSP rejects that path.
|
|
50
|
-
*/
|
|
51
|
-
import type { RuntimeRunOpts, RuntimeRunResult } from './runtime-registry.js';
|
|
52
|
-
import type { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
|
|
53
|
-
import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
|
|
54
|
-
export declare const WASM_RUNNER_VERSION = "0.3.0";
|
|
55
|
-
export declare const WASM_RUNNER_HELP: string;
|
|
56
|
-
export declare function formatWasmRunnerWasiInfo(): string;
|
|
57
|
-
/**
|
|
58
|
-
* Build a `run` function suitable for RuntimeSpec.run(). Parameterised
|
|
59
|
-
* over the VFS, env (for env.LOADER), ctx (for the pool's doId-scoped
|
|
60
|
-
* cache key), and the session process supervisor (for `ps` /
|
|
61
|
-
* `logs <pid>` / Process tab integration). Returns a fn that matches
|
|
62
|
-
* the runtime-registry's contract.
|
|
63
|
-
*/
|
|
64
|
-
export declare function makeWasmRunner(deps: {
|
|
65
|
-
vfs: SqliteVFS;
|
|
66
|
-
env: any;
|
|
67
|
-
ctx: DurableObjectState;
|
|
68
|
-
processes: SessionProcessSupervisor;
|
|
69
|
-
}): (_facetMgr: unknown, _code: string, opts: RuntimeRunOpts) => Promise<RuntimeRunResult>;
|
|
70
|
-
//# sourceMappingURL=wasm-runner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-runner.d.ts","sourceRoot":"","sources":["../../src/runtime/wasm-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAmDnE,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,gBAAgB,QAoCwC,CAAC;AAEtE,wBAAgB,wBAAwB,IAAI,MAAM,CASjD;AAyCD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,GAAG,EAAE,SAAS,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,kBAAkB,CAAC;IACxB,SAAS,EAAE,wBAAwB,CAAC;CACrC,IAEG,WAAW,OAAO,EAClB,OAAO,MAAM,EACb,MAAM,cAAc,KACnB,OAAO,CAAC,gBAAgB,CAAC,CAslB7B"}
|