@ynhcj/xiaoyi-channel 0.0.225-next → 0.0.226-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.
- package/dist/src/dispatch/outbound.js +20 -12
- package/package.json +1 -1
|
@@ -115,16 +115,18 @@ export const xyOutbound = {
|
|
|
115
115
|
chatId: typeof to === "string" ? to : "",
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
// ── Subagent completion text capture
|
|
118
|
+
// ── Subagent completion text capture + push 抑制 ─────────────
|
|
119
119
|
// Subagent completions may arrive here when openclaw's announce
|
|
120
120
|
// flow delivers through the channel outbound. We capture the text
|
|
121
121
|
// for the final A2A response but do NOT track delivery count here.
|
|
122
122
|
// Delivery tracking is done by the subagent_ended hook (index.ts).
|
|
123
123
|
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
124
|
+
// 正常对话的 subagent announce 一律不发 push:结果由保活机制经
|
|
125
|
+
// A2A final 帧交付,push webhook 通知冗余。返回合成成功(与 cron
|
|
126
|
+
// 吞没路径同理),保证 openclaw durable-delivery 记账正常,避免
|
|
127
|
+
// 触发 direct-primary fallback 重试。
|
|
128
|
+
// cron 的 announce 不受此分支影响:cron sendText 无 target
|
|
129
|
+
// (DEFAULT_PUSH_MARKER),且 cron 会话不存在 wait state,push 照常。
|
|
128
130
|
if (to && to !== DEFAULT_PUSH_MARKER) {
|
|
129
131
|
const [targetSessionId, targetTaskId] = String(to).split("::");
|
|
130
132
|
const waitState = getWaitState(targetSessionId, targetTaskId);
|
|
@@ -132,15 +134,21 @@ export const xyOutbound = {
|
|
|
132
134
|
// 同样携带父会话 ALS 上下文(resolveTarget 据此增强 target),ALS guard
|
|
133
135
|
// 会把 announce 误判为父 turn 自己的 sendText 而漏捕获。
|
|
134
136
|
// 改用 parentSettled 区分:父 run 存活期间的 sendText 是父自己的 message
|
|
135
|
-
//
|
|
136
|
-
// subagent 完成结果的 announce
|
|
137
|
+
// 工具调用(不捕获、push 照常);父 settle 后命中 waitState 的 sendText
|
|
138
|
+
// 即为 subagent 完成结果的 announce 投递(捕获 + 吞掉 push)。
|
|
137
139
|
const isFromWaitState = waitState && waitState.parentSettled;
|
|
138
|
-
if (isFromWaitState
|
|
140
|
+
if (isFromWaitState) {
|
|
139
141
|
const log = logger.withContext(waitState.sessionId, waitState.taskId);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
if (!waitState.finalizationClaimed) {
|
|
143
|
+
log.log(`[xyOutbound.sendText] Subagent completion text captured, len=${text?.length ?? 0}`);
|
|
144
|
+
addCompletionText(targetSessionId, targetTaskId, text);
|
|
145
|
+
}
|
|
146
|
+
log.log(`[xyOutbound.sendText] Subagent announce — swallowing push (result delivered via A2A final frame)`);
|
|
147
|
+
return {
|
|
148
|
+
channel: "xiaoyi-channel",
|
|
149
|
+
messageId: `subagent-swallowed-${Date.now()}`,
|
|
150
|
+
chatId: typeof to === "string" ? to : "",
|
|
151
|
+
};
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
154
|
// ── End subagent text capture ───────────────────────────────
|