@ynhcj/xiaoyi-channel 0.0.207-beta → 0.0.208-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.
@@ -3,6 +3,9 @@
3
3
  */
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
6
9
  import { CONFIG_FILE_NAME, ENV_FILE_PATH, REQUIRED_ENV_VARS } from './constants.js';
7
10
  import { logger } from '../utils/logger.js';
8
11
  let cachedConfig = null;
@@ -430,15 +430,16 @@ export function createXYReplyDispatcher(params) {
430
430
  }
431
431
  else {
432
432
  // 新文本不以已累积内容为前缀(如工具调用后模型重新开始生成),
433
- // 更新 accumulatedText 为当前文本,后续基于此新前缀做去重
433
+ // 重置 accumulatedText 为当前文本,后续基于此新前缀做去重
434
434
  const wasFirstRound = accumulatedText.length === 0;
435
- accumulatedText = "";
436
435
  // 新一轮输出前加换行分隔(第一轮除外)
437
436
  if (sendText.length > 0 && !wasFirstRound) {
438
437
  sendText = "\n" + sendText;
439
438
  }
440
439
  }
441
- accumulatedText += sendText;
440
+ // 始终追踪模型的原始输出文本,避免注入的 "\n" 前缀污染 accumulatedText
441
+ // 导致下一轮 startsWith 永久匹配失败
442
+ accumulatedText = text;
442
443
  hasSentResponse = true;
443
444
  if (sendText.length > 0) {
444
445
  await sendA2AResponse({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.207-beta",
3
+ "version": "0.0.208-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",