personal-bot 0.3.6 → 0.4.0
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 +5 -8
- package/README.zh-CN.md +5 -8
- package/bin/pbot-pi-acp.mjs +1 -1
- package/docs/README.md +1 -1
- package/docs/architecture/design.md +2 -2
- package/docs/architecture/extensibility.md +1 -1
- package/docs/architecture/model-context.md +1 -2
- package/docs/guides/capabilities.md +4 -8
- package/docs/guides/cross-harness-workers.md +4 -4
- package/docs/guides/history.md +1 -3
- package/docs/guides/workspace-configuration.md +4 -4
- package/docs/hosts/claude-code.md +2 -2
- package/docs/hosts/codex-qoder.md +1 -1
- package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +1 -1
- package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +1 -1
- package/lib/antigravity-plugin/lib/extension/acp/member.js +11 -10
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +348 -203
- package/lib/antigravity-plugin/lib/extension/cli.js +574 -549
- package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +1 -1
- package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +3 -4
- package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +0 -11
- package/lib/antigravity-plugin/lib/extension/mcp.js +462 -326
- package/lib/antigravity-plugin/lib/integrations/agent-resources.js +2 -2
- package/lib/antigravity-plugin/lib/model/acp.d.ts +29 -35
- package/lib/antigravity-plugin/lib/model/agent.d.ts +33 -17
- package/lib/antigravity-plugin/lib/model/agent.js +0 -1
- package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +5 -8
- package/lib/antigravity-plugin/lib/storage/acp-files.js +34 -40
- package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +19 -10
- package/lib/antigravity-plugin/lib/storage/agent-files.js +147 -43
- 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/member.d.ts +1 -1
- package/lib/extension/acp/member.js +11 -10
- package/lib/extension/acp/worker.js +34 -33
- package/lib/extension/acp-worker.js +348 -203
- package/lib/extension/cli.js +574 -549
- package/lib/extension/hosts/dsh/acp-member.js +1 -1
- package/lib/extension/hosts/dsh/command.js +1 -1
- package/lib/extension/hosts/dsh/workspace.js +1 -3
- package/lib/extension/hosts/pi/acp-member.js +3 -4
- package/lib/extension/hosts/plugin-runtime.js +0 -11
- package/lib/extension/mcp/tool-contract.d.ts +8 -50
- package/lib/extension/mcp/tool-contract.js +48 -62
- package/lib/extension/mcp/workers.d.ts +13 -27
- package/lib/extension/mcp/workers.js +60 -25
- package/lib/extension/mcp.js +462 -326
- package/lib/integrations/acp/agents.d.ts +2 -3
- package/lib/integrations/acp/agents.js +22 -22
- package/lib/integrations/acp/harnesses/claude.js +1 -1
- package/lib/integrations/agent-resources.js +2 -2
- package/lib/model/acp.d.ts +29 -35
- package/lib/model/agent.d.ts +33 -17
- package/lib/model/agent.js +0 -1
- 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/services/agents/acp-run.d.ts +6 -4
- package/lib/services/agents/acp-run.js +62 -43
- package/lib/services/agents/agent-run.d.ts +10 -6
- package/lib/services/agents/agent-run.js +142 -65
- package/lib/services/agents/agent-service.d.ts +3 -21
- package/lib/services/agents/agent-service.js +180 -126
- package/lib/storage/acp-files.d.ts +5 -8
- package/lib/storage/acp-files.js +34 -40
- package/lib/storage/agent-files.d.ts +19 -10
- package/lib/storage/agent-files.js +147 -43
- 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/acp/member.ts +14 -11
- package/src/extension/acp/worker.ts +31 -28
- package/src/extension/cli/commands/upgrade.ts +8 -36
- package/src/extension/cli/commands/workspace.ts +3 -8
- package/src/extension/cli/index.ts +1 -2
- package/src/extension/hosts/dsh/acp-member.ts +1 -1
- package/src/extension/hosts/dsh/command.ts +1 -1
- package/src/extension/hosts/dsh/workspace.ts +1 -3
- package/src/extension/hosts/pi/acp-member.ts +3 -4
- package/src/extension/hosts/pi/command.ts +1 -1
- package/src/extension/hosts/pi/lifecycle.ts +0 -2
- package/src/extension/hosts/plugin-runtime.ts +0 -10
- package/src/extension/mcp/tool-contract.ts +48 -62
- package/src/extension/mcp/workers.ts +66 -27
- package/src/integrations/acp/agents.ts +28 -27
- package/src/integrations/acp/harnesses/claude.ts +1 -1
- package/src/integrations/agent-resources.ts +2 -2
- package/src/integrations/hosts/dsh/session.ts +2 -2
- package/src/integrations/installation/cli-update.ts +2 -2
- package/src/integrations/installation/installers/claude.ts +4 -4
- package/src/integrations/installation/installers/qoder.ts +5 -5
- package/src/integrations/installation/upgraders/antigravity.ts +57 -15
- package/src/integrations/installation/upgraders/claude.ts +1 -4
- package/src/integrations/installation/upgraders/codex.ts +85 -15
- package/src/integrations/installation/upgraders/dsh.ts +46 -24
- package/src/integrations/installation/upgraders/pi.ts +18 -11
- package/src/integrations/installation/upgraders/qoder.ts +95 -20
- package/src/model/acp.ts +27 -29
- package/src/model/agent.ts +80 -16
- package/src/model/installation.ts +0 -2
- package/src/pbot.ts +2 -2
- package/src/services/agents/acp-run.ts +81 -49
- package/src/services/agents/agent-run.ts +154 -56
- package/src/services/agents/agent-service.ts +204 -133
- package/src/services/installation/upgrade-service.ts +1 -5
- package/src/storage/acp-files.ts +50 -45
- package/src/storage/agent-files.ts +159 -46
- package/src/tools/history/contract.ts +12 -12
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +0 -15
- package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +0 -126
- 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/services/workspace/plugin-releases.d.ts +0 -15
- package/lib/services/workspace/plugin-releases.js +0 -126
- 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/services/workspace/plugin-releases.ts +0 -121
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
import { AgentFiles,
|
|
4
|
-
import {
|
|
3
|
+
import { AgentFiles, status, toDescriptor } from "../../storage/agent-files.js";
|
|
4
|
+
import { acpReference } from "../../storage/acp-files.js";
|
|
5
5
|
import { AcpAgentRun } from "../../services/agents/acp-run.js";
|
|
6
|
+
import { AgentRun } from "../../services/agents/agent-run.js";
|
|
6
7
|
import { openAcp } from "../../integrations/acp/connection.js";
|
|
7
8
|
import { acpExecutable } from "../../integrations/acp/executable.js";
|
|
8
9
|
import { acpContent } from "../../integrations/acp/input.js";
|
|
@@ -93,16 +94,17 @@ async function runWorker(args) {
|
|
|
93
94
|
requireThat(directory && id && generation, "缺少 ACP worker 启动信息。");
|
|
94
95
|
const files = new AgentFiles(dirname(directory));
|
|
95
96
|
requireThat(files.directory(id) === directory, "ACP worker 目录不匹配。");
|
|
96
|
-
const d = files.
|
|
97
|
+
const d = toDescriptor(files.worker(id)), reference = files.reference(id);
|
|
97
98
|
requireThat(d.agentId === id && releaseLine(d.release) === releaseLine(packageVersion), "ACP worker 身份或版本不匹配。");
|
|
98
99
|
const validating = args.includes("--validate"), lifetime = new AbortController();
|
|
100
|
+
const agentRun = validating ? undefined : new AgentRun(files, id, generation);
|
|
99
101
|
let execution;
|
|
100
102
|
const stop = () => { void execution?.stop().catch(error => lifetime.abort(error)); if (!execution)
|
|
101
103
|
lifetime.abort(); };
|
|
102
104
|
process.on("SIGTERM", stop);
|
|
103
105
|
process.on("SIGINT", stop);
|
|
104
106
|
async function main() {
|
|
105
|
-
requireThat(files.
|
|
107
|
+
requireThat(files.worker(id).generation === generation, "ACP worker 启动代次已失效。");
|
|
106
108
|
const harness = resolveAcpHarness(reference.backend);
|
|
107
109
|
const exactAnswer = Boolean(harness.exactAnswer);
|
|
108
110
|
const packageRoot = resolve(resourceRoot, "..");
|
|
@@ -116,7 +118,7 @@ async function runWorker(args) {
|
|
|
116
118
|
...(validating ? { PBOT_ACP_VALIDATE: "1" } : {}),
|
|
117
119
|
};
|
|
118
120
|
const prepared = harness.prepareLaunch
|
|
119
|
-
? await harness.prepareLaunch({ reference,
|
|
121
|
+
? await harness.prepareLaunch({ reference, workspace: d.workspace, directory: directory, packageRoot, options: d.options, env: baseEnv, features })
|
|
120
122
|
: { command: { ...reference, args: [...reference.args] }, env: { ...baseEnv, ...(reference.env ?? {}) } };
|
|
121
123
|
let prompt;
|
|
122
124
|
if (!exactAnswer) {
|
|
@@ -142,16 +144,16 @@ async function runWorker(args) {
|
|
|
142
144
|
mcpServers = toAcpMcpServers(resolved);
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
|
-
// Only publish
|
|
147
|
+
// Only publish selection after requested model/thinking options are applied so callers can detect startup readiness.
|
|
146
148
|
let configured = false;
|
|
147
149
|
const saveSelection = (selection) => {
|
|
148
|
-
if (validating || !configured)
|
|
150
|
+
if (validating || !configured || !agentRun)
|
|
149
151
|
return;
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
152
|
+
const w = files.worker(id);
|
|
153
|
+
if (w.generation === generation && !w.stop)
|
|
154
|
+
agentRun.setSelection(selection);
|
|
153
155
|
};
|
|
154
|
-
const connection = await openAcp(prepared.command, d.
|
|
156
|
+
const connection = await openAcp(prepared.command, d.workspace, prepared.env, {
|
|
155
157
|
selection: saveSelection,
|
|
156
158
|
update(update) {
|
|
157
159
|
if (update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
|
|
@@ -210,12 +212,10 @@ async function runWorker(args) {
|
|
|
210
212
|
}
|
|
211
213
|
if (reference.sessionId === null)
|
|
212
214
|
await connection.configure(d.options);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
capabilities: connection.capabilities,
|
|
218
|
-
}, acpReference);
|
|
215
|
+
const currentWorker = files.worker(id);
|
|
216
|
+
requireThat(currentWorker.generation === generation && !currentWorker.stop, "ACP 启动已取消。");
|
|
217
|
+
let sessionId = harness.eagerSessionId || reference.sessionId !== null ? connection.sessionId : null;
|
|
218
|
+
agentRun.setSession(sessionId, connection.capabilities);
|
|
219
219
|
configured = true;
|
|
220
220
|
saveSelection(connection.selection());
|
|
221
221
|
let promptInjected = reference.sessionId !== null || connection.systemPrompt;
|
|
@@ -227,16 +227,17 @@ async function runWorker(args) {
|
|
|
227
227
|
: request;
|
|
228
228
|
promptInjected = true;
|
|
229
229
|
const content = await acpContent(effective, connection.images, connection.signal);
|
|
230
|
-
const
|
|
231
|
-
requireThat(
|
|
230
|
+
const w = files.worker(id);
|
|
231
|
+
requireThat(w.generation === generation && !w.stop, "ACP 输入已取消或启动代次变化。");
|
|
232
232
|
connection.signal.throwIfAborted();
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
if (sessionId === null) {
|
|
234
|
+
sessionId = connection.sessionId;
|
|
235
|
+
agentRun.setSession(sessionId, connection.capabilities);
|
|
236
|
+
}
|
|
236
237
|
return connection.prompt(content);
|
|
237
238
|
},
|
|
238
239
|
cancel: () => connection.cancel(),
|
|
239
|
-
}, exactAnswer);
|
|
240
|
+
}, exactAnswer, agentRun);
|
|
240
241
|
await execution.run();
|
|
241
242
|
}
|
|
242
243
|
finally {
|
|
@@ -250,24 +251,24 @@ async function runWorker(args) {
|
|
|
250
251
|
}
|
|
251
252
|
try {
|
|
252
253
|
await main();
|
|
253
|
-
if (!validating && files.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
else
|
|
257
|
-
files.write(id, "status.json", { generation, state: "stopped", activity: "已停止", updatedAt: Date.now() }, status);
|
|
254
|
+
if (!validating && files.worker(id).generation === generation) {
|
|
255
|
+
agentRun.save({ state: "stopped", activity: "已停止" });
|
|
256
|
+
files.clearTransient(id);
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
259
|
catch (error) {
|
|
261
260
|
if (validating) {
|
|
262
261
|
await sendIpc({ type: "error", error: errorMessage(error) });
|
|
263
262
|
}
|
|
264
|
-
else if (files.
|
|
265
|
-
const stopped = files.
|
|
263
|
+
else if (files.worker(id).generation === generation) {
|
|
264
|
+
const stopped = files.worker(id).stop;
|
|
266
265
|
const patch = { state: stopped ? "stopped" : "error", activity: stopped ? "已停止" : "ACP 执行失败", ...(stopped ? {} : { error: errorMessage(error) }) };
|
|
267
|
-
if (
|
|
268
|
-
|
|
266
|
+
if (agentRun)
|
|
267
|
+
agentRun.save(patch);
|
|
269
268
|
else
|
|
270
|
-
files.write(id, "
|
|
269
|
+
files.write(id, "state.json", { generation, ...patch, updatedAt: Date.now() }, status);
|
|
270
|
+
if (stopped)
|
|
271
|
+
files.clearTransient(id);
|
|
271
272
|
}
|
|
272
273
|
process.exitCode = 1;
|
|
273
274
|
}
|