@moxt-ai/mobius 0.0.74 → 0.0.75
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 +44 -3
- package/dist/cli.js.map +2 -2
- package/dist/index.js +43 -2
- package/dist/index.js.map +2 -2
- package/dist/relay-connection/session-event-outbox.d.ts +6 -0
- package/dist/relay-connection/session-event-outbox.d.ts.map +1 -1
- package/dist/relay-connection/session-event-outbox.js +19 -0
- package/dist/relay-connection/session-event-outbox.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +26 -2
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +43 -2
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { mkdir as mkdir6 } 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.75",
|
|
15
15
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
16
16
|
type: "module",
|
|
17
17
|
bin: {
|
|
@@ -41437,6 +41437,23 @@ var SessionEventOutbox = class {
|
|
|
41437
41437
|
}
|
|
41438
41438
|
this.#database.prepare(`UPDATE relay_turn_receipts SET state = ? WHERE command_id = ?`).run(state, commandId);
|
|
41439
41439
|
};
|
|
41440
|
+
/**
|
|
41441
|
+
* The Attempt this Runtime durably claimed for a command, when that Attempt never reached a
|
|
41442
|
+
* terminal state. A restarted Runtime has no in-memory Turn for a command it was executing before
|
|
41443
|
+
* the restart, so this is the only record of the Attempt identity the Relay is still waiting on.
|
|
41444
|
+
*/
|
|
41445
|
+
findUnsettledAttemptId = (commandId, sessionId) => {
|
|
41446
|
+
const row = this.#database.prepare(`SELECT attempt_id, state FROM relay_turn_receipts WHERE command_id = ? AND session_id = ?`).get(commandId, sessionId);
|
|
41447
|
+
if (typeof row !== "object" || row === null) {
|
|
41448
|
+
return null;
|
|
41449
|
+
}
|
|
41450
|
+
const attemptId = Reflect.get(row, "attempt_id");
|
|
41451
|
+
const state = Reflect.get(row, "state");
|
|
41452
|
+
if (typeof attemptId !== "string" || attemptId.length === 0 || !isDaemonExecutionState(state)) {
|
|
41453
|
+
return null;
|
|
41454
|
+
}
|
|
41455
|
+
return state === "dispatching" || state === "running" ? attemptId : null;
|
|
41456
|
+
};
|
|
41440
41457
|
isTerminalExecution = (commandId, sessionId) => {
|
|
41441
41458
|
const row = this.#database.prepare(`SELECT state FROM relay_turn_receipts WHERE command_id = ? AND session_id = ?`).get(commandId, sessionId);
|
|
41442
41459
|
const state = typeof row === "object" && row !== null ? Reflect.get(row, "state") : void 0;
|
|
@@ -42401,6 +42418,26 @@ function reportFailure(publisher, command, code, message, attemptId) {
|
|
|
42401
42418
|
attemptId
|
|
42402
42419
|
);
|
|
42403
42420
|
}
|
|
42421
|
+
function settleAbandonedTurn(publisher, outbox, audit, cancellation) {
|
|
42422
|
+
const attemptId = outbox.findUnsettledAttemptId(cancellation.commandId, cancellation.sessionId);
|
|
42423
|
+
if (attemptId === null) {
|
|
42424
|
+
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
42425
|
+
return;
|
|
42426
|
+
}
|
|
42427
|
+
audit.record({
|
|
42428
|
+
commandId: cancellation.commandId,
|
|
42429
|
+
event: "session_abandoned_turn_settled",
|
|
42430
|
+
sessionId: cancellation.sessionId
|
|
42431
|
+
});
|
|
42432
|
+
reportFailure(
|
|
42433
|
+
publisher,
|
|
42434
|
+
cancellation,
|
|
42435
|
+
"agent_execution_abandoned",
|
|
42436
|
+
"The local Agent execution was abandoned before it completed",
|
|
42437
|
+
attemptId
|
|
42438
|
+
);
|
|
42439
|
+
outbox.transitionExecution(cancellation.commandId, "failed");
|
|
42440
|
+
}
|
|
42404
42441
|
function operationErrorCode(error62) {
|
|
42405
42442
|
if (error62 instanceof AcpExecutionError || error62 instanceof LocalAuthorizationError || error62 instanceof LocalAgentCatalogError || error62 instanceof PromptArtifactError) {
|
|
42406
42443
|
return error62.code;
|
|
@@ -43495,7 +43532,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
43495
43532
|
throw new Error("Runtime delivery Session identity does not match its payload");
|
|
43496
43533
|
}
|
|
43497
43534
|
const turn = activeTurns.get(cancellation.commandId);
|
|
43498
|
-
if (turn === void 0 || !turn.matches(cancellation)
|
|
43535
|
+
if (turn === void 0 || !turn.matches(cancellation)) {
|
|
43536
|
+
settleAbandonedTurn(publisher, outbox, audit, cancellation);
|
|
43537
|
+
return;
|
|
43538
|
+
}
|
|
43539
|
+
if (!turn.requestCancellation()) {
|
|
43499
43540
|
return;
|
|
43500
43541
|
}
|
|
43501
43542
|
audit.record({
|
|
@@ -44175,7 +44216,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
44175
44216
|
const cancellation = message;
|
|
44176
44217
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
44177
44218
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
44178
|
-
|
|
44219
|
+
settleAbandonedTurn(publisher, outbox, audit, cancellation);
|
|
44179
44220
|
return;
|
|
44180
44221
|
}
|
|
44181
44222
|
if (!turn2.requestCancellation()) {
|