chore: move telegram projects to top-level

This commit is contained in:
banteg
2025-12-28 21:31:48 +04:00
parent 5f4f97f529
commit 39c0bcec45
11 changed files with 2 additions and 2 deletions
+71
View File
@@ -0,0 +1,71 @@
# Telegram Codex Bridge (Codex)
Route Telegram replies back into Codex sessions. Includes three options:
1. Non-interactive `codex exec` + `codex exec resume`.
2. `codex mcp-server` with MCP stdio JSON-RPC.
3. tmux injection for interactive Codex sessions.
All options store a mapping from `(chat_id, bot_message_id)` to a route so replies can be routed correctly.
## Install
1. Ensure `uv` is installed.
2. From this folder, run the entrypoints with `uv run` (uses `pyproject.toml` deps).
3. Put your Telegram credentials in `~/.codex/telegram.toml`.
Example `~/.codex/telegram.toml`:
```toml
bot_token = "123:abc"
chat_id = 123456789
```
For Python < 3.11, install `tomli` to read TOML. `chat_id` is used both for allowed messages
and startup notifications.
Optional keys (by mode):
- common: `bridge_db`, `allowed_chat_ids`, `startup_chat_ids`
- exec/resume: `startup_message`, `codex_cmd`, `codex_workspace`, `codex_exec_args`, `max_workers`
- MCP server: `codex_mcp_cmd`, `codex_workspace`, `codex_sandbox`, `codex_approval_policy`
## Option 1: exec/resume
Run:
```bash
uv run codex-telegram-exec-bridge
```
## Option 2: MCP server
Run:
```bash
uv run codex-telegram-mcp-bridge
```
## Option 3: tmux
Reply injector:
```bash
uv run codex-telegram-tmux-reply
```
Notifier (call from your existing hook):
```bash
uv run codex-telegram-tmux-notify --tmux-target "codex1:0.0" --text "$TURN_TEXT"
```
Add `--chat-id` if `chat_id` is not set in `~/.codex/telegram.toml`.
## Files
- `src/codex_telegram_bridge/bridge_common.py`: shared Telegram client, chunking, and routing store
- `src/codex_telegram_bridge/exec_bridge.py`: codex exec + resume bridge
- `src/codex_telegram_bridge/mcp_bridge.py`: MCP stdio JSON-RPC bridge
- `src/codex_telegram_bridge/tmux_notify.py`: tmux notifier helper
- `src/codex_telegram_bridge/tmux_reply_bot.py`: tmux reply injector