@ipab/cli 0.1.0-rc.8 → 0.1.0-rc.9

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/swarm.js CHANGED
@@ -920,6 +920,7 @@ async function privateSource(context, record, signal, candidates) {
920
920
  export async function swarmDaemon(context, selected, signal) {
921
921
  const lock = await privateDirectory(context.stateDir, "swarm-daemon");
922
922
  await withPrivateLock(lock, async () => {
923
+ const closeReadiness = await context.daemonReady?.();
923
924
  const sessions = new Map();
924
925
  context.diagnostic?.("IPAB daemon running in foreground; Ctrl-C stops management and leaves Kubo running.");
925
926
  const persist = async (url, session, running) => {
@@ -1101,8 +1102,13 @@ export async function swarmDaemon(context, selected, signal) {
1101
1102
  }
1102
1103
  }
1103
1104
  finally {
1104
- for (const [url, session] of sessions)
1105
- await persist(url, session, false);
1105
+ try {
1106
+ for (const [url, session] of sessions)
1107
+ await persist(url, session, false);
1108
+ }
1109
+ finally {
1110
+ await closeReadiness?.();
1111
+ }
1106
1112
  }
1107
1113
  }, signal, 1);
1108
1114
  }
@@ -1117,6 +1123,7 @@ async function activate(context, record) {
1117
1123
  context.sourcePeers = peers;
1118
1124
  }
1119
1125
  context.node = node;
1126
+ await context.ensureDaemon?.();
1120
1127
  }
1121
1128
  async function localForRead(context, configUrl) {
1122
1129
  const record = await local(context, configUrl);
@@ -1695,7 +1702,9 @@ async function lazyPrivateSource(context, url, account, basis) {
1695
1702
  record.config.epoch !== basis.epoch ||
1696
1703
  record.config.headId !== basis.headId)
1697
1704
  throw new HostError("Swarm membership changed since this cached HEAD; retry with --refresh.");
1698
- return (await privateSource(scoped, record, signal)).source;
1705
+ const { source } = await privateSource(scoped, record, signal);
1706
+ await context.ensureDaemon?.();
1707
+ return source;
1699
1708
  };
1700
1709
  // Same lock order as Owner rotation: credentials first, then the node.
1701
1710
  return withPrivateLock(await directory(scoped), authorize, signal);