@ai-ecoverse/slicc-kernel 1.110.4 → 1.110.6
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/kernel-worker.js +1 -1
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +51 -25
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +1 -1
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +51 -25
- package/dist/process-worker.js.map +3 -3
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -2515,7 +2515,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2515
2515
|
var init_version = __esm({
|
|
2516
2516
|
"src/version.ts"() {
|
|
2517
2517
|
"use strict";
|
|
2518
|
-
KERNEL_VERSION = true ? "1.110.
|
|
2518
|
+
KERNEL_VERSION = true ? "1.110.6" : "0.0.0-dev";
|
|
2519
2519
|
OS_RELEASE = "6.0.0-slicc";
|
|
2520
2520
|
}
|
|
2521
2521
|
});
|
|
@@ -3241,6 +3241,7 @@ function useMounts(Fs, env = {}, live = false) {
|
|
|
3241
3241
|
if (typeof Fs.open !== "function" || typeof writeFile !== "function") return;
|
|
3242
3242
|
const { passwd, group } = accounts(env);
|
|
3243
3243
|
const backing = { "/etc/mtab": "/proc/mounts" };
|
|
3244
|
+
const defaults = {};
|
|
3244
3245
|
try {
|
|
3245
3246
|
if (!live) writeFile.call(Fs, "/proc/mounts", mountTable());
|
|
3246
3247
|
} catch {
|
|
@@ -3248,20 +3249,39 @@ function useMounts(Fs, env = {}, live = false) {
|
|
|
3248
3249
|
}
|
|
3249
3250
|
try {
|
|
3250
3251
|
mkdirTree.call(Fs, "/dev/.etc");
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3252
|
+
const files = {
|
|
3253
|
+
passwd,
|
|
3254
|
+
group,
|
|
3255
|
+
hosts: hostsFile(hostnameOf(env)),
|
|
3256
|
+
hostname: `${hostnameOf(env)}
|
|
3257
|
+
`
|
|
3258
|
+
};
|
|
3259
|
+
for (const [name2, text] of Object.entries(files)) {
|
|
3260
|
+
writeFile.call(Fs, `/dev/.etc/${name2}`, text);
|
|
3261
|
+
backing[`/etc/${name2}`] = `/dev/.etc/${name2}`;
|
|
3262
|
+
defaults[`/etc/${name2}`] = text;
|
|
3263
|
+
}
|
|
3260
3264
|
} catch {
|
|
3261
3265
|
}
|
|
3262
3266
|
const open = Fs.open.bind(Fs);
|
|
3267
|
+
const seed = (path, text) => {
|
|
3268
|
+
let stream;
|
|
3269
|
+
try {
|
|
3270
|
+
stream = open(path, O_WRONLY2 | O_CREAT | O_EXCL, 420);
|
|
3271
|
+
} catch {
|
|
3272
|
+
return;
|
|
3273
|
+
}
|
|
3274
|
+
try {
|
|
3275
|
+
const bytes = new TextEncoder().encode(text);
|
|
3276
|
+
Fs.write(stream, bytes, 0, bytes.length);
|
|
3277
|
+
} finally {
|
|
3278
|
+
Fs.closeStream(stream.fd);
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3263
3281
|
Fs.open = (path, flags, mode) => {
|
|
3264
3282
|
const instead = backing[path];
|
|
3283
|
+
const text = defaults[path];
|
|
3284
|
+
if (text !== void 0 && (flags & (O_ACCMODE3 | O_CREAT)) !== 0) seed(path, text);
|
|
3265
3285
|
if (!instead || (flags & (O_ACCMODE3 | O_CREAT)) !== 0) return open(path, flags, mode);
|
|
3266
3286
|
try {
|
|
3267
3287
|
return open(path, flags, mode);
|
|
@@ -3443,7 +3463,7 @@ function linuxDevices(Fs) {
|
|
|
3443
3463
|
}
|
|
3444
3464
|
}
|
|
3445
3465
|
}
|
|
3446
|
-
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3466
|
+
var O_CLOEXEC, FD_CLOEXEC, F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_DUPFD_CLOEXEC, tracked, IMPORT_NAMES, EBADF, AT_SYMLINK_NOFOLLOW, EMSCRIPTEN_EPERM, O_PATH2, LITERALS, UTIME_NOW, UTIME_OMIT, PROT_WRITE, MAP_PRIVATE, MAP_TYPE, O_WRONLY2, MAP_ALIGN, DIR_MODE, LINK_MODE, CHAR_DEVICE, O_ACCMODE3, O_CREAT, O_EXCL, field, pinnedRoot, rootKind, NAME, AT_FDCWD, AT_EACCESS, W_ACCESS, X_ACCESS, AT_SYMLINK_FOLLOW, UTS_FIELD, DEVICE_MODES;
|
|
3447
3467
|
var init_process_fds = __esm({
|
|
3448
3468
|
"src/process/process-fds.ts"() {
|
|
3449
3469
|
"use strict";
|
|
@@ -3503,6 +3523,7 @@ var init_process_fds = __esm({
|
|
|
3503
3523
|
CHAR_DEVICE = 8630;
|
|
3504
3524
|
O_ACCMODE3 = 3;
|
|
3505
3525
|
O_CREAT = 64;
|
|
3526
|
+
O_EXCL = 128;
|
|
3506
3527
|
field = (text) => (text || "none").replace(/[\s\\]/g, (c) => `\\${c.charCodeAt(0).toString(8).padStart(3, "0")}`);
|
|
3507
3528
|
rootKind = () => globalThis.navigator?.storage ? "opfs" : "memory";
|
|
3508
3529
|
NAME = /^[a-z_][a-z0-9_-]*$/i;
|
|
@@ -3652,7 +3673,7 @@ function datesOf(real) {
|
|
|
3652
3673
|
dates[key] = new Date(value2);
|
|
3653
3674
|
return dates;
|
|
3654
3675
|
}
|
|
3655
|
-
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, O_CREAT2,
|
|
3676
|
+
var POLLIN, POLLOUT, POLLERR, POLLHUP, POLLRDNORM, POLLWRNORM, TCSETSF, O_NONBLOCK, SOCKET_MODE, PTY_PATH, TTY_PATH, TTY_NAME, SEALED_PATH, STRERROR, CLIPBOARD_PATH, O_CREAT2, O_EXCL2, O_NOCTTY, O_TRUNC2, O_DIRECTORY, KILLED_BY_SIGPIPE, ProcessExit, SyscallError, KernelStreams;
|
|
3656
3677
|
var init_kernel_streams = __esm({
|
|
3657
3678
|
"src/process/kernel-streams.ts"() {
|
|
3658
3679
|
"use strict";
|
|
@@ -3682,7 +3703,7 @@ var init_kernel_streams = __esm({
|
|
|
3682
3703
|
};
|
|
3683
3704
|
CLIPBOARD_PATH = "/dev/clipboard";
|
|
3684
3705
|
O_CREAT2 = 64;
|
|
3685
|
-
|
|
3706
|
+
O_EXCL2 = 128;
|
|
3686
3707
|
O_NOCTTY = 256;
|
|
3687
3708
|
O_TRUNC2 = 512;
|
|
3688
3709
|
O_DIRECTORY = 65536;
|
|
@@ -3983,13 +4004,13 @@ var init_kernel_streams = __esm({
|
|
|
3983
4004
|
try {
|
|
3984
4005
|
return open(path, flags, mode);
|
|
3985
4006
|
} catch (err) {
|
|
3986
|
-
const lost = err.errno === wasiErrno("EEXIST") && !(flags &
|
|
4007
|
+
const lost = err.errno === wasiErrno("EEXIST") && !(flags & O_EXCL2);
|
|
3987
4008
|
if (!lost) throw err;
|
|
3988
4009
|
return open(path, flags, mode);
|
|
3989
4010
|
}
|
|
3990
4011
|
}
|
|
3991
4012
|
refuseExclusiveLink(path, flags) {
|
|
3992
|
-
if ((flags & (O_CREAT2 |
|
|
4013
|
+
if ((flags & (O_CREAT2 | O_EXCL2)) !== (O_CREAT2 | O_EXCL2)) return;
|
|
3993
4014
|
let mode = 0;
|
|
3994
4015
|
try {
|
|
3995
4016
|
mode = this.Fs.stat?.(path, true)?.mode ?? 0;
|
|
@@ -4031,7 +4052,7 @@ var init_kernel_streams = __esm({
|
|
|
4031
4052
|
vessel(open, kfd, at, terminal) {
|
|
4032
4053
|
let stream;
|
|
4033
4054
|
try {
|
|
4034
|
-
stream = open("/dev/null", at.flags & ~(O_CREAT2 |
|
|
4055
|
+
stream = open("/dev/null", at.flags & ~(O_CREAT2 | O_EXCL2 | O_TRUNC2), at.mode);
|
|
4035
4056
|
} catch (e) {
|
|
4036
4057
|
this.sys.close(kfd);
|
|
4037
4058
|
throw e;
|
|
@@ -4370,7 +4391,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
4370
4391
|
} else {
|
|
4371
4392
|
const placed = place(
|
|
4372
4393
|
Fs,
|
|
4373
|
-
Fs.open(entry.path, entry.flags & ~(O_CREAT3 |
|
|
4394
|
+
Fs.open(entry.path, entry.flags & ~(O_CREAT3 | O_EXCL3 | O_TRUNC3)),
|
|
4374
4395
|
entry.fd
|
|
4375
4396
|
);
|
|
4376
4397
|
setCloseOnExec(placed, (entry.flags & O_CLOEXEC) !== 0);
|
|
@@ -4379,7 +4400,7 @@ function restoreForkedStreams(Fs, streams2, table) {
|
|
|
4379
4400
|
}
|
|
4380
4401
|
}
|
|
4381
4402
|
}
|
|
4382
|
-
var O_RDWR, O_ACCMODE4, O_CREAT3,
|
|
4403
|
+
var O_RDWR, O_ACCMODE4, O_CREAT3, O_EXCL3, O_TRUNC3, PLACEHOLDER_DIR, NAMED_DEVICES, ACCESS, DEVICES, FIFO_MODE, nextStreamIno, streamInos;
|
|
4383
4404
|
var init_process_fork = __esm({
|
|
4384
4405
|
"src/process/process-fork.ts"() {
|
|
4385
4406
|
"use strict";
|
|
@@ -4387,7 +4408,7 @@ var init_process_fork = __esm({
|
|
|
4387
4408
|
O_RDWR = 2;
|
|
4388
4409
|
O_ACCMODE4 = 3;
|
|
4389
4410
|
O_CREAT3 = 64;
|
|
4390
|
-
|
|
4411
|
+
O_EXCL3 = 128;
|
|
4391
4412
|
O_TRUNC3 = 512;
|
|
4392
4413
|
PLACEHOLDER_DIR = "/dev/slicc-fd";
|
|
4393
4414
|
NAMED_DEVICES = {
|
|
@@ -14494,12 +14515,13 @@ function fetchOp(kernel) {
|
|
|
14494
14515
|
throw signal.aborted ? signal.reason : failed3(err);
|
|
14495
14516
|
}
|
|
14496
14517
|
};
|
|
14497
|
-
const body = (handle,
|
|
14518
|
+
const body = (handle, request) => {
|
|
14519
|
+
const { signal } = request;
|
|
14498
14520
|
let aborted;
|
|
14499
14521
|
const settle = () => {
|
|
14500
14522
|
if (aborted) signal.removeEventListener("abort", aborted);
|
|
14501
14523
|
};
|
|
14502
|
-
|
|
14524
|
+
const stream = new ReadableStream(
|
|
14503
14525
|
{
|
|
14504
14526
|
start(controller) {
|
|
14505
14527
|
aborted = () => {
|
|
@@ -14534,8 +14556,10 @@ function fetchOp(kernel) {
|
|
|
14534
14556
|
},
|
|
14535
14557
|
{ highWaterMark: 0 }
|
|
14536
14558
|
);
|
|
14559
|
+
keptRequests.set(stream, request);
|
|
14560
|
+
return stream;
|
|
14537
14561
|
};
|
|
14538
|
-
const respond = (head, method, redirected, encoded,
|
|
14562
|
+
const respond = (head, method, redirected, encoded, request) => {
|
|
14539
14563
|
if (head.status < 200 || head.status > 599) {
|
|
14540
14564
|
void close(head.handle);
|
|
14541
14565
|
throw failed3(new JsCallError("EPROTO", `status ${head.status}`));
|
|
@@ -14543,7 +14567,7 @@ function fetchOp(kernel) {
|
|
|
14543
14567
|
const empty = method === "HEAD" || NULL_BODY.has(head.status);
|
|
14544
14568
|
if (empty) void close(head.handle);
|
|
14545
14569
|
const headers = new Headers(head.headers);
|
|
14546
|
-
let stream = empty ? null : body(head.handle,
|
|
14570
|
+
let stream = empty ? null : body(head.handle, request);
|
|
14547
14571
|
const coding = headers.get("content-encoding")?.trim().toLowerCase();
|
|
14548
14572
|
if (stream && encoded && coding && DECODED.has(coding)) {
|
|
14549
14573
|
const format = coding === "deflate" ? "deflate" : "gzip";
|
|
@@ -14551,6 +14575,7 @@ function fetchOp(kernel) {
|
|
|
14551
14575
|
new DecompressionStream(format)
|
|
14552
14576
|
);
|
|
14553
14577
|
headers.delete("content-length");
|
|
14578
|
+
keptRequests.set(stream, request);
|
|
14554
14579
|
}
|
|
14555
14580
|
const response = new Response(stream, {
|
|
14556
14581
|
status: head.status,
|
|
@@ -14596,7 +14621,7 @@ function fetchOp(kernel) {
|
|
|
14596
14621
|
const follow2 = known.manualRedirects && REDIRECTS.has(head.status) && location !== void 0 && request.redirect !== "manual";
|
|
14597
14622
|
if (!follow2) {
|
|
14598
14623
|
const redirected = hops > 0 || head.redirected === true;
|
|
14599
|
-
return respond(head, hop.method, redirected, known.encodedBodies,
|
|
14624
|
+
return respond(head, hop.method, redirected, known.encodedBodies, request);
|
|
14600
14625
|
}
|
|
14601
14626
|
await close(head.handle);
|
|
14602
14627
|
if (request.redirect === "error") throw failed3(new Error("unexpected redirect"));
|
|
@@ -14605,7 +14630,7 @@ function fetchOp(kernel) {
|
|
|
14605
14630
|
}
|
|
14606
14631
|
};
|
|
14607
14632
|
}
|
|
14608
|
-
var CHUNK2, MAX_REDIRECTS, NULL_BODY, REDIRECTS, BODY_HEADERS, DECODED, CREDENTIALS, BAD_PORTS, OVER, TOKEN, QUOTABLE, SPACE, BASE64, SLICE;
|
|
14633
|
+
var CHUNK2, MAX_REDIRECTS, keptRequests, NULL_BODY, REDIRECTS, BODY_HEADERS, DECODED, CREDENTIALS, BAD_PORTS, OVER, TOKEN, QUOTABLE, SPACE, BASE64, SLICE;
|
|
14609
14634
|
var init_js_fetch = __esm({
|
|
14610
14635
|
"src/process/js/js-fetch.ts"() {
|
|
14611
14636
|
"use strict";
|
|
@@ -14613,6 +14638,7 @@ var init_js_fetch = __esm({
|
|
|
14613
14638
|
init_js_kernel();
|
|
14614
14639
|
CHUNK2 = 64 * 1024;
|
|
14615
14640
|
MAX_REDIRECTS = 20;
|
|
14641
|
+
keptRequests = /* @__PURE__ */ new WeakMap();
|
|
14616
14642
|
NULL_BODY = /* @__PURE__ */ new Set([101, 103, 204, 205, 304]);
|
|
14617
14643
|
REDIRECTS = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
14618
14644
|
BODY_HEADERS = /* @__PURE__ */ new Set([
|