@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.
package/dist/index.js CHANGED
@@ -358,7 +358,8 @@ function bodyStream(id, state, post) {
358
358
  const next = state.body.shift();
359
359
  if (next) controller.enqueue(next);
360
360
  else controller.close();
361
- }
361
+ },
362
+ cancel: () => post({ id, bodyCancel: true })
362
363
  },
363
364
  { highWaterMark: 0 }
364
365
  );
@@ -379,14 +380,16 @@ function embedderAnswerer(port, hookFor) {
379
380
  throw Object.assign(new Error(`this page does not answer ${ask.kind}`), {
380
381
  name: "NotSupportedError"
381
382
  });
383
+ const body = bodyStream(ask.id, state, post);
382
384
  const reply = await hook.handle({
383
385
  kind: ask.kind,
384
386
  options: ask.options,
385
- body: bodyStream(ask.id, state, post),
387
+ body,
386
388
  stamp: ask.stamp,
387
389
  signal: state.abort.signal,
388
390
  progress: (line) => post({ id: ask.id, progress: String(line) })
389
391
  });
392
+ if (!(reply instanceof ReadableStream)) post({ id: ask.id, bodyCancel: true });
390
393
  state.reader = bytesOf(reply).getReader();
391
394
  post({ id: ask.id, ready: true });
392
395
  } catch (err) {