pi-courier 0.1.1 → 0.1.2
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/README.md +111 -243
- package/README.zh-CN.md +114 -245
- package/dist/setup.js +2 -2
- package/dist/setup.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,61 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Run the [pi coding agent](https://pi.dev)
|
|
5
|
+
Run the [pi coding agent](https://pi.dev) from **Matrix**. Send a message in a chat, pi answers — and every slash command, skill and prompt template works, exactly like in the terminal.
|
|
6
6
|
|
|
7
|
-
Unlike
|
|
7
|
+
Unlike pi's classic extension mode, pi-courier drives pi over the [RPC protocol](https://pi.dev/docs/latest/rpc), which is why commands work from chat: the extension mode can't do this because pi's `sendUserMessage()` deliberately skips command handling.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 1. What is it
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- 📱 Matrix transport (E2EE-capable), challenge-based auth (6-digit codes)
|
|
14
|
-
- 🎛️ Full slash-command support: `/new`, `/compact`, `/model`, `/thinking`, `/bash`, `/reload`, ...
|
|
15
|
-
- 🧩 Skills & prompt templates pass through: `/skill:name`, `/template`
|
|
16
|
-
- 💾 Session persistence: pi sessions live on disk, resume across restarts
|
|
17
|
-
- 🔄 `/reload` restarts the pi process (after installing extensions/config) — lossless
|
|
18
|
-
- 🔌 pi is **not bundled**: installed independently on the system, upgraded on its own
|
|
19
|
-
- 🧭 One-command CLI: `pi-courier setup` wizard, `pi-courier enable` auto-start, `pi-courier update` self-update
|
|
20
|
-
|
|
21
|
-
## Architecture
|
|
11
|
+
pi-courier is a small standalone service that bridges Matrix to a locally installed pi:
|
|
22
12
|
|
|
23
13
|
```
|
|
24
|
-
|
|
25
|
-
Messenger <── replies <────────────────────── <── agent events (stdout JSONL)
|
|
14
|
+
Matrix bot ←→ pi-courier ←→ pi --mode rpc (system-installed)
|
|
26
15
|
```
|
|
27
16
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
17
|
+
- **You talk to a Matrix bot account**; messages are forwarded to pi over the RPC protocol
|
|
18
|
+
- **Full command support**: `/new`, `/compact`, `/model`, `/thinking`, `/skill:name`, prompt templates, extension commands
|
|
19
|
+
- **pi is not bundled** — installed independently on the system, upgraded on its own
|
|
20
|
+
- **Sessions persist** to `~/.pi/agent/sessions` and resume automatically after restarts
|
|
21
|
+
- **One-command CLI**: setup wizard, systemd auto-start, self-update
|
|
22
|
+
|
|
23
|
+
## 2. Install
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
### Prerequisites
|
|
33
26
|
|
|
34
|
-
| Component | Requirement |
|
|
35
|
-
|
|
36
|
-
| Node.js | >= 20 (tested on 24.x) |
|
|
37
|
-
| pi | >= 0.83,
|
|
38
|
-
| Network | access to your homeserver and LLM provider | — |
|
|
27
|
+
| Component | Requirement |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Node.js | >= 20 (tested on 24.x) |
|
|
30
|
+
| pi | >= 0.83, installed **globally** |
|
|
39
31
|
|
|
40
|
-
Install pi first — pi-courier
|
|
32
|
+
Install pi first — pi-courier connects to it:
|
|
41
33
|
|
|
42
34
|
```bash
|
|
43
35
|
npm install -g @earendil-works/pi-coding-agent
|
|
44
36
|
pi --version
|
|
45
37
|
```
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
Using nvm? Run `source ~/.nvm/nvm.sh` in each new terminal so `pi` and `node` are on PATH.
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
### Option A: Regular users — one command
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g pi-courier
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
That's it. Verify: `pi-courier help`.
|
|
48
|
+
|
|
49
|
+
### Option B: Developers — from source
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
git clone https://github.com/Hi-Barry/pi-courier.git
|
|
53
53
|
cd pi-courier
|
|
54
54
|
npm install
|
|
55
|
-
npm link # make the `pi-courier` command available globally
|
|
56
55
|
npm run build
|
|
56
|
+
npm link # make the `pi-courier` command available globally
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
**Do not use `--ignore-scripts`**: the Matrix E2EE library
|
|
59
|
+
**Do not use `--ignore-scripts`**: the Matrix E2EE library downloads its native binary via postinstall. If your npm blocks it and you hit `Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu'`, run:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
62
|
cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
@@ -64,132 +64,66 @@ node download-lib.js
|
|
|
64
64
|
cd ../..
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Configuration
|
|
67
|
+
Slow download (20-60 kB/s)? The binary comes from GitHub Releases and ignores npm's proxy — set `export https_proxy=... http_proxy=...` first.
|
|
70
68
|
|
|
71
|
-
|
|
69
|
+
## 3. Get started
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
### Step 0 — Make sure pi can chat (one-time)
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
curl -s https://models.dev/api.json -o /tmp/modelsdev.json
|
|
77
|
-
python3 -c "
|
|
78
|
-
import json, os
|
|
79
|
-
md = json.load(open('/tmp/modelsdev.json')) # top level is the provider dict
|
|
80
|
-
out = {'providers': {'opencode-go': md['opencode-go']}}
|
|
81
|
-
json.dump(out, open(os.path.expanduser('~/.pi/agent/models.json'), 'w'), indent=2)
|
|
82
|
-
"
|
|
83
|
-
```
|
|
73
|
+
pi needs an LLM provider configured in `~/.pi/agent/` (`models.json`, `auth.json`, `settings.json`). Easiest check: run `pi`, send any message, confirm it answers. If it can't, configure it first — pi's own docs cover this; the field names are `defaultProvider`/`defaultModel` in `settings.json`.
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"opencode-go": { "type": "api_key", "key": "sk-your-key" }
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**c) settings.json** — default provider & model:
|
|
94
|
-
|
|
95
|
-
```json
|
|
96
|
-
{
|
|
97
|
-
"defaultProvider": "opencode-go",
|
|
98
|
-
"defaultModel": "deepseek-v4-flash"
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
> Field names are `defaultProvider`/`defaultModel` (not `provider`/`model`).
|
|
103
|
-
|
|
104
|
-
Verify (run inside the pi-courier project dir):
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
node --input-type=module -e "
|
|
108
|
-
import { RpcClient } from '@earendil-works/pi-coding-agent';
|
|
109
|
-
import { fileURLToPath } from 'node:url';
|
|
110
|
-
import path from 'node:path';
|
|
111
|
-
const entry = fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent'));
|
|
112
|
-
const c = new RpcClient({ cliPath: path.join(path.dirname(entry), 'cli.js') });
|
|
113
|
-
await c.start();
|
|
114
|
-
console.log('models:', (await c.getAvailableModels()).length);
|
|
115
|
-
console.log('current:', (await c.getState()).model?.id);
|
|
116
|
-
await c.stop();
|
|
117
|
-
"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Messenger (Matrix example)
|
|
121
|
-
|
|
122
|
-
**Option A (recommended): setup wizard**
|
|
75
|
+
### Step 1 — Run the setup wizard
|
|
123
76
|
|
|
124
77
|
```bash
|
|
125
78
|
pi-courier setup
|
|
126
79
|
```
|
|
127
80
|
|
|
128
|
-
|
|
81
|
+
It walks you through, prompting for each value (defaults in brackets; press Enter to accept):
|
|
129
82
|
|
|
130
|
-
**Option B: manual `~/.pi/msg-bridge.json`** (chmod 600):
|
|
131
|
-
|
|
132
|
-
```json
|
|
133
|
-
{
|
|
134
|
-
"matrix": {
|
|
135
|
-
"homeserverUrl": "https://your-homeserver",
|
|
136
|
-
"accessToken": "syt_...",
|
|
137
|
-
"encryption": true
|
|
138
|
-
},
|
|
139
|
-
"auth": {
|
|
140
|
-
"trustedUsers": ["matrix:@you:your-homeserver"],
|
|
141
|
-
"adminUserId": "matrix:@you:your-homeserver"
|
|
142
|
-
},
|
|
143
|
-
"workdir": "/path/to/pi/workdir",
|
|
144
|
-
"autoConnect": true,
|
|
145
|
-
"debug": true
|
|
146
|
-
}
|
|
147
83
|
```
|
|
84
|
+
=== pi-courier 首次配置向导 ===
|
|
85
|
+
将生成 ~/.pi/msg-bridge.json(权限 600)
|
|
148
86
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Everything goes through a single command:
|
|
87
|
+
Matrix homeserver URL (如 https://matrix.example.com): ← 输入,如 https://matrix.example.com
|
|
88
|
+
获取 token 方式 [1=用户名密码登录, 2=粘贴已有 token] (1): ← 1 或 2(Enter 默认 1)
|
|
89
|
+
[方式 1] bot 用户名 (如 test2): ← bot 账号名,如 test3
|
|
90
|
+
bot 密码: ← 密码(不回显)
|
|
91
|
+
[方式 2] 粘贴 access token (syt_...): ← 已有 token
|
|
92
|
+
✅ 登录成功,账号: @test3:matrix.example.com
|
|
93
|
+
信任用户(管理员)MXID [默认 @test3:matrix.example.com]: ← 你的账号,如 @barry:matrix.example.com
|
|
94
|
+
启用 E2EE 加密? [y/N]: ← y/n(非加密房间也选 y 无妨)
|
|
95
|
+
pi 工作目录 [默认 /home/you/Projects]: ← Enter 或输入其他目录
|
|
159
96
|
|
|
97
|
+
✅ 配置已写入 ~/.pi/msg-bridge.json
|
|
98
|
+
账号: @test3:...
|
|
99
|
+
信任用户: @barry:...
|
|
100
|
+
E2EE: 开启
|
|
101
|
+
工作目录: /home/you/Projects
|
|
160
102
|
```
|
|
161
|
-
pi-courier setup first-run configuration wizard (Matrix account, trusted user, workdir)
|
|
162
|
-
pi-courier run run in the foreground (workdir from config; --workdir overrides)
|
|
163
|
-
pi-courier enable install a user-level systemd service (auto-start) and start it
|
|
164
|
-
pi-courier start start the service
|
|
165
|
-
pi-courier stop stop the service
|
|
166
|
-
pi-courier restart restart the service
|
|
167
|
-
pi-courier status show service status + recent logs
|
|
168
|
-
pi-courier logs tail the service logs
|
|
169
|
-
pi-courier disable uninstall the service (stop + remove autostart + delete unit file)
|
|
170
|
-
pi-courier update update this project (git pull + npm install + build)
|
|
171
|
-
```
|
|
172
103
|
|
|
173
|
-
|
|
104
|
+
The wizard verifies the token and writes `~/.pi/msg-bridge.json`. To skip the wizard, create that file manually — the format is in the [FAQ](#4-faq).
|
|
105
|
+
|
|
106
|
+
### Step 2 — Start it
|
|
174
107
|
|
|
175
108
|
```bash
|
|
176
|
-
pi-courier
|
|
177
|
-
pi-courier enable # auto-start on boot, running as your user
|
|
109
|
+
pi-courier enable # install a systemd service: auto-start on boot + start now
|
|
178
110
|
```
|
|
179
111
|
|
|
180
|
-
|
|
112
|
+
Or run in the foreground for a quick test: `pi-courier run` (Ctrl+C to stop).
|
|
181
113
|
|
|
182
114
|
Startup success looks like:
|
|
183
115
|
|
|
184
116
|
```
|
|
185
|
-
✅ Matrix connected as @
|
|
117
|
+
✅ Matrix connected as @test3:... (2 rooms, E2EE enabled)
|
|
186
118
|
✅ pi RPC connected (model: deepseek-v4-flash, session: 019f...)
|
|
187
119
|
🚀 msg-bridge standalone ready. Waiting for messages...
|
|
188
120
|
```
|
|
189
121
|
|
|
190
|
-
###
|
|
122
|
+
### Step 3 — Use it from Matrix
|
|
191
123
|
|
|
192
|
-
**
|
|
124
|
+
1. **DM the bot** from your account
|
|
125
|
+
2. First time only: the bridge prints a **6-digit code** in its log (`pi-courier logs`); reply with the code to become a trusted user (the first trusted user becomes admin)
|
|
126
|
+
3. Chat normally, or send commands:
|
|
193
127
|
|
|
194
128
|
| Command | Action |
|
|
195
129
|
|---|---|
|
|
@@ -202,162 +136,96 @@ Startup success looks like:
|
|
|
202
136
|
| `/status` | Current model & state |
|
|
203
137
|
| `/name <name>` | Name the session |
|
|
204
138
|
| `/export [path]` | Export session HTML |
|
|
205
|
-
| `/bash <cmd>` | Run a shell command
|
|
139
|
+
| `/bash <cmd>` | Run a shell command |
|
|
206
140
|
| `/abort` | Abort current operation |
|
|
207
|
-
| `/reload` | Restart pi
|
|
141
|
+
| `/reload` | Restart pi (after installing extensions/config) |
|
|
208
142
|
| `/help` | Full help |
|
|
209
143
|
|
|
210
|
-
**Bridge admin commands
|
|
144
|
+
**Bridge admin commands**: `/trusted`, `/revoke <userId>`, `/channels`, `/enable <chatId> <mode>`, `/disable <chatId>`, `/toggletools`
|
|
211
145
|
|
|
212
|
-
**
|
|
146
|
+
**Anything else** starting with `/` passes through to pi directly — extension commands, `/skill:name`, prompt templates. Plain text is a normal conversation turn.
|
|
213
147
|
|
|
214
|
-
|
|
148
|
+
**Group chats**: enable the room first with `/enable <roomId> all` (in a DM to the bot).
|
|
215
149
|
|
|
216
|
-
|
|
217
|
-
2. The bridge terminal (or `journalctl --user -u pi-msg-bridge -f`) prints a 6-digit code
|
|
218
|
-
3. Reply with the code → you become a trusted user (the first trusted user becomes admin)
|
|
219
|
-
|
|
220
|
-
Users pre-listed in `msg-bridge.json` → `auth.trustedUsers` skip this step.
|
|
221
|
-
|
|
222
|
-
## systemd deployment
|
|
223
|
-
|
|
224
|
-
**User-level (recommended, no sudo):**
|
|
150
|
+
### Managing the service
|
|
225
151
|
|
|
226
152
|
```bash
|
|
227
|
-
pi-courier
|
|
153
|
+
pi-courier status # status + recent logs
|
|
154
|
+
pi-courier logs # tail logs
|
|
155
|
+
pi-courier restart # restart
|
|
156
|
+
pi-courier stop # stop
|
|
157
|
+
pi-courier start # start
|
|
158
|
+
pi-courier disable # uninstall the service
|
|
159
|
+
pi-courier update # update pi-courier itself
|
|
228
160
|
```
|
|
229
161
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
Commands: `pi-courier status`, `pi-courier logs`, `pi-courier stop`, `pi-courier start` (or `systemctl --user restart pi-msg-bridge`).
|
|
233
|
-
|
|
234
|
-
**System-level (needs sudo):** copy `deploy/pi-msg-bridge.service` to `/etc/systemd/system/`, adjust the three marked values (`User`, `WorkingDirectory`, `NVM_DIR`), then `sudo systemctl enable --now pi-msg-bridge`.
|
|
235
|
-
|
|
236
|
-
## Upgrading pi
|
|
237
|
-
|
|
238
|
-
pi is managed independently on the system — upgrade it, no bridge code changes:
|
|
162
|
+
Upgrading **pi** is independent — pi-courier always uses the system pi via `which pi`:
|
|
239
163
|
|
|
240
164
|
```bash
|
|
241
165
|
npm install -g @earendil-works/pi-coding-agent@latest
|
|
242
|
-
pi
|
|
243
|
-
pi-courier restart # or: systemctl --user restart pi-msg-bridge
|
|
166
|
+
pi-courier restart
|
|
244
167
|
```
|
|
245
168
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
## FAQ
|
|
249
|
-
|
|
250
|
-
### Installation & deployment
|
|
169
|
+
## 4. FAQ
|
|
251
170
|
|
|
252
|
-
**Q: `
|
|
253
|
-
A:
|
|
254
|
-
|
|
255
|
-
**Q: `npm install` hangs / crawls at ~20-60 kB/s?**
|
|
256
|
-
A: Two downloads are involved:
|
|
257
|
-
- npm registry packages → set npm proxy: `npm config set proxy http://...` and `npm config set https-proxy http://...`
|
|
258
|
-
- the 21 MB E2EE native lib (downloaded from GitHub Releases by matrix-sdk-crypto-nodejs) → does **not** use npm's proxy; export `https_proxy`/`http_proxy` env vars before installing (e.g. `export https_proxy=http://10.88.88.8:10809`). Add them to `~/.bashrc` to make it permanent.
|
|
171
|
+
**Q: `npm install` hangs / crawls at 20-60 kB/s?**
|
|
172
|
+
A: The 21 MB E2EE native library downloads from GitHub Releases and ignores npm's proxy. Set `export https_proxy=... http_proxy=...` (add to `~/.bashrc`) and reinstall.
|
|
259
173
|
|
|
260
174
|
**Q: `Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu'`?**
|
|
261
|
-
A: The native binary
|
|
262
|
-
```bash
|
|
263
|
-
cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
264
|
-
node download-lib.js
|
|
265
|
-
cd ../..
|
|
266
|
-
```
|
|
175
|
+
A: The native binary didn't download (postinstall blocked). Run manually: `cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs && node download-lib.js`.
|
|
267
176
|
|
|
268
177
|
**Q: `npm install -g pi-courier` fails with EEXIST?**
|
|
269
|
-
A: A previous `npm link` left a conflicting `pi-courier
|
|
270
|
-
```bash
|
|
271
|
-
npm unlink -g pi-courier
|
|
272
|
-
rm -f ~/.nvm/versions/node/v24.18.1/bin/pi-courier
|
|
273
|
-
npm install -g pi-courier
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
**Q: `pi-courier` command not found after `npm link`?**
|
|
277
|
-
A: The link was created before `npm run build`, so `dist/cli.js` didn't exist yet. Re-run `npm link` after building (or just install via npm instead).
|
|
278
|
-
|
|
279
|
-
**Q: The systemd service keeps restarting in a loop?**
|
|
280
|
-
A: The pi child process crashed — almost always a Node version mismatch. The bridge spawns pi via PATH, and systemd's default PATH may find a system node (e.g. v20) that pi's undici is incompatible with (`webidl.util.markAsUncloneable is not a function`). Fix: load nvm (`source ~/.nvm/nvm.sh`) and re-run `pi-courier enable` (v0.1.2+ writes `Environment=PATH=<nvm bin first>` into the unit automatically). Stick to one Node version (nvm v24) everywhere.
|
|
178
|
+
A: A previous `npm link` left a conflicting bin. `npm unlink -g pi-courier && rm -f $(npm prefix -g)/bin/pi-courier && npm install -g pi-courier`.
|
|
281
179
|
|
|
282
|
-
|
|
180
|
+
**Q: The systemd service restarts in a loop?**
|
|
181
|
+
A: Almost always a Node version mismatch — the pi child crashes on system node v20 (`webidl.util.markAsUncloneable is not a function`). Load nvm and re-run `pi-courier enable` (v0.1.2+ writes the correct PATH into the unit). Stick to one Node version everywhere.
|
|
283
182
|
|
|
284
|
-
**Q: Startup
|
|
285
|
-
A: pi's provider isn't configured. Check
|
|
286
|
-
|
|
287
|
-
**Q: `getAvailableModels` returns nothing?**
|
|
288
|
-
A: `models.json` is malformed. Regenerate it with the models.dev extraction command in the Configuration section.
|
|
289
|
-
|
|
290
|
-
**Q: `no transports configured` at startup?**
|
|
291
|
-
A: The bridge config is empty. Check `~/.pi/msg-bridge.json` (run `pi-courier setup`) or the `PI_*` env vars.
|
|
292
|
-
|
|
293
|
-
**Q: Weird `DeprecationWarning: util._extend` appears during setup?**
|
|
294
|
-
A: Known noise from a transport dependency, filtered since v0.1.0 — update pi-courier if you still see it.
|
|
295
|
-
|
|
296
|
-
### Messaging & encryption
|
|
183
|
+
**Q: Startup shows `model: unknown`?**
|
|
184
|
+
A: pi's provider isn't configured. Check `~/.pi/agent/`: `models.json` + `auth.json` + `settings.json` (`defaultProvider` / `defaultModel` — exact field names).
|
|
297
185
|
|
|
298
186
|
**Q: Lots of `Decryption error` lines in the log?**
|
|
299
|
-
A: Historical events that can't be decrypted (new device without old keys). Normal — new messages
|
|
187
|
+
A: Historical events that can't be decrypted (new device without old keys). Normal — new messages work fine.
|
|
300
188
|
|
|
301
189
|
**Q: Encrypted room: no reply / can't decrypt new messages?**
|
|
302
|
-
A: The bot's new device never received the room keys
|
|
303
|
-
- In Element (web: Settings → Security & Privacy → Encryption), make sure "Only share keys with verified devices" is unchecked, then send a message in the room
|
|
304
|
-
- The bot account has no cross-signing, so user verification shows "unavailable" — device-level trust is the relevant one, but the simplest reliable fix is: **use a non-encrypted room** (create a room without encryption enabled and invite the bot). The bridge handles plain rooms fine even with `encryption: true`.
|
|
190
|
+
A: The bot's new device never received the room keys. The bot account has no cross-signing, so the most reliable fix is to **use a non-encrypted room** (create a room without encryption and invite the bot) — the bridge handles plain rooms fine even with `encryption: true`.
|
|
305
191
|
|
|
306
|
-
**Q: `M_BAD_JSON: Provided device_id in device_keys does not match
|
|
307
|
-
A: The crypto store holds an old device identity but
|
|
308
|
-
```bash
|
|
309
|
-
rm -rf ~/.pi/msg-bridge-matrix-crypto
|
|
310
|
-
pi-courier restart
|
|
311
|
-
```
|
|
312
|
-
Remember this whenever you re-run setup / change the token.
|
|
313
|
-
|
|
314
|
-
**Q: Matrix connection fails (wrong homeserver/token)?**
|
|
315
|
-
A: Verify the token: `curl -H "Authorization: Bearer <token>" https://homeserver/_matrix/client/v3/account/whoami`.
|
|
192
|
+
**Q: `M_BAD_JSON: Provided device_id in device_keys does not match...`?**
|
|
193
|
+
A: The crypto store holds an old device identity but the token belongs to a newer device (re-logged). Delete and restart: `rm -rf ~/.pi/msg-bridge-matrix-crypto && pi-courier restart`. Do this whenever you re-run setup / change the token.
|
|
316
194
|
|
|
317
|
-
**Q: First message
|
|
318
|
-
A: That's the challenge auth — reply with the code to become a trusted user
|
|
195
|
+
**Q: First message asks for a 6-digit code?**
|
|
196
|
+
A: That's the challenge auth — reply with the code to become a trusted user.
|
|
319
197
|
|
|
320
198
|
**Q: No reply to messages at all?**
|
|
321
|
-
A: Check in order: (1) `pi-courier status`
|
|
322
|
-
|
|
323
|
-
### Running & maintenance
|
|
199
|
+
A: Check in order: (1) `pi-courier status` — Matrix connected? Decryption errors (encrypted room)? (2) pi RPC connected? (3) the model call itself — curl the provider endpoint with your key.
|
|
324
200
|
|
|
325
201
|
**Q: `pi RPC did not become ready`?**
|
|
326
|
-
A:
|
|
327
|
-
```bash
|
|
328
|
-
node node_modules/@earendil-works/pi-coding-agent/dist/cli.js --mode rpc
|
|
329
|
-
```
|
|
330
|
-
Common causes: Node version mismatch (see service restart loop above), invalid provider config, no network access to the provider.
|
|
202
|
+
A: pi failed to start. Run `node node_modules/@earendil-works/pi-coding-agent/dist/cli.js --mode rpc` manually to see the real error. Common causes: Node version mismatch, invalid provider config, no network to the provider.
|
|
331
203
|
|
|
332
204
|
**Q: After a restart the conversation context is gone?**
|
|
333
|
-
A: Since v0.1.1 the bridge passes `--continue` to pi, resuming the most recent session per workdir
|
|
205
|
+
A: Since v0.1.1 the bridge passes `--continue` to pi, resuming the most recent session per workdir. Update pi-courier and restart; `/new` starts a fresh session and the next restart resumes that one.
|
|
334
206
|
|
|
335
207
|
**Q: Element (web client) intercepts `/`-prefixed messages?**
|
|
336
208
|
A: Prefix with `//` to send a literal slash (`//compact` sends `/compact`).
|
|
337
209
|
|
|
338
|
-
**Q:
|
|
339
|
-
A:
|
|
210
|
+
**Q: What exactly is in `~/.pi/msg-bridge.json`?**
|
|
211
|
+
A: The wizard-generated config. Example:
|
|
340
212
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
npm run build # compile
|
|
351
|
-
npm run typecheck # type-check
|
|
352
|
-
npm run test # unit tests (vitest)
|
|
353
|
-
npm run lint # biome lint
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"matrix": { "homeserverUrl": "https://matrix.example.com", "accessToken": "syt_...", "encryption": true },
|
|
216
|
+
"auth": { "trustedUsers": ["matrix:@you:matrix.example.com"], "adminUserId": "matrix:@you:matrix.example.com" },
|
|
217
|
+
"workdir": "/home/you/Projects",
|
|
218
|
+
"autoConnect": true,
|
|
219
|
+
"debug": true
|
|
220
|
+
}
|
|
354
221
|
```
|
|
355
222
|
|
|
356
|
-
|
|
357
|
-
|
|
223
|
+
Env var alternatives: `PI_MATRIX_HOMESERVER` / `PI_MATRIX_ACCESS_TOKEN`.
|
|
224
|
+
|
|
225
|
+
## 5. License & Acknowledgements
|
|
358
226
|
|
|
359
|
-
|
|
227
|
+
MIT License — see [LICENSE](LICENSE).
|
|
360
228
|
|
|
361
|
-
MIT
|
|
229
|
+
**Upstream**: this project is a rework of [tintinweb/pi-messenger-bridge](https://github.com/tintinweb/pi-messenger-bridge) (MIT). The Matrix transport layer and challenge auth come from upstream; the RPC-based standalone architecture, slash-command mapping, CLI, setup wizard and docs are new.
|
|
362
230
|
|
|
363
|
-
|
|
231
|
+
pi-courier is an independent companion app for [pi](https://pi.dev) — it is not affiliated with Earendil Inc.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,61 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
通过 **Matrix**
|
|
5
|
+
通过 **Matrix** 远程使用 [pi coding agent](https://pi.dev)。在聊天里发消息,pi 回复 —— 而且 slash 命令、技能、提示词模板**全部可用**,和终端里一模一样。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
与 pi 经典的扩展模式不同,pi-courier 通过 [RPC 协议](https://pi.dev/docs/latest/rpc)驱动 pi,这是命令能在聊天里生效的原因:扩展模式做不到,因为 pi 的 `sendUserMessage()` 刻意跳过了命令解析。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 1. 是什么
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- 📱 Matrix 传输(支持 E2EE)、6 位验证码挑战认证
|
|
14
|
-
- 🎛️ slash 命令全支持:`/new`、`/compact`、`/model`、`/thinking`、`/bash`、`/reload` 等
|
|
15
|
-
- 🧩 技能与提示词模板透传:`/skill:名称`、`/模板名` 直接生效
|
|
16
|
-
- 💾 会话持久化:pi 会话存磁盘,重启自动恢复
|
|
17
|
-
- 🔄 `/reload` 重启 pi 进程:装新插件、改配置后一条命令生效,会话无损
|
|
18
|
-
- 🔌 不打包 pi:作为 pi 的伴侣程序独立部署,通过 RPC 连接系统安装的 pi,pi 独立升级
|
|
19
|
-
- 🧭 一条命令搞定: `pi-courier setup` 配置向导、`pi-courier enable` 开机自启、`pi-courier update` 自更新
|
|
20
|
-
|
|
21
|
-
## 架构
|
|
11
|
+
pi-courier 是一个把 Matrix 桥接到本机 pi 的轻量独立服务:
|
|
22
12
|
|
|
23
13
|
```
|
|
24
|
-
|
|
25
|
-
Messenger <── 回复 <────────────────────────── <── agent 事件流(stdout JSONL)
|
|
14
|
+
Matrix bot ←→ pi-courier ←→ pi --mode rpc(系统安装)
|
|
26
15
|
```
|
|
27
16
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
17
|
+
- **你和 Matrix bot 账号对话**;消息通过 RPC 协议转发给 pi
|
|
18
|
+
- **命令全支持**:`/new`、`/compact`、`/model`、`/thinking`、`/skill:名称`、提示词模板、扩展命令
|
|
19
|
+
- **不捆绑 pi** —— pi 独立安装、独立升级
|
|
20
|
+
- **会话持久化**到 `~/.pi/agent/sessions`,重启自动恢复
|
|
21
|
+
- **一条命令的 CLI**:配置向导、systemd 开机自启、自动更新
|
|
22
|
+
|
|
23
|
+
## 2. 怎么装
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
### 前置条件
|
|
33
26
|
|
|
34
|
-
| 组件 | 要求 |
|
|
35
|
-
|
|
36
|
-
| Node.js |
|
|
37
|
-
| pi |
|
|
38
|
-
| 网络 | 能访问 homeserver 与 LLM provider 端点 | — |
|
|
27
|
+
| 组件 | 要求 |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Node.js | >= 20(实测 24.x) |
|
|
30
|
+
| pi | >= 0.83,**全局安装** |
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
先装 pi —— pi-courier 连接的是它:
|
|
41
33
|
|
|
42
34
|
```bash
|
|
43
35
|
npm install -g @earendil-works/pi-coding-agent
|
|
44
36
|
pi --version
|
|
45
37
|
```
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
用 nvm 的话,每个新终端先 `source ~/.nvm/nvm.sh`,确保 `pi` 和 `node` 在 PATH 里。
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
### 方式 A:普通用户 —— 一条命令
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g pi-courier
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
完事。验证:`pi-courier help`。
|
|
48
|
+
|
|
49
|
+
### 方式 B:开发人员 —— 源码构建
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
git clone https://github.com/Hi-Barry/pi-courier.git
|
|
53
53
|
cd pi-courier
|
|
54
54
|
npm install
|
|
55
|
-
npm link # 把 `pi-courier` 命令全局化,之后任何目录都能用
|
|
56
55
|
npm run build
|
|
56
|
+
npm link # 让 `pi-courier` 命令全局可用
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
**不要用 `--ignore-scripts`**:Matrix E2EE 库的 postinstall 会下载原生二进制。如果被 npm 拦截,报 `Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu'` 时手动补:
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
62
|
cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
@@ -64,299 +64,168 @@ node download-lib.js
|
|
|
64
64
|
cd ../..
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## 配置
|
|
70
|
-
|
|
71
|
-
### pi 的 LLM provider(`~/.pi/agent/`)
|
|
72
|
-
|
|
73
|
-
**a) models.json** — 模型元数据。推荐从 models.dev 提取(字段完整正确),以 opencode-go 为例:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
curl -s https://models.dev/api.json -o /tmp/modelsdev.json
|
|
77
|
-
python3 -c "
|
|
78
|
-
import json, os
|
|
79
|
-
md = json.load(open('/tmp/modelsdev.json')) # 顶层直接是 provider 字典
|
|
80
|
-
out = {'providers': {'opencode-go': md['opencode-go']}}
|
|
81
|
-
json.dump(out, open(os.path.expanduser('~/.pi/agent/models.json'), 'w'), indent=2)
|
|
82
|
-
"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**b) auth.json** — API key(权限 600):
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"opencode-go": { "type": "api_key", "key": "sk-你的密钥" }
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**c) settings.json** — 默认 provider 与模型:
|
|
67
|
+
下载很慢(20-60 kB/s)?这个二进制来自 GitHub Releases,**不走 npm 代理** —— 先 `export https_proxy=... http_proxy=...` 再装。
|
|
94
68
|
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
"defaultProvider": "opencode-go",
|
|
98
|
-
"defaultModel": "deepseek-v4-flash"
|
|
99
|
-
}
|
|
100
|
-
```
|
|
69
|
+
## 3. 怎么用
|
|
101
70
|
|
|
102
|
-
|
|
71
|
+
### 第 0 步 —— 确认 pi 能对话(一次性)
|
|
103
72
|
|
|
104
|
-
|
|
73
|
+
pi 需要在 `~/.pi/agent/` 里配好 LLM provider(`models.json`、`auth.json`、`settings.json`)。最快的检查方式:跑 `pi`,随便发条消息,能回复就行。不能回复就先配好(参考 pi 官方文档;注意 `settings.json` 的字段名是 `defaultProvider` / `defaultModel`)。
|
|
105
74
|
|
|
106
|
-
|
|
107
|
-
node --input-type=module -e "
|
|
108
|
-
import { RpcClient } from '@earendil-works/pi-coding-agent';
|
|
109
|
-
import { fileURLToPath } from 'node:url';
|
|
110
|
-
import path from 'node:path';
|
|
111
|
-
const entry = fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent'));
|
|
112
|
-
const c = new RpcClient({ cliPath: path.join(path.dirname(entry), 'cli.js') });
|
|
113
|
-
await c.start();
|
|
114
|
-
console.log('可用模型数:', (await c.getAvailableModels()).length);
|
|
115
|
-
console.log('当前模型:', (await c.getState()).model?.id);
|
|
116
|
-
await c.stop();
|
|
117
|
-
"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### 配置 messenger(Matrix 为例)
|
|
121
|
-
|
|
122
|
-
**方式一(推荐):首次运行配置向导**
|
|
75
|
+
### 第 1 步 —— 运行配置向导
|
|
123
76
|
|
|
124
77
|
```bash
|
|
125
78
|
pi-courier setup
|
|
126
79
|
```
|
|
127
80
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
**方式二:手动编辑 `~/.pi/msg-bridge.json`**(权限 600):
|
|
81
|
+
向导会逐步询问,照着输入(方括号里是默认值,直接回车接受):
|
|
131
82
|
|
|
132
|
-
```json
|
|
133
|
-
{
|
|
134
|
-
"matrix": {
|
|
135
|
-
"homeserverUrl": "https://你的homeserver",
|
|
136
|
-
"accessToken": "syt_你的token",
|
|
137
|
-
"encryption": true
|
|
138
|
-
},
|
|
139
|
-
"auth": {
|
|
140
|
-
"trustedUsers": ["matrix:@你的账号:你的homeserver域名"],
|
|
141
|
-
"adminUserId": "matrix:@你的账号:你的homeserver域名"
|
|
142
|
-
},
|
|
143
|
-
"workdir": "/path/to/pi/workdir",
|
|
144
|
-
"autoConnect": true,
|
|
145
|
-
"debug": true
|
|
146
|
-
}
|
|
147
83
|
```
|
|
84
|
+
=== pi-courier 首次配置向导 ===
|
|
85
|
+
将生成 ~/.pi/msg-bridge.json(权限 600)
|
|
148
86
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
87
|
+
Matrix homeserver URL (如 https://matrix.example.com): ← 输入,如 https://matrix.example.com
|
|
88
|
+
获取 token 方式 [1=用户名密码登录, 2=粘贴已有 token] (1): ← 1 或 2(回车默认 1)
|
|
89
|
+
[方式 1] bot 用户名 (如 test2): ← bot 账号名,如 test3
|
|
90
|
+
bot 密码: ← 密码(不回显)
|
|
91
|
+
[方式 2] 粘贴 access token (syt_...): ← 已有 token
|
|
92
|
+
✅ 登录成功,账号: @test3:matrix.example.com
|
|
93
|
+
信任用户(管理员)MXID [默认 @test3:matrix.example.com]: ← 你的账号,如 @barry:matrix.example.com
|
|
94
|
+
启用 E2EE 加密? [y/N]: ← y/n(非加密房间选 y 也没问题)
|
|
95
|
+
pi 工作目录 [默认 /home/你/Projects]: ← 回车或输入其他目录
|
|
155
96
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
pi-courier setup 首次运行配置向导(Matrix 账号、信任用户、工作目录)
|
|
162
|
-
pi-courier run 前台运行(工作目录从配置读,--workdir 可覆盖)
|
|
163
|
-
pi-courier enable 安装用户级 systemd 服务并开机自启、立即启动
|
|
164
|
-
pi-courier start 启动服务
|
|
165
|
-
pi-courier stop 停止服务
|
|
166
|
-
pi-courier restart 重启服务
|
|
167
|
-
pi-courier status 查看服务状态与最近日志
|
|
168
|
-
pi-courier logs 跟踪服务日志(Ctrl+C 退出)
|
|
169
|
-
pi-courier disable 卸载服务(停止 + 取消自启 + 删除 unit 文件)
|
|
170
|
-
pi-courier update 更新本项目(git pull + 安装依赖 + 重新构建)
|
|
97
|
+
✅ 配置已写入 ~/.pi/msg-bridge.json
|
|
98
|
+
账号: @test3:...
|
|
99
|
+
信任用户: @barry:...
|
|
100
|
+
E2EE: 开启
|
|
101
|
+
工作目录: /home/你/Projects
|
|
171
102
|
```
|
|
172
103
|
|
|
173
|
-
|
|
104
|
+
向导会验证 token 并写入 `~/.pi/msg-bridge.json`。不想用向导的话,手动创建这个文件也行 —— 格式见[常见问题](#4-常见问题)。
|
|
105
|
+
|
|
106
|
+
### 第 2 步 —— 启动
|
|
174
107
|
|
|
175
108
|
```bash
|
|
176
|
-
pi-courier
|
|
177
|
-
pi-courier enable # 开机自启,以当前用户运行
|
|
109
|
+
pi-courier enable # 安装 systemd 服务:开机自启 + 立即启动
|
|
178
110
|
```
|
|
179
111
|
|
|
180
|
-
|
|
112
|
+
想先快速前台测试:`pi-courier run`(Ctrl+C 停止)。
|
|
181
113
|
|
|
182
|
-
|
|
114
|
+
启动成功长这样:
|
|
183
115
|
|
|
184
116
|
```
|
|
185
|
-
✅ Matrix connected as @
|
|
117
|
+
✅ Matrix connected as @test3:... (2 rooms, E2EE enabled)
|
|
186
118
|
✅ pi RPC connected (model: deepseek-v4-flash, session: 019f...)
|
|
187
119
|
🚀 msg-bridge standalone ready. Waiting for messages...
|
|
188
120
|
```
|
|
189
121
|
|
|
190
|
-
###
|
|
122
|
+
### 第 3 步 —— 在 Matrix 里使用
|
|
191
123
|
|
|
192
|
-
|
|
124
|
+
1. **给 bot 账号发私聊消息**
|
|
125
|
+
2. **仅首次**:bridge 日志里会打印**6 位验证码**(`pi-courier logs` 查看);把验证码回复给 bot,你就成为 trusted user(第一个 trusted 用户自动成为管理员)
|
|
126
|
+
3. 正常对话,或发命令:
|
|
193
127
|
|
|
194
|
-
| 命令 |
|
|
128
|
+
| 命令 | 作用 |
|
|
195
129
|
|---|---|
|
|
196
130
|
| `/new` `/clear` | 新会话 |
|
|
197
131
|
| `/compact [说明]` | 压缩上下文 |
|
|
198
132
|
| `/model` / `/model <provider/id>` | 查看 / 切换模型 |
|
|
199
|
-
| `/models` |
|
|
200
|
-
| `/thinking [
|
|
133
|
+
| `/models` | 列出模型 |
|
|
134
|
+
| `/thinking [级别]` | 查看 / 设置思考级别 |
|
|
201
135
|
| `/session` `/cost` | 会话统计与费用 |
|
|
202
136
|
| `/status` | 当前模型与状态 |
|
|
203
137
|
| `/name <名字>` | 会话命名 |
|
|
204
138
|
| `/export [路径]` | 导出会话 HTML |
|
|
205
|
-
| `/bash <命令>` | 执行 shell 命令
|
|
139
|
+
| `/bash <命令>` | 执行 shell 命令 |
|
|
206
140
|
| `/abort` | 中止当前操作 |
|
|
207
|
-
| `/reload` | 重启 pi
|
|
141
|
+
| `/reload` | 重启 pi(装完扩展/配置后) |
|
|
208
142
|
| `/help` | 完整帮助 |
|
|
209
143
|
|
|
210
|
-
**
|
|
211
|
-
|
|
212
|
-
**透传:** 其他 `/` 开头的命令直接交给 pi(扩展命令、`/skill:名称`、提示词模板由 pi 展开);普通文本 = 正常对话。
|
|
144
|
+
**bridge 管理命令**:`/trusted`、`/revoke <userId>`、`/channels`、`/enable <chatId> <mode>`、`/disable <chatId>`、`/toggletools`
|
|
213
145
|
|
|
214
|
-
|
|
146
|
+
**其他任何 `/` 开头的内容**都直接透传给 pi —— 扩展命令、`/skill:名称`、提示词模板由 pi 展开。普通文本就是正常对话。
|
|
215
147
|
|
|
216
|
-
|
|
217
|
-
2. bridge 终端(或 `journalctl --user -u pi-msg-bridge -f`)会打印 6 位验证码
|
|
218
|
-
3. 把验证码发回给 bot → 成为 trusted user(第一个 trusted 用户自动成为 admin)
|
|
148
|
+
**群聊**:先给 bot 发 `/enable <roomId> all` 启用该房间。
|
|
219
149
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
## systemd 部署(开机自启)
|
|
223
|
-
|
|
224
|
-
**用户级(推荐,无需 sudo):**
|
|
150
|
+
### 服务管理
|
|
225
151
|
|
|
226
152
|
```bash
|
|
227
|
-
pi-courier
|
|
153
|
+
pi-courier status # 状态 + 最近日志
|
|
154
|
+
pi-courier logs # 跟踪日志
|
|
155
|
+
pi-courier restart # 重启
|
|
156
|
+
pi-courier stop # 停止
|
|
157
|
+
pi-courier start # 启动
|
|
158
|
+
pi-courier disable # 卸载服务
|
|
159
|
+
pi-courier update # 更新 pi-courier 自身
|
|
228
160
|
```
|
|
229
161
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
常用命令:`pi-courier status`、`pi-courier logs`、`pi-courier stop`、`pi-courier start`(或 `systemctl --user restart pi-msg-bridge`)。
|
|
233
|
-
|
|
234
|
-
**系统级(需要 sudo):** 复制 `deploy/pi-msg-bridge.service` 到 `/etc/systemd/system/`,按注释修改三处必改项(`User`、`WorkingDirectory`、`NVM_DIR`),再 `sudo systemctl enable --now pi-msg-bridge`。
|
|
235
|
-
|
|
236
|
-
## 升级 pi
|
|
237
|
-
|
|
238
|
-
pi 由系统独立管理,升级只需全局更新,bridge 无需任何改动:
|
|
162
|
+
**升级 pi** 是独立的事 —— pi-courier 始终通过 `which pi` 连接系统 pi:
|
|
239
163
|
|
|
240
164
|
```bash
|
|
241
165
|
npm install -g @earendil-works/pi-coding-agent@latest
|
|
242
|
-
pi
|
|
243
|
-
pi-courier restart # 或: systemctl --user restart pi-msg-bridge
|
|
166
|
+
pi-courier restart
|
|
244
167
|
```
|
|
245
168
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
## FAQ(常见问题)
|
|
249
|
-
|
|
250
|
-
### 安装与部署
|
|
251
|
-
|
|
252
|
-
**Q: `git clone` 报 404?**
|
|
253
|
-
A: 仓库地址写错。用 `https://github.com/Hi-Barry/pi-courier.git`(或直接 `npm install -g pi-courier` 安装)。
|
|
169
|
+
## 4. 常见问题
|
|
254
170
|
|
|
255
171
|
**Q: `npm install` 卡住 / 只有 20-60 kB/s?**
|
|
256
|
-
A:
|
|
257
|
-
- npm registry 的包 → 配 npm 代理:`npm config set proxy http://...` 和 `npm config set https-proxy http://...`
|
|
258
|
-
- 21MB 的 E2EE 原生库(由 matrix-sdk-crypto-nodejs 从 GitHub Releases 下载)→ **不走 npm 代理**,需先 `export https_proxy=http://...` `export http_proxy=http://...` 再安装(想永久生效写进 `~/.bashrc`)
|
|
172
|
+
A: 21MB 的 E2EE 原生库从 GitHub Releases 下载,不走 npm 代理。先 `export https_proxy=... http_proxy=...`(写进 `~/.bashrc` 永久生效)再装。
|
|
259
173
|
|
|
260
174
|
**Q: 报 `Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs-linux-x64-gnu'`?**
|
|
261
|
-
A:
|
|
262
|
-
```bash
|
|
263
|
-
cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
264
|
-
node download-lib.js
|
|
265
|
-
cd ../..
|
|
266
|
-
```
|
|
175
|
+
A: 原生二进制没下载(postinstall 被拦)。手动补:`cd node_modules/@matrix-org/matrix-sdk-crypto-nodejs && node download-lib.js`。
|
|
267
176
|
|
|
268
177
|
**Q: `npm install -g pi-courier` 报 EEXIST?**
|
|
269
|
-
A: 之前 `npm link` 过,bin
|
|
270
|
-
```bash
|
|
271
|
-
npm unlink -g pi-courier
|
|
272
|
-
rm -f ~/.nvm/versions/node/v24.18.1/bin/pi-courier
|
|
273
|
-
npm install -g pi-courier
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
**Q: `npm link` 后 `pi-courier` 命令找不到?**
|
|
277
|
-
A: link 在 `npm run build` 之前执行,`dist/cli.js` 还不存在。build 后重新 `npm link`(或直接改用 npm 安装)。
|
|
278
|
-
|
|
279
|
-
**Q: systemd 服务反复重启循环?**
|
|
280
|
-
A: pi 子进程崩溃,几乎都是 **Node 版本不匹配**:bridge 通过 PATH 找 node 启动 pi,systemd 默认 PATH 可能命中系统 node(如 v20),而 pi 的 undici 与 Node 20 不兼容(报 `webidl.util.markAsUncloneable is not a function`)。修复:`source ~/.nvm/nvm.sh` 后重新 `pi-courier enable`(0.1.2+ 会自动把 `Environment=PATH=<nvm bin 优先>` 写进 unit)。**全机统一用一个 Node 版本(nvm v24)**,别和系统 node 混用。
|
|
178
|
+
A: 之前 `npm link` 过,bin 冲突。`npm unlink -g pi-courier && rm -f $(npm prefix -g)/bin/pi-courier && npm install -g pi-courier`。
|
|
281
179
|
|
|
282
|
-
|
|
180
|
+
**Q: systemd 服务反复重启?**
|
|
181
|
+
A: 几乎都是 Node 版本不匹配 —— pi 子进程在系统 node v20 上崩溃(报 `webidl.util.markAsUncloneable is not a function`)。加载 nvm 后重新 `pi-courier enable`(0.1.2+ 会自动写入正确的 PATH)。全机统一一个 Node 版本。
|
|
283
182
|
|
|
284
|
-
**Q:
|
|
285
|
-
A: pi 的 provider
|
|
286
|
-
|
|
287
|
-
**Q: `getAvailableModels` 为空?**
|
|
288
|
-
A: `models.json` 格式错误。用配置章节的 models.dev 提取命令重新生成。
|
|
289
|
-
|
|
290
|
-
**Q: 启动报 `no transports configured`?**
|
|
291
|
-
A: bridge 配置为空。运行 `pi-courier setup` 生成 `~/.pi/msg-bridge.json`,或检查 `PI_*` 环境变量。
|
|
292
|
-
|
|
293
|
-
**Q: setup 向导里出现奇怪的 `DeprecationWarning: util._extend`?**
|
|
294
|
-
A: 传输层依赖的已知噪音,0.1.0 起已过滤。更新 pi-courier 后仍看到就说明版本太旧。
|
|
295
|
-
|
|
296
|
-
### 消息与加密
|
|
183
|
+
**Q: 启动显示 `model: unknown`?**
|
|
184
|
+
A: pi 的 provider 没配。检查 `~/.pi/agent/`:`models.json` + `auth.json` + `settings.json`(字段名是 `defaultProvider` / `defaultModel`)。
|
|
297
185
|
|
|
298
186
|
**Q: 日志大量 `Decryption error`?**
|
|
299
|
-
A: 历史消息无法解密(新设备没有旧密钥)
|
|
187
|
+
A: 历史消息无法解密(新设备没有旧密钥)。**正常**,新消息不受影响。
|
|
300
188
|
|
|
301
189
|
**Q: 加密房间:发消息没回复 / 新消息解不开?**
|
|
302
|
-
A: bot
|
|
303
|
-
- Element(网页:设置 → 安全与隐私 → 加密):确保 **"仅向已验证设备共享密钥"未勾选**,然后在房间里发一条消息
|
|
304
|
-
- bot 账号没有交叉签名,"用户验证"显示不可用是正常的;最省心的可靠方案:**直接用非加密房间**(新建房间时不要勾选加密,把 bot 拉进来)。bridge 配置 `encryption: true` 也照常处理非加密房间。
|
|
190
|
+
A: bot 的新设备没拿到房间密钥。bot 账号没有交叉签名,最可靠的解法是**用非加密房间**(新建房间时不勾选加密,把 bot 拉进来)—— 配置 `encryption: true` 也照常处理非加密房间。
|
|
305
191
|
|
|
306
|
-
**Q:
|
|
307
|
-
A: 加密存储里是旧设备身份,而
|
|
308
|
-
```bash
|
|
309
|
-
rm -rf ~/.pi/msg-bridge-matrix-crypto
|
|
310
|
-
pi-courier restart
|
|
311
|
-
```
|
|
312
|
-
**以后每次重跑 setup / 换 token,都顺手删一次这个目录。**
|
|
313
|
-
|
|
314
|
-
**Q: Matrix 连接失败(homeserver/token 错误)?**
|
|
315
|
-
A: 验证 token:`curl -H "Authorization: Bearer <token>" https://homeserver/_matrix/client/v3/account/whoami`。
|
|
192
|
+
**Q: 报 `M_BAD_JSON: Provided device_id in device_keys does not match...`?**
|
|
193
|
+
A: 加密存储里是旧设备身份,而 token 属于新设备(重新登录过)。删除重启:`rm -rf ~/.pi/msg-bridge-matrix-crypto && pi-courier restart`。**每次重跑 setup / 换 token 都顺手删一次。**
|
|
316
194
|
|
|
317
|
-
**Q:
|
|
318
|
-
A:
|
|
195
|
+
**Q: 第一次发消息要 6 位验证码?**
|
|
196
|
+
A: 这是挑战认证 —— 把验证码回复给 bot 即成为 trusted user。
|
|
319
197
|
|
|
320
198
|
**Q: 消息完全没有回复?**
|
|
321
|
-
A: 按顺序排查:(1) `pi-courier status`
|
|
322
|
-
|
|
323
|
-
### 运行与维护
|
|
199
|
+
A: 按顺序排查:(1) `pi-courier status` —— Matrix 连上了吗?有 Decryption error 吗(加密房间)?(2) pi RPC 连上了吗?(3) 模型调用本身 —— 用 curl 直接测 provider 端点。
|
|
324
200
|
|
|
325
201
|
**Q: `pi RPC did not become ready`?**
|
|
326
|
-
A: pi
|
|
327
|
-
```bash
|
|
328
|
-
node node_modules/@earendil-works/pi-coding-agent/dist/cli.js --mode rpc
|
|
329
|
-
```
|
|
330
|
-
常见原因:Node 版本不匹配(见上面重启循环)、provider 配置错误、无法访问 provider 端点。
|
|
202
|
+
A: pi 启动失败。手动跑 `node node_modules/@earendil-works/pi-coding-agent/dist/cli.js --mode rpc` 看真实报错。常见原因:Node 版本不匹配、provider 配置错误、无法访问 provider。
|
|
331
203
|
|
|
332
204
|
**Q: 重启后对话上下文丢了?**
|
|
333
|
-
A: 0.1.1 起 bridge 会给 pi 传 `--continue
|
|
205
|
+
A: 0.1.1 起 bridge 会给 pi 传 `--continue`,按 workdir 恢复最近会话。升级并重启即可;`/new` 开新会话,下次重启恢复新会话。
|
|
334
206
|
|
|
335
207
|
**Q: Element(网页客户端)拦截 `/` 开头的消息?**
|
|
336
208
|
A: 用 `//` 转义发送字面文本(如 `//compact` 会发出 `/compact`)。
|
|
337
209
|
|
|
338
|
-
**Q:
|
|
339
|
-
A:
|
|
210
|
+
**Q: `~/.pi/msg-bridge.json` 里到底有什么?**
|
|
211
|
+
A: 向导生成的配置,示例:
|
|
340
212
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
```bash
|
|
350
|
-
npm run build # 编译
|
|
351
|
-
npm run typecheck # 类型检查
|
|
352
|
-
npm run test # 单元测试(vitest)
|
|
353
|
-
npm run lint # biome lint
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"matrix": { "homeserverUrl": "https://matrix.example.com", "accessToken": "syt_...", "encryption": true },
|
|
216
|
+
"auth": { "trustedUsers": ["matrix:@你:matrix.example.com"], "adminUserId": "matrix:@你:matrix.example.com" },
|
|
217
|
+
"workdir": "/home/你/Projects",
|
|
218
|
+
"autoConnect": true,
|
|
219
|
+
"debug": true
|
|
220
|
+
}
|
|
354
221
|
```
|
|
355
222
|
|
|
356
|
-
|
|
223
|
+
环境变量替代:`PI_MATRIX_HOMESERVER` / `PI_MATRIX_ACCESS_TOKEN`。
|
|
224
|
+
|
|
225
|
+
## 5. 协议与声明
|
|
357
226
|
|
|
358
|
-
|
|
227
|
+
MIT License —— 见 [LICENSE](LICENSE)。
|
|
359
228
|
|
|
360
|
-
MIT
|
|
229
|
+
**上游来源**:本项目改造自 [tintinweb/pi-messenger-bridge](https://github.com/tintinweb/pi-messenger-bridge)(MIT)。Matrix 传输层与挑战码认证来自上游;基于 RPC 的独立架构、slash 命令映射、CLI、配置向导与文档为本项目新增。
|
|
361
230
|
|
|
362
|
-
|
|
231
|
+
pi-courier 是 [pi](https://pi.dev) 的独立伴侣应用,与 Earendil Inc. 无隶属关系。
|
package/dist/setup.js
CHANGED
|
@@ -96,7 +96,7 @@ async function matrixWhoami(homeserver, accessToken) {
|
|
|
96
96
|
export async function runSetup() {
|
|
97
97
|
const { ask, close } = createPrompter();
|
|
98
98
|
console.log("");
|
|
99
|
-
console.log("=== pi-
|
|
99
|
+
console.log("=== pi-courier 首次配置向导 ===");
|
|
100
100
|
console.log("将生成 ~/.pi/msg-bridge.json(权限 600)\n");
|
|
101
101
|
try {
|
|
102
102
|
const homeserver = (await ask("Matrix homeserver URL (如 https://matrix.example.com): ")).trim();
|
|
@@ -146,7 +146,7 @@ export async function runSetup() {
|
|
|
146
146
|
console.log(` 信任用户: ${adminRaw}`);
|
|
147
147
|
console.log(` E2EE: ${encryption ? "开启" : "关闭"}`);
|
|
148
148
|
console.log(` 工作目录: ${workdir}`);
|
|
149
|
-
console.log("\n下一步: pi-
|
|
149
|
+
console.log("\n下一步: pi-courier enable(开机自启)或 pi-courier run(前台运行)");
|
|
150
150
|
}
|
|
151
151
|
catch (err) {
|
|
152
152
|
console.error(`\n❌ 配置失败: ${err.message}`);
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;GAOG;AACH,SAAS,cAAc;IAIrB,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7D,OAAO;YACL,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,CACd,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtB,IAAI,IAAI,GAAG,KAAK,CAAC;gBACjB,MAAM,MAAM,GAAG,CAAC,MAAc,EAAQ,EAAE;oBACtC,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,IAAI,GAAG,IAAI,CAAC;wBACZ,OAAO,CAAC,MAAM,CAAC,CAAC;oBAClB,CAAC;gBACH,CAAC,CAAC;gBACF,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC5B,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EA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