personal-bot 0.3.2 → 0.3.4

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 (318) 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 +1 -1
  8. package/bin/pbot.mjs +22 -2
  9. package/docs/README.md +2 -0
  10. package/docs/architecture/design.md +16 -16
  11. package/docs/architecture/extensibility.md +29 -2
  12. package/docs/architecture/model-context.md +3 -2
  13. package/docs/architecture/principles.md +2 -2
  14. package/docs/guides/capabilities.md +1 -1
  15. package/docs/guides/cross-harness-workers.md +3 -1
  16. package/docs/guides/history.md +30 -7
  17. package/docs/guides/workspace-configuration.md +20 -3
  18. package/docs/hosts/antigravity.md +1 -1
  19. package/docs/hosts/claude-code.md +1 -1
  20. package/docs/hosts/codex-qoder.md +63 -0
  21. package/docs/maintainers/architecture-governance.md +78 -0
  22. package/lib/antigravity-plugin/DISCLAIMER.md +17 -0
  23. package/lib/antigravity-plugin/LICENSE +21 -0
  24. package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +36 -0
  25. package/lib/antigravity-plugin/lib/common/files.d.ts +2 -0
  26. package/lib/antigravity-plugin/lib/common/files.js +44 -0
  27. package/lib/antigravity-plugin/lib/common/validation.d.ts +4 -0
  28. package/lib/antigravity-plugin/lib/common/validation.js +8 -0
  29. package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +18 -0
  30. package/lib/antigravity-plugin/lib/extension/acp/member.js +44 -0
  31. package/lib/antigravity-plugin/lib/extension/acp-worker.js +71 -45
  32. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
  33. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-entry.js +22 -0
  34. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.d.ts +4 -0
  35. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +58 -0
  36. package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.d.ts +5 -0
  37. package/lib/antigravity-plugin/lib/extension/hosts/dsh/files.js +67 -0
  38. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.d.ts +3 -0
  39. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +100 -0
  40. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.d.ts +3 -1
  41. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +37 -22
  42. package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.d.ts +6 -0
  43. package/lib/antigravity-plugin/lib/extension/hosts/workspace-mcp.js +21 -0
  44. package/lib/antigravity-plugin/lib/extension/mcp.js +2577 -2255
  45. package/lib/antigravity-plugin/lib/extension/workspace-cli.js +20171 -0
  46. package/lib/antigravity-plugin/lib/integrations/agent-resources.js +1 -1
  47. package/lib/antigravity-plugin/lib/integrations/hosts/claude/adapter.js +7 -59
  48. package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.d.ts +2 -0
  49. package/lib/antigravity-plugin/lib/integrations/hosts/codex/adapter.js +14 -0
  50. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/mcp.d.ts +4 -0
  51. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/mcp.js +28 -0
  52. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.d.ts +36 -0
  53. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/messages.js +11 -0
  54. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.d.ts +6 -0
  55. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/resources.js +47 -0
  56. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.d.ts +4 -0
  57. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/root-agents.js +3 -0
  58. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.d.ts +8 -0
  59. package/lib/antigravity-plugin/lib/integrations/hosts/dsh/skills.js +31 -0
  60. package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
  61. package/lib/antigravity-plugin/lib/integrations/hosts/pi/agent-tools.js +32 -0
  62. package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.d.ts +4 -0
  63. package/lib/antigravity-plugin/lib/integrations/hosts/pi/mcp.js +23 -0
  64. package/lib/antigravity-plugin/lib/integrations/hosts/plugin-registry.d.ts +1 -0
  65. package/lib/antigravity-plugin/lib/integrations/hosts/plugin-registry.js +8 -1
  66. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
  67. package/lib/antigravity-plugin/lib/integrations/hosts/prompt-hooks.js +76 -0
  68. package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
  69. package/lib/antigravity-plugin/lib/integrations/hosts/qoder/adapter.js +16 -0
  70. package/lib/antigravity-plugin/lib/model/acp.d.ts +7 -3
  71. package/lib/antigravity-plugin/lib/model/acp.js +8 -0
  72. package/lib/antigravity-plugin/lib/model/agent.d.ts +121 -0
  73. package/lib/antigravity-plugin/lib/model/agent.js +4 -0
  74. package/lib/antigravity-plugin/lib/model/history.d.ts +10 -0
  75. package/lib/antigravity-plugin/lib/model/history.js +4 -1
  76. package/lib/antigravity-plugin/lib/model/plugin-host.d.ts +5 -0
  77. package/lib/antigravity-plugin/lib/model/workspace-config.d.ts +8 -12
  78. package/lib/antigravity-plugin/lib/model/workspace-config.js +2 -1
  79. package/lib/antigravity-plugin/lib/plugin.d.ts +2 -1
  80. package/lib/antigravity-plugin/lib/plugin.js +2 -2
  81. package/lib/antigravity-plugin/lib/services/history/history-capture.js +34 -22
  82. package/lib/antigravity-plugin/lib/services/history/summary-registry.js +2 -3
  83. package/lib/antigravity-plugin/lib/services/history/summary-runner.d.ts +2 -5
  84. package/lib/antigravity-plugin/lib/services/history/summary-runner.js +72 -74
  85. package/lib/antigravity-plugin/lib/services/history/workspace-history.d.ts +3 -0
  86. package/lib/antigravity-plugin/lib/services/history/workspace-history.js +6 -0
  87. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +15 -0
  88. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +126 -0
  89. package/lib/antigravity-plugin/lib/services/workspace/workspace-config.js +9 -8
  90. package/lib/antigravity-plugin/lib/services/workspace/workspace-files.d.ts +2 -0
  91. package/lib/antigravity-plugin/lib/services/workspace/workspace-files.js +17 -0
  92. package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.d.ts +14 -0
  93. package/lib/antigravity-plugin/lib/services/workspace/workspace-mcp.js +193 -0
  94. package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.d.ts +1 -0
  95. package/lib/antigravity-plugin/lib/services/workspace/workspace-skills.js +4 -2
  96. package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +11 -0
  97. package/lib/antigravity-plugin/lib/storage/acp-files.js +75 -0
  98. package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +31 -0
  99. package/lib/antigravity-plugin/lib/storage/agent-files.js +159 -0
  100. package/lib/antigravity-plugin/lib/storage/atomic-json.d.ts +3 -1
  101. package/lib/antigravity-plugin/lib/storage/atomic-json.js +43 -3
  102. package/lib/antigravity-plugin/lib/storage/history-files.d.ts +2 -1
  103. package/lib/antigravity-plugin/lib/storage/history-files.js +21 -15
  104. package/lib/antigravity-plugin/lib/storage/history-format.d.ts +2 -3
  105. package/lib/antigravity-plugin/lib/storage/history-format.js +5 -7
  106. package/lib/antigravity-plugin/package.json +1 -1
  107. package/lib/antigravity-plugin/plugin.json +1 -1
  108. package/lib/antigravity-plugin/resources/prompts/history-monthly-summary.md +13 -0
  109. package/lib/antigravity-plugin/resources/prompts/history-summary.md +13 -0
  110. package/lib/antigravity-plugin/resources/prompts/plugin-coordinator.md +1 -0
  111. package/lib/antigravity-plugin/resources/skills/.claude-plugin/plugin.json +4 -0
  112. package/lib/antigravity-plugin/resources/skills/project-maintenance/SKILL.md +35 -0
  113. package/lib/antigravity-plugin/resources/skills/provider-connections/SKILL.md +52 -0
  114. package/lib/antigravity-plugin/skills/pbot/SKILL.md +11 -1
  115. package/lib/client.js +22 -50
  116. package/lib/codex-marketplace/.agents/plugins/marketplace.json +17 -0
  117. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +7 -0
  118. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +17 -0
  119. package/lib/codex-marketplace/plugins/personal-bot/DISCLAIMER.md +17 -0
  120. package/lib/codex-marketplace/plugins/personal-bot/LICENSE +21 -0
  121. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +37 -0
  122. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +9 -0
  123. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/agents/openai.yaml +2 -0
  124. package/lib/common/validation.d.ts +4 -0
  125. package/lib/common/validation.js +8 -0
  126. package/lib/dsh.js +2 -2
  127. package/lib/extension/acp/member.d.ts +1 -1
  128. package/lib/extension/acp-worker.js +71 -45
  129. package/lib/extension/history/command.d.ts +37 -0
  130. package/lib/extension/history/command.js +57 -0
  131. package/lib/extension/hosts/dsh/acp-entry.d.ts +1 -0
  132. package/lib/extension/hosts/dsh/acp-entry.js +22 -0
  133. package/lib/extension/hosts/dsh/acp-member.js +4 -18
  134. package/lib/extension/hosts/dsh/command.d.ts +1 -2
  135. package/lib/extension/hosts/dsh/command.js +5 -49
  136. package/lib/extension/hosts/dsh/workspace.js +13 -44
  137. package/lib/extension/hosts/pi/acp-member.d.ts +3 -0
  138. package/lib/extension/hosts/pi/acp-member.js +100 -0
  139. package/lib/extension/hosts/plugin-runtime.d.ts +3 -1
  140. package/lib/extension/hosts/plugin-runtime.js +37 -22
  141. package/lib/extension/hosts/workspace-mcp.d.ts +6 -0
  142. package/lib/extension/hosts/workspace-mcp.js +21 -0
  143. package/lib/extension/mcp/bridge.d.ts +6 -8
  144. package/lib/extension/mcp/bridge.js +66 -84
  145. package/lib/extension/mcp/tool-contract.d.ts +735 -0
  146. package/lib/extension/mcp/tool-contract.js +441 -0
  147. package/lib/extension/mcp/workers.d.ts +29 -742
  148. package/lib/extension/mcp/workers.js +75 -525
  149. package/lib/extension/mcp.js +2577 -2255
  150. package/lib/extension/setup/cli.js +15 -0
  151. package/lib/extension/setup/upgrade.js +153 -0
  152. package/lib/extension/workspace-cli.js +20171 -0
  153. package/lib/integrations/acp/agents.d.ts +2 -3
  154. package/lib/integrations/acp/harnesses/dsh.js +1 -1
  155. package/lib/integrations/acp/harnesses/presets.js +8 -0
  156. package/lib/integrations/acp/history-summary.js +2 -1
  157. package/lib/integrations/acp/launch.d.ts +2 -2
  158. package/lib/integrations/agent-resources.js +1 -1
  159. package/lib/integrations/hosts/claude/adapter.js +7 -59
  160. package/lib/integrations/hosts/codex/adapter.d.ts +2 -0
  161. package/lib/integrations/hosts/codex/adapter.js +14 -0
  162. package/lib/integrations/hosts/pi/agent-tools.d.ts +3 -0
  163. package/lib/integrations/hosts/pi/agent-tools.js +32 -0
  164. package/lib/integrations/hosts/pi/mcp.d.ts +4 -0
  165. package/lib/integrations/hosts/pi/mcp.js +23 -0
  166. package/lib/integrations/hosts/plugin-registry.d.ts +1 -0
  167. package/lib/integrations/hosts/plugin-registry.js +8 -1
  168. package/lib/integrations/hosts/prompt-hooks.d.ts +76 -0
  169. package/lib/integrations/hosts/prompt-hooks.js +76 -0
  170. package/lib/integrations/hosts/qoder/adapter.d.ts +2 -0
  171. package/lib/integrations/hosts/qoder/adapter.js +16 -0
  172. package/lib/integrations/installation/cli-update.js +146 -0
  173. package/lib/integrations/installation/upgraders/antigravity.js +67 -0
  174. package/lib/integrations/installation/upgraders/claude.js +123 -0
  175. package/lib/integrations/installation/upgraders/codex.js +73 -0
  176. package/lib/integrations/installation/upgraders/dsh.js +62 -0
  177. package/lib/integrations/installation/upgraders/pi.js +90 -0
  178. package/lib/integrations/installation/upgraders/qoder.js +67 -0
  179. package/lib/integrations/installation/upgraders/registry.js +40 -0
  180. package/lib/model/acp.d.ts +7 -3
  181. package/lib/model/acp.js +8 -0
  182. package/lib/model/agent.d.ts +18 -4
  183. package/lib/model/agent.js +4 -1
  184. package/lib/model/history.d.ts +10 -0
  185. package/lib/model/history.js +4 -1
  186. package/lib/model/installation.js +1 -0
  187. package/lib/model/plugin-host.d.ts +5 -0
  188. package/lib/model/workspace-config.d.ts +8 -12
  189. package/lib/model/workspace-config.js +2 -1
  190. package/lib/plugin.d.ts +2 -1
  191. package/lib/plugin.js +2 -2
  192. package/lib/qoder-plugin/.mcp.json +17 -0
  193. package/lib/qoder-plugin/.qoder-plugin/plugin.json +7 -0
  194. package/lib/qoder-plugin/DISCLAIMER.md +17 -0
  195. package/lib/qoder-plugin/LICENSE +21 -0
  196. package/lib/qoder-plugin/hooks/hooks.json +37 -0
  197. package/lib/qoder-plugin/skills/pbot/SKILL.md +9 -0
  198. package/lib/services/agents/agent-service.d.ts +15 -45
  199. package/lib/services/agents/agent-service.js +22 -3
  200. package/lib/services/history/history-capture.js +34 -22
  201. package/lib/services/history/history-migrate.js +26 -60
  202. package/lib/services/history/history-query.js +38 -57
  203. package/lib/services/history/summary-command.d.ts +1 -1
  204. package/lib/services/history/summary-command.js +8 -7
  205. package/lib/services/history/summary-registry.js +2 -3
  206. package/lib/services/history/summary-runner.d.ts +2 -5
  207. package/lib/services/history/summary-runner.js +72 -74
  208. package/lib/services/history/workspace-history.d.ts +3 -0
  209. package/lib/services/history/workspace-history.js +6 -0
  210. package/lib/services/installation/setup-service.js +4 -1
  211. package/lib/services/installation/upgrade-service.js +95 -0
  212. package/lib/services/workspace/plugin-releases.d.ts +15 -0
  213. package/lib/services/workspace/plugin-releases.js +126 -0
  214. package/lib/services/workspace/workspace-config.js +9 -8
  215. package/lib/services/workspace/workspace-mcp.js +22 -29
  216. package/lib/services/workspace/workspace-skills.d.ts +1 -0
  217. package/lib/services/workspace/workspace-skills.js +4 -2
  218. package/lib/storage/acp-files.js +7 -12
  219. package/lib/storage/agent-files.js +6 -5
  220. package/lib/storage/atomic-json.d.ts +3 -1
  221. package/lib/storage/atomic-json.js +43 -3
  222. package/lib/storage/history-files.d.ts +2 -1
  223. package/lib/storage/history-files.js +21 -15
  224. package/lib/storage/history-format.d.ts +2 -3
  225. package/lib/storage/history-format.js +5 -7
  226. package/lib/tools/history/contract.d.ts +3 -11
  227. package/lib/tools/history/contract.js +8 -7
  228. package/lib/ui/dsh/elements.d.ts +2 -5
  229. package/lib/ui/dsh/elements.js +3 -16
  230. package/lib/ui/dsh/management.js +9 -9
  231. package/lib/ui/dsh/styles.d.ts +1 -1
  232. package/lib/ui/dsh/styles.js +5 -33
  233. package/package.json +4 -1
  234. package/resources/antigravity/skills/pbot/SKILL.md +11 -1
  235. package/resources/claude/skills/pbot/SKILL.md +11 -1
  236. package/resources/plugin/skills/pbot/SKILL.md +9 -0
  237. package/resources/prompts/history-coordinator.md +1 -0
  238. package/resources/prompts/plugin-coordinator.md +1 -0
  239. package/scripts/README.md +3 -2
  240. package/src/common/validation.ts +10 -0
  241. package/src/dsh.ts +2 -2
  242. package/src/extension/history/command.ts +68 -0
  243. package/src/extension/hosts/dsh/acp-entry.ts +21 -0
  244. package/src/extension/hosts/dsh/acp-member.ts +4 -15
  245. package/src/extension/hosts/dsh/command.ts +6 -46
  246. package/src/extension/hosts/dsh/workspace.ts +12 -38
  247. package/src/extension/hosts/pi/acp-member.ts +4 -10
  248. package/src/extension/hosts/pi/command.ts +14 -63
  249. package/src/extension/hosts/pi/events.ts +2 -8
  250. package/src/extension/hosts/pi/lifecycle.ts +3 -2
  251. package/src/extension/hosts/plugin-runtime.ts +39 -19
  252. package/src/extension/hosts/workspace-mcp.ts +25 -0
  253. package/src/extension/mcp/bridge.ts +80 -80
  254. package/src/extension/mcp/tool-contract.ts +462 -0
  255. package/src/extension/mcp/workers.ts +81 -551
  256. package/src/extension/setup/cli.ts +11 -1
  257. package/src/extension/setup/upgrade.ts +158 -0
  258. package/src/extension/setup/workspace-cli.ts +167 -0
  259. package/src/integrations/acp/agents.ts +2 -3
  260. package/src/integrations/acp/harnesses/dsh.ts +1 -1
  261. package/src/integrations/acp/harnesses/presets.ts +8 -0
  262. package/src/integrations/acp/history-summary.ts +2 -1
  263. package/src/integrations/agent-resources.ts +1 -1
  264. package/src/integrations/hosts/claude/adapter.ts +7 -53
  265. package/src/integrations/hosts/codex/adapter.ts +16 -0
  266. package/src/integrations/hosts/plugin-registry.ts +9 -1
  267. package/src/integrations/hosts/prompt-hooks.ts +72 -0
  268. package/src/integrations/hosts/qoder/adapter.ts +19 -0
  269. package/src/integrations/installation/cli-update.ts +144 -0
  270. package/src/integrations/installation/pi-bridge.ts +1 -1
  271. package/src/integrations/installation/pi-setup.ts +1 -1
  272. package/src/integrations/installation/processes.ts +1 -1
  273. package/src/integrations/installation/upgraders/antigravity.ts +68 -0
  274. package/src/integrations/installation/upgraders/claude.ts +123 -0
  275. package/src/integrations/installation/upgraders/codex.ts +73 -0
  276. package/src/integrations/installation/upgraders/dsh.ts +63 -0
  277. package/src/integrations/installation/upgraders/pi.ts +87 -0
  278. package/src/integrations/installation/upgraders/qoder.ts +68 -0
  279. package/src/integrations/installation/upgraders/registry.ts +48 -0
  280. package/src/model/acp.ts +11 -3
  281. package/src/model/agent.ts +20 -4
  282. package/src/model/history.ts +5 -0
  283. package/src/model/installation.ts +86 -0
  284. package/src/model/plugin-host.ts +5 -1
  285. package/src/model/workspace-config.ts +6 -12
  286. package/src/pbot.ts +13 -32
  287. package/src/plugin.ts +3 -3
  288. package/src/services/agents/agent-service.ts +29 -17
  289. package/src/services/history/history-capture.ts +30 -22
  290. package/src/services/history/history-migrate.ts +23 -50
  291. package/src/services/history/history-query.ts +34 -48
  292. package/src/services/history/summary-command.ts +9 -8
  293. package/src/services/history/summary-registry.ts +2 -3
  294. package/src/services/history/summary-runner.ts +72 -81
  295. package/src/services/history/workspace-history.ts +8 -0
  296. package/src/services/installation/setup-service.ts +9 -43
  297. package/src/services/installation/upgrade-service.ts +127 -0
  298. package/src/services/workspace/plugin-releases.ts +121 -0
  299. package/src/services/workspace/workspace-config.ts +9 -8
  300. package/src/services/workspace/workspace-mcp.ts +23 -28
  301. package/src/services/workspace/workspace-skills.ts +5 -2
  302. package/src/storage/acp-files.ts +7 -12
  303. package/src/storage/agent-files.ts +6 -5
  304. package/src/storage/atomic-json.ts +31 -4
  305. package/src/storage/history-files.ts +22 -15
  306. package/src/storage/history-format.ts +6 -8
  307. package/src/tools/history/contract.ts +9 -9
  308. package/src/tools/history/pi-tool.ts +6 -4
  309. package/src/ui/dsh/elements.ts +5 -12
  310. package/src/ui/dsh/management.ts +10 -10
  311. package/src/ui/dsh/styles.ts +5 -33
  312. package/lib/antigravity-plugin/lib/services/history/history-migrate.d.ts +0 -12
  313. package/lib/antigravity-plugin/lib/services/history/history-migrate.js +0 -88
  314. package/lib/ui/presentation.d.ts +0 -3
  315. package/lib/ui/presentation.js +0 -12
  316. package/src/tools/access.ts +0 -7
  317. package/src/tools/register.ts +0 -21
  318. package/src/ui/presentation.ts +0 -12
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"], ["antigravity", "Antigravity"]]);
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");
@@ -461,7 +433,7 @@ function showManagement(ctx, parentSessionId) {
461
433
  historyBody.append(item);
462
434
  }
463
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"));
464
- 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));
465
437
  if (typeof data.nextOffset === "number") button(historyPaging, "\u4E0B\u4E00\u9875", () => searchHistory(data.nextOffset, true));
466
438
  }
467
439
  async function readHistory(id, source, offset = 0, childrenOffset = 0) {
@@ -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.4",
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.4 \"$@\"",
8
+ "pbot",
9
+ "mcp"
10
+ ],
11
+ "env": {
12
+ "PBOT_HOST": "codex",
13
+ "PBOT_PLUGIN_VERSION": "0.3.4"
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.4 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.4 \"$@\"' 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.4 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.4 \"$@\"' 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.4 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.4 \"$@\"' 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.4 <子命令> --workspace "<workspaceRoot>"`。如果 `pbot --at-least 0.3.4` 返回 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
@@ -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);
@@ -6,7 +6,7 @@ export declare function acpMember(): Promise<{
6
6
  id: string;
7
7
  generation: string;
8
8
  configuration: import("../../model/workspace-config.js").WorkspaceConfiguration;
9
- features: import("../../model/workspace-config.js").ResolvedWorkspaceFeatures;
9
+ features: Readonly<Required<import("../../model/workspace-config.js").WorkspaceFeatures>>;
10
10
  check: () => void;
11
11
  context: () => Promise<{
12
12
  workspace: string;