@stamn/stamn-plugin 0.1.0-alpha.23 → 0.1.0-alpha.25

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/index.js CHANGED
@@ -3702,6 +3702,9 @@ var require_websocket_server = __commonJS({
3702
3702
  }
3703
3703
  });
3704
3704
 
3705
+ // src/index.ts
3706
+ import { randomUUID as randomUUID2 } from "crypto";
3707
+
3705
3708
  // node_modules/.pnpm/@clack+core@1.1.0/node_modules/@clack/core/dist/index.mjs
3706
3709
  var import_sisteransi = __toESM(require_src(), 1);
3707
3710
  import { styleText as D } from "util";
@@ -6145,18 +6148,32 @@ function dispatchOwnerChat(api, wsService, payload, agentId) {
6145
6148
  return;
6146
6149
  }
6147
6150
  const reply = api.runtime.channel.reply;
6151
+ const streamId = randomUUID2();
6152
+ let index = 0;
6148
6153
  try {
6149
6154
  const { dispatcher, replyOptions } = reply.createReplyDispatcherWithTyping({
6150
- deliver: async (outbound) => {
6155
+ deliver: async (outbound, info) => {
6151
6156
  const text2 = typeof outbound === "string" ? outbound : outbound?.text;
6152
6157
  if (!text2) {
6153
6158
  api.logger.warn("[stamn-channel] deliver: no text in outbound");
6154
6159
  return;
6155
6160
  }
6156
- wsService.send("participant:owner_chat_reply", {
6157
- participantId: agentId,
6158
- text: text2
6159
- });
6161
+ const kind = info?.kind ?? "final";
6162
+ if (kind === "block" || kind === "tool") {
6163
+ wsService.send("participant:owner_chat_stream", {
6164
+ participantId: agentId,
6165
+ streamId,
6166
+ kind,
6167
+ text: text2,
6168
+ index: index++
6169
+ });
6170
+ } else {
6171
+ wsService.send("participant:owner_chat_reply", {
6172
+ participantId: agentId,
6173
+ text: text2,
6174
+ streamId
6175
+ });
6176
+ }
6160
6177
  },
6161
6178
  channel: "stamn",
6162
6179
  accountId: agentId