@ai-ecoverse/slicc-kernel 1.52.0 → 1.53.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.
@@ -11604,7 +11604,13 @@ function keepWatching(loop, signal) {
11604
11604
  function invalidation(event) {
11605
11605
  return event.paths ?? true;
11606
11606
  }
11607
- async function openHostfs(spec, hook, fetch2, timing = {}) {
11607
+ function grantConnect(hook, fetch2) {
11608
+ return async (source, options) => {
11609
+ const grant = () => hook(source, options);
11610
+ return new HostfsClient(await grant(), grant, fetch2);
11611
+ };
11612
+ }
11613
+ async function openHostfs(spec, connect, timing = {}) {
11608
11614
  const readonly2 = spec.options?.ro !== void 0;
11609
11615
  const { port1, port2 } = new MessageChannel();
11610
11616
  const slot = mediumSlot(
@@ -11612,7 +11618,6 @@ async function openHostfs(spec, hook, fetch2, timing = {}) {
11612
11618
  () => watching.kick()
11613
11619
  );
11614
11620
  const stop = new AbortController();
11615
- const grant = () => hook(spec.source, { readonly: readonly2 });
11616
11621
  let active;
11617
11622
  const handlers = hostfsHandlers(() => active);
11618
11623
  const ranged2 = () => active?.capabilities.ranges === true ? { ranges: true } : {};
@@ -11629,7 +11634,7 @@ async function openHostfs(spec, hook, fetch2, timing = {}) {
11629
11634
  );
11630
11635
  const watching = keepWatching(
11631
11636
  {
11632
- connect: async () => new HostfsClient(await grant(), grant, fetch2),
11637
+ connect: () => connect(spec.source, { readonly: readonly2 }),
11633
11638
  up(client) {
11634
11639
  active = client;
11635
11640
  slot.insert(client, handlers);
@@ -12648,8 +12653,7 @@ var Launcher = class {
12648
12653
  throw fsError("ENODEV", "this kernel has no hostfs hook (createKernel({ hostfs }))");
12649
12654
  return openHostfs(
12650
12655
  spec,
12651
- hostfs,
12652
- hostfsFetch ?? ((url, init) => fetch(url, init)),
12656
+ grantConnect(hostfs, hostfsFetch ?? ((url, init) => fetch(url, init))),
12653
12657
  hostfsTiming
12654
12658
  );
12655
12659
  }