mu-agent-bridge 1.0.63 → 1.0.64
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/src-ts/plugins/aun/index.js +5 -4
- package/dist/src-ts/plugins/qwenwork/index.js +4 -3
- package/dist/tests-ts/aun-plugin.test.js +9 -0
- package/dist/tests-ts/qwenwork-plugin.test.js +14 -0
- package/package.json +1 -1
- package/plugins/aun/dist/src-ts/plugins/aun/index.js +5 -4
- package/plugins/aun/package.json +1 -1
- package/plugins/aun/plugin.json +1 -1
- package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/index.js +4 -3
- package/plugins/qwenwork/package.json +1 -1
- package/plugins/qwenwork/plugin.json +1 -1
|
@@ -12,7 +12,7 @@ const agent_1 = require("../../agent");
|
|
|
12
12
|
const messages_1 = require("./messages");
|
|
13
13
|
const attachments_1 = require("./attachments");
|
|
14
14
|
const manifest = {
|
|
15
|
-
id: "aun", version: "1.0.
|
|
15
|
+
id: "aun", version: "1.0.33", type: "channel", displayName: "AUN 通道",
|
|
16
16
|
entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
|
|
17
17
|
capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health", "cli"],
|
|
18
18
|
configSchema: "config.schema.json",
|
|
@@ -83,10 +83,11 @@ class AunPlugin {
|
|
|
83
83
|
identity = {
|
|
84
84
|
list: async () => {
|
|
85
85
|
const own = new Set([...this.createdAids, ...this.legacyCreatedAids]);
|
|
86
|
+
const known = new Set([...this.clients.keys(), ...this.listStoreAids()]);
|
|
86
87
|
return {
|
|
87
|
-
evolcore: [...
|
|
88
|
+
evolcore: [...known].filter((aid) => !own.has(aid)).sort(),
|
|
88
89
|
muAgentBridge: [...this.clients.keys()].filter((aid) => own.has(aid)).sort(),
|
|
89
|
-
localMuAgentBridge: [...own].filter((aid) => !
|
|
90
|
+
localMuAgentBridge: [...own].filter((aid) => !known.has(aid)).sort(),
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
93
|
create: async (aid, owner) => {
|
|
@@ -945,7 +946,7 @@ class AunPlugin {
|
|
|
945
946
|
exports.AunPlugin = AunPlugin;
|
|
946
947
|
exports.default = AunPlugin;
|
|
947
948
|
function safeError(error) {
|
|
948
|
-
return redact(error instanceof Error ? error.message : String(error))
|
|
949
|
+
return redact(error instanceof Error ? error.message : String(error));
|
|
949
950
|
}
|
|
950
951
|
async function readResponse(response, limit) {
|
|
951
952
|
if (!response.body) {
|
|
@@ -10,7 +10,7 @@ const desktop_launch_1 = require("../desktop-launch");
|
|
|
10
10
|
const session_history_1 = require("./session-history");
|
|
11
11
|
exports.qwenworkManifest = {
|
|
12
12
|
id: "qwenwork",
|
|
13
|
-
version: "1.0.
|
|
13
|
+
version: "1.0.24",
|
|
14
14
|
displayName: "千问办公",
|
|
15
15
|
entry: "dist/index.js",
|
|
16
16
|
apiVersion: "1",
|
|
@@ -215,9 +215,10 @@ class QwenworkPlugin {
|
|
|
215
215
|
throw new Error("千问 CDP 已断开,等待空闲后自动恢复");
|
|
216
216
|
if (request.attachments?.length && (!this.client.attachmentInput || !this.client.complete))
|
|
217
217
|
throw new Error("千问当前客户端不支持附件输入");
|
|
218
|
+
const timeoutMs = request.timeoutMs ?? asNumber(this.context?.config.timeoutMs, 240_000);
|
|
218
219
|
const response = this.client.complete
|
|
219
|
-
? await this.client.complete(request.task,
|
|
220
|
-
: { text: await this.complete(request.task,
|
|
220
|
+
? await this.client.complete(request.task, timeoutMs, undefined, undefined, request.attachments, request.onMessage)
|
|
221
|
+
: { text: await this.complete(request.task, timeoutMs) };
|
|
221
222
|
if ((0, cdp_client_1.isQwenApiUnavailableReply)(response.text))
|
|
222
223
|
throw new agent_1.AgentOperationError("QWEN_REMOTE_ERROR", "等待千问办公回复", new Error("千问生成接口不可用;桌面未提供具体服务端错误码,CDP 仍连接,未重启或重新提交任务"));
|
|
223
224
|
this.failures = 0;
|
|
@@ -1342,3 +1342,12 @@ async function withAunAttachmentPlugin(run, publish, config = { allow_from: "pee
|
|
|
1342
1342
|
strict_1.default.match(logs.join("\n"), /fs-failed.*AUN_FS_UPLOAD_FAILED|AUN_FS_UPLOAD_FAILED.*fs-failed/);
|
|
1343
1343
|
}, async (message) => { await message.replyAttachments([{ kind: "file", filename: "报告.pdf", contentType: "application/pdf", data: new Uint8Array([1]) }]); });
|
|
1344
1344
|
});
|
|
1345
|
+
(0, node_test_1.default)("AUN 长路径错误保留末尾的根因和错误码并继续脱敏", async () => {
|
|
1346
|
+
await withAunAttachmentPlugin(async (receive, sent, _storage, logs) => {
|
|
1347
|
+
await receive({ from: "peer.agentid.cn", message_id: "long-error", payload: { text: "读取文件" } });
|
|
1348
|
+
for (const output of [sent[0].payload.text, logs.join("\n")]) {
|
|
1349
|
+
strict_1.default.match(output, /ENOENT.*产物文件已经删除/);
|
|
1350
|
+
strict_1.default.doesNotMatch(output, /private-token/);
|
|
1351
|
+
}
|
|
1352
|
+
}, async () => { throw new Error(`WORKBUDDY_ARTIFACT_READ_FAILED:读取文件 ${"目录/".repeat(120)};原因:ENOENT:产物文件已经删除;token=private-token`); });
|
|
1353
|
+
});
|
|
@@ -609,3 +609,17 @@ const cdp_client_1 = require("../src-ts/plugins/qwenwork/cdp-client");
|
|
|
609
609
|
client.cdp = async () => { throw Object.assign(new Error("connection reset"), { code: "ECONNRESET" }); };
|
|
610
610
|
await strict_1.default.rejects(client.complete("测试"), /QWEN_SUBMIT_FAILED.*提交.*ECONNRESET/);
|
|
611
611
|
});
|
|
612
|
+
(0, node_test_1.default)("千问 AUN 调用采用插件配置的任务等待时间,请求参数仍可覆盖", async () => {
|
|
613
|
+
const timeouts = [];
|
|
614
|
+
const client = { connect: async () => undefined, close() { }, connected: () => true, send: async () => undefined, direct: async () => "回复", complete: async (_text, timeoutMs) => { timeouts.push(timeoutMs); return { text: "已完成" }; } };
|
|
615
|
+
const plugin = new qwenwork_1.QwenworkPlugin({ client });
|
|
616
|
+
try {
|
|
617
|
+
await plugin.activate({ config: { timeoutMs: 900000 }, logger: { info() { }, warn() { }, error() { } }, http: { register() { }, unregister() { } } });
|
|
618
|
+
await plugin.handle({ task: "生成文件" });
|
|
619
|
+
await plugin.handle({ task: "快速检查", timeoutMs: 1000 });
|
|
620
|
+
strict_1.default.deepEqual(timeouts, [900000, 1000]);
|
|
621
|
+
}
|
|
622
|
+
finally {
|
|
623
|
+
await plugin.deactivate("stop");
|
|
624
|
+
}
|
|
625
|
+
});
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ const agent_1 = require("../../agent");
|
|
|
12
12
|
const messages_1 = require("./messages");
|
|
13
13
|
const attachments_1 = require("./attachments");
|
|
14
14
|
const manifest = {
|
|
15
|
-
id: "aun", version: "1.0.
|
|
15
|
+
id: "aun", version: "1.0.33", type: "channel", displayName: "AUN 通道",
|
|
16
16
|
entry: "dist/src-ts/plugins/aun/index.js", apiVersion: "1", process: "in-process",
|
|
17
17
|
capabilities: ["channel", "channel.identity.create", "channel.receive", "channel.send", "health", "cli"],
|
|
18
18
|
configSchema: "config.schema.json",
|
|
@@ -83,10 +83,11 @@ class AunPlugin {
|
|
|
83
83
|
identity = {
|
|
84
84
|
list: async () => {
|
|
85
85
|
const own = new Set([...this.createdAids, ...this.legacyCreatedAids]);
|
|
86
|
+
const known = new Set([...this.clients.keys(), ...this.listStoreAids()]);
|
|
86
87
|
return {
|
|
87
|
-
evolcore: [...
|
|
88
|
+
evolcore: [...known].filter((aid) => !own.has(aid)).sort(),
|
|
88
89
|
muAgentBridge: [...this.clients.keys()].filter((aid) => own.has(aid)).sort(),
|
|
89
|
-
localMuAgentBridge: [...own].filter((aid) => !
|
|
90
|
+
localMuAgentBridge: [...own].filter((aid) => !known.has(aid)).sort(),
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
93
|
create: async (aid, owner) => {
|
|
@@ -945,7 +946,7 @@ class AunPlugin {
|
|
|
945
946
|
exports.AunPlugin = AunPlugin;
|
|
946
947
|
exports.default = AunPlugin;
|
|
947
948
|
function safeError(error) {
|
|
948
|
-
return redact(error instanceof Error ? error.message : String(error))
|
|
949
|
+
return redact(error instanceof Error ? error.message : String(error));
|
|
949
950
|
}
|
|
950
951
|
async function readResponse(response, limit) {
|
|
951
952
|
if (!response.body) {
|
package/plugins/aun/package.json
CHANGED
package/plugins/aun/plugin.json
CHANGED
|
@@ -10,7 +10,7 @@ const desktop_launch_1 = require("../desktop-launch");
|
|
|
10
10
|
const session_history_1 = require("./session-history");
|
|
11
11
|
exports.qwenworkManifest = {
|
|
12
12
|
id: "qwenwork",
|
|
13
|
-
version: "1.0.
|
|
13
|
+
version: "1.0.24",
|
|
14
14
|
displayName: "千问办公",
|
|
15
15
|
entry: "dist/index.js",
|
|
16
16
|
apiVersion: "1",
|
|
@@ -215,9 +215,10 @@ class QwenworkPlugin {
|
|
|
215
215
|
throw new Error("千问 CDP 已断开,等待空闲后自动恢复");
|
|
216
216
|
if (request.attachments?.length && (!this.client.attachmentInput || !this.client.complete))
|
|
217
217
|
throw new Error("千问当前客户端不支持附件输入");
|
|
218
|
+
const timeoutMs = request.timeoutMs ?? asNumber(this.context?.config.timeoutMs, 240_000);
|
|
218
219
|
const response = this.client.complete
|
|
219
|
-
? await this.client.complete(request.task,
|
|
220
|
-
: { text: await this.complete(request.task,
|
|
220
|
+
? await this.client.complete(request.task, timeoutMs, undefined, undefined, request.attachments, request.onMessage)
|
|
221
|
+
: { text: await this.complete(request.task, timeoutMs) };
|
|
221
222
|
if ((0, cdp_client_1.isQwenApiUnavailableReply)(response.text))
|
|
222
223
|
throw new agent_1.AgentOperationError("QWEN_REMOTE_ERROR", "等待千问办公回复", new Error("千问生成接口不可用;桌面未提供具体服务端错误码,CDP 仍连接,未重启或重新提交任务"));
|
|
223
224
|
this.failures = 0;
|