@ynhcj/xiaoyi 2.1.9 → 2.2.0

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/channel.js +3 -32
  2. package/package.json +1 -1
package/dist/channel.js CHANGED
@@ -364,44 +364,15 @@ exports.xiaoyiPlugin = {
364
364
  }
365
365
  });
366
366
  // Setup cancel handler
367
- // Note: The response is already sent in websocket.ts, this is just for additional handling
367
+ // Note: The response is already sent in websocket.ts, this is just for logging
368
368
  connection.on("cancel", async (data) => {
369
369
  console.log("\n" + "=".repeat(60));
370
370
  console.log(`XiaoYi: [CANCEL] Cancel event received (response already sent)`);
371
371
  console.log(` Session: ${data.sessionId}`);
372
372
  console.log(` Task ID: ${data.taskId || "N/A"}`);
373
373
  console.log("=".repeat(60) + "\n");
374
- // Try to abort the running agent by clearing session queues
375
- // This prevents new messages from being queued and may interrupt streaming
376
- try {
377
- const sessionKey = `xiaoyi:${resolvedAccount.accountId}:${data.sessionId}`;
378
- // Try to load and use clearSessionQueues from OpenClaw at runtime
379
- // Use require() instead of import to avoid TypeScript compilation errors
380
- const clearSessionQueues = (() => {
381
- try {
382
- // Try direct require first (works when openclaw is installed as dependency)
383
- const queueModule = require("openclaw/dist/auto-reply/reply/queue.js");
384
- return queueModule.clearSessionQueues;
385
- }
386
- catch {
387
- return null;
388
- }
389
- })();
390
- if (clearSessionQueues) {
391
- const cleared = clearSessionQueues([sessionKey]);
392
- console.log(`XiaoYi: [CANCEL] Cleared session queues:`, cleared);
393
- }
394
- else {
395
- console.log(`XiaoYi: [CANCEL] clearSessionQueues not available, skipping queue cleanup`);
396
- }
397
- }
398
- catch (error) {
399
- console.log(`XiaoYi: [CANCEL] Could not clear session queues:`, error);
400
- }
401
- // NOTE: True cancellation of the in-progress agent run requires OpenClaw's internal
402
- // abortEmbeddedPiRun function, which needs the internal sessionId from session store.
403
- // This channel plugin acknowledges the cancel request, but actual agent interruption
404
- // depends on OpenClaw's internal mechanisms.
374
+ // NOTE: The cancel response has already been sent to XiaoYi in websocket.ts.
375
+ // Actual cancellation of the agent run depends on OpenClaw's internal mechanisms.
405
376
  });
406
377
  console.log("XiaoYi: Event handlers registered");
407
378
  console.log("XiaoYi: startAccount() completed - END");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi",
3
- "version": "2.1.9",
3
+ "version": "2.2.0",
4
4
  "description": "XiaoYi channel plugin for OpenClaw",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",