@ynhcj/xiaoyi 2.2.6 → 2.2.8

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/channel.js CHANGED
@@ -381,6 +381,18 @@ exports.xiaoyiPlugin = {
381
381
  console.log("=".repeat(60) + "\n");
382
382
  return;
383
383
  }
384
+ // ==================== CHECK EMPTY RESPONSE ====================
385
+ // If response is empty, don't clear timeout (let it trigger)
386
+ if (!completeText || completeText.length === 0) {
387
+ console.log("\n" + "=".repeat(60));
388
+ console.log(`[TIMEOUT] Empty response detected`);
389
+ console.log(` Session: ${message.sessionId}`);
390
+ console.log(` Elapsed: ${elapsed}ms`);
391
+ console.log(` Action: KEEPING TIMEOUT (session conflict detected)`);
392
+ console.log("=".repeat(60) + "\n");
393
+ // Don't send anything, and don't clear timeout
394
+ return;
395
+ }
384
396
  console.log("\n" + "-".repeat(60));
385
397
  console.log(`XiaoYi: [DELIVER] AI response received`);
386
398
  console.log(` Elapsed: ${elapsed}ms`);
@@ -421,9 +433,16 @@ exports.xiaoyiPlugin = {
421
433
  console.log(`XiaoYi: [IDLE] Processing complete`);
422
434
  console.log(` Total time: ${elapsed}ms`);
423
435
  console.log(` Final length: ${accumulatedText.length} chars`);
436
+ // Only clear timeout if we have a valid response
437
+ // If empty, keep timeout running to handle session conflict
438
+ if (accumulatedText.length > 0) {
439
+ runtime.markSessionCompleted(message.sessionId);
440
+ console.log(`[TIMEOUT] Timeout cleared (valid response)\n`);
441
+ }
442
+ else {
443
+ console.log(`[TIMEOUT] Keeping timeout (no valid response)\n`);
444
+ }
424
445
  console.log("=".repeat(60) + "\n");
425
- // Clear timeout on completion
426
- runtime.markSessionCompleted(message.sessionId);
427
446
  },
428
447
  },
429
448
  replyOptions: undefined,
package/dist/runtime.js CHANGED
@@ -112,8 +112,15 @@ class XiaoYiRuntime {
112
112
  console.log(`[TIMEOUT] Timeout disabled, skipping for session ${sessionId}`);
113
113
  return undefined;
114
114
  }
115
- // Clear existing timeout if any
115
+ // Clear existing timeout AND timeout flag if any (reuse session scenario)
116
+ const hadExistingTimeout = this.sessionTimeoutMap.has(sessionId);
117
+ const hadSentTimeout = this.sessionTimeoutSent.has(sessionId);
116
118
  this.clearSessionTimeout(sessionId);
119
+ // Also clear the timeout sent flag to allow this session to timeout again
120
+ if (hadSentTimeout) {
121
+ this.sessionTimeoutSent.delete(sessionId);
122
+ console.log(`[TIMEOUT] Previous timeout flag cleared for session ${sessionId} (session reuse)`);
123
+ }
117
124
  const timeoutId = setTimeout(() => {
118
125
  console.log(`[TIMEOUT] Timeout triggered for session ${sessionId}`);
119
126
  this.sessionTimeoutMap.delete(sessionId);
@@ -121,7 +128,8 @@ class XiaoYiRuntime {
121
128
  callback();
122
129
  }, this.timeoutConfig.duration);
123
130
  this.sessionTimeoutMap.set(sessionId, timeoutId);
124
- console.log(`[TIMEOUT] ${this.timeoutConfig.duration}ms timeout started for session ${sessionId}`);
131
+ const logSuffix = hadExistingTimeout ? " (replacing existing timeout)" : "";
132
+ console.log(`[TIMEOUT] ${this.timeoutConfig.duration}ms timeout started for session ${sessionId}${logSuffix}`);
125
133
  return timeoutId;
126
134
  }
127
135
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "XiaoYi channel plugin for OpenClaw",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",