@moxt-ai/mobius 0.0.11 → 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/config.js CHANGED
@@ -23,7 +23,7 @@ export function loadDaemonConfig() {
23
23
  const relayUrl = new URL(
24
24
  // biome-ignore lint/complexity/useLiteralKeys: Environment variables use an index signature.
25
25
  process.env["MOBIUS_RELAY_URL"] ??
26
- "ws://127.0.0.1:8787/api/channels/local/daemon");
26
+ "ws://127.0.0.1:8787/mobius/api/channels/local/daemon");
27
27
  relayUrl.searchParams.set("token",
28
28
  // biome-ignore lint/complexity/useLiteralKeys: Environment variables use an index signature.
29
29
  process.env["MOBIUS_RELAY_TOKEN"] ?? "local-development-token");
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAEL,iBAAiB,GAElB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,UAAU,oBAAoB;IAClC,MAAM,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACtE,OAAO,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE,WAAW,CAAC,CAAC;AACxE,CAAC;AAoBD,MAAM,UAAU,kBAAkB,CAChC,UAAkC,EAClC,MAAM,GAAoC,EAAE,EAC5C,iBAAiB,GAA0C,EAAE;IAE7D,OAAO;QACL,MAAM;QACN,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;QAC7C,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;QAC/C,SAAS,EAAE,WAAW;QACtB,OAAO,EA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CAAC;YACpC,aAAa,CACX,IAAI,GAAG,CAAC,gCAAgC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAC3D;QACH,6FAA6F;QAC7F,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,OAAO;QACtD,QAAQ;KACT,EACD,EAAE,EACF,EAAE,CACH,CAAC;AACJ,CAAC"}
package/dist/index.js CHANGED
@@ -628,7 +628,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = []) {
628
628
  function loadDaemonConfig() {
629
629
  const relayUrl = new URL(
630
630
  // biome-ignore lint/complexity/useLiteralKeys: Environment variables use an index signature.
631
- process.env["MOBIUS_RELAY_URL"] ?? "ws://127.0.0.1:8787/api/channels/local/daemon"
631
+ process.env["MOBIUS_RELAY_URL"] ?? "ws://127.0.0.1:8787/mobius/api/channels/local/daemon"
632
632
  );
633
633
  relayUrl.searchParams.set(
634
634
  "token",
@@ -26370,7 +26370,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
26370
26370
  id: agent.id,
26371
26371
  label: agent.label
26372
26372
  }));
26373
- const endpoint = new URL("/api/pairings/claim", options.relayOrigin);
26373
+ const endpoint = new URL("/mobius/api/pairings/claim", options.relayOrigin);
26374
26374
  let response;
26375
26375
  try {
26376
26376
  response = await fetch2(endpoint, {
@@ -26507,7 +26507,7 @@ function assertInventoryUsable(inventory) {
26507
26507
  function buildPairedDaemon(connection, connectionPath, inventory) {
26508
26508
  assertInventoryUsable(inventory);
26509
26509
  const relayUrl = new URL(
26510
- `/api/channels/${encodeURIComponent(connection.channelId)}/daemon`,
26510
+ `/mobius/api/channels/${encodeURIComponent(connection.channelId)}/daemon`,
26511
26511
  connection.relayOrigin
26512
26512
  );
26513
26513
  relayUrl.protocol = relayUrl.protocol === "https:" ? "wss:" : "ws:";
@@ -26587,6 +26587,7 @@ async function resumeLocalMachine(arguments_, signal = new AbortController().sig
26587
26587
 
26588
26588
  // src/run-daemon.ts
26589
26589
  import { basename as basename3 } from "node:path";
26590
+ import { styleText } from "node:util";
26590
26591
  import { WebSocket as WebSocket2 } from "undici";
26591
26592
 
26592
26593
  // src/agent-catalog/publish-agent-catalog.ts
@@ -29550,10 +29551,33 @@ function waitForRelayRetry(signal, timer) {
29550
29551
  signal.addEventListener("abort", finish, { once: true });
29551
29552
  });
29552
29553
  }
29553
- async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, signal, timer) {
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
+ }
29576
+ async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, onConnected, signal, timer) {
29554
29577
  const relayUrl = new URL(config2.relayUrl);
29555
29578
  relayUrl.searchParams.set("liveness", "1");
29556
29579
  const socket = await connectRelay(relayUrl, signal);
29580
+ onConnected();
29557
29581
  const activeTurns = /* @__PURE__ */ new Map();
29558
29582
  const activeAttemptIds = /* @__PURE__ */ new Map();
29559
29583
  const connectionController = new AbortController();
@@ -29988,10 +30012,32 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
29988
30012
  installationAudit
29989
30013
  );
29990
30014
  let retryAnnounced = false;
30015
+ let connectionAnnounced = false;
30016
+ const announceConnection = () => {
30017
+ if (connectionAnnounced) {
30018
+ return;
30019
+ }
30020
+ connectionAnnounced = true;
30021
+ const reconnectCommand = `npx --yes @moxt-ai/mobius start --channel ${config2.channelId}`;
30022
+ process.stdout.write("Mobius daemon connected to the relay.\n\n");
30023
+ process.stdout.write(
30024
+ `${styleText(
30025
+ ["bold", "yellow"],
30026
+ `Reconnect this channel later:
30027
+ ${reconnectCommand}`
30028
+ )}
30029
+
30030
+ `
30031
+ );
30032
+ };
30033
+ const catalogPublication = publishAgentCatalogUntilAvailable(
30034
+ config2,
30035
+ signal,
30036
+ timer
30037
+ );
29991
30038
  try {
29992
30039
  while (!signal.aborted) {
29993
30040
  try {
29994
- await publishAgentCatalog(config2, signal);
29995
30041
  await runRelayConnection(
29996
30042
  config2,
29997
30043
  directories,
@@ -30001,6 +30047,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30001
30047
  installationObserver,
30002
30048
  nativeSessions,
30003
30049
  outbox,
30050
+ announceConnection,
30004
30051
  signal,
30005
30052
  timer
30006
30053
  );
@@ -30018,15 +30065,19 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
30018
30065
  }
30019
30066
  } finally {
30020
30067
  try {
30021
- await installations.close();
30068
+ await catalogPublication;
30022
30069
  } finally {
30023
30070
  try {
30024
- await sessions.close();
30071
+ await installations.close();
30025
30072
  } finally {
30026
30073
  try {
30027
- sessionStore.close();
30074
+ await sessions.close();
30028
30075
  } finally {
30029
- outbox.close();
30076
+ try {
30077
+ sessionStore.close();
30078
+ } finally {
30079
+ outbox.close();
30080
+ }
30030
30081
  }
30031
30082
  }
30032
30083
  }