personal-bot 0.2.11 → 0.2.13

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 (151) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +15 -0
  3. package/CONTEXT.md +11 -5
  4. package/README.md +45 -14
  5. package/README.zh-CN.md +45 -14
  6. package/bin/pbot-pi-acp.mjs +20 -0
  7. package/docs/README.md +6 -4
  8. package/docs/adr/0001-claude-skill-discovery.md +3 -0
  9. package/docs/adr/0002-claude-native-collaboration.md +3 -0
  10. package/docs/agent-collaboration.md +54 -6
  11. package/docs/architecture-guidelines.md +1 -1
  12. package/docs/capability-design.md +15 -3
  13. package/docs/claude-code-design.md +45 -0
  14. package/docs/claude-code.md +64 -0
  15. package/docs/dsh.md +12 -11
  16. package/docs/file-storage.md +26 -9
  17. package/docs/history.md +17 -9
  18. package/docs/interaction-design.md +11 -3
  19. package/docs/model-context.md +43 -12
  20. package/docs/model-instruction-guidelines.md +3 -3
  21. package/docs/release.md +13 -5
  22. package/docs/technical-design.md +59 -19
  23. package/docs/workspace-configuration.md +50 -23
  24. package/hooks/hooks.json +19 -0
  25. package/lib/claude.d.ts +1 -0
  26. package/lib/claude.js +20 -0
  27. package/lib/client.js +41 -8
  28. package/lib/dsh.js +2 -0
  29. package/lib/extension/acp-member.d.ts +16 -0
  30. package/lib/extension/acp-member.js +45 -0
  31. package/lib/extension/acp-worker.d.ts +1 -0
  32. package/lib/extension/acp-worker.js +159 -0
  33. package/lib/extension/claude-hooks.d.ts +15 -0
  34. package/lib/extension/claude-hooks.js +104 -0
  35. package/lib/extension/dsh/acp-member.d.ts +4 -0
  36. package/lib/extension/dsh/acp-member.js +48 -0
  37. package/lib/extension/dsh/command.js +11 -1
  38. package/lib/extension/dsh/history.js +1 -1
  39. package/lib/extension/dsh/management.js +3 -1
  40. package/lib/extension/dsh/workspace.d.ts +35 -1
  41. package/lib/extension/dsh/workspace.js +21 -3
  42. package/lib/integrations/acp/agents.d.ts +24 -0
  43. package/lib/integrations/acp/agents.js +168 -0
  44. package/lib/integrations/acp/claude.d.ts +18 -0
  45. package/lib/integrations/acp/claude.js +33 -0
  46. package/lib/integrations/acp/connection.d.ts +27 -0
  47. package/lib/integrations/acp/connection.js +167 -0
  48. package/lib/integrations/acp/input.d.ts +4 -0
  49. package/lib/integrations/acp/input.js +45 -0
  50. package/lib/integrations/acp/launch.d.ts +4 -0
  51. package/lib/integrations/acp/launch.js +52 -0
  52. package/lib/integrations/acp/model-selection.d.ts +12 -0
  53. package/lib/integrations/acp/model-selection.js +65 -0
  54. package/lib/integrations/agent-resources.d.ts +1 -1
  55. package/lib/integrations/agent-resources.js +3 -1
  56. package/lib/integrations/dsh/dsh-agents.d.ts +2 -1
  57. package/lib/integrations/dsh/dsh-agents.js +4 -0
  58. package/lib/integrations/dsh/history-summary.js +5 -9
  59. package/lib/integrations/dsh/history.js +13 -5
  60. package/lib/integrations/history-summary.d.ts +2 -0
  61. package/lib/integrations/history-summary.js +21 -10
  62. package/lib/model/acp.d.ts +59 -0
  63. package/lib/model/acp.js +1 -0
  64. package/lib/model/agent.d.ts +15 -1
  65. package/lib/model/history.d.ts +11 -4
  66. package/lib/model/workspace-config.d.ts +3 -0
  67. package/lib/services/agents/acp-run.d.ts +42 -0
  68. package/lib/services/agents/acp-run.js +149 -0
  69. package/lib/services/agents/agent-service.d.ts +114 -6
  70. package/lib/services/agents/agent-service.js +81 -10
  71. package/lib/services/agents/team-service.js +4 -2
  72. package/lib/services/history/history-service.d.ts +8 -6
  73. package/lib/services/history/history-service.js +90 -48
  74. package/lib/services/workspace/python-environment-service.d.ts +6 -0
  75. package/lib/services/workspace/python-environment-service.js +25 -9
  76. package/lib/services/workspace/workspace-config.js +12 -1
  77. package/lib/storage/acp-files.d.ts +9 -0
  78. package/lib/storage/acp-files.js +50 -0
  79. package/lib/storage/agent-files.d.ts +5 -4
  80. package/lib/storage/agent-files.js +14 -2
  81. package/lib/storage/history-files.d.ts +2 -1
  82. package/lib/storage/history-files.js +26 -15
  83. package/lib/tools/agents/actions.d.ts +16 -2
  84. package/lib/tools/agents/actions.js +3 -1
  85. package/lib/tools/agents/contract.d.ts +48 -3
  86. package/lib/tools/agents/contract.js +15 -9
  87. package/lib/tools/agents/dsh-contract.d.ts +8 -15
  88. package/lib/tools/agents/dsh-contract.js +12 -8
  89. package/lib/tools/history/contract.d.ts +7 -7
  90. package/lib/tools/history/contract.js +2 -2
  91. package/lib/ui/dsh/management.js +37 -9
  92. package/npm-shrinkwrap.json +975 -51
  93. package/package.json +40 -29
  94. package/python/README.md +17 -14
  95. package/resources/agents/coordinator.md +1 -1
  96. package/resources/claude/agents/general-purpose.md +12 -0
  97. package/resources/claude/skills/pbot/SKILL.md +17 -0
  98. package/resources/prompts/claude-coordinator.md +1 -0
  99. package/resources/prompts/native-coordinator.md +1 -0
  100. package/resources/prompts/workspace.md +2 -2
  101. package/resources/references/compute.md +2 -2
  102. package/resources/references/task-conductor.md +3 -2
  103. package/resources/skills/.claude-plugin/plugin.json +4 -0
  104. package/resources/skills/provider-connections/SKILL.md +17 -1
  105. package/scripts/README.md +29 -5
  106. package/src/claude.ts +19 -0
  107. package/src/dsh.ts +1 -0
  108. package/src/extension/acp-member.ts +44 -0
  109. package/src/extension/acp-worker.ts +124 -0
  110. package/src/extension/agent-events.ts +28 -3
  111. package/src/extension/agents-command.ts +33 -5
  112. package/src/extension/claude-hooks.ts +94 -0
  113. package/src/extension/dsh/acp-member.ts +44 -0
  114. package/src/extension/dsh/command.ts +10 -1
  115. package/src/extension/dsh/history.ts +1 -1
  116. package/src/extension/dsh/management.ts +2 -1
  117. package/src/extension/dsh/workspace.ts +21 -3
  118. package/src/extension/lifecycle.ts +2 -2
  119. package/src/extension/pi-acp-member.ts +64 -0
  120. package/src/integrations/acp/agents.ts +118 -0
  121. package/src/integrations/acp/claude.ts +40 -0
  122. package/src/integrations/acp/connection.ts +152 -0
  123. package/src/integrations/acp/input.ts +39 -0
  124. package/src/integrations/acp/launch.ts +50 -0
  125. package/src/integrations/acp/model-selection.ts +66 -0
  126. package/src/integrations/agent-resources.ts +2 -1
  127. package/src/integrations/dsh/dsh-agents.ts +4 -1
  128. package/src/integrations/dsh/history-summary.ts +5 -9
  129. package/src/integrations/dsh/history.ts +12 -6
  130. package/src/integrations/history-summary.ts +18 -8
  131. package/src/integrations/pi/history.ts +16 -15
  132. package/src/integrations/pi/pi-agents.ts +4 -1
  133. package/src/model/acp.ts +26 -0
  134. package/src/model/agent.ts +7 -1
  135. package/src/model/history.ts +12 -4
  136. package/src/model/workspace-config.ts +4 -0
  137. package/src/pbot.ts +5 -4
  138. package/src/services/agents/acp-run.ts +123 -0
  139. package/src/services/agents/agent-service.ts +85 -12
  140. package/src/services/agents/team-service.ts +3 -2
  141. package/src/services/history/history-service.ts +82 -41
  142. package/src/services/workspace/python-environment-service.ts +26 -9
  143. package/src/services/workspace/workspace-config.ts +10 -1
  144. package/src/storage/acp-files.ts +50 -0
  145. package/src/storage/agent-files.ts +15 -4
  146. package/src/storage/history-files.ts +20 -11
  147. package/src/tools/agents/actions.ts +4 -2
  148. package/src/tools/agents/contract.ts +16 -9
  149. package/src/tools/agents/dsh-contract.ts +12 -8
  150. package/src/tools/history/contract.ts +2 -2
  151. package/src/ui/dsh/management.ts +32 -9
@@ -3,7 +3,7 @@ export declare const historyResultSchema: Type.TObject<{
3
3
  matches: Type.TOptional<Type.TArray<Type.TObject<{
4
4
  snippet: Type.TString;
5
5
  parents: Type.TArray<Type.TString>;
6
- host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>;
6
+ host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>;
7
7
  id: Type.TString;
8
8
  kind: Type.TUnion<[Type.TLiteral<"session">, Type.TLiteral<"exchange">, Type.TLiteral<"summary">]>;
9
9
  sessionId: Type.TString;
@@ -21,7 +21,7 @@ export declare const historyResultSchema: Type.TObject<{
21
21
  totalLength: Type.TInteger;
22
22
  nextOffset: Type.TUnion<[Type.TInteger, Type.TNull]>;
23
23
  parents: Type.TArray<Type.TObject<{
24
- host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>;
24
+ host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>;
25
25
  id: Type.TString;
26
26
  kind: Type.TUnion<[Type.TLiteral<"session">, Type.TLiteral<"exchange">, Type.TLiteral<"summary">]>;
27
27
  sessionId: Type.TString;
@@ -33,7 +33,7 @@ export declare const historyResultSchema: Type.TObject<{
33
33
  completed: Type.TBoolean;
34
34
  }>>;
35
35
  children: Type.TArray<Type.TObject<{
36
- host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>;
36
+ host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>;
37
37
  id: Type.TString;
38
38
  kind: Type.TUnion<[Type.TLiteral<"session">, Type.TLiteral<"exchange">, Type.TLiteral<"summary">]>;
39
39
  sessionId: Type.TString;
@@ -46,12 +46,12 @@ export declare const historyResultSchema: Type.TObject<{
46
46
  }>>;
47
47
  nextChildrenOffset: Type.TUnion<[Type.TInteger, Type.TNull]>;
48
48
  source: Type.TObject<{
49
- host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>;
49
+ host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>;
50
50
  sessionId: Type.TString;
51
51
  entryIds: Type.TArray<Type.TString>;
52
52
  }>;
53
53
  warnings: Type.TArray<Type.TString>;
54
- host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>;
54
+ host: Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>;
55
55
  id: Type.TString;
56
56
  kind: Type.TUnion<[Type.TLiteral<"session">, Type.TLiteral<"exchange">, Type.TLiteral<"summary">]>;
57
57
  sessionId: Type.TString;
@@ -64,10 +64,10 @@ export declare const historyResultSchema: Type.TObject<{
64
64
  }>>;
65
65
  warnings: Type.TArray<Type.TString>;
66
66
  }>;
67
- export declare const historyDescription = "\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u533A\u7684 Pi/dsh \u95EE\u7B54\u5F52\u6863\uFF0Chost \u53EF\u7B5B\u9009\u6765\u6E90\u3002search \u6309\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u7684\u8FDE\u7EED\u6587\u672C\u5339\u914D\u539F\u6587\u548C\u6458\u8981\uFF1B\u65E0\u5339\u914D\u65F6\u6362\u8BCD\uFF0C\u7701\u7565 query \u5217\u4F1A\u8BDD\u3002read \u6309 parents/children \u7684 id \u5C55\u5F00\uFF0CnextOffset \u7EED\u8BFB\u6B63\u6587\uFF0CnextChildrenOffset \u7EED\u8BFB\u5B50\u8282\u70B9\u3002\u9700\u8981\u5BF9\u8BDD\u7EC6\u8282\u65F6\u8BFB\u53D6 exchange \u539F\u6587\uFF1B\u9700\u8981\u5DE5\u5177\u65E5\u5FD7\u65F6\u67E5\u6240\u5C5E\u5BBF\u4E3B\u7684\u539F\u59CB\u4F1A\u8BDD\u3002";
67
+ export declare const historyDescription = "\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u533A\u7684 Pi/dsh \u95EE\u7B54\u4E0E\u5DF2\u6709 Claude \u5F52\u6863\uFF0Chost \u53EF\u7B5B\u9009\u6765\u6E90\u3002search \u6309\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u7684\u8FDE\u7EED\u6587\u672C\u5339\u914D\u539F\u6587\u548C\u6458\u8981\uFF1B\u65E0\u5339\u914D\u65F6\u6362\u8BCD\uFF0C\u7701\u7565 query \u5217\u4F1A\u8BDD\u3002read \u6309 parents/children \u7684 id \u5C55\u5F00\uFF0CnextOffset \u7EED\u8BFB\u6B63\u6587\uFF0CnextChildrenOffset \u7EED\u8BFB\u5B50\u8282\u70B9\u3002\u9700\u8981\u5BF9\u8BDD\u7EC6\u8282\u65F6\u8BFB\u53D6 exchange \u539F\u6587\uFF1B\u9700\u8981\u5DE5\u5177\u65E5\u5FD7\u65F6\u67E5\u6240\u5C5E\u5BBF\u4E3B\u7684\u539F\u59CB\u4F1A\u8BDD\u3002";
68
68
  export declare const historyParameters: Type.TObject<{
69
69
  action: Type.TUnion<[Type.TLiteral<"search">, Type.TLiteral<"read">]>;
70
- host: Type.TOptional<Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">]>>;
70
+ host: Type.TOptional<Type.TUnion<[Type.TLiteral<"pi">, Type.TLiteral<"dsh">, Type.TLiteral<"claude">]>>;
71
71
  query: Type.TOptional<Type.TString>;
72
72
  sessionId: Type.TOptional<Type.TString>;
73
73
  from: Type.TOptional<Type.TString>;
@@ -1,6 +1,6 @@
1
1
  import { Type } from "../../common/typebox.js";
2
2
  import { requireThat, schema } from "../../common/validation.js";
3
- const host = Type.Union([Type.Literal("pi"), Type.Literal("dsh")]);
3
+ const host = Type.Union([Type.Literal("pi"), Type.Literal("dsh"), Type.Literal("claude")]);
4
4
  const nullableOffset = Type.Union([Type.Integer(), Type.Null()]);
5
5
  const node = Type.Object({ host, id: Type.String(), kind: Type.Union([Type.Literal("session"), Type.Literal("exchange"), Type.Literal("summary")]),
6
6
  sessionId: Type.String(), name: Type.String(), preview: Type.String(), from: Type.String(), to: Type.String(), ready: Type.Boolean(), completed: Type.Boolean() });
@@ -12,7 +12,7 @@ export const historyResultSchema = Type.Object({
12
12
  source: Type.Object({ host, sessionId: Type.String({ description: "原始宿主会话 ID。" }), entryIds: Type.Array(Type.String()) }), warnings: Type.Array(Type.String()) })),
13
13
  warnings: Type.Array(Type.String()),
14
14
  });
15
- export const historyDescription = "查询当前工作区的 Pi/dsh 问答归档,host 可筛选来源。search 按不区分大小写的连续文本匹配原文和摘要;无匹配时换词,省略 query 列会话。read 按 parents/children 的 id 展开,nextOffset 续读正文,nextChildrenOffset 续读子节点。需要对话细节时读取 exchange 原文;需要工具日志时查所属宿主的原始会话。";
15
+ export const historyDescription = "查询当前工作区的 Pi/dsh 问答与已有 Claude 归档,host 可筛选来源。search 按不区分大小写的连续文本匹配原文和摘要;无匹配时换词,省略 query 列会话。read 按 parents/children 的 id 展开,nextOffset 续读正文,nextChildrenOffset 续读子节点。需要对话细节时读取 exchange 原文;需要工具日志时查所属宿主的原始会话。";
16
16
  export const historyParameters = Type.Object({ action: Type.Union([Type.Literal("search"), Type.Literal("read")]),
17
17
  host: Type.Optional(host), query: Type.Optional(Type.String()), sessionId: Type.Optional(Type.String()),
18
18
  from: Type.Optional(Type.String({ description: "search:ISO 日期或时间,下界。" })),
@@ -165,19 +165,23 @@ export function showManagement(ctx, parentSessionId) {
165
165
  const diagnostic = details(status, "环境详情"), statusBody = block("");
166
166
  statusBody.classList.add("pbot-raw");
167
167
  diagnostic.append(statusBody);
168
+ const permissions = group(status, "pbot-setting");
169
+ permissions.hidden = true;
170
+ let permissionKey = "";
168
171
  const experts = section("experts", "专家");
169
172
  pageTitle(experts, "专家", "");
170
173
  const create = details(experts, "创建专家"), createForm = form(create), newName = field(createForm, "名称"), initial = field(createForm, "任务(可选)", true);
171
174
  newName.placeholder = "例如:研究员";
172
175
  initial.placeholder = "任务目标与交付要求";
176
+ const backend = select(createForm, "运行宿主", [["", "当前宿主"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"]]);
173
177
  const options = details(createForm, "模型与选项"), modelFields = group(options, "pbot-grid");
174
- options.querySelector("summary").after(note("留空沿用当前会话。"));
178
+ options.querySelector("summary").after(note("当前宿主留空沿用主会话;其他宿主留空使用目标配置。"));
175
179
  const provider = field(modelFields, "Provider"), model = field(modelFields, "模型");
176
180
  const effort = field(options, "Reasoning effort"), cwd = field(options, "工作目录");
177
181
  const files = field(options, "文件路径(每行一个)", true);
178
182
  const advanced = field(details(options, "其他选项"), "JSON", true, "{}");
179
183
  submit(createForm, "创建", async () => {
180
- const args = { ...objectInput(advanced.value), action: "start", ...(newName.value ? { name: newName.value } : {}),
184
+ const args = { ...objectInput(advanced.value), action: "start", ...(backend.value ? { backend: backend.value } : {}), ...(newName.value ? { name: newName.value } : {}),
181
185
  ...(initial.value ? { message: initial.value } : {}), ...(provider.value ? { provider: provider.value } : {}),
182
186
  ...(model.value ? { model: model.value } : {}), ...(effort.value ? { thinking: effort.value } : {}),
183
187
  ...(cwd.value ? { cwd: cwd.value } : {}), ...(lines(files.value).length ? { files: lines(files.value) } : {}) };
@@ -304,8 +308,15 @@ export function showManagement(ctx, parentSessionId) {
304
308
  expertBadge.replaceChildren(badge(agent.state));
305
309
  expertPanel.hidden = false;
306
310
  expertEmpty.hidden = true;
307
- const config = object(agent.options) ? agent.options : {};
308
- expertInfo.replaceChildren(note(text(agent.activity) || "等待新的任务。"), facts([["模型", config.model || "继承父会话"], ["工作目录", agent.cwd]]));
311
+ const config = object(agent.options) ? agent.options : {}, selected = record(agent.selection);
312
+ const configuredModel = [selected.provider ?? config.provider, selected.model ?? config.model].filter(Boolean).join("/");
313
+ const chosenModel = selected.resolvedModel && selected.resolvedModel !== configuredModel ? `${configuredModel} → ${text(selected.resolvedModel)}` : configuredModel;
314
+ expertInfo.replaceChildren(note(text(agent.activity) || "等待新的任务。"), facts([["宿主", agent.backend || "当前宿主"], ["模型", chosenModel || (agent.transport === "acp" ? "目标宿主配置" : "继承父会话")],
315
+ ["思考等级", selected.thinking || config.thinking || "宿主默认"], ["工作目录", agent.cwd]]));
316
+ const steering = delivery.querySelector('option[value="steer"]');
317
+ steering.disabled = agent.transport === "acp";
318
+ if (steering.disabled && delivery.value === "steer")
319
+ delivery.value = "followUp";
309
320
  expertState.textContent = JSON.stringify(agent, null, 2);
310
321
  expertError.textContent = text(agent.error);
311
322
  expertError.hidden = !agent.error;
@@ -324,7 +335,7 @@ export function showManagement(ctx, parentSessionId) {
324
335
  eventBody.textContent = text(data.text);
325
336
  eventBody.classList.toggle("pbot-raw", format === "json");
326
337
  eventPaging.replaceChildren(element("span", `记录 ${seq} · ${offset + 1}–${offset + text(data.text).length} / ${data.totalLength}`));
327
- button(eventPaging, format === "text" ? "查看原始事件" : "查看正文", () => loadRecord(seq, 0, format === "text" ? "json" : "text"));
338
+ button(eventPaging, format === "text" ? data.kind === "acp" ? "查看记录详情" : "查看原始事件" : "查看正文", () => loadRecord(seq, 0, format === "text" ? "json" : "text"));
328
339
  if (offset)
329
340
  button(eventPaging, "从头读取", () => loadRecord(seq, 0, format));
330
341
  if (typeof data.nextOffset === "number")
@@ -351,8 +362,9 @@ export function showManagement(ctx, parentSessionId) {
351
362
  const expanded = new Set(Array.from(rawEventList.querySelectorAll("details[open]")).map(item => item.dataset.seq));
352
363
  eventList.replaceChildren();
353
364
  rawEventList.replaceChildren();
354
- const labels = { "user/message": "输入", "assistant/message": "专家回复", "tool/result": "工具结果", "turn/end": "本轮结束" };
355
- for (const event of rows(data.events)) {
365
+ rawEvents.querySelector("summary").textContent = data.kind === "acp" ? "全部任务与报告" : "全部原生事件";
366
+ const labels = { "user/message": "输入", "assistant/message": "专家回复", "tool/result": "工具结果", "turn/end": "本轮结束", "acp/input": "任务", "acp/report": "专家报告" };
367
+ for (const event of rows(data.kind === "acp" ? data.records : data.events)) {
356
368
  const seq = Number(event.seq), label = event.type === "user/message"
357
369
  ? event.source === "user" ? "输入" : event.source === "pbot-input" ? "任务" : undefined : labels[text(event.type)];
358
370
  if (label && text(event.preview)) {
@@ -506,7 +518,7 @@ export function showManagement(ctx, parentSessionId) {
506
518
  pageTitle(history, "历史", "");
507
519
  const searchForm = form(history);
508
520
  searchForm.className = "pbot-search";
509
- const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"]]);
521
+ const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"]]);
510
522
  historyQuery.placeholder = "留空查看最近会话";
511
523
  submit(searchForm, "查询", () => searchHistory());
512
524
  const dateFilters = details(history, "时间范围"), dateGrid = group(dateFilters, "pbot-grid");
@@ -663,10 +675,26 @@ export function showManagement(ctx, parentSessionId) {
663
675
  enabled(pythonButton, python.state !== "preparing");
664
676
  const { agents: _agents, teams: _teams, ...summary } = snapshot;
665
677
  statusBody.textContent = JSON.stringify(summary, null, 2);
678
+ const pending = rows(snapshot.permissions), nextPermissionKey = pending.map(request => text(request.agentId) + ":" + text(request.requestId)).join(",");
679
+ permissions.hidden = !pending.length;
680
+ if (nextPermissionKey !== permissionKey) {
681
+ permissionKey = nextPermissionKey;
682
+ permissions.replaceChildren(element("h3", "专家请求确认"));
683
+ for (const request of pending) {
684
+ const card = group(permissions, "pbot-card");
685
+ card.append(element("h4", text(request.name)), block(request.description));
686
+ const choices = group(card, "pbot-row");
687
+ for (const option of rows(request.options))
688
+ button(choices, text(option.name), async () => {
689
+ await command("approval", { agentId: request.agentId, requestId: request.requestId, optionId: option.optionId }, "确认答复已提交。");
690
+ });
691
+ button(choices, "取消", async () => { await command("approval", { agentId: request.agentId, requestId: request.requestId, optionId: null }, "已取消该请求。"); });
692
+ }
693
+ }
666
694
  if (snapshot.controlError)
667
695
  inform(text(snapshot.controlError), "error");
668
696
  renderLists();
669
- const owned = agents.filter(value => value.owned), ids = new Set(owned.map(agent => text(agent.agentId)));
697
+ const owned = agents.filter(value => value.owned && record(value.capabilities).team !== false), ids = new Set(owned.map(agent => text(agent.agentId)));
670
698
  for (const input of memberFields.querySelectorAll("input[data-agent-id]"))
671
699
  if (!ids.has(input.dataset.agentId))
672
700
  input.parentElement?.remove();