@moxt-ai/mobius 0.0.91 → 0.0.92

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
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.91",
3384
+ version: "0.0.92",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -48800,22 +48800,22 @@ async function waitForManagerExit(stateDirectory, signal) {
48800
48800
  const deadline = AbortSignal.any([signal, AbortSignal.timeout(1e4)]);
48801
48801
  while (!deadline.aborted) {
48802
48802
  try {
48803
- await sendControlRequest(stateDirectory, { kind: "list" }, AbortSignal.timeout(200));
48803
+ await readFile3(join18(stateDirectory, "manager.lock"), "utf8");
48804
48804
  } catch (cause) {
48805
- if (isNodeError2(cause, "ENOENT") || isNodeError2(cause, "ECONNREFUSED")) {
48805
+ if (isNodeError2(cause, "ENOENT")) {
48806
48806
  return;
48807
48807
  }
48808
+ throw cause;
48808
48809
  }
48809
48810
  await new Promise((resolve8, reject) => {
48810
- const timeout = setTimeout(resolve8, 20);
48811
- deadline.addEventListener(
48812
- "abort",
48813
- () => {
48814
- clearTimeout(timeout);
48815
- reject(deadline.reason);
48816
- },
48817
- { once: true }
48818
- );
48811
+ const timeout = setTimeout(finish, 20);
48812
+ const abort = () => finish(deadline.reason);
48813
+ function finish(cause) {
48814
+ clearTimeout(timeout);
48815
+ deadline.removeEventListener("abort", abort);
48816
+ cause === void 0 ? resolve8() : reject(cause);
48817
+ }
48818
+ deadline.addEventListener("abort", abort, { once: true });
48819
48819
  });
48820
48820
  }
48821
48821
  throw deadline.reason;
@@ -48909,6 +48909,7 @@ async function runManager(installation, managerVersion, signal) {
48909
48909
  const shutdown2 = new AbortController();
48910
48910
  const combined = AbortSignal.any([signal, shutdown2.signal]);
48911
48911
  const supervisor = new RuntimeSupervisor(installation);
48912
+ const sockets = /* @__PURE__ */ new Set();
48912
48913
  try {
48913
48914
  await supervisor.restore(combined);
48914
48915
  } catch (cause) {
@@ -48917,6 +48918,8 @@ async function runManager(installation, managerVersion, signal) {
48917
48918
  `);
48918
48919
  }
48919
48920
  const server = createServer((socket) => {
48921
+ sockets.add(socket);
48922
+ socket.once("close", () => sockets.delete(socket));
48920
48923
  void (async () => {
48921
48924
  try {
48922
48925
  const request = decodeCommand(await readSocketMessage(socket, combined), token);
@@ -48940,8 +48943,12 @@ async function runManager(installation, managerVersion, signal) {
48940
48943
  kind: "pair-removed"
48941
48944
  };
48942
48945
  } else {
48943
- response = { kind: "stopped" };
48944
- shutdown2.abort();
48946
+ const beginShutdown = () => shutdown2.abort();
48947
+ socket.once("close", beginShutdown);
48948
+ socket.once("error", beginShutdown);
48949
+ socket.end(`${JSON.stringify({ kind: "stopped" })}
48950
+ `, beginShutdown);
48951
+ return;
48945
48952
  }
48946
48953
  socket.end(`${JSON.stringify(response)}
48947
48954
  `);
@@ -48970,7 +48977,11 @@ async function runManager(installation, managerVersion, signal) {
48970
48977
  }
48971
48978
  try {
48972
48979
  await new Promise((resolve8) => combined.addEventListener("abort", () => resolve8(), { once: true }));
48973
- await new Promise((resolve8) => server.close(() => resolve8()));
48980
+ const serverClosed = new Promise((resolve8) => server.close(() => resolve8()));
48981
+ for (const socket of sockets) {
48982
+ socket.destroy();
48983
+ }
48984
+ await serverClosed;
48974
48985
  await supervisor.close();
48975
48986
  } finally {
48976
48987
  if (process.platform !== "win32") {