@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
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
* - events: full EventEmitter
|
|
10
10
|
* - stream: real Readable/Writable/Transform/Duplex with backpressure
|
|
11
11
|
* - crypto: createHash (FNV-1a sync, SubtleCrypto async), randomBytes/UUID
|
|
12
|
-
* - zlib:
|
|
12
|
+
* - zlib: forward to workerd's native node:zlib when the facet real-import
|
|
13
|
+
* block materialised (full sync/brotli/stream surface; results are the
|
|
14
|
+
* host realm's own Buffers, recognized by the widened isBuffer);
|
|
15
|
+
* CompressionStream fallback with honest sync refusal
|
|
13
16
|
* - dns: real DNS resolution via Cloudflare DNS-over-HTTPS
|
|
14
17
|
* - http: virtual server with port registry for supervisor routing
|
|
15
18
|
* - https: fetch()-backed request/get
|
|
@@ -41,7 +44,8 @@ import { generateUndiciShimCode } from '@nimbus-sh/core/runtime/undici-shim.js';
|
|
|
41
44
|
import { getExportsResolverJS } from '@nimbus-sh/core/_shared/exports-resolver.js';
|
|
42
45
|
import { getTypescriptSpecifiersJS } from '@nimbus-sh/core/_shared/typescript-specifiers.js';
|
|
43
46
|
import { NIMBUS_AI_CREDENTIAL_HEADERS, NIMBUS_AI_TOKEN_ENV } from '@nimbus-sh/core/_shared/ai-egress.js';
|
|
44
|
-
import {
|
|
47
|
+
import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
|
|
48
|
+
import { FACET_PROVIDED_PACKAGES, FS_READ_BATCH_PATH_LIMIT, FS_READ_BATCH_REQUEST_BYTES, NIMBUS_AI_GATEWAY_PORT, NODE_VERSION, NODE_VERSIONS, } from '@nimbus-sh/core/constants.js';
|
|
45
49
|
const STREAMS_CODE = generateStreamsCode();
|
|
46
50
|
const SQLITE_SHIM_CODE = generateSqliteShimCode();
|
|
47
51
|
const UNDICI_SHIM_CODE = generateUndiciShimCode();
|
|
@@ -385,7 +389,19 @@ const __BufferMod = (() => {
|
|
|
385
389
|
|
|
386
390
|
function alloc(n, fill) { const a = new Uint8Array(n); if (fill !== undefined) a.fill(typeof fill === "number" ? fill : 0); return _wrap(a); }
|
|
387
391
|
function allocUnsafe(n) { return _wrap(new Uint8Array(Number(n) || 0)); }
|
|
388
|
-
|
|
392
|
+
// Marker check plus native-brand recognition: forwarded node:* builtins
|
|
393
|
+
// (zlib streams and results, crypto) hand back the host realm's own Buffer
|
|
394
|
+
// instances, which carry no __isBuffer marker. Their constructor brand is
|
|
395
|
+
// the closest cross-realm equivalent of Node's instanceof check, so
|
|
396
|
+
// Buffer.isBuffer stays truthful across the shim/native boundary instead
|
|
397
|
+
// of rejecting genuine host Buffers. Always returns a boolean (the old
|
|
398
|
+
// single-expression form leaked an undefined when the marker was absent).
|
|
399
|
+
function isBuffer(o) {
|
|
400
|
+
if (!(o instanceof Uint8Array)) return false;
|
|
401
|
+
if (o.__isBuffer) return true;
|
|
402
|
+
const ctor = o.constructor;
|
|
403
|
+
return typeof ctor === "function" && ctor.name === "Buffer";
|
|
404
|
+
}
|
|
389
405
|
function concat(bufs, len) {
|
|
390
406
|
const total = len ?? bufs.reduce((s, b) => s + b.length, 0);
|
|
391
407
|
const r = new Uint8Array(total); let off = 0;
|
|
@@ -5592,6 +5608,21 @@ const __processMod = {
|
|
|
5592
5608
|
},
|
|
5593
5609
|
platform: "linux", arch: "x64",
|
|
5594
5610
|
version: ${NODE_VERSION_LITERAL}, versions: ${NODE_VERSIONS_LITERAL},
|
|
5611
|
+
features: Object.freeze({
|
|
5612
|
+
inspector: false,
|
|
5613
|
+
debug: false,
|
|
5614
|
+
uv: false,
|
|
5615
|
+
ipv6: true,
|
|
5616
|
+
tls_alpn: true,
|
|
5617
|
+
tls_sni: true,
|
|
5618
|
+
tls_ocsp: false,
|
|
5619
|
+
tls: true,
|
|
5620
|
+
openssl_is_boringssl: true,
|
|
5621
|
+
}),
|
|
5622
|
+
getBuiltinModule: (specifier) => {
|
|
5623
|
+
const key = String(specifier).replace(/^node:/, "");
|
|
5624
|
+
return Object.prototype.hasOwnProperty.call(builtins, key) ? builtins[key] : undefined;
|
|
5625
|
+
},
|
|
5595
5626
|
execPath: "/usr/local/bin/node",
|
|
5596
5627
|
execArgv: [],
|
|
5597
5628
|
pid: 1, ppid: 0, title: "node",
|
|
@@ -6151,10 +6182,295 @@ const __nimbusFacetProvidedPackages = new Set(${FACET_PROVIDED_PACKAGES_LITERAL}
|
|
|
6151
6182
|
// timers.setInterval(...)), which clack's spinner — used by
|
|
6152
6183
|
// create-cloudflare — triggers.
|
|
6153
6184
|
builtins.timers = { setTimeout: globalThis.setTimeout.bind(globalThis), setInterval: globalThis.setInterval.bind(globalThis), clearTimeout: globalThis.clearTimeout.bind(globalThis), clearInterval: globalThis.clearInterval.bind(globalThis), setImmediate: (fn,...a) => globalThis.setTimeout(fn,0,...a), clearImmediate: globalThis.clearTimeout.bind(globalThis) };
|
|
6185
|
+
// ── zlib ───────────────────────────────────────────────────────────
|
|
6186
|
+
//
|
|
6187
|
+
// Two runtimes, one surface:
|
|
6188
|
+
// 1. Facet templates prepend the static import block
|
|
6189
|
+
// (_shared/real-node-imports.ts), which carries workerd's native
|
|
6190
|
+
// node:zlib — complete at the production compat date: every *Sync
|
|
6191
|
+
// variant, brotli/zstd, crc32, constants, and real streaming create*
|
|
6192
|
+
// factories. Forward verbatim: results are the host realm's own Buffer
|
|
6193
|
+
// instances, and __BufferMod.isBuffer recognizes that brand (see the
|
|
6194
|
+
// Buffer shim), so Buffer checks stay truthful without copying every
|
|
6195
|
+
// result or intercepting stream chunks.
|
|
6196
|
+
// 2. Scopes without the import block keep the CompressionStream fallback.
|
|
6197
|
+
// It is async-only by nature; the sync names refuse with an honest,
|
|
6198
|
+
// actionable error instead of pretending.
|
|
6154
6199
|
builtins.zlib = (() => {
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6200
|
+
const __real = (typeof __real_zlib !== "undefined") ? (__real_zlib.default ?? __real_zlib) : null;
|
|
6201
|
+
if (__real && typeof __real.gzipSync === "function") {
|
|
6202
|
+
const mod = {};
|
|
6203
|
+
// Constants, lookup tables, crc32, and the stream factories/classes pass
|
|
6204
|
+
// through bound to the native module (capitalized names are classes —
|
|
6205
|
+
// binding would strip their prototype and break \`new\`).
|
|
6206
|
+
for (const k of Object.keys(__real)) {
|
|
6207
|
+
const v = __real[k];
|
|
6208
|
+
mod[k] = (typeof v === "function" && /^[a-z]/.test(k)) ? v.bind(__real) : v;
|
|
6209
|
+
}
|
|
6210
|
+
if (__real.promises) mod.promises = __real.promises;
|
|
6211
|
+
mod.default = mod;
|
|
6212
|
+
return mod;
|
|
6213
|
+
}
|
|
6214
|
+
function _c(i,a) { return new Response(new Blob([i]).stream().pipeThrough(new CompressionStream(a))).arrayBuffer().then(ab=>__BufferMod.from(new Uint8Array(ab))); }
|
|
6215
|
+
// Decompression is driven by hand rather than piped: feeding and draining
|
|
6216
|
+
// run together, because a write only completes while somebody reads.
|
|
6217
|
+
async function _d(i,a) {
|
|
6218
|
+
const codec = _openCodec("decompress", a);
|
|
6219
|
+
const chunks = [];
|
|
6220
|
+
let failure = null;
|
|
6221
|
+
const record = (reason) => { if (!failure) failure = { reason }; };
|
|
6222
|
+
const drain = (async () => {
|
|
6223
|
+
for (;;) {
|
|
6224
|
+
const next = await codec.reader.read();
|
|
6225
|
+
if (next.done) return;
|
|
6226
|
+
chunks.push(next.value);
|
|
6227
|
+
}
|
|
6228
|
+
})().catch(record);
|
|
6229
|
+
const feed = (async () => {
|
|
6230
|
+
await codec.writer.write(i);
|
|
6231
|
+
await codec.writer.close();
|
|
6232
|
+
})().catch(record);
|
|
6233
|
+
await Promise.all([drain, feed]);
|
|
6234
|
+
if (failure) throw _decompressFailure(failure.reason);
|
|
6235
|
+
return __BufferMod.from(_concat(chunks));
|
|
6236
|
+
}
|
|
6237
|
+
function _syncRefusal(name, asyncName) {
|
|
6238
|
+
const e = new Error("zlib." + name + ": synchronous compression is not available on this runtime (no native node:zlib in scope). Use the async zlib." + asyncName + "(data, callback) form.");
|
|
6239
|
+
e.code = "ERR_ZLIB_SYNC_UNAVAILABLE";
|
|
6240
|
+
throw e;
|
|
6241
|
+
}
|
|
6242
|
+
// Node accepts strings, ArrayBuffers, and any ArrayBufferView; one funnel
|
|
6243
|
+
// yields a byte-addressed Uint8Array over the caller's own region —
|
|
6244
|
+
// byteOffset/byteLength preserved, element values never reinterpreted.
|
|
6245
|
+
function _u8(d) {
|
|
6246
|
+
if (typeof d === "string") return new TextEncoder().encode(d);
|
|
6247
|
+
if (d instanceof Uint8Array) return d;
|
|
6248
|
+
if (ArrayBuffer.isView(d)) return new Uint8Array(d.buffer, d.byteOffset, d.byteLength);
|
|
6249
|
+
return new Uint8Array(d);
|
|
6250
|
+
}
|
|
6251
|
+
// Node splits decompression failures two ways, and the engine's own
|
|
6252
|
+
// failure is the only thing that can tell them apart: an input that ran
|
|
6253
|
+
// out is Z_BUF_ERROR / errno -5, everything else — bad header, bad block,
|
|
6254
|
+
// and a checksum or length trailer that only fails once the member is
|
|
6255
|
+
// complete — is Z_DATA_ERROR / errno -3. Which side of a write or close
|
|
6256
|
+
// the failure lands on says nothing about that, so it is not consulted.
|
|
6257
|
+
function _zdata(e) {
|
|
6258
|
+
const err = new Error(e instanceof Error && e.message ? e.message : String(e));
|
|
6259
|
+
err.code = "Z_DATA_ERROR";
|
|
6260
|
+
err.errno = -3;
|
|
6261
|
+
err.cause = e;
|
|
6262
|
+
return err;
|
|
6263
|
+
}
|
|
6264
|
+
function _zbuf(e) {
|
|
6265
|
+
const err = new Error("unexpected end of file");
|
|
6266
|
+
err.code = "Z_BUF_ERROR";
|
|
6267
|
+
err.errno = -5;
|
|
6268
|
+
if (e != null) err.cause = e;
|
|
6269
|
+
return err;
|
|
6270
|
+
}
|
|
6271
|
+
function _isUnexpectedEnd(e) {
|
|
6272
|
+
const m = e instanceof Error && typeof e.message === "string" ? e.message : String(e);
|
|
6273
|
+
return /unexpected end|end of (?:file|input|stream)|premature|truncated|\\bEOF\\b/i.test(m);
|
|
6274
|
+
}
|
|
6275
|
+
function _decompressFailure(e) { return _isUnexpectedEnd(e) ? _zbuf(e) : _zdata(e); }
|
|
6276
|
+
function _destroyedWrite() {
|
|
6277
|
+
const e = new Error("Cannot call write after a stream was destroyed");
|
|
6278
|
+
e.code = "ERR_STREAM_DESTROYED";
|
|
6279
|
+
return e;
|
|
6280
|
+
}
|
|
6281
|
+
// Node throws synchronously rather than deferring a callback that is not
|
|
6282
|
+
// there; this surface has no promise form to fall back on.
|
|
6283
|
+
function _invalidCallback(v) {
|
|
6284
|
+
const got = v === undefined ? "undefined"
|
|
6285
|
+
: v === null ? "null"
|
|
6286
|
+
: typeof v === "object" ? "an instance of " + ((v.constructor && v.constructor.name) || "Object")
|
|
6287
|
+
: "type " + typeof v + " (" + String(v) + ")";
|
|
6288
|
+
const e = new TypeError('The "callback" argument must be of type function. Received ' + got);
|
|
6289
|
+
e.code = "ERR_INVALID_ARG_TYPE";
|
|
6290
|
+
return e;
|
|
6291
|
+
}
|
|
6292
|
+
// Node's Unzip contract sniffs the wrapper itself: gzip magic or zlib.
|
|
6293
|
+
function _isGzip(u8) { return u8.length >= 2 && u8[0] === 0x1f && u8[1] === 0x8b; }
|
|
6294
|
+
function _concat(chunks) {
|
|
6295
|
+
let n = 0;
|
|
6296
|
+
for (const c of chunks) n += c.length;
|
|
6297
|
+
const out = new Uint8Array(n);
|
|
6298
|
+
let o = 0;
|
|
6299
|
+
for (const c of chunks) { out.set(c, o); o += c.length; }
|
|
6300
|
+
return out;
|
|
6301
|
+
}
|
|
6302
|
+
function _process(mode, fmt, input) {
|
|
6303
|
+
const algo = mode === "compress" ? fmt : (fmt || (_isGzip(input) ? "gzip" : "deflate"));
|
|
6304
|
+
return mode === "compress" ? _c(input, algo) : _d(input, algo);
|
|
6305
|
+
}
|
|
6306
|
+
function _async(mode, fmt) {
|
|
6307
|
+
return (d, o, cb) => {
|
|
6308
|
+
const callback = typeof o === "function" ? o : cb;
|
|
6309
|
+
if (typeof callback !== "function") throw _invalidCallback(callback);
|
|
6310
|
+
// Two arms, not .then().catch(): a callback that throws on success must
|
|
6311
|
+
// not be handed its own exception as a second, failed invocation.
|
|
6312
|
+
_process(mode, fmt, _u8(d)).then(
|
|
6313
|
+
(r) => callback(null, r),
|
|
6314
|
+
(e) => callback(e instanceof Error ? e : new Error(String(e))),
|
|
6315
|
+
);
|
|
6316
|
+
};
|
|
6317
|
+
}
|
|
6318
|
+
// Live codec per Transform lifetime: every write feeds one real
|
|
6319
|
+
// CompressionStream/DecompressionStream writer (its queue serializes
|
|
6320
|
+
// ordering; the write promise settles before the callback), a reader pump
|
|
6321
|
+
// relays output as it is produced instead of accumulating the payload,
|
|
6322
|
+
// and flush closes the writer then awaits full drain before completing.
|
|
6323
|
+
// Chunks are copied so later caller mutations cannot reach the codec, and
|
|
6324
|
+
// createUnzip holds copies only until two bytes decide the wrapper.
|
|
6325
|
+
function _openCodec(openMode, openAlgo) {
|
|
6326
|
+
const cs = openMode === "compress" ? new CompressionStream(openAlgo) : new DecompressionStream(openAlgo);
|
|
6327
|
+
return { writer: cs.writable.getWriter(), reader: cs.readable.getReader() };
|
|
6328
|
+
}
|
|
6329
|
+
// The legacy Readable has no resume notification, so room below the
|
|
6330
|
+
// high-water mark is observed by yielding to the task queue until the
|
|
6331
|
+
// consumer drains or the stream is destroyed.
|
|
6332
|
+
async function _drainRoom(stream) {
|
|
6333
|
+
while (
|
|
6334
|
+
stream._readableState &&
|
|
6335
|
+
!stream._readableState.destroyed &&
|
|
6336
|
+
stream.readableLength >= stream._readableState.highWaterMark
|
|
6337
|
+
) {
|
|
6338
|
+
await new Promise((tick) => setTimeout(tick, 0));
|
|
6339
|
+
}
|
|
6340
|
+
// True when the wait ended because the stream went away, not because
|
|
6341
|
+
// the consumer made room.
|
|
6342
|
+
return !!(stream._readableState && stream._readableState.destroyed);
|
|
6343
|
+
}
|
|
6344
|
+
function _streamFactory(factoryMode, fmt) {
|
|
6345
|
+
return () => {
|
|
6346
|
+
let writer = null;
|
|
6347
|
+
let reader = null;
|
|
6348
|
+
let drained = Promise.resolve();
|
|
6349
|
+
let pumpFailure = null;
|
|
6350
|
+
let algo = fmt;
|
|
6351
|
+
let held = [];
|
|
6352
|
+
let heldLen = 0;
|
|
6353
|
+
let destroyed = false;
|
|
6354
|
+
const t = new __streamMod.Transform({
|
|
6355
|
+
transform: async (chunk, _enc, cb) => {
|
|
6356
|
+
try {
|
|
6357
|
+
if (destroyed) return cb(_destroyedWrite());
|
|
6358
|
+
const bytes = _u8(chunk).slice();
|
|
6359
|
+
let feed = bytes;
|
|
6360
|
+
if (!writer) {
|
|
6361
|
+
if (fmt === null && heldLen + bytes.length < 2) {
|
|
6362
|
+
held.push(bytes);
|
|
6363
|
+
heldLen += bytes.length;
|
|
6364
|
+
return cb();
|
|
6365
|
+
}
|
|
6366
|
+
if (heldLen > 0) feed = _concat([...held, bytes]);
|
|
6367
|
+
held = [];
|
|
6368
|
+
heldLen = 0;
|
|
6369
|
+
if (fmt === null) algo = _isGzip(feed) ? "gzip" : "deflate";
|
|
6370
|
+
start();
|
|
6371
|
+
}
|
|
6372
|
+
await writer.write(feed);
|
|
6373
|
+
cb();
|
|
6374
|
+
} catch (e) {
|
|
6375
|
+
cb(destroyed ? _destroyedWrite() : factoryMode === "decompress" ? _decompressFailure(e) : e);
|
|
6376
|
+
}
|
|
6377
|
+
},
|
|
6378
|
+
flush: async (cb) => {
|
|
6379
|
+
try {
|
|
6380
|
+
if (destroyed) return cb(_destroyedWrite());
|
|
6381
|
+
if (!writer) {
|
|
6382
|
+
if (factoryMode !== "compress") {
|
|
6383
|
+
// Nothing was ever fed: the input ended before a member
|
|
6384
|
+
// began, which is Node's unexpected-end buffer error rather
|
|
6385
|
+
// than corrupt data. No codec is invented to hide it.
|
|
6386
|
+
return cb(_zbuf(null));
|
|
6387
|
+
}
|
|
6388
|
+
start();
|
|
6389
|
+
}
|
|
6390
|
+
await writer.close();
|
|
6391
|
+
await drained;
|
|
6392
|
+
cb(pumpFailure);
|
|
6393
|
+
} catch (e) {
|
|
6394
|
+
if (pumpFailure) return cb(pumpFailure);
|
|
6395
|
+
if (destroyed) return cb(_destroyedWrite());
|
|
6396
|
+
cb(factoryMode === "decompress" ? _decompressFailure(e) : e);
|
|
6397
|
+
}
|
|
6398
|
+
},
|
|
6399
|
+
});
|
|
6400
|
+
// Every destroy exit fires 'close' on the custom Transform — even when
|
|
6401
|
+
// the pump sits parked inside reader.read() on truncated input that can
|
|
6402
|
+
// never decode. Waking there is immediate: cancel settles the parked
|
|
6403
|
+
// read, abort fails queued writes, and writes arriving after destroy
|
|
6404
|
+
// report ERR_STREAM_DESTROYED instead of silent acceptance.
|
|
6405
|
+
t.on("close", () => {
|
|
6406
|
+
destroyed = true;
|
|
6407
|
+
_releaseCodec();
|
|
6408
|
+
});
|
|
6409
|
+
// One cleanup path for every destroy exit: cancel the readable side,
|
|
6410
|
+
// abort the writable side, and stop the pump.
|
|
6411
|
+
function _releaseCodec() {
|
|
6412
|
+
if (reader) reader.cancel().catch(() => {});
|
|
6413
|
+
if (writer) writer.abort().catch(() => {});
|
|
6414
|
+
}
|
|
6415
|
+
function start() {
|
|
6416
|
+
const opened = _openCodec(factoryMode, algo);
|
|
6417
|
+
writer = opened.writer;
|
|
6418
|
+
reader = opened.reader;
|
|
6419
|
+
drained = (async () => {
|
|
6420
|
+
try {
|
|
6421
|
+
for (;;) {
|
|
6422
|
+
// A destroy can land while a read is in flight; check on both
|
|
6423
|
+
// sides so nothing buffers after the stream went away.
|
|
6424
|
+
if (destroyed) return _releaseCodec();
|
|
6425
|
+
const next = await reader.read();
|
|
6426
|
+
if (destroyed) return _releaseCodec();
|
|
6427
|
+
if (next.done) {
|
|
6428
|
+
return;
|
|
6429
|
+
}
|
|
6430
|
+
// Backpressure: once push reports pressure, park the pump and
|
|
6431
|
+
// do not read again until the consumer drains below the
|
|
6432
|
+
// high-water mark. The pending writer.write promise then holds
|
|
6433
|
+
// the transform callback, so producer writes stop resolving
|
|
6434
|
+
// instead of accumulating. A destroy while parked releases the
|
|
6435
|
+
// codec through the close hook above.
|
|
6436
|
+
if (!t.push(__BufferMod.from(next.value))) {
|
|
6437
|
+
if (await _drainRoom(t)) return _releaseCodec();
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
} catch (e) {
|
|
6441
|
+
pumpFailure = factoryMode === "decompress"
|
|
6442
|
+
? _decompressFailure(e)
|
|
6443
|
+
: (e instanceof Error ? e : new Error(String(e)));
|
|
6444
|
+
}
|
|
6445
|
+
})();
|
|
6446
|
+
}
|
|
6447
|
+
return t;
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
6450
|
+
return {
|
|
6451
|
+
gzip: _async("compress", "gzip"),
|
|
6452
|
+
gunzip: _async("decompress", "gzip"),
|
|
6453
|
+
deflate: _async("compress", "deflate"),
|
|
6454
|
+
inflate: _async("decompress", "deflate"),
|
|
6455
|
+
deflateRaw: _async("compress", "deflate-raw"),
|
|
6456
|
+
inflateRaw: _async("decompress", "deflate-raw"),
|
|
6457
|
+
unzip: _async("decompress", null),
|
|
6458
|
+
gzipSync: (d, o) => _syncRefusal("gzipSync", "gzip"),
|
|
6459
|
+
gunzipSync: (d, o) => _syncRefusal("gunzipSync", "gunzip"),
|
|
6460
|
+
deflateSync: (d, o) => _syncRefusal("deflateSync", "deflate"),
|
|
6461
|
+
inflateSync: (d, o) => _syncRefusal("inflateSync", "inflate"),
|
|
6462
|
+
deflateRawSync: (d, o) => _syncRefusal("deflateRawSync", "deflateRaw"),
|
|
6463
|
+
inflateRawSync: (d, o) => _syncRefusal("inflateRawSync", "inflateRaw"),
|
|
6464
|
+
unzipSync: (d, o) => _syncRefusal("unzipSync", "unzip"),
|
|
6465
|
+
createGzip: _streamFactory("compress", "gzip"),
|
|
6466
|
+
createGunzip: _streamFactory("decompress", "gzip"),
|
|
6467
|
+
createDeflate: _streamFactory("compress", "deflate"),
|
|
6468
|
+
createInflate: _streamFactory("decompress", "deflate"),
|
|
6469
|
+
createDeflateRaw: _streamFactory("compress", "deflate-raw"),
|
|
6470
|
+
createInflateRaw: _streamFactory("decompress", "deflate-raw"),
|
|
6471
|
+
createUnzip: _streamFactory("decompress", null),
|
|
6472
|
+
constants: { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1 },
|
|
6473
|
+
};
|
|
6158
6474
|
})();
|
|
6159
6475
|
builtins.readline = (() => {
|
|
6160
6476
|
function emitKeypressEvents(stream) {
|
|
@@ -6879,9 +7195,11 @@ function __resolveImportsField(name, fromDir) {
|
|
|
6879
7195
|
function __mkCompiledFn(code) {
|
|
6880
7196
|
const reFn = /(?:^|\\n|;)\\s*(?:const|let|var)\\s+__filename\\s*=/m;
|
|
6881
7197
|
const reDn = /(?:^|\\n|;)\\s*(?:const|let|var)\\s+__dirname\\s*=/m;
|
|
7198
|
+
const reRequire = /(?:^|\\n|;)\\s*(?:const|let|var)\\s+require\\s*=/m;
|
|
6882
7199
|
const fnName = reFn.test(code) ? "__filename__nimbus_unused" : "__filename";
|
|
6883
7200
|
const dnName = reDn.test(code) ? "__dirname__nimbus_unused" : "__dirname";
|
|
6884
|
-
|
|
7201
|
+
const requireName = reRequire.test(code) ? "require__nimbus_unused" : "require";
|
|
7202
|
+
return new Function("exports", requireName, "module", fnName, dnName, code);
|
|
6885
7203
|
}
|
|
6886
7204
|
|
|
6887
7205
|
function __exportsTarget(mod) {
|
|
@@ -6960,6 +7278,7 @@ function __loadModule(resolvedPath) {
|
|
|
6960
7278
|
};
|
|
6961
7279
|
scopedRequire.cache = __moduleCache;
|
|
6962
7280
|
scopedRequire.main = __require.main;
|
|
7281
|
+
mod.require = scopedRequire;
|
|
6963
7282
|
|
|
6964
7283
|
// X.5-M3: thread currently-loading module path through globalThis so the
|
|
6965
7284
|
// URL shim null-base fallback (in node-shims url module) can compose
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* (see OPENCODE_TREE_SITTER_WASMS and FacetManager.treeSitterModuleEntries).
|
|
21
21
|
*/
|
|
22
22
|
import { OPENCODE_ARTIFACT_BUILD_ID, OPENCODE_ARTIFACT_DIGESTS, OPENCODE_ARTIFACT_PRESENT, OPENCODE_ARTIFACT_VERSION, } from '../opencode-artifact.generated.js';
|
|
23
|
-
import { disposeRpcResource } from '@nimbus-sh/
|
|
23
|
+
import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
24
24
|
import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
|
|
25
25
|
/** Base asset path of the staged opencode bundle directory. */
|
|
26
26
|
const OPENCODE_ASSET_BASE = `/_assets/opencode/${OPENCODE_ARTIFACT_VERSION}`;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* the backend.
|
|
17
17
|
*/
|
|
18
18
|
import { OPENTUI_WASM_BUILD_ID, OPENTUI_WASM_ENTRY, OPENTUI_WASM_SHA256, } from '../opentui-wasm-artifact.generated.js';
|
|
19
|
-
import { disposeRpcResource } from '@nimbus-sh/
|
|
19
|
+
import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
20
20
|
import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
|
|
21
21
|
/**
|
|
22
22
|
* Synthetic L2 cache key for the OpenTUI wasm asset. Build-id-pinned so a
|
|
@@ -207,7 +207,7 @@ class PythonReplAdapter {
|
|
|
207
207
|
snapshot.files[stdlibPath.replace(/^\/+/, '')] = btoa(bin);
|
|
208
208
|
this.fsSnapshot = snapshot;
|
|
209
209
|
this.pythonHome = `/${installRoot.replace(/^\/+/, '')}`;
|
|
210
|
-
const {
|
|
210
|
+
const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
|
|
211
211
|
const host = getFacetManagerLoaderHost(facetMgr);
|
|
212
212
|
// A prompt where `open(path, "w")` silently does nothing is worse than one
|
|
213
213
|
// that refuses to start, so the pid decides which pool this is. Written as
|
|
@@ -225,11 +225,11 @@ class PythonReplAdapter {
|
|
|
225
225
|
};
|
|
226
226
|
const pid = this.deps.pid;
|
|
227
227
|
this.pool = (typeof pid === 'number' && pid > 0
|
|
228
|
-
? new
|
|
228
|
+
? new IsolatePool(host.env, host.ctx, { ...base, supervisorPid: pid })
|
|
229
229
|
// The install-time warm-up has no invoking process. It boots the
|
|
230
230
|
// interpreter and never touches a file, so it asks for no supervisor
|
|
231
231
|
// rather than binding one it cannot authenticate to.
|
|
232
|
-
: new
|
|
232
|
+
: new IsolatePool(host.env, host.ctx, { ...base, omitSupervisor: true }));
|
|
233
233
|
}
|
|
234
234
|
async submit(userCode) {
|
|
235
235
|
const result = await this.pool.submit(pythonReplStepFacetFn, {
|
|
@@ -156,10 +156,10 @@ class RubyReplAdapter {
|
|
|
156
156
|
// drifted (it lacked the language-prelude const __rubyRun requires, so
|
|
157
157
|
// every REPL eval died on boot) — compose it in exactly one place.
|
|
158
158
|
const preamble = buildRubyPreamble();
|
|
159
|
-
const {
|
|
159
|
+
const { IsolatePool } = await import('@nimbus-sh/fabric/isolate-pool.js');
|
|
160
160
|
const env = facetMgr.env;
|
|
161
161
|
const ctx = facetMgr.ctx;
|
|
162
|
-
this.pool = new
|
|
162
|
+
this.pool = new IsolatePool(env, ctx, {
|
|
163
163
|
tag: 'ruby-repl',
|
|
164
164
|
concurrency: 1,
|
|
165
165
|
omitSupervisor: true,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { SQLJS_VERSION } from '@nimbus-sh/core/constants.js';
|
|
19
19
|
import { SQLITE_WASM_SHA256 } from '../sqlite-wasm-bundle.generated.js';
|
|
20
|
-
import { disposeRpcResource } from '@nimbus-sh/
|
|
20
|
+
import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
|
|
21
21
|
import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
|
|
22
22
|
/**
|
|
23
23
|
* Path inside env.ASSETS where the sql.js wasm binary lives. Versioned so
|
package/dist/session/agent.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ interface AgentStorage {
|
|
|
15
15
|
delete(key: string): Promise<void>;
|
|
16
16
|
deleteAll(): Promise<void>;
|
|
17
17
|
deleteAlarm(): Promise<void>;
|
|
18
|
+
list<T = unknown>(options: {
|
|
19
|
+
prefix: string;
|
|
20
|
+
}): Promise<Map<string, T>>;
|
|
21
|
+
transaction<T>(body: (txn: {
|
|
22
|
+
get(key: string): Promise<unknown>;
|
|
23
|
+
put(key: string, value: unknown): Promise<void>;
|
|
24
|
+
delete(key: string): Promise<unknown>;
|
|
25
|
+
list<T2 = unknown>(options: {
|
|
26
|
+
prefix: string;
|
|
27
|
+
}): Promise<Map<string, T2>>;
|
|
28
|
+
}) => Promise<T>): Promise<T>;
|
|
18
29
|
}
|
|
19
30
|
interface Host extends ProgrammaticHost, SessionAiHost {
|
|
20
31
|
ctx: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/session/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgCH,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAiB3B,UAAU,YAAY;IACpB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,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AC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;KAC3E,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/B;AAED,UAAU,IAAK,SAAQ,gBAAgB,EAAE,aAAa;IACpD,GAAG,EAAE;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE,CAAC;IAC/B,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxD;AAED,UAAU,iBAAiB;IACzB,CAAC,EAAE,CAAC,CAAC;IACL,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AA2BD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2ClG;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAQxF"}
|
package/dist/session/diag.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Per DEFECT-D1: ctx is taken as a separate explicit arg.
|
|
18
18
|
*/
|
|
19
|
-
import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/
|
|
19
|
+
import { rehydrateFromStorage, snapshotForStorage, getFailures, } from '@nimbus-sh/platform/oom-discriminator.js';
|
|
20
20
|
import { W5_RING_STORAGE_KEY } from './keys.js';
|
|
21
21
|
export function readNodeMem() {
|
|
22
22
|
try {
|
package/dist/session/helpers.js
CHANGED
|
@@ -370,7 +370,7 @@ export const _CP_PURE_BUILTIN = new Set([
|
|
|
370
370
|
'sleep', 'date', 'whoami', 'id', 'hostname', 'uname', 'clear',
|
|
371
371
|
'tree', 'find', 'grep', 'head', 'tail', 'wc', 'sort', 'uniq', 'sed',
|
|
372
372
|
'awk', 'xargs', 'tee', 'du', 'diff', 'base64', 'seq', 'realpath',
|
|
373
|
-
'basename', 'dirname', 'printf', 'sha256sum', 'file', 'xxd',
|
|
373
|
+
'basename', 'dirname', 'printf', 'sha256sum', 'file', 'xxd', 'od', 'hexdump',
|
|
374
374
|
'chmod', 'chown', 'ln', 'test', '[', 'read', 'exit', 'set', 'shopt',
|
|
375
375
|
'trap', 'umask', 'ulimit', 'which', 'uptime',
|
|
376
376
|
]);
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
* reason dispatcher with this session's handlers registered.
|
|
23
23
|
* - flushOnClose(host) — synchronous flush on ws close.
|
|
24
24
|
*
|
|
25
|
-
* The
|
|
26
|
-
* chain)
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* The timer multiplexer itself (reason map, schedule, the per-instance
|
|
26
|
+
* chain) is fabric machinery — `@nimbus-sh/fabric/timers.js`; this module
|
|
27
|
+
* registers the session's reasons ('w9-flush' | 'log-janitor' |
|
|
28
|
+
* 'resident-launch') on top of it.
|
|
29
29
|
*
|
|
30
30
|
* **`ctx` taken as a separate arg from `host`** because the parent
|
|
31
31
|
* `CloudflareDurableObject` class declares `ctx` as `protected`, which
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
*/
|
|
41
41
|
import type { SessionProcessSupervisor } from '@nimbus-sh/core/runtime/session-process-supervisor.js';
|
|
42
42
|
import { type WsHibernationConfigResult } from '@nimbus-sh/fabric/ws-hibernation-config.js';
|
|
43
|
-
import { type
|
|
43
|
+
import { type TimerHost } from '@nimbus-sh/fabric/timers.js';
|
|
44
44
|
export type { WsHibernationConfigResult };
|
|
45
45
|
/**
|
|
46
46
|
* Minimal host shape. `_w9*` fields drop `private` on the class so
|
|
@@ -49,7 +49,7 @@ export type { WsHibernationConfigResult };
|
|
|
49
49
|
*
|
|
50
50
|
* `ctx` is NOT in this interface — passed as a separate arg.
|
|
51
51
|
*/
|
|
52
|
-
export interface HibHost extends
|
|
52
|
+
export interface HibHost extends TimerHost {
|
|
53
53
|
processes: SessionProcessSupervisor;
|
|
54
54
|
_w9SchemaInit: boolean;
|
|
55
55
|
_w9PersistWired: boolean;
|
|
@@ -114,7 +114,7 @@ export type AlarmReason = 'w9-flush' | 'log-janitor' | 'resident-launch';
|
|
|
114
114
|
/**
|
|
115
115
|
* W9: ensure the alarm is set for the next flush window. Cheap to
|
|
116
116
|
* call repeatedly — we only schedule the in-isolate flush timer if
|
|
117
|
-
* it isn't already set. The persistent alarm goes through
|
|
117
|
+
* it isn't already set. The persistent alarm goes through timers.schedule
|
|
118
118
|
* so it coordinates with W1's log-janitor sweep.
|
|
119
119
|
*/
|
|
120
120
|
export declare function scheduleHibFlush(host: HibHost, ctx: any): void;
|
|
@@ -130,7 +130,7 @@ export declare function scheduleHibFlush(host: HibHost, ctx: any): void;
|
|
|
130
130
|
* caller (typically `(pid) => !host.processes.get(pid)`). Decoupled
|
|
131
131
|
* so HibHost doesn't need to import ProcessTable.
|
|
132
132
|
*/
|
|
133
|
-
export declare function dispatchAlarm(host: HibHost, ctx: any, janitorOrphanCheck?: (pid: number) => boolean, pumpResidentLaunches?: () => Promise<void
|
|
133
|
+
export declare function dispatchAlarm(host: HibHost, ctx: any, janitorOrphanCheck?: (pid: number) => boolean, pumpResidentLaunches?: () => Promise<void>, alarmInfo?: AlarmInvocationInfo): Promise<void>;
|
|
134
134
|
/**
|
|
135
135
|
* W9: synchronous flush of the process-log ring on session close.
|
|
136
136
|
* Wraps `processes.flushLogs()` in a try/catch so a flush failure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hibernation.d.ts","sourceRoot":"","sources":["../../src/session/hibernation.ts"],"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