@ynhcj/xiaoyi-channel 0.0.140-beta → 0.0.142-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.
Files changed (2) hide show
  1. package/dist/src/bot.js +16 -2
  2. package/package.json +1 -1
package/dist/src/bot.js CHANGED
@@ -204,11 +204,19 @@ export async function handleXYMessage(params) {
204
204
  // 回调,onInitComplete 永远不会被触发。如果不释放,后续消息
205
205
  // 会被 globalDispatchInitGate 永久阻塞。
206
206
  params.onInitComplete?.();
207
+ // Steer 也支持文件 —— 提取并下载,附带到 mediaPayload
208
+ const steerFileParts = extractFileParts(parsed.parts);
209
+ const steerDownloadedFiles = await downloadFilesFromParts(steerFileParts);
210
+ const steerMediaPayload = buildXYMediaPayload(steerDownloadedFiles);
211
+ if (steerFileParts.length > 0) {
212
+ logger.log(`[BOT] 📎 Steer message with files: ${steerFileParts.length} file(s)`);
213
+ }
207
214
  logger.log(`[BOT] 🔄 Steer message — enqueuing to streaming-signal queue`);
208
215
  await enqueueSteer({
209
216
  sessionId: parsed.sessionId,
210
217
  sessionKey: route.sessionKey,
211
218
  steerText: textForAgent, // 原始文本,不带 /steer 前缀
219
+ mediaPayload: steerMediaPayload,
212
220
  cfg,
213
221
  runtime,
214
222
  parsed,
@@ -446,7 +454,9 @@ function enqueueSteer(params) {
446
454
  const next = (prev ?? Promise.resolve()).then(() => dispatchSteerWhenReady(params));
447
455
  steerQueues.set(sessionId, next);
448
456
  // 链条结束后清理
449
- next.catch(() => { }).finally(() => {
457
+ next.catch((err) => {
458
+ logger.error(`[STEER-QUEUE] ❌ Steer chain failed: ${String(err)}`);
459
+ }).finally(() => {
450
460
  if (steerQueues.get(sessionId) === next) {
451
461
  steerQueues.delete(sessionId);
452
462
  }
@@ -479,7 +489,10 @@ async function dispatchSteerWhenReady(params) {
479
489
  logger.log(`[STEER-QUEUE] ✅ Streaming signal received, session=${sessionId}`);
480
490
  }
481
491
  else {
482
- logger.log(`[STEER-QUEUE] ⚠️ Signal never appeared, proceeding without wait`);
492
+ // 轮询超时且 hasActiveTask 仍为 true——说明第一条消息可能卡在异常路径,
493
+ // 没有创建 signal。此时 dispatch 会与第一条消息的模型调用并发冲突,放弃。
494
+ logger.log(`[STEER-QUEUE] ⚠️ Signal never appeared after polling, skip steer to avoid collision`);
495
+ return;
483
496
  }
484
497
  // 2. 第一条消息已结束 → 放弃
485
498
  if (!hasActiveTask(sessionId)) {
@@ -520,6 +533,7 @@ async function dispatchSteerWhenReady(params) {
520
533
  OriginatingChannel: "xiaoyi-channel",
521
534
  OriginatingTo: sessionId,
522
535
  ReplyToBody: undefined,
536
+ ...params.mediaPayload,
523
537
  });
524
538
  const steerState = { steered: true };
525
539
  const { dispatcher, replyOptions } = createXYReplyDispatcher({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.140-beta",
3
+ "version": "0.0.142-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",