@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/cli.js CHANGED
@@ -29570,6 +29570,28 @@ function waitForRelayRetry(signal, timer) {
29570
29570
  signal.addEventListener("abort", finish, { once: true });
29571
29571
  });
29572
29572
  }
29573
+ async function publishAgentCatalogUntilAvailable(config2, signal, timer) {
29574
+ try {
29575
+ await publishAgentCatalog(config2, signal);
29576
+ return;
29577
+ } catch {
29578
+ if (signal.aborted) {
29579
+ return;
29580
+ }
29581
+ console.warn("Mobius daemon is waiting to publish its Agent catalog");
29582
+ }
29583
+ while (!signal.aborted) {
29584
+ await waitForRelayRetry(signal, timer);
29585
+ try {
29586
+ await publishAgentCatalog(config2, signal);
29587
+ return;
29588
+ } catch {
29589
+ if (signal.aborted) {
29590
+ return;
29591
+ }
29592
+ }
29593
+ }
29594
+ }
29573
29595
  async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, onConnected, signal, timer) {
29574
29596
  const relayUrl = new URL(config2.relayUrl);
29575
29597
  relayUrl.searchParams.set("liveness", "1");
@@ -30027,10 +30049,14 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30027
30049
  `
30028
30050
  );
30029
30051
  };
30052
+ const catalogPublication = publishAgentCatalogUntilAvailable(
30053
+ config2,
30054
+ signal,
30055
+ timer
30056
+ );
30030
30057
  try {
30031
30058
  while (!signal.aborted) {
30032
30059
  try {
30033
- await publishAgentCatalog(config2, signal);
30034
30060
  await runRelayConnection(
30035
30061
  config2,
30036
30062
  directories,
@@ -30058,15 +30084,19 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30058
30084
  }
30059
30085
  } finally {
30060
30086
  try {
30061
- await installations.close();
30087
+ await catalogPublication;
30062
30088
  } finally {
30063
30089
  try {
30064
- await sessions.close();
30090
+ await installations.close();
30065
30091
  } finally {
30066
30092
  try {
30067
- sessionStore.close();
30093
+ await sessions.close();
30068
30094
  } finally {
30069
- outbox.close();
30095
+ try {
30096
+ sessionStore.close();
30097
+ } finally {
30098
+ outbox.close();
30099
+ }
30070
30100
  }
30071
30101
  }
30072
30102
  }