@nimbus-sh/worker 0.1.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/README.md +219 -0
- package/dist/_shared/bytes.d.ts +18 -0
- package/dist/_shared/bytes.d.ts.map +1 -0
- package/dist/_shared/bytes.js +17 -0
- package/dist/_shared/cache-stats.d.ts +146 -0
- package/dist/_shared/cache-stats.d.ts.map +1 -0
- package/dist/_shared/cache-stats.js +162 -0
- package/dist/_shared/exports-resolver.d.ts +76 -0
- package/dist/_shared/exports-resolver.d.ts.map +1 -0
- package/dist/_shared/exports-resolver.js +284 -0
- package/dist/_shared/install-phase.d.ts +47 -0
- package/dist/_shared/install-phase.d.ts.map +1 -0
- package/dist/_shared/install-phase.js +1 -0
- package/dist/_shared/real-node-imports.d.ts +38 -0
- package/dist/_shared/real-node-imports.d.ts.map +1 -0
- package/dist/_shared/real-node-imports.js +46 -0
- package/dist/_shared/retry.d.ts +93 -0
- package/dist/_shared/retry.d.ts.map +1 -0
- package/dist/_shared/retry.js +161 -0
- package/dist/_shared/session-id.d.ts +39 -0
- package/dist/_shared/session-id.d.ts.map +1 -0
- package/dist/_shared/session-id.js +127 -0
- package/dist/_shared/session-router.d.ts +104 -0
- package/dist/_shared/session-router.d.ts.map +1 -0
- package/dist/_shared/session-router.js +165 -0
- package/dist/_shared/w7-frame.d.ts +93 -0
- package/dist/_shared/w7-frame.d.ts.map +1 -0
- package/dist/_shared/w7-frame.js +402 -0
- package/dist/auth/index.d.ts +16 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/middleware.d.ts +85 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +150 -0
- package/dist/auth/token.d.ts +96 -0
- package/dist/auth/token.d.ts.map +1 -0
- package/dist/auth/token.js +226 -0
- package/dist/auth/types.d.ts +141 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +114 -0
- package/dist/bindings/d1.d.ts +102 -0
- package/dist/bindings/d1.d.ts.map +1 -0
- package/dist/bindings/d1.js +549 -0
- package/dist/bindings/kv.d.ts +82 -0
- package/dist/bindings/kv.d.ts.map +1 -0
- package/dist/bindings/kv.js +290 -0
- package/dist/bindings/r2.d.ts +137 -0
- package/dist/bindings/r2.d.ts.map +1 -0
- package/dist/bindings/r2.js +379 -0
- package/dist/cirrus-npm-cjs.generated.d.ts +17 -0
- package/dist/cirrus-npm-cjs.generated.d.ts.map +1 -0
- package/dist/cirrus-npm-cjs.generated.js +41 -0
- package/dist/cirrus-plugin-react.generated.d.ts +34 -0
- package/dist/cirrus-plugin-react.generated.d.ts.map +1 -0
- package/dist/cirrus-plugin-react.generated.js +33 -0
- package/dist/constants.d.ts +34 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +116 -0
- package/dist/esbuild-wasm-bundle.generated.d.ts +41 -0
- package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -0
- package/dist/esbuild-wasm-bundle.generated.js +40 -0
- package/dist/facets/cirrus-real.d.ts +147 -0
- package/dist/facets/cirrus-real.d.ts.map +1 -0
- package/dist/facets/cirrus-real.js +981 -0
- package/dist/facets/inner-do-registry.d.ts +41 -0
- package/dist/facets/inner-do-registry.d.ts.map +1 -0
- package/dist/facets/inner-do-registry.js +51 -0
- package/dist/facets/manager.d.ts +314 -0
- package/dist/facets/manager.d.ts.map +1 -0
- package/dist/facets/manager.js +2681 -0
- package/dist/facets/process.d.ts +318 -0
- package/dist/facets/process.d.ts.map +1 -0
- package/dist/facets/process.js +567 -0
- package/dist/facets/real-vite-fs-shim.d.ts +151 -0
- package/dist/facets/real-vite-fs-shim.d.ts.map +1 -0
- package/dist/facets/real-vite-fs-shim.js +1279 -0
- package/dist/facets/real-vite-hmr.d.ts +142 -0
- package/dist/facets/real-vite-hmr.d.ts.map +1 -0
- package/dist/facets/real-vite-hmr.js +476 -0
- package/dist/facets/vite-dev-server.d.ts +293 -0
- package/dist/facets/vite-dev-server.d.ts.map +1 -0
- package/dist/facets/vite-dev-server.js +2580 -0
- package/dist/facets/wasm-swap-registry.d.ts +261 -0
- package/dist/facets/wasm-swap-registry.d.ts.map +1 -0
- package/dist/facets/wasm-swap-registry.js +551 -0
- package/dist/facets/ws-terminal.d.ts +107 -0
- package/dist/facets/ws-terminal.d.ts.map +1 -0
- package/dist/facets/ws-terminal.js +207 -0
- package/dist/git/commands.d.ts +13 -0
- package/dist/git/commands.d.ts.map +1 -0
- package/dist/git/commands.js +633 -0
- package/dist/git/network-facet.d.ts +61 -0
- package/dist/git/network-facet.d.ts.map +1 -0
- package/dist/git/network-facet.js +700 -0
- package/dist/git-bundle.generated.d.ts +16 -0
- package/dist/git-bundle.generated.d.ts.map +1 -0
- package/dist/git-bundle.generated.js +15 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/loaders/child-process/spawn-facet.d.ts +90 -0
- package/dist/loaders/child-process/spawn-facet.d.ts.map +1 -0
- package/dist/loaders/child-process/spawn-facet.js +103 -0
- package/dist/loaders/child-process/spawn-pool.d.ts +110 -0
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -0
- package/dist/loaders/child-process/spawn-pool.js +161 -0
- package/dist/loaders/fanout-pool.d.ts +195 -0
- package/dist/loaders/fanout-pool.d.ts.map +1 -0
- package/dist/loaders/fanout-pool.js +326 -0
- package/dist/loaders/generated-workers.d.ts +26 -0
- package/dist/loaders/generated-workers.d.ts.map +1 -0
- package/dist/loaders/generated-workers.js +25 -0
- package/dist/loaders/index.d.ts +15 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +13 -0
- package/dist/loaders/loader-pool.d.ts +273 -0
- package/dist/loaders/loader-pool.d.ts.map +1 -0
- package/dist/loaders/loader-pool.js +624 -0
- package/dist/loaders/npm-resolve-preamble.d.ts +34 -0
- package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -0
- package/dist/loaders/npm-resolve-preamble.js +237 -0
- package/dist/loaders/pre-bundle-preamble.d.ts +41 -0
- package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -0
- package/dist/loaders/pre-bundle-preamble.js +114 -0
- package/dist/loaders/vendor/codegen.d.ts +24 -0
- package/dist/loaders/vendor/codegen.d.ts.map +1 -0
- package/dist/loaders/vendor/codegen.js +44 -0
- package/dist/loaders/vendor/errors.d.ts +24 -0
- package/dist/loaders/vendor/errors.d.ts.map +1 -0
- package/dist/loaders/vendor/errors.js +46 -0
- package/dist/loaders/vendor/index.d.ts +16 -0
- package/dist/loaders/vendor/index.d.ts.map +1 -0
- package/dist/loaders/vendor/index.js +11 -0
- package/dist/loaders/vendor/pool.d.ts +88 -0
- package/dist/loaders/vendor/pool.d.ts.map +1 -0
- package/dist/loaders/vendor/pool.js +353 -0
- package/dist/loaders/vendor/primitives.d.ts +11 -0
- package/dist/loaders/vendor/primitives.d.ts.map +1 -0
- package/dist/loaders/vendor/primitives.js +33 -0
- package/dist/loaders/vendor/serialize.d.ts +3 -0
- package/dist/loaders/vendor/serialize.d.ts.map +1 -0
- package/dist/loaders/vendor/serialize.js +25 -0
- package/dist/loaders/vendor/types.d.ts +60 -0
- package/dist/loaders/vendor/types.d.ts.map +1 -0
- package/dist/loaders/vendor/types.js +4 -0
- package/dist/npm/cache.d.ts +136 -0
- package/dist/npm/cache.d.ts.map +1 -0
- package/dist/npm/cache.js +429 -0
- package/dist/npm/install-batch-facet.d.ts +129 -0
- package/dist/npm/install-batch-facet.d.ts.map +1 -0
- package/dist/npm/install-batch-facet.js +598 -0
- package/dist/npm/install-facet.d.ts +29 -0
- package/dist/npm/install-facet.d.ts.map +1 -0
- package/dist/npm/install-facet.js +9 -0
- package/dist/npm/installer.d.ts +239 -0
- package/dist/npm/installer.d.ts.map +1 -0
- package/dist/npm/installer.js +2022 -0
- package/dist/npm/npx-install.d.ts +74 -0
- package/dist/npm/npx-install.d.ts.map +1 -0
- package/dist/npm/npx-install.js +302 -0
- package/dist/npm/pre-bundle-facet.d.ts +168 -0
- package/dist/npm/pre-bundle-facet.d.ts.map +1 -0
- package/dist/npm/pre-bundle-facet.js +653 -0
- package/dist/npm/r2-cache.d.ts +286 -0
- package/dist/npm/r2-cache.d.ts.map +1 -0
- package/dist/npm/r2-cache.js +506 -0
- package/dist/npm/resolve-facet.d.ts +202 -0
- package/dist/npm/resolve-facet.d.ts.map +1 -0
- package/dist/npm/resolve-facet.js +833 -0
- package/dist/npm/resolve-one-facet.d.ts +204 -0
- package/dist/npm/resolve-one-facet.d.ts.map +1 -0
- package/dist/npm/resolve-one-facet.js +437 -0
- package/dist/npm/resolver.d.ts +109 -0
- package/dist/npm/resolver.d.ts.map +1 -0
- package/dist/npm/resolver.js +899 -0
- package/dist/npm/tarball-stream.d.ts +85 -0
- package/dist/npm/tarball-stream.d.ts.map +1 -0
- package/dist/npm/tarball-stream.js +205 -0
- package/dist/npm/tarball.d.ts +51 -0
- package/dist/npm/tarball.d.ts.map +1 -0
- package/dist/npm/tarball.js +185 -0
- package/dist/observability/diag-counters.d.ts +292 -0
- package/dist/observability/diag-counters.d.ts.map +1 -0
- package/dist/observability/diag-counters.js +302 -0
- package/dist/observability/heap-estimate.d.ts +166 -0
- package/dist/observability/heap-estimate.d.ts.map +1 -0
- package/dist/observability/heap-estimate.js +192 -0
- package/dist/observability/heavy-alloc-coord.d.ts +95 -0
- package/dist/observability/heavy-alloc-coord.d.ts.map +1 -0
- package/dist/observability/heavy-alloc-coord.js +149 -0
- package/dist/observability/oom-classify.d.ts +56 -0
- package/dist/observability/oom-classify.d.ts.map +1 -0
- package/dist/observability/oom-classify.js +118 -0
- package/dist/observability/oom-discriminator.d.ts +192 -0
- package/dist/observability/oom-discriminator.d.ts.map +1 -0
- package/dist/observability/oom-discriminator.js +233 -0
- package/dist/real-vite-bundle.generated.d.ts +46 -0
- package/dist/real-vite-bundle.generated.d.ts.map +1 -0
- package/dist/real-vite-bundle.generated.js +53 -0
- package/dist/replica/routing.d.ts +171 -0
- package/dist/replica/routing.d.ts.map +1 -0
- package/dist/replica/routing.js +288 -0
- package/dist/replica/suspension.d.ts +36 -0
- package/dist/replica/suspension.d.ts.map +1 -0
- package/dist/replica/suspension.js +49 -0
- package/dist/router/index.d.ts +156 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +220 -0
- package/dist/runtime/assets-loader.d.ts +71 -0
- package/dist/runtime/assets-loader.d.ts.map +1 -0
- package/dist/runtime/assets-loader.js +128 -0
- package/dist/runtime/barrel-detect.d.ts +46 -0
- package/dist/runtime/barrel-detect.d.ts.map +1 -0
- package/dist/runtime/barrel-detect.js +73 -0
- package/dist/runtime/barrel-synthesizer.d.ts +181 -0
- package/dist/runtime/barrel-synthesizer.d.ts.map +1 -0
- package/dist/runtime/barrel-synthesizer.js +541 -0
- package/dist/runtime/bun-repl.d.ts +46 -0
- package/dist/runtime/bun-repl.d.ts.map +1 -0
- package/dist/runtime/bun-repl.js +326 -0
- package/dist/runtime/bun-runner.d.ts +66 -0
- package/dist/runtime/bun-runner.d.ts.map +1 -0
- package/dist/runtime/bun-runner.js +219 -0
- package/dist/runtime/clang-runner.d.ts +38 -0
- package/dist/runtime/clang-runner.d.ts.map +1 -0
- package/dist/runtime/clang-runner.js +1033 -0
- package/dist/runtime/comment-strip.d.ts +37 -0
- package/dist/runtime/comment-strip.d.ts.map +1 -0
- package/dist/runtime/comment-strip.js +74 -0
- package/dist/runtime/esbuild-service.d.ts +201 -0
- package/dist/runtime/esbuild-service.d.ts.map +1 -0
- package/dist/runtime/esbuild-service.js +1444 -0
- package/dist/runtime/esbuild-wasm-bytes.d.ts +87 -0
- package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -0
- package/dist/runtime/esbuild-wasm-bytes.js +131 -0
- package/dist/runtime/framework-detect.d.ts +71 -0
- package/dist/runtime/framework-detect.d.ts.map +1 -0
- package/dist/runtime/framework-detect.js +178 -0
- package/dist/runtime/long-running-handle.d.ts +133 -0
- package/dist/runtime/long-running-handle.d.ts.map +1 -0
- package/dist/runtime/long-running-handle.js +192 -0
- package/dist/runtime/node-repl.d.ts +36 -0
- package/dist/runtime/node-repl.d.ts.map +1 -0
- package/dist/runtime/node-repl.js +293 -0
- package/dist/runtime/node-runner.d.ts +111 -0
- package/dist/runtime/node-runner.d.ts.map +1 -0
- package/dist/runtime/node-runner.js +194 -0
- package/dist/runtime/node-shims.d.ts +24 -0
- package/dist/runtime/node-shims.d.ts.map +1 -0
- package/dist/runtime/node-shims.js +3019 -0
- package/dist/runtime/package-manager.d.ts +118 -0
- package/dist/runtime/package-manager.d.ts.map +1 -0
- package/dist/runtime/package-manager.js +420 -0
- package/dist/runtime/port-registry.d.ts +80 -0
- package/dist/runtime/port-registry.d.ts.map +1 -0
- package/dist/runtime/port-registry.js +166 -0
- package/dist/runtime/process-logs-api.d.ts +102 -0
- package/dist/runtime/process-logs-api.d.ts.map +1 -0
- package/dist/runtime/process-logs-api.js +253 -0
- package/dist/runtime/process-logs.d.ts +311 -0
- package/dist/runtime/process-logs.d.ts.map +1 -0
- package/dist/runtime/process-logs.js +656 -0
- package/dist/runtime/process-table.d.ts +65 -0
- package/dist/runtime/process-table.d.ts.map +1 -0
- package/dist/runtime/process-table.js +107 -0
- package/dist/runtime/project-detect.d.ts +21 -0
- package/dist/runtime/project-detect.d.ts.map +1 -0
- package/dist/runtime/project-detect.js +46 -0
- package/dist/runtime/python-repl.d.ts +66 -0
- package/dist/runtime/python-repl.d.ts.map +1 -0
- package/dist/runtime/python-repl.js +563 -0
- package/dist/runtime/python-runner.d.ts +50 -0
- package/dist/runtime/python-runner.d.ts.map +1 -0
- package/dist/runtime/python-runner.js +870 -0
- package/dist/runtime/repl-session.d.ts +160 -0
- package/dist/runtime/repl-session.d.ts.map +1 -0
- package/dist/runtime/repl-session.js +393 -0
- package/dist/runtime/require-resolver.d.ts +52 -0
- package/dist/runtime/require-resolver.d.ts.map +1 -0
- package/dist/runtime/require-resolver.js +690 -0
- package/dist/runtime/router-basename.d.ts +36 -0
- package/dist/runtime/router-basename.d.ts.map +1 -0
- package/dist/runtime/router-basename.js +310 -0
- package/dist/runtime/ruby-repl.d.ts +43 -0
- package/dist/runtime/ruby-repl.d.ts.map +1 -0
- package/dist/runtime/ruby-repl.js +229 -0
- package/dist/runtime/ruby-runner.d.ts +62 -0
- package/dist/runtime/ruby-runner.d.ts.map +1 -0
- package/dist/runtime/ruby-runner.js +737 -0
- package/dist/runtime/runtime-catalog.d.ts +99 -0
- package/dist/runtime/runtime-catalog.d.ts.map +1 -0
- package/dist/runtime/runtime-catalog.js +183 -0
- package/dist/runtime/runtime-registry.d.ts +136 -0
- package/dist/runtime/runtime-registry.d.ts.map +1 -0
- package/dist/runtime/runtime-registry.js +318 -0
- package/dist/runtime/streams.d.ts +13 -0
- package/dist/runtime/streams.d.ts.map +1 -0
- package/dist/runtime/streams.js +402 -0
- package/dist/runtime/wasi-instance.d.ts +190 -0
- package/dist/runtime/wasi-instance.d.ts.map +1 -0
- package/dist/runtime/wasi-instance.js +2044 -0
- package/dist/runtime/wasm-runner.d.ts +117 -0
- package/dist/runtime/wasm-runner.d.ts.map +1 -0
- package/dist/runtime/wasm-runner.js +705 -0
- package/dist/session/bindings.d.ts +168 -0
- package/dist/session/bindings.d.ts.map +1 -0
- package/dist/session/bindings.js +524 -0
- package/dist/session/ctx-exports.d.ts +16 -0
- package/dist/session/ctx-exports.d.ts.map +1 -0
- package/dist/session/ctx-exports.js +22 -0
- package/dist/session/diag.d.ts +62 -0
- package/dist/session/diag.d.ts.map +1 -0
- package/dist/session/diag.js +118 -0
- package/dist/session/fs-watch.d.ts +132 -0
- package/dist/session/fs-watch.d.ts.map +1 -0
- package/dist/session/fs-watch.js +255 -0
- package/dist/session/helpers.d.ts +150 -0
- package/dist/session/helpers.d.ts.map +1 -0
- package/dist/session/helpers.js +472 -0
- package/dist/session/hibernation.d.ts +145 -0
- package/dist/session/hibernation.d.ts.map +1 -0
- package/dist/session/hibernation.js +385 -0
- package/dist/session/init-phases.d.ts +87 -0
- package/dist/session/init-phases.d.ts.map +1 -0
- package/dist/session/init-phases.js +137 -0
- package/dist/session/init.d.ts +46 -0
- package/dist/session/init.d.ts.map +1 -0
- package/dist/session/init.js +3579 -0
- package/dist/session/keys.d.ts +56 -0
- package/dist/session/keys.d.ts.map +1 -0
- package/dist/session/keys.js +55 -0
- package/dist/session/nimbus-session.d.ts +434 -0
- package/dist/session/nimbus-session.d.ts.map +1 -0
- package/dist/session/nimbus-session.js +1084 -0
- package/dist/session/programmatic.d.ts +105 -0
- package/dist/session/programmatic.d.ts.map +1 -0
- package/dist/session/programmatic.js +326 -0
- package/dist/session/replica-routes.d.ts +68 -0
- package/dist/session/replica-routes.d.ts.map +1 -0
- package/dist/session/replica-routes.js +77 -0
- package/dist/session/routes.d.ts +29 -0
- package/dist/session/routes.d.ts.map +1 -0
- package/dist/session/routes.js +1331 -0
- package/dist/session/rpc.d.ts +323 -0
- package/dist/session/rpc.d.ts.map +1 -0
- package/dist/session/rpc.js +808 -0
- package/dist/session/state-store.d.ts +210 -0
- package/dist/session/state-store.d.ts.map +1 -0
- package/dist/session/state-store.js +459 -0
- package/dist/session/supervisor-rpc.d.ts +269 -0
- package/dist/session/supervisor-rpc.d.ts.map +1 -0
- package/dist/session/supervisor-rpc.js +437 -0
- package/dist/session/ws-hibernation-config.d.ts +64 -0
- package/dist/session/ws-hibernation-config.d.ts.map +1 -0
- package/dist/session/ws-hibernation-config.js +89 -0
- package/dist/session/ws.d.ts +95 -0
- package/dist/session/ws.d.ts.map +1 -0
- package/dist/session/ws.js +395 -0
- package/dist/shell/features.d.ts +410 -0
- package/dist/shell/features.d.ts.map +1 -0
- package/dist/shell/features.js +1885 -0
- package/dist/shell/unix-commands.d.ts +15 -0
- package/dist/shell/unix-commands.d.ts.map +1 -0
- package/dist/shell/unix-commands.js +3703 -0
- package/dist/stubs/lifo-ui.d.ts +10 -0
- package/dist/stubs/lifo-ui.d.ts.map +1 -0
- package/dist/stubs/lifo-ui.js +1 -0
- package/dist/tailwind-play.generated.d.ts +19 -0
- package/dist/tailwind-play.generated.d.ts.map +1 -0
- package/dist/tailwind-play.generated.js +18 -0
- package/dist/vfs/dev-provider.d.ts +64 -0
- package/dist/vfs/dev-provider.d.ts.map +1 -0
- package/dist/vfs/dev-provider.js +191 -0
- package/dist/vfs/events.d.ts +51 -0
- package/dist/vfs/events.d.ts.map +1 -0
- package/dist/vfs/events.js +127 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.d.ts.map +1 -0
- package/dist/vfs/path.js +41 -0
- package/dist/vfs/seed-project.d.ts +62 -0
- package/dist/vfs/seed-project.d.ts.map +1 -0
- package/dist/vfs/seed-project.js +1045 -0
- package/dist/vfs/sqlite-vfs.d.ts +435 -0
- package/dist/vfs/sqlite-vfs.d.ts.map +1 -0
- package/dist/vfs/sqlite-vfs.js +1670 -0
- package/dist/vfs/symlink-registry.d.ts +64 -0
- package/dist/vfs/symlink-registry.d.ts.map +1 -0
- package/dist/vfs/symlink-registry.js +137 -0
- package/dist/wrangler/nimbus-wrangler.d.ts +157 -0
- package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -0
- package/dist/wrangler/nimbus-wrangler.js +931 -0
- package/package.json +77 -0
- package/public/_assets/cirrus-plugin-react.bundle.js +70740 -0
- package/public/_assets/esbuild-0.24.2.wasm +0 -0
- package/public/_assets/real-vite-bundle.js +101478 -0
- package/public/_assets/rollup.wasm +0 -0
- package/public/favicon.svg +8 -0
- package/public/index.html +565 -0
- package/public/s/index.html +2379 -0
- package/scripts/bundle-esbuild-wasm.mjs +244 -0
- package/scripts/bundle-facet-workers.mjs +137 -0
- package/scripts/bundle-git.mjs +118 -0
- package/scripts/bundle-npm-cjs.mjs +363 -0
- package/scripts/bundle-plugin-react.mjs +480 -0
- package/scripts/bundle-real-vite.mjs +959 -0
- package/scripts/bundle-runtime.mjs +600 -0
- package/scripts/bundle-tailwind-play.mjs +130 -0
- package/scripts/patch-lifo-ui.mjs +131 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runtime-catalog.ts — R2 + Cache API L2 wrapper for the
|
|
3
|
+
* `nimbus install <runtime>` package manager.
|
|
4
|
+
*
|
|
5
|
+
* Per `/workspace/.seal-internal/2026-05-10-true-os/plan.md` §2.3, §2.4:
|
|
6
|
+
*
|
|
7
|
+
* L1 (per-DO SqliteFS) — populated at install time.
|
|
8
|
+
* L2 (caches.default per-colo) — sub-ms reads after first hit.
|
|
9
|
+
* L3 (R2 nimbus-runtime-cache) — primary source of truth.
|
|
10
|
+
*
|
|
11
|
+
* R2 layout:
|
|
12
|
+
*
|
|
13
|
+
* catalog/v1.json ← top-level catalog
|
|
14
|
+
* manifests/<name>-<version>.json ← per-version manifest
|
|
15
|
+
* blobs/<name>-<version>/<file> ← content-addressed blobs
|
|
16
|
+
*
|
|
17
|
+
* Catalog schema (RuntimeCatalog):
|
|
18
|
+
* { version: 1, runtimes: { <name>: { default, versions: { <ver>: { manifest, size_bytes, license } } } } }
|
|
19
|
+
*
|
|
20
|
+
* Manifest schema (RuntimeManifest):
|
|
21
|
+
* { name, version, license, wasi_namespace, memfs_companion,
|
|
22
|
+
* files: [{ path, content, sha256, size, mode? }],
|
|
23
|
+
* entrypoints: [{ binName, runner, args[], kind? }] }
|
|
24
|
+
*
|
|
25
|
+
* The wave's anti-reqs apply: no setTimeout / no retry / no defensive-
|
|
26
|
+
* catch. R2 / cache failures throw; the verb's UX surface formats them.
|
|
27
|
+
*/
|
|
28
|
+
/** Minimal R2Bucket shape we depend on. */
|
|
29
|
+
type R2BucketLike = {
|
|
30
|
+
get(key: string): Promise<{
|
|
31
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
32
|
+
text(): Promise<string>;
|
|
33
|
+
} | null>;
|
|
34
|
+
} | null | undefined;
|
|
35
|
+
/** Minimal env shape this module consumes. */
|
|
36
|
+
export interface RuntimeCatalogEnv {
|
|
37
|
+
NIMBUS_RUNTIME_CACHE?: R2BucketLike;
|
|
38
|
+
}
|
|
39
|
+
export interface CatalogVersionEntry {
|
|
40
|
+
manifest: string;
|
|
41
|
+
size_bytes: number;
|
|
42
|
+
license: string;
|
|
43
|
+
}
|
|
44
|
+
export interface CatalogRuntimeEntry {
|
|
45
|
+
default: string;
|
|
46
|
+
versions: Record<string, CatalogVersionEntry>;
|
|
47
|
+
}
|
|
48
|
+
export interface RuntimeCatalog {
|
|
49
|
+
version: 1;
|
|
50
|
+
runtimes: Record<string, CatalogRuntimeEntry>;
|
|
51
|
+
}
|
|
52
|
+
export interface ManifestFile {
|
|
53
|
+
/** VFS path relative to ~/.nimbus/runtimes/<name>/<version>/. */
|
|
54
|
+
path: string;
|
|
55
|
+
/** R2 key for the content blob. */
|
|
56
|
+
content: string;
|
|
57
|
+
/** Hex sha256 of the content blob bytes. */
|
|
58
|
+
sha256: string;
|
|
59
|
+
/** Byte size. */
|
|
60
|
+
size: number;
|
|
61
|
+
/** Optional file mode hint ("exec" → registered as a shell bin). */
|
|
62
|
+
mode?: 'exec';
|
|
63
|
+
}
|
|
64
|
+
export interface ManifestEntrypoint {
|
|
65
|
+
/** Shell command name. */
|
|
66
|
+
binName: string;
|
|
67
|
+
/** Runner key (e.g. "clang-runner") — package manager dispatches to
|
|
68
|
+
* the right runner factory by this. */
|
|
69
|
+
runner: string;
|
|
70
|
+
/** Default args prepended to user args at invocation. */
|
|
71
|
+
args: string[];
|
|
72
|
+
/** Optional secondary classification (e.g. "linker" for wasm-ld). */
|
|
73
|
+
kind?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface RuntimeManifest {
|
|
76
|
+
name: string;
|
|
77
|
+
version: string;
|
|
78
|
+
license: string;
|
|
79
|
+
/** Which WASI namespace the binaries import — `wasi_unstable` for
|
|
80
|
+
* binji clang. `null` for non-WASI runtimes (e.g. Pyodide). */
|
|
81
|
+
wasi_namespace: string | null;
|
|
82
|
+
/** Optional sibling-blob VFS path that the runner needs to load
|
|
83
|
+
* as a 2nd `modules:` entry (binji's memfs.wasm helper). */
|
|
84
|
+
memfs_companion: string | null;
|
|
85
|
+
files: ManifestFile[];
|
|
86
|
+
entrypoints: ManifestEntrypoint[];
|
|
87
|
+
}
|
|
88
|
+
/** Fetch the top-level catalog. Throws if neither L2 nor R2 has it. */
|
|
89
|
+
export declare function fetchCatalog(env: RuntimeCatalogEnv): Promise<RuntimeCatalog>;
|
|
90
|
+
/** Fetch a per-version manifest by its R2 key. */
|
|
91
|
+
export declare function fetchManifest(env: RuntimeCatalogEnv, manifestKey: string): Promise<RuntimeManifest>;
|
|
92
|
+
/**
|
|
93
|
+
* Fetch a content-addressed blob by R2 key. Bytes are eternally
|
|
94
|
+
* cacheable because the key encodes the version. Verifies sha256 if
|
|
95
|
+
* `expectedSha256` is provided.
|
|
96
|
+
*/
|
|
97
|
+
export declare function fetchBlob(env: RuntimeCatalogEnv, blobKey: string, expectedSha256?: string): Promise<Uint8Array>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=runtime-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-catalog.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,2CAA2C;AAC3C,KAAK,YAAY,GAAG;IAClB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QACxB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;QACpC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,GAAG,IAAI,CAAC,CAAC;CACX,GAAG,IAAI,GAAG,SAAS,CAAC;AAErB,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,oBAAoB,CAAC,EAAE,YAAY,CAAC;CACrC;AAID,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB;4CACwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB;oEACgE;IAChE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;iEAC6D;IAC7D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC;AAaD,uEAAuE;AACvE,wBAAsB,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoBlF;AAED,kDAAkD;AAClD,wBAAsB,aAAa,CACjC,GAAG,EAAE,iBAAiB,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CAoB1B;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,iBAAiB,EACtB,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runtime-catalog.ts — R2 + Cache API L2 wrapper for the
|
|
3
|
+
* `nimbus install <runtime>` package manager.
|
|
4
|
+
*
|
|
5
|
+
* Per `/workspace/.seal-internal/2026-05-10-true-os/plan.md` §2.3, §2.4:
|
|
6
|
+
*
|
|
7
|
+
* L1 (per-DO SqliteFS) — populated at install time.
|
|
8
|
+
* L2 (caches.default per-colo) — sub-ms reads after first hit.
|
|
9
|
+
* L3 (R2 nimbus-runtime-cache) — primary source of truth.
|
|
10
|
+
*
|
|
11
|
+
* R2 layout:
|
|
12
|
+
*
|
|
13
|
+
* catalog/v1.json ← top-level catalog
|
|
14
|
+
* manifests/<name>-<version>.json ← per-version manifest
|
|
15
|
+
* blobs/<name>-<version>/<file> ← content-addressed blobs
|
|
16
|
+
*
|
|
17
|
+
* Catalog schema (RuntimeCatalog):
|
|
18
|
+
* { version: 1, runtimes: { <name>: { default, versions: { <ver>: { manifest, size_bytes, license } } } } }
|
|
19
|
+
*
|
|
20
|
+
* Manifest schema (RuntimeManifest):
|
|
21
|
+
* { name, version, license, wasi_namespace, memfs_companion,
|
|
22
|
+
* files: [{ path, content, sha256, size, mode? }],
|
|
23
|
+
* entrypoints: [{ binName, runner, args[], kind? }] }
|
|
24
|
+
*
|
|
25
|
+
* The wave's anti-reqs apply: no setTimeout / no retry / no defensive-
|
|
26
|
+
* catch. R2 / cache failures throw; the verb's UX surface formats them.
|
|
27
|
+
*/
|
|
28
|
+
// ── Cache key helpers ────────────────────────────────────────────────
|
|
29
|
+
/** Synthetic L2 cache URLs. Reserved-invalid TLD so they can never
|
|
30
|
+
* collide with real user requests. */
|
|
31
|
+
const L2_NS = 'https://nimbus-runtime-cache.invalid';
|
|
32
|
+
const catalogL2Key = () => `${L2_NS}/catalog/v1.json`;
|
|
33
|
+
const manifestL2Key = (key) => `${L2_NS}/${key}`;
|
|
34
|
+
const blobL2Key = (key) => `${L2_NS}/${key}`;
|
|
35
|
+
// ── Fetchers ─────────────────────────────────────────────────────────
|
|
36
|
+
/** Fetch the top-level catalog. Throws if neither L2 nor R2 has it. */
|
|
37
|
+
export async function fetchCatalog(env) {
|
|
38
|
+
// L2 hot path.
|
|
39
|
+
const text = await l2GetText(catalogL2Key());
|
|
40
|
+
if (text)
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
// R2 path.
|
|
43
|
+
const r2 = env.NIMBUS_RUNTIME_CACHE;
|
|
44
|
+
if (!r2) {
|
|
45
|
+
throw new Error('NIMBUS_RUNTIME_CACHE binding missing — catalog cannot be fetched');
|
|
46
|
+
}
|
|
47
|
+
const obj = await r2.get('catalog/v1.json');
|
|
48
|
+
if (!obj) {
|
|
49
|
+
throw new Error('catalog/v1.json not in R2 — bundle pipeline has not seeded the catalog');
|
|
50
|
+
}
|
|
51
|
+
const catalogText = await obj.text();
|
|
52
|
+
// Cache for next call. Catalog is small (~1 KB) — 5-min TTL via
|
|
53
|
+
// Cache-Control: this matches Pyodide-research §D2's "5-min TTL on
|
|
54
|
+
// packument-style metadata".
|
|
55
|
+
await l2PutText(catalogL2Key(), catalogText, 300);
|
|
56
|
+
return JSON.parse(catalogText);
|
|
57
|
+
}
|
|
58
|
+
/** Fetch a per-version manifest by its R2 key. */
|
|
59
|
+
export async function fetchManifest(env, manifestKey) {
|
|
60
|
+
// L2 hot path.
|
|
61
|
+
const text = await l2GetText(manifestL2Key(manifestKey));
|
|
62
|
+
if (text)
|
|
63
|
+
return JSON.parse(text);
|
|
64
|
+
// R2 path.
|
|
65
|
+
const r2 = env.NIMBUS_RUNTIME_CACHE;
|
|
66
|
+
if (!r2) {
|
|
67
|
+
throw new Error('NIMBUS_RUNTIME_CACHE binding missing — manifest cannot be fetched');
|
|
68
|
+
}
|
|
69
|
+
const obj = await r2.get(manifestKey);
|
|
70
|
+
if (!obj) {
|
|
71
|
+
throw new Error(`manifest ${manifestKey} not in R2 — catalog references a missing manifest`);
|
|
72
|
+
}
|
|
73
|
+
const manifestText = await obj.text();
|
|
74
|
+
// 5-min TTL — manifests are content-addressed by version so we
|
|
75
|
+
// could go eternal, but a short TTL lets us correct a bad upload
|
|
76
|
+
// by re-running bundle-runtime.mjs without manual cache invalidation.
|
|
77
|
+
await l2PutText(manifestL2Key(manifestKey), manifestText, 300);
|
|
78
|
+
return JSON.parse(manifestText);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fetch a content-addressed blob by R2 key. Bytes are eternally
|
|
82
|
+
* cacheable because the key encodes the version. Verifies sha256 if
|
|
83
|
+
* `expectedSha256` is provided.
|
|
84
|
+
*/
|
|
85
|
+
export async function fetchBlob(env, blobKey, expectedSha256) {
|
|
86
|
+
// L2 hot path.
|
|
87
|
+
const cached = await l2GetBytes(blobL2Key(blobKey));
|
|
88
|
+
if (cached) {
|
|
89
|
+
if (expectedSha256)
|
|
90
|
+
await assertSha256(cached, expectedSha256, blobKey);
|
|
91
|
+
return cached;
|
|
92
|
+
}
|
|
93
|
+
// R2 path.
|
|
94
|
+
const r2 = env.NIMBUS_RUNTIME_CACHE;
|
|
95
|
+
if (!r2) {
|
|
96
|
+
throw new Error('NIMBUS_RUNTIME_CACHE binding missing — blob cannot be fetched');
|
|
97
|
+
}
|
|
98
|
+
const obj = await r2.get(blobKey);
|
|
99
|
+
if (!obj) {
|
|
100
|
+
throw new Error(`blob ${blobKey} not in R2 — manifest references a missing blob`);
|
|
101
|
+
}
|
|
102
|
+
const ab = await obj.arrayBuffer();
|
|
103
|
+
const bytes = new Uint8Array(ab);
|
|
104
|
+
if (expectedSha256)
|
|
105
|
+
await assertSha256(bytes, expectedSha256, blobKey);
|
|
106
|
+
// Eternal-immutable write-back (content-addressed; never changes).
|
|
107
|
+
await l2PutBytes(blobL2Key(blobKey), bytes);
|
|
108
|
+
return bytes;
|
|
109
|
+
}
|
|
110
|
+
// ── sha256 verifier ──────────────────────────────────────────────────
|
|
111
|
+
async function assertSha256(bytes, expected, label) {
|
|
112
|
+
const digest = await crypto.subtle.digest('SHA-256', bytes);
|
|
113
|
+
const hex = bytesToHex(new Uint8Array(digest));
|
|
114
|
+
if (hex !== expected.toLowerCase()) {
|
|
115
|
+
throw new Error(`sha256 mismatch for ${label}: expected ${expected} got ${hex}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function bytesToHex(b) {
|
|
119
|
+
let s = '';
|
|
120
|
+
for (let i = 0; i < b.length; i++)
|
|
121
|
+
s += b[i].toString(16).padStart(2, '0');
|
|
122
|
+
return s;
|
|
123
|
+
}
|
|
124
|
+
// ── L2 (caches.default) helpers ──────────────────────────────────────
|
|
125
|
+
async function l2GetText(key) {
|
|
126
|
+
try {
|
|
127
|
+
const c = globalThis.caches;
|
|
128
|
+
if (!c?.default)
|
|
129
|
+
return null;
|
|
130
|
+
const hit = await c.default.match(new Request(key));
|
|
131
|
+
if (!hit || !hit.ok)
|
|
132
|
+
return null;
|
|
133
|
+
return await hit.text();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function l2PutText(key, text, ttlSeconds) {
|
|
140
|
+
try {
|
|
141
|
+
const c = globalThis.caches;
|
|
142
|
+
if (!c?.default)
|
|
143
|
+
return;
|
|
144
|
+
const resp = new Response(text, {
|
|
145
|
+
headers: {
|
|
146
|
+
'Content-Type': 'application/json',
|
|
147
|
+
'Cache-Control': `public, max-age=${ttlSeconds}`,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
await c.default.put(new Request(key), resp);
|
|
151
|
+
}
|
|
152
|
+
catch { /* silent */ }
|
|
153
|
+
}
|
|
154
|
+
async function l2GetBytes(key) {
|
|
155
|
+
try {
|
|
156
|
+
const c = globalThis.caches;
|
|
157
|
+
if (!c?.default)
|
|
158
|
+
return null;
|
|
159
|
+
const hit = await c.default.match(new Request(key));
|
|
160
|
+
if (!hit || !hit.ok)
|
|
161
|
+
return null;
|
|
162
|
+
const ab = await hit.arrayBuffer();
|
|
163
|
+
return new Uint8Array(ab);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function l2PutBytes(key, bytes) {
|
|
170
|
+
try {
|
|
171
|
+
const c = globalThis.caches;
|
|
172
|
+
if (!c?.default)
|
|
173
|
+
return;
|
|
174
|
+
const resp = new Response(bytes, {
|
|
175
|
+
headers: {
|
|
176
|
+
'Content-Type': 'application/octet-stream',
|
|
177
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
await c.default.put(new Request(key), resp);
|
|
181
|
+
}
|
|
182
|
+
catch { /* silent */ }
|
|
183
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runtime-registry.ts — shared shell-command factory for runtime
|
|
3
|
+
* dispatchers (node, bun, and future native-WASM / Python / Ruby /
|
|
4
|
+
* AssemblyScript runtimes).
|
|
5
|
+
*
|
|
6
|
+
* Why this exists
|
|
7
|
+
* ───────────────
|
|
8
|
+
* `node` and `bun` shell-command handlers in src/session/init.ts
|
|
9
|
+
* shared ~85% of their code: argv parsing for --version / --help /
|
|
10
|
+
* -e / script-path, VFS lookup, shebang strip, esbuild transform for
|
|
11
|
+
* .ts/.tsx/.jsx, dispatch to the runner. The duplication had drifted
|
|
12
|
+
* — only `node` had the primitive #1 nodeFlagSpan fix
|
|
13
|
+
* (init.ts:233-243), only `node` had primitive-#2 binSpawn ctx
|
|
14
|
+
* propagation (init.ts:391-403), only `bun` had install / run
|
|
15
|
+
* subcommand routing.
|
|
16
|
+
*
|
|
17
|
+
* `buildRuntimeHandler` returns a single shell-handler function that
|
|
18
|
+
* encodes the shared contract. Per-runtime variation is supplied
|
|
19
|
+
* via the `RuntimeSpec` parameter:
|
|
20
|
+
*
|
|
21
|
+
* - name + version + helpText
|
|
22
|
+
* - run(): runner fn (runNodeScript / runBunScript / wasm-runner)
|
|
23
|
+
* - subcommands: optional map of `<verb> → handler` for
|
|
24
|
+
* bun-style `bun install`, `bun run` (node has none today)
|
|
25
|
+
* - transform(): optional code rewriter (bun prepends BUN_SHIM_PREAMBLE)
|
|
26
|
+
* - supportsBinSpawn: true for node (the .bin handler propagates
|
|
27
|
+
* a callerPid); other runtimes use a plain spawn flow.
|
|
28
|
+
*
|
|
29
|
+
* Anti-requirements observed
|
|
30
|
+
* ──────────────────────────
|
|
31
|
+
* - NO setTimeout / NO retry / NO defensive-catch added.
|
|
32
|
+
* - NO behavioral change vs the pre-refactor handlers — every
|
|
33
|
+
* runtime-specific quirk is preserved exactly.
|
|
34
|
+
* - Per-runtime test parity: existing primitives-extension probes
|
|
35
|
+
* (#1 npx / #2 .bin) and runtime-pkg probes (G1-G4) MUST still
|
|
36
|
+
* pass against the refactored handlers — the contract is
|
|
37
|
+
* observable behaviour, not implementation shape.
|
|
38
|
+
*/
|
|
39
|
+
import type { FacetManager } from '../facets/manager.js';
|
|
40
|
+
import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
|
|
41
|
+
import type { EsbuildService } from './esbuild-service.js';
|
|
42
|
+
/**
|
|
43
|
+
* Result shape that runtime-registry expects from a runner. Mirrors
|
|
44
|
+
* the existing RunFreshResult / RunBunResult shapes — kept narrow so
|
|
45
|
+
* future runtimes don't have to plumb runtime-internal state.
|
|
46
|
+
*/
|
|
47
|
+
export interface RuntimeRunResult {
|
|
48
|
+
exitCode: number;
|
|
49
|
+
stdout: string;
|
|
50
|
+
stderr: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Options the handler passes to the runner. Mirrors RunFreshOpts.
|
|
54
|
+
*/
|
|
55
|
+
export interface RuntimeRunOpts {
|
|
56
|
+
argv: string[];
|
|
57
|
+
env: Record<string, string> | undefined;
|
|
58
|
+
cwd: string | undefined;
|
|
59
|
+
filename: string;
|
|
60
|
+
dirname: string;
|
|
61
|
+
command: string;
|
|
62
|
+
/** Primitive #1/G4 hooks. node-runner consumes these; other
|
|
63
|
+
* runtimes ignore them safely. */
|
|
64
|
+
skipSpawn?: boolean;
|
|
65
|
+
callerPid?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface RuntimeSpec {
|
|
68
|
+
/** Shell-command name: 'node' / 'bun' / 'wasm-runner' / 'python'. */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Output of `<name> --version`. Includes the leading 'v' if the
|
|
71
|
+
* runtime convention does (Node: 'v20.0.0'; Bun: '1.1.42'). */
|
|
72
|
+
version: string;
|
|
73
|
+
/** Multi-line help text for `<name> --help`. */
|
|
74
|
+
helpText: string;
|
|
75
|
+
/**
|
|
76
|
+
* Runner function. Usually wraps facetMgr.exec / facetMgr.spawn.
|
|
77
|
+
* For native-WASM, this is a thin WebAssembly.instantiate +
|
|
78
|
+
* function-call helper.
|
|
79
|
+
*/
|
|
80
|
+
run(facetMgr: FacetManager, code: string, opts: RuntimeRunOpts): Promise<RuntimeRunResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Optional pre-execution code transform. Used by Bun to prepend
|
|
83
|
+
* BUN_SHIM_PREAMBLE; native-WASM runtimes typically skip
|
|
84
|
+
* this entirely and route around the read-script-from-VFS path
|
|
85
|
+
* (see `bypassesScriptRead`).
|
|
86
|
+
*/
|
|
87
|
+
transformCode?(code: string, scriptPath: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Subcommand router. When the first positional arg is a key in
|
|
90
|
+
* this map, the handler is invoked instead of the standard
|
|
91
|
+
* script-execution flow. Used by `bun install`, `bun run <script>`.
|
|
92
|
+
*/
|
|
93
|
+
subcommands?: Record<string, (ctx: any, registry: ShellRegistry) => Promise<number>>;
|
|
94
|
+
/**
|
|
95
|
+
* When true, the runtime treats the args list as a binary file
|
|
96
|
+
* path (NOT a JS script). Used by `wasm-runner` — the args[0] is a
|
|
97
|
+
* .wasm path, args[1+] are the function name + integer args.
|
|
98
|
+
* The handler skips the read-and-transform-script flow and calls
|
|
99
|
+
* `run()` with a synthetic empty `code` — runtimes that set this
|
|
100
|
+
* flag implement the actual bytes-load inside their runner.
|
|
101
|
+
*/
|
|
102
|
+
bypassesScriptRead?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Primitive #1 / G4 — when true, the script-execution branch
|
|
105
|
+
* propagates `ctx.__nimbusBinSpawn` into RuntimeRunOpts. Only
|
|
106
|
+
* `node` enables this; bun's runFresh chain doesn't share PID
|
|
107
|
+
* state with the .bin handler today. Future runtimes set this
|
|
108
|
+
* iff they share the runFresh contract.
|
|
109
|
+
*/
|
|
110
|
+
supportsBinSpawn?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Minimal registry shape we depend on. Avoids importing the full
|
|
114
|
+
* @lifo-sh/core type tree (the shell registry's runtime shape is a
|
|
115
|
+
* few methods on a Map-like class).
|
|
116
|
+
*/
|
|
117
|
+
export interface ShellRegistry {
|
|
118
|
+
resolve(name: string): Promise<any> | any;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Build a shell-handler function for a runtime. The returned function
|
|
122
|
+
* is the value passed to `registry.register('<name>', handler)`.
|
|
123
|
+
*
|
|
124
|
+
* Captures `vfs`, `facetMgr`, `esbuild`, `getEsbuild` (for lazy init)
|
|
125
|
+
* + the spec. The same factory is used for every runtime; the only
|
|
126
|
+
* runtime-specific code lives in `spec`.
|
|
127
|
+
*/
|
|
128
|
+
export declare function buildRuntimeHandler(spec: RuntimeSpec, ctx0: {
|
|
129
|
+
vfs: SqliteVFS;
|
|
130
|
+
facetMgr: FacetManager;
|
|
131
|
+
/** Lazy esbuild initialiser. Called once per first .ts/.tsx/.jsx
|
|
132
|
+
* invocation — the host owns the init lifecycle. */
|
|
133
|
+
getEsbuild(): EsbuildService;
|
|
134
|
+
registry: ShellRegistry;
|
|
135
|
+
}): (ctx: any) => Promise<number>;
|
|
136
|
+
//# sourceMappingURL=runtime-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-registry.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACxC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB;uCACmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb;oEACgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3F;;;;;OAKG;IACH,aAAa,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACzD;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE;IACJ,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB;yDACqD;IACrD,UAAU,IAAI,cAAc,CAAC;IAC7B,QAAQ,EAAE,aAAa,CAAC;CACzB,GACA,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAyR/B"}
|