@ynhcj/xiaoyi-channel 0.0.230-next → 0.0.231-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.
@@ -203,16 +203,19 @@ export function createXYReplyDispatcher(params) {
203
203
  scopedLog().log(`[DELIVER SKIP] Empty text, skipping`);
204
204
  return;
205
205
  }
206
- // 捕获权威最终文本(canonical,来自最后一条 assistant 消息,
207
- // 非流式累计),供 onIdle 拼接最终帧。compaction 通知不是答案
208
- // 文本,不能污染 finalReplyText。
209
- // ⚙️ 前缀是 openclaw 系统消息的稳定标记(infra/system-message.ts
210
- // SYSTEM_MARK),如 ACP 绑定会话投递的 "Session ids resolved"
211
- // 诊断通知 —— 它会在同一 run 内尾随真实答案以 kind=final 投递,
212
- // 若被捕获,最终帧会把客户端气泡里的答案整体替换成通知文本。
206
+ // 捕获权威最终文本(canonical),供 onIdle 拼接最终帧。
207
+ // 真正的 assistant 回复带有 assistantMessageIndex 元数据,系统通知
208
+ // (如 ⚙️ Session ids resolved. 诊断通知)没有此字段。assistant
209
+ // 回复始终可信,系统通知仅在没有已捕获答案时作为兜底(如纯报错场景)。
213
210
  if (info?.kind === "final" && !payload.isCompactionNotice) {
214
- finalReplyText = text;
215
- scopedLog().log(`[DELIVER] Captured final reply text, length=${finalReplyText.length}`);
211
+ const isAssistantReply = info?.assistantMessageIndex !== undefined;
212
+ if (isAssistantReply || !finalReplyText) {
213
+ finalReplyText = text;
214
+ scopedLog().log(`[DELIVER] Captured final reply text, length=${finalReplyText.length}${isAssistantReply ? "" : " (fallback)"}`);
215
+ }
216
+ else {
217
+ scopedLog().log(`[DELIVER] Skip non-assistant notification, keeping finalReplyText length=${finalReplyText.length}`);
218
+ }
216
219
  }
217
220
  // onPartialReply 已经通过 append:false 全量发送了所有文本,deliver 不再重复发送
218
221
  if (hasSentResponse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.230-next",
3
+ "version": "0.0.231-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",