@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,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inner-do-registry.ts — Module-level registry of inner DO classes.
|
|
3
|
+
*
|
|
4
|
+
* `nimbus-wrangler` populates this on each successful buildAndLoad()
|
|
5
|
+
* with the DurableObject classes extracted from the freshly-loaded
|
|
6
|
+
* inner Worker via `worker.getDurableObjectClass(name)`. The supervisor
|
|
7
|
+
* DO (`NimbusSession`) reads it on each inner-DO fetch to synthesize a
|
|
8
|
+
* NimbusDurableObjectNamespace stub for `env.MY_DO`.
|
|
9
|
+
*
|
|
10
|
+
* Why a separate leaf module:
|
|
11
|
+
* Before this extraction, the registry lived inside nimbus-session.ts,
|
|
12
|
+
* which forced nimbus-wrangler.ts to import from nimbus-session.ts —
|
|
13
|
+
* producing the cycle
|
|
14
|
+
* index.ts -> nimbus-session.ts -> nimbus-wrangler.ts -> nimbus-session.ts
|
|
15
|
+
* Promoting the registry to its own leaf breaks that cycle without
|
|
16
|
+
* changing any semantics. The Map identity is preserved across the
|
|
17
|
+
* isolate (it's still process-scoped — module-level state — survives
|
|
18
|
+
* across DO instances in the same workerd process).
|
|
19
|
+
*
|
|
20
|
+
* Key shape:
|
|
21
|
+
* `<supervisor-DO-id>:<binding-name>` — both halves are required to
|
|
22
|
+
* prevent multiple supervisor DOs in the same isolate from clobbering
|
|
23
|
+
* each other's registrations.
|
|
24
|
+
*
|
|
25
|
+
* The values are DurableObject class constructors. `any` here is
|
|
26
|
+
* deliberate: the inner DO's class shape is whatever the user defines
|
|
27
|
+
* in their inner Worker, and we only need to invoke it via
|
|
28
|
+
* `ctx.facets.get(name, { class: cls, id })` — workerd does the rest.
|
|
29
|
+
*/
|
|
30
|
+
/** Look up a registered inner-DO class. Returns undefined if not found. */
|
|
31
|
+
export declare function getInnerDoClass(supervisorDoId: string, bindingName: string): any | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Register an inner DO class for synthesis. Called by nimbus-wrangler.ts
|
|
34
|
+
* after each successful buildAndLoad() with the class extracted from
|
|
35
|
+
* the fresh worker stub. Keys are `<doId>:<bindingName>` so multiple
|
|
36
|
+
* supervisor DOs don't collide.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerInnerDoClass(supervisorDoId: string, bindingName: string, cls: any): void;
|
|
39
|
+
/** Clear all registrations belonging to a supervisor DO (called on rebuild). */
|
|
40
|
+
export declare function clearInnerDoClasses(supervisorDoId: string): void;
|
|
41
|
+
//# sourceMappingURL=inner-do-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inner-do-registry.d.ts","sourceRoot":"","sources":["../../src/facets/inner-do-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAE5F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,GAAG,GACP,IAAI,CAEN;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAKhE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inner-do-registry.ts — Module-level registry of inner DO classes.
|
|
3
|
+
*
|
|
4
|
+
* `nimbus-wrangler` populates this on each successful buildAndLoad()
|
|
5
|
+
* with the DurableObject classes extracted from the freshly-loaded
|
|
6
|
+
* inner Worker via `worker.getDurableObjectClass(name)`. The supervisor
|
|
7
|
+
* DO (`NimbusSession`) reads it on each inner-DO fetch to synthesize a
|
|
8
|
+
* NimbusDurableObjectNamespace stub for `env.MY_DO`.
|
|
9
|
+
*
|
|
10
|
+
* Why a separate leaf module:
|
|
11
|
+
* Before this extraction, the registry lived inside nimbus-session.ts,
|
|
12
|
+
* which forced nimbus-wrangler.ts to import from nimbus-session.ts —
|
|
13
|
+
* producing the cycle
|
|
14
|
+
* index.ts -> nimbus-session.ts -> nimbus-wrangler.ts -> nimbus-session.ts
|
|
15
|
+
* Promoting the registry to its own leaf breaks that cycle without
|
|
16
|
+
* changing any semantics. The Map identity is preserved across the
|
|
17
|
+
* isolate (it's still process-scoped — module-level state — survives
|
|
18
|
+
* across DO instances in the same workerd process).
|
|
19
|
+
*
|
|
20
|
+
* Key shape:
|
|
21
|
+
* `<supervisor-DO-id>:<binding-name>` — both halves are required to
|
|
22
|
+
* prevent multiple supervisor DOs in the same isolate from clobbering
|
|
23
|
+
* each other's registrations.
|
|
24
|
+
*
|
|
25
|
+
* The values are DurableObject class constructors. `any` here is
|
|
26
|
+
* deliberate: the inner DO's class shape is whatever the user defines
|
|
27
|
+
* in their inner Worker, and we only need to invoke it via
|
|
28
|
+
* `ctx.facets.get(name, { class: cls, id })` — workerd does the rest.
|
|
29
|
+
*/
|
|
30
|
+
const _NIMBUS_INNER_DO_CLASSES = new Map();
|
|
31
|
+
/** Look up a registered inner-DO class. Returns undefined if not found. */
|
|
32
|
+
export function getInnerDoClass(supervisorDoId, bindingName) {
|
|
33
|
+
return _NIMBUS_INNER_DO_CLASSES.get(supervisorDoId + ':' + bindingName);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Register an inner DO class for synthesis. Called by nimbus-wrangler.ts
|
|
37
|
+
* after each successful buildAndLoad() with the class extracted from
|
|
38
|
+
* the fresh worker stub. Keys are `<doId>:<bindingName>` so multiple
|
|
39
|
+
* supervisor DOs don't collide.
|
|
40
|
+
*/
|
|
41
|
+
export function registerInnerDoClass(supervisorDoId, bindingName, cls) {
|
|
42
|
+
_NIMBUS_INNER_DO_CLASSES.set(supervisorDoId + ':' + bindingName, cls);
|
|
43
|
+
}
|
|
44
|
+
/** Clear all registrations belonging to a supervisor DO (called on rebuild). */
|
|
45
|
+
export function clearInnerDoClasses(supervisorDoId) {
|
|
46
|
+
const prefix = supervisorDoId + ':';
|
|
47
|
+
for (const k of _NIMBUS_INNER_DO_CLASSES.keys()) {
|
|
48
|
+
if (k.startsWith(prefix))
|
|
49
|
+
_NIMBUS_INNER_DO_CLASSES.delete(k);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* facets/manager.ts — Lifecycle for "user node script as a child DO".
|
|
3
|
+
*
|
|
4
|
+
* `node script.js` from the shell prompt has to run somewhere isolated
|
|
5
|
+
* — same memory bound as the supervisor (128 MiB) but separate so a
|
|
6
|
+
* runaway script can't take the supervisor down. The script is also
|
|
7
|
+
* stateful: `fs.readFileSync` writes inside the script need to flow
|
|
8
|
+
* back to the VFS, and `http.createServer` registers a port the
|
|
9
|
+
* preview iframe later proxies to. That makes a stateless Worker
|
|
10
|
+
* Loader insufficient — we need a child DO with its own SQLite for
|
|
11
|
+
* port registration and exit reporting.
|
|
12
|
+
*
|
|
13
|
+
* The pattern:
|
|
14
|
+
* 1. LOADER.get(codeHash, makeConfig) — dynamic worker w/ user script
|
|
15
|
+
* 2. worker.getDurableObjectClass('NodeProcess') — class from that worker
|
|
16
|
+
* 3. ctx.facets.get(`proc-${pid}`, {class}) — child DO Facet
|
|
17
|
+
* 4. facet.run(argsJson) — RPC executes the script
|
|
18
|
+
* 5. ctx.facets.delete(name) — cleanup, even on throw
|
|
19
|
+
*
|
|
20
|
+
* The codeHash includes `ctx.id.toString()` to scope the LOADER cache
|
|
21
|
+
* per-supervisor-DO. Without that, two sessions executing identical
|
|
22
|
+
* code would share an isolate, and the warm slot's baked-in
|
|
23
|
+
* env.SUPERVISOR stub would point at whichever DO instantiated it
|
|
24
|
+
* first — every other session's stdout would silently route to the
|
|
25
|
+
* wrong terminal. (Same cross-session-slot-sharing fix b225db3
|
|
26
|
+
* applied to install-time facets.)
|
|
27
|
+
*
|
|
28
|
+
* `_execViaLoader` is the local-dev fallback: when the runtime doesn't
|
|
29
|
+
* support `ctx.facets.get`, fall back to `LOADER.load()` +
|
|
30
|
+
* `getEntrypoint().fetch()` with a plain fetch-handler shape. The
|
|
31
|
+
* supervisor's environment is the same; only the lifecycle primitive
|
|
32
|
+
* differs.
|
|
33
|
+
*/
|
|
34
|
+
import { ProcessTable } from '../runtime/process-table.js';
|
|
35
|
+
import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
|
|
36
|
+
import type { PortRegistry } from '../runtime/port-registry.js';
|
|
37
|
+
import { EsbuildService } from '../runtime/esbuild-service.js';
|
|
38
|
+
/** Result returned from a facet execution */
|
|
39
|
+
export interface FacetExecResult {
|
|
40
|
+
exitCode: number;
|
|
41
|
+
stdout: string;
|
|
42
|
+
stderr: string;
|
|
43
|
+
/**
|
|
44
|
+
* Files written by the script (path → content), to be flushed back to VFS.
|
|
45
|
+
*
|
|
46
|
+
* binary-fs wave: cells may be string | Uint8Array. After JSON.parse on
|
|
47
|
+
* the result envelope (NodeProcess.run returns JSON.stringify; the
|
|
48
|
+
* LOADER.load fallback uses Response.json) Uint8Array becomes a
|
|
49
|
+
* {"0":n,"1":n,...} object — _reviveVfsWriteCell reconstitutes the
|
|
50
|
+
* bytes.
|
|
51
|
+
*/
|
|
52
|
+
vfsWrites?: Record<string, string | Uint8Array | Record<string, number>>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Greedy-oversample every installed package's main entry. The static
|
|
56
|
+
* prefetch via require-resolver covers the require() chain literally
|
|
57
|
+
* present in source; greedy oversampling adds a safety net for dynamic
|
|
58
|
+
* patterns the regex misses (jest/`bindings`/`import-local` style
|
|
59
|
+
* computed-path requires). Bounded to package.json + 1 main-entry file
|
|
60
|
+
* per package — sub-agent §Q3 quantified the worst-case cumulative
|
|
61
|
+
* budget impact (~322 KiB for fastify, ~1.7 MiB for ts-jest).
|
|
62
|
+
*/
|
|
63
|
+
export declare function greedyAddMainEntries(vfs: SqliteVFS, cwd: string, bundle: Record<string, string | Uint8Array>, budgetState: {
|
|
64
|
+
totalBytes: number;
|
|
65
|
+
fileCount: number;
|
|
66
|
+
}): {
|
|
67
|
+
added: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* X.5-Z3: scan every JS source already in `bundle` for static
|
|
71
|
+
* `fs.readFileSync(path.resolve(__dirname, "<rel>"))` shapes and pull
|
|
72
|
+
* the matched asset files (.css / .html / .htm / .svg / .txt / .json)
|
|
73
|
+
* into the bundle. The motivating case is jsdom's
|
|
74
|
+
* `lib/jsdom/living/css/helpers/computed-style.js:16-19`, which loads
|
|
75
|
+
* `default-stylesheet.css` at module-eval time:
|
|
76
|
+
*
|
|
77
|
+
* const defaultStyleSheet = fs.readFileSync(
|
|
78
|
+
* path.resolve(__dirname, "../../../browser/default-stylesheet.css"),
|
|
79
|
+
* { encoding: "utf-8" },
|
|
80
|
+
* );
|
|
81
|
+
*
|
|
82
|
+
* The fs shim's `readFileSync` (`src/node-shims.ts:202-215`) consults
|
|
83
|
+
* only `__vfsBundle` + `__vfsWrites`; runtime asset files that the
|
|
84
|
+
* require-graph walker doesn't reach (it's bounded to .js/.mjs/.cjs)
|
|
85
|
+
* are absent from the bundle and ENOENT at runtime. This helper closes
|
|
86
|
+
* that gap as a sibling of `greedyAddMainEntries` (W2.6a) +
|
|
87
|
+
* `transformEsmInBundle` (W3.5 Fix B).
|
|
88
|
+
*
|
|
89
|
+
* Pattern matched: literal-only, conservative.
|
|
90
|
+
*
|
|
91
|
+
* fs.readFileSync(path.resolve(__dirname, "<rel>"), …)
|
|
92
|
+
* readFileSync(path.resolve(__dirname, "<rel>"), …)
|
|
93
|
+
*
|
|
94
|
+
* `<rel>` is a string literal (single, double, OR backtick — provided
|
|
95
|
+
* the backtick form has no `${}` interpolation). Template-literal,
|
|
96
|
+
* variable, and concatenation forms are **deliberately skipped** —
|
|
97
|
+
* they're an unbounded class. Comment-stripped first to avoid
|
|
98
|
+
* matching the pattern inside `//` / `/* */`.
|
|
99
|
+
*
|
|
100
|
+
* Returns the count of asset files added (for diagnostics). Errors
|
|
101
|
+
* are swallowed: missing assets, unreadable VFS, and non-string
|
|
102
|
+
* readFile inputs are silent skips.
|
|
103
|
+
*
|
|
104
|
+
* Same budget shape as `greedyAddMainEntries` — shares the same
|
|
105
|
+
* VFS_BUNDLE_MAX_FILES / VFS_BUNDLE_MAX_BYTES caps via the
|
|
106
|
+
* `budgetState` counter.
|
|
107
|
+
*/
|
|
108
|
+
export declare function addStaticReadFileAssets(vfs: SqliteVFS, cwd: string, bundle: Record<string, string | Uint8Array>, budgetState: {
|
|
109
|
+
totalBytes: number;
|
|
110
|
+
fileCount: number;
|
|
111
|
+
}): {
|
|
112
|
+
added: number;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* X.5-U: scan every JS source already in `bundle` for static
|
|
116
|
+
* readFileSync of a `__dirname`-relative dotfile or "digest/hash/version/
|
|
117
|
+
* sha/md5"-shaped sentinel, AND match the SWC/TypeScript-compiled
|
|
118
|
+
* `(0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, "<rel>"))`
|
|
119
|
+
* call shape that X.5-Z3's `addStaticReadFileAssets` regex misses.
|
|
120
|
+
*
|
|
121
|
+
* Motivating case: ts-jest@29.x's
|
|
122
|
+
* `package/dist/legacy/config/config-set.js:105`:
|
|
123
|
+
*
|
|
124
|
+
* var fs_1 = require("fs");
|
|
125
|
+
* var path_1 = require("path");
|
|
126
|
+
* exports.MY_DIGEST = (0, fs_1.readFileSync)(
|
|
127
|
+
* (0, path_1.resolve)(__dirname, '../../../.ts-jest-digest'), 'utf8');
|
|
128
|
+
*
|
|
129
|
+
* The install pipeline writes `.ts-jest-digest` to VFS correctly
|
|
130
|
+
* (manifest pass at buildManifest enumerates it). But the runtime
|
|
131
|
+
* fs shim's readFileSync (`src/node-shims.ts:202-215`) consults
|
|
132
|
+
* `__vfsBundle` only, and none of the existing bundle-population
|
|
133
|
+
* passes — `prefetchForRequire` (require-graph), `greedyAddMainEntries`
|
|
134
|
+
* (pkg main entries), `addStaticReadFileAssets` (X.5-Z3, restricted to
|
|
135
|
+
* `.css|html|svg|txt|json` and to direct `path.resolve(__dirname,…)`)
|
|
136
|
+
* — picks the dotfile up. Result: ENOENT at facet runtime even though
|
|
137
|
+
* `fs.readdirSync` and `fs.statSync` both see the file via the manifest.
|
|
138
|
+
*
|
|
139
|
+
* Bounded heuristic: filename must EITHER start with `.` (dotfile) OR
|
|
140
|
+
* match `/digest|hash|version|sha|md5/i` (small-metadata-sentinel
|
|
141
|
+
* pattern). Without this gate, an unconstrained "match any
|
|
142
|
+
* __dirname-relative readFileSync filename" would pull arbitrary large
|
|
143
|
+
* runtime-loaded files (compiled WASM, JSON dictionaries, …) on
|
|
144
|
+
* packages that read them via this exact shape — bundle bloat with no
|
|
145
|
+
* payoff. The heuristic narrows to the ts-jest class. Trade-off
|
|
146
|
+
* documented; future packages outside this shape can extend the
|
|
147
|
+
* predicate.
|
|
148
|
+
*
|
|
149
|
+
* Quote chars supported: `'`, `"`, and backticks WITHOUT `${}`
|
|
150
|
+
* interpolation. Dynamic specifiers (variable, concatenation,
|
|
151
|
+
* interpolation) are deliberately skipped.
|
|
152
|
+
*
|
|
153
|
+
* Same budget shape as `greedyAddMainEntries` /
|
|
154
|
+
* `addStaticReadFileAssets` — shares the same VFS_BUNDLE_MAX_FILES /
|
|
155
|
+
* VFS_BUNDLE_MAX_BYTES caps via `budgetState`. Returns the count of
|
|
156
|
+
* files added (for diagnostics).
|
|
157
|
+
*
|
|
158
|
+
* Errors are swallowed: missing assets, unreadable VFS, and
|
|
159
|
+
* non-string readFile inputs are silent skips — matches Z3 posture.
|
|
160
|
+
*/
|
|
161
|
+
export declare function addStaticReadFileDotfilesAndCompiled(vfs: SqliteVFS, cwd: string, bundle: Record<string, string | Uint8Array>, budgetState: {
|
|
162
|
+
totalBytes: number;
|
|
163
|
+
fileCount: number;
|
|
164
|
+
}): {
|
|
165
|
+
added: number;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Optional hooks wired in by NimbusSession. Kept as callbacks so
|
|
169
|
+
* FacetManager stays unaware of the session / log-store types.
|
|
170
|
+
*/
|
|
171
|
+
export interface FacetManagerHooks {
|
|
172
|
+
/**
|
|
173
|
+
* Fired when a process was terminated OUTSIDE the facet's own try/
|
|
174
|
+
* finally (timeout via abort, explicit kill, etc.) — the facet never
|
|
175
|
+
* runs its own `reportExit`, so the session side won't hear about the
|
|
176
|
+
* exit unless we call it here.
|
|
177
|
+
*/
|
|
178
|
+
onExternalExit?: (pid: number, code: number, reason: string) => void;
|
|
179
|
+
/** Fired right after processTable.spawn — lets the session print a notification. */
|
|
180
|
+
onSpawn?: (pid: number, command: string, longRunning: boolean) => void;
|
|
181
|
+
}
|
|
182
|
+
export declare class FacetManager {
|
|
183
|
+
private ctx;
|
|
184
|
+
private env;
|
|
185
|
+
private processTable;
|
|
186
|
+
private portRegistry;
|
|
187
|
+
private vfs;
|
|
188
|
+
/** Track whether facets API is available (detected on first use). */
|
|
189
|
+
private _hasFacets;
|
|
190
|
+
private _facetLogOnce;
|
|
191
|
+
private hooks;
|
|
192
|
+
/**
|
|
193
|
+
* W3.5 Fix B: lazily-created EsbuildService for the ESM→CJS pre-pass
|
|
194
|
+
* over the prefetch bundle. Created on first exec where vfs is set;
|
|
195
|
+
* shared across subsequent execs (warm wasm). Optional setter
|
|
196
|
+
* `setEsbuildService` lets NimbusSession share its existing instance
|
|
197
|
+
* to avoid double-init.
|
|
198
|
+
*/
|
|
199
|
+
private esbuild;
|
|
200
|
+
constructor(ctx: DurableObjectState, env: any, processTable: ProcessTable, portRegistry: PortRegistry, hooks?: FacetManagerHooks);
|
|
201
|
+
setVfs(vfs: SqliteVFS): void;
|
|
202
|
+
/**
|
|
203
|
+
* W3.5 Fix B: hand the FacetManager a pre-warmed EsbuildService for
|
|
204
|
+
* the ESM→CJS bundle pre-pass. NimbusSession already lazy-creates one
|
|
205
|
+
* for the user-shell `node` runtime; sharing avoids paying init twice.
|
|
206
|
+
*/
|
|
207
|
+
setEsbuildService(esbuild: EsbuildService): void;
|
|
208
|
+
/**
|
|
209
|
+
* Execute JS code in a facet (or fallback dynamic worker).
|
|
210
|
+
*
|
|
211
|
+
* Strategy:
|
|
212
|
+
* 1. Try LOADER.get() + ctx.facets.get() (production: warm reuse, own SQLite)
|
|
213
|
+
* 2. Fallback: LOADER.load() + getEntrypoint().fetch() (local dev)
|
|
214
|
+
*/
|
|
215
|
+
exec(code: string, opts: {
|
|
216
|
+
argv?: string[];
|
|
217
|
+
env?: Record<string, string>;
|
|
218
|
+
cwd?: string;
|
|
219
|
+
filename?: string;
|
|
220
|
+
dirname?: string;
|
|
221
|
+
/**
|
|
222
|
+
* G4 (runtime-pkg wave): caller-supplied display label for the
|
|
223
|
+
* processTable entry. When set, takes precedence over the
|
|
224
|
+
* default `node ${filename}`. Used by the .bin handler in
|
|
225
|
+
* init.ts so `tsc --version` shows up in `ps` as
|
|
226
|
+
* `tsc --version` (the user's typed line) rather than
|
|
227
|
+
* `node /home/user/proj/node_modules/typescript/bin/tsc`.
|
|
228
|
+
*
|
|
229
|
+
* Also: when `command` is provided AND `skipSpawn` is true,
|
|
230
|
+
* the caller has already done processTable.spawn (e.g. the
|
|
231
|
+
* .bin wrapper that needs to allocate a PID before parsing
|
|
232
|
+
* the shim). exec() reuses that PID instead of spawning a
|
|
233
|
+
* second one — the G4 double-spawn fix.
|
|
234
|
+
*/
|
|
235
|
+
command?: string;
|
|
236
|
+
/** G4: caller already did processTable.spawn; don't double-spawn. */
|
|
237
|
+
skipSpawn?: boolean;
|
|
238
|
+
/** G4: when skipSpawn is true, the PID the caller allocated. */
|
|
239
|
+
callerPid?: number;
|
|
240
|
+
}): Promise<FacetExecResult>;
|
|
241
|
+
/**
|
|
242
|
+
* W5 Lever 5: push a DiagFailure into the OOM ring for every facet
|
|
243
|
+
* termination with a non-zero exit code. This is the supervisor side
|
|
244
|
+
* of the zero-silent-OOM contract — the audit/probes/w5/e2e/
|
|
245
|
+
* oom-stress probe asserts that every termination has a matching
|
|
246
|
+
* ring entry.
|
|
247
|
+
*
|
|
248
|
+
* Classification: parse the reason/stderr for SQLITE_NOMEM, OOM,
|
|
249
|
+
* clone-refused, rpc_timeout signatures (oom-classify.ts). Code 124
|
|
250
|
+
* always maps to rpc_timeout regardless of message.
|
|
251
|
+
*/
|
|
252
|
+
private _w5RecordTermination;
|
|
253
|
+
private _execViaFacets;
|
|
254
|
+
private _execViaLoader;
|
|
255
|
+
/** Flush files written by the script back to the supervisor's VFS. */
|
|
256
|
+
private _flushVfsWrites;
|
|
257
|
+
/** Execution timeout. */
|
|
258
|
+
private _execWithTimeout;
|
|
259
|
+
/**
|
|
260
|
+
* Run npm install in a dedicated facet.
|
|
261
|
+
* All writes go through SUPERVISOR.writeFile (live VFS),
|
|
262
|
+
* progress streams via SUPERVISOR.stdout.
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* Spawn a vite dev server facet.
|
|
266
|
+
* Returns immediately with the facet stub for HTTP routing.
|
|
267
|
+
*/
|
|
268
|
+
spawnVite(root: string, basePath?: string): {
|
|
269
|
+
pid: number;
|
|
270
|
+
facetStub: any;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Spawn a long-running Node process with the same shimmed require/fs/http
|
|
274
|
+
* environment used by foreground `node <script>` execution.
|
|
275
|
+
*/
|
|
276
|
+
spawnNode(code: string, opts?: {
|
|
277
|
+
argv?: string[];
|
|
278
|
+
env?: Record<string, string>;
|
|
279
|
+
cwd?: string;
|
|
280
|
+
filename?: string;
|
|
281
|
+
dirname?: string;
|
|
282
|
+
command?: string;
|
|
283
|
+
port?: number;
|
|
284
|
+
}): Promise<{
|
|
285
|
+
pid: number;
|
|
286
|
+
facetStub: any;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* Spawn a long-running facet process.
|
|
290
|
+
* Returns immediately with the process entry.
|
|
291
|
+
* The facet stays alive and can handle HTTP requests via its fetch() method.
|
|
292
|
+
* Used for: vite dev server, node HTTP servers, etc.
|
|
293
|
+
*
|
|
294
|
+
* @param workerCode The dynamic worker code (must export a default fetch handler)
|
|
295
|
+
* @param command Display name for process listing
|
|
296
|
+
* @returns Process entry with pid and facet stub
|
|
297
|
+
*/
|
|
298
|
+
spawn(workerCode: string, command: string, cwd: string, opts?: {
|
|
299
|
+
port?: number;
|
|
300
|
+
}): {
|
|
301
|
+
pid: number;
|
|
302
|
+
facetStub: any;
|
|
303
|
+
};
|
|
304
|
+
/** Kill a running process by PID. */
|
|
305
|
+
kill(pid: number): boolean;
|
|
306
|
+
get stats(): {
|
|
307
|
+
total: number;
|
|
308
|
+
running: number;
|
|
309
|
+
exited: number;
|
|
310
|
+
killed: number;
|
|
311
|
+
nextPid: number;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/facets/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAG9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1E;AAslCD;;;;;;;;GAQG;AAMH,wBAAgB,oBAAoB,CAClC,GAA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