@moxt-ai/mobius 0.0.121 → 0.0.123
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 -37
- package/dist/cli.js.map +3 -3
- package/dist/daemon-active-turn.d.ts +2 -1
- package/dist/daemon-active-turn.d.ts.map +1 -1
- package/dist/daemon-active-turn.js +11 -8
- package/dist/daemon-active-turn.js.map +1 -1
- package/dist/daemon-command-handler.js +3 -4
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/daemon-prompt-executor.d.ts +1 -2
- package/dist/daemon-prompt-executor.d.ts.map +1 -1
- package/dist/daemon-prompt-executor.js +1 -4
- package/dist/daemon-prompt-executor.js.map +1 -1
- package/dist/daemon-turn-registry.d.ts +5 -8
- package/dist/daemon-turn-registry.d.ts.map +1 -1
- package/dist/daemon-turn-registry.js +41 -20
- package/dist/daemon-turn-registry.js.map +1 -1
- package/dist/index.js +65 -36
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/service.d.ts +3 -3
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +1 -1
- package/dist/native-sessions/service.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +11 -6
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +65 -36
- 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.123",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -41767,15 +41767,21 @@ var ActiveDaemonTurn = class {
|
|
|
41767
41767
|
this.attemptId = attemptId;
|
|
41768
41768
|
this.command = command;
|
|
41769
41769
|
this.#controller = new AbortController();
|
|
41770
|
-
this.#dispatch =
|
|
41770
|
+
this.#dispatch = { kind: "pending" };
|
|
41771
41771
|
}
|
|
41772
|
+
enqueue = () => {
|
|
41773
|
+
if (this.#dispatch.kind !== "pending") {
|
|
41774
|
+
throw new Error("Only a pending prompt can enter the queue");
|
|
41775
|
+
}
|
|
41776
|
+
this.#dispatch = { kind: "queued", promotion: Promise.withResolvers() };
|
|
41777
|
+
};
|
|
41772
41778
|
isQueued = () => this.#dispatch.kind === "queued" && !this.#controller.signal.aborted;
|
|
41773
41779
|
abortDaemon = () => {
|
|
41774
41780
|
this.#controller.abort();
|
|
41775
41781
|
};
|
|
41776
41782
|
finish = () => this.#finished.resolve();
|
|
41777
|
-
|
|
41778
|
-
this.#dispatch = { kind: "
|
|
41783
|
+
activate = () => {
|
|
41784
|
+
this.#dispatch = { kind: "running" };
|
|
41779
41785
|
return { epoch: this.#epoch, sequence: 0 };
|
|
41780
41786
|
};
|
|
41781
41787
|
promoteQueuedPrompt = (command) => {
|
|
@@ -41853,7 +41859,7 @@ var ActiveDaemonTurn = class {
|
|
|
41853
41859
|
}
|
|
41854
41860
|
return event;
|
|
41855
41861
|
};
|
|
41856
|
-
snapshot = () => this.#dispatch.kind === "
|
|
41862
|
+
snapshot = () => this.#dispatch.kind === "running" ? {
|
|
41857
41863
|
activities: [...this.#activities.values()].sort((left, right) => left.sequence - right.sequence),
|
|
41858
41864
|
commandId: decodeIdentifier(this.command.commandId),
|
|
41859
41865
|
content: [...this.#content.values()],
|
|
@@ -41871,7 +41877,7 @@ var ActiveDaemonTurn = class {
|
|
|
41871
41877
|
return "already-requested";
|
|
41872
41878
|
}
|
|
41873
41879
|
this.#cancellationRequested = true;
|
|
41874
|
-
if (this.#dispatch.kind !== "
|
|
41880
|
+
if (this.#dispatch.kind !== "running") {
|
|
41875
41881
|
this.#controller.abort(new Error("The queued Agent turn was cancelled"));
|
|
41876
41882
|
return "pending";
|
|
41877
41883
|
}
|
|
@@ -41932,11 +41938,23 @@ var DaemonTurnRegistry = class {
|
|
|
41932
41938
|
turn.recordEvent(event);
|
|
41933
41939
|
}
|
|
41934
41940
|
};
|
|
41935
|
-
|
|
41936
|
-
|
|
41937
|
-
turn
|
|
41938
|
-
|
|
41939
|
-
|
|
41941
|
+
executionSnapshot = async (matches) => {
|
|
41942
|
+
const matching = [];
|
|
41943
|
+
for (const turn of this.#turns.values()) {
|
|
41944
|
+
if (await matches(turn.command)) {
|
|
41945
|
+
matching.push(turn);
|
|
41946
|
+
}
|
|
41947
|
+
}
|
|
41948
|
+
const current = matching.filter((turn) => this.#turns.get(turn.command.commandId) === turn);
|
|
41949
|
+
return {
|
|
41950
|
+
turn: current.map((turn) => turn.snapshot()).find((snapshot) => snapshot !== null) ?? null,
|
|
41951
|
+
queued: current.filter((turn) => turn.isQueued()).map(({ command }) => ({
|
|
41952
|
+
commandId: command.commandId,
|
|
41953
|
+
prompt: command.prompt,
|
|
41954
|
+
images: command.images
|
|
41955
|
+
}))
|
|
41956
|
+
};
|
|
41957
|
+
};
|
|
41940
41958
|
snapshot = (matches) => {
|
|
41941
41959
|
for (const turn of this.#turns.values()) {
|
|
41942
41960
|
if (!matches(turn.command)) {
|
|
@@ -41956,24 +41974,33 @@ var DaemonTurnRegistry = class {
|
|
|
41956
41974
|
}
|
|
41957
41975
|
await Promise.all(turns.map((turn) => turn.completion));
|
|
41958
41976
|
};
|
|
41959
|
-
|
|
41960
|
-
|
|
41977
|
+
admitAndWait = async (turn, waitSignal, onQueued) => {
|
|
41978
|
+
const command = turn.command;
|
|
41979
|
+
waitSignal.throwIfAborted();
|
|
41980
|
+
const head = () => [...this.#turns.values()].find(
|
|
41981
|
+
(turn2) => turn2.command.sessionId === command.sessionId && turn2.command.disposition !== SessionPromptDisposition.Steer
|
|
41982
|
+
);
|
|
41983
|
+
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
41984
|
+
const target = head();
|
|
41985
|
+
if ((target === turn || target?.command.commandId !== command.targetCommandId) && !this.#operations.isTerminalExecution(command.targetCommandId, command.sessionId)) {
|
|
41986
|
+
return { kind: "queue-target-unavailable" };
|
|
41987
|
+
}
|
|
41988
|
+
turn.enqueue();
|
|
41989
|
+
onQueued();
|
|
41990
|
+
}
|
|
41991
|
+
if (turn.effectiveDisposition() === SessionPromptDisposition.Steer) {
|
|
41961
41992
|
return { disposition: SessionPromptDisposition.Steer, kind: "available" };
|
|
41962
41993
|
}
|
|
41963
41994
|
for (; ; ) {
|
|
41964
|
-
|
|
41965
|
-
|
|
41966
|
-
)
|
|
41967
|
-
|
|
41968
|
-
return command.disposition !== SessionPromptDisposition.Queue || this.#operations.isTerminalExecution(command.targetCommandId, command.sessionId) ? { disposition: queuedTurn.effectiveDisposition(), kind: "available" } : { kind: "queue-target-unavailable" };
|
|
41995
|
+
waitSignal.throwIfAborted();
|
|
41996
|
+
const first = head();
|
|
41997
|
+
if (first === void 0 || first === turn) {
|
|
41998
|
+
return { disposition: turn.effectiveDisposition(), kind: "available" };
|
|
41969
41999
|
}
|
|
41970
42000
|
if (command.disposition !== SessionPromptDisposition.Queue) {
|
|
41971
42001
|
return { kind: "busy" };
|
|
41972
42002
|
}
|
|
41973
|
-
|
|
41974
|
-
return { kind: "queue-target-unavailable" };
|
|
41975
|
-
}
|
|
41976
|
-
const promotion = queuedTurn.queuePromotion();
|
|
42003
|
+
const promotion = turn.queuePromotion();
|
|
41977
42004
|
if (promotion === null) {
|
|
41978
42005
|
throw new Error("The queued prompt cannot be promoted");
|
|
41979
42006
|
}
|
|
@@ -42540,7 +42567,7 @@ var NativeSessionService = class {
|
|
|
42540
42567
|
requestId: command.requestId,
|
|
42541
42568
|
sessionId: command.sessionId,
|
|
42542
42569
|
targetSessionId: command.targetSessionId,
|
|
42543
|
-
...this.#activeTurn(command)
|
|
42570
|
+
...await this.#activeTurn(command, options)
|
|
42544
42571
|
};
|
|
42545
42572
|
}
|
|
42546
42573
|
if (command.action === "create") {
|
|
@@ -44630,7 +44657,6 @@ async function executePrompt({
|
|
|
44630
44657
|
sessions,
|
|
44631
44658
|
attemptId,
|
|
44632
44659
|
activateAttempt,
|
|
44633
|
-
acknowledgeQueued,
|
|
44634
44660
|
waitForSessionAvailability,
|
|
44635
44661
|
timer,
|
|
44636
44662
|
signal,
|
|
@@ -44673,9 +44699,6 @@ async function executePrompt({
|
|
|
44673
44699
|
AGENT_TEXT_MAXIMUM_LENGTH
|
|
44674
44700
|
);
|
|
44675
44701
|
try {
|
|
44676
|
-
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
44677
|
-
acknowledgeQueued();
|
|
44678
|
-
}
|
|
44679
44702
|
const resolved = await resolveSessionDirectories(
|
|
44680
44703
|
directories,
|
|
44681
44704
|
command.bindingId,
|
|
@@ -45346,16 +45369,15 @@ function createDaemonCommandHandler({
|
|
|
45346
45369
|
audit,
|
|
45347
45370
|
sessions,
|
|
45348
45371
|
attemptId: receipt.attemptId,
|
|
45349
|
-
activateAttempt: turn.
|
|
45350
|
-
|
|
45372
|
+
activateAttempt: turn.activate,
|
|
45373
|
+
waitForSessionAvailability: (waitSignal) => activeTurns.admitAndWait(turn, waitSignal, () => {
|
|
45351
45374
|
queueChanged(command.sessionId);
|
|
45352
45375
|
send(socket, {
|
|
45353
45376
|
commandId: command.commandId,
|
|
45354
45377
|
kind: SESSION_QUEUED_KIND,
|
|
45355
45378
|
sessionId: command.sessionId
|
|
45356
45379
|
});
|
|
45357
|
-
},
|
|
45358
|
-
waitForSessionAvailability: (waitSignal) => activeTurns.waitForAvailability(command, turn, waitSignal),
|
|
45380
|
+
}),
|
|
45359
45381
|
timer,
|
|
45360
45382
|
signal: turn.signal,
|
|
45361
45383
|
recordLiveEvent: turn.recordEvent,
|
|
@@ -45948,12 +45970,19 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
45948
45970
|
config2.relayUrl,
|
|
45949
45971
|
new DaemonDiagnosticLog(stateDirectory)
|
|
45950
45972
|
);
|
|
45951
|
-
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit, (request) => {
|
|
45952
|
-
return activeTurns.executionSnapshot(
|
|
45953
|
-
(command
|
|
45954
|
-
|
|
45955
|
-
|
|
45956
|
-
|
|
45973
|
+
const nativeSessions = new NativeSessionService(config2, directories, sessions, audit, async (request, options2) => {
|
|
45974
|
+
return await activeTurns.executionSnapshot(async (command) => {
|
|
45975
|
+
if (command.sessionId !== request.targetSessionId || command.agentId !== request.agentId) {
|
|
45976
|
+
return false;
|
|
45977
|
+
}
|
|
45978
|
+
const cwd = await directories.resolve(command.bindingId, command.directoryId, options2.signal);
|
|
45979
|
+
const additionalDirectories = await directories.resolveMany(
|
|
45980
|
+
command.bindingId,
|
|
45981
|
+
command.additionalDirectoryIds,
|
|
45982
|
+
options2.signal
|
|
45983
|
+
);
|
|
45984
|
+
return cwd === options2.cwd && additionalDirectories.length === options2.additionalDirectories.length && additionalDirectories.every((directory, index) => directory === options2.additionalDirectories[index]);
|
|
45985
|
+
});
|
|
45957
45986
|
});
|
|
45958
45987
|
const installations = new AgentInstallationManager(
|
|
45959
45988
|
specifications,
|