@xcompiler/cli 0.2.2 → 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/.env.example +18 -0
- package/README.CN.md +143 -190
- package/README.md +144 -193
- package/config.example.yaml +138 -0
- 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 +32 -4
- package/dist/acp/index.js +6064 -1044
- package/dist/acp/index.js.map +1 -1
- package/dist/cli/xcompiler.js +7102 -2051
- package/dist/cli/xcompiler.js.map +1 -1
- package/dist/cli/xcompiler_build.js +3519 -1520
- package/dist/cli/xcompiler_build.js.map +1 -1
- package/dist/cli/xcompiler_run.js +5196 -894
- package/dist/cli/xcompiler_run.js.map +1 -1
- package/dist/plugins/index.d.ts +30 -4
- package/dist/plugins/index.js +401 -85
- package/dist/plugins/index.js.map +1 -1
- package/dist/runtime/runtime.d.ts +79 -17
- package/dist/runtime/runtime.js +7087 -2040
- 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 +158 -0
- package/docs/versioning.md +12 -0
- package/package.json +9 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: agent.calibration.network-api
|
|
3
|
+
layer: agent
|
|
4
|
+
createdAt: "2026-07-18T00:00:00.000Z"
|
|
5
|
+
updatedAt: "2026-07-18T00:00:00.000Z"
|
|
6
|
+
status: active
|
|
7
|
+
category: network_api_failure
|
|
8
|
+
summary: "Network/API failures are real gates and require endpoint repair or replacement"
|
|
9
|
+
primaryError: "HTTP/API probe failed or returned unusable data"
|
|
10
|
+
debugDemand: "Identify the failed URL/status, reject unusable responses, switch to a suitable API when needed, patch the integration, and verify."
|
|
11
|
+
fingerprints:
|
|
12
|
+
- "cat:network_api_failure"
|
|
13
|
+
- "http:401"
|
|
14
|
+
- "http:403"
|
|
15
|
+
- "http:404"
|
|
16
|
+
- "http:429"
|
|
17
|
+
- "http:500"
|
|
18
|
+
symptoms:
|
|
19
|
+
- "Network API failure detected"
|
|
20
|
+
- "HTTP 401/403/404/429/5xx"
|
|
21
|
+
- "http_fetch loops or empty body"
|
|
22
|
+
resolutionPlan: "Use at most two probes, choose a reachable and schema-compatible API, then patch the real integration and validate with run_program plus tests."
|
|
23
|
+
solution: "Do not hide API failures with static fake data. For 401/403 without user credentials, switch to a no-key public API. For 404/410, replace the endpoint. For 429, add fallback/timeout/caching or use a less constrained API. HTTP 2xx with empty or unparsable body is not a usable API."
|
|
24
|
+
evidence:
|
|
25
|
+
- "Derived from calibrateDebugSuggestions network-api-failure and network-api-probe-loop rules"
|
|
26
|
+
language: python
|
|
27
|
+
stats:
|
|
28
|
+
uses: 0
|
|
29
|
+
successes: 1
|
|
30
|
+
failures: 0
|
|
31
|
+
feedback: []
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Network/API debug calibration
|
|
35
|
+
|
|
36
|
+
API failures are functional failures. The Debugger must repair the integration or switch API and verify the entrypoint.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: agent.calibration.python-imports
|
|
3
|
+
layer: agent
|
|
4
|
+
createdAt: "2026-07-18T00:00:00.000Z"
|
|
5
|
+
updatedAt: "2026-07-18T00:00:00.000Z"
|
|
6
|
+
status: active
|
|
7
|
+
category: import_error
|
|
8
|
+
summary: "Python import failures require real module/dependency repair"
|
|
9
|
+
primaryError: "ModuleNotFoundError or ImportError"
|
|
10
|
+
debugDemand: "Inspect actual src/tests layout, fix imports or add real dependencies, and never fake missing modules in production code."
|
|
11
|
+
fingerprints:
|
|
12
|
+
- "cat:import_error"
|
|
13
|
+
- "err:modulenotfounderror"
|
|
14
|
+
- "err:importerror"
|
|
15
|
+
symptoms:
|
|
16
|
+
- "ModuleNotFoundError"
|
|
17
|
+
- "cannot import name"
|
|
18
|
+
- "from src.<module> import"
|
|
19
|
+
resolutionPlan: "Read the failing file and target module, compare actual symbols and paths, then patch the import or create the missing output/dependency."
|
|
20
|
+
solution: "Use sibling module imports inside src and tests. If the missing name is a third-party import, add the real package name, not an import alias. Never add try/except ImportError fake modules, fake classes, or production mocks to bypass the error."
|
|
21
|
+
evidence:
|
|
22
|
+
- "Derived from calibration rules ModuleNotFoundError, ImportError-name, src-prefix-import, mock-patch-target-src-prefix"
|
|
23
|
+
language: python
|
|
24
|
+
stats:
|
|
25
|
+
uses: 0
|
|
26
|
+
successes: 1
|
|
27
|
+
failures: 0
|
|
28
|
+
feedback: []
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Python import debug calibration
|
|
32
|
+
|
|
33
|
+
Import errors are contract signals. Fix the import graph or dependency manifest; do not simulate the missing dependency.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: system.debug.issue-flow
|
|
3
|
+
layer: system
|
|
4
|
+
createdAt: "2026-07-18T00:00:00.000Z"
|
|
5
|
+
updatedAt: "2026-07-18T00:00:00.000Z"
|
|
6
|
+
status: active
|
|
7
|
+
category: unknown
|
|
8
|
+
summary: "Issue-first debug flow with explicit resolution plans"
|
|
9
|
+
primaryError: "Debug attempts must repair recorded issues instead of hiding failures"
|
|
10
|
+
debugDemand: "Record issue evidence, require an explicit issueResolutionPlan, apply a minimal repair, and verify before resolving."
|
|
11
|
+
fingerprints:
|
|
12
|
+
- "cat:unknown"
|
|
13
|
+
- "debug:issue-resolution-plan"
|
|
14
|
+
symptoms:
|
|
15
|
+
- "Debugger receives a routed issue"
|
|
16
|
+
- "Attempt claims done without a reusable repair plan"
|
|
17
|
+
solution: "Treat every Debugger retry with issueId as issue handling. The LLM must output issueResolutionPlan before or while fixing the issue. The plan should state root cause hypothesis, target files/contracts, verification gate, and disconfirming evidence. Resolve only after a successful repair or verification action."
|
|
18
|
+
evidence:
|
|
19
|
+
- "issueResolutionPlan is persisted to the issue and external wiki after success"
|
|
20
|
+
stats:
|
|
21
|
+
uses: 0
|
|
22
|
+
successes: 1
|
|
23
|
+
failures: 0
|
|
24
|
+
feedback: []
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Issue-first debug flow
|
|
28
|
+
|
|
29
|
+
Failures become issues first. Debugger repairs the issue, not the symptom. The repair plan is reusable knowledge and must survive in the external wiki after the issue is resolved.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: system.debug.no-poisoning
|
|
3
|
+
layer: system
|
|
4
|
+
createdAt: "2026-07-18T00:00:00.000Z"
|
|
5
|
+
updatedAt: "2026-07-18T00:00:00.000Z"
|
|
6
|
+
status: active
|
|
7
|
+
category: tool_loop
|
|
8
|
+
summary: "Do not poison XCompiler with generated project-specific fixes"
|
|
9
|
+
primaryError: "Generated project failures must be fixed through process or agent behavior, not hardcoded into XCompiler."
|
|
10
|
+
debugDemand: "Fix Debugger/Coder workflow, tool contracts, or prompts; never add generated project fixtures or domain-specific hacks to XCompiler core."
|
|
11
|
+
fingerprints:
|
|
12
|
+
- "cat:tool_loop"
|
|
13
|
+
- "policy:no-poisoning"
|
|
14
|
+
symptoms:
|
|
15
|
+
- "A real sample project fails repeatedly"
|
|
16
|
+
- "Proposed fix adds project fixture or generated-project rule into XCompiler"
|
|
17
|
+
solution: "When a generated project exposes a recurring failure, fix the generic agent/tool/debug process. Do not add DBC/news/test-project-specific fixtures, hardcoded APIs, or one-off output rules to XCompiler core. External wiki entries may record the project issue and solution, but system/agent rules must remain general."
|
|
18
|
+
evidence:
|
|
19
|
+
- "Project-specific hardcoding is treated as poisoning"
|
|
20
|
+
stats:
|
|
21
|
+
uses: 0
|
|
22
|
+
successes: 1
|
|
23
|
+
failures: 0
|
|
24
|
+
feedback: []
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# No poisoning
|
|
28
|
+
|
|
29
|
+
XCompiler can learn from generated projects, but the learning must be generalized. Specific project artifacts belong to the generated project or the external wiki layer.
|
package/dist/acp/index.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ declare const PlanSchema: z.ZodPipe<z.ZodObject<{
|
|
|
129
129
|
refactor: "refactor";
|
|
130
130
|
self: "self";
|
|
131
131
|
}>>;
|
|
132
|
+
phaseId: z.ZodDefault<z.ZodString>;
|
|
132
133
|
projectType: z.ZodDefault<z.ZodEnum<{
|
|
133
134
|
application: "application";
|
|
134
135
|
library: "library";
|
|
@@ -222,6 +223,7 @@ declare const PlanSchema: z.ZodPipe<z.ZodObject<{
|
|
|
222
223
|
version: "1";
|
|
223
224
|
language: "python" | "typescript";
|
|
224
225
|
intent: "greenfield" | "feature" | "refactor" | "self";
|
|
226
|
+
phaseId: string;
|
|
225
227
|
projectType: "application" | "library" | "mixed";
|
|
226
228
|
requirementDigest: string;
|
|
227
229
|
globalPrompt: string;
|
|
@@ -278,6 +280,7 @@ declare const PlanSchema: z.ZodPipe<z.ZodObject<{
|
|
|
278
280
|
version: "1";
|
|
279
281
|
language: "python" | "typescript";
|
|
280
282
|
intent: "greenfield" | "feature" | "refactor" | "self";
|
|
283
|
+
phaseId: string;
|
|
281
284
|
projectType: "application" | "library" | "mixed";
|
|
282
285
|
requirementDigest: string;
|
|
283
286
|
globalPrompt: string;
|
|
@@ -362,6 +365,12 @@ interface ChatOptions {
|
|
|
362
365
|
* 空输出、model token loop 等“表面成功但语义不可用”场景。
|
|
363
366
|
*/
|
|
364
367
|
validate?: (text: string) => void;
|
|
368
|
+
/**
|
|
369
|
+
* Whether a provider response should increase its dynamic score.
|
|
370
|
+
* Step/workflow executors should disable this and score quality through
|
|
371
|
+
* their own validation instead of treating "returned text" as task success.
|
|
372
|
+
*/
|
|
373
|
+
scoreSuccess?: boolean;
|
|
365
374
|
/**
|
|
366
375
|
* 调用者可传入回调,与 LLM 输出一同拿到实际产出该响应的 provider 名。
|
|
367
376
|
* 主要用于追溯:在 FallbackClient 中服务于响应的是链中某一个后选 provider,
|
|
@@ -421,11 +430,12 @@ declare class AuditLogger {
|
|
|
421
430
|
llmResponse(role: string, model: string, content: string, meta?: Record<string, unknown>): Promise<void>;
|
|
422
431
|
llmError(role: string, model: string, err: unknown): Promise<void>;
|
|
423
432
|
/**
|
|
424
|
-
* 记录一轮 Executor
|
|
425
|
-
* 写入 jsonl + markdown
|
|
433
|
+
* 记录一轮 Executor 执行摘要:简短 intent、issue 处理方案、计划调用的 actions、是否完成。
|
|
434
|
+
* 写入 jsonl + markdown 折叠块,交付时可追溯每轮决策和动作。
|
|
426
435
|
*/
|
|
427
436
|
executorTurn(stepId: string, role: string, round: number, payload: {
|
|
428
437
|
thoughts?: string;
|
|
438
|
+
issueResolutionPlan?: string;
|
|
429
439
|
actions?: unknown[];
|
|
430
440
|
done?: boolean;
|
|
431
441
|
raw?: string;
|
|
@@ -489,11 +499,23 @@ interface ExecResult {
|
|
|
489
499
|
stderr: string;
|
|
490
500
|
timedOut: boolean;
|
|
491
501
|
durationMs: number;
|
|
502
|
+
timeoutReason?: string;
|
|
503
|
+
}
|
|
504
|
+
interface ExecProgressWatch {
|
|
505
|
+
/** Host-side paths whose recursive size indicates install progress. */
|
|
506
|
+
paths: string[];
|
|
507
|
+
/** Kill the child only after this much time without size growth. */
|
|
508
|
+
idleTimeoutMs: number;
|
|
509
|
+
/** Poll interval for recursive size checks. */
|
|
510
|
+
checkIntervalMs?: number;
|
|
511
|
+
/** Human-readable label used in timeout diagnostics. */
|
|
512
|
+
label?: string;
|
|
492
513
|
}
|
|
493
514
|
interface ExecExtra {
|
|
494
515
|
cwd?: string;
|
|
495
516
|
env?: Record<string, string>;
|
|
496
517
|
timeoutMs?: number;
|
|
518
|
+
progressWatch?: ExecProgressWatch;
|
|
497
519
|
}
|
|
498
520
|
/** 沙盒统一接口。任意 phase / tool 都通过此接口与运行时交互。 */
|
|
499
521
|
interface Sandbox {
|
|
@@ -515,7 +537,7 @@ interface Sandbox {
|
|
|
515
537
|
/**
|
|
516
538
|
* 运行工程入口程序。
|
|
517
539
|
* - Python:`python <args>`(自动选用 venv 内解释器)。
|
|
518
|
-
* - TypeScript
|
|
540
|
+
* - TypeScript:默认 `npx tsx <entry>`;当 args 以 `npm`/`npx`/`node`/`tsx`/`tsc` 开头时执行对应项目命令。
|
|
519
541
|
*/
|
|
520
542
|
runProgram(args: string[], extra?: ExecExtra): Promise<ExecResult>;
|
|
521
543
|
/**
|
|
@@ -577,6 +599,8 @@ interface ToolContext {
|
|
|
577
599
|
language?: Language;
|
|
578
600
|
/** 当前 Step 的 write_file / append_file 单次 content 字节预算。 */
|
|
579
601
|
writeChunkBytes?: number;
|
|
602
|
+
/** run_tests 未提供有效过滤参数时使用的当前阶段默认测试范围。 */
|
|
603
|
+
defaultTestArgs?: string[];
|
|
580
604
|
/** Optional protocol/UI permission hook for sensitive tool operations. */
|
|
581
605
|
requestPermission?: ToolPermissionRequester;
|
|
582
606
|
/** Optional protocol/UI event hook for tool calls and file changes. */
|
|
@@ -653,6 +677,8 @@ interface HookContextMap {
|
|
|
653
677
|
'compile.finish': {
|
|
654
678
|
plan: Plan;
|
|
655
679
|
planPath: string;
|
|
680
|
+
phasePlanPath?: string;
|
|
681
|
+
currentPlanPath?: string;
|
|
656
682
|
};
|
|
657
683
|
'run.before': {
|
|
658
684
|
plan: Plan;
|
|
@@ -868,7 +894,7 @@ interface CompileOptions {
|
|
|
868
894
|
* 已澄清的 topic.md 直接输入:跳过 intake / clarify / Addenda / Gate 1,把该文件
|
|
869
895
|
* 内容当作冻结后的项目选题书,直接进入 decompose。常用于:
|
|
870
896
|
* - 用户上次已澄清并保留了 topic.md,重新跑 decompose 不想再问一遍
|
|
871
|
-
* - 离线编辑了 topic.md 想直接拿来出
|
|
897
|
+
* - 离线编辑了 topic.md 想直接拿来出 phasePlan.json 与当前阶段计划
|
|
872
898
|
* 与 --input 互斥;同时给则 --topic 优先并打印警告。
|
|
873
899
|
*/
|
|
874
900
|
topicFile?: string;
|
|
@@ -924,6 +950,8 @@ interface ExecuteOptions {
|
|
|
924
950
|
force?: boolean;
|
|
925
951
|
/** Optional XXX.xc project file to keep in sync with execution progress. */
|
|
926
952
|
projectFilePath?: string;
|
|
953
|
+
/** Optional debug wiki root directory. Defaults to XCompiler's own .xcompiler/debug-wiki. */
|
|
954
|
+
debugWikiPath?: string;
|
|
927
955
|
/** Project-file history command label; defaults to run. */
|
|
928
956
|
projectCommand?: string;
|
|
929
957
|
/** Whether to append a history row when execution starts; defaults to true. */
|