@moxt-ai/mobius 0.0.115 → 0.0.116

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/runtime.js CHANGED
@@ -23306,6 +23306,18 @@ var CODEX_META_KEY = "codex";
23306
23306
  function truncate(value, limit) {
23307
23307
  return value.length <= limit ? value : value.slice(0, limit);
23308
23308
  }
23309
+ function boundedParagraphs(values, limit) {
23310
+ let text = "";
23311
+ for (const value of values) {
23312
+ const separator = text.length === 0 ? "" : "\n\n";
23313
+ const remaining = limit - text.length;
23314
+ if (remaining <= separator.length) {
23315
+ break;
23316
+ }
23317
+ text += `${separator}${value.slice(0, remaining - separator.length)}`;
23318
+ }
23319
+ return text;
23320
+ }
23309
23321
  function textContent(text) {
23310
23322
  const block = { text: truncate(text, TOOL_OUTPUT_CHARACTER_LIMIT), type: "text" };
23311
23323
  return { content: block, type: "content" };
@@ -23423,6 +23435,12 @@ function decodeThreadItem(value) {
23423
23435
  const decoded = threadItemSchema.safeParse(value);
23424
23436
  return decoded.success ? decoded.data : null;
23425
23437
  }
23438
+ function reasoningText(item) {
23439
+ if (item.type !== "reasoning") {
23440
+ return null;
23441
+ }
23442
+ return boundedParagraphs(item.summary.length > 0 ? item.summary : item.content, TOOL_OUTPUT_CHARACTER_LIMIT);
23443
+ }
23426
23444
  function agentMessageMeta(phase) {
23427
23445
  if (phase == null) {
23428
23446
  return null;
@@ -24191,6 +24209,19 @@ var CodexAcpAgent = class {
24191
24209
  });
24192
24210
  return;
24193
24211
  }
24212
+ const reasoning = reasoningText(item);
24213
+ if (reasoning !== null) {
24214
+ if (method === "item/completed" && reasoning.length > 0) {
24215
+ await this.#enqueue(async () => {
24216
+ await this.#emit({
24217
+ content: { text: reasoning, type: "text" },
24218
+ messageId: item.id,
24219
+ sessionUpdate: "agent_thought_chunk"
24220
+ });
24221
+ });
24222
+ }
24223
+ return;
24224
+ }
24194
24225
  const update = toolCallUpdate(item, method === "item/completed" ? "completed" : "started");
24195
24226
  if (update !== null) {
24196
24227
  await this.#enqueue(async () => {