personal-bot 0.4.0 → 0.4.1

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 (100) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/docs/architecture/extensibility.md +3 -3
  4. package/docs/architecture/model-context.md +6 -3
  5. package/docs/guides/cross-harness-workers.md +1 -1
  6. package/docs/guides/workspace-configuration.md +1 -1
  7. package/docs/hosts/claude-code.md +1 -1
  8. package/docs/hosts/codex-qoder.md +3 -1
  9. package/hooks/hooks.json +3 -0
  10. package/lib/antigravity-plugin/lib/extension/acp-worker.js +3 -3
  11. package/lib/antigravity-plugin/lib/extension/cli.js +33 -34
  12. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +1 -1
  13. package/lib/antigravity-plugin/lib/extension/mcp.js +70 -105
  14. package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +2 -2
  15. package/lib/antigravity-plugin/lib/integrations/agent-resources.js +3 -3
  16. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +0 -1
  17. package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +1 -2
  18. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +1 -1
  19. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +4 -7
  20. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +1 -1
  21. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +6 -3
  22. package/lib/antigravity-plugin/lib/services/history/summary-runner.js +3 -3
  23. package/lib/antigravity-plugin/lib/storage/history-files.js +3 -2
  24. package/lib/antigravity-plugin/package.json +1 -1
  25. package/lib/antigravity-plugin/plugin.json +2 -2
  26. package/lib/antigravity-plugin/resources/agents/coordinator.md +2 -4
  27. package/lib/antigravity-plugin/resources/agents/general-purpose.md +2 -4
  28. package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +6 -11
  29. package/lib/antigravity-plugin/resources/prompts/history-summary.md +6 -11
  30. package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -1
  31. package/lib/antigravity-plugin/resources/prompts/workspace.md +16 -23
  32. package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +14 -21
  33. package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +23 -36
  34. package/lib/antigravity-plugin/resources/templates/workspace-agents.md +5 -13
  35. package/lib/antigravity-plugin/skills/pbot/SKILL.md +6 -23
  36. package/lib/antigravity-plugin/skills/project-maintenance/SKILL.md +14 -21
  37. package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +23 -36
  38. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +2 -2
  39. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
  40. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
  41. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +11 -3
  42. package/lib/extension/acp-worker.js +3 -3
  43. package/lib/extension/cli.js +33 -34
  44. package/lib/extension/hosts/dsh/command.js +1 -1
  45. package/lib/extension/hosts/dsh/workspace.js +4 -2
  46. package/lib/extension/hosts/plugin-runtime.js +1 -1
  47. package/lib/extension/mcp/tool-contract.js +61 -99
  48. package/lib/extension/mcp/workers.js +5 -7
  49. package/lib/extension/mcp.js +70 -105
  50. package/lib/integrations/agent-resources.d.ts +2 -2
  51. package/lib/integrations/agent-resources.js +3 -3
  52. package/lib/integrations/hosts/antigravity/adapter.js +0 -1
  53. package/lib/integrations/hosts/claude/adapter.js +1 -2
  54. package/lib/integrations/hosts/dsh/resources.d.ts +1 -1
  55. package/lib/integrations/hosts/prompt-hooks.js +4 -7
  56. package/lib/qoder-plugin/.mcp.json +2 -2
  57. package/lib/qoder-plugin/.qoder-plugin/plugin.json +2 -2
  58. package/lib/qoder-plugin/hooks/hooks.json +3 -3
  59. package/lib/qoder-plugin/skills/pbot/SKILL.md +11 -3
  60. package/lib/services/agents/agent-service.js +2 -2
  61. package/lib/services/history/summary-dimensions/monthly.js +1 -1
  62. package/lib/services/history/summary-dimensions/session.js +6 -3
  63. package/lib/services/history/summary-runner.js +3 -3
  64. package/lib/storage/history-files.js +3 -2
  65. package/lib/tools/history/contract.d.ts +1 -1
  66. package/lib/tools/history/contract.js +14 -16
  67. package/package.json +2 -2
  68. package/resources/agents/coordinator.md +2 -4
  69. package/resources/agents/general-purpose.md +2 -4
  70. package/resources/antigravity/skills/pbot/SKILL.md +6 -23
  71. package/resources/claude/skills/pbot/SKILL.md +6 -23
  72. package/resources/plugin/skills/pbot/SKILL.md +11 -3
  73. package/resources/prompts/history-coordinator.md +1 -1
  74. package/resources/prompts/history-monthly-summary.md +6 -11
  75. package/resources/prompts/history-summary.md +6 -11
  76. package/resources/prompts/plugin-coordinator.md +1 -1
  77. package/resources/prompts/workspace.md +16 -23
  78. package/resources/skills/project-maintenance/SKILL.md +14 -21
  79. package/resources/skills/provider-connections/SKILL.md +23 -36
  80. package/resources/templates/workspace-agents.md +5 -13
  81. package/src/extension/cli/commands/mcp.ts +1 -1
  82. package/src/extension/hosts/dsh/command.ts +1 -1
  83. package/src/extension/hosts/dsh/workspace.ts +4 -1
  84. package/src/extension/hosts/pi/command.ts +1 -1
  85. package/src/extension/hosts/pi/events.ts +1 -1
  86. package/src/extension/hosts/plugin-runtime.ts +1 -1
  87. package/src/extension/mcp/tool-contract.ts +61 -100
  88. package/src/extension/mcp/workers.ts +5 -7
  89. package/src/integrations/agent-resources.ts +5 -5
  90. package/src/integrations/hosts/antigravity/adapter.ts +0 -1
  91. package/src/integrations/hosts/claude/adapter.ts +1 -2
  92. package/src/integrations/hosts/dsh/resources.ts +1 -1
  93. package/src/integrations/hosts/prompt-hooks.ts +3 -6
  94. package/src/pbot.ts +2 -2
  95. package/src/services/agents/agent-service.ts +2 -2
  96. package/src/services/history/summary-dimensions/monthly.ts +1 -1
  97. package/src/services/history/summary-dimensions/session.ts +6 -3
  98. package/src/services/history/summary-runner.ts +3 -3
  99. package/src/storage/history-files.ts +3 -2
  100. package/src/tools/history/contract.ts +14 -16
@@ -1,17 +1,9 @@
1
- # 工作区资料入口
1
+ # 工作区导航
2
2
 
3
- ## 目录树
3
+ ## 项目速查
4
4
 
5
- ```text
6
- ./
7
- ├── areas/ # 长期目标、约束、建议、决策与复盘
8
- ├── projects/ # 任务定义、结论、交付物与源码
9
- ├── knowledge/ # 可复用的概念、方法与口径
10
- ├── providers/ # 能力提供方导航与手册
11
- ├── scratch/ # 临时脚本、查询与计算数据、下载及运行环境
12
- └── agents/ # coordinator.md 与 general-purpose.md 的职责补充
13
- ```
5
+ 用项目目录名和常用称呼登记项目。默认入口为 `projects/<目录名>/README.md`,其他项目链接到实际入口。
14
6
 
15
- ## 项目速查
7
+ ## 资料目录
16
8
 
17
- 项目默认入口为 `projects/<目录名>/README.md`。
9
+ [项目](projects/) · [长期事务](areas/) · [可复用知识](knowledge/) · [工具手册](providers/) · [临时文件](scratch/) · [角色补充](agents/)
@@ -19,7 +19,7 @@ const mcpUsage =
19
19
  " pbot mcp add <name> --url <url> [--header K=V]... [--description <说明>] [--timeout <秒>] [--disabled] [--workspace <目录>]\n" +
20
20
  " pbot mcp add <name> [--env K=V]... [--cwd <目录>] [--description <说明>] [--timeout <秒>] [--disabled] [--workspace <目录>] -- <command> [args...]\n" +
21
21
  " pbot mcp remove <name> [--workspace <目录>]\n\n" +
22
- "无参数时启动统一 stdio MCP 服务(暴露 worker_* 与 workspace_mcp_*);带 list/add/remove 时管理工作区 .pbot/mcp.json。";
22
+ "不带子命令时启动 stdio MCP 服务。用 list、add、remove 管理工作区的 .pbot/mcp.json。";
23
23
 
24
24
  async function runMcpServer(): Promise<number> {
25
25
  const entry = join(packageRoot, "lib/extension/mcp.js");
@@ -10,7 +10,7 @@ const usage = '用法:/pbot status | init | history [summary [维度] [--force
10
10
  export function registerDshCommand(ctx: Context, workspaces: DshWorkspaces) {
11
11
  ctx.commands.register({
12
12
  name: "pbot",
13
- description: "Personal Bot 工作区、历史摘要与跨 Harness worker 管理",
13
+ description: "初始化或检查工作区,查询历史、更新摘要、管理委派的助手。",
14
14
  recordInput: false,
15
15
  input: { hint: "status | init | history ... | worker ...", attachments: false },
16
16
  async handler({ agent, rawInput, signal }) {
@@ -44,7 +44,10 @@ export class DshWorkspace {
44
44
  inject: dshDependencies,
45
45
  apply: async ctx => {
46
46
  if (this.features.skills) registerDshSkills(ctx, this.agent, { workspaceRoot: this.root });
47
- if (this.features.prompts) await dshResources(ctx, this.agent, this.root, "coordinator", this.check, "history-coordinator.md");
47
+ if (this.features.prompts) {
48
+ const historyPrompt = this.features.history ? "history-coordinator.md" : null;
49
+ await dshResources(ctx, this.agent, this.root, "coordinator", this.check, historyPrompt);
50
+ }
48
51
  registerDshFileEvents(ctx, this.agent, this.root, false, this.check);
49
52
  if (this.features.history) {
50
53
  registerDshHistoryTool(ctx, this.agent, this.root, this.lifetime.signal, this.check);
@@ -23,7 +23,7 @@ function formatHistoryStatusLine(root: string): string[] {
23
23
 
24
24
  export function registerCommand(pi: ExtensionAPI, lifecycle: Lifecycle, confirmations: Confirmations) {
25
25
  pi.registerCommand("pbot", {
26
- description: "工作区初始化、状态、历史摘要与跨 Harness worker 管理",
26
+ description: "初始化或检查工作区,查询历史、更新摘要、管理委派的助手。",
27
27
  getArgumentCompletions: prefix => {
28
28
  if (/\s/.test(prefix)) return null;
29
29
  return ["init", "status", "history", "worker"]
@@ -42,7 +42,7 @@ export function registerEvents(pi: ExtensionAPI, lifecycle: Lifecycle, confirmat
42
42
  host: "pi",
43
43
  root: instance.root,
44
44
  role: "coordinator",
45
- coordinatorPrompt: "history-coordinator.md",
45
+ coordinatorPrompt: instance.features.history ? "history-coordinator.md" : null,
46
46
  });
47
47
  instance.check();
48
48
  Object.assign(event.systemPromptOptions.sections, {
@@ -82,7 +82,7 @@ export async function pluginHook(adapter: PluginHostAdapter, payload: unknown, r
82
82
  host: adapter.host,
83
83
  root,
84
84
  role: event.role,
85
- ...(adapter.coordinatorPrompt ? { coordinatorPrompt: adapter.coordinatorPrompt } : {}),
85
+ coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
86
86
  includePrompts,
87
87
  includeRootAgents: includePrompts && !adapter.nativeRootAgents,
88
88
  ...(event.localRoleOnly ? { localRoleOnly: true } : {}),
@@ -15,42 +15,34 @@ function formatBackendItem(entry: ReturnType<typeof inspectAcpBackends>[number],
15
15
  return tags.length ? `${entry.backend}(${tags.join(",")})` : entry.backend;
16
16
  }
17
17
 
18
- function summarizeBackends(commands: AcpCommands = {}, defaultBackend?: string) {
19
- const entries = inspectAcpBackends(commands);
20
- const available = entries.filter(item => item.available);
21
- const unavailable = entries.filter(item => !item.available);
22
- const availableText = available.map(item => formatBackendItem(item, defaultBackend)).join("、");
23
- const unavailableText = unavailable.map(item => formatBackendItem(item, defaultBackend)).join("、");
24
- const overview = available.length
25
- ? unavailable.length
26
- ? `当前可用助手:${availableText};暂不可用:${unavailableText}。`
27
- : `当前可用助手:${availableText}。`
28
- : `当前无可用外部助手(暂不可用:${unavailableText})。`;
29
- const availableIds = available.map(item => item.backend).join("、");
30
- return { overview, availableIds };
31
- }
32
-
33
18
  function workspaceProperty(workspaceBound: boolean) {
34
19
  return {
35
20
  type: "string",
36
21
  description: workspaceBound
37
- ? "工作区根目录绝对路径;默认当前工作区,通常省略。"
38
- : "目标工作区根目录绝对路径;请传入环境中的 workspaceRoot。",
22
+ ? "工作区根目录的绝对路径,默认当前绑定的工作区。"
23
+ : "传目标工作区的绝对路径(workspaceRoot)。省略时使用服务的当前目录。",
39
24
  };
40
25
  }
41
26
 
42
27
  export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?: string, workspaceBound = false) {
43
- const { overview, availableIds } = summarizeBackends(commands, defaultBackend);
44
- const modelsBackendHint = defaultBackend
45
- ? `省略时默认查 ${defaultBackend}`
46
- : "必填";
28
+ const available = inspectAcpBackends(commands).filter(item => item.available);
29
+ const overview = available.length
30
+ ? "可用助手:" + available.map(item => formatBackendItem(item, defaultBackend)).join("、") + "。"
31
+ : "当前没有可用助手。用 worker_discover 的 backends 查看接入状态。";
47
32
  const workspace = workspaceProperty(workspaceBound);
33
+ const workerId = { type: "string", description: "助手会话 ID。" };
34
+ const waitMs = {
35
+ type: "integer",
36
+ minimum: 0,
37
+ maximum: maxWaitMs,
38
+ description: `等待本轮结果的毫秒数,默认 ${defaultWaitMs}。0 表示不等待结果。`,
39
+ };
48
40
 
49
41
  return [
50
42
  {
51
43
  name: "worker_create" as const,
52
44
  description:
53
- "启动独立的外部助手会话并返回 workerId(不发送任务,随后用 worker_request 派发)。未指定其他助手或特定模型时,优先自行完成或使用当前内置子代理。\n" +
45
+ "新建独立助手会话,返回 workerId。用 worker_request 发送首个任务。\n" +
54
46
  overview,
55
47
  annotations: {
56
48
  title: "Create Worker",
@@ -66,15 +58,15 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
66
58
  properties: {
67
59
  backend: {
68
60
  type: "string",
69
- description: "目标外部助手标识(不区分大小写,支持常见别名如 claude-code、agy)。",
61
+ description: "助手标识或别名,如 claude-code、agy。",
70
62
  },
71
63
  model: {
72
64
  type: "string",
73
- description: "目标模型(模型 ID、显示名或 provider/model,不区分大小写);未明确指定时省略以用默认模型,不确定可选值时先查 worker_discover(target=\"models\")。",
65
+ description: "模型 ID、显示名或 provider/model。未指定模型时省略,使用助手默认模型。",
74
66
  },
75
67
  thinking: {
76
68
  type: "string",
77
- description: "思考深度(如 low / medium / high / xhigh / max,不区分大小写);未明确指定时省略以用默认设置。",
69
+ description: "思考深度,如 high。未指定时省略,使用助手默认设置。",
78
70
  },
79
71
  workspace,
80
72
  },
@@ -83,7 +75,7 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
83
75
  {
84
76
  name: "worker_close" as const,
85
77
  description:
86
- "结束外部助手会话并释放进程。若该会话支持恢复(capabilities.resume),后续仍可直接用 worker_request 续接。",
78
+ "任务结束后关闭助手。提前关闭会中断执行。创建结果中 resume 为 true 时,可用原 workerId 续接。",
87
79
  annotations: {
88
80
  title: "Close Worker",
89
81
  readOnlyHint: false,
@@ -96,18 +88,14 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
96
88
  additionalProperties: false,
97
89
  required: ["workerId"],
98
90
  properties: {
99
- workerId: {
100
- type: "string",
101
- description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
102
- },
91
+ workerId,
103
92
  },
104
93
  },
105
94
  },
106
95
  {
107
96
  name: "worker_request" as const,
108
97
  description:
109
- "向外部助手派发任务或在同一上下文中追问(已关闭且支持恢复的会话会自动续接)。" +
110
- `默认最多等待 ${defaultWaitMs / 1000} 秒(waitMs 设为 0 可立即转后台并行);返回 timedOut 或 nextOffset 用 worker_output,返回 needsResponse 先向用户确认再用 worker_response。`,
98
+ "向助手派发任务或在同一会话追问。后台结果用 worker_output 收取。",
111
99
  annotations: {
112
100
  title: "Send Request to Worker",
113
101
  readOnlyHint: false,
@@ -120,28 +108,19 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
120
108
  additionalProperties: false,
121
109
  required: ["workerId", "message"],
122
110
  properties: {
123
- workerId: {
124
- type: "string",
125
- description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
126
- },
111
+ workerId,
127
112
  message: {
128
113
  type: "string",
129
- description: "任务说明或追问内容。外部助手看不到当前会话历史,首次派发需写清背景、目标、相关文件路径、约束和期望产出。",
130
- },
131
- waitMs: {
132
- type: "integer",
133
- minimum: 0,
134
- maximum: maxWaitMs,
135
- description: `最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回转后台执行。`,
114
+ description: "任务或追问。助手看不到主会话历史,首次派发时写明背景、目标、文件路径、约束和交付要求。",
136
115
  },
116
+ waitMs,
137
117
  },
138
118
  },
139
119
  },
140
120
  {
141
121
  name: "worker_response" as const,
142
122
  description:
143
- "回复外部助手暂停时发出的待处理请求(needsResponse: true),支持操作授权、表单问答与链接确认。" +
144
- `提交前先向用户确认;提交后默认等待最多 ${defaultWaitMs / 1000} 秒返回后续结果。`,
123
+ "收到 needsResponse 时,将权限选项、表单问题或链接交给用户确认,再提交用户的决定。",
145
124
  annotations: {
146
125
  title: "Respond to Worker Request",
147
126
  readOnlyHint: false,
@@ -154,41 +133,33 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
154
133
  additionalProperties: false,
155
134
  required: ["workerId", "action"],
156
135
  properties: {
157
- workerId: {
158
- type: "string",
159
- description: "等待回复的助手会话 ID。",
160
- },
136
+ workerId,
161
137
  action: {
162
138
  type: "string",
163
139
  enum: [...acpElicitationActions],
164
- description: "accept 同意/提交表单/确认链接;decline 拒绝;cancel 取消请求。",
140
+ description: "accept 同意或提交答案,decline 拒绝,cancel 取消请求。",
165
141
  },
166
142
  requestId: {
167
143
  type: "string",
168
- description: "请求 ID(pendingRequests[].requestId);仅一条待处理请求时可省略,多条时必填。",
144
+ description: "待回复的请求 ID。仅有一条待处理请求时可省略。",
169
145
  },
170
146
  optionId: {
171
147
  type: "string",
172
- description: "仅 permission 请求且 action≠cancel 时可用:指定 pendingRequests[].options[].optionId,省略则按 action 单次允许或拒绝。",
148
+ description: "允许或拒绝操作时填用户所选权限的 ID。省略时优先单次,缺少单次选项时可能采用长期选项。",
173
149
  },
174
150
  content: {
175
151
  type: "object",
176
152
  additionalProperties: true,
177
- description: "仅 form 请求且 action=\"accept\" 时可用:按 pendingRequests[].schema.properties 填写回答对象(值为字符串、数字、布尔值或字符串数组)。",
178
- },
179
- waitMs: {
180
- type: "integer",
181
- minimum: 0,
182
- maximum: maxWaitMs,
183
- description: `提交后最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回。`,
153
+ description: "接受表单时,按表单字段填写答案。值可为字符串、数字、布尔值或字符串数组。",
184
154
  },
155
+ waitMs,
185
156
  },
186
157
  },
187
158
  },
188
159
  {
189
160
  name: "worker_output" as const,
190
161
  description:
191
- "获取或等待外部助手的最新结果,用于收取后台产出、timedOut 后继续等待,或按 nextOffset 分页续读。任务已结束时立即返回,运行中最多等待 waitMs。",
162
+ "读取助手最近一轮的结果。后台执行或返回 timedOut 时,用原 workerId 继续等待。",
192
163
  annotations: {
193
164
  title: "Get Worker Output",
194
165
  readOnlyHint: true,
@@ -201,28 +172,20 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
201
172
  additionalProperties: false,
202
173
  required: ["workerId"],
203
174
  properties: {
204
- workerId: {
205
- type: "string",
206
- description: "助手会话 ID。",
207
- },
175
+ workerId,
208
176
  offset: {
209
177
  type: "integer",
210
178
  minimum: 0,
211
- description: "读取起始位置(默认 0);翻页续读时传上次返回的 nextOffset。",
212
- },
213
- waitMs: {
214
- type: "integer",
215
- minimum: 0,
216
- maximum: maxWaitMs,
217
- description: `运行中最多等待毫秒数(默认 ${defaultWaitMs});已结束或翻页时立即返回。`,
179
+ description: "续读传上页的 nextOffset,默认从 0 开始。",
218
180
  },
181
+ waitMs,
219
182
  },
220
183
  },
221
184
  },
222
185
  {
223
186
  name: "worker_discover" as const,
224
187
  description:
225
- "查询可用外部助手、已有会话状态,或某个助手支持的模型与思考深度。默认(overview)返回可用助手与已有会话;仅需核对模型或思考深度可选值时再查 models(需启动探测,耗时较长)。",
188
+ "查找可复用的会话、查看助手状态或核对模型选项。查询模型会临时启动目标助手。",
226
189
  annotations: {
227
190
  title: "Discover Workers, Backends & Models",
228
191
  readOnlyHint: true,
@@ -238,21 +201,19 @@ export function buildPbotWorkerTools(commands: AcpCommands = {}, defaultBackend?
238
201
  target: {
239
202
  type: "string",
240
203
  enum: [...discoverTargets],
241
- description: "overview(默认,可用助手与已有会话)、workers(全部或单个会话状态)、backends(可用助手)、models(指定助手的模型与思考深度)。",
204
+ description: "overview(默认)列助手及当前会话拥有的 worker,workers 只查会话,backends 只查助手可用情况,models 查模型与思考深度。",
242
205
  },
243
206
  workerId: {
244
207
  type: "string",
245
- description: "仅 target=\"workers\" 可用:指定单个会话 ID,省略列全部。",
208
+ description: "查 workers 时可指定单个会话,省略列出全部所属会话。",
246
209
  },
247
210
  backend: {
248
211
  type: "string",
249
- description: availableIds
250
- ? `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名;当前可用:${availableIds}。`
251
- : `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名。`,
212
+ description: defaultBackend ? `查 models 时选择助手,默认 ${defaultBackend}。` : "查 models 时必填助手标识。",
252
213
  },
253
214
  model: {
254
215
  type: "string",
255
- description: "仅 target=\"models\" 可用:指定模型以查看其支持的思考深度选项。",
216
+ description: "查 models 时可指定模型以查看它支持的思考深度。",
256
217
  },
257
218
  workspace,
258
219
  },
@@ -267,7 +228,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
267
228
  {
268
229
  name: "workspace_mcp_discover" as const,
269
230
  description:
270
- "查询当前工作区共享 MCP 服务(.pbot/mcp.json)。省略 server 列出服务;传入 server 返回其工具列表与参数说明。",
231
+ "查找工作区共享的 MCP 服务,以及服务提供的工具和参数。",
271
232
  annotations: {
272
233
  title: "Discover Workspace MCP Servers & Tools",
273
234
  readOnlyHint: true,
@@ -282,7 +243,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
282
243
  properties: {
283
244
  server: {
284
245
  type: "string",
285
- description: "服务名称;省略列出工作区全部已配置服务。",
246
+ description: "填服务名列出其工具,省略则列出已配置的服务。",
286
247
  },
287
248
  workspace,
288
249
  },
@@ -291,11 +252,11 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
291
252
  {
292
253
  name: "workspace_mcp_call" as const,
293
254
  description:
294
- "调用工作区共享 MCP 服务中的指定工具。不确定工具名或参数时先用 workspace_mcp_discover(server) 查询。",
255
+ "执行工作区共享 MCP 服务的工具,读写效果取决于所选工具。工具名和参数可用 workspace_mcp_discover 查询。",
295
256
  annotations: {
296
257
  title: "Call Workspace MCP Tool",
297
258
  readOnlyHint: false,
298
- destructiveHint: false,
259
+ destructiveHint: true,
299
260
  idempotentHint: false,
300
261
  openWorldHint: true,
301
262
  },
@@ -306,16 +267,16 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
306
267
  properties: {
307
268
  server: {
308
269
  type: "string",
309
- description: "服务名称(来自 workspace_mcp_discover)。",
270
+ description: "工作区中登记的服务名。",
310
271
  },
311
272
  tool: {
312
273
  type: "string",
313
- description: "工具名称。",
274
+ description: "该服务提供的工具名。",
314
275
  },
315
276
  arguments: {
316
277
  type: "object",
317
278
  additionalProperties: true,
318
- description: "传给目标工具的参数对象,默认空对象。",
279
+ description: "按所选工具的参数定义填写,默认 {}。",
319
280
  },
320
281
  workspace,
321
282
  },
@@ -330,7 +291,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
330
291
  {
331
292
  name: "history_search" as const,
332
293
  description:
333
- "搜索当前工作区跨宿主历史问答与摘要归档(不含工具调用日志)。省略 query 列出各会话或指定维度摘要;传入 query 按不区分大小写的连续关键词匹配。",
294
+ "查找工作区各宿主归档的问答或摘要。用命中项的 id 调用 history_read 可读全文。",
334
295
  annotations: {
335
296
  title: "Search Workspace History",
336
297
  readOnlyHint: true,
@@ -345,38 +306,38 @@ export function buildHistoryMcpTools(workspaceBound = false) {
345
306
  properties: {
346
307
  host: {
347
308
  type: "string",
348
- description: "来源宿主筛选(如 pi、dsh、claude、antigravity、codex、qoder);省略查全部。",
309
+ description: "按来源宿主筛选,如 pi 或 claude。默认查全部来源。",
349
310
  },
350
311
  dimension: {
351
312
  type: "string",
352
- description: "范围筛选:raw 仅原文,或指定摘要维度(如 monthly、session);省略查全部。",
313
+ description: "raw 为原始问答,session、monthly 等为摘要维度。关键词搜索默认查全部。",
353
314
  },
354
315
  query: {
355
316
  type: "string",
356
- description: "连续关键词(不区分大小写);省略列会话或指定维度摘要。",
317
+ description: "匹配连续文本,忽略大小写。省略时列会话,指定摘要维度则列该维度的摘要。",
357
318
  },
358
319
  sessionId: {
359
320
  type: "string",
360
- description: "限定在指定原始会话 ID 内搜索。",
321
+ description: "按原始会话 ID 筛选。",
361
322
  },
362
323
  from: {
363
324
  type: "string",
364
- description: "ISO 日期或时间下界。",
325
+ description: "时间区间起点(含),用 ISO 日期或时间。",
365
326
  },
366
327
  to: {
367
328
  type: "string",
368
- description: "ISO 日期或时间上界。",
329
+ description: "时间区间终点(含),仅填 ISO 日期表示该日 UTC 零点。",
369
330
  },
370
331
  offset: {
371
332
  type: "integer",
372
333
  minimum: 0,
373
- description: "结果偏移,默认 0。",
334
+ description: "结果起点,默认 0。翻页传上页的 nextOffset。",
374
335
  },
375
336
  limit: {
376
337
  type: "integer",
377
338
  minimum: 1,
378
339
  maximum: historyPageLimits.search.max,
379
- description: `返回条数(1–${historyPageLimits.search.max}),默认 ${historyPageLimits.search.default}。`,
340
+ description: `每页条数,默认 ${historyPageLimits.search.default}。`,
380
341
  },
381
342
  workspace,
382
343
  },
@@ -385,7 +346,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
385
346
  {
386
347
  name: "history_read" as const,
387
348
  description:
388
- "按节点 id 读取历史正文与上下级(可从 monthly 汇总下钻至 session 摘要和 exchange 原文)。正文分页传 nextOffset,子节点分页传 nextChildrenOffset。",
349
+ "读取历史节点的正文和上下级。沿子节点可从月度汇总找到会话摘要和原始问答。",
389
350
  annotations: {
390
351
  title: "Read Workspace History Node",
391
352
  readOnlyHint: true,
@@ -400,27 +361,27 @@ export function buildHistoryMcpTools(workspaceBound = false) {
400
361
  properties: {
401
362
  id: {
402
363
  type: "string",
403
- description: "节点 id(来自 history_search 或上下级)。",
364
+ description: "搜索结果、父节点或子节点的 id。",
404
365
  },
405
366
  host: {
406
367
  type: "string",
407
- description: "跨宿主 id 冲突时指定来源宿主。",
368
+ description: "节点 id 重名时填来源宿主。",
408
369
  },
409
370
  offset: {
410
371
  type: "integer",
411
372
  minimum: 0,
412
- description: "正文字符偏移,默认 0;续读传上次 nextOffset。",
373
+ description: "正文字符偏移,默认 0。续读传上页的 nextOffset。",
413
374
  },
414
375
  limit: {
415
376
  type: "integer",
416
377
  minimum: 1,
417
378
  maximum: historyPageLimits.read.max,
418
- description: `正文字符数(1–${historyPageLimits.read.max}),默认 ${historyPageLimits.read.default}。`,
379
+ description: `每页正文字符数,默认 ${historyPageLimits.read.default}。`,
419
380
  },
420
381
  childrenOffset: {
421
382
  type: "integer",
422
383
  minimum: 0,
423
- description: "子节点偏移,默认 0;续读传上次 nextChildrenOffset。",
384
+ description: "子节点起点,默认 0。翻页传上页的 nextChildrenOffset。",
424
385
  },
425
386
  workspace,
426
387
  },
@@ -40,21 +40,19 @@ const progressIntervalMs = 5_000;
40
40
  export type ProgressReporter = (message: string) => void;
41
41
 
42
42
  const workerCapabilityInstruction =
43
- "跨助手委派(worker_*):启动并调度其他外部助手在当前工作区独立执行任务;无需外部助手时优先自行完成或使用内置子代理。" +
44
- "流程:worker_create 启动(或 worker_discover 复用)→ worker_request 派发/追问 → 完成后 worker_close;" +
45
- "后台取结果、超时续等(timedOut)或翻页(nextOffset)用 worker_output;返回 needsResponse 时先向用户确认,再用 worker_response 回复。";
43
+ "用户或工作区分工指定其他助手或特定模型时,可在当前工作区委派任务。常规任务优先自行处理或使用宿主内置子代理。";
46
44
 
47
45
  const workspaceMcpCapabilityInstruction =
48
- "工作区共享 MCP(workspace_mcp_*):先用 workspace_mcp_discover 查 .pbot/mcp.json 中的服务与工具,再用 workspace_mcp_call 调用。";
46
+ "可调用本工作区 .pbot/mcp.json 中登记的 MCP 工具。";
49
47
 
50
48
  const historyCapabilityInstruction =
51
- "跨宿主历史(history_search / history_read):只读检索当前工作区跨宿主记录的历史问答与摘要归档。";
49
+ "可检索本工作区各宿主归档的问答和摘要。";
52
50
 
53
51
  export function buildMcpInstructions(options: { workspaceMcp: boolean; history: boolean }): string {
54
52
  const parts = [workerCapabilityInstruction];
55
53
  if (options.workspaceMcp) parts.push(workspaceMcpCapabilityInstruction);
56
54
  if (options.history) parts.push(historyCapabilityInstruction);
57
- return parts.length === 1 ? parts[0]! : parts.map((text, index) => `${index + 1}. ${text}`).join("\n");
55
+ return parts.join("\n");
58
56
  }
59
57
 
60
58
  export const mcpWorkerOnlyInstructions = buildMcpInstructions({ workspaceMcp: false, history: false });
@@ -401,7 +399,7 @@ export class McpWorkerRuntime {
401
399
  switch (name) {
402
400
  case "workspace_mcp_discover":
403
401
  case "workspace_mcp_call": {
404
- requireThat(!this.#nativeWorkspaceMcp, "当前宿主已原生挂载工作区 .pbot/mcp.json 服务,请直接调用对应原生 MCP 工具,勿重复经由 workspace_mcp_* 桥接。");
402
+ requireThat(!this.#nativeWorkspaceMcp, "当前宿主已原生挂载工作区 MCP 服务,请直接调用对应工具。");
405
403
  requireThat(workspaceFeatures(configuration).mcp, `工作区统一 MCP 功能已在 ${configuration.path} 中停用(features.mcp: false)。`);
406
404
  if (name === "workspace_mcp_discover") return this.#bridge.discover(root, asString(rawArgs, "server"));
407
405
  const server = asString(rawArgs, "server", true)!;
@@ -21,11 +21,11 @@ export async function readLocalRole(agent: WorkspaceRole, root: string): Promise
21
21
  export async function agentText(
22
22
  agent: WorkspaceRole,
23
23
  root: string,
24
- coordinatorPrompt = "plugin-coordinator.md",
24
+ coordinatorPrompt: string | null = "plugin-coordinator.md",
25
25
  ): Promise<string> {
26
26
  requireThat(agent === "coordinator" || agent === "general-purpose", "未知职责。");
27
27
  let text = await readFile(join(resourceRoot, "agents", agent + ".md"), "utf8");
28
- if (agent === "coordinator") {
28
+ if (agent === "coordinator" && coordinatorPrompt) {
29
29
  text += "\n\n" + await readFile(join(resourceRoot, "prompts", coordinatorPrompt), "utf8");
30
30
  }
31
31
  const local = await readLocalRole(agent, root);
@@ -37,14 +37,14 @@ export async function agentText(
37
37
  export function formatWorkspaceSkills(skills: readonly WorkspaceSkillMeta[]): string {
38
38
  if (!skills.length) return "";
39
39
  const lines = skills.map(skill => `- **${skill.name}**(\`${skill.path}\`):${skill.description}`);
40
- return "## 可用技能\n\n任务匹配时按需读取对应 `SKILL.md` 正文:\n" + lines.join("\n");
40
+ return "## 按需读取的技能\n\n" + lines.join("\n");
41
41
  }
42
42
 
43
43
  export async function loadWorkspaceContext(options: {
44
44
  host: HostId;
45
45
  root: string;
46
46
  role: WorkspaceRole;
47
- coordinatorPrompt?: string;
47
+ coordinatorPrompt?: string | null;
48
48
  includePrompts?: boolean;
49
49
  includeRootAgents?: boolean;
50
50
  localRoleOnly?: boolean;
@@ -71,7 +71,7 @@ export async function loadWorkspaceContext(options: {
71
71
  : ["", "", ""];
72
72
  const skillsSection = formatWorkspaceSkills(workspaceSkills);
73
73
  const noticesSection = notices.length
74
- ? "## 启动提示\n\n以下为工作区维护提醒,适时顺带告知用户即可,勿未经用户要求自行执行:\n" + notices.map(item => `- ${item}`).join("\n")
74
+ ? "## 维护提醒\n\n告知用户,按用户要求执行。\n\n" + notices.map(item => `- ${item}`).join("\n")
75
75
  : "";
76
76
  const environment = { host, workspaceRoot: root, resourceRoot };
77
77
  const text = [
@@ -98,7 +98,6 @@ export const antigravityAdapter: PluginHostAdapter = {
98
98
  host: "antigravity",
99
99
  nativeRootAgents: true,
100
100
  nativeWorkspaceSkills: true,
101
- coordinatorPrompt: "plugin-coordinator.md",
102
101
  initCommandHint: "/pbot init",
103
102
  usage: "用法:node <插件目录>/lib/plugin.js antigravity init|status",
104
103
  resolveRoot(cwd, rawPayload) {
@@ -3,7 +3,7 @@ import { requireThat } from "../../../common/validation.js";
3
3
  import type { HostEvent, PluginHostAdapter } from "../../../model/plugin-host.js";
4
4
  import { parsePromptEvent, pluginWorkspaceRoot, promptHooks } from "../prompt-hooks.js";
5
5
 
6
- const supportedEvents = ["UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
6
+ const supportedEvents = ["SessionStart", "UserPromptSubmit", "PreToolUse", "UserPromptExpansion", "Stop"];
7
7
  const boundWorkspaceRoot = () => process.env.CLAUDE_PROJECT_DIR;
8
8
 
9
9
  export async function claudeWorkspaceRoot(cwd: string, projectDirectory = boundWorkspaceRoot()): Promise<string> {
@@ -14,7 +14,6 @@ export const claudeAdapter: PluginHostAdapter = {
14
14
  host: "claude",
15
15
  nativeRootAgents: false,
16
16
  nativeWorkspaceSkills: false,
17
- coordinatorPrompt: "plugin-coordinator.md",
18
17
  initCommandHint: "/personal-bot:pbot init",
19
18
  usage: "用法:node <插件目录>/lib/claude.js init|status",
20
19
  boundWorkspaceRoot,
@@ -17,7 +17,7 @@ export async function dshResources(
17
17
  root: string,
18
18
  role: "coordinator" | "general-purpose",
19
19
  check: () => void,
20
- coordinatorPrompt = "history-coordinator.md",
20
+ coordinatorPrompt: string | null = "history-coordinator.md",
21
21
  ) {
22
22
  const read = () => Promise.all([agentText(role, root, coordinatorPrompt), readFile(join(resourceRoot, "prompts/workspace.md"), "utf8")]);
23
23
  const [text, workspace] = await read();
@@ -18,12 +18,9 @@ export function parsePromptEvent(value: unknown): HostEvent {
18
18
  if (name !== "Stop" && name !== "UserPromptSubmit" && name !== "SessionStart") return { kind: "ignore" };
19
19
  if (typeof value.agent_id === "string") return { kind: "ignore" };
20
20
  requireThat(typeof value.cwd === "string", "插件 hook 缺少工作目录。");
21
- if (name === "Stop") return { kind: "record-history", cwd: value.cwd, raw: value };
22
- if (name === "SessionStart") {
23
- if (value.source === "resume" || value.source === "compact") return { kind: "ignore" };
24
- return { kind: "inject-context", role: "coordinator", isSessionStart: true, noticesOnly: true, cwd: value.cwd, raw: value };
25
- }
26
- return { kind: "inject-context", role: "coordinator", cwd: value.cwd, raw: value };
21
+ if (name !== "SessionStart") return { kind: "record-history", cwd: value.cwd, raw: value };
22
+ if (value.source === "resume" || value.source === "compact") return { kind: "ignore" };
23
+ return { kind: "inject-context", role: "coordinator", isSessionStart: true, cwd: value.cwd, raw: value };
27
24
  }
28
25
 
29
26
  export const promptHooks = {
package/src/pbot.ts CHANGED
@@ -5,7 +5,7 @@ import { Lifecycle, WorkspaceInstance } from "./extension/hosts/pi/lifecycle.js"
5
5
  import { registerCommand } from "./extension/hosts/pi/command.js";
6
6
  import { registerEvents } from "./extension/hosts/pi/events.js";
7
7
  import { registerHistoryEvents } from "./extension/hosts/pi/history.js";
8
- import { McpWorkerRuntime, defaultWorkerDirectory } from "./extension/mcp/workers.js";
8
+ import { McpWorkerRuntime, defaultWorkerDirectory, mcpWorkerOnlyInstructions } from "./extension/mcp/workers.js";
9
9
  import { workspaceFeatures } from "./services/workspace/workspace-config.js";
10
10
  import { loadNativeWorkspaceServers } from "./extension/hosts/workspace-mcp.js";
11
11
  import { toPiMcpConfig } from "./integrations/hosts/pi/mcp.js";
@@ -34,7 +34,7 @@ export default function pbot(pi: ExtensionAPI) {
34
34
  ...server,
35
35
  exposure: "direct",
36
36
  timeout: 600,
37
- description: "跨助手委派(worker_*)",
37
+ description: mcpWorkerOnlyInstructions,
38
38
  });
39
39
  registeredMcpServers.push(mcpServerName);
40
40
  }