@moxt-ai/mobius 0.0.101 → 0.0.102
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 +86 -17
- package/dist/cli.js.map +3 -3
- package/dist/daemon-session-commands.d.ts +1 -1
- package/dist/daemon-session-commands.d.ts.map +1 -1
- package/dist/daemon-session-commands.js +2 -1
- package/dist/daemon-session-commands.js.map +1 -1
- package/dist/daemon-turn-reconciliation.d.ts +10 -4
- package/dist/daemon-turn-reconciliation.d.ts.map +1 -1
- package/dist/daemon-turn-reconciliation.js +29 -0
- package/dist/daemon-turn-reconciliation.js.map +1 -1
- package/dist/index.js +85 -16
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/service.d.ts +5 -1
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +15 -1
- package/dist/native-sessions/service.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +15 -5
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +89 -20
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
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.
|
|
3384
|
+
version: "0.0.102",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -29141,6 +29141,7 @@ var nativeSessionTurnForkCommandSchema = external_exports.strictObject({
|
|
|
29141
29141
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
29142
29142
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29143
29143
|
external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
|
|
29144
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
|
|
29144
29145
|
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
|
|
29145
29146
|
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
|
|
29146
29147
|
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
|
|
@@ -29164,6 +29165,7 @@ var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
|
29164
29165
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
29165
29166
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29166
29167
|
external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
|
|
29168
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
|
|
29167
29169
|
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
|
|
29168
29170
|
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
|
|
29169
29171
|
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
|
|
@@ -29211,6 +29213,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
29211
29213
|
targetSessionId: identifier,
|
|
29212
29214
|
history: sessionHistorySchema
|
|
29213
29215
|
}).readonly(),
|
|
29216
|
+
external_exports.strictObject({
|
|
29217
|
+
...resultEnvelope,
|
|
29218
|
+
action: external_exports.literal("active-turn"),
|
|
29219
|
+
targetSessionId: identifier,
|
|
29220
|
+
turn: external_exports.strictObject({
|
|
29221
|
+
commandId: identifier,
|
|
29222
|
+
prompt: external_exports.string().max(1e5),
|
|
29223
|
+
text: external_exports.string().max(1e5),
|
|
29224
|
+
truncated: external_exports.boolean(),
|
|
29225
|
+
epoch: identifier,
|
|
29226
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
29227
|
+
state: external_exports.literal("running")
|
|
29228
|
+
}).readonly().nullable()
|
|
29229
|
+
}).readonly(),
|
|
29214
29230
|
external_exports.strictObject({
|
|
29215
29231
|
...resultEnvelope,
|
|
29216
29232
|
action: external_exports.literal("unlinked-history"),
|
|
@@ -30611,7 +30627,7 @@ var AuditStore = class {
|
|
|
30611
30627
|
};
|
|
30612
30628
|
|
|
30613
30629
|
// src/run-daemon.ts
|
|
30614
|
-
import { randomUUID as
|
|
30630
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
30615
30631
|
import { styleText } from "node:util";
|
|
30616
30632
|
import { WebSocket as WebSocket5 } from "undici";
|
|
30617
30633
|
|
|
@@ -37316,7 +37332,7 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
37316
37332
|
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
37317
37333
|
}
|
|
37318
37334
|
}
|
|
37319
|
-
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal) {
|
|
37335
|
+
async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal, recordLiveText) {
|
|
37320
37336
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity2) => {
|
|
37321
37337
|
publisher.recordAttempt(command.sessionId, daemonActivity(command, activity2), attemptId);
|
|
37322
37338
|
});
|
|
@@ -37449,6 +37465,7 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
37449
37465
|
return Promise.resolve();
|
|
37450
37466
|
},
|
|
37451
37467
|
onText: (delta, messageId) => {
|
|
37468
|
+
recordLiveText(delta);
|
|
37452
37469
|
text.record(messageId, delta);
|
|
37453
37470
|
return Promise.resolve();
|
|
37454
37471
|
},
|
|
@@ -37635,14 +37652,21 @@ var DaemonInstallationObserver = class {
|
|
|
37635
37652
|
};
|
|
37636
37653
|
|
|
37637
37654
|
// src/daemon-turn-reconciliation.ts
|
|
37655
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
37638
37656
|
import { fetch as fetch5 } from "undici";
|
|
37639
37657
|
var ACTIVE_TURN_RECONCILIATION_TIMEOUT_MILLISECONDS = 2e4;
|
|
37658
|
+
var ACTIVE_TURN_TEXT_LIMIT = 1e5;
|
|
37640
37659
|
var ActiveDaemonTurn = class {
|
|
37641
37660
|
attemptId;
|
|
37642
37661
|
command;
|
|
37643
37662
|
#controller;
|
|
37644
37663
|
#finished = Promise.withResolvers();
|
|
37645
37664
|
#cancellationRequested = false;
|
|
37665
|
+
#accepted = false;
|
|
37666
|
+
#text = "";
|
|
37667
|
+
#truncated = false;
|
|
37668
|
+
#sequence = 0;
|
|
37669
|
+
#epoch = randomUUID3();
|
|
37646
37670
|
constructor(command, attemptId) {
|
|
37647
37671
|
this.attemptId = attemptId;
|
|
37648
37672
|
this.command = command;
|
|
@@ -37652,6 +37676,26 @@ var ActiveDaemonTurn = class {
|
|
|
37652
37676
|
this.#controller.abort();
|
|
37653
37677
|
};
|
|
37654
37678
|
finish = () => this.#finished.resolve();
|
|
37679
|
+
accept = () => {
|
|
37680
|
+
this.#accepted = true;
|
|
37681
|
+
};
|
|
37682
|
+
recordText = (delta) => {
|
|
37683
|
+
this.#sequence += 1;
|
|
37684
|
+
this.#text += delta;
|
|
37685
|
+
if (this.#text.length > ACTIVE_TURN_TEXT_LIMIT) {
|
|
37686
|
+
this.#text = this.#text.slice(-ACTIVE_TURN_TEXT_LIMIT);
|
|
37687
|
+
this.#truncated = true;
|
|
37688
|
+
}
|
|
37689
|
+
};
|
|
37690
|
+
snapshot = () => this.#accepted ? {
|
|
37691
|
+
commandId: this.command.commandId,
|
|
37692
|
+
prompt: this.command.prompt,
|
|
37693
|
+
text: this.#text,
|
|
37694
|
+
truncated: this.#truncated,
|
|
37695
|
+
epoch: this.#epoch,
|
|
37696
|
+
sequence: this.#sequence,
|
|
37697
|
+
state: "running"
|
|
37698
|
+
} : null;
|
|
37655
37699
|
matches = (cancellation) => cancellation.commandId === this.command.commandId && cancellation.sessionId === this.command.sessionId;
|
|
37656
37700
|
requestCancellation = () => {
|
|
37657
37701
|
if (this.#cancellationRequested) {
|
|
@@ -38175,7 +38219,7 @@ var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await read
|
|
|
38175
38219
|
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "rich" });
|
|
38176
38220
|
|
|
38177
38221
|
// src/native-sessions/service.ts
|
|
38178
|
-
import { randomUUID as
|
|
38222
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
38179
38223
|
import { basename as basename7 } from "node:path";
|
|
38180
38224
|
|
|
38181
38225
|
// src/native-sessions/acp-history.ts
|
|
@@ -38267,11 +38311,13 @@ var NativeSessionService = class {
|
|
|
38267
38311
|
#directories;
|
|
38268
38312
|
#sessions;
|
|
38269
38313
|
#audit;
|
|
38270
|
-
|
|
38314
|
+
#activeTurn;
|
|
38315
|
+
constructor(config2, directories, sessions, audit, activeTurn) {
|
|
38271
38316
|
this.#config = config2;
|
|
38272
38317
|
this.#directories = directories;
|
|
38273
38318
|
this.#sessions = sessions;
|
|
38274
38319
|
this.#audit = audit;
|
|
38320
|
+
this.#activeTurn = activeTurn;
|
|
38275
38321
|
}
|
|
38276
38322
|
execute = async (command, signal) => {
|
|
38277
38323
|
signal.throwIfAborted();
|
|
@@ -38289,6 +38335,18 @@ var NativeSessionService = class {
|
|
|
38289
38335
|
sessionId: command.sessionId,
|
|
38290
38336
|
signal
|
|
38291
38337
|
};
|
|
38338
|
+
if (command.action === "active-turn") {
|
|
38339
|
+
nativeSessionIdSchema.parse(command.targetSessionId);
|
|
38340
|
+
this.record(command, "active_turn_read");
|
|
38341
|
+
return {
|
|
38342
|
+
action: "active-turn",
|
|
38343
|
+
kind: "native.session.result",
|
|
38344
|
+
requestId: command.requestId,
|
|
38345
|
+
sessionId: command.sessionId,
|
|
38346
|
+
targetSessionId: command.targetSessionId,
|
|
38347
|
+
turn: this.#activeTurn(command)
|
|
38348
|
+
};
|
|
38349
|
+
}
|
|
38292
38350
|
if (command.action === "linked-history") {
|
|
38293
38351
|
const nativeSessionId = nativeSessionIdSchema.parse(command.targetSessionId);
|
|
38294
38352
|
if (this.#sessions.hasPreparedSession(nativeSessionId, options.agent.id, cwd, additionalDirectories) && await this.#sessions.loadLinkedSessionHistory({ ...options, sessionId: nativeSessionId }) === null) {
|
|
@@ -38359,7 +38417,7 @@ var NativeSessionService = class {
|
|
|
38359
38417
|
if (authorized === null) {
|
|
38360
38418
|
return null;
|
|
38361
38419
|
}
|
|
38362
|
-
const entryId =
|
|
38420
|
+
const entryId = randomUUID4();
|
|
38363
38421
|
if (this.#entries.size >= 5e3) {
|
|
38364
38422
|
this.#entries.clear();
|
|
38365
38423
|
}
|
|
@@ -38414,7 +38472,7 @@ var NativeSessionService = class {
|
|
|
38414
38472
|
"invalid_native_session_response"
|
|
38415
38473
|
);
|
|
38416
38474
|
}
|
|
38417
|
-
nextCursor =
|
|
38475
|
+
nextCursor = randomUUID4();
|
|
38418
38476
|
if (this.#cursors.size >= 500) {
|
|
38419
38477
|
this.#cursors.clear();
|
|
38420
38478
|
}
|
|
@@ -39033,7 +39091,7 @@ var RelayConnectionDiagnostics = class {
|
|
|
39033
39091
|
};
|
|
39034
39092
|
|
|
39035
39093
|
// src/relay-connection/liveness.ts
|
|
39036
|
-
import { randomUUID as
|
|
39094
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
39037
39095
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
39038
39096
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
39039
39097
|
var RelayLivenessState = class {
|
|
@@ -39122,7 +39180,7 @@ var RelayConnectionLiveness = class {
|
|
|
39122
39180
|
}
|
|
39123
39181
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
39124
39182
|
}
|
|
39125
|
-
const heartbeatId =
|
|
39183
|
+
const heartbeatId = randomUUID5();
|
|
39126
39184
|
this.#state = new AwaitingHeartbeatAckState(
|
|
39127
39185
|
heartbeatId,
|
|
39128
39186
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
@@ -39970,7 +40028,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
39970
40028
|
{
|
|
39971
40029
|
agentId: agent.id,
|
|
39972
40030
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
39973
|
-
requestId: `automatic-integration-${
|
|
40031
|
+
requestId: `automatic-integration-${randomUUID6()}`
|
|
39974
40032
|
},
|
|
39975
40033
|
signal
|
|
39976
40034
|
);
|
|
@@ -40098,12 +40156,13 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40098
40156
|
const turn = new ActiveDaemonTurn(command, receipt.attemptId);
|
|
40099
40157
|
activeTurns.set(command.commandId, turn);
|
|
40100
40158
|
const activateAttempt = () => {
|
|
40159
|
+
turn.accept();
|
|
40101
40160
|
if (trackActiveAttempt) {
|
|
40102
40161
|
activeAttemptIds.set(command.sessionId, receipt.attemptId);
|
|
40103
40162
|
}
|
|
40104
40163
|
};
|
|
40105
40164
|
try {
|
|
40106
|
-
await execute(receipt.attemptId, activateAttempt, turn.signal);
|
|
40165
|
+
await execute(receipt.attemptId, activateAttempt, turn.signal, turn);
|
|
40107
40166
|
} finally {
|
|
40108
40167
|
activeTurns.delete(command.commandId);
|
|
40109
40168
|
if (activeAttemptIds.get(command.sessionId) === receipt.attemptId) {
|
|
@@ -40193,7 +40252,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40193
40252
|
delivery,
|
|
40194
40253
|
command,
|
|
40195
40254
|
command.disposition !== SessionPromptDisposition.Steer,
|
|
40196
|
-
(attemptId, activateAttempt, executionSignal) => executePrompt(
|
|
40255
|
+
(attemptId, activateAttempt, executionSignal, turn) => executePrompt(
|
|
40197
40256
|
outbox,
|
|
40198
40257
|
publisher,
|
|
40199
40258
|
command,
|
|
@@ -40204,7 +40263,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40204
40263
|
attemptId,
|
|
40205
40264
|
activateAttempt,
|
|
40206
40265
|
timer,
|
|
40207
|
-
executionSignal
|
|
40266
|
+
executionSignal,
|
|
40267
|
+
turn.recordText
|
|
40208
40268
|
)
|
|
40209
40269
|
);
|
|
40210
40270
|
return;
|
|
@@ -40633,7 +40693,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40633
40693
|
const previous = [...nativeRequests.values()].filter(
|
|
40634
40694
|
(request) => request.agentId === command2.agentId
|
|
40635
40695
|
);
|
|
40636
|
-
if (nativeRequests.has(command2.requestId) || nativeRequests.size >= 4 || command2.action !== "linked-history" && previous.some((request) => !request.controller.signal.aborted)) {
|
|
40696
|
+
if (nativeRequests.has(command2.requestId) || nativeRequests.size >= 4 || command2.action !== "linked-history" && command2.action !== "active-turn" && previous.some((request) => !request.controller.signal.aborted)) {
|
|
40637
40697
|
reportOperationFailure(
|
|
40638
40698
|
socket,
|
|
40639
40699
|
command2.requestId,
|
|
@@ -40661,7 +40721,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40661
40721
|
const completion = (async () => {
|
|
40662
40722
|
try {
|
|
40663
40723
|
operationSignal.throwIfAborted();
|
|
40664
|
-
if (previous.length > 0) {
|
|
40724
|
+
if (previous.length > 0 && command2.action !== "active-turn") {
|
|
40665
40725
|
await new Promise((resolve9, reject2) => {
|
|
40666
40726
|
const cancel = () => reject2(operationSignal.reason);
|
|
40667
40727
|
operationSignal.addEventListener("abort", cancel, {
|
|
@@ -40955,12 +41015,14 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
40955
41015
|
sessions,
|
|
40956
41016
|
receipt.attemptId,
|
|
40957
41017
|
() => {
|
|
41018
|
+
turn.accept();
|
|
40958
41019
|
if (command.disposition !== SessionPromptDisposition.Steer) {
|
|
40959
41020
|
activeAttemptIds.set(command.sessionId, receipt.attemptId);
|
|
40960
41021
|
}
|
|
40961
41022
|
},
|
|
40962
41023
|
timer,
|
|
40963
|
-
turn.signal
|
|
41024
|
+
turn.signal,
|
|
41025
|
+
turn.recordText
|
|
40964
41026
|
).catch((error62) => {
|
|
40965
41027
|
console.error("Mobius daemon turn failed", error62);
|
|
40966
41028
|
}).finally(() => {
|
|
@@ -41080,7 +41142,14 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
41080
41142
|
config2.relayUrl,
|
|
41081
41143
|
new DaemonDiagnosticLog(stateDirectory)
|
|
41082
41144
|
);
|
|
41083
|
-
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit)
|
|
41145
|
+
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit, (request) => {
|
|
41146
|
+
const turn = [...activeTurns.values()].find(
|
|
41147
|
+
(candidate) => candidate.command.sessionId === request.targetSessionId && candidate.command.agentId === request.agentId && candidate.command.directoryId === request.directoryId && candidate.command.additionalDirectoryIds.length === request.additionalDirectoryIds.length && candidate.command.additionalDirectoryIds.every(
|
|
41148
|
+
(directoryId2, index) => directoryId2 === request.additionalDirectoryIds[index]
|
|
41149
|
+
)
|
|
41150
|
+
);
|
|
41151
|
+
return turn?.snapshot() ?? null;
|
|
41152
|
+
});
|
|
41084
41153
|
const installations = new AgentInstallationManager(
|
|
41085
41154
|
specifications,
|
|
41086
41155
|
installationExecutor,
|