@moxt-ai/mobius 0.0.1 → 0.0.2
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 +15 -3
- package/dist/cli.js.map +4 -4
- package/dist/index.js +15 -3
- package/dist/index.js.map +4 -4
- package/dist/network/environment-proxy.d.ts +3 -0
- package/dist/network/environment-proxy.d.ts.map +1 -0
- package/dist/network/environment-proxy.js +3 -0
- package/dist/network/environment-proxy.js.map +1 -0
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js +3 -0
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/relay-connection/connect.d.ts +1 -0
- package/dist/relay-connection/connect.d.ts.map +1 -1
- package/dist/relay-connection/connect.js +5 -1
- package/dist/relay-connection/connect.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +1 -0
- package/dist/run-daemon.js.map +1 -1
- package/package.json +16 -4
package/dist/cli.js
CHANGED
|
@@ -53,6 +53,7 @@ import {
|
|
|
53
53
|
} from "node:fs/promises";
|
|
54
54
|
import { homedir, hostname } from "node:os";
|
|
55
55
|
import { basename, join, resolve } from "node:path";
|
|
56
|
+
import { fetch } from "undici";
|
|
56
57
|
|
|
57
58
|
// src/config.ts
|
|
58
59
|
import { fileURLToPath } from "node:url";
|
|
@@ -116,6 +117,10 @@ function findLocalAgent(agents, agentId) {
|
|
|
116
117
|
throw new Error("The requested local agent is not approved");
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
// src/network/environment-proxy.ts
|
|
121
|
+
import { EnvHttpProxyAgent } from "undici";
|
|
122
|
+
var environmentProxyDispatcher = new EnvHttpProxyAgent();
|
|
123
|
+
|
|
119
124
|
// src/pairing/pair-local-machine.ts
|
|
120
125
|
var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
|
|
121
126
|
var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
|
|
@@ -336,6 +341,7 @@ async function claimPairing(options, approvedRoot) {
|
|
|
336
341
|
pairingCode: options.code,
|
|
337
342
|
workspaceName: basename(approvedRoot) || "Local workspace"
|
|
338
343
|
}),
|
|
344
|
+
dispatcher: environmentProxyDispatcher,
|
|
339
345
|
headers: { "content-type": "application/json" },
|
|
340
346
|
method: "POST",
|
|
341
347
|
signal: AbortSignal.timeout(PAIRING_TIMEOUT_MILLISECONDS)
|
|
@@ -641,6 +647,9 @@ function encodeSessionFailedEvent(message) {
|
|
|
641
647
|
return JSON.stringify(message);
|
|
642
648
|
}
|
|
643
649
|
|
|
650
|
+
// src/run-daemon.ts
|
|
651
|
+
import { WebSocket as WebSocket2 } from "undici";
|
|
652
|
+
|
|
644
653
|
// src/acp/session-manager.ts
|
|
645
654
|
import { spawn } from "node:child_process";
|
|
646
655
|
import { once } from "node:events";
|
|
@@ -1342,6 +1351,7 @@ async function authorizeBinding(requestedBindingId, approvedBindingId, approvedR
|
|
|
1342
1351
|
}
|
|
1343
1352
|
|
|
1344
1353
|
// src/relay-connection/connect.ts
|
|
1354
|
+
import { WebSocket } from "undici";
|
|
1345
1355
|
var CONNECTION_TIMEOUT_MILLISECONDS = 15e3;
|
|
1346
1356
|
var RelayConnectionError = class extends Error {
|
|
1347
1357
|
code;
|
|
@@ -1354,7 +1364,9 @@ var RelayConnectionError = class extends Error {
|
|
|
1354
1364
|
function connectRelay(url, signal) {
|
|
1355
1365
|
signal.throwIfAborted();
|
|
1356
1366
|
return new Promise((resolve2, reject) => {
|
|
1357
|
-
const socket = new WebSocket(url
|
|
1367
|
+
const socket = new WebSocket(url, {
|
|
1368
|
+
dispatcher: environmentProxyDispatcher
|
|
1369
|
+
});
|
|
1358
1370
|
let finished = false;
|
|
1359
1371
|
const timeout = setTimeout(onTimeout, CONNECTION_TIMEOUT_MILLISECONDS);
|
|
1360
1372
|
const cleanup = () => {
|
|
@@ -1450,13 +1462,13 @@ var ActiveDaemonTurn = class {
|
|
|
1450
1462
|
}
|
|
1451
1463
|
};
|
|
1452
1464
|
function send(socket, message) {
|
|
1453
|
-
if (socket.readyState !==
|
|
1465
|
+
if (socket.readyState !== WebSocket2.OPEN) {
|
|
1454
1466
|
throw new Error("Relay connection is not open");
|
|
1455
1467
|
}
|
|
1456
1468
|
socket.send(message);
|
|
1457
1469
|
}
|
|
1458
1470
|
function reportFailure(socket, command, code, message) {
|
|
1459
|
-
if (socket.readyState !==
|
|
1471
|
+
if (socket.readyState !== WebSocket2.OPEN) {
|
|
1460
1472
|
return;
|
|
1461
1473
|
}
|
|
1462
1474
|
send(
|