@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/cli.js +59 -8
- package/dist/cli.js.map +2 -2
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +60 -9
- package/dist/index.js.map +2 -2
- package/dist/pairing/pair-local-machine.js +2 -2
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +48 -7
- package/dist/run-daemon.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2977,7 +2977,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
|
|
|
2977
2977
|
id: agent.id,
|
|
2978
2978
|
label: agent.label
|
|
2979
2979
|
}));
|
|
2980
|
-
const endpoint = new URL("/api/pairings/claim", options.relayOrigin);
|
|
2980
|
+
const endpoint = new URL("/mobius/api/pairings/claim", options.relayOrigin);
|
|
2981
2981
|
let response;
|
|
2982
2982
|
try {
|
|
2983
2983
|
response = await fetch2(endpoint, {
|
|
@@ -3114,7 +3114,7 @@ function assertInventoryUsable(inventory) {
|
|
|
3114
3114
|
function buildPairedDaemon(connection, connectionPath, inventory) {
|
|
3115
3115
|
assertInventoryUsable(inventory);
|
|
3116
3116
|
const relayUrl = new URL(
|
|
3117
|
-
`/api/channels/${encodeURIComponent(connection.channelId)}/daemon`,
|
|
3117
|
+
`/mobius/api/channels/${encodeURIComponent(connection.channelId)}/daemon`,
|
|
3118
3118
|
connection.relayOrigin
|
|
3119
3119
|
);
|
|
3120
3120
|
relayUrl.protocol = relayUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
@@ -3194,6 +3194,7 @@ async function resumeLocalMachine(arguments_, signal = new AbortController().sig
|
|
|
3194
3194
|
|
|
3195
3195
|
// src/run-daemon.ts
|
|
3196
3196
|
import { basename as basename3 } from "node:path";
|
|
3197
|
+
import { styleText } from "node:util";
|
|
3197
3198
|
|
|
3198
3199
|
// ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/external.js
|
|
3199
3200
|
var external_exports = {};
|
|
@@ -29569,10 +29570,33 @@ function waitForRelayRetry(signal, timer) {
|
|
|
29569
29570
|
signal.addEventListener("abort", finish, { once: true });
|
|
29570
29571
|
});
|
|
29571
29572
|
}
|
|
29572
|
-
async function
|
|
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
|
+
}
|
|
29595
|
+
async function runRelayConnection(config2, directories, audit, sessions, installations, installationObserver, nativeSessions, outbox, onConnected, signal, timer) {
|
|
29573
29596
|
const relayUrl = new URL(config2.relayUrl);
|
|
29574
29597
|
relayUrl.searchParams.set("liveness", "1");
|
|
29575
29598
|
const socket = await connectRelay(relayUrl, signal);
|
|
29599
|
+
onConnected();
|
|
29576
29600
|
const activeTurns = /* @__PURE__ */ new Map();
|
|
29577
29601
|
const activeAttemptIds = /* @__PURE__ */ new Map();
|
|
29578
29602
|
const connectionController = new AbortController();
|
|
@@ -30007,10 +30031,32 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
30007
30031
|
installationAudit
|
|
30008
30032
|
);
|
|
30009
30033
|
let retryAnnounced = false;
|
|
30034
|
+
let connectionAnnounced = false;
|
|
30035
|
+
const announceConnection = () => {
|
|
30036
|
+
if (connectionAnnounced) {
|
|
30037
|
+
return;
|
|
30038
|
+
}
|
|
30039
|
+
connectionAnnounced = true;
|
|
30040
|
+
const reconnectCommand = `npx --yes @moxt-ai/mobius start --channel ${config2.channelId}`;
|
|
30041
|
+
process.stdout.write("Mobius daemon connected to the relay.\n\n");
|
|
30042
|
+
process.stdout.write(
|
|
30043
|
+
`${styleText(
|
|
30044
|
+
["bold", "yellow"],
|
|
30045
|
+
`Reconnect this channel later:
|
|
30046
|
+
${reconnectCommand}`
|
|
30047
|
+
)}
|
|
30048
|
+
|
|
30049
|
+
`
|
|
30050
|
+
);
|
|
30051
|
+
};
|
|
30052
|
+
const catalogPublication = publishAgentCatalogUntilAvailable(
|
|
30053
|
+
config2,
|
|
30054
|
+
signal,
|
|
30055
|
+
timer
|
|
30056
|
+
);
|
|
30010
30057
|
try {
|
|
30011
30058
|
while (!signal.aborted) {
|
|
30012
30059
|
try {
|
|
30013
|
-
await publishAgentCatalog(config2, signal);
|
|
30014
30060
|
await runRelayConnection(
|
|
30015
30061
|
config2,
|
|
30016
30062
|
directories,
|
|
@@ -30020,6 +30066,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
30020
30066
|
installationObserver,
|
|
30021
30067
|
nativeSessions,
|
|
30022
30068
|
outbox,
|
|
30069
|
+
announceConnection,
|
|
30023
30070
|
signal,
|
|
30024
30071
|
timer
|
|
30025
30072
|
);
|
|
@@ -30037,15 +30084,19 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer) {
|
|
|
30037
30084
|
}
|
|
30038
30085
|
} finally {
|
|
30039
30086
|
try {
|
|
30040
|
-
await
|
|
30087
|
+
await catalogPublication;
|
|
30041
30088
|
} finally {
|
|
30042
30089
|
try {
|
|
30043
|
-
await
|
|
30090
|
+
await installations.close();
|
|
30044
30091
|
} finally {
|
|
30045
30092
|
try {
|
|
30046
|
-
|
|
30093
|
+
await sessions.close();
|
|
30047
30094
|
} finally {
|
|
30048
|
-
|
|
30095
|
+
try {
|
|
30096
|
+
sessionStore.close();
|
|
30097
|
+
} finally {
|
|
30098
|
+
outbox.close();
|
|
30099
|
+
}
|
|
30049
30100
|
}
|
|
30050
30101
|
}
|
|
30051
30102
|
}
|