personal-bot 0.3.4 → 0.3.5

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 (62) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bin/pbot.mjs +3 -17
  4. package/docs/architecture/design.md +8 -6
  5. package/docs/architecture/extensibility.md +1 -1
  6. package/docs/architecture/principles.md +1 -1
  7. package/lib/antigravity-plugin/lib/common/paths.d.ts +1 -0
  8. package/lib/antigravity-plugin/lib/common/paths.js +2 -0
  9. package/lib/antigravity-plugin/lib/extension/acp-worker.js +26 -24
  10. package/lib/antigravity-plugin/lib/extension/cli.js +22596 -0
  11. package/lib/antigravity-plugin/lib/extension/mcp.js +22 -20
  12. package/lib/antigravity-plugin/lib/extension/workspace-cli.js +5 -20165
  13. package/lib/antigravity-plugin/package.json +1 -1
  14. package/lib/antigravity-plugin/plugin.json +1 -1
  15. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +1 -1
  16. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
  17. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
  18. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +1 -1
  19. package/lib/common/paths.d.ts +1 -0
  20. package/lib/common/paths.js +2 -0
  21. package/lib/extension/acp-worker.js +26 -24
  22. package/lib/extension/cli.js +22596 -0
  23. package/lib/extension/mcp.js +22 -20
  24. package/lib/extension/workspace-cli.js +5 -20165
  25. package/lib/qoder-plugin/.mcp.json +2 -2
  26. package/lib/qoder-plugin/.qoder-plugin/plugin.json +1 -1
  27. package/lib/qoder-plugin/hooks/hooks.json +3 -3
  28. package/lib/qoder-plugin/skills/pbot/SKILL.md +1 -1
  29. package/package.json +1 -1
  30. package/scripts/README.md +1 -1
  31. package/src/common/paths.ts +2 -0
  32. package/src/extension/cli/args.ts +104 -0
  33. package/src/extension/cli/commands/history.ts +81 -0
  34. package/src/extension/cli/commands/mcp.ts +165 -0
  35. package/src/extension/cli/commands/plugin.ts +33 -0
  36. package/src/extension/cli/commands/setup.ts +159 -0
  37. package/src/extension/cli/commands/upgrade.ts +158 -0
  38. package/src/extension/cli/commands/workspace.ts +71 -0
  39. package/src/extension/cli/index.ts +193 -0
  40. package/src/extension/cli/types.ts +30 -0
  41. package/src/integrations/installation/cli-update.ts +3 -3
  42. package/src/integrations/installation/pi-setup.ts +6 -3
  43. package/src/services/installation/setup-service.ts +0 -35
  44. package/lib/extension/setup/cli.js +0 -364
  45. package/lib/extension/setup/upgrade.js +0 -153
  46. package/lib/integrations/installation/cli-update.js +0 -146
  47. package/lib/integrations/installation/pi-setup.js +0 -193
  48. package/lib/integrations/installation/processes.js +0 -140
  49. package/lib/integrations/installation/upgraders/antigravity.js +0 -67
  50. package/lib/integrations/installation/upgraders/claude.js +0 -123
  51. package/lib/integrations/installation/upgraders/codex.js +0 -73
  52. package/lib/integrations/installation/upgraders/dsh.js +0 -62
  53. package/lib/integrations/installation/upgraders/pi.js +0 -90
  54. package/lib/integrations/installation/upgraders/qoder.js +0 -67
  55. package/lib/integrations/installation/upgraders/registry.js +0 -40
  56. package/lib/integrations/installation/workspace.js +0 -21
  57. package/lib/services/installation/setup-service.js +0 -140
  58. package/lib/services/installation/upgrade-service.js +0 -95
  59. package/lib/ui/setup.js +0 -52
  60. package/src/extension/setup/cli.ts +0 -303
  61. package/src/extension/setup/upgrade.ts +0 -158
  62. package/src/extension/setup/workspace-cli.ts +0 -167
@@ -41,8 +41,10 @@ function isOneOf(value, choices) {
41
41
  }
42
42
 
43
43
  // src/common/paths.ts
44
+ import { resolve } from "node:path";
44
45
  import { fileURLToPath } from "node:url";
45
46
  var resourceRoot = fileURLToPath(new URL("../../resources/", import.meta.url));
47
+ var packageRoot = resolve(resourceRoot, "..");
46
48
 
47
49
  // src/common/version.ts
48
50
  import { readFileSync } from "node:fs";
@@ -59,7 +61,7 @@ releaseLine(packageVersion);
59
61
  // src/integrations/acp/agents.ts
60
62
  import { fork, spawnSync } from "node:child_process";
61
63
  import { existsSync as existsSync2 } from "node:fs";
62
- import { join as join7, resolve as resolve3 } from "node:path";
64
+ import { join as join7, resolve as resolve4 } from "node:path";
63
65
  import { setTimeout as delay } from "node:timers/promises";
64
66
 
65
67
  // src/storage/agent-files.ts
@@ -400,9 +402,9 @@ var AgentFiles = class {
400
402
 
401
403
  // src/integrations/acp/executable.ts
402
404
  import { accessSync, constants as constants2, realpathSync as realpathSync2, statSync } from "node:fs";
403
- import { delimiter, isAbsolute as isAbsolute2, resolve } from "node:path";
405
+ import { delimiter, isAbsolute as isAbsolute2, resolve as resolve2 } from "node:path";
404
406
  function findAcpExecutable(command) {
405
- const candidates = isAbsolute2(command) ? [command] : (process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => resolve(directory, command));
407
+ const candidates = isAbsolute2(command) ? [command] : (process.env.PATH ?? "").split(delimiter).filter(Boolean).map((directory) => resolve2(directory, command));
406
408
  for (const candidate of candidates) {
407
409
  try {
408
410
  accessSync(candidate, constants2.X_OK);
@@ -435,13 +437,13 @@ function acpExecutable(command, backend, harness) {
435
437
  // src/integrations/acp/claude-settings.ts
436
438
  import { createRequire } from "node:module";
437
439
  import { pathToFileURL } from "node:url";
438
- import { basename, join as join4, resolve as resolve2 } from "node:path";
440
+ import { basename, join as join4, resolve as resolve3 } from "node:path";
439
441
  var levels = ["low", "medium", "high", "xhigh", "max"];
440
442
  async function claudeOptions(command, cwd, supplied, includeSkills = true) {
441
443
  const normalized = supplied?.trim().toLowerCase().replace(/[^a-z0-9]+/g, "");
442
444
  const requested = normalized === "extrahigh" ? "xhigh" : normalized;
443
445
  const script = command.args[0];
444
- const anchor = ["node", "node.exe"].includes(basename(command.command)) && script && !script.startsWith("-") ? resolve2(cwd, script) : command.command;
446
+ const anchor = ["node", "node.exe"].includes(basename(command.command)) && script && !script.startsWith("-") ? resolve3(cwd, script) : command.command;
445
447
  const require2 = createRequire(pathToFileURL(anchor));
446
448
  const sdk = await import(pathToFileURL(require2.resolve("@anthropic-ai/claude-agent-sdk")).href);
447
449
  requireThat(object(sdk) && typeof sdk.resolveSettings === "function", "Claude ACP \u9700\u8981\u63D0\u4F9B resolveSettings \u7684\u539F\u751F SDK\u3002");
@@ -754,7 +756,7 @@ var AcpWorkerHost = class {
754
756
  this.files = new AgentFiles(directory);
755
757
  }
756
758
  files;
757
- worker = resolve3(resourceRoot, "../lib/extension/acp-worker.js");
759
+ worker = resolve4(resourceRoot, "../lib/extension/acp-worker.js");
758
760
  available(backend) {
759
761
  requireThat(backend, "\u901A\u8FC7 worker_create \u59D4\u6D3E\u8DE8 Harness \u4E13\u5BB6\u65F6\u5FC5\u987B\u6307\u5B9A backend\uFF08\u4F8B\u5982 pi\u3001dsh\u3001claude\u3001antigravity\u3001codex \u6216\u81EA\u5B9A\u4E49 ACP \u540D\u79F0\uFF09\u3002");
760
762
  requireThat(process.platform === "linux" || process.platform === "darwin", "ACP worker \u5F53\u524D\u652F\u6301 Linux \u548C macOS\u3002");
@@ -937,7 +939,7 @@ var AcpWorkerHost = class {
937
939
 
938
940
  // src/integrations/hosts/antigravity/adapter.ts
939
941
  import { readFile, realpath, stat } from "node:fs/promises";
940
- import { dirname as dirname2, isAbsolute as isAbsolute3, join as join8, relative, resolve as resolve4, sep } from "node:path";
942
+ import { dirname as dirname2, isAbsolute as isAbsolute3, join as join8, relative, resolve as resolve5, sep } from "node:path";
941
943
  var supportedEvents = ["SessionStart", "PreToolUse", "Stop"];
942
944
  function cleanUserRequest(content) {
943
945
  const match = content.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);
@@ -1004,9 +1006,9 @@ function workspaceFromPayload(cwd, payload) {
1004
1006
  }
1005
1007
  return cwd;
1006
1008
  }
1007
- function skillFromReadPath(targetPath, pluginRoot = process.env.PLUGIN_ROOT || resolve4(resourceRoot, "..")) {
1008
- const skillsRoot = resolve4(pluginRoot, "skills");
1009
- const rel = relative(skillsRoot, resolve4(targetPath));
1009
+ function skillFromReadPath(targetPath, pluginRoot = process.env.PLUGIN_ROOT || resolve5(resourceRoot, "..")) {
1010
+ const skillsRoot = resolve5(pluginRoot, "skills");
1011
+ const rel = relative(skillsRoot, resolve5(targetPath));
1010
1012
  if (!rel || rel.startsWith("..") || isAbsolute3(rel)) return void 0;
1011
1013
  const skill = rel.split(sep)[0];
1012
1014
  if (!skill || skill === "pbot") return void 0;
@@ -1671,7 +1673,7 @@ function parseMcpToolCall(name, args) {
1671
1673
  // src/services/agents/agent-service.ts
1672
1674
  import { randomUUID as randomUUID3 } from "node:crypto";
1673
1675
  import { realpathSync as realpathSync3 } from "node:fs";
1674
- import { resolve as resolve5 } from "node:path";
1676
+ import { resolve as resolve6 } from "node:path";
1675
1677
  var AgentService = class {
1676
1678
  constructor(root, directory, host) {
1677
1679
  this.root = root;
@@ -1828,8 +1830,8 @@ var AgentService = class {
1828
1830
  const prepared = this.files.control(() => {
1829
1831
  requireThat(this.list(owner).filter((v) => v.alive).length < 50, "\u6700\u591A 50 \u4E2A\u5B58\u6D3B\u6216\u542F\u52A8\u4E2D worker\uFF1B\u8BF7\u5148\u505C\u6B62\u4E00\u4E2A\u7A7A\u95F2\u4F1A\u8BDD\u3002");
1830
1832
  const agentId = randomUUID3();
1831
- const cwd = realpathSync3(resolve5(this.root, options.cwd ?? "."));
1832
- const files = (options.files ?? []).map((p) => realpathSync3(resolve5(this.root, p)));
1833
+ const cwd = realpathSync3(resolve6(this.root, options.cwd ?? "."));
1834
+ const files = (options.files ?? []).map((p) => realpathSync3(resolve6(this.root, p)));
1833
1835
  const d = {
1834
1836
  agentId,
1835
1837
  release: packageVersion,
@@ -1890,7 +1892,7 @@ var AgentService = class {
1890
1892
  requireThat(this.alive(id) && this.#starting.get(id)?.stage !== "validate" && !this.files.read(id, "launch.json", launch).stop, "worker \u5DF2\u505C\u6B62\u6216\u4ECD\u5728\u6062\u590D\u6821\u9A8C\uFF0C\u8BF7\u7B49\u5F85\u663E\u5F0F\u6062\u590D\u5B8C\u6210\u3002");
1891
1893
  const view = this.view(d, owner);
1892
1894
  requireThat(!(delivery === "steer" && view.state !== "idle"), "\u8BE5 ACP worker \u8FD0\u884C\u4E2D\u4E0D\u652F\u6301 steer\uFF1B\u8BF7\u7528 delivery: followUp \u6392\u961F\u3002");
1893
- const files = attachments.map((path) => realpathSync3(resolve5(this.root, path)));
1895
+ const files = attachments.map((path) => realpathSync3(resolve6(this.root, path)));
1894
1896
  const request = this.files.enqueue(id, text3, delivery, files);
1895
1897
  return { ...this.view(d, owner), requestId: request.requestId, messageStatus: "queued" };
1896
1898
  });
@@ -2087,7 +2089,7 @@ var AgentService = class {
2087
2089
  // src/storage/history-files.ts
2088
2090
  import { spawnSync as spawnSync2 } from "node:child_process";
2089
2091
  import { linkSync as linkSync2, lstatSync as lstatSync3, mkdirSync as mkdirSync4, readdirSync as readdirSync2, readFileSync as readFileSync3, realpathSync as realpathSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync2 } from "node:fs";
2090
- import { basename as basename2, dirname as dirname3, join as join9, relative as relative2, resolve as resolve6 } from "node:path";
2092
+ import { basename as basename2, dirname as dirname3, join as join9, relative as relative2, resolve as resolve7 } from "node:path";
2091
2093
  import { isDeepStrictEqual } from "node:util";
2092
2094
 
2093
2095
  // src/storage/history-format.ts
@@ -2180,8 +2182,8 @@ function ensureDirectory(path) {
2180
2182
  const first = mkdirSync4(path, { recursive: true, mode: 448 });
2181
2183
  requireThat(sharedDirectory(path), "\u65E0\u6CD5\u521B\u5EFA\u5386\u53F2\u76EE\u5F55\uFF1A" + path);
2182
2184
  if (first) {
2183
- const existing = dirname3(resolve6(first));
2184
- for (let child = resolve6(path); child !== existing && child !== dirname3(child); child = dirname3(child)) {
2185
+ const existing = dirname3(resolve7(first));
2186
+ for (let child = resolve7(path); child !== existing && child !== dirname3(child); child = dirname3(child)) {
2185
2187
  syncDirectory(realpathSync4(dirname3(child)));
2186
2188
  }
2187
2189
  }
@@ -2313,7 +2315,7 @@ function findCandidateJsonFiles(directory, query, layout = "monthly", depth = "m
2313
2315
  for (const line of result.stdout.split(/\r?\n/)) {
2314
2316
  const trimmedLine = line.trim();
2315
2317
  if (!trimmedLine) continue;
2316
- const rel = relative2(base, resolve6(trimmedLine)).replaceAll("\\", "/");
2318
+ const rel = relative2(base, resolve7(trimmedLine)).replaceAll("\\", "/");
2317
2319
  if (layout === "flat") {
2318
2320
  if (!rel.includes("/") && rel.endsWith(".json")) matched2.push(rel);
2319
2321
  } else if (relativePattern.test(rel)) {
@@ -3030,7 +3032,7 @@ import { setTimeout as delay2 } from "node:timers/promises";
3030
3032
 
3031
3033
  // src/services/workspace/workspace-mcp.ts
3032
3034
  import { mkdir as mkdir2, readFile as readFile3 } from "node:fs/promises";
3033
- import { dirname as dirname5, join as join12, resolve as resolve7 } from "node:path";
3035
+ import { dirname as dirname5, join as join12, resolve as resolve8 } from "node:path";
3034
3036
  var serverNamePattern = /^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;
3035
3037
  var reservedServerNames = /* @__PURE__ */ new Set(["pbot"]);
3036
3038
  var stdioKeys = /* @__PURE__ */ new Set(["command", "args", "env", "cwd", "description", "timeout", "enabled"]);
@@ -3184,7 +3186,7 @@ function resolveWorkspaceMcpServer(root, name, server, env = process.env) {
3184
3186
  }
3185
3187
  const command = expandEnvTemplate(server.command, env, `MCP \u670D\u52A1 "${name}" \u7684 command`);
3186
3188
  const args = (server.args ?? []).map((arg, index) => expandEnvTemplate(arg, env, `MCP \u670D\u52A1 "${name}" \u7684 args[${index}]`));
3187
- const cwd = server.cwd ? resolve7(root, expandEnvTemplate(server.cwd, env, `MCP \u670D\u52A1 "${name}" \u7684 cwd`)) : root;
3189
+ const cwd = server.cwd ? resolve8(root, expandEnvTemplate(server.cwd, env, `MCP \u670D\u52A1 "${name}" \u7684 cwd`)) : root;
3188
3190
  return {
3189
3191
  transport: "stdio",
3190
3192
  name,