diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..6827eb7 --- /dev/null +++ b/README.en.md @@ -0,0 +1,151 @@ +
+ +# CODING + +### A repository-aware coding agent with a reviewable engineering loop. + +Plan, search, implement, test, review, and deliver changes through a streaming workspace—with persistent sessions and reproducible agent evaluations. + +[简体中文](README.md) · [English](README.en.md) · [Quick start](#quick-start) · [Architecture](#architecture) · [Agent Eval](#agent-eval) + +[![Python](https://img.shields.io/badge/Python-3.14%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) +[![Vue](https://img.shields.io/badge/Vue-3-42B883?logo=vuedotjs&logoColor=white)](https://vuejs.org/) +[![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) +[![License: MIT](https://img.shields.io/badge/License-MIT-5b7fff.svg)](LICENSE) + +
+ +

+ + Autoplaying full HD CODING demo: repository search, code edits, checks, and pull request delivery + +

+

▶ Full 89-second 1080p preview · Open the HD video with playback controls

+ +## What is CODING? + +CODING is a web-based AI coding agent for real Git repositories. It turns a request into a traceable workflow: understand the task, inspect the code, propose a plan, wait for approval when needed, edit and test in a repository workspace, then present the diff and delivery status. + +## Highlights + +| Capability | What it does | +| --- | --- | +| **Multi-agent workflow** | A primary agent coordinates work and can delegate analysis or read-only code review to specialist subagents. The review-to-fix loop keeps implementation and review responsibilities distinct. | +| **Multi-layer intent routing** | Structured LLM classification with a keyword-rule fallback routes planning, coding, review, QA, and related tasks; execution can then delegate subagents and choose tools for the next action. | +| **Repository intelligence** | Hybrid CodeGraph and text search, GitHub/Gitee context tools, and repository-scoped memory help the agent reuse project structure and decisions across sessions. | +| **Guarded execution** | A controlled file backend, path validation, tool-input checks, normalized tool errors, and run limits constrain agent actions. OpenSandbox is available for isolated Eval execution. | +| **Streaming and recovery** | FastAPI streams a stable event protocol to the Vue workspace; LangGraph checkpoints and persistent task state support session recovery. | +| **SQLite and PostgreSQL** | SQLite is the local default. PostgreSQL can persist application state and checkpoints for shared deployments. | +| **Agent Eval** | Fixed agent and target revisions, isolated candidate workspaces, target/regression/oracle checks, retrieval and tool traces, token/latency metrics, patches, and HTML reports. | + +## Workspace Preview + +

CODING workspace home with recent chats, repository projects, and model selection

+

Workspace home with recent chats, project groups, and the active conversation.

+ +

CODING create-project dialog with project name, Git provider, and repository URL

+

Create a project by setting its name, GitHub or Gitee provider, and repository URL.

+ +## Architecture + +The vector SVG stays sharp when zoomed. Solid arrows show the current application and Eval paths. + +

High-resolution CODING vector architecture: asynchronous task scheduling, agent execution, persistence, and isolated evaluation

+

High-resolution vector diagram · Open the full-size SVG

+ +The deployment design describes **3 Agent Workers and 2 ASGI nodes**, with estimates of about **170 peak concurrent requests** and **20–30 concurrent coding/review tasks**. Treat these as design capacity estimates: this repository does not include a load-test report validating those figures. The Redis queue, repository lock, and event stream are shown as target components, not current application services. + +## Agent Eval + +The latest fixed suite evaluated CODING against the independent [`test-coding-eval`](https://github.com/Guo-Yixin/test-coding-eval) task repository. Agent revisions are recorded per case; the report uses DeepSeek `deepseek-flash` and runner v4. + +

+ + Agent Eval report: 10 of 10 cases passed and both end-to-end gates passed + +

+ +| Fixed-suite measure | Result | +| --- | ---: | +| Coding cases | **10 / 10 passed** | +| Target, regression, and oracle tests | **10 / 10 passed each** | +| Patch application / retrieval hit@k / tool recovery | **100% / 1.0 / 100%** | +| Provider tokens / summed agent latency | **6,963,895 / 10.2 min** | +| Application and sandbox end-to-end gates | **2 / 2 passed** | + +Open the [full coding-suite report](docs/agent-eval/evidence/2026-09-27-final-suite/report.html), [per-case Agent and target SHAs](docs/agent-eval/evidence/2026-09-27-final-suite/provenance.md), [OpenSandbox real-agent report](docs/agent-eval/evidence/2026-09-27-final-suite/opensandbox-agent/report.html), or [PostgreSQL application E2E report](docs/agent-eval/evidence/2026-09-27-final-suite/application-postgres-e2e/report.html). The score describes this fixed benchmark, agent revisions, model, and run configuration; it is not a universal coding-success guarantee. + +## Quick start + +### Requirements + +- Python **3.14+** +- Node.js and Corepack (Yarn Classic 1.22) +- A DeepSeek API key + +### Install and configure + +```powershell +git clone https://github.com/Guo-Yixin/coding-agent.git +cd coding-agent +py -3.14 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install -e . "deepagents==0.6.11" +corepack prepare yarn@1.22.22 --activate +Set-Location ui +yarn install --frozen-lockfile +Set-Location .. +Copy-Item .env.example .env +``` + +Edit `.env` and set at least: + +```dotenv +DEEPSEEK_API_KEY=your-deepseek-api-key +MAIN_MODEL=deepseek-flash +AI_WORKSPACE_ROOT=C:\coding-agent-workspace +DASHBOARD_JWT_SECRET=replace-with-a-long-random-secret +``` + +Keep `.env` local. Add `GITHUB_TOKEN` or `GITEE_TOKEN` only if you need authenticated access or write operations on those providers. Never commit real keys. + +### Start the app + +From the repository root, run: + +```powershell +python scripts/start_all.py +``` + +Open . The API is at . Press `Ctrl+C` to stop both services. + +## Database and sandbox + +- **SQLite (default):** no extra service is needed for local development; project data is stored under `data/`. +- **PostgreSQL (optional):** provision a dedicated database and add this to `.env`: + + ```dotenv + PERSISTENCE_BACKEND=postgres + POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/coding_agent_db + ``` + + Follow the [deployment guide](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md) for shared deployments. +- **OpenSandbox (optional):** install `python -m pip install -e ".[sandbox]"`, start an OpenSandbox service, then configure: + + ```dotenv + OPEN_SANDBOX_DOMAIN=https://your-opensandbox-service + OPEN_SANDBOX_API_KEY=your-opensandbox-key + ``` + + The current OpenSandbox adapter is used by isolated Eval paths; the regular local app uses its controlled local workspace backend. + +See [`.env.example`](.env.example), [Linux deployment](docs/CODING_LINUX_DEPLOYMENT_RUNBOOK.md), [cloud deployment design](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md), and [Agent Eval guide](docs/AGENT_EVAL.md) for the complete configuration and operating boundaries. + +## Contributing + +Issues and pull requests are welcome. Describe the problem, the proposed change, and how you verified it. Changes to agent behavior, tools, permissions, persistence, or evaluation should include focused tests or an Eval case. Start with the [project docs](docs/) and open an Issue when the intended behavior needs discussion. + +## License + +CODING is released under the [MIT License](LICENSE). diff --git a/README.md b/README.md index 2796457..fb54284 100644 --- a/README.md +++ b/README.md @@ -1,143 +1,151 @@ -
- -# CODING - -### A repository-aware coding agent with a reviewable engineering loop. - -Plan, search, implement, test, review, and deliver changes through a streaming workspace—with persistent sessions and reproducible agent evaluations. - -[English](README.md) · [简体中文](README.zh-CN.md) · [Quick start](#quick-start) · [Architecture](#architecture) · [Agent Eval](#agent-eval) - -[![Python](https://img.shields.io/badge/Python-3.14%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) -[![Vue](https://img.shields.io/badge/Vue-3-42B883?logo=vuedotjs&logoColor=white)](https://vuejs.org/) -[![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) -[![License: MIT](https://img.shields.io/badge/License-MIT-5b7fff.svg)](LICENSE) - -
- -

- - Autoplaying full HD CODING demo: repository search, code edits, checks, and pull request delivery - -

-

▶ Full 89-second 1080p preview · Open the HD video with playback controls

- -## What is CODING? - -CODING is a web-based AI coding agent for real Git repositories. It turns a request into a traceable workflow: understand the task, inspect the code, propose a plan, wait for approval when needed, edit and test in a repository workspace, then present the diff and delivery status. - -## Highlights - -| Capability | What it does | -| --- | --- | -| **Multi-agent workflow** | A primary agent coordinates work and can delegate analysis or read-only code review to specialist subagents. The review-to-fix loop keeps implementation and review responsibilities distinct. | -| **Multi-layer intent routing** | Structured LLM classification with a keyword-rule fallback routes planning, coding, review, QA, and related tasks; execution can then delegate subagents and choose tools for the next action. | -| **Repository intelligence** | Hybrid CodeGraph and text search, GitHub/Gitee context tools, and repository-scoped memory help the agent reuse project structure and decisions across sessions. | -| **Guarded execution** | A controlled file backend, path validation, tool-input checks, normalized tool errors, and run limits constrain agent actions. OpenSandbox is available for isolated Eval execution. | -| **Streaming and recovery** | FastAPI streams a stable event protocol to the Vue workspace; LangGraph checkpoints and persistent task state support session recovery. | -| **SQLite and PostgreSQL** | SQLite is the local default. PostgreSQL can persist application state and checkpoints for shared deployments. | -| **Agent Eval** | Fixed agent and target revisions, isolated candidate workspaces, target/regression/oracle checks, retrieval and tool traces, token/latency metrics, patches, and HTML reports. | - -## Architecture - -Solid borders show the current application and Eval paths. The dashed area is the documented scale-out target; it is not the default runtime topology. - -

Animated CODING architecture: request routing, agent execution, isolated evaluation, and evidence flow

-

Animated flow · Open the scalable SVG diagram

- -The deployment design describes **3 Agent Workers and 2 ASGI nodes**, with estimates of about **170 peak concurrent requests** and **20–30 concurrent coding/review tasks**. Treat these as design capacity estimates: this repository does not include a load-test report validating those figures. The Redis queue, repository lock, and event stream are shown as target components, not current application services. - -## Agent Eval - -The latest fixed suite evaluated CODING against the independent [`test-coding-eval`](https://github.com/Guo-Yixin/test-coding-eval) task repository. Agent revisions are recorded per case; the report uses DeepSeek `deepseek-flash` and runner v4. - -

- - Agent Eval report: 10 of 10 cases passed and both end-to-end gates passed - -

- -| Fixed-suite measure | Result | -| --- | ---: | -| Coding cases | **10 / 10 passed** | -| Target, regression, and oracle tests | **10 / 10 passed each** | -| Patch application / retrieval hit@k / tool recovery | **100% / 1.0 / 100%** | -| Provider tokens / summed agent latency | **6,963,895 / 10.2 min** | -| Application and sandbox end-to-end gates | **2 / 2 passed** | - -Open the [full coding-suite report](docs/agent-eval/evidence/2026-09-27-final-suite/report.html), [per-case Agent and target SHAs](docs/agent-eval/evidence/2026-09-27-final-suite/provenance.md), [OpenSandbox real-agent report](docs/agent-eval/evidence/2026-09-27-final-suite/opensandbox-agent/report.html), or [PostgreSQL application E2E report](docs/agent-eval/evidence/2026-09-27-final-suite/application-postgres-e2e/report.html). The score describes this fixed benchmark, agent revisions, model, and run configuration; it is not a universal coding-success guarantee. - -## Quick start - -### Requirements - -- Python **3.14+** -- Node.js and Corepack (Yarn Classic 1.22) -- A DeepSeek API key - -### Install and configure - -```powershell -git clone https://github.com/Guo-Yixin/coding-agent.git -cd coding-agent -py -3.14 -m venv .venv -.\.venv\Scripts\Activate.ps1 -python -m pip install --upgrade pip -python -m pip install -e . "deepagents==0.6.11" -corepack prepare yarn@1.22.22 --activate -Set-Location ui -yarn install --frozen-lockfile -Set-Location .. -Copy-Item .env.example .env -``` - -Edit `.env` and set at least: - -```dotenv -DEEPSEEK_API_KEY=your-deepseek-api-key -MAIN_MODEL=deepseek-flash -AI_WORKSPACE_ROOT=C:\coding-agent-workspace -DASHBOARD_JWT_SECRET=replace-with-a-long-random-secret -``` - -Keep `.env` local. Add `GITHUB_TOKEN` or `GITEE_TOKEN` only if you need authenticated access or write operations on those providers. Never commit real keys. - -### Start the app - -From the repository root, run: - -```powershell -python scripts/start_all.py -``` - -Open . The API is at . Press `Ctrl+C` to stop both services. - -## Database and sandbox - -- **SQLite (default):** no extra service is needed for local development; project data is stored under `data/`. -- **PostgreSQL (optional):** provision a dedicated database and add this to `.env`: - - ```dotenv - PERSISTENCE_BACKEND=postgres - POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/coding_agent_db - ``` - - Follow the [deployment guide](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md) for shared deployments. -- **OpenSandbox (optional):** install `python -m pip install -e ".[sandbox]"`, start an OpenSandbox service, then configure: - - ```dotenv - OPEN_SANDBOX_DOMAIN=https://your-opensandbox-service - OPEN_SANDBOX_API_KEY=your-opensandbox-key - ``` - - The current OpenSandbox adapter is used by isolated Eval paths; the regular local app uses its controlled local workspace backend. - -See [`.env.example`](.env.example), [Linux deployment](docs/CODING_LINUX_DEPLOYMENT_RUNBOOK.md), [cloud deployment design](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md), and [Agent Eval guide](docs/AGENT_EVAL.md) for the complete configuration and operating boundaries. - -## Contributing - -Issues and pull requests are welcome. Describe the problem, the proposed change, and how you verified it. Changes to agent behavior, tools, permissions, persistence, or evaluation should include focused tests or an Eval case. Start with the [project docs](docs/) and open an Issue when the intended behavior needs discussion. - -## License - -CODING is released under the [MIT License](LICENSE). +
+ +# CODING + +### 面向真实 Git 仓库、可追踪且可复跑的 AI 编码 Agent + +从需求理解、代码检索、计划审批,到修改、测试、审查与交付;支持持久化会话和可复现的 Agent Eval。 + +[简体中文](README.md) · [English](README.en.md) · [快速开始](#快速开始) · [系统架构](#系统架构) · [Agent Eval](#agent-eval) + +[![Python](https://img.shields.io/badge/Python-3.14%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) +[![Vue](https://img.shields.io/badge/Vue-3-42B883?logo=vuedotjs&logoColor=white)](https://vuejs.org/) +[![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) +[![License: MIT](https://img.shields.io/badge/License-MIT-5b7fff.svg)](LICENSE) + +
+ +

+ + 自动播放的 CODING 1080p 演示:检索仓库、修改代码、运行检查并交付 Pull Request + +

+

▶ 89 秒 1080p 自动播放预览 · 打开带播放控件的高清完整视频

+ +## CODING 是什么 + +CODING 是一个面向真实 Git 仓库的 AI 编码工作台。它把用户需求变成一条可追踪的研发流程:理解任务、检索代码、提出计划、按需等待审批、在仓库工作区修改和测试,最后展示补丁与交付状态。 + +## 项目亮点 + +| 能力 | 说明 | +| --- | --- | +| **多 Agent 协作** | 主 Agent 负责任务编排和结果汇总,可按需委派分析或只读代码审查 SubAgent。编码、审查和修复职责分开,支持形成可检查的研发闭环。 | +| **多层意图路由** | 使用结构化 LLM 分类并以关键词规则兜底,识别 planning、coding、review、QA 等入口任务;执行中再委派 SubAgent、拆分任务并决定下一步工具动作。 | +| **仓库级理解** | CodeGraph 与文本混合检索、GitHub/Gitee 上下文工具及仓库长期记忆,帮助 Agent 复用项目结构和历史决策。 | +| **受控执行** | 受控文件后端、路径校验、工具参数检查、可理解的工具错误和运行上限约束 Agent 操作。OpenSandbox 可用于隔离的 Eval 执行。 | +| **流式与恢复** | FastAPI 通过稳定事件协议向 Vue 工作台流式推送过程;LangGraph checkpoint 与持久化任务状态支持会话恢复。 | +| **SQLite 与 PostgreSQL** | SQLite 是本地默认选项;PostgreSQL 可用于共享部署中的业务状态和 checkpoint 持久化。 | +| **Agent Eval** | 固定 Agent 和目标版本,在隔离副本中执行真实编码题、目标/回归/隐藏验收,记录检索、工具轨迹、Token、耗时、补丁并生成 HTML 报告。 | + +## 工作台预览 + +

CODING 工作台首页:最近聊天、按仓库分组的项目与会话、模型选择

+

工作台首页:最近聊天、项目分组和当前会话。

+ +

CODING 新建项目弹窗:设置项目名称、代码托管平台和仓库地址

+

新建项目:指定项目名称、GitHub/Gitee 平台和仓库地址。

+ +## 系统架构 + +实线表示当前应用和 Eval 的运行路径;架构图使用矢量 SVG 绘制,放大查看仍保持清晰。 + +

CODING 高清矢量系统架构图:异步任务调度、Agent 执行、状态持久化与隔离评测

+

高清矢量架构图 · 打开原尺寸 SVG

+ +部署设计描述了 **3 个 Agent Worker 和 2 个 ASGI 节点**,并给出约 **170 峰值并发请求、20–30 个 coding/review 并发任务**的容量估算。仓库目前没有包含验证这些数字的压测报告,因此应视为设计容量估算。图中的 Redis 队列、仓库锁和事件流是目标组件,不是当前应用服务。 + +## Agent Eval + +最近一次固定题库评测使用独立的 [`test-coding-eval`](https://github.com/Guo-Yixin/test-coding-eval) 仓库。各案例记录了对应的 Agent 版本;本次使用 DeepSeek `deepseek-flash` 和 runner v4。 + +

+ + Agent Eval 报告:10 道编码题全部通过,两个端到端门禁通过 + +

+ +| 固定题库指标 | 结果 | +| --- | ---: | +| 编码题 | **10 / 10 通过** | +| 目标、回归、隐藏验收 | **各 10 / 10 通过** | +| 补丁应用 / 检索 hit@k / 工具恢复 | **100% / 1.0 / 100%** | +| Provider Token / Agent 累计耗时 | **6,963,895 / 10.2 分钟** | +| 应用与沙箱端到端门禁 | **2 / 2 通过** | + +查看[完整编码题报告](docs/agent-eval/evidence/2026-09-27-final-suite/report.html)、[逐题 Agent/目标仓库 SHA](docs/agent-eval/evidence/2026-09-27-final-suite/provenance.md)、[真实 Agent + OpenSandbox 报告](docs/agent-eval/evidence/2026-09-27-final-suite/opensandbox-agent/report.html),或 [PostgreSQL 应用端到端报告](docs/agent-eval/evidence/2026-09-27-final-suite/application-postgres-e2e/report.html)。该成绩只代表这组固定案例、记录的 Agent 版本、模型和运行配置,不代表 Agent 在任意项目上的通用成功率。 + +## 快速开始 + +### 环境要求 + +- Python **3.14+** +- Node.js 与 Corepack(Yarn Classic 1.22) +- DeepSeek API Key + +### 安装并配置 + +```powershell +git clone https://github.com/Guo-Yixin/coding-agent.git +cd coding-agent +py -3.14 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install -e . "deepagents==0.6.11" +corepack prepare yarn@1.22.22 --activate +Set-Location ui +yarn install --frozen-lockfile +Set-Location .. +Copy-Item .env.example .env +``` + +编辑 `.env`,至少填写: + +```dotenv +DEEPSEEK_API_KEY=your-deepseek-api-key +MAIN_MODEL=deepseek-flash +AI_WORKSPACE_ROOT=C:\coding-agent-workspace +DASHBOARD_JWT_SECRET=替换为足够长的随机密钥 +``` + +`.env` 只保存在本机。只有需要访问私有仓库或执行平台写操作时,才配置 `GITHUB_TOKEN` 或 `GITEE_TOKEN`;不要把真实密钥提交到 Git。 + +### 启动前后端 + +在仓库根目录运行: + +```powershell +python scripts/start_all.py +``` + +打开 ;后端 API 文档位于 。按 `Ctrl+C` 同时停止前后端。 + +## 数据库与沙箱 + +- **SQLite(默认):** 本地开发无需单独启动数据库服务,项目数据保存在 `data/`。 +- **PostgreSQL(可选):** 准备独立数据库,并在 `.env` 中配置: + + ```dotenv + PERSISTENCE_BACKEND=postgres + POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/coding_agent_db + ``` + + 共享部署请参考[部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)。 +- **OpenSandbox(可选):** 安装 `python -m pip install -e ".[sandbox]"`,启动 OpenSandbox 服务后配置: + + ```dotenv + OPEN_SANDBOX_DOMAIN=https://your-opensandbox-service + OPEN_SANDBOX_API_KEY=your-opensandbox-key + ``` + + 当前 OpenSandbox 适配器用于隔离的 Eval 执行;常规本地应用使用受控本地工作区后端。 + +完整变量见 [`.env.example`](.env.example);更多内容见 [Linux 部署手册](docs/CODING_LINUX_DEPLOYMENT_RUNBOOK.md)、[云端部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)和 [Agent Eval 指南](docs/AGENT_EVAL.md)。 + +## 参与贡献 + +欢迎提交 Issue 和 Pull Request。请说明问题、改动目的和验证方式。涉及 Agent 行为、工具权限、持久化或评测的改动,请附上针对性测试或 Eval 案例。可先阅读[项目文档](docs/),需要讨论方案时先开 Issue。 + +## 许可证 + +CODING 使用 [MIT License](LICENSE) 发布。 diff --git a/README.zh-CN.md b/README.zh-CN.md index a90fe26..fb54284 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,143 +1,151 @@ -
- -# CODING - -### 面向真实 Git 仓库、可追踪且可复跑的 AI 编码 Agent - -从需求理解、代码检索、计划审批,到修改、测试、审查与交付;支持持久化会话和可复现的 Agent Eval。 - -[English](README.md) · [简体中文](README.zh-CN.md) · [快速开始](#快速开始) · [系统架构](#系统架构) · [Agent Eval](#agent-eval) - -[![Python](https://img.shields.io/badge/Python-3.14%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) -[![Vue](https://img.shields.io/badge/Vue-3-42B883?logo=vuedotjs&logoColor=white)](https://vuejs.org/) -[![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) -[![License: MIT](https://img.shields.io/badge/License-MIT-5b7fff.svg)](LICENSE) - -
- -

- - 自动播放的 CODING 1080p 演示:检索仓库、修改代码、运行检查并交付 Pull Request - -

-

▶ 89 秒 1080p 自动播放预览 · 打开带播放控件的高清完整视频

- -## CODING 是什么 - -CODING 是一个面向真实 Git 仓库的 AI 编码工作台。它把用户需求变成一条可追踪的研发流程:理解任务、检索代码、提出计划、按需等待审批、在仓库工作区修改和测试,最后展示补丁与交付状态。 - -## 项目亮点 - -| 能力 | 说明 | -| --- | --- | -| **多 Agent 协作** | 主 Agent 负责任务编排和结果汇总,可按需委派分析或只读代码审查 SubAgent。编码、审查和修复职责分开,支持形成可检查的研发闭环。 | -| **多层意图路由** | 使用结构化 LLM 分类并以关键词规则兜底,识别 planning、coding、review、QA 等入口任务;执行中再委派 SubAgent、拆分任务并决定下一步工具动作。 | -| **仓库级理解** | CodeGraph 与文本混合检索、GitHub/Gitee 上下文工具及仓库长期记忆,帮助 Agent 复用项目结构和历史决策。 | -| **受控执行** | 受控文件后端、路径校验、工具参数检查、可理解的工具错误和运行上限约束 Agent 操作。OpenSandbox 可用于隔离的 Eval 执行。 | -| **流式与恢复** | FastAPI 通过稳定事件协议向 Vue 工作台流式推送过程;LangGraph checkpoint 与持久化任务状态支持会话恢复。 | -| **SQLite 与 PostgreSQL** | SQLite 是本地默认选项;PostgreSQL 可用于共享部署中的业务状态和 checkpoint 持久化。 | -| **Agent Eval** | 固定 Agent 和目标版本,在隔离副本中执行真实编码题、目标/回归/隐藏验收,记录检索、工具轨迹、Token、耗时、补丁并生成 HTML 报告。 | - -## 系统架构 - -实线表示当前应用和 Eval 的运行路径;虚线区域表示文档中的横向扩容目标,并非默认运行拓扑。 - -

CODING 动态架构图:需求路由、Agent 执行、隔离评测与报告反馈

-

动态流程图 · 打开可缩放 SVG 源图

- -部署设计描述了 **3 个 Agent Worker 和 2 个 ASGI 节点**,并给出约 **170 峰值并发请求、20–30 个 coding/review 并发任务**的容量估算。仓库目前没有包含验证这些数字的压测报告,因此应视为设计容量估算。图中的 Redis 队列、仓库锁和事件流是目标组件,不是当前应用服务。 - -## Agent Eval - -最近一次固定题库评测使用独立的 [`test-coding-eval`](https://github.com/Guo-Yixin/test-coding-eval) 仓库。各案例记录了对应的 Agent 版本;本次使用 DeepSeek `deepseek-flash` 和 runner v4。 - -

- - Agent Eval 报告:10 道编码题全部通过,两个端到端门禁通过 - -

- -| 固定题库指标 | 结果 | -| --- | ---: | -| 编码题 | **10 / 10 通过** | -| 目标、回归、隐藏验收 | **各 10 / 10 通过** | -| 补丁应用 / 检索 hit@k / 工具恢复 | **100% / 1.0 / 100%** | -| Provider Token / Agent 累计耗时 | **6,963,895 / 10.2 分钟** | -| 应用与沙箱端到端门禁 | **2 / 2 通过** | - -查看[完整编码题报告](docs/agent-eval/evidence/2026-09-27-final-suite/report.html)、[逐题 Agent/目标仓库 SHA](docs/agent-eval/evidence/2026-09-27-final-suite/provenance.md)、[真实 Agent + OpenSandbox 报告](docs/agent-eval/evidence/2026-09-27-final-suite/opensandbox-agent/report.html),或 [PostgreSQL 应用端到端报告](docs/agent-eval/evidence/2026-09-27-final-suite/application-postgres-e2e/report.html)。该成绩只代表这组固定案例、记录的 Agent 版本、模型和运行配置,不代表 Agent 在任意项目上的通用成功率。 - -## 快速开始 - -### 环境要求 - -- Python **3.14+** -- Node.js 与 Corepack(Yarn Classic 1.22) -- DeepSeek API Key - -### 安装并配置 - -```powershell -git clone https://github.com/Guo-Yixin/coding-agent.git -cd coding-agent -py -3.14 -m venv .venv -.\.venv\Scripts\Activate.ps1 -python -m pip install --upgrade pip -python -m pip install -e . "deepagents==0.6.11" -corepack prepare yarn@1.22.22 --activate -Set-Location ui -yarn install --frozen-lockfile -Set-Location .. -Copy-Item .env.example .env -``` - -编辑 `.env`,至少填写: - -```dotenv -DEEPSEEK_API_KEY=your-deepseek-api-key -MAIN_MODEL=deepseek-flash -AI_WORKSPACE_ROOT=C:\coding-agent-workspace -DASHBOARD_JWT_SECRET=替换为足够长的随机密钥 -``` - -`.env` 只保存在本机。只有需要访问私有仓库或执行平台写操作时,才配置 `GITHUB_TOKEN` 或 `GITEE_TOKEN`;不要把真实密钥提交到 Git。 - -### 启动前后端 - -在仓库根目录运行: - -```powershell -python scripts/start_all.py -``` - -打开 ;后端 API 文档位于 。按 `Ctrl+C` 同时停止前后端。 - -## 数据库与沙箱 - -- **SQLite(默认):** 本地开发无需单独启动数据库服务,项目数据保存在 `data/`。 -- **PostgreSQL(可选):** 准备独立数据库,并在 `.env` 中配置: - - ```dotenv - PERSISTENCE_BACKEND=postgres - POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/coding_agent_db - ``` - - 共享部署请参考[部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)。 -- **OpenSandbox(可选):** 安装 `python -m pip install -e ".[sandbox]"`,启动 OpenSandbox 服务后配置: - - ```dotenv - OPEN_SANDBOX_DOMAIN=https://your-opensandbox-service - OPEN_SANDBOX_API_KEY=your-opensandbox-key - ``` - - 当前 OpenSandbox 适配器用于隔离的 Eval 执行;常规本地应用使用受控本地工作区后端。 - -完整变量见 [`.env.example`](.env.example);更多内容见 [Linux 部署手册](docs/CODING_LINUX_DEPLOYMENT_RUNBOOK.md)、[云端部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)和 [Agent Eval 指南](docs/AGENT_EVAL.md)。 - -## 参与贡献 - -欢迎提交 Issue 和 Pull Request。请说明问题、改动目的和验证方式。涉及 Agent 行为、工具权限、持久化或评测的改动,请附上针对性测试或 Eval 案例。可先阅读[项目文档](docs/),需要讨论方案时先开 Issue。 - -## 许可证 - -CODING 使用 [MIT License](LICENSE) 发布。 +
+ +# CODING + +### 面向真实 Git 仓库、可追踪且可复跑的 AI 编码 Agent + +从需求理解、代码检索、计划审批,到修改、测试、审查与交付;支持持久化会话和可复现的 Agent Eval。 + +[简体中文](README.md) · [English](README.en.md) · [快速开始](#快速开始) · [系统架构](#系统架构) · [Agent Eval](#agent-eval) + +[![Python](https://img.shields.io/badge/Python-3.14%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) +[![Vue](https://img.shields.io/badge/Vue-3-42B883?logo=vuedotjs&logoColor=white)](https://vuejs.org/) +[![FastAPI](https://img.shields.io/badge/FastAPI-API-009688?logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) +[![License: MIT](https://img.shields.io/badge/License-MIT-5b7fff.svg)](LICENSE) + +
+ +

+ + 自动播放的 CODING 1080p 演示:检索仓库、修改代码、运行检查并交付 Pull Request + +

+

▶ 89 秒 1080p 自动播放预览 · 打开带播放控件的高清完整视频

+ +## CODING 是什么 + +CODING 是一个面向真实 Git 仓库的 AI 编码工作台。它把用户需求变成一条可追踪的研发流程:理解任务、检索代码、提出计划、按需等待审批、在仓库工作区修改和测试,最后展示补丁与交付状态。 + +## 项目亮点 + +| 能力 | 说明 | +| --- | --- | +| **多 Agent 协作** | 主 Agent 负责任务编排和结果汇总,可按需委派分析或只读代码审查 SubAgent。编码、审查和修复职责分开,支持形成可检查的研发闭环。 | +| **多层意图路由** | 使用结构化 LLM 分类并以关键词规则兜底,识别 planning、coding、review、QA 等入口任务;执行中再委派 SubAgent、拆分任务并决定下一步工具动作。 | +| **仓库级理解** | CodeGraph 与文本混合检索、GitHub/Gitee 上下文工具及仓库长期记忆,帮助 Agent 复用项目结构和历史决策。 | +| **受控执行** | 受控文件后端、路径校验、工具参数检查、可理解的工具错误和运行上限约束 Agent 操作。OpenSandbox 可用于隔离的 Eval 执行。 | +| **流式与恢复** | FastAPI 通过稳定事件协议向 Vue 工作台流式推送过程;LangGraph checkpoint 与持久化任务状态支持会话恢复。 | +| **SQLite 与 PostgreSQL** | SQLite 是本地默认选项;PostgreSQL 可用于共享部署中的业务状态和 checkpoint 持久化。 | +| **Agent Eval** | 固定 Agent 和目标版本,在隔离副本中执行真实编码题、目标/回归/隐藏验收,记录检索、工具轨迹、Token、耗时、补丁并生成 HTML 报告。 | + +## 工作台预览 + +

CODING 工作台首页:最近聊天、按仓库分组的项目与会话、模型选择

+

工作台首页:最近聊天、项目分组和当前会话。

+ +

CODING 新建项目弹窗:设置项目名称、代码托管平台和仓库地址

+

新建项目:指定项目名称、GitHub/Gitee 平台和仓库地址。

+ +## 系统架构 + +实线表示当前应用和 Eval 的运行路径;架构图使用矢量 SVG 绘制,放大查看仍保持清晰。 + +

CODING 高清矢量系统架构图:异步任务调度、Agent 执行、状态持久化与隔离评测

+

高清矢量架构图 · 打开原尺寸 SVG

+ +部署设计描述了 **3 个 Agent Worker 和 2 个 ASGI 节点**,并给出约 **170 峰值并发请求、20–30 个 coding/review 并发任务**的容量估算。仓库目前没有包含验证这些数字的压测报告,因此应视为设计容量估算。图中的 Redis 队列、仓库锁和事件流是目标组件,不是当前应用服务。 + +## Agent Eval + +最近一次固定题库评测使用独立的 [`test-coding-eval`](https://github.com/Guo-Yixin/test-coding-eval) 仓库。各案例记录了对应的 Agent 版本;本次使用 DeepSeek `deepseek-flash` 和 runner v4。 + +

+ + Agent Eval 报告:10 道编码题全部通过,两个端到端门禁通过 + +

+ +| 固定题库指标 | 结果 | +| --- | ---: | +| 编码题 | **10 / 10 通过** | +| 目标、回归、隐藏验收 | **各 10 / 10 通过** | +| 补丁应用 / 检索 hit@k / 工具恢复 | **100% / 1.0 / 100%** | +| Provider Token / Agent 累计耗时 | **6,963,895 / 10.2 分钟** | +| 应用与沙箱端到端门禁 | **2 / 2 通过** | + +查看[完整编码题报告](docs/agent-eval/evidence/2026-09-27-final-suite/report.html)、[逐题 Agent/目标仓库 SHA](docs/agent-eval/evidence/2026-09-27-final-suite/provenance.md)、[真实 Agent + OpenSandbox 报告](docs/agent-eval/evidence/2026-09-27-final-suite/opensandbox-agent/report.html),或 [PostgreSQL 应用端到端报告](docs/agent-eval/evidence/2026-09-27-final-suite/application-postgres-e2e/report.html)。该成绩只代表这组固定案例、记录的 Agent 版本、模型和运行配置,不代表 Agent 在任意项目上的通用成功率。 + +## 快速开始 + +### 环境要求 + +- Python **3.14+** +- Node.js 与 Corepack(Yarn Classic 1.22) +- DeepSeek API Key + +### 安装并配置 + +```powershell +git clone https://github.com/Guo-Yixin/coding-agent.git +cd coding-agent +py -3.14 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install -e . "deepagents==0.6.11" +corepack prepare yarn@1.22.22 --activate +Set-Location ui +yarn install --frozen-lockfile +Set-Location .. +Copy-Item .env.example .env +``` + +编辑 `.env`,至少填写: + +```dotenv +DEEPSEEK_API_KEY=your-deepseek-api-key +MAIN_MODEL=deepseek-flash +AI_WORKSPACE_ROOT=C:\coding-agent-workspace +DASHBOARD_JWT_SECRET=替换为足够长的随机密钥 +``` + +`.env` 只保存在本机。只有需要访问私有仓库或执行平台写操作时,才配置 `GITHUB_TOKEN` 或 `GITEE_TOKEN`;不要把真实密钥提交到 Git。 + +### 启动前后端 + +在仓库根目录运行: + +```powershell +python scripts/start_all.py +``` + +打开 ;后端 API 文档位于 。按 `Ctrl+C` 同时停止前后端。 + +## 数据库与沙箱 + +- **SQLite(默认):** 本地开发无需单独启动数据库服务,项目数据保存在 `data/`。 +- **PostgreSQL(可选):** 准备独立数据库,并在 `.env` 中配置: + + ```dotenv + PERSISTENCE_BACKEND=postgres + POSTGRES_DSN=postgresql://user:password@127.0.0.1:5432/coding_agent_db + ``` + + 共享部署请参考[部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)。 +- **OpenSandbox(可选):** 安装 `python -m pip install -e ".[sandbox]"`,启动 OpenSandbox 服务后配置: + + ```dotenv + OPEN_SANDBOX_DOMAIN=https://your-opensandbox-service + OPEN_SANDBOX_API_KEY=your-opensandbox-key + ``` + + 当前 OpenSandbox 适配器用于隔离的 Eval 执行;常规本地应用使用受控本地工作区后端。 + +完整变量见 [`.env.example`](.env.example);更多内容见 [Linux 部署手册](docs/CODING_LINUX_DEPLOYMENT_RUNBOOK.md)、[云端部署设计](docs/CODING_CLOUD_DOCKER_DEPLOYMENT.md)和 [Agent Eval 指南](docs/AGENT_EVAL.md)。 + +## 参与贡献 + +欢迎提交 Issue 和 Pull Request。请说明问题、改动目的和验证方式。涉及 Agent 行为、工具权限、持久化或评测的改动,请附上针对性测试或 Eval 案例。可先阅读[项目文档](docs/),需要讨论方案时先开 Issue。 + +## 许可证 + +CODING 使用 [MIT License](LICENSE) 发布。 diff --git a/assets/architecture-en.svg b/assets/architecture-en.svg index 1b0e0f0..700c5cd 100644 --- a/assets/architecture-en.svg +++ b/assets/architecture-en.svg @@ -1,88 +1,60 @@ - -CODING · SYSTEM ARCHITECTUREA repository-aware coding agent with a reviewable engineering loop - - - - - - - - - -CODING · SYSTEM ARCHITECTURE -A repository-aware coding agent with a reviewable engineering loop -REQUEST → ROUTE → REASON → BUILD → VERIFY → REPORT - - -APP RUNTIME - -Developer / User -Task · approval · review - -Web UI · FastAPI -REST + SSE event stream - -Intent router -LLM classification + rule fallback - -Primary Agent -Plan · delegate · code · summarize - -Code intelligence & tools -CodeGraph · grep · Git · terminal · tests - -Repository workspace -Guarded file access · reviewable diffs - -Specialist SubAgents -Analysis · read-only review · focused tasks - - - - - - -delegate / review -read / edit / test -retrieve context - -AGENT EVAL · REPRODUCIBLE CODING BENCHMARK - -Eval runner -Fixed task · agent revision · limits - -OpenSandbox -Isolated candidate repository - -Scorers & checks -Target · regression · hidden oracle - -Report & evidence -Patch · events · tokens · latency · HTML - - - - - - -candidate patch -run isolated tests -scores + traces -reproducible evidence -evaluation feedback - - -SQLite / PostgreSQL -Tasks · messages · events · checkpoints - -Repository memory -Project facts · decisions · session resume - -Scale-out design -Redis queue · worker pool · repo lock - - - -persist & resume -Dashed = documented deployment target; capacity numbers are estimates, not load-test results. - \ No newline at end of file + +CODING System Architecture +CODING request intake, asynchronous task scheduling, agent execution, persistence, and isolated evaluation. + + + + + + + + + + +CODING · SYSTEM ARCHITECTURE +An asynchronous AI coding workspace for real Git repositories +REQUEST INTAKE → DURABLE QUEUE → PARALLEL RUNS → STREAMING → VERIFIED DELIVERY + + +01 · APPLICATION RUNTIMECurrent implementation + +Developer / UserCreate chats · submit tasks · review results +Vue 3 WorkspaceProjects · chats · model selection · live status +FastAPI IngressValidate · create runs · stream over SSE +Durable Run Queue + Worker PoolAtomic claims · concurrency limits · leases · recovery + + +TASK EXECUTION + +Concurrent Run WorkersIndependent runs · cancellable · resumableClaimed from the durable queue +Primary Agent · LangGraphIntent routing · planning · tools · synthesisCheckpoints support interrupted-run recovery +Repository Context & ToolsCodeGraph / grep · Git · terminal · testsGuarded files · isolated workspace · reviewable diff +Specialist SubAgentsFocused analysis · read-only review · collaborationResults are synthesized by the primary agent + +Tool results return to the agent for the next step + + +02 · STATE, EVENTS & MEMORY + +SQLite / PostgreSQLProjects · chats · runs · messages · events +LangGraph CheckpointsExecution state · resume cursor · memory +SSE Event StreamSteps · tool output · heartbeat · terminal state +Workspace & DeliverablesRepository files · patches · branch / PR status +Run state and traces persist; clients subscribe by chat + + +03 · REPRODUCIBLE AGENT EVALUATIONSeparate from everyday coding runs + +Pinned CasesTarget revisions · checks +Eval RunnerPinned agent · replay orchestration +OpenSandboxIsolated repo · test execution +Scorers & ChecksTarget · regression · hidden tests +Report & EvidencePatch · trace · tokens · latency + +Reports capture revisions, test outcomes, and execution evidence for replay and comparison. OpenSandbox isolates Eval; it is not the runtime for every coding task. + diff --git a/assets/architecture-zh.svg b/assets/architecture-zh.svg index 458d533..ed71156 100644 --- a/assets/architecture-zh.svg +++ b/assets/architecture-zh.svg @@ -1,88 +1,89 @@ - -CODING · 项目系统架构面向真实代码仓库,形成可审查、可复现的研发闭环 - - - - - - - - - -CODING · 项目系统架构 -面向真实代码仓库,形成可审查、可复现的研发闭环 -提交需求 → 意图路由 → Agent 执行 → 测试验证 → 评测报告 - - -应用运行链路 - -开发者 / 用户 -需求 · 审批 · 代码审查 - -Web 工作台 · FastAPI -REST 接口 + SSE 事件流 - -意图路由 -LLM 语义分类 + 规则兜底 - -主 Agent -计划 · 委派 · 编码 · 汇总 - -代码检索与工具 -CodeGraph · grep · Git · 终端 · 测试 - -仓库工作区 -受控文件访问 · 可审查 diff - -专业 SubAgent -分析 · 只读审查 · 专项子任务 - - - - - - -任务委派 / 审查 -读取 / 修改 / 测试 -检索上下文 - -AGENT EVAL · 可复现编码能力评测 - -评测运行器 -固定题目 · Agent 版本 · 资源限制 - -OpenSandbox -隔离的候选项目副本 - -评分器与验收 -目标测试 · 回归测试 · 隐藏验收 - -报告与证据 -补丁 · 事件 · Token · 耗时 · HTML - - - - - - -候选补丁 -隔离运行测试 -评分与轨迹 -可复现证据 -评测反馈 - - -SQLite / PostgreSQL -任务 · 消息 · 事件 · checkpoint - -仓库长期记忆 -项目事实 · 技术决策 · 会话恢复 - -横向扩容设计 -Redis 队列 · Worker 池 · 仓库锁 - - - -持久化与恢复 -虚线表示文档中的部署目标;并发数字为估算值,尚非压测结果。 - \ No newline at end of file + +CODING 项目架构图 +展示 CODING 从用户请求、异步任务调度、Agent 执行、仓库工具、持久化到隔离评测的完整架构。 + + + + + + + + + + +CODING · 项目系统架构 +面向真实代码仓库的异步 AI 编码工作台 · 可追踪、可审查、可恢复 +请求接入 → 持久化排队 → 并行执行 → 流式反馈 → 验证交付 + + +01 · 应用运行链路 +当前实现 + + + + + + + + +开发者 / 用户创建会话 · 提交任务 · 查看结果 +Vue 3 工作台项目 / 会话 · 模型选择 · 实时状态 +FastAPI 接入层校验请求 · 创建 Run · SSE 流式响应 +持久化任务队列 + Worker Pool原子领取 · 并发上限 · 心跳租约 · 失败恢复 + + + +任务执行 + + + + + + +并发 Run Worker每个任务独立运行 · 可取消 / 可恢复由持久化队列领取任务 +主 Agent · LangGraph意图路由 · 计划 · 工具调用 · 汇总checkpoint 支持中断后续跑 +仓库上下文与工具CodeGraph / grep · Git · 终端 · 测试受控文件访问 · 工作区隔离 · 可审查 diff +专业 SubAgent专项分析 · 只读审查 · 并行协作结果由主 Agent 汇总 + +工具执行结果返回 Agent · 迭代直到完成 + + + +02 · 状态、事件与记忆 + + + + + + +SQLite / PostgreSQL项目 · 会话 · Run · 消息 · 事件 +LangGraph Checkpoint执行状态 · 恢复游标 · 长期记忆 +SSE 事件流步骤 · 工具输出 · 心跳 · 完成 / 失败 +工作区与交付物仓库文件 · 补丁 · 分支 / PR 状态 +Run 状态与执行轨迹持久化,前端按会话订阅 + + + +03 · Agent Eval 可复现评测链路 +独立于日常编码任务 + + + + + + + +固定案例集目标版本 · 验收命令 +Eval Runner固定 Agent · 复跑编排 +OpenSandbox隔离候选仓库 · 执行测试 +评分与检查目标 · 回归 · 隐藏验收 +报告与证据补丁 · 轨迹 · Token · 耗时 + + +评测报告记录版本、测试结果和运行证据,用于复现与版本对比;OpenSandbox 是 Eval 隔离后端,不代表所有常规任务都在沙箱运行。 + diff --git a/assets/demo/create-project-dialog.png b/assets/demo/create-project-dialog.png new file mode 100644 index 0000000..8954237 Binary files /dev/null and b/assets/demo/create-project-dialog.png differ diff --git a/assets/demo/workspace-home.png b/assets/demo/workspace-home.png new file mode 100644 index 0000000..ec58b66 Binary files /dev/null and b/assets/demo/workspace-home.png differ