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
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: project-maintenance
3
+ description: 维护项目导航、结论和可复用的任务定义,归集交付物,整理结项资料。
4
+ ---
5
+
6
+ # 项目整理与维护
7
+
8
+ 只更新本次涉及的项目、长期事务正文及受影响的引用;全盘整理按用户指定范围进行。
9
+
10
+ ## 更新正文与知识
11
+
12
+ - **项目正文**(默认 `projects/<目录名>/README.md`)和**长期事务**(`areas/<领域>/`):呈现当前结论、适用条件、分析口径和未决问题。直接修订同主题正文,合并重复内容并替换过时说明;重要结论或决策变化时简述原因,保留历史来源与时间并用引用连接,未解决的冲突保留原貌。
13
+ - **用户偏好与约定**:按用户实际表达记录,不把推测写成既定约定。
14
+ - **可复用知识**(`knowledge/<主题>/`):提炼可跨任务复用的概念、方法与口径,注明适用条件并引用来源。需要留史的研究和决策按日期与主题命名。
15
+ - **排查过程与测试流水**:不逐次追加到正文,必要实现细节写入对应技术资料。
16
+
17
+ ## 维护根导航
18
+
19
+ 更新根 `AGENTS.md` 的项目速查:列出目录名和用户常用称呼或主题词。采用默认入口(`projects/<目录名>/README.md`)的项目写目录名即可,其他项目链接到实际入口;进展和结论留在项目正文。
20
+
21
+ ## 复用任务定义
22
+
23
+ 需要跨会话继续或重复执行的任务,在所属项目或 `areas/<领域>/` 记录目标、输入、执行方式和预期产物,并随变化更新。
24
+
25
+ 重复分析或报告按需写明:数据来源与查询方式、对象与筛选范围、期间与时区、单位、指标公式与分母、分组与比较基准、执行入口;单次报告引用该定义。
26
+
27
+ - 回查结论:引用对应时期的正文或交付物。
28
+ - 按原口径更新:核对原定义的来源与前提,使用本期数据;口径变化时说明对可比性的影响。
29
+ - 复现历史结果:使用当时的输入和版本。
30
+
31
+ ## 归集、清理与结项
32
+
33
+ 整理或结项时,检查本次涉及的项目目录和 `scratch/`:将结论与方法并入正文,将交付物和可复用源码归入项目目录,同步来源引用与执行入口。
34
+
35
+ 归集完成后,只清理本次范围内已被吸收或不再需要的临时文件,不删除正式资料、历史记录或备份。结项时按目标核对交付物和执行入口,在项目正文记录交付结果、剩余工作和复用条件。
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: provider-connections
3
+ description: 接入或修复工作区共享 MCP 与原生 CLI/MCP,核对认证与可用性,维护精简的工作区工具手册。
4
+ ---
5
+
6
+ # 工具与 MCP 接入
7
+
8
+ 先查看工作区 `providers/AGENTS.md`、`providers/<id>/GUIDE.md`、`.pbot/mcp.json` 和当前宿主原生 MCP 列表,优先复用已有接入;同一个 MCP 服务只在一处注册,不同时写入 `.pbot/mcp.json` 与宿主原生配置。
9
+
10
+ ## CLI
11
+
12
+ 确认已安装版本,用本次所需子命令的 `--help` 核对参数、默认值和校验规则,沿用原生登录与 profile。
13
+
14
+ ## MCP 归属判断
15
+
16
+ 接入新 MCP 前先判断归属;边界不明确或用户未说明作用域时,写入前先向用户确认放工作区共享还是当前宿主原生:
17
+
18
+ - **工作区共享 MCP(`.pbot/mcp.json`)**:归属当前工作区业务、需要跨宿主(Pi、dsh、Claude Code、Antigravity、Codex 及 ACP worker)共用,使用 stdio 或 Streamable HTTP + 环境变量/本地凭据,纯 `tools/list` + `tools/call` 请求-响应且可并发连接的服务。
19
+ - **宿主原生 MCP(全局或项目级)**:满足以下任一条件时走当前宿主原生入口,不写入 `.pbot/mcp.json`:
20
+ 1. 跨项目通用的本机全局基础设施或开发工具(如浏览器调试、全局调度);
21
+ 2. 依赖宿主浏览器交互式 OAuth 登录;
22
+ 3. 依赖宿主配套插件、斜杠命令、原生技能、MCP resources/prompts 或服务端主动事件推送;
23
+ 4. 工具极多且高频交互,或独占本机端口/浏览器目录、不宜自动透传给 ACP worker;
24
+ 5. 用户明确要求绑定到当前宿主原生配置。
25
+
26
+ ## 工作区共享 MCP(`.pbot/mcp.json`)
27
+
28
+ 不保存明文凭据,使用 `${ENV_VAR}` 引用,保留无关项,不能使用保留名 `pbot`:
29
+
30
+ - **查看**:`pbot mcp list --workspace <workspaceRoot>` 或(轻插件宿主)调用 `workspace_mcp_discover`
31
+ - **新增 / 更新 stdio**:`pbot mcp add <name> --workspace <workspaceRoot> [--env K=\${VAR}] [--cwd .] [--description "..."] -- <command> [args...]`
32
+ - **新增 / 更新 HTTP**:`pbot mcp add <name> --workspace <workspaceRoot> --url https://... [--header Authorization="Bearer \${TOKEN}"] [--description "..."]`
33
+ - **删除**:`pbot mcp remove <name> --workspace <workspaceRoot>`
34
+
35
+ 生效方式(原生挂载与桥接二选一,不重复暴露):
36
+ - Pi 执行 `/reload`、dsh 重启会话后由宿主直接原生挂载(不暴露 `workspace_mcp_*`);
37
+ - 轻插件宿主与任意 MCP 宿主通过 `workspace_mcp_discover` / `workspace_mcp_call` 桥接,即改即生效,无需重启;
38
+ - ACP worker 在下次新建或恢复会话时自动加载最新 `.pbot/mcp.json`。
39
+
40
+ ## 宿主原生 MCP
41
+
42
+ - **`host = pi`**:项目级用 `pi mcp add --local <server> ...`(写入 `.pi/mcp.json`),全局省略 `--local`;改完后请用户在会话中执行 `/reload` 并用 `/mcp` 检查。
43
+ - **`host = dsh`**:通过原生界面或 profile 配置管理(注意同一 profile 可能被多工作区共用)。
44
+ - **`host = claude`**:`claude mcp add --scope project --transport http <server> <url>`(写入 `.mcp.json`),改完后请用户在会话中用 `/mcp` 核对认证与工具。
45
+ - **`host = antigravity`**:全局使用 `agy mcp add <name> <commandOrUrl> [args...]` / `agy mcp remove <name>`(管理 `~/.gemini/config/mcp_config.json`),通过 `agy mcp list` 或 UI 面板核对。
46
+
47
+ ## 验证与手册
48
+
49
+ 用一个简单的只读查询验证所需能力(例如 `workspace_mcp_discover(server)` + 只读 `workspace_mcp_call` 或原生工具调用),失败时按实际错误排障。
50
+
51
+ - `providers/<id>/GUIDE.md`:保留用途、接入方式(`.pbot/mcp.json` 或原生入口)、适用版本,以及原生 help/schema 未写明但影响结果的口径和限制;不抄录完整参数表,更新时直接替换过时内容。
52
+ - `providers/AGENTS.md`:只做能力导航和选用约定。
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pbot
3
- description: 初始化 Personal Bot 工作区或查看状态。
3
+ description: 初始化 Personal Bot 工作区、查看状态、搜索归档或生成历史摘要。
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
@@ -14,3 +14,13 @@ node "<plugin-root>/lib/plugin.js" antigravity status
14
14
  ```
15
15
 
16
16
  根据用户参数选择一条:`init` 补建资料目录与根 `AGENTS.md` 并启用工作区,`status` 只查看工作区及当前配置状态。省略参数时查看状态。返回命令的实际结果和需要处理的错误。
17
+
18
+ 用户要求整理历史时,在当前工作区执行 `pbot history summary --workspace "<workspaceRoot>"`。检查待处理数量用 `history status`,列维度用 `history list`,搜索与读取用 `history search`、`history read`,迁移预览用 `history migrate --dry-run`。保留用户指定的参数。
19
+
20
+ 首次使用或全局 CLI 缺少该子命令时,可直接运行随插件安装的 CLI:
21
+
22
+ ```sh
23
+ node "<plugin-root>/lib/extension/workspace-cli.js" history summary --workspace "<workspaceRoot>"
24
+ ```
25
+
26
+ 也可读取 `<plugin-root>/package.json` 的 `version`,运行 `npx --yes personal-bot@<version> history summary --workspace "<workspaceRoot>"`。
@@ -5,31 +5,41 @@ description: 接入或修复工作区共享 MCP 与原生 CLI/MCP,核对认证
5
5
 
6
6
  # 工具与 MCP 接入
7
7
 
8
- 先查看工作区 `providers/AGENTS.md`、`providers/<id>/GUIDE.md`、`.pbot/mcp.json` 和用户提供的资料,优先复用已有接入。
8
+ 先查看工作区 `providers/AGENTS.md`、`providers/<id>/GUIDE.md`、`.pbot/mcp.json` 和当前宿主原生 MCP 列表,优先复用已有接入;同一个 MCP 服务只在一处注册,不同时写入 `.pbot/mcp.json` 与宿主原生配置。
9
9
 
10
10
  ## CLI
11
11
 
12
12
  确认已安装版本,用本次所需子命令的 `--help` 核对参数、默认值和校验规则,沿用原生登录与 profile。
13
13
 
14
- ## 工作区共享 MCP(优先)
14
+ ## MCP 归属判断
15
15
 
16
- 需要跨宿主(Pi、dsh、Claude Code、Antigravity、Codex 及 ACP worker)共用且使用 stdio 或 Streamable HTTP + 环境变量/本地凭据的 MCP,统一写入工作区 `.pbot/mcp.json`(不保存明文凭据,使用 `${ENV_VAR}` 引用,保留无关项,不能使用保留名 `pbot`):
16
+ 接入新 MCP 前先判断归属;边界不明确或用户未说明作用域时,写入前先向用户确认放工作区共享还是当前宿主原生:
17
17
 
18
- - **查看**:`pbot mcp list --workspace <workspaceRoot>` 或调用 `workspace_mcp_discover`
18
+ - **工作区共享 MCP(`.pbot/mcp.json`)**:归属当前工作区业务、需要跨宿主(Pi、dsh、Claude Code、Antigravity、Codex 及 ACP worker)共用,使用 stdio 或 Streamable HTTP + 环境变量/本地凭据,纯 `tools/list` + `tools/call` 请求-响应且可并发连接的服务。
19
+ - **宿主原生 MCP(全局或项目级)**:满足以下任一条件时走当前宿主原生入口,不写入 `.pbot/mcp.json`:
20
+ 1. 跨项目通用的本机全局基础设施或开发工具(如浏览器调试、全局调度);
21
+ 2. 依赖宿主浏览器交互式 OAuth 登录;
22
+ 3. 依赖宿主配套插件、斜杠命令、原生技能、MCP resources/prompts 或服务端主动事件推送;
23
+ 4. 工具极多且高频交互,或独占本机端口/浏览器目录、不宜自动透传给 ACP worker;
24
+ 5. 用户明确要求绑定到当前宿主原生配置。
25
+
26
+ ## 工作区共享 MCP(`.pbot/mcp.json`)
27
+
28
+ 不保存明文凭据,使用 `${ENV_VAR}` 引用,保留无关项,不能使用保留名 `pbot`:
29
+
30
+ - **查看**:`pbot mcp list --workspace <workspaceRoot>` 或(轻插件宿主)调用 `workspace_mcp_discover`
19
31
  - **新增 / 更新 stdio**:`pbot mcp add <name> --workspace <workspaceRoot> [--env K=\${VAR}] [--cwd .] [--description "..."] -- <command> [args...]`
20
32
  - **新增 / 更新 HTTP**:`pbot mcp add <name> --workspace <workspaceRoot> --url https://... [--header Authorization="Bearer \${TOKEN}"] [--description "..."]`
21
33
  - **删除**:`pbot mcp remove <name> --workspace <workspaceRoot>`
22
34
 
23
- 生效方式:
24
- - 轻插件宿主与任意 MCP 宿主通过 `workspace_mcp_discover` / `workspace_mcp_call` 即改即生效,无需重启;
25
- - ACP worker 在下次新建或恢复会话时自动加载最新 `.pbot/mcp.json`;
26
- - Pi 执行 `/reload`、dsh 重启会话后同步刷新原生挂载(同时仍可直接用 `workspace_mcp_*`)。
27
-
28
- ## 宿主原生 MCP(交互式 OAuth 或全局服务)
35
+ 生效方式(原生挂载与桥接二选一,不重复暴露):
36
+ - Pi 执行 `/reload`、dsh 重启会话后由宿主直接原生挂载(不暴露 `workspace_mcp_*`);
37
+ - 轻插件宿主与任意 MCP 宿主通过 `workspace_mcp_discover` / `workspace_mcp_call` 桥接,即改即生效,无需重启;
38
+ - ACP worker 在下次新建或恢复会话时自动加载最新 `.pbot/mcp.json`。
29
39
 
30
- 需要宿主浏览器交互式 OAuth 登录、或用户明确要求绑定到当前宿主全局配置的远程 MCP,仍使用当前宿主的原生入口(可与 `.pbot/mcp.json` 并存,不自动互相同步):
40
+ ## 宿主原生 MCP
31
41
 
32
- - **`host = pi`**:`pi mcp add --local <server> ...`(写入 `.pi/mcp.json`),改完后请用户在会话中执行 `/reload` 并用 `/mcp` 检查。
42
+ - **`host = pi`**:项目级用 `pi mcp add --local <server> ...`(写入 `.pi/mcp.json`),全局省略 `--local`;改完后请用户在会话中执行 `/reload` 并用 `/mcp` 检查。
33
43
  - **`host = dsh`**:通过原生界面或 profile 配置管理(注意同一 profile 可能被多工作区共用)。
34
44
  - **`host = claude`**:`claude mcp add --scope project --transport http <server> <url>`(写入 `.mcp.json`),改完后请用户在会话中用 `/mcp` 核对认证与工具。
35
45
  - **`host = antigravity`**:全局使用 `agy mcp add <name> <commandOrUrl> [args...]` / `agy mcp remove <name>`(管理 `~/.gemini/config/mcp_config.json`),通过 `agy mcp list` 或 UI 面板核对。
package/lib/claude.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { realpathSync } from "node:fs";
2
2
  import { pathToFileURL } from "node:url";
3
- import { runPluginHost } from "./extension/plugin-runtime.js";
4
- import { claudeAdapter } from "./integrations/hosts/claude.js";
3
+ import { runPluginHost } from "./extension/hosts/plugin-runtime.js";
4
+ import { claudeAdapter } from "./integrations/hosts/claude/adapter.js";
5
5
  export function main(args) {
6
6
  return runPluginHost(claudeAdapter, args);
7
7
  }
package/lib/client.js CHANGED
@@ -60,6 +60,12 @@ var pbotReadRemote = {
60
60
  }))
61
61
  };
62
62
 
63
+ // src/model/history.ts
64
+ var historyPageLimits = {
65
+ search: { default: 20, max: 50 },
66
+ read: { default: 12e3, max: 24e3 }
67
+ };
68
+
63
69
  // src/ui/dsh/elements.ts
64
70
  var record = (value2) => {
65
71
  if (!object(value2)) throw new Error("\u7BA1\u7406\u6570\u636E\u65E0\u6548\u3002");
@@ -90,12 +96,10 @@ function details(parent, title) {
90
96
  parent.append(node);
91
97
  return node;
92
98
  }
93
- function field(parent, label, multiline = false, value2 = "") {
94
- const wrapper = element("label", "", "pbot-field"), input = multiline ? element("textarea") : element("input");
99
+ function field(parent, label) {
100
+ const wrapper = element("label", "", "pbot-field"), input = element("input");
95
101
  wrapper.append(element("span", label));
96
- input.value = value2;
97
102
  input.setAttribute("aria-label", label);
98
- if (input instanceof HTMLTextAreaElement) input.rows = 3;
99
103
  wrapper.append(input);
100
104
  parent.append(wrapper);
101
105
  return input;
@@ -123,10 +127,9 @@ function empty(title, description) {
123
127
  node.append(element("h3", title), note(description));
124
128
  return node;
125
129
  }
126
- function pageTitle(parent, title, description) {
130
+ function pageTitle(parent, title) {
127
131
  const node = element("header", "", "pbot-page-title");
128
132
  node.append(element("h2", title));
129
- if (description) node.append(note(description));
130
133
  parent.append(node);
131
134
  return node;
132
135
  }
@@ -158,15 +161,14 @@ var managementStyles = `
158
161
  .pbot-management h2 { font-size: 21px; font-weight: 600; }
159
162
  .pbot-management h3 { font-size: 16px; font-weight: 600; }
160
163
  .pbot-management h4 { font-size: 14px; font-weight: 600; }
161
- .pbot-management button, .pbot-management input, .pbot-management textarea, .pbot-management select { font: inherit; color: inherit; }
164
+ .pbot-management button, .pbot-management input, .pbot-management select { font: inherit; color: inherit; }
162
165
  .pbot-management button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 13px; border: 1px solid var(--pbot-line); border-radius: 8px; background: var(--pbot-surface); cursor: pointer; line-height: 1.4; }
163
166
  .pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
164
167
  .pbot-management button:disabled { opacity: .45; cursor: not-allowed; }
165
- .pbot-management :is(button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }
168
+ .pbot-management :is(button, input, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }
166
169
  .pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }
167
170
  .pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }
168
171
  .pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }
169
- .pbot-management button.pbot-danger { color: var(--pbot-danger); }
170
172
  .pbot-management button[data-busy=true]::after { content: "\u2026"; }
171
173
  .pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
172
174
  .pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }
@@ -177,7 +179,6 @@ var managementStyles = `
177
179
  .pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }
178
180
  .pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }
179
181
  .pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }
180
- .pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
181
182
  .pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }
182
183
  .pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }
183
184
  .pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }
@@ -188,7 +189,6 @@ var managementStyles = `
188
189
  .pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }
189
190
  .pbot-notice:empty { display: none; }
190
191
  .pbot-stack { display: grid; gap: 16px; }
191
- .pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
192
192
  .pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
193
193
  .pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
194
194
  .pbot-counts { margin: -8px 0 20px !important; }
@@ -200,10 +200,6 @@ var managementStyles = `
200
200
  .pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }
201
201
  .pbot-badge { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--pbot-muted); background: var(--pbot-bg); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
202
202
  .pbot-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
203
- .pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]) { color: var(--pbot-accent); background: var(--pbot-tint); }
204
- .pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }
205
- .pbot-badge[data-state=completed] { color: var(--dsw-alias-state-success-primary, #26834b); }
206
- .pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }
207
203
  .pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }
208
204
  .pbot-facts dt { color: var(--pbot-muted); }
209
205
  .pbot-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
@@ -213,33 +209,15 @@ var managementStyles = `
213
209
  .pbot-disclosure .pbot-disclosure { background: var(--pbot-bg); }
214
210
  .pbot-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 13px; }
215
211
  .pbot-field > span { font-weight: 500; }
216
- .pbot-field :is(input,textarea,select) { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--pbot-line); border-radius: 7px; background: var(--pbot-surface); line-height: 1.5; }
217
- .pbot-field input[type=file] { padding: 7px; font-size: 12px; }
218
- .pbot-field input::file-selector-button { border: 0; padding: 5px 8px; margin-right: 10px; border-radius: 4px; background: var(--pbot-tint); color: var(--pbot-ink); cursor: pointer; }
219
- .pbot-field textarea { resize: vertical; min-height: 84px; }
220
- .pbot-field input::placeholder, .pbot-field textarea::placeholder { color: var(--pbot-muted); opacity: .8; }
221
- .pbot-split { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 22px; align-items: start; }
222
- .pbot-list { display: grid; align-content: start; grid-auto-rows: max-content; gap: 6px; max-height: 470px; overflow-y: auto; padding: 3px; }
223
- .pbot-management .pbot-list-item { display: block; width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; min-width: 0; }
224
- .pbot-list-item[aria-pressed=true] { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
225
- .pbot-list-item strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
226
- .pbot-list-item .pbot-muted { margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
212
+ .pbot-field :is(input,select) { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--pbot-line); border-radius: 7px; background: var(--pbot-surface); line-height: 1.5; }
213
+ .pbot-field input::placeholder { color: var(--pbot-muted); opacity: .8; }
227
214
  .pbot-empty { padding: 38px 20px; border: 1px dashed var(--pbot-line); border-radius: 12px; text-align: center; display: grid; gap: 8px; }
228
215
  .pbot-empty h3 { font-weight: 550; }
229
216
  .pbot-empty button { justify-self: center; margin-top: 10px; }
230
- .pbot-detail { min-width: 0; display: grid; gap: 18px; }
231
- .pbot-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
232
217
  .pbot-prose { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 10px 0; line-height: 1.7; }
233
218
  .pbot-raw { font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; max-height: 340px; overflow: auto; }
234
- .pbot-transcript { margin-top: 14px; }
235
- .pbot-event { border-left: 2px solid var(--pbot-line); padding: 0 0 0 14px; margin: 18px 0; }
236
- .pbot-event .pbot-prose { font-size: 13px; }
237
- .pbot-event .pbot-row, .pbot-message .pbot-row { justify-content: space-between; }
238
219
  .pbot-management .pbot-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--pbot-muted); font-size: 12px; }
239
220
  .pbot-pagination button { font-size: 12px; min-height: 30px; padding: 5px 9px; }
240
- .pbot-message { padding: 16px 0; border-bottom: 1px solid var(--pbot-line); }
241
- .pbot-message:last-child { border-bottom: 0; }
242
- .pbot-message .pbot-prose { font-size: 13px; }
243
221
  .pbot-search { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }
244
222
  .pbot-search .pbot-field { margin: 0; }
245
223
  .pbot-search > button { margin-bottom: 2px; }
@@ -252,16 +230,13 @@ var managementStyles = `
252
230
  .pbot-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; }
253
231
  .pbot-nav { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--pbot-line); }
254
232
  .pbot-nav button { flex: 1; justify-content: center; padding: 8px; }
255
- .pbot-nav small { display: none; }
256
233
  .pbot-main { padding: 22px 18px; }
257
234
  .pbot-notice { top: -22px; }
258
235
  .pbot-header { padding: 14px 18px; }
259
- .pbot-split { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: 16px; }
260
236
  }
261
237
  @media (max-width: 600px) {
262
238
  .pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }
263
- .pbot-grid, .pbot-split { grid-template-columns: minmax(0, 1fr); }
264
- .pbot-list { max-height: 215px; }
239
+ .pbot-grid { grid-template-columns: minmax(0, 1fr); }
265
240
  .pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }
266
241
  .pbot-search > button { grid-column: 1 / -1; }
267
242
  .pbot-footer { padding: 8px 14px; }
@@ -390,12 +365,12 @@ function showManagement(ctx, parentSessionId) {
390
365
  lifetime.signal.throwIfAborted();
391
366
  return record(result.value);
392
367
  }
393
- async function command(verb, input, message = "\u64CD\u4F5C\u5DF2\u63A5\u7EB3\u3002") {
394
- const result = await ctx.remote.commands.execute(parentSessionId, "/pbot " + verb + (input === void 0 ? "" : " " + JSON.stringify(input)), []);
368
+ async function initializeWorkspace() {
369
+ const result = await ctx.remote.commands.execute(parentSessionId, "/pbot init", []);
395
370
  if (!result.ok) throw new Error(result.error.message + "\uFF1B\u5982\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u5148\u5237\u65B0\u8BB0\u5F55\u786E\u8BA4\u64CD\u4F5C\u662F\u5426\u5DF2\u63A5\u7EB3\u3002");
396
371
  if (!result.value) throw new Error("\u7BA1\u7406\u547D\u4EE4\u672A\u88AB\u63A5\u7EB3\u3002");
397
372
  if (result.value.result.kind === "error") throw new Error(result.value.result.text);
398
- inform(message);
373
+ inform("\u5DE5\u4F5C\u533A\u5DF2\u521D\u59CB\u5316\u5E76\u542F\u7528\u3002");
399
374
  if (!closed) {
400
375
  try {
401
376
  await refresh();
@@ -403,26 +378,23 @@ function showManagement(ctx, parentSessionId) {
403
378
  inform("\u64CD\u4F5C\u5DF2\u63A5\u7EB3\uFF1B\u5237\u65B0\u72B6\u6001\u672A\u6210\u529F\uFF1A" + String(error), "error");
404
379
  }
405
380
  }
406
- return result.value.result.text ?? "";
407
381
  }
408
382
  const status = section("status", "\u5DE5\u4F5C\u533A");
409
- pageTitle(status, "\u5DE5\u4F5C\u533A", "");
383
+ pageTitle(status, "\u5DE5\u4F5C\u533A");
410
384
  const counts = note(""), workspaceInfo = group(status);
411
385
  status.querySelector("header").after(counts);
412
386
  counts.classList.add("pbot-counts");
413
387
  const materials = group(status, "pbot-setting");
414
388
  materials.append(element("h3", "\u8D44\u6599\u76EE\u5F55"));
415
- const initializeButton = button(materials, "\u51C6\u5907\u76EE\u5F55", async () => {
416
- await command("init", void 0, "\u5DE5\u4F5C\u533A\u5DF2\u521D\u59CB\u5316\u5E76\u542F\u7528\u3002");
417
- });
389
+ const initializeButton = button(materials, "\u51C6\u5907\u76EE\u5F55", initializeWorkspace);
418
390
  const diagnostic = details(status, "\u73AF\u5883\u8BE6\u60C5"), statusBody = block("");
419
391
  statusBody.classList.add("pbot-raw");
420
392
  diagnostic.append(statusBody);
421
393
  const history = section("history", "\u5386\u53F2");
422
- pageTitle(history, "\u5386\u53F2", "");
394
+ pageTitle(history, "\u5386\u53F2");
423
395
  const searchForm = form(history);
424
396
  searchForm.className = "pbot-search";
425
- const historyQuery = field(searchForm, "\u5173\u952E\u8BCD"), host = select(searchForm, "\u6765\u6E90", [["", "\u5168\u90E8"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"]]);
397
+ const historyQuery = field(searchForm, "\u5173\u952E\u8BCD"), host = select(searchForm, "\u6765\u6E90", [["", "\u5168\u90E8"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"], ["codex", "Codex"], ["qoder", "Qoder CLI"]]);
426
398
  historyQuery.placeholder = "\u7559\u7A7A\u67E5\u770B\u6700\u8FD1\u4F1A\u8BDD";
427
399
  submit(searchForm, "\u67E5\u8BE2", () => searchHistory());
428
400
  const dateFilters = details(history, "\u65F6\u95F4\u8303\u56F4"), dateGrid = group(dateFilters, "pbot-grid");
@@ -455,12 +427,13 @@ function showManagement(ctx, parentSessionId) {
455
427
  item.dataset.id = text(match.id);
456
428
  item.dataset.host = text(match.host);
457
429
  meta.append(element("h4", text(match.name)), element("span", text(match.host), "pbot-badge"));
458
- item.append(note(`${time(match.from)} \xB7 ${match.kind === "session" ? "\u4F1A\u8BDD" : match.kind === "summary" ? "\u6458\u8981" : "\u95EE\u7B54"}`), block(match.snippet || match.preview));
430
+ const kindLabel = match.kind === "session" ? "\u4F1A\u8BDD" : match.kind === "summary" ? `\u6458\u8981${match.dimension ? "\xB7" + text(match.dimension) : ""}` : "\u95EE\u7B54";
431
+ item.append(note(`${time(match.from)} \xB7 ${kindLabel}`), block(match.snippet || match.preview));
459
432
  button(item, "\u8BFB\u53D6", () => readHistory(text(match.id), text(match.host)), "pbot-quiet");
460
433
  historyBody.append(item);
461
434
  }
462
435
  if (!rows(data.matches).length) historyBody.append(empty("\u6CA1\u6709\u627E\u5230\u5339\u914D\u5185\u5BB9", "\u8BD5\u8BD5\u66F4\u77ED\u7684\u5173\u952E\u8BCD\uFF0C\u6216\u8C03\u6574\u6765\u6E90\u548C\u65F6\u95F4\u8303\u56F4\u3002"));
463
- if (offset) button(historyPaging, "\u4E0A\u4E00\u9875", () => searchHistory(Math.max(0, offset - 20), true));
436
+ if (offset) button(historyPaging, "\u4E0A\u4E00\u9875", () => searchHistory(Math.max(0, offset - historyPageLimits.search.default), true));
464
437
  if (typeof data.nextOffset === "number") button(historyPaging, "\u4E0B\u4E00\u9875", () => searchHistory(data.nextOffset, true));
465
438
  }
466
439
  async function readHistory(id, source, offset = 0, childrenOffset = 0) {
@@ -515,17 +488,26 @@ function showManagement(ctx, parentSessionId) {
515
488
  materials.hidden = false;
516
489
  initializeButton.textContent = "\u51C6\u5907\u76EE\u5F55";
517
490
  enabled(initializeButton, true);
518
- const historyState = record(snapshot.history);
491
+ const historyState = object(snapshot.history) ? snapshot.history : null;
492
+ const historyDims = historyState && Array.isArray(historyState.dimensions) ? rows(historyState.dimensions) : [];
493
+ const historySummaryText = !historyState ? "\u5DF2\u505C\u7528" : `\u539F\u59CB\u4F1A\u8BDD ${text(historyState.rawCount ?? 0)}` + (historyDims.length ? " \xB7 " + historyDims.map((dim) => {
494
+ const pending = Number(dim.pendingCreate ?? 0) + Number(dim.pendingIncremental ?? 0) + Number(dim.pendingRebuild ?? 0);
495
+ return `${text(dim.dimension)} ${text(dim.ready ?? 0)}/${text(dim.total ?? 0)}${pending ? `\uFF08\u5F85\u5904\u7406 ${pending}\uFF09` : ""}`;
496
+ }).join("\uFF0C") : "");
497
+ const historyReminder = historyState && object(historyState.reminder) && typeof historyState.reminder.message === "string" ? historyState.reminder.message : "";
519
498
  counts.textContent = "Personal Bot \u5DF2\u542F\u52A8 \xB7 \u8DE8 Harness \u8C03\u5EA6\u901A\u8FC7 MCP worker_* \u63D0\u4F9B";
520
499
  const model = object(snapshot.model) ? snapshot.model : {};
521
- workspaceInfo.replaceChildren(facts([
522
- ["\u72B6\u6001", "\u5DF2\u542F\u52A8"],
523
- ["\u5DE5\u4F5C\u533A", snapshot.workspaceRoot],
524
- ["\u914D\u7F6E\u6587\u4EF6", record(snapshot.configuration).path],
525
- ["\u6A21\u578B", model.model || "\u5C1A\u672A\u9009\u62E9"],
526
- ["Provider", model.provider || "\u2014"],
527
- ["\u5386\u53F2", historyState.organizing ? "\u6574\u7406\u4E2D" : historyState.pending === null ? "\u67E5\u8BE2\u65F6\u66F4\u65B0\u7D22\u5F15" : `${historyState.pending} \u9879\u5F85\u6574\u7406`]
528
- ]));
500
+ workspaceInfo.replaceChildren(
501
+ facts([
502
+ ["\u72B6\u6001", "\u5DF2\u542F\u52A8"],
503
+ ["\u5DE5\u4F5C\u533A", snapshot.workspaceRoot],
504
+ ["\u914D\u7F6E\u6587\u4EF6", record(snapshot.configuration).path],
505
+ ["\u6A21\u578B", model.model || "\u5C1A\u672A\u9009\u62E9"],
506
+ ["Provider", model.provider || "\u2014"],
507
+ ["\u5386\u53F2", historySummaryText]
508
+ ]),
509
+ ...historyReminder ? [note(historyReminder)] : []
510
+ );
529
511
  statusBody.textContent = JSON.stringify(snapshot, null, 2);
530
512
  }
531
513
  async function refresh() {
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "pbot-local",
3
+ "plugins": [
4
+ {
5
+ "name": "personal-bot",
6
+ "source": {
7
+ "source": "local",
8
+ "path": "./plugins/personal-bot"
9
+ },
10
+ "policy": {
11
+ "installation": "AVAILABLE",
12
+ "authentication": "ON_INSTALL"
13
+ },
14
+ "category": "Productivity"
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
+ {
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": "codex",
13
+ "PBOT_PLUGIN_VERSION": "0.3.3"
14
+ }
15
+ }
16
+ }
17
+ }
@@ -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=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-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 codex 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=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-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 codex 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=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-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 codex 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` 执行同一条命令。返回实际结果。
@@ -0,0 +1,2 @@
1
+ policy:
2
+ allow_implicit_invocation: false
@@ -1,3 +1,7 @@
1
1
  export declare const acpBackendPattern: RegExp;
2
2
  export declare function isAcpBackend(value: unknown): value is string;
3
3
  export declare function requireThat(condition: unknown, message: string): asserts condition;
4
+ /** Shared grammar for host and dimension identifiers in history archives and queries. */
5
+ export declare const historyIdentifierPattern: RegExp;
6
+ export declare function isHistoryIdentifier(value: unknown): value is string;
7
+ export declare function isOneOf<T extends string>(value: unknown, choices: readonly T[]): value is T;
@@ -6,3 +6,11 @@ export function requireThat(condition, message) {
6
6
  if (!condition)
7
7
  throw new Error(message);
8
8
  }
9
+ /** Shared grammar for host and dimension identifiers in history archives and queries. */
10
+ export const historyIdentifierPattern = /^[a-z0-9][a-z0-9-]{0,63}$/;
11
+ export function isHistoryIdentifier(value) {
12
+ return typeof value === "string" && historyIdentifierPattern.test(value);
13
+ }
14
+ export function isOneOf(value, choices) {
15
+ return typeof value === "string" && choices.includes(value);
16
+ }
package/lib/dsh.js CHANGED
@@ -1,8 +1,8 @@
1
- import { registerDshCommand } from "./extension/dsh/command.js";
2
- import { registerDshManagement } from "./extension/dsh/management.js";
3
- import { DshWorkspaces, dshDependencies } from "./extension/dsh/workspace.js";
1
+ import { registerDshCommand } from "./extension/hosts/dsh/command.js";
2
+ import { registerDshManagement } from "./extension/hosts/dsh/management.js";
3
+ import { DshWorkspaces, dshDependencies } from "./extension/hosts/dsh/workspace.js";
4
4
  import { requireThat } from "./common/validation.js";
5
- import { rootAgents } from "./integrations/dsh/root-agents.js";
5
+ import { rootAgents } from "./integrations/hosts/dsh/root-agents.js";
6
6
  export const name = "personal-bot";
7
7
  export const inject = ["commands", "typert", ...dshDependencies];
8
8
  export async function apply(ctx) {
@@ -12,8 +12,8 @@ export async function apply(ctx) {
12
12
  requireThat(major > 24 || (major === 24 && minor >= 9), "dsh 接入需要 Node.js 24.9.0 或更新版本。");
13
13
  const workspaces = new DshWorkspaces(ctx);
14
14
  ctx.effect(() => () => workspaces.close());
15
- const management = registerDshManagement(ctx, workspaces);
16
- registerDshCommand(ctx, workspaces, management);
15
+ registerDshManagement(ctx, workspaces);
16
+ registerDshCommand(ctx, workspaces);
17
17
  ctx.on("agent/created", async ({ agent }) => {
18
18
  if (rootAgents(ctx.agents).includes(agent))
19
19
  await workspaces.open(agent);
@@ -0,0 +1,18 @@
1
+ import { AgentFiles } from "../../storage/agent-files.js";
2
+ import type { AcpInput, AcpAnswer } from "../../model/acp.js";
3
+ export declare function acpMember(): Promise<{
4
+ files: AgentFiles;
5
+ d: import("../../model/agent.js").AgentDescriptor;
6
+ id: string;
7
+ generation: string;
8
+ configuration: import("../../model/workspace-config.js").WorkspaceConfiguration;
9
+ features: Readonly<Required<import("../../model/workspace-config.js").WorkspaceFeatures>>;
10
+ check: () => void;
11
+ context: () => Promise<{
12
+ workspace: string;
13
+ role: string;
14
+ environment: string;
15
+ }>;
16
+ input(): AcpInput;
17
+ answer(input: AcpInput, state: AcpAnswer["state"], answer: string, error?: string): void;
18
+ }>;