agent-bridge-qwenwork 1.0.11 → 1.0.12

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.
@@ -71,6 +71,7 @@ class QwenCdpClient {
71
71
  verifyQwenHeartbeatReply(token, reply);
72
72
  }
73
73
  async createSession(_name) {
74
+ await this.ensureVisible();
74
75
  await this.recoverDraft();
75
76
  const snapshot = `(() => ({ url: location.href, messages: document.querySelectorAll('[data-message-id]').length, input: document.querySelector(${JSON.stringify(exports.inputSelector)})?.innerText ?? null, blank: Boolean(document.querySelector('.new-task-model-selector')) }))()`;
76
77
  const before = await this.evaluate(snapshot);
@@ -149,6 +150,7 @@ class QwenCdpClient {
149
150
  if (typeof draft === "string" && draft.trim() && !isQwenBridgeHealthPrompt(draft))
150
151
  throw new Error("千问输入框有用户草稿,跳过后台健康检测");
151
152
  }
153
+ await this.ensureVisible();
152
154
  await this.recoverDraft();
153
155
  const ready = await this.evaluate(`(() => { const input = document.querySelector(${JSON.stringify(exports.inputSelector)}); return Boolean(input && !input.innerText.trim() && !document.querySelector('button[aria-label="停止生成"],button[aria-label="Stop generating"]')); })()`);
154
156
  if (!ready)
@@ -202,6 +204,13 @@ class QwenCdpClient {
202
204
  this.pending.delete(message.id);
203
205
  pending.resolve(message);
204
206
  }
207
+ async ensureVisible() {
208
+ await this.evaluate(`(async () => {
209
+ if (document.querySelector('button[aria-label="停止生成"],button[aria-label="Stop generating"]')) throw new Error('千问桌面端正在生成回复');
210
+ // 隐藏窗口会暂停消息渲染,使桌面端的提交前检查一直等不到确认。
211
+ if (document.hidden && typeof window.desktopApi?.focusMainWindow === 'function') await window.desktopApi.focusMainWindow();
212
+ })()`);
213
+ }
205
214
  recoverDraft() {
206
215
  return (0, cdp_draft_1.recoverCdpDraft)(this.evaluate.bind(this), exports.inputSelector, 'button[aria-label="停止生成"],button[aria-label="Stop generating"]', this.options.dataDir);
207
216
  }
@@ -11,7 +11,7 @@ const desktop_launch_1 = require("../desktop-launch");
11
11
  const CHAT_HEARTBEAT_INTERVAL_MS = 2 * 60 * 60_000;
12
12
  exports.qwenworkManifest = {
13
13
  id: "qwenwork",
14
- version: "1.0.11",
14
+ version: "1.0.12",
15
15
  displayName: "千问办公",
16
16
  entry: "dist/index.js",
17
17
  apiVersion: "1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-qwenwork",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
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.11",
3
+ "version": "1.0.12",
4
4
  "type": "agent",
5
5
  "displayName": "千问办公",
6
6
  "entry": "dist/src-ts/plugins/qwenwork/index.js",