CrossRelay stage 0+1: Go gateway with Anthropic<->Chat Completions relay, Tauri shell, bilingual management UI
- Go gateway (stdlib only): /v1/messages non-stream + SSE, /v1/messages/count_tokens, management API /api/* (providers CRUD, apply/restore, settings, backups, logs) - Protocol conversion: Anthropic Messages <-> Chat Completions with a streaming state machine keyed by content block index (text, tool_use, parallel calls) - ~/.claude/settings.json guarded read/write: timestamped backups, managed env keys only, one-click restore - Tauri 2 shell: spawns the gateway sidecar, parses the random port from stdout, stdin pipe watchdog prevents orphans, kills the child on exit - React frontend: Dashboard/Providers/Settings, zh-CN + en-US, TanStack Query - Tests: Go table-driven + httptest integration (all green), vitest + RTL
This commit is contained in:
1 parent
8ee5e98ea3
commit
f8acf31ebc
71 files changed
+15727
-1
No files matched your search
@@ -1,3 +1,34 @@
|
||||
# CrossRelay
|
||||
|
||||
跨工具管理AI中继代理
|
||||
跨工具管理 AI 中继代理:面向 Claude Code 与 ChatGPT Codex 的跨协议配置管理与本地网关,不改官方文件,不依赖 CDP 注入。
|
||||
|
||||
## 架构
|
||||
|
||||
- `src-tauri/`:Tauri 2 桌面壳(React 前端 + Rust 壳),负责拉起网关子进程、解析端口、退出时清理。
|
||||
- `cmd/gateway` + `internal/`:Go 网关,同时提供 `/v1/messages`(Anthropic Messages 协议)与管理 API `/api/*`,统一转换为上游 Chat Completions。
|
||||
- 用户数据位于 `~/.crossrelay/`:`config.json`(供应商与设置)、`state.json`(运行期端口)、`backups/`(配置备份)。
|
||||
|
||||
## 开发
|
||||
|
||||
```powershell
|
||||
# 1. 构建网关二进制到 bin/
|
||||
make build
|
||||
|
||||
# 2. 安装前端依赖
|
||||
npm install
|
||||
|
||||
# 3. 启动桌面端(自动构建网关并启动 Tauri dev)
|
||||
make dev
|
||||
```
|
||||
|
||||
## 测试
|
||||
|
||||
```powershell
|
||||
make test # Go 单元测试与集成测试
|
||||
npm test # 前端 vitest
|
||||
npm run typecheck
|
||||
```
|
||||
|
||||
## 当前范围
|
||||
|
||||
阶段一已完成:Claude Code 通路(`/v1/messages` 非流式 + SSE 流式、`~/.claude/settings.json` 注入与还原、供应商管理与中英双语界面)。Codex `/v1/responses`、MCP 双端同步、单二进制打包为后续阶段。
|
||||
Reference in new issue
Block a user