mu-agent-bridge 1.0.18 → 1.0.19
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/chatgpt/cdp-client.js +2 -11
- package/dist/src-ts/plugins/doubao/index.js +1 -1
- package/dist/src-ts/plugins/dsh/index.js +1 -1
- package/dist/src-ts/plugins/qwenwork/index.js +1 -1
- package/dist/src-ts/plugins/workbuddy/index.js +1 -1
- package/dist/tests-ts/bundled-package.test.js +11 -0
- package/package.json +1 -1
- package/plugins/abweb/dist/src-ts/plugin.js +13 -0
- package/plugins/aun/dist/src-ts/plugin.js +13 -0
- package/plugins/chatgpt/dist/src-ts/plugin.js +13 -0
- package/plugins/chatgpt/dist/src-ts/plugins/chatgpt/cdp-client.js +2 -7
- package/plugins/doubao/dist/src-ts/plugin.js +13 -0
- package/plugins/doubao/dist/src-ts/plugins/doubao/index.js +1 -1
- package/plugins/doubao/plugin.json +1 -1
- package/plugins/dsh/dist/src-ts/plugin.js +13 -0
- package/plugins/dsh/dist/src-ts/plugins/dsh/index.js +1 -1
- package/plugins/dsh/plugin.json +1 -1
- package/plugins/feishu/dist/src-ts/plugin.js +13 -0
- package/plugins/qwenwork/dist/src-ts/plugin.js +13 -0
- package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/index.js +1 -1
- package/plugins/qwenwork/plugin.json +1 -1
- package/plugins/workbuddy/dist/src-ts/plugin.js +13 -0
- package/plugins/workbuddy/dist/src-ts/plugins/workbuddy/index.js +1 -1
- package/plugins/workbuddy/plugin.json +1 -1
|
@@ -5,7 +5,6 @@ const node_child_process_1 = require("node:child_process");
|
|
|
5
5
|
exports.editorSelector = '[data-codex-composer="true"][contenteditable="true"]';
|
|
6
6
|
exports.turnSelector = '[data-chatgpt-conversation-turn="true"]';
|
|
7
7
|
exports.userBubbleSelector = "[data-user-message-bubble]";
|
|
8
|
-
const assistantMessageSelector = '[data-markdown-text-style="assistant-message"]';
|
|
9
8
|
const turnIdAttribute = "data-chatgpt-conversation-turn-id";
|
|
10
9
|
const contentUnitSelector = "[data-content-search-unit-key]";
|
|
11
10
|
const sendButtonSelector = 'button[aria-label="Send"], button[aria-label="发送"]';
|
|
@@ -89,8 +88,7 @@ class ChatgptCdpClient {
|
|
|
89
88
|
if (!response.ok)
|
|
90
89
|
throw new Error(`ChatGPT CDP /json HTTP ${response.status}`);
|
|
91
90
|
const targets = await response.json();
|
|
92
|
-
const page = targets.find((target) => target.type === "page" &&
|
|
93
|
-
|| target.url === "app://-/index.html"));
|
|
91
|
+
const page = targets.find((target) => target.type === "page" && /chatgpt|codex/i.test(`${target.title} ${target.url}`));
|
|
94
92
|
if (page?.webSocketDebuggerUrl)
|
|
95
93
|
return page;
|
|
96
94
|
last = new Error(`未找到 ChatGPT/Codex 页面 target(端口 ${this.port})`);
|
|
@@ -113,7 +111,6 @@ class ChatgptCdpClient {
|
|
|
113
111
|
await this.waitFor(`Boolean(document.querySelector(${JSON.stringify(exports.editorSelector)}))`, "ChatGPT 桌面端输入框未就绪");
|
|
114
112
|
const beforeTurnsJson = await this.evaluate(`JSON.stringify([...document.querySelectorAll(${JSON.stringify(exports.turnSelector)})].map(turn => ({ id: turn.getAttribute(${JSON.stringify(turnIdAttribute)}), users: turn.querySelectorAll(${JSON.stringify(exports.userBubbleSelector)}).length })))`);
|
|
115
113
|
const beforeTurns = JSON.parse(String(beforeTurnsJson || "[]"));
|
|
116
|
-
const beforeAssistantCount = Number(await this.evaluate(`document.querySelectorAll(${JSON.stringify(assistantMessageSelector)}).length`));
|
|
117
114
|
const ready = await this.evaluate(`(() => {
|
|
118
115
|
const editor = document.querySelector(${JSON.stringify(exports.editorSelector)});
|
|
119
116
|
if (!editor || editor.innerText.trim()) return false;
|
|
@@ -167,13 +164,7 @@ class ChatgptCdpClient {
|
|
|
167
164
|
const fresh = oldIndex < 0 || index >= before.length || users.length > (old?.users ?? 0);
|
|
168
165
|
return fresh && users.item(users.length - 1)?.innerText.trim() === ${JSON.stringify(text.trim())};
|
|
169
166
|
});
|
|
170
|
-
if (!turn) {
|
|
171
|
-
const assistants = [...document.querySelectorAll(${JSON.stringify(assistantMessageSelector)})];
|
|
172
|
-
const fallback = assistants.length > ${beforeAssistantCount}
|
|
173
|
-
? assistants.at(-1)?.innerText.trim() ?? ""
|
|
174
|
-
: "";
|
|
175
|
-
return JSON.stringify({ reply: fallback, active: Boolean(document.querySelector(${JSON.stringify(stopButtonSelector)})) });
|
|
176
|
-
}
|
|
167
|
+
if (!turn) return JSON.stringify({ reply: "", active: false });
|
|
177
168
|
const user = turn.querySelectorAll(${JSON.stringify(exports.userBubbleSelector)}).item(turn.querySelectorAll(${JSON.stringify(exports.userBubbleSelector)}).length - 1);
|
|
178
169
|
const unit = user?.closest(${JSON.stringify(contentUnitSelector)});
|
|
179
170
|
const units = [...turn.querySelectorAll(${JSON.stringify(contentUnitSelector)})];
|
|
@@ -6,7 +6,7 @@ const dsh_agent_1 = require("../../dsh-agent");
|
|
|
6
6
|
const openai_adapter_1 = require("../qwenwork/openai-adapter");
|
|
7
7
|
exports.dshManifest = {
|
|
8
8
|
id: "dsh",
|
|
9
|
-
version: "1.0.
|
|
9
|
+
version: "1.0.4",
|
|
10
10
|
displayName: "DeepSeek Harness",
|
|
11
11
|
entry: "dist/index.js",
|
|
12
12
|
apiVersion: "1",
|
|
@@ -10,7 +10,7 @@ const plugin_1 = require("../../plugin");
|
|
|
10
10
|
const cdp_client_1 = require("./cdp-client");
|
|
11
11
|
const cli_client_1 = require("./cli-client");
|
|
12
12
|
exports.workbuddyManifest = {
|
|
13
|
-
id: "workbuddy", version: "1.1.
|
|
13
|
+
id: "workbuddy", version: "1.1.2", displayName: "WorkBuddy", type: "agent",
|
|
14
14
|
entry: "dist/index.js", apiVersion: "1", process: "in-process",
|
|
15
15
|
capabilities: ["chat", "health"], configSchema: "config.schema.json",
|
|
16
16
|
};
|
|
@@ -6,8 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
7
|
const promises_1 = require("node:fs/promises");
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
|
+
const node_module_1 = require("node:module");
|
|
9
10
|
const node_test_1 = __importDefault(require("node:test"));
|
|
10
11
|
const ids = ["abweb", "aun", "chatgpt", "doubao", "dsh", "feishu", "qwenwork", "workbuddy"];
|
|
12
|
+
(0, node_test_1.default)("独立包和默认插件的运行时依赖可加载", async () => {
|
|
13
|
+
const load = (0, node_module_1.createRequire)(__filename);
|
|
14
|
+
for (const id of ids) {
|
|
15
|
+
for (const root of ["packages", "plugins"]) {
|
|
16
|
+
const directory = (0, node_path_1.join)(process.cwd(), root, id);
|
|
17
|
+
const manifest = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(directory, "plugin.json"), "utf8"));
|
|
18
|
+
strict_1.default.doesNotThrow(() => load((0, node_path_1.join)(directory, manifest.entry)), `${root}/${id} 的运行时依赖必须完整`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
11
22
|
(0, node_test_1.default)("核心插件目录包含全部默认插件及其可加载入口", async () => {
|
|
12
23
|
const packageJson = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(process.cwd(), "package.json"), "utf8"));
|
|
13
24
|
strict_1.default.ok(packageJson.files?.includes("plugins/"));
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -88,8 +88,7 @@ class ChatgptCdpClient {
|
|
|
88
88
|
if (!response.ok)
|
|
89
89
|
throw new Error(`ChatGPT CDP /json HTTP ${response.status}`);
|
|
90
90
|
const targets = await response.json();
|
|
91
|
-
const page = targets.find((target) => target.type === "page" &&
|
|
92
|
-
|| target.url === "app://-/index.html"));
|
|
91
|
+
const page = targets.find((target) => target.type === "page" && /chatgpt|codex/i.test(`${target.title} ${target.url}`));
|
|
93
92
|
if (page?.webSocketDebuggerUrl)
|
|
94
93
|
return page;
|
|
95
94
|
last = new Error(`未找到 ChatGPT/Codex 页面 target(端口 ${this.port})`);
|
|
@@ -165,11 +164,7 @@ class ChatgptCdpClient {
|
|
|
165
164
|
const fresh = oldIndex < 0 || index >= before.length || users.length > (old?.users ?? 0);
|
|
166
165
|
return fresh && users.item(users.length - 1)?.innerText.trim() === ${JSON.stringify(text.trim())};
|
|
167
166
|
});
|
|
168
|
-
if (!turn) {
|
|
169
|
-
const fallback = [...document.querySelectorAll('[data-message-author-role="assistant"]')]
|
|
170
|
-
.map(item => item.innerText.trim()).filter(Boolean).at(-1) ?? "";
|
|
171
|
-
return JSON.stringify({ reply: fallback, active: Boolean(document.querySelector(${JSON.stringify(stopButtonSelector)})) });
|
|
172
|
-
}
|
|
167
|
+
if (!turn) return JSON.stringify({ reply: "", active: false });
|
|
173
168
|
const user = turn.querySelectorAll(${JSON.stringify(exports.userBubbleSelector)}).item(turn.querySelectorAll(${JSON.stringify(exports.userBubbleSelector)}).length - 1);
|
|
174
169
|
const unit = user?.closest(${JSON.stringify(contentUnitSelector)});
|
|
175
170
|
const units = [...turn.querySelectorAll(${JSON.stringify(contentUnitSelector)})];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -6,7 +6,7 @@ const dsh_agent_1 = require("../../dsh-agent");
|
|
|
6
6
|
const openai_adapter_1 = require("../qwenwork/openai-adapter");
|
|
7
7
|
exports.dshManifest = {
|
|
8
8
|
id: "dsh",
|
|
9
|
-
version: "1.0.
|
|
9
|
+
version: "1.0.4",
|
|
10
10
|
displayName: "DeepSeek Harness",
|
|
11
11
|
entry: "dist/index.js",
|
|
12
12
|
apiVersion: "1",
|
package/plugins/dsh/plugin.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRuntimePort = resolveRuntimePort;
|
|
4
|
+
function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
|
|
5
|
+
const injected = runtime?.ports?.[pluginId];
|
|
6
|
+
if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
|
|
7
|
+
return injected;
|
|
8
|
+
const configured = config.cdpPort;
|
|
9
|
+
if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
|
|
10
|
+
return configured;
|
|
11
|
+
const environment = Number(process.env[envName] ?? "");
|
|
12
|
+
return Number.isInteger(environment) && environment > 0 ? environment : fallback;
|
|
13
|
+
}
|
|
@@ -10,7 +10,7 @@ const plugin_1 = require("../../plugin");
|
|
|
10
10
|
const cdp_client_1 = require("./cdp-client");
|
|
11
11
|
const cli_client_1 = require("./cli-client");
|
|
12
12
|
exports.workbuddyManifest = {
|
|
13
|
-
id: "workbuddy", version: "1.1.
|
|
13
|
+
id: "workbuddy", version: "1.1.2", displayName: "WorkBuddy", type: "agent",
|
|
14
14
|
entry: "dist/index.js", apiVersion: "1", process: "in-process",
|
|
15
15
|
capabilities: ["chat", "health"], configSchema: "config.schema.json",
|
|
16
16
|
};
|