agent-bridge-qwenwork 1.0.42 → 1.0.43

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.
@@ -837,11 +837,25 @@ class QwenCdpClient {
837
837
  return (0, cdp_draft_1.recoverCdpDraft)(expression => this.evaluate(`(() => { if (!${taskGuard}) throw new Error('千问草稿恢复期间任务身份已变化'); return (${expression}); })()`.replaceAll(`document.querySelector(${JSON.stringify(exports.inputSelector)})`, visibleEditorExpression)), exports.inputSelector, 'button[aria-label="停止"],button[aria-label="停止生成"],button[aria-label="Stop generating"]', this.options.dataDir, expected);
838
838
  }
839
839
  async cdp(method, params = {}, timeoutMs = this.options.timeoutMs) {
840
- if (!this.socket)
840
+ const socket = this.socket;
841
+ if (!socket)
841
842
  throw new Error("CDP 尚未连接");
842
843
  const id = ++this.sequence;
843
844
  return new Promise((resolve, reject) => {
844
- const timer = setTimeout(() => { this.pending.delete(id); reject(new Error(`CDP ${method} 超时`)); }, timeoutMs);
845
+ const timer = setTimeout(() => {
846
+ this.pending.delete(id);
847
+ const error = new Error(`CDP ${method} 超时`);
848
+ // Runtime.evaluate 超时后旧 WebSocket 可能仍保持 OPEN,但已不能可靠地
849
+ // 接收响应。丢弃它,令下一条请求走插件的正常重连流程,避免继续复用失效连接。
850
+ if (this.socket === socket) {
851
+ this.socket = undefined;
852
+ socket.close();
853
+ for (const pending of this.pending.values())
854
+ pending.reject(error);
855
+ this.pending.clear();
856
+ }
857
+ reject(error);
858
+ }, timeoutMs);
845
859
  this.pending.set(id, {
846
860
  resolve: (value) => { clearTimeout(timer); resolve(value); },
847
861
  reject: (error) => { clearTimeout(timer); reject(error); },
@@ -17,7 +17,7 @@ const session_history_1 = require("./session-history");
17
17
  const ability_1 = require("./ability");
18
18
  exports.qwenworkManifest = {
19
19
  id: "qwenwork",
20
- version: "1.0.42",
20
+ version: "1.0.43",
21
21
  displayName: "千问办公",
22
22
  entry: "dist/index.js",
23
23
  apiVersion: "1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-qwenwork",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "agent-bridge 的千问办公插件。",
5
5
  "keywords": [
6
6
  "mu-agent-bridge-plugin",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "qwenwork",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "type": "agent",
5
5
  "displayName": "千问办公",
6
6
  "entry": "dist/src-ts/plugins/qwenwork/index.js",