personal-bot 0.3.5 → 0.3.7
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +191 -65
- package/README.zh-CN.md +189 -63
- package/docs/README.md +2 -2
- package/docs/architecture/design.md +3 -4
- package/docs/architecture/model-context.md +1 -2
- package/docs/guides/capabilities.md +4 -8
- package/docs/hosts/antigravity.md +4 -2
- package/docs/hosts/pi.md +4 -15
- package/docs/maintainers/release.md +2 -2
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +2 -2
- package/lib/antigravity-plugin/lib/extension/cli.js +1403 -1504
- package/lib/antigravity-plugin/lib/extension/mcp.js +66 -49
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +2 -2
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- package/lib/antigravity-plugin/resources/agents/coordinator.md +3 -7
- package/lib/antigravity-plugin/resources/agents/general-purpose.md +3 -3
- package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -2
- package/lib/antigravity-plugin/resources/prompts/workspace.md +12 -16
- package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +7 -6
- package/lib/antigravity-plugin/resources/templates/workspace-agents.md +0 -4
- package/lib/antigravity-plugin/skills/pbot/SKILL.md +14 -6
- package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +7 -6
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +1 -1
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +2 -2
- package/lib/extension/acp-worker.js +2 -2
- package/lib/extension/cli.js +1403 -1504
- package/lib/extension/mcp/tool-contract.js +49 -55
- package/lib/extension/mcp/workers.d.ts +6 -0
- package/lib/extension/mcp/workers.js +25 -8
- package/lib/extension/mcp.js +66 -49
- package/lib/integrations/agent-resources.js +2 -2
- package/lib/qoder-plugin/.mcp.json +2 -2
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +1 -1
- package/lib/qoder-plugin/hooks/hooks.json +3 -3
- package/lib/qoder-plugin/skills/pbot/SKILL.md +2 -2
- package/lib/tools/history/contract.js +12 -12
- package/package.json +1 -1
- package/resources/agents/coordinator.md +3 -7
- package/resources/agents/general-purpose.md +3 -3
- package/resources/antigravity/skills/pbot/SKILL.md +14 -6
- package/resources/claude/skills/pbot/SKILL.md +14 -6
- package/resources/plugin/skills/pbot/SKILL.md +2 -2
- package/resources/prompts/history-coordinator.md +1 -2
- package/resources/prompts/plugin-coordinator.md +1 -2
- package/resources/prompts/workspace.md +12 -16
- package/resources/skills/provider-connections/SKILL.md +7 -6
- package/resources/templates/workspace-agents.md +0 -4
- package/src/extension/cli/commands/install.ts +77 -0
- package/src/extension/cli/index.ts +3 -4
- package/src/extension/mcp/tool-contract.ts +49 -55
- package/src/extension/mcp/workers.ts +32 -10
- package/src/integrations/agent-resources.ts +2 -2
- package/src/integrations/installation/installers/antigravity.ts +49 -0
- package/src/integrations/installation/installers/claude.ts +30 -0
- package/src/integrations/installation/installers/codex.ts +56 -0
- package/src/integrations/installation/installers/dsh.ts +25 -0
- package/src/integrations/installation/installers/pi.ts +26 -0
- package/src/integrations/installation/installers/qoder.ts +49 -0
- package/src/integrations/installation/installers/registry.ts +48 -0
- package/src/integrations/installation/processes.ts +2 -41
- package/src/model/installation.ts +28 -36
- package/src/pbot.ts +1 -1
- package/src/services/installation/install-service.ts +107 -0
- package/src/tools/history/contract.ts +12 -12
- package/lib/antigravity-plugin/resources/references/compute-finance.md +0 -22
- package/lib/antigravity-plugin/resources/references/compute.md +0 -16
- package/lib/antigravity-plugin/resources/references/task-conductor.md +0 -25
- package/lib/common/package-source.js +0 -16
- package/lib/extension/setup/guard.js +0 -11
- package/lib/integrations/installation/pi-bridge.js +0 -131
- package/lib/model/installation.js +0 -1
- package/resources/installer/plugins.json +0 -16
- package/resources/references/compute-finance.md +0 -22
- package/resources/references/compute.md +0 -16
- package/resources/references/task-conductor.md +0 -25
- package/src/extension/cli/commands/setup.ts +0 -159
- package/src/extension/setup/guard.ts +0 -12
- package/src/integrations/installation/pi-bridge.ts +0 -109
- package/src/integrations/installation/pi-setup.ts +0 -165
- package/src/services/installation/setup-service.ts +0 -91
- package/src/ui/setup.ts +0 -40
|
@@ -11,7 +11,7 @@ function formatBackendItem(entry, defaultBackend) {
|
|
|
11
11
|
if (entry.label)
|
|
12
12
|
tags.push(entry.label);
|
|
13
13
|
if (entry.backend === defaultBackend)
|
|
14
|
-
tags.push("
|
|
14
|
+
tags.push("当前宿主");
|
|
15
15
|
return tags.length ? `${entry.backend}(${tags.join(",")})` : entry.backend;
|
|
16
16
|
}
|
|
17
17
|
function summarizeBackends(commands = {}, defaultBackend) {
|
|
@@ -32,8 +32,8 @@ function workspaceProperty(workspaceBound) {
|
|
|
32
32
|
return {
|
|
33
33
|
type: "string",
|
|
34
34
|
description: workspaceBound
|
|
35
|
-
? "
|
|
36
|
-
: "
|
|
35
|
+
? "工作区根目录绝对路径;默认当前工作区,通常省略。"
|
|
36
|
+
: "目标工作区根目录绝对路径;请传入环境中的 workspaceRoot。",
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBound = false) {
|
|
@@ -45,8 +45,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
45
45
|
return [
|
|
46
46
|
{
|
|
47
47
|
name: "worker_create",
|
|
48
|
-
description: "
|
|
49
|
-
"本工具仅建立会话并返回 workerId,随后通过 worker_request 发送具体任务。不需要借助其他助手时,优先自行完成或使用当前内置子代理。\n" +
|
|
48
|
+
description: "启动独立的外部助手会话并返回 workerId(不发送任务,随后用 worker_request 派发)。未指定其他助手或特定模型时,优先自行完成或使用当前内置子代理。\n" +
|
|
50
49
|
overview,
|
|
51
50
|
annotations: {
|
|
52
51
|
title: "Create Worker",
|
|
@@ -62,19 +61,19 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
62
61
|
properties: {
|
|
63
62
|
backend: {
|
|
64
63
|
type: "string",
|
|
65
|
-
description: "
|
|
64
|
+
description: "目标外部助手标识(不区分大小写,支持常见别名如 claude-code、agy)。",
|
|
66
65
|
},
|
|
67
66
|
model: {
|
|
68
67
|
type: "string",
|
|
69
|
-
description: "
|
|
68
|
+
description: "目标模型(模型 ID、显示名或 provider/model,不区分大小写);未明确指定时省略以用默认模型,不确定可选值时先查 worker_discover(target=\"models\")。",
|
|
70
69
|
},
|
|
71
70
|
thinking: {
|
|
72
71
|
type: "string",
|
|
73
|
-
description: "
|
|
72
|
+
description: "思考深度(如 low / medium / high / xhigh / max,不区分大小写);未明确指定时省略以用默认设置。",
|
|
74
73
|
},
|
|
75
74
|
cwd: {
|
|
76
75
|
type: "string",
|
|
77
|
-
description: "
|
|
76
|
+
description: "执行目录(绝对路径或相对工作区路径),默认工作区根目录。",
|
|
78
77
|
},
|
|
79
78
|
workspace,
|
|
80
79
|
},
|
|
@@ -82,7 +81,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
82
81
|
},
|
|
83
82
|
{
|
|
84
83
|
name: "worker_close",
|
|
85
|
-
description: "
|
|
84
|
+
description: "结束外部助手会话并释放进程。若该会话支持恢复(capabilities.resume),后续仍可直接用 worker_request 续接。",
|
|
86
85
|
annotations: {
|
|
87
86
|
title: "Close Worker",
|
|
88
87
|
readOnlyHint: false,
|
|
@@ -97,7 +96,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
97
96
|
properties: {
|
|
98
97
|
workerId: {
|
|
99
98
|
type: "string",
|
|
100
|
-
description: "
|
|
99
|
+
description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
|
|
101
100
|
},
|
|
102
101
|
workspace,
|
|
103
102
|
},
|
|
@@ -105,9 +104,8 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
105
104
|
},
|
|
106
105
|
{
|
|
107
106
|
name: "worker_request",
|
|
108
|
-
description: "
|
|
109
|
-
`默认最多等待 ${defaultWaitMs / 1000}
|
|
110
|
-
"若返回 timedOut 或结果含 nextOffset,用 worker_output 继续等待或翻页;若返回 needsResponse,先向用户确认再用 worker_response 回复。",
|
|
107
|
+
description: "向外部助手派发任务或在同一上下文中追问(已关闭且支持恢复的会话会自动续接)。" +
|
|
108
|
+
`默认最多等待 ${defaultWaitMs / 1000} 秒(waitMs 设为 0 可立即转后台并行);返回 timedOut 或 nextOffset 用 worker_output,返回 needsResponse 先向用户确认再用 worker_response。`,
|
|
111
109
|
annotations: {
|
|
112
110
|
title: "Send Request to Worker",
|
|
113
111
|
readOnlyHint: false,
|
|
@@ -122,17 +120,17 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
122
120
|
properties: {
|
|
123
121
|
workerId: {
|
|
124
122
|
type: "string",
|
|
125
|
-
description: "
|
|
123
|
+
description: "助手会话 ID(来自 worker_create 或 worker_discover)。",
|
|
126
124
|
},
|
|
127
125
|
message: {
|
|
128
126
|
type: "string",
|
|
129
|
-
description: "
|
|
127
|
+
description: "任务说明或追问内容。外部助手看不到当前会话历史,首次派发需写清背景、目标、相关文件路径、约束和期望产出。",
|
|
130
128
|
},
|
|
131
129
|
waitMs: {
|
|
132
130
|
type: "integer",
|
|
133
131
|
minimum: 0,
|
|
134
132
|
maximum: maxWaitMs,
|
|
135
|
-
description:
|
|
133
|
+
description: `最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回转后台执行。`,
|
|
136
134
|
},
|
|
137
135
|
workspace,
|
|
138
136
|
},
|
|
@@ -140,9 +138,8 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
140
138
|
},
|
|
141
139
|
{
|
|
142
140
|
name: "worker_response",
|
|
143
|
-
description: "
|
|
144
|
-
|
|
145
|
-
`提交前先向用户确认;提交后默认最多等待 ${defaultWaitMs / 1000} 秒返回后续结果(waitMs 设为 0 立即返回)。`,
|
|
141
|
+
description: "回复外部助手暂停时发出的待处理请求(needsResponse: true),支持操作授权、表单问答与链接确认。" +
|
|
142
|
+
`提交前先向用户确认;提交后默认等待最多 ${defaultWaitMs / 1000} 秒返回后续结果。`,
|
|
146
143
|
annotations: {
|
|
147
144
|
title: "Respond to Worker Request",
|
|
148
145
|
readOnlyHint: false,
|
|
@@ -162,26 +159,26 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
162
159
|
action: {
|
|
163
160
|
type: "string",
|
|
164
161
|
enum: [...acpElicitationActions],
|
|
165
|
-
description: "
|
|
162
|
+
description: "accept 同意/提交表单/确认链接;decline 拒绝;cancel 取消请求。",
|
|
166
163
|
},
|
|
167
164
|
requestId: {
|
|
168
165
|
type: "string",
|
|
169
|
-
description: "
|
|
166
|
+
description: "请求 ID(pendingRequests[].requestId);仅一条待处理请求时可省略,多条时必填。",
|
|
170
167
|
},
|
|
171
168
|
optionId: {
|
|
172
169
|
type: "string",
|
|
173
|
-
description: "
|
|
170
|
+
description: "仅 permission 请求且 action≠cancel 时可用:指定 pendingRequests[].options[].optionId,省略则按 action 单次允许或拒绝。",
|
|
174
171
|
},
|
|
175
172
|
content: {
|
|
176
173
|
type: "object",
|
|
177
174
|
additionalProperties: true,
|
|
178
|
-
description: "
|
|
175
|
+
description: "仅 form 请求且 action=\"accept\" 时可用:按 pendingRequests[].schema.properties 填写回答对象(值为字符串、数字、布尔值或字符串数组)。",
|
|
179
176
|
},
|
|
180
177
|
waitMs: {
|
|
181
178
|
type: "integer",
|
|
182
179
|
minimum: 0,
|
|
183
180
|
maximum: maxWaitMs,
|
|
184
|
-
description:
|
|
181
|
+
description: `提交后最多等待毫秒数(默认 ${defaultWaitMs});0 表示立即返回。`,
|
|
185
182
|
},
|
|
186
183
|
workspace,
|
|
187
184
|
},
|
|
@@ -189,8 +186,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
189
186
|
},
|
|
190
187
|
{
|
|
191
188
|
name: "worker_output",
|
|
192
|
-
description: "
|
|
193
|
-
"任务仍在运行时会等待其完成(也可能返回 timedOut 或 needsResponse),已结束则立即返回。",
|
|
189
|
+
description: "获取或等待外部助手的最新结果,用于收取后台产出、timedOut 后继续等待,或按 nextOffset 分页续读。任务已结束时立即返回,运行中最多等待 waitMs。",
|
|
194
190
|
annotations: {
|
|
195
191
|
title: "Get Worker Output",
|
|
196
192
|
readOnlyHint: true,
|
|
@@ -205,18 +201,18 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
205
201
|
properties: {
|
|
206
202
|
workerId: {
|
|
207
203
|
type: "string",
|
|
208
|
-
description: "
|
|
204
|
+
description: "助手会话 ID。",
|
|
209
205
|
},
|
|
210
206
|
offset: {
|
|
211
207
|
type: "integer",
|
|
212
208
|
minimum: 0,
|
|
213
|
-
description: "
|
|
209
|
+
description: "读取起始位置(默认 0);翻页续读时传上次返回的 nextOffset。",
|
|
214
210
|
},
|
|
215
211
|
waitMs: {
|
|
216
212
|
type: "integer",
|
|
217
213
|
minimum: 0,
|
|
218
214
|
maximum: maxWaitMs,
|
|
219
|
-
description:
|
|
215
|
+
description: `运行中最多等待毫秒数(默认 ${defaultWaitMs});已结束或翻页时立即返回。`,
|
|
220
216
|
},
|
|
221
217
|
workspace,
|
|
222
218
|
},
|
|
@@ -224,8 +220,7 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
224
220
|
},
|
|
225
221
|
{
|
|
226
222
|
name: "worker_discover",
|
|
227
|
-
description: "
|
|
228
|
-
"默认(target=\"overview\")同时返回可用助手与已有会话;仅在需要核对模型或思考深度可选值时再查 target=\"models\"(耗时较长)。",
|
|
223
|
+
description: "查询可用外部助手、已有会话状态,或某个助手支持的模型与思考深度。默认(overview)返回可用助手与已有会话;仅需核对模型或思考深度可选值时再查 models(需启动探测,耗时较长)。",
|
|
229
224
|
annotations: {
|
|
230
225
|
title: "Discover Workers, Backends & Models",
|
|
231
226
|
readOnlyHint: true,
|
|
@@ -241,21 +236,21 @@ export function buildPbotWorkerTools(commands = {}, defaultBackend, workspaceBou
|
|
|
241
236
|
target: {
|
|
242
237
|
type: "string",
|
|
243
238
|
enum: [...discoverTargets],
|
|
244
|
-
description: "
|
|
239
|
+
description: "overview(默认,可用助手与已有会话)、workers(全部或单个会话状态)、backends(可用助手)、models(指定助手的模型与思考深度)。",
|
|
245
240
|
},
|
|
246
241
|
workerId: {
|
|
247
242
|
type: "string",
|
|
248
|
-
description: "仅 target=\"workers\"
|
|
243
|
+
description: "仅 target=\"workers\" 可用:指定单个会话 ID,省略列全部。",
|
|
249
244
|
},
|
|
250
245
|
backend: {
|
|
251
246
|
type: "string",
|
|
252
247
|
description: availableIds
|
|
253
|
-
? `仅 target="models" 可用(${modelsBackendHint}
|
|
254
|
-
: `仅 target="models" 可用(${modelsBackendHint}
|
|
248
|
+
? `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名;当前可用:${availableIds}。`
|
|
249
|
+
: `仅 target="models" 可用(${modelsBackendHint}):目标助手标识,支持别名。`,
|
|
255
250
|
},
|
|
256
251
|
model: {
|
|
257
252
|
type: "string",
|
|
258
|
-
description: "仅 target=\"models\"
|
|
253
|
+
description: "仅 target=\"models\" 可用:指定模型以查看其支持的思考深度选项。",
|
|
259
254
|
},
|
|
260
255
|
workspace,
|
|
261
256
|
},
|
|
@@ -268,7 +263,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
|
|
|
268
263
|
return [
|
|
269
264
|
{
|
|
270
265
|
name: "workspace_mcp_discover",
|
|
271
|
-
description: "
|
|
266
|
+
description: "查询当前工作区共享 MCP 服务(.pbot/mcp.json)。省略 server 列出服务;传入 server 返回其工具列表与参数说明。",
|
|
272
267
|
annotations: {
|
|
273
268
|
title: "Discover Workspace MCP Servers & Tools",
|
|
274
269
|
readOnlyHint: true,
|
|
@@ -283,7 +278,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
|
|
|
283
278
|
properties: {
|
|
284
279
|
server: {
|
|
285
280
|
type: "string",
|
|
286
|
-
description: "
|
|
281
|
+
description: "服务名称;省略列出工作区全部已配置服务。",
|
|
287
282
|
},
|
|
288
283
|
workspace,
|
|
289
284
|
},
|
|
@@ -291,8 +286,7 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
|
|
|
291
286
|
},
|
|
292
287
|
{
|
|
293
288
|
name: "workspace_mcp_call",
|
|
294
|
-
description: "
|
|
295
|
-
"不确定工具名或参数格式时,先用 workspace_mcp_discover(server) 查询。",
|
|
289
|
+
description: "调用工作区共享 MCP 服务中的指定工具。不确定工具名或参数时先用 workspace_mcp_discover(server) 查询。",
|
|
296
290
|
annotations: {
|
|
297
291
|
title: "Call Workspace MCP Tool",
|
|
298
292
|
readOnlyHint: false,
|
|
@@ -307,16 +301,16 @@ export function buildWorkspaceMcpTools(workspaceBound = false) {
|
|
|
307
301
|
properties: {
|
|
308
302
|
server: {
|
|
309
303
|
type: "string",
|
|
310
|
-
description: "
|
|
304
|
+
description: "服务名称(来自 workspace_mcp_discover)。",
|
|
311
305
|
},
|
|
312
306
|
tool: {
|
|
313
307
|
type: "string",
|
|
314
|
-
description: "
|
|
308
|
+
description: "工具名称。",
|
|
315
309
|
},
|
|
316
310
|
arguments: {
|
|
317
311
|
type: "object",
|
|
318
312
|
additionalProperties: true,
|
|
319
|
-
description: "
|
|
313
|
+
description: "传给目标工具的参数对象,默认空对象。",
|
|
320
314
|
},
|
|
321
315
|
workspace,
|
|
322
316
|
},
|
|
@@ -329,7 +323,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
329
323
|
return [
|
|
330
324
|
{
|
|
331
325
|
name: "history_search",
|
|
332
|
-
description: "
|
|
326
|
+
description: "搜索当前工作区跨宿主历史问答与摘要归档(不含工具调用日志)。省略 query 列出各会话或指定维度摘要;传入 query 按不区分大小写的连续关键词匹配。",
|
|
333
327
|
annotations: {
|
|
334
328
|
title: "Search Workspace History",
|
|
335
329
|
readOnlyHint: true,
|
|
@@ -344,15 +338,15 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
344
338
|
properties: {
|
|
345
339
|
host: {
|
|
346
340
|
type: "string",
|
|
347
|
-
description: "
|
|
341
|
+
description: "来源宿主筛选(如 pi、dsh、claude、antigravity、codex、qoder);省略查全部。",
|
|
348
342
|
},
|
|
349
343
|
dimension: {
|
|
350
344
|
type: "string",
|
|
351
|
-
description: "
|
|
345
|
+
description: "范围筛选:raw 仅原文,或指定摘要维度(如 monthly、session);省略查全部。",
|
|
352
346
|
},
|
|
353
347
|
query: {
|
|
354
348
|
type: "string",
|
|
355
|
-
description: "
|
|
349
|
+
description: "连续关键词(不区分大小写);省略列会话或指定维度摘要。",
|
|
356
350
|
},
|
|
357
351
|
sessionId: {
|
|
358
352
|
type: "string",
|
|
@@ -369,13 +363,13 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
369
363
|
offset: {
|
|
370
364
|
type: "integer",
|
|
371
365
|
minimum: 0,
|
|
372
|
-
description: "
|
|
366
|
+
description: "结果偏移,默认 0。",
|
|
373
367
|
},
|
|
374
368
|
limit: {
|
|
375
369
|
type: "integer",
|
|
376
370
|
minimum: 1,
|
|
377
371
|
maximum: historyPageLimits.search.max,
|
|
378
|
-
description:
|
|
372
|
+
description: `返回条数(1–${historyPageLimits.search.max}),默认 ${historyPageLimits.search.default}。`,
|
|
379
373
|
},
|
|
380
374
|
workspace,
|
|
381
375
|
},
|
|
@@ -383,7 +377,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
383
377
|
},
|
|
384
378
|
{
|
|
385
379
|
name: "history_read",
|
|
386
|
-
description: "按节点 id
|
|
380
|
+
description: "按节点 id 读取历史正文与上下级(可从 monthly 汇总下钻至 session 摘要和 exchange 原文)。正文分页传 nextOffset,子节点分页传 nextChildrenOffset。",
|
|
387
381
|
annotations: {
|
|
388
382
|
title: "Read Workspace History Node",
|
|
389
383
|
readOnlyHint: true,
|
|
@@ -398,16 +392,16 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
398
392
|
properties: {
|
|
399
393
|
id: {
|
|
400
394
|
type: "string",
|
|
401
|
-
description: "history_search
|
|
395
|
+
description: "节点 id(来自 history_search 或上下级)。",
|
|
402
396
|
},
|
|
403
397
|
host: {
|
|
404
398
|
type: "string",
|
|
405
|
-
description: "
|
|
399
|
+
description: "跨宿主 id 冲突时指定来源宿主。",
|
|
406
400
|
},
|
|
407
401
|
offset: {
|
|
408
402
|
type: "integer",
|
|
409
403
|
minimum: 0,
|
|
410
|
-
description: "正文字符偏移,默认 0。",
|
|
404
|
+
description: "正文字符偏移,默认 0;续读传上次 nextOffset。",
|
|
411
405
|
},
|
|
412
406
|
limit: {
|
|
413
407
|
type: "integer",
|
|
@@ -418,7 +412,7 @@ export function buildHistoryMcpTools(workspaceBound = false) {
|
|
|
418
412
|
childrenOffset: {
|
|
419
413
|
type: "integer",
|
|
420
414
|
minimum: 0,
|
|
421
|
-
description: "
|
|
415
|
+
description: "子节点偏移,默认 0;续读传上次 nextChildrenOffset。",
|
|
422
416
|
},
|
|
423
417
|
workspace,
|
|
424
418
|
},
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type McpWorkerToolName } from "../../model/acp.js";
|
|
2
2
|
export { buildHistoryMcpTools, buildPbotWorkerTools, buildWorkspaceMcpTools, pbotWorkerTools } from "./tool-contract.js";
|
|
3
3
|
export type ProgressReporter = (message: string) => void;
|
|
4
|
+
export declare function buildMcpInstructions(options: {
|
|
5
|
+
workspaceMcp: boolean;
|
|
6
|
+
history: boolean;
|
|
7
|
+
}): string;
|
|
4
8
|
export declare const mcpWorkerOnlyInstructions: string;
|
|
5
9
|
export declare const mcpInstructions: string;
|
|
6
10
|
export declare function defaultWorkerDirectory(): string;
|
|
@@ -30,6 +34,8 @@ export declare class McpWorkerRuntime {
|
|
|
30
34
|
private resolveBackend;
|
|
31
35
|
private resolveWorkspace;
|
|
32
36
|
private workerService;
|
|
37
|
+
private resolveToolContext;
|
|
38
|
+
serverInstructions(): Promise<string>;
|
|
33
39
|
toolDefinitions(): Promise<({
|
|
34
40
|
name: "worker_create";
|
|
35
41
|
description: string;
|
|
@@ -23,12 +23,21 @@ const protocolVersion = "2025-03-26";
|
|
|
23
23
|
const readyTimeoutMs = 45_000;
|
|
24
24
|
const reportPageSize = 16_000;
|
|
25
25
|
const progressIntervalMs = 5_000;
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const workerCapabilityInstruction = "跨助手委派(worker_*):启动并调度其他外部助手在当前工作区独立执行任务;无需外部助手时优先自行完成或使用内置子代理。" +
|
|
27
|
+
"流程:worker_create 启动(或 worker_discover 复用)→ worker_request 派发/追问 → 完成后 worker_close;" +
|
|
28
|
+
"后台取结果、超时续等(timedOut)或翻页(nextOffset)用 worker_output;返回 needsResponse 时先向用户确认,再用 worker_response 回复。";
|
|
29
|
+
const workspaceMcpCapabilityInstruction = "工作区共享 MCP(workspace_mcp_*):先用 workspace_mcp_discover 查 .pbot/mcp.json 中的服务与工具,再用 workspace_mcp_call 调用。";
|
|
30
|
+
const historyCapabilityInstruction = "跨宿主历史(history_search / history_read):只读检索当前工作区跨宿主记录的历史问答与摘要归档。";
|
|
31
|
+
export function buildMcpInstructions(options) {
|
|
32
|
+
const parts = [workerCapabilityInstruction];
|
|
33
|
+
if (options.workspaceMcp)
|
|
34
|
+
parts.push(workspaceMcpCapabilityInstruction);
|
|
35
|
+
if (options.history)
|
|
36
|
+
parts.push(historyCapabilityInstruction);
|
|
37
|
+
return parts.length === 1 ? parts[0] : parts.map((text, index) => `${index + 1}. ${text}`).join("\n");
|
|
38
|
+
}
|
|
39
|
+
export const mcpWorkerOnlyInstructions = buildMcpInstructions({ workspaceMcp: false, history: false });
|
|
40
|
+
export const mcpInstructions = buildMcpInstructions({ workspaceMcp: true, history: true });
|
|
32
41
|
export function defaultWorkerDirectory() {
|
|
33
42
|
if (process.env.PBOT_MCP_AGENT_DIR)
|
|
34
43
|
return process.env.PBOT_MCP_AGENT_DIR;
|
|
@@ -214,7 +223,7 @@ export class McpWorkerRuntime {
|
|
|
214
223
|
}
|
|
215
224
|
return entry;
|
|
216
225
|
}
|
|
217
|
-
async
|
|
226
|
+
async resolveToolContext() {
|
|
218
227
|
let commands;
|
|
219
228
|
let includeWorkspaceMcp = !this.#nativeWorkspaceMcp;
|
|
220
229
|
let includeHistory = !this.#nativeHistory;
|
|
@@ -229,6 +238,14 @@ export class McpWorkerRuntime {
|
|
|
229
238
|
}
|
|
230
239
|
}
|
|
231
240
|
catch { /* Fall back to registered built-in harnesses when cwd is outside an enabled workspace. */ }
|
|
241
|
+
return { commands, includeWorkspaceMcp, includeHistory };
|
|
242
|
+
}
|
|
243
|
+
async serverInstructions() {
|
|
244
|
+
const { includeWorkspaceMcp, includeHistory } = await this.resolveToolContext();
|
|
245
|
+
return buildMcpInstructions({ workspaceMcp: includeWorkspaceMcp, history: includeHistory });
|
|
246
|
+
}
|
|
247
|
+
async toolDefinitions() {
|
|
248
|
+
const { commands, includeWorkspaceMcp, includeHistory } = await this.resolveToolContext();
|
|
232
249
|
const defaultBackend = this.#defaultBackend ? canonicalAcpBackend(this.#defaultBackend, commands) : undefined;
|
|
233
250
|
const workspaceBound = Boolean(pluginMcpWorkspaceRoot());
|
|
234
251
|
return [
|
|
@@ -502,7 +519,7 @@ export async function handleMcpRequest(runtime, message, notify) {
|
|
|
502
519
|
protocolVersion: requested || protocolVersion,
|
|
503
520
|
capabilities: { tools: {} },
|
|
504
521
|
serverInfo: { name: "personal-bot", version: packageVersion },
|
|
505
|
-
instructions: runtime.
|
|
522
|
+
instructions: await runtime.serverInstructions(),
|
|
506
523
|
},
|
|
507
524
|
};
|
|
508
525
|
}
|