@ynhcj/xiaoyi-channel 0.0.147-next → 0.0.148-next

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.
@@ -166,15 +166,21 @@ export function createXYReplyDispatcher(params) {
166
166
  const text = payload.text ?? "";
167
167
  const currentTaskId = getActiveTaskId();
168
168
  const currentMessageId = getActiveMessageId();
169
- scopedLog().log(`[DELIVER] kind=${info?.kind}, text.length=${text.length}`);
169
+ // 🔑 诊断日志:确认 deliver 是否被调用及与 onPartialReply 的时序关系
170
+ scopedLog().log(`[DELIVER] Called, kind=${info?.kind}, text.length=${text.length}, hasSentResponse=${hasSentResponse}, preview="${text.slice(0, 50)}"`);
170
171
  try {
171
172
  if (!text.trim()) {
172
173
  scopedLog().log(`[DELIVER SKIP] Empty text, skipping`);
173
174
  return;
174
175
  }
176
+ // 🔑 如果 onPartialReply 已经流式发送过文本,deliver 不再重复发送
177
+ if (hasSentResponse) {
178
+ scopedLog().log(`[DELIVER SKIP] Already sent via onPartialReply, skipping duplicate delivery`);
179
+ return;
180
+ }
175
181
  accumulatedText += text;
176
182
  hasSentResponse = true;
177
- scopedLog().log(`[DELIVER] Sending text chunk via A2A response, length=${text.length}`);
183
+ scopedLog().log(`[DELIVER] First delivery, sending via A2A response, length=${text.length}`);
178
184
  // 🔑 使用动态taskId发送A2A响应(流式append)
179
185
  await sendA2AResponse({
180
186
  config,
@@ -394,7 +400,8 @@ export function createXYReplyDispatcher(params) {
394
400
  const currentTaskId = getActiveTaskId();
395
401
  const currentMessageId = getActiveMessageId();
396
402
  const text = payload.text ?? "";
397
- scopedLog().log(`[REASONING-STREAM] Reasoning chunk received, text.length: ${text.length}`);
403
+ // 🔑 诊断日志:确认 onReasoningStream 是否被触发
404
+ scopedLog().log(`[REASONING-STREAM] *** CALLED *** text.length=${text.length}, preview="${text.slice(0, 80)}"`);
398
405
  try {
399
406
  if (text.length > 0) {
400
407
  // 🔑 将模型真实的thinking/reasoning内容通过reasoningText转发
@@ -406,6 +413,7 @@ export function createXYReplyDispatcher(params) {
406
413
  text,
407
414
  append: true,
408
415
  });
416
+ scopedLog().log(`[REASONING-STREAM] Sent via sendReasoningTextUpdate(append:true)`);
409
417
  }
410
418
  }
411
419
  catch (err) {
@@ -420,20 +428,27 @@ export function createXYReplyDispatcher(params) {
420
428
  const currentTaskId = getActiveTaskId();
421
429
  const currentMessageId = getActiveMessageId();
422
430
  const text = payload.text ?? "";
431
+ // 🔑 诊断日志:确认 onPartialReply 是否被调用及内容
432
+ scopedLog().log(`[PARTIAL-REPLY] Called, text.length=${text.length}, preview="${text.slice(0, 50)}"`);
423
433
  try {
424
434
  if (text.length > 0) {
425
- await sendReasoningTextUpdate({
435
+ accumulatedText += text;
436
+ hasSentResponse = true;
437
+ // 🔑 流式文本通过 A2A text 通道发送(而非 reasoningText)
438
+ await sendA2AResponse({
426
439
  config,
427
440
  sessionId,
428
441
  taskId: currentTaskId,
429
442
  messageId: currentMessageId,
430
443
  text,
431
- append: false,
444
+ append: true,
445
+ final: false,
432
446
  });
447
+ scopedLog().log(`[PARTIAL-REPLY] Sent via sendA2AResponse(append:true, final:false)`);
433
448
  }
434
449
  }
435
450
  catch (err) {
436
- scopedLog().error(`[PARTIAL REPLY] Failed to send partial reply:`, err);
451
+ scopedLog().error(`[PARTIAL-REPLY] Failed to send partial reply:`, err);
437
452
  }
438
453
  },
439
454
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.147-next",
3
+ "version": "0.0.148-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",