@ynhcj/xiaoyi-channel 0.0.204-beta → 0.0.205-beta

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.
@@ -128,6 +128,7 @@ function createRetryingStream(createStream, cronJob) {
128
128
  let hasContent = false;
129
129
  const buffer = [];
130
130
  let errorResult = null;
131
+ const fullResponseEvents = [];
131
132
  for await (const event of stream) {
132
133
  const isContent = CONTENT_EVENT_TYPES.has(event.type);
133
134
  if (!hasContent && !isContent) {
@@ -150,9 +151,14 @@ function createRetryingStream(createStream, cronJob) {
150
151
  if (!hasContent) {
151
152
  logger.log("[xiaoyiprovider] first content event received, switching to streaming mode");
152
153
  hasContent = true;
153
- for (const b of buffer)
154
+ for (const b of buffer) {
155
+ if (CONTENT_EVENT_TYPES.has(b.type))
156
+ fullResponseEvents.push(b);
154
157
  yield b;
158
+ }
155
159
  }
160
+ if (isContent)
161
+ fullResponseEvents.push(event);
156
162
  // IMPORTANT: resolve result() BEFORE yielding terminal events to avoid deadlock.
157
163
  // The SDK calls result() when it sees done/error — if we yield first, the generator
158
164
  // suspends and can never reach resolve, causing a permanent deadlock.
@@ -424,9 +424,15 @@ export function createXYReplyDispatcher(params) {
424
424
  // 模型可能返回完整文本(非纯增量),如果新文本以已累积内容开头,
425
425
  // 则只取新增的后缀部分,避免 append 模式下重复拼接。
426
426
  let sendText = text;
427
- if (accumulatedText.length > 0 && text.startsWith(accumulatedText)) {
427
+ const dedupApplied = accumulatedText.length > 0 && text.startsWith(accumulatedText);
428
+ if (dedupApplied) {
428
429
  sendText = text.slice(accumulatedText.length);
429
430
  }
431
+ else {
432
+ // 新文本不以已累积内容为前缀(如工具调用后模型重新开始生成),
433
+ // 更新 accumulatedText 为当前文本,后续基于此新前缀做去重
434
+ accumulatedText = "";
435
+ }
430
436
  accumulatedText += sendText;
431
437
  hasSentResponse = true;
432
438
  if (sendText.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.204-beta",
3
+ "version": "0.0.205-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  }
50
50
  },
51
51
  "peerDependencies": {
52
- "openclaw": ">=2026.5.6"
52
+ "openclaw": ">=2026.6.6"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "openclaw": {