@moxt-ai/mobius 0.0.12 → 0.0.13

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
@@ -29551,6 +29551,28 @@ function waitForRelayRetry(signal, timer) {
29551
29551
  signal.addEventListener("abort", finish, { once: true });
29552
29552
  });
29553
29553
  }
29554
+ async function publishAgentCatalogUntilAvailable(config2, signal, timer) {
29555
+ try {
29556
+ await publishAgentCatalog(config2, signal);
29557
+ return;
29558
+ } catch {
29559
+ if (signal.aborted) {
29560
+ return;
29561
+ }
29562
+ console.warn("Mobius daemon is waiting to publish its Agent catalog");
29563
+ }
29564
+ while (!signal.aborted) {
29565
+ await waitForRelayRetry(signal, timer);
29566
+ try {
29567
+ await publishAgentCatalog(config2, signal);
29568
+ return;
29569
+ } catch {
29570
+ if (signal.aborted) {
29571
+ return;
29572
+ }
29573
+ }
29574
+ }
29575
+ }
29554
29576
  async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, onConnected, signal, timer) {
29555
29577
  const relayUrl = new URL(config2.relayUrl);
29556
29578
  relayUrl.searchParams.set("liveness", "1");
@@ -30008,10 +30030,14 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30008
30030
  `
30009
30031
  );
30010
30032
  };
30033
+ const catalogPublication = publishAgentCatalogUntilAvailable(
30034
+ config2,
30035
+ signal,
30036
+ timer
30037
+ );
30011
30038
  try {
30012
30039
  while (!signal.aborted) {
30013
30040
  try {
30014
- await publishAgentCatalog(config2, signal);
30015
30041
  await runRelayConnection(
30016
30042
  config2,
30017
30043
  directories,
@@ -30039,15 +30065,19 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30039
30065
  }
30040
30066
  } finally {
30041
30067
  try {
30042
- await installations.close();
30068
+ await catalogPublication;
30043
30069
  } finally {
30044
30070
  try {
30045
- await sessions.close();
30071
+ await installations.close();
30046
30072
  } finally {
30047
30073
  try {
30048
- sessionStore.close();
30074
+ await sessions.close();
30049
30075
  } finally {
30050
- outbox.close();
30076
+ try {
30077
+ sessionStore.close();
30078
+ } finally {
30079
+ outbox.close();
30080
+ }
30051
30081
  }
30052
30082
  }
30053
30083
  }