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
@@ -24,7 +24,7 @@ export async function apply(ctx) {
24
24
  if (source === "resume")
25
25
  agent.inbox.clear();
26
26
  const reference = member.files.reference(member.id);
27
- requireThat(reference.host === "acp" && reference.backend === "dsh" && agent.session.header.cwd === member.d.cwd &&
27
+ requireThat(reference.host === "acp" && reference.backend === "dsh" && agent.session.header.cwd === member.d.workspace &&
28
28
  (reference.sessionId === null || reference.sessionId === agent.id), "dsh ACP 会话身份或工作目录不匹配。");
29
29
  await agent.ctx.plugin({ name: "pbot-acp-expert", inject, apply: async (scope) => {
30
30
  if (member.features.skills)
@@ -8,7 +8,6 @@ import { toPiMcpConfig } from "../../../integrations/hosts/pi/mcp.js";
8
8
  import { authorizeMutation } from "../../../services/workspace/workspace-files.js";
9
9
  import { loadNativeWorkspaceServers } from "../workspace-mcp.js";
10
10
  import { resourceRoot } from "../../../common/paths.js";
11
- import { launch } from "../../../storage/agent-files.js";
12
11
  import { requireThat } from "../../../common/validation.js";
13
12
  const isBlockedTool = (name) => name === "pbot_history" || isMcpWorkerTool(name);
14
13
  /** Member resources and authoritative final answers; ACP owns input delivery. */
@@ -18,7 +17,7 @@ export default async function piAcpMember(pi) {
18
17
  let input, startLeaf = null;
19
18
  const checkSession = (ctx) => {
20
19
  const reference = member.files.reference(member.id);
21
- requireThat(reference.host === "acp" && reference.backend === "pi" && realpathSync(ctx.cwd) === member.d.cwd &&
20
+ requireThat(reference.host === "acp" && reference.backend === "pi" && realpathSync(ctx.cwd) === member.d.workspace &&
22
21
  (reference.sessionId === null || reference.sessionId === ctx.sessionManager.getSessionId()), "Pi ACP 会话身份或工作目录不匹配。");
23
22
  };
24
23
  const workspaceMcpServers = [];
@@ -42,7 +41,7 @@ export default async function piAcpMember(pi) {
42
41
  pi.on("session_start", (_event, ctx) => {
43
42
  checkSession(ctx);
44
43
  const active = pi.getActiveTools();
45
- for (const tool of agentFileTools(member.d.cwd, lifetime.signal, async (path, change, signal) => {
44
+ for (const tool of agentFileTools(member.d.workspace, lifetime.signal, async (path, change, signal) => {
46
45
  member.check();
47
46
  await authorizeMutation(member.d.workspace, path, change, async () => false, signal);
48
47
  member.check();
@@ -53,7 +52,7 @@ export default async function piAcpMember(pi) {
53
52
  registeredMcp.push(server.name);
54
53
  }
55
54
  pi.setActiveTools(active.filter(name => !isBlockedTool(name)));
56
- pi.setSessionName(member.files.read(member.id, "launch.json", launch).name);
55
+ pi.setSessionName(member.id.slice(0, 8));
57
56
  startLeaf = ctx.sessionManager.getLeafId();
58
57
  });
59
58
  pi.on("before_agent_start", async (event, ctx) => {
@@ -5,7 +5,6 @@ import { requireThat } from "../../common/validation.js";
5
5
  import { loadWorkspaceContext } from "../../integrations/agent-resources.js";
6
6
  import { recordHistoryCapture } from "../../services/history/history-capture.js";
7
7
  import { historyStartupNotices } from "../../services/history/summary-runner.js";
8
- import { bindWorkspacePlugin, workspacePluginDrift, workspacePluginReleases } from "../../services/workspace/plugin-releases.js";
9
8
  import { readWorkspaceConfig, workspaceFeatures } from "../../services/workspace/workspace-config.js";
10
9
  import { initializeWorkspace } from "../../services/workspace/workspace-preparation.js";
11
10
  import { discoverSkills, discoverWorkspaceSkills } from "../../services/workspace/workspace-skills.js";
@@ -18,7 +17,6 @@ export async function pluginCommand(adapter, args, cwd) {
18
17
  requireThat(["init", "status"].includes(action), adapter.usage);
19
18
  if (action === "init") {
20
19
  await initializeWorkspace(root);
21
- bindWorkspacePlugin(root, adapter.host, process.env.PBOT_PLUGIN_MANIFEST || process.env.PBOT_PLUGIN_VERSION);
22
20
  }
23
21
  const configuration = await readWorkspaceConfig(root);
24
22
  return { version: packageVersion, workspaceRoot: root, resourceRoot, configuration };
@@ -62,8 +60,6 @@ export async function pluginHook(adapter, payload, replay) {
62
60
  }
63
61
  if (!configuration.enabled)
64
62
  return adapter.formatPass(payload);
65
- if (event.kind === "inject-context")
66
- bindWorkspacePlugin(root, adapter.host, process.env.PBOT_PLUGIN_MANIFEST || process.env.PBOT_PLUGIN_VERSION);
67
63
  if (features.history && adapter.extractHistory) {
68
64
  try {
69
65
  const capture = await adapter.extractHistory(event);
@@ -84,20 +80,13 @@ export async function pluginHook(adapter, payload, replay) {
84
80
  workspaceSkills.push(...await discoverSkills(directory, directory));
85
81
  }
86
82
  const notices = event.isSessionStart && features.history ? [...historyStartupNotices(root)] : [];
87
- if (event.isSessionStart) {
88
- const drift = workspacePluginDrift(workspacePluginReleases(root));
89
- if (drift.outOfSync) {
90
- const summary = Object.entries(drift.versions).map(([host, version]) => `${host}=${version}`).join(", ");
91
- notices.push(`检测到当前工作区各宿主 Personal Bot 插件版本不一致(${summary}),可在终端运行 pbot upgrade 统一升级。`);
92
- }
93
- }
94
83
  if (!includePrompts && !workspaceSkills.length && !notices.length)
95
84
  return adapter.formatPass(payload);
96
85
  const context = await loadWorkspaceContext({
97
86
  host: adapter.host,
98
87
  root,
99
88
  role: event.role,
100
- ...(adapter.coordinatorPrompt ? { coordinatorPrompt: adapter.coordinatorPrompt } : {}),
89
+ coordinatorPrompt: adapter.coordinatorPrompt ?? (features.history ? "plugin-coordinator.md" : null),
101
90
  includePrompts,
102
91
  includeRootAgents: includePrompts && !adapter.nativeRootAgents,
103
92
  ...(event.localRoleOnly ? { localRoleOnly: true } : {}),