feat: package codex telegram bridge with uv entrypoints
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
[project]
|
||||||
|
name = "codex-telegram-bridge"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Telegram bridge tools for Codex."
|
||||||
|
readme = "readme.md"
|
||||||
|
requires-python = ">=3.10"
|
||||||
|
dependencies = [
|
||||||
|
"markdown-it-py",
|
||||||
|
"sulguk",
|
||||||
|
"tomli; python_version < '3.11'",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
codex-telegram-exec-bridge = "codex_telegram_bridge.exec_bridge:main"
|
||||||
|
codex-telegram-mcp-bridge = "codex_telegram_bridge.mcp_bridge:main"
|
||||||
|
codex-telegram-tmux-notify = "codex_telegram_bridge.tmux_notify:main"
|
||||||
|
codex-telegram-tmux-reply = "codex_telegram_bridge.tmux_reply_bot:main"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src/codex_telegram_bridge"]
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.sdist]
|
||||||
|
include = ["src/codex_telegram_bridge", "readme.md"]
|
||||||
@@ -11,7 +11,7 @@ All options store a mapping from `(chat_id, bot_message_id)` to a route so repli
|
|||||||
## Install
|
## Install
|
||||||
|
|
||||||
1. Ensure `uv` is installed.
|
1. Ensure `uv` is installed.
|
||||||
2. Use the scripts in this folder as-is; `uv run` will install the inline dependencies.
|
2. From this folder, run the entrypoints with `uv run` (uses `pyproject.toml` deps).
|
||||||
3. Put your Telegram credentials in `~/.codex/telegram.toml`.
|
3. Put your Telegram credentials in `~/.codex/telegram.toml`.
|
||||||
|
|
||||||
Example `~/.codex/telegram.toml`:
|
Example `~/.codex/telegram.toml`:
|
||||||
@@ -35,7 +35,7 @@ Optional keys (by mode):
|
|||||||
Run:
|
Run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run exec_bridge.py
|
uv run codex-telegram-exec-bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
## Option 2: MCP server
|
## Option 2: MCP server
|
||||||
@@ -43,7 +43,7 @@ uv run exec_bridge.py
|
|||||||
Run:
|
Run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run mcp_bridge.py
|
uv run codex-telegram-mcp-bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
## Option 3: tmux
|
## Option 3: tmux
|
||||||
@@ -51,21 +51,21 @@ uv run mcp_bridge.py
|
|||||||
Reply injector:
|
Reply injector:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run tmux_reply_bot.py
|
uv run codex-telegram-tmux-reply
|
||||||
```
|
```
|
||||||
|
|
||||||
Notifier (call from your existing hook):
|
Notifier (call from your existing hook):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv run tmux_notify.py --tmux-target "codex1:0.0" --text "$TURN_TEXT"
|
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`.
|
Add `--chat-id` if `chat_id` is not set in `~/.codex/telegram.toml`.
|
||||||
|
|
||||||
## Files
|
## Files
|
||||||
|
|
||||||
- `bridge_common.py`: shared Telegram client, chunking, and routing store
|
- `src/codex_telegram_bridge/bridge_common.py`: shared Telegram client, chunking, and routing store
|
||||||
- `exec_bridge.py`: codex exec + resume bridge
|
- `src/codex_telegram_bridge/exec_bridge.py`: codex exec + resume bridge
|
||||||
- `mcp_bridge.py`: MCP stdio JSON-RPC bridge
|
- `src/codex_telegram_bridge/mcp_bridge.py`: MCP stdio JSON-RPC bridge
|
||||||
- `tmux_notify.py`: tmux notifier helper
|
- `src/codex_telegram_bridge/tmux_notify.py`: tmux notifier helper
|
||||||
- `tmux_reply_bot.py`: tmux reply injector
|
- `src/codex_telegram_bridge/tmux_reply_bot.py`: tmux reply injector
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
"""Telegram Codex bridge package."""
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@ import time
|
|||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from typing import Any, Callable, Dict, Optional, Tuple
|
from typing import Any, Callable, Dict, Optional, Tuple
|
||||||
|
|
||||||
from bridge_common import (
|
from .bridge_common import (
|
||||||
TelegramClient,
|
TelegramClient,
|
||||||
RouteStore,
|
RouteStore,
|
||||||
TELEGRAM_HARD_LIMIT,
|
TELEGRAM_HARD_LIMIT,
|
||||||
+1
-1
@@ -13,7 +13,7 @@ import time
|
|||||||
from queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from bridge_common import (
|
from .bridge_common import (
|
||||||
TelegramClient,
|
TelegramClient,
|
||||||
RouteStore,
|
RouteStore,
|
||||||
config_get,
|
config_get,
|
||||||
+1
-1
@@ -9,7 +9,7 @@ import argparse
|
|||||||
import sys
|
import sys
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from bridge_common import TelegramClient, RouteStore, config_get, load_telegram_config
|
from .bridge_common import TelegramClient, RouteStore, config_get, load_telegram_config
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
+1
-1
@@ -9,7 +9,7 @@ import subprocess
|
|||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from bridge_common import (
|
from .bridge_common import (
|
||||||
TelegramClient,
|
TelegramClient,
|
||||||
RouteStore,
|
RouteStore,
|
||||||
config_get,
|
config_get,
|
||||||
Reference in New Issue
Block a user