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,20 +1,24 @@
1
1
  import { object } from "../common/json.js";
2
- import { requireThat } from "../common/validation.js";
3
- import type { HistoryExchange, HistoryHost, HistoryIdentity, HistoryRecord, HistorySummary, RawHistory } from "../model/history.js";
2
+ import { isHistoryIdentifier, requireThat } from "../common/validation.js";
3
+ import type { HistoryExchange, HistoryIdentity, RawHistory, SummaryArtifact } from "../model/history.js";
4
4
  import { fileId } from "./file-access.js";
5
5
 
6
6
  const strings = (value: unknown): value is string[] => Array.isArray(value) && value.every(item => typeof item === "string");
7
7
  const fields = (value: object, names: readonly string[]) => Object.keys(value).every(key => names.includes(key));
8
+
8
9
  const rawFields = ["host", "id", "sessionId", "name", "exchanges", "branches"];
9
- const hierarchyFields = ["host", "id", "sessionId", "summaries"];
10
10
  const exchangeFields = ["id", "entryIds", "text", "from", "to", "completed"];
11
- const summaryFields = [...exchangeFields, "level", "children", "ready"];
11
+ const summaryArtifactFields = ["id", "dimension", "host", "sessionId", "title", "text", "from", "to", "updatedAt", "source"];
12
+ const summarySourceFields = ["rawIds", "exchangeIds", "fingerprint"];
12
13
 
13
- export const isHistoryHost = (value: unknown): value is HistoryHost => value === "pi" || value === "dsh" || value === "claude";
14
+ export { isHistoryIdentifier as isHistoryHost, isHistoryIdentifier as isSummaryDimension } from "../common/validation.js";
14
15
 
15
16
  function identity(value: unknown): asserts value is HistoryIdentity {
16
- requireThat(object(value) && isHistoryHost(value.host) && typeof value.id === "string" &&
17
- typeof value.sessionId === "string" && value.sessionId.length > 0, "历史归档身份无效。");
17
+ requireThat(
18
+ object(value) && isHistoryIdentifier(value.host) && typeof value.id === "string" &&
19
+ typeof value.sessionId === "string" && value.sessionId.length > 0,
20
+ "历史归档身份无效。",
21
+ );
18
22
  fileId(value.id);
19
23
  }
20
24
 
@@ -31,68 +35,48 @@ function exchange(value: unknown): value is HistoryExchange & { id: string } {
31
35
 
32
36
  export function rawHistory(value: unknown): RawHistory {
33
37
  identity(value);
34
- requireThat(object(value) && fields(value, rawFields) && typeof value.name === "string" &&
35
- Array.isArray(value.exchanges) && Array.isArray(value.branches), "历史原文归档无效。");
38
+ requireThat(
39
+ object(value) && fields(value, rawFields) && typeof value.name === "string" &&
40
+ Array.isArray(value.exchanges) && Array.isArray(value.branches),
41
+ "历史原文归档无效。",
42
+ );
36
43
  const ids = new Set<string>();
37
44
  for (const item of value.exchanges) {
38
45
  requireThat(exchange(item) && fields(item, exchangeFields) && item.entryIds.length > 0, "历史问答或其来源消息 ID 无效。");
39
46
  requireThat(item.id !== value.id && !ids.has(item.id), "历史问答 ID 重复:" + item.id);
40
47
  ids.add(item.id);
41
48
  }
42
- for (const branch of value.branches) requireThat(strings(branch) && new Set(branch).size === branch.length && branch.every(id => ids.has(id)),
43
- "历史分支包含重复或未知的问答 ID。");
44
- return value as unknown as RawHistory;
45
- }
46
-
47
- export interface HierarchicalHistory extends HistoryIdentity { summaries: HistorySummary[] }
48
-
49
- export function hierarchicalHistory(value: unknown, raw: RawHistory): HierarchicalHistory {
50
- identity(value);
51
- matchIdentity(value, raw);
52
- requireThat(object(value) && fields(value, hierarchyFields) && Array.isArray(value.summaries), "历史摘要归档无效。");
53
- const levels = new Map(raw.exchanges.map(item => [item.id, 0]));
54
- for (const item of value.summaries) {
55
- requireThat(object(item) && exchange(item) && fields(item, summaryFields) && item.entryIds.length > 0 &&
56
- typeof item.level === "number" && Number.isSafeInteger(item.level) && item.level > 0 && strings(item.children) && typeof item.ready === "boolean", "历史摘要节点无效。");
57
- requireThat(item.id !== raw.id && !levels.has(item.id), "历史摘要 ID 重复:" + item.id);
58
- levels.set(item.id, item.level);
49
+ for (const branch of value.branches) {
50
+ requireThat(
51
+ strings(branch) && new Set(branch).size === branch.length && branch.every(id => ids.has(id)),
52
+ "历史分支包含重复或未知的问答 ID。",
53
+ );
59
54
  }
60
- const result = value as unknown as HierarchicalHistory;
61
- for (const item of result.summaries) requireThat(item.children.length > 0 && new Set(item.children).size === item.children.length &&
62
- item.children.every(id => levels.get(id) === item.level - 1), "历史摘要子节点缺失、重复或层级不匹配:" + item.id);
63
- return result;
55
+ return value as unknown as RawHistory;
64
56
  }
65
57
 
66
- /** Old private directories carried the host in their path. Shared records must declare it. */
67
- export function legacyHistory(value: unknown, host?: HistoryHost): HistoryRecord {
68
- if (host !== undefined) {
69
- requireThat(object(value) && (value.host === undefined || value.host === host), "旧历史归档与来源目录不匹配。");
70
- value = { ...value, host };
58
+ export function summaryArtifact(value: unknown, expectedDimension?: string): SummaryArtifact {
59
+ requireThat(object(value) && fields(value, summaryArtifactFields), "历史摘要产物格式无效。");
60
+ requireThat(typeof value.id === "string" && value.id.length > 0, "历史摘要 ID 无效。");
61
+ fileId(value.id);
62
+ requireThat(isHistoryIdentifier(value.dimension), "历史摘要维度无效。");
63
+ if (expectedDimension !== undefined) {
64
+ requireThat(value.dimension === expectedDimension, `历史摘要维度不匹配,预期 ${expectedDimension},实际 ${value.dimension}。`);
71
65
  }
72
- identity(value);
73
- requireThat(object(value) && typeof value.name === "string" && Array.isArray(value.nodes) &&
74
- !("exchanges" in value) && !("branches" in value) && !("summaries" in value), "旧历史归档无效。");
75
- for (const node of value.nodes) requireThat(object(node) && exchange(node) &&
76
- (node.kind === "session" || node.kind === "exchange" || node.kind === "summary") && Number.isInteger(node.level) &&
77
- strings(node.parents) && strings(node.children) && typeof node.ready === "boolean", "旧历史节点无效。");
78
- const result = value as unknown as HistoryRecord, ids = new Set(result.nodes.map(node => node.id));
79
- const roots = result.nodes.filter(node => node.kind === "session");
80
- requireThat(ids.size === result.nodes.length && roots.length === 1 && roots[0]!.id === result.id &&
81
- result.nodes.every(node => [...node.parents, ...node.children].every(id => ids.has(id))), "旧历史节点关系无效。");
82
- return result;
83
- }
84
-
85
- function exchangeData({ id, entryIds, text, from, to, completed }: HistoryExchange & { id: string }) {
86
- return { id, entryIds, text, from, to, completed };
87
- }
88
-
89
- export function summaryData(item: HistorySummary): HistorySummary {
90
- return { ...exchangeData(item), level: item.level, children: item.children, ready: item.ready };
91
- }
92
-
93
- export function splitLegacy(record: HistoryRecord): { raw: RawHistory; summaries: HistorySummary[] } {
94
- const { host, id, sessionId, name } = record;
95
- const raw = rawHistory({ host, id, sessionId, name, exchanges: record.nodes.filter(node => node.kind === "exchange").map(exchangeData), branches: [] });
96
- const summaries = record.nodes.filter(node => node.kind === "summary").map(summaryData);
97
- return { raw, summaries: hierarchicalHistory({ host, id, sessionId, summaries }, raw).summaries };
66
+ if (value.host !== undefined) requireThat(isHistoryIdentifier(value.host), "历史摘要来源 host 无效。");
67
+ if (value.sessionId !== undefined) requireThat(typeof value.sessionId === "string" && value.sessionId.length > 0, "历史摘要 sessionId 无效。");
68
+ requireThat(
69
+ typeof value.title === "string" && typeof value.text === "string" && value.text.trim().length > 0 &&
70
+ typeof value.from === "string" && typeof value.to === "string" && typeof value.updatedAt === "string",
71
+ "历史摘要正文或时间字段无效。",
72
+ );
73
+ const source = value.source;
74
+ requireThat(
75
+ object(source) && fields(source, summarySourceFields) &&
76
+ strings(source.rawIds) && source.rawIds.length > 0 &&
77
+ strings(source.exchangeIds) &&
78
+ typeof source.fingerprint === "string" && source.fingerprint.length > 0,
79
+ "历史摘要来源指纹无效。",
80
+ );
81
+ return value as unknown as SummaryArtifact;
98
82
  }
@@ -1,9 +1,11 @@
1
- import type { HistoryLocation } from "../../model/history.js";
2
- import type { HistoryService } from "../../services/history/history-service.js";
1
+ import { readWorkspaceHistory, searchWorkspaceHistory } from "../../services/history/history-query.js";
3
2
  import type { HistoryInput } from "./contract.js";
4
3
 
5
- export async function executeHistory(service: HistoryService, args: HistoryInput, location: HistoryLocation, signal?: AbortSignal) {
6
- signal?.throwIfAborted(); await service.refresh(location, signal); signal?.throwIfAborted();
7
- return args.action === "search" ? service.search(args) :
8
- { node: service.read(args.id, args.offset, args.limit, args.childrenOffset, args.host), warnings: service.warnings };
4
+ export function executeHistory(root: string, args: HistoryInput, signal?: AbortSignal) {
5
+ signal?.throwIfAborted();
6
+ if (args.action === "search") {
7
+ return searchWorkspaceHistory(root, args);
8
+ }
9
+ const node = readWorkspaceHistory(root, args.id, args.offset, args.limit, args.childrenOffset, args.host);
10
+ return { node, warnings: node.warnings };
9
11
  }
@@ -1,40 +1,77 @@
1
1
  import { Type } from "typebox";
2
- import type { HistoryHost } from "../../model/history.js";
3
- import { requireThat } from "../../common/validation.js";
2
+ import { historyPageLimits, type HistoryHost, type HistoryQuery } from "../../model/history.js";
3
+ import { historyIdentifierPattern, requireThat } from "../../common/validation.js";
4
4
  import { schema } from "../../common/schema.js";
5
5
  import { inputObject, need, nullable, pick } from "../input.js";
6
6
 
7
- const host = Type.Union([Type.Literal("pi"), Type.Literal("dsh"), Type.Literal("claude")]);
7
+ const identifier = Type.String({ pattern: historyIdentifierPattern.source });
8
8
  const nullableOffset = Type.Union([Type.Integer(), Type.Null()]);
9
- const node = Type.Object({ host, id: Type.String(),
10
- kind: Type.Union([Type.Literal("session"), Type.Literal("exchange"), Type.Literal("summary")], { description: "session=会话根;summary=摘要;exchange=单轮问答原文。" }),
11
- sessionId: Type.String(), name: Type.String(), preview: Type.String(), from: Type.String(), to: Type.String(),
9
+ const node = Type.Object({
10
+ host: identifier,
11
+ id: Type.String(),
12
+ kind: Type.Union([Type.Literal("session"), Type.Literal("exchange"), Type.Literal("summary")], {
13
+ description: "session=会话根;summary=维度摘要;exchange=单轮问答原文。",
14
+ }),
15
+ dimension: Type.Optional(identifier),
16
+ sessionId: Type.String(),
17
+ name: Type.String(),
18
+ preview: Type.String(),
19
+ from: Type.String(),
20
+ to: Type.String(),
12
21
  ready: Type.Boolean({ description: "正文或摘要是否已生成。" }),
13
- completed: Type.Boolean({ description: "该对话或问答是否正常结束(false 表示中断或未完)。" }) });
22
+ completed: Type.Boolean({ description: "该对话或问答是否正常结束(false 表示中断或未完)。" }),
23
+ });
24
+
14
25
  export const historyResultSchema = Type.Object({
15
- matches: Type.Optional(Type.Array(Type.Object({ ...node.properties, snippet: Type.String(), parents: Type.Array(Type.String()) }))),
16
- total: Type.Optional(Type.Integer()), nextOffset: Type.Optional(nullableOffset),
17
- node: Type.Optional(Type.Object({ ...node.properties, text: Type.String(), totalLength: Type.Integer(), nextOffset: nullableOffset,
18
- parents: Type.Array(node), children: Type.Array(node), nextChildrenOffset: nullableOffset,
19
- source: Type.Object({ host, sessionId: Type.String({ description: "原始宿主会话 ID。" }), entryIds: Type.Array(Type.String()) }), warnings: Type.Array(Type.String()) })),
26
+ matches: Type.Optional(Type.Array(Type.Object({
27
+ ...node.properties,
28
+ snippet: Type.String(),
29
+ parents: Type.Array(Type.String()),
30
+ }))),
31
+ total: Type.Optional(Type.Integer()),
32
+ nextOffset: Type.Optional(nullableOffset),
33
+ node: Type.Optional(Type.Object({
34
+ ...node.properties,
35
+ text: Type.String(),
36
+ totalLength: Type.Integer(),
37
+ nextOffset: nullableOffset,
38
+ parents: Type.Array(node),
39
+ children: Type.Array(node),
40
+ nextChildrenOffset: nullableOffset,
41
+ source: Type.Object({
42
+ host: identifier,
43
+ sessionId: Type.String({ description: "原始宿主会话 ID。" }),
44
+ entryIds: Type.Array(Type.String()),
45
+ dimension: Type.Optional(identifier),
46
+ }),
47
+ warnings: Type.Array(Type.String()),
48
+ })),
20
49
  warnings: Type.Array(Type.String()),
21
50
  });
22
- export const historyDescription = "查询当前工作区的历史问答与归档,host 可筛选来源(pi/dsh/claude)。search 按不区分大小写的连续关键词匹配原文和摘要,省略 query 列出各会话;无匹配时换词。read 按节点 id 展开正文与上下级,nextOffset 续读正文,nextChildrenOffset 续读子节点;需要细节时读取 exchange 原文。归档不含工具调用日志。";
51
+
52
+ export const historyDescription =
53
+ "查询当前工作区的历史问答与各维度摘要,host 可筛选来源(如 pi、dsh、claude、antigravity),dimension 可筛选 raw 原文或特定摘要维度(如 monthly 月度汇总、session 会话摘要)。" +
54
+ "search 按不区分大小写的连续关键词匹配原文和摘要,省略 query 列出各会话或指定维度摘要;无匹配时换词。" +
55
+ "read 按节点 id 展开正文与上下级(可从 monthly 下钻至 session 摘要,再下钻至 exchange 原文),nextOffset 续读正文,nextChildrenOffset 续读子节点。归档不含工具调用日志。";
56
+
23
57
  export const historyParameters = Type.Object({
24
- action: Type.Union([Type.Literal("search"), Type.Literal("read")], { description: "search 搜索或列会话;read 读取指定节点正文与上下级。各动作仅读取自身字段,其余字段忽略。" }),
25
- host: nullable(Type.Union([Type.Literal("pi"), Type.Literal("dsh"), Type.Literal("claude")], { description: "可选来源筛选:pi、dsh 或 claude。" })),
26
- query: nullable(Type.String({ description: "仅 search:不区分大小写的连续关键词;省略时列出各会话。" })),
58
+ action: Type.Union([Type.Literal("search"), Type.Literal("read")], {
59
+ description: "search 搜索或列会话;read 读取指定节点正文与上下级。各动作仅读取自身字段,其余字段忽略。",
60
+ }),
61
+ host: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "可选来源筛选(如 pi、dsh、claude、antigravity)。" })),
62
+ dimension: nullable(Type.String({ pattern: historyIdentifierPattern.source, description: "仅 search:可选范围筛选(raw 表示仅原文,或指定摘要维度如 monthly、session;省略查全部)。" })),
63
+ query: nullable(Type.String({ description: "仅 search:不区分大小写的连续关键词;省略时列出各会话(或指定维度摘要)。" })),
27
64
  sessionId: nullable(Type.String({ description: "仅 search:限定在指定会话 ID 内搜索。" })),
28
65
  from: nullable(Type.String({ description: "仅 search:ISO 日期或时间下界。" })),
29
66
  to: nullable(Type.String({ description: "仅 search:ISO 日期或时间上界。" })),
30
67
  id: nullable(Type.String({ description: "仅 read,必填:search 或上下级返回的节点 id。" })),
31
68
  offset: nullable(Type.Integer({ minimum: 0, description: "search:匹配结果偏移;read:正文字符偏移。默认 0。" })),
32
- limit: nullable(Type.Integer({ minimum: 1, maximum: 24000, description: "search:最多返回条数(默认 20,上限 50);read:正文字符数(默认 12000)。" })),
69
+ limit: nullable(Type.Integer({ minimum: 1, maximum: historyPageLimits.read.max, description: `search:最多返回条数(默认 ${historyPageLimits.search.default},上限 ${historyPageLimits.search.max});read:正文字符数(默认 ${historyPageLimits.read.default})。` })),
33
70
  childrenOffset: nullable(Type.Integer({ minimum: 0, description: "仅 read:子节点列表偏移,默认 0;续读传上页 nextChildrenOffset。" })),
34
71
  }, { additionalProperties: false });
35
72
 
36
73
  export type HistoryInput =
37
- | { action: "search"; host?: HistoryHost; query?: string; sessionId?: string; from?: string; to?: string; offset?: number; limit?: number }
74
+ | ({ action: "search" } & HistoryQuery)
38
75
  | { action: "read"; id: string; host?: HistoryHost; offset?: number; limit?: number; childrenOffset?: number };
39
76
 
40
77
  const valid = schema(historyParameters);
@@ -42,13 +79,21 @@ const valid = schema(historyParameters);
42
79
  export function historyInput(value: unknown): HistoryInput {
43
80
  const args = inputObject(value, valid, "历史参数格式无效");
44
81
  if (args.action === "search") {
45
- const limit = args.limit === undefined ? 20 : args.limit as number;
46
- requireThat(limit <= 50, "search 的 limit 最多 50。");
47
- return { action: "search", ...(pick(args, ["host", "query", "sessionId", "from", "to", "offset", "limit"]) as
48
- Omit<Extract<HistoryInput, { action: "search" }>, "action">) };
82
+ const limit = args.limit === undefined ? historyPageLimits.search.default : args.limit as number;
83
+ requireThat(limit <= historyPageLimits.search.max, `search 的 limit 最多 ${historyPageLimits.search.max}。`);
84
+ return {
85
+ action: "search",
86
+ ...(pick(args, ["host", "dimension", "query", "sessionId", "from", "to", "offset", "limit"]) as
87
+ Omit<Extract<HistoryInput, { action: "search" }>, "action">),
88
+ };
89
+ }
90
+ if (args.action === "read") {
91
+ return {
92
+ action: "read",
93
+ id: need("read", args, "id"),
94
+ ...(pick(args, ["host", "offset", "limit", "childrenOffset"]) as
95
+ Omit<Extract<HistoryInput, { action: "read" }>, "action" | "id">),
96
+ };
49
97
  }
50
- if (args.action === "read") return { action: "read", id: need("read", args, "id"),
51
- ...(pick(args, ["host", "offset", "limit", "childrenOffset"]) as
52
- Omit<Extract<HistoryInput, { action: "read" }>, "action" | "id">) };
53
98
  throw new Error("未知的历史 action。");
54
99
  }
@@ -1,7 +1,6 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type { Agent } from "@deepseek-ai/dsh-agent";
3
- import type { HistoryService } from "../../services/history/history-service.js";
4
- import { dshParameters, dshOutputSchema } from "../../integrations/dsh/schema.js";
3
+ import { dshParameters, dshOutputSchema } from "../../integrations/hosts/dsh/schema.js";
5
4
  import { requireThat } from "../../common/validation.js";
6
5
  import { schema } from "../../common/schema.js";
7
6
  import { json } from "../../common/json.js";
@@ -9,15 +8,25 @@ import { markdownFields } from "../../common/markdown.js";
9
8
  import { historyDescription, historyInput, historyParameters, historyResultSchema } from "./contract.js";
10
9
  import { executeHistory } from "./actions.js";
11
10
 
12
- export function registerDshHistoryTool(ctx: Context, agent: Agent, service: HistoryService, lifetime: AbortSignal, check: () => void) {
11
+ export function registerDshHistoryTool(ctx: Context, agent: Agent, root: string, lifetime: AbortSignal, check: () => void) {
13
12
  const valid = schema(historyResultSchema);
14
- ctx.tools.register({ name: "pbot_history", description: historyDescription, parameters: dshParameters(historyParameters),
15
- output: { schema: dshOutputSchema(historyResultSchema), render: (_args, value) => [{ type: "text", text: "# 历史\n\n" + markdownFields(value) }] },
13
+ ctx.tools.register({
14
+ name: "pbot_history",
15
+ description: historyDescription,
16
+ parameters: dshParameters(historyParameters),
17
+ output: {
18
+ schema: dshOutputSchema(historyResultSchema),
19
+ render: (_args, value) => [{ type: "text", text: "# 历史\n\n" + markdownFields(value) }],
20
+ },
16
21
  async execute(value, exec) {
17
- check(); requireThat(exec.agent === agent, "历史工具不属于当前会话。");
22
+ check();
23
+ requireThat(exec.agent === agent, "历史工具不属于当前会话。");
18
24
  const signal = AbortSignal.any([exec.signal, lifetime]);
19
- const result = await executeHistory(service, historyInput(value), { host: "dsh", sessionId: agent.id }, signal);
20
- check(); signal.throwIfAborted(); requireThat(valid(result), "历史输出不符合契约。"); return json(result);
25
+ const result = executeHistory(root, historyInput(value), signal);
26
+ check();
27
+ signal.throwIfAborted();
28
+ requireThat(valid(result), "历史输出不符合契约。");
29
+ return json(result);
21
30
  },
22
31
  });
23
32
  }
@@ -0,0 +1,23 @@
1
+ import { defineTool, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { markdownResult } from "../result.js";
3
+ import { historyDescription, historyInput, historyParameters, historyResultSchema } from "./contract.js";
4
+ import { executeHistory } from "./actions.js";
5
+
6
+ export function registerPiHistoryTool(pi: ExtensionAPI, root: string, access: { check(): void }) {
7
+ const tool = defineTool({
8
+ namespace: { name: "pbot", description: "工作区历史查询。" },
9
+ name: "pbot_history",
10
+ label: "历史对话",
11
+ description: historyDescription,
12
+ parameters: historyParameters,
13
+ outputSchema: historyResultSchema,
14
+ async execute(_id, args, signal) {
15
+ access.check();
16
+ const result = executeHistory(root, historyInput(args), signal);
17
+ access.check();
18
+ return markdownResult(result, args.action === "search" ? "历史搜索" : "历史正文");
19
+ },
20
+ });
21
+ pi.registerTool(tool);
22
+ return () => pi.registerTool({ ...tool, exposure: "hidden" });
23
+ }
@@ -1,11 +1,8 @@
1
1
  import { object } from "../../common/json.js";
2
- import { stateLabel } from "../presentation.js";
3
2
 
4
3
  export const record = (value: unknown): Record<string, unknown> => { if (!object(value)) throw new Error("管理数据无效。"); return value; };
5
4
  export const rows = (value: unknown) => Array.isArray(value) ? value.map(record) : [];
6
5
  export const text = (value: unknown) => value === null || value === undefined ? "" : String(value);
7
- export const objectInput = (value: string) => record(JSON.parse(value || "{}"));
8
- export const lines = (value: string) => value.split(/\r?\n/).map(item => item.trim()).filter(Boolean);
9
6
 
10
7
  export function element<K extends keyof HTMLElementTagNameMap>(tag: K, content = "", className = "") {
11
8
  const node = document.createElement(tag); node.textContent = content; node.className = className; return node;
@@ -18,10 +15,9 @@ export function group(parent: HTMLElement, className = "pbot-stack") {
18
15
  export function details(parent: HTMLElement, title: string) {
19
16
  const node = element("details", "", "pbot-disclosure"); node.append(element("summary", title)); parent.append(node); return node;
20
17
  }
21
- export function field(parent: HTMLElement, label: string, multiline = false, value = "") {
22
- const wrapper = element("label", "", "pbot-field"), input = multiline ? element("textarea") : element("input");
23
- wrapper.append(element("span", label)); input.value = value; input.setAttribute("aria-label", label);
24
- if (input instanceof HTMLTextAreaElement) input.rows = 3;
18
+ export function field(parent: HTMLElement, label: string) {
19
+ const wrapper = element("label", "", "pbot-field"), input = element("input");
20
+ wrapper.append(element("span", label)); input.setAttribute("aria-label", label);
25
21
  wrapper.append(input); parent.append(wrapper); return input;
26
22
  }
27
23
  export function select(parent: HTMLElement, label: string, values: [string, string][]) {
@@ -30,9 +26,6 @@ export function select(parent: HTMLElement, label: string, values: [string, stri
30
26
  for (const [value, title] of values) { const option = element("option", title); option.value = value; input.append(option); }
31
27
  wrapper.append(input); parent.append(wrapper); return input;
32
28
  }
33
- export function badge(state: unknown) {
34
- const node = element("span", stateLabel(state), "pbot-badge"); node.dataset.state = text(state); return node;
35
- }
36
29
  export function facts(values: [string, unknown][]) {
37
30
  const node = element("dl", "", "pbot-facts");
38
31
  for (const [label, value] of values) node.append(element("dt", label), element("dd", text(value) || "—"));
@@ -41,8 +34,8 @@ export function facts(values: [string, unknown][]) {
41
34
  export function empty(title: string, description: string) {
42
35
  const node = element("div", "", "pbot-empty"); node.append(element("h3", title), note(description)); return node;
43
36
  }
44
- export function pageTitle(parent: HTMLElement, title: string, description: string) {
45
- const node = element("header", "", "pbot-page-title"); node.append(element("h2", title)); if (description) node.append(note(description)); parent.append(node); return node;
37
+ export function pageTitle(parent: HTMLElement, title: string) {
38
+ const node = element("header", "", "pbot-page-title"); node.append(element("h2", title)); parent.append(node); return node;
46
39
  }
47
40
  export function time(value: unknown) {
48
41
  const date = new Date(typeof value === "number" ? value : text(value));
@@ -1,6 +1,7 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import type {} from "@deepseek-ai/dsh-api-remotes/client";
3
3
  import type { SessionId } from "@deepseek-ai/dsh-session/types";
4
+ import { historyPageLimits } from "../../model/history.js";
4
5
  import { object, json } from "../../common/json.js";
5
6
  import { block, details, element, empty, facts, field, group, note, pageTitle, record, rows, select, text, time } from "./elements.js";
6
7
  import { managementStyles } from "./styles.js";
@@ -72,29 +73,28 @@ export function showManagement(ctx: Context, parentSessionId: SessionId) {
72
73
  if (!result.ok) throw new Error(result.error.message);
73
74
  lifetime.signal.throwIfAborted(); return record(result.value);
74
75
  }
75
- async function command(verb: string, input?: unknown, message = "操作已接纳。") {
76
- const result = await ctx.remote.commands.execute(parentSessionId, "/pbot " + verb + (input === undefined ? "" : " " + JSON.stringify(input)), []);
76
+ async function initializeWorkspace() {
77
+ const result = await ctx.remote.commands.execute(parentSessionId, "/pbot init", []);
77
78
  if (!result.ok) throw new Error(result.error.message + ";如连接中断,请先刷新记录确认操作是否已接纳。");
78
79
  if (!result.value) throw new Error("管理命令未被接纳。");
79
80
  if (result.value.result.kind === "error") throw new Error(result.value.result.text);
80
- inform(message);
81
+ inform("工作区已初始化并启用。");
81
82
  if (!closed) { try { await refresh(); } catch (error) { inform("操作已接纳;刷新状态未成功:" + String(error), "error"); } }
82
- return result.value.result.text ?? "";
83
83
  }
84
84
 
85
- const status = section("status", "工作区"); pageTitle(status, "工作区", "");
85
+ const status = section("status", "工作区"); pageTitle(status, "工作区");
86
86
  const counts = note(""), workspaceInfo = group(status); status.querySelector("header")!.after(counts); counts.classList.add("pbot-counts");
87
87
  const materials = group(status, "pbot-setting"); materials.append(element("h3", "资料目录"));
88
- const initializeButton = button(materials, "准备目录", async () => { await command("init", undefined, "工作区已初始化并启用。"); });
88
+ const initializeButton = button(materials, "准备目录", initializeWorkspace);
89
89
  const diagnostic = details(status, "环境详情"), statusBody = block(""); statusBody.classList.add("pbot-raw"); diagnostic.append(statusBody);
90
90
 
91
- const history = section("history", "历史"); pageTitle(history, "历史", "");
91
+ const history = section("history", "历史"); pageTitle(history, "历史");
92
92
  const searchForm = form(history); searchForm.className = "pbot-search";
93
- const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"]]);
93
+ const historyQuery = field(searchForm, "关键词"), host = select(searchForm, "来源", [["", "全部"], ["pi", "Pi"], ["dsh", "dsh"], ["claude", "Claude Code"], ["antigravity", "Antigravity"], ["codex", "Codex"], ["qoder", "Qoder CLI"]]);
94
94
  historyQuery.placeholder = "留空查看最近会话"; submit(searchForm, "查询", () => searchHistory());
95
95
  const dateFilters = details(history, "时间范围"), dateGrid = group(dateFilters, "pbot-grid");
96
96
  const historyFrom = field(dateGrid, "开始时间"), historyTo = field(dateGrid, "结束时间");
97
- for (const input of [historyFrom, historyTo]) (input as HTMLInputElement).type = "datetime-local";
97
+ for (const input of [historyFrom, historyTo]) input.type = "datetime-local";
98
98
  const historyBody = group(history, "pbot-history-results"), historyPaging = group(history, "pbot-pagination"), historyNode = group(history, "pbot-card"); historyNode.hidden = true;
99
99
  historyBody.append(empty("查询历史", "输入关键词,或留空查看最近会话。"));
100
100
  let historySearch: Record<string, unknown> = {};
@@ -114,11 +114,12 @@ export function showManagement(ctx: Context, parentSessionId: SessionId) {
114
114
  for (const match of rows(data.matches)) {
115
115
  const item = element("article"), meta = group(item, "pbot-between"); item.dataset.id = text(match.id); item.dataset.host = text(match.host);
116
116
  meta.append(element("h4", text(match.name)), element("span", text(match.host), "pbot-badge"));
117
- item.append(note(`${time(match.from)} · ${match.kind === "session" ? "会话" : match.kind === "summary" ? "摘要" : "问答"}`), block(match.snippet || match.preview));
117
+ const kindLabel = match.kind === "session" ? "会话" : match.kind === "summary" ? `摘要${match.dimension ? "·" + text(match.dimension) : ""}` : "问答";
118
+ item.append(note(`${time(match.from)} · ${kindLabel}`), block(match.snippet || match.preview));
118
119
  button(item, "读取", () => readHistory(text(match.id), text(match.host)), "pbot-quiet"); historyBody.append(item);
119
120
  }
120
121
  if (!rows(data.matches).length) historyBody.append(empty("没有找到匹配内容", "试试更短的关键词,或调整来源和时间范围。"));
121
- if (offset) button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset - 20), true));
122
+ if (offset) button(historyPaging, "上一页", () => searchHistory(Math.max(0, offset - historyPageLimits.search.default), true));
122
123
  if (typeof data.nextOffset === "number") button(historyPaging, "下一页", () => searchHistory(data.nextOffset as number, true));
123
124
  }
124
125
  async function readHistory(id: string, source: string, offset = 0, childrenOffset = 0) {
@@ -166,17 +167,32 @@ export function showManagement(ctx: Context, parentSessionId: SessionId) {
166
167
  }
167
168
  for (const control of tabs.values()) enabled(control, true);
168
169
  materials.hidden = false; initializeButton.textContent = "准备目录"; enabled(initializeButton, true);
169
- const historyState = record(snapshot.history);
170
+ const historyState = object(snapshot.history) ? snapshot.history : null;
171
+ const historyDims = historyState && Array.isArray(historyState.dimensions) ? rows(historyState.dimensions) : [];
172
+ const historySummaryText = !historyState
173
+ ? "已停用"
174
+ : `原始会话 ${text(historyState.rawCount ?? 0)}` + (historyDims.length
175
+ ? " · " + historyDims.map(dim => {
176
+ const pending = Number(dim.pendingCreate ?? 0) + Number(dim.pendingIncremental ?? 0) + Number(dim.pendingRebuild ?? 0);
177
+ return `${text(dim.dimension)} ${text(dim.ready ?? 0)}/${text(dim.total ?? 0)}${pending ? `(待处理 ${pending})` : ""}`;
178
+ }).join(",")
179
+ : "");
180
+ const historyReminder = historyState && object(historyState.reminder) && typeof historyState.reminder.message === "string"
181
+ ? historyState.reminder.message
182
+ : "";
170
183
  counts.textContent = "Personal Bot 已启动 · 跨 Harness 调度通过 MCP worker_* 提供";
171
184
  const model = object(snapshot.model) ? snapshot.model : {};
172
- workspaceInfo.replaceChildren(facts([
173
- ["状态", "已启动"],
174
- ["工作区", snapshot.workspaceRoot],
175
- ["配置文件", record(snapshot.configuration).path],
176
- ["模型", model.model || "尚未选择"],
177
- ["Provider", model.provider || "—"],
178
- ["历史", historyState.organizing ? "整理中" : historyState.pending === null ? "查询时更新索引" : `${historyState.pending} 项待整理`],
179
- ]));
185
+ workspaceInfo.replaceChildren(
186
+ facts([
187
+ ["状态", "已启动"],
188
+ ["工作区", snapshot.workspaceRoot],
189
+ ["配置文件", record(snapshot.configuration).path],
190
+ ["模型", model.model || "尚未选择"],
191
+ ["Provider", model.provider || "—"],
192
+ ["历史", historySummaryText],
193
+ ]),
194
+ ...(historyReminder ? [note(historyReminder)] : []),
195
+ );
180
196
  statusBody.textContent = JSON.stringify(snapshot, null, 2);
181
197
  }
182
198
 
@@ -20,15 +20,14 @@ export const managementStyles = `
20
20
  .pbot-management h2 { font-size: 21px; font-weight: 600; }
21
21
  .pbot-management h3 { font-size: 16px; font-weight: 600; }
22
22
  .pbot-management h4 { font-size: 14px; font-weight: 600; }
23
- .pbot-management button, .pbot-management input, .pbot-management textarea, .pbot-management select { font: inherit; color: inherit; }
23
+ .pbot-management button, .pbot-management input, .pbot-management select { font: inherit; color: inherit; }
24
24
  .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; }
25
25
  .pbot-management button:hover:not(:disabled) { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
26
26
  .pbot-management button:disabled { opacity: .45; cursor: not-allowed; }
27
- .pbot-management :is(button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }
27
+ .pbot-management :is(button, input, select, summary):focus-visible { outline: 2px solid var(--pbot-accent); outline-offset: 3px; }
28
28
  .pbot-management button.pbot-primary { background: var(--pbot-accent); border-color: var(--pbot-accent); color: var(--pbot-surface); font-weight: 600; }
29
29
  .pbot-management button.pbot-primary:hover:not(:disabled) { filter: brightness(.94); background: var(--pbot-accent); }
30
30
  .pbot-management button.pbot-quiet { border-color: transparent; background: transparent; }
31
- .pbot-management button.pbot-danger { color: var(--pbot-danger); }
32
31
  .pbot-management button[data-busy=true]::after { content: "…"; }
33
32
  .pbot-shell { height: 100%; display: grid; grid-template-columns: 178px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
34
33
  .pbot-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--pbot-line); }
@@ -39,7 +38,6 @@ export const managementStyles = `
39
38
  .pbot-nav { display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; background: var(--pbot-bg); border-right: 1px solid var(--pbot-line); }
40
39
  .pbot-nav button { text-align: left; justify-content: space-between; border-color: transparent; background: transparent; padding: 11px 12px; color: var(--pbot-muted); }
41
40
  .pbot-nav button[aria-selected=true] { color: var(--pbot-accent); background: var(--pbot-tint); font-weight: 600; }
42
- .pbot-nav small { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
43
41
  .pbot-main { min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 26px 28px; }
44
42
  .pbot-page-title { margin-bottom: 22px; display: grid; gap: 5px; }
45
43
  .pbot-muted { color: var(--pbot-muted); font-size: 13px; overflow-wrap: anywhere; }
@@ -50,7 +48,6 @@ export const managementStyles = `
50
48
  .pbot-notice[data-tone=error] { border-left-color: var(--pbot-danger); }
51
49
  .pbot-notice:empty { display: none; }
52
50
  .pbot-stack { display: grid; gap: 16px; }
53
- .pbot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
54
51
  .pbot-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
55
52
  .pbot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
56
53
  .pbot-counts { margin: -8px 0 20px !important; }
@@ -62,10 +59,6 @@ export const managementStyles = `
62
59
  .pbot-card > :is(h3, .pbot-between) { margin-bottom: 12px; }
63
60
  .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; }
64
61
  .pbot-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
65
- .pbot-badge:is([data-state=busy],[data-state=running],[data-state=starting]) { color: var(--pbot-accent); background: var(--pbot-tint); }
66
- .pbot-badge:is([data-state=error],[data-state=failed]) { color: var(--pbot-danger); }
67
- .pbot-badge[data-state=completed] { color: var(--dsw-alias-state-success-primary, #26834b); }
68
- .pbot-badge:is([data-state=paused],[data-state=stopping]) { color: var(--dsw-alias-state-warn-label, #9a6500); }
69
62
  .pbot-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 18px; margin: 12px 0; font-size: 13px; }
70
63
  .pbot-facts dt { color: var(--pbot-muted); }
71
64
  .pbot-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
@@ -75,33 +68,15 @@ export const managementStyles = `
75
68
  .pbot-disclosure .pbot-disclosure { background: var(--pbot-bg); }
76
69
  .pbot-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; font-size: 13px; }
77
70
  .pbot-field > span { font-weight: 500; }
78
- .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; }
79
- .pbot-field input[type=file] { padding: 7px; font-size: 12px; }
80
- .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; }
81
- .pbot-field textarea { resize: vertical; min-height: 84px; }
82
- .pbot-field input::placeholder, .pbot-field textarea::placeholder { color: var(--pbot-muted); opacity: .8; }
83
- .pbot-split { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 22px; align-items: start; }
84
- .pbot-list { display: grid; align-content: start; grid-auto-rows: max-content; gap: 6px; max-height: 470px; overflow-y: auto; padding: 3px; }
85
- .pbot-management .pbot-list-item { display: block; width: 100%; text-align: left; padding: 12px; border: 1px solid transparent; min-width: 0; }
86
- .pbot-list-item[aria-pressed=true] { background: var(--pbot-tint); border-color: color-mix(in srgb, var(--pbot-accent) 40%, var(--pbot-line)); }
87
- .pbot-list-item strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
88
- .pbot-list-item .pbot-muted { margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
71
+ .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; }
72
+ .pbot-field input::placeholder { color: var(--pbot-muted); opacity: .8; }
89
73
  .pbot-empty { padding: 38px 20px; border: 1px dashed var(--pbot-line); border-radius: 12px; text-align: center; display: grid; gap: 8px; }
90
74
  .pbot-empty h3 { font-weight: 550; }
91
75
  .pbot-empty button { justify-self: center; margin-top: 10px; }
92
- .pbot-detail { min-width: 0; display: grid; gap: 18px; }
93
- .pbot-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
94
76
  .pbot-prose { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 10px 0; line-height: 1.7; }
95
77
  .pbot-raw { font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; max-height: 340px; overflow: auto; }
96
- .pbot-transcript { margin-top: 14px; }
97
- .pbot-event { border-left: 2px solid var(--pbot-line); padding: 0 0 0 14px; margin: 18px 0; }
98
- .pbot-event .pbot-prose { font-size: 13px; }
99
- .pbot-event .pbot-row, .pbot-message .pbot-row { justify-content: space-between; }
100
78
  .pbot-management .pbot-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--pbot-muted); font-size: 12px; }
101
79
  .pbot-pagination button { font-size: 12px; min-height: 30px; padding: 5px 9px; }
102
- .pbot-message { padding: 16px 0; border-bottom: 1px solid var(--pbot-line); }
103
- .pbot-message:last-child { border-bottom: 0; }
104
- .pbot-message .pbot-prose { font-size: 13px; }
105
80
  .pbot-search { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: end; }
106
81
  .pbot-search .pbot-field { margin: 0; }
107
82
  .pbot-search > button { margin-bottom: 2px; }
@@ -114,16 +89,13 @@ export const managementStyles = `
114
89
  .pbot-shell { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr) auto; }
115
90
  .pbot-nav { flex-direction: row; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--pbot-line); }
116
91
  .pbot-nav button { flex: 1; justify-content: center; padding: 8px; }
117
- .pbot-nav small { display: none; }
118
92
  .pbot-main { padding: 22px 18px; }
119
93
  .pbot-notice { top: -22px; }
120
94
  .pbot-header { padding: 14px 18px; }
121
- .pbot-split { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); gap: 16px; }
122
95
  }
123
96
  @media (max-width: 600px) {
124
97
  .pbot-management { width: calc(100vw - 12px); height: calc(100dvh - 16px); }
125
- .pbot-grid, .pbot-split { grid-template-columns: minmax(0, 1fr); }
126
- .pbot-list { max-height: 215px; }
98
+ .pbot-grid { grid-template-columns: minmax(0, 1fr); }
127
99
  .pbot-search { grid-template-columns: minmax(0, 1fr) 110px; }
128
100
  .pbot-search > button { grid-column: 1 / -1; }
129
101
  .pbot-footer { padding: 8px 14px; }
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionContext, KeybindingsManager, Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { ScrollView, SelectList, Text, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
3
3
  import type { Component } from "@earendil-works/pi-tui";
4
- import { requireThat } from "../common/validation.js";
4
+ import { requireThat } from "../../common/validation.js";
5
5
 
6
6
  /** One confirmation owns its viewport, selection, and abort listener. */
7
7
  export class ConfirmationDialog implements Component {