@ai-ecoverse/slicc-kernel 1.160.2 → 1.161.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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +125 -10
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +102 -96
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +197 -16
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +5 -1
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +8 -0
- package/dist/types/fs/remote.d.ts +19 -0
- package/dist/types/fs/types.d.ts +8 -0
- package/dist/types/kernel/host.d.ts +1 -0
- package/dist/types/kernel/proc-info.d.ts +6 -0
- package/dist/types/mount/mount-fs.d.ts +3 -1
- package/dist/types/node.d.ts +9 -1
- package/dist/types/realm/sync-fs-token-registry.d.ts +1 -0
- package/package.json +2 -2
|
@@ -2207,8 +2207,8 @@ function createSyncFsSabBridge(transport, opts = {}) {
|
|
|
2207
2207
|
};
|
|
2208
2208
|
const io = (id) => ({
|
|
2209
2209
|
readFile: (path) => bytes({ op: "read", path, ...id }, path),
|
|
2210
|
-
writeFile: (path,
|
|
2211
|
-
changing({ op: "write", path, body:
|
|
2210
|
+
writeFile: (path, data2, open) => {
|
|
2211
|
+
changing({ op: "write", path, body: data2, ...open ? { mode: 1 } : {}, ...id }, path);
|
|
2212
2212
|
},
|
|
2213
2213
|
pread: (path, offset, length, version) => bytes({ op: "pread", path, offset, length, ...version ? { version } : {}, ...id }, path),
|
|
2214
2214
|
pwrite: (path, offset, body, transfer) => {
|
|
@@ -3116,12 +3116,12 @@ function streamFile(fd, path, io, access) {
|
|
|
3116
3116
|
},
|
|
3117
3117
|
read: (position, length) => readAsync(position, length),
|
|
3118
3118
|
readInto: readingIntoAsync((position, length) => readAsync(position, length)),
|
|
3119
|
-
async write(position,
|
|
3119
|
+
async write(position, data2) {
|
|
3120
3120
|
index2(position, "write");
|
|
3121
3121
|
live();
|
|
3122
3122
|
allowed(access.write, "write");
|
|
3123
|
-
await io.write(fd,
|
|
3124
|
-
return
|
|
3123
|
+
await io.write(fd, data2);
|
|
3124
|
+
return data2.length;
|
|
3125
3125
|
},
|
|
3126
3126
|
async truncate(size) {
|
|
3127
3127
|
live();
|
|
@@ -3155,12 +3155,12 @@ function streamSyncFile(fd, path, io, access) {
|
|
|
3155
3155
|
},
|
|
3156
3156
|
read: (position, length) => readSync(position, length),
|
|
3157
3157
|
readInto: readingInto((position, length) => readSync(position, length)),
|
|
3158
|
-
write(position,
|
|
3158
|
+
write(position, data2) {
|
|
3159
3159
|
index2(position, "write");
|
|
3160
3160
|
live();
|
|
3161
3161
|
allowed(access.write, "write");
|
|
3162
|
-
io.write(fd,
|
|
3163
|
-
return
|
|
3162
|
+
io.write(fd, data2);
|
|
3163
|
+
return data2.length;
|
|
3164
3164
|
},
|
|
3165
3165
|
truncate(size) {
|
|
3166
3166
|
live();
|
|
@@ -4572,12 +4572,12 @@ var init_wasi_memory = __esm({
|
|
|
4572
4572
|
}
|
|
4573
4573
|
return out;
|
|
4574
4574
|
}
|
|
4575
|
-
scatter(ptr, count,
|
|
4575
|
+
scatter(ptr, count, data2) {
|
|
4576
4576
|
let at = 0;
|
|
4577
4577
|
for (const [base, len] of this.iovecs(ptr, count)) {
|
|
4578
|
-
if (at >=
|
|
4579
|
-
const n = capturedMath.min(len,
|
|
4580
|
-
this.bytes(base, n).set(
|
|
4578
|
+
if (at >= data2.length) break;
|
|
4579
|
+
const n = capturedMath.min(len, data2.length - at);
|
|
4580
|
+
this.bytes(base, n).set(data2.subarray(at, at + n));
|
|
4581
4581
|
at += n;
|
|
4582
4582
|
}
|
|
4583
4583
|
return at;
|
|
@@ -4980,8 +4980,8 @@ function wasixEpollImports(host) {
|
|
|
4980
4980
|
kernelFd(fd, "EPERM");
|
|
4981
4981
|
if (how !== "del" && event === 0) throw new WasiError("EINVAL");
|
|
4982
4982
|
const events = event === 0 ? 0 : mem.view().getUint32(event, true);
|
|
4983
|
-
const
|
|
4984
|
-
call3({ op: "epoll-ctl", epfd, how, fd, events, data });
|
|
4983
|
+
const data2 = event === 0 ? [] : [...mem.bytes(event + DATA_OFFSET, DATA_SIZE)];
|
|
4984
|
+
call3({ op: "epoll-ctl", epfd, how, fd, events, data: data2 });
|
|
4985
4985
|
},
|
|
4986
4986
|
epoll_wait: (epfd, ptr, maxevents, timeout, out) => {
|
|
4987
4987
|
mem.view().setUint32(out, 0, true);
|
|
@@ -6111,12 +6111,12 @@ var init_wasi_host = __esm({
|
|
|
6111
6111
|
return {
|
|
6112
6112
|
fd_write: (fd, iovs, n, out) => void mem.view().setUint32(out, this.write(fd, mem.gather(iovs, n)), true),
|
|
6113
6113
|
fd_read: (fd, iovs, n, out) => {
|
|
6114
|
-
const
|
|
6115
|
-
mem.view().setUint32(out, mem.scatter(iovs, n,
|
|
6114
|
+
const data2 = this.read(fd, mem.capacity(iovs, n));
|
|
6115
|
+
mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
|
|
6116
6116
|
},
|
|
6117
6117
|
fd_pread: (fd, iovs, n, at, out) => {
|
|
6118
|
-
const
|
|
6119
|
-
mem.view().setUint32(out, mem.scatter(iovs, n,
|
|
6118
|
+
const data2 = this.positional(fd, "read").pread(mem.capacity(iovs, n), capturedNumber(at));
|
|
6119
|
+
mem.view().setUint32(out, mem.scatter(iovs, n, data2), true);
|
|
6120
6120
|
},
|
|
6121
6121
|
fd_pwrite: (fd, iovs, n, at, out) => void mem.view().setUint32(
|
|
6122
6122
|
out,
|
|
@@ -6287,8 +6287,8 @@ var init_wasi_host = __esm({
|
|
|
6287
6287
|
}
|
|
6288
6288
|
const peek = (riflags & RIFLAGS.PEEK) !== 0;
|
|
6289
6289
|
const want = mem.capacity(iovs, n);
|
|
6290
|
-
const
|
|
6291
|
-
mem.view().setUint32(outLen, mem.scatter(iovs, n,
|
|
6290
|
+
const data2 = (riflags & RIFLAGS.WAITALL) !== 0 && !peek ? this.recvAll(fd, want, e.nonblock) : o.kernel.sys.read(fd, capturedMath.min(want, MAX_READ), { nonblock: e.nonblock, peek });
|
|
6291
|
+
mem.view().setUint32(outLen, mem.scatter(iovs, n, data2), true);
|
|
6292
6292
|
mem.view().setUint16(outFlags, 0, true);
|
|
6293
6293
|
},
|
|
6294
6294
|
sock_send: (fd, iovs, n, _flags, out) => {
|
|
@@ -6399,12 +6399,12 @@ var init_wasi_host = __esm({
|
|
|
6399
6399
|
kernelStat(fd) {
|
|
6400
6400
|
return this.o.kernel.call({ op: "fd-vfs-stat", fd });
|
|
6401
6401
|
}
|
|
6402
|
-
write(fd,
|
|
6403
|
-
if (this.muted?.(fd,
|
|
6402
|
+
write(fd, data2) {
|
|
6403
|
+
if (this.muted?.(fd, data2)) return data2.length;
|
|
6404
6404
|
const e = this.fds.get(fd);
|
|
6405
6405
|
if (e.type === "kernel") {
|
|
6406
6406
|
try {
|
|
6407
|
-
const n = this.o.kernel.sys.write(fd,
|
|
6407
|
+
const n = this.o.kernel.sys.write(fd, data2, { nonblock: e.nonblock });
|
|
6408
6408
|
return this.fds.kind(fd, e) === "file" ? this.changed(fd, e, n) : n;
|
|
6409
6409
|
} catch (err) {
|
|
6410
6410
|
const broken = err.code === "EPIPE";
|
|
@@ -6415,10 +6415,10 @@ var init_wasi_host = __esm({
|
|
|
6415
6415
|
if (e.type === "device") {
|
|
6416
6416
|
this.interrupted?.();
|
|
6417
6417
|
if (e.access === "read") throw new WasiError("EBADF");
|
|
6418
|
-
if (e.device === "full" &&
|
|
6419
|
-
return
|
|
6418
|
+
if (e.device === "full" && data2.length > 0) throw new WasiError("ENOSPC");
|
|
6419
|
+
return data2.length;
|
|
6420
6420
|
}
|
|
6421
|
-
return this.file(fd, "write").write(
|
|
6421
|
+
return this.file(fd, "write").write(data2);
|
|
6422
6422
|
}
|
|
6423
6423
|
brokenPipe() {
|
|
6424
6424
|
let action;
|
|
@@ -7365,7 +7365,7 @@ var init_version = __esm({
|
|
|
7365
7365
|
"src/version.ts"() {
|
|
7366
7366
|
"use strict";
|
|
7367
7367
|
init_captured_globals();
|
|
7368
|
-
KERNEL_VERSION = true ? "1.
|
|
7368
|
+
KERNEL_VERSION = true ? "1.161.0" : "0.0.0-dev";
|
|
7369
7369
|
OS_RELEASE = "6.0.0-slicc";
|
|
7370
7370
|
}
|
|
7371
7371
|
});
|
|
@@ -7589,10 +7589,10 @@ function restoreMode(lane, { terminal, fd, termios }) {
|
|
|
7589
7589
|
lane({ op: "tty-set", fd: opened2, termios });
|
|
7590
7590
|
lane({ op: "fd-close", fd: opened2 });
|
|
7591
7591
|
}
|
|
7592
|
-
function writeOut(lane, fd,
|
|
7592
|
+
function writeOut(lane, fd, data2) {
|
|
7593
7593
|
let at = 0;
|
|
7594
|
-
while (at <
|
|
7595
|
-
const body =
|
|
7594
|
+
while (at < data2.length) {
|
|
7595
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
7596
7596
|
const r = lane({ op: "fd-write", fd, body });
|
|
7597
7597
|
if (!r.ok && r.errno === "EINTR") continue;
|
|
7598
7598
|
if (!r.ok) return false;
|
|
@@ -10662,13 +10662,13 @@ function useFileMmap(Fs, deps) {
|
|
|
10662
10662
|
if (stream.stream_ops.mmap && kfd === void 0 || !memalign || !memory || length <= 0 || shared || (stream.flags & O_ACCMODE3) === O_WRONLY5 || !Fs.isFile(stream.node.mode)) {
|
|
10663
10663
|
return mmap.call(fs, stream, length, position, prot, flags);
|
|
10664
10664
|
}
|
|
10665
|
-
const
|
|
10665
|
+
const data2 = staging(Fs, length);
|
|
10666
10666
|
let done = 0;
|
|
10667
10667
|
try {
|
|
10668
|
-
if (kfd !== void 0) done = readInto(deps.sys, kfd,
|
|
10668
|
+
if (kfd !== void 0) done = readInto(deps.sys, kfd, data2, position);
|
|
10669
10669
|
else {
|
|
10670
10670
|
for (let got = 1; done < length && got > 0; done += got) {
|
|
10671
|
-
got = Fs.read(stream,
|
|
10671
|
+
got = Fs.read(stream, data2, done, length - done, position + done);
|
|
10672
10672
|
}
|
|
10673
10673
|
}
|
|
10674
10674
|
} catch (err) {
|
|
@@ -10679,7 +10679,7 @@ function useFileMmap(Fs, deps) {
|
|
|
10679
10679
|
if (!ptr) throw new Fs.ErrnoError(wasiErrno("ENOMEM"));
|
|
10680
10680
|
const target = new capturedUint8Array(memory.buffer, ptr, size);
|
|
10681
10681
|
target.fill(0);
|
|
10682
|
-
target.set(
|
|
10682
|
+
target.set(data2.subarray(0, done));
|
|
10683
10683
|
return { ptr, allocated: true };
|
|
10684
10684
|
};
|
|
10685
10685
|
}
|
|
@@ -11476,8 +11476,8 @@ function useProcfs(Fs, sys, pid, memory = memorySource()) {
|
|
|
11476
11476
|
stream.sliccProc = new capturedTextEncoder().encode(content());
|
|
11477
11477
|
},
|
|
11478
11478
|
read: (stream, buffer, offset, length, at) => {
|
|
11479
|
-
const
|
|
11480
|
-
const chunk =
|
|
11479
|
+
const data2 = stream.sliccProc ?? new capturedUint8Array(0);
|
|
11480
|
+
const chunk = data2.subarray(at, at + length);
|
|
11481
11481
|
buffer.set(chunk, offset);
|
|
11482
11482
|
return chunk.length;
|
|
11483
11483
|
},
|
|
@@ -11655,6 +11655,10 @@ var init_procfs = __esm({
|
|
|
11655
11655
|
`,
|
|
11656
11656
|
slicc_file_ids: (listing2) => `${listing2.fileIds ?? 0}
|
|
11657
11657
|
`,
|
|
11658
|
+
slicc_peer_holds: ({ holds }) => `${holds?.mine ?? 0} ${holds?.peers ?? 0} ${holds?.sent ?? 0}
|
|
11659
|
+
`,
|
|
11660
|
+
slicc_peer_held: ({ holds }) => (holds?.held ?? []).map((path) => `${path}
|
|
11661
|
+
`).join(""),
|
|
11658
11662
|
slicc_rename_acks: (listing2) => {
|
|
11659
11663
|
const samples = [...listing2.renameAcks?.ackMs ?? []].sort((a, b) => a - b);
|
|
11660
11664
|
const median = samples[capturedMath.floor(samples.length / 2)] ?? 0;
|
|
@@ -12319,11 +12323,11 @@ var init_js_proc = __esm({
|
|
|
12319
12323
|
});
|
|
12320
12324
|
|
|
12321
12325
|
// src/process/js/js-rights.ts
|
|
12322
|
-
function sendmsgRequest(fd,
|
|
12326
|
+
function sendmsgRequest(fd, data2, options = {}) {
|
|
12323
12327
|
return {
|
|
12324
12328
|
op: "sock-sendmsg",
|
|
12325
12329
|
fd,
|
|
12326
|
-
body: typeof
|
|
12330
|
+
body: typeof data2 === "string" ? encoder2.encode(data2) : data2,
|
|
12327
12331
|
fds: options.fds ?? [],
|
|
12328
12332
|
nonblock: options.nonblock === true
|
|
12329
12333
|
};
|
|
@@ -12360,7 +12364,7 @@ async function blocked(kernel, watch, req) {
|
|
|
12360
12364
|
function rightsAsync(kernel, forget, watch) {
|
|
12361
12365
|
return {
|
|
12362
12366
|
socketpair: async () => await kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
|
|
12363
|
-
sendmsg: async (fd,
|
|
12367
|
+
sendmsg: async (fd, data2, options) => jsonOf(await blocked(kernel, watch, sendmsgRequest(fd, data2, options))),
|
|
12364
12368
|
async recvmsg(fd, max, options) {
|
|
12365
12369
|
const got = decodeReceived2(
|
|
12366
12370
|
bytesOf2(await blocked(kernel, watch, recvmsgRequest(fd, max, options)))
|
|
@@ -12507,8 +12511,8 @@ function syncOps(kernel, shared) {
|
|
|
12507
12511
|
const r = kernel.blocking({ op: "fd-read", fd, max: capturedMath.min(max, MAX_IO) });
|
|
12508
12512
|
return r.ok && r.kind === "bytes" ? r.bytes : new capturedUint8Array(0);
|
|
12509
12513
|
};
|
|
12510
|
-
const write2 = (fd,
|
|
12511
|
-
const bytes = typeof
|
|
12514
|
+
const write2 = (fd, data2, options) => {
|
|
12515
|
+
const bytes = typeof data2 === "string" ? encoder4.encode(data2) : data2;
|
|
12512
12516
|
const i = info(fd);
|
|
12513
12517
|
if (writeDevice(i)) return bytes.length;
|
|
12514
12518
|
const nonblock = options?.nonblock === true;
|
|
@@ -12599,7 +12603,7 @@ function syncOps(kernel, shared) {
|
|
|
12599
12603
|
kernel.call({ op: "fd-close", fd });
|
|
12600
12604
|
},
|
|
12601
12605
|
socketpair: () => kernel.json({ op: "sock-pair", domain: "unix", type: "stream" }),
|
|
12602
|
-
sendmsg: (fd,
|
|
12606
|
+
sendmsg: (fd, data2, options) => kernel.json(sendmsgRequest(fd, data2, options)),
|
|
12603
12607
|
recvmsg(fd, max, options) {
|
|
12604
12608
|
const got = decodeReceived2(kernel.bytes(recvmsgRequest(fd, max, options)));
|
|
12605
12609
|
for (const n of got.fds) infos.delete(n);
|
|
@@ -12648,17 +12652,17 @@ function syncFile(kernel, fd, path, append, forget) {
|
|
|
12648
12652
|
read(position, length) {
|
|
12649
12653
|
return pread(position, length);
|
|
12650
12654
|
},
|
|
12651
|
-
write(position,
|
|
12655
|
+
write(position, data2) {
|
|
12652
12656
|
index2(position, "write");
|
|
12653
12657
|
let at = 0;
|
|
12654
12658
|
do {
|
|
12655
12659
|
live();
|
|
12656
|
-
if (at >=
|
|
12657
|
-
const body =
|
|
12660
|
+
if (at >= data2.length) break;
|
|
12661
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
12658
12662
|
const n = kernel.json(fileWrite(fd, append, position + at, body));
|
|
12659
12663
|
if (!(n > 0)) throw new JsCallError("EIO", "write");
|
|
12660
12664
|
at += n;
|
|
12661
|
-
} while (at <
|
|
12665
|
+
} while (at < data2.length);
|
|
12662
12666
|
return at;
|
|
12663
12667
|
},
|
|
12664
12668
|
truncate(size) {
|
|
@@ -12743,7 +12747,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
12743
12747
|
return readWholeSync(open(devPath));
|
|
12744
12748
|
}
|
|
12745
12749
|
},
|
|
12746
|
-
writeFile(path,
|
|
12750
|
+
writeFile(path, data2, options) {
|
|
12747
12751
|
const mode = options?.mode;
|
|
12748
12752
|
const file = open(path, {
|
|
12749
12753
|
write: true,
|
|
@@ -12752,7 +12756,7 @@ function syncPathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
12752
12756
|
...mode !== void 0 ? { mode } : {}
|
|
12753
12757
|
});
|
|
12754
12758
|
try {
|
|
12755
|
-
file.write(0, typeof
|
|
12759
|
+
file.write(0, typeof data2 === "string" ? encoder4.encode(data2) : data2);
|
|
12756
12760
|
} finally {
|
|
12757
12761
|
file.close();
|
|
12758
12762
|
}
|
|
@@ -14226,8 +14230,8 @@ function createProcessKernel(deps) {
|
|
|
14226
14230
|
},
|
|
14227
14231
|
pause: () => status(call3({ op: "sig-pause" }, "pause")),
|
|
14228
14232
|
sigInherited: () => inheritedOf(call3({ op: "sig-inherited" }, "sig-inherited")),
|
|
14229
|
-
mount(source, target, type, flags,
|
|
14230
|
-
const req = { op: "mount", source, target: at(target), type, flags, data };
|
|
14233
|
+
mount(source, target, type, flags, data2) {
|
|
14234
|
+
const req = { op: "mount", source, target: at(target), type, flags, data: data2 };
|
|
14231
14235
|
return status(call3(req, `mount ${target}`));
|
|
14232
14236
|
},
|
|
14233
14237
|
umount2(target, flags) {
|
|
@@ -15933,9 +15937,9 @@ function includesSelf(kernel, self, pid) {
|
|
|
15933
15937
|
}
|
|
15934
15938
|
function writer(kernel, info, pid) {
|
|
15935
15939
|
const writes = new capturedSet();
|
|
15936
|
-
const sendAll = async (fd,
|
|
15937
|
-
while (w.at <
|
|
15938
|
-
const body =
|
|
15940
|
+
const sendAll = async (fd, data2, i, w, signal) => {
|
|
15941
|
+
while (w.at < data2.length) {
|
|
15942
|
+
const body = data2.subarray(w.at, w.at + MAX_IO);
|
|
15939
15943
|
w.len = body.length;
|
|
15940
15944
|
try {
|
|
15941
15945
|
w.at += signal ? await sendSome(kernel, fd, body, signal) : written(
|
|
@@ -15953,21 +15957,21 @@ function writer(kernel, info, pid) {
|
|
|
15953
15957
|
}
|
|
15954
15958
|
}
|
|
15955
15959
|
};
|
|
15956
|
-
const writeAll = async (fd,
|
|
15957
|
-
const w = { fd, data, at: 0, len: 0 };
|
|
15960
|
+
const writeAll = async (fd, data2, signal) => {
|
|
15961
|
+
const w = { fd, data: data2, at: 0, len: 0 };
|
|
15958
15962
|
if (!signal) writes.add(w);
|
|
15959
15963
|
try {
|
|
15960
15964
|
const i = await info(fd);
|
|
15961
15965
|
if (writeDevice(i)) return;
|
|
15962
|
-
await sendAll(fd,
|
|
15966
|
+
await sendAll(fd, data2, i, w, signal);
|
|
15963
15967
|
} finally {
|
|
15964
15968
|
writes.delete(w);
|
|
15965
15969
|
}
|
|
15966
15970
|
};
|
|
15967
|
-
const writeSome = async (fd,
|
|
15971
|
+
const writeSome = async (fd, data2) => {
|
|
15968
15972
|
const i = await info(fd);
|
|
15969
|
-
if (writeDevice(i)) return
|
|
15970
|
-
const body =
|
|
15973
|
+
if (writeDevice(i)) return data2.length;
|
|
15974
|
+
const body = data2.subarray(0, MAX_IO);
|
|
15971
15975
|
const r = await kernel.raw({ op: "fd-write", fd, body, nonblock: true });
|
|
15972
15976
|
if (r.ok) return written(r, body.length);
|
|
15973
15977
|
if (brokenPipe(callError(r, "fd-write"), i))
|
|
@@ -16051,10 +16055,10 @@ async function fifoOpen(kernel, abs, options, io) {
|
|
|
16051
16055
|
seekless(position, "read");
|
|
16052
16056
|
return io.read(fd, length);
|
|
16053
16057
|
}),
|
|
16054
|
-
async write(position,
|
|
16058
|
+
async write(position, data2) {
|
|
16055
16059
|
seekless(position, "write");
|
|
16056
|
-
await io.write(fd,
|
|
16057
|
-
return
|
|
16060
|
+
await io.write(fd, data2);
|
|
16061
|
+
return data2.length;
|
|
16058
16062
|
},
|
|
16059
16063
|
async truncate() {
|
|
16060
16064
|
live();
|
|
@@ -16145,10 +16149,10 @@ function pendingReads(kernel, info, random2) {
|
|
|
16145
16149
|
return { read: read2, closing, watch };
|
|
16146
16150
|
}
|
|
16147
16151
|
function tracked2(pending, writeAll, writeSome, failed5) {
|
|
16148
|
-
return (fd,
|
|
16152
|
+
return (fd, data2, options) => {
|
|
16149
16153
|
const status2 = failed5?.();
|
|
16150
16154
|
if (status2 !== void 0) return capturedPromise.reject(new JsExit(status2));
|
|
16151
|
-
const bytes = typeof
|
|
16155
|
+
const bytes = typeof data2 === "string" ? encoder5.encode(data2) : data2;
|
|
16152
16156
|
let settle;
|
|
16153
16157
|
const settled2 = new capturedPromise((resolve2) => settle = resolve2);
|
|
16154
16158
|
pending.add(settled2);
|
|
@@ -16415,17 +16419,17 @@ function fileHandle(kernel, fd, path, append, forget) {
|
|
|
16415
16419
|
async read(position, length) {
|
|
16416
16420
|
return await pread(position, length);
|
|
16417
16421
|
},
|
|
16418
|
-
async write(position,
|
|
16422
|
+
async write(position, data2) {
|
|
16419
16423
|
index2(position, "write");
|
|
16420
16424
|
let at = 0;
|
|
16421
16425
|
do {
|
|
16422
16426
|
live();
|
|
16423
|
-
if (at >=
|
|
16424
|
-
const body =
|
|
16427
|
+
if (at >= data2.length) break;
|
|
16428
|
+
const body = data2.subarray(at, at + MAX_IO);
|
|
16425
16429
|
const n = await kernel.json(fileWrite(fd, append, position + at, body));
|
|
16426
16430
|
if (!(n > 0)) throw new JsCallError("EIO", "write");
|
|
16427
16431
|
at += n;
|
|
16428
|
-
} while (at <
|
|
16432
|
+
} while (at < data2.length);
|
|
16429
16433
|
return at;
|
|
16430
16434
|
},
|
|
16431
16435
|
async truncate(size) {
|
|
@@ -16535,7 +16539,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
16535
16539
|
return readWhole(await open(devPath));
|
|
16536
16540
|
}
|
|
16537
16541
|
},
|
|
16538
|
-
async writeFile(path,
|
|
16542
|
+
async writeFile(path, data2, options) {
|
|
16539
16543
|
const mode = options?.mode;
|
|
16540
16544
|
const file = await open(
|
|
16541
16545
|
path,
|
|
@@ -16543,7 +16547,7 @@ function pathOps(kernel, resolve2, statOf, open, clean) {
|
|
|
16543
16547
|
true
|
|
16544
16548
|
);
|
|
16545
16549
|
try {
|
|
16546
|
-
await file.write(0, typeof
|
|
16550
|
+
await file.write(0, typeof data2 === "string" ? encoder5.encode(data2) : data2);
|
|
16547
16551
|
} finally {
|
|
16548
16552
|
await file.close();
|
|
16549
16553
|
}
|
|
@@ -17132,9 +17136,9 @@ var init_wasi_signals = __esm({
|
|
|
17132
17136
|
this.libcDefault = outer.libc;
|
|
17133
17137
|
}
|
|
17134
17138
|
}
|
|
17135
|
-
muted(fd,
|
|
17139
|
+
muted(fd, data2) {
|
|
17136
17140
|
if (fd !== 2 || this.delivering === void 0) return false;
|
|
17137
|
-
if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(
|
|
17141
|
+
if (!WASIX_LIBC_DEFAULT_LINE.test(new capturedTextDecoder().decode(data2))) return false;
|
|
17138
17142
|
this.libcDefault = true;
|
|
17139
17143
|
return true;
|
|
17140
17144
|
}
|
|
@@ -17306,8 +17310,8 @@ var init_wasix_fork = __esm({
|
|
|
17306
17310
|
fork(fork) {
|
|
17307
17311
|
const sp = this.stackPointer();
|
|
17308
17312
|
const globals = this.globals();
|
|
17309
|
-
return this.unwind((
|
|
17310
|
-
this.answer = fork(
|
|
17313
|
+
return this.unwind((data2) => {
|
|
17314
|
+
this.answer = fork(data2, globals, sp);
|
|
17311
17315
|
});
|
|
17312
17316
|
}
|
|
17313
17317
|
checkpoint(snapPtr, retPtr) {
|
|
@@ -17317,9 +17321,9 @@ var init_wasix_fork = __esm({
|
|
|
17317
17321
|
v.setBigUint64(snapPtr + 8, capturedBigInt(id), true);
|
|
17318
17322
|
v.setBigUint64(snapPtr + 16, 0x51cc5117n, true);
|
|
17319
17323
|
const globals = this.globals();
|
|
17320
|
-
return this.unwind((
|
|
17321
|
-
const end = this.mem.view().getUint32(
|
|
17322
|
-
this.snapshots.set(id, { frames: this.mem.bytes(
|
|
17324
|
+
return this.unwind((data2) => {
|
|
17325
|
+
const end = this.mem.view().getUint32(data2, true);
|
|
17326
|
+
this.snapshots.set(id, { frames: this.mem.bytes(data2 + 8, end - data2 - 8).slice(), globals });
|
|
17323
17327
|
this.answer = 0;
|
|
17324
17328
|
});
|
|
17325
17329
|
}
|
|
@@ -17327,9 +17331,9 @@ var init_wasix_fork = __esm({
|
|
|
17327
17331
|
const id = capturedNumber(this.mem.view().getBigUint64(snapPtr + 8, true));
|
|
17328
17332
|
const snap = this.snapshots.get(id);
|
|
17329
17333
|
if (!snap) throw new capturedError(`WASIX: longjmp to an unknown setjmp (${id})`);
|
|
17330
|
-
return this.unwind((
|
|
17331
|
-
this.mem.bytes(
|
|
17332
|
-
this.mem.view().setUint32(
|
|
17334
|
+
return this.unwind((data2) => {
|
|
17335
|
+
this.mem.bytes(data2 + 8, snap.frames.length).set(snap.frames);
|
|
17336
|
+
this.mem.view().setUint32(data2, data2 + 8 + snap.frames.length, true);
|
|
17333
17337
|
this.restoreGlobals(snap.globals);
|
|
17334
17338
|
this.answer = capturedNumber(val) || 1;
|
|
17335
17339
|
});
|
|
@@ -17357,15 +17361,15 @@ var init_wasix_fork = __esm({
|
|
|
17357
17361
|
}
|
|
17358
17362
|
unwind(then) {
|
|
17359
17363
|
if (!this.supported) return E.NOSYS;
|
|
17360
|
-
const
|
|
17364
|
+
const data2 = this.dataPointer();
|
|
17361
17365
|
const v = this.mem.view();
|
|
17362
|
-
v.setUint32(
|
|
17363
|
-
v.setUint32(
|
|
17366
|
+
v.setUint32(data2, data2 + 8, true);
|
|
17367
|
+
v.setUint32(data2 + 4, this.stackPointer() - 16, true);
|
|
17364
17368
|
this.pending = () => {
|
|
17365
|
-
then(
|
|
17366
|
-
return
|
|
17369
|
+
then(data2);
|
|
17370
|
+
return data2;
|
|
17367
17371
|
};
|
|
17368
|
-
this.exports.asyncify_start_unwind?.(
|
|
17372
|
+
this.exports.asyncify_start_unwind?.(data2);
|
|
17369
17373
|
return E.SUCCESS;
|
|
17370
17374
|
}
|
|
17371
17375
|
restoreGlobals(globals) {
|
|
@@ -19284,7 +19288,7 @@ async function runWasiProcess(init, port3) {
|
|
|
19284
19288
|
host.signals = signals;
|
|
19285
19289
|
wireSignals(host, gate);
|
|
19286
19290
|
host.onRaise = (sig) => signals.raised(sig);
|
|
19287
|
-
host.muted = (fd,
|
|
19291
|
+
host.muted = (fd, data2) => signals.muted(fd, data2);
|
|
19288
19292
|
const exports = instance.exports;
|
|
19289
19293
|
driver.bind(instance.exports);
|
|
19290
19294
|
const entry = fork?.entry;
|
|
@@ -19693,10 +19697,11 @@ function workerShaped(scope2, href) {
|
|
|
19693
19697
|
location: slot2(capturedObject.freeze({ href }))
|
|
19694
19698
|
});
|
|
19695
19699
|
}
|
|
19696
|
-
function ownCache(dir, result) {
|
|
19700
|
+
function ownCache(dir, result, optional = false) {
|
|
19697
19701
|
const active = result.directory;
|
|
19698
19702
|
if (active === void 0) return false;
|
|
19699
19703
|
if (!`${resolve(active)}${sep}`.startsWith(`${resolve(dir)}${sep}`)) {
|
|
19704
|
+
if (optional) return false;
|
|
19700
19705
|
throw new capturedError(
|
|
19701
19706
|
`slicc-kernel: compileCache ${dir} was asked for, but this worker already caches in ${active} (a host preload enabled it): refusing to run programs`
|
|
19702
19707
|
);
|
|
@@ -19951,30 +19956,30 @@ function processEntry(port3, run = runWasmProcess, wasi = loadWasi, js = loadJs,
|
|
|
19951
19956
|
}
|
|
19952
19957
|
return refused3;
|
|
19953
19958
|
};
|
|
19954
|
-
return (
|
|
19955
|
-
const type =
|
|
19959
|
+
return (data2) => {
|
|
19960
|
+
const type = data2?.type;
|
|
19956
19961
|
if (type !== WASM_THREAD_INIT && type !== WASM_PROCESS_INIT && type !== JS_THREAD_INIT) return;
|
|
19957
19962
|
const refusal2 = sealOnce();
|
|
19958
19963
|
if (type === JS_THREAD_INIT) {
|
|
19959
19964
|
if (refusal2) return failed5(refusal2.error);
|
|
19960
19965
|
js().then((m) => {
|
|
19961
19966
|
if (!m.runJsThread) throw new capturedError("this process worker runs no JS threads");
|
|
19962
|
-
return m.runJsThread(
|
|
19967
|
+
return m.runJsThread(data2, port3);
|
|
19963
19968
|
}).then(
|
|
19964
19969
|
(code2) => port3.postMessage({ type: JS_THREAD_EXIT, code: code2 }),
|
|
19965
19970
|
failed5
|
|
19966
19971
|
);
|
|
19967
19972
|
return;
|
|
19968
19973
|
}
|
|
19969
|
-
const init =
|
|
19974
|
+
const init = data2;
|
|
19970
19975
|
if (type === WASM_THREAD_INIT || init?.program?.abi !== "js") useLocalClock(init?.sab);
|
|
19971
19976
|
if (type === WASM_THREAD_INIT) {
|
|
19972
19977
|
if (refusal2) return failed5(refusal2.error);
|
|
19973
|
-
wasi().then((m) => m.runWasiThread(
|
|
19978
|
+
wasi().then((m) => m.runWasiThread(data2, port3)).catch(failed5);
|
|
19974
19979
|
return;
|
|
19975
19980
|
}
|
|
19976
19981
|
if (refusal2) return failed5(refusal2.error, NOT_RUNNABLE2);
|
|
19977
|
-
started2(
|
|
19982
|
+
started2(data2, port3, run, wasi, js).then(
|
|
19978
19983
|
(code2) => port3.postMessage({ type: WASM_PROCESS_EXIT, code: code2 }),
|
|
19979
19984
|
failed5
|
|
19980
19985
|
);
|
|
@@ -19988,8 +19993,9 @@ var scope = capturedGlobalThis;
|
|
|
19988
19993
|
scope.require ??= createRequire(import.meta.url);
|
|
19989
19994
|
scope.__filename ??= new capturedURL(import.meta.url).pathname;
|
|
19990
19995
|
scope.__dirname ??= new capturedURL(".", import.meta.url).pathname;
|
|
19991
|
-
var
|
|
19992
|
-
var
|
|
19996
|
+
var data = workerData;
|
|
19997
|
+
var cacheDir = data?.compileCache;
|
|
19998
|
+
var cached = typeof cacheDir === "string" && ownCache(cacheDir, enableCompileCache(cacheDir), data?.ownedCache === true);
|
|
19993
19999
|
var imported = cached ? () => flushCompileCache() : void 0;
|
|
19994
20000
|
var port2 = parentPort;
|
|
19995
20001
|
var post2 = {
|