@ai-ecoverse/slicc-kernel 1.169.0 → 1.170.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/dist/index.js CHANGED
@@ -1221,7 +1221,8 @@ function fetchTransport(options = {}) {
1221
1221
  `fetch ${request.url} failed (unreachable, or not allowed by CORS)${options.hint ? `: ${options.hint}` : ""}`
1222
1222
  ),
1223
1223
  { status: 502 },
1224
- dns ? { code: causeCode } : {}
1224
+ dns ? { code: causeCode } : {},
1225
+ typeof causeCode === "string" ? {} : { detail: "transport" }
1225
1226
  );
1226
1227
  }
1227
1228
  const headers2 = [];
@@ -1270,13 +1271,14 @@ function serveTransport(peer, transport, { closeWaitMs = CLOSE_WAIT_MS } = {}) {
1270
1271
  const open = /* @__PURE__ */ new Map();
1271
1272
  const fail = (nid, e) => {
1272
1273
  open.delete(nid);
1273
- const { status, code } = e;
1274
+ const { status, code, detail } = e;
1274
1275
  peer.postMessage({
1275
1276
  net: "error",
1276
1277
  nid,
1277
1278
  message: e instanceof Error ? e.message : String(e),
1278
1279
  ...typeof status === "number" ? { status } : {},
1279
- ...typeof code === "string" ? { code } : {}
1280
+ ...typeof code === "string" ? { code } : {},
1281
+ ...detail === "transport" ? { detail } : {}
1280
1282
  });
1281
1283
  };
1282
1284
  const uploads = uploadsFor(peer);
@@ -1451,10 +1453,12 @@ function serveTransport(peer, transport, { closeWaitMs = CLOSE_WAIT_MS } = {}) {
1451
1453
  var TransportError = class extends Error {
1452
1454
  status;
1453
1455
  code;
1454
- constructor(message, status, code) {
1456
+ detail;
1457
+ constructor(message, status, code, detail) {
1455
1458
  super(message);
1456
1459
  this.status = status;
1457
1460
  this.code = code;
1461
+ this.detail = detail === "transport" ? detail : void 0;
1458
1462
  }
1459
1463
  };
1460
1464
  var RemoteTransport = class {
@@ -1480,7 +1484,7 @@ var RemoteTransport = class {
1480
1484
  if (!waiter) return;
1481
1485
  this.waiting.delete(reply.nid);
1482
1486
  if (reply.net === "error") {
1483
- waiter.reject(new TransportError(reply.message, reply.status, reply.code));
1487
+ waiter.reject(new TransportError(reply.message, reply.status, reply.code, reply.detail));
1484
1488
  } else waiter.resolve(reply);
1485
1489
  }
1486
1490
  toSocket(reply, socket) {