personal-bot 0.3.7 → 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 (172) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/README.md +5 -8
  4. package/README.zh-CN.md +5 -8
  5. package/bin/pbot-pi-acp.mjs +1 -1
  6. package/docs/architecture/design.md +2 -2
  7. package/docs/architecture/extensibility.md +4 -4
  8. package/docs/architecture/model-context.md +6 -3
  9. package/docs/guides/cross-harness-workers.md +5 -5
  10. package/docs/guides/history.md +1 -3
  11. package/docs/guides/workspace-configuration.md +5 -5
  12. package/docs/hosts/claude-code.md +3 -3
  13. package/docs/hosts/codex-qoder.md +4 -2
  14. package/hooks/hooks.json +3 -0
  15. package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +1 -1
  16. package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +1 -1
  17. package/lib/antigravity-plugin/lib/extension/acp/member.js +11 -10
  18. package/lib/antigravity-plugin/lib/extension/acp-worker.js +349 -204
  19. package/lib/antigravity-plugin/lib/extension/cli.js +596 -572
  20. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +1 -1
  21. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +3 -4
  22. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +1 -12
  23. package/lib/antigravity-plugin/lib/extension/mcp.js +463 -379
  24. package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +2 -2
  25. package/lib/antigravity-plugin/lib/integrations/agent-resources.js +3 -3
  26. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +0 -1
  27. package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +1 -2
  28. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +1 -1
  29. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +4 -7
  30. package/lib/antigravity-plugin/lib/model/acp.d.ts +29 -35
  31. package/lib/antigravity-plugin/lib/model/agent.d.ts +33 -17
  32. package/lib/antigravity-plugin/lib/model/agent.js +0 -1
  33. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +1 -1
  34. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +6 -3
  35. package/lib/antigravity-plugin/lib/services/history/summary-runner.js +3 -3
  36. package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +5 -8
  37. package/lib/antigravity-plugin/lib/storage/acp-files.js +34 -40
  38. package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +19 -10
  39. package/lib/antigravity-plugin/lib/storage/agent-files.js +147 -43
  40. package/lib/antigravity-plugin/lib/storage/history-files.js +3 -2
  41. package/lib/antigravity-plugin/package.json +1 -1
  42. package/lib/antigravity-plugin/plugin.json +2 -2
  43. package/lib/antigravity-plugin/resources/agents/coordinator.md +2 -4
  44. package/lib/antigravity-plugin/resources/agents/general-purpose.md +2 -4
  45. package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +6 -11
  46. package/lib/antigravity-plugin/resources/prompts/history-summary.md +6 -11
  47. package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -1
  48. package/lib/antigravity-plugin/resources/prompts/workspace.md +16 -23
  49. package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +14 -21
  50. package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +23 -36
  51. package/lib/antigravity-plugin/resources/templates/workspace-agents.md +5 -13
  52. package/lib/antigravity-plugin/skills/pbot/SKILL.md +6 -23
  53. package/lib/antigravity-plugin/skills/project-maintenance/SKILL.md +14 -21
  54. package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +23 -36
  55. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +2 -2
  56. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
  57. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
  58. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +11 -3
  59. package/lib/extension/acp/member.d.ts +1 -1
  60. package/lib/extension/acp/member.js +11 -10
  61. package/lib/extension/acp/worker.js +34 -33
  62. package/lib/extension/acp-worker.js +349 -204
  63. package/lib/extension/cli.js +596 -572
  64. package/lib/extension/hosts/dsh/acp-member.js +1 -1
  65. package/lib/extension/hosts/dsh/command.js +2 -2
  66. package/lib/extension/hosts/dsh/workspace.js +5 -5
  67. package/lib/extension/hosts/pi/acp-member.js +3 -4
  68. package/lib/extension/hosts/plugin-runtime.js +1 -12
  69. package/lib/extension/mcp/tool-contract.d.ts +8 -50
  70. package/lib/extension/mcp/tool-contract.js +61 -107
  71. package/lib/extension/mcp/workers.d.ts +7 -27
  72. package/lib/extension/mcp/workers.js +40 -24
  73. package/lib/extension/mcp.js +463 -379
  74. package/lib/integrations/acp/agents.d.ts +2 -3
  75. package/lib/integrations/acp/agents.js +22 -22
  76. package/lib/integrations/acp/harnesses/claude.js +1 -1
  77. package/lib/integrations/agent-resources.d.ts +2 -2
  78. package/lib/integrations/agent-resources.js +3 -3
  79. package/lib/integrations/hosts/antigravity/adapter.js +0 -1
  80. package/lib/integrations/hosts/claude/adapter.js +1 -2
  81. package/lib/integrations/hosts/dsh/resources.d.ts +1 -1
  82. package/lib/integrations/hosts/prompt-hooks.js +4 -7
  83. package/lib/model/acp.d.ts +29 -35
  84. package/lib/model/agent.d.ts +33 -17
  85. package/lib/model/agent.js +0 -1
  86. package/lib/qoder-plugin/.mcp.json +2 -2
  87. package/lib/qoder-plugin/.qoder-plugin/plugin.json +2 -2
  88. package/lib/qoder-plugin/hooks/hooks.json +3 -3
  89. package/lib/qoder-plugin/skills/pbot/SKILL.md +11 -3
  90. package/lib/services/agents/acp-run.d.ts +6 -4
  91. package/lib/services/agents/acp-run.js +62 -43
  92. package/lib/services/agents/agent-run.d.ts +10 -6
  93. package/lib/services/agents/agent-run.js +142 -65
  94. package/lib/services/agents/agent-service.d.ts +3 -21
  95. package/lib/services/agents/agent-service.js +182 -128
  96. package/lib/services/history/summary-dimensions/monthly.js +1 -1
  97. package/lib/services/history/summary-dimensions/session.js +6 -3
  98. package/lib/services/history/summary-runner.js +3 -3
  99. package/lib/storage/acp-files.d.ts +5 -8
  100. package/lib/storage/acp-files.js +34 -40
  101. package/lib/storage/agent-files.d.ts +19 -10
  102. package/lib/storage/agent-files.js +147 -43
  103. package/lib/storage/history-files.js +3 -2
  104. package/lib/tools/history/contract.d.ts +1 -1
  105. package/lib/tools/history/contract.js +14 -16
  106. package/package.json +2 -2
  107. package/resources/agents/coordinator.md +2 -4
  108. package/resources/agents/general-purpose.md +2 -4
  109. package/resources/antigravity/skills/pbot/SKILL.md +6 -23
  110. package/resources/claude/skills/pbot/SKILL.md +6 -23
  111. package/resources/plugin/skills/pbot/SKILL.md +11 -3
  112. package/resources/prompts/history-coordinator.md +1 -1
  113. package/resources/prompts/history-monthly-summary.md +6 -11
  114. package/resources/prompts/history-summary.md +6 -11
  115. package/resources/prompts/plugin-coordinator.md +1 -1
  116. package/resources/prompts/workspace.md +16 -23
  117. package/resources/skills/project-maintenance/SKILL.md +14 -21
  118. package/resources/skills/provider-connections/SKILL.md +23 -36
  119. package/resources/templates/workspace-agents.md +5 -13
  120. package/src/extension/acp/member.ts +14 -11
  121. package/src/extension/acp/worker.ts +31 -28
  122. package/src/extension/cli/commands/mcp.ts +1 -1
  123. package/src/extension/cli/commands/upgrade.ts +8 -36
  124. package/src/extension/cli/commands/workspace.ts +3 -8
  125. package/src/extension/cli/index.ts +1 -2
  126. package/src/extension/hosts/dsh/acp-member.ts +1 -1
  127. package/src/extension/hosts/dsh/command.ts +2 -2
  128. package/src/extension/hosts/dsh/workspace.ts +5 -4
  129. package/src/extension/hosts/pi/acp-member.ts +3 -4
  130. package/src/extension/hosts/pi/command.ts +2 -2
  131. package/src/extension/hosts/pi/events.ts +1 -1
  132. package/src/extension/hosts/pi/lifecycle.ts +0 -2
  133. package/src/extension/hosts/plugin-runtime.ts +1 -11
  134. package/src/extension/mcp/tool-contract.ts +61 -108
  135. package/src/extension/mcp/workers.ts +39 -24
  136. package/src/integrations/acp/agents.ts +28 -27
  137. package/src/integrations/acp/harnesses/claude.ts +1 -1
  138. package/src/integrations/agent-resources.ts +5 -5
  139. package/src/integrations/hosts/antigravity/adapter.ts +0 -1
  140. package/src/integrations/hosts/claude/adapter.ts +1 -2
  141. package/src/integrations/hosts/dsh/resources.ts +1 -1
  142. package/src/integrations/hosts/dsh/session.ts +2 -2
  143. package/src/integrations/hosts/prompt-hooks.ts +3 -6
  144. package/src/integrations/installation/cli-update.ts +2 -2
  145. package/src/integrations/installation/installers/claude.ts +4 -4
  146. package/src/integrations/installation/installers/qoder.ts +5 -5
  147. package/src/integrations/installation/upgraders/antigravity.ts +57 -15
  148. package/src/integrations/installation/upgraders/claude.ts +1 -4
  149. package/src/integrations/installation/upgraders/codex.ts +85 -15
  150. package/src/integrations/installation/upgraders/dsh.ts +46 -24
  151. package/src/integrations/installation/upgraders/pi.ts +18 -11
  152. package/src/integrations/installation/upgraders/qoder.ts +95 -20
  153. package/src/model/acp.ts +27 -29
  154. package/src/model/agent.ts +80 -16
  155. package/src/model/installation.ts +0 -2
  156. package/src/pbot.ts +3 -3
  157. package/src/services/agents/acp-run.ts +81 -49
  158. package/src/services/agents/agent-run.ts +154 -56
  159. package/src/services/agents/agent-service.ts +206 -135
  160. package/src/services/history/summary-dimensions/monthly.ts +1 -1
  161. package/src/services/history/summary-dimensions/session.ts +6 -3
  162. package/src/services/history/summary-runner.ts +3 -3
  163. package/src/services/installation/upgrade-service.ts +1 -5
  164. package/src/storage/acp-files.ts +50 -45
  165. package/src/storage/agent-files.ts +159 -46
  166. package/src/storage/history-files.ts +3 -2
  167. package/src/tools/history/contract.ts +14 -16
  168. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +0 -15
  169. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +0 -126
  170. package/lib/services/workspace/plugin-releases.d.ts +0 -15
  171. package/lib/services/workspace/plugin-releases.js +0 -126
  172. package/src/services/workspace/plugin-releases.ts +0 -121
@@ -14,38 +14,31 @@ function formatBackendItem(entry, defaultBackend) {
14
14
  tags.push("当前宿主");
15
15
  return tags.length ? `${entry.backend}(${tags.join(",")})` : entry.backend;
16
16
  }
17
- function summarizeBackends(commands = {}, defaultBackend) {
18
- const entries = inspectAcpBackends(commands);
19
- const available = entries.filter(item => item.available);
20
- const unavailable = entries.filter(item => !item.available);
21
- const availableText = available.map(item => formatBackendItem(item, defaultBackend)).join("、");
22
- const unavailableText = unavailable.map(item => formatBackendItem(item, defaultBackend)).join("、");
23
- const overview = available.length
24
- ? unavailable.length
25
- ? `当前可用助手:${availableText};暂不可用:${unavailableText}。`
26
- : `当前可用助手:${availableText}。`
27
- : `当前无可用外部助手(暂不可用:${unavailableText})。`;
28
- const availableIds = available.map(item => item.backend).join("、");
29
- return { overview, availableIds };
30
- }
31
17
  function workspaceProperty(workspaceBound) {
32
18
  return {
33
19
  type: "string",
34
20
  description: workspaceBound
35
- ? "工作区根目录绝对路径;默认当前工作区,通常省略。"
36
- : "目标工作区根目录绝对路径;请传入环境中的 workspaceRoot。",
21
+ ? "工作区根目录的绝对路径,默认当前绑定的工作区。"
22
+ : "传目标工作区的绝对路径(workspaceRoot)。省略时使用服务的当前目录。",
37
23
  };
38
24
  }
39
25
  export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBound = false) {
40
- const { overview, availableIds } = summarizeBackends(commands, defaultBackend);
41
- const modelsBackendHint = defaultBackend
42
- ? `省略时默认查 ${defaultBackend}`
43
- : "必填";
26
+ const available = inspectAcpBackends(commands).filter(item => item.available);
27
+ const overview = available.length
28
+ ? "可用助手:" + available.map(item => formatBackendItem(item, defaultBackend)).join("、") + "。"
29
+ : "当前没有可用助手。用 worker_discover 的 backends 查看接入状态。";
44
30
  const workspace = workspaceProperty(workspaceBound);
31
+ const workerId = { type: "string", description: "助手会话 ID。" };
32
+ const waitMs = {
33
+ type: "integer",
34
+ minimum: 0,
35
+ maximum: maxWaitMs,
36
+ description: `等待本轮结果的毫秒数,默认 ${defaultWaitMs}。0 表示不等待结果。`,
37
+ };
45
38
  return [
46
39
  {
47
40
  name: "worker_create",
48
- description: "启动独立的外部助手会话并返回 workerId(不发送任务,随后用 worker_request 派发)。未指定其他助手或特定模型时,优先自行完成或使用当前内置子代理。\n" +
41
+ description: "新建独立助手会话,返回 workerId。用 worker_request 发送首个任务。\n" +
49
42
  overview,
50
43
  annotations: {
51
44
  title: "Create Worker",
@@ -61,19 +54,15 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
61
54
  properties: {
62
55
  backend: {
63
56
  type: "string",
64
- description: "目标外部助手标识(不区分大小写,支持常见别名如 claude-code、agy)。",
57
+ description: "助手标识或别名,如 claude-code、agy。",
65
58
  },
66
59
  model: {
67
60
  type: "string",
68
- description: "目标模型(模型 ID、显示名或 provider/model,不区分大小写);未明确指定时省略以用默认模型,不确定可选值时先查 worker_discover(target=\"models\")。",
61
+ description: "模型 ID、显示名或 provider/model。未指定模型时省略,使用助手默认模型。",
69
62
  },
70
63
  thinking: {
71
64
  type: "string",
72
- description: "思考深度(如 low / medium / high / xhigh / max,不区分大小写);未明确指定时省略以用默认设置。",
73
- },
74
- cwd: {
75
- type: "string",
76
- description: "执行目录(绝对路径或相对工作区路径),默认工作区根目录。",
65
+ description: "思考深度,如 high。未指定时省略,使用助手默认设置。",
77
66
  },
78
67
  workspace,
79
68
  },
@@ -81,7 +70,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
81
70
  },
82
71
  {
83
72
  name: "worker_close",
84
- description: "结束外部助手会话并释放进程。若该会话支持恢复(capabilities.resume),后续仍可直接用 worker_request 续接。",
73
+ description: "任务结束后关闭助手。提前关闭会中断执行。创建结果中 resume 为 true 时,可用原 workerId 续接。",
85
74
  annotations: {
86
75
  title: "Close Worker",
87
76
  readOnlyHint: false,
@@ -94,18 +83,13 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
94
83
  additionalProperties: false,
95
84
  required: ["workerId"],
96
85
  properties: {
97
- workerId: {
98
- type: "string",
99
- description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
100
- },
101
- workspace,
86
+ workerId,
102
87
  },
103
88
  },
104
89
  },
105
90
  {
106
91
  name: "worker_request",
107
- description: "向外部助手派发任务或在同一上下文中追问(已关闭且支持恢复的会话会自动续接)。" +
108
- `默认最多等待 ${defaultWaitMs / 1000} 秒(waitMs 设为 0 可立即转后台并行);返回 timedOut 或 nextOffset 用 worker_output,返回 needsResponse 先向用户确认再用 worker_response。`,
92
+ description: "向助手派发任务或在同一会话追问。后台结果用 worker_output 收取。",
109
93
  annotations: {
110
94
  title: "Send Request to Worker",
111
95
  readOnlyHint: false,
@@ -118,28 +102,18 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
118
102
  additionalProperties: false,
119
103
  required: ["workerId", "message"],
120
104
  properties: {
121
- workerId: {
122
- type: "string",
123
- description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
124
- },
105
+ workerId,
125
106
  message: {
126
107
  type: "string",
127
- description: "任务说明或追问内容。外部助手看不到当前会话历史,首次派发需写清背景、目标、相关文件路径、约束和期望产出。",
108
+ description: "任务或追问。助手看不到主会话历史,首次派发时写明背景、目标、文件路径、约束和交付要求。",
128
109
  },
129
- waitMs: {
130
- type: "integer",
131
- minimum: 0,
132
- maximum: maxWaitMs,
133
- description: `最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回转后台执行。`,
134
- },
135
- workspace,
110
+ waitMs,
136
111
  },
137
112
  },
138
113
  },
139
114
  {
140
115
  name: "worker_response",
141
- description: "回复外部助手暂停时发出的待处理请求(needsResponse: true),支持操作授权、表单问答与链接确认。" +
142
- `提交前先向用户确认;提交后默认等待最多 ${defaultWaitMs / 1000} 秒返回后续结果。`,
116
+ description: "收到 needsResponse 时,将权限选项、表单问题或链接交给用户确认,再提交用户的决定。",
143
117
  annotations: {
144
118
  title: "Respond to Worker Request",
145
119
  readOnlyHint: false,
@@ -152,41 +126,32 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
152
126
  additionalProperties: false,
153
127
  required: ["workerId", "action"],
154
128
  properties: {
155
- workerId: {
156
- type: "string",
157
- description: "等待回复的助手会话 ID。",
158
- },
129
+ workerId,
159
130
  action: {
160
131
  type: "string",
161
132
  enum: [...acpElicitationActions],
162
- description: "accept 同意/提交表单/确认链接;decline 拒绝;cancel 取消请求。",
133
+ description: "accept 同意或提交答案,decline 拒绝,cancel 取消请求。",
163
134
  },
164
135
  requestId: {
165
136
  type: "string",
166
- description: "请求 ID(pendingRequests[].requestId);仅一条待处理请求时可省略,多条时必填。",
137
+ description: "待回复的请求 ID。仅有一条待处理请求时可省略。",
167
138
  },
168
139
  optionId: {
169
140
  type: "string",
170
- description: "仅 permission 请求且 action≠cancel 时可用:指定 pendingRequests[].options[].optionId,省略则按 action 单次允许或拒绝。",
141
+ description: "允许或拒绝操作时填用户所选权限的 ID。省略时优先单次,缺少单次选项时可能采用长期选项。",
171
142
  },
172
143
  content: {
173
144
  type: "object",
174
145
  additionalProperties: true,
175
- description: "仅 form 请求且 action=\"accept\" 时可用:按 pendingRequests[].schema.properties 填写回答对象(值为字符串、数字、布尔值或字符串数组)。",
176
- },
177
- waitMs: {
178
- type: "integer",
179
- minimum: 0,
180
- maximum: maxWaitMs,
181
- description: `提交后最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回。`,
146
+ description: "接受表单时,按表单字段填写答案。值可为字符串、数字、布尔值或字符串数组。",
182
147
  },
183
- workspace,
148
+ waitMs,
184
149
  },
185
150
  },
186
151
  },
187
152
  {
188
153
  name: "worker_output",
189
- description: "获取或等待外部助手的最新结果,用于收取后台产出、timedOut 后继续等待,或按 nextOffset 分页续读。任务已结束时立即返回,运行中最多等待 waitMs。",
154
+ description: "读取助手最近一轮的结果。后台执行或返回 timedOut 时,用原 workerId 继续等待。",
190
155
  annotations: {
191
156
  title: "Get Worker Output",
192
157
  readOnlyHint: true,
@@ -199,28 +164,19 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
199
164
  additionalProperties: false,
200
165
  required: ["workerId"],
201
166
  properties: {
202
- workerId: {
203
- type: "string",
204
- description: "助手会话 ID。",
205
- },
167
+ workerId,
206
168
  offset: {
207
169
  type: "integer",
208
170
  minimum: 0,
209
- description: "读取起始位置(默认 0);翻页续读时传上次返回的 nextOffset。",
210
- },
211
- waitMs: {
212
- type: "integer",
213
- minimum: 0,
214
- maximum: maxWaitMs,
215
- description: `运行中最多等待毫秒数(默认 ${defaultWaitMs});已结束或翻页时立即返回。`,
171
+ description: "续读传上页的 nextOffset,默认从 0 开始。",
216
172
  },
217
- workspace,
173
+ waitMs,
218
174
  },
219
175
  },
220
176
  },
221
177
  {
222
178
  name: "worker_discover",
223
- description: "查询可用外部助手、已有会话状态,或某个助手支持的模型与思考深度。默认(overview)返回可用助手与已有会话;仅需核对模型或思考深度可选值时再查 models(需启动探测,耗时较长)。",
179
+ description: "查找可复用的会话、查看助手状态或核对模型选项。查询模型会临时启动目标助手。",
224
180
  annotations: {
225
181
  title: "Discover Workers, Backends & Models",
226
182
  readOnlyHint: true,
@@ -236,21 +192,19 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
236
192
  target: {
237
193
  type: "string",
238
194
  enum: [...discoverTargets],
239
- description: "overview(默认,可用助手与已有会话)、workers(全部或单个会话状态)、backends(可用助手)、models(指定助手的模型与思考深度)。",
195
+ description: "overview(默认)列助手及当前会话拥有的 worker,workers 只查会话,backends 只查助手可用情况,models 查模型与思考深度。",
240
196
  },
241
197
  workerId: {
242
198
  type: "string",
243
- description: "仅 target=\"workers\" 可用:指定单个会话 ID,省略列全部。",
199
+ description: "查 workers 时可指定单个会话,省略列出全部所属会话。",
244
200
  },
245
201
  backend: {
246
202
  type: "string",
247
- description: availableIds
248
- ? `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名;当前可用:${availableIds}。`
249
- : `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名。`,
203
+ description: defaultBackend ? `查 models 时选择助手,默认 ${defaultBackend}。` : "查 models 时必填助手标识。",
250
204
  },
251
205
  model: {
252
206
  type: "string",
253
- description: "仅 target=\"models\" 可用:指定模型以查看其支持的思考深度选项。",
207
+ description: "查 models 时可指定模型以查看它支持的思考深度。",
254
208
  },
255
209
  workspace,
256
210
  },
@@ -263,7 +217,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
263
217
  return [
264
218
  {
265
219
  name: "workspace_mcp_discover",
266
- description: "查询当前工作区共享 MCP 服务(.pbot/mcp.json)。省略 server 列出服务;传入 server 返回其工具列表与参数说明。",
220
+ description: "查找工作区共享的 MCP 服务,以及服务提供的工具和参数。",
267
221
  annotations: {
268
222
  title: "Discover Workspace MCP Servers & Tools",
269
223
  readOnlyHint: true,
@@ -278,7 +232,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
278
232
  properties: {
279
233
  server: {
280
234
  type: "string",
281
- description: "服务名称;省略列出工作区全部已配置服务。",
235
+ description: "填服务名列出其工具,省略则列出已配置的服务。",
282
236
  },
283
237
  workspace,
284
238
  },
@@ -286,11 +240,11 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
286
240
  },
287
241
  {
288
242
  name: "workspace_mcp_call",
289
- description: "调用工作区共享 MCP 服务中的指定工具。不确定工具名或参数时先用 workspace_mcp_discover(server) 查询。",
243
+ description: "执行工作区共享 MCP 服务的工具,读写效果取决于所选工具。工具名和参数可用 workspace_mcp_discover 查询。",
290
244
  annotations: {
291
245
  title: "Call Workspace MCP Tool",
292
246
  readOnlyHint: false,
293
- destructiveHint: false,
247
+ destructiveHint: true,
294
248
  idempotentHint: false,
295
249
  openWorldHint: true,
296
250
  },
@@ -301,16 +255,16 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
301
255
  properties: {
302
256
  server: {
303
257
  type: "string",
304
- description: "服务名称(来自 workspace_mcp_discover)。",
258
+ description: "工作区中登记的服务名。",
305
259
  },
306
260
  tool: {
307
261
  type: "string",
308
- description: "工具名称。",
262
+ description: "该服务提供的工具名。",
309
263
  },
310
264
  arguments: {
311
265
  type: "object",
312
266
  additionalProperties: true,
313
- description: "传给目标工具的参数对象,默认空对象。",
267
+ description: "按所选工具的参数定义填写,默认 {}。",
314
268
  },
315
269
  workspace,
316
270
  },
@@ -323,7 +277,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
323
277
  return [
324
278
  {
325
279
  name: "history_search",
326
- description: "搜索当前工作区跨宿主历史问答与摘要归档(不含工具调用日志)。省略 query 列出各会话或指定维度摘要;传入 query 按不区分大小写的连续关键词匹配。",
280
+ description: "查找工作区各宿主归档的问答或摘要。用命中项的 id 调用 history_read 可读全文。",
327
281
  annotations: {
328
282
  title: "Search Workspace History",
329
283
  readOnlyHint: true,
@@ -338,38 +292,38 @@ export function buildHistoryMcpTools(workspaceBound = false) {
338
292
  properties: {
339
293
  host: {
340
294
  type: "string",
341
- description: "来源宿主筛选(如 pi、dsh、claude、antigravity、codex、qoder);省略查全部。",
295
+ description: "按来源宿主筛选,如 pi 或 claude。默认查全部来源。",
342
296
  },
343
297
  dimension: {
344
298
  type: "string",
345
- description: "范围筛选:raw 仅原文,或指定摘要维度(如 monthly、session);省略查全部。",
299
+ description: "raw 为原始问答,session、monthly 等为摘要维度。关键词搜索默认查全部。",
346
300
  },
347
301
  query: {
348
302
  type: "string",
349
- description: "连续关键词(不区分大小写);省略列会话或指定维度摘要。",
303
+ description: "匹配连续文本,忽略大小写。省略时列会话,指定摘要维度则列该维度的摘要。",
350
304
  },
351
305
  sessionId: {
352
306
  type: "string",
353
- description: "限定在指定原始会话 ID 内搜索。",
307
+ description: "按原始会话 ID 筛选。",
354
308
  },
355
309
  from: {
356
310
  type: "string",
357
- description: "ISO 日期或时间下界。",
311
+ description: "时间区间起点(含),用 ISO 日期或时间。",
358
312
  },
359
313
  to: {
360
314
  type: "string",
361
- description: "ISO 日期或时间上界。",
315
+ description: "时间区间终点(含),仅填 ISO 日期表示该日 UTC 零点。",
362
316
  },
363
317
  offset: {
364
318
  type: "integer",
365
319
  minimum: 0,
366
- description: "结果偏移,默认 0。",
320
+ description: "结果起点,默认 0。翻页传上页的 nextOffset。",
367
321
  },
368
322
  limit: {
369
323
  type: "integer",
370
324
  minimum: 1,
371
325
  maximum: historyPageLimits.search.max,
372
- description: `返回条数(1–${historyPageLimits.search.max}),默认 ${historyPageLimits.search.default}。`,
326
+ description: `每页条数,默认 ${historyPageLimits.search.default}。`,
373
327
  },
374
328
  workspace,
375
329
  },
@@ -377,7 +331,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
377
331
  },
378
332
  {
379
333
  name: "history_read",
380
- description: "按节点 id 读取历史正文与上下级(可从 monthly 汇总下钻至 session 摘要和 exchange 原文)。正文分页传 nextOffset,子节点分页传 nextChildrenOffset。",
334
+ description: "读取历史节点的正文和上下级。沿子节点可从月度汇总找到会话摘要和原始问答。",
381
335
  annotations: {
382
336
  title: "Read Workspace History Node",
383
337
  readOnlyHint: true,
@@ -392,27 +346,27 @@ export function buildHistoryMcpTools(workspaceBound = false) {
392
346
  properties: {
393
347
  id: {
394
348
  type: "string",
395
- description: "节点 id(来自 history_search 或上下级)。",
349
+ description: "搜索结果、父节点或子节点的 id。",
396
350
  },
397
351
  host: {
398
352
  type: "string",
399
- description: "跨宿主 id 冲突时指定来源宿主。",
353
+ description: "节点 id 重名时填来源宿主。",
400
354
  },
401
355
  offset: {
402
356
  type: "integer",
403
357
  minimum: 0,
404
- description: "正文字符偏移,默认 0;续读传上次 nextOffset。",
358
+ description: "正文字符偏移,默认 0。续读传上页的 nextOffset。",
405
359
  },
406
360
  limit: {
407
361
  type: "integer",
408
362
  minimum: 1,
409
363
  maximum: historyPageLimits.read.max,
410
- description: `正文字符数(1–${historyPageLimits.read.max}),默认 ${historyPageLimits.read.default}。`,
364
+ description: `每页正文字符数,默认 ${historyPageLimits.read.default}。`,
411
365
  },
412
366
  childrenOffset: {
413
367
  type: "integer",
414
368
  minimum: 0,
415
- description: "子节点偏移,默认 0;续读传上次 nextChildrenOffset。",
369
+ description: "子节点起点,默认 0。翻页传上页的 nextChildrenOffset。",
416
370
  },
417
371
  workspace,
418
372
  },
@@ -7,7 +7,7 @@ export declare function buildMcpInstructions(options: {
7
7
  }): string;
8
8
  export declare const mcpWorkerOnlyInstructions: string;
9
9
  export declare const mcpInstructions: string;
10
- export declare function defaultWorkerDirectory(): string;
10
+ export declare function defaultWorkerDirectory(workspaceRoot: string): string;
11
11
  /** Parse Pi/dsh `/pbot worker ...` CLI arguments into a canonical MCP tool call. */
12
12
  export declare function parseWorkerCommand(raw: string): {
13
13
  tool: McpWorkerToolName;
@@ -33,6 +33,7 @@ export declare class McpWorkerRuntime {
33
33
  get nativeHistory(): boolean;
34
34
  private resolveBackend;
35
35
  private resolveWorkspace;
36
+ private resolveWorkerWorkspace;
36
37
  private workerService;
37
38
  private resolveToolContext;
38
39
  serverInstructions(): Promise<string>;
@@ -63,10 +64,6 @@ export declare class McpWorkerRuntime {
63
64
  type: string;
64
65
  description: string;
65
66
  };
66
- cwd: {
67
- type: string;
68
- description: string;
69
- };
70
67
  workspace: {
71
68
  type: string;
72
69
  description: string;
@@ -101,14 +98,10 @@ export declare class McpWorkerRuntime {
101
98
  type: string;
102
99
  description: string;
103
100
  };
104
- workspace: {
105
- type: string;
106
- description: string;
107
- };
108
101
  backend?: never;
109
102
  model?: never;
110
103
  thinking?: never;
111
- cwd?: never;
104
+ workspace?: never;
112
105
  message?: never;
113
106
  waitMs?: never;
114
107
  action?: never;
@@ -148,14 +141,10 @@ export declare class McpWorkerRuntime {
148
141
  maximum: number;
149
142
  description: string;
150
143
  };
151
- workspace: {
152
- type: string;
153
- description: string;
154
- };
155
144
  backend?: never;
156
145
  model?: never;
157
146
  thinking?: never;
158
- cwd?: never;
147
+ workspace?: never;
159
148
  action?: never;
160
149
  requestId?: never;
161
150
  optionId?: never;
@@ -207,14 +196,10 @@ export declare class McpWorkerRuntime {
207
196
  maximum: number;
208
197
  description: string;
209
198
  };
210
- workspace: {
211
- type: string;
212
- description: string;
213
- };
214
199
  backend?: never;
215
200
  model?: never;
216
201
  thinking?: never;
217
- cwd?: never;
202
+ workspace?: never;
218
203
  message?: never;
219
204
  offset?: never;
220
205
  target?: never;
@@ -250,14 +235,10 @@ export declare class McpWorkerRuntime {
250
235
  maximum: number;
251
236
  description: string;
252
237
  };
253
- workspace: {
254
- type: string;
255
- description: string;
256
- };
257
238
  backend?: never;
258
239
  model?: never;
259
240
  thinking?: never;
260
- cwd?: never;
241
+ workspace?: never;
261
242
  message?: never;
262
243
  action?: never;
263
244
  requestId?: never;
@@ -303,7 +284,6 @@ export declare class McpWorkerRuntime {
303
284
  description: string;
304
285
  };
305
286
  thinking?: never;
306
- cwd?: never;
307
287
  message?: never;
308
288
  waitMs?: never;
309
289
  action?: never;
@@ -486,7 +466,7 @@ export declare class McpWorkerRuntime {
486
466
  /** Wait until ACP handshake and model/thinking configuration finish so invalid options fail synchronously on create/resume. */
487
467
  private waitReady;
488
468
  private waitFor;
489
- callTool(toolName: string, input: unknown, progress?: ProgressReporter): Promise<unknown>;
469
+ callTool(toolName: string, input: unknown, progress?: ProgressReporter, defaultWorkspace?: string): Promise<unknown>;
490
470
  close(preserve?: boolean): Promise<void>;
491
471
  }
492
472
  export declare function handleMcpRequest(runtime: McpWorkerRuntime, message: unknown, notify?: (notification: Record<string, unknown>) => void): Promise<Record<string, unknown> | null>;