@moxt-ai/mobius 0.0.103 → 0.0.104

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 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.103",
3384
+ version: "0.0.104",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -28883,12 +28883,19 @@ function decodeRuntimeDeliveryCommitted(encoded) {
28883
28883
  }
28884
28884
  function decodeSessionStartedEvent(encoded) {
28885
28885
  const value = parseJson2(encoded);
28886
- assertExactKeys(value, ["commandId", "kind", "attemptId", "sessionId"]);
28886
+ assertExactKeys(value, ["commandId", "epoch", "kind", "attemptId", "prompt", "sequence", "sessionId"]);
28887
28887
  assertKind(value, SESSION_STARTED_KIND);
28888
+ const sequence = readSequence(value, "sequence");
28889
+ if (sequence !== 0) {
28890
+ throw new ProtocolMessageError("Invalid live start sequence");
28891
+ }
28888
28892
  return {
28889
28893
  commandId: readIdentifier(value, "commandId"),
28894
+ epoch: readIdentifier(value, "epoch"),
28890
28895
  kind: SESSION_STARTED_KIND,
28891
28896
  attemptId: readIdentifier(value, "attemptId"),
28897
+ prompt: readText(value, "prompt", MAX_PROMPT_LENGTH),
28898
+ sequence,
28892
28899
  sessionId: readIdentifier(value, "sessionId")
28893
28900
  };
28894
28901
  }
@@ -37338,7 +37345,7 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
37338
37345
  reportOperationFailure(socket, command.requestId, command.sessionId, error62);
37339
37346
  }
37340
37347
  }
37341
- async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, timer, signal, recordLiveText) {
37348
+ async function executePrompt(outbox, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, sessionAvailable, timer, signal, recordLiveText) {
37342
37349
  const activities = new CoalescingDaemonActivityPublisher(timer, (activity2) => {
37343
37350
  publisher.recordAttempt(command.sessionId, daemonActivity(command, activity2), attemptId);
37344
37351
  });
@@ -37386,12 +37393,15 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
37386
37393
  try {
37387
37394
  const resolved = await resolveSessionDirectories(
37388
37395
  directories,
37389
- config2.bindingId,
37396
+ command.bindingId,
37390
37397
  command.directoryId,
37391
37398
  command.additionalDirectoryIds,
37392
37399
  signal
37393
37400
  );
37394
37401
  const agent = config2.catalog.find(command.agentId);
37402
+ if (!sessionAvailable()) {
37403
+ throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
37404
+ }
37395
37405
  if (command.disposition === SessionPromptDisposition.Queue && !outbox.isTerminalExecution(command.targetCommandId, command.sessionId)) {
37396
37406
  throw new AcpExecutionError(
37397
37407
  "The queued prompt target is unavailable",
@@ -37433,17 +37443,20 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
37433
37443
  sessionId: command.sessionId
37434
37444
  });
37435
37445
  outbox.transitionExecution(command.commandId, "running");
37446
+ const stream = activateAttempt();
37436
37447
  publisher.recordAttempt(
37437
37448
  command.sessionId,
37438
37449
  {
37439
37450
  commandId: command.commandId,
37451
+ epoch: stream.epoch,
37440
37452
  kind: SESSION_STARTED_KIND,
37441
37453
  attemptId,
37454
+ prompt: command.prompt,
37455
+ sequence: stream.sequence,
37442
37456
  sessionId: command.sessionId
37443
37457
  },
37444
37458
  attemptId
37445
37459
  );
37446
- activateAttempt();
37447
37460
  const attachments = await resolvePromptArtifacts(config2, command, signal);
37448
37461
  let stopReason;
37449
37462
  if (command.disposition === SessionPromptDisposition.Steer) {
@@ -37686,6 +37699,7 @@ var ActiveDaemonTurn = class {
37686
37699
  finish = () => this.#finished.resolve();
37687
37700
  accept = () => {
37688
37701
  this.#accepted = true;
37702
+ return { epoch: this.#epoch, sequence: 0 };
37689
37703
  };
37690
37704
  recordText = (delta) => {
37691
37705
  this.#sequence += 1;
@@ -40136,6 +40150,15 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40136
40150
  rejectConnection(failure2);
40137
40151
  };
40138
40152
  const processingDeliveryIds = /* @__PURE__ */ new Set();
40153
+ const sessionAvailable = (command) => {
40154
+ if (command.disposition === SessionPromptDisposition.Steer) {
40155
+ return true;
40156
+ }
40157
+ const first = [...activeTurns.values()].find(
40158
+ (turn) => turn.command.sessionId === command.sessionId && turn.command.disposition !== SessionPromptDisposition.Steer
40159
+ );
40160
+ return first === void 0 || first.command.commandId === command.commandId;
40161
+ };
40139
40162
  const processDeliveredPrompt = async (delivery, command, trackActiveAttempt, execute) => {
40140
40163
  if (command.sessionId !== delivery.sessionId) {
40141
40164
  throw new Error("Runtime delivery Session identity does not match its payload");
@@ -40165,10 +40188,11 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40165
40188
  const turn = new ActiveDaemonTurn(command, receipt.attemptId);
40166
40189
  activeTurns.set(command.commandId, turn);
40167
40190
  const activateAttempt = () => {
40168
- turn.accept();
40191
+ const stream = turn.accept();
40169
40192
  if (trackActiveAttempt) {
40170
40193
  activeAttemptIds.set(command.sessionId, receipt.attemptId);
40171
40194
  }
40195
+ return stream;
40172
40196
  };
40173
40197
  try {
40174
40198
  await execute(receipt.attemptId, activateAttempt, turn.signal, turn);
@@ -40271,6 +40295,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40271
40295
  sessions,
40272
40296
  attemptId,
40273
40297
  activateAttempt,
40298
+ () => sessionAvailable(command),
40274
40299
  timer,
40275
40300
  executionSignal,
40276
40301
  turn.recordText
@@ -41024,11 +41049,13 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41024
41049
  sessions,
41025
41050
  receipt.attemptId,
41026
41051
  () => {
41027
- turn.accept();
41052
+ const stream = turn.accept();
41028
41053
  if (command.disposition !== SessionPromptDisposition.Steer) {
41029
41054
  activeAttemptIds.set(command.sessionId, receipt.attemptId);
41030
41055
  }
41056
+ return stream;
41031
41057
  },
41058
+ () => sessionAvailable(command),
41032
41059
  timer,
41033
41060
  turn.signal,
41034
41061
  turn.recordText