Skip to content

Repository files navigation

DeepSeekBridge / DeepSeek 桥接器

A local file-based bridge for real-time collaboration between Codex and DeepSeek Harness.

一个让 Codex 与 DeepSeek Harness 通过本地文件进行多轮实时协作的桥接工具。

Features / 特性

  • File-based message exchange without exposing network ports / 基于文件的消息交换,不暴露网络端口
  • Multi-turn conversation protocol with conversation_id, seq, message_id, reply_to / 支持 conversation_id、seq、message_id、reply_to 的多轮对话协议
  • Automatic DeepSeek API replies / 自动调用 DeepSeek API 回复
  • Resident-session mode (A mode) for DeepSeek Harness / 支持 DeepSeek Harness 常驻会话 A 模式
  • Deduplication, crash recovery and single-instance lock / 去重、断线恢复和单实例锁
  • Progress sync every second / 每秒进度同步
  • Windows EXE packaging support / 支持 Windows EXE 封装

Quick Start / 快速开始

1. Install dependencies / 安装依赖

Python 3.10+ is recommended. No third-party packages are required.

建议使用 Python 3.10+,本项目不需要第三方依赖。

All scripts resolve their data files from the project directory by default. Set BRIDGE_DIR to keep runtime files elsewhere / 默认从项目目录读取和写入数据;可设置 BRIDGE_DIR 将运行数据放到其他目录。

2. Configure API Key / 配置 API Key

Copy .env.example to .env and fill in your DeepSeek API Key:

cp .env.example .env
DEEPSEEK_API_KEY=your_key_here
DEEPSEEK_MODEL=deepseek-chat

3. Run / 运行

Start automatic API bridge / 启动自动 API 桥接:

python auto_bridge.py

Start resident A-mode bridge / 启动 A 模式常驻桥接:

python deepseek_bridge.py

Use the CLI / 使用命令行:

python bridge_cli.py auto
python bridge_cli.py resident
python bridge_cli.py status
python bridge_cli.py test

Build a Windows executable / 构建 Windows 可执行文件:

python -m PyInstaller --onefile --console --name DeepSeekBridge `
  --hidden-import deepseek_bridge --hidden-import auto_bridge --hidden-import bridge_client `
  bridge_cli.py

The generated executable keeps data beside the EXE unless --data-dir is provided / EXE 默认将数据保存在 EXE 同目录,也可用 --data-dir 指定目录。

File Layout / 文件结构

bridge/
├── auto_bridge.py          # Automatic DeepSeek API bridge / 自动 API 桥接
├── deepseek_bridge.py      # A-mode resident bridge / A 模式常驻桥接
├── bridge_cli.py           # Unified CLI / 统一命令行入口
├── bridge_client.py        # Codex-side client / Codex 端客户端
├── progress_notifier.py    # Progress sync every second / 每秒进度同步
├── PROTOCOL.md             # Communication protocol / 通信协议
├── DeepSeekBridge.spec     # PyInstaller spec / PyInstaller 打包配置
└── README.md

Protocol / 协议

See PROTOCOL.md for the full protocol specification.

完整协议说明请查看 PROTOCOL.md。

Security / 安全说明

  • Never commit .env or API keys / 不要提交 .env 或 API Key
  • The bridge only listens to local files, not network ports / 桥接只监听本地文件,不监听网络端口
  • Use single-instance lock to prevent duplicate writers / 使用单实例锁防止重复写入

License / 许可证

MIT License

About

Local file-based bridge for real-time collaboration between Codex and DeepSeek Harness

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages