mu-agent-bridge 1.0.71 → 1.0.73

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 (120) hide show
  1. package/README.md +9 -6
  2. package/dist/src-ts/agent.js +35 -0
  3. package/dist/src-ts/channel-sessions.js +3 -2
  4. package/dist/src-ts/control-server.js +5 -2
  5. package/dist/src-ts/dsh-agent.js +25 -12
  6. package/dist/src-ts/plugin-catalog.js +11 -2
  7. package/dist/src-ts/plugin-manager.js +183 -9
  8. package/dist/src-ts/plugins/abweb/index.js +1 -1
  9. package/dist/src-ts/plugins/abweb/public/app.js +68 -2
  10. package/dist/src-ts/plugins/abweb/public/index.html +15 -0
  11. package/dist/src-ts/plugins/abweb/public/style.css +4 -0
  12. package/dist/src-ts/plugins/aun/index.js +66 -10
  13. package/dist/src-ts/plugins/aun/messages.js +3 -0
  14. package/dist/src-ts/plugins/chatgpt/cdp-client.js +26 -12
  15. package/dist/src-ts/plugins/chatgpt/index.js +77 -17
  16. package/dist/src-ts/plugins/claude-cli/index.js +19 -2
  17. package/dist/src-ts/plugins/codex-cli/index.js +19 -2
  18. package/dist/src-ts/plugins/doubao/cdp-client.js +5 -2
  19. package/dist/src-ts/plugins/doubao/index.js +36 -4
  20. package/dist/src-ts/plugins/dsh/index.js +78 -6
  21. package/dist/src-ts/plugins/local-cli/agent.js +74 -9
  22. package/dist/src-ts/plugins/personal-assistant/claude-cli-model.js +30 -0
  23. package/dist/src-ts/plugins/personal-assistant/coordination.js +57 -0
  24. package/dist/src-ts/plugins/personal-assistant/index.js +242 -0
  25. package/dist/src-ts/plugins/personal-assistant/model-client.js +167 -0
  26. package/dist/src-ts/plugins/personal-assistant/owner-context.js +56 -0
  27. package/dist/src-ts/plugins/personal-assistant/remote-ability.js +176 -0
  28. package/dist/src-ts/plugins/personal-assistant/tools.js +166 -0
  29. package/dist/src-ts/plugins/qwenwork/cdp-client.js +47 -11
  30. package/dist/src-ts/plugins/qwenwork/index.js +89 -8
  31. package/dist/src-ts/plugins/workbuddy/cdp-client.js +9 -4
  32. package/dist/src-ts/plugins/workbuddy/index.js +104 -33
  33. package/dist/src-ts/session-management.js +105 -6
  34. package/dist/tests-ts/abweb-cli.test.js +10 -2
  35. package/dist/tests-ts/abweb-model-config.test.js +70 -0
  36. package/dist/tests-ts/agent.test.js +27 -0
  37. package/dist/tests-ts/aun-messages.test.js +6 -0
  38. package/dist/tests-ts/aun-plugin.test.js +85 -0
  39. package/dist/tests-ts/bundled-package.test.js +12 -2
  40. package/dist/tests-ts/channel-sessions.test.js +27 -0
  41. package/dist/tests-ts/chatgpt-plugin.test.js +99 -0
  42. package/dist/tests-ts/control-server.test.js +36 -0
  43. package/dist/tests-ts/doubao-plugin.test.js +92 -0
  44. package/dist/tests-ts/dsh-agent.test.js +77 -0
  45. package/dist/tests-ts/feishu-plugin.test.js +1 -1
  46. package/dist/tests-ts/installer-assets.test.js +1 -1
  47. package/dist/tests-ts/local-cli.test.js +119 -1
  48. package/dist/tests-ts/model-provider-cancellation.test.js +150 -0
  49. package/dist/tests-ts/personal-assistant-coordination.test.js +76 -0
  50. package/dist/tests-ts/personal-assistant-extensions.test.js +29 -0
  51. package/dist/tests-ts/personal-assistant-owner-context.test.js +107 -0
  52. package/dist/tests-ts/personal-assistant-remote-ability.test.js +123 -0
  53. package/dist/tests-ts/personal-assistant.test.js +389 -0
  54. package/dist/tests-ts/platform-integration.test.js +124 -1
  55. package/dist/tests-ts/plugin-catalog.test.js +12 -2
  56. package/dist/tests-ts/plugin-manager.test.js +280 -0
  57. package/dist/tests-ts/publish-packages.test.js +42 -0
  58. package/dist/tests-ts/qwenwork-plugin.test.js +105 -1
  59. package/dist/tests-ts/session-management.test.js +155 -0
  60. package/dist/tests-ts/workbuddy-plugin.test.js +154 -2
  61. package/package.json +1 -1
  62. package/plugins/abweb/dist/src-ts/agent.js +35 -0
  63. package/plugins/abweb/dist/src-ts/plugins/abweb/index.js +1 -1
  64. package/plugins/abweb/dist/src-ts/plugins/abweb/public/app.js +68 -2
  65. package/plugins/abweb/dist/src-ts/plugins/abweb/public/app.ts +53 -3
  66. package/plugins/abweb/dist/src-ts/plugins/abweb/public/index.html +15 -0
  67. package/plugins/abweb/dist/src-ts/plugins/abweb/public/style.css +4 -0
  68. package/plugins/abweb/package.json +1 -1
  69. package/plugins/abweb/plugin.json +1 -1
  70. package/plugins/aun/dist/src-ts/agent.js +35 -0
  71. package/plugins/aun/dist/src-ts/plugins/aun/index.js +66 -10
  72. package/plugins/aun/dist/src-ts/plugins/aun/messages.js +3 -0
  73. package/plugins/chatgpt/dist/src-ts/agent.js +35 -0
  74. package/plugins/chatgpt/dist/src-ts/plugins/chatgpt/cdp-client.js +26 -12
  75. package/plugins/chatgpt/dist/src-ts/plugins/chatgpt/index.js +77 -17
  76. package/plugins/chatgpt/package.json +1 -1
  77. package/plugins/chatgpt/plugin.json +1 -1
  78. package/plugins/claude-cli/dist/src-ts/agent.js +35 -0
  79. package/plugins/claude-cli/dist/src-ts/plugins/claude-cli/index.js +19 -2
  80. package/plugins/claude-cli/dist/src-ts/plugins/local-cli/agent.js +74 -9
  81. package/plugins/claude-cli/package.json +1 -1
  82. package/plugins/claude-cli/plugin.json +3 -2
  83. package/plugins/codex-cli/dist/src-ts/agent.js +35 -0
  84. package/plugins/codex-cli/dist/src-ts/plugins/codex-cli/index.js +19 -2
  85. package/plugins/codex-cli/dist/src-ts/plugins/local-cli/agent.js +74 -9
  86. package/plugins/codex-cli/package.json +1 -1
  87. package/plugins/codex-cli/plugin.json +3 -2
  88. package/plugins/doubao/dist/src-ts/agent.js +35 -0
  89. package/plugins/doubao/dist/src-ts/plugins/doubao/cdp-client.js +5 -2
  90. package/plugins/doubao/dist/src-ts/plugins/doubao/index.js +36 -4
  91. package/plugins/doubao/package.json +1 -1
  92. package/plugins/doubao/plugin.json +3 -2
  93. package/plugins/dsh/dist/src-ts/agent.js +35 -0
  94. package/plugins/dsh/dist/src-ts/dsh-agent.js +25 -12
  95. package/plugins/dsh/dist/src-ts/plugins/dsh/index.js +78 -6
  96. package/plugins/dsh/package.json +1 -1
  97. package/plugins/dsh/plugin.json +3 -2
  98. package/plugins/feishu/dist/src-ts/agent.js +35 -0
  99. package/plugins/personal-assistant/config.schema.json +22 -0
  100. package/plugins/personal-assistant/dist/src-ts/agent.js +69 -0
  101. package/plugins/personal-assistant/dist/src-ts/plugin.js +13 -0
  102. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/claude-cli-model.js +30 -0
  103. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/coordination.js +57 -0
  104. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/index.js +242 -0
  105. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/model-client.js +167 -0
  106. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/owner-context.js +56 -0
  107. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/remote-ability.js +176 -0
  108. package/plugins/personal-assistant/dist/src-ts/plugins/personal-assistant/tools.js +166 -0
  109. package/plugins/personal-assistant/package.json +39 -0
  110. package/plugins/personal-assistant/plugin.json +15 -0
  111. package/plugins/qwenwork/dist/src-ts/agent.js +35 -0
  112. package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/cdp-client.js +47 -11
  113. package/plugins/qwenwork/dist/src-ts/plugins/qwenwork/index.js +89 -8
  114. package/plugins/qwenwork/package.json +1 -1
  115. package/plugins/qwenwork/plugin.json +3 -2
  116. package/plugins/workbuddy/dist/src-ts/agent.js +35 -0
  117. package/plugins/workbuddy/dist/src-ts/plugins/workbuddy/cdp-client.js +9 -4
  118. package/plugins/workbuddy/dist/src-ts/plugins/workbuddy/index.js +104 -33
  119. package/plugins/workbuddy/package.json +1 -1
  120. package/plugins/workbuddy/plugin.json +3 -2
@@ -8,6 +8,7 @@ const promises_1 = require("node:fs/promises");
8
8
  const node_os_1 = require("node:os");
9
9
  const node_path_1 = require("node:path");
10
10
  const agent_1 = require("../../agent");
11
+ const agent_2 = require("../../agent");
11
12
  const attachments_1 = require("../../attachments");
12
13
  const plugin_1 = require("../../plugin");
13
14
  const cdp_client_1 = require("./cdp-client");
@@ -16,9 +17,9 @@ const session_history_1 = require("./session-history");
16
17
  const desktop_launch_1 = require("../desktop-launch");
17
18
  const desktop_launch_2 = require("./desktop-launch");
18
19
  exports.workbuddyManifest = {
19
- id: "workbuddy", version: "1.1.32", displayName: "WorkBuddy", type: "agent",
20
+ id: "workbuddy", version: "1.1.34", displayName: "WorkBuddy", type: "agent",
20
21
  entry: "dist/index.js", apiVersion: "1", process: "in-process",
21
- capabilities: ["chat", "health"], configSchema: "config.schema.json",
22
+ capabilities: ["chat", "health", "model-provider"], configSchema: "config.schema.json",
22
23
  };
23
24
  function extractExpertQuery(task) {
24
25
  const text = task.normalize("NFKC");
@@ -40,6 +41,11 @@ function findExecutable(configured) {
40
41
  class WorkbuddyPlugin {
41
42
  options;
42
43
  manifest = exports.workbuddyManifest;
44
+ get modelProvider() {
45
+ if (this.transport === "cli" || (this.transport !== "cdp" && this.cliPath) || !this.client?.createTask || !this.client.complete)
46
+ return undefined;
47
+ return { complete: (request) => this.completeModelProvider(request) };
48
+ }
43
49
  client;
44
50
  process;
45
51
  reconnect;
@@ -242,20 +248,71 @@ class WorkbuddyPlugin {
242
248
  return await this.complete(request);
243
249
  }
244
250
  finally {
245
- if (this.activeSessionId && this.desktopSessionValid && this.client?.conversationId) {
246
- try {
247
- this.activeDesktopConversationId = await this.client.conversationId();
248
- await this.persistKnownSessions();
249
- }
250
- catch (error) {
251
- this.dailyPointsLogger?.warn("WorkBuddy 会话状态同步失败,已保留本轮回复", { stage: "完成后读取会话标识或保存映射", error: error instanceof Error ? error.message : String(error) });
252
- }
253
- }
251
+ await this.synchronizeSession();
254
252
  }
255
253
  });
256
254
  const response = await run;
257
255
  return { ...response, sessionId: request.sessionId ?? response.sessionId };
258
256
  }
257
+ async synchronizeSession() {
258
+ if (this.activeSessionId && this.desktopSessionValid && this.client?.conversationId) {
259
+ try {
260
+ this.activeDesktopConversationId = await this.client.conversationId();
261
+ if (this.activeDesktopConversationId)
262
+ this.sessionBindings.set(this.activeSessionId, { conversationId: this.activeDesktopConversationId, expert: this.activeExpert });
263
+ await this.persistKnownSessions();
264
+ }
265
+ catch (error) {
266
+ this.dailyPointsLogger?.warn("WorkBuddy 会话状态同步失败,已保留本轮回复", { stage: "完成后读取会话标识或保存映射", error: error instanceof Error ? error.message : String(error) });
267
+ }
268
+ }
269
+ }
270
+ async completeModelProvider(request) {
271
+ let stage = "WorkBuddy 模型排队(queue)";
272
+ try {
273
+ request.signal.throwIfAborted();
274
+ const run = this.enqueue(async () => {
275
+ request.signal.throwIfAborted();
276
+ const client = this.client;
277
+ if (!client?.connected() || !client.complete)
278
+ throw new Error("WorkBuddy CDP 未连接,模型请求不会启动或重启桌面");
279
+ const availability = await client.historyAvailability?.();
280
+ if (availability?.waiting || availability?.generating || availability?.draft)
281
+ throw new Error("WorkBuddy 当前有用户草稿、待确认操作或正在生成回复,模型请求未切换会话");
282
+ stage = "连接 WorkBuddy 模型(connect)";
283
+ const previous = { sessionId: this.activeSessionId, conversationId: await client.conversationId?.(), expert: this.activeExpert, expertSession: this.expertSession, valid: this.desktopSessionValid };
284
+ try {
285
+ stage = "等待 WorkBuddy 模型生成(generate)";
286
+ const response = await this.complete({ task: request.prompt, sessionId: request.sessionId, timeoutMs: request.timeoutMs, signal: request.signal }, true);
287
+ return { text: response.text };
288
+ }
289
+ finally {
290
+ await this.synchronizeSession();
291
+ if (client.connected()) {
292
+ if (previous.conversationId) {
293
+ if (!client.activateConversation)
294
+ throw new Error("WorkBuddy 无法恢复用户原会话");
295
+ await client.activateConversation(previous.conversationId, true);
296
+ }
297
+ else if (client.conversationId)
298
+ await client.createTask();
299
+ }
300
+ this.activeSessionId = previous.sessionId;
301
+ this.activeDesktopConversationId = previous.conversationId;
302
+ this.activeExpert = previous.expert;
303
+ this.expertSession = previous.expertSession;
304
+ this.desktopSessionValid = previous.valid;
305
+ await this.persistKnownSessions();
306
+ }
307
+ });
308
+ return await (0, agent_1.abortable)(run, request.signal);
309
+ }
310
+ catch (error) {
311
+ if (error instanceof agent_2.AgentOperationError)
312
+ throw error;
313
+ throw new agent_2.AgentOperationError("WORKBUDDY_MODEL_FAILED", stage, error);
314
+ }
315
+ }
259
316
  async controlSession(request) {
260
317
  if (this.pending)
261
318
  throw new Error("WorkBuddy 当前忙,无法创建新会话");
@@ -277,17 +334,20 @@ class WorkbuddyPlugin {
277
334
  return { text: "WorkBuddy 已创建新会话", sessionId };
278
335
  });
279
336
  }
280
- async complete(request) {
337
+ async complete(request, modelRequest = false) {
281
338
  let stage = "连接 WorkBuddy 桌面";
282
339
  try {
283
340
  const timeout = request.timeoutMs ?? this.timeoutMs;
284
- const expert = extractExpertQuery(request.task);
341
+ const expert = modelRequest ? undefined : extractExpertQuery(request.task);
285
342
  const usesCli = Boolean(this.cliPath && this.transport !== "cdp" && !expert);
286
343
  const hasAttachments = Array.isArray(request.attachments) && request.attachments.length > 0;
287
344
  if (hasAttachments && !this.attachmentInput)
288
345
  throw new Error("WorkBuddy 当前传输不支持附件输入");
289
- if (!usesCli && !this.client?.connected())
346
+ if (!usesCli && !this.client?.connected()) {
347
+ if (modelRequest)
348
+ throw new Error("WorkBuddy CDP 已断开,模型请求不会启动或重启桌面");
290
349
  await this.reconnect?.();
350
+ }
291
351
  const pendingInteractionSessionId = this.client?.pendingInteractionSessionId?.();
292
352
  if (!usesCli && pendingInteractionSessionId && pendingInteractionSessionId !== request.sessionId)
293
353
  throw new Error("WorkBuddy 正在等待另一个会话的选择");
@@ -299,7 +359,7 @@ class WorkbuddyPlugin {
299
359
  throw new Error("WorkBuddy 桌面任务状态未知,请先创建新会话");
300
360
  stage = "准备或恢复 WorkBuddy 会话";
301
361
  if (!usesCli)
302
- await this.ensureSession(request.sessionId);
362
+ await this.ensureSession(request.sessionId, modelRequest);
303
363
  stage = "执行 WorkBuddy 桌面任务";
304
364
  if (expert) {
305
365
  if (!this.client?.connected())
@@ -342,12 +402,12 @@ class WorkbuddyPlugin {
342
402
  }
343
403
  }
344
404
  catch (error) {
345
- if (error instanceof agent_1.AgentOperationError || error?.stage)
405
+ if (error instanceof agent_2.AgentOperationError || error?.stage)
346
406
  throw error;
347
- throw new agent_1.AgentOperationError("WORKBUDDY_TASK_FAILED", stage, error);
407
+ throw new agent_2.AgentOperationError("WORKBUDDY_TASK_FAILED", stage, error);
348
408
  }
349
409
  }
350
- async ensureSession(sessionId) {
410
+ async ensureSession(sessionId, modelRequest = false) {
351
411
  if (!sessionId)
352
412
  return;
353
413
  if (!this.client?.connected())
@@ -370,7 +430,7 @@ class WorkbuddyPlugin {
370
430
  }
371
431
  if (!this.client.activateConversation)
372
432
  throw new Error("WorkBuddy 不支持恢复旧 WorkBuddy 会话");
373
- await this.client.activateConversation(conversationId);
433
+ await this.client.activateConversation(conversationId, modelRequest);
374
434
  this.activeSessionId = sessionId;
375
435
  this.activeDesktopConversationId = conversationId;
376
436
  this.activeExpert = binding?.expert;
@@ -462,22 +522,33 @@ class WorkbuddyPlugin {
462
522
  const profile = (0, node_path_1.join)(dataDir ?? (0, node_path_1.join)((0, node_os_1.homedir)(), ".agent-bridge", "workbuddy"), "desktop");
463
523
  const launch = (file, args) => (0, desktop_launch_2.launchWorkbuddyDesktop)(file, args, profile, port);
464
524
  const timeoutMs = typeof config.startupTimeoutMs === "number" ? config.startupTimeoutMs : 30_000;
525
+ const connectOrLaunch = async () => {
526
+ try {
527
+ await this.client.connect();
528
+ return;
529
+ }
530
+ catch (first) {
531
+ if (config.autoStart === false || this.options.client)
532
+ throw first;
533
+ if (!executable)
534
+ throw new Error("未找到 WorkBuddy.exe,请配置 executablePath");
535
+ logger.info(`WorkBuddy CDP ${port} 不可用,启动带调试参数的桥接实例`);
536
+ await (0, desktop_launch_1.launchManagedAndWait)(executable, [`--remote-debugging-port=${port}`], profile, () => this.client.connect(), timeoutMs, child => { this.process = child; }, launch);
537
+ }
538
+ };
465
539
  this.reconnect = async () => {
466
- // 请求恢复只重连 socket,页面错误不能触发桌面进程重启。
467
- await this.client.connect();
540
+ try {
541
+ await this.client.connect();
542
+ }
543
+ catch (error) {
544
+ const failure = error;
545
+ // 只有调试端口拒绝连接才重新启动;页面或协议错误不得触碰桌面进程。
546
+ if (failure.code !== "ECONNREFUSED" && failure.cause?.code !== "ECONNREFUSED")
547
+ throw error;
548
+ await connectOrLaunch();
549
+ }
468
550
  };
469
- try {
470
- await this.client.connect();
471
- return;
472
- }
473
- catch (first) {
474
- if (config.autoStart === false || this.options.client)
475
- throw first;
476
- if (!executable)
477
- throw new Error("未找到 WorkBuddy.exe,请配置 executablePath");
478
- logger.info(`WorkBuddy 已启动,等待 CDP ${port}`);
479
- await (0, desktop_launch_1.launchManagedAndWait)(executable, [`--remote-debugging-port=${port}`], profile, () => this.client.connect(), timeoutMs, child => { this.process = child; }, launch);
480
- }
551
+ await connectOrLaunch();
481
552
  }
482
553
  }
483
554
  exports.WorkbuddyPlugin = WorkbuddyPlugin;
@@ -10,7 +10,7 @@ const session_summary_1 = require("./session-summary");
10
10
  class ManagementError extends Error {
11
11
  }
12
12
  const dailyPlugins = ["qwenwork", "workbuddy", "doubao", "chatgpt", "dsh"];
13
- const usage = "用法:/sessions today [插件ID] [--summary];/sessions last <1–24>h [插件ID] [--summary];/sessions list [插件ID] [--page 页码 --snapshot 编号];/sessions show <编号>;/sessions native-list <插件ID>;/sessions native-show <编号>;/sessions summary --from <编号,...> [主题]";
13
+ const usage = "用法:/sessions today [插件ID] [--summary];/sessions last <1-24>h [插件ID] [--summary];/sessions list [插件ID] [--page 页码 --snapshot 编号];/sessions show <编号>;/sessions native-list <插件ID>;/sessions native-show <编号>;/sessions summary --from <编号,...> [主题]";
14
14
  function isDailySummaryRequest(text) {
15
15
  return /(?:今天|今日).{0,20}(?:聊了什么|聊了哪些|话题|小结|总结)|(?:小结|总结).{0,20}(?:今天|今日|对话)|最近\s*\d+\s*(?:小时|h).{0,20}(?:聊|话题|小结|总结|对话|消息)/i.test(text.trim());
16
16
  }
@@ -119,6 +119,99 @@ class SessionManagement {
119
119
  const result = await this.archive.snapshotSessions();
120
120
  return { sessions: result.sessions.filter(item => sources.includes(item.source) && (!agentPlugin || item.agentPlugin === agentPlugin)), complete: result.complete };
121
121
  }
122
+ async summarizeToday(context, now = new Date()) {
123
+ await this.load();
124
+ validateSource(context.source);
125
+ if (!context.sessionId)
126
+ throw new ManagementError("当前逻辑会话无效");
127
+ if (!(now instanceof Date) || !Number.isFinite(now.getTime()))
128
+ throw new ManagementError("总结时间无效");
129
+ const revision = this.revision;
130
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
131
+ const end = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
132
+ const cutoff = Math.min(now.getTime(), end.getTime());
133
+ const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
134
+ const range = `${formatLocalDate(start)} 至 ${formatLocalDate(new Date(cutoff))} (${zone})`;
135
+ const limitation = "原生插件历史未纳入今日总结:缺少可验证的历史时间,仅统计归档正文";
136
+ const selected = [];
137
+ let characters = 0;
138
+ try {
139
+ const catalog = await this.catalog(this.sources(context));
140
+ this.checkRevision(revision);
141
+ for (const session of catalog.sessions) {
142
+ const turns = [];
143
+ const reasons = new Set([
144
+ ...(session.missingReasons ?? []),
145
+ ...(catalog.complete ? [] : ["归档目录不完整"]),
146
+ limitation,
147
+ ]);
148
+ let complete = true;
149
+ for (let page = 1; page <= 20; page++) {
150
+ const result = await this.archive.readSession(session.sessionId, { page, limit: 100 });
151
+ this.checkRevision(revision);
152
+ if (!result.session) {
153
+ complete = false;
154
+ reasons.add("会话正文不存在");
155
+ break;
156
+ }
157
+ for (const reason of result.missingReasons)
158
+ reasons.add(reason);
159
+ complete &&= result.complete;
160
+ for (const turn of result.turns) {
161
+ const timestamp = Date.parse(turn.time);
162
+ if (!Number.isFinite(timestamp)) {
163
+ complete = false;
164
+ reasons.add("部分正文时间未知");
165
+ continue;
166
+ }
167
+ if (timestamp >= start.getTime() && timestamp <= cutoff) {
168
+ characters += turn.text.length;
169
+ if (characters > session_summary_1.MAX_SUMMARY_CHARACTERS)
170
+ throw new ManagementError("总结输入超过60000字符,请缩小范围");
171
+ turns.push({ role: turn.role, time: turn.time, text: turn.text });
172
+ }
173
+ }
174
+ if (!result.hasNext)
175
+ break;
176
+ if (page === 20) {
177
+ complete = false;
178
+ reasons.add("正文超过20页,未完整读取");
179
+ }
180
+ }
181
+ if (!turns.length)
182
+ continue;
183
+ if (this.bindings?.isBusy(session.source))
184
+ reasons.add("源会话正在运行,仅包含已完成轮次");
185
+ if (selected.length >= session_summary_1.MAX_SUMMARY_SESSIONS)
186
+ throw new ManagementError(`今日会话超过 ${session_summary_1.MAX_SUMMARY_SESSIONS} 个,请缩小来源范围`);
187
+ selected.push({
188
+ sessionId: session.sessionId, agentPlugin: session.agentPlugin, channel: session.channel,
189
+ ...(session.title ? { title: session.title } : {}), firstSeenAt: session.firstSeenAt, updatedAt: session.updatedAt,
190
+ complete: complete && reasons.size === 0, incompleteReasons: [...reasons], turns,
191
+ });
192
+ }
193
+ this.checkRevision(revision);
194
+ if (!selected.length) {
195
+ const result = { supported: false, text: `今日没有可总结的已归档会话(${range})。${limitation}`, complete: false, sources: [] };
196
+ this.audit("今日总结", { actor: context.source, count: 0, status: "empty" });
197
+ return result;
198
+ }
199
+ const summarizer = this.settings.summarizer?.model;
200
+ const result = await new session_summary_1.SessionSummarizer(this.settings.summarizer).summarizeSessions({ sessions: selected }).catch(error => {
201
+ if (error instanceof session_summary_1.SessionSummaryError && error.code === "limit")
202
+ throw new ManagementError(error.message);
203
+ throw new ManagementError("只读总结失败,请检查本机配置与模型服务");
204
+ });
205
+ this.checkRevision(revision);
206
+ const output = { ...result, text: `今日工作小结(${range}):\n${result.text}\n\n说明:${limitation}` };
207
+ this.audit("今日总结", { actor: context.source, count: selected.length, status: result.supported ? "ok" : "unsupported", refs: selected.map(item => item.sessionId), summarizer });
208
+ return output;
209
+ }
210
+ catch (error) {
211
+ this.audit("今日总结", { actor: context.source, count: selected.length, status: "failed", ...(selected.length ? { refs: selected.map(item => item.sessionId) } : {}) });
212
+ throw error;
213
+ }
214
+ }
122
215
  async command(text, context) {
123
216
  const dailyRequest = isDailySummaryRequest(text);
124
217
  if (!dailyRequest && !/^\/sessions(?:\s|$)/.test(text.trimStart()))
@@ -137,15 +230,15 @@ class SessionManagement {
137
230
  const recent = input.match(/^\/sessions last (\d+)h(?: (qwenwork|workbuddy|doubao|chatgpt|dsh))?( --summary)?$/i);
138
231
  const naturalRecent = dailyRequest ? input.match(/最近\s*(\d+)\s*(?:小时|h)/i) : undefined;
139
232
  if (naturalRecent)
140
- return await this.summarizeToday(context, undefined, Boolean(this.settings.summarizer), Number(naturalRecent[1]));
233
+ return await this.summarizeNativeToday(context, undefined, Boolean(this.settings.summarizer), Number(naturalRecent[1]));
141
234
  if (recent)
142
- return await this.summarizeToday(context, recent[2], Boolean(recent[3]), Number(recent[1]));
235
+ return await this.summarizeNativeToday(context, recent[2], Boolean(recent[3]), Number(recent[1]));
143
236
  if (/^\/sessions last\b/i.test(input))
144
237
  throw new ManagementError("时间范围须为最近1至24小时,例如 /sessions last 4h");
145
238
  if (dailyRequest)
146
- return await this.summarizeToday(context, undefined, Boolean(this.settings.summarizer));
239
+ return await this.summarizeNativeToday(context, undefined, Boolean(this.settings.summarizer));
147
240
  if (today)
148
- return await this.summarizeToday(context, today[1], Boolean(today[2]));
241
+ return await this.summarizeNativeToday(context, today[1], Boolean(today[2]));
149
242
  const nativeList = input.match(/^\/sessions native-list ([a-z][a-z0-9-]*)(?: --page ([1-9]\d*))?$/);
150
243
  if (nativeList)
151
244
  return await this.listNative(context, nativeList[1], nativeList[2] ? Number(nativeList[2]) : undefined);
@@ -240,7 +333,7 @@ class SessionManagement {
240
333
  providers() {
241
334
  return this.nativeProviders().map(({ pluginId, provider, status }) => ({ pluginId, scope: provider.scope, mode: provider.mode, limitation: provider.limitation, status }));
242
335
  }
243
- async summarizeToday(context, onlyPlugin, summarize = false, hours) {
336
+ async summarizeNativeToday(context, onlyPlugin, summarize = false, hours) {
244
337
  const revision = this.revision;
245
338
  const cutoff = Date.now();
246
339
  const configured = this.settings.summarizer?.model;
@@ -631,6 +724,12 @@ function validateSource(value) {
631
724
  if (!Array.isArray(source) || source.length !== 5 || source.some(item => typeof item !== "string" || /[\u0000-\u001f]/.test(item)) || !["aun", "feishu"].includes(source[0]) || !source[3] || JSON.stringify(source) !== value)
632
725
  throw new ManagementError("来源格式无效");
633
726
  }
727
+ function formatLocalDate(value) {
728
+ const pad = (part) => String(part).padStart(2, "0");
729
+ const offset = -value.getTimezoneOffset();
730
+ const sign = offset >= 0 ? "+" : "-";
731
+ return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())} ${pad(value.getHours())}:${pad(value.getMinutes())}${sign}${pad(Math.floor(Math.abs(offset) / 60))}:${pad(Math.abs(offset) % 60)}`;
732
+ }
634
733
  function exactIdentifier(value, maximum) {
635
734
  return typeof value === "string" && value.length > 0 && value.length <= maximum && !/[\u0000-\u001f*]/.test(value);
636
735
  }
@@ -35,7 +35,12 @@ class Element {
35
35
  fetch: async (path, options) => {
36
36
  let data = {};
37
37
  if (path === "/api/plugins")
38
- data = { plugins: [{ id: "codex-cli", displayName: "Codex CLI", type: "agent", version: "1.0.0", status: "installed", path: "plugins/codex-cli", manifest: { executionMode: "cli" } }] };
38
+ data = { plugins: [
39
+ { id: "codex-cli", displayName: "Codex CLI", type: "agent", version: "1.0.0", status: "installed", path: "plugins/codex-cli", manifest: { executionMode: "cli" } },
40
+ { id: "qwenwork", displayName: "千问办公", type: "agent", version: "1.0.0", status: "ready", path: "plugins/qwenwork" },
41
+ { id: "doubao", displayName: "豆包", type: "agent", version: "1.0.0", status: "ready", path: "plugins/doubao", manifest: { executionMode: "cdp" } },
42
+ { id: "aun", displayName: "AUN", type: "channel", version: "1.0.0", status: "ready", path: "plugins/aun" },
43
+ ] };
39
44
  if (path.endsWith("/config")) {
40
45
  if (options.method === "PATCH")
41
46
  saved = JSON.parse(options.body);
@@ -46,7 +51,10 @@ class Element {
46
51
  });
47
52
  await new Promise(resolve => setImmediate(resolve));
48
53
  const row = node("#plugins").children[0];
49
- strict_1.default.match(row.children[1].textContent, /CLI/);
54
+ strict_1.default.equal(row.children[1].textContent, "Agent · CLI");
55
+ strict_1.default.equal(node("#plugins").children[1].children[1].textContent, "Agent · 桌面");
56
+ strict_1.default.equal(node("#plugins").children[2].children[1].textContent, "Agent · 桌面");
57
+ strict_1.default.equal(node("#plugins").children[3].children[1].textContent, "Channel");
50
58
  const configure = row.children.at(-1).children.find(child => child.textContent === "配置");
51
59
  strict_1.default.ok(configure, "CLI 插件必须提供配置按钮");
52
60
  await configure.onclick();
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_test_1 = __importDefault(require("node:test"));
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_vm_1 = require("node:vm");
10
+ class Element {
11
+ hidden = false;
12
+ disabled = false;
13
+ value = "";
14
+ textContent = "";
15
+ placeholder = "";
16
+ open = false;
17
+ children = [];
18
+ options = [];
19
+ selectedIndex = 0;
20
+ onclick;
21
+ onchange;
22
+ onsubmit;
23
+ append(...children) { this.children.push(...children); this.options = this.children; }
24
+ replaceChildren(...children) { this.children = children; this.options = this.children; }
25
+ setAttribute() { }
26
+ showModal() { this.open = true; }
27
+ close() { this.open = false; }
28
+ }
29
+ (0, node_test_1.default)("ABWeb 个人助理动态列出模型来源,保留不可用选择及脱敏密钥和隐藏配置", async () => {
30
+ const script = await (0, promises_1.readFile)("src-ts/plugins/abweb/public/app.js", "utf8");
31
+ const nodes = new Map();
32
+ const node = (selector) => { if (!nodes.has(selector))
33
+ nodes.set(selector, new Element()); return nodes.get(selector); };
34
+ const calls = [];
35
+ const plugin = { id: "personal-assistant", type: "agent", displayName: "个人助理", status: "ready", version: "1.0.0", path: "/plugins/personal-assistant" };
36
+ const config = { modelProvider: "plugin", modelPlugin: "workbuddy", apiKey: "******", endpoint: "http://127.0.0.1:1234/v1/chat/completions", model: "local", allowedPeers: ["peer.agentid.cn"], allowedAgents: ["dsh"], ownerAid: "owner.agentid.cn", timeoutMs: 120000 };
37
+ (0, node_vm_1.runInNewContext)(script, {
38
+ document: { querySelector: node, createElement: () => new Element(), hidden: false },
39
+ localStorage: { getItem: () => null, setItem() { }, removeItem() { } },
40
+ window: { addEventListener() { } }, setInterval() { }, confirm: () => false, structuredClone,
41
+ fetch: async (path, init) => {
42
+ calls.push({ path, method: init.method, body: init.body ? JSON.parse(init.body) : undefined });
43
+ const data = path.endsWith("/config") ? config : path === "/api/model-providers" ? { providers: [
44
+ { id: "workbuddy", displayName: "WorkBuddy", status: "failed", available: false, reason: "桌面未连接" },
45
+ { id: "qwenwork", displayName: "千问办公", status: "ready", available: true, reason: "" },
46
+ ] } : { plugins: [plugin], messages: [], sessions: [], mode: "auto-install", config: { providers: {}, plugins: {} } };
47
+ return { ok: true, status: 200, json: async () => data };
48
+ },
49
+ });
50
+ await new Promise(resolve => setImmediate(resolve));
51
+ const buttons = (element) => [element, ...element.children.flatMap(buttons)];
52
+ const configure = buttons(node("#plugins")).find(item => item.textContent === "配置模型");
53
+ strict_1.default.ok(configure, "个人助理应显示配置入口");
54
+ configure.onclick();
55
+ await new Promise(resolve => setImmediate(resolve));
56
+ strict_1.default.equal(node("#assistant-config-dialog").open, true);
57
+ strict_1.default.equal(node("#assistant-model-provider").value, "plugin:workbuddy");
58
+ const choices = node("#assistant-model-provider").children;
59
+ strict_1.default.ok(choices.some(option => option.value === "plugin:qwenwork" && !option.disabled));
60
+ strict_1.default.ok(choices.some(option => option.value === "plugin:workbuddy" && option.disabled && /桌面未连接/.test(option.textContent)));
61
+ strict_1.default.ok(choices.every(option => option.value !== "claude-cli"), "未安装的 Claude CLI 不应被硬编码为可用来源");
62
+ strict_1.default.equal(node("#assistant-api-key").value, "");
63
+ node("#assistant-model-provider").value = "plugin:qwenwork";
64
+ node("#assistant-config-form").onsubmit({ preventDefault() { } });
65
+ await new Promise(resolve => setImmediate(resolve));
66
+ const saved = calls.find(call => call.method === "PATCH" && call.path.endsWith("personal-assistant/config"));
67
+ strict_1.default.ok(saved);
68
+ strict_1.default.deepEqual(saved.body, { modelPlugin: "qwenwork" });
69
+ strict_1.default.ok(calls.some(call => call.path === "/api/model-providers"));
70
+ });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_test_1 = __importDefault(require("node:test"));
8
+ const agent_1 = require("../src-ts/agent");
9
+ (0, node_test_1.default)("取消只结束调用方等待,不会停止仍在运行的桌面操作", async () => {
10
+ const controller = new AbortController();
11
+ let finish;
12
+ let operationFinished = false;
13
+ const operation = new Promise(resolve => { finish = () => { operationFinished = true; resolve("迟到结果"); }; });
14
+ const waiting = (0, agent_1.abortable)(operation, controller.signal);
15
+ controller.abort(new Error("请求已取消"));
16
+ await strict_1.default.rejects(waiting, /请求已取消/);
17
+ strict_1.default.equal(operationFinished, false);
18
+ finish();
19
+ strict_1.default.equal(await operation, "迟到结果");
20
+ strict_1.default.equal(operationFinished, true);
21
+ });
22
+ (0, node_test_1.default)("预取消仍观察已经启动的操作拒绝", async () => {
23
+ const controller = new AbortController();
24
+ controller.abort(new Error("预取消"));
25
+ await strict_1.default.rejects((0, agent_1.abortable)(Promise.reject(new Error("底层迟到失败")), controller.signal), /预取消/);
26
+ await new Promise(resolve => setImmediate(resolve));
27
+ });
@@ -14,6 +14,12 @@ const messages_1 = require("../src-ts/plugins/aun/messages");
14
14
  peerId: "other.agentid.cn", messageId: "m1", text: "你好", threadId: "t1",
15
15
  });
16
16
  });
17
+ (0, node_test_1.default)("AUN 错误和通知事件不作为任务触发自动互答", () => {
18
+ for (const type of ["error", "notice"]) {
19
+ strict_1.default.equal((0, messages_1.normalizeAunMessage)({ from: "peer.agentid.cn", payload: { type, text: "今日额度已用完", thread_id: "test-thread" } }, "self.agentid.cn"), undefined);
20
+ }
21
+ strict_1.default.equal((0, messages_1.normalizeAunMessage)({ from: "peer.agentid.cn", payload: { type: "text", text: "请分析今日额度已用完的原因" } }, "self.agentid.cn")?.text, "请分析今日额度已用完的原因");
22
+ });
17
23
  (0, node_test_1.default)("AUN 纯附件消息保留可定位引用并拒绝任意 URL", () => {
18
24
  const message = (0, messages_1.normalizeAunMessage)({
19
25
  from: "peer.agentid.cn", message_id: "attachment-1", payload: {
@@ -385,6 +385,91 @@ async function withAunAttachmentPlugin(run, publish, config = { allow_from: "pee
385
385
  await (0, promises_1.rm)(root, { recursive: true, force: true });
386
386
  }
387
387
  });
388
+ (0, node_test_1.default)("AUN 管理接口列出安全绑定、使用默认 Owner 创建并要求显式允许替换", async () => {
389
+ const root = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), "aun-management-api-"));
390
+ const registered = [];
391
+ const sdk = {
392
+ AIDStore: class {
393
+ async register(aid) { registered.push(aid); return { ok: true, data: {} }; }
394
+ list() { return { ok: true, data: { identities: ["assistant.agentid.cn", ...registered].map((aid) => ({ aid })) } }; }
395
+ load(aid) { return { ok: true, data: { aid } }; }
396
+ close() { }
397
+ },
398
+ AUNClient: class {
399
+ on() { return { unsubscribe() { } }; }
400
+ async connect() { }
401
+ async close() { }
402
+ },
403
+ };
404
+ const plugin = new aun_1.AunPlugin({ sdk, ingress: { publish: async () => undefined } });
405
+ const fetchCalls = [];
406
+ let failBinding = false;
407
+ const originalFetch = globalThis.fetch;
408
+ globalThis.fetch = async (url, init) => {
409
+ fetchCalls.push({ path: String(url), body: init?.body ? JSON.parse(String(init.body)) : undefined });
410
+ if (failBinding)
411
+ return Response.json({ error: "配置保存失败" }, { status: 400 });
412
+ return Response.json({ ok: true });
413
+ };
414
+ try {
415
+ await plugin.activate({ dataDir: root, config: { aid: "assistant.agentid.cn", owner_aid: "owner.agentid.cn", encryption_seed: "private-seed", bindings: { "assistant.agentid.cn": "personal-assistant", "old.agentid.cn": "qwenwork" } }, logger: { info() { }, warn() { }, error() { } }, callPlugin: async () => ({ text: "" }), pluginStatus: () => "ready", http: { register() { }, unregister() { } }, runtime: { controlUrl: "http://127.0.0.1:3000" } });
416
+ strict_1.default.deepEqual(await plugin.aunManagement.list(), {
417
+ aids: ["assistant.agentid.cn", "old.agentid.cn"],
418
+ bindings: { "assistant.agentid.cn": "personal-assistant", "old.agentid.cn": "qwenwork" },
419
+ });
420
+ await strict_1.default.rejects(plugin.aunManagement.create({ aid: "invalid" }), /AID 格式无效/);
421
+ await strict_1.default.rejects(plugin.aunManagement.bind({ aid: "new.agentid.cn", agentId: "qwenwork", replace: false }), /其他 AID 绑定.*replace/);
422
+ await strict_1.default.rejects(plugin.aunManagement.bind({ aid: "old.agentid.cn", agentId: "personal-assistant", replace: true }), /已绑定到其他 Agent/);
423
+ const created = await plugin.aunManagement.create({ aid: "new.agentid.cn" });
424
+ strict_1.default.deepEqual(created, { aid: "new.agentid.cn", status: "已创建", connection: "ready" });
425
+ strict_1.default.deepEqual(registered, ["new.agentid.cn"]);
426
+ strict_1.default.doesNotMatch(JSON.stringify(created), /owner|private-seed|token|path/i);
427
+ failBinding = true;
428
+ await strict_1.default.rejects(plugin.aunManagement.bind({ aid: "new.agentid.cn", agentId: "qwenwork", replace: true }), /身份关联失败/);
429
+ strict_1.default.equal(fetchCalls.length, 1);
430
+ failBinding = false;
431
+ strict_1.default.deepEqual(await plugin.aunManagement.bind({ aid: "new.agentid.cn", agentId: "qwenwork", replace: true }), { aid: "new.agentid.cn", agent: "qwenwork", replacedAids: ["old.agentid.cn"] });
432
+ strict_1.default.deepEqual(fetchCalls, [
433
+ { path: "http://127.0.0.1:3000/api/plugins/qwenwork/aid", body: { aid: "new.agentid.cn" } },
434
+ { path: "http://127.0.0.1:3000/api/plugins/qwenwork/aid", body: { aid: "new.agentid.cn" } },
435
+ ]);
436
+ }
437
+ finally {
438
+ globalThis.fetch = originalFetch;
439
+ await plugin.deactivate("stop");
440
+ await (0, promises_1.rm)(root, { recursive: true, force: true });
441
+ }
442
+ });
443
+ (0, node_test_1.default)("AUN 管理创建拒绝缺失 Owner,并在注册后连接失败时禁止盲目重试", async () => {
444
+ const root = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), "aun-management-create-partial-"));
445
+ const registered = [];
446
+ const sdk = {
447
+ AIDStore: class {
448
+ async register(aid) { registered.push(aid); return { ok: true, data: {} }; }
449
+ list() { return { ok: true, data: { identities: registered.map((aid) => ({ aid })) } }; }
450
+ load(aid) { return { ok: true, data: { aid } }; }
451
+ close() { }
452
+ },
453
+ AUNClient: class {
454
+ on() { return { unsubscribe() { } }; }
455
+ async connect() { throw new Error("连接失败"); }
456
+ async close() { }
457
+ },
458
+ };
459
+ const plugin = new aun_1.AunPlugin({ sdk, ingress: { publish: async () => undefined } });
460
+ try {
461
+ await plugin.activate({ dataDir: root, config: {}, logger: { info() { }, warn() { }, error() { } }, callPlugin: async () => ({ text: "" }), pluginStatus: () => "ready", http: { register() { }, unregister() { } } });
462
+ await strict_1.default.rejects(plugin.aunManagement.create({ aid: "missing-owner.agentid.cn" }), /未提供 Owner AID/);
463
+ strict_1.default.deepEqual(registered, []);
464
+ await strict_1.default.rejects(plugin.aunManagement.create({ aid: "partial.agentid.cn", ownerAid: "owner.agentid.cn" }), /已创建但连接失败.*不要重试创建/);
465
+ strict_1.default.deepEqual(registered, ["partial.agentid.cn"]);
466
+ strict_1.default.deepEqual((await plugin.aunManagement.list()).aids, ["partial.agentid.cn"]);
467
+ }
468
+ finally {
469
+ await plugin.deactivate("stop");
470
+ await (0, promises_1.rm)(root, { recursive: true, force: true });
471
+ }
472
+ });
388
473
  (0, node_test_1.default)("AUN 首次加载失败后仍列出已注册身份且重试不重复注册", async () => {
389
474
  const root = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), "aun-cli-load-retry-"));
390
475
  const routes = new Map();
@@ -8,7 +8,7 @@ const promises_1 = require("node:fs/promises");
8
8
  const node_path_1 = require("node:path");
9
9
  const node_module_1 = require("node:module");
10
10
  const node_test_1 = __importDefault(require("node:test"));
11
- const ids = ["abweb", "aun", "chatgpt", "claude-cli", "codex-cli", "doubao", "dsh", "feishu", "qwenwork", "workbuddy"];
11
+ const ids = ["abweb", "aun", "chatgpt", "claude-cli", "codex-cli", "doubao", "dsh", "feishu", "personal-assistant", "qwenwork", "workbuddy"];
12
12
  (0, node_test_1.default)("独立包和默认插件的运行时依赖可加载且代码版本一致", async () => {
13
13
  const load = (0, node_module_1.createRequire)(__filename);
14
14
  for (const id of ids) {
@@ -35,7 +35,17 @@ const ids = ["abweb", "aun", "chatgpt", "claude-cli", "codex-cli", "doubao", "ds
35
35
  strict_1.default.deepEqual(packageSchema, schema, `${id} 独立包与内置插件的配置声明必须一致`);
36
36
  await (0, promises_1.access)((0, node_path_1.join)(directory, manifest.entry));
37
37
  const meta = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(directory, "package.json"), "utf8"));
38
- strict_1.default.equal(meta.name, `agent-bridge-${id}`);
38
+ strict_1.default.equal(meta.name, id === "personal-assistant" ? "agent-bridge-pa" : `agent-bridge-${id}`);
39
+ if (id === "personal-assistant")
40
+ strict_1.default.equal(meta.agentBridge.id, id);
39
41
  strict_1.default.equal(meta.version, packageManifest.version);
40
42
  }
41
43
  });
44
+ (0, node_test_1.default)("五个桌面插件的安装清单声明模型来源能力", async () => {
45
+ for (const id of ["chatgpt", "doubao", "dsh", "qwenwork", "workbuddy"]) {
46
+ for (const root of ["packages", "plugins"]) {
47
+ const manifest = JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(process.cwd(), root, id, "plugin.json"), "utf8"));
48
+ strict_1.default.ok(manifest.capabilities?.includes("model-provider"), `${root}/${id} 必须声明模型来源能力`);
49
+ }
50
+ }
51
+ });