personal-bot 0.3.1 → 0.3.3

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 (436) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/DISCLAIMER.md +17 -0
  4. package/LICENSE +21 -0
  5. package/README.md +15 -5
  6. package/README.zh-CN.md +15 -5
  7. package/bin/pbot-pi-acp.mjs +27 -11
  8. package/bin/pbot.mjs +22 -2
  9. package/docs/README.md +3 -1
  10. package/docs/architecture/design.md +37 -24
  11. package/docs/architecture/extensibility.md +27 -19
  12. package/docs/architecture/model-context.md +4 -3
  13. package/docs/architecture/principles.md +5 -4
  14. package/docs/guides/capabilities.md +4 -4
  15. package/docs/guides/cross-harness-workers.md +3 -1
  16. package/docs/guides/history.md +73 -16
  17. package/docs/guides/workspace-configuration.md +35 -6
  18. package/docs/hosts/antigravity.md +2 -0
  19. package/docs/hosts/claude-code.md +1 -1
  20. package/docs/hosts/codex-qoder.md +63 -0
  21. package/docs/hosts/dsh.md +1 -1
  22. package/docs/hosts/pi.md +1 -1
  23. package/docs/maintainers/architecture-governance.md +78 -0
  24. package/hooks/hooks.json +3 -0
  25. package/lib/antigravity-plugin/DISCLAIMER.md +17 -0
  26. package/lib/antigravity-plugin/LICENSE +21 -0
  27. package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +36 -0
  28. package/lib/antigravity-plugin/hooks.json +7 -0
  29. package/lib/antigravity-plugin/lib/claude.js +2 -2
  30. package/lib/antigravity-plugin/lib/common/files.d.ts +2 -0
  31. package/lib/antigravity-plugin/lib/common/files.js +44 -0
  32. package/lib/antigravity-plugin/lib/common/validation.d.ts +4 -0
  33. package/lib/antigravity-plugin/lib/common/validation.js +8 -0
  34. package/lib/{extension/acp-member.d.ts → antigravity-plugin/lib/extension/acp/member.d.ts} +5 -5
  35. package/lib/{extension/acp-member.js → antigravity-plugin/lib/extension/acp/member.js} +6 -6
  36. package/lib/antigravity-plugin/lib/extension/acp-worker.js +222 -51
  37. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
  38. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.js +22 -0
  39. package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/acp-member.js +11 -25
  40. package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/files.js +3 -3
  41. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.d.ts +3 -0
  42. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +100 -0
  43. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.d.ts +12 -0
  44. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +101 -0
  45. package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.d.ts +6 -0
  46. package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.js +21 -0
  47. package/lib/antigravity-plugin/lib/extension/mcp.js +2705 -1348
  48. package/lib/antigravity-plugin/lib/extension/workspace-cli.js +20127 -0
  49. package/lib/antigravity-plugin/lib/integrations/agent-resources.d.ts +1 -0
  50. package/lib/antigravity-plugin/lib/integrations/agent-resources.js +6 -2
  51. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
  52. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity/adapter.js +171 -0
  53. package/lib/antigravity-plugin/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
  54. package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +36 -0
  55. package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.d.ts +2 -0
  56. package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.js +14 -0
  57. package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/mcp.d.ts +1 -1
  58. package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/resources.d.ts +1 -1
  59. package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/resources.js +4 -4
  60. package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/skills.js +1 -1
  61. package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
  62. package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.js +32 -0
  63. package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.d.ts +4 -0
  64. package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.js +23 -0
  65. package/lib/antigravity-plugin/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +1 -0
  66. package/lib/{integrations/hosts/registry.js → antigravity-plugin/lib/integrations/hosts/plugin-registry.js} +10 -3
  67. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
  68. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +76 -0
  69. package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
  70. package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.js +16 -0
  71. package/lib/antigravity-plugin/lib/model/acp.d.ts +7 -3
  72. package/lib/antigravity-plugin/lib/model/acp.js +8 -0
  73. package/lib/antigravity-plugin/lib/model/agent.d.ts +121 -0
  74. package/lib/antigravity-plugin/lib/model/agent.js +4 -0
  75. package/lib/antigravity-plugin/lib/model/history.d.ts +179 -0
  76. package/lib/antigravity-plugin/lib/model/history.js +4 -0
  77. package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +31 -0
  78. package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +28 -7
  79. package/lib/antigravity-plugin/lib/model/workspace-config.js +2 -1
  80. package/lib/antigravity-plugin/lib/plugin.d.ts +2 -1
  81. package/lib/antigravity-plugin/lib/plugin.js +4 -4
  82. package/lib/antigravity-plugin/lib/services/history/history-capture.d.ts +4 -0
  83. package/lib/antigravity-plugin/lib/services/history/history-capture.js +98 -0
  84. package/lib/antigravity-plugin/lib/services/history/history-index.d.ts +17 -0
  85. package/lib/antigravity-plugin/lib/services/history/history-index.js +112 -0
  86. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
  87. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/monthly.js +121 -0
  88. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.d.ts +7 -0
  89. package/lib/antigravity-plugin/lib/services/history/summary-dimensions/session.js +124 -0
  90. package/lib/antigravity-plugin/lib/services/history/summary-registry.d.ts +7 -0
  91. package/lib/antigravity-plugin/lib/services/history/summary-registry.js +35 -0
  92. package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +34 -0
  93. package/lib/antigravity-plugin/lib/services/history/summary-runner.js +299 -0
  94. package/lib/antigravity-plugin/lib/services/history/workspace-history.d.ts +3 -0
  95. package/lib/antigravity-plugin/lib/services/history/workspace-history.js +6 -0
  96. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +3 -0
  97. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +78 -0
  98. package/lib/antigravity-plugin/lib/services/workspace/workspace-config.d.ts +5 -1
  99. package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +77 -7
  100. package/lib/antigravity-plugin/lib/services/workspace/workspace-files.d.ts +2 -0
  101. package/lib/antigravity-plugin/lib/services/workspace/workspace-files.js +17 -0
  102. package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.d.ts +14 -0
  103. package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.js +193 -0
  104. package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.d.ts +1 -0
  105. package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.js +4 -2
  106. package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +11 -0
  107. package/lib/antigravity-plugin/lib/storage/acp-files.js +75 -0
  108. package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +31 -0
  109. package/lib/antigravity-plugin/lib/storage/agent-files.js +159 -0
  110. package/lib/antigravity-plugin/lib/storage/atomic-json.d.ts +3 -1
  111. package/lib/antigravity-plugin/lib/storage/atomic-json.js +43 -3
  112. package/lib/antigravity-plugin/lib/storage/file-access.d.ts +2 -0
  113. package/lib/antigravity-plugin/lib/storage/file-access.js +26 -0
  114. package/lib/antigravity-plugin/lib/storage/history-files.d.ts +55 -0
  115. package/lib/antigravity-plugin/lib/storage/history-files.js +473 -0
  116. package/lib/antigravity-plugin/lib/storage/history-format.d.ts +5 -0
  117. package/lib/antigravity-plugin/lib/storage/history-format.js +60 -0
  118. package/lib/antigravity-plugin/package.json +1 -1
  119. package/lib/antigravity-plugin/plugin.json +1 -1
  120. package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +13 -0
  121. package/lib/antigravity-plugin/resources/prompts/history-summary.md +13 -0
  122. package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -0
  123. package/lib/antigravity-plugin/resources/skills/.claude-plugin/plugin.json +4 -0
  124. package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +35 -0
  125. package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +52 -0
  126. package/lib/antigravity-plugin/skills/pbot/SKILL.md +11 -1
  127. package/lib/antigravity-plugin/skills/provider-connections/SKILL.md +22 -12
  128. package/lib/claude.js +2 -2
  129. package/lib/client.js +42 -60
  130. package/lib/codex-marketplace/.agents/plugins/marketplace.json +17 -0
  131. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +7 -0
  132. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +17 -0
  133. package/lib/codex-marketplace/plugins/personal-bot/DISCLAIMER.md +17 -0
  134. package/lib/codex-marketplace/plugins/personal-bot/LICENSE +21 -0
  135. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +37 -0
  136. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +9 -0
  137. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/agents/openai.yaml +2 -0
  138. package/lib/common/validation.d.ts +4 -0
  139. package/lib/common/validation.js +8 -0
  140. package/lib/dsh.js +6 -6
  141. package/lib/extension/acp/member.d.ts +18 -0
  142. package/lib/extension/acp/member.js +44 -0
  143. package/lib/extension/acp/worker.js +384 -0
  144. package/lib/extension/acp-worker.js +222 -51
  145. package/lib/extension/history/command.d.ts +37 -0
  146. package/lib/extension/history/command.js +57 -0
  147. package/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
  148. package/lib/extension/hosts/dsh/acp-entry.js +22 -0
  149. package/lib/extension/hosts/dsh/acp-member.d.ts +4 -0
  150. package/lib/extension/hosts/dsh/acp-member.js +58 -0
  151. package/lib/extension/{dsh → hosts/dsh}/command.d.ts +1 -2
  152. package/lib/extension/{dsh → hosts/dsh}/command.js +9 -11
  153. package/lib/extension/hosts/dsh/files.d.ts +5 -0
  154. package/lib/extension/hosts/dsh/files.js +67 -0
  155. package/lib/extension/hosts/dsh/history.d.ts +4 -0
  156. package/lib/extension/hosts/dsh/history.js +62 -0
  157. package/lib/extension/{dsh → hosts/dsh}/management.d.ts +1 -1
  158. package/lib/extension/{dsh → hosts/dsh}/management.js +12 -10
  159. package/lib/extension/{dsh → hosts/dsh}/workspace.d.ts +3 -9
  160. package/lib/extension/{dsh → hosts/dsh}/workspace.js +30 -99
  161. package/lib/extension/hosts/pi/acp-member.d.ts +3 -0
  162. package/lib/extension/hosts/pi/acp-member.js +100 -0
  163. package/lib/extension/hosts/plugin-runtime.d.ts +12 -0
  164. package/lib/extension/hosts/plugin-runtime.js +101 -0
  165. package/lib/extension/hosts/workspace-mcp.d.ts +6 -0
  166. package/lib/extension/hosts/workspace-mcp.js +21 -0
  167. package/lib/extension/{mcp-bridge.d.ts → mcp/bridge.d.ts} +7 -9
  168. package/lib/extension/{mcp-bridge.js → mcp/bridge.js} +70 -88
  169. package/lib/extension/{mcp-workers.d.ts → mcp/tool-contract.d.ts} +129 -374
  170. package/lib/extension/mcp/tool-contract.js +441 -0
  171. package/lib/extension/mcp/workers.d.ts +487 -0
  172. package/lib/extension/mcp/workers.js +598 -0
  173. package/lib/extension/mcp.js +2705 -1348
  174. package/lib/extension/{setup-cli.js → setup/cli.js} +12 -9
  175. package/lib/extension/workspace-cli.js +20127 -0
  176. package/lib/integrations/acp/agents.d.ts +2 -3
  177. package/lib/integrations/acp/connection.d.ts +11 -10
  178. package/lib/integrations/acp/connection.js +6 -0
  179. package/lib/integrations/acp/harnesses/claude.js +1 -1
  180. package/lib/integrations/acp/harnesses/dsh.js +1 -1
  181. package/lib/integrations/acp/harnesses/presets.js +8 -0
  182. package/lib/integrations/acp/history-summary.d.ts +17 -0
  183. package/lib/integrations/acp/history-summary.js +101 -0
  184. package/lib/integrations/acp/launch.d.ts +2 -2
  185. package/lib/integrations/agent-resources.d.ts +1 -0
  186. package/lib/integrations/agent-resources.js +6 -2
  187. package/lib/integrations/hosts/antigravity/adapter.d.ts +6 -0
  188. package/lib/integrations/hosts/antigravity/adapter.js +171 -0
  189. package/lib/integrations/hosts/{claude.d.ts → claude/adapter.d.ts} +1 -1
  190. package/lib/integrations/hosts/claude/adapter.js +36 -0
  191. package/lib/integrations/hosts/codex/adapter.d.ts +2 -0
  192. package/lib/integrations/hosts/codex/adapter.js +14 -0
  193. package/lib/integrations/hosts/dsh/mcp.d.ts +4 -0
  194. package/lib/integrations/hosts/dsh/mcp.js +28 -0
  195. package/lib/integrations/hosts/dsh/messages.d.ts +36 -0
  196. package/lib/integrations/hosts/dsh/messages.js +11 -0
  197. package/lib/integrations/hosts/dsh/resources.d.ts +6 -0
  198. package/lib/integrations/hosts/dsh/resources.js +47 -0
  199. package/lib/integrations/hosts/dsh/root-agents.d.ts +4 -0
  200. package/lib/integrations/hosts/dsh/root-agents.js +3 -0
  201. package/lib/integrations/{dsh → hosts/dsh}/schema.js +1 -1
  202. package/lib/integrations/hosts/dsh/skills.d.ts +8 -0
  203. package/lib/integrations/hosts/dsh/skills.js +31 -0
  204. package/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
  205. package/lib/integrations/hosts/pi/agent-tools.js +32 -0
  206. package/lib/integrations/hosts/pi/mcp.d.ts +4 -0
  207. package/lib/integrations/hosts/pi/mcp.js +23 -0
  208. package/lib/integrations/hosts/{registry.d.ts → plugin-registry.d.ts} +1 -0
  209. package/lib/{antigravity-plugin/lib/integrations/hosts/registry.js → integrations/hosts/plugin-registry.js} +10 -3
  210. package/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
  211. package/lib/integrations/hosts/prompt-hooks.js +76 -0
  212. package/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
  213. package/lib/integrations/hosts/qoder/adapter.js +16 -0
  214. package/lib/integrations/installation/pi-setup.js +1 -1
  215. package/lib/model/acp.d.ts +7 -3
  216. package/lib/model/acp.js +8 -0
  217. package/lib/model/agent.d.ts +18 -4
  218. package/lib/model/agent.js +4 -1
  219. package/lib/model/history.d.ts +143 -34
  220. package/lib/model/history.js +4 -1
  221. package/lib/model/installation.js +1 -0
  222. package/lib/model/plugin-host.d.ts +31 -0
  223. package/lib/model/workspace-config.d.ts +28 -7
  224. package/lib/model/workspace-config.js +2 -1
  225. package/lib/plugin.d.ts +2 -1
  226. package/lib/plugin.js +4 -4
  227. package/lib/qoder-plugin/.mcp.json +17 -0
  228. package/lib/qoder-plugin/.qoder-plugin/plugin.json +7 -0
  229. package/lib/qoder-plugin/DISCLAIMER.md +17 -0
  230. package/lib/qoder-plugin/LICENSE +21 -0
  231. package/lib/qoder-plugin/hooks/hooks.json +37 -0
  232. package/lib/qoder-plugin/skills/pbot/SKILL.md +9 -0
  233. package/lib/services/agents/agent-run.d.ts +1 -1
  234. package/lib/services/agents/agent-service.d.ts +15 -45
  235. package/lib/services/agents/agent-service.js +22 -3
  236. package/lib/services/history/history-capture.d.ts +4 -0
  237. package/lib/services/history/history-capture.js +98 -0
  238. package/lib/services/history/history-index.d.ts +16 -7
  239. package/lib/services/history/history-index.js +48 -70
  240. package/lib/services/history/history-migrate.d.ts +12 -0
  241. package/lib/services/history/history-migrate.js +54 -0
  242. package/lib/services/history/history-query.d.ts +51 -0
  243. package/lib/services/history/history-query.js +352 -0
  244. package/lib/services/history/summary-command.d.ts +20 -0
  245. package/lib/services/history/summary-command.js +69 -0
  246. package/lib/services/history/summary-dimensions/monthly.d.ts +7 -0
  247. package/lib/services/history/summary-dimensions/monthly.js +121 -0
  248. package/lib/services/history/summary-dimensions/session.d.ts +7 -0
  249. package/lib/services/history/summary-dimensions/session.js +124 -0
  250. package/lib/services/history/summary-registry.d.ts +7 -0
  251. package/lib/services/history/summary-registry.js +35 -0
  252. package/lib/services/history/summary-runner.d.ts +34 -0
  253. package/lib/services/history/summary-runner.js +299 -0
  254. package/lib/services/history/workspace-history.d.ts +3 -0
  255. package/lib/services/history/workspace-history.js +6 -0
  256. package/lib/services/workspace/plugin-releases.d.ts +3 -0
  257. package/lib/services/workspace/plugin-releases.js +78 -0
  258. package/lib/services/workspace/workspace-config.d.ts +5 -1
  259. package/lib/services/workspace/workspace-config.js +77 -7
  260. package/lib/services/workspace/workspace-mcp.js +22 -29
  261. package/lib/services/workspace/workspace-skills.d.ts +1 -0
  262. package/lib/services/workspace/workspace-skills.js +4 -2
  263. package/lib/storage/acp-files.js +7 -12
  264. package/lib/storage/agent-files.js +6 -5
  265. package/lib/storage/atomic-json.d.ts +3 -1
  266. package/lib/storage/atomic-json.js +43 -3
  267. package/lib/storage/history-files.d.ts +46 -9
  268. package/lib/storage/history-files.js +382 -250
  269. package/lib/storage/history-format.d.ts +3 -13
  270. package/lib/storage/history-format.js +26 -52
  271. package/lib/tools/history/actions.d.ts +3 -68
  272. package/lib/tools/history/actions.js +7 -5
  273. package/lib/tools/history/contract.d.ts +16 -17
  274. package/lib/tools/history/contract.js +63 -22
  275. package/lib/tools/history/dsh-tool.d.ts +1 -2
  276. package/lib/tools/history/dsh-tool.js +11 -5
  277. package/lib/ui/dsh/elements.d.ts +2 -5
  278. package/lib/ui/dsh/elements.js +3 -16
  279. package/lib/ui/dsh/management.js +26 -13
  280. package/lib/ui/dsh/styles.d.ts +1 -1
  281. package/lib/ui/dsh/styles.js +5 -33
  282. package/package.json +4 -1
  283. package/resources/antigravity/skills/pbot/SKILL.md +11 -1
  284. package/resources/claude/skills/pbot/SKILL.md +11 -1
  285. package/resources/plugin/skills/pbot/SKILL.md +9 -0
  286. package/resources/prompts/history-coordinator.md +2 -1
  287. package/resources/prompts/history-monthly-summary.md +13 -0
  288. package/resources/prompts/history-summary.md +10 -4
  289. package/resources/prompts/plugin-coordinator.md +1 -0
  290. package/resources/skills/provider-connections/SKILL.md +22 -12
  291. package/scripts/README.md +3 -2
  292. package/src/claude.ts +2 -2
  293. package/src/common/validation.ts +10 -0
  294. package/src/dsh.ts +6 -6
  295. package/src/extension/{acp-member.ts → acp/member.ts} +7 -7
  296. package/src/extension/{acp-worker.ts → acp/worker.ts} +131 -17
  297. package/src/extension/history/command.ts +68 -0
  298. package/src/extension/hosts/dsh/acp-entry.ts +21 -0
  299. package/src/extension/{dsh → hosts/dsh}/acp-member.ts +12 -23
  300. package/src/extension/{dsh → hosts/dsh}/command.ts +10 -12
  301. package/src/extension/{dsh → hosts/dsh}/files.ts +3 -3
  302. package/src/extension/hosts/dsh/history.ts +67 -0
  303. package/src/extension/{dsh → hosts/dsh}/management.ts +11 -9
  304. package/src/extension/{dsh → hosts/dsh}/workspace.ts +31 -76
  305. package/src/extension/{pi-acp-member.ts → hosts/pi/acp-member.ts} +12 -18
  306. package/src/extension/{command.ts → hosts/pi/command.ts} +44 -11
  307. package/src/extension/{events.ts → hosts/pi/events.ts} +8 -4
  308. package/src/extension/hosts/pi/history.ts +45 -0
  309. package/src/extension/{lifecycle.ts → hosts/pi/lifecycle.ts} +9 -12
  310. package/src/extension/hosts/plugin-runtime.ts +96 -0
  311. package/src/extension/hosts/workspace-mcp.ts +25 -0
  312. package/src/extension/{mcp-bridge.ts → mcp/bridge.ts} +85 -85
  313. package/src/extension/mcp/tool-contract.ts +462 -0
  314. package/src/extension/{mcp-workers.ts → mcp/workers.ts} +151 -448
  315. package/src/extension/{setup-cli.ts → setup/cli.ts} +14 -11
  316. package/src/extension/setup/workspace-cli.ts +159 -0
  317. package/src/integrations/acp/agents.ts +2 -3
  318. package/src/integrations/acp/connection.ts +6 -0
  319. package/src/integrations/acp/harnesses/claude.ts +1 -1
  320. package/src/integrations/acp/harnesses/dsh.ts +1 -1
  321. package/src/integrations/acp/harnesses/presets.ts +8 -0
  322. package/src/integrations/acp/history-summary.ts +109 -0
  323. package/src/integrations/agent-resources.ts +7 -1
  324. package/src/integrations/hosts/antigravity/adapter.ts +161 -0
  325. package/src/integrations/hosts/claude/adapter.ts +39 -0
  326. package/src/integrations/hosts/codex/adapter.ts +16 -0
  327. package/src/integrations/{dsh → hosts/dsh}/mcp.ts +1 -1
  328. package/src/integrations/{dsh → hosts/dsh}/resources.ts +5 -5
  329. package/src/integrations/{dsh → hosts/dsh}/schema.ts +1 -1
  330. package/src/integrations/{dsh → hosts/dsh}/session.ts +2 -2
  331. package/src/integrations/{dsh → hosts/dsh}/skills.ts +1 -1
  332. package/src/integrations/{pi → hosts/pi}/mcp.ts +1 -1
  333. package/src/integrations/{pi → hosts/pi}/skills.ts +1 -1
  334. package/src/integrations/hosts/{registry.ts → plugin-registry.ts} +11 -3
  335. package/src/integrations/hosts/prompt-hooks.ts +72 -0
  336. package/src/integrations/hosts/qoder/adapter.ts +19 -0
  337. package/src/integrations/installation/cli-update.ts +116 -0
  338. package/src/integrations/installation/pi-bridge.ts +1 -1
  339. package/src/integrations/installation/pi-setup.ts +2 -2
  340. package/src/integrations/installation/processes.ts +1 -1
  341. package/src/mcp.ts +1 -1
  342. package/src/model/acp.ts +11 -3
  343. package/src/model/agent.ts +20 -4
  344. package/src/model/history.ts +156 -26
  345. package/src/model/installation.ts +41 -0
  346. package/src/model/plugin-host.ts +30 -2
  347. package/src/model/workspace-config.ts +31 -7
  348. package/src/pbot.ts +22 -50
  349. package/src/plugin.ts +4 -4
  350. package/src/services/agents/agent-service.ts +29 -17
  351. package/src/services/history/history-capture.ts +91 -0
  352. package/src/services/history/history-index.ts +48 -62
  353. package/src/services/history/history-migrate.ts +62 -0
  354. package/src/services/history/history-query.ts +401 -0
  355. package/src/services/history/summary-command.ts +70 -0
  356. package/src/services/history/summary-dimensions/monthly.ts +139 -0
  357. package/src/services/history/summary-dimensions/session.ts +149 -0
  358. package/src/services/history/summary-registry.ts +43 -0
  359. package/src/services/history/summary-runner.ts +343 -0
  360. package/src/services/history/workspace-history.ts +8 -0
  361. package/src/services/installation/setup-service.ts +2 -41
  362. package/src/services/workspace/plugin-releases.ts +68 -0
  363. package/src/services/workspace/workspace-config.ts +95 -8
  364. package/src/services/workspace/workspace-mcp.ts +23 -28
  365. package/src/services/workspace/workspace-skills.ts +5 -2
  366. package/src/storage/acp-files.ts +7 -12
  367. package/src/storage/agent-files.ts +6 -5
  368. package/src/storage/atomic-json.ts +31 -4
  369. package/src/storage/history-files.ts +416 -189
  370. package/src/storage/history-format.ts +45 -61
  371. package/src/tools/history/actions.ts +8 -6
  372. package/src/tools/history/contract.ts +70 -25
  373. package/src/tools/history/dsh-tool.ts +17 -8
  374. package/src/tools/history/pi-tool.ts +23 -0
  375. package/src/ui/dsh/elements.ts +5 -12
  376. package/src/ui/dsh/management.ts +36 -20
  377. package/src/ui/dsh/styles.ts +5 -33
  378. package/src/ui/{confirmation.ts → pi/confirmation.ts} +1 -1
  379. package/lib/antigravity-plugin/lib/extension/plugin-runtime.d.ts +0 -10
  380. package/lib/antigravity-plugin/lib/extension/plugin-runtime.js +0 -67
  381. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.d.ts +0 -4
  382. package/lib/antigravity-plugin/lib/integrations/hosts/antigravity.js +0 -79
  383. package/lib/antigravity-plugin/lib/integrations/hosts/claude.js +0 -60
  384. package/lib/extension/dsh/history.d.ts +0 -15
  385. package/lib/extension/dsh/history.js +0 -87
  386. package/lib/extension/mcp-workers.js +0 -882
  387. package/lib/extension/plugin-runtime.d.ts +0 -10
  388. package/lib/extension/plugin-runtime.js +0 -67
  389. package/lib/integrations/dsh/history-summary.d.ts +0 -11
  390. package/lib/integrations/dsh/history-summary.js +0 -36
  391. package/lib/integrations/dsh/history.d.ts +0 -16
  392. package/lib/integrations/dsh/history.js +0 -167
  393. package/lib/integrations/history-summary.d.ts +0 -4
  394. package/lib/integrations/history-summary.js +0 -32
  395. package/lib/integrations/hosts/antigravity.d.ts +0 -4
  396. package/lib/integrations/hosts/antigravity.js +0 -79
  397. package/lib/integrations/hosts/claude.js +0 -60
  398. package/lib/services/history/history-service.d.ts +0 -106
  399. package/lib/services/history/history-service.js +0 -242
  400. package/lib/storage/acp-history.d.ts +0 -10
  401. package/lib/storage/acp-history.js +0 -57
  402. package/lib/ui/presentation.d.ts +0 -3
  403. package/lib/ui/presentation.js +0 -12
  404. package/src/extension/dsh/history.ts +0 -74
  405. package/src/extension/history.ts +0 -26
  406. package/src/extension/plugin-runtime.ts +0 -63
  407. package/src/integrations/dsh/history-summary.ts +0 -39
  408. package/src/integrations/dsh/history.ts +0 -84
  409. package/src/integrations/history-summary.ts +0 -30
  410. package/src/integrations/hosts/antigravity.ts +0 -83
  411. package/src/integrations/hosts/claude.ts +0 -62
  412. package/src/integrations/pi/history.ts +0 -99
  413. package/src/services/history/history-service.ts +0 -195
  414. package/src/storage/acp-history.ts +0 -49
  415. package/src/tools/access.ts +0 -7
  416. package/src/tools/history/tool.ts +0 -19
  417. package/src/tools/register.ts +0 -22
  418. package/src/ui/presentation.ts +0 -12
  419. /package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/acp-member.d.ts +0 -0
  420. /package/lib/{extension → antigravity-plugin/lib/extension/hosts}/dsh/files.d.ts +0 -0
  421. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/mcp.js +0 -0
  422. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/messages.d.ts +0 -0
  423. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/messages.js +0 -0
  424. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/root-agents.d.ts +0 -0
  425. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/root-agents.js +0 -0
  426. /package/lib/{integrations → antigravity-plugin/lib/integrations/hosts}/dsh/skills.d.ts +0 -0
  427. /package/lib/extension/{acp-worker.d.ts → acp/worker.d.ts} +0 -0
  428. /package/lib/extension/{setup-guard.js → setup/guard.js} +0 -0
  429. /package/lib/integrations/acp/{claude.d.ts → claude-settings.d.ts} +0 -0
  430. /package/lib/integrations/acp/{claude.js → claude-settings.js} +0 -0
  431. /package/lib/integrations/{dsh → hosts/dsh}/schema.d.ts +0 -0
  432. /package/src/extension/{setup-guard.ts → setup/guard.ts} +0 -0
  433. /package/src/integrations/acp/{claude.ts → claude-settings.ts} +0 -0
  434. /package/src/integrations/{dsh → hosts/dsh}/messages.ts +0 -0
  435. /package/src/integrations/{dsh → hosts/dsh}/root-agents.ts +0 -0
  436. /package/src/integrations/{pi → hosts/pi}/agent-tools.ts +0 -0
@@ -1,3 +1,6 @@
1
+ import type { HistoryLayout } from "./workspace-config.js";
2
+ export type { HistoryLayout };
3
+ export type HistoryHost = string;
1
4
  export interface HistoryExchange {
2
5
  entryIds: string[];
3
6
  text: string;
@@ -23,44 +26,25 @@ export interface RawHistory extends HistoryIdentity {
23
26
  exchanges: (HistoryExchange & {
24
27
  id: string;
25
28
  })[];
26
- /** Ordered paths observed in the native source. Legacy exchanges can have no known path. */
29
+ /** Ordered paths observed in the native source. */
27
30
  branches: string[][];
28
31
  }
29
- export interface HistorySummary extends HistoryExchange {
30
- id: string;
31
- level: number;
32
- children: string[];
33
- ready: boolean;
34
- }
35
- export interface HistoryArchive {
36
- raw: RawHistory;
37
- /** Empty if absent; null if the derived file is unreadable. */
38
- summaries: HistorySummary[] | null;
39
- }
40
- export interface HistoryNode extends HistorySummary {
41
- kind: "session" | "exchange" | "summary";
42
- parents: string[];
32
+ export interface SummarySource {
33
+ rawIds: string[];
34
+ exchangeIds: string[];
35
+ fingerprint: string;
43
36
  }
44
- /** Query view and legacy on-disk format. New writers persist raw exchanges and summaries separately. */
45
- export interface HistoryRecord extends HistoryIdentity {
46
- name: string;
47
- nodes: HistoryNode[];
48
- }
49
- export type HistoryHost = "pi" | "dsh" | "claude";
50
- export type HistoryLocation = {
51
- host: "pi";
52
- directory: string;
53
- file?: string;
54
- } | {
55
- host: "dsh";
37
+ export interface SummaryArtifact {
38
+ id: string;
39
+ dimension: string;
40
+ host?: HistoryHost;
56
41
  sessionId?: string;
57
- };
58
- export interface HistorySource {
59
- readonly host: HistoryLocation["host"];
60
- scan(location: HistoryLocation, signal?: AbortSignal, excluded?: ReadonlySet<string>): Promise<{
61
- sessions: HistorySession[];
62
- warnings: string[];
63
- }>;
42
+ title: string;
43
+ text: string;
44
+ from: string;
45
+ to: string;
46
+ updatedAt: string;
47
+ source: SummarySource;
64
48
  }
65
49
  export interface HistorySummaryRequest {
66
50
  system: string;
@@ -68,3 +52,128 @@ export interface HistorySummaryRequest {
68
52
  maxTokens: number;
69
53
  }
70
54
  export type HistorySummarizer = (request: HistorySummaryRequest, signal: AbortSignal) => Promise<string>;
55
+ export type SummaryTaskMode = "create" | "incremental" | "rebuild";
56
+ export interface SummaryTask {
57
+ id: string;
58
+ dimension: string;
59
+ mode: SummaryTaskMode;
60
+ title: string;
61
+ host?: HistoryHost;
62
+ sessionId?: string;
63
+ from: string;
64
+ to: string;
65
+ source: SummarySource;
66
+ exchanges: readonly (HistoryExchange & {
67
+ id: string;
68
+ })[];
69
+ existing?: SummaryArtifact;
70
+ addedExchanges?: readonly (HistoryExchange & {
71
+ id: string;
72
+ })[];
73
+ sourceSummaries?: readonly SummaryArtifact[];
74
+ }
75
+ export interface SummaryPlanOptions {
76
+ force?: boolean;
77
+ summariesByDimension?: ReadonlyMap<string, ReadonlyMap<string, SummaryArtifact>>;
78
+ }
79
+ export interface SummaryPlanResult {
80
+ tasks: SummaryTask[];
81
+ skipped: number;
82
+ }
83
+ export interface SummaryDimension {
84
+ readonly id: string;
85
+ readonly title: string;
86
+ readonly description: string;
87
+ readonly requiresMonthlyLayout?: boolean;
88
+ plan(raws: readonly RawHistory[], existing: ReadonlyMap<string, SummaryArtifact>, options?: SummaryPlanOptions): SummaryPlanResult;
89
+ buildRequest(task: SummaryTask): HistorySummaryRequest;
90
+ finalize(task: SummaryTask, output: string, now: string): SummaryArtifact;
91
+ }
92
+ export interface HistoryMigrationItem {
93
+ kind: "raw" | "summary";
94
+ dimension?: string;
95
+ id: string;
96
+ from: string;
97
+ to: string;
98
+ }
99
+ export interface HistoryMigrationConflict {
100
+ kind: "raw" | "summary";
101
+ dimension?: string;
102
+ from: string;
103
+ to: string;
104
+ reason: string;
105
+ }
106
+ export interface HistoryMigrationReport {
107
+ layout: HistoryLayout;
108
+ dryRun: boolean;
109
+ moved: HistoryMigrationItem[];
110
+ skipped: HistoryMigrationConflict[];
111
+ errors: {
112
+ path: string;
113
+ error: string;
114
+ }[];
115
+ }
116
+ export interface SummaryDimensionStatus {
117
+ dimension: string;
118
+ title: string;
119
+ description: string;
120
+ total: number;
121
+ ready: number;
122
+ pendingCreate: number;
123
+ pendingIncremental: number;
124
+ pendingRebuild: number;
125
+ }
126
+ export interface HistorySummaryReminder {
127
+ rawCount: number;
128
+ pendingCount: number;
129
+ oldestRawAt: string;
130
+ latestSummaryAt?: string;
131
+ rawAgeDays: number;
132
+ daysSinceLastSummary?: number;
133
+ thresholdDays: number;
134
+ message: string;
135
+ }
136
+ export interface SummaryRunProgress {
137
+ dimension: string;
138
+ completed: number;
139
+ total: number;
140
+ currentId: string;
141
+ mode: SummaryTaskMode;
142
+ }
143
+ export interface SummaryDimensionReport {
144
+ dimension: string;
145
+ scanned: number;
146
+ skipped: number;
147
+ created: number;
148
+ incremental: number;
149
+ rebuilt: number;
150
+ failed: {
151
+ id: string;
152
+ error: string;
153
+ }[];
154
+ }
155
+ export interface SummaryRunReport {
156
+ dimensions: SummaryDimensionReport[];
157
+ durationMs: number;
158
+ warnings: string[];
159
+ }
160
+ export declare const historyPageLimits: {
161
+ readonly search: {
162
+ readonly default: 20;
163
+ readonly max: 50;
164
+ };
165
+ readonly read: {
166
+ readonly default: 12000;
167
+ readonly max: 24000;
168
+ };
169
+ };
170
+ export interface HistoryQuery {
171
+ host?: HistoryHost;
172
+ query?: string;
173
+ sessionId?: string;
174
+ dimension?: string;
175
+ from?: string;
176
+ to?: string;
177
+ offset?: number;
178
+ limit?: number;
179
+ }
@@ -1 +1,4 @@
1
- export {};
1
+ export const historyPageLimits = {
2
+ search: { default: 20, max: 50 },
3
+ read: { default: 12_000, max: 24_000 },
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { HistorySession } from "./history.js";
1
2
  import type { WorkspaceSkillMeta } from "./workspace-mcp.js";
2
3
  export type HostId = string;
3
4
  export type PluginHostId = string;
@@ -15,12 +16,33 @@ export interface WorkspaceContext {
15
16
  environment: WorkspaceEnvironment;
16
17
  text: string;
17
18
  }
19
+ export type HistoryCapture = {
20
+ kind: "input";
21
+ sessionId: string;
22
+ turnId?: string;
23
+ text: string;
24
+ timestamp?: string;
25
+ } | {
26
+ kind: "answer";
27
+ sessionId: string;
28
+ turnId?: string;
29
+ userText?: string;
30
+ assistantText: string;
31
+ completed: boolean;
32
+ isContinuation?: boolean;
33
+ timestamp?: string;
34
+ } | {
35
+ kind: "session";
36
+ session: HistorySession;
37
+ };
18
38
  export type HostEvent = {
19
39
  kind: "ignore";
20
40
  } | {
21
41
  kind: "inject-context";
22
42
  role: WorkspaceRole;
23
43
  localRoleOnly?: boolean;
44
+ isSessionStart?: boolean;
45
+ noticesOnly?: boolean;
24
46
  cwd: string;
25
47
  raw: unknown;
26
48
  } | {
@@ -28,16 +50,25 @@ export type HostEvent = {
28
50
  skill: string;
29
51
  cwd: string;
30
52
  raw: unknown;
53
+ } | {
54
+ kind: "record-history";
55
+ cwd: string;
56
+ raw: unknown;
31
57
  };
32
58
  export interface PluginHostAdapter {
33
59
  readonly host: PluginHostId;
34
60
  readonly nativeRootAgents: boolean;
61
+ readonly indexBundledSkills?: boolean;
35
62
  readonly nativeWorkspaceSkills?: boolean;
36
63
  readonly coordinatorPrompt?: string;
37
64
  readonly initCommandHint: string;
38
65
  readonly usage: string;
66
+ boundWorkspaceRoot?(): string | undefined;
39
67
  resolveRoot(cwd: string, rawPayload?: unknown): Promise<string>;
40
68
  parseEvent(payload: unknown): HostEvent;
69
+ extractHistory?(event: Extract<HostEvent, {
70
+ kind: "inject-context" | "record-history";
71
+ }>): Promise<HistoryCapture | undefined>;
41
72
  formatPass(payload: unknown): Record<string, unknown>;
42
73
  formatContext(event: Extract<HostEvent, {
43
74
  kind: "inject-context";
@@ -3,22 +3,43 @@ export interface WorkspaceFeatures {
3
3
  prompts?: boolean;
4
4
  skills?: boolean;
5
5
  mcp?: boolean;
6
+ history?: boolean;
6
7
  }
7
- export interface ResolvedWorkspaceFeatures {
8
- readonly prompts: boolean;
9
- readonly skills: boolean;
10
- readonly mcp: boolean;
8
+ export type ResolvedWorkspaceFeatures = Readonly<Required<WorkspaceFeatures>>;
9
+ export declare const summaryConcurrency: {
10
+ readonly default: 3;
11
+ readonly max: 8;
12
+ };
13
+ export interface WorkspaceSummaryConfig {
14
+ backend?: string;
15
+ model?: string;
16
+ thinking?: string;
17
+ concurrency?: number;
18
+ }
19
+ export interface ResolvedWorkspaceSummaryConfig {
20
+ readonly backend: string;
21
+ readonly model?: string;
22
+ readonly thinking?: string;
23
+ readonly concurrency: number;
24
+ }
25
+ export declare const historyLayouts: readonly ["monthly", "flat"];
26
+ export type HistoryLayout = typeof historyLayouts[number];
27
+ export interface WorkspaceHistoryConfig {
28
+ layout?: HistoryLayout;
29
+ }
30
+ export interface ResolvedWorkspaceHistoryConfig {
31
+ readonly layout: HistoryLayout;
11
32
  }
12
33
  export interface WorkspaceConfig {
13
34
  enabled?: boolean;
14
35
  features?: WorkspaceFeatures;
15
36
  acp?: AcpCommands;
37
+ summary?: WorkspaceSummaryConfig;
38
+ history?: WorkspaceHistoryConfig;
16
39
  }
17
- export interface WorkspaceConfiguration {
40
+ export interface WorkspaceConfiguration extends WorkspaceConfig {
18
41
  path: string;
19
42
  present: boolean;
20
43
  enabled: boolean;
21
44
  error?: string;
22
- features?: WorkspaceFeatures;
23
- acp?: AcpCommands;
24
45
  }
@@ -1 +1,2 @@
1
- export {};
1
+ export const summaryConcurrency = { default: 3, max: 8 };
2
+ export const historyLayouts = ["monthly", "flat"];
package/lib/plugin.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare function main(args: readonly string[]): Promise<void>;
1
+ import { type ReplayPluginHook } from "./extension/hosts/plugin-runtime.js";
2
+ export declare function main(args: readonly string[], replayHook?: ReplayPluginHook): Promise<void>;
package/lib/plugin.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { realpathSync } from "node:fs";
2
2
  import { pathToFileURL } from "node:url";
3
3
  import { requireThat } from "./common/validation.js";
4
- import { runPluginHost } from "./extension/plugin-runtime.js";
5
- import { listPluginHosts, pluginHosts } from "./integrations/hosts/registry.js";
6
- export async function main(args) {
4
+ import { runPluginHost } from "./extension/hosts/plugin-runtime.js";
5
+ import { listPluginHosts, pluginHosts } from "./integrations/hosts/plugin-registry.js";
6
+ export async function main(args, replayHook) {
7
7
  const [host, ...rest] = args;
8
8
  const adapter = host ? pluginHosts.get(host) : undefined;
9
9
  requireThat(adapter, `用法:node <插件目录>/lib/plugin.js <${listPluginHosts().join("|")}> hook|init|status`);
10
- await runPluginHost(adapter, rest);
10
+ await runPluginHost(adapter, rest, replayHook);
11
11
  }
12
12
  if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {
13
13
  void main(process.argv.slice(2)).catch(error => {
@@ -0,0 +1,17 @@
1
+ {
2
+ "mcpServers": {
3
+ "pbot": {
4
+ "command": "sh",
5
+ "args": [
6
+ "-c",
7
+ "if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.3 \"$@\"",
8
+ "pbot",
9
+ "mcp"
10
+ ],
11
+ "env": {
12
+ "PBOT_HOST": "qoder",
13
+ "PBOT_PLUGIN_VERSION": "0.3.3"
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "personal-bot",
3
+ "version": "0.3.3",
4
+ "description": "Personal Bot workspace context and cross-harness workers.",
5
+ "skills": "./skills/",
6
+ "mcpServers": "./.mcp.json"
7
+ }
@@ -0,0 +1,17 @@
1
+ # Disclaimer / 免责声明
2
+
3
+ ## English
4
+
5
+ AI models can produce incorrect answers, commands, and code. Verify information before relying on it. Review proposed changes before applying them to important files or systems.
6
+
7
+ Workers and MCP tools may read or change files, run commands, or send workspace data to services you configure. Check which data and credentials a worker or service can access when granting permissions. Third-party providers may charge for requests and process data under their own terms and privacy policies.
8
+
9
+ Personal Bot is provided “as is”. Its warranty disclaimer and limitation of liability are set out in the project license. Third-party software is subject to its own licenses. [MIT License](LICENSE)
10
+
11
+ ## 中文
12
+
13
+ AI 模型生成的回答、命令和代码可能有误。请在据此作出决定前核实关键信息,在将更改应用到重要文件或系统前审查具体内容。
14
+
15
+ Worker 和 MCP 工具可能读取或修改文件、执行命令,或将工作区数据发送给你配置的服务。授予权限时,请确认对方能够访问哪些数据和凭据。第三方服务可能按请求收费,并按各自的条款和隐私政策处理数据。
16
+
17
+ Personal Bot 按现状提供,担保免责和责任限制条款见项目许可证。第三方软件适用其各自的许可证。[MIT 许可证全文](LICENSE)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Personal Bot contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,37 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "PBOT_PLUGIN_VERSION=0.3.3 PBOT_PLUGIN_MANIFEST=\"${QODER_PLUGIN_ROOT:+$QODER_PLUGIN_ROOT/.qoder-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.3 \"$@\"' pbot plugin qoder hook",
9
+ "timeout": 120
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "UserPromptSubmit": [
15
+ {
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "PBOT_PLUGIN_VERSION=0.3.3 PBOT_PLUGIN_MANIFEST=\"${QODER_PLUGIN_ROOT:+$QODER_PLUGIN_ROOT/.qoder-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.3 \"$@\"' pbot plugin qoder hook",
20
+ "timeout": 120
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "Stop": [
26
+ {
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "PBOT_PLUGIN_VERSION=0.3.3 PBOT_PLUGIN_MANIFEST=\"${QODER_PLUGIN_ROOT:+$QODER_PLUGIN_ROOT/.qoder-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.3 \"$@\"' pbot plugin qoder hook",
31
+ "timeout": 120
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: pbot
3
+ description: 初始化 Personal Bot 工作区、查看状态、搜索归档或生成历史摘要。
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ 使用当前会话的 `workspaceRoot` 作为 `--workspace`。省略子命令时使用 `status`。可执行 `init`、`status`、`history status|list|summary|migrate|search|read`。保留用户指定的维度、模型和筛选参数。
8
+
9
+ 运行 `npx --yes personal-bot@0.3.3 <子命令> --workspace "<workspaceRoot>"`。如果 `pbot --at-least 0.3.3` 返回 0,也可以用 `pbot` 执行同一条命令。返回实际结果。
@@ -8,7 +8,7 @@ export declare class AgentRun {
8
8
  readonly generation: string;
9
9
  constructor(files: AgentFiles, id: string, generation: string);
10
10
  get current(): Readonly<AgentCycle> | undefined;
11
- get state(): "starting" | "busy" | "idle" | "stopping" | "stopped" | "error";
11
+ get state(): "error" | "starting" | "busy" | "idle" | "stopping" | "stopped";
12
12
  get pending(): number;
13
13
  get interactive(): boolean;
14
14
  accepted(requestId: string): boolean;
@@ -1,22 +1,11 @@
1
- import { AgentFiles } from "../../storage/agent-files.js";
2
- import type { AgentOwner, AgentOptions, AgentPendingRequest, AgentResponseInput, AgentStartOptions, AgentDescriptor, AgentCycle, AgentSessionReference, AgentView } from "../../model/agent.js";
3
- import type { AcpBackend, AcpSessionReference } from "../../model/acp.js";
4
- export interface AgentHost {
5
- available(backend: AcpBackend): void;
6
- filterOptions?(backend: AcpBackend, options: AgentOptions): AgentOptions;
7
- prepare(backend: AcpBackend, options: AgentOptions): AcpSessionReference;
8
- alive(id: string): boolean;
9
- validateSession(value: AgentDescriptor, reference: AgentSessionReference): void | Promise<void>;
10
- launch(value: AgentDescriptor, directory: string, generation: string, reference: AgentSessionReference, resume: boolean, signal: AbortSignal): void | Promise<void>;
11
- release(id: string, generation: string): void | Promise<void>;
12
- report(value: AgentDescriptor, reference: AgentSessionReference, leaf: string): string | Promise<string>;
13
- }
1
+ import type { AgentOwner, AgentOptions, AgentMessage, AgentPendingRequest, AgentResponseInput, AgentStartOptions, AgentCycle, AgentHost, AgentView } from "../../model/agent.js";
2
+ export type { AgentHost } from "../../model/agent.js";
14
3
  /** Host-neutral lifecycle manager for cross-harness ACP workers. */
15
4
  export declare class AgentService {
16
5
  #private;
17
6
  readonly root: string;
18
7
  readonly host: AgentHost;
19
- readonly files: AgentFiles;
8
+ private readonly files;
20
9
  constructor(root: string, directory: string, host: AgentHost);
21
10
  private alive;
22
11
  private check;
@@ -35,7 +24,7 @@ export declare class AgentService {
35
24
  state: import("../../model/agent.js").AgentStatus["state"];
36
25
  activity: string;
37
26
  alive: boolean;
38
- backend: AcpBackend;
27
+ backend: import("../../model/acp.js").AcpBackend;
39
28
  transport: "acp";
40
29
  selection?: import("../../model/acp.js").AcpModelSelection;
41
30
  capabilities: {
@@ -57,7 +46,7 @@ export declare class AgentService {
57
46
  options: AgentOptions;
58
47
  }>;
59
48
  private launch;
60
- send(id: string, text: string, delivery: "steer" | "followUp", owner: AgentOwner, attachments?: readonly string[]): {
49
+ send(id: string, text: string, delivery: AgentMessage["delivery"], owner: AgentOwner, attachments?: readonly string[]): {
61
50
  requestId: string;
62
51
  messageStatus: "queued";
63
52
  name: string;
@@ -65,7 +54,7 @@ export declare class AgentService {
65
54
  state: import("../../model/agent.js").AgentStatus["state"];
66
55
  activity: string;
67
56
  alive: boolean;
68
- backend: AcpBackend;
57
+ backend: import("../../model/acp.js").AcpBackend;
69
58
  transport: "acp";
70
59
  selection?: import("../../model/acp.js").AcpModelSelection;
71
60
  capabilities: {
@@ -98,7 +87,7 @@ export declare class AgentService {
98
87
  state: import("../../model/agent.js").AgentStatus["state"];
99
88
  activity: string;
100
89
  alive: boolean;
101
- backend: AcpBackend;
90
+ backend: import("../../model/acp.js").AcpBackend;
102
91
  transport: "acp";
103
92
  selection?: import("../../model/acp.js").AcpModelSelection;
104
93
  capabilities: {
@@ -121,32 +110,13 @@ export declare class AgentService {
121
110
  }>;
122
111
  private restart;
123
112
  cycles(id: string, owner: AgentOwner): AgentCycle[];
124
- status(id: string, owner: AgentOwner): {
125
- cycle?: AgentCycle;
126
- name: string;
127
- generation: string;
128
- state: import("../../model/agent.js").AgentStatus["state"];
129
- activity: string;
130
- alive: boolean;
131
- backend: AcpBackend;
132
- transport: "acp";
133
- selection?: import("../../model/acp.js").AcpModelSelection;
134
- capabilities: {
135
- steer: boolean;
136
- resume: boolean;
137
- transcript: boolean;
138
- };
139
- error?: string;
140
- owned: boolean;
141
- pendingRequests?: AgentPendingRequest[];
142
- agentId: string;
143
- release: string;
144
- workspace: string;
145
- cwd: string;
146
- parentSessionId: string;
147
- parentLeaf: string | null;
148
- createdAt: number;
149
- options: AgentOptions;
113
+ private cyclesFor;
114
+ private snapshot;
115
+ status(id: string, owner: AgentOwner): AgentView;
116
+ outputStatus(id: string, owner: AgentOwner, requestId?: string): {
117
+ current: AgentView;
118
+ cycle: AgentCycle | undefined;
119
+ terminal: boolean;
150
120
  };
151
121
  read(id: string, owner: AgentOwner, cycleId?: string, offset?: number, limit?: number): Promise<{
152
122
  cycles: {
@@ -162,7 +132,7 @@ export declare class AgentService {
162
132
  state: import("../../model/agent.js").AgentStatus["state"];
163
133
  activity: string;
164
134
  alive: boolean;
165
- backend: AcpBackend;
135
+ backend: import("../../model/acp.js").AcpBackend;
166
136
  transport: "acp";
167
137
  selection?: import("../../model/acp.js").AcpModelSelection;
168
138
  capabilities: {
@@ -298,7 +298,11 @@ export class AgentService {
298
298
  }
299
299
  }
300
300
  cycles(id, owner) {
301
- const d = this.get(id, owner), view = this.view(d, owner), values = this.files.completions(id);
301
+ return this.cyclesFor(this.view(this.get(id, owner), owner));
302
+ }
303
+ cyclesFor(view) {
304
+ const id = view.agentId;
305
+ const values = this.files.completions(id);
302
306
  if (view.cycle && !values.some(c => c.cycleId === view.cycle.cycleId)) {
303
307
  values.push(view.state === "stopped" || view.state === "error" ? { ...view.cycle, state: "interrupted", finishedAt: view.cycle.finishedAt ?? Date.now() } : view.cycle);
304
308
  }
@@ -321,9 +325,24 @@ export class AgentService {
321
325
  }
322
326
  return values;
323
327
  }
328
+ snapshot(id, owner) {
329
+ const view = this.view(this.get(id, owner), owner);
330
+ const cycles = this.cyclesFor(view);
331
+ const latest = cycles.at(-1);
332
+ return { current: latest ? { ...view, cycle: latest } : view, cycles };
333
+ }
324
334
  status(id, owner) {
325
- const d = this.get(id, owner), latest = this.cycles(id, owner).at(-1);
326
- return { ...this.view(d, owner), ...(latest ? { cycle: latest } : {}) };
335
+ return this.snapshot(id, owner).current;
336
+ }
337
+ outputStatus(id, owner, requestId) {
338
+ const { current, cycles } = this.snapshot(id, owner);
339
+ const request = requestId ?? this.files.messages(id).findLast(item => item.generation === current.generation)?.requestId;
340
+ const cycle = request
341
+ ? cycles.find(item => item.generation === current.generation && item.requestIds.includes(request))
342
+ : current.cycle;
343
+ const stopped = current.state === "stopped" || current.state === "error";
344
+ const terminal = request ? stopped && !cycle : stopped || (current.state === "idle" && !cycle);
345
+ return { current, cycle, terminal };
327
346
  }
328
347
  async read(id, owner, cycleId, offset = 0, limit = 16000) {
329
348
  const d = this.get(id, owner), cycles = this.cycles(id, owner);
@@ -0,0 +1,4 @@
1
+ import type { HistoryHost } from "../../model/history.js";
2
+ import type { HistoryCapture } from "../../model/plugin-host.js";
3
+ /** Persist a host raw history observation atomically into .pbot/history/raw/. */
4
+ export declare function recordHistoryCapture(root: string, host: HistoryHost, capture: HistoryCapture): void;