@ai-ecoverse/slicc-kernel 1.31.2 → 1.32.1
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 +3 -2
- package/dist/kernel-worker.js +8 -3
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +361 -262
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +20 -3
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +361 -262
- package/dist/process-worker.js.map +4 -4
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -347,6 +347,10 @@ function nullFile() {
|
|
|
347
347
|
}
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
|
+
function written(device, bytes) {
|
|
351
|
+
if (device === "full" && bytes.length > 0) throw new KernelError("ENOSPC");
|
|
352
|
+
return bytes.length;
|
|
353
|
+
}
|
|
350
354
|
function deviceFile(device, access) {
|
|
351
355
|
const read = async (max) => {
|
|
352
356
|
if (device === "null") return new Uint8Array(0);
|
|
@@ -360,7 +364,7 @@ function deviceFile(device, access) {
|
|
|
360
364
|
};
|
|
361
365
|
return new OpenFile({
|
|
362
366
|
...access !== "write" ? { read } : {},
|
|
363
|
-
...access !== "read" ? { write: async (bytes) => bytes
|
|
367
|
+
...access !== "read" ? { write: async (bytes) => written(device, bytes) } : {},
|
|
364
368
|
seek: async () => 0,
|
|
365
369
|
heldMeta: { device, ...access ? { access } : {} },
|
|
366
370
|
close: () => {
|
|
@@ -3495,6 +3499,7 @@ var ChildTable = class {
|
|
|
3495
3499
|
openSlot(slot, n, captured) {
|
|
3496
3500
|
if ("fd" in slot) return this.parentFds.get(slot.fd).retain();
|
|
3497
3501
|
if ("input" in slot) return bytesSource(slot.input);
|
|
3502
|
+
if ("device" in slot) return deviceFile(slot.device, slot.access);
|
|
3498
3503
|
if ("capture" in slot) {
|
|
3499
3504
|
const chunks2 = [];
|
|
3500
3505
|
captured.set(n, chunks2);
|
|
@@ -6928,11 +6933,11 @@ var Pages = class {
|
|
|
6928
6933
|
runs.push({ offset: start, bytes });
|
|
6929
6934
|
i = j;
|
|
6930
6935
|
}
|
|
6931
|
-
const
|
|
6936
|
+
const written2 = Math.max(this.stored, ...runs.map((r) => r.offset + r.bytes.length));
|
|
6932
6937
|
return {
|
|
6933
6938
|
...this.shrink !== void 0 ? { shrink: this.shrink } : {},
|
|
6934
6939
|
runs,
|
|
6935
|
-
...this.length >
|
|
6940
|
+
...this.length > written2 ? { extend: this.length } : {}
|
|
6936
6941
|
};
|
|
6937
6942
|
}
|
|
6938
6943
|
flushed() {
|
|
@@ -11385,6 +11390,17 @@ async function attachKernel(port, options = {}) {
|
|
|
11385
11390
|
}
|
|
11386
11391
|
|
|
11387
11392
|
// src/node.ts
|
|
11393
|
+
function hostfsFetchOf(options) {
|
|
11394
|
+
const { hostfsFetch, hostfsOrigin } = options;
|
|
11395
|
+
if (hostfsOrigin === void 0) return hostfsFetch ? { hostfsFetch } : {};
|
|
11396
|
+
const base = hostfsFetch ?? ((url, init) => fetch(url, init));
|
|
11397
|
+
return {
|
|
11398
|
+
hostfsFetch: (url, init) => base(url, {
|
|
11399
|
+
...init,
|
|
11400
|
+
headers: { ...init.headers, Origin: hostfsOrigin }
|
|
11401
|
+
})
|
|
11402
|
+
};
|
|
11403
|
+
}
|
|
11388
11404
|
function nodeTransport() {
|
|
11389
11405
|
const transport = fetchTransport();
|
|
11390
11406
|
return { ...transport, traits: { ...transport.traits, crossOrigin: "any" } };
|
|
@@ -11460,6 +11476,7 @@ async function createNodeKernel(options = {}) {
|
|
|
11460
11476
|
...options.processMounts !== void 0 ? { processMounts: options.processMounts } : {},
|
|
11461
11477
|
...options.fstabRetries ? { fstabRetries: options.fstabRetries } : {},
|
|
11462
11478
|
...options.hostfs ? { hostfs: options.hostfs } : {},
|
|
11479
|
+
...hostfsFetchOf(options),
|
|
11463
11480
|
...options.cdp ? { cdp: options.cdp } : {},
|
|
11464
11481
|
...options.hostname !== void 0 ? { hostname: options.hostname } : {}
|
|
11465
11482
|
});
|