@moxt-ai/mobius 0.0.46 → 0.0.47

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
@@ -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.46",
14
+ version: "0.0.47",
15
15
  description: "Mobius CLI for pairing and running local AI agent services.",
16
16
  type: "module",
17
17
  bin: {
@@ -34347,7 +34347,7 @@ var AcpProcessSession = class _AcpProcessSession {
34347
34347
  #preSessionUpdateBytes = 0;
34348
34348
  #agentName = "";
34349
34349
  #agentVersion = "";
34350
- #bufferedAgentText = null;
34350
+ #bufferedAgentText = [];
34351
34351
  #capabilities = {
34352
34352
  additionalDirectories: false,
34353
34353
  audioPrompt: false,
@@ -34536,20 +34536,30 @@ var AcpProcessSession = class _AcpProcessSession {
34536
34536
  });
34537
34537
  };
34538
34538
  bufferAgentText = async (text3, messageId) => {
34539
- if (this.#bufferedAgentText !== null && this.#bufferedAgentText.messageId !== messageId) {
34540
- await this.emitAgentMessage(this.#bufferedAgentText.chunks, this.#bufferedAgentText.messageId);
34541
- this.#bufferedAgentText = null;
34539
+ const previous2 = this.#bufferedAgentText.at(-1);
34540
+ if (previous2?.messageId === messageId) {
34541
+ this.#bufferedAgentText = [
34542
+ ...this.#bufferedAgentText.slice(0, -1),
34543
+ { chunks: [...previous2.chunks, text3], messageId }
34544
+ ];
34545
+ return;
34542
34546
  }
34543
- this.#bufferedAgentText = {
34544
- chunks: [...this.#bufferedAgentText?.chunks ?? [], text3],
34545
- messageId
34546
- };
34547
+ this.#bufferedAgentText = [...this.#bufferedAgentText, { chunks: [text3], messageId }];
34547
34548
  };
34548
34549
  flushAgentText = async () => {
34549
34550
  const buffered = this.#bufferedAgentText;
34550
- this.#bufferedAgentText = null;
34551
- if (buffered !== null) {
34552
- await this.emitAgentMessage(buffered.chunks, buffered.messageId);
34551
+ this.#bufferedAgentText = [];
34552
+ for (const message of buffered) {
34553
+ await this.emitAgentMessage(message.chunks, message.messageId);
34554
+ }
34555
+ };
34556
+ recordBufferedAgentTextAsProgress = async () => {
34557
+ const buffered = this.#bufferedAgentText;
34558
+ this.#bufferedAgentText = [];
34559
+ for (const message of buffered) {
34560
+ for (const chunk of message.chunks) {
34561
+ await this.#turn.activities.recordNarrative("progress", message.messageId, chunk);
34562
+ }
34553
34563
  }
34554
34564
  };
34555
34565
  prepareAgentContent = async (content3) => {
@@ -35063,7 +35073,7 @@ var AcpProcessSession = class _AcpProcessSession {
35063
35073
  cause: error62
35064
35074
  });
35065
35075
  } finally {
35066
- this.#bufferedAgentText = null;
35076
+ this.#bufferedAgentText = [];
35067
35077
  this.#turn = new IdleAcpTurn();
35068
35078
  }
35069
35079
  };
@@ -35378,6 +35388,7 @@ var AcpProcessSession = class _AcpProcessSession {
35378
35388
  return;
35379
35389
  }
35380
35390
  if (update.sessionUpdate === "tool_call") {
35391
+ await this.recordBufferedAgentTextAsProgress();
35381
35392
  await this.#turn.activities.recordToolCall(update);
35382
35393
  return;
35383
35394
  }