u-foo 2.3.15 → 2.3.17
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 +310 -293
- package/README.zh-CN.md +288 -289
- package/package.json +1 -1
- package/src/agent/internalRunner.js +11 -1
- package/src/chat/agentViewController.js +192 -48
- package/src/chat/index.js +6 -1
- package/src/chat/inputMath.js +24 -10
package/README.zh-CN.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
ufoo 是一个多 Agent 工作区协议,用于在同一个项目运行 Claude Code、OpenAI Codex、ufoo 原生 `ucode`,以及按模板编排的 Agent 小组。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
npm 包:[u-foo](https://www.npmjs.com/package/u-foo)
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/u-foo)
|
|
10
10
|
[](https://www.npmjs.com/package/u-foo)
|
|
@@ -12,393 +12,392 @@
|
|
|
12
12
|
[](https://nodejs.org)
|
|
13
13
|
[](https://www.apple.com/macos)
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## 功能概览
|
|
16
16
|
|
|
17
|
-
ufoo
|
|
17
|
+
- `ufoo` / `ufoo chat` 打开交互式多 Agent 仪表盘。
|
|
18
|
+
- `uclaude`、`ucodex`、`ucode` 会带着项目 bootstrap、bus 身份和 ufoo 协议上下文启动 Agent。
|
|
19
|
+
- `ufoo daemon` 负责项目运行态、启动/恢复、组编排、报告和 chat bridge 请求。
|
|
20
|
+
- `ufoo bus` 提供项目内 Agent 消息、唤醒、监听、提醒和终端激活。
|
|
21
|
+
- `ufoo ctx`、`ufoo memory`、`ufoo history` 把决策、长期事实和输入时间线写入 `.ufoo/`。
|
|
22
|
+
- `ufoo group` 从 `templates/groups/` 的内置模板启动多 Agent 小组。
|
|
23
|
+
- `ufoo online` 提供远程 relay、频道、房间、token 和 inbox 辅助命令。
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
- **📬 消息路由** - Agent 之间通过事件总线通信协作
|
|
21
|
-
- **🧠 上下文共享** - 跨 Agent 共享决策和知识
|
|
22
|
-
- **🚀 自动初始化** - Agent 包装器自动完成配置
|
|
23
|
-
- **📝 决策追踪** - 记录架构决策和权衡取舍
|
|
24
|
-
- **⚡ 实时更新** - 即时查看 Agent 状态和消息
|
|
25
|
+
## 环境要求
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
- 实时 Agent 通信和状态监控
|
|
30
|
-
- 仪表盘展示 Agent 列表、在线状态和快捷操作
|
|
31
|
-
- 使用 `@agent-name` 向特定 Agent 发送消息
|
|
32
|
-
- **事件总线** - Agent 间实时消息通信 (`ufoo bus`)
|
|
33
|
-
- **上下文共享** - 共享决策和项目上下文 (`ufoo ctx`)
|
|
34
|
-
- **Agent 包装器** - Claude Code (`uclaude`)、Codex (`ucodex`) 和 ucode 助手 (`ucode`) 自动初始化
|
|
35
|
-
- **PTY 包装器** - 智能终端模拟与就绪检测
|
|
36
|
-
- **智能探针注入** - 等待 Agent 初始化完成后再注入命令
|
|
37
|
-
- **统一命名** - 一致的 Agent 命名规范(如 ucode-1、claude-1、codex-1)
|
|
38
|
-
- **技能系统** - 可扩展的 Agent 能力 (`ufoo skills`)
|
|
27
|
+
- Node.js 18 或更新版本。
|
|
28
|
+
- macOS,用于 Terminal.app/iTerm2 启动和激活集成。
|
|
29
|
+
- 使用 `uclaude` 或 `ucodex` 时,需要本机已经安装 Claude Code 或 Codex CLI。
|
|
39
30
|
|
|
40
31
|
## 安装
|
|
41
32
|
|
|
33
|
+
安装 npm 发布包:
|
|
34
|
+
|
|
42
35
|
```bash
|
|
43
|
-
# 从 npm 全局安装(推荐)
|
|
44
36
|
npm install -g u-foo
|
|
45
37
|
```
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
或从源码链接本仓库:
|
|
48
40
|
|
|
49
41
|
```bash
|
|
50
|
-
git clone https://github.com/Icyoung/ufoo.git
|
|
51
|
-
cd
|
|
42
|
+
git clone https://github.com/Icyoung/ufoo.git
|
|
43
|
+
cd ufoo
|
|
44
|
+
npm install
|
|
45
|
+
npm link
|
|
52
46
|
```
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
安装后会提供这些命令:`ufoo`、`uclaude`、`ucodex`、`ucode`、`ucode-core`。
|
|
55
49
|
|
|
56
50
|
## 快速开始
|
|
57
51
|
|
|
58
52
|
```bash
|
|
59
|
-
# 初始化项目
|
|
60
53
|
cd your-project
|
|
61
|
-
ufoo init
|
|
62
|
-
|
|
63
|
-
# 启动聊天界面(默认命令)
|
|
64
|
-
ufoo chat
|
|
65
|
-
# 或直接
|
|
54
|
+
ufoo init --modules context,bus
|
|
66
55
|
ufoo
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
在 chat UI 里启动 Agent:
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
```text
|
|
61
|
+
> /launch claude
|
|
62
|
+
> /launch codex
|
|
63
|
+
> /launch ucode
|
|
64
|
+
> @claude-1 read the project structure and summarize the risks
|
|
72
65
|
```
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
也可以直接从项目目录启动包装器:
|
|
75
68
|
|
|
76
69
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
uclaude
|
|
71
|
+
ucodex
|
|
72
|
+
ucode
|
|
73
|
+
```
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
> /launch claude
|
|
82
|
-
> /launch ucode
|
|
75
|
+
`ufoo chat` 会按需启动项目 daemon。跨项目全局模式:
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
```bash
|
|
78
|
+
ufoo -g
|
|
79
|
+
```
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
claude-1: 分析完成,发现 3 处需要重构...
|
|
90
|
-
ucode-1: Bug 已修复,正在运行测试...
|
|
81
|
+
## 架构
|
|
91
82
|
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
```text
|
|
84
|
+
ufoo chat / ufoo -g
|
|
85
|
+
|
|
|
86
|
+
v
|
|
87
|
+
+----------------+----------------+
|
|
88
|
+
| project daemon / IPC / reports |
|
|
89
|
+
+----------------+----------------+
|
|
90
|
+
|
|
|
91
|
+
+--------------+--------------+
|
|
92
|
+
| | |
|
|
93
|
+
v v v
|
|
94
|
+
controller group runtime project registry
|
|
95
|
+
gate/router loop orchestration ~/.ufoo/projects
|
|
96
|
+
|
|
|
97
|
+
v
|
|
98
|
+
provider API transports and tools
|
|
99
|
+
codex/claude/ucode, memory, bus, terminal
|
|
100
|
+
|
|
|
101
|
+
v
|
|
102
|
+
uclaude / ucodex / ucode agent sessions
|
|
94
103
|
```
|
|
95
104
|
|
|
96
|
-
|
|
105
|
+
Chat UI 通过 `.ufoo/run/ufoo.sock` 和项目 daemon 通信。daemon 负责启动、恢复、recover、group 编排、report、controller 路由和项目注册表更新。Agent 通过项目 bus 通信,并可使用共享决策、memory、report、prompt history 和工具处理器。
|
|
106
|
+
|
|
107
|
+
## 常用命令
|
|
97
108
|
|
|
98
|
-
|
|
109
|
+
### 项目运行态
|
|
99
110
|
|
|
100
111
|
```bash
|
|
101
|
-
ufoo
|
|
102
|
-
ufoo
|
|
103
|
-
ufoo
|
|
112
|
+
ufoo init --modules context,bus,resources
|
|
113
|
+
ufoo status
|
|
114
|
+
ufoo doctor
|
|
115
|
+
ufoo daemon --start
|
|
116
|
+
ufoo daemon --status
|
|
117
|
+
ufoo daemon --stop
|
|
104
118
|
```
|
|
105
119
|
|
|
106
|
-
|
|
120
|
+
`ufoo init` 会创建 `.ufoo/`,向 `AGENTS.md` 和 `CLAUDE.md` 注入 ufoo 协议块,创建 shared memory 存储,并初始化指定模块。默认模块是 `context`;常用多 Agent 项目建议使用 `--modules context,bus`。
|
|
121
|
+
|
|
122
|
+
### Chat 和 Agent
|
|
107
123
|
|
|
108
124
|
```bash
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
125
|
+
ufoo
|
|
126
|
+
ufoo chat
|
|
127
|
+
ufoo chat -g
|
|
128
|
+
ufoo launch codex reviewer --profile review-critic
|
|
129
|
+
ufoo solo list
|
|
130
|
+
ufoo solo run implementation-lead --agent codex --nickname builder
|
|
131
|
+
ufoo role ufoo-builder implementation-lead
|
|
132
|
+
ufoo resume <ucode|uclaude|ucodex|nickname>
|
|
133
|
+
ufoo recover list
|
|
112
134
|
```
|
|
113
135
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
使用 `ufoo -g`(或 `ufoo --global`)启动跨项目聊天仪表盘。全局模式不再绑定当前工作目录,而是使用一个基于家目录的控制器上下文,并将自身运行时写入 `~/.ufoo`,然后按需连接各项目的 ufoo 守护进程。
|
|
136
|
+
常见 chat 命令包括 `/status`、`/bus list`、`/bus status`、`/settings`、`/project list`、`/project switch <index|path>`、`/open <path>`、`/resume list`、`/group status` 和 `@nickname <message>`。
|
|
117
137
|
|
|
118
|
-
|
|
138
|
+
### 事件总线
|
|
119
139
|
|
|
120
140
|
```bash
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
ufoo bus join
|
|
142
|
+
ufoo bus status
|
|
143
|
+
ufoo bus send codex:abc123 "Please implement the approved slice."
|
|
144
|
+
ufoo bus check codex:abc123
|
|
145
|
+
ufoo bus listen codex:abc123 --from-beginning
|
|
146
|
+
ufoo bus alert codex:abc123 --daemon --notify
|
|
147
|
+
ufoo bus wake ufoo-builder --reason follow-up
|
|
148
|
+
ufoo bus activate ufoo-builder
|
|
128
149
|
```
|
|
129
150
|
|
|
130
|
-
|
|
131
|
-
|------|------|
|
|
132
|
-
| `/project list` | 列出全局运行时注册的项目 |
|
|
133
|
-
| `/project switch <序号\|路径>` | 切换活动项目的 daemon 连接 |
|
|
134
|
-
| `/open <path>` | 仅在全局模式下可用;按路径初始化、启动并打开项目 daemon |
|
|
135
|
-
| `/launch <agent> scope=inplace` | 在当前工作区启动 Agent |
|
|
136
|
-
| `/launch <agent> scope=window` | 在独立终端窗口启动 Agent |
|
|
151
|
+
先用 `ufoo bus status` 查看真实 subscriber ID 或可解析昵称。当前项目会给显式 group 昵称加项目前缀,例如 `ufoo-builder`;裸 `builder` 目标不一定能解析。
|
|
137
152
|
|
|
138
|
-
|
|
139
|
-
- 如果你在控制器视图里直接输入普通消息,全局 `ufoo-agent` 会先尝试把它路由到最相关的已注册项目。
|
|
140
|
-
- 选中的项目里,项目侧 `ufoo-agent` 会继续完成第二跳路由,选择具体 coding agent。
|
|
153
|
+
### 上下文、Memory、Report
|
|
141
154
|
|
|
142
|
-
|
|
155
|
+
```bash
|
|
156
|
+
ufoo ctx decisions -l
|
|
157
|
+
ufoo ctx decisions -n 1
|
|
158
|
+
ufoo ctx decisions new "Adopt API-backed loop architecture"
|
|
143
159
|
|
|
144
|
-
|
|
160
|
+
ufoo memory add "Provider contract" --body "Durable fact..." --tags provider,contract
|
|
161
|
+
ufoo memory list --tag provider
|
|
162
|
+
ufoo memory show mem-0001
|
|
145
163
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
"ucodeProvider": "openai",
|
|
150
|
-
"ucodeModel": "gpt-4-turbo-preview",
|
|
151
|
-
"ucodeBaseUrl": "https://api.openai.com/v1",
|
|
152
|
-
"ucodeApiKey": "sk-***"
|
|
153
|
-
}
|
|
154
|
-
```
|
|
164
|
+
ufoo history build
|
|
165
|
+
ufoo history show 20
|
|
166
|
+
ufoo history prompt 30
|
|
155
167
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"claudeProvider": "claude-cli",
|
|
160
|
-
"claudeModel": "claude-3-opus"
|
|
161
|
-
}
|
|
168
|
+
ufoo report start "Implement README refresh" --task docs-readme --agent ufoo-builder
|
|
169
|
+
ufoo report done "README updated" --task docs-readme --agent ufoo-builder
|
|
170
|
+
ufoo report list
|
|
162
171
|
```
|
|
163
172
|
|
|
164
|
-
|
|
165
|
-
```json
|
|
166
|
-
{
|
|
167
|
-
"codexProvider": "codex-cli",
|
|
168
|
-
"codexModel": "gpt-4"
|
|
169
|
-
}
|
|
170
|
-
```
|
|
173
|
+
决策只用于计划级约束;长期项目事实应写入 memory。
|
|
171
174
|
|
|
172
|
-
###
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
"codexModel": "gpt-4"
|
|
184
|
-
}
|
|
175
|
+
### Group
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
ufoo group templates
|
|
179
|
+
ufoo group template show build-lane
|
|
180
|
+
ufoo group template validate templates/groups/build-lane.json
|
|
181
|
+
ufoo group run build-lane --dry-run
|
|
182
|
+
ufoo group run build-lane --instance docs-refresh
|
|
183
|
+
ufoo group status
|
|
184
|
+
ufoo group diagram build-lane --mermaid
|
|
185
|
+
ufoo group stop docs-refresh
|
|
185
186
|
```
|
|
186
187
|
|
|
187
|
-
`
|
|
188
|
+
当前内置模板包括 `build-lane`、`build-ultra`、`design-system`、`product-discovery`、`ui-plan-review`、`ui-polish` 和 `verify-ship`。
|
|
188
189
|
|
|
189
|
-
|
|
190
|
+
### Online Relay
|
|
190
191
|
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
│ ufoo bus │ 事件总线
|
|
200
|
-
└──────┬──────┘
|
|
201
|
-
│
|
|
202
|
-
┌────────────┼────────────┐
|
|
203
|
-
│ │ │
|
|
204
|
-
┌──────▼──────┐ ┌───▼───┐ ┌──────▼──────┐
|
|
205
|
-
│ .ufoo/bus │ │context│ │ decisions │
|
|
206
|
-
└─────────────┘ └───────┘ └─────────────┘
|
|
192
|
+
```bash
|
|
193
|
+
ufoo online server --host 127.0.0.1 --port 8787
|
|
194
|
+
ufoo online token codex:abc123 --nickname builder
|
|
195
|
+
ufoo online channel list --nickname builder
|
|
196
|
+
ufoo online room create --nickname builder --name review-room --type private --password secret
|
|
197
|
+
ufoo online connect --nickname builder --room <room_id> --room-password secret
|
|
198
|
+
ufoo online send --nickname builder --room <room_id> --text "handoff ready"
|
|
199
|
+
ufoo online inbox builder --unread
|
|
207
200
|
```
|
|
208
201
|
|
|
209
|
-
|
|
202
|
+
`room create` 会返回生成的 room ID,例如 `room_000000`;`connect` 和 `send` 的 `--room` 应使用这个 ID。`--name` 是展示元数据,不是加入/发送时的标识。默认公开服务地址是 `https://online.ufoo.dev`;本地开发可用 `ufoo online server` 启动自己的 relay。
|
|
210
203
|
|
|
211
|
-
|
|
204
|
+
### 原生 ucode 运行时
|
|
212
205
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
| `ufoo chat` | 启动交互式多 Agent 聊天 UI |
|
|
218
|
-
| `ufoo -g` | 启动全局聊天模式(跨项目仪表盘) |
|
|
219
|
-
| `ufoo init` | 在当前项目初始化 .ufoo |
|
|
220
|
-
| `ufoo status` | 显示 banner、未读消息和未处理决策 |
|
|
221
|
-
| `ufoo doctor` | 检查安装状态 |
|
|
222
|
-
|
|
223
|
-
### Agent 管理
|
|
224
|
-
| 命令 | 说明 |
|
|
225
|
-
|------|------|
|
|
226
|
-
| `ufoo daemon start` | 启动 ufoo 守护进程 |
|
|
227
|
-
| `ufoo daemon stop` | 停止 ufoo 守护进程 |
|
|
228
|
-
| `ufoo daemon status` | 查看守护进程状态 |
|
|
229
|
-
| `ufoo resume [nickname]` | 恢复 Agent 会话 |
|
|
206
|
+
```bash
|
|
207
|
+
ufoo ucode doctor
|
|
208
|
+
ufoo ucode prepare
|
|
209
|
+
ufoo ucode build
|
|
230
210
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
| `ufoo bus send <id> <msg>` | 发送消息给 Agent |
|
|
236
|
-
| `ufoo bus check <id>` | 检查待处理消息 |
|
|
237
|
-
| `ufoo bus status` | 查看总线状态和在线 Agent |
|
|
211
|
+
ucode-core submit --tool read --args-json '{"path":"README.md"}' --json
|
|
212
|
+
ucode-core run-once --json
|
|
213
|
+
ucode-core list --json
|
|
214
|
+
```
|
|
238
215
|
|
|
239
|
-
|
|
240
|
-
| 命令 | 说明 |
|
|
241
|
-
|------|------|
|
|
242
|
-
| `ufoo ctx decisions -l` | 列出所有决策 |
|
|
243
|
-
| `ufoo ctx decisions -n 1` | 显示最新决策 |
|
|
244
|
-
| `ufoo ctx decisions new <title>` | 创建新决策 |
|
|
216
|
+
## 命令参考
|
|
245
217
|
|
|
246
|
-
|
|
247
|
-
| 命令 | 说明 |
|
|
218
|
+
| 范围 | 命令 |
|
|
248
219
|
|------|------|
|
|
249
|
-
| `ufoo
|
|
250
|
-
| `ufoo
|
|
220
|
+
| 运行态 | `ufoo`, `ufoo chat`, `ufoo -g`, `ufoo init`, `ufoo status`, `ufoo doctor`, `ufoo daemon --start|--status|--stop` |
|
|
221
|
+
| 项目 | `ufoo project list`, `ufoo project current`, `ufoo project switch`(v1 中仅 chat 可切换), chat `/open <path>` |
|
|
222
|
+
| Agent | `ufoo launch`, `ufoo solo list|run`, `ufoo role`, `ufoo resume <target>`, `ufoo recover list|run` |
|
|
223
|
+
| Bus | `ufoo bus join|status|send|check|listen|alert|wake|activate` |
|
|
224
|
+
| Context | `ufoo ctx doctor`, `ufoo ctx decisions`, `ufoo ctx sync` |
|
|
225
|
+
| Memory | `ufoo memory add|list|show|edit|forget|rebuild-index|audit` |
|
|
226
|
+
| Report | `ufoo report start|progress|done|error|list` |
|
|
227
|
+
| Group | `ufoo group templates|template|run|status|diagram|stop` |
|
|
228
|
+
| Online | `ufoo online server|token|room|channel|connect|send|inbox` |
|
|
229
|
+
| History | `ufoo history build|show|prompt` |
|
|
230
|
+
| Skills | `ufoo skills list|install` |
|
|
231
|
+
| Chat 设置 | `/settings`, `/settings agent`, `/settings router`, `/settings ucode` |
|
|
251
232
|
|
|
252
|
-
|
|
253
|
-
- Claude CLI 的 headless agent 使用 `--dangerously-skip-permissions`。
|
|
233
|
+
## 配置
|
|
254
234
|
|
|
255
|
-
|
|
235
|
+
项目配置文件是 `.ufoo/config.json`。`ucode` provider 凭据写入全局 `~/.ufoo/config.json`,加载项目配置时会合并进来。
|
|
256
236
|
|
|
237
|
+
常见项目配置:
|
|
238
|
+
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"launchMode": "auto",
|
|
242
|
+
"agentProvider": "codex-cli",
|
|
243
|
+
"controllerMode": "main",
|
|
244
|
+
"codexInternalThreadMode": "api",
|
|
245
|
+
"codexAuthPath": "",
|
|
246
|
+
"codexOauthRefreshWindowSec": 300,
|
|
247
|
+
"claudeOauthProfile": "",
|
|
248
|
+
"claudeOauthTokenPath": "",
|
|
249
|
+
"claudeOauthRefreshWindowSec": 300,
|
|
250
|
+
"routerProvider": "",
|
|
251
|
+
"routerModel": "",
|
|
252
|
+
"agentModel": "",
|
|
253
|
+
"autoResume": true
|
|
254
|
+
}
|
|
257
255
|
```
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
├── modules/
|
|
272
|
-
│ ├── context/ # 决策/上下文协议
|
|
273
|
-
│ ├── bus/ # 总线模块资源
|
|
274
|
-
│ └── resources/ # UI/图标(可选)
|
|
275
|
-
├── AGENTS.md # 项目指令(规范文件)
|
|
276
|
-
└── CLAUDE.md # 指向 AGENTS.md
|
|
256
|
+
|
|
257
|
+
`launchMode` 支持 `auto`、`internal`、`internal-pty`、`tmux`、`terminal`、`host`。`controllerMode` 支持 `main`、`shadow`、`loop` 和 legacy 兼容值。
|
|
258
|
+
|
|
259
|
+
全局 `ucode` 配置:
|
|
260
|
+
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"ucodeProvider": "openai",
|
|
264
|
+
"ucodeModel": "gpt-4.1",
|
|
265
|
+
"ucodeBaseUrl": "https://api.openai.com/v1",
|
|
266
|
+
"ucodeApiKey": "sk-...",
|
|
267
|
+
"ucodeAgentDir": ""
|
|
268
|
+
}
|
|
277
269
|
```
|
|
278
270
|
|
|
279
|
-
##
|
|
271
|
+
## 项目结构
|
|
280
272
|
|
|
281
|
-
|
|
273
|
+
仓库结构:
|
|
282
274
|
|
|
275
|
+
```text
|
|
276
|
+
ufoo/
|
|
277
|
+
bin/ CLI 入口
|
|
278
|
+
src/ CommonJS 实现
|
|
279
|
+
agent/ Agent 启动、bootstrap、运行时、provider
|
|
280
|
+
bus/ 项目事件总线
|
|
281
|
+
chat/ 终端 dashboard UI
|
|
282
|
+
cli/ 命令适配层
|
|
283
|
+
code/ 原生 ucode core
|
|
284
|
+
controller/ gate router、launch routing、shadow guard
|
|
285
|
+
context/ 决策与上下文检查
|
|
286
|
+
daemon/ 项目 daemon、IPC、编排
|
|
287
|
+
group/ prompt profiles 与 group templates
|
|
288
|
+
memory/ shared memory store
|
|
289
|
+
online/ relay client/server helpers
|
|
290
|
+
projects/ 全局项目注册表
|
|
291
|
+
providerapi/ redaction 与 provider shadow-diff helpers
|
|
292
|
+
report/ Agent report store
|
|
293
|
+
terminal/ Terminal.app、iTerm2、tmux、host adapters
|
|
294
|
+
tools/ controller/tool handler registry
|
|
295
|
+
templates/groups/ 内置多 Agent group 模板
|
|
296
|
+
modules/ init 模板和打包模块文档
|
|
297
|
+
SKILLS/ 打包的 Agent skills
|
|
298
|
+
test/ Jest 单元测试和集成测试
|
|
283
299
|
```
|
|
300
|
+
|
|
301
|
+
执行 `ufoo init --modules context,bus` 后创建:
|
|
302
|
+
|
|
303
|
+
```text
|
|
284
304
|
your-project/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
305
|
+
.ufoo/
|
|
306
|
+
memory/ 长期项目事实
|
|
307
|
+
context/
|
|
308
|
+
decisions/ decision 文件
|
|
309
|
+
decisions.jsonl decision 索引
|
|
310
|
+
bus/
|
|
311
|
+
events/ event log files
|
|
312
|
+
queues/ per-agent queues
|
|
313
|
+
logs/ bus logs
|
|
314
|
+
offsets/ read offsets
|
|
315
|
+
agent/
|
|
316
|
+
all-agents.json Agent 元数据注册表
|
|
317
|
+
daemon/
|
|
318
|
+
counts/ bus daemon delivery counts
|
|
319
|
+
docs -> docs/ 当项目存在 docs/ 时创建的可选 symlink
|
|
320
|
+
AGENTS.md 规范 Agent 指令文件
|
|
321
|
+
CLAUDE.md Claude 兼容指令文件
|
|
295
322
|
```
|
|
296
323
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
324
|
+
运行时或相关功能使用后创建:
|
|
325
|
+
|
|
326
|
+
```text
|
|
327
|
+
.ufoo/run/
|
|
328
|
+
ufoo.sock project daemon IPC socket
|
|
329
|
+
ufoo-daemon.pid project daemon pid
|
|
330
|
+
ufoo-daemon.log project daemon log
|
|
331
|
+
.ufoo/daemon/
|
|
332
|
+
daemon.pid bus auto-inject daemon pid
|
|
333
|
+
daemon.log bus auto-inject daemon log
|
|
334
|
+
.ufoo/chat/ chat runtime state
|
|
335
|
+
.ufoo/groups/ group runtime instances
|
|
336
|
+
.ufoo/history/ Agent 输入时间线
|
|
337
|
+
.ufoo/agent/
|
|
338
|
+
reports/ Agent report records
|
|
339
|
+
private-inbox/ private controller inbox
|
|
340
|
+
sessions/ provider/session metadata
|
|
341
|
+
```
|
|
300
342
|
|
|
301
|
-
|
|
302
|
-
- **实时通信** - 在一个界面查看所有 Agent 消息
|
|
303
|
-
- **Agent 仪表盘** - 监控在线状态、会话 ID 和昵称
|
|
304
|
-
- **定向消息** - 使用 `@agent-name` 向特定 Agent 发送消息
|
|
305
|
-
- **命令补全** - Tab 键补全命令和 Agent 名称
|
|
306
|
-
- **鼠标支持** - `Ctrl+M` 切换鼠标模式(滚动 vs 文本选择)
|
|
307
|
-
- **会话历史** - 跨会话持久化消息记录
|
|
343
|
+
全局运行态位于 `~/.ufoo/`,包括 `~/.ufoo/config.json` 的 `ucode` provider 设置,以及 `~/.ufoo/projects/runtime/*.json` 的全局 chat 项目注册记录。
|
|
308
344
|
|
|
309
|
-
|
|
310
|
-
| 按键 | 操作 |
|
|
311
|
-
|------|------|
|
|
312
|
-
| `Tab` | 自动补全命令/Agent |
|
|
313
|
-
| `Ctrl+C` | 退出聊天 |
|
|
314
|
-
| `Ctrl+M` | 切换鼠标模式 |
|
|
315
|
-
| `Ctrl+L` | 清屏 |
|
|
316
|
-
| `Ctrl+R` | 刷新 Agent 列表 |
|
|
317
|
-
| `↑/↓` | 浏览命令历史 |
|
|
318
|
-
|
|
319
|
-
### 聊天命令
|
|
320
|
-
| 命令 | 说明 |
|
|
321
|
-
|------|------|
|
|
322
|
-
| `/help` | 显示可用命令 |
|
|
323
|
-
| `/agents` | 列出在线 Agent |
|
|
324
|
-
| `/clear` | 清除聊天记录 |
|
|
325
|
-
| `/settings` | 配置聊天偏好 |
|
|
326
|
-
| `@agent-name <message>` | 向特定 Agent 发送消息 |
|
|
345
|
+
## 开发
|
|
327
346
|
|
|
328
|
-
|
|
347
|
+
```bash
|
|
348
|
+
npm install
|
|
349
|
+
npm link
|
|
350
|
+
node bin/ufoo.js --help
|
|
351
|
+
npm test
|
|
352
|
+
```
|
|
329
353
|
|
|
330
|
-
|
|
354
|
+
常用检查:
|
|
331
355
|
|
|
332
356
|
```bash
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
ufoo bus check "codex:abc123"
|
|
338
|
-
# → 自动执行任务
|
|
339
|
-
# → 回复结果
|
|
340
|
-
ufoo bus send "claude-code:xyz789" "分析完成:..."
|
|
357
|
+
npm run test:watch
|
|
358
|
+
npm run test:coverage
|
|
359
|
+
npm run bench:global-switch
|
|
360
|
+
node bin/ucode-core.js --help
|
|
341
361
|
```
|
|
342
362
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
内置技能通过斜杠命令触发:
|
|
363
|
+
测试框架是 Jest,`testEnvironment` 为 `node`。覆盖率忽略 `node_modules` 和 `src/code/tui.js`。
|
|
346
364
|
|
|
347
|
-
|
|
348
|
-
- `/uctx` - 快速检查上下文状态
|
|
349
|
-
- `/ustatus` - 统一状态视图(横幅、未读消息、未决决策)
|
|
350
|
-
- `/uinit` - 手动初始化 .ufoo
|
|
365
|
+
## 发布
|
|
351
366
|
|
|
352
|
-
|
|
367
|
+
`package.json` 没有专用 release script。请在干净工作区按标准 npm 流程发布:
|
|
353
368
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
369
|
+
```bash
|
|
370
|
+
npm test
|
|
371
|
+
npm pack --dry-run
|
|
372
|
+
npm version patch # 或 minor/major
|
|
373
|
+
npm publish
|
|
374
|
+
git push --follow-tags
|
|
375
|
+
```
|
|
358
376
|
|
|
359
|
-
|
|
377
|
+
发布前用 `npm pack --dry-run` 检查最终 tarball。
|
|
360
378
|
|
|
361
|
-
|
|
379
|
+
## 故障排查
|
|
362
380
|
|
|
363
|
-
如果
|
|
381
|
+
如果 `ufoo` 不在 `PATH`:
|
|
364
382
|
|
|
365
383
|
```bash
|
|
366
|
-
|
|
367
|
-
ufoo chat # 守护进程自动启动
|
|
384
|
+
node bin/ufoo.js --help
|
|
368
385
|
```
|
|
369
386
|
|
|
370
|
-
|
|
387
|
+
如果 Codex 默认 home 不可写:
|
|
371
388
|
|
|
372
|
-
### 环境搭建
|
|
373
389
|
```bash
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
cd ufoo
|
|
377
|
-
|
|
378
|
-
# 安装依赖
|
|
379
|
-
npm install
|
|
380
|
-
|
|
381
|
-
# 本地开发链接
|
|
382
|
-
npm link
|
|
383
|
-
|
|
384
|
-
# 运行测试
|
|
385
|
-
npm test
|
|
390
|
+
export CODEX_HOME="$PWD/.ufoo/codex"
|
|
391
|
+
ufoo
|
|
386
392
|
```
|
|
387
393
|
|
|
388
|
-
|
|
389
|
-
- Fork 本仓库
|
|
390
|
-
- 创建功能分支 (`git checkout -b feature/amazing-feature`)
|
|
391
|
-
- 提交更改 (`git commit -m 'Add amazing feature'`)
|
|
392
|
-
- 推送分支 (`git push origin feature/amazing-feature`)
|
|
393
|
-
- 发起 Pull Request
|
|
394
|
+
Codex 场景下建议使用 bus alert/listen,而不是依赖终端文本注入提醒:
|
|
394
395
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
- `test/` - 单元测试和集成测试
|
|
400
|
-
- `SKILLS/` - Agent 技能定义
|
|
396
|
+
```bash
|
|
397
|
+
ufoo bus alert codex:abc123 --daemon
|
|
398
|
+
ufoo bus listen codex:abc123
|
|
399
|
+
```
|
|
401
400
|
|
|
402
401
|
## 许可证
|
|
403
402
|
|
|
404
|
-
UNLICENSED
|
|
403
|
+
UNLICENSED。详见 [LICENSE](LICENSE)。
|