@ai-ecoverse/slicc-kernel 1.154.2 → 1.154.3

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.
@@ -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 };
@@ -8089,7 +8090,7 @@ function satisfies(version, range2) {
8089
8090
  }
8090
8091
 
8091
8092
  // src/version.ts
8092
- var KERNEL_VERSION = true ? "1.154.2" : "0.0.0-dev";
8093
+ var KERNEL_VERSION = true ? "1.154.3" : "0.0.0-dev";
8093
8094
  var OS_RELEASE = "6.0.0-slicc";
8094
8095
  function procVersion() {
8095
8096
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -11914,6 +11915,7 @@ var BodyPipe = class {
11914
11915
  queue = [];
11915
11916
  size = 0;
11916
11917
  ended = false;
11918
+ dropped = false;
11917
11919
  wake;
11918
11920
  room;
11919
11921
  stream;
@@ -11932,7 +11934,8 @@ var BodyPipe = class {
11932
11934
  this.room?.();
11933
11935
  controller.enqueue(next3);
11934
11936
  } else controller.close();
11935
- }
11937
+ },
11938
+ cancel: () => this.drop()
11936
11939
  },
11937
11940
  { highWaterMark: 0 }
11938
11941
  );
@@ -11940,8 +11943,14 @@ var BodyPipe = class {
11940
11943
  get full() {
11941
11944
  return this.size >= EMBEDDER_WINDOW;
11942
11945
  }
11946
+ drop() {
11947
+ this.dropped = true;
11948
+ this.queue = [];
11949
+ this.size = 0;
11950
+ this.end();
11951
+ }
11943
11952
  push(bytes) {
11944
- if (bytes.length === 0) return;
11953
+ if (bytes.length === 0 || this.dropped) return;
11945
11954
  this.queue.push(bytes.slice());
11946
11955
  this.size += bytes.length;
11947
11956
  this.wake?.();
@@ -11957,6 +11966,30 @@ var BodyPipe = class {
11957
11966
  this.room?.();
11958
11967
  }
11959
11968
  };
11969
+ function endsWith(stream, ended) {
11970
+ const reader = stream.getReader();
11971
+ return new ReadableStream(
11972
+ {
11973
+ pull: async (controller) => {
11974
+ let got;
11975
+ try {
11976
+ got = await reader.read();
11977
+ } catch (err) {
11978
+ ended();
11979
+ throw err;
11980
+ }
11981
+ if (!got.done) return controller.enqueue(got.value);
11982
+ ended();
11983
+ controller.close();
11984
+ },
11985
+ cancel: (reason) => {
11986
+ ended();
11987
+ return reader.cancel(reason);
11988
+ }
11989
+ },
11990
+ { highWaterMark: 0 }
11991
+ );
11992
+ }
11960
11993
  function replyStream(reply) {
11961
11994
  if (reply instanceof ReadableStream) return reply;
11962
11995
  const bytes = typeof reply === "string" ? new TextEncoder().encode(reply) : reply instanceof Uint8Array ? reply : new Uint8Array(0);
@@ -12031,7 +12064,10 @@ var EmbedderChannel = class {
12031
12064
  signal: this.abort.signal,
12032
12065
  progress
12033
12066
  })
12034
- ).then((reply) => replyStream(reply).getReader());
12067
+ ).then((reply) => {
12068
+ if (!(reply instanceof ReadableStream)) body.drop();
12069
+ return endsWith(replyStream(reply), () => body.drop()).getReader();
12070
+ });
12035
12071
  this.replied = asked.catch((err) => {
12036
12072
  body.end();
12037
12073
  throw this.fail(err);