zooid 0.7.3 → 0.7.4

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/bin.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  renderRegistration,
16
16
  startDaemonSocketServer,
17
17
  startWorkforcePublisher
18
- } from "./chunk-3IKBBKGI.js";
18
+ } from "./chunk-OKGNOROJ.js";
19
19
 
20
20
  // src/bin.ts
21
21
  import { resolve as resolve5 } from "path";
@@ -23352,7 +23352,11 @@ function acpUpdateToAgentEvent(notif) {
23352
23352
  return {
23353
23353
  type: "agent_message_chunk",
23354
23354
  sessionId,
23355
- content: update.content
23355
+ content: update.content,
23356
+ // `messageId` is not part of the ACP `agent_message_chunk` schema, but
23357
+ // opencode includes it. Forward it so transports can split on message
23358
+ // boundaries; harmlessly undefined for agents that omit it.
23359
+ messageId: update.messageId
23356
23360
  };
23357
23361
  case "tool_call":
23358
23362
  return {
@@ -25589,6 +25593,7 @@ function createMatrixTransport(opts) {
25589
25593
  const pool = new BotPool(client, bindings);
25590
25594
  const sessions = /* @__PURE__ */ new Map();
25591
25595
  const buffers = /* @__PURE__ */ new Map();
25596
+ const bufferMessageIds = /* @__PURE__ */ new Map();
25592
25597
  const sendQueue = /* @__PURE__ */ new Map();
25593
25598
  const threadStates = /* @__PURE__ */ new Map();
25594
25599
  const cutoffTs = Date.now() - STARTUP_GRACE_MS;
@@ -25603,8 +25608,13 @@ function createMatrixTransport(opts) {
25603
25608
  const block = event.content;
25604
25609
  if (block.type === "text" && typeof block.text === "string") {
25605
25610
  const current = buffers.get(event.sessionId) ?? "";
25606
- const prefix = block.text === "" && current.length > 0 ? "\n\n" : "";
25611
+ const prevMessageId = bufferMessageIds.get(event.sessionId);
25612
+ const messageChanged = event.messageId !== void 0 && prevMessageId !== void 0 && event.messageId !== prevMessageId;
25613
+ const needsBreak = current.length > 0 && (block.text === "" || messageChanged);
25614
+ const prefix = needsBreak ? "\n\n" : "";
25607
25615
  buffers.set(event.sessionId, current + prefix + block.text);
25616
+ if (event.messageId !== void 0)
25617
+ bufferMessageIds.set(event.sessionId, event.messageId);
25608
25618
  } else {
25609
25619
  console.warn(`[matrix:${name}] dropped chunk block type=${block.type}`, block);
25610
25620
  }
@@ -25847,6 +25857,7 @@ function createMatrixTransport(opts) {
25847
25857
  const sessionId = await agents.ensureSession(agent.name, sessionKey, evt.room_id);
25848
25858
  sessions.set(sessionId, { agent, roomId: evt.room_id, threadRoot });
25849
25859
  buffers.set(sessionId, "");
25860
+ bufferMessageIds.delete(sessionId);
25850
25861
  const roomId = evt.room_id;
25851
25862
  const TYPING_TTL_MS = 3e4;
25852
25863
  const TYPING_REFRESH_MS = 25e3;
@@ -25907,6 +25918,7 @@ function createMatrixTransport(opts) {
25907
25918
  await safeTyping(false);
25908
25919
  await safePresence("online");
25909
25920
  buffers.delete(sessionId);
25921
+ bufferMessageIds.delete(sessionId);
25910
25922
  }
25911
25923
  }
25912
25924
  return {
@@ -31585,4 +31597,4 @@ export {
31585
31597
  startDaemonSocketServer,
31586
31598
  buildAcpRegistry
31587
31599
  };
31588
- //# sourceMappingURL=chunk-3IKBBKGI.js.map
31600
+ //# sourceMappingURL=chunk-OKGNOROJ.js.map