@xcompiler/cli 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.CN.md +137 -202
- package/README.md +138 -205
- package/config.example.yaml +64 -32
- package/debug-wiki/README.md +12 -0
- package/debug-wiki/wiki/agent/calibration-fixtures.md +33 -0
- package/debug-wiki/wiki/agent/calibration-network-api.md +36 -0
- package/debug-wiki/wiki/agent/calibration-python-imports.md +33 -0
- package/debug-wiki/wiki/system/debug-issue-flow.md +29 -0
- package/debug-wiki/wiki/system/no-poisoning.md +29 -0
- package/dist/acp/index.d.ts +17 -2
- package/dist/acp/index.js +2403 -432
- package/dist/acp/index.js.map +1 -1
- package/dist/cli/xcompiler.js +2507 -523
- package/dist/cli/xcompiler.js.map +1 -1
- package/dist/cli/xcompiler_build.js +730 -248
- package/dist/cli/xcompiler_build.js.map +1 -1
- package/dist/cli/xcompiler_run.js +2185 -359
- package/dist/cli/xcompiler_run.js.map +1 -1
- package/dist/plugins/index.d.ts +16 -3
- package/dist/plugins/index.js +27 -17
- package/dist/plugins/index.js.map +1 -1
- package/dist/runtime/runtime.d.ts +38 -13
- package/dist/runtime/runtime.js +2495 -515
- package/dist/runtime/runtime.js.map +1 -1
- package/docs/XCompiler_design.md +542 -0
- package/docs/acp.md +4 -4
- package/docs/assets/iterative-v-model-pipeline.svg +169 -0
- package/docs/assets/system-architecture.svg +134 -0
- package/docs/assets/xcompiler-icon.png +0 -0
- package/docs/deploy.md +381 -0
- package/docs/openrouter.md +10 -1
- package/package.json +5 -1
package/README.CN.md
CHANGED
|
@@ -1,287 +1,222 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/xcompiler-icon.png" alt="XCompiler logo" width="128" height="128" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
>
|
|
4
|
-
> 输入一段自然语言需求 → 自动产出可运行、可测试、可交付的 Python 或 TypeScript 工程
|
|
5
|
-
> Apache License 2.0
|
|
5
|
+
<h1 align="center">XCompiler</h1>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>AI 软件工厂运行时</strong>
|
|
9
|
+
</p>
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
> 通过迭代式 V 模型流程,把自然语言需求转成可运行、可测试、可交付的 Python 或 TypeScript 工程。
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/@xcompiler/cli"><img src="https://img.shields.io/npm/v/@xcompiler/cli.svg" alt="npm package" /></a>
|
|
15
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache-2.0 license" /></a>
|
|
16
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D24-brightgreen.svg" alt="Node.js >= 24" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
语言: [EN](README.md) (默认) · **简体中文**
|
|
11
20
|
|
|
12
21
|
---
|
|
13
22
|
|
|
14
|
-
##
|
|
23
|
+
## XCompiler 做什么
|
|
15
24
|
|
|
16
|
-
XCompiler
|
|
25
|
+
XCompiler 是一个可复用的 AI 软件工厂运行时。它先把产品需求编译成可执行工程计划,再用受沙盒约束的多 Agent、受控工具、测试门禁、Debug 回退、审计日志和可恢复工程状态来执行计划。
|
|
17
26
|
|
|
18
27
|
| 命令 | 定位 | 输入 | 输出 |
|
|
19
28
|
|---|---|---|---|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
29
|
+
| `xcompiler build` | 把需求编译成 `phasePlan.json` 和当前阶段计划,例如 `plan.P1.json` | 需求文本(`-i req.md`、`-t topic.md` 或交互输入) | `topic.md`、`phasePlan.json`、`plan.P1.json`、`plan.md`、`<name>.xc` |
|
|
30
|
+
| `xcompiler run` | 按 V 模型执行当前阶段 | `phasePlan.json` 或历史 `plan.json` | 可运行工程、测试、文档、审计、更新后的进度 |
|
|
31
|
+
| `xcompiler load` | 从工程文件恢复 | `<name>.xc` | 继续保存的阶段/任务状态 |
|
|
32
|
+
| `xcompiler append` / `xcompiler evolve` | 在已有工程上追加需求 | 现有 workspace/工程文件 + 新需求 | 增量计划和实现 |
|
|
33
|
+
| `xcompiler acp` | 作为 ACP Code Agent Adapter 运行 | IDE/Editor 通过 stdio JSON-RPC 调用 | 基于 Runtime 的代码代理事件和结果 |
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
> 区别:XCompiler 的"指令"是 V 模型阶段(REQUIREMENT / ARCH / CODE / TEST / REFACTOR / DELIVERY),"执行单元"是受沙盒约束的多 Agent 循环。
|
|
25
|
-
|
|
26
|
-
每个 Step 都有 git 快照与审计日志,失败自动进入 DEBUG 闭环重试(≤ 3 次)。
|
|
35
|
+
当前架构中,**Runtime 是唯一业务入口**。CLI 和 ACP 都只是 Adapter:负责解析输入、加载配置、渲染输出、监听 Runtime 事件;Build/Run/Workflow/Agent/Tool/Plugin/Memory 等业务能力统一由 Runtime 提供。
|
|
27
36
|
|
|
28
37
|
---
|
|
29
38
|
|
|
30
|
-
##
|
|
39
|
+
## 迭代式 V 模型流程
|
|
31
40
|
|
|
32
|
-
XCompiler
|
|
41
|
+
XCompiler 把 Phase 迭代模型和 V 模型结合起来。Planner 先生成总览级 `phasePlan.json`,再只展开当前阶段为具体 `plan.P<N>.json`。每个当前阶段都执行完整 V 模型;未来阶段只保留目标,等激活后再展开细节计划。
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
需求 (NL) ───► Intake ──► Clarify ──► PhasePlan ──► plan.P1.json
|
|
38
|
-
│ │
|
|
39
|
-
└─ Gate 1 ───┘ Gate 2 (人工双确认门)
|
|
43
|
+
<p align="center">
|
|
44
|
+
<img src="docs/assets/iterative-v-model-pipeline.svg" alt="Iterative V-Model Pipeline" />
|
|
45
|
+
</p>
|
|
40
46
|
|
|
47
|
+
V 模型行为:
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
- `REQUIREMENT_ANALYSIS`、`HIGH_LEVEL_DESIGN`、`DETAILED_DESIGN`、`CODE` 会同步生成对应下游测试期望。
|
|
50
|
+
- `HIGH_LEVEL_DESIGN` 定义系统级接口、外部 API、第三方库选型和依赖确认。
|
|
51
|
+
- `DETAILED_DESIGN` 定义模块内部结构和具体实现方案。
|
|
52
|
+
- 测试失败先记录为 issue,再路由回匹配的上游阶段交给 Debugger 修复。
|
|
53
|
+
- 已完成阶段的 Debug 必须提供真实 patch/rewrite 或成功验证证据。
|
|
54
|
+
- 网络/API 调用失败是正式门禁:项目 API 失败时必须修复或切换可用 API,不能跳过或掩盖。
|
|
44
55
|
|
|
45
|
-
|
|
46
|
-
│ ▲
|
|
47
|
-
▼ │
|
|
48
|
-
ARCH ◄───── refactor / docs ─────► REFACTOR
|
|
49
|
-
│ ▲
|
|
50
|
-
▼ │
|
|
51
|
-
CODE ◄────── test gate ──────────► TEST
|
|
52
|
-
│ ▲
|
|
53
|
-
└─────────────► DEBUG (≤3 retries) ──────┘
|
|
54
|
-
(失败自动闭环)
|
|
55
|
-
```
|
|
56
|
+
---
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
## 系统架构
|
|
59
|
+
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img src="docs/assets/system-architecture.svg" alt="XCompiler System Architecture" />
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
各层职责:
|
|
65
|
+
|
|
66
|
+
- **Adapters**:参数/协议解析、配置加载、用户交互、输出渲染、Exit Code。
|
|
67
|
+
- **Runtime**:Runtime API、Build Service、Run Service、Event Stream、Permission Broker,是唯一业务入口。
|
|
68
|
+
- **Workflow and planning**:Phase 迭代、V 模型调度、回退/Debug 路由、迭代门禁、断点恢复。
|
|
69
|
+
- **Agents / Skills**:每个阶段的角色化 prompt 与工具白名单。
|
|
70
|
+
- **Tools**:文件编辑、程序/测试执行、API fetch、依赖修改、git 快照,全部受门禁约束。
|
|
71
|
+
- **LLM Router**:角色链、动态评分、cluster fallback、OpenAI-compatible/Ollama 客户端、审计。
|
|
72
|
+
- **Workspace**:`phasePlan.json`、`plan.P<N>.json`、`<name>.xc`、`.xcompiler/audit.jsonl`、Debug cache、Project memory。
|
|
66
73
|
|
|
67
74
|
---
|
|
68
75
|
|
|
69
|
-
##
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
│ │
|
|
79
|
-
▼ ▼
|
|
80
|
-
┌────────────────────┐ ┌──────────────────────┐
|
|
81
|
-
│ Planner (compile) │ │ PhaseEngine (run) │
|
|
82
|
-
│ - intake/clarify │ │ - 拓扑调度 │
|
|
83
|
-
│ - decompose (V) │ │ - DEBUG 闭环 │
|
|
84
|
-
│ - plan lint │ │ - 断点续跑 │
|
|
85
|
-
└─────────┬──────────┘ └──────────┬───────────┘
|
|
86
|
-
│ │
|
|
87
|
-
▼ ▼
|
|
88
|
-
┌──────────────────────────────────────────────┐
|
|
89
|
-
│ Agent / Skill 层 │
|
|
90
|
-
│ Architect · Coder · Tester · Debugger · │
|
|
91
|
-
│ Refactorer · Author │
|
|
92
|
-
│ Skills: patcher / author / tester / │
|
|
93
|
-
│ dep_resolver / debugger / refactor │
|
|
94
|
-
└──────────────────┬───────────────────────────┘
|
|
95
|
-
│
|
|
96
|
-
▼
|
|
97
|
-
┌─────────────────────────────────────────────────────┐
|
|
98
|
-
│ Tool 层(白名单 + EditGuard) │
|
|
99
|
-
│ read_file · write_file · append_file · │
|
|
100
|
-
│ replace_in_file · run_program · run_tests · git_* │
|
|
101
|
-
└──────────────────┬──────────────────────────────────┘
|
|
102
|
-
│
|
|
103
|
-
┌──────────────┼──────────────────┐
|
|
104
|
-
▼ ▼ ▼
|
|
105
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
|
|
106
|
-
│ LLM Router │ │ Sandbox │ │ Workspace │
|
|
107
|
-
│ chain + │ │ subprocess │ │ git + audit │
|
|
108
|
-
│ fallback │ │ / docker │ │ + .xcompiler/ │
|
|
109
|
-
│ (ollama, │ │ venv 隔离 │ │ phasePlan/plan.Px │
|
|
110
|
-
│ openai) │ │ │ │ │
|
|
111
|
-
└──────────────┘ └──────────────┘ └──────────────────┘
|
|
76
|
+
## 从 npm 安装
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install -g @xcompiler/cli
|
|
80
|
+
mkdir xcompiler-demo && cd xcompiler-demo
|
|
81
|
+
cp "$(npm root -g)/@xcompiler/cli/config.example.yaml" config.yaml
|
|
82
|
+
cp "$(npm root -g)/@xcompiler/cli/.env.example" .env
|
|
83
|
+
# 编辑 .env,填入 OPENROUTER_API_KEY
|
|
84
|
+
xcompiler doctor
|
|
112
85
|
```
|
|
113
86
|
|
|
114
|
-
|
|
115
|
-
等关键边界。插件可以注册 Tool / Skill,但仍受原有工具白名单与 EditGuard 安全模型约束。
|
|
87
|
+
默认模板使用 OpenRouter Free mode,并通过 `type: openai` 的 OpenAI-compatible provider 访问:
|
|
116
88
|
|
|
117
|
-
|
|
89
|
+
```yaml
|
|
90
|
+
model: openrouter/free
|
|
91
|
+
base_url: https://openrouter.ai/api/v1
|
|
92
|
+
```
|
|
118
93
|
|
|
119
|
-
|
|
120
|
-
- **Planner / PhaseEngine**:分别对应"编译"与"执行"的总调度。
|
|
121
|
-
- **Agent / Skill**:每个 Skill 是一组「角色 + System Prompt + 工具白名单」,绑定到 V 模型的某个阶段。
|
|
122
|
-
- **Tool**:原子操作,全部经 EditGuard / 白名单审查;写入只允许落在 Step 声明的 outputs 内。
|
|
123
|
-
- **LLM Router**:多 provider 链式回退(chain + fallbacks)+ 全量审计。
|
|
124
|
-
- **Sandbox**:Python 走 venv/pip/pytest;TypeScript 走 npm/tsx/vitest,可选 subprocess 或 docker。
|
|
125
|
-
- **Workspace**:git 快照 + `.xcompiler/audit.jsonl` + `.xcompiler/.lock`,可断点续跑。
|
|
94
|
+
`config.yaml`、`llm_scores.yaml` 和 `llm_scores_user.yaml` 都是本地文件,故意不提交到仓库。npm 包只发布 `config.example.yaml` 和 `.env.example` 作为模板。`llm_scores.yaml` 是 XCompiler 自动维护的运行态分数;只有需要固定本地覆盖策略时,才创建 `llm_scores_user.yaml`,例如用 `provider: 0` 禁用某个 provider。
|
|
126
95
|
|
|
127
96
|
---
|
|
128
97
|
|
|
129
98
|
## 快速开始
|
|
130
99
|
|
|
131
100
|
```bash
|
|
132
|
-
# 1. 安装依赖
|
|
133
|
-
npm ci
|
|
134
|
-
cp .env.example .env # 填入 OPENROUTER_API_KEY,默认走 OpenRouter Free provider
|
|
135
|
-
cp config.example.yaml config.yaml
|
|
136
|
-
|
|
137
|
-
# 2. 构建并安装为全局命令
|
|
138
|
-
npm run build
|
|
139
|
-
npm link # 或 npm install -g .
|
|
140
|
-
xcompiler --help
|
|
141
|
-
|
|
142
|
-
# 3. 写需求 → 编译 plan
|
|
143
101
|
echo "把 DBC 文件解析为 Excel 报表" > req.md
|
|
144
102
|
xcompiler build -i req.md --yes
|
|
145
|
-
|
|
146
|
-
# 4. 执行 plan
|
|
147
103
|
xcompiler run /tmp/xcompiler-<时间戳>/phasePlan.json
|
|
148
|
-
|
|
149
|
-
# 5. 之后从生成的工程文件恢复
|
|
150
104
|
xcompiler load /tmp/xcompiler-<时间戳>/xcompiler-<时间戳>.xc
|
|
151
105
|
```
|
|
152
106
|
|
|
153
|
-
|
|
107
|
+
源码仓库开发:
|
|
154
108
|
|
|
155
109
|
```bash
|
|
156
|
-
npm
|
|
157
|
-
cp
|
|
158
|
-
cp
|
|
159
|
-
|
|
110
|
+
npm ci
|
|
111
|
+
cp .env.example .env
|
|
112
|
+
cp config.example.yaml config.yaml
|
|
113
|
+
npm run build
|
|
114
|
+
npm link
|
|
115
|
+
xcompiler --help
|
|
160
116
|
```
|
|
161
117
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
开发模式(无需构建):
|
|
118
|
+
不 link 的开发模式:
|
|
165
119
|
|
|
166
120
|
```bash
|
|
167
|
-
npm run dev -- build
|
|
121
|
+
npm run dev -- build -i req.md --yes
|
|
168
122
|
npm run dev -- run path/to/phasePlan.json
|
|
169
123
|
```
|
|
170
124
|
|
|
171
|
-
|
|
125
|
+
增量开发:
|
|
172
126
|
|
|
173
127
|
```bash
|
|
174
|
-
# 在当前 workspace 基线之上新增 feature
|
|
175
128
|
xcompiler build -w path/to/workspace -i feature_req.md --intent feature --yes
|
|
176
|
-
|
|
177
|
-
# 或一条命令完成 compile + run
|
|
178
129
|
xcompiler evolve -w path/to/workspace -i refactor_req.md --intent refactor --yes
|
|
179
|
-
|
|
180
|
-
# 在同一个工程上追加新需求,仍走澄清 + V 模型
|
|
181
130
|
xcompiler append path/to/workspace/<name>.xc -i feature_req.md --yes
|
|
182
|
-
|
|
183
|
-
# 在隔离 worktree 中让稳定版本构建、验证下一代 XCompiler
|
|
184
|
-
xcompiler bootstrap -r path/to/XCompiler -i self_req.md --yes
|
|
185
131
|
```
|
|
186
132
|
|
|
187
|
-
|
|
133
|
+
自举开发:
|
|
188
134
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
| `xcompiler build` | `-t <file>` | 复用已有 `topic.md`,跳过 Gate 1 |
|
|
193
|
-
| `xcompiler build` | `--intent <greenfield\|feature\|refactor\|self>` | 选择新建、增量或隔离自举规划 |
|
|
194
|
-
| `xcompiler build` | `--baseline-plan <file>` | 为增量规划显式指定已有 `phasePlan.json` 或历史 `plan.json` |
|
|
195
|
-
| `xcompiler build` / `xcompiler run` | `--project-file <file>` | 创建/更新指定的 `XXX.xc` 工程文件 |
|
|
196
|
-
| `xcompiler build` | `--force` | 覆写 workspace 锁,强制重新生成 plan |
|
|
197
|
-
| `xcompiler evolve` | `...` | 先编译增量 plan,再在同一 workspace 内立即执行 |
|
|
198
|
-
| `xcompiler load <XXX.xc>` | — | 读取工程配置/进度并继续当前 plan |
|
|
199
|
-
| `xcompiler append <XXX.xc>` | `-i <file>` | 在已有工程上澄清并执行新的增量需求 |
|
|
200
|
-
| `xcompiler bootstrap` | `--promote` | 质量门全部通过后显式快进晋级候选版本;默认只生成候选和报告 |
|
|
201
|
-
| `xcompiler bootstrap` | `--docker-qualification` | 显式启用实验性 Docker 质量门;默认使用 subprocess 沙箱 |
|
|
202
|
-
| `xcompiler run` | `--reset` | 重置所有 Step 为 PENDING |
|
|
203
|
-
| `xcompiler run` | `--force` | 等价于 `--reset` + 覆写锁 |
|
|
204
|
-
| `xcompiler run` | `--from <stepId>` / `--phase <phase>` | 断点续跑 / 仅跑某阶段 |
|
|
205
|
-
| `xcompiler run` | `--dry-run` | 仅打印拓扑顺序 |
|
|
206
|
-
| `xcompiler ls` | — | 扫描 workspace 列出所有阶段计划状态 |
|
|
207
|
-
| `xcompiler show <stepId>` | — | 查看单 Step 定义 / 产物 / 最近审计 |
|
|
135
|
+
```bash
|
|
136
|
+
xcompiler bootstrap -r path/to/XCompiler -i self_req.md --yes
|
|
137
|
+
```
|
|
208
138
|
|
|
209
139
|
---
|
|
210
140
|
|
|
211
|
-
##
|
|
141
|
+
## 常用命令
|
|
212
142
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
143
|
+
| 命令 | 用途 |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `xcompiler build -i <file>` | 从需求文件生成阶段计划 |
|
|
146
|
+
| `xcompiler build -t <topic.md>` | 复用已澄清 topic,跳过 Gate 1 |
|
|
147
|
+
| `xcompiler run <phasePlan.json>` | 执行当前阶段计划 |
|
|
148
|
+
| `xcompiler run --from <stepId>` | 从指定 Step 断点恢复 |
|
|
149
|
+
| `xcompiler run --phase <phase>` | 只执行某个阶段/状态 |
|
|
150
|
+
| `xcompiler run --debug-wiki-path <dir>` | 复用并更新共享分层 Debug wiki 路径 |
|
|
151
|
+
| `xcompiler load <name.xc>` | 读取工程配置/进度并继续 |
|
|
152
|
+
| `xcompiler append <name.xc> -i <file>` | 在已有工程上追加新需求 |
|
|
153
|
+
| `xcompiler evolve -w <workspace> -i <file>` | 编译并执行一次增量变更 |
|
|
154
|
+
| `xcompiler acp` | 启动 ACP Code Agent stdio adapter |
|
|
155
|
+
| `xcompiler doctor` | 检查配置、LLM provider、sandbox、skills 是否可用 |
|
|
156
|
+
| `xcompiler ls` / `xcompiler show <stepId>` | 查看计划和最近审计 |
|
|
157
|
+
| `npm run release:local -- vX.Y.Z` | 本地准备 release commit 和 tag,不 push |
|
|
222
158
|
|
|
223
159
|
---
|
|
224
160
|
|
|
225
|
-
##
|
|
161
|
+
## 默认运行时
|
|
226
162
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
| [docs/versioning.md](docs/versioning.md) | 核心版本、Plugin API 版本、同步命令与发版校验 |
|
|
235
|
-
| [docs/self_bootstrap.md](docs/self_bootstrap.md) | 代际自举、worktree 隔离、质量门与晋级协议 |
|
|
236
|
-
| [docs/dev_audit_log.md](docs/dev_audit_log.md) | XCompiler 自身开发交付日志(每次需求 / 决策 / 产物 / 验证) |
|
|
237
|
-
|
|
238
|
-
> 文档分层:
|
|
239
|
-
> - `docs/` 是唯一文档根目录;设计文档使用语义化名称,V 模型运行产物使用 `01-`~`05-` 阶段前缀。
|
|
240
|
-
> - `docs/dev_audit_log.md` 记录"我们如何建造 XCompiler",是 XCompiler 项目的交付物之一。
|
|
241
|
-
> - `<workspace>/docs/process_log.md` 由运行时 `AuditLogger` 自动生成,记录"用户用 XCompiler 开发某 Python 项目"的全部交互,作为该产品的交付汇总。
|
|
163
|
+
- **LLM**:默认 OpenRouter Free mode。key 缺失或无效时会输出 provider、model、base URL、HTTP 状态/响应体,并明确提示 `OPENROUTER_API_KEY`。
|
|
164
|
+
- **LLM 路由**:角色专用 provider 链、XCompiler 自动维护的动态评分、`llm_scores_user.yaml` 用户覆盖,以及 `tags: [cluster]` 聚合路由兜底评分带。
|
|
165
|
+
- **语言**:支持 Python 与 TypeScript 的工程生成、测试、运行和入口检查。
|
|
166
|
+
- **Sandbox**:默认 `subprocess`;可切换 `docker` 以启用 bind-mount 隔离和网络/资源限制。
|
|
167
|
+
- **Audit**:每次运行写入 `.xcompiler/audit.jsonl`、LLM stream trace、`docs/process_log.md`、Debug cache、Debug wiki 反馈和 Project memory。
|
|
168
|
+
- **Debug wiki**:Debugger 处理 issue 时会基于压缩后的 `DebugBrief` 检索 LLM-wiki 风格的历史修复经验。wiki 是分层 Markdown 知识库:随包发布的 `wiki/system` 策略页、随包发布的 `wiki/agent` calibration 页、本地 `wiki/external` 真实 issue 解决方案页。Runtime 会重新生成 `index.md` 供人工审阅、`index.json` 供检索使用,并追加 `log.md` 记录操作流水。默认复制到 XCompiler 路径(设置 `XC_PATH` 时为 `$XC_PATH/.xcompiler/debug-wiki`,否则为包/仓库根目录),也可用 `--debug-wiki-path <dir>` 指定共享根目录。issue 正确修复后会把 LLM 输出的 `issueResolutionPlan` 写入 `external`;复用方案失败会通过 feedback overlay 标为 `needs_review`,后续成功修复会创建或纠正 external 条目。
|
|
169
|
+
- **安全门禁**:项目文件访问受控,写工具限制在 Step 声明 outputs 内,敏感操作可通过 Adapter 暴露为权限事件。
|
|
242
170
|
|
|
243
171
|
---
|
|
244
172
|
|
|
245
|
-
##
|
|
173
|
+
## 运行期调优
|
|
246
174
|
|
|
247
|
-
LLM
|
|
175
|
+
LLM 路由配置位于 `config.yaml -> llm.*`。
|
|
248
176
|
|
|
249
177
|
| 字段 | 默认 | 作用 |
|
|
250
178
|
|---|---|---|
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
179
|
+
| `roles.<Role>` | 按角色不同 | Planner、Architect、Coder、Tester、Debugger 的 provider 候选链 |
|
|
180
|
+
| `scores.<provider>` | `1.0` | 向后兼容的初始评分;手动覆盖优先使用 `llm_scores_user.yaml` |
|
|
181
|
+
| `llm_scores_user.yaml` | 不存在 | 本地用户评分覆盖;`0` 禁用 provider,`0.1..1` 固定有效优先级 |
|
|
182
|
+
| `cluster_score_min/max` | `0.2..0.5` | `cluster` provider 的动态评分范围;用户覆盖仍可使用 `0.1..1` |
|
|
183
|
+
| `agent.sandboxes.python.mode` | `subprocess` | Python 工程沙盒后端:本地 subprocess 或 Docker |
|
|
184
|
+
| `agent.sandboxes.typescript.mode` | `subprocess` | TypeScript 工程沙盒后端:本地 subprocess 或 Docker |
|
|
185
|
+
| `max_rounds_per_step` | `6` | 普通 Step 的 LLM 对话轮数上限 |
|
|
186
|
+
| `max_debug_rounds_per_step` | `max(8, 2 * max_rounds_per_step)` | Debugger 对话轮数上限 |
|
|
187
|
+
| `max_debug_retries` | `3` | Debug 重试次数 |
|
|
188
|
+
| `--debug-wiki-path <dir>` | XCompiler 路径下的 `.xcompiler/debug-wiki` | 共享分层 Debug wiki 根目录路径 |
|
|
189
|
+
| `max_edit_lines_per_step` | `auto` | EditGuard 单 Step 累计写入行数预算 |
|
|
190
|
+
| `max_write_chunk_bytes` | `auto` | 单次写入 chunk 字节预算 |
|
|
191
|
+
| `agent.sandboxes.<language>.<local\|docker>.limits.network` | `download-only` | 默认允许出站下载且不发布入站端口;`off` 为断网 |
|
|
257
192
|
|
|
258
193
|
---
|
|
259
194
|
|
|
260
|
-
##
|
|
195
|
+
## 文档
|
|
261
196
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
197
|
+
| 路径 | 内容 |
|
|
198
|
+
|---|---|
|
|
199
|
+
| [docs/openrouter.md](docs/openrouter.md) | OpenRouter Free mode 与 OpenAI-compatible provider 配置 |
|
|
200
|
+
| [docs/acp.md](docs/acp.md) | ACP Code Agent Adapter 协议说明 |
|
|
201
|
+
| [docs/XCompiler_design.md](docs/XCompiler_design.md) | 核心设计与 V 模型概念 |
|
|
202
|
+
| [docs/plugin_api.md](docs/plugin_api.md) | Plugin API、生命周期 hooks、tools、skills |
|
|
203
|
+
| [docs/versioning.md](docs/versioning.md) | 版本源、release 脚本、tag 策略 |
|
|
204
|
+
| [docs/self_bootstrap.md](docs/self_bootstrap.md) | 自举开发与 qualification gates |
|
|
205
|
+
| [docs/deploy.md](docs/deploy.md) | 本地、Docker、native package 部署 |
|
|
267
206
|
|
|
268
207
|
---
|
|
269
208
|
|
|
270
|
-
##
|
|
271
|
-
|
|
272
|
-
完整步骤见 [docs/deploy.md](docs/deploy.md):
|
|
209
|
+
## 测试
|
|
273
210
|
|
|
274
211
|
```bash
|
|
275
|
-
|
|
276
|
-
npm
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
docker build -t xcompiler:latest .
|
|
281
|
-
docker compose run --rm xcompiler --help
|
|
212
|
+
npm run version:check
|
|
213
|
+
npm run typecheck
|
|
214
|
+
npm run lint
|
|
215
|
+
npm test
|
|
216
|
+
npm run build
|
|
282
217
|
```
|
|
283
218
|
|
|
284
|
-
|
|
219
|
+
最近本地 release gate:49 个测试文件 / 473 个测试通过。
|
|
285
220
|
|
|
286
221
|
---
|
|
287
222
|
|