personal-bot 0.3.4 → 0.3.6
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/bin/pbot.mjs +3 -17
- package/docs/README.md +1 -1
- package/docs/architecture/design.md +10 -9
- package/docs/architecture/extensibility.md +1 -1
- package/docs/architecture/principles.md +1 -1
- 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/common/paths.d.ts +1 -0
- package/lib/antigravity-plugin/lib/common/paths.js +2 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +26 -24
- package/lib/antigravity-plugin/lib/extension/cli.js +22495 -0
- package/lib/antigravity-plugin/lib/extension/mcp.js +22 -20
- package/lib/antigravity-plugin/lib/extension/workspace-cli.js +5 -20165
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- 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 +1 -1
- package/lib/common/paths.d.ts +1 -0
- package/lib/common/paths.js +2 -0
- package/lib/extension/acp-worker.js +26 -24
- package/lib/extension/cli.js +22495 -0
- package/lib/extension/mcp.js +22 -20
- package/lib/extension/workspace-cli.js +5 -20165
- 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 +1 -1
- package/package.json +1 -1
- package/scripts/README.md +1 -1
- package/src/common/paths.ts +2 -0
- package/src/extension/cli/args.ts +104 -0
- package/src/extension/cli/commands/history.ts +81 -0
- package/src/extension/cli/commands/install.ts +77 -0
- package/src/extension/cli/commands/mcp.ts +165 -0
- package/src/extension/cli/commands/plugin.ts +33 -0
- package/src/extension/cli/commands/upgrade.ts +158 -0
- package/src/extension/cli/commands/workspace.ts +71 -0
- package/src/extension/cli/index.ts +192 -0
- package/src/extension/cli/types.ts +30 -0
- package/src/integrations/installation/cli-update.ts +3 -3
- 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/services/installation/install-service.ts +107 -0
- package/lib/common/package-source.js +0 -16
- package/lib/extension/setup/cli.js +0 -364
- package/lib/extension/setup/guard.js +0 -11
- package/lib/extension/setup/upgrade.js +0 -153
- package/lib/integrations/installation/cli-update.js +0 -146
- package/lib/integrations/installation/pi-bridge.js +0 -131
- package/lib/integrations/installation/pi-setup.js +0 -193
- package/lib/integrations/installation/processes.js +0 -140
- package/lib/integrations/installation/upgraders/antigravity.js +0 -67
- package/lib/integrations/installation/upgraders/claude.js +0 -123
- package/lib/integrations/installation/upgraders/codex.js +0 -73
- package/lib/integrations/installation/upgraders/dsh.js +0 -62
- package/lib/integrations/installation/upgraders/pi.js +0 -90
- package/lib/integrations/installation/upgraders/qoder.js +0 -67
- package/lib/integrations/installation/upgraders/registry.js +0 -40
- package/lib/integrations/installation/workspace.js +0 -21
- package/lib/model/installation.js +0 -1
- package/lib/services/installation/setup-service.js +0 -140
- package/lib/services/installation/upgrade-service.js +0 -95
- package/lib/ui/setup.js +0 -52
- package/resources/installer/plugins.json +0 -16
- package/src/extension/setup/cli.ts +0 -303
- package/src/extension/setup/guard.ts +0 -12
- package/src/extension/setup/upgrade.ts +0 -158
- package/src/extension/setup/workspace-cli.ts +0 -167
- package/src/integrations/installation/pi-bridge.ts +0 -109
- package/src/integrations/installation/pi-setup.ts +0 -162
- package/src/services/installation/setup-service.ts +0 -126
- package/src/ui/setup.ts +0 -40
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/extension/acp/worker.ts
|
|
8
8
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
9
|
-
import { dirname as dirname4, join as join11, resolve as
|
|
9
|
+
import { dirname as dirname4, join as join11, resolve as resolve6 } from "node:path";
|
|
10
10
|
|
|
11
11
|
// src/storage/agent-files.ts
|
|
12
12
|
import { existsSync, mkdirSync as mkdirSync3, readdirSync, rmSync } from "node:fs";
|
|
@@ -4000,7 +4000,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
4000
4000
|
var NONE = 0;
|
|
4001
4001
|
var ASSUMED = 1;
|
|
4002
4002
|
var PROVEN = 2;
|
|
4003
|
-
function isRecursive(inst, stack,
|
|
4003
|
+
function isRecursive(inst, stack, resolve7) {
|
|
4004
4004
|
const cached2 = recursive.get(inst);
|
|
4005
4005
|
if (cached2 !== void 0)
|
|
4006
4006
|
return cached2 ? PROVEN : NONE;
|
|
@@ -4010,7 +4010,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
4010
4010
|
let result = NONE;
|
|
4011
4011
|
const check = (child) => {
|
|
4012
4012
|
if (result !== PROVEN && child?._zod) {
|
|
4013
|
-
const answer = isRecursive(child, stack,
|
|
4013
|
+
const answer = isRecursive(child, stack, resolve7);
|
|
4014
4014
|
if (answer > result)
|
|
4015
4015
|
result = answer;
|
|
4016
4016
|
}
|
|
@@ -4021,7 +4021,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
4021
4021
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
4022
4022
|
if (spread && !desc.enumerable)
|
|
4023
4023
|
continue;
|
|
4024
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
4024
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve7) : NONE;
|
|
4025
4025
|
if (child > answer)
|
|
4026
4026
|
answer = child;
|
|
4027
4027
|
}
|
|
@@ -4085,7 +4085,7 @@ function isRecursive(inst, stack, resolve6) {
|
|
|
4085
4085
|
break;
|
|
4086
4086
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
4087
4087
|
case "lazy": {
|
|
4088
|
-
const inner = def._cachedInner ?? (
|
|
4088
|
+
const inner = def._cachedInner ?? (resolve7 ? inst._zod.innerType : void 0);
|
|
4089
4089
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
4090
4090
|
break;
|
|
4091
4091
|
}
|
|
@@ -8536,11 +8536,11 @@ var Connection = class {
|
|
|
8536
8536
|
const id = this.nextRequestId++;
|
|
8537
8537
|
let cancel = () => {
|
|
8538
8538
|
};
|
|
8539
|
-
const response = new Promise((
|
|
8539
|
+
const response = new Promise((resolve7, reject) => {
|
|
8540
8540
|
const pendingResponse = {
|
|
8541
8541
|
resolve: (value) => {
|
|
8542
8542
|
try {
|
|
8543
|
-
|
|
8543
|
+
resolve7(mapResponse ? mapResponse(value) : value);
|
|
8544
8544
|
} catch (error2) {
|
|
8545
8545
|
reject(error2);
|
|
8546
8546
|
}
|
|
@@ -8601,8 +8601,8 @@ var Connection = class {
|
|
|
8601
8601
|
this.stream = stream;
|
|
8602
8602
|
this.staticHandlers = handlers;
|
|
8603
8603
|
this.fallbackHandlers = [...options?.fallbackHandlers ?? []];
|
|
8604
|
-
this.closedPromise = new Promise((
|
|
8605
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
8604
|
+
this.closedPromise = new Promise((resolve7) => {
|
|
8605
|
+
this.abortController.signal.addEventListener("abort", () => resolve7());
|
|
8606
8606
|
});
|
|
8607
8607
|
void this.receive();
|
|
8608
8608
|
}
|
|
@@ -9667,8 +9667,8 @@ var AsyncQueue = class {
|
|
|
9667
9667
|
if (this.failed) {
|
|
9668
9668
|
return Promise.reject(this.failure);
|
|
9669
9669
|
}
|
|
9670
|
-
return new Promise((
|
|
9671
|
-
this.waiters.push({ resolve:
|
|
9670
|
+
return new Promise((resolve7, reject) => {
|
|
9671
|
+
this.waiters.push({ resolve: resolve7, reject });
|
|
9672
9672
|
});
|
|
9673
9673
|
}
|
|
9674
9674
|
};
|
|
@@ -10357,11 +10357,13 @@ releaseLine(packageVersion);
|
|
|
10357
10357
|
// src/integrations/acp/claude-settings.ts
|
|
10358
10358
|
import { createRequire } from "node:module";
|
|
10359
10359
|
import { pathToFileURL } from "node:url";
|
|
10360
|
-
import { basename, join as join4, resolve } from "node:path";
|
|
10360
|
+
import { basename, join as join4, resolve as resolve2 } from "node:path";
|
|
10361
10361
|
|
|
10362
10362
|
// src/common/paths.ts
|
|
10363
|
+
import { resolve } from "node:path";
|
|
10363
10364
|
import { fileURLToPath } from "node:url";
|
|
10364
10365
|
var resourceRoot = fileURLToPath(new URL("../../resources/", import.meta.url));
|
|
10366
|
+
var packageRoot = resolve(resourceRoot, "..");
|
|
10365
10367
|
|
|
10366
10368
|
// src/integrations/acp/claude-settings.ts
|
|
10367
10369
|
var levels = ["low", "medium", "high", "xhigh", "max"];
|
|
@@ -10369,7 +10371,7 @@ async function claudeOptions(command, cwd, supplied, includeSkills = true) {
|
|
|
10369
10371
|
const normalized = supplied?.trim().toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
10370
10372
|
const requested = normalized === "extrahigh" ? "xhigh" : normalized;
|
|
10371
10373
|
const script = command.args[0];
|
|
10372
|
-
const anchor2 = ["node", "node.exe"].includes(basename(command.command)) && script && !script.startsWith("-") ?
|
|
10374
|
+
const anchor2 = ["node", "node.exe"].includes(basename(command.command)) && script && !script.startsWith("-") ? resolve2(cwd, script) : command.command;
|
|
10373
10375
|
const require2 = createRequire(pathToFileURL(anchor2));
|
|
10374
10376
|
const sdk = await import(pathToFileURL(require2.resolve("@anthropic-ai/claude-agent-sdk")).href);
|
|
10375
10377
|
requireThat(object(sdk) && typeof sdk.resolveSettings === "function", "Claude ACP \u9700\u8981\u63D0\u4F9B resolveSettings \u7684\u539F\u751F SDK\u3002");
|
|
@@ -10520,9 +10522,9 @@ import { join as join6 } from "node:path";
|
|
|
10520
10522
|
|
|
10521
10523
|
// src/integrations/acp/executable.ts
|
|
10522
10524
|
import { accessSync, constants as constants2, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
10523
|
-
import { delimiter, isAbsolute as isAbsolute2, resolve as
|
|
10525
|
+
import { delimiter, isAbsolute as isAbsolute2, resolve as resolve3 } from "node:path";
|
|
10524
10526
|
function findAcpExecutable(command) {
|
|
10525
|
-
const candidates = isAbsolute2(command) ? [command] : (process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) =>
|
|
10527
|
+
const candidates = isAbsolute2(command) ? [command] : (process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => resolve3(directory, command));
|
|
10526
10528
|
for (const candidate of candidates) {
|
|
10527
10529
|
try {
|
|
10528
10530
|
accessSync(candidate, constants2.X_OK);
|
|
@@ -10749,10 +10751,10 @@ function acpChoices(options) {
|
|
|
10749
10751
|
}
|
|
10750
10752
|
|
|
10751
10753
|
// src/integrations/acp/mcp.ts
|
|
10752
|
-
import { isAbsolute as isAbsolute3, resolve as
|
|
10754
|
+
import { isAbsolute as isAbsolute3, resolve as resolve4 } from "node:path";
|
|
10753
10755
|
function resolveStdioCommand(command, cwd) {
|
|
10754
10756
|
if (isAbsolute3(command)) return command;
|
|
10755
|
-
if (command.includes("/") || command.includes("\\")) return
|
|
10757
|
+
if (command.includes("/") || command.includes("\\")) return resolve4(cwd, command);
|
|
10756
10758
|
return findAcpExecutable(command) ?? command;
|
|
10757
10759
|
}
|
|
10758
10760
|
function toAcpMcpServers(servers) {
|
|
@@ -10792,7 +10794,7 @@ async function openAcp(reference, cwd, env, callbacks, signal, openOptions = {})
|
|
|
10792
10794
|
const child = spawn(reference.command, reference.args, { cwd, env, stdio: ["pipe", "pipe", "pipe"] });
|
|
10793
10795
|
const lifetime = new AbortController();
|
|
10794
10796
|
const cancel = AbortSignal.any([signal, lifetime.signal]);
|
|
10795
|
-
const exited = new Promise((
|
|
10797
|
+
const exited = new Promise((resolve7) => child.once("close", () => resolve7()));
|
|
10796
10798
|
child.once("error", (error2) => lifetime.abort(error2));
|
|
10797
10799
|
child.once("exit", (code, termination) => lifetime.abort(new Error("ACP \u8FDB\u7A0B\u9000\u51FA\uFF1A" + (termination ?? code))));
|
|
10798
10800
|
child.stderr.resume();
|
|
@@ -11159,7 +11161,7 @@ async function readWorkspaceConfig(root) {
|
|
|
11159
11161
|
|
|
11160
11162
|
// src/services/workspace/workspace-mcp.ts
|
|
11161
11163
|
import { mkdir as mkdir2, readFile as readFile3 } from "node:fs/promises";
|
|
11162
|
-
import { dirname as dirname3, join as join9, resolve as
|
|
11164
|
+
import { dirname as dirname3, join as join9, resolve as resolve5 } from "node:path";
|
|
11163
11165
|
var serverNamePattern = /^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;
|
|
11164
11166
|
var reservedServerNames = /* @__PURE__ */ new Set(["pbot"]);
|
|
11165
11167
|
var stdioKeys = /* @__PURE__ */ new Set(["command", "args", "env", "cwd", "description", "timeout", "enabled"]);
|
|
@@ -11313,7 +11315,7 @@ function resolveWorkspaceMcpServer(root, name, server, env = process.env) {
|
|
|
11313
11315
|
}
|
|
11314
11316
|
const command = expandEnvTemplate(server.command, env, `MCP \u670D\u52A1 "${name}" \u7684 command`);
|
|
11315
11317
|
const args2 = (server.args ?? []).map((arg, index) => expandEnvTemplate(arg, env, `MCP \u670D\u52A1 "${name}" \u7684 args[${index}]`));
|
|
11316
|
-
const cwd = server.cwd ?
|
|
11318
|
+
const cwd = server.cwd ? resolve5(root, expandEnvTemplate(server.cwd, env, `MCP \u670D\u52A1 "${name}" \u7684 cwd`)) : root;
|
|
11317
11319
|
return {
|
|
11318
11320
|
transport: "stdio",
|
|
11319
11321
|
name,
|
|
@@ -11515,7 +11517,7 @@ async function runWorker(args2) {
|
|
|
11515
11517
|
requireThat(files.read(id, "launch.json", launch).generation === generation, "ACP worker \u542F\u52A8\u4EE3\u6B21\u5DF2\u5931\u6548\u3002");
|
|
11516
11518
|
const harness = resolveAcpHarness(reference.backend);
|
|
11517
11519
|
const exactAnswer = Boolean(harness.exactAnswer);
|
|
11518
|
-
const
|
|
11520
|
+
const packageRoot2 = resolve6(resourceRoot, "..");
|
|
11519
11521
|
const configuration = await readWorkspaceConfig(d.workspace);
|
|
11520
11522
|
const features = workspaceFeatures(configuration);
|
|
11521
11523
|
const baseEnv = {
|
|
@@ -11525,7 +11527,7 @@ async function runWorker(args2) {
|
|
|
11525
11527
|
PBOT_SUBAGENT_GENERATION: generation,
|
|
11526
11528
|
...validating ? { PBOT_ACP_VALIDATE: "1" } : {}
|
|
11527
11529
|
};
|
|
11528
|
-
const prepared = harness.prepareLaunch ? await harness.prepareLaunch({ reference, cwd: d.cwd, directory, packageRoot, options: d.options, env: baseEnv, features }) : { command: { ...reference, args: [...reference.args] }, env: { ...baseEnv, ...reference.env ?? {} } };
|
|
11530
|
+
const prepared = harness.prepareLaunch ? await harness.prepareLaunch({ reference, cwd: d.cwd, directory, packageRoot: packageRoot2, options: d.options, env: baseEnv, features }) : { command: { ...reference, args: [...reference.args] }, env: { ...baseEnv, ...reference.env ?? {} } };
|
|
11529
11531
|
let prompt;
|
|
11530
11532
|
if (!exactAnswer) {
|
|
11531
11533
|
const workspaceSkills = features.skills && !harness.nativeWorkspaceSkills && !d.options.noSkills ? await discoverWorkspaceSkills(d.workspace) : [];
|
|
@@ -11686,7 +11688,7 @@ async function runOneShotPrompt() {
|
|
|
11686
11688
|
requireThat(typeof payload.cwd === "string" && payload.cwd.length > 0, "\u7F3A\u5C11 ACP \u6458\u8981\u5DE5\u4F5C\u76EE\u5F55\u3002");
|
|
11687
11689
|
requireThat(typeof payload.prompt === "string" && payload.prompt.trim().length > 0, "\u7F3A\u5C11 ACP \u6458\u8981\u8F93\u5165\u5185\u5BB9\u3002");
|
|
11688
11690
|
const harness = resolveAcpHarness(reference.backend);
|
|
11689
|
-
const
|
|
11691
|
+
const packageRoot2 = resolve6(resourceRoot, "..");
|
|
11690
11692
|
const env = {
|
|
11691
11693
|
...process.env,
|
|
11692
11694
|
...reference.env ?? {},
|
|
@@ -11695,7 +11697,7 @@ async function runOneShotPrompt() {
|
|
|
11695
11697
|
PBOT_SUMMARY_WORKER: "1",
|
|
11696
11698
|
PI_OFFLINE: "1",
|
|
11697
11699
|
PBOT_ACP_PI_COMMAND: process.env.PI_ACP_PI_COMMAND ?? acpExecutable("pi", "pi"),
|
|
11698
|
-
PI_ACP_PI_COMMAND: join11(
|
|
11700
|
+
PI_ACP_PI_COMMAND: join11(packageRoot2, "bin/pbot-pi-acp.mjs")
|
|
11699
11701
|
} : {}
|
|
11700
11702
|
};
|
|
11701
11703
|
let collecting = false;
|