@ai-ecoverse/slicc-kernel 1.154.2 → 1.155.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 +2 -2
- package/dist/driver-worker.js +5 -2
- package/dist/driver-worker.js.map +2 -2
- package/dist/index.js +5 -2
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +69 -7
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-driver-worker.js +5 -2
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +9 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +74 -9
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +9 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/embedder-relay.d.ts +3 -0
- package/dist/types/kernel/socket-syscalls.d.ts +3 -0
- package/dist/types/kernel/socket.d.ts +6 -0
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/package.json +1 -1
package/dist/kernel-worker.js
CHANGED
|
@@ -4648,6 +4648,7 @@ function embedderAsker(port) {
|
|
|
4648
4648
|
void asked.body.cancel(message3.error.message).catch(() => void 0);
|
|
4649
4649
|
push(asked, message3.error);
|
|
4650
4650
|
} else if ("progress" in message3) asked.progress(message3.progress);
|
|
4651
|
+
else if ("bodyCancel" in message3) void asked.body.cancel("the page").catch(() => void 0);
|
|
4651
4652
|
else void sendBody(message3.id, asked);
|
|
4652
4653
|
};
|
|
4653
4654
|
return { hookFor, answer: answer2 };
|
|
@@ -6096,8 +6097,8 @@ function link(a, b) {
|
|
|
6096
6097
|
pipe.openRead();
|
|
6097
6098
|
pipe.openWrite();
|
|
6098
6099
|
}
|
|
6099
|
-
a.attach({ rx: ba, tx: ab });
|
|
6100
|
-
b.attach({ rx: ab, tx: ba });
|
|
6100
|
+
a.attach({ rx: ba, tx: ab, peer: b });
|
|
6101
|
+
b.attach({ rx: ab, tx: ba, peer: a });
|
|
6101
6102
|
}
|
|
6102
6103
|
var SERVE_CHUNK = 64 * 1024;
|
|
6103
6104
|
var NEVER_ABORTED = new AbortController().signal;
|
|
@@ -6109,6 +6110,8 @@ var KernelSocket = class _KernelSocket {
|
|
|
6109
6110
|
dialing;
|
|
6110
6111
|
failed;
|
|
6111
6112
|
reset;
|
|
6113
|
+
abortive = false;
|
|
6114
|
+
refused;
|
|
6112
6115
|
local;
|
|
6113
6116
|
peer;
|
|
6114
6117
|
peerCred;
|
|
@@ -6145,20 +6148,25 @@ var KernelSocket = class _KernelSocket {
|
|
|
6145
6148
|
}
|
|
6146
6149
|
async read(max, signal) {
|
|
6147
6150
|
const { rx } = this.connection();
|
|
6151
|
+
if (this.refused) throw this.refused;
|
|
6148
6152
|
if (this.readShut || max <= 0) return new Uint8Array(0);
|
|
6149
6153
|
const bytes = await pipeCall(() => rx.read(max, signal));
|
|
6154
|
+
if (this.refused) throw this.refused;
|
|
6150
6155
|
if (bytes.length === 0 && this.reset) throw this.reset;
|
|
6151
6156
|
return bytes;
|
|
6152
6157
|
}
|
|
6153
6158
|
async peek(max, signal) {
|
|
6154
6159
|
const { rx } = this.connection();
|
|
6160
|
+
if (this.refused) throw this.refused;
|
|
6155
6161
|
if (this.readShut || max <= 0) return new Uint8Array(0);
|
|
6156
6162
|
const bytes = await pipeCall(() => rx.peek(max, signal));
|
|
6163
|
+
if (this.refused) throw this.refused;
|
|
6157
6164
|
if (bytes.length === 0 && this.reset) throw this.reset;
|
|
6158
6165
|
return bytes;
|
|
6159
6166
|
}
|
|
6160
6167
|
async write(bytes, signal) {
|
|
6161
6168
|
const { tx } = this.connection();
|
|
6169
|
+
if (this.refused) throw this.refused;
|
|
6162
6170
|
if (this.writeShut) throw new KernelError("EPIPE");
|
|
6163
6171
|
if (this.reset?.code === "EPROTO") throw this.reset;
|
|
6164
6172
|
return pipeCall(() => tx.write(bytes, signal));
|
|
@@ -6345,10 +6353,11 @@ var KernelSocket = class _KernelSocket {
|
|
|
6345
6353
|
handshaking = false;
|
|
6346
6354
|
signal.removeEventListener("abort", abandon);
|
|
6347
6355
|
}
|
|
6348
|
-
|
|
6356
|
+
const plain3 = uplinkLink(made2.conn, (err) => {
|
|
6349
6357
|
this.reset = err instanceof KernelError && err.code === "EPROTO" ? err : new KernelError("ECONNRESET");
|
|
6350
6358
|
this.changes.wake();
|
|
6351
6359
|
});
|
|
6360
|
+
this.link = { ...plain3, ...raw2.peer ? { peer: raw2.peer } : {} };
|
|
6352
6361
|
this.changes.wake();
|
|
6353
6362
|
return made2.info;
|
|
6354
6363
|
}
|
|
@@ -6466,8 +6475,22 @@ var KernelSocket = class _KernelSocket {
|
|
|
6466
6475
|
setOption(level, name2, value2) {
|
|
6467
6476
|
this.options.set(`${level}:${name2}`, value2);
|
|
6468
6477
|
}
|
|
6478
|
+
resetOnClose() {
|
|
6479
|
+
this.connection();
|
|
6480
|
+
this.abortive = true;
|
|
6481
|
+
}
|
|
6482
|
+
abort() {
|
|
6483
|
+
const link2 = this.link;
|
|
6484
|
+
if (link2.peer) link2.peer.resetBy();
|
|
6485
|
+
else link2.tx.closeRead();
|
|
6486
|
+
}
|
|
6487
|
+
resetBy() {
|
|
6488
|
+
this.refused ??= new KernelError("ECONNRESET");
|
|
6489
|
+
this.changes.wake();
|
|
6490
|
+
}
|
|
6469
6491
|
close() {
|
|
6470
6492
|
const was = this.state;
|
|
6493
|
+
if (this.abortive && was === "connected") this.abort();
|
|
6471
6494
|
this.state = "closed";
|
|
6472
6495
|
this.dialing?.abort(new KernelError("ECONNABORTED"));
|
|
6473
6496
|
this.dialing = void 0;
|
|
@@ -8089,7 +8112,7 @@ function satisfies(version, range2) {
|
|
|
8089
8112
|
}
|
|
8090
8113
|
|
|
8091
8114
|
// src/version.ts
|
|
8092
|
-
var KERNEL_VERSION = true ? "1.
|
|
8115
|
+
var KERNEL_VERSION = true ? "1.155.0" : "0.0.0-dev";
|
|
8093
8116
|
var OS_RELEASE = "6.0.0-slicc";
|
|
8094
8117
|
function procVersion() {
|
|
8095
8118
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -11914,6 +11937,7 @@ var BodyPipe = class {
|
|
|
11914
11937
|
queue = [];
|
|
11915
11938
|
size = 0;
|
|
11916
11939
|
ended = false;
|
|
11940
|
+
dropped = false;
|
|
11917
11941
|
wake;
|
|
11918
11942
|
room;
|
|
11919
11943
|
stream;
|
|
@@ -11932,7 +11956,8 @@ var BodyPipe = class {
|
|
|
11932
11956
|
this.room?.();
|
|
11933
11957
|
controller.enqueue(next3);
|
|
11934
11958
|
} else controller.close();
|
|
11935
|
-
}
|
|
11959
|
+
},
|
|
11960
|
+
cancel: () => this.drop()
|
|
11936
11961
|
},
|
|
11937
11962
|
{ highWaterMark: 0 }
|
|
11938
11963
|
);
|
|
@@ -11940,8 +11965,14 @@ var BodyPipe = class {
|
|
|
11940
11965
|
get full() {
|
|
11941
11966
|
return this.size >= EMBEDDER_WINDOW;
|
|
11942
11967
|
}
|
|
11968
|
+
drop() {
|
|
11969
|
+
this.dropped = true;
|
|
11970
|
+
this.queue = [];
|
|
11971
|
+
this.size = 0;
|
|
11972
|
+
this.end();
|
|
11973
|
+
}
|
|
11943
11974
|
push(bytes) {
|
|
11944
|
-
if (bytes.length === 0) return;
|
|
11975
|
+
if (bytes.length === 0 || this.dropped) return;
|
|
11945
11976
|
this.queue.push(bytes.slice());
|
|
11946
11977
|
this.size += bytes.length;
|
|
11947
11978
|
this.wake?.();
|
|
@@ -11957,6 +11988,30 @@ var BodyPipe = class {
|
|
|
11957
11988
|
this.room?.();
|
|
11958
11989
|
}
|
|
11959
11990
|
};
|
|
11991
|
+
function endsWith(stream, ended) {
|
|
11992
|
+
const reader = stream.getReader();
|
|
11993
|
+
return new ReadableStream(
|
|
11994
|
+
{
|
|
11995
|
+
pull: async (controller) => {
|
|
11996
|
+
let got;
|
|
11997
|
+
try {
|
|
11998
|
+
got = await reader.read();
|
|
11999
|
+
} catch (err) {
|
|
12000
|
+
ended();
|
|
12001
|
+
throw err;
|
|
12002
|
+
}
|
|
12003
|
+
if (!got.done) return controller.enqueue(got.value);
|
|
12004
|
+
ended();
|
|
12005
|
+
controller.close();
|
|
12006
|
+
},
|
|
12007
|
+
cancel: (reason) => {
|
|
12008
|
+
ended();
|
|
12009
|
+
return reader.cancel(reason);
|
|
12010
|
+
}
|
|
12011
|
+
},
|
|
12012
|
+
{ highWaterMark: 0 }
|
|
12013
|
+
);
|
|
12014
|
+
}
|
|
11960
12015
|
function replyStream(reply) {
|
|
11961
12016
|
if (reply instanceof ReadableStream) return reply;
|
|
11962
12017
|
const bytes = typeof reply === "string" ? new TextEncoder().encode(reply) : reply instanceof Uint8Array ? reply : new Uint8Array(0);
|
|
@@ -12031,7 +12086,10 @@ var EmbedderChannel = class {
|
|
|
12031
12086
|
signal: this.abort.signal,
|
|
12032
12087
|
progress
|
|
12033
12088
|
})
|
|
12034
|
-
).then((reply) =>
|
|
12089
|
+
).then((reply) => {
|
|
12090
|
+
if (!(reply instanceof ReadableStream)) body.drop();
|
|
12091
|
+
return endsWith(replyStream(reply), () => body.drop()).getReader();
|
|
12092
|
+
});
|
|
12035
12093
|
this.replied = asked.catch((err) => {
|
|
12036
12094
|
body.end();
|
|
12037
12095
|
throw this.fail(err);
|
|
@@ -23236,6 +23294,7 @@ var SOCKET_OPS = [
|
|
|
23236
23294
|
"sock-accept",
|
|
23237
23295
|
"sock-connect",
|
|
23238
23296
|
"sock-shutdown",
|
|
23297
|
+
"sock-reset",
|
|
23239
23298
|
"sock-name",
|
|
23240
23299
|
"sock-getopt",
|
|
23241
23300
|
"sock-setopt",
|
|
@@ -23303,6 +23362,9 @@ async function socketSyscall(req, proc) {
|
|
|
23303
23362
|
case "sock-shutdown":
|
|
23304
23363
|
anySocketAt(fds, req.fd).shutdown(req.how);
|
|
23305
23364
|
return ok3();
|
|
23365
|
+
case "sock-reset":
|
|
23366
|
+
socketAt(fds, req.fd).resetOnClose();
|
|
23367
|
+
return ok3();
|
|
23306
23368
|
case "sock-name": {
|
|
23307
23369
|
const socket = anySocketAt(fds, req.fd);
|
|
23308
23370
|
const addr = req.peer ? socket.peer : socket.local;
|