@moxt-ai/mobius 0.0.58 → 0.0.59
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 +66 -3
- package/dist/cli.js.map +3 -3
- package/dist/index.js +65 -2
- package/dist/index.js.map +3 -3
- package/dist/relay-connection/diagnostics.d.ts +5 -0
- package/dist/relay-connection/diagnostics.d.ts.map +1 -1
- package/dist/relay-connection/diagnostics.js +14 -0
- package/dist/relay-connection/diagnostics.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +48 -2
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +65 -2
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir5 } from "node:fs/promises";
|
|
|
11
11
|
// package.json
|
|
12
12
|
var package_default = {
|
|
13
13
|
name: "@moxt-ai/mobius",
|
|
14
|
-
version: "0.0.
|
|
14
|
+
version: "0.0.59",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -38994,6 +38994,25 @@ var RelayConnectionDiagnostics = class {
|
|
|
38994
38994
|
addFailureDetails(details, failure2);
|
|
38995
38995
|
this.#record("relay_connection_failed", connectionEpoch.toString(), details, true);
|
|
38996
38996
|
};
|
|
38997
|
+
/**
|
|
38998
|
+
* Records that the Runtime gave up on Agent turns the Relay already settled. This is not a connection
|
|
38999
|
+
* failure, so it is recorded independently of the per-epoch failure deduplication.
|
|
39000
|
+
*/
|
|
39001
|
+
reconciliationAbandoned = (connectionEpoch, relayErrorCode2, turnCount) => {
|
|
39002
|
+
this.#record(
|
|
39003
|
+
"relay_reconciliation_abandoned",
|
|
39004
|
+
connectionEpoch.toString(),
|
|
39005
|
+
{
|
|
39006
|
+
connectionEpoch: connectionEpoch.toString(),
|
|
39007
|
+
relayErrorCode: relayErrorCode2 ?? "unknown",
|
|
39008
|
+
relayOrigin: this.#relayOrigin,
|
|
39009
|
+
source: "reconciliation_abandoned",
|
|
39010
|
+
turnCount: turnCount.toString(),
|
|
39011
|
+
...this.#route
|
|
39012
|
+
},
|
|
39013
|
+
true
|
|
39014
|
+
);
|
|
39015
|
+
};
|
|
38997
39016
|
connectionOpened = (connectionEpoch) => {
|
|
38998
39017
|
this.#record(
|
|
38999
39018
|
"relay_connection_opened",
|
|
@@ -39940,11 +39959,34 @@ var ActiveDaemonTurn = class {
|
|
|
39940
39959
|
};
|
|
39941
39960
|
var ActiveTurnReconciliationError = class extends Error {
|
|
39942
39961
|
code = "active_turn_reconciliation_failed";
|
|
39962
|
+
diagnosticDetails;
|
|
39963
|
+
relayErrorCode;
|
|
39964
|
+
terminal;
|
|
39943
39965
|
constructor(message, options = {}) {
|
|
39944
39966
|
super(message, options);
|
|
39945
39967
|
this.name = "ActiveTurnReconciliationError";
|
|
39968
|
+
this.relayErrorCode = options.relayErrorCode ?? null;
|
|
39969
|
+
this.terminal = options.terminal ?? false;
|
|
39970
|
+
this.diagnosticDetails = this.relayErrorCode === null ? {} : { relayErrorCode: this.relayErrorCode };
|
|
39946
39971
|
}
|
|
39947
39972
|
};
|
|
39973
|
+
var TERMINAL_RECONCILIATION_RELAY_CODES = /* @__PURE__ */ new Set(["session_conflict"]);
|
|
39974
|
+
async function relayErrorCode(response) {
|
|
39975
|
+
try {
|
|
39976
|
+
const body = JSON.parse(await response.text());
|
|
39977
|
+
if (typeof body !== "object" || body === null) {
|
|
39978
|
+
return null;
|
|
39979
|
+
}
|
|
39980
|
+
const error62 = Reflect.get(body, "error");
|
|
39981
|
+
if (typeof error62 !== "object" || error62 === null) {
|
|
39982
|
+
return null;
|
|
39983
|
+
}
|
|
39984
|
+
const code = Reflect.get(error62, "code");
|
|
39985
|
+
return typeof code === "string" && code.length > 0 ? code : null;
|
|
39986
|
+
} catch {
|
|
39987
|
+
return null;
|
|
39988
|
+
}
|
|
39989
|
+
}
|
|
39948
39990
|
function activeTurnReconciliationEndpoint(config2, turn) {
|
|
39949
39991
|
const endpoint = relayHttpEndpoint(config2.relayUrl);
|
|
39950
39992
|
let channelPath = "";
|
|
@@ -39982,12 +40024,15 @@ async function reconcileActiveTurn(config2, turn, signal) {
|
|
|
39982
40024
|
{ cause: error62 }
|
|
39983
40025
|
);
|
|
39984
40026
|
}
|
|
39985
|
-
await response.body?.cancel();
|
|
39986
40027
|
if (!response.ok) {
|
|
40028
|
+
const errorCode = await relayErrorCode(response);
|
|
40029
|
+
const terminal = errorCode !== null && TERMINAL_RECONCILIATION_RELAY_CODES.has(errorCode);
|
|
39987
40030
|
throw new ActiveTurnReconciliationError(
|
|
39988
|
-
`The Relay rejected the active Agent turn reconciliation with status ${response.status.toString()}
|
|
40031
|
+
terminal ? `The Relay reported that the active Agent turn can no longer be reconciled (${errorCode})` : `The Relay rejected the active Agent turn reconciliation with status ${response.status.toString()}`,
|
|
40032
|
+
{ relayErrorCode: errorCode, terminal }
|
|
39989
40033
|
);
|
|
39990
40034
|
}
|
|
40035
|
+
await response.body?.cancel();
|
|
39991
40036
|
}
|
|
39992
40037
|
async function reconcileActiveTurns(config2, turns, signal) {
|
|
39993
40038
|
await Promise.all(turns.map(async (turn) => await reconcileActiveTurn(config2, turn, signal)));
|
|
@@ -42002,6 +42047,24 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
42002
42047
|
return;
|
|
42003
42048
|
}
|
|
42004
42049
|
console.error("Mobius daemon could not reconcile active Agent turns", error62);
|
|
42050
|
+
if (error62 instanceof ActiveTurnReconciliationError && error62.terminal) {
|
|
42051
|
+
diagnostics.reconciliationAbandoned(
|
|
42052
|
+
connectionEpoch,
|
|
42053
|
+
error62.relayErrorCode,
|
|
42054
|
+
reconnectingTurns.length
|
|
42055
|
+
);
|
|
42056
|
+
console.error(
|
|
42057
|
+
"Mobius daemon abandoned Agent turns the Relay already settled",
|
|
42058
|
+
error62.relayErrorCode
|
|
42059
|
+
);
|
|
42060
|
+
for (const turn of reconnectingTurns) {
|
|
42061
|
+
activeTurns.delete(turn.command.commandId);
|
|
42062
|
+
turn.abortDaemon();
|
|
42063
|
+
}
|
|
42064
|
+
publisher.connect(socket);
|
|
42065
|
+
resumeRuntimeDeliveries();
|
|
42066
|
+
return;
|
|
42067
|
+
}
|
|
42005
42068
|
failAndClose(
|
|
42006
42069
|
new Error("Active Agent turn reconciliation failed", { cause: error62 }),
|
|
42007
42070
|
ACTIVE_TURN_RECONCILIATION_CLOSE_CODE,
|