mu-agent-bridge 1.0.73 → 1.0.78

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.
Files changed (152) hide show
  1. package/README.md +12 -8
  2. package/dist/src-ts/cli.js +67 -37
  3. package/dist/src-ts/control-server.js +7 -28
  4. package/dist/src-ts/core-updater.js +141 -33
  5. package/dist/src-ts/daemon-process.js +2 -1
  6. package/dist/src-ts/dsh-agent.js +7 -2
  7. package/dist/src-ts/http-agent.js +36 -0
  8. package/dist/src-ts/plugin-manager.js +185 -58
  9. package/dist/src-ts/plugins/abweb/index.js +1 -1
  10. package/dist/src-ts/plugins/abweb/public/app.js +8 -6
  11. package/dist/src-ts/plugins/abweb/public/index.html +3 -3
  12. package/dist/src-ts/plugins/aun/attachments.js +3 -21
  13. package/dist/src-ts/plugins/aun/index.js +89 -11
  14. package/dist/src-ts/plugins/aun/messages.js +1 -1
  15. package/dist/src-ts/plugins/aun/public/app.js +2 -1
  16. package/dist/src-ts/plugins/aun/public/index.html +1 -1
  17. package/dist/src-ts/plugins/cdp-draft.js +5 -2
  18. package/dist/src-ts/plugins/chatgpt/index.js +3 -2
  19. package/dist/src-ts/plugins/claude-cli/index.js +1 -1
  20. package/dist/src-ts/plugins/desktop-launch.js +44 -3
  21. package/dist/src-ts/plugins/doubao/cdp-client.js +231 -45
  22. package/dist/src-ts/plugins/doubao/index.js +119 -7
  23. package/dist/src-ts/plugins/doubao/native-task.js +134 -0
  24. package/dist/src-ts/plugins/dsh/cdp-client.js +334 -0
  25. package/dist/src-ts/plugins/dsh/index.js +102 -23
  26. package/dist/src-ts/plugins/dsh/session-history.js +31 -3
  27. package/dist/src-ts/plugins/feishu/index.js +1 -1
  28. package/dist/src-ts/plugins/personal-assistant/index.js +29 -8
  29. package/dist/src-ts/plugins/personal-assistant/model-client.js +20 -6
  30. package/dist/src-ts/plugins/personal-assistant/session-memory.js +124 -0
  31. package/dist/src-ts/plugins/personal-assistant/tools.js +4 -3
  32. package/dist/src-ts/plugins/qwenwork/cdp-client.js +43 -7
  33. package/dist/src-ts/plugins/qwenwork/index.js +52 -18
  34. package/dist/src-ts/plugins/workbuddy/cdp-client.js +349 -83
  35. package/dist/src-ts/plugins/workbuddy/index.js +24 -12
  36. package/dist/src-ts/plugins/zcode/cdp-client.js +500 -0
  37. package/dist/src-ts/plugins/zcode/index.js +97 -0
  38. package/dist/src-ts/session-management.js +27 -8
  39. package/dist/src-ts/version-manager.js +6 -3
  40. package/dist/tests-ts/abweb-model-config.test.js +44 -41
  41. package/dist/tests-ts/aun-attachments.test.js +19 -17
  42. package/dist/tests-ts/aun-default-owner-page.test.js +2 -1
  43. package/dist/tests-ts/aun-messages.test.js +14 -0
  44. package/dist/tests-ts/aun-plugin.test.js +207 -19
  45. package/dist/tests-ts/bundled-package.test.js +1 -1
  46. package/dist/tests-ts/cdp-draft-recovery.test.js +182 -3
  47. package/dist/tests-ts/chatgpt-plugin.test.js +19 -0
  48. package/dist/tests-ts/control-server.test.js +20 -0
  49. package/dist/tests-ts/core-updater.test.js +215 -46
  50. package/dist/tests-ts/daemon-process.test.js +126 -1
  51. package/dist/tests-ts/desktop-launch.test.js +73 -0
  52. package/dist/tests-ts/doubao-native-task.test.js +237 -0
  53. package/dist/tests-ts/doubao-plugin.test.js +688 -19
  54. package/dist/tests-ts/dsh-agent.test.js +91 -19
  55. package/dist/tests-ts/dsh-cdp.test.js +148 -0
  56. package/dist/tests-ts/dsh-history.test.js +37 -0
  57. package/dist/tests-ts/feishu-plugin.test.js +1 -1
  58. package/dist/tests-ts/http-agent.test.js +18 -0
  59. package/dist/tests-ts/local-cli.test.js +29 -2
  60. package/dist/tests-ts/model-provider-cancellation.test.js +2 -0
  61. package/dist/tests-ts/native-session-management.test.js +8 -7
  62. package/dist/tests-ts/personal-assistant-coordination.test.js +16 -0
  63. package/dist/tests-ts/personal-assistant-extensions.test.js +7 -1
  64. package/dist/tests-ts/personal-assistant-memory.test.js +117 -0
  65. package/dist/tests-ts/personal-assistant.test.js +277 -3
  66. package/dist/tests-ts/platform-integration.test.js +60 -1
  67. package/dist/tests-ts/plugin-manager.test.js +78 -6
  68. package/dist/tests-ts/plugin-upgrade-deadline.test.js +354 -0
  69. package/dist/tests-ts/publish-packages.test.js +1 -1
  70. package/dist/tests-ts/qwenwork-plugin.test.js +30 -0
  71. package/dist/tests-ts/qwenwork-reconnect.test.js +195 -0
  72. package/dist/tests-ts/qwenwork-sse.test.js +33 -0
  73. package/dist/tests-ts/session-access-defaults.test.js +112 -0
  74. package/dist/tests-ts/session-management.test.js +8 -8
  75. package/dist/tests-ts/version-manager.test.js +40 -0
  76. package/dist/tests-ts/workbuddy-cdp-recovery.test.js +311 -0
  77. package/dist/tests-ts/workbuddy-plugin.test.js +356 -13
  78. package/dist/tests-ts/zcode-cdp.test.js +894 -0
  79. package/dist/tests-ts/zcode-plugin.test.js +396 -0
  80. package/package.json +1 -1
  81. package/plugins/abweb/dist/src-ts/plugins/abweb/index.js +1 -1
  82. package/plugins/abweb/dist/src-ts/plugins/abweb/public/app.js +8 -6
  83. package/plugins/abweb/dist/src-ts/plugins/abweb/public/app.ts +7 -5
  84. package/plugins/abweb/dist/src-ts/plugins/abweb/public/index.html +3 -3
  85. package/plugins/abweb/package.json +1 -1
  86. package/plugins/abweb/plugin.json +1 -1
  87. package/plugins/aun/config.schema.json +1 -1
  88. package/plugins/aun/dist/src-ts/plugins/aun/attachments.js +3 -21
  89. package/plugins/aun/dist/src-ts/plugins/aun/index.js +89 -11
  90. package/plugins/aun/dist/src-ts/plugins/aun/messages.js +1 -1
  91. package/plugins/aun/dist/src-ts/plugins/aun/public/app.js +2 -1
  92. package/plugins/aun/dist/src-ts/plugins/aun/public/index.html +1 -1
  93. package/plugins/aun/package.json +1 -1
  94. package/plugins/aun/plugin.json +1 -1
  95. package/plugins/chatgpt/dist/src-ts/plugins/cdp-draft.js +5 -2
  96. package/plugins/chatgpt/dist/src-ts/plugins/chatgpt/index.js +3 -2
  97. package/plugins/chatgpt/dist/src-ts/plugins/desktop-launch.js +44 -3
  98. package/plugins/claude-cli/dist/src-ts/plugins/claude-cli/index.js +1 -1
  99. package/plugins/claude-cli/package.json +1 -1
  100. package/plugins/claude-cli/plugin.json +1 -1
  101. package/plugins/doubao/config.schema.json +2 -1
  102. package/plugins/doubao/dist/src-ts/plugins/desktop-launch.js +44 -3
  103. package/plugins/doubao/dist/src-ts/plugins/doubao/cdp-client.js +231 -45
  104. package/plugins/doubao/dist/src-ts/plugins/doubao/index.js +119 -7
  105. package/plugins/doubao/dist/src-ts/plugins/doubao/native-task.js +134 -0
  106. package/plugins/doubao/package.json +1 -1
  107. package/plugins/doubao/plugin.json +1 -1
  108. package/plugins/dsh/config.schema.json +5 -2
  109. package/plugins/dsh/dist/src-ts/dsh-agent.js +7 -2
  110. package/plugins/dsh/dist/src-ts/plugins/desktop-launch.js +44 -3
  111. package/plugins/dsh/dist/src-ts/plugins/dsh/cdp-client.js +334 -0
  112. package/plugins/dsh/dist/src-ts/plugins/dsh/index.js +102 -23
  113. package/plugins/dsh/dist/src-ts/plugins/dsh/session-history.js +31 -3
  114. package/plugins/dsh/package.json +1 -1
  115. package/plugins/dsh/plugin.json +1 -1
  116. package/plugins/feishu/dist/src-ts/plugins/feishu/index.js +1 -1
  117. package/plugins/feishu/package.json +1 -1
  118. package/plugins/feishu/plugin.json +1 -1
  119. package/plugins/personal-assistant/config.schema.json +3 -2
  120. package/plugins/personal-assistant/dist/src-ts/attachments.js +62 -0
  121. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/index.js +29 -8
  122. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/model-client.js +20 -6
  123. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/session-memory.js +124 -0
  124. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/tools.js +4 -3
  125. package/plugins/personal-assistant/package.json +2 -2
  126. package/plugins/personal-assistant/plugin.json +1 -1
  127. package/plugins/qwenwork/dist/src-ts/plugins/cdp-draft.js +5 -2
  128. package/plugins/qwenwork/dist/src-ts/plugins/desktop-launch.js +44 -3
  129. package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/cdp-client.js +43 -7
  130. package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/index.js +52 -18
  131. package/plugins/qwenwork/package.json +1 -1
  132. package/plugins/qwenwork/plugin.json +1 -1
  133. package/plugins/workbuddy/config.schema.json +1 -1
  134. package/plugins/workbuddy/dist/src-ts/plugins/desktop-launch.js +44 -3
  135. package/plugins/workbuddy/dist/src-ts/plugins/workbuddy/cdp-client.js +349 -83
  136. package/plugins/workbuddy/dist/src-ts/plugins/workbuddy/index.js +24 -12
  137. package/plugins/workbuddy/package.json +1 -1
  138. package/plugins/workbuddy/plugin.json +1 -1
  139. package/plugins/zcode/config.schema.json +13 -0
  140. package/plugins/zcode/dist/src-ts/agent.js +69 -0
  141. package/plugins/zcode/dist/src-ts/attachments.js +62 -0
  142. package/plugins/zcode/dist/src-ts/plugin.js +13 -0
  143. package/plugins/zcode/dist/src-ts/plugins/desktop-launch.js +238 -0
  144. package/plugins/zcode/dist/src-ts/plugins/workbuddy/cdp-client.js +896 -0
  145. package/plugins/zcode/dist/src-ts/plugins/workbuddy/cli-client.js +39 -0
  146. package/plugins/zcode/dist/src-ts/plugins/workbuddy/desktop-launch.js +10 -0
  147. package/plugins/zcode/dist/src-ts/plugins/workbuddy/index.js +567 -0
  148. package/plugins/zcode/dist/src-ts/plugins/workbuddy/session-history.js +121 -0
  149. package/plugins/zcode/dist/src-ts/plugins/zcode/cdp-client.js +500 -0
  150. package/plugins/zcode/dist/src-ts/plugins/zcode/index.js +97 -0
  151. package/plugins/zcode/package.json +16 -0
  152. package/plugins/zcode/plugin.json +11 -0
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZcodePlugin = exports.zcodeManifest = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ const agent_1 = require("../../agent");
6
+ const plugin_1 = require("../../plugin");
7
+ const cdp_client_1 = require("./cdp-client");
8
+ const workbuddy_1 = require("../workbuddy");
9
+ const desktop_launch_1 = require("../desktop-launch");
10
+ exports.zcodeManifest = {
11
+ id: "zcode", version: "1.0.8", displayName: "ZCode", type: "agent",
12
+ entry: "dist/src-ts/plugins/zcode/index.js", apiVersion: "1", process: "in-process",
13
+ capabilities: ["chat", "health"], configSchema: "config.schema.json",
14
+ };
15
+ class ZcodePlugin {
16
+ options;
17
+ manifest = exports.zcodeManifest;
18
+ delegate;
19
+ process;
20
+ constructor(options = {}) {
21
+ this.options = options;
22
+ }
23
+ get sessionOperations() { return this.delegate?.sessionOperations ?? []; }
24
+ async activate(context) {
25
+ const port = (0, plugin_1.resolveRuntimePort)(context.config, context.runtime, "zcode", "ZCODE_CDP_PORT", this.options.cdpPort ?? 9231);
26
+ const args = context.config.startupArgs ?? [];
27
+ if (!Array.isArray(args) || args.some(arg => typeof arg !== "string" || /^--remote-debugging-(?:port|address)(?:=|$)/i.test(arg)))
28
+ throw new Error("startupArgs 必须为字符串数组,CDP 地址和端口由插件配置管理");
29
+ const client = this.options.client ?? new cdp_client_1.ZcodeCdpClient({ port });
30
+ if (!this.options.client) {
31
+ const connect = client.connect.bind(client);
32
+ client.connect = async () => {
33
+ try {
34
+ await connect();
35
+ }
36
+ catch (error) {
37
+ const failure = error;
38
+ if (context.config.autoStart === false || process.platform !== "win32" || failure.code !== "ECONNREFUSED" && failure.cause?.code !== "ECONNREFUSED")
39
+ throw error;
40
+ const executable = await (0, desktop_launch_1.findWindowsExecutable)("ZCode.exe", typeof context.config.executablePath === "string" ? context.config.executablePath : undefined);
41
+ if (!executable)
42
+ throw new Error("未找到 ZCode.exe,请检查开始菜单安装记录或配置 executablePath");
43
+ context.logger.info("正在启动 ZCode 并等待 CDP", { executable, port });
44
+ const env = { ...process.env };
45
+ delete env.ELECTRON_RUN_AS_NODE;
46
+ try {
47
+ await (0, desktop_launch_1.launchManagedAndWait)(executable, [...args, "--remote-debugging-address=127.0.0.1", `--remote-debugging-port=${port}`], undefined, connect, typeof context.config.startupTimeoutMs === "number" ? context.config.startupTimeoutMs : 30_000, child => { this.process = child; }, (file, argv) => (0, node_child_process_1.spawn)(file, argv, { env, detached: true, stdio: "ignore", windowsHide: false }));
48
+ }
49
+ catch (cause) {
50
+ const code = cause.code ?? (cause.cause?.code);
51
+ if (code === "ENOENT" || code === "EACCES")
52
+ throw new Error(`无法启动 ZCode:${cause instanceof Error ? cause.message : String(cause)}`, { cause });
53
+ throw new Error(`ZCode 已启动,但 CDP ${port} 未就绪;若桌面已打开,请先退出 ZCode,再重载插件使调试参数生效`, { cause });
54
+ }
55
+ }
56
+ };
57
+ }
58
+ this.delegate = new workbuddy_1.WorkbuddyPlugin({ client, expertSelection: false, replyTimeoutLimitMs: Infinity });
59
+ await this.delegate.activate({ ...context, config: { ...context.config, transport: "cdp", cdpPort: port, autoStart: false, dailyPoints: false } });
60
+ }
61
+ async deactivate(reason) {
62
+ try {
63
+ await this.delegate?.deactivate(reason);
64
+ }
65
+ finally {
66
+ const child = this.process;
67
+ this.process = undefined;
68
+ this.delegate = undefined;
69
+ await (0, desktop_launch_1.terminateOwnedProcess)(child);
70
+ }
71
+ }
72
+ async health() {
73
+ return this.delegate ? this.delegate.health() : { status: "failed", message: "ZCode 插件尚未激活" };
74
+ }
75
+ async handle(request) {
76
+ if (!this.delegate)
77
+ throw new Error("ZCode 插件尚未激活");
78
+ try {
79
+ return await this.delegate.handle(request);
80
+ }
81
+ catch (error) {
82
+ if (!(error instanceof agent_1.AgentOperationError) || error.code !== "WORKBUDDY_TASK_FAILED")
83
+ throw error;
84
+ const cause = error.cause;
85
+ const detail = cause instanceof Error && cause.message.includes("WorkBuddy")
86
+ ? Object.assign(new Error(cause.message.replaceAll("WorkBuddy", "ZCode"), { cause: cause.cause }), { code: cause.code }) : cause;
87
+ throw new agent_1.AgentOperationError("ZCODE_TASK_FAILED", error.stage.replaceAll("WorkBuddy", "ZCode"), detail);
88
+ }
89
+ }
90
+ async controlSession(request) {
91
+ if (!this.delegate)
92
+ throw new Error("ZCode 插件尚未激活");
93
+ return this.delegate.controlSession(request);
94
+ }
95
+ }
96
+ exports.ZcodePlugin = ZcodePlugin;
97
+ exports.default = ZcodePlugin;
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "agent-bridge-zcode",
3
+ "version": "1.0.8",
4
+ "description": "agent-bridge 的 ZCode 桌面端 CDP 插件。",
5
+ "keywords": ["mu-agent-bridge-plugin", "mu-agent-bridge-agent"],
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://codeup.aliyun.com/6808da56fb3da14b899afd54/agent_bridge.git",
9
+ "directory": "packages/zcode"
10
+ },
11
+ "main": "dist/src-ts/plugins/zcode/index.js",
12
+ "files": ["dist/", "plugin.json", "config.schema.json", "README.md"],
13
+ "agentBridge": { "plugin": "./plugin.json", "type": "agent" },
14
+ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org" },
15
+ "engines": { "node": ">=22" }
16
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "zcode",
3
+ "version": "1.0.8",
4
+ "type": "agent",
5
+ "displayName": "ZCode",
6
+ "entry": "dist/src-ts/plugins/zcode/index.js",
7
+ "apiVersion": "1",
8
+ "process": "in-process",
9
+ "capabilities": ["chat", "health"],
10
+ "configSchema": "config.schema.json"
11
+ }