agent-bridge-qwenwork 1.0.41 → 1.0.42
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/README.md
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
提交前等待发送按钮就绪;窗口在插入、点击复查或回复轮询期间被最小化时,插件会恢复千问主窗口并继续确认。只有复查确认尚未点击时最多再尝试一次;仅备份并清理原会话内仍与本次请求完全一致的文字,保留用户后来修改的草稿。点击后无法确认提交状态时不会自动重发或清理输入,避免重复执行。
|
|
18
18
|
|
|
19
|
+
首轮发送后,千问可能先替换首页输入框,再挂载用户消息。插件会在限定时间内等待本次原文和原生任务身份就绪,再读取回复;等待期间的用户操作、页面变化或任务身份切换仍会使绑定失效。已点击发送后的绑定错误使用 `QWEN_SESSION_BIND_FAILED`,明确提示不会重复提交,不再标为尚未发送。
|
|
20
|
+
|
|
19
21
|
云端故障、账号额度不足或登录过期仍可能需要修复服务或账号,重连 CDP 本身不能证明上游模型可用。
|
|
20
22
|
|
|
21
23
|
文件、图片、视频附件经桌面原生上传入口送入本轮任务;回传只采集本轮助手通过“已展示最终文件”工具声明的产物,不扫描普通正文中的任意路径。图片按内容去重,视频以 `video/*` 文件附件交给 AUN,使用分块读取避免大视频导致 CDP 断连。单条最多 8 个附件,单个不超过 32 MiB、合计不超过 64 MiB;实际可处理的格式及内容理解能力由桌面端和模型决定。验证证据见仓库的 `docs/verification/2026-10-20-qwenwork-media.md`。
|
|
@@ -191,6 +191,7 @@ class QwenCdpClient {
|
|
|
191
191
|
}
|
|
192
192
|
async waitForAssignedTask(previous, reservationToken, submittedText) {
|
|
193
193
|
const deadline = Date.now() + Math.min(this.options.timeoutMs, 10_000);
|
|
194
|
+
let assigned;
|
|
194
195
|
while (Date.now() < deadline) {
|
|
195
196
|
const candidate = await this.evaluate(`(() => {
|
|
196
197
|
const state = ${taskStateExpression};
|
|
@@ -199,21 +200,31 @@ class QwenCdpClient {
|
|
|
199
200
|
const editorReplaced = state.editor !== ${previous.editor};
|
|
200
201
|
const oldEditorVisible = reservedEditor?.getClientRects?.().length > 0 && getComputedStyle(reservedEditor).visibility !== 'hidden'
|
|
201
202
|
&& !reservedEditor.closest('[inert],[hidden],[aria-hidden="true"]');
|
|
202
|
-
const
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
const replacementConfirmed = !oldEditorVisible && submittedMessage;
|
|
203
|
+
const userMessages = [...document.querySelectorAll('[data-message-id][data-conversation-user-text="true"],[data-message-id] [data-role="user"] [data-slot="session-user-text"]')]
|
|
204
|
+
.map(message => message.innerText.trim()).filter(Boolean);
|
|
205
|
+
const submittedMessage = userMessages.includes(${JSON.stringify(submittedText.trim())});
|
|
206
206
|
const currentEditor = [...document.querySelectorAll(${JSON.stringify(exports.inputSelector)})].find(editor => globalThis.__agentBridgeQwenEditors?.editors.get(editor) === state.editor);
|
|
207
207
|
if (state.url !== ${JSON.stringify(previous.url)}
|
|
208
208
|
|| reservation?.token !== ${JSON.stringify(reservationToken)}
|
|
209
|
-
|| (editorReplaced ? !
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
|| (editorReplaced ? oldEditorVisible || (userMessages.length > 0 && !submittedMessage) : reservedEditor !== currentEditor)) {
|
|
210
|
+
const reason = state.url !== ${JSON.stringify(previous.url)} ? '页面地址已变化'
|
|
211
|
+
: reservation?.token !== ${JSON.stringify(reservationToken)} ? '空白绑定已撤销'
|
|
212
|
+
: editorReplaced && oldEditorVisible ? '原编辑器仍可见'
|
|
213
|
+
: editorReplaced ? '用户消息与本次原文不符' : '编辑器绑定不符';
|
|
214
|
+
throw new Error('千问首轮原生任务页面、编辑器或空白绑定已失效(' + reason + '),任务可能已提交,请勿重复发送');
|
|
215
|
+
}
|
|
216
|
+
// 首页编辑器和用户消息分批挂载;消息未出现时继续等待,不能提前判为失败或确认绑定。
|
|
217
|
+
return { state, ready: !editorReplaced || submittedMessage };
|
|
213
218
|
})()`);
|
|
214
|
-
|
|
219
|
+
const state = candidate.state;
|
|
220
|
+
if (assigned && (state.chatId !== assigned.chatId || state.subChatId !== assigned.subChatId)) {
|
|
221
|
+
throw new Error("千问首轮等待绑定期间原生任务身份已切换,任务可能已提交,请勿重复发送");
|
|
222
|
+
}
|
|
223
|
+
if (state.chatId && state.subChatId)
|
|
224
|
+
assigned ??= state;
|
|
225
|
+
if (candidate.ready && state.chatId && state.subChatId) {
|
|
215
226
|
const verified = await this.readTaskState();
|
|
216
|
-
if (verified.chatId !==
|
|
227
|
+
if (verified.chatId !== state.chatId || verified.subChatId !== state.subChatId)
|
|
217
228
|
throw new Error("千问首轮任务身份已切换,任务可能已提交,请勿重复发送");
|
|
218
229
|
return verified;
|
|
219
230
|
}
|
|
@@ -466,8 +477,11 @@ class QwenCdpClient {
|
|
|
466
477
|
finally { if (reservation) reservation.submitting = false; }
|
|
467
478
|
return true;
|
|
468
479
|
})()`);
|
|
469
|
-
if (sent === true)
|
|
480
|
+
if (sent === true) {
|
|
481
|
+
stage = "确认千问办公任务绑定(已点击发送,不会重复提交)";
|
|
482
|
+
code = "QWEN_SESSION_BIND_FAILED";
|
|
470
483
|
break;
|
|
484
|
+
}
|
|
471
485
|
submitAttempted = false;
|
|
472
486
|
if (attempt === 1)
|
|
473
487
|
throw new 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.
|
|
20
|
+
version: "1.0.42",
|
|
21
21
|
displayName: "千问办公",
|
|
22
22
|
entry: "dist/index.js",
|
|
23
23
|
apiVersion: "1",
|
package/package.json
CHANGED