@ynhcj/xiaoyi-channel 0.0.118-next → 0.0.119-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/bot.js +11 -12
- package/dist/src/reply-dispatcher.js +5 -0
- package/package.json +1 -1
package/dist/src/bot.js
CHANGED
|
@@ -186,6 +186,11 @@ export async function handleXYMessage(params) {
|
|
|
186
186
|
logger.error(`[SELF_EVOLUTION] Failed to append inline keyword nudge: ${String(selfEvolutionError)}`);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
+
// 🔑 Steer消息加 /steer 前缀,触发core的 queueEmbeddedPiMessage
|
|
190
|
+
if (isUpdate && textForAgent) {
|
|
191
|
+
textForAgent = `/steer ${textForAgent}`;
|
|
192
|
+
logger.log(`[BOT] 🔄 Prepended /steer for steer injection`);
|
|
193
|
+
}
|
|
189
194
|
const fileParts = extractFileParts(parsed.parts);
|
|
190
195
|
// Download files to local disk
|
|
191
196
|
const downloadedFiles = await downloadFilesFromParts(fileParts);
|
|
@@ -231,9 +236,10 @@ export async function handleXYMessage(params) {
|
|
|
231
236
|
ReplyToBody: undefined, // A2A protocol doesn't support reply/quote
|
|
232
237
|
...mediaPayload,
|
|
233
238
|
});
|
|
234
|
-
// 🔑 Dynamic steer state:
|
|
235
|
-
//
|
|
236
|
-
|
|
239
|
+
// 🔑 Dynamic steer state: when isUpdate (second message), start as steered=true
|
|
240
|
+
// so the dispatcher skips all user-facing callbacks (deliver, onIdle, etc.)
|
|
241
|
+
// and onSettled skips cleanup.
|
|
242
|
+
const steerState = { steered: isUpdate };
|
|
237
243
|
// 🔑 创建dispatcher
|
|
238
244
|
logger.log(`[BOT-DISPATCHER] 🎯 Creating reply dispatcher`);
|
|
239
245
|
logger.log(`[BOT-DISPATCHER] - taskId: ${parsed.taskId}`);
|
|
@@ -291,15 +297,8 @@ export async function handleXYMessage(params) {
|
|
|
291
297
|
dispatcher,
|
|
292
298
|
replyOptions,
|
|
293
299
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
steerState.steered = true;
|
|
297
|
-
logger.log(`[BOT-DISPATCH] ✅ Message steered into active Pi run`);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
logger.log(`[BOT-DISPATCH] ✅ dispatchReplyFromConfig returned`);
|
|
301
|
-
logger.log(`[BOT-DISPATCH] - result: ${JSON.stringify(result)}`);
|
|
302
|
-
}
|
|
300
|
+
logger.log(`[BOT-DISPATCH] ✅ dispatchReplyFromConfig returned`);
|
|
301
|
+
logger.log(`[BOT-DISPATCH] - result: ${JSON.stringify(result)}`);
|
|
303
302
|
return result;
|
|
304
303
|
}
|
|
305
304
|
catch (dispatchErr) {
|
|
@@ -113,6 +113,11 @@ export function createXYReplyDispatcher(params) {
|
|
|
113
113
|
logger.log(`[REPLY START] Reply started for session ${sessionId}, taskId=${currentTaskId}, steered=${steerState.steered}`);
|
|
114
114
|
},
|
|
115
115
|
deliver: async (payload, info) => {
|
|
116
|
+
// 🔑 steered dispatch不发送内容(让主dispatcher处理)
|
|
117
|
+
if (steerState.steered) {
|
|
118
|
+
logger.log(`[DELIVER] Steered dispatch - skipping deliver, info.kind=${info?.kind}`);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
116
121
|
const text = payload.text ?? "";
|
|
117
122
|
const currentTaskId = getActiveTaskId();
|
|
118
123
|
const currentMessageId = getActiveMessageId();
|