Skip to content

Commit bbf9188

Browse files
committed
fix: clarify thread status markers and sanitize docs paths
1 parent 3c1e153 commit bbf9188

5 files changed

Lines changed: 121 additions & 89 deletions

File tree

README.md

Lines changed: 110 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,105 @@
22

33
[English](#english) | [中文](#中文)
44

5-
## English
6-
Zero-configuration remote control for Codex (`Desktop App + Relay + local Codex execution`).
7-
8-
Goal: users download the app, complete setup in the wizard, and control Codex from Telegram without command-line steps.
9-
10-
### Monorepo
11-
- `packages/bridge-core`: execution orchestration, health checks, config, launchd manager.
12-
- `apps/desktop`: Electron + React desktop app (wizard + advanced settings + menu bar entry).
13-
- `services/cloud-relay`: Fastify + WebSocket relay service.
14-
- `src` (legacy): previous bridge implementation kept for compatibility.
15-
16-
### Current capabilities
17-
- Desktop setup wizard + app home (Current Status / Advanced Settings / Logs & Feedback).
18-
- Telegram bot pairing via QR code.
19-
- Bound-thread remote turns with status + final response.
20-
- Telegram usage query (`/usage`, alias `/limits`).
21-
- Thread list with live per-thread task state in `/threads`.
22-
- Approval routing (`/approve` / `/deny`).
23-
- Menu bar control (status, remote on/off, open settings).
24-
- i18n support for **English + Chinese** (`en`/`zh`) across desktop UI, tray, and Telegram responses.
25-
26-
### Dev quick start
5+
## 中文
6+
7+
把 Codex 从“只能坐在电脑前用”,变成“手机 Telegram 随时远程用”。
8+
9+
### 这个项目解决什么痛点
10+
- 你离开电脑后,Codex 对话无法继续跟进。
11+
- 你在手机上只能看消息,不能像在 Codex 里那样继续驱动任务。
12+
- 需要远程审批、查看状态、切换线程时,缺少统一入口。
13+
14+
Codex Bridge Desktop 的目标是:**让你用 Telegram 像远程控制台一样操作本机 Codex**,并尽量保持与 Codex 线程一致。
15+
16+
### 你现在可以做到什么
17+
- 在 Telegram 中发送文本/图片,转给已绑定的 Codex thread 执行。
18+
- 在 Telegram 中查看最近线程、绑定线程、查看当前对话快照。
19+
- 在 Telegram 中处理审批(`/approve` / `/deny`)。
20+
- 查询 Codex 用量(`/usage``/limits`)。
21+
- 使用 macOS 菜单栏快速查看状态、启停远程能力。
22+
- 使用桌面 App 完成首次引导、机器人配置、日志排查。
23+
24+
## 2-3 分钟上手(普通用户)
25+
26+
### 1) 下载并打开 App
27+
1. 打开 Releases 页面下载最新版:
28+
`https://github.com/tonyHu08/CodeX_Bridge/releases`
29+
2. 安装并打开 `Codex Bridge Desktop`
30+
3. 保证本机已安装并登录 Codex App。
31+
32+
### 2) 配置 Telegram 机器人
33+
1. 在 Telegram 打开 `@BotFather`
34+
2.`/newbot` 创建机器人,拿到 Bot Token。
35+
3. 在桌面 App 中粘贴 Token,保存并启用。
36+
37+
### 3) 手机配对
38+
1. 在桌面 App 点击“开始配对”。
39+
2. 用 Telegram 打开配对链接(或扫码)。
40+
3. 配对成功后,机器人会回复已绑定。
41+
42+
### 4) 绑定要操作的 Codex 会话
43+
1. 在 Telegram 里发送 `/threads`
44+
2. 选择线程按钮,或用 `/bind <编号>``/bind latest`
45+
3. 之后直接发消息即可远程驱动该线程。
46+
47+
### 5) 日常使用
48+
- 直接发送文本任务(可附图)。
49+
- 随时用 `/status``/current``/usage` 查看状态。
50+
- 需要停止当前任务时用 `/cancel`
51+
52+
## 常用 Telegram 命令
53+
- `/threads`:查看最近线程并快速绑定
54+
- `/bind latest`:绑定最新线程
55+
- `/bind <index|threadId>`:绑定指定线程
56+
- `/current`:查看当前绑定线程快照
57+
- `/detail <index|threadId>`:查看线程详细信息
58+
- `/usage` / `/limits`:查询 Codex 用量
59+
- `/status`:查看桥接状态
60+
- `/cancel`:终止当前运行并清空排队
61+
- `/unbind`:解绑当前线程
62+
- `/help`:帮助
63+
64+
## 技术实现(面向开发者)
65+
66+
### Monorepo 结构
67+
- `apps/desktop`: Electron + React 桌面端(引导、主页、菜单栏)
68+
- `packages/bridge-core`: 线程编排、审批、状态管理、Codex App Server 客户端
69+
- `services/cloud-relay`: Relay 服务(可选,自托管场景)
70+
- `src` (legacy): 历史实现
71+
72+
### 核心机制
73+
- 使用 `codex app-server`(JSON-RPC)控制本机 thread:
74+
- `thread/list``thread/read``thread/resume``turn/start`
75+
- Telegram 侧做消息接入、命令路由、审批回传。
76+
- SQLite 持久化绑定、去重和审批状态。
77+
- macOS 菜单栏常驻,桌面窗口用于配置与诊断。
78+
79+
### 本地开发
2780
```bash
28-
cd /Users/junweihu/clawd/codex-remote-bridge
81+
cd /path/to/codex-remote-bridge
2982
npm install
3083
npm run setup
3184
npm run dev:relay
3285
npm run build:desktop
3386
npm run start:desktop
3487
```
3588

36-
### Quality checks
89+
### 构建校验
3790
```bash
3891
npm run typecheck
3992
npm run build
4093
```
4194

42-
### Key environment variables
43-
- `HOST` (default `127.0.0.1`)
44-
- `PORT` (default `8787`)
45-
- `RELAY_PUBLIC_BASE_URL` (default `http://127.0.0.1:8787`)
95+
### 关键环境变量
96+
- `HOST`(默认 `127.0.0.1`
97+
- `PORT`(默认 `8787`
98+
- `RELAY_PUBLIC_BASE_URL`(默认 `http://127.0.0.1:8787`
4699
- `RELAY_BOT_USERNAME`
47100
- `TELEGRAM_BOT_TOKEN`
48-
- `BRIDGE_LOCALE` (`zh` or `en`)
49-
50-
### Local data paths
51-
- `$HOME/.codex-bridge/config.json`
52-
- `$HOME/.codex-bridge/data/codex_bridge.db`
53-
- `$HOME/.codex-bridge/logs/agent.log`
101+
- `BRIDGE_LOCALE``zh``en`
54102

55-
### Documents
103+
### 文档
56104
- [Configuration](./docs/CONFIG.md)
57105
- [Commands](./docs/COMMANDS.md)
58106
- [Architecture](./docs/ARCHITECTURE.md)
@@ -61,59 +109,42 @@ npm run build
61109
- [Privacy](./docs/PRIVACY.md)
62110
- [Self-hosting](./docs/SELF_HOSTING.md)
63111
- [Threat model](./docs/THREAT_MODEL.md)
64-
- [Contributing](./CONTRIBUTING.md)
65-
- [Security](./SECURITY.md)
66-
- [Code of Conduct](./CODE_OF_CONDUCT.md)
67-
- [Open Source Checklist](./OPEN_SOURCE_CHECKLIST.md)
68112

69113
---
70114

71-
## 中文
72-
零配置远程控制能力(`桌面 App + Relay + 本地 Codex 执行`)。
115+
## English
73116

74-
目标体验:用户下载安装后,通过向导完成配对,即可用 Telegram 远程操作 Codex,无需命令行。
117+
Turn Codex from a desktop-only experience into a Telegram-based remote workflow.
75118

76-
### Monorepo 结构
77-
- `packages/bridge-core`:执行编排、健康检测、配置与 launchd 管理。
78-
- `apps/desktop`:Electron + React 桌面端(向导、设置、菜单栏入口)。
79-
- `services/cloud-relay`:Fastify + WebSocket Relay 服务。
80-
- `src`(legacy):历史桥接实现,保留兼容用途。
81-
82-
### 当前能力
83-
- 桌面端向导 + 应用主页(当前状态 / 高级设置 / 日志与反馈)。
84-
- Telegram 二维码配对。
85-
- 绑定线程后的远程执行(状态 + 最终回包)。
86-
- Telegram 用量查询(`/usage`,兼容 `/limits`)。
87-
- `/threads` 中展示每个会话的实时任务状态。
88-
- 审批流转(`/approve` / `/deny`)。
89-
- 菜单栏控制(状态、远程开关、打开设置)。
90-
- 国际化:桌面 UI、菜单栏、Telegram 回包支持 **中英文**`zh`/`en`)。
91-
92-
### 开发快速开始
119+
### What this project solves
120+
- You cannot continue Codex tasks when you are away from your computer.
121+
- You need a mobile control surface for thread operations, status, and approvals.
122+
- You want a practical remote bridge without changing your existing Codex workflow.
123+
124+
Codex Bridge Desktop lets you control local Codex threads from Telegram, with thread binding, status, approvals, and usage visibility.
125+
126+
### What you can do
127+
- Send text/image messages from Telegram to a bound Codex thread.
128+
- List and bind recent threads from Telegram.
129+
- Handle approvals remotely (`/approve`, `/deny`).
130+
- Check Codex rate limits (`/usage`, `/limits`).
131+
- Use macOS tray/menu bar for quick status and remote on/off.
132+
133+
### Quick start (2-3 minutes)
134+
1. Download the desktop app from Releases:
135+
`https://github.com/tonyHu08/CodeX_Bridge/releases`
136+
2. Open the app and complete the onboarding wizard.
137+
3. Create a Telegram bot via `@BotFather` and paste the Bot Token.
138+
4. Start pairing in the app, then open the pairing link in Telegram.
139+
5. In Telegram, run `/threads` and bind a thread.
140+
6. Send your message to start remote Codex execution.
141+
142+
### Development quick start
93143
```bash
94-
cd /Users/junweihu/clawd/codex-remote-bridge
144+
cd /path/to/codex-remote-bridge
95145
npm install
96146
npm run setup
97147
npm run dev:relay
98148
npm run build:desktop
99149
npm run start:desktop
100150
```
101-
102-
### 质量检查
103-
```bash
104-
npm run typecheck
105-
npm run build
106-
```
107-
108-
### 关键环境变量
109-
- `HOST`(默认 `127.0.0.1`
110-
- `PORT`(默认 `8787`
111-
- `RELAY_PUBLIC_BASE_URL`(默认 `http://127.0.0.1:8787`
112-
- `RELAY_BOT_USERNAME`
113-
- `TELEGRAM_BOT_TOKEN`
114-
- `BRIDGE_LOCALE``zh``en`
115-
116-
### 本地数据路径
117-
- `$HOME/.codex-bridge/config.json`
118-
- `$HOME/.codex-bridge/data/codex_bridge.db`
119-
- `$HOME/.codex-bridge/logs/agent.log`

docs/COMMANDS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
### Session commands
1414
- `/threads`
15-
- Each thread now shows live task state inline (`⏳ running` / `🕒 queued` / `✅ idle`).
15+
- Each thread shows bridge task state inline (`⏳ running` / `🕒 queued` / `⚪ unobserved`).
1616
- `/bind latest`
1717
- `/bind <threadId|index>`
1818
- `/usage` (alias: `/limits`)
@@ -41,7 +41,7 @@
4141

4242
### 会话命令
4343
- `/threads`
44-
- 每个 thread 行内会展示任务状态`⏳ 运行中` / `🕒 排队中` / `✅ 空闲`)。
44+
- 每个 thread 行内会展示桥接任务状态`⏳ 运行中` / `🕒 排队中` / `⚪ 未观测`)。
4545
- `/bind latest`
4646
- `/bind <threadId|编号>`
4747
- `/usage`(别名:`/limits`

docs/OPERATIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## English
44
### Local dev
55
```bash
6-
cd /Users/junweihu/clawd/codex-remote-bridge
6+
cd /path/to/codex-remote-bridge
77
npm install
88
npm run setup
99
npm run dev:relay
@@ -26,7 +26,7 @@ npm run dist:desktop
2626
## 中文
2727
### 本地开发
2828
```bash
29-
cd /Users/junweihu/clawd/codex-remote-bridge
29+
cd /path/to/codex-remote-bridge
3030
npm install
3131
npm run setup
3232
npm run dev:relay

docs/SELF_HOSTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ You can run your own relay and bot.
55

66
### Start relay
77
```bash
8-
cd /Users/junweihu/clawd/codex-remote-bridge/services/cloud-relay
8+
cd /path/to/codex-remote-bridge/services/cloud-relay
99
npm install
1010
npm run dev
1111
```
@@ -23,7 +23,7 @@ Set desktop relay URL to your hosted relay endpoint.
2323

2424
### 启动 relay
2525
```bash
26-
cd /Users/junweihu/clawd/codex-remote-bridge/services/cloud-relay
26+
cd /path/to/codex-remote-bridge/services/cloud-relay
2727
npm install
2828
npm run dev
2929
```

packages/bridge-core/src/agent.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ interface DisplayThreadsState {
9292
usingSidebarVisibility: boolean;
9393
}
9494

95-
type ThreadTaskState = 'running' | 'queued' | 'idle';
95+
type ThreadTaskState = 'running' | 'queued' | 'unknown';
9696

9797
interface TurnConversationSummary {
9898
turnId: string;
@@ -463,7 +463,7 @@ function buildThreadButtonTitle(
463463
taskState: ThreadTaskState,
464464
): string {
465465
const title = truncate(compactText(item.title || localeText(locale, `会话 ${index + 1}`, `Thread ${index + 1}`)), 24);
466-
const status = taskState === 'running' ? '⏳' : taskState === 'queued' ? '🕒' : '';
466+
const status = taskState === 'running' ? '⏳' : taskState === 'queued' ? '🕒' : '';
467467
return `${isCurrent ? '✅ ' : ''}${status} 🧵 ${title}`;
468468
}
469469

@@ -975,7 +975,7 @@ export class BridgeAgent extends EventEmitter {
975975
if (this.queuedByThread.has(threadId)) {
976976
return 'queued';
977977
}
978-
return 'idle';
978+
return 'unknown';
979979
}
980980

981981
private formatThreadTaskStateLabel(taskState: ThreadTaskState): string {
@@ -985,7 +985,7 @@ export class BridgeAgent extends EventEmitter {
985985
if (taskState === 'queued') {
986986
return this.t('🕒 排队中', '🕒 Queued');
987987
}
988-
return this.t('✅ 空闲', '✅ Idle');
988+
return this.t('⚪ 未观测', '⚪ Unobserved');
989989
}
990990

991991
async handleIncomingMessage(event: IncomingUserMessageEvent): Promise<void> {
@@ -1616,6 +1616,7 @@ export class BridgeAgent extends EventEmitter {
16161616
if (state.usingSidebarVisibility && state.hiddenCount > 0) {
16171617
lines.push(this.locale === 'en' ? `Filtered sidebar-invisible threads: ${state.hiddenCount}` : `已过滤侧边栏不可见会话: ${state.hiddenCount}`);
16181618
}
1619+
lines.push(this.t('状态说明:仅⏳/🕒表示桥接中任务;⚪表示当前未观测到桥接任务。', 'Status note: only ⏳/🕒 indicate bridge tasks; ⚪ means no bridge task currently observed.'));
16191620
lines.push('');
16201621
lines.push(this.t('可用: /bind [编号] | /detail [编号] | /bind latest', 'Available: /bind [index] | /detail [index] | /bind latest'));
16211622
lines.push(this.t('快速查看当前: /active', 'Quick view current: /active'));

0 commit comments

Comments
 (0)