@deepseek-ai/dsh-experimental-webworker-runtime 0.2.1-rc.4 → 0.2.2-alpha.2
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.i18n.yaml +4 -4
- package/README.md +7 -4
- package/README.zh.md +7 -4
- package/lib/client.js +104 -9
- package/lib/index.js +79 -4
- package/lib/types/client/client.d.ts +5 -0
- package/lib/types/node/builtin_modules/implemented/async_hooks.d.ts +3 -3
- package/lib/types/node/builtin_modules/implemented/buffer.d.ts +7 -0
- package/lib/types/node/builtin_modules/implemented/string_decoder.d.ts +12 -0
- package/lib/types/node/builtin_modules/mock/repl.d.ts +10 -0
- package/lib/types/node/external_packages/pi-coding-agent.d.ts +64 -0
- package/lib/types/node/globals/process.d.ts +1 -1
- package/lib/types/package-assets.d.ts +17 -0
- package/lib/types/string-decoder-types.d.ts +5 -0
- package/lib/types/transport/tunnel.d.ts +5 -0
- package/lib/worker.js +363 -87
- package/package.json +25 -24
package/lib/worker.js
CHANGED
|
@@ -836,7 +836,7 @@ const EXEC_PATH = "/dsh/bin/node";
|
|
|
836
836
|
/** Node release whose internal-module members `node-addon-require-builtin` follows in the Worker. */
|
|
837
837
|
const NODE_VERSION = "24.18.0";
|
|
838
838
|
/**
|
|
839
|
-
* Publish `globalThis.process
|
|
839
|
+
* Publish `globalThis.process` and Node's `global` alias for the worker lifetime.
|
|
840
840
|
*
|
|
841
841
|
* `versions.node` names the Node release the Worker's `node-addon-require-builtin` internals follow, so Cordis's
|
|
842
842
|
* `ModuleLoader.fromInternal()` reaches them the way it reaches Node's; `execArgv` stays empty, without
|
|
@@ -905,6 +905,7 @@ function installProcessGlobal(options) {
|
|
|
905
905
|
console.warn(`webworker process: exit(${String(code ?? 0)}) requested; the worker keeps running`);
|
|
906
906
|
}
|
|
907
907
|
};
|
|
908
|
+
globalThis.global = globalThis;
|
|
908
909
|
globalThis.process = shim;
|
|
909
910
|
return shim;
|
|
910
911
|
}
|
|
@@ -969,7 +970,7 @@ function parseInboundFrame(data) {
|
|
|
969
970
|
}
|
|
970
971
|
//#endregion
|
|
971
972
|
//#region src/transport/synthetic-http.ts
|
|
972
|
-
const encoder$
|
|
973
|
+
const encoder$5 = new TextEncoder();
|
|
973
974
|
/**
|
|
974
975
|
* Build the request/response pair for one tunnel request.
|
|
975
976
|
*
|
|
@@ -1033,13 +1034,13 @@ function createSyntheticExchange(frame, sink) {
|
|
|
1033
1034
|
streaming = true;
|
|
1034
1035
|
sink.head(status, headers);
|
|
1035
1036
|
}
|
|
1036
|
-
sink.chunk(typeof chunk === "string" ? encoder$
|
|
1037
|
+
sink.chunk(typeof chunk === "string" ? encoder$5.encode(chunk) : chunk);
|
|
1037
1038
|
return true;
|
|
1038
1039
|
},
|
|
1039
1040
|
end: (body) => {
|
|
1040
1041
|
if (finished) return res;
|
|
1041
1042
|
finished = true;
|
|
1042
|
-
const bytes = body === void 0 ? void 0 : typeof body === "string" ? encoder$
|
|
1043
|
+
const bytes = body === void 0 ? void 0 : typeof body === "string" ? encoder$5.encode(body) : body;
|
|
1043
1044
|
if (streaming) {
|
|
1044
1045
|
if (bytes !== void 0) sink.chunk(bytes);
|
|
1045
1046
|
sink.end();
|
|
@@ -1088,7 +1089,7 @@ function createSyntheticExchange(frame, sink) {
|
|
|
1088
1089
|
}
|
|
1089
1090
|
/** Host header the synthesized requests carry; the API trust fence requires one. */
|
|
1090
1091
|
const SYNTHETIC_HOST = "127.0.0.1";
|
|
1091
|
-
const encoder$
|
|
1092
|
+
const encoder$4 = new TextEncoder();
|
|
1092
1093
|
/**
|
|
1093
1094
|
* Render a failure with everything nested inside it.
|
|
1094
1095
|
*
|
|
@@ -1342,7 +1343,7 @@ var TunnelServer = class {
|
|
|
1342
1343
|
});
|
|
1343
1344
|
return;
|
|
1344
1345
|
}
|
|
1345
|
-
const body = toTransferable(encoder$
|
|
1346
|
+
const body = toTransferable(encoder$4.encode(message));
|
|
1346
1347
|
this.send({
|
|
1347
1348
|
t: "res",
|
|
1348
1349
|
id: frame.id,
|
|
@@ -1474,6 +1475,10 @@ var TunnelServer = class {
|
|
|
1474
1475
|
this.serveBoot(frame, sink);
|
|
1475
1476
|
return;
|
|
1476
1477
|
}
|
|
1478
|
+
if (path === "/__assets__") {
|
|
1479
|
+
this.servePackageAssets(frame, sink);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1477
1482
|
if (path.startsWith(`/api/`)) {
|
|
1478
1483
|
await this.serveApi(frame, routed, path, sink);
|
|
1479
1484
|
return;
|
|
@@ -1539,6 +1544,24 @@ var TunnelServer = class {
|
|
|
1539
1544
|
}
|
|
1540
1545
|
buffered.flushTo(sink);
|
|
1541
1546
|
}
|
|
1547
|
+
servePackageAssets(frame, sink) {
|
|
1548
|
+
if (this.seams === void 0) throw new Error("webworker tunnel: package assets requested before the host tree is serving");
|
|
1549
|
+
if (frame.method !== "GET") {
|
|
1550
|
+
sink.end({
|
|
1551
|
+
status: 405,
|
|
1552
|
+
headers: { allow: "GET" }
|
|
1553
|
+
});
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
sink.end({
|
|
1557
|
+
status: 200,
|
|
1558
|
+
headers: {
|
|
1559
|
+
"content-type": "application/x-tar",
|
|
1560
|
+
"cache-control": "no-store"
|
|
1561
|
+
},
|
|
1562
|
+
body: this.seams.packageAssets()
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1542
1565
|
serveBoot(frame, sink) {
|
|
1543
1566
|
if (this.seams === void 0) throw new Error("webworker tunnel: boot payload requested before the host tree is serving");
|
|
1544
1567
|
if (frame.method !== "GET") {
|
|
@@ -1548,7 +1571,7 @@ var TunnelServer = class {
|
|
|
1548
1571
|
});
|
|
1549
1572
|
return;
|
|
1550
1573
|
}
|
|
1551
|
-
const body = encoder$
|
|
1574
|
+
const body = encoder$4.encode(JSON.stringify(this.seams.bootPayload()));
|
|
1552
1575
|
sink.end({
|
|
1553
1576
|
status: 200,
|
|
1554
1577
|
headers: {
|
|
@@ -1694,14 +1717,104 @@ async function inflateImage(bytes, source) {
|
|
|
1694
1717
|
if (body === null) throw new Error(`webworker image: ${source} produced no readable body`);
|
|
1695
1718
|
return await inflateImageStream(body, source);
|
|
1696
1719
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/storage/tar.ts
|
|
1722
|
+
/**
|
|
1723
|
+
* Uncompressed ustar archive: the VFS image format. One fetch delivers the
|
|
1724
|
+
* whole tree, and the reader hands out subarray views into the fetched buffer,
|
|
1725
|
+
* so mounting copies nothing and no inflate step runs inside the worker.
|
|
1726
|
+
*
|
|
1727
|
+
* Hand-rolled on purpose: both sides need synchronous in-memory operation and
|
|
1728
|
+
* the reader ships inside the worker bundle, where the streaming tar packages
|
|
1729
|
+
* would drag Node stream shims back in. The subset is plain ustar — regular
|
|
1730
|
+
* files and directories, names up to 255 bytes via the name-prefix split — and
|
|
1731
|
+
* anything outside it fails loud on either side.
|
|
1732
|
+
* @module @deepseek-ai/dsh-experimental-webworker-runtime/src/storage/tar
|
|
1733
|
+
*/
|
|
1734
|
+
const encoder$3 = new TextEncoder();
|
|
1735
|
+
const decoder$2 = new TextDecoder();
|
|
1699
1736
|
const BLOCK = 512;
|
|
1737
|
+
/** Write an octal field: zero-padded digits with a terminating NUL. */
|
|
1738
|
+
function writeOctal(header, offset, length, value) {
|
|
1739
|
+
header.set(encoder$3.encode(value.toString(8).padStart(length - 1, "0")), offset);
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Split an entry name into the ustar name and prefix fields.
|
|
1743
|
+
* @param name - Full entry name.
|
|
1744
|
+
* @returns The two fields; the prefix is empty when the name fits directly.
|
|
1745
|
+
* @throws When no slash yields name ≤ 100 and prefix ≤ 155 bytes: the entry
|
|
1746
|
+
* cannot be archived and a silently truncated name would corrupt the image.
|
|
1747
|
+
*/
|
|
1748
|
+
function splitName(name) {
|
|
1749
|
+
if (encoder$3.encode(name).length <= 100) return {
|
|
1750
|
+
name,
|
|
1751
|
+
prefix: ""
|
|
1752
|
+
};
|
|
1753
|
+
for (let index = name.length - 1; index > 0; index -= 1) {
|
|
1754
|
+
if (name[index] !== "/") continue;
|
|
1755
|
+
const prefix = name.slice(0, index);
|
|
1756
|
+
const rest = name.slice(index + 1);
|
|
1757
|
+
if (encoder$3.encode(rest).length <= 100 && encoder$3.encode(prefix).length <= 155) return {
|
|
1758
|
+
name: rest,
|
|
1759
|
+
prefix
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
throw new Error(`vfs tar: entry name does not fit the ustar name+prefix split: ${name}`);
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Pack entries into one uncompressed ustar archive.
|
|
1766
|
+
*
|
|
1767
|
+
* Entries keep their given order; names ending in a slash become directory
|
|
1768
|
+
* entries. Contents are written verbatim — compression belongs to the HTTP
|
|
1769
|
+
* transport, not to the archive.
|
|
1770
|
+
* @param files - Entry name to content bytes.
|
|
1771
|
+
* @returns The archive bytes.
|
|
1772
|
+
*/
|
|
1773
|
+
function packTar(files) {
|
|
1774
|
+
const chunks = [];
|
|
1775
|
+
for (const [entryName, bytes] of Object.entries(files)) {
|
|
1776
|
+
const directory = entryName.endsWith("/");
|
|
1777
|
+
const size = directory ? 0 : bytes.length;
|
|
1778
|
+
const { name, prefix } = splitName(entryName);
|
|
1779
|
+
const header = new Uint8Array(BLOCK);
|
|
1780
|
+
header.set(encoder$3.encode(name), 0);
|
|
1781
|
+
writeOctal(header, 100, 8, directory ? 493 : 420);
|
|
1782
|
+
writeOctal(header, 108, 8, 0);
|
|
1783
|
+
writeOctal(header, 116, 8, 0);
|
|
1784
|
+
writeOctal(header, 124, 12, size);
|
|
1785
|
+
writeOctal(header, 136, 12, 0);
|
|
1786
|
+
header.fill(32, 148, 156);
|
|
1787
|
+
header[156] = directory ? 53 : 48;
|
|
1788
|
+
header.set(encoder$3.encode("ustar"), 257);
|
|
1789
|
+
header.set(encoder$3.encode("00"), 263);
|
|
1790
|
+
header.set(encoder$3.encode(prefix), 345);
|
|
1791
|
+
let checksum = 0;
|
|
1792
|
+
for (const byte of header) checksum += byte;
|
|
1793
|
+
header.set(encoder$3.encode(checksum.toString(8).padStart(6, "0")), 148);
|
|
1794
|
+
header[154] = 0;
|
|
1795
|
+
header[155] = 32;
|
|
1796
|
+
chunks.push(header);
|
|
1797
|
+
if (size > 0) {
|
|
1798
|
+
chunks.push(bytes);
|
|
1799
|
+
const padding = size % BLOCK;
|
|
1800
|
+
if (padding !== 0) chunks.push(new Uint8Array(BLOCK - padding));
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
chunks.push(new Uint8Array(BLOCK * 2));
|
|
1804
|
+
const total = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
1805
|
+
const archive = new Uint8Array(total);
|
|
1806
|
+
let offset = 0;
|
|
1807
|
+
for (const chunk of chunks) {
|
|
1808
|
+
archive.set(chunk, offset);
|
|
1809
|
+
offset += chunk.length;
|
|
1810
|
+
}
|
|
1811
|
+
return archive;
|
|
1812
|
+
}
|
|
1700
1813
|
/** @returns The NUL-terminated string in one header field. */
|
|
1701
1814
|
function readField(header, offset, length) {
|
|
1702
1815
|
let end = offset;
|
|
1703
1816
|
while (end < offset + length && header[end] !== 0) end += 1;
|
|
1704
|
-
return decoder$
|
|
1817
|
+
return decoder$2.decode(header.subarray(offset, end));
|
|
1705
1818
|
}
|
|
1706
1819
|
/**
|
|
1707
1820
|
* Parse an uncompressed ustar archive.
|
|
@@ -1745,8 +1858,8 @@ function parseTar(archive) {
|
|
|
1745
1858
|
* authority when an asynchronous durable sink mirrors selected subtrees.
|
|
1746
1859
|
* @module @deepseek-ai/dsh-experimental-webworker-runtime/src/storage/memory
|
|
1747
1860
|
*/
|
|
1748
|
-
const decoder = new TextDecoder();
|
|
1749
|
-
const encoder$
|
|
1861
|
+
const decoder$1 = new TextDecoder();
|
|
1862
|
+
const encoder$2 = new TextEncoder();
|
|
1750
1863
|
/** Creation default for files, Node's `0o666` under the classic `022` umask. */
|
|
1751
1864
|
const DEFAULT_FILE_MODE = 420;
|
|
1752
1865
|
/** Creation default for directories, Node's `0o777` under the classic `022` umask. */
|
|
@@ -2072,7 +2185,7 @@ var MemoryVfs = class {
|
|
|
2072
2185
|
if (this.directories.has(target)) fail("EISDIR", "read", target);
|
|
2073
2186
|
fail("ENOENT", "open", target);
|
|
2074
2187
|
}
|
|
2075
|
-
return encodingOf$1(options) === void 0 ? node.bytes : decoder.decode(node.bytes);
|
|
2188
|
+
return encodingOf$1(options) === void 0 ? node.bytes : decoder$1.decode(node.bytes);
|
|
2076
2189
|
}
|
|
2077
2190
|
/**
|
|
2078
2191
|
* Report whether a path exists.
|
|
@@ -2362,7 +2475,7 @@ var MemoryVfs = class {
|
|
|
2362
2475
|
}
|
|
2363
2476
|
const previous = this.files.get(target);
|
|
2364
2477
|
const mode = previous?.mode ?? (options?.mode !== void 0 ? options.mode & 511 : DEFAULT_FILE_MODE);
|
|
2365
|
-
const bytes = typeof data === "string" ? encoder$
|
|
2478
|
+
const bytes = typeof data === "string" ? encoder$2.encode(data) : data;
|
|
2366
2479
|
if (previous !== void 0) {
|
|
2367
2480
|
this.replaceFile(previous, bytes);
|
|
2368
2481
|
return;
|
|
@@ -2434,7 +2547,7 @@ var MemoryVfs = class {
|
|
|
2434
2547
|
};
|
|
2435
2548
|
return {
|
|
2436
2549
|
write: async (data) => {
|
|
2437
|
-
const bytes = typeof data === "string" ? encoder$
|
|
2550
|
+
const bytes = typeof data === "string" ? encoder$2.encode(data) : data;
|
|
2438
2551
|
const descriptor = current("write");
|
|
2439
2552
|
const offset = descriptor.append ? descriptor.stat().size : position;
|
|
2440
2553
|
const bytesWritten = descriptor.write(offset, bytes);
|
|
@@ -2442,7 +2555,7 @@ var MemoryVfs = class {
|
|
|
2442
2555
|
return { bytesWritten };
|
|
2443
2556
|
},
|
|
2444
2557
|
writeFile: async (data) => {
|
|
2445
|
-
const bytes = typeof data === "string" ? encoder$
|
|
2558
|
+
const bytes = typeof data === "string" ? encoder$2.encode(data) : data;
|
|
2446
2559
|
const descriptor = current("write");
|
|
2447
2560
|
const offset = descriptor.append ? descriptor.stat().size : position;
|
|
2448
2561
|
position = offset + descriptor.write(offset, bytes);
|
|
@@ -2451,7 +2564,7 @@ var MemoryVfs = class {
|
|
|
2451
2564
|
const descriptor = current("read");
|
|
2452
2565
|
const bytes = descriptor.read(position, Math.max(0, descriptor.stat().size - position));
|
|
2453
2566
|
position += bytes.length;
|
|
2454
|
-
return encodingOf$1(options) === void 0 ? bytes : decoder.decode(bytes);
|
|
2567
|
+
return encodingOf$1(options) === void 0 ? bytes : decoder$1.decode(bytes);
|
|
2455
2568
|
},
|
|
2456
2569
|
truncate: async (length = 0) => {
|
|
2457
2570
|
current("ftruncate").truncate(length);
|
|
@@ -2546,7 +2659,7 @@ var MemoryVfs = class {
|
|
|
2546
2659
|
const target = this.key(path);
|
|
2547
2660
|
this.requireArrived("open", target);
|
|
2548
2661
|
const existing = this.files.get(target);
|
|
2549
|
-
const addition = typeof data === "string" ? encoder$
|
|
2662
|
+
const addition = typeof data === "string" ? encoder$2.encode(data) : data;
|
|
2550
2663
|
if (existing === void 0) {
|
|
2551
2664
|
this.writeFileSync(target, addition);
|
|
2552
2665
|
return;
|
|
@@ -2788,7 +2901,7 @@ var MemoryVfs = class {
|
|
|
2788
2901
|
this.seedDirectory(dirname$1(target));
|
|
2789
2902
|
this.deferred.delete(target);
|
|
2790
2903
|
this.setFile(target, {
|
|
2791
|
-
bytes: typeof data === "string" ? encoder$
|
|
2904
|
+
bytes: typeof data === "string" ? encoder$2.encode(data) : data,
|
|
2792
2905
|
mtimeMs: options.mtimeMs ?? this.touch(target),
|
|
2793
2906
|
mode: (options.mode ?? DEFAULT_FILE_MODE) & 511,
|
|
2794
2907
|
paths: void 0
|
|
@@ -2943,6 +3056,50 @@ const XDG_OPEN_EXECUTABLE = {
|
|
|
2943
3056
|
}
|
|
2944
3057
|
};
|
|
2945
3058
|
//#endregion
|
|
3059
|
+
//#region src/package-assets.ts
|
|
3060
|
+
/**
|
|
3061
|
+
* Package assets for the preview page. A Client bundle names each image as a
|
|
3062
|
+
* document-relative reference, `plugins/<package>/assets/<path>`, and resolves
|
|
3063
|
+
* it through the module loader's synchronous `require.asset`. The page of the
|
|
3064
|
+
* Worker preview cannot request such a URL itself, so the Worker hands it every
|
|
3065
|
+
* asset the image holds in one archive and the page maps each reference to a
|
|
3066
|
+
* Blob URL before any bundle runs.
|
|
3067
|
+
* @module @deepseek-ai/dsh-experimental-webworker-runtime/src/package-assets
|
|
3068
|
+
*/
|
|
3069
|
+
/** Entries of one directory. */
|
|
3070
|
+
function entriesOf(vfs, directory) {
|
|
3071
|
+
return vfs.readdirSync(directory, { withFileTypes: true });
|
|
3072
|
+
}
|
|
3073
|
+
/** Files under one directory, as `/`-separated paths relative to it. */
|
|
3074
|
+
function filesBelow(vfs, directory, prefix = "") {
|
|
3075
|
+
return entriesOf(vfs, directory).flatMap((entry) => entry.isDirectory() ? filesBelow(vfs, join$1(directory, entry.name), `${prefix}${entry.name}/`) : entry.isFile() ? [`${prefix}${entry.name}`] : []);
|
|
3076
|
+
}
|
|
3077
|
+
/** Installed package directories under `node_modules`, scoped ones included. */
|
|
3078
|
+
function packageDirectories(vfs, modules) {
|
|
3079
|
+
if (!vfs.existsSync(modules)) return [];
|
|
3080
|
+
return entriesOf(vfs, modules).filter((entry) => entry.isDirectory()).flatMap((entry) => entry.name.startsWith("@") ? entriesOf(vfs, join$1(modules, entry.name)).filter((scoped) => scoped.isDirectory()).map((scoped) => join$1(modules, entry.name, scoped.name)) : [join$1(modules, entry.name)]);
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* Archive every file a package of the image publishes through `"./assets/*": "./lib/assets/*"`.
|
|
3084
|
+
* @param vfs - Mounted image filesystem.
|
|
3085
|
+
* @param root - Image root holding `node_modules`.
|
|
3086
|
+
* @returns An uncompressed tar whose entries are named `plugins/<package>/assets/<path>` with the path unencoded,
|
|
3087
|
+
* so every name fits the ustar limits the base image already met.
|
|
3088
|
+
*/
|
|
3089
|
+
function packPackageAssets(vfs, root) {
|
|
3090
|
+
const files = {};
|
|
3091
|
+
for (const directory of packageDirectories(vfs, join$1(root, "node_modules"))) {
|
|
3092
|
+
const manifestPath = join$1(directory, "package.json");
|
|
3093
|
+
if (!vfs.existsSync(manifestPath)) continue;
|
|
3094
|
+
const manifest = JSON.parse(vfs.readFileSync(manifestPath, "utf8"));
|
|
3095
|
+
if (typeof manifest.name !== "string" || manifest.exports?.["./assets/*"] !== "./lib/assets/*") continue;
|
|
3096
|
+
const assets = join$1(directory, "lib", "assets");
|
|
3097
|
+
if (!vfs.existsSync(assets)) continue;
|
|
3098
|
+
for (const path of filesBelow(vfs, assets)) files[`plugins/${manifest.name}/assets/${path}`] = vfs.readFileSync(join$1(assets, path));
|
|
3099
|
+
}
|
|
3100
|
+
return packTar(files);
|
|
3101
|
+
}
|
|
3102
|
+
//#endregion
|
|
2946
3103
|
//#region src/image-manifest.ts
|
|
2947
3104
|
/**
|
|
2948
3105
|
* The base image's manifest: what the packer records about one image and what
|
|
@@ -3118,7 +3275,8 @@ function createWorkerHost(options) {
|
|
|
3118
3275
|
const peer = connection.browserPeer;
|
|
3119
3276
|
tunnel.serve({
|
|
3120
3277
|
directFetch: (request) => handler.fetch(request, peer),
|
|
3121
|
-
bootPayload: () => readBootPayload(ctx),
|
|
3278
|
+
bootPayload: () => readBootPayload(ctx, peer),
|
|
3279
|
+
packageAssets: () => packPackageAssets(mounted, root),
|
|
3122
3280
|
openStream: (endpoint, payload, uplink, signal) => typertGateway.wireStream.open(endpoint, payload, uplink, peer, signal),
|
|
3123
3281
|
streamFailure: typertGateway.wireStream.failure
|
|
3124
3282
|
});
|
|
@@ -3260,12 +3418,13 @@ function prepareProfile(appBoot, vfs, manifest, root, env) {
|
|
|
3260
3418
|
* from the in-process webserver service, never from the API surface, because
|
|
3261
3419
|
* the page has no Cordis tree yet.
|
|
3262
3420
|
* @param ctx - Booted host context.
|
|
3421
|
+
* @param peer - the browser Peer the page speaks for.
|
|
3263
3422
|
* @returns Boot payload for `GET /__boot__`.
|
|
3264
3423
|
*/
|
|
3265
|
-
function readBootPayload(ctx) {
|
|
3424
|
+
function readBootPayload(ctx, peer) {
|
|
3266
3425
|
const webServer = ctx.get("webServer");
|
|
3267
3426
|
if (webServer === void 0) throw new Error("webworker host: no webServer service, so the page cannot receive its boot injections");
|
|
3268
|
-
return { injections: webServer.collectIndexInjections() };
|
|
3427
|
+
return { injections: webServer.collectIndexInjections(peer) };
|
|
3269
3428
|
}
|
|
3270
3429
|
//#endregion
|
|
3271
3430
|
//#region ../../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
|
|
@@ -4725,6 +4884,28 @@ var buffer_exports = /* @__PURE__ */ __exportAll({
|
|
|
4725
4884
|
kMaxLength: () => import_buffer.kMaxLength
|
|
4726
4885
|
});
|
|
4727
4886
|
var import_buffer = require_buffer();
|
|
4887
|
+
const encoder$1 = new TextEncoder();
|
|
4888
|
+
const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
4889
|
+
const UTF8 = /^utf-?8$/i;
|
|
4890
|
+
const packageFrom = import_buffer.Buffer.from.bind(import_buffer.Buffer);
|
|
4891
|
+
const bufferPrototype = import_buffer.Buffer.prototype;
|
|
4892
|
+
const packageToString = bufferPrototype.toString;
|
|
4893
|
+
/** Whether an omitted or string encoding argument names UTF-8. */
|
|
4894
|
+
function isUtf8(encoding) {
|
|
4895
|
+
return encoding === void 0 || typeof encoding === "string" && UTF8.test(encoding);
|
|
4896
|
+
}
|
|
4897
|
+
import_buffer.Buffer.from = function from(value, encodingOrOffset, length) {
|
|
4898
|
+
if (typeof value === "string" && isUtf8(encodingOrOffset)) {
|
|
4899
|
+
const bytes = encoder$1.encode(value);
|
|
4900
|
+
return packageFrom(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
4901
|
+
}
|
|
4902
|
+
return packageFrom(value, encodingOrOffset, length);
|
|
4903
|
+
};
|
|
4904
|
+
bufferPrototype.toString = function toString(encoding, start, end) {
|
|
4905
|
+
if (start === void 0 && end === void 0 && isUtf8(encoding)) return decoder.decode(this);
|
|
4906
|
+
return packageToString.call(this, encoding, start, end);
|
|
4907
|
+
};
|
|
4908
|
+
Reflect.set(bufferPrototype, "toLocaleString", bufferPrototype.toString);
|
|
4728
4909
|
Object.defineProperty(globalThis, "Buffer", {
|
|
4729
4910
|
value: import_buffer.Buffer,
|
|
4730
4911
|
writable: true,
|
|
@@ -4777,9 +4958,10 @@ var buffer_default = {
|
|
|
4777
4958
|
* itself back over whoever came after it. The three slots are separate for the same reason — a restored
|
|
4778
4959
|
* copy pushed onto the folding stack could unwind another boundary's entry.
|
|
4779
4960
|
*
|
|
4780
|
-
* A snapshot with no stores
|
|
4781
|
-
* nothing: a callback registered outside every boundary keeps inheriting
|
|
4782
|
-
* enclosing boundary
|
|
4961
|
+
* A snapshot with no stores or explicit contexts is `undefined`, and the hook layer
|
|
4962
|
+
* then wraps nothing: a callback registered outside every boundary keeps inheriting
|
|
4963
|
+
* the enclosing boundary. Explicit empty contexts retain their `undefined` stores,
|
|
4964
|
+
* so deferred callbacks cannot inherit unrelated work. `__snapshotAll` is
|
|
4783
4965
|
* the transformer-facing counterpart and always captures every instance, including
|
|
4784
4966
|
* the ones reading `undefined`, because a resumed frame must see exactly what it
|
|
4785
4967
|
* saw at its pause point.
|
|
@@ -4942,13 +5124,13 @@ var AsyncLocalStorage = class AsyncLocalStorage {
|
|
|
4942
5124
|
/**
|
|
4943
5125
|
* Copy every live instance's current store. Not part of the Node face: this is
|
|
4944
5126
|
* the shim's own mechanism, kept in the class so the overlay stays private.
|
|
4945
|
-
* @returns the snapshot, or undefined when no instance has a store.
|
|
5127
|
+
* @returns the snapshot, or undefined when no instance has a store or explicit context.
|
|
4946
5128
|
*/
|
|
4947
5129
|
static captureContext() {
|
|
4948
5130
|
let captured;
|
|
4949
5131
|
for (const instance of instances) {
|
|
4950
5132
|
const store = instance.getStore();
|
|
4951
|
-
if (store === void 0) continue;
|
|
5133
|
+
if (store === void 0 && instance.overlay === void 0 && instance.resumed === void 0 && instance.ambients.length === 0 && instance.entries.length === 0) continue;
|
|
4952
5134
|
captured ??= [];
|
|
4953
5135
|
captured.push({
|
|
4954
5136
|
instance,
|
|
@@ -5006,8 +5188,8 @@ var AsyncLocalStorage = class AsyncLocalStorage {
|
|
|
5006
5188
|
};
|
|
5007
5189
|
/**
|
|
5008
5190
|
* Copy every live instance's current store.
|
|
5009
|
-
* @returns the snapshot, or undefined when no instance has a store
|
|
5010
|
-
* layer then wraps nothing and callbacks inherit the stack top).
|
|
5191
|
+
* @returns the snapshot, or undefined when no instance has a store or explicit
|
|
5192
|
+
* context (the hook layer then wraps nothing and callbacks inherit the stack top).
|
|
5011
5193
|
*/
|
|
5012
5194
|
function captureAsyncContext() {
|
|
5013
5195
|
return AsyncLocalStorage.captureContext();
|
|
@@ -13652,17 +13834,27 @@ var perf_hooks_exports = /* @__PURE__ */ __exportAll({
|
|
|
13652
13834
|
default: () => perf_hooks_default,
|
|
13653
13835
|
performance: () => performance$1
|
|
13654
13836
|
});
|
|
13655
|
-
const MODULE$
|
|
13837
|
+
const MODULE$10 = "node:perf_hooks";
|
|
13656
13838
|
/** Same clock object the worker global exposes. */
|
|
13657
13839
|
const performance$1 = globalThis.performance;
|
|
13658
13840
|
/** Observation of performance entries has no consumer here. */
|
|
13659
|
-
const PerformanceObserver = notImplementedFail(MODULE$
|
|
13841
|
+
const PerformanceObserver = notImplementedFail(MODULE$10, "PerformanceObserver");
|
|
13660
13842
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
13661
13843
|
var perf_hooks_default = {
|
|
13662
13844
|
performance: performance$1,
|
|
13663
13845
|
PerformanceObserver
|
|
13664
13846
|
};
|
|
13665
13847
|
//#endregion
|
|
13848
|
+
//#region src/node/builtin_modules/implemented/string_decoder.ts
|
|
13849
|
+
var string_decoder_exports = /* @__PURE__ */ __exportAll({
|
|
13850
|
+
StringDecoder: () => import_string_decoder.StringDecoder,
|
|
13851
|
+
__esModule: () => true,
|
|
13852
|
+
default: () => string_decoder_default
|
|
13853
|
+
});
|
|
13854
|
+
var import_string_decoder = require_string_decoder();
|
|
13855
|
+
/** CommonJS-compatible namespace for default imports. */
|
|
13856
|
+
var string_decoder_default = { StringDecoder: import_string_decoder.StringDecoder };
|
|
13857
|
+
//#endregion
|
|
13666
13858
|
//#region src/node/builtin_modules/implemented/stream/promises.ts
|
|
13667
13859
|
/** Promise-based stream completion and pipelines from the shared readable-stream implementation. */
|
|
13668
13860
|
var promises_exports$1 = /* @__PURE__ */ __exportAll({
|
|
@@ -14027,7 +14219,7 @@ var zlib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14027
14219
|
zstdDecompress: () => zstdDecompress,
|
|
14028
14220
|
zstdDecompressSync: () => zstdDecompressSync
|
|
14029
14221
|
});
|
|
14030
|
-
const MODULE$
|
|
14222
|
+
const MODULE$9 = "node:zlib";
|
|
14031
14223
|
/** Zstandard parameter/flush constants read at module scope by the JSONL backend. */
|
|
14032
14224
|
const constants = {
|
|
14033
14225
|
ZSTD_c_compressionLevel: 100,
|
|
@@ -14041,13 +14233,13 @@ const constants = {
|
|
|
14041
14233
|
Z_FINISH: 4
|
|
14042
14234
|
};
|
|
14043
14235
|
/** One-shot Zstandard compression (unavailable; the composition writes plaintext logs). */
|
|
14044
|
-
const zstdCompressSync = notImplementedFail(MODULE$
|
|
14236
|
+
const zstdCompressSync = notImplementedFail(MODULE$9, "zstdCompressSync");
|
|
14045
14237
|
/** One-shot Zstandard decompression (unavailable; the worker never reads compressed logs). */
|
|
14046
|
-
const zstdDecompressSync = notImplementedFail(MODULE$
|
|
14238
|
+
const zstdDecompressSync = notImplementedFail(MODULE$9, "zstdDecompressSync");
|
|
14047
14239
|
/** Callback form of {@link zstdCompressSync} (`promisify`'d at module scope by the backend). */
|
|
14048
|
-
const zstdCompress = notImplementedFail(MODULE$
|
|
14240
|
+
const zstdCompress = notImplementedFail(MODULE$9, "zstdCompress");
|
|
14049
14241
|
/** Callback form of {@link zstdDecompressSync}. */
|
|
14050
|
-
const zstdDecompress = notImplementedFail(MODULE$
|
|
14242
|
+
const zstdDecompress = notImplementedFail(MODULE$9, "zstdDecompress");
|
|
14051
14243
|
/**
|
|
14052
14244
|
* Streaming Zstandard decoder placeholder: the returned object deliberately
|
|
14053
14245
|
* lacks Node's private `_handle`/`_writeState` members, which is the signal the
|
|
@@ -14058,15 +14250,15 @@ function createZstdDecompress() {
|
|
|
14058
14250
|
return { close: () => {} };
|
|
14059
14251
|
}
|
|
14060
14252
|
/** Streaming Zstandard encoder (unavailable; the backend only needs one-shot). */
|
|
14061
|
-
const createZstdCompress = notImplementedFail(MODULE$
|
|
14253
|
+
const createZstdCompress = notImplementedFail(MODULE$9, "createZstdCompress");
|
|
14062
14254
|
/** gzip family (unavailable; no consumer in the reachable tree). */
|
|
14063
|
-
const gzip = notImplementedFail(MODULE$
|
|
14255
|
+
const gzip = notImplementedFail(MODULE$9, "gzip");
|
|
14064
14256
|
/** gzip sync counterpart. */
|
|
14065
|
-
const gzipSync = notImplementedFail(MODULE$
|
|
14257
|
+
const gzipSync = notImplementedFail(MODULE$9, "gzipSync");
|
|
14066
14258
|
/** gunzip counterpart. */
|
|
14067
|
-
const gunzip = notImplementedFail(MODULE$
|
|
14259
|
+
const gunzip = notImplementedFail(MODULE$9, "gunzip");
|
|
14068
14260
|
/** gunzip sync counterpart. */
|
|
14069
|
-
const gunzipSync = notImplementedFail(MODULE$
|
|
14261
|
+
const gunzipSync = notImplementedFail(MODULE$9, "gunzipSync");
|
|
14070
14262
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
14071
14263
|
var zlib_default = {
|
|
14072
14264
|
constants,
|
|
@@ -21364,7 +21556,7 @@ var child_process_exports = /* @__PURE__ */ __exportAll({
|
|
|
21364
21556
|
spawn: () => spawn$1,
|
|
21365
21557
|
spawnSync: () => spawnSync
|
|
21366
21558
|
});
|
|
21367
|
-
const MODULE$
|
|
21559
|
+
const MODULE$8 = "node:child_process";
|
|
21368
21560
|
/**
|
|
21369
21561
|
* The readable half of a pipe: `data` events carrying Buffers, `end`, and a
|
|
21370
21562
|
* `destroy` that stops delivery.
|
|
@@ -21629,7 +21821,7 @@ function spawnSync(program, args = []) {
|
|
|
21629
21821
|
if (executable !== void 0) {
|
|
21630
21822
|
const result = executable.runSync(args);
|
|
21631
21823
|
if (result.kind === "asynchronous") {
|
|
21632
|
-
const error = /* @__PURE__ */ new Error(`${MODULE$
|
|
21824
|
+
const error = /* @__PURE__ */ new Error(`${MODULE$8}.spawnSync cannot run ${program} in the worker host: commands run asynchronously`);
|
|
21633
21825
|
return {
|
|
21634
21826
|
pid: -1,
|
|
21635
21827
|
status: null,
|
|
@@ -21659,7 +21851,7 @@ function spawnSync(program, args = []) {
|
|
|
21659
21851
|
]
|
|
21660
21852
|
};
|
|
21661
21853
|
}
|
|
21662
|
-
const error = standardPrograms().has(program) ? /* @__PURE__ */ new Error(`${MODULE$
|
|
21854
|
+
const error = standardPrograms().has(program) ? /* @__PURE__ */ new Error(`${MODULE$8}.spawnSync cannot run ${program} in the worker host: commands run asynchronously`) : spawnEnoent(program);
|
|
21663
21855
|
return {
|
|
21664
21856
|
pid: -1,
|
|
21665
21857
|
status: null,
|
|
@@ -21736,11 +21928,11 @@ function execute(argv, options, callback) {
|
|
|
21736
21928
|
return child;
|
|
21737
21929
|
}
|
|
21738
21930
|
/** Run a command line synchronously (unavailable: the interpreter is asynchronous). */
|
|
21739
|
-
const execSync = notImplementedFail(MODULE$
|
|
21931
|
+
const execSync = notImplementedFail(MODULE$8, "execSync");
|
|
21740
21932
|
/** Run one program synchronously (unavailable: the interpreter is asynchronous). */
|
|
21741
|
-
const execFileSync = notImplementedFail(MODULE$
|
|
21933
|
+
const execFileSync = notImplementedFail(MODULE$8, "execFileSync");
|
|
21742
21934
|
/** Start a Node child (unavailable: the worker cannot create another Node runtime). */
|
|
21743
|
-
const fork = notImplementedFail(MODULE$
|
|
21935
|
+
const fork = notImplementedFail(MODULE$8, "fork");
|
|
21744
21936
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
21745
21937
|
var child_process_default = {
|
|
21746
21938
|
spawn: spawn$1,
|
|
@@ -21852,17 +22044,17 @@ var sqlite_exports = /* @__PURE__ */ __exportAll({
|
|
|
21852
22044
|
backup: () => backup,
|
|
21853
22045
|
default: () => sqlite_default
|
|
21854
22046
|
});
|
|
21855
|
-
const MODULE$
|
|
22047
|
+
const MODULE$7 = "node:sqlite";
|
|
21856
22048
|
/** Synchronous database handle (unavailable). */
|
|
21857
|
-
const DatabaseSync = notImplementedFail(MODULE$
|
|
22049
|
+
const DatabaseSync = notImplementedFail(MODULE$7, "DatabaseSync");
|
|
21858
22050
|
/** Prepared statement handle (unavailable). */
|
|
21859
|
-
const StatementSync = notImplementedFail(MODULE$
|
|
22051
|
+
const StatementSync = notImplementedFail(MODULE$7, "StatementSync");
|
|
21860
22052
|
/**
|
|
21861
22053
|
* Backup helper (unavailable).
|
|
21862
22054
|
* @returns Never — it throws naming the unavailable member.
|
|
21863
22055
|
*/
|
|
21864
22056
|
function backup() {
|
|
21865
|
-
throw notAvailableError(MODULE$
|
|
22057
|
+
throw notAvailableError(MODULE$7, "backup");
|
|
21866
22058
|
}
|
|
21867
22059
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
21868
22060
|
var sqlite_default = {
|
|
@@ -21887,19 +22079,19 @@ var vm_exports = /* @__PURE__ */ __exportAll({
|
|
|
21887
22079
|
runInNewContext: () => runInNewContext,
|
|
21888
22080
|
runInThisContext: () => runInThisContext
|
|
21889
22081
|
});
|
|
21890
|
-
const MODULE$
|
|
22082
|
+
const MODULE$6 = "node:vm";
|
|
21891
22083
|
/** Compiled script (unavailable). */
|
|
21892
|
-
const Script = notImplementedFail(MODULE$
|
|
22084
|
+
const Script = notImplementedFail(MODULE$6, "Script");
|
|
21893
22085
|
/** Context creation (unavailable). */
|
|
21894
|
-
const createContext = notImplementedFail(MODULE$
|
|
22086
|
+
const createContext = notImplementedFail(MODULE$6, "createContext");
|
|
21895
22087
|
/** In-context evaluation (unavailable). */
|
|
21896
|
-
const runInContext = notImplementedFail(MODULE$
|
|
22088
|
+
const runInContext = notImplementedFail(MODULE$6, "runInContext");
|
|
21897
22089
|
/** New-context evaluation (unavailable). */
|
|
21898
|
-
const runInNewContext = notImplementedFail(MODULE$
|
|
22090
|
+
const runInNewContext = notImplementedFail(MODULE$6, "runInNewContext");
|
|
21899
22091
|
/** This-context evaluation (unavailable). */
|
|
21900
|
-
const runInThisContext = notImplementedFail(MODULE$
|
|
22092
|
+
const runInThisContext = notImplementedFail(MODULE$6, "runInThisContext");
|
|
21901
22093
|
/** Context predicate (unavailable). */
|
|
21902
|
-
const isContext = notImplementedFail(MODULE$
|
|
22094
|
+
const isContext = notImplementedFail(MODULE$6, "isContext");
|
|
21903
22095
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
21904
22096
|
var vm_default = {
|
|
21905
22097
|
Script,
|
|
@@ -21910,6 +22102,18 @@ var vm_default = {
|
|
|
21910
22102
|
isContext
|
|
21911
22103
|
};
|
|
21912
22104
|
//#endregion
|
|
22105
|
+
//#region src/node/builtin_modules/mock/repl.ts
|
|
22106
|
+
/** Node REPL imports are available for packaging; starting a native REPL requires a Node Host. */
|
|
22107
|
+
var repl_exports = /* @__PURE__ */ __exportAll({
|
|
22108
|
+
__esModule: () => true,
|
|
22109
|
+
default: () => repl_default,
|
|
22110
|
+
start: () => start
|
|
22111
|
+
});
|
|
22112
|
+
/** REPL construction is unavailable in the browser worker. */
|
|
22113
|
+
const start = notImplementedFail("node:repl", "start");
|
|
22114
|
+
/** CommonJS export for the REPL member used by the Node PTC evaluator. */
|
|
22115
|
+
var repl_default = { start };
|
|
22116
|
+
//#endregion
|
|
21913
22117
|
//#region src/node/builtin_modules/mock/worker_threads.ts
|
|
21914
22118
|
/**
|
|
21915
22119
|
* `node:worker_threads` stub. Nested workers are unsupported, so the workflow
|
|
@@ -21930,17 +22134,17 @@ var worker_threads_exports = /* @__PURE__ */ __exportAll({
|
|
|
21930
22134
|
threadId: () => 0,
|
|
21931
22135
|
workerData: () => void 0
|
|
21932
22136
|
});
|
|
21933
|
-
const MODULE$
|
|
22137
|
+
const MODULE$5 = "node:worker_threads";
|
|
21934
22138
|
/** Worker-thread construction (unavailable). */
|
|
21935
|
-
const Worker$1 = notImplementedFail(MODULE$
|
|
22139
|
+
const Worker$1 = notImplementedFail(MODULE$5, "Worker");
|
|
21936
22140
|
/** Channel construction (unavailable). */
|
|
21937
|
-
const MessageChannel = notImplementedFail(MODULE$
|
|
22141
|
+
const MessageChannel = notImplementedFail(MODULE$5, "MessageChannel");
|
|
21938
22142
|
/** Port construction (unavailable). */
|
|
21939
|
-
const MessagePort = notImplementedFail(MODULE$
|
|
22143
|
+
const MessagePort = notImplementedFail(MODULE$5, "MessagePort");
|
|
21940
22144
|
/** Object transfer marking (unavailable). */
|
|
21941
|
-
const markAsUntransferable = notImplementedFail(MODULE$
|
|
22145
|
+
const markAsUntransferable = notImplementedFail(MODULE$5, "markAsUntransferable");
|
|
21942
22146
|
/** Port receiving on a message channel (unavailable). */
|
|
21943
|
-
const receiveMessageOnPort = notImplementedFail(MODULE$
|
|
22147
|
+
const receiveMessageOnPort = notImplementedFail(MODULE$5, "receiveMessageOnPort");
|
|
21944
22148
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
21945
22149
|
var worker_threads_default = {
|
|
21946
22150
|
Worker: Worker$1,
|
|
@@ -21993,7 +22197,7 @@ var koffi_exports = /* @__PURE__ */ __exportAll({
|
|
|
21993
22197
|
struct: () => struct,
|
|
21994
22198
|
types: () => types
|
|
21995
22199
|
});
|
|
21996
|
-
const MODULE$
|
|
22200
|
+
const MODULE$4 = "koffi";
|
|
21997
22201
|
/** Primitive sizes koffi's own x64 ABI reports. */
|
|
21998
22202
|
const PRIMITIVES = {
|
|
21999
22203
|
void: 0,
|
|
@@ -22103,15 +22307,15 @@ const koffi = {
|
|
|
22103
22307
|
},
|
|
22104
22308
|
sizeof: (target) => typeOf(target).size,
|
|
22105
22309
|
alignof: (target) => typeOf(target).alignment,
|
|
22106
|
-
load: notImplementedFail(MODULE$
|
|
22107
|
-
alloc: notImplementedFail(MODULE$
|
|
22108
|
-
free: notImplementedFail(MODULE$
|
|
22109
|
-
decode: notImplementedFail(MODULE$
|
|
22110
|
-
encode: notImplementedFail(MODULE$
|
|
22111
|
-
address: notImplementedFail(MODULE$
|
|
22112
|
-
register: notImplementedFail(MODULE$
|
|
22113
|
-
unregister: notImplementedFail(MODULE$
|
|
22114
|
-
call: notImplementedFail(MODULE$
|
|
22310
|
+
load: notImplementedFail(MODULE$4, "load"),
|
|
22311
|
+
alloc: notImplementedFail(MODULE$4, "alloc"),
|
|
22312
|
+
free: notImplementedFail(MODULE$4, "free"),
|
|
22313
|
+
decode: notImplementedFail(MODULE$4, "decode"),
|
|
22314
|
+
encode: notImplementedFail(MODULE$4, "encode"),
|
|
22315
|
+
address: notImplementedFail(MODULE$4, "address"),
|
|
22316
|
+
register: notImplementedFail(MODULE$4, "register"),
|
|
22317
|
+
unregister: notImplementedFail(MODULE$4, "unregister"),
|
|
22318
|
+
call: notImplementedFail(MODULE$4, "call")
|
|
22115
22319
|
};
|
|
22116
22320
|
//#endregion
|
|
22117
22321
|
//#region src/node/external_packages/libreoffice-kit.ts
|
|
@@ -22136,11 +22340,11 @@ var node_pty_exports = /* @__PURE__ */ __exportAll({
|
|
|
22136
22340
|
open: () => open,
|
|
22137
22341
|
spawn: () => spawn
|
|
22138
22342
|
});
|
|
22139
|
-
const MODULE$
|
|
22343
|
+
const MODULE$3 = "node-pty";
|
|
22140
22344
|
/** Spawn a pseudo-terminal (unavailable). */
|
|
22141
|
-
const spawn = notImplementedFail(MODULE$
|
|
22345
|
+
const spawn = notImplementedFail(MODULE$3, "spawn");
|
|
22142
22346
|
/** Open a pseudo-terminal pair (unavailable). */
|
|
22143
|
-
const open = notImplementedFail(MODULE$
|
|
22347
|
+
const open = notImplementedFail(MODULE$3, "open");
|
|
22144
22348
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
22145
22349
|
var node_pty_default = {
|
|
22146
22350
|
spawn,
|
|
@@ -22261,17 +22465,17 @@ var pi_ai_exports = /* @__PURE__ */ __exportAll({
|
|
|
22261
22465
|
openAICompletionsApi: () => openAICompletionsApi,
|
|
22262
22466
|
openAIResponsesApi: () => openAIResponsesApi
|
|
22263
22467
|
});
|
|
22264
|
-
const MODULE$
|
|
22468
|
+
const MODULE$2 = "@earendil-works/pi-ai";
|
|
22265
22469
|
/** Provider factory (unavailable). */
|
|
22266
|
-
const createProvider = notImplementedFail(MODULE$
|
|
22470
|
+
const createProvider = notImplementedFail(MODULE$2, "createProvider");
|
|
22267
22471
|
/** Model-list factory (unavailable). */
|
|
22268
|
-
const createModels = notImplementedFail(MODULE$
|
|
22472
|
+
const createModels = notImplementedFail(MODULE$2, "createModels");
|
|
22269
22473
|
/** Thinking-level catalog (unavailable). */
|
|
22270
|
-
const getSupportedThinkingLevels = notImplementedFail(MODULE$
|
|
22474
|
+
const getSupportedThinkingLevels = notImplementedFail(MODULE$2, "getSupportedThinkingLevels");
|
|
22271
22475
|
/** Context-overflow predicate (unavailable). */
|
|
22272
|
-
const isContextOverflow = notImplementedFail(MODULE$
|
|
22476
|
+
const isContextOverflow = notImplementedFail(MODULE$2, "isContextOverflow");
|
|
22273
22477
|
/** Collection of every builtin provider (unavailable). */
|
|
22274
|
-
const builtinModels = notImplementedFail(MODULE$
|
|
22478
|
+
const builtinModels = notImplementedFail(MODULE$2, "builtinModels");
|
|
22275
22479
|
/**
|
|
22276
22480
|
* Preview provider ids, in catalog order. This fixed subset must use valid
|
|
22277
22481
|
* installed pi-ai identifiers so the adapter can attach authentication metadata.
|
|
@@ -22348,11 +22552,11 @@ function getAllBuiltinModels() {
|
|
|
22348
22552
|
return [];
|
|
22349
22553
|
}
|
|
22350
22554
|
/** Anthropic messages API binding (unavailable). */
|
|
22351
|
-
const anthropicMessagesApi = notImplementedFail(MODULE$
|
|
22555
|
+
const anthropicMessagesApi = notImplementedFail(MODULE$2, "anthropicMessagesApi");
|
|
22352
22556
|
/** OpenAI completions API binding (unavailable). */
|
|
22353
|
-
const openAICompletionsApi = notImplementedFail(MODULE$
|
|
22557
|
+
const openAICompletionsApi = notImplementedFail(MODULE$2, "openAICompletionsApi");
|
|
22354
22558
|
/** OpenAI responses API binding (unavailable). */
|
|
22355
|
-
const openAIResponsesApi = notImplementedFail(MODULE$
|
|
22559
|
+
const openAIResponsesApi = notImplementedFail(MODULE$2, "openAIResponsesApi");
|
|
22356
22560
|
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
22357
22561
|
var pi_ai_default = {
|
|
22358
22562
|
createProvider,
|
|
@@ -22368,6 +22572,74 @@ var pi_ai_default = {
|
|
|
22368
22572
|
openAIResponsesApi
|
|
22369
22573
|
};
|
|
22370
22574
|
//#endregion
|
|
22575
|
+
//#region src/node/external_packages/pi-coding-agent.ts
|
|
22576
|
+
/** Pi's native SDK loads for plugin metadata, but agent and tool operations require a Node Host. */
|
|
22577
|
+
var pi_coding_agent_exports = /* @__PURE__ */ __exportAll({
|
|
22578
|
+
ModelRegistry: () => ModelRegistry,
|
|
22579
|
+
ModelRuntime: () => ModelRuntime,
|
|
22580
|
+
ProjectTrustStore: () => ProjectTrustStore,
|
|
22581
|
+
SessionManager: () => SessionManager,
|
|
22582
|
+
SettingsManager: () => SettingsManager,
|
|
22583
|
+
__esModule: () => true,
|
|
22584
|
+
createAgentSessionFromServices: () => createAgentSessionFromServices,
|
|
22585
|
+
createAgentSessionServices: () => createAgentSessionServices,
|
|
22586
|
+
createBashToolDefinition: () => createBashToolDefinition,
|
|
22587
|
+
createMcpExtension: () => createMcpExtension,
|
|
22588
|
+
default: () => pi_coding_agent_default,
|
|
22589
|
+
defineTool: () => defineTool,
|
|
22590
|
+
getAgentDir: () => getAgentDir,
|
|
22591
|
+
initTheme: () => initTheme,
|
|
22592
|
+
resolveCliModel: () => resolveCliModel
|
|
22593
|
+
});
|
|
22594
|
+
const MODULE$1 = "@earendil-works/pi-coding-agent";
|
|
22595
|
+
/** Agent directory discovery (unavailable). */
|
|
22596
|
+
const getAgentDir = notImplementedFail(MODULE$1, "getAgentDir");
|
|
22597
|
+
/** Theme initialization (unavailable). */
|
|
22598
|
+
const initTheme = notImplementedFail(MODULE$1, "initTheme");
|
|
22599
|
+
/** Agent session service creation (unavailable). */
|
|
22600
|
+
const createAgentSessionServices = notImplementedFail(MODULE$1, "createAgentSessionServices");
|
|
22601
|
+
/** Agent session creation from services (unavailable). */
|
|
22602
|
+
const createAgentSessionFromServices = notImplementedFail(MODULE$1, "createAgentSessionFromServices");
|
|
22603
|
+
/** Bash tool definition creation (unavailable). */
|
|
22604
|
+
const createBashToolDefinition = notImplementedFail(MODULE$1, "createBashToolDefinition");
|
|
22605
|
+
/** MCP extension creation (unavailable). */
|
|
22606
|
+
const createMcpExtension = notImplementedFail(MODULE$1, "createMcpExtension");
|
|
22607
|
+
/** Tool definition (unavailable). */
|
|
22608
|
+
const defineTool = notImplementedFail(MODULE$1, "defineTool");
|
|
22609
|
+
/** CLI model selection (unavailable). */
|
|
22610
|
+
const resolveCliModel = notImplementedFail(MODULE$1, "resolveCliModel");
|
|
22611
|
+
/** Model registry construction (unavailable). */
|
|
22612
|
+
const ModelRegistry = notImplementedFail(MODULE$1, "ModelRegistry");
|
|
22613
|
+
/** Project trust store construction (unavailable). */
|
|
22614
|
+
const ProjectTrustStore = notImplementedFail(MODULE$1, "ProjectTrustStore");
|
|
22615
|
+
/** Model runtime construction and creation (unavailable). */
|
|
22616
|
+
const ModelRuntime = Object.assign(notImplementedFail(MODULE$1, "ModelRuntime"), { create: notImplementedFail(MODULE$1, "ModelRuntime.create") });
|
|
22617
|
+
/** Settings manager construction and creation (unavailable). */
|
|
22618
|
+
const SettingsManager = Object.assign(notImplementedFail(MODULE$1, "SettingsManager"), { create: notImplementedFail(MODULE$1, "SettingsManager.create") });
|
|
22619
|
+
/** Session manager construction and storage operations (unavailable). */
|
|
22620
|
+
const SessionManager = Object.assign(notImplementedFail(MODULE$1, "SessionManager"), {
|
|
22621
|
+
create: notImplementedFail(MODULE$1, "SessionManager.create"),
|
|
22622
|
+
open: notImplementedFail(MODULE$1, "SessionManager.open"),
|
|
22623
|
+
inMemory: notImplementedFail(MODULE$1, "SessionManager.inMemory"),
|
|
22624
|
+
list: notImplementedFail(MODULE$1, "SessionManager.list")
|
|
22625
|
+
});
|
|
22626
|
+
/** CommonJS default export: the members `require()` hands a caller of this module. */
|
|
22627
|
+
var pi_coding_agent_default = {
|
|
22628
|
+
getAgentDir,
|
|
22629
|
+
initTheme,
|
|
22630
|
+
createAgentSessionServices,
|
|
22631
|
+
createAgentSessionFromServices,
|
|
22632
|
+
createBashToolDefinition,
|
|
22633
|
+
createMcpExtension,
|
|
22634
|
+
defineTool,
|
|
22635
|
+
resolveCliModel,
|
|
22636
|
+
ModelRegistry,
|
|
22637
|
+
ProjectTrustStore,
|
|
22638
|
+
ModelRuntime,
|
|
22639
|
+
SettingsManager,
|
|
22640
|
+
SessionManager
|
|
22641
|
+
};
|
|
22642
|
+
//#endregion
|
|
22371
22643
|
//#region src/node/external_packages/ripgrep.ts
|
|
22372
22644
|
var ripgrep_exports = /* @__PURE__ */ __exportAll({
|
|
22373
22645
|
__esModule: () => true,
|
|
@@ -22462,6 +22734,7 @@ const Server = WebSocketServer;
|
|
|
22462
22734
|
/** Package or subpath specifiers served from the worker bundle instead of the VFS. */
|
|
22463
22735
|
const REPLACED_EXTERNAL_PACKAGES = [
|
|
22464
22736
|
"@earendil-works/pi-ai",
|
|
22737
|
+
"@earendil-works/pi-coding-agent",
|
|
22465
22738
|
"@vscode/ripgrep",
|
|
22466
22739
|
"@deepseek-ai/libreoffice-kit",
|
|
22467
22740
|
"@deepseek-ai/node-addon-system/flock",
|
|
@@ -22517,8 +22790,10 @@ const BUILTINS = {
|
|
|
22517
22790
|
path: () => path_exports,
|
|
22518
22791
|
"path/posix": () => path_exports,
|
|
22519
22792
|
perf_hooks: () => perf_hooks_exports,
|
|
22793
|
+
repl: () => repl_exports,
|
|
22520
22794
|
sqlite: () => sqlite_exports,
|
|
22521
22795
|
stream: () => stream_exports,
|
|
22796
|
+
string_decoder: () => string_decoder_exports,
|
|
22522
22797
|
"stream/promises": () => promises_exports$1,
|
|
22523
22798
|
"timers/promises": () => promises_exports,
|
|
22524
22799
|
tty: () => tty_exports,
|
|
@@ -22541,7 +22816,8 @@ const EXTERNALS = {
|
|
|
22541
22816
|
"node-addon-require-builtin": () => node_addon_require_builtin_exports,
|
|
22542
22817
|
"ws": () => ws_exports,
|
|
22543
22818
|
"@vscode/ripgrep": () => ripgrep_exports,
|
|
22544
|
-
"@earendil-works/pi-ai": () => pi_ai_exports
|
|
22819
|
+
"@earendil-works/pi-ai": () => pi_ai_exports,
|
|
22820
|
+
"@earendil-works/pi-coding-agent": () => pi_coding_agent_exports
|
|
22545
22821
|
};
|
|
22546
22822
|
/**
|
|
22547
22823
|
* Prefixes whose every subpath resolves to one replacement module. The loader
|