11# Codex Bridge Desktop
22
3- [ English ] ( #english ) | [ 中文 ] ( #中文 )
3+ [ 中文 ] ( #中文 ) | [ English ] ( #english )
44
5- ## 中文
5+ ## English
66
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- ### 本地开发
7+ Remote-control your local Codex from Telegram, as if you never left your desk.
8+
9+ Codex Bridge Desktop turns Codex into a mobile-operable workflow: send tasks from your phone, bind to the exact thread you care about, review approvals, and get final responses back in Telegram.
10+
11+ ![ Codex Bridge Icon] ( ./apps/desktop/electron/assets/cab-brand-icon.png )
12+
13+ ### Why this exists
14+
15+ Codex is great on desktop, but real work does not stop when you step away.
16+
17+ This project solves exactly that:
18+ - Continue Codex conversations from your phone.
19+ - Keep thread-level control (` /threads ` , ` /bind ` , ` /current ` ) instead of a generic chat relay.
20+ - Handle approvals remotely (` /approve ` , ` /deny ` ) with clear visibility.
21+ - Check Codex usage quickly (` /usage ` , ` /limits ` ).
22+
23+ ### What you can do today
24+
25+ - Bind Telegram to a specific Codex thread and run remote turns.
26+ - Send text and image inputs from Telegram.
27+ - See command/status/final response in the same Telegram chat.
28+ - Use macOS menu bar for quick state and remote on/off.
29+ - Run bilingual experience (English + Chinese) across desktop + Telegram responses.
30+
31+ ### Experience flow
32+
33+ ``` mermaid
34+ flowchart LR
35+ A["Install Desktop App"] --> B["Paste Telegram Bot Token"]
36+ B --> C["Pair Phone (QR / deep link)"]
37+ C --> D["Send /threads in Telegram"]
38+ D --> E["Bind thread (/bind latest or index)"]
39+ E --> F["Send tasks remotely"]
40+ F --> G["Receive status + final response"]
41+ ```
42+
43+ ### Architecture (high level)
44+
45+ ``` mermaid
46+ flowchart TB
47+ TG["Telegram User"] --> BOT["Telegram Bot"]
48+ BOT --> RELAY["Local Relay (127.0.0.1)"]
49+ RELAY --> AGENT["Bridge Agent"]
50+ AGENT --> APP["Codex App Server (JSON-RPC)"]
51+ APP --> THREAD["Bound Codex Thread"]
52+ THREAD --> APP --> AGENT --> RELAY --> BOT --> TG
53+ ```
54+
55+ ---
56+
57+ ## Quick Start (2-3 minutes)
58+
59+ ### 1. Download and open
60+ 1 . Download latest build from [ Releases] ( https://github.com/tonyHu08/CodeX_Bridge/releases ) .
61+ 2 . Open ` Codex Bridge Desktop ` .
62+ 3 . Make sure Codex App is installed and logged in on this Mac.
63+
64+ ### 2. Create your Telegram bot
65+ 1 . Open ` @BotFather ` in Telegram.
66+ 2 . Run ` /newbot ` .
67+ 3 . Copy the Bot Token.
68+
69+ ### 3. Pair desktop with phone
70+ 1 . Paste Token in the desktop app and save.
71+ 2 . Click pairing.
72+ 3 . Open pairing link (or scan QR) in Telegram.
73+
74+ ### 4. Bind a Codex thread
75+ 1 . Send ` /threads ` in Telegram.
76+ 2 . Pick one thread button or run ` /bind latest ` .
77+ 3 . Send normal text to start remote execution.
78+
79+ ### 5. Daily commands
80+ - ` /threads `
81+ - ` /bind latest `
82+ - ` /current `
83+ - ` /status `
84+ - ` /usage ` (alias: ` /limits ` )
85+ - ` /cancel `
86+ - ` /unbind `
87+
88+ ---
89+
90+ ## Developer Guide
91+
92+ ### Monorepo layout
93+ - ` apps/desktop ` : Electron + React desktop app (onboarding + app home + menu bar).
94+ - ` packages/bridge-core ` : orchestration, Codex client, approvals, persistence.
95+ - ` services/cloud-relay ` : optional self-hosted relay.
96+ - ` src ` (legacy): earlier implementation kept for compatibility.
97+
98+ ### Local development
8099``` bash
81100cd /path/to/codex-remote-bridge
82101npm install
@@ -86,21 +105,21 @@ npm run build:desktop
86105npm run start:desktop
87106```
88107
89- ### 构建校验
108+ ### Quality checks
90109``` bash
91110npm run typecheck
92111npm run build
93112```
94113
95- ### 关键环境变量
96- - ` HOST ` (默认 ` 127.0.0.1 ` )
97- - ` PORT ` (默认 ` 8787 ` )
98- - ` RELAY_PUBLIC_BASE_URL ` (默认 ` http://127.0.0.1:8787 ` )
114+ ### Environment variables
115+ - ` HOST ` (default ` 127.0.0.1 ` )
116+ - ` PORT ` (default ` 8787 ` )
117+ - ` RELAY_PUBLIC_BASE_URL ` (default ` http://127.0.0.1:8787 ` )
99118- ` RELAY_BOT_USERNAME `
100119- ` TELEGRAM_BOT_TOKEN `
101- - ` BRIDGE_LOCALE ` ( ` zh ` 或 ` en ` )
120+ - ` BRIDGE_LOCALE ` ( ` en ` or ` zh ` )
102121
103- ### 文档
122+ ### More docs
104123- [ Configuration] ( ./docs/CONFIG.md )
105124- [ Commands] ( ./docs/COMMANDS.md )
106125- [ Architecture] ( ./docs/ARCHITECTURE.md )
@@ -112,39 +131,39 @@ npm run build
112131
113132---
114133
115- ## English
116-
117- Turn Codex from a desktop-only experience into a Telegram-based remote workflow.
118-
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.
134+ ## 中文
141135
142- ### Development quick start
143- ``` bash
144- cd /path/to/codex-remote-bridge
145- npm install
146- npm run setup
147- npm run dev:relay
148- npm run build:desktop
149- npm run start:desktop
150- ```
136+ 用 Telegram 远程操控本机 Codex,让你离开电脑也能持续推进对话和任务。
137+
138+ ### 这个项目能解决什么问题
139+ - 人不在电脑前,Codex 对话就中断。
140+ - 手机端缺少 thread 级别控制(不仅仅是“转发消息”)。
141+ - 远程审批、查看状态、查看用量缺少统一入口。
142+
143+ Codex Bridge Desktop 提供“桌面 + Telegram”一体化远程体验:
144+ 线程可绑定、状态可追踪、审批可确认、结果可回包。
145+
146+ ### 已支持能力
147+ - Telegram 文本/图片输入转发到绑定 thread。
148+ - ` /threads ` 查看最近线程并绑定。
149+ - ` /approve ` ` /deny ` 远程审批。
150+ - ` /usage ` ` /limits ` 查询用量。
151+ - 菜单栏快速查看在线状态与远程开关。
152+ - 桌面端与 Telegram 均支持中英文。
153+
154+ ### 快速上手
155+ 1 . 在 [ Releases] ( https://github.com/tonyHu08/CodeX_Bridge/releases ) 下载桌面端并打开。
156+ 2 . 在 ` @BotFather ` 创建机器人并拿到 Token。
157+ 3 . 在桌面端保存 Token 并完成配对。
158+ 4 . Telegram 发送 ` /threads ` 后绑定线程。
159+ 5 . 直接发送消息开始远程操作。
160+
161+ ### 常用命令
162+ - ` /threads ` :列出最近线程
163+ - ` /bind latest ` :绑定最新线程
164+ - ` /bind <编号|threadId> ` :绑定指定线程
165+ - ` /current ` :查看当前 thread 快照
166+ - ` /status ` :查看当前状态
167+ - ` /usage ` :查看 Codex 用量
168+ - ` /cancel ` :终止当前任务
169+ - ` /unbind ` :解绑线程
0 commit comments