personal-bot 0.3.4 → 0.3.6
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +191 -65
- package/README.zh-CN.md +189 -63
- package/bin/pbot.mjs +3 -17
- package/docs/README.md +1 -1
- package/docs/architecture/design.md +10 -9
- package/docs/architecture/extensibility.md +1 -1
- package/docs/architecture/principles.md +1 -1
- package/docs/hosts/antigravity.md +4 -2
- package/docs/hosts/pi.md +4 -15
- package/docs/maintainers/release.md +2 -2
- package/lib/antigravity-plugin/lib/common/paths.d.ts +1 -0
- package/lib/antigravity-plugin/lib/common/paths.js +2 -0
- package/lib/antigravity-plugin/lib/extension/acp-worker.js +26 -24
- package/lib/antigravity-plugin/lib/extension/cli.js +22495 -0
- package/lib/antigravity-plugin/lib/extension/mcp.js +22 -20
- package/lib/antigravity-plugin/lib/extension/workspace-cli.js +5 -20165
- package/lib/antigravity-plugin/package.json +1 -1
- package/lib/antigravity-plugin/plugin.json +1 -1
- package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +1 -1
- package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
- package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
- package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +1 -1
- package/lib/common/paths.d.ts +1 -0
- package/lib/common/paths.js +2 -0
- package/lib/extension/acp-worker.js +26 -24
- package/lib/extension/cli.js +22495 -0
- package/lib/extension/mcp.js +22 -20
- package/lib/extension/workspace-cli.js +5 -20165
- package/lib/qoder-plugin/.mcp.json +2 -2
- package/lib/qoder-plugin/.qoder-plugin/plugin.json +1 -1
- package/lib/qoder-plugin/hooks/hooks.json +3 -3
- package/lib/qoder-plugin/skills/pbot/SKILL.md +1 -1
- package/package.json +1 -1
- package/scripts/README.md +1 -1
- package/src/common/paths.ts +2 -0
- package/src/extension/cli/args.ts +104 -0
- package/src/extension/cli/commands/history.ts +81 -0
- package/src/extension/cli/commands/install.ts +77 -0
- package/src/extension/cli/commands/mcp.ts +165 -0
- package/src/extension/cli/commands/plugin.ts +33 -0
- package/src/extension/cli/commands/upgrade.ts +158 -0
- package/src/extension/cli/commands/workspace.ts +71 -0
- package/src/extension/cli/index.ts +192 -0
- package/src/extension/cli/types.ts +30 -0
- package/src/integrations/installation/cli-update.ts +3 -3
- package/src/integrations/installation/installers/antigravity.ts +49 -0
- package/src/integrations/installation/installers/claude.ts +30 -0
- package/src/integrations/installation/installers/codex.ts +56 -0
- package/src/integrations/installation/installers/dsh.ts +25 -0
- package/src/integrations/installation/installers/pi.ts +26 -0
- package/src/integrations/installation/installers/qoder.ts +49 -0
- package/src/integrations/installation/installers/registry.ts +48 -0
- package/src/integrations/installation/processes.ts +2 -41
- package/src/model/installation.ts +28 -36
- package/src/services/installation/install-service.ts +107 -0
- package/lib/common/package-source.js +0 -16
- package/lib/extension/setup/cli.js +0 -364
- package/lib/extension/setup/guard.js +0 -11
- package/lib/extension/setup/upgrade.js +0 -153
- package/lib/integrations/installation/cli-update.js +0 -146
- package/lib/integrations/installation/pi-bridge.js +0 -131
- package/lib/integrations/installation/pi-setup.js +0 -193
- package/lib/integrations/installation/processes.js +0 -140
- package/lib/integrations/installation/upgraders/antigravity.js +0 -67
- package/lib/integrations/installation/upgraders/claude.js +0 -123
- package/lib/integrations/installation/upgraders/codex.js +0 -73
- package/lib/integrations/installation/upgraders/dsh.js +0 -62
- package/lib/integrations/installation/upgraders/pi.js +0 -90
- package/lib/integrations/installation/upgraders/qoder.js +0 -67
- package/lib/integrations/installation/upgraders/registry.js +0 -40
- package/lib/integrations/installation/workspace.js +0 -21
- package/lib/model/installation.js +0 -1
- package/lib/services/installation/setup-service.js +0 -140
- package/lib/services/installation/upgrade-service.js +0 -95
- package/lib/ui/setup.js +0 -52
- package/resources/installer/plugins.json +0 -16
- package/src/extension/setup/cli.ts +0 -303
- package/src/extension/setup/guard.ts +0 -12
- package/src/extension/setup/upgrade.ts +0 -158
- package/src/extension/setup/workspace-cli.ts +0 -167
- package/src/integrations/installation/pi-bridge.ts +0 -109
- package/src/integrations/installation/pi-setup.ts +0 -162
- package/src/services/installation/setup-service.ts +0 -126
- package/src/ui/setup.ts +0 -40
package/README.zh-CN.md
CHANGED
|
@@ -4,116 +4,242 @@
|
|
|
4
4
|
|
|
5
5
|
**连接知识、研究与行动的跨 Harness 个人助手层。**
|
|
6
6
|
|
|
7
|
-
Personal Bot
|
|
7
|
+
Personal Bot 将 [Pi](https://pi.dev)、DeepSeek Harness(`dsh`)、Claude Code、Antigravity、Codex、Qoder CLI 及任意支持 MCP 的宿主接入同一份工作区——提供共享资料与技能、工作区统一 MCP、跨宿主历史对话,以及基于 ACP v1 的跨 Harness 专家调度。各宿主原生的子代理和团队能力保持独立,互不干扰。
|
|
8
8
|
|
|
9
|
-
快速导航:[文档总索引](docs/README.md) · [Pi](docs/hosts/pi.md) · [dsh](docs/hosts/dsh.md) · [Claude Code](docs/hosts/claude-code.md) · [Antigravity](docs/hosts/antigravity.md) · [
|
|
9
|
+
快速导航:[文档总索引](docs/README.md) · [Pi](docs/hosts/pi.md) · [dsh](docs/hosts/dsh.md) · [Claude Code](docs/hosts/claude-code.md) · [Antigravity](docs/hosts/antigravity.md) · [Codex 与 Qoder CLI](docs/hosts/codex-qoder.md)。
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 核心功能
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. **共享工作区与技能**
|
|
14
|
+
- 以统一目录沉淀长期事务、项目产物、可复用知识、外部接入手册、实验脚本与角色约定(`AGENTS.md`、`areas/`、`projects/`、`knowledge/`、`providers/`、`scratch/`、`agents/`、`.agents/skills/`)。
|
|
15
|
+
- 通过工作区根目录的 `.pbot/config.json` 显式启用(只检查绑定根目录,不向父目录继承);配置缺失、停用或损坏时保持休眠。
|
|
16
|
+
- 支持按模块精细开关 `features`(`prompts`、`skills`、`mcp`、`history`,默认均为 `true`),按需启用。
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
2. **跨 Harness 专家调度(`worker_*`)**
|
|
19
|
+
- 通过单一 stdio MCP 服务(`pbot mcp`)暴露 6 个读写分离的工具:`worker_discover`、`worker_create`、`worker_request`、`worker_response`、`worker_output`、`worker_close`。
|
|
20
|
+
- 内置 `pi`、`dsh`、`claude`、`antigravity`、`codex`、`qoder` 六种 ACP v1 预设,并支持在 `.pbot/config.json` 中接入任意自定义 ACP v1 程序。
|
|
21
|
+
- 与宿主原生子代理互补(Claude `Agent`/团队、Antigravity `invoke_subagent`/`/swarm`、dsh `subagent`),不拦截、不覆盖原生能力。
|
|
22
|
+
|
|
23
|
+
3. **工作区共享 MCP(`.pbot/mcp.json`)**
|
|
24
|
+
- 通过 `pbot mcp add|list|remove` 在工作区统一维护 stdio 与 Streamable HTTP MCP 服务,支持 `${ENV_VAR}` 环境变量展开,不保存明文凭据。
|
|
25
|
+
- Pi 与 dsh 直接原生挂载;插件宿主通过 `workspace_mcp_discover` / `workspace_mcp_call` 按需调用;ACP worker 自动继承同一组服务。
|
|
26
|
+
|
|
27
|
+
4. **跨宿主历史对话与摘要(`.pbot/history/`)**
|
|
28
|
+
- 将各已接入宿主的主会话原始问答统一归档到 `.pbot/history/raw/`(默认按年月分层)。
|
|
29
|
+
- 通过 `pbot history summary` 增量生成单会话与月度摘要。
|
|
30
|
+
- 通过 `pbot_history`(Pi / dsh)、MCP `history_search` / `history_read`(插件与其他 MCP 宿主)及 `pbot history` CLI 只读检索与逐层下钻。
|
|
18
31
|
|
|
19
|
-
|
|
32
|
+
### 宿主支持一览
|
|
33
|
+
|
|
34
|
+
| 宿主 | 接入方式 | 工作区启用 | 跨 Harness MCP | 历史对话 |
|
|
35
|
+
| --- | --- | --- | --- | --- |
|
|
36
|
+
| **Pi** | 原生扩展 | `/pbot init` | 自动挂载 + `/pbot worker` | `pbot_history` + `/pbot history` |
|
|
37
|
+
| **dsh** | 原生插件 + Web 工作台 | `/pbot init` | 自动挂载 + `/pbot worker` | `pbot_history` + Web 历史页 + `/pbot history` |
|
|
38
|
+
| **Claude Code** | 原生插件(hooks + MCP) | `/personal-bot:pbot init` | 自动挂载 | Hooks + MCP `history_*` |
|
|
39
|
+
| **Antigravity** | 原生插件(hooks + MCP) | `/pbot init` | 自动挂载 | Hooks + MCP `history_*` |
|
|
40
|
+
| **Codex** | 原生插件(hooks + MCP) | `pbot plugin codex init` | 自动挂载 | Hooks + MCP `history_*` |
|
|
41
|
+
| **Qoder CLI** | 原生插件(hooks + MCP) | `pbot plugin qoder init` | 自动挂载 | Hooks + MCP `history_*` |
|
|
42
|
+
| **其他 MCP 宿主**(Cursor 等) | Stdio MCP(`pbot mcp`) | `pbot init` | 手动配置 MCP | MCP `history_*` + CLI |
|
|
20
43
|
|
|
21
44
|
## 安装
|
|
22
45
|
|
|
23
|
-
|
|
46
|
+
**环境要求**:Linux 或 macOS,Node.js `22.19+` 与 npm(`dsh` 需要 Node.js `24.9+` 与 `pnpm`)。
|
|
24
47
|
|
|
25
|
-
###
|
|
48
|
+
### 1. 安装通用 CLI(推荐)
|
|
26
49
|
|
|
27
|
-
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g personal-bot
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
所有宿主共用 `pbot` CLI(`pbot install`、`pbot init`、`pbot status`、`pbot upgrade`、`pbot mcp`、`pbot history`)。如不想全局安装,可用 `npx personal-bot@latest` 代替 `pbot`。
|
|
55
|
+
|
|
56
|
+
### 2. 安装宿主插件
|
|
57
|
+
|
|
58
|
+
**方式一:通过 `pbot install` 统一安装(推荐)**
|
|
28
59
|
|
|
29
60
|
```bash
|
|
30
|
-
#
|
|
31
|
-
|
|
61
|
+
# 为本机所有已安装的宿主统一安装(未安装的宿主自动跳过)
|
|
62
|
+
pbot install all
|
|
32
63
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
64
|
+
# 或为单个宿主安装:pi | dsh | claude | antigravity | codex | qoder
|
|
65
|
+
pbot install pi --workspace /path/to/workspace
|
|
66
|
+
pbot install claude
|
|
36
67
|
```
|
|
37
68
|
|
|
38
|
-
|
|
69
|
+
可通过 `--dsh-profile <名称>` 指定 `dsh` profile(默认 `pbot`)。Codex 安装后需在 `/hooks` 中检查并信任 Personal Bot hooks 再开始会话。
|
|
70
|
+
|
|
71
|
+
**方式二:各宿主原生安装**
|
|
72
|
+
|
|
73
|
+
- **Pi**(在目标工作区根目录执行):`pi install --local npm:personal-bot` · [Pi 使用指南](docs/hosts/pi.md)
|
|
74
|
+
- **dsh**(`0.2.2-rc.1+`,Node.js `24.9+`,`pnpm`):`dsh plugin --profile pbot add personal-bot@latest`(首次创建 profile:`dsh --profile pbot --from-default-profile web --dump-config`) · [dsh 使用指南](docs/hosts/dsh.md)
|
|
75
|
+
- **Claude Code**(`2.1.325+`):`/plugin install personal-bot --marketplace realqiyan/personal-bot` · [Claude Code 使用指南](docs/hosts/claude-code.md)
|
|
76
|
+
- **Antigravity**(`agy` `1.5+`):`agy plugin install "$(npm root -g)/personal-bot/lib/antigravity-plugin"` · [Antigravity 使用指南](docs/hosts/antigravity.md)
|
|
77
|
+
- **Codex**:`codex plugin marketplace add "$(npm root -g)/personal-bot/lib/codex-marketplace" && codex plugin add personal-bot@pbot-local`(安装后在 `/hooks` 信任 hooks) · [Codex 与 Qoder CLI 指南](docs/hosts/codex-qoder.md)
|
|
78
|
+
- **Qoder CLI**:`qodercli plugin install "$(npm root -g)/personal-bot/lib/qoder-plugin"` · [Codex 与 Qoder CLI 指南](docs/hosts/codex-qoder.md)
|
|
79
|
+
- **其他 MCP 宿主(Cursor 等)**:将宿主的 stdio MCP 服务命令配置为 `pbot mcp`(或 `npx personal-bot@latest mcp`)。
|
|
80
|
+
|
|
81
|
+
## 使用
|
|
39
82
|
|
|
40
|
-
###
|
|
83
|
+
### 启用工作区
|
|
41
84
|
|
|
42
|
-
|
|
85
|
+
在目标工作区根目录初始化一次即可(所有宿主共用同一份 `.pbot/config.json`):
|
|
43
86
|
|
|
44
87
|
```bash
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
dsh plugin --profile pbot add personal-bot@latest
|
|
48
|
-
dsh --profile pbot
|
|
88
|
+
# 在终端执行(适用于所有宿主)
|
|
89
|
+
pbot init --workspace /path/to/workspace
|
|
49
90
|
```
|
|
50
91
|
|
|
51
|
-
|
|
92
|
+
或在宿主会话中执行对应命令:
|
|
93
|
+
- Pi / dsh / Antigravity:`/pbot init`
|
|
94
|
+
- Claude Code:`/personal-bot:pbot init`
|
|
95
|
+
- Codex / Qoder CLI:`pbot plugin codex init` 或 `pbot plugin qoder init`
|
|
96
|
+
|
|
97
|
+
`init` 会补建缺失的资料目录与根 `AGENTS.md`(不覆盖已有文件),并启用 `.pbot/config.json`:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"enabled": true,
|
|
102
|
+
"features": {
|
|
103
|
+
"prompts": true,
|
|
104
|
+
"skills": true,
|
|
105
|
+
"mcp": true,
|
|
106
|
+
"history": true
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
随时运行 `pbot status`(或会话内 `/pbot status`)查看启用状态与各宿主插件版本同步情况。详见[工作区配置](docs/guides/workspace-configuration.md)。
|
|
112
|
+
|
|
113
|
+
### 工作区目录说明
|
|
114
|
+
|
|
115
|
+
| 路径 | 用途 |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `.pbot/config.json` | 工作区启用开关、`features` 模块开关、`acp` 后端与 `history`/`summary` 配置 |
|
|
118
|
+
| `.pbot/mcp.json` | 工作区共享的 stdio / HTTP MCP 服务配置 |
|
|
119
|
+
| `.pbot/history/` | 各宿主原始问答(`raw/`)与派生摘要(`summaries/`) |
|
|
120
|
+
| `AGENTS.md` | 项目索引、工作约定与可选的跨 Harness 分工偏好 |
|
|
121
|
+
| `areas/`、`projects/`、`knowledge/` | 长期事务、项目产物与可复用知识方法 |
|
|
122
|
+
| `providers/` | 外部 CLI/MCP 使用手册与数据口径 |
|
|
123
|
+
| `scratch/` | 临时脚本、计算数据与实验环境 |
|
|
124
|
+
| `agents/` | 角色职责补充(`coordinator.md`、`general-purpose.md`) |
|
|
125
|
+
| `.agents/skills/` | 跨宿主共享的工作区自有技能(`<name>/SKILL.md`) |
|
|
126
|
+
|
|
127
|
+
### 常用功能
|
|
52
128
|
|
|
53
|
-
|
|
129
|
+
**1. 跨 Harness 专家调度(`worker_*`)**
|
|
54
130
|
|
|
55
|
-
|
|
131
|
+
在对话中直接要求调用其他宿主(例如“让 Codex 实现并测试模块 A”或“请 Claude 独立审查这份改动”),或在 Pi / dsh 中使用 `/pbot worker` 命令:
|
|
56
132
|
|
|
57
133
|
```text
|
|
58
|
-
/
|
|
134
|
+
/pbot worker overview
|
|
135
|
+
/pbot worker backends
|
|
136
|
+
/pbot worker models claude
|
|
137
|
+
/pbot worker create {"backend":"codex"}
|
|
59
138
|
```
|
|
60
139
|
|
|
61
|
-
|
|
140
|
+
使用内置 ACP 目标前,需先安装并登录对应目标程序(`pi-acp`、`dsh`、`@agentclientprotocol/claude-agent-acp`、`agy`、`@agentclientprotocol/codex-acp` 或 `qodercli`)。如需接入自定义 ACP v1 程序,在 `.pbot/config.json` 中声明即可:
|
|
62
141
|
|
|
63
|
-
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"enabled": true,
|
|
145
|
+
"acp": {
|
|
146
|
+
"my-harness": {
|
|
147
|
+
"command": "/absolute/path/to/my-acp",
|
|
148
|
+
"args": ["--stdio"],
|
|
149
|
+
"env": { "MY_HARNESS_MODE": "headless" },
|
|
150
|
+
"permission": "ask"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
64
155
|
|
|
65
|
-
|
|
156
|
+
详见[跨 Harness 专家调度](docs/guides/cross-harness-workers.md)。
|
|
66
157
|
|
|
67
|
-
|
|
158
|
+
**2. 管理工作区共享 MCP**
|
|
68
159
|
|
|
69
|
-
|
|
160
|
+
```bash
|
|
161
|
+
# 添加 stdio MCP 服务
|
|
162
|
+
pbot mcp add sqlite --description "本地 SQLite 查询" -- npx -y @modelcontextprotocol/server-sqlite ./data.db
|
|
163
|
+
|
|
164
|
+
# 添加 Streamable HTTP MCP 服务(用环境变量引用凭据)
|
|
165
|
+
pbot mcp add internal-api --url https://mcp.example.com/mcp --header Authorization='Bearer ${INTERNAL_MCP_TOKEN}'
|
|
166
|
+
|
|
167
|
+
# 查看或移除
|
|
168
|
+
pbot mcp list
|
|
169
|
+
pbot mcp remove sqlite
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**3. 跨宿主历史与摘要**
|
|
70
173
|
|
|
71
174
|
```bash
|
|
72
|
-
|
|
175
|
+
pbot history status
|
|
176
|
+
pbot history summary
|
|
177
|
+
pbot history search "评审决定" --limit 10
|
|
178
|
+
pbot history read <节点ID>
|
|
73
179
|
```
|
|
74
180
|
|
|
75
|
-
|
|
181
|
+
详见[历史对话](docs/guides/history.md)。
|
|
182
|
+
|
|
183
|
+
## 升级
|
|
76
184
|
|
|
77
|
-
###
|
|
185
|
+
### 统一升级(推荐)
|
|
78
186
|
|
|
79
|
-
|
|
187
|
+
在工作区根目录执行(或通过 `--workspace <目录>` 指定):
|
|
80
188
|
|
|
81
189
|
```bash
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
pbot mcp
|
|
190
|
+
pbot upgrade
|
|
191
|
+
# 等价别名:pbot update
|
|
85
192
|
```
|
|
86
193
|
|
|
87
|
-
|
|
194
|
+
`pbot upgrade` 会将全局 `pbot` CLI 与当前工作区已绑定的各宿主插件统一升级到 npm 最新稳定版,并保留各宿主原有安装作用域。常用选项:
|
|
88
195
|
|
|
89
|
-
|
|
196
|
+
- `--version <x.y.z>`:指定目标版本
|
|
197
|
+
- `--hosts <h1,h2>`:仅升级指定宿主(如 `claude,codex`)
|
|
198
|
+
- `--dsh-profile <名称>`:自动识别失败时显式指定 dsh profile
|
|
90
199
|
|
|
91
|
-
|
|
92
|
-
| --- | --- |
|
|
93
|
-
| `.pbot/config.json` | 全宿主共用的工作区启用与开放 ACP Harness 配置 |
|
|
94
|
-
| `AGENTS.md` | 项目导航、工作约定与可选的跨 Harness 分工偏好 |
|
|
95
|
-
| `areas/`、`projects/`、`knowledge/` | 长期事务、项目产物与可复用知识方法 |
|
|
96
|
-
| `providers/` | 外部 CLI/MCP 使用手册与数据口径 |
|
|
97
|
-
| `scratch/` | 临时脚本、计算数据与实验环境 |
|
|
98
|
-
| `agents/` | 角色职责补充(`coordinator.md`、`general-purpose.md`) |
|
|
99
|
-
| `.pbot/history/` | 各接入宿主的原始问答(`raw/`)与分层摘要(`summaries/`) |
|
|
200
|
+
同一工作区下多个宿主版本不一致时,`pbot status` 会标记 `outOfSync: true`。
|
|
100
201
|
|
|
101
|
-
|
|
202
|
+
### 单宿主手动升级
|
|
102
203
|
|
|
103
|
-
|
|
204
|
+
- **全局 CLI**:`npm install -g personal-bot@latest`
|
|
205
|
+
- **Pi**:`pi install --local npm:personal-bot@latest`(随后在 Pi 中执行 `/reload`)
|
|
206
|
+
- **dsh**:先停止运行中的 dsh 服务,再执行 `dsh plugin --profile pbot update personal-bot --latest`
|
|
207
|
+
- **Claude Code**:`claude plugin update personal-bot`(重启会话生效)
|
|
208
|
+
- **Antigravity**:先执行 `npm install -g personal-bot@latest`,再执行 `agy plugin install "$(npm root -g)/personal-bot/lib/antigravity-plugin"` 或 `pbot install antigravity`(重启会话生效)
|
|
209
|
+
- **Codex**:先执行 `npm install -g personal-bot@latest`,再执行 `codex plugin add personal-bot@pbot-local`(若 hooks 有变化,需在 `/hooks` 中重新确认信任)
|
|
210
|
+
- **Qoder CLI**:先执行 `npm install -g personal-bot@latest`,再执行 `qodercli plugin install "$(npm root -g)/personal-bot/lib/qoder-plugin"`
|
|
104
211
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
212
|
+
## 卸载
|
|
213
|
+
|
|
214
|
+
### 仅在单个工作区停用
|
|
215
|
+
|
|
216
|
+
如果只想在某个工作区停用 Personal Bot 而保留插件和资料,将 `.pbot/config.json` 中的 `"enabled"` 改为 `false`(或删除 `.pbot/config.json`)即可。
|
|
217
|
+
|
|
218
|
+
### 卸载插件与 CLI
|
|
219
|
+
|
|
220
|
+
按实际安装情况移除对应组件:
|
|
221
|
+
|
|
222
|
+
- **全局 CLI**:`npm uninstall -g personal-bot`
|
|
223
|
+
- **Pi**(在工作区根目录执行):`pi remove --local npm:personal-bot`
|
|
224
|
+
- **dsh**(先停止服务):`dsh plugin --profile pbot remove personal-bot`
|
|
225
|
+
- **Claude Code**:`claude plugin uninstall personal-bot`
|
|
226
|
+
- **Antigravity**:`agy plugin uninstall personal-bot`
|
|
227
|
+
- **Codex**:`codex plugin remove personal-bot@pbot-local`(可选:`codex plugin marketplace remove pbot-local`)
|
|
228
|
+
- **Qoder CLI**:`qodercli plugin uninstall personal-bot`
|
|
229
|
+
- **其他 MCP 宿主**:从宿主的 MCP 配置中移除 `pbot` 条目。
|
|
230
|
+
|
|
231
|
+
### 可选的数据清理
|
|
232
|
+
|
|
233
|
+
卸载操作不会删除你的工作区资料(`AGENTS.md`、`areas/`、`projects/`、`knowledge/`、`providers/`、`scratch/`、`agents/`、`.agents/skills/`)或本地状态。如需彻底清理 Personal Bot 状态文件,可手动删除:
|
|
234
|
+
|
|
235
|
+
- 工作区状态目录:工作区内的 `.pbot/`(含 `config.json`、`mcp.json` 与 `history/`)
|
|
236
|
+
- 用户级缓存与宿主绑定记录:`~/.pbot/`
|
|
237
|
+
|
|
238
|
+
## 文档与开发
|
|
113
239
|
|
|
114
|
-
- [文档总索引](docs/README.md)
|
|
115
|
-
- [架构原则](docs/architecture/principles.md) · [技术设计](docs/architecture/design.md) · [插件与 ACP 扩展设计](docs/architecture/extensibility.md)
|
|
116
|
-
-
|
|
240
|
+
- [文档总索引](docs/README.md) · [工作区配置](docs/guides/workspace-configuration.md) · [跨 Harness 专家调度](docs/guides/cross-harness-workers.md) · [历史对话](docs/guides/history.md) · [工具与执行能力](docs/guides/capabilities.md)
|
|
241
|
+
- [架构原则](docs/architecture/principles.md) · [技术设计](docs/architecture/design.md) · [插件与 ACP 扩展设计](docs/architecture/extensibility.md) · [npm 发布与验收](docs/maintainers/release.md) · [领域术语](CONTEXT.md)
|
|
242
|
+
- 参与开发与验证请参考 [AGENTS.md](AGENTS.md)。
|
|
117
243
|
|
|
118
244
|
## 许可证与免责声明
|
|
119
245
|
|
package/bin/pbot.mjs
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { main } from "../lib/extension/cli.js";
|
|
3
|
+
|
|
3
4
|
try {
|
|
4
|
-
|
|
5
|
-
const { main } = await import("../lib/extension/workspace-cli.js");
|
|
6
|
-
process.exitCode = await main(args);
|
|
7
|
-
} else {
|
|
8
|
-
const { updateForCommand, updateForWorkspace } = await import("../lib/extension/workspace-cli.js");
|
|
9
|
-
const updated = args.length && !["-h", "--help", "upgrade", "update"].includes(args[0]) ? await updateForCommand(args) : undefined;
|
|
10
|
-
if (updated !== undefined) {
|
|
11
|
-
process.exitCode = updated;
|
|
12
|
-
} else if (args[0] === "plugin") {
|
|
13
|
-
const { main } = await import("../lib/plugin.js");
|
|
14
|
-
await main(args.slice(1), (root, input) => updateForWorkspace(root, args, input));
|
|
15
|
-
} else {
|
|
16
|
-
const { main } = await import("../lib/extension/setup/cli.js");
|
|
17
|
-
process.exitCode = await main(args);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
5
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
20
6
|
} catch (error) {
|
|
21
7
|
console.error(error instanceof Error ? error.message : String(error));
|
|
22
8
|
process.exitCode = 1;
|
package/docs/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Personal Bot 文档按使用场景与职责分为四类,根目录 [README.zh-C
|
|
|
6
6
|
|
|
7
7
|
| 文档 | 适用对象与内容 |
|
|
8
8
|
| --- | --- |
|
|
9
|
-
| [Pi 使用指南](hosts/pi.md) | `pbot
|
|
9
|
+
| [Pi 使用指南](hosts/pi.md) | `pbot install pi` / 原生安装、`/pbot init\|status\|worker`、自动挂载 MCP `worker_*` 与 `pbot_history` |
|
|
10
10
|
| [dsh 使用指南](hosts/dsh.md) | profile 与插件管理、工作区/历史 Web 工作台、`/pbot` 聊天命令、自动挂载 MCP `worker_*` |
|
|
11
11
|
| [Claude Code 使用指南](hosts/claude-code.md) | 原生插件安装、command hooks、技能门控、MCP `worker_*` 与原生 Agent/团队互补 |
|
|
12
12
|
| [Codex 与 Qoder CLI](hosts/codex-qoder.md) | 原生插件安装、工作区启用、hook、历史与 MCP 工具 |
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
| `src/pbot.ts` / `src/dsh.ts` | Pi 与 dsh Host 装配(工作区生命周期、历史工具、原生 MCP 挂载) |
|
|
22
22
|
| `src/plugin.ts` / `src/claude.ts` | 通用插件宿主 CLI/hook 入口(查 `PluginHostRegistry`)与 Claude 兼容入口 |
|
|
23
23
|
| `src/mcp.ts` | 独立 stdio MCP 服务入口,暴露 6 个 `worker_*` 工具,按工作区功能与宿主原生挂载情况提供共享 MCP 和历史查询 |
|
|
24
|
-
| `src/extension/` | 运行时编排。 `hosts/` 装配宿主,`mcp/` 提供 MCP 服务与桥接,`acp/` 启动 worker,`history/` 执行共享历史命令,`
|
|
24
|
+
| `src/extension/` | 运行时编排。 `hosts/` 装配宿主,`mcp/` 提供 MCP 服务与桥接,`acp/` 启动 worker,`history/` 执行共享历史命令,`cli/` 提供统一 CLI 路由与各子命令实现,`setup/` 提供 Pi 初始化保护 |
|
|
25
25
|
| `src/integrations/` | 按外部集成域划分的适配器:`hosts/`(各宿主平级目录 `pi/`、`dsh/`、`claude/`、`antigravity/` 及 `plugin-registry.ts`)、`acp/`(协议、`harnesses/` 与独立摘要执行器 `history-summary.ts`)、`installation/`(安装桥接),以及跨宿主辅助(`agent-resources.ts`) |
|
|
26
26
|
| `src/services/` | 宿主无关业务规则(`agents/`、`workspace/`、`history/`、`installation/`) |
|
|
27
27
|
| `src/model/` | 纯数据类型与窄能力契约(`plugin-host.ts`、`acp.ts`、`agent.ts`、`history.ts`、`workspace-config.ts`),不含实现或宿主 SDK 类型 |
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
2. **跨宿主协议与运行域**:
|
|
42
42
|
- **ACP Harness**:实现 `AcpHarnessAdapter` 放入 `src/integrations/acp/harnesses/<name>.ts` 并在 `src/integrations/acp/registry.ts` 注册;运行时在 `src/extension/acp/`;辅助模块避免与适配器重名(如 `acp/claude-settings.ts`)。
|
|
43
43
|
- **MCP 服务与桥接**:统一放在 `src/extension/mcp/`。
|
|
44
|
-
-
|
|
44
|
+
- **统一 CLI 与安装器**:CLI 路由与命令处理器在 `src/extension/cli/`,宿主安装器与升级器在 `src/integrations/installation/`。
|
|
45
45
|
3. **宿主无关业务与共享模块**:业务规则放 `src/services/<domain>/`,纯数据契约放 `src/model/`,存储放 `src/storage/`,跨宿主 UI/展示辅助放 `src/ui/` 顶层。
|
|
46
46
|
|
|
47
47
|
所有单向依赖与宿主 SDK 隔离规则由 `.dependency-cruiser.cjs` 静态强制。`common/validation` 保持零第三方依赖,`common/schema`(Ajv)仅由 Pi/dsh 历史工具与管理查询显式引入。
|
|
@@ -69,18 +69,19 @@
|
|
|
69
69
|
- `atomic-json` 先校验对象再写入临时文件并原子替换,拒绝符号链接、路径越界与特殊文件;短目录锁(`.control` / `.write-<host>`)串行化控制写操作。
|
|
70
70
|
- 兼容线规则:发布版本遵循 `package.json` 的 `MAJOR.MINOR.PATCH`,1.0 前按次版本、之后按主版本判断控制记录兼容性,不引入自动迁移或存储版本计数器。
|
|
71
71
|
|
|
72
|
-
##
|
|
72
|
+
## 统一 CLI(`pbot`)
|
|
73
73
|
|
|
74
|
-
`bin/pbot.mjs`
|
|
75
|
-
- `pbot init|status` 与 `pbot history status|list|summary|migrate|search|read
|
|
76
|
-
- `pbot
|
|
77
|
-
- `pbot
|
|
78
|
-
- `pbot
|
|
74
|
+
`bin/pbot.mjs` 直接委派给独立打包的 `lib/extension/cli.js`(同时保留 `lib/extension/workspace-cli.js` 兼容入口供既有插件技能调用),由 `src/extension/cli/index.ts` 统一负责参数提取(`--workspace`、`--json`、`--help`)、本地探针(`--version`、`--at-least`)、工作区版本自动更新中间件与声明式命令分发:
|
|
75
|
+
- `pbot init|status` 与 `pbot history status|list|summary|migrate|search|read`:与 Pi/dsh 共用 `src/extension/history/command.ts`。根目录、精确版本和输出契约见[历史与 CLI 指南](../guides/history.md)。
|
|
76
|
+
- `pbot upgrade|update [--workspace <dir>] [--version <ver>] [--hosts <h1,h2>] [--dsh-profile <name>] [--json]`:统一升级全局 CLI 与当前工作区已绑定的各宿主插件。
|
|
77
|
+
- `pbot mcp [list|add|remove ...]`:无参数时运行独立打包的 `lib/extension/mcp.js` 供任意 MCP 客户端连接;带子命令时管理工作区 `.pbot/mcp.json`。
|
|
78
|
+
- `pbot plugin <host> hook|init|status`:经 `PluginHostRegistry` 运行轻插件宿主的无状态 hook 或工作区命令。
|
|
79
|
+
- `pbot install <host|all> [--workspace <dir>] [--dsh-profile <name>] [--json]`:经 `HostInstallerRegistry` 为指定宿主或本机已安装的各宿主统一安装插件。
|
|
79
80
|
|
|
80
81
|
## 构建与分发
|
|
81
82
|
|
|
82
83
|
构建顺序固定为 **`dist → build:cli → build:dsh → build:plugins`**(`build:cli` 清空 `lib/`):
|
|
83
|
-
1. `build:cli
|
|
84
|
+
1. `build:cli`:打包独立 CLI(`lib/extension/cli.js` 与 `lib/extension/workspace-cli.js` 兼容入口)。
|
|
84
85
|
2. `build:dsh`:编译 dsh Host,打包内置 TypeBox 及许可证,构建 Web 客户端模块 `lib/client.js`。
|
|
85
86
|
3. `build:plugins`:编译共享插件运行时(`lib/plugin.js`、`lib/claude.js`),用 `esbuild` 打包零外部依赖的 `lib/extension/mcp.js` 与 `lib/extension/acp-worker.js`(内联 `@agentclientprotocol/sdk`),执行已注册的各插件宿主目标(同步 Claude 清单、组装自包含 `lib/antigravity-plugin/`)。
|
|
86
87
|
|
|
@@ -88,7 +88,7 @@ MCP Server (src/extension/mcp/workers.ts) -> AgentService -> AcpWorkerHost -> sr
|
|
|
88
88
|
## 4. 可扩展宿主升级适配器(`HostUpgraderRegistry`)
|
|
89
89
|
|
|
90
90
|
```text
|
|
91
|
-
pbot upgrade|update (src/extension/
|
|
91
|
+
pbot upgrade|update (src/extension/cli/commands/upgrade.ts)
|
|
92
92
|
↓
|
|
93
93
|
src/services/installation/upgrade-service.ts (宿主无关编排与单宿主容错)
|
|
94
94
|
↓
|
|
@@ -21,7 +21,7 @@ Personal Bot 不绑定单一宿主,所有能力按两条正交主线组织:
|
|
|
21
21
|
## 保持单向依赖与对称目录维度
|
|
22
22
|
|
|
23
23
|
- 宿主入口与 extension 装配服务和适配器。tools 调用服务,UI 经宿主接口取得业务数据。services 与 integrations 通过 model 共享能力契约,两层分别访问所需存储。直接依赖见[技术设计](design.md),静态边界由 `.dependency-cruiser.cjs` 检查。
|
|
24
|
-
- `src/extension/` 按运行域划分为 `hosts/`、`mcp/`、`acp/`、`history/` 和 `setup/`。宿主与 CLI 在 `history/` 共用历史命令。 `src/integrations/` 按外部集成域划分为 `hosts/`、`acp/` 和 `installation/`。具体宿主在 `hosts/` 下平级建目录。详见[技术设计](design.md)。
|
|
24
|
+
- `src/extension/` 按运行域划分为 `hosts/`、`mcp/`、`acp/`、`history/`、`cli/` 和 `setup/`。宿主与 CLI 在 `history/` 共用历史命令。 `src/integrations/` 按外部集成域划分为 `hosts/`、`acp/` 和 `installation/`。具体宿主在 `hosts/` 下平级建目录。详见[技术设计](design.md)。
|
|
25
25
|
- 资源的创建、状态变更和释放由同一责任主体管理。工具与服务绑定工作区实例,关闭后旧调用失效。
|
|
26
26
|
|
|
27
27
|
## 区分两类文档方法论
|
|
@@ -7,14 +7,16 @@ Personal Bot 以自包含原生插件(`lib/antigravity-plugin/`)接入 Googl
|
|
|
7
7
|
支持 Linux 和 macOS,需要 Node.js 22.19+ 与 Antigravity CLI(`agy` 1.5+):
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npx personal-bot@latest install
|
|
10
|
+
npx personal-bot@latest install antigravity
|
|
11
|
+
# 或全局安装后使用
|
|
12
|
+
pbot install antigravity
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
从源码本地构建安装:
|
|
14
16
|
|
|
15
17
|
```sh
|
|
16
18
|
npm run build
|
|
17
|
-
node bin/pbot.mjs install
|
|
19
|
+
node bin/pbot.mjs install antigravity
|
|
18
20
|
# 或直接调用原生命令
|
|
19
21
|
agy plugin install ./lib/antigravity-plugin
|
|
20
22
|
```
|
package/docs/hosts/pi.md
CHANGED
|
@@ -4,23 +4,12 @@ Personal Bot 以 Pi 扩展形式接入 [Pi](https://pi.dev),提供共享工作
|
|
|
4
4
|
|
|
5
5
|
## 安装与启用
|
|
6
6
|
|
|
7
|
-
支持 Linux 和 macOS,需要 Node.js 22.19+ 与 npm
|
|
8
|
-
|
|
9
|
-
### 向导安装
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx personal-bot@latest setup
|
|
13
|
-
# 或直接指定工作区
|
|
14
|
-
npx personal-bot@latest setup --workspace ~/pbot-workspace
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
向导负责安装或更新 Pi 与工作区扩展,并在确认后启动 Pi 执行 `/pbot init`。已有全局或本地来源按原生规则保留,可按需切换到 npm 最新稳定版。
|
|
18
|
-
|
|
19
|
-
### 已有 Pi 安装
|
|
20
|
-
|
|
21
|
-
在目标工作区根目录执行:
|
|
7
|
+
支持 Linux 和 macOS,需要 Node.js 22.19+ 与 npm。在目标工作区根目录执行:
|
|
22
8
|
|
|
23
9
|
```bash
|
|
10
|
+
# 通过 pbot CLI 安装
|
|
11
|
+
pbot install pi
|
|
12
|
+
# 或使用 Pi 原生命令
|
|
24
13
|
pi install --local npm:personal-bot
|
|
25
14
|
pi
|
|
26
15
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# npm 发布与验收
|
|
2
2
|
|
|
3
|
-
发布配置以 `package.json` 为准:包名 `personal-bot`,registry 为 npmjs,稳定版本使用 `latest`。发布包包含 Pi 扩展源码、共享资源、独立 CLI(`
|
|
3
|
+
发布配置以 `package.json` 为准:包名 `personal-bot`,registry 为 npmjs,稳定版本使用 `latest`。发布包包含 Pi 扩展源码、共享资源、独立 CLI(`install` / `upgrade` / `mcp` / `history`)、dsh Host/Web、Claude 插件、自包含 `lib/antigravity-plugin/` 以及独立打包的 `lib/extension/{mcp,acp-worker}.js`。
|
|
4
4
|
|
|
5
5
|
## 首次配置
|
|
6
6
|
|
|
@@ -55,5 +55,5 @@ npm publish "./personal-bot-$VERSION.tgz" --ignore-scripts --access public --tag
|
|
|
55
55
|
2. Pi 消费检查:`node scripts/check-consumer.mjs npm:personal-bot@<version>`。
|
|
56
56
|
3. dsh:在独立 profile 安装 `personal-bot@latest`,核对 `/pbot status`、Web 工作区/历史页与 `mcp__pbot__worker_*`。
|
|
57
57
|
4. Claude Code:通过 `/plugin install personal-bot --marketplace realqiyan/personal-bot` 安装,核对版本、`/personal-bot:pbot status` 与 `worker_*` MCP。
|
|
58
|
-
5. Antigravity:通过 `npx personal-bot@latest install
|
|
58
|
+
5. Antigravity:通过 `npx personal-bot@latest install antigravity` 安装,核对 `/pbot status` 与 `worker_*` MCP。
|
|
59
59
|
6. 真实模型环境下各宿主首轮上下文、技能选择与跨 Harness 实测调用(含 `npm run test:e2e:acp`)在独立批准环境单独验收。
|