@ai-ecoverse/slicc-kernel 1.94.2 → 1.94.4

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.
@@ -4105,7 +4105,7 @@ var KERNEL_VERSION, OS_RELEASE;
4105
4105
  var init_version = __esm({
4106
4106
  "src/version.ts"() {
4107
4107
  "use strict";
4108
- KERNEL_VERSION = true ? "1.94.2" : "0.0.0-dev";
4108
+ KERNEL_VERSION = true ? "1.94.4" : "0.0.0-dev";
4109
4109
  OS_RELEASE = "6.0.0-slicc";
4110
4110
  }
4111
4111
  });
@@ -4164,7 +4164,8 @@ var init_js_kernel = __esm({
4164
4164
  "fd-read",
4165
4165
  "fd-write",
4166
4166
  "fd-close",
4167
- "fd-open-clipboard"
4167
+ "fd-open-clipboard",
4168
+ "net-ws-ready"
4168
4169
  ]);
4169
4170
  JsKernel = class {
4170
4171
  header;
@@ -5135,14 +5136,19 @@ function badPort(url) {
5135
5136
  const port3 = url.port ? Number(url.port) : 0;
5136
5137
  return port3 !== 0 && BAD_PORTS.has(port3);
5137
5138
  }
5138
- function rewrite(hop, status2, location) {
5139
- const next2 = new URL(location, hop.url);
5140
- if (next2.protocol !== "http:" && next2.protocol !== "https:") {
5141
- throw failed(new JsCallError("EPROTONOSUPPORT", next2.protocol));
5139
+ function checkUrl(url) {
5140
+ const parsed = new URL(url);
5141
+ const { protocol } = parsed;
5142
+ if (protocol !== "http:" && protocol !== "https:") {
5143
+ throw failed(new JsCallError("EPROTONOSUPPORT", protocol));
5142
5144
  }
5143
- if (badPort(next2)) {
5144
- throw failed(new JsCallError("EACCES", `bad port: ${next2.href}`));
5145
+ if (badPort(parsed) && !local2(url)) {
5146
+ throw failed(new JsCallError("EACCES", `bad port: ${url}`));
5145
5147
  }
5148
+ }
5149
+ function rewrite(hop, status2, location) {
5150
+ const next2 = new URL(location, hop.url);
5151
+ checkUrl(next2.href);
5146
5152
  if (local2(next2.href) && !local2(hop.url)) {
5147
5153
  const from = new URL(hop.url).origin;
5148
5154
  throw failed(
@@ -5368,7 +5374,7 @@ function fetchOp(kernel) {
5368
5374
  } catch (err) {
5369
5375
  settle();
5370
5376
  await close(handle);
5371
- throw signal.aborted ? signal.reason : failed(err);
5377
+ throw signal.aborted ? signal.reason : new TypeError("terminated", { cause: err });
5372
5378
  }
5373
5379
  const bytes = r.ok && r.kind === "bytes" ? r.bytes : new Uint8Array(0);
5374
5380
  if (bytes.length > 0) {
@@ -5402,7 +5408,6 @@ function fetchOp(kernel) {
5402
5408
  stream = stream.pipeThrough(
5403
5409
  new DecompressionStream(format)
5404
5410
  );
5405
- headers.delete("content-encoding");
5406
5411
  headers.delete("content-length");
5407
5412
  }
5408
5413
  const response = new Response(stream, {
@@ -5425,12 +5430,7 @@ function fetchOp(kernel) {
5425
5430
  signal.throwIfAborted();
5426
5431
  const { protocol } = new URL(request.url);
5427
5432
  if (protocol === "data:") return dataResponse(request);
5428
- if (protocol !== "http:" && protocol !== "https:") {
5429
- throw failed(new JsCallError("EPROTONOSUPPORT", protocol));
5430
- }
5431
- if (badPort(new URL(request.url))) {
5432
- throw failed(new JsCallError("EACCES", `bad port: ${request.url}`));
5433
- }
5433
+ checkUrl(request.url);
5434
5434
  let known = await traitsAt(request.url);
5435
5435
  if (!known.manualRedirects && request.redirect !== "follow") {
5436
5436
  throw failed(new JsCallError("ENOTSUP", `redirect: ${request.redirect}`));
@@ -5455,7 +5455,8 @@ function fetchOp(kernel) {
5455
5455
  return respond(head, hop.method, redirected, known.encodedBodies, signal);
5456
5456
  }
5457
5457
  await close(head.handle);
5458
- if (request.redirect === "error") throw failed(new JsCallError("EREDIRECT", hop.url));
5458
+ if (request.redirect === "error")
5459
+ throw failed(new JsCallError("EREDIRECT", "unexpected redirect"));
5459
5460
  if (hops >= MAX_REDIRECTS) throw failed(new JsCallError("ELOOP", hop.url));
5460
5461
  [hop, known] = await redirect(hop, head.status, location, known);
5461
5462
  }