开发指南
ACE = AI Computing Explorer
本指南涵盖如何搭建开发环境以及如何为 Open ACE 贡献代码。
开发环境搭建
前提条件
- Python 3.10+
- Git
- 代码编辑器(VS Code、PyCharm 等)
搭建步骤
# 克隆仓库
git clone https://github.com/open-ace/open-ace.git
cd open-ace
# 创建虚拟环境
python3 -m venv venv
source venv/bin/activate # Windows 上使用: venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 安装开发依赖
pip install pytest pytest-cov playwright
# 初始化配置
python3 cli.py config init
项目结构
open-ace/
├── server.py # Web 服务器入口
├── requirements.txt # Python 依赖
│
├── app/ # Flask 应用
│ ├── __init__.py # create_app() 工厂函数
│ ├── routes/ # 24 个 Blueprint 路由模块
│ ├── services/ # 13 个业务逻辑服务
│ ├── repositories/ # 11 个数据访问仓储
│ ├── modules/ # 领域逻辑包
│ │ ├── analytics/ # 使用分析、ROI、成本优化
│ │ ├── compliance/ # 审计分析、报告、数据保留
│ │ ├── governance/ # 审计日志、告警、配额、内容过滤
│ │ ├── sso/ # OAuth2/OIDC/SAML SSO
│ │ └── workspace/ # 远程代理、会话、协作
│ ├── models/ # 数据模型(User、Message、Session、Tenant 等)
│ ├── auth/ # 认证装饰器
│ └── utils/ # 辅助工具、验证器、格式化器
│
├── frontend/ # React + TypeScript SPA
│ └── src/
│ ├── api/ # API 客户端模块
│ ├── hooks/ # React Query hooks
│ ├── components/ # UI 组件(common、features、work、layout)
│ ├── store/ # Zustand 状态管理
│ ├── i18n/ # 国际化(en/zh/ja/ko)
│ ├── types/ # TypeScript 接口
│ └── utils/ # 格式化器、辅助工具
│
├── remote-agent/ # 远程代理守护进程
│ ├── agent.py # 主守护进程循环
│ ├── executor.py # CLI 子进程管理
│ ├── cli_adapters/ # 工具适配器(Claude、Qwen、Codex、OpenClaw)
│ ├── terminal_server.py # WebSocket 终端服务器(Linux/macOS 使用 PTY,Windows 使用管道子进程)
│ └── session_sync.py # 会话历史同步
│
├── scripts/ # 数据采集脚本
│ ├── fetch_*.py # 各工具数据采集器
│ ├── shared/ # 共享模块(config、db、utils)
│ └── migrations/ # Alembic 数据库迁移
│
├── k8s/ # Kubernetes 清单
├── schema/ # 数据库模式文件
├── static/ # 构建后的前端资源
├── templates/ # HTML 模板
├── tests/ # 测试文件
│ ├── unit/ # 单元测试
│ ├── e2e/ # 端到端测试
│ └── issues/ # Issue 相关测试
└── docs/ # 文档(en/ + cn/)
前端开发
搭建
cd frontend
npm install