@nimbus-sh/worker 0.2.3 → 0.4.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/dist/_shared/session-router.d.ts +8 -0
- package/dist/_shared/session-router.d.ts.map +1 -1
- package/dist/_shared/session-router.js +8 -0
- 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/manager.d.ts +43 -129
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +107 -318
- package/dist/facets/opencode-staging.d.ts +1 -1
- package/dist/facets/opencode-staging.d.ts.map +1 -1
- package/dist/facets/opencode-staging.js +3 -0
- 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 +8 -0
- package/dist/git/commands.d.ts.map +1 -1
- package/dist/git/commands.js +41 -9
- package/dist/git/network-facet.d.ts +1 -1
- package/dist/git/network-facet.d.ts.map +1 -1
- package/dist/git/network-facet.js +39 -15
- 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.map +1 -1
- package/dist/index.js +9 -1
- 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/loaders/process-host.d.ts +6 -107
- package/dist/loaders/process-host.d.ts.map +1 -1
- package/dist/loaders/process-host.js +6 -405
- 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.js +2 -2
- package/dist/router/remote-api.js +9 -1
- 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 +5 -8
- package/dist/runtime/facet-loader-host.d.ts.map +1 -1
- package/dist/runtime/facet-loader-host.js +7 -11
- package/dist/runtime/node-repl.js +2 -2
- package/dist/runtime/node-shims-artifact.js +1 -1
- package/dist/runtime/node-shims.js +2 -1
- 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/ruby-resident.js +1 -1
- package/dist/runtime/sqlite-wasm-bytes.js +1 -1
- package/dist/session/diag.js +1 -1
- package/dist/session/hibernation.d.ts +20 -53
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +57 -194
- package/dist/session/init-phases.d.ts +2 -3
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +3 -2
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +8 -4
- package/dist/session/keys.d.ts +14 -37
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +18 -37
- package/dist/session/nimbus-session.d.ts +10 -15
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +28 -31
- package/dist/session/port-capability.d.ts +43 -0
- package/dist/session/port-capability.d.ts.map +1 -0
- package/dist/session/port-capability.js +49 -0
- package/dist/session/programmatic.d.ts +39 -5
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +150 -19
- package/dist/session/routes.d.ts +2 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +96 -20
- package/dist/session/rpc.d.ts +36 -9
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +84 -24
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +3 -1
- package/dist/session/state-store.d.ts +3 -2
- package/dist/session/state-store.d.ts.map +1 -1
- package/dist/session/state-store.js +3 -2
- package/dist/session/supervisor-rpc.d.ts.map +1 -1
- package/dist/session/supervisor-rpc.js +7 -4
- package/dist/session/ws.d.ts +1 -3
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +4 -3
- package/dist/wrangler/nimbus-wrangler.js +1 -1
- package/package.json +4 -2
- package/scripts/bundle-esbuild-wasm.mjs +2 -2
- package/scripts/bundle-facet-workers.mjs +5 -7
- package/scripts/bundle-sqlite-wasm.mjs +1 -1
- package/dist/facets/inner-do-registry.d.ts +0 -41
- package/dist/facets/inner-do-registry.d.ts.map +0 -1
- package/dist/facets/inner-do-registry.js +0 -51
- package/dist/facets/launch-pacer.d.ts +0 -111
- package/dist/facets/launch-pacer.d.ts.map +0 -1
- package/dist/facets/launch-pacer.js +0 -130
- package/dist/loaders/fanout-pool.d.ts +0 -207
- package/dist/loaders/fanout-pool.d.ts.map +0 -1
- package/dist/loaders/fanout-pool.js +0 -363
- package/dist/loaders/loader-pool.d.ts +0 -294
- package/dist/loaders/loader-pool.d.ts.map +0 -1
- package/dist/loaders/loader-pool.js +0 -642
- package/dist/loaders/process-fabric.d.ts +0 -509
- package/dist/loaders/process-fabric.d.ts.map +0 -1
- package/dist/loaders/process-fabric.js +0 -360
- package/dist/loaders/vendor/errors.d.ts +0 -24
- package/dist/loaders/vendor/errors.d.ts.map +0 -1
- package/dist/loaders/vendor/errors.js +0 -46
- package/dist/loaders/vendor/serialize.d.ts +0 -3
- package/dist/loaders/vendor/serialize.d.ts.map +0 -1
- package/dist/loaders/vendor/serialize.js +0 -25
- package/dist/loaders/vendor/types.d.ts +0 -69
- package/dist/loaders/vendor/types.d.ts.map +0 -1
- package/dist/loaders/vendor/types.js +0 -4
- package/dist/loaders/workerd-facet-host.d.ts +0 -141
- package/dist/loaders/workerd-facet-host.d.ts.map +0 -1
- package/dist/loaders/workerd-facet-host.js +0 -284
- package/dist/session/bindings.d.ts +0 -209
- package/dist/session/bindings.d.ts.map +0 -1
- package/dist/session/bindings.js +0 -680
- package/dist/session/ctx-exports.d.ts +0 -16
- package/dist/session/ctx-exports.d.ts.map +0 -1
- package/dist/session/ctx-exports.js +0 -22
- package/dist/session/ws-hibernation-config.d.ts +0 -64
- package/dist/session/ws-hibernation-config.d.ts.map +0 -1
- package/dist/session/ws-hibernation-config.js +0 -89
|
@@ -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
|
@@ -15,7 +15,15 @@ export interface ParsedCloneArgs {
|
|
|
15
15
|
depth: number | undefined;
|
|
16
16
|
noShallow: boolean;
|
|
17
17
|
isBg: boolean;
|
|
18
|
+
branch: string | undefined;
|
|
18
19
|
}
|
|
20
|
+
export declare const CLONE_USAGE = "usage: git clone [--depth <n>] [--no-shallow] [--branch <name> | -b <name>] [--bg] <url> [dir]";
|
|
21
|
+
/**
|
|
22
|
+
* Every flag is either handled or refused loudly. Silently skipping unknown
|
|
23
|
+
* flags corrupted positionals for value-taking ones (`--branch dev URL`
|
|
24
|
+
* parsed `dev` as the URL) and silently no-opped `--filter=blob:none` — a
|
|
25
|
+
* "blobless" clone that was not blobless.
|
|
26
|
+
*/
|
|
19
27
|
export declare function parseCloneArgs(args: string[]): ParsedCloneArgs;
|
|
20
28
|
export declare function registerGitCommands(registry: any, vfs: SqliteVFS, doCtx?: DurableObjectState, doEnv?: any): void;
|
|
21
29
|
//# 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;AAoLpF,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;
|
|
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;AAoLpF,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,CA4bN"}
|
package/dist/git/commands.js
CHANGED
|
@@ -183,17 +183,47 @@ function getFlag(args, flag) {
|
|
|
183
183
|
const prefix = `${flag}=`;
|
|
184
184
|
return args.find((arg) => arg.startsWith(prefix))?.slice(prefix.length) || undefined;
|
|
185
185
|
}
|
|
186
|
+
export const CLONE_USAGE = 'usage: git clone [--depth <n>] [--no-shallow] [--branch <name> | -b <name>] [--bg] <url> [dir]';
|
|
187
|
+
/**
|
|
188
|
+
* Every flag is either handled or refused loudly. Silently skipping unknown
|
|
189
|
+
* flags corrupted positionals for value-taking ones (`--branch dev URL`
|
|
190
|
+
* parsed `dev` as the URL) and silently no-opped `--filter=blob:none` — a
|
|
191
|
+
* "blobless" clone that was not blobless.
|
|
192
|
+
*/
|
|
186
193
|
export function parseCloneArgs(args) {
|
|
187
|
-
|
|
188
|
-
|
|
194
|
+
let depthFlag;
|
|
195
|
+
let branch;
|
|
196
|
+
let noShallow = false;
|
|
197
|
+
let isBg = false;
|
|
189
198
|
const positionals = [];
|
|
190
199
|
for (let i = 0; i < args.length; i++) {
|
|
191
200
|
const arg = args[i];
|
|
192
|
-
|
|
193
|
-
|
|
201
|
+
const eq = arg.startsWith('--') ? arg.indexOf('=') : -1;
|
|
202
|
+
const name = eq > 0 ? arg.slice(0, eq) : arg;
|
|
203
|
+
const takeValue = () => {
|
|
204
|
+
if (eq > 0)
|
|
205
|
+
return arg.slice(eq + 1);
|
|
206
|
+
const value = args[++i];
|
|
207
|
+
if (value === undefined) {
|
|
208
|
+
throw new Error(`option '${name}' requires a value\n${CLONE_USAGE}`);
|
|
209
|
+
}
|
|
210
|
+
return value;
|
|
211
|
+
};
|
|
212
|
+
if (name === '--depth')
|
|
213
|
+
depthFlag = takeValue();
|
|
214
|
+
else if (name === '--branch' || name === '-b')
|
|
215
|
+
branch = takeValue();
|
|
216
|
+
else if (arg === '--no-shallow')
|
|
217
|
+
noShallow = true;
|
|
218
|
+
else if (arg === '--bg' || arg === '&')
|
|
219
|
+
isBg = true;
|
|
220
|
+
else if (name === '--filter') {
|
|
221
|
+
throw new Error("clone does not support '--filter': the bundled isomorphic-git has no " +
|
|
222
|
+
'partial-clone support, so a filter would silently download every object. ' +
|
|
223
|
+
'Use --depth <n> to bound history instead.');
|
|
194
224
|
}
|
|
195
|
-
else if (arg
|
|
196
|
-
|
|
225
|
+
else if (arg.startsWith('-')) {
|
|
226
|
+
throw new Error(`unknown option '${arg}'\n${CLONE_USAGE}`);
|
|
197
227
|
}
|
|
198
228
|
else {
|
|
199
229
|
positionals.push(arg);
|
|
@@ -204,7 +234,8 @@ export function parseCloneArgs(args) {
|
|
|
204
234
|
dest: positionals[1],
|
|
205
235
|
depth: depthFlag ? parseInt(depthFlag) || 1 : (noShallow ? undefined : 1),
|
|
206
236
|
noShallow,
|
|
207
|
-
isBg
|
|
237
|
+
isBg,
|
|
238
|
+
branch,
|
|
208
239
|
};
|
|
209
240
|
}
|
|
210
241
|
function getAuthor(ctx) {
|
|
@@ -263,9 +294,9 @@ export function registerGitCommands(registry, vfs, doCtx, doEnv) {
|
|
|
263
294
|
return 0;
|
|
264
295
|
}
|
|
265
296
|
case 'clone': {
|
|
266
|
-
const { url, dest: destArg, depth, isBg } = parseCloneArgs(subArgs);
|
|
297
|
+
const { url, dest: destArg, depth, isBg, branch } = parseCloneArgs(subArgs);
|
|
267
298
|
if (!url) {
|
|
268
|
-
ctx.stderr.write(
|
|
299
|
+
ctx.stderr.write(CLONE_USAGE + '\n');
|
|
269
300
|
return 1;
|
|
270
301
|
}
|
|
271
302
|
// hardening-r5: respect absolute paths. Pre-fix `git clone <url> /tmp/x`
|
|
@@ -304,6 +335,7 @@ export function registerGitCommands(registry, vfs, doCtx, doEnv) {
|
|
|
304
335
|
pid: ctx.pid,
|
|
305
336
|
dir: dest,
|
|
306
337
|
url,
|
|
338
|
+
ref: branch,
|
|
307
339
|
depth,
|
|
308
340
|
exclusiveDestination: true,
|
|
309
341
|
exclusiveMutationRoot: mutationLease.root,
|
|
@@ -35,7 +35,7 @@ export interface GitNetworkOpts {
|
|
|
35
35
|
url?: string;
|
|
36
36
|
/** For fetch/pull: remote name (default "origin") */
|
|
37
37
|
remote?: string;
|
|
38
|
-
/** For pull: branch name (default current) */
|
|
38
|
+
/** For clone: branch to clone (default remote HEAD); for pull: branch name (default current) */
|
|
39
39
|
ref?: string;
|
|
40
40
|
/** Shallow depth; default 1 for clone */
|
|
41
41
|
depth?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-facet.d.ts","sourceRoot":"","sources":["../../src/git/network-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"network-facet.d.ts","sourceRoot":"","sources":["../../src/git/network-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAcH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAC;IACjB,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,+BAA+B;IAC/B,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEA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B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;IACT,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,OAAO;IACf,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACxD;AAED,UAAU,mBAAmB;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AA8cD;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,kBAAkB,EACvB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAuU3B;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EACjB,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAuDT;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD"}
|
|
@@ -24,13 +24,14 @@
|
|
|
24
24
|
* See docs/analysis in git-network-facet plan — the canonical write-up lives
|
|
25
25
|
* in the PR that introduced this file.
|
|
26
26
|
*/
|
|
27
|
-
import { getCtxExports } from '
|
|
28
|
-
import { CF_COMPAT_DATE
|
|
27
|
+
import { getCtxExports } from '@nimbus-sh/fabric/composition.js';
|
|
28
|
+
import { CF_COMPAT_DATE } from '@nimbus-sh/core/constants.js';
|
|
29
|
+
import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
|
|
29
30
|
import { GIT_BUNDLE_CODE } from '../git-bundle.generated.js';
|
|
30
31
|
import { W7_FRAME_PREAMBLE } from '../loaders/generated-workers.js';
|
|
31
32
|
import { ESBUILD_NAME_GLOBAL_SHIM } from '@nimbus-sh/core/_shared/esbuild-facet-shim.js';
|
|
32
|
-
import { disposeRpcResource } from '@nimbus-sh/
|
|
33
|
-
import { W7_MAX_OWNED_PATH_BYTES, W7_MAX_PATHS_PER_BATCH, } from '@nimbus-sh/
|
|
33
|
+
import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
34
|
+
import { W7_MAX_OWNED_PATH_BYTES, W7_MAX_PATHS_PER_BATCH, } from '@nimbus-sh/platform/w7-frame.js';
|
|
34
35
|
const CLONE_PHASE_TIMEOUT_MS = 240_000;
|
|
35
36
|
const CLONE_ABORT_TIMEOUT_MS = 30_000;
|
|
36
37
|
const DEFAULT_CLONE_BUDGET_MS = 30 * 60_000;
|
|
@@ -430,7 +431,7 @@ export async function execGitNetwork(ctx, env, opts) {
|
|
|
430
431
|
// - its own worker code (git-network-worker.js), with the
|
|
431
432
|
// W7 frame helpers (encodeWriteBatchStream + supporting
|
|
432
433
|
// state) prepended so the buffered fs adapter can call
|
|
433
|
-
// them as bare identifiers — the same shape
|
|
434
|
+
// them as bare identifiers — the same shape IsolatePool's
|
|
434
435
|
// `preamble` option provides for npm install. This is the
|
|
435
436
|
// W7 v3 emits one bounded record per pull; the receiver owns
|
|
436
437
|
// the aggregate 8 MiB payload-credit and transaction limits.
|
|
@@ -1229,10 +1230,25 @@ function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritative
|
|
|
1229
1230
|
if (size <= CHUNK_SIZE) {
|
|
1230
1231
|
chunks.push({ path, chunkId: 0, data });
|
|
1231
1232
|
} else {
|
|
1233
|
+
// Each chunk record must hand the W7 encoder a Uint8Array over its own
|
|
1234
|
+
// dedicated ArrayBuffer: the encoder enqueues chunk.data into the
|
|
1235
|
+
// type:'bytes' RPC stream and workerd transfers the underlying buffer,
|
|
1236
|
+
// so a subarray view would detach the parent every other chunk shares
|
|
1237
|
+
// (the detached-ArrayBuffer failure class documented at the writeFile
|
|
1238
|
+
// ingress). That copy is materialized LAZILY, one access at a time: an
|
|
1239
|
+
// eager data.slice() per chunk held a second full copy of the file
|
|
1240
|
+
// beside the writeBuffer original, and for an oversize single-file
|
|
1241
|
+
// wave — a packfile — that transient 2× was the facet's peak
|
|
1242
|
+
// allocation. With the getter, W7 validation and encoding each
|
|
1243
|
+
// materialize one chunk-sized copy that is discarded (validation) or
|
|
1244
|
+
// transferred (encode) before the next exists, so peak stays ~1× wave
|
|
1245
|
+
// bytes + one chunk.
|
|
1232
1246
|
for (let i = 0; i < chunkCount; i++) {
|
|
1247
|
+
const start = i * CHUNK_SIZE;
|
|
1248
|
+
const end = Math.min(size, start + CHUNK_SIZE);
|
|
1233
1249
|
chunks.push({
|
|
1234
1250
|
path, chunkId: i,
|
|
1235
|
-
data
|
|
1251
|
+
get data() { return data.slice(start, end); },
|
|
1236
1252
|
});
|
|
1237
1253
|
}
|
|
1238
1254
|
}
|
|
@@ -1564,20 +1580,21 @@ function createBufferedFs(
|
|
|
1564
1580
|
const wavebytesWritten = bufferBytes;
|
|
1565
1581
|
// Release facet-side buffer references BEFORE awaiting the RPC.
|
|
1566
1582
|
//
|
|
1567
|
-
// After buildPayload, payload.chunks
|
|
1568
|
-
//
|
|
1569
|
-
//
|
|
1570
|
-
// of the
|
|
1571
|
-
//
|
|
1583
|
+
// After buildPayload, payload.chunks references each writeBuffer entry's
|
|
1584
|
+
// bytes — small files alias the entry's Uint8Array directly; files over
|
|
1585
|
+
// CHUNK_SIZE are lazy chunk records whose getters copy one chunk at a
|
|
1586
|
+
// time out of the entry (see buildPayload). payload is the only consumer
|
|
1587
|
+
// that needs those bytes for the duration of the await. Holding them in
|
|
1588
|
+
// writeBuffer too just doubles facet-side residency during the await.
|
|
1572
1589
|
//
|
|
1573
1590
|
// Empirically (Q4 prod verification at probe-prod-post-fix-2026-05-09T14-54-31Z.txt)
|
|
1574
1591
|
// the facet OOMs around the third long-clone wave on a real repo
|
|
1575
1592
|
// with the buffers retained. Releasing them here means the writeBuffer
|
|
1576
1593
|
// Map drops to size 0, the underlying Uint8Array entries are reachable
|
|
1577
|
-
// ONLY through payload.chunks,
|
|
1578
|
-
//
|
|
1579
|
-
//
|
|
1580
|
-
// to ~1× wave bytes.
|
|
1594
|
+
// ONLY through payload.chunks (directly, or via the lazy chunk-record
|
|
1595
|
+
// closures), and as the W7 encoder advances past each chunk the JS
|
|
1596
|
+
// engine can collect the consumed entries. Net facet-side residency
|
|
1597
|
+
// during the await drops from ~2× wave bytes to ~1× wave bytes.
|
|
1581
1598
|
//
|
|
1582
1599
|
// Safety: if the await throws, the outer fetch handler calls flushWave()
|
|
1583
1600
|
// again best-effort. writeBuffer is already empty, so that is a no-op.
|
|
@@ -2382,6 +2399,7 @@ export default {
|
|
|
2382
2399
|
fs, http, cache,
|
|
2383
2400
|
dir: opts.dir,
|
|
2384
2401
|
url: opts.url,
|
|
2402
|
+
ref: opts.ref || undefined,
|
|
2385
2403
|
singleBranch: true,
|
|
2386
2404
|
depth: opts.depth || 1,
|
|
2387
2405
|
noCheckout: true,
|
|
@@ -2613,6 +2631,12 @@ export default {
|
|
|
2613
2631
|
} catch (e) {
|
|
2614
2632
|
// Best-effort flush of partial state so user can inspect what landed
|
|
2615
2633
|
try { await flushWave(); } catch {}
|
|
2634
|
+
// Only a failed PREPARE drops the warm job: a failed checkout chunk
|
|
2635
|
+
// keeps its entry so a marker-replay retry runs warm (the cache pins
|
|
2636
|
+
// the pack; a cold retry re-reads it from the supervisor). Completion
|
|
2637
|
+
// and clone-abort delete the entry, and the facet isolate itself is
|
|
2638
|
+
// scoped to one execGitNetwork call, so a retained entry can never
|
|
2639
|
+
// outlive its clone.
|
|
2616
2640
|
if (phase === 'clone-prepare') cloneJobs.delete(opts.jobId);
|
|
2617
2641
|
return respond(false, {
|
|
2618
2642
|
error: (e && e.message) || String(e),
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* Consumed by git-network-facet.ts: passed to LOADER.load()'s
|
|
9
9
|
* `modules` record so the facet can `import` isomorphic-git.
|
|
10
10
|
*
|
|
11
|
-
* Size:
|
|
11
|
+
* Size: 480.8 KiB
|
|
12
12
|
*/
|
|
13
13
|
export declare const GIT_BUNDLE_CODE: string;
|
|
14
|
-
export declare const GIT_BUNDLE_SIZE =
|
|
14
|
+
export declare const GIT_BUNDLE_SIZE = 492322;
|
|
15
15
|
//# sourceMappingURL=git-bundle.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-bundle.generated.d.ts","sourceRoot":"","sources":["../src/git-bundle.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"git-bundle.generated.d.ts","sourceRoot":"","sources":["../src/git-bundle.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,eAAe,EAAE,MAAkkqf,CAAC;AAEjmqf,eAAO,MAAM,eAAe,SAAS,CAAC"}
|