@nimbus-sh/worker 0.2.2 → 0.3.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 +5 -2
- 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/facets/cirrus-real.js +1 -1
- package/dist/facets/manager.d.ts +42 -104
- package/dist/facets/manager.d.ts.map +1 -1
- package/dist/facets/manager.js +126 -283
- 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 +4 -0
- package/dist/facets/vite-dev-server.d.ts +2 -2
- package/dist/facets/vite-dev-server.js +4 -4
- 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 +35 -12
- 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.js +1 -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 +1 -1
- package/dist/loaders/generated-workers.d.ts.map +1 -1
- package/dist/loaders/generated-workers.js +2 -2
- 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.js +1 -1
- package/dist/npm/installer.d.ts +4 -4
- package/dist/npm/installer.js +18 -18
- package/dist/npm/pre-bundle-facet.d.ts +2 -2
- package/dist/npm/pre-bundle-facet.js +5 -5
- 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 +1 -1
- package/dist/router/remote-api.js +8 -0
- package/dist/runtime/bun-repl.d.ts +1 -1
- package/dist/runtime/bun-repl.js +3 -3
- 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/python-repl.js +3 -3
- package/dist/runtime/ruby-repl.js +2 -2
- package/dist/runtime/ruby-resident.js +1 -1
- package/dist/session/hibernation.d.ts +18 -51
- package/dist/session/hibernation.d.ts.map +1 -1
- package/dist/session/hibernation.js +49 -186
- package/dist/session/init-phases.d.ts +2 -2
- package/dist/session/init-phases.d.ts.map +1 -1
- package/dist/session/init-phases.js +1 -1
- package/dist/session/init.d.ts.map +1 -1
- package/dist/session/init.js +16 -2
- package/dist/session/keys.d.ts +14 -35
- package/dist/session/keys.d.ts.map +1 -1
- package/dist/session/keys.js +17 -35
- package/dist/session/nimbus-session.d.ts +10 -4
- package/dist/session/nimbus-session.d.ts.map +1 -1
- package/dist/session/nimbus-session.js +20 -11
- 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 +41 -5
- package/dist/session/programmatic.d.ts.map +1 -1
- package/dist/session/programmatic.js +147 -15
- package/dist/session/routes.d.ts +2 -0
- package/dist/session/routes.d.ts.map +1 -1
- package/dist/session/routes.js +91 -16
- package/dist/session/rpc.d.ts +35 -8
- package/dist/session/rpc.d.ts.map +1 -1
- package/dist/session/rpc.js +73 -14
- package/dist/session/start-real-vite.d.ts.map +1 -1
- package/dist/session/start-real-vite.js +2 -0
- 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 +5 -0
- package/dist/session/ws.d.ts +2 -2
- package/dist/session/ws.d.ts.map +1 -1
- package/dist/session/ws.js +2 -2
- package/dist/wrangler/nimbus-wrangler.js +1 -1
- package/package.json +3 -2
- package/scripts/bundle-runtime.mjs +5 -2
- 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
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;AAaH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,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AU,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,7 +24,7 @@
|
|
|
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 '
|
|
27
|
+
import { getCtxExports } from '@nimbus-sh/fabric/ctx-exports.js';
|
|
28
28
|
import { CF_COMPAT_DATE, MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/core/constants.js';
|
|
29
29
|
import { GIT_BUNDLE_CODE } from '../git-bundle.generated.js';
|
|
30
30
|
import { W7_FRAME_PREAMBLE } from '../loaders/generated-workers.js';
|
|
@@ -430,7 +430,7 @@ export async function execGitNetwork(ctx, env, opts) {
|
|
|
430
430
|
// - its own worker code (git-network-worker.js), with the
|
|
431
431
|
// W7 frame helpers (encodeWriteBatchStream + supporting
|
|
432
432
|
// state) prepended so the buffered fs adapter can call
|
|
433
|
-
// them as bare identifiers — the same shape
|
|
433
|
+
// them as bare identifiers — the same shape LoaderPool's
|
|
434
434
|
// `preamble` option provides for npm install. This is the
|
|
435
435
|
// W7 v3 emits one bounded record per pull; the receiver owns
|
|
436
436
|
// the aggregate 8 MiB payload-credit and transaction limits.
|
|
@@ -1229,10 +1229,25 @@ function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritative
|
|
|
1229
1229
|
if (size <= CHUNK_SIZE) {
|
|
1230
1230
|
chunks.push({ path, chunkId: 0, data });
|
|
1231
1231
|
} else {
|
|
1232
|
+
// Each chunk record must hand the W7 encoder a Uint8Array over its own
|
|
1233
|
+
// dedicated ArrayBuffer: the encoder enqueues chunk.data into the
|
|
1234
|
+
// type:'bytes' RPC stream and workerd transfers the underlying buffer,
|
|
1235
|
+
// so a subarray view would detach the parent every other chunk shares
|
|
1236
|
+
// (the detached-ArrayBuffer failure class documented at the writeFile
|
|
1237
|
+
// ingress). That copy is materialized LAZILY, one access at a time: an
|
|
1238
|
+
// eager data.slice() per chunk held a second full copy of the file
|
|
1239
|
+
// beside the writeBuffer original, and for an oversize single-file
|
|
1240
|
+
// wave — a packfile — that transient 2× was the facet's peak
|
|
1241
|
+
// allocation. With the getter, W7 validation and encoding each
|
|
1242
|
+
// materialize one chunk-sized copy that is discarded (validation) or
|
|
1243
|
+
// transferred (encode) before the next exists, so peak stays ~1× wave
|
|
1244
|
+
// bytes + one chunk.
|
|
1232
1245
|
for (let i = 0; i < chunkCount; i++) {
|
|
1246
|
+
const start = i * CHUNK_SIZE;
|
|
1247
|
+
const end = Math.min(size, start + CHUNK_SIZE);
|
|
1233
1248
|
chunks.push({
|
|
1234
1249
|
path, chunkId: i,
|
|
1235
|
-
data
|
|
1250
|
+
get data() { return data.slice(start, end); },
|
|
1236
1251
|
});
|
|
1237
1252
|
}
|
|
1238
1253
|
}
|
|
@@ -1564,20 +1579,21 @@ function createBufferedFs(
|
|
|
1564
1579
|
const wavebytesWritten = bufferBytes;
|
|
1565
1580
|
// Release facet-side buffer references BEFORE awaiting the RPC.
|
|
1566
1581
|
//
|
|
1567
|
-
// After buildPayload, payload.chunks
|
|
1568
|
-
//
|
|
1569
|
-
//
|
|
1570
|
-
// of the
|
|
1571
|
-
//
|
|
1582
|
+
// After buildPayload, payload.chunks references each writeBuffer entry's
|
|
1583
|
+
// bytes — small files alias the entry's Uint8Array directly; files over
|
|
1584
|
+
// CHUNK_SIZE are lazy chunk records whose getters copy one chunk at a
|
|
1585
|
+
// time out of the entry (see buildPayload). payload is the only consumer
|
|
1586
|
+
// that needs those bytes for the duration of the await. Holding them in
|
|
1587
|
+
// writeBuffer too just doubles facet-side residency during the await.
|
|
1572
1588
|
//
|
|
1573
1589
|
// Empirically (Q4 prod verification at probe-prod-post-fix-2026-05-09T14-54-31Z.txt)
|
|
1574
1590
|
// the facet OOMs around the third long-clone wave on a real repo
|
|
1575
1591
|
// with the buffers retained. Releasing them here means the writeBuffer
|
|
1576
1592
|
// Map drops to size 0, the underlying Uint8Array entries are reachable
|
|
1577
|
-
// ONLY through payload.chunks,
|
|
1578
|
-
//
|
|
1579
|
-
//
|
|
1580
|
-
// to ~1× wave bytes.
|
|
1593
|
+
// ONLY through payload.chunks (directly, or via the lazy chunk-record
|
|
1594
|
+
// closures), and as the W7 encoder advances past each chunk the JS
|
|
1595
|
+
// engine can collect the consumed entries. Net facet-side residency
|
|
1596
|
+
// during the await drops from ~2× wave bytes to ~1× wave bytes.
|
|
1581
1597
|
//
|
|
1582
1598
|
// Safety: if the await throws, the outer fetch handler calls flushWave()
|
|
1583
1599
|
// again best-effort. writeBuffer is already empty, so that is a no-op.
|
|
@@ -2382,6 +2398,7 @@ export default {
|
|
|
2382
2398
|
fs, http, cache,
|
|
2383
2399
|
dir: opts.dir,
|
|
2384
2400
|
url: opts.url,
|
|
2401
|
+
ref: opts.ref || undefined,
|
|
2385
2402
|
singleBranch: true,
|
|
2386
2403
|
depth: opts.depth || 1,
|
|
2387
2404
|
noCheckout: true,
|
|
@@ -2613,6 +2630,12 @@ export default {
|
|
|
2613
2630
|
} catch (e) {
|
|
2614
2631
|
// Best-effort flush of partial state so user can inspect what landed
|
|
2615
2632
|
try { await flushWave(); } catch {}
|
|
2633
|
+
// Only a failed PREPARE drops the warm job: a failed checkout chunk
|
|
2634
|
+
// keeps its entry so a marker-replay retry runs warm (the cache pins
|
|
2635
|
+
// the pack; a cold retry re-reads it from the supervisor). Completion
|
|
2636
|
+
// and clone-abort delete the entry, and the facet isolate itself is
|
|
2637
|
+
// scoped to one execGitNetwork call, so a retained entry can never
|
|
2638
|
+
// outlive its clone.
|
|
2616
2639
|
if (phase === 'clone-prepare') cloneJobs.delete(opts.jobId);
|
|
2617
2640
|
return respond(false, {
|
|
2618
2641
|
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"}
|