@nimbus-sh/worker 0.3.0 → 0.5.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 +46 -43
- package/dist/_shared/preview-host.d.ts +14 -1
- package/dist/_shared/preview-host.d.ts.map +1 -1
- package/dist/_shared/preview-host.js +28 -3
- package/dist/_shared/session-router.d.ts +43 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +59 -12
- package/dist/esbuild-wasm-bundle.generated.d.ts +1 -1
- package/dist/esbuild-wasm-bundle.generated.js +1 -1
- package/dist/facets/cirrus-real.js +1 -1
- package/dist/facets/durable-images.d.ts +50 -0
- package/dist/facets/durable-images.d.ts.map +1 -0
- package/dist/facets/durable-images.js +75 -0
- package/dist/facets/durable-slots.d.ts +45 -0
- package/dist/facets/durable-slots.d.ts.map +1 -0
- package/dist/facets/durable-slots.js +94 -0
- package/dist/facets/esbuild-transform.d.ts +10 -0
- package/dist/facets/esbuild-transform.d.ts.map +1 -0
- package/dist/facets/esbuild-transform.js +36 -0
- package/dist/facets/manager.d.ts +167 -12
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +575 -113
- package/dist/facets/opencode-staging.d.ts.map +1 -1
- package/dist/facets/opencode-staging.js +3 -4
- package/dist/facets/real-vite-hmr.js +1 -1
- package/dist/facets/vite-dev-server.d.ts +4 -4
- package/dist/facets/vite-dev-server.js +5 -5
- package/dist/git/commands.d.ts +22 -0
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +431 -424
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +6 -5
- package/dist/git-bundle.generated.d.ts +2 -2
- package/dist/git-bundle.generated.d.ts.map +1 -1
- package/dist/git-bundle.generated.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/loaders/child-process/spawn-facet.js +1 -1
- package/dist/loaders/child-process/spawn-pool.d.ts.map +1 -1
- package/dist/loaders/child-process/spawn-pool.js +2 -2
- package/dist/loaders/generated-workers.d.ts +2 -2
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +3 -3
- package/dist/loaders/npm-resolve-preamble.d.ts +3 -3
- package/dist/loaders/npm-resolve-preamble.js +3 -3
- package/dist/loaders/pre-bundle-preamble.d.ts +5 -5
- package/dist/loaders/pre-bundle-preamble.js +6 -6
- package/dist/node-shims-artifact.generated.js +3 -3
- package/dist/npm/install-batch-facet.d.ts +1 -1
- package/dist/npm/install-batch-facet.js +1 -1
- package/dist/npm/installer.d.ts +6 -6
- package/dist/npm/installer.d.ts.map +1 -1
- package/dist/npm/installer.js +28 -27
- package/dist/npm/pre-bundle-facet.d.ts +2 -2
- package/dist/npm/pre-bundle-facet.js +5 -5
- package/dist/npm/r2-cache.d.ts +1 -1
- package/dist/npm/resolve-facet.d.ts +1 -1
- package/dist/npm/resolve-facet.js +1 -1
- package/dist/npm/resolve-one-facet.d.ts +5 -5
- package/dist/npm/resolve-one-facet.js +5 -5
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +61 -4
- package/dist/router/public-directory-do.d.ts +17 -0
- package/dist/router/public-directory-do.d.ts.map +1 -0
- package/dist/router/public-directory-do.js +16 -0
- package/dist/router/public-directory.d.ts +75 -0
- package/dist/router/public-directory.d.ts.map +1 -0
- package/dist/router/public-directory.js +115 -0
- package/dist/router/remote-api.d.ts +9 -1
- package/dist/router/remote-api.d.ts.map +1 -1
- package/dist/router/remote-api.js +20 -3
- package/dist/runtime/bun-repl.d.ts +1 -1
- package/dist/runtime/bun-repl.js +3 -3
- package/dist/runtime/esbuild-wasm-bytes.js +1 -1
- package/dist/runtime/facet-loader-host.d.ts +2 -2
- package/dist/runtime/facet-loader-host.js +3 -3
- package/dist/runtime/node-repl.js +2 -2
- package/dist/runtime/node-shims-artifact.js +1 -1
- package/dist/runtime/node-shims.d.ts +4 -1
- package/dist/runtime/node-shims.d.ts.map +1 -1
- package/dist/runtime/node-shims.js +326 -7
- package/dist/runtime/opencode-artifact.js +1 -1
- package/dist/runtime/opentui-wasm-bytes.js +1 -1
- package/dist/runtime/python-repl.js +3 -3
- package/dist/runtime/ruby-repl.js +2 -2
- package/dist/runtime/sqlite-wasm-bytes.js +1 -1
- package/dist/session/agent.d.ts +11 -0
- package/dist/session/agent.d.ts.map +1 -1
- package/dist/session/diag.js +1 -1
- package/dist/session/helpers.js +1 -1
- package/dist/session/hibernation.d.ts +8 -8
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +15 -15
- package/dist/session/init-phases.d.ts +19 -26
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +20 -43
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +24 -19
- package/dist/session/keys.d.ts +8 -0
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +12 -3
- package/dist/session/nimbus-session.d.ts +33 -19
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +78 -37
- package/dist/session/port-capability.d.ts +95 -8
- package/dist/session/port-capability.d.ts.map +1 -1
- package/dist/session/port-capability.js +165 -8
- package/dist/session/programmatic.d.ts +50 -4
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +112 -15
- package/dist/session/routes.d.ts +17 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +111 -43
- package/dist/session/rpc.d.ts +7 -7
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +34 -23
- package/dist/session/shell-socket.d.ts +76 -0
- package/dist/session/shell-socket.d.ts.map +1 -0
- package/dist/session/shell-socket.js +172 -0
- package/dist/session/start-real-vite.js +2 -2
- package/dist/session/supervisor-op.d.ts +5 -0
- package/dist/session/supervisor-op.d.ts.map +1 -0
- package/dist/session/supervisor-op.js +74 -0
- package/dist/session/supervisor-rpc.d.ts +6 -10
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +98 -79
- package/dist/session/ws.d.ts +1 -3
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +23 -7
- package/package.json +4 -3
- package/public/_assets/runtime/{node-shims-fea906843f6d594e.js → node-shims-9e1380d9ee430fcc.js} +320 -5
- package/public/s/index.html +101 -5
- package/scripts/bundle-esbuild-wasm.mjs +2 -2
- package/scripts/bundle-facet-workers.mjs +5 -7
- package/scripts/bundle-sqlite-wasm.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-staging.d.ts","sourceRoot":"","sources":["../../src/facets/opencode-staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAwB3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"opencode-staging.d.ts","sourceRoot":"","sources":["../../src/facets/opencode-staging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAwB3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAGpE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC;CACpD;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;iBAwBlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAoCxE,iFAAiF;AACjF,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAC/B,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC,CAMhD;AAsFD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,OAAO,CAAC,iBAAiB,CAAC,EAC/B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAyDrB"}
|
|
@@ -30,7 +30,6 @@ import { fetchOpenTUIWasmBytes } from '../runtime/opentui-wasm-bytes.js';
|
|
|
30
30
|
import { OPENTUI_WASM_MODULE_NAME } from '../runtime/opentui-facet-backend.js';
|
|
31
31
|
import { OPENCODE_CHUNKS_PACK, OPENCODE_TREE_SITTER_WASMS, OPENCODE_TUI_WORKERS, OPENCODE_YOGA_WASM, } from '../opencode-artifact.generated.js';
|
|
32
32
|
import { generateOpencodeRunnerCode, opencodeBuiltinBridgeModules, OPENCODE_BUNDLE_MODULE_NAME, SQLITE_WASM_MODULE_NAME, YOGA_WASM_MODULE_NAME, } from '../runtime/opencode-facet-runner.js';
|
|
33
|
-
import { setStagedBootAssembler } from '@nimbus-sh/fabric/process-fabric.js';
|
|
34
33
|
import { CF_COMPAT_DATE } from '@nimbus-sh/core/constants.js';
|
|
35
34
|
/**
|
|
36
35
|
* Everything a facet spawn needs beyond the artifact sources themselves.
|
|
@@ -146,9 +145,9 @@ function chunkModuleEntries(env) {
|
|
|
146
145
|
}
|
|
147
146
|
return chunkEntriesInflight;
|
|
148
147
|
}
|
|
149
|
-
// A 'staged' boot spec reaching the fabric assembles through
|
|
150
|
-
//
|
|
151
|
-
|
|
148
|
+
// A 'staged' boot spec reaching the fabric assembles through
|
|
149
|
+
// assembleOpencodeFacetConfig below; the worker's composition root
|
|
150
|
+
// (src/index.ts) hands it to the fabric with composeFabric.
|
|
152
151
|
/**
|
|
153
152
|
* Assemble the full Worker Loader config for an opencode facet from a stage
|
|
154
153
|
* spec. Returns the config WITHOUT the SUPERVISOR env binding — the caller
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
// 3. Facet-side: ESM source strings for the ws shim + chokidar shim.
|
|
42
42
|
// All are emitted by the generators below.
|
|
43
43
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
44
|
-
import { disposeRpcResource, useRpcResource } from '@nimbus-sh/
|
|
44
|
+
import { disposeRpcResource, useRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
45
45
|
// CLN-3 (2026-05-11): supervisor-side debug gate. Mirrors the facet-side
|
|
46
46
|
// `globalThis.__cirrusDebug` flag declared at cirrus-real.ts:160. When
|
|
47
47
|
// `false` (default), the hot-path console.log calls in `HmrBridge`
|
|
@@ -49,8 +49,8 @@ export interface ViteDevServerOptions {
|
|
|
49
49
|
injectBasename?: boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Worker bindings env. Required for the on-demand-bundle facet path
|
|
52
|
-
* (LOADER + ctx
|
|
53
|
-
* misses bundle in a
|
|
52
|
+
* (LOADER + ctx.exports). When provided, /preview/@modules/<spec>
|
|
53
|
+
* misses bundle in a IsolatePool isolate instead of the
|
|
54
54
|
* supervisor's EsbuildService — same architecture as the
|
|
55
55
|
* pre-bundle path. Without this option, the supervisor falls back
|
|
56
56
|
* to in-process esbuild (legacy behaviour).
|
|
@@ -128,7 +128,7 @@ export declare class ViteDevServer {
|
|
|
128
128
|
private npmCache;
|
|
129
129
|
/** Inject React Router basename into entry files? Default: true. */
|
|
130
130
|
private injectBasename;
|
|
131
|
-
/** Worker env (LOADER, ctx
|
|
131
|
+
/** Worker env (LOADER, ctx.exports) for the on-demand-bundle facet path.
|
|
132
132
|
* Null = legacy in-supervisor esbuild fallback. */
|
|
133
133
|
private env;
|
|
134
134
|
private ctx;
|
|
@@ -180,7 +180,7 @@ export declare class ViteDevServer {
|
|
|
180
180
|
private logSink;
|
|
181
181
|
constructor(opts: ViteDevServerOptions);
|
|
182
182
|
/**
|
|
183
|
-
* Lazily construct the
|
|
183
|
+
* Lazily construct the IsolatePool used for on-demand bundling
|
|
184
184
|
* of /preview/@modules/<spec> requests that miss both the in-memory
|
|
185
185
|
* and pkg_esm_bundles caches. Mirrors the pre-bundle pool's
|
|
186
186
|
* configuration: 1 worker, internal pLimit not needed (one bundle
|
|
@@ -1168,7 +1168,7 @@ export class ViteDevServer {
|
|
|
1168
1168
|
npmCache = null;
|
|
1169
1169
|
/** Inject React Router basename into entry files? Default: true. */
|
|
1170
1170
|
injectBasename;
|
|
1171
|
-
/** Worker env (LOADER, ctx
|
|
1171
|
+
/** Worker env (LOADER, ctx.exports) for the on-demand-bundle facet path.
|
|
1172
1172
|
* Null = legacy in-supervisor esbuild fallback. */
|
|
1173
1173
|
env;
|
|
1174
1174
|
ctx = null;
|
|
@@ -1262,7 +1262,7 @@ export class ViteDevServer {
|
|
|
1262
1262
|
this.detectTailwind();
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
|
-
* Lazily construct the
|
|
1265
|
+
* Lazily construct the IsolatePool used for on-demand bundling
|
|
1266
1266
|
* of /preview/@modules/<spec> requests that miss both the in-memory
|
|
1267
1267
|
* and pkg_esm_bundles caches. Mirrors the pre-bundle pool's
|
|
1268
1268
|
* configuration: 1 worker, internal pLimit not needed (one bundle
|
|
@@ -1278,11 +1278,11 @@ export class ViteDevServer {
|
|
|
1278
1278
|
if (!this.env || !this.ctx)
|
|
1279
1279
|
return null;
|
|
1280
1280
|
this.onDemandPoolPromise = (async () => {
|
|
1281
|
-
const {
|
|
1281
|
+
const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
|
|
1282
1282
|
const { PRE_BUNDLE_PREAMBLE } = await import('../loaders/pre-bundle-preamble.js');
|
|
1283
1283
|
const { fetchEsbuildWasmBytes } = await import('../runtime/esbuild-wasm-bytes.js');
|
|
1284
1284
|
const wasmBytes = await fetchEsbuildWasmBytes(this.env);
|
|
1285
|
-
const pool = new
|
|
1285
|
+
const pool = new IsolatePool(this.env, this.ctx, {
|
|
1286
1286
|
concurrency: 1,
|
|
1287
1287
|
timeoutMs: 60_000,
|
|
1288
1288
|
retries: 0,
|
|
@@ -1797,7 +1797,7 @@ export class ViteDevServer {
|
|
|
1797
1797
|
// supervisor isolate. For large modules (lucide-react, ~18 MiB
|
|
1798
1798
|
// unpacked) that OOM'd the supervisor and surfaced as CF error
|
|
1799
1799
|
// 1101 on /preview/@modules/lucide-react, taking down the entire
|
|
1800
|
-
// preview. We now dispatch the bundle work to a
|
|
1800
|
+
// preview. We now dispatch the bundle work to a IsolatePool
|
|
1801
1801
|
// isolate via its own 128 MiB heap — same pattern as install-time
|
|
1802
1802
|
// pre-bundling. Supervisor never bundles esbuild for any path.
|
|
1803
1803
|
//
|
package/dist/git/commands.d.ts
CHANGED
|
@@ -9,6 +9,20 @@
|
|
|
9
9
|
* to the SqliteVFS.
|
|
10
10
|
*/
|
|
11
11
|
import type { SqliteVFS } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
|
|
12
|
+
import { type VfsCred } from '@nimbus-sh/core/runtime/os-contracts.js';
|
|
13
|
+
type Ctx = {
|
|
14
|
+
pid: number;
|
|
15
|
+
cred: VfsCred;
|
|
16
|
+
args: string[];
|
|
17
|
+
stdout: {
|
|
18
|
+
write(s: string): void;
|
|
19
|
+
};
|
|
20
|
+
stderr: {
|
|
21
|
+
write(s: string): void;
|
|
22
|
+
};
|
|
23
|
+
cwd: string;
|
|
24
|
+
env: Record<string, string>;
|
|
25
|
+
};
|
|
12
26
|
export interface ParsedCloneArgs {
|
|
13
27
|
url: string | undefined;
|
|
14
28
|
dest: string | undefined;
|
|
@@ -26,4 +40,12 @@ export declare const CLONE_USAGE = "usage: git clone [--depth <n>] [--no-shallow
|
|
|
26
40
|
*/
|
|
27
41
|
export declare function parseCloneArgs(args: string[]): ParsedCloneArgs;
|
|
28
42
|
export declare function registerGitCommands(registry: any, vfs: SqliteVFS, doCtx?: DurableObjectState, doEnv?: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* The `git` command handler. Split out from registration so it can be
|
|
45
|
+
* lazy-loaded (`await import('./commands.js')`) on first `git` use, keeping
|
|
46
|
+
* this module and its ~106 KB network-facet dependency out of the cold
|
|
47
|
+
* script-eval graph.
|
|
48
|
+
*/
|
|
49
|
+
export declare function runGitCommand(ctx: Ctx, vfs: SqliteVFS, doCtx?: DurableObjectState, doEnv?: any): Promise<number>;
|
|
50
|
+
export {};
|
|
29
51
|
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/git/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,yCAAyC,CAAC;AA8JvF,KAAK,GAAG,GAAG;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE;QAAE,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACnC,MAAM,EAAE;QAAE,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,CAAC;AAaF,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,mGAC0E,CAAC;AAEnG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CA4C9D;AAWD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,GAAG,EACb,GAAG,EAAE,SAAS,EACd,KAAK,CAAC,EAAE,kBAAkB,EAC1B,KAAK,CAAC,EAAE,GAAG,GACV,IAAI,CAEN;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,SAAS,EACd,KAAK,CAAC,EAAE,kBAAkB,EAC1B,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,MAAM,CAAC,CA0bjB"}
|