@ai-ecoverse/slicc-kernel 1.66.0 → 1.66.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/dist/driver-worker.js +7 -2
- package/dist/driver-worker.js.map +3 -3
- package/dist/driver.js +6 -1
- package/dist/driver.js.map +3 -3
- package/dist/index.js +8 -3
- package/dist/index.js.map +3 -3
- package/dist/kernel-worker.js +28 -23
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +7 -2
- package/dist/node-driver-worker.js.map +3 -3
- package/dist/node.js +29 -24
- package/dist/node.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,11 @@ function serveCdpPort(port, hook, request, onDone) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// src/bytes.ts
|
|
47
|
+
function fresh(bytes, start = 0, end = bytes.length) {
|
|
48
|
+
return new Uint8Array(bytes.subarray(start, end));
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
// src/client/dial-stream.ts
|
|
47
52
|
function errorWithCode(message) {
|
|
48
53
|
const code = /^E[A-Z]+/.exec(message)?.[0];
|
|
@@ -96,7 +101,7 @@ function dialStream(port, onClose) {
|
|
|
96
101
|
const writable = new WritableStream({
|
|
97
102
|
write(chunk) {
|
|
98
103
|
if (closed) throw errorWithCode("EPIPE: the connection is closed");
|
|
99
|
-
const copy = chunk
|
|
104
|
+
const copy = fresh(chunk);
|
|
100
105
|
const acked = new Promise((resolve, reject) => acks.push({ resolve, reject }));
|
|
101
106
|
port.postMessage(copy, [copy.buffer]);
|
|
102
107
|
return acked;
|
|
@@ -854,7 +859,7 @@ function serveTransport(peer, transport, { closeWaitMs = CLOSE_WAIT_MS } = {}) {
|
|
|
854
859
|
}
|
|
855
860
|
if (typeof data === "string") peer.postMessage({ net: "ws-message", nid, data });
|
|
856
861
|
else {
|
|
857
|
-
const bytes = data
|
|
862
|
+
const bytes = fresh(data);
|
|
858
863
|
peer.postMessage({ net: "ws-message", nid, data: bytes }, [bytes.buffer]);
|
|
859
864
|
}
|
|
860
865
|
flow.inflight += payloadSize(data);
|
|
@@ -892,7 +897,7 @@ function serveTransport(peer, transport, { closeWaitMs = CLOSE_WAIT_MS } = {}) {
|
|
|
892
897
|
open.delete(nid);
|
|
893
898
|
peer.postMessage({ net: "end", nid });
|
|
894
899
|
} else {
|
|
895
|
-
const bytes = next.value
|
|
900
|
+
const bytes = fresh(next.value);
|
|
896
901
|
peer.postMessage({ net: "chunk", nid, bytes }, [bytes.buffer]);
|
|
897
902
|
}
|
|
898
903
|
} catch (e) {
|