weacpx 0.3.0 → 0.3.1
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 +63 -21
- package/dist/bridge/bridge-main.js +10 -6
- package/dist/cli.js +982 -733
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
|
|
12
12
|
## 这是什么
|
|
13
13
|
|
|
14
|
-
`weacpx`
|
|
14
|
+
`weacpx` 是一个微信控制台。它把微信消息接到 `acpx` 会话上,让你直接在手机里:
|
|
15
15
|
|
|
16
|
-
-
|
|
16
|
+
- 新建和切换 Codex / Claude Code 会话
|
|
17
17
|
- 让 Agent 继续在指定项目目录里工作
|
|
18
18
|
- 查看流式回复、最终结果和工具调用摘要
|
|
19
19
|
- 调整权限策略
|
|
20
|
-
-
|
|
20
|
+
- 在需要时做最小可用的多 Agent 编排
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
如果你已经习惯在本地终端里用 `acpx`,`weacpx` 提供的是一个**远程入口**,而不是另一套全新的工作流。
|
|
23
23
|
|
|
24
24
|
## 适合谁
|
|
25
25
|
|
|
26
|
-
`weacpx`
|
|
26
|
+
`weacpx` 适合已经在用 Codex、Claude Code 或其他 `acpx` driver 的开发者。你可以用微信盯任务、发指令、看结果,并在同一个聊天里管理多个会话。
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
它不是云端 IDE,也不是可视化编排平台。
|
|
29
29
|
|
|
30
30
|
## 5 分钟快速开始
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
开始前,你至少需要:
|
|
35
35
|
|
|
36
36
|
- Node.js 22+ 或 Bun
|
|
37
|
-
- 已可用的 Codex
|
|
37
|
+
- 已可用的 Codex、Claude Code 或其他 `acpx` driver
|
|
38
38
|
- 一台装了微信的手机
|
|
39
39
|
|
|
40
40
|
> `weacpx` 基于 `weixin-agent-sdk` 和 `acpx` 工作。正常情况下,你不需要额外全局安装 `acpx`。
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
### 安装
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
npm install -g weacpx
|
|
45
|
+
npm install -g weacpx
|
|
46
46
|
# 或
|
|
47
47
|
bun add -g weacpx
|
|
48
48
|
```
|
|
@@ -53,7 +53,7 @@ bun add -g weacpx
|
|
|
53
53
|
weacpx login
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
终端会显示二维码。你用微信扫码登录。
|
|
57
57
|
|
|
58
58
|
### 启动服务
|
|
59
59
|
|
|
@@ -85,7 +85,7 @@ hello
|
|
|
85
85
|
1. **启动后台服务**:`weacpx start`
|
|
86
86
|
2. **创建或切换会话**:`/ss ...`、`/use ...`
|
|
87
87
|
3. **直接发普通文本**:让当前会话继续工作
|
|
88
|
-
4.
|
|
88
|
+
4. **必要时查看状态或取消**:`/status`、`/cancel`
|
|
89
89
|
|
|
90
90
|
### 1) 创建会话
|
|
91
91
|
|
|
@@ -95,7 +95,7 @@ hello
|
|
|
95
95
|
/ss codex -d /absolute/path/to/your/repo
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
它会使用 `codex
|
|
98
|
+
它会使用 `codex`,绑定这个目录,并自动切换到新会话。
|
|
99
99
|
|
|
100
100
|
### 2) 发普通消息
|
|
101
101
|
|
|
@@ -109,9 +109,9 @@ hello
|
|
|
109
109
|
|
|
110
110
|
`weacpx` 支持三种常用回复模式:
|
|
111
111
|
|
|
112
|
-
- `stream
|
|
112
|
+
- `stream`:默认,流式返回中间文本
|
|
113
113
|
- `final`:只返回最终结果
|
|
114
|
-
- `verbose
|
|
114
|
+
- `verbose`:在流式文本之外,额外显示工具调用摘要
|
|
115
115
|
|
|
116
116
|
例如 `verbose` 模式下,你会看到:
|
|
117
117
|
|
|
@@ -145,6 +145,50 @@ hello
|
|
|
145
145
|
| `weacpx stop` | 停止后台实例 |
|
|
146
146
|
| `weacpx doctor` | 运行环境诊断 |
|
|
147
147
|
| `weacpx version` | 查看当前版本 |
|
|
148
|
+
| `weacpx workspace list` | 查看本机已注册的 workspace |
|
|
149
|
+
| `weacpx workspace add [name]` | 把当前目录注册成 workspace;不传 `name` 时使用当前目录名 |
|
|
150
|
+
| `weacpx workspace rm <name>` | 删除 workspace |
|
|
151
|
+
|
|
152
|
+
`workspace` 也可以简写为 `ws`:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
weacpx ws add
|
|
156
|
+
weacpx ws list
|
|
157
|
+
weacpx ws rm backend
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `workspace` CLI 怎么用
|
|
161
|
+
|
|
162
|
+
`weacpx workspace` 用来在电脑本机维护 `~/.weacpx/config.json` 里的 `workspaces` 配置。它适合先在终端里注册常用项目目录,然后在微信里用 `--ws <name>` 直接引用。
|
|
163
|
+
|
|
164
|
+
| 命令 | 说明 |
|
|
165
|
+
|------|------|
|
|
166
|
+
| `weacpx workspace list` | 列出已注册的 workspace 及其路径 |
|
|
167
|
+
| `weacpx workspace add` | 把当前目录注册为 workspace,名称默认取当前目录名 |
|
|
168
|
+
| `weacpx workspace add <name>` | 把当前目录注册为指定名称 |
|
|
169
|
+
| `weacpx workspace rm <name>` | 删除指定 workspace |
|
|
170
|
+
|
|
171
|
+
常见用法:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
cd /absolute/path/to/backend
|
|
175
|
+
weacpx workspace add backend
|
|
176
|
+
|
|
177
|
+
cd /absolute/path/to/frontend
|
|
178
|
+
weacpx ws add frontend
|
|
179
|
+
|
|
180
|
+
weacpx ws list
|
|
181
|
+
weacpx ws rm frontend
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
注册后,你可以在微信里直接使用:
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
/ss codex --ws backend
|
|
188
|
+
/ss new claude --ws frontend
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
注意:`workspace add` 总是注册**当前终端所在目录**;如果不传名称,会用当前目录名作为 workspace 名称。
|
|
148
192
|
|
|
149
193
|
### `doctor` 怎么用
|
|
150
194
|
|
|
@@ -164,19 +208,17 @@ weacpx doctor --smoke --agent codex --workspace backend
|
|
|
164
208
|
|
|
165
209
|
## 常用微信命令
|
|
166
210
|
|
|
211
|
+
下面这部分保留一份**中等长度**的日常手册。够你上手和日常使用,但不把 README 写成完整参考手册。
|
|
212
|
+
|
|
167
213
|
完整微信命令参考见:[docs/commands.md](./docs/commands.md)。
|
|
168
214
|
|
|
169
215
|
### Agent 管理
|
|
170
216
|
|
|
171
|
-
已内置常用的 Codex 与 Claude Code;
|
|
172
|
-
|
|
173
|
-
可以使用 `/agent add opencode` 添加你所需要的 agents。
|
|
174
|
-
|
|
175
217
|
| 命令 | 说明 |
|
|
176
218
|
|------|------|
|
|
177
219
|
| `/agents` | 查看 agent 列表 |
|
|
178
|
-
| `/agent add
|
|
179
|
-
| `/agent add
|
|
220
|
+
| `/agent add codex` | 添加 `codex` |
|
|
221
|
+
| `/agent add claude` | 添加 `claude` |
|
|
180
222
|
| `/agent rm <name>` | 删除 agent |
|
|
181
223
|
|
|
182
224
|
### Workspace 管理
|
|
@@ -184,7 +226,7 @@ weacpx doctor --smoke --agent codex --workspace backend
|
|
|
184
226
|
| 命令 | 说明 |
|
|
185
227
|
|------|------|
|
|
186
228
|
| `/workspaces` / `/workspace` / `/ws` | 查看 workspace 列表 |
|
|
187
|
-
| `/ws new <name> -d <path>` | 添加 workspace,`path`
|
|
229
|
+
| `/ws new <name> -d <path>` | 添加 workspace,`path` 是电脑上的绝对路径 |
|
|
188
230
|
| `/workspace rm <name>` | 删除 workspace |
|
|
189
231
|
|
|
190
232
|
### Session 会话
|
|
@@ -204,7 +246,7 @@ weacpx doctor --smoke --agent codex --workspace backend
|
|
|
204
246
|
| `/replymode reset` | 回退到全局默认 reply mode |
|
|
205
247
|
| `/session reset` | 重置当前会话上下文 |
|
|
206
248
|
| `/clear` | `/session reset` 的快捷别名 |
|
|
207
|
-
| `/cancel` / `/stop` |
|
|
249
|
+
| `/cancel` / `/stop` | 取消当前会话 |
|
|
208
250
|
|
|
209
251
|
建议你优先记住这三个:
|
|
210
252
|
|
|
@@ -354,6 +354,7 @@ var init_streaming_prompt = __esm(() => {
|
|
|
354
354
|
|
|
355
355
|
// src/recovery/discover-parent-package-paths.ts
|
|
356
356
|
import { spawn } from "node:child_process";
|
|
357
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
357
358
|
import { access } from "node:fs/promises";
|
|
358
359
|
import { homedir } from "node:os";
|
|
359
360
|
import { dirname, join } from "node:path";
|
|
@@ -426,8 +427,8 @@ async function defaultFsExists(path) {
|
|
|
426
427
|
}
|
|
427
428
|
function defaultResolveFromCwd(name, cwd) {
|
|
428
429
|
try {
|
|
429
|
-
const pkgJson =
|
|
430
|
-
paths: [cwd, ...
|
|
430
|
+
const pkgJson = require2.resolve(`${name}/package.json`, {
|
|
431
|
+
paths: [cwd, ...require2.resolve.paths(name) ?? []]
|
|
431
432
|
});
|
|
432
433
|
return dirname(pkgJson);
|
|
433
434
|
} catch {
|
|
@@ -480,11 +481,14 @@ async function defaultQueryPackageManagerRoot(tool) {
|
|
|
480
481
|
});
|
|
481
482
|
});
|
|
482
483
|
}
|
|
483
|
-
var
|
|
484
|
+
var require2;
|
|
485
|
+
var init_discover_parent_package_paths = __esm(() => {
|
|
486
|
+
require2 = createRequire2(import.meta.url);
|
|
487
|
+
});
|
|
484
488
|
|
|
485
489
|
// src/process/terminate-process-tree.ts
|
|
486
490
|
import { spawn as spawn2 } from "node:child_process";
|
|
487
|
-
async function terminateProcessTree(pid, platform = process.platform, runCommand = defaultRunProcessCommand, killProcess = (targetPid, signal) => {
|
|
491
|
+
async function terminateProcessTree(pid, options = {}, platform = process.platform, runCommand = defaultRunProcessCommand, killProcess = (targetPid, signal) => {
|
|
488
492
|
process.kill(targetPid, signal);
|
|
489
493
|
}, isProcessRunning = defaultIsProcessRunning) {
|
|
490
494
|
if (pid <= 0) {
|
|
@@ -496,7 +500,7 @@ async function terminateProcessTree(pid, platform = process.platform, runCommand
|
|
|
496
500
|
} catch {}
|
|
497
501
|
return;
|
|
498
502
|
}
|
|
499
|
-
const targetPid =
|
|
503
|
+
const targetPid = options.detachedProcessGroup ? -pid : pid;
|
|
500
504
|
try {
|
|
501
505
|
killProcess(targetPid, "SIGTERM");
|
|
502
506
|
} catch {
|
|
@@ -692,7 +696,7 @@ async function terminateAcpxQueueOwner(sessionId) {
|
|
|
692
696
|
return;
|
|
693
697
|
}
|
|
694
698
|
if (typeof owner.pid === "number" && Number.isInteger(owner.pid) && owner.pid > 0) {
|
|
695
|
-
await terminateProcessTree(owner.pid);
|
|
699
|
+
await terminateProcessTree(owner.pid, { detachedProcessGroup: true });
|
|
696
700
|
}
|
|
697
701
|
await unlink(lockPath).catch(() => {});
|
|
698
702
|
}
|