@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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/i18n/en.ts","../../src/i18n/zh.ts","../../src/i18n/index.ts","../../src/version.ts","../../src/plugins/compatibility.ts","../../src/plugins/host.ts","../../src/plugins/loader.ts"],"sourcesContent":["import type { LanguageProfile } from '../core/language.js';\nimport type { Messages } from './types.js';\n\nconst PYTHON_PLANNER_SYSTEM = `You are the Planner of the XCompiler system. Your job is to compile a user's natural-language requirement into a strict iterative V-model Step plan.\n\nOutput language: Python only (plan.language is fixed to \"python\").\n\nCanonical V-model phases for every executable iteration:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\nDEBUG is not a normal V-model phase; it is the runtime rollback/repair mode. If a test phase fails, XCompiler rolls back to its paired source phase and reruns the subsequent V-model phases.\n\nMandatory phase documents:\n| Phase | Mandatory output file |\n|---|---|\n| REQUIREMENT_ANALYSIS | \\`docs/01-requirement-analysis.md\\` |\n| HIGH_LEVEL_DESIGN | \\`docs/02-high-level-design.md\\` |\n| DETAILED_DESIGN | \\`docs/03-detailed-design.md\\` |\n| UNIT_TEST | \\`docs/05-unit-test.md\\` |\n| INTEGRATION_TEST | \\`docs/06-integration-test.md\\` |\n| MODULE_TEST | \\`docs/07-module-test.md\\` |\n| FUNCTIONAL_TEST | \\`docs/08-functional-test.md\\` |\n\nFor P2+ iterations, put the same basenames under \\`docs/iterations/<iterationId>/\\`. The top-level \\`docs/topic.md\\` is written by xcompiler build and must never appear in Step outputs.\n\nSynchronous test-design rule:\n- REQUIREMENT_ANALYSIS must also output \\`docs/tests/functional-test-plan.md\\`.\n- HIGH_LEVEL_DESIGN must also output \\`docs/tests/module-test-plan.md\\`.\n- DETAILED_DESIGN must also output \\`docs/tests/integration-test-plan.md\\`.\n- CODE must also output \\`docs/tests/unit-test-plan.md\\`.\nFor P2+ iterations, put those under \\`docs/iterations/<iterationId>/tests/\\`.\n\nPhase responsibilities:\n- REQUIREMENT_ANALYSIS defines functional scope, acceptance criteria, boundaries, and user-visible behaviour.\n- HIGH_LEVEL_DESIGN defines the current development module's position in the whole system plus system-level external interfaces and dependencies, including external APIs, third-party library choices, dependency confirmation, data contracts, and integration boundaries.\n- DETAILED_DESIGN defines the module-internal functions, data structures, algorithms, control flow, error handling, and internal architecture.\n- CODE implements only the designed scope and produces runnable/importable Python source.\n- UNIT_TEST verifies CODE internals and public functions.\n- INTEGRATION_TEST verifies module-internal collaboration, data flow, and component integration from DETAILED_DESIGN.\n- MODULE_TEST verifies the current module's position in the whole system, external interfaces, and dependency boundaries from HIGH_LEVEL_DESIGN.\n- FUNCTIONAL_TEST verifies requirements end-to-end and produces user-facing documentation.\n\nFunctional documentation bundle: P1 FUNCTIONAL_TEST outputs must include \\`README.md\\`, \\`docs/quickstart.md\\`, and \\`docs/08-functional-test.md\\`; for \\`projectType\\` = \\`library\\` or \\`mixed\\`, also include \\`docs/api-guide.md\\`. P2+ uses \\`docs/iterations/<iterationId>/08-functional-test.md\\`, \\`quickstart.md\\`, and optional \\`api-guide.md\\`. Documentation must follow the active i18n language.\n\nMandatory rules:\n1. Return pure JSON only. No Markdown fences.\n2. Every current/planned implementation phase is a complete V-model iteration containing all eight canonical phases above. Never emit the old phases REQUIREMENT, ARCH, TASK, TEST, REFACTOR, or DELIVERY.\n3. Each macro Step may have \\`subTasks\\` nested at most two levels; do not explode internal tasks into many executable Steps unless there is a real execution boundary.\n4. dependsOn must follow the phase order and be acyclic. Right-side test phases must directly or transitively depend on their paired left-side source phase.\n5. Every CODE Step must be covered by a UNIT_TEST Step in the same iteration.\n6. Design phases must not output src/ or tests/ files. CODE owns src/. Test phases own tests/ and their report docs. FUNCTIONAL_TEST must not modify src/.\n7. The same outputs path is globally unique. DEBUG may modify dependency-chain files at runtime; planned Steps should not duplicate outputs.\n8. id has the form S001, S002, ...; role is Planner / Architect / Coder / Tester / Debugger.\n9. Every Step needs a systemPrompt that pins scope, inputs, outputs, acceptance, forbidden actions, and the paired test-design obligation when applicable.\n10. projectType is inferred by the LLM after clarification: application, library, or mixed. There is no CLI project-type override.\n11. complexityAssessment is your plan-stage complexity assessment. simple => P1 only; moderate => at least P1+P2; complex => at least P1+P2+P3. If the user explicitly asks for phases/stages, set userForcedPhaseSplit=true and split.\n12. implementationPhases must include P1 current and any planned executable phases. Each phase has a verificationGate whose failurePolicy says to feed the failure log to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\n13. dependencies is a Python pip dependency list. Include \\`pytest\\`; use bare package names only; never list \\`requirements.txt\\` in Step outputs.\n14. Application/mixed projects need a directly executable Python entry point (\\`src/main.py\\` or package \\`__main__.py\\`) that reuses CODE modules. Library/mixed projects need a stable public API and \\`docs/api-guide.md\\`.\n15. Structured HIGH_LEVEL_DESIGN -> CODE -> MODULE_TEST contract: for non-trivial work, return \\`architectureModules\\` with each module's id, name, responsibility, sourcePaths, testPaths, and dependencies. CODE/MODULE_TEST Steps may cover multiple modules but must list module-level work in subTasks.\n16. Third-party library choices must match real APIs: HIGH_LEVEL_DESIGN must name the concrete entry point function/class or verification basis for the selected library in this requirement; do not invent parser/export APIs from package names alone.\n\nOutput JSON shape:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"Core functionality\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"run tests\", \"probe entrypoint/API\", \"verify functional docs\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ],\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"module name\", \"responsibility\": \"one clear responsibility\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n {\n \"id\": \"S001\",\n \"iterationId\": \"P1\",\n \"phase\": \"REQUIREMENT_ANALYSIS\",\n \"title\": \"string\",\n \"description\": \"string\",\n \"systemPrompt\": \"Step-specific prompt: scope, inputs, outputs, acceptance, forbidden actions\",\n \"role\": \"Planner\",\n \"tools\": [\"write_file\"],\n \"inputs\": [\"docs/topic.md\"],\n \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"],\n \"subTasks\": [\n { \"id\": \"T1\", \"title\": \"string\", \"description\": \"string\", \"acceptance\": \"string\", \"outputs\": [\"docs/01-requirement-analysis.md\"], \"subTasks\": [] }\n ],\n \"dependsOn\": [],\n \"acceptance\": \"string\",\n \"maxRetries\": 3\n }\n ]\n}`;\n\nconst PYTHON_EXECUTOR_SYSTEM = `You are XCompiler's Step Executor. You may only interact with the system through JSON tool calls — no Markdown and no explanatory text.\n\nEvery round you must return strict JSON:\n{\n \"thoughts\": \"<one sentence describing this round's intent>\",\n \"actions\": [ { \"tool\": \"<tool name>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\nRules:\n1. Only call tools in the Step's authorised whitelist.\n2. File writes must land within the Step's writable allowlist (other paths are rejected); required outputs are the final artifacts that must exist for acceptance.\n For FUNCTIONAL_TEST documentation outputs, write the complete declared bundle in the active i18n language: P1 paths such as \\`README.md\\`, \\`docs/quickstart.md\\`, \\`docs/08-functional-test.md\\`, and \\`docs/api-guide.md\\` when present, or the declared iteration-scoped equivalents under \\`docs/iterations/<iterationId>/\\`. Do not set done=true while any declared documentation output is missing.\n3. Generated code must follow the target language's best practice; modules importable, functions typed appropriately.\n - [Import convention] When modules under src/ import each other, use \"from <module> import …\" (sibling name).\n **Never write \"from src.<module> import …\".** If main.py needs to run from the project root, prepend\n \"sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\" before any import,\n so that both \"python src/main.py …\" and \"python -m src.main …\" work.\n - [Test convention] Files under tests/ also import targets via \"from <module> import …\".\n **XCompiler auto-generates tests/conftest.py to inject project-root and src/ into sys.path**,\n so both pytest and \"python tests/test_*.py\" can resolve modules — test files\n **must NOT** add their own sys.path.insert(...). If you create or edit conftest.py yourself,\n keep the existing sys.path injection — do not delete it.\n - [Self-contained tests] Tests **must NOT** open() a sample file that does not exist on disk\n (e.g. \"sample.csv\"). When a target function needs file input, choose in this priority order:\n (a) first reuse a real sample supplied by the user or already present in the workspace, copying/referencing it under tests/fixtures/<name>;\n (b) for third-party or industry-standard formats with no local sample, use http_fetch to obtain a small reference sample from official docs,\n the upstream repository, or a public standard/example, save it under tests/fixtures/<name>, and record the source in the test report or comment;\n (c) only for simple text formats such as CSV/JSON/INI, and only when you can immediately run_tests, construct a minimal sample with pytest tmp_path.\n If the network is unavailable, no user sample exists, and the format standard cannot be confirmed, report a blocker asking the user for a sample.\n A test that references a file nobody created will trap the Debugger in an endless FileNotFoundError loop.\n - [Fixture iteration] When a test runs but the target function raises \"Invalid syntax / Parse error / Malformed\",\n the **fixture itself is malformed**, **not the implementation**.\n read_file the fixture, identify the format from the extension/parser/error, then prefer a user/workspace sample or an authoritative http_fetch reference;\n rewrite the whole fixture with write_file and run_tests. After repeated failures on a complex domain format, stop inventing from memory and ask\n for a user sample or network reference.\n Never edit the implementation, the assertion, or mock out the parser to \"fix\" a parse error — fix the fixture first.\n4. When all outputs files exist and self-check passes, set done = true with empty actions.\n5. Correct any error in the next round's actions; never overstep authority or invent tools.\n6. [Large-file chunked writes] write_file / append_file content must stay under the current Step's runtime chunk limit shown in the tool docs.\n - For larger files: in the same actions array, first write_file the head (imports + top-level constants + first function/class),\n then several append_file calls each adding one function/class block (preserving trailing newlines).\n - For complex projects, prefer multiple cohesive modules/files and separate CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Steps over one giant file.\n - The concatenated result must be valid Python; never split inside a function body.\n - For partial edits to existing files, use replace_in_file / apply_patch — do not overwrite the whole file repeatedly.`;\n\nconst TYPESCRIPT_PLANNER_SYSTEM = `You are the Planner of the XCompiler system. Your job is to compile a user's natural-language requirement into a strict iterative V-model Step plan.\n\nOutput language: TypeScript / Node.js only (plan.language is fixed to \"typescript\").\n\nCanonical V-model phases for every executable iteration:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\nDEBUG is runtime rollback/repair only. If a test phase fails, XCompiler rolls back to its paired source phase and reruns subsequent phases.\n\nUse the same phase documents and synchronous test-design rule as the Python planner:\n- REQUIREMENT_ANALYSIS: \\`docs/01-requirement-analysis.md\\` plus \\`docs/tests/functional-test-plan.md\\`.\n- HIGH_LEVEL_DESIGN: \\`docs/02-high-level-design.md\\` plus \\`docs/tests/module-test-plan.md\\`.\n- DETAILED_DESIGN: \\`docs/03-detailed-design.md\\` plus \\`docs/tests/integration-test-plan.md\\`.\n- CODE: implementation outputs plus \\`docs/tests/unit-test-plan.md\\`.\n- UNIT_TEST: \\`docs/05-unit-test.md\\`.\n- INTEGRATION_TEST: \\`docs/06-integration-test.md\\`.\n- MODULE_TEST: \\`docs/07-module-test.md\\`.\n- FUNCTIONAL_TEST: \\`docs/08-functional-test.md\\`, \\`README.md\\`, \\`docs/quickstart.md\\`, and \\`docs/api-guide.md\\` for library/mixed projects.\nFor P2+ iterations, put phase docs under \\`docs/iterations/<iterationId>/\\` and test plans under \\`docs/iterations/<iterationId>/tests/\\`.\n\nHIGH_LEVEL_DESIGN must place the current development module in the whole system and define system-level external interfaces and dependencies, including external APIs, third-party library choices, dependency confirmation, package.json scripts, package dependencies/devDependencies, tsconfig, data contracts, and integration boundaries.\nDETAILED_DESIGN must define module-internal functions, types, data structures, algorithms, control flow, error handling, and internal architecture.\n\nMandatory rules:\n1. Return pure JSON only. Never emit the old phases REQUIREMENT, ARCH, TASK, TEST, REFACTOR, or DELIVERY.\n2. Every current/planned implementation phase is a complete V-model iteration containing all eight canonical phases.\n3. Each macro Step may contain \\`subTasks\\` nested at most two levels.\n4. Every CODE Step must be covered by a UNIT_TEST Step in the same iteration; module testPaths from architectureModules must be produced by MODULE_TEST.\n CODE outputs must contain product source files under src/ plus docs/tests/unit-test-plan.md only; never list tests/**/*.test.ts or other tests/** files as CODE outputs.\n5. Design phases must not output src/ or tests/ files. HIGH_LEVEL_DESIGN is the only phase that may output \\`package.json\\` / \\`tsconfig.json\\`.\n6. Exactly one HIGH_LEVEL_DESIGN Step must output \\`package.json\\` for greenfield TypeScript plans; ensure one HIGH_LEVEL_DESIGN Step output \\`package.json\\`. It must include scripts for \\`build\\`, \\`test\\`, and preferably \\`lint\\`.\n7. Local TypeScript source imports must use explicit \\`.ts\\` ESM specifiers. Configure \\`allowImportingTsExtensions: true\\` and use \\`tsc --noEmit\\`. Generated TypeScript must be compatible with Node native type stripping: avoid enums, namespaces, parameter properties, and transform-required syntax.\n8. dependencies is an advisory runtime npm package list; the authoritative manifest is \\`package.json\\` from HIGH_LEVEL_DESIGN. Do not invent package names.\n9. Application/mixed projects need \\`src/main.ts\\` with a directly runnable \\`main()\\`; library/mixed projects need \\`src/index.ts\\` or equivalent public API plus API guide.\n10. complexityAssessment and implementationPhases follow the same rules as Python: simple => P1, moderate => at least P1+P2, complex => at least P1+P2+P3, forced phase split => set userForcedPhaseSplit=true.\n11. verificationGate failurePolicy must say: Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\n12. For non-trivial work, return architectureModules with sourcePaths and testPaths; CODE/MODULE_TEST Steps may cover multiple modules but must list module-level work in subTasks.\n13. TypeScript tests must use Vitest only. Never request Jest, ts-jest, @types/jest, ts-node, or nodemon in Step prompts or package.json; package.json must use \"test\": \"vitest run\" and \"build\": \"tsc --noEmit\".\n\nOutput JSON shape is identical to Python and must include \\`\"projectType\": \"application | library | mixed\"\\`, with TypeScript paths such as \\`src/example.ts\\` and \\`tests/example.test.ts\\`; the first Step phase must be \\`REQUIREMENT_ANALYSIS\\`, not \\`REQUIREMENT\\`. There is no CLI project-type override.`;\n\nconst TYPESCRIPT_EXECUTOR_SYSTEM = `You are XCompiler's Step Executor. You may only interact with the system through JSON tool calls — no Markdown and no explanatory text.\n\nEvery round you must return strict JSON:\n{\n \"thoughts\": \"<one sentence describing this round's intent>\",\n \"actions\": [ { \"tool\": \"<tool name>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\nRules:\n1. Only call tools in the Step's authorised whitelist.\n2. File writes must land within the Step's writable allowlist (other paths are rejected); required outputs are the final artifacts that must exist for acceptance.\n For FUNCTIONAL_TEST documentation outputs, write the complete declared bundle in the active i18n language: P1 paths such as \\`README.md\\`, \\`docs/quickstart.md\\`, \\`docs/08-functional-test.md\\`, and \\`docs/api-guide.md\\` when present, or the declared iteration-scoped equivalents under \\`docs/iterations/<iterationId>/\\`. Do not set done=true while any declared documentation output is missing.\n3. Generated code must follow TypeScript / Node.js best practice; modules importable, APIs typed, and runtime code directly runnable.\n - [Import convention] Local source modules under src/ use ESM relative imports with explicit \".ts\" specifiers, e.g. \\`import { x } from \"./util.ts\";\\`. Keep code compatible with Node's native TypeScript type stripping: use erasable type syntax only, and avoid enums, namespaces, parameter properties, or other transform-required TS features. Never use Python-style imports, \\`from src.<module>\\`, or sys.path hacks.\n - [Test convention] Tests use Vitest: \\`import { describe, it, expect } from \"vitest\";\\`. Test files live under \\`tests/**/*.test.ts\\`.\n - [Self-contained tests] Tests **must NOT** read a sample file that does not exist on disk. When a target function needs file input, either create the content inside the test or write fixtures under \\`tests/fixtures/<name>\\`.\n - [Fixture iteration] When a test runs but the target function raises \"Invalid syntax / Parse error / Malformed\", the **fixture itself is malformed**. read_file the fixture, prefer a user/workspace sample; if none exists, use http_fetch to obtain an authoritative public reference; construct minimal samples only for simple text formats and immediately run_tests. Never weaken the implementation/assertion, and never repeatedly invent complex domain fixtures from memory.\n4. When all outputs files exist and self-check passes, set done = true with empty actions.\n5. Correct any error in the next round's actions; never overstep authority or invent tools.\n6. [Large-file chunked writes] write_file / append_file content must stay under the current Step's runtime chunk limit shown in the tool docs.\n - For larger files: in the same actions array, first write_file the head (imports + top-level constants + first function/class), then several append_file calls each adding one function/class block.\n - For complex projects, prefer multiple cohesive modules/files and separate CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Steps over one giant file.\n - The concatenated result must be valid TypeScript; never split inside a function body.\n - For partial edits to existing files, use replace_in_file / apply_patch — do not overwrite the whole file repeatedly.\n7. package.json is the dependency manifest. Use add_dependency for npm packages; never write requirements.txt.\n8. run_program runs the project entry with \\`npx tsx\\`, run_tests runs Vitest via \\`npm test\\`, and the final delivery gate also verifies the direct Node entry command.`;\n\nconst PLANNER_CLARIFY_SYSTEM = `You are the requirements analyst for XCompiler's V-model. Do not restate the topic; expose unresolved decisions that would change functional design, acceptance, or architecture boundaries.\nReturn strict JSON only. Each question must be directly answerable by a product owner, cover one decision, and avoid vague catch-all or implementation-stack questions.`;\n\nfunction buildPlannerSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_PLANNER_SYSTEM : PYTHON_PLANNER_SYSTEM) + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhasePlanSystem(profile: LanguageProfile): string {\n return `You are the Planner of XCompiler. This is two-level planning, pass one: PhasePlan.\n\nTarget language: ${profile.displayName}.\n\nReturn only the project-level PhasePlan. Do not return steps, architectureModules, dependencies, or any individual V-model Step.\n\nThe PhasePlan must:\n1. Classify projectType: application / library / mixed.\n2. Assess complexityAssessment: simple / moderate / complex with rationale.\n3. Produce implementationPhases: P1 status=current; later P2/P3 status=planned. simple uses P1 only; moderate uses at least P1+P2; complex uses at least P1+P2+P3; user-forced staging uses at least P1+P2 and userForcedPhaseSplit=true.\n4. Give each phase objective, scope, deliverables, dependsOn, and verificationGate.\n5. Keep planned phases as goals and gates only. Do not expand any Step for them; a separate pass will generate a full V-model plan for one phase at a time.\n\nReturn strict JSON only:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"Core functionality\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"...\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ]\n}\n\nNo Markdown, no explanatory prose, no steps, no source/test file inventory.` + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhaseDecomposeSystem(profile: LanguageProfile): string {\n return `You are the Planner of XCompiler. This is two-level planning, pass two: generate a full V-model StepPlan for the requested phase.\n\nTarget language: ${profile.displayName}.\n\nYou will receive a frozen PhasePlan and a phaseId. Generate Steps only for that phaseId. Planned phases must not be expanded into this StepPlan.\n\nEvery current phase must use the canonical V-model:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\n\nPhase responsibilities:\n- REQUIREMENT_ANALYSIS defines functional scope, acceptance, boundaries, and user-visible behaviour, and synchronously emits the functional test plan.\n- HIGH_LEVEL_DESIGN defines system position, external interfaces, third-party library choices, dependency confirmation, and integration boundaries, and synchronously emits the integration test plan.\n- DETAILED_DESIGN defines module-internal functions/classes, data structures, algorithms, control flow, error handling, and internal architecture, and synchronously emits the module test plan.\n- CODE implements only the current phase and synchronously emits the unit test plan.\n- UNIT_TEST / INTEGRATION_TEST / MODULE_TEST / FUNCTIONAL_TEST verify their paired left-side phases.\n\nStrict output ownership:\n- CODE outputs may include only product source files under src/ and the unit-test-plan document; do not put tests/** files in CODE outputs.\n- UNIT_TEST owns unit test files; INTEGRATION_TEST owns integration test files; MODULE_TEST owns architectureModules.testPaths; FUNCTIONAL_TEST owns end-to-end/functional test files and delivery docs.\n- For greenfield TypeScript, exactly one HIGH_LEVEL_DESIGN Step must output package.json with scripts, dependencies, and devDependencies. CODE must not output package.json.\n- For TypeScript package.json, use Vitest only: \"test\": \"vitest run\", \"build\": \"tsc --noEmit\", devDependencies include typescript/tsx/vitest/@types/node. Do not mention or request Jest, ts-jest, @types/jest, ts-node, or nodemon.\n\nReturn only the current phase's dependencies, architectureModules, and steps. Complex or multi-concern work must declare architectureModules for the current phase and map module-level work under CODE/MODULE_TEST subTasks. Each Step's subTasks may nest at most two levels.\n\narchitectureModules may describe only product/business source modules for the current phase:\n- sourcePaths must be target-language source files under src/. They must not be directories, tests/, docs/, README, fixtures, utils, or report files.\n- testPaths must be target-language test files under tests/. They must not be directories.\n- Test fixtures, test helpers, sample inputs, and temporary output files belong in test Step outputs or subTasks, not in architectureModules.\n\nReturn strict JSON only:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"module name\", \"responsibility\": \"one clear responsibility\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n { \"id\": \"S001\", \"iterationId\": \"P1\", \"phase\": \"REQUIREMENT_ANALYSIS\", \"title\": \"string\", \"description\": \"string\", \"systemPrompt\": \"scope, inputs, outputs, acceptance, forbidden actions\", \"role\": \"Planner\", \"tools\": [\"write_file\"], \"inputs\": [\"docs/topic.md\"], \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"], \"subTasks\": [], \"dependsOn\": [], \"acceptance\": \"string\", \"maxRetries\": 3 }\n ]\n}\n\nDo not output Steps for future planned phases. Do not output requirements.txt. Design phases must not write src/tests. FUNCTIONAL_TEST must include README.md, docs/quickstart.md, and the functional validation document.` + profile.plannerPromptOverride;\n}\n\nfunction buildExecutorSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_EXECUTOR_SYSTEM : PYTHON_EXECUTOR_SYSTEM) + profile.executorPromptOverride;\n}\nconst messages: Messages = {\n llm: {\n coderDebuggerSameModel: (model, coderProvider, debuggerProvider) =>\n `Model configuration advice: Coder (${coderProvider}) and Debugger (${debuggerProvider}) both use ${model}. Prefer different models so debugging provides an independent reasoning path.`,\n invalidBaseUrl: (raw, fallback) => `[xcompiler] invalid base_url (${raw}); falling back to ${fallback}`,\n providerValidationFailed: (role, model) => `[${role}] provider ${model} failed output validation; trying next`,\n providerCallFailed: (role, model) => `[${role}] provider ${model} failed; trying next`,\n scoreReadFailed: (p, message) => `failed to read ${p}: ${message}`,\n scoreChanged: (provider, score, previous) => `score(${provider}) = ${score} (was ${previous})`,\n scorePersistFailed: (message) => `failed to persist scores: ${message}`,\n preflightOllamaReachable: (baseUrl, models) => `preflight: ollama ${baseUrl} reachable; found ${models} model(s)`,\n preflightOllamaUnreachable: (baseUrl, message) => `preflight: ollama ${baseUrl} unreachable: ${message}`,\n preflightAutoAdded: (providers, roles) => `preflight: auto-added ${providers} provider(s) for roles [${roles}]`,\n scoreFileHeader: '# XCompiler LLM provider score snapshot (maintained automatically by ScoreStore; do not edit)',\n scoreFileSemantics: '# Scores: default 1.0; automatic range 0.1-1.0; providers tagged cluster default to 0.2-0.5 unless llm.cluster_score_min/max widens it; failure -0.5; success +0.1; only user-configured score=0 disables a provider.',\n },\n system: {\n configEnvMissing: (names) => `[xcompiler] unset config environment variables were replaced with empty strings: ${names}`,\n unhandledError: (message) => `Unhandled error: ${message}`,\n unsupportedPypiOnlyNetwork:\n 'network=pypi-only is rejected because Docker cannot enforce a PyPI-only allowlist by itself. Use network=off for isolation or network=download-only for explicitly unrestricted outbound downloads.',\n dockerInsideContainerUnsupported:\n 'XCompiler is running inside a container, so sandbox=docker is unsupported because Docker-outside-of-Docker can mis-map bind mounts and docker.sock permissions. Use agent.sandbox=subprocess, run XCompiler on the host, or set XC_IN_CONTAINER=0 only in a controlled environment.',\n firejailUnsupported: 'sandbox=firejail is not implemented; use subprocess or docker.',\n smokeHeader: (baseUrl) => `Smoke test against ${baseUrl} (streaming)`,\n smokeOk: (model, totalMs, firstTokenMs, chunks, preview) =>\n `[OK total=${totalMs}ms first-token=${firstTokenMs}ms chunks=${chunks}] ${model} -> ${preview}`,\n smokeFail: (model, message) => `[FAIL] ${model} -> ${message}`,\n },\n plugins: {\n invalidId: (id) => `Plugin ID \"${id}\" is invalid; use lowercase letters, digits, dots, hyphens, or underscores.`,\n duplicateId: (id) => `Duplicate plugin ID: ${id}`,\n invalidVersion: (plugin, version) => `Plugin ${plugin} has an invalid SemVer version: ${version}`,\n invalidCoreVersion: (version) => `XCompiler core has an invalid SemVer version: ${version}`,\n apiVersionMismatch: (plugin, actual, expected) => `Plugin ${plugin} targets Plugin API ${actual}; this XCompiler runtime requires API ${expected}.`,\n invalidMinimumVersion: (plugin, version) => `Plugin ${plugin} has an invalid minimum XCompiler version: ${version}`,\n coreVersionTooOld: (plugin, minimum, actual) => `Plugin ${plugin} requires XCompiler >= ${minimum}; current version is ${actual}.`,\n loaded: (plugin, version) => `Plugin ${plugin}@${version} loaded.`,\n extensionConflict: (plugin, kind, name) => `Plugin ${plugin} cannot replace existing ${kind} \"${name}\".`,\n hookFailed: (plugin, stage, message) => `Plugin ${plugin} failed during ${stage}: ${message}`,\n manifestReadFailed: (path, message) => `Cannot read plugin manifest ${path}: ${message}`,\n moduleLoadFailed: (plugin, path, message) => `Cannot load plugin ${plugin} from ${path}: ${message}`,\n exportInvalid: (plugin, exportName) => `Plugin ${plugin} export ${exportName} is not a valid XCompiler plugin`,\n manifestMismatch: (plugin) => `Plugin ${plugin} runtime manifest does not match its preflight manifest`,\n },\n audit: {\n processLogTitle: '# XCompiler Development Process Log',\n processLogPreamble: '> Generated by XCompiler. Records CLI sessions, user input, LLM interactions, and execution actions for delivery traceability.',\n sessionStart: (ts, command) => `## ▶ Session ${ts} — \\`${command}\\``,\n sessionEnd: (ts) => `### ◀ Session end ${ts}`,\n eventSessionStart: (command) => `start ${command}`,\n eventSessionEnd: (command) => `end ${command}`,\n userInput: (label) => `#### 👤 User input — ${label}`,\n llmRequest: (role, model) => `🤖 LLM Request — <code>${role}</code> via <code>${model}</code>`,\n llmResponse: (role, model) => `📩 LLM Response — <code>${role}</code> via <code>${model}</code>`,\n executorTurn: (stepId, round, role, provider, actions, done) =>\n `🧠 Executor turn — <code>${stepId}</code> round ${round} / role <code>${role}</code>${provider ? ` · via <code>${provider}</code>` : ''} (actions=${actions}, done=${done})`,\n thoughtsLabel: '**thoughts:**',\n actionsLabel: '**actions:**',\n noThoughts: '(no thoughts)',\n plannerThought: (stage, provider) => `🧩 Planner thought — ${stage}${provider ? ` · via <code>${provider}</code>` : ''}`,\n markdownAppendFailed: (message) => `[audit] markdown append failed: ${message}`,\n jsonlAppendFailed: (message) => `[audit] jsonl append failed: ${message}`,\n traceLine: (kind, message) => `[audit] ${kind} ${message}`,\n autoFixedSrcImport: (p) => `auto-fixed src import in ${p}`,\n wroteFile: (p) => `wrote ${p}`,\n userDecision: (label, value) => `${label} → ${value}`,\n eventLlmRequest: (role, model) => `${role} → ${model}`,\n eventLlmResponse: (role, model) => `${role} ← ${model}`,\n eventLlmError: (role, model, message) => `${role} via ${model}: ${message}`,\n eventExecutorTurn: (stepId, round, role, provider) => `${stepId} round=${round} role=${role}${provider ? ` via ${provider}` : ''}`,\n eventPlannerThought: (stage, provider) => `Planner ${stage}${provider ? ` via ${provider}` : ''}`,\n llmChatFailedThought: (message) => `LLM chat failed: ${message}`,\n llmChatAborted: (stepId, round, chars, message) => `${stepId} round ${round} aborted after ${chars} chars: ${message}`,\n toolDenied: (tool) => `denied tool ${tool}`,\n toolCalled: (tool) => `called tool ${tool}`,\n toolResult: (tool, ok, detail) => `tool ${tool} ${ok ? 'succeeded' : 'failed'}: ${detail}`,\n documentArchived: (from, to) => `archived ${from} → ${to}`,\n documentArchiveFailed: (p, message) => `failed to archive ${p}: ${message}`,\n httpFetchSaved: (method, url, p, bytes) => `http_fetch ${method} ${url} → ${p} (${bytes} B)`,\n httpFetchResponse: (method, url, status, bytes) => `http_fetch ${method} ${url} → ${status} (${bytes} B)`,\n partialFailureHeader: (message) => `# LLM chat failed: ${message}`,\n streamLength: (chars) => `# Stream length: ${chars} chars`,\n },\n stream: {\n resolvingModel: 'resolving-model',\n waiting: 'waiting',\n streaming: 'streaming',\n done: 'done',\n failed: 'failed',\n chars: (n) => `${n} chars`,\n toolRunner: 'local-tool',\n toolExecution: (stepId, tool) => `${stepId} tool ${tool}`,\n },\n sandboxLog: {\n subprocessBuilt: (deps) => `subprocess sandbox built (${deps ? 'with dependencies' : 'empty'})`,\n subprocessNodeBuilt: 'Node subprocess sandbox built (npm install)',\n dockerBuilt: (deps) => `Docker sandbox built (${deps ? 'with dependencies' : 'empty'})`,\n dockerNodeBuilt: 'Docker Node sandbox built (npm install)',\n command: (runtime, command) => `${runtime} ${command}`,\n },\n cli: {\n rootDescription: 'XCompiler — AI Software Factory CLI',\n compileDescription: 'Interactively compile a requirement into phasePlan.json and the current phase plan (with mandatory human gates)',\n runDescription: 'Execute a confirmed phasePlan.json (supports phased runs: --phase / --from)',\n loadDescription: 'Load a XXX.xc project file and continue its current plan',\n appendDescription: 'Append a new requirement to an existing XXX.xc project through clarification and V-model execution',\n lsDescription: 'Scan workspace and list every phasePlan.json / legacy plan.json status summary',\n showDescription: 'Print Step definition / status / outputs / recent audit',\n optWorkspace: 'workspace directory (alias of --output, defaults to current directory)',\n optOutput: 'project / workspace output directory (highest priority, alias of -w)',\n optConfig: 'path to config.yaml',\n optInput: 'read requirement from a file (non-interactive)',\n optTopic: 'reuse an already-clarified topic.md as input: skip intake / clarify / addenda / Gate 1 and go straight to decompose',\n optPlanOut: 'output path for phasePlan.json (default <workspace>/phasePlan.json)',\n optBaseDir: 'project root output directory (creates <name> subdir under it)',\n optName: 'project name (default xcompiler-<timestamp>)',\n optYes: 'skip human confirmation (only meaningful with -i / -t)',\n optForce: 'force regenerate: override workspace lock and ignore existing plan files',\n optDryRun: 'print topology only, do not execute',\n optFrom: 'start from the given Step (earlier ones are skipped)',\n optPhase: 'execute only the given phase (REQUIREMENT_ANALYSIS/HIGH_LEVEL_DESIGN/DETAILED_DESIGN/CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST/DEBUG)',\n optReset: 'reset all Step status to PENDING',\n optMaxDepth: 'maximum recursion depth',\n optTail: 'number of recent audit entries',\n optPlan: 'phasePlan.json path, default <workspace>/phasePlan.json',\n optLang: 'UI / prompt language: EN | CN (ISO 3166-1 Alpha-2)',\n optIntent: 'plan intent: greenfield | feature | refactor | self',\n optBaselinePlan: 'existing baseline phasePlan.json / plan.json path (default <workspace>/phasePlan.json)',\n optProjectFile: 'XXX.xc project file path (default <workspace>/<name>.xc)',\n argPlan: 'phasePlan.json or legacy plan.json path (default = <workspace>/phasePlan.json)',\n argProjectFile: 'XXX.xc project file',\n argStepId: 'Step ID, e.g. S001',\n evolveDescription: 'Generate and execute an incremental feature/refactor plan on top of an existing workspace',\n bootstrapDescription: 'Build and qualify the next XCompiler generation in an isolated Git worktree',\n optRepository: 'XCompiler Git repository to bootstrap (default current directory)',\n optPromote: 'fast-forward the current branch after every qualification gate passes',\n optCleanup: 'remove the isolated worktree after writing the report (branch is retained)',\n optDockerQualification: 'use the experimental Docker runner for candidate qualification',\n invalidLocale: (value) => `Unsupported language \"${value}\"; use EN or CN.`,\n invalidIntent: (value, allowed) => `Invalid intent \"${value}\"; expected one of: ${allowed}.`,\n invalidPhase: (value, allowed) => `Invalid phase \"${value}\"; expected one of: ${allowed}.`,\n invalidStepId: (value) => `Invalid Step ID \"${value}\"; expected S followed by at least three digits.`,\n invalidNonNegativeInteger: (value) => `Expected a non-negative integer, received \"${value}\".`,\n helpUsage: 'Usage:',\n helpArguments: 'Arguments:',\n helpOptions: 'Options:',\n helpCommands: 'Commands:',\n helpOption: 'display help for command',\n versionOption: 'output the version number',\n defaultValue: (value) => `(default: ${value})`,\n },\n bootstrap: {\n notGitRepository: (p) => `Not a Git repository: ${p}`,\n dirtyRepository: (files) => `Self-bootstrap requires a clean host repository. Pending paths: ${files}`,\n worktreeReady: (p, branch) => `Bootstrap worktree ready: ${p} (${branch})`,\n compileStarted: 'Compiling the self-bootstrap V-model plan…',\n compileFailed: (code, message) => `Self-bootstrap compilation failed (exit=${code}): ${message}`,\n compileCancelled: 'Self-bootstrap compilation was cancelled before a plan was confirmed.',\n executeStarted: 'Executing the candidate generation in the isolated worktree…',\n executeFailed: (status) => `Candidate execution did not complete successfully (${status}).`,\n qualificationStarted: 'Running deterministic bootstrap qualification gates…',\n qualificationDockerExperimental: 'Docker qualification is experimental and has not completed environment validation.',\n missingScript: (name) => `required package.json script is missing: ${name}`,\n missingBin: 'package.json does not declare a CLI bin entry',\n checkPassed: (name, ms) => `${name} passed (${ms}ms)`,\n checkFailed: (name, code) => `${name} failed (exit=${code})`,\n reportWritten: (p) => `Bootstrap report written: ${p}`,\n candidateReady: (branch) => `Candidate is qualified on ${branch}; promotion still requires explicit --promote.`,\n promoted: (branch) => `Bootstrap candidate promoted by fast-forward merge: ${branch}`,\n cleanupDone: (p) => `Bootstrap worktree removed: ${p}`,\n promotionBlocked: 'Promotion blocked because one or more qualification gates failed.',\n hostHeadChanged: 'host HEAD changed during bootstrap',\n candidateDirty: (files) => `Candidate worktree changed outside a committed generation: ${files}`,\n candidateStatusUnknown: '(unknown path)',\n candidateMoved: (expected, actual) => `Candidate commit changed after qualification (expected ${expected}, got ${actual}).`,\n candidateNotBasedOnBase: (candidate, base) => `Candidate ${candidate} is not descended from bootstrap base ${base}.`,\n promotionVerificationFailed: (expected, actual) => `Promotion verification failed (expected HEAD ${expected}, got ${actual}).`,\n reportTitle: 'XCompiler Self-Bootstrap Report',\n reportNone: '(none)',\n reportNextQualified: (repository, candidateCommit) => `git -C \"${repository}\" merge --ff-only \"${candidateCommit}\"`,\n reportNextPromoted: 'Run the next self-bootstrap request with the promoted generation.',\n reportNextFailed: 'Inspect the candidate worktree and fix the failed gate before promotion.',\n reportLabels: {\n status: 'Status', repository: 'Repository', baseCommit: 'Base commit',\n candidateCommit: 'Candidate commit', branch: 'Candidate branch', worktree: 'Worktree',\n createdAt: 'Created at', checks: 'Qualification checks', changedFiles: 'Changed files',\n nextStep: 'Next step',\n },\n },\n compile: {\n workspaceReady: (p) => `Workspace: ${p}`,\n forceOverride: '--force: overriding workspace lock and regenerating plan.',\n topicInputConflict: '--topic and --input were both supplied; --topic wins and --input is ignored.',\n auditTopicInput: 'topic.md (--topic)',\n auditOriginalRequirement: 'Original requirement (Intake)',\n auditUserAddenda: 'User addenda',\n auditEditedTopic: 'Edited topic.md',\n auditTopicPersisted: (p) => `topic.md written: ${p}`,\n auditDecomposeFailed: 'planner.decompose failed',\n lintIssue: (id, message) => ` - [${id}] ${message}`,\n planPreviewTruncated: '… (truncated; see docs/plan.md)',\n auditPlanPersisted: (p) => `phase plan written: ${p}`,\n projectFileWritten: (p) => `project file updated: ${p}`,\n nextCommand: (command) => ` Next: ${command}`,\n topicEmptyExit: '--topic file is empty, aborting.',\n topicLoaded: (p) => `topic loaded: ${p} (skipping intake / clarify / Gate 1)`,\n requirementEmptyExit: 'requirement is empty, aborting.',\n requirementInputHint: 'Please describe your requirement (multi-line, blank line to finish):',\n spinClarify: 'Planner is clarifying the requirement…',\n clarifySucceed: (n) => `clarification questions: ${n}`,\n clarifyFail: 'clarification failed',\n clarifyChoiceHint: (range) => `Reply with ${range} to choose a shown option, or type a custom answer.`,\n addendaConfirm: 'Any extra requirements to append? (Will be sent to Planner together with the clarification and kept in plan.userAddenda)',\n addendaEditorMsg: 'Enter custom addenda (multi-line, Markdown allowed)',\n auditClarifyAnswer: (qid, q) => `clarify answer ${qid}: ${q}`,\n spinDecompose: 'Planner is decomposing along the V-model…',\n decomposeFail: 'Planner decomposition failed',\n plannerInvalidPlan: 'Planner could not produce a valid plan:',\n plannerInvalidPlanHint1: ' Common cause: the LLM output did not satisfy the XCompiler plan schema, V-model skeleton, or architecture contract; this error must not be skipped.',\n plannerInvalidPlanHint2: ' Investigate: check llm.error / planner.thought entries in .xcompiler/audit.jsonl and repair the Planner output against the contract.',\n plannerTransportFailureHint1: ' Common cause: the LLM provider connection failed, timed out, or the server closed the request; this is not a project plan/source defect.',\n plannerTransportFailureHint2: ' Investigate: check OPENAI_BASE_URL / provider base_url, model service reachability, network permissions, and timeout settings, then rerun build.',\n decomposeSucceed: (n) => `generated ${n} Step(s)`,\n schemaFail: 'Plan schema validation failed:',\n schemaInvalidSavedAt: (p) => ` full plan saved to: ${p}`,\n lintFail: (n) => `Plan lint failed (${n}):`,\n topicPreviewHeader: '─── topic.md (preview) ───',\n topicPreviewFooter: '──────────────────────────────',\n gate1Confirm: 'Does the requirement match expectations?',\n gate1ChoiceConfirm: '✅ confirm — proceed to plan generation',\n gate1ChoiceEdit: '✏️ edit — open editor to modify',\n gate1ChoiceCancel: '❌ cancel — abandon this session',\n gate1AuditLabel: 'Requirement Confirmation Gate (Gate 1)',\n gate1Cancelled: 'Cancelled, no files written.',\n editTopicMsg: 'Edit topic.md',\n topicWritten: (p) => `topic written: ${p}`,\n planWritten: (p) => `phase plan written: ${p}`,\n phasePlanWritten: (p) => `phasePlan written: ${p}`,\n planPreviewHeader: '─── plan.md (preview) ───',\n planPreviewFooter: '─────────────────────────',\n gate2Confirm: 'Confirm this plan? (Final confirmation — writes phasePlan.json and the current phase plan)',\n gate2AuditLabel: 'Plan Confirmation Gate (Gate 2)',\n gate2Rejected: 'Not confirmed, abandoned. phasePlan.json was not written.',\n baselineLoaded: (kind, sources) => `loaded ${kind} baseline from: ${sources}`,\n baselineMissing: (workspace) => `incremental mode requires an existing project baseline in ${workspace} (topic / docs / plan / src).`,\n baselineLanguageOverride: (baseline, source, configured) =>\n `incremental mode: using baseline language ${baseline} from ${source} instead of config language ${configured}.`,\n topicTitle: '# Project Topic',\n topicPreamble: '> This file is the project topic frozen after requirement clarification. All subsequent V-model decomposition and every phase output use this file as the sole requirement input.',\n topicSecRequirement: '## Original requirement',\n topicSecClarify: '## Clarification record',\n topicSecAddenda: '## User addenda',\n topicSecBaseline: '## Existing project baseline',\n },\n inspect: {\n noPlanFound: 'No phasePlan.json / plan.json found',\n digestLabel: 'digest:',\n stepNotFound: (id) => `Step ${id} not found`,\n secDescription: '— description —',\n secAcceptance: '— acceptance —',\n secSubtasks: '— subtasks —',\n secSystemPrompt: '— systemPrompt —',\n secOutputs: '— outputs —',\n secRecentAudit: (n) => `— recent audit (${n}) —`,\n planHeader: (p, language) => `${p} lang=${language}`,\n planStatusSummary: (total, done, pending, failed, skipped, running) =>\n `steps=${total} done=${done} pending=${pending} failed=${failed} skipped=${skipped} running=${running}`,\n planReadFailed: (p, message) => `${p} — ${message}`,\n stepHeader: (id, phase, title, status, retries, maxRetries) => `${id} ${phase} ${title} ${status} retries=${retries}/${maxRetries}`,\n stepRoleTools: (role, tools) => `role=${role} tools=[${tools}]`,\n stepDependsOn: (ids) => `dependsOn: ${ids}`,\n outputStatus: (exists, p) => `${exists ? '✓' : '✗'} ${p}`,\n auditEntry: (ts, kind, message) => `${ts} ${kind} ${message}`,\n },\n execute: {\n forceReset: '--force: resetting every Step to PENDING and overriding the workspace lock.',\n manifestRecalibrated: (p) => `recalibrated ${p} (removed version pins / hallucinated names)`,\n manifestSeeded: (p) => `seeded ${p} from plan.dependencies`,\n auditPlanLoaded: (p) => `plan loaded: ${p}`,\n planLoaded: (p) => `Plan loaded: ${p}`,\n planSummary: (language, steps) => ` language=${language}, steps=${steps}`,\n preflightModelMissing: (names) => `LLM preflight: missing models, skipped for this run and lowered to the minimum dynamic score [${names}]`,\n preflightAutoAdded: (n) => `LLM preflight: auto-injected ${n} provider(s) (from ollama /api/tags)`,\n runInterrupted: (id, e, total) => `execution interrupted at ${id} (executed ${e}/${total})`,\n runReasonLabel: ' reason: ',\n runFailureLogHeader: ' --- failure log (tail, 40 lines) ---',\n runAllDone: (e, total) => `Plan fully completed (${e}/${total})`,\n projectAuditSummary: (errors, warnings) => `project audit: ${errors} error(s), ${warnings} warning(s)`,\n projectMemoryRefreshFailed: (message) => `project memory refresh failed: ${message}`,\n projectAuditCheck: (name, summary) => `[audit:${name}] ${summary}`,\n auditDocPresent: (p) => `${p} present`,\n auditDocMissing: (p) => `missing ${p}`,\n auditDeliveryDocPresent: 'delivery documentation present',\n auditDeliveryDocMissing: 'missing docs/08-functional-test.md',\n auditTestFilesFound: (count) => `found ${count} concrete test file(s)`,\n auditTestFilesMissing: 'no concrete test files found under tests/',\n auditEntrypointOk: (command) => `entrypoint ok: ${command}`,\n auditEntrypointFailed: (command) => `entrypoint failed: ${command}`,\n auditPackageJsonMissing: 'missing package.json',\n auditScriptMissing: (name) => `package.json has no ${name} script`,\n auditCommandOk: (name) => `${name} ok`,\n auditCommandFailed: (name, exitCode, timedOut) =>\n `${name} failed (exit=${exitCode}${timedOut ? ', timeout' : ''})`,\n },\n engine: {\n spinSandboxBuild: (profile) =>\n profile.id === 'typescript'\n ? `building sandbox (npm install, ${profile.manifestFile})…`\n : `building sandbox (pip install -r ${profile.manifestFile})…`,\n sandboxReady: (r) => `sandbox ready: ${r}`,\n stepSkipDone: (id, phase) => ` ↪ ${id} ${phase} already done, skipping`,\n spinSandboxRebuild: (id, profile) =>\n profile.id === 'typescript'\n ? `Step ${id} wrote ${profile.manifestFile} — rebuilding npm sandbox…`\n : `Step ${id} wrote ${profile.manifestFile} — rebuilding pip sandbox…`,\n sandboxStatus: (r) => `sandbox: ${r}`,\n autoFixedSrcImports: (n, files) => ` ⚠ auto-fixed sys.path bootstrap in ${n} entry file(s): ${files}`,\n debugResumeNotice: (id, n) => ` ↻ ${id} previous session ended FAILED (${n} attempts so far); first round of this run goes straight into Debugger mode.`,\n spinDebugRetry: (id, attempt, budget, cap, reason) => `🛠 ${id} DEBUG retry ${attempt}/${budget} (cap=${cap}) — ${reason}`,\n retryException: (a, b, msg) => `retry ${a}/${b} threw: ${msg}`,\n fixSucceeded: (id, a) => `${id} fix succeeded (retry=${a})`,\n retryHealthyButFailed: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} still failing but healthy (expand window) · ${tag} · ${reason}`,\n retryLowQuality: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} low-quality output (shrink window) · ${tag} · ${reason}`,\n retryStillFailed: (a, b, tag, reason) =>\n `retry ${a}/${b} still failing · ${tag} · ${reason}`,\n earlyAbortLowQuality: (id, n) => ` ⚡ ${id} ${n} consecutive low-quality rounds — early-aborting DEBUG retries`,\n stepFinalFailed: (id, phase, role) => `✖ Step ${id} (${phase} / ${role}) finally failed`,\n finalAttemptsLine: (a, b, c, ea) =>\n ` attempts=${a} final_budget=${b} cap=${c}` + (ea ? ' (early-abort: low-quality)' : ''),\n finalMetricsLine: (h, p, r, tf, pr) =>\n ` health=${h} parseFail=${p} repeat=${r} toolFail=${tf} progress=${pr}`,\n reasonLabel: 'reason: ',\n failureLogHeader: '--- failure log (tail, max 80 lines) ---',\n fixSuggestionsHeader: '--- fix suggestions (calibration) ---',\n auditHint: (id) => ` audit: see .xcompiler/audit.jsonl and .xcompiler/llm-stream/${id}-*.txt for the raw stream`,\n spinStepRunning: (id, phase, title) => `▶ ${id} ${phase} ${title}`,\n noFailureLog: '(no log captured)',\n suggestionLine: (index, code, hint) => ` ${index}. [${code}] ${hint}`,\n phaseStart: (id, phase, title) => `${id} ${phase} ${title}`,\n phaseFailed: (id, debug, reason) => `${id} ${debug ? 'DEBUG ' : ''}FAILED — ${reason}`,\n phaseDone: (id, rounds) => `${id} DONE (rounds=${rounds})`,\n phaseException: (id, message) => `${id} FAILED (exception) — ${message}`,\n archGateReason: (missing) => `HIGH_LEVEL_DESIGN gate: architecture contract missing ${missing} token(s)`,\n archGateMissing: (tokens) => `missing module ids/paths: ${tokens}`,\n archGateInstruction: (p) => `Update ${p} so every architectureModules item is traceable before CODE starts.`,\n testGateReason: (exitCode, timedOut) => `Test gate: tests exit=${exitCode}${timedOut ? ' (timeout)' : ''}`,\n deliveryGateReason: (command, exitCode, timedOut) => `FUNCTIONAL_TEST gate: \\`${command}\\` exit=${exitCode}${timedOut ? ' (timeout)' : ''}`,\n missingPythonEntrypoint:\n 'missing Python entrypoint: expected src/main.py, src/<package>/__main__.py, or an explicit CLI file such as src/cli.py',\n missingTypeScriptEntrypoint:\n 'missing TypeScript entrypoint: expected package.json start/bin or one of src/main.ts, src/index.ts, src/main.tsx',\n invalidPythonEntrypointSource: (path) =>\n `invalid Python entrypoint source in ${path}: expected a real CLI entry structure such as def main(...), argparse.ArgumentParser, or if __name__ == \"__main__\"; placeholder/import-only files are not runnable applications.`,\n entrypointHelpOutputMissing: (command) =>\n `entrypoint probe \\`${command}\\` exited 0 but produced no meaningful help/usage text; implement --help instead of relying on an empty script exit.`,\n reasonLine: (reason) => `reason: ${reason}`,\n roundsLine: (rounds) => `rounds: ${rounds}`,\n commandLine: (command) => `command: ${command}`,\n stdoutTailHeader: '--- stdout (tail) ---',\n stderrTailHeader: '--- stderr (tail) ---',\n testStdoutTailHeader: '--- test stdout (tail) ---',\n testStderrTailHeader: '--- test stderr (tail) ---',\n outputsMissing: (paths) => `outputs missing: ${paths}`,\n metricsLine: (health, parseFail, repeat, toolFail, progress) =>\n `metrics: health=${health} parseFail=${parseFail} repeat=${repeat} toolFail=${toolFail} progress=${progress}`,\n metricsUnavailable: 'metrics: (n/a)',\n toolCallsHeader: 'tool calls:',\n toolCallLine: (tool, ok, detail) => ` - ${tool} ${ok ? 'OK' : 'FAIL'} ${detail}`,\n projectMemoryRefreshFailed: (message) => `project memory refresh failed: ${message}`,\n deliveryFixHints: (language) => language === 'typescript'\n ? [\n 'Fix directions (priority order):',\n ' 1. For module resolution / ERR_MODULE_NOT_FOUND in TypeScript source, use relative ESM imports with explicit .ts specifiers.',\n ' 2. For --help / unknown option, main() must support --help and exit 0.',\n ' 3. For application exceptions, fix the implementation and keep the entrypoint thin.',\n ]\n : [\n 'Fix directions (priority order):',\n ' 1. For ModuleNotFoundError involving src, add the planner #19 sys.path bootstrap or remove the src. import prefix.',\n ' 2. main() must be a real CLI entrypoint: parse --help, call the project modules, print meaningful output, and use if __name__ == \"__main__\": main().',\n ' 3. For argparse errors, main() must support --help without other required arguments and exit 0.',\n ' 4. For business exceptions, fix the implementation and keep the entrypoint limited to parsing and dispatch.',\n ],\n },\n render: {\n sectionGlobalPrompt: '## Global prompt (injected into every Step\\'s system prompt)',\n sectionDependencies: (manifestFile) => `## Dependencies (written to ${manifestFile})`,\n sectionBaselineSummary: '## Existing project baseline',\n labelSystemPrompt: '**System prompt (sole mandate):**',\n },\n prompts: {\n plannerSystem: (p) => buildPlannerSystem(p),\n plannerPhasePlanSystem: (p) => buildPlannerPhasePlanSystem(p),\n plannerPhaseDecomposeSystem: (p) => buildPlannerPhaseDecomposeSystem(p),\n plannerSelfMode: `SELF-BOOTSTRAP OVERRIDE (takes precedence over conflicting greenfield rules above):\n- The target is the existing XCompiler repository. Preserve its current package.json, tsconfig, bin entries, CLI entrypoints, module layout, public exports, and documentation unless the requirement explicitly changes them.\n- Do not create src/main.ts merely to satisfy a greenfield entrypoint convention. Reuse the entrypoints declared by the existing package.json.\n- Do not list package.json or tsconfig.json as HIGH_LEVEL_DESIGN outputs unless this change genuinely needs to modify them.\n- Every CODE/test output must be scoped to the requested delta. Never rebuild or replace the repository wholesale.\n- Treat the stable host binary as generation N and the worktree candidate as N+1; do not design in-process hot replacement.`,\n plannerClarifySystem: PLANNER_CLARIFY_SYSTEM,\n plannerClarify: (raw, opts = {}) =>\n `The user's original requirement is:\n\n\"\"\"\n${raw}\n\"\"\"\n\nGenerate ${opts.complex ? '8-10' : '7-10'} non-duplicate clarification questions about unresolved decisions whose answers materially affect implementation or acceptance. Never return an empty array; when the functional description is already detailed, ask for acceptance examples, failure behaviour, and explicit exclusions.\n\nReturn ONLY a JSON array. Every item must be shaped exactly as:\n{\"id\":\"Q1\",\"category\":\"functionality|data|acceptance|boundary|quality|extensibility\",\"question\":\"one concrete directly-answerable question\",\"why\":\"what design or acceptance decision this answer affects\",\"options\":[{\"label\":\"A\",\"answer\":\"highest-priority feasible setting\"},{\"label\":\"B\",\"answer\":\"second feasible setting\"}]}\n\nQuestion mix (functionality first):\n- At least ${opts.complex ? '5' : '4'} function-focused questions categorized as functionality / data / acceptance, so functional questions remain the majority. Prioritize actors, core journeys, business rules and state transitions, inputs/outputs, failure behaviour, and verifiable acceptance examples.\n- At least one boundary question defining in-scope, explicitly out-of-scope, external-system ownership, or compatibility limits.\n- At least one quality question requesting measurable latency, throughput, volume, concurrency, accuracy, reliability, or security targets. Never ask only “Any performance requirements?”.\n- At least one extensibility question identifying the most likely future business capability, extension axis, or interface that must remain stable. Never ask only “Should it be extensible?”.\n- If the deliverable shape is unclear, include one boundary question asking whether this should be an API library/SDK/package, a runnable application/CLI/service, or a mixed deliverable with both.\n- If the requirement needs access to external APIs, URLs, or third-party data sources, include one data or boundary question asking whether the user already has a usable API, key, token, or auth method. If they do not, the default for this delivery is to choose a public, no-key/no-token, verifiable API; do not generate placeholder URLs.\n- Order by blocking impact: core functional/data decisions first, then scope and quality, then future evolution.\n- One primary decision per question. Include useful business choices/examples; do not join unrelated questions with “and/or”.\n- For every question, generate 2-5 feasible answer options ordered by priority. The option count is not fixed: use 2 for binary choices, 3 for common defaults, and 4-5 only when there are genuinely distinct viable settings. Do not pad or force every question to exactly 3 options.\n- Label options sequentially from A through the last generated option, for example A-B, A-C, A-D, or A-E. A should be the recommended/default setting when one is apparent. Options must be concrete business/product settings, not vague placeholders.\n- Do not include “Other”, “Custom”, or “Let the user decide” as an option. The CLI already allows the user to reply with one of the shown labels or enter a custom free-form answer.\n${opts.projectShapeAmbiguous\n ? '- Required for this topic: ask the API library vs runnable application vs mixed-deliverable boundary explicitly.\\n'\n : ''}\n\n[Hard constraint] The implementation stack is already fixed by XCompiler config / the existing project baseline. Do not reopen language/runtime/package-manager decisions.\n**Do NOT** ask questions of these forms:\n - \"Which programming language / framework / runtime should this use?\"\n - \"Which test framework / build tool / package manager?\"\n - \"Which OS is the target platform?\"\n${opts.intent && opts.intent !== 'greenfield'\n ? `This is an incremental ${opts.intent} request against an existing project${opts.hasBaseline ? ' with a separate baseline summary that will be provided during decomposition' : ''}. Ask ONLY delta questions; do not ask to rebuild the project from scratch.`\n : ''}The majority of questions must concern functional behaviour; performance, boundaries, and extensibility should eliminate ambiguities that affect this delivery.`,\n plannerDecompose: (raw, qa, addenda, opts = {}) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over any vague parts of the original):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate an incremental ${opts.intent} plan on top of the existing project. Reuse the current architecture, files, tests and dependencies where possible instead of rebootstrapping the whole project. Outside the requested change, preserve existing behaviour.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}Planning depth rules:\n- Unless the request is explicitly tiny (single function / toy script / one-file utility), do not collapse the solution into one source file and one test.\n- If the requirement spans multiple concerns (domain logic, API/CLI surface, persistence, integration, orchestration, tests), reflect that with multiple architecture modules and Step.subTasks under CODE/MODULE_TEST macro Steps.\n- Assess project complexity in the plan and size implementationPhases from that assessment: simple => P1 current only; moderate => P1 current + at least P2 planned; complex => P1 current + at least P2/P3 planned. If the user explicitly requested phases/stages, use at least P1+P2 and set userForcedPhaseSplit=true. Every current/planned implementation phase must be represented by a full V-model cycle in steps, with Step.iterationId pointing to that phase.\n- Use HIGH_LEVEL_DESIGN/DETAILED_DESIGN steps to describe module boundaries, responsibilities, dependencies, and extension points that future incremental work can build on.\n- When baseline files already exist, prefer editing/extending those modules over creating shadow implementations with duplicate behaviour.\n\nOutput a strict JSON plan per the system rules.`,\n plannerPhasePlan: (raw, qa, addenda, opts = {}) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over vague original wording):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate a PhasePlan on top of the existing project. Reuse current architecture, files, tests, and dependencies where possible. Preserve existing behaviour outside the requested change.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}First generate only the high-level PhasePlan:\n- Assess complexity and choose phase count: simple => P1 current only; moderate => P1 current + at least P2 planned; complex => P1 current + at least P2/P3 planned.\n- P1 objective must be an independently deliverable and verifiable core slice.\n- P2/P3 should contain only future enhancement goals, scope, deliverables, and verification gates. Do not expand any V-model Step.\n- Every phase verificationGate must say failures are fed to Debugger, rolled back to the paired V-model phase, and followed by rerunning subsequent phases.\n- Return only PhasePlan JSON. Do not include steps, architectureModules, or dependencies.`,\n plannerPhaseDecompose: (raw, qa, addenda, opts) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over vague original wording):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate the current phase's incremental V-model StepPlan on top of the existing project. Reuse current architecture, files, tests, and dependencies where possible.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}Frozen PhasePlan:\n\"\"\"\n${opts.phasePlan}\n\"\"\"\n\nPhase to expand now: ${opts.phaseId}\n\nReturn a full V-model StepPlan only for ${opts.phaseId}:\n- Every Step.iterationId must equal \"${opts.phaseId}\".\n- Do not output Steps for any other planned phase; P2/P3 detailed plans are generated only when they become the current phase.\n- If ${opts.phaseId} spans multiple concerns (domain logic, CLI/API, file I/O, external integration, orchestration, tests), declare architectureModules for this phase and map module-level work under CODE/MODULE_TEST subTasks.\n- architectureModules.sourcePaths may only contain product source files under src/. Do not register tests/fixtures, tests/utils, sample files, directories, or docs as architecture modules.\n- dependencies contains only packages required by this phase; Python must include pytest; never output requirements.txt.\n- This phase must contain the canonical eight V-model macro Steps and synchronous paired test-design outputs.\n\nReturn strict JSON StepPlan for the current phase only.`,\n executorSystem: (p) => buildExecutorSystem(p),\n executorDebugBlock: (reason: string, suggestions?: string) =>\n `\\n\\nYou are now in DEBUG retry mode. Previous failure reason: ${reason}\\n` +\n 'DEBUG may edit upstream source files and tests within the current allowedWrites. If the failure reveals a real implementation, contract, or downstream integration mismatch, fix that real defect; do not pass by weakening assertions, skipping tests, deleting failing cases, or merely accommodating an incorrect test. ' +\n 'If this rollback is in a design/requirements step and the concrete code change belongs to a later V-model step outside the current allowedWrites, update the current contract, test plan, or diagnostic artifact and finish this step so the later CODE step can implement it; do not attempt denied writes. ' +\n 'If the failure is a missing third-party dependency or wrong library choice, use add_dependency with the real package name or change the source back to the real library selected by HIGH_LEVEL_DESIGN; never add try/except ImportError fake modules, fake classes/functions, empty implementations, or fallback mocks in production src/ code to bypass the error. ' +\n 'Begin with read_file / code_search to localise the issue, then make the smallest possible fix via apply_patch / replace_in_file / add_dependency, and finally run_tests to verify. ' +\n 'A DEBUG retry cannot be marked complete from read-only inspection alone: it must produce a successful repair action or a successful verification command in this retry. ' +\n 'If the previous failure reason mentions repeated read-only/probe actions, use the existing failure log as sufficient context and make the next action a patch/write/dependency change or a verification command. ' +\n 'When a test executes and fails an assertion about returned behaviour, do not repeatedly rewrite fixtures or samples. Only edit fixtures when the evidence is missing-file, malformed-fixture, or parse-error in the fixture itself; otherwise patch the implementation, interface contract, dependency choice, or test expectation that is actually wrong. ' +\n 'If the failure log shows a network/API failure, do not stop at probing endpoints: use at most two consecutive http_fetch probes, reject 2xx responses with empty or unusable bodies, then patch the real integration and verify with run_program plus run_tests. Do not set done=true while the entrypoint still reports a network/API failure.' +\n (suggestions ? `\\n\\n${suggestions}` : ''),\n executorGlobalBlock: (globalPrompt: string) => `\\n\\n## Project-wide constraints\\n${globalPrompt}`,\n executorStepBlock: (sp: string) =>\n `\\n\\n## Current Step prompt (sole mission — do not drift across steps)\\n${sp}`,\n executorUserPromptOutro: 'Now return the first round of JSON per the protocol.',\n executorFeedbackHeader: 'Tool results this round:',\n executorFeedbackVerifyOk:\n 'outputs verified. If you are done, set done=true and actions=[].',\n executorFeedbackVerifyMissing: (paths: string) =>\n `outputs still missing: ${paths}. Please continue.`,\n executorFeedbackReadOnlyLoopWarning: (rounds: number, targets: string) =>\n `Loop guard warning: the last ${rounds} round(s) used only read/probe tools` +\n (targets ? ` (${targets})` : '') +\n '. Next response must include a successful repair action (apply_patch / replace_in_file / write_file / add_dependency) or a concrete verification action (run_tests / run_program). Do not continue with only read_file, list_dir, code_search, or http_fetch.',\n executorFeedbackReadOnlyRecoveryRequired:\n 'Read-only recovery mode is active because the previous attempt already failed from probing. The next response must use existing failure evidence to patch/write/change dependency or run verification; one more read-only-only response will fail this retry.',\n executorFeedbackRepairEvidenceMissing:\n 'Invalid DEBUG completion: this retry has not produced repair evidence yet. Before done=true, perform at least one successful repair action or successful verification run; otherwise stop only with a concrete blocker in thoughts.',\n },\n skills: {\n patcher: 'Use apply_patch / replace_in_file for small in-place edits to existing files; never overwrite a whole file.',\n author: 'Use write_file to create new files; prefer paths inside the current Step writable allowlist.',\n tester:\n 'Write and run pytest tests verifying function behaviour; on failure parse with analyze_error. ' +\n '[Self-contained fixtures] Tests **must NOT** open() a sample file that does not exist on disk. ' +\n 'When the target function needs file input, first reuse a real user/workspace sample; if none exists, use http_fetch to get a small reference sample from official docs, the upstream repository, or a public standard/example, ' +\n 'save it under tests/fixtures/<name>, and record the source. Only for simple text formats such as CSV/JSON/INI may you construct a minimal pytest tmp_path sample and immediately run_tests. ' +\n 'Test/DEBUG phases already grant write permission to tests/fixtures/, sub-dirs are auto-mkdir\\'d, and **fixture paths do NOT need to be pre-declared in outputs**. ' +\n 'When generating tests, always emit every dependent resource so the Debugger does not loop on FileNotFoundError. ' +\n '[Fixture iteration] If a running test raises \"Invalid syntax / Parse error / Malformed\" from the target function, ' +\n 'your fixture content does not match the format spec: read_file to inspect, then prefer a user sample or authoritative http_fetch reference before rewriting and running tests. ' +\n 'After repeated failures on a complex domain format, stop inventing from memory and ask for a user sample or network reference. Never edit the implementation or assertions to \"fix\" a parse error.',\n dep_resolver: 'On ModuleNotFoundError, use add_dependency to write the package back into requirements.txt and rebuild the sandbox.',\n debugger:\n 'First run_tests / run_python to reproduce the error → analyze_error → patch / replace_in_file / add_dependency to fix → run_tests again. Make the smallest possible change each round. ' +\n '[Missing dependencies] Add the real dependency or use the real library selected by the design; never fake modules/classes/functions, empty implementations, or fallback mocks in production src/ code. ' +\n '[Fixture discipline] If tests fail with behavioural assertions, do not keep rewriting fixtures. Only change fixtures for clear missing-file, malformed-fixture, or fixture parse errors; otherwise fix source code, contracts, dependencies, or the incorrect assertion. ' +\n '[Network/API failures] Locate the failing URL, try only a small number of replacement API probes, then patch the source and run_program to prove the entrypoint no longer emits API failure. ' +\n '[Important] If replace_in_file on the same file fails ≥ 2 times in a row, switch to read_file and then patch or rewrite within the current runtime chunk limit; stop guessing the find string. ' +\n '[No no-ops] replace_in_file find and replace must differ — if you only want to \"verify\" a snippet, use read_file; do not submit identical-string replacements.',\n refactorer: 'Refactors must preserve behaviour: run regression tests → modify → run regression tests again.',\n },\n doctor: {\n cliDescription: 'check that config / LLM / sandbox / skills are ready',\n optStrict: 'treat warnings as failures (exit non-zero on any warn)',\n header: 'XCompiler environment check',\n sectionConfig: '[config]',\n sectionLLM: '[LLM]',\n sectionSandbox: '[sandbox]',\n sectionSkills: '[skills]',\n summaryOk: 'all checks passed.',\n summaryWarn: (n) => `passed with ${n} warning(s).`,\n summaryFail: (n) => `${n} failure(s) detected.`,\n configLoadOk: (path) => `config loaded: ${path}`,\n configLoadFail: (msg) => `failed to load config: ${msg}`,\n configLocale: (locale) => `locale=${locale}`,\n llmNoProviders: 'no LLM providers defined in config.llm.providers',\n llmProviderListed: (n) => `${n} provider(s) declared`,\n ollamaUnreachable: (baseUrl, msg) => `ollama unreachable @ ${baseUrl} — ${msg}`,\n ollamaReachable: (baseUrl, n) => `ollama reachable @ ${baseUrl} (${n} model(s))`,\n ollamaModelMissing: (provider, model, baseUrl) =>\n `provider \"${provider}\": model \"${model}\" NOT installed on ${baseUrl} (run \\`ollama pull ${model}\\`)`,\n ollamaModelOk: (provider, model) => `provider \"${provider}\": model \"${model}\" available`,\n openaiKeyMissing: (provider) => `provider \"${provider}\": api_key empty (set the provider env var such as OPENROUTER_API_KEY, or config.llm.providers.${provider}.api_key)`,\n openaiReachable: (provider, baseUrl) => `provider \"${provider}\": OpenAI endpoint reachable @ ${baseUrl}`,\n openaiUnreachable: (provider, baseUrl, msg) => `provider \"${provider}\": OpenAI endpoint unreachable @ ${baseUrl} — ${msg}`,\n openaiModelListMissing: (provider, model) =>\n `provider \"${provider}\": model \"${model}\" not in /models response (it may still work if your account has access)`,\n providerScoreZero: (provider) => `provider \"${provider}\" disabled (score=0)`,\n roleNoLiveProvider: (role) => `role \"${role}\" has no live provider (no candidate is reachable & enabled)`,\n roleOk: (role, provider) => `role \"${role}\" → ${provider}`,\n sandboxKind: (kind) => `sandbox=${kind}`,\n sandboxNetworkPolicy: (policy, ports) =>\n `network=${policy}` + (ports.length ? ` (expose_ports=[${ports.join(', ')}])` : ''),\n sandboxFullNoPorts:\n 'network=full but no expose_ports configured — host-side cannot reach container services. ' +\n 'Add `agent.sandbox_limits.expose_ports: [<port>]` in config.yaml.',\n sandboxNodeMissing: 'node not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNodeOk: (version) => `node OK (${version})`,\n sandboxNpmMissing: 'npm not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNpmOk: (version) => `npm OK (${version})`,\n sandboxNpxMissing: 'npx not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNpxOk: (version) => `npx OK (${version})`,\n sandboxPythonMissing: 'python3 not found on PATH (required by subprocess sandbox)',\n sandboxPythonOk: (version) => `python3 OK (${version})`,\n sandboxVenvMissing: 'python3 venv module unavailable (install python3-venv / python3-virtualenv)',\n sandboxVenvOk: 'python3 venv module OK',\n sandboxDockerMissing: (bin) => `docker binary \"${bin}\" not found on PATH`,\n sandboxDockerOk: (version) => `docker OK (${version})`,\n sandboxDockerDaemonDown: (msg) => `docker daemon not reachable: ${msg}`,\n sandboxInContainerWarn:\n 'XCompiler appears to be running inside a container; sandbox=docker is unsupported in this mode (use subprocess).',\n skillToolMissing: (skill, tool) => `skill \"${skill}\" references unknown tool \"${tool}\"`,\n skillOk: (n, tools) => `${n} skill(s) registered, ${tools} underlying tool(s)`,\n },\n};\n\nexport default messages;\n","import type { LanguageProfile } from '../core/language.js';\nimport type { Messages } from './types.js';\n\nconst PYTHON_PLANNER_SYSTEM = `你是 XCompiler 系统的 Planner。你的任务是把用户的自然语言需求编译成严格的“迭代模型 + V 模型”Step 计划。\n\n输出语言:仅 Python (plan.language 固定为 \"python\")。\n\n每个可执行迭代周期必须使用标准 V 模型流程:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\nDEBUG 不是正常 V 模型阶段,只是运行时失败回退/修复模式。任意测试阶段失败时,XCompiler 会回退到该测试对应的左侧阶段开始 Debugger 修复,并重新执行后续 V 模型动作。\n\n阶段文档:\n| Phase | 必须输出文件 |\n|---|---|\n| REQUIREMENT_ANALYSIS | \\`docs/01-requirement-analysis.md\\` |\n| HIGH_LEVEL_DESIGN | \\`docs/02-high-level-design.md\\` |\n| DETAILED_DESIGN | \\`docs/03-detailed-design.md\\` |\n| UNIT_TEST | \\`docs/05-unit-test.md\\` |\n| INTEGRATION_TEST | \\`docs/06-integration-test.md\\` |\n| MODULE_TEST | \\`docs/07-module-test.md\\` |\n| FUNCTIONAL_TEST | \\`docs/08-functional-test.md\\` |\n\nP2+ 迭代把同名阶段文档写入 \\`docs/iterations/<iterationId>/\\`。顶层 \\`docs/topic.md\\` 由 xcompiler build 写入,任何 Step 都不得把它列为 outputs。\n\n同步测试设计规则:\n- REQUIREMENT_ANALYSIS 同步输出 \\`docs/tests/functional-test-plan.md\\`。\n- HIGH_LEVEL_DESIGN 同步输出 \\`docs/tests/module-test-plan.md\\`。\n- DETAILED_DESIGN 同步输出 \\`docs/tests/integration-test-plan.md\\`。\n- CODE 同步输出 \\`docs/tests/unit-test-plan.md\\`。\nP2+ 迭代把这些测试计划写到 \\`docs/iterations/<iterationId>/tests/\\`。\n\n阶段职责:\n- REQUIREMENT_ANALYSIS 定义功能范围、验收标准、边界条件和用户可见行为。\n- HIGH_LEVEL_DESIGN 负责架构设计,说明当前开发模块在整体系统中的定位,并定义系统层面的对外接口和依赖,包括外部 API、第三方库选型、依赖确认、数据契约和集成边界。\n- DETAILED_DESIGN 定义模块内部的具体功能实现和架构,包括函数/类、数据结构、算法、控制流、错误处理和内部协作。\n- CODE 只实现已设计范围并产出可运行/可导入的 Python 源码。\n- UNIT_TEST 验证 CODE 的内部函数和公开 API。\n- INTEGRATION_TEST 验证 DETAILED_DESIGN 中定义的模块内部协作、数据流和组件集成。\n- MODULE_TEST 验证 HIGH_LEVEL_DESIGN 中当前开发模块在整体系统中的定位、对外接口和依赖边界。\n- FUNCTIONAL_TEST 按需求端到端验收,并产出面向用户的文档。\n\n功能验收文档包:P1 FUNCTIONAL_TEST outputs 必须包含 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`;当 \\`projectType\\` 为 \\`library\\` 或 \\`mixed\\` 时还必须包含 \\`docs/api-guide.md\\`。P2+ 使用 \\`docs/iterations/<iterationId>/08-functional-test.md\\`、\\`quickstart.md\\` 和可选 \\`api-guide.md\\`。文档语言遵循当前 i18n。\n\n强制规则:\n1. 只返回纯 JSON,禁止 Markdown 代码块和解释文字。\n2. 每个 current/planned implementation phase 都是完整 V 模型迭代,必须包含上述 8 个标准阶段。禁止输出旧阶段 REQUIREMENT、ARCH、TASK、TEST、REFACTOR、DELIVERY。\n3. 每个宏 Step 的 \\`subTasks\\` 最多嵌套 2 层;不要为了内部细节拆出大量可执行 Step。\n4. dependsOn 必须按阶段顺序且无环。右侧测试阶段必须直接或间接依赖其对应左侧阶段。\n5. 每个 CODE Step 必须被同迭代的 UNIT_TEST Step 覆盖。\n6. 需求/设计阶段不得输出 src/ 或 tests/ 文件;CODE 产出 src/;测试阶段产出 tests/ 和报告文档;FUNCTIONAL_TEST 不得修改 src/。\n7. outputs 路径全局唯一。DEBUG 运行时可修改依赖链文件,计划 Step 不要重复声明 outputs。\n8. id 形如 S001、S002;role 只能是 Planner / Architect / Coder / Tester / Debugger。\n9. 每个 Step 必须有 systemPrompt,明确范围、输入、产出、验收、禁令,以及左侧阶段的同步测试设计义务。\n10. projectType 由 LLM 在澄清后判定:application / library / mixed,不存在命令行 project-type 覆盖。\n11. complexityAssessment 由 plan 阶段评估:simple => P1;moderate => 至少 P1+P2;complex => 至少 P1+P2+P3。用户明确要求分阶段时必须 userForcedPhaseSplit=true。\n12. implementationPhases 必须包含 P1 current 和后续 planned 可执行迭代;verificationGate 的 failurePolicy 必须说明把失败日志传给 Debugger,回退到对应 V 模型阶段并重新执行后续阶段。\n13. dependencies 是 Python pip 依赖列表;必须包含 \\`pytest\\`;只写裸包名;任何 Step 都不要输出 \\`requirements.txt\\`。\n14. application/mixed 项目需要可直接运行的 Python 入口(\\`src/main.py\\` 或包 \\`__main__.py\\`)并复用 CODE 模块;library/mixed 项目需要稳定公开 API 和 \\`docs/api-guide.md\\`。\n15. 复杂需求必须返回 \\`architectureModules\\`:每个模块包含 id、name、responsibility、sourcePaths、testPaths、dependencies。CODE/MODULE_TEST Step 可覆盖多个模块,但必须在 subTasks 中列出模块级工作。\n16. 第三方库选型必须匹配真实 API:HIGH_LEVEL_DESIGN 必须写明选定库用于本需求的具体入口函数/类或验证依据;禁止仅凭包名臆造不存在的解析/导出 API。\n\n输出 JSON 形如:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"核心功能\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"run tests\", \"probe entrypoint/API\", \"verify functional docs\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ],\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"模块名\", \"responsibility\": \"单一且明确的模块职责\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n {\n \"id\": \"S001\",\n \"iterationId\": \"P1\",\n \"phase\": \"REQUIREMENT_ANALYSIS\",\n \"title\": \"string\",\n \"description\": \"string\",\n \"systemPrompt\": \"本 Step 专属提示:范围、输入、产出、验收、禁令\",\n \"role\": \"Planner\",\n \"tools\": [\"write_file\"],\n \"inputs\": [\"docs/topic.md\"],\n \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"],\n \"subTasks\": [\n { \"id\": \"T1\", \"title\": \"string\", \"description\": \"string\", \"acceptance\": \"string\", \"outputs\": [\"docs/01-requirement-analysis.md\"], \"subTasks\": [] }\n ],\n \"dependsOn\": [],\n \"acceptance\": \"string\",\n \"maxRetries\": 3\n }\n ]\n}`;\n\nconst PYTHON_EXECUTOR_SYSTEM = `你是 XCompiler 的 Step Executor。你只能通过 JSON 工具调用与系统交互,禁止任何 Markdown 或解释性文本。\n\n每一轮你必须返回严格 JSON:\n{\n \"thoughts\": \"<用一句话说明本轮意图>\",\n \"actions\": [ { \"tool\": \"<工具名>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\n规则:\n1. 仅可调用本 Step 授权的工具白名单。\n2. 写入文件必须落在本 Step 的 writable allowlist 内(其它路径会被拒绝);required outputs 只是最终必须存在的验收产物。\n 对 FUNCTIONAL_TEST 文档产物,必须按当前 i18n 语言写完整声明的文档包:P1 路径如 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`,以及 outputs 中出现时的 \\`docs/api-guide.md\\`;P2+ 则写 outputs 声明的 \\`docs/iterations/<iterationId>/\\` 等价路径。任何已声明文档缺失时不得设置 done=true。\n3. 对生成代码遵循目标语言的最佳实践;模块可导入、函数应带合适的类型信息。\n - 【导入约定】src/ 下的模块互相 import 时使用 \"from <module> import ...\"(同级名称),\n **严禁写成 \"from src.<module> import ...\"**。如果 main.py 需要从项目根运行,\n 在 import 之前加一行:sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))),\n 以保证 \"python src/main.py ...\" 和 \"python -m src.main ...\" 两种调用都能走通。\n - 【测试约定】tests/ 下的文件同样以 \"from <module> import ...\" 导入被测模块;\n **XCompiler 已自动生成 tests/conftest.py 把项目根与 src/ 注入 sys.path**,\n 因此 pytest 与 \"python tests/test_*.py\" 两种执行方式都能解析模块,\n 测试文件头部**无需**再写 sys.path.insert(...),避免重复污染。\n 如果 LLM 自己额外创建/编辑 conftest.py,必须保留上面 sys.path 注入逻辑,禁止删除。\n - 【测试自包含】测试**严禁**直接 open() 一个磁盘上不存在的样例文件(如 \"sample.csv\");\n 当被测函数需要文件输入时,必须按优先级选择:\n (a) 优先复用用户或工作区已提供的真实样例,用 read_file 读取后复制/引用到 tests/fixtures/<name>;\n (b) 若是第三方/行业标准格式且工作区无样例,用 http_fetch 获取官方文档、上游仓库或公开标准中的小型参考样例,\n 保存到 tests/fixtures/<name>,并在测试报告或注释中记录来源;\n (c) 只有 CSV/JSON/INI 等简单文本格式,且能立刻 run_tests 验证时,才可在 pytest tmp_path 中构造最小样例。\n 网络不可用、用户未提供样例且无法确认格式标准时,应明确报告 blocker 请求用户提供样例。\n 绝不允许出现\"测试代码引用了一个谁都没创建的文件\"——这会让 Debugger 反复 FileNotFoundError 死循环。\n - 【fixture 迭代】当测试已经能运行但被测函数报\"Invalid syntax / Parse error / Malformed\"等解析失败错误,\n 说明 fixture 文件本身格式不合法,**不是被测代码的 bug**。\n 必须 read_file 看清当前 fixture 内容,按扩展名/解析库确认格式标准;优先使用用户样例或 http_fetch 下载的权威参考样例,\n 再 write_file 整文件重写并 run_tests。复杂领域格式连续失败后必须停止凭记忆生成,改为请求用户样例或网络参考。\n 严禁因为解析错误就去改被测模块、测试断言或 mock 掉解析逻辑——先把 fixture 修对再说。\n4. 当所有 outputs 文件均已生成且自检通过,把 done 设为 true 且 actions 为空。\n5. 任何错误都通过下一轮的 actions 修正;不要尝试越权或捏造工具。\n6. 【大文件拆块写入】write_file / append_file 单次 content 必须低于工具文档展示的当前 Step 运行时 chunk limit。\n - 超过时请拆分:同一轮 actions 里先一个 write_file 写首段(import + 顶层常量 + 第一个函数/类),\n 紧跟多个 append_file 逐段追加(按函数/类边界切块,每段收尾保留换行)。\n - 复杂工程优先拆成多个内聚模块/文件,并用独立 CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Step 增量推进,不要写一个巨型万能文件。\n - 拆分必须保证拼接后仓 Python 语法合法;严禁在函数体中间拆断。\n - 对已存在文件的局部修改使用 replace_in_file / apply_patch,不要重复覆盖整个文件。`;\n\nconst TYPESCRIPT_PLANNER_SYSTEM = `你是 XCompiler 系统的 Planner。你的任务是把用户的自然语言需求编译成严格的“迭代模型 + V 模型”Step 计划。\n\n输出语言:仅 TypeScript / Node.js(plan.language 固定为 \"typescript\")。\n\n每个可执行迭代周期必须使用标准 V 模型流程:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\nDEBUG 只是运行时失败回退/修复模式。任意测试阶段失败时,XCompiler 会回退到该测试对应的左侧阶段并重新执行后续阶段。\n\n沿用 Python Planner 的阶段文档和同步测试设计规则:\n- REQUIREMENT_ANALYSIS:\\`docs/01-requirement-analysis.md\\` + \\`docs/tests/functional-test-plan.md\\`。\n- HIGH_LEVEL_DESIGN:\\`docs/02-high-level-design.md\\` + \\`docs/tests/module-test-plan.md\\`。\n- DETAILED_DESIGN:\\`docs/03-detailed-design.md\\` + \\`docs/tests/integration-test-plan.md\\`。\n- CODE:实现产物 + \\`docs/tests/unit-test-plan.md\\`。\n- UNIT_TEST:\\`docs/05-unit-test.md\\`。\n- INTEGRATION_TEST:\\`docs/06-integration-test.md\\`。\n- MODULE_TEST:\\`docs/07-module-test.md\\`。\n- FUNCTIONAL_TEST:\\`docs/08-functional-test.md\\`、\\`README.md\\`、\\`docs/quickstart.md\\`,library/mixed 还要 \\`docs/api-guide.md\\`。\nP2+ 迭代把阶段文档写到 \\`docs/iterations/<iterationId>/\\`,测试计划写到 \\`docs/iterations/<iterationId>/tests/\\`。\n\nHIGH_LEVEL_DESIGN 必须说明当前开发模块在整体系统中的定位,并定义系统层面的对外接口和依赖,包括外部 API、第三方库选型、依赖确认、package.json scripts、dependencies/devDependencies、tsconfig、数据契约和集成边界。\nDETAILED_DESIGN 必须定义模块内部具体功能实现和架构,包括函数/类型、数据结构、算法、控制流、错误处理和内部协作。\n\n强制规则:\n1. 只返回纯 JSON。禁止输出旧阶段 REQUIREMENT、ARCH、TASK、TEST、REFACTOR、DELIVERY。\n2. 每个 current/planned implementation phase 都必须包含完整 8 阶段 V 模型。\n3. 每个宏 Step 的 \\`subTasks\\` 最多嵌套 2 层。\n4. 每个 CODE Step 必须被同迭代 UNIT_TEST 覆盖;architectureModules 的 testPaths 必须由 MODULE_TEST 产出。\n CODE outputs 只能包含 src/ 下的产品源码文件和 docs/tests/unit-test-plan.md;禁止把 tests/**/*.test.ts 或其他 tests/** 文件列为 CODE outputs。\n5. 设计阶段不得输出 src/ 或 tests/ 文件;HIGH_LEVEL_DESIGN 是唯一可输出 \\`package.json\\` / \\`tsconfig.json\\` 的阶段。\n6. TypeScript greenfield 计划必须且只能有一个 HIGH_LEVEL_DESIGN Step 输出 \\`package.json\\`,并确保 one HIGH_LEVEL_DESIGN Step output \\`package.json\\`,包含 \\`build\\`、\\`test\\`、最好还有 \\`lint\\` 脚本。\n7. 本地 TypeScript 源码模块必须使用带显式 \\`.ts\\` 后缀的 ESM 相对导入;配置 \\`allowImportingTsExtensions: true\\`,build/lint 使用 \\`tsc --noEmit\\`。代码必须兼容 Node 原生 type stripping,避免 enum、namespace、参数属性等需转译语法。\n8. dependencies 只是运行时 npm 包建议;真正依赖清单以 HIGH_LEVEL_DESIGN 产出的 \\`package.json\\` 为准,不要编造包名。\n9. application/mixed 需要 \\`src/main.ts\\` 且可直接 \\`node src/main.ts --help\\`;library/mixed 需要 \\`src/index.ts\\` 或等价公共 API 并写 API Guide。\n10. complexityAssessment 和 implementationPhases 规则同 Python:simple=>P1,moderate => 至少 P1+P2,complex => 至少 P1+P2+P3,用户强制分阶段时 userForcedPhaseSplit=true。\n11. verificationGate failurePolicy 必须说明把失败日志传给 Debugger,回退到对应 V 模型阶段并重跑后续阶段。\n12. 复杂需求返回 architectureModules;CODE/MODULE_TEST Step 可覆盖多个模块,但必须在 subTasks 中列出模块级工作。\n13. TypeScript 测试必须只使用 Vitest。Step prompt 或 package.json 中禁止要求 Jest、ts-jest、@types/jest、ts-node、nodemon;package.json 必须使用 \"test\": \"vitest run\" 和 \"build\": \"tsc --noEmit\"。\n\n输出 JSON 结构同 Python,必须包含 \\`\"projectType\": \"application | library | mixed\"\\`,路径使用 \\`src/example.ts\\` 和 \\`tests/example.test.ts\\`;第一个 Step phase 必须是 \\`REQUIREMENT_ANALYSIS\\`,不是 \\`REQUIREMENT\\`。不存在命令行 project-type 覆盖。`;\n\nconst TYPESCRIPT_EXECUTOR_SYSTEM = `你是 XCompiler 的 Step Executor。你只能通过 JSON 工具调用与系统交互,禁止任何 Markdown 或解释性文本。\n\n每一轮你必须返回严格 JSON:\n{\n \"thoughts\": \"<用一句话说明本轮意图>\",\n \"actions\": [ { \"tool\": \"<工具名>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\n规则:\n1. 仅可调用本 Step 授权的工具白名单。\n2. 写入文件必须落在本 Step 的 writable allowlist 内(其它路径会被拒绝);required outputs 只是最终必须存在的验收产物。\n 对 FUNCTIONAL_TEST 文档产物,必须按当前 i18n 语言写完整声明的文档包:P1 路径如 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`,以及 outputs 中出现时的 \\`docs/api-guide.md\\`;P2+ 则写 outputs 声明的 \\`docs/iterations/<iterationId>/\\` 等价路径。任何已声明文档缺失时不得设置 done=true。\n3. 生成代码必须符合 TypeScript / Node.js 最佳实践;API 要有类型,运行代码必须能直接执行。\n - 【导入约定】src/ 下的本地源码模块使用带显式 \".ts\" 后缀的 ESM 相对导入,例如 \\`import { x } from \"./util.ts\";\\`。代码必须兼容 Node 原生 TypeScript type stripping:只使用可擦除类型语法,避免 enum、namespace、参数属性等需要转译的 TS 特性。禁止使用 Python 风格 import、\\`from src.<module>\\` 或任何 sys.path hack。\n - 【测试约定】测试使用 Vitest:\\`import { describe, it, expect } from \"vitest\";\\`,测试文件放在 \\`tests/**/*.test.ts\\`。\n - 【测试自包含】测试**严禁**读取一个磁盘上不存在的样例文件;当被测函数需要文件输入时,要么在测试里构造内容,要么写入 \\`tests/fixtures/<name>\\`。\n - 【fixture 迭代】当测试已经能运行但被测函数报\"Invalid syntax / Parse error / Malformed\"等解析失败错误,说明 fixture 文件本身格式不合法。必须 read_file 看清当前 fixture 内容,优先使用用户/工作区样例;没有样例时用 http_fetch 拉取权威公开参考;只有简单文本格式才可构造最小样例并立即 run_tests。严禁因为解析错误去弱化实现或断言,也严禁反复凭记忆生成复杂格式 fixture。\n4. 当所有 outputs 文件均已生成且自检通过,把 done 设为 true 且 actions 为空。\n5. 任何错误都通过下一轮的 actions 修正;不要尝试越权或捏造工具。\n6. 【大文件拆块写入】write_file / append_file 单次 content 必须低于工具文档展示的当前 Step 运行时 chunk limit。\n - 超过时请拆分:同一轮 actions 里先一个 write_file 写首段(import + 顶层常量 + 第一个函数/类),紧跟多个 append_file 逐段追加。\n - 复杂工程优先拆成多个内聚模块/文件,并用独立 CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Step 增量推进,不要写一个巨型万能文件。\n - 拆分必须保证拼接后 TypeScript 语法合法;严禁在函数体中间拆断。\n - 对已存在文件的局部修改使用 replace_in_file / apply_patch,不要重复覆盖整个文件。\n7. package.json 是依赖清单。新增 npm 包要用 add_dependency,禁止去写 requirements.txt。\n8. run_program 会通过 \\`npx tsx\\` 运行入口,run_tests 会通过 \\`npm test\\` 跑 Vitest,最终交付门禁还会验证 direct Node 入口命令。`;\n\nfunction buildPlannerSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_PLANNER_SYSTEM : PYTHON_PLANNER_SYSTEM) + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhasePlanSystem(profile: LanguageProfile): string {\n return `你是 XCompiler 系统的 Planner,当前执行“两级规划”的第一步:PhasePlan。\n\n目标语言:${profile.displayName}。\n\n只输出项目级 PhasePlan,不输出 steps、architectureModules、dependencies 或任何单个 V 模型 Step。\n\nPhasePlan 必须完成:\n1. 判定 projectType:application / library / mixed。\n2. 判定 complexityAssessment:simple / moderate / complex,并说明 rationale。\n3. 生成 implementationPhases:P1 status=current;后续 P2/P3 status=planned。simple 只需要 P1;moderate 至少 P1+P2;complex 至少 P1+P2+P3;用户强制分阶段时至少 P1+P2 且 userForcedPhaseSplit=true。\n4. 每个 phase 必须包含 objective、scope、deliverables、dependsOn 和 verificationGate。\n5. planned phase 只记录目标和门禁,不能展开任何 Step。后续会基于单个 phase 另行生成完整 V 模型计划。\n\n只返回严格 JSON:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"核心功能\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"...\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ]\n}\n\n禁止输出 Markdown、解释文字、steps、src/test 文件清单。` + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhaseDecomposeSystem(profile: LanguageProfile): string {\n return `你是 XCompiler 系统的 Planner,当前执行“两级规划”的第二步:为指定 phase 生成完整 V 模型 StepPlan。\n\n目标语言:${profile.displayName}。\n\n你会收到已经冻结的 PhasePlan 和一个 phaseId。只允许为该 phaseId 生成 Step;planned phase 不得展开到本次 steps 中。\n\n每个当前 phase 必须使用完整标准 V 模型:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\n\n阶段职责:\n- REQUIREMENT_ANALYSIS 定义功能范围、验收标准、边界条件和用户可见行为,并同步输出功能测试计划。\n- HIGH_LEVEL_DESIGN 定义系统定位、外部接口、第三方库选型、依赖确认和集成边界,并同步输出集成测试计划。\n- DETAILED_DESIGN 定义模块内部函数/类、数据结构、算法、控制流、错误处理和内部架构,并同步输出模块测试计划。\n- CODE 只实现当前 phase 范围并同步输出单元测试计划。\n- UNIT_TEST / INTEGRATION_TEST / MODULE_TEST / FUNCTIONAL_TEST 分别验证对应左侧阶段。\n\n严格产物归属:\n- CODE outputs 只能包含 src/ 下的产品源码文件和单元测试计划文档;不得把 tests/** 文件放到 CODE outputs。\n- UNIT_TEST 拥有单元测试文件;INTEGRATION_TEST 拥有集成测试文件;MODULE_TEST 拥有 architectureModules.testPaths;FUNCTIONAL_TEST 拥有端到端/功能测试文件和交付文档。\n- TypeScript greenfield 必须且只能有一个 HIGH_LEVEL_DESIGN Step 输出 package.json,包含 scripts、dependencies、devDependencies。CODE 不得输出 package.json。\n- TypeScript package.json 只能使用 Vitest:\"test\": \"vitest run\",\"build\": \"tsc --noEmit\",devDependencies 包含 typescript/tsx/vitest/@types/node。禁止提及或要求 Jest、ts-jest、@types/jest、ts-node、nodemon。\n\n输出必须只包含当前 phase 的 dependencies、architectureModules 和 steps。复杂/多关注点任务必须用 architectureModules 表达当前 phase 的模块边界,并在 CODE/MODULE_TEST 的 subTasks 中映射模块级工作。每个 Step 的 subTasks 最多嵌套 2 层。\n\narchitectureModules 只能描述当前 phase 的产品/业务源码模块:\n- sourcePaths 必须是 src/ 下的目标语言源码文件,不能是目录,不能是 tests/、docs/、README、fixtures、utils 或报告文件。\n- testPaths 必须是 tests/ 下的目标语言测试文件,不能是目录。\n- 测试 fixtures、测试工具、领域样例输入、临时输出文件应放在对应测试 Step 的 outputs 或 subTasks 中,不得登记为 architectureModules。\n\n只返回严格 JSON:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"模块名\", \"responsibility\": \"单一明确职责\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n { \"id\": \"S001\", \"iterationId\": \"P1\", \"phase\": \"REQUIREMENT_ANALYSIS\", \"title\": \"string\", \"description\": \"string\", \"systemPrompt\": \"范围、输入、产出、验收、禁令\", \"role\": \"Planner\", \"tools\": [\"write_file\"], \"inputs\": [\"docs/topic.md\"], \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"], \"subTasks\": [], \"dependsOn\": [], \"acceptance\": \"string\", \"maxRetries\": 3 }\n ]\n}\n\n禁止输出未来 planned phase 的 Step;禁止输出 requirements.txt;禁止让需求/设计阶段写 src/tests;FUNCTIONAL_TEST 必须包含 README.md、docs/quickstart.md 和功能验收文档。` + profile.plannerPromptOverride;\n}\n\nfunction buildExecutorSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_EXECUTOR_SYSTEM : PYTHON_EXECUTOR_SYSTEM) + profile.executorPromptOverride;\n}\n\nconst messages: Messages = {\n llm: {\n coderDebuggerSameModel: (model, coderProvider, debuggerProvider) =>\n `模型配置建议:Coder(${coderProvider})和 Debugger(${debuggerProvider})当前都使用 ${model}。建议配置不同模型,让调试阶段获得独立的推理路径。`,\n invalidBaseUrl: (raw, fallback) => `[xcompiler] base_url 无效(${raw}),回退到 ${fallback}`,\n providerValidationFailed: (role, model) => `[${role}] provider ${model} 输出验证失败,切换到下一个`,\n providerCallFailed: (role, model) => `[${role}] provider ${model} 调用失败,切换到下一个`,\n scoreReadFailed: (p, message) => `读取 ${p} 失败:${message}`,\n scoreChanged: (provider, score, previous) => `评分(${provider})=${score}(原值 ${previous})`,\n scorePersistFailed: (message) => `持久化评分失败:${message}`,\n preflightOllamaReachable: (baseUrl, models) => `预检:Ollama ${baseUrl} 可达,发现 ${models} 个模型`,\n preflightOllamaUnreachable: (baseUrl, message) => `预检:Ollama ${baseUrl} 不可达:${message}`,\n preflightAutoAdded: (providers, roles) => `预检:自动增加 ${providers} 个 provider,覆盖角色 [${roles}]`,\n scoreFileHeader: '# XCompiler LLM provider 评分快照(由 ScoreStore 自动维护,请勿手工编辑)',\n scoreFileSemantics: '# 评分语义:默认 1.0;自动评分范围 0.1~1.0;tags: [cluster] 的 provider 默认 0.2~0.5,除非 llm.cluster_score_min/max 扩宽;失败 -0.5;成功 +0.1;只有用户配置 score=0 表示禁用。',\n },\n system: {\n configEnvMissing: (names) => `[xcompiler] 配置中的环境变量未设置,已替换为空字符串:${names}`,\n unhandledError: (message) => `未处理错误:${message}`,\n unsupportedPypiOnlyNetwork:\n '拒绝 network=pypi-only:Docker 本身无法可靠执行“仅 PyPI”域名白名单。需要隔离请使用 network=off;明确允许任意出站下载时使用 network=download-only。',\n dockerInsideContainerUnsupported:\n '检测到 XCompiler 运行在容器内,sandbox=docker 可能导致 bind-mount 路径及 docker.sock 权限错位,因此不受支持。请使用 agent.sandbox=subprocess、改在宿主机运行,或仅在受控环境设置 XC_IN_CONTAINER=0。',\n firejailUnsupported: '尚未实现 sandbox=firejail,请使用 subprocess 或 docker。',\n smokeHeader: (baseUrl) => `正在对 ${baseUrl} 执行流式冒烟测试`,\n smokeOk: (model, totalMs, firstTokenMs, chunks, preview) =>\n `[成功 总耗时=${totalMs}ms 首Token=${firstTokenMs}ms 分块=${chunks}] ${model} -> ${preview}`,\n smokeFail: (model, message) => `[失败] ${model} -> ${message}`,\n },\n plugins: {\n invalidId: (id) => `插件 ID“${id}”无效;仅允许小写字母、数字、点、连字符或下划线。`,\n duplicateId: (id) => `插件 ID 重复:${id}`,\n invalidVersion: (plugin, version) => `插件 ${plugin} 的版本不是有效 SemVer:${version}`,\n invalidCoreVersion: (version) => `XCompiler 核心版本不是有效 SemVer:${version}`,\n apiVersionMismatch: (plugin, actual, expected) => `插件 ${plugin} 面向 Plugin API ${actual},当前 XCompiler 运行时要求 API ${expected}。`,\n invalidMinimumVersion: (plugin, version) => `插件 ${plugin} 声明的最低 XCompiler 版本无效:${version}`,\n coreVersionTooOld: (plugin, minimum, actual) => `插件 ${plugin} 要求 XCompiler >= ${minimum},当前版本为 ${actual}。`,\n loaded: (plugin, version) => `插件 ${plugin}@${version} 已加载。`,\n extensionConflict: (plugin, kind, name) => `插件 ${plugin} 不能覆盖已有 ${kind} “${name}”。`,\n hookFailed: (plugin, stage, message) => `插件 ${plugin} 在 ${stage} 阶段执行失败:${message}`,\n manifestReadFailed: (path, message) => `无法读取插件清单 ${path}:${message}`,\n moduleLoadFailed: (plugin, path, message) => `无法从 ${path} 加载插件 ${plugin}:${message}`,\n exportInvalid: (plugin, exportName) => `插件 ${plugin} 的导出 ${exportName} 不是有效 XCompiler 插件`,\n manifestMismatch: (plugin) => `插件 ${plugin} 的运行时清单与预检清单不一致`,\n },\n audit: {\n processLogTitle: '# XCompiler 开发过程记录',\n processLogPreamble: '> 由 XCompiler 自动生成,记录 CLI 会话、用户输入、LLM 交互与执行动作,用于交付追踪。',\n sessionStart: (ts, command) => `## ▶ 会话 ${ts} — \\`${command}\\``,\n sessionEnd: (ts) => `### ◀ 会话结束 ${ts}`,\n eventSessionStart: (command) => `启动 ${command}`,\n eventSessionEnd: (command) => `结束 ${command}`,\n userInput: (label) => `#### 👤 用户输入 — ${label}`,\n llmRequest: (role, model) => `🤖 LLM 请求 — <code>${role}</code> 使用 <code>${model}</code>`,\n llmResponse: (role, model) => `📩 LLM 响应 — <code>${role}</code> 使用 <code>${model}</code>`,\n executorTurn: (stepId, round, role, provider, actions, done) =>\n `🧠 执行轮次 — <code>${stepId}</code> 第 ${round} 轮 / 角色 <code>${role}</code>${provider ? ` · 使用 <code>${provider}</code>` : ''}(actions=${actions}, done=${done})`,\n thoughtsLabel: '**思考:**',\n actionsLabel: '**动作:**',\n noThoughts: '(无思考内容)',\n plannerThought: (stage, provider) => `🧩 Planner 思考 — ${stage}${provider ? ` · 使用 <code>${provider}</code>` : ''}`,\n markdownAppendFailed: (message) => `[audit] Markdown 追加失败:${message}`,\n jsonlAppendFailed: (message) => `[audit] JSONL 追加失败:${message}`,\n traceLine: (kind, message) => `[audit] ${kind} ${message}`,\n autoFixedSrcImport: (p) => `已自动修复 ${p} 中的 src import`,\n wroteFile: (p) => `已写入 ${p}`,\n userDecision: (label, value) => `${label} → ${value}`,\n eventLlmRequest: (role, model) => `${role} → ${model}`,\n eventLlmResponse: (role, model) => `${role} ← ${model}`,\n eventLlmError: (role, model, message) => `${role} 使用 ${model}:${message}`,\n eventExecutorTurn: (stepId, round, role, provider) => `${stepId} 轮次=${round} 角色=${role}${provider ? ` 使用 ${provider}` : ''}`,\n eventPlannerThought: (stage, provider) => `Planner ${stage}${provider ? ` 使用 ${provider}` : ''}`,\n llmChatFailedThought: (message) => `LLM 调用失败:${message}`,\n llmChatAborted: (stepId, round, chars, message) => `${stepId} 第 ${round} 轮在收到 ${chars} 字符后中止:${message}`,\n toolDenied: (tool) => `拒绝调用工具 ${tool}`,\n toolCalled: (tool) => `调用工具 ${tool}`,\n toolResult: (tool, ok, detail) => `工具 ${tool}${ok ? '执行成功' : '执行失败'}:${detail}`,\n documentArchived: (from, to) => `已归档 ${from} → ${to}`,\n documentArchiveFailed: (p, message) => `归档 ${p} 失败:${message}`,\n httpFetchSaved: (method, url, p, bytes) => `http_fetch ${method} ${url} → ${p}(${bytes} 字节)`,\n httpFetchResponse: (method, url, status, bytes) => `http_fetch ${method} ${url} → ${status}(${bytes} 字节)`,\n partialFailureHeader: (message) => `# LLM 调用失败:${message}`,\n streamLength: (chars) => `# 流式响应长度:${chars} 字符`,\n },\n stream: {\n resolvingModel: '正在解析模型',\n waiting: '等待响应',\n streaming: '流式响应',\n done: '完成',\n failed: '失败',\n chars: (n) => `${n} 字符`,\n toolRunner: '本地工具',\n toolExecution: (stepId, tool) => `${stepId} 工具 ${tool}`,\n },\n sandboxLog: {\n subprocessBuilt: (deps) => `子进程沙箱已构建(${deps ? '含依赖' : '空环境'})`,\n subprocessNodeBuilt: 'Node 子进程沙箱已构建(npm install)',\n dockerBuilt: (deps) => `Docker 沙箱已构建(${deps ? '含依赖' : '空环境'})`,\n dockerNodeBuilt: 'Docker Node 沙箱已构建(npm install)',\n command: (runtime, command) => `${runtime} ${command}`,\n },\n cli: {\n rootDescription: 'XCompiler — AI Software Factory CLI',\n compileDescription: '交互式编译需求为 phasePlan.json 与当前阶段计划(含强制人工确认)',\n runDescription: '执行已确认的 phasePlan.json(支持分阶段运行:--phase / --from)',\n loadDescription: '加载 XXX.xc 工程文件并继续当前 plan',\n appendDescription: '在已有 XXX.xc 工程基础上追加新需求,并重新走澄清与 V 模型执行',\n lsDescription: '扫描 workspace 列出所有 phasePlan.json / 历史 plan.json 状态摘要',\n showDescription: '打印 Step 定义 / 状态 / 产物 / 最近审计',\n optWorkspace: 'workspace 目录(同 --output,默认为当前目录)',\n optOutput: '工程/workspace 输出目录(优先级最高,等价于 -w)',\n optConfig: 'config.yaml 路径',\n optInput: '从需求文件读取(非交互)',\n optTopic: '直接使用已澄清的 topic.md 作为输入:跳过 intake / clarify / Addenda / Gate 1,直接进入 decompose',\n optPlanOut: '指定 phasePlan.json 输出文件(默认 <workspace>/phasePlan.json)',\n optBaseDir: '项目输出根目录(在其下创建 <name> 子目录)',\n optName: '项目名(默认 xcompiler-<时间戳>)',\n optYes: '跳过人工确认(仅在 -i / -t 提供时有意义)',\n optForce: '强制重新生成:覆写 workspace 锁、忽略旧计划文件',\n optDryRun: '仅打印拓扑顺序,不执行',\n optFrom: '从指定 Step 开始(之前的跳过)',\n optPhase: '仅执行指定 phase(REQUIREMENT_ANALYSIS/HIGH_LEVEL_DESIGN/DETAILED_DESIGN/CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST/DEBUG)',\n optReset: '重置所有 Step 状态为 PENDING',\n optMaxDepth: '递归最大深度',\n optTail: '最近审计条数',\n optPlan: 'phasePlan.json 路径,默认 <workspace>/phasePlan.json',\n optLang: 'UI / 提示词语言:EN | CN(ISO 3166-1 Alpha-2)',\n optIntent: '计划意图:greenfield | feature | refactor | self',\n optBaselinePlan: '已有基线 phasePlan.json / plan.json 路径(默认 <workspace>/phasePlan.json)',\n optProjectFile: 'XXX.xc 工程文件路径(默认 <workspace>/<name>.xc)',\n argPlan: 'phasePlan.json 或历史 plan.json 路径(默认 = <workspace>/phasePlan.json)',\n argProjectFile: 'XXX.xc 工程文件',\n argStepId: 'Step ID,如 S001',\n evolveDescription: '在现有 workspace 基础上生成并执行增量 feature/refactor 计划',\n bootstrapDescription: '在隔离 Git worktree 中构建并验证下一代 XCompiler',\n optRepository: '要执行自举的 XCompiler Git 仓库(默认当前目录)',\n optPromote: '全部质量门通过后,快进合并到当前分支',\n optCleanup: '写入报告后删除隔离 worktree(保留候选分支)',\n optDockerQualification: '使用尚处于实验阶段的 Docker 环境执行候选质量门',\n invalidLocale: (value) => `不支持的语言“${value}”,请使用 EN 或 CN。`,\n invalidIntent: (value, allowed) => `无效 intent“${value}”,可选值:${allowed}。`,\n invalidPhase: (value, allowed) => `无效阶段“${value}”,可选值:${allowed}。`,\n invalidStepId: (value) => `无效 Step ID“${value}”,格式应为 S 加至少三位数字。`,\n invalidNonNegativeInteger: (value) => `参数必须是非负整数,当前值为“${value}”。`,\n helpUsage: '用法:',\n helpArguments: '参数:',\n helpOptions: '选项:',\n helpCommands: '命令:',\n helpOption: '显示命令帮助',\n versionOption: '输出版本号',\n defaultValue: (value) => `(默认值:${value})`,\n },\n bootstrap: {\n notGitRepository: (p) => `不是 Git 仓库:${p}`,\n dirtyRepository: (files) => `功能自举要求宿主仓库保持干净,待处理路径:${files}`,\n worktreeReady: (p, branch) => `自举 worktree 已就绪:${p}(${branch})`,\n compileStarted: '正在编译自举 V 模型计划…',\n compileFailed: (code, message) => `自举计划编译失败(exit=${code}):${message}`,\n compileCancelled: '自举计划尚未确认,已取消执行。',\n executeStarted: '正在隔离 worktree 中执行候选版本…',\n executeFailed: (status) => `候选版本执行未成功完成(${status})。`,\n qualificationStarted: '正在执行确定性自举质量门…',\n qualificationDockerExperimental: 'Docker 质量门环境尚未完成验证,本次按显式选项以实验模式执行。',\n missingScript: (name) => `package.json 缺少必选脚本:${name}`,\n missingBin: 'package.json 未声明 CLI bin 入口',\n checkPassed: (name, ms) => `${name} 通过(${ms}ms)`,\n checkFailed: (name, code) => `${name} 失败(exit=${code})`,\n reportWritten: (p) => `自举报告已写入:${p}`,\n candidateReady: (branch) => `候选版本已在 ${branch} 通过验证;仍需显式使用 --promote 才会晋级。`,\n promoted: (branch) => `候选版本已通过快进合并完成晋级:${branch}`,\n cleanupDone: (p) => `自举 worktree 已删除:${p}`,\n promotionBlocked: '存在未通过的质量门,禁止晋级候选版本。',\n hostHeadChanged: '自举期间宿主 HEAD 已变化',\n candidateDirty: (files) => `候选 worktree 存在未提交变更:${files}`,\n candidateStatusUnknown: '(未知路径)',\n candidateMoved: (expected, actual) => `质量门之后候选提交发生漂移(预期 ${expected},实际 ${actual})。`,\n candidateNotBasedOnBase: (candidate, base) => `候选提交 ${candidate} 不是自举基线 ${base} 的后代。`,\n promotionVerificationFailed: (expected, actual) => `晋级后 HEAD 校验失败(预期 ${expected},实际 ${actual})。`,\n reportTitle: 'XCompiler 功能自举报告',\n reportNone: '(无)',\n reportNextQualified: (repository, candidateCommit) => `git -C \"${repository}\" merge --ff-only \"${candidateCommit}\"`,\n reportNextPromoted: '使用已晋级版本执行下一轮功能自举。',\n reportNextFailed: '检查候选 worktree,修复失败质量门后再晋级。',\n reportLabels: {\n status: '状态', repository: '仓库', baseCommit: '基线提交',\n candidateCommit: '候选提交', branch: '候选分支', worktree: '隔离工作区',\n createdAt: '创建时间', checks: '质量门', changedFiles: '变更文件',\n nextStep: '下一步',\n },\n },\n compile: {\n workspaceReady: (p) => `工作区:${p}`,\n forceOverride: '--force:覆盖工作区锁并重新生成计划。',\n topicInputConflict: '同时提供了 --topic 和 --input;优先使用 --topic,忽略 --input。',\n auditTopicInput: 'topic.md(--topic)',\n auditOriginalRequirement: '原始需求(Intake)',\n auditUserAddenda: '用户补充需求',\n auditEditedTopic: '已编辑 topic.md',\n auditTopicPersisted: (p) => `topic.md 已写入:${p}`,\n auditDecomposeFailed: 'planner.decompose 失败',\n lintIssue: (id, message) => ` - [${id}] ${message}`,\n planPreviewTruncated: '…(已截断,完整内容见 docs/plan.md)',\n auditPlanPersisted: (p) => `阶段 plan 已写入:${p}`,\n projectFileWritten: (p) => `工程文件已更新:${p}`,\n nextCommand: (command) => ` 下一步:${command}`,\n topicEmptyExit: '--topic 文件为空,已退出。',\n topicLoaded: (p) => `已加载 topic:${p}(跳过 intake / clarify / Gate 1)`,\n requirementEmptyExit: '需求为空,已退出。',\n requirementInputHint: '请描述你的需求(多行,输入空行结束):',\n spinClarify: 'Planner 正在澄清需求…',\n clarifySucceed: (n) => `澄清问题:${n} 条`,\n clarifyFail: '澄清失败',\n clarifyChoiceHint: (range) => `输入 ${range} 选择已展示选项,或直接输入自定义回答内容。`,\n addendaConfirm: '是否有补充需求要追加?(会连同澄清一起发给 Planner,并保留在 plan.userAddenda 字段)',\n addendaEditorMsg: '输入自定义补充需求(多行、Markdown 可)',\n auditClarifyAnswer: (qid, q) => `澄清回答 ${qid}: ${q}`,\n spinDecompose: 'Planner 正在按 V 模型拆解…',\n decomposeFail: 'Planner 拆解失败',\n plannerInvalidPlan: 'Planner 无法生成有效 plan:',\n plannerInvalidPlanHint1: ' 常见原因:LLM 输出未满足 XCompiler 计划 schema、V 模型骨架或架构契约;不能跳过该错误。',\n plannerInvalidPlanHint2: ' 排查:检查 .xcompiler/audit.jsonl 中的 llm.error / planner.thought 原文,按契约错误修正 Planner 输出。',\n plannerTransportFailureHint1: ' 常见原因:LLM provider 连接失败、请求超时或服务端中断;这不是项目 plan/源码缺陷。',\n plannerTransportFailureHint2: ' 排查:检查 OPENAI_BASE_URL / provider base_url、模型服务是否可达、网络权限和超时设置,然后重跑 build。',\n decomposeSucceed: (n) => `已生成 ${n} 个 Step`,\n schemaFail: 'Plan schema 校验失败:',\n schemaInvalidSavedAt: (p) => ` 完整 plan 已落盘:${p}`,\n lintFail: (n) => `Plan lint 失败(${n}):`,\n topicPreviewHeader: '─── topic.md (preview) ───',\n topicPreviewFooter: '──────────────────────────────',\n gate1Confirm: '需求是否符合预期?',\n gate1ChoiceConfirm: '✅ confirm — 进入计划生成',\n gate1ChoiceEdit: '✏️ edit — 打开编辑器修改',\n gate1ChoiceCancel: '❌ cancel — 放弃本次会话',\n gate1AuditLabel: '需求确认门 (Gate 1)',\n gate1Cancelled: '已取消,未写入任何文件。',\n editTopicMsg: '编辑 topic.md',\n topicWritten: (p) => `已写入 ${p}`,\n planWritten: (p) => `阶段 plan 已写入 ${p}`,\n phasePlanWritten: (p) => `phasePlan 已写入 ${p}`,\n planPreviewHeader: '─── plan.md (preview) ───',\n planPreviewFooter: '─────────────────────────',\n gate2Confirm: '是否确认该计划? (此为最终确认,确认后将写入 phasePlan.json 和当前阶段计划)',\n gate2AuditLabel: '计划确认门 (Gate 2)',\n gate2Rejected: '未确认,已放弃。phasePlan.json 未写入。',\n baselineLoaded: (kind, sources) => `已加载 ${kind} 基线:${sources}`,\n baselineMissing: (workspace) => `增量模式需要在 ${workspace} 中找到已有工程基线(topic / docs / plan / src)。`,\n baselineLanguageOverride: (baseline, source, configured) =>\n `增量模式将沿用基线语言 ${baseline}(来源:${source}),而不是配置中的 ${configured}。`,\n topicTitle: '# Project Topic (项目选题)',\n topicPreamble: '> 本文件是需求澄清后冻结的项目选题,后续 V 模型拆解与所有阶段产出皆以本文件为唯一需求输入。',\n topicSecRequirement: '## 原始需求',\n topicSecClarify: '## 澄清记录',\n topicSecAddenda: '## 用户补充需求 (Addenda)',\n topicSecBaseline: '## 现有工程基线',\n },\n inspect: {\n noPlanFound: '未找到任何 phasePlan.json / plan.json',\n digestLabel: 'digest:',\n stepNotFound: (id) => `Step ${id} 未找到`,\n secDescription: '— description —',\n secAcceptance: '— acceptance —',\n secSubtasks: '— subtasks —',\n secSystemPrompt: '— systemPrompt —',\n secOutputs: '— outputs —',\n secRecentAudit: (n) => `— recent audit (${n}) —`,\n planHeader: (p, language) => `${p} 语言=${language}`,\n planStatusSummary: (total, done, pending, failed, skipped, running) =>\n `步骤=${total} 完成=${done} 待执行=${pending} 失败=${failed} 跳过=${skipped} 运行中=${running}`,\n planReadFailed: (p, message) => `${p} — ${message}`,\n stepHeader: (id, phase, title, status, retries, maxRetries) => `${id} ${phase} ${title} ${status} 重试=${retries}/${maxRetries}`,\n stepRoleTools: (role, tools) => `角色=${role} 工具=[${tools}]`,\n stepDependsOn: (ids) => `依赖:${ids}`,\n outputStatus: (exists, p) => `${exists ? '✓' : '✗'} ${p}`,\n auditEntry: (ts, kind, message) => `${ts} ${kind} ${message}`,\n },\n execute: {\n forceReset: '--force:重置所有 Step 为 PENDING,并覆盖工作区锁。',\n manifestRecalibrated: (p) => `已重新校准 ${p}(移除版本锁和幻觉包名)`,\n manifestSeeded: (p) => `已根据 plan.dependencies 生成 ${p}`,\n auditPlanLoaded: (p) => `已加载 plan:${p}`,\n planLoaded: (p) => `已加载 Plan:${p}`,\n planSummary: (language, steps) => ` 语言=${language},步骤=${steps}`,\n preflightModelMissing: (names) => `LLM preflight: 模型缺失,当前运行已跳过 [${names}],并将动态评分降到最低值`,\n preflightAutoAdded: (n) => `LLM preflight: 自动注入 ${n} 个 provider(来自 ollama /api/tags)`,\n runInterrupted: (id, e, total) => `执行中断于 ${id}(已执行 ${e}/${total})`,\n runReasonLabel: ' 原因: ',\n runFailureLogHeader: ' --- 详细失败日志(tail 40 行) ---',\n runAllDone: (e, total) => `Plan 全部完成(${e}/${total})`,\n projectAuditSummary: (errors, warnings) => `项目审计:${errors} 个错误,${warnings} 个警告`,\n projectMemoryRefreshFailed: (message) => `项目记忆刷新失败:${message}`,\n projectAuditCheck: (name, summary) => `[审计:${name}] ${summary}`,\n auditDocPresent: (p) => `${p} 存在`,\n auditDocMissing: (p) => `缺少 ${p}`,\n auditDeliveryDocPresent: '交付文档存在',\n auditDeliveryDocMissing: '缺少 docs/08-functional-test.md',\n auditTestFilesFound: (count) => `发现 ${count} 个有效测试文件`,\n auditTestFilesMissing: 'tests/ 下没有有效测试文件',\n auditEntrypointOk: (command) => `入口验证通过:${command}`,\n auditEntrypointFailed: (command) => `入口验证失败:${command}`,\n auditPackageJsonMissing: '缺少 package.json',\n auditScriptMissing: (name) => `package.json 缺少 ${name} 脚本`,\n auditCommandOk: (name) => `${name} 通过`,\n auditCommandFailed: (name, exitCode, timedOut) =>\n `${name} 失败(exit=${exitCode}${timedOut ? ',超时' : ''})`,\n },\n engine: {\n spinSandboxBuild: (profile) =>\n profile.id === 'typescript'\n ? `构建沙盒(npm install,${profile.manifestFile})…`\n : `构建沙盒(pip install -r ${profile.manifestFile})…`,\n sandboxReady: (r) => `沙盒就绪:${r}`,\n stepSkipDone: (id, phase) => ` ↪ ${id} ${phase} 已完成,跳过`,\n spinSandboxRebuild: (id, profile) =>\n profile.id === 'typescript'\n ? `Step ${id} 写入 ${profile.manifestFile},重建 npm 沙盒…`\n : `Step ${id} 写入 ${profile.manifestFile},重建 pip 沙盒…`,\n sandboxStatus: (r) => `沙盒:${r}`,\n autoFixedSrcImports: (n, files) => ` ⚠ auto-fixed sys.path bootstrap in ${n} 个入口文件:${files}`,\n debugResumeNotice: (id, n) => ` ↻ ${id} 检测到上次会话以 FAILED 结束(已累积 ${n} 次尝试),本次首轮直接进入 Debugger 模式。`,\n spinDebugRetry: (id, attempt, budget, cap, reason) => `🛠 ${id} DEBUG retry ${attempt}/${budget} (cap=${cap}) — ${reason}`,\n retryException: (a, b, msg) => `retry ${a}/${b} 抛出异常:${msg}`,\n fixSucceeded: (id, a) => `${id} 修复成功 (retry=${a})`,\n retryHealthyButFailed: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} 仍失败但健康(扩窗) · ${tag} · ${reason}`,\n retryLowQuality: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} 低质量输出(缩窗) · ${tag} · ${reason}`,\n retryStillFailed: (a, b, tag, reason) => `retry ${a}/${b} 仍失败 · ${tag} · ${reason}`,\n earlyAbortLowQuality: (id, n) => ` ⚡ ${id} 检测到连续 ${n} 次低质量 LLM 输出(解析失败/重复 actions/无进展),快速终止 DEBUG 重试`,\n stepFinalFailed: (id, phase, role) => `✖ Step ${id} (${phase} / ${role}) 最终失败`,\n finalAttemptsLine: (a, b, c, ea) =>\n ` attempts=${a} final_budget=${b} cap=${c}` + (ea ? ' (early-abort: low-quality)' : ''),\n finalMetricsLine: (h, p, r, tf, pr) =>\n ` health=${h} parseFail=${p} repeat=${r} toolFail=${tf} progress=${pr}`,\n reasonLabel: 'reason: ',\n failureLogHeader: '--- failure log (tail, max 80 lines) ---',\n fixSuggestionsHeader: '--- 修复建议(calibration) ---',\n auditHint: (id) => ` 审计: 查看 .xcompiler/audit.jsonl 与 .xcompiler/llm-stream/${id}-*.txt 获取完整原始流`,\n spinStepRunning: (id, phase, title) => `▶ ${id} ${phase} ${title}`,\n noFailureLog: '(未捕获日志)',\n suggestionLine: (index, code, hint) => ` ${index}. [${code}] ${hint}`,\n phaseStart: (id, phase, title) => `${id} ${phase} ${title}`,\n phaseFailed: (id, debug, reason) => `${id} ${debug ? 'DEBUG ' : ''}失败 — ${reason}`,\n phaseDone: (id, rounds) => `${id} 完成(轮次=${rounds})`,\n phaseException: (id, message) => `${id} 异常失败 — ${message}`,\n archGateReason: (missing) => `HIGH_LEVEL_DESIGN 门禁:架构契约缺少 ${missing} 个标记`,\n archGateMissing: (tokens) => `缺失模块 ID/路径:${tokens}`,\n archGateInstruction: (p) => `请更新 ${p},确保每个 architectureModules 项在进入 CODE 前均可追踪。`,\n testGateReason: (exitCode, timedOut) => `测试门禁:测试退出码=${exitCode}${timedOut ? '(超时)' : ''}`,\n deliveryGateReason: (command, exitCode, timedOut) => `FUNCTIONAL_TEST 门禁:\\`${command}\\` 退出码=${exitCode}${timedOut ? '(超时)' : ''}`,\n missingPythonEntrypoint: '缺少 Python 入口:需要 src/main.py、src/<package>/__main__.py,或 src/cli.py 等显式 CLI 文件',\n missingTypeScriptEntrypoint:\n '缺少 TypeScript 入口:需要 package.json start/bin 或 src/main.ts、src/index.ts、src/main.tsx 之一',\n invalidPythonEntrypointSource: (path) =>\n `Python 入口源码无效:${path} 必须是真实 CLI 入口,至少包含 def main(...)、argparse.ArgumentParser 或 if __name__ == \"__main__\" 这类入口结构;仅 import/comment 的占位文件不能算可运行应用。`,\n entrypointHelpOutputMissing: (command) =>\n `入口探测 \\`${command}\\` 虽然退出码为 0,但没有输出有意义的 help/usage 文本;必须实现 --help,不能靠空脚本自然退出过关。`,\n reasonLine: (reason) => `原因:${reason}`,\n roundsLine: (rounds) => `轮次:${rounds}`,\n commandLine: (command) => `命令:${command}`,\n stdoutTailHeader: '--- 标准输出(尾部)---',\n stderrTailHeader: '--- 标准错误(尾部)---',\n testStdoutTailHeader: '--- 测试标准输出(尾部)---',\n testStderrTailHeader: '--- 测试标准错误(尾部)---',\n outputsMissing: (paths) => `缺失输出:${paths}`,\n metricsLine: (health, parseFail, repeat, toolFail, progress) =>\n `指标:健康度=${health} 解析失败=${parseFail} 重复=${repeat} 工具失败=${toolFail} 进度=${progress}`,\n metricsUnavailable: '指标:无',\n toolCallsHeader: '工具调用:',\n toolCallLine: (tool, ok, detail) => ` - ${tool} ${ok ? '成功' : '失败'} ${detail}`,\n projectMemoryRefreshFailed: (message) => `项目记忆刷新失败:${message}`,\n deliveryFixHints: (language) => language === 'typescript'\n ? [\n '修复方向(按优先级):',\n ' 1. 若 TypeScript 源码出现模块解析或 ERR_MODULE_NOT_FOUND,使用带显式 .ts 后缀的相对 ESM import。',\n ' 2. 若为 --help 或未知选项,main() 必须支持 --help 并以 0 退出。',\n ' 3. 若为应用异常,修复实现并保持入口轻量。',\n ]\n : [\n '修复方向(按优先级):',\n ' 1. 若为 src 相关 ModuleNotFoundError,加入 planner #19 的 sys.path 自举或移除 import 的 src. 前缀。',\n ' 2. main() 必须是真实 CLI 入口:解析 --help、调用项目模块、打印有意义输出,并用 if __name__ == \"__main__\": main() 启动。',\n ' 3. 若为 argparse 错误,main() 必须无需其他必填参数即可支持 --help 并以 0 退出。',\n ' 4. 若为业务异常,修复实现;入口只负责参数解析与调用。',\n ],\n },\n render: {\n sectionGlobalPrompt: '## Global prompt (注入每个 Step 的 system prompt)',\n sectionDependencies: (manifestFile) => `## Dependencies (将写入 ${manifestFile})`,\n sectionBaselineSummary: '## 现有工程基线',\n labelSystemPrompt: '**System prompt (唯一使命):**',\n },\n prompts: {\n plannerSystem: (p) => buildPlannerSystem(p),\n plannerPhasePlanSystem: (p) => buildPlannerPhasePlanSystem(p),\n plannerPhaseDecomposeSystem: (p) => buildPlannerPhaseDecomposeSystem(p),\n plannerSelfMode: `自举模式覆盖规则(优先级高于上方与之冲突的 greenfield 规则):\n- 目标是现有 XCompiler 仓库。除非需求明确要求修改,否则必须保留当前 package.json、tsconfig、bin、CLI 入口、模块结构、公共导出和设计文档。\n- 不得为了满足新建工程入口约定而创建 src/main.ts;必须复用现有 package.json 声明的入口。\n- 除非本次变更确实需要修改,否则 HIGH_LEVEL_DESIGN outputs 不得包含 package.json 或 tsconfig.json。\n- 每个 CODE/测试产物必须严格限定在本次增量范围,禁止整体重建或替换仓库。\n- 将稳定宿主视为 N 代、隔离 worktree 中的候选版本视为 N+1 代;禁止设计进程内热替换。`,\n plannerClarifySystem: `你是 XCompiler V 模型的需求分析师。你的职责不是复述 topic,而是发现会改变功能设计、验收结果或架构边界的未决事项。\n只返回严格 JSON。问题必须可由业务方直接作答、一次只确认一个决策,避免空泛的“还有什么要求”或技术栈选型问题。`,\n plannerClarify: (raw, opts = {}) =>\n `用户的原始需求如下:\n\n\"\"\"\n${raw}\n\"\"\"\n\n请针对 topic 中尚未明确、且答案会实质改变实现或验收的事项,生成${opts.complex ? '8-10' : '7-10'}个互不重复的澄清问题。不得返回空数组;如果功能描述已经较完整,就追问验收示例、失败行为和明确的不做范围。\n\n仅返回 JSON 数组,每项严格为:\n{\"id\":\"Q1\",\"category\":\"functionality|data|acceptance|boundary|quality|extensibility\",\"question\":\"一个可直接回答的具体问题\",\"why\":\"该答案会影响什么设计或验收\",\"options\":[{\"label\":\"A\",\"answer\":\"最高优先级的可行设定\"},{\"label\":\"B\",\"answer\":\"第二个可行设定\"}]}\n\n问题组合要求(功能优先):\n- 至少 ${opts.complex ? '5' : '4'} 个功能性问题,category 使用 functionality / data / acceptance,确保功能问题占多数。优先质询:目标用户与角色、核心使用流程、功能规则与状态变化、输入输出、失败/异常行为、可验证验收示例。\n- 至少 1 个 boundary:明确本期必须做、明确不做、外部系统责任边界或兼容范围。\n- 至少 1 个 quality:询问可量化的性能、容量、并发、时延、准确性、可靠性或安全指标;不要只问“性能有什么要求”。\n- 至少 1 个 extensibility:询问最可能新增的业务能力、扩展维度或需要稳定保留的接口,不要泛问“是否需要扩展性”。\n- 如果交付形态不明确,必须包含 1 个 boundary 问题,确认本项目应是 API library/SDK/软件包、可运行应用/CLI/服务,还是二者兼具的 mixed 交付。\n- 如果需求需要访问外部 API/URL/第三方数据源,必须包含 1 个 data 或 boundary 问题,确认用户是否已有可用 API、key、token 或鉴权方式;若用户没有凭证,本期默认优先选择公开、免 key/token、可验证的接口,不要生成占位 URL。\n- 按阻塞程度排序:先问会改变核心功能/数据模型的问题,再问范围与质量,最后问未来扩展。\n- 一题只包含一个主要决策,给出必要的业务选项或示例,禁止把多个无关问题用“以及/或者”拼成一题。\n- 每个问题都必须预生成 2-5 个可行回答设定,按优先级排序。选项数量不是固定值:二选一场景用 2 个,常见默认设定用 3 个,只有确实存在 4-5 个彼此不同的可行设定时才生成 4-5 个;不要填充或强制每题都是 3 个选项。\n- 选项从 A 开始连续标号,到实际最后一个选项结束,例如 A-B、A-C、A-D 或 A-E;如果能判断推荐/默认方案,A 应是最高优先级方案。选项必须是具体业务/产品设定,不要写成空泛占位。\n- 不要把“其他 / 自定义 / 用户决定”作为选项;CLI 已支持用户输入已展示的选项字母或直接输入自定义回答内容。\n${opts.projectShapeAmbiguous\n ? '- 本 topic 必问:明确确认 API library / 可运行应用 / mixed 交付边界。\\n'\n : ''}\n\n【硬约束】实现技术栈已经由 XCompiler 配置 / 现有工程基线固定,不要重新询问语言、运行时、包管理器这类问题。\n**严禁**提出以下类型的问题:\n - \"希望用什么编程语言 / 框架 / 运行时实现?\"\n - \"需要哪种测试框架 / 构建工具 / 包管理器?\"\n - \"目标平台是哪种操作系统?\"\n${opts.intent && opts.intent !== 'greenfield'\n ? `这是一条针对现有工程的增量 ${opts.intent} 请求${opts.hasBaseline ? ';分解阶段还会提供一份基线摘要' : ''}。请只问“变更增量”相关问题,不要把项目当成从零开始重做。`\n : ''}问题主体必须聚焦功能行为;性能、边界和扩展性用于消除会影响本期设计的关键歧义。`,\n plannerDecompose: (raw, qa, addenda, opts = {}) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成一份增量 ${opts.intent} 计划,优先复用当前架构、文件、测试与依赖,而不是把整个项目重新搭一遍。除本次需求涉及的范围外,默认保持既有行为不变。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}规划深度约束:\n- 除非需求明确只是一个很小的单函数 / 单脚本 / 小工具,否则不要把方案压缩成“一个源码文件 + 一个测试文件”的最小实现。\n- 如果需求横跨多个关注点(领域逻辑、API/CLI 接口、持久化、外部集成、流程编排、测试),必须在计划里体现为多个架构模块,并在 CODE/MODULE_TEST 宏 Step 的 subTasks 下分解模块级工作。\n- 在 plan 中评估项目复杂度,并按评估结果确定 implementationPhases 数量:simple => 只有 P1 current;moderate => P1 current + 至少 P2 planned;complex => P1 current + 至少 P2/P3 planned。若用户明确要求分阶段/里程碑,至少使用 P1+P2,并设置 userForcedPhaseSplit=true。每个 current/planned implementation phase 都必须在 steps 中拥有一套完整 V 模型,并让 Step.iterationId 指向对应 phase。\n- 请通过 HIGH_LEVEL_DESIGN / DETAILED_DESIGN Step 明确模块边界、职责划分、依赖和后续可扩展点,让后续增量开发可以持续追加,而不是每次重写。\n- 如果基线里已经存在相关文件,优先在原模块上扩展/重构,不要新造一套行为重复的影子实现。\n\n请按系统规则输出严格 JSON 计划。`,\n plannerPhasePlan: (raw, qa, addenda, opts = {}) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成 PhasePlan,优先复用当前架构、文件、测试与依赖。除本次需求涉及的范围外,默认保持既有行为不变。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}请先只生成大的 PhasePlan:\n- 评估项目复杂度并决定 phase 数量:simple => 只有 P1 current;moderate => P1 current + 至少 P2 planned;complex => P1 current + 至少 P2/P3 planned。\n- P1 objective 必须是可独立交付、可验证的核心功能。\n- P2/P3 只写后续增强目标、范围、交付物和验证门禁;不要展开任何 V 模型 Step。\n- 每个 phase 的 verificationGate 必须说明失败时把完整错误日志交给 Debugger,并回退到对应 V 模型阶段后重跑后续阶段。\n- 只返回 PhasePlan JSON,禁止包含 steps / architectureModules / dependencies。`,\n plannerPhaseDecompose: (raw, qa, addenda, opts) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成当前 phase 的增量 V 模型 StepPlan,优先复用当前架构、文件、测试与依赖。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}已确认的 PhasePlan:\n\"\"\"\n${opts.phasePlan}\n\"\"\"\n\n当前需要展开的 phaseId:${opts.phaseId}\n\n请只为 ${opts.phaseId} 输出完整 V 模型 StepPlan:\n- steps 中每个 Step.iterationId 必须等于 \"${opts.phaseId}\"。\n- 禁止输出其他 planned phase 的 Step;P2/P3 的详细计划留到它们成为 current phase 时再生成。\n- 如果 ${opts.phaseId} 横跨多个关注点(领域逻辑、CLI/API、文件 I/O、外部集成、流程编排、测试),必须在 architectureModules 中体现当前 phase 的模块边界,并在 CODE/MODULE_TEST 的 subTasks 下分解模块级工作。\n- architectureModules.sourcePaths 只能是 src/ 下的产品源码文件;不要把 tests/fixtures、tests/utils、样例文件、目录或文档登记为架构模块。\n- dependencies 只写当前 phase 需要的包名;Python 必须包含 pytest;不要输出 requirements.txt。\n- 当前 phase 必须包含标准 V 模型 8 个宏 Step,并满足同步测试设计规则。\n\n只返回当前 phase 的严格 JSON StepPlan。`,\n executorSystem: (p) => buildExecutorSystem(p),\n executorDebugBlock: (reason: string, suggestions?: string) =>\n `\\n\\n正处于 DEBUG 重试模式。上一轮失败原因: ${reason}\\n` +\n 'DEBUG 可以修改当前 allowedWrites 内的上游源码与测试文件;若失败暴露的是实现、契约或下游调用不一致,必须修真实缺陷,禁止通过削弱断言、跳过测试、删除失败用例或只迎合错误测试来过关。' +\n '如果本次回退处于需求/设计阶段,而具体源码修改属于后续 V 模型 Step 且目标文件不在当前 allowedWrites 内,应更新当前契约、测试计划或诊断产物并完成当前 Step,让后续 CODE Step 实现;不要尝试被拒绝的越权写入。' +\n '若失败是第三方依赖缺失或库选型错误,必须用 add_dependency 写入真实包名,或把源码改回 HIGH_LEVEL_DESIGN 选定的真实库;严禁在 src/ 生产代码里 try/except ImportError 后伪造 module、fake class/function、空实现或 fallback mock 来绕过错误。' +\n '请包含 read_file/code_search 先定位问题,再以 apply_patch / replace_in_file / add_dependency 作最小修改,最后 run_tests 验证。' +\n 'DEBUG 重试不能只靠只读检查就标记完成:本次重试必须产生一次成功的修复动作,或一次成功的验证命令。' +\n '如果上一轮失败原因包含 repeated read-only/probe actions,请把已有 failure log 视为足够上下文,下一步直接 patch/write/改依赖或执行验证命令。' +\n '当测试已正常执行但失败点是返回行为断言时,禁止反复重写 fixture 或样例。只有证据明确是文件缺失、fixture 格式错误或 fixture 本身解析失败时才修改 fixture;否则应修实现、接口契约、依赖选型或确实错误的断言。' +\n '如果失败日志显示网络/API 调用失败,不允许只停留在探测接口:最多连续执行 2 次 http_fetch 探测;HTTP 2xx 但 body 为空或格式不可用不算可用接口;随后必须 patch 真实集成代码,并用 run_program 和 run_tests 验证。入口仍输出网络/API 失败时不得 done=true。' +\n (suggestions ? `\\n\\n${suggestions}` : ''),\n executorGlobalBlock: (globalPrompt: string) => `\\n\\n## 项目全局约束\\n${globalPrompt}`,\n executorStepBlock: (sp: string) =>\n `\\n\\n## 当前 Step 专属提示 (唯一使命,禁止跨 Step 发散)\\n${sp}`,\n executorUserPromptOutro: '现在按协议返回第一轮 JSON。',\n executorFeedbackHeader: '本轮工具结果:',\n executorFeedbackVerifyOk: 'outputs 校验通过。如已完成,请把 done 设为 true 且 actions=[]。',\n executorFeedbackVerifyMissing: (paths: string) => `outputs 仍缺失:${paths}。请继续。`,\n executorFeedbackReadOnlyLoopWarning: (rounds: number, targets: string) =>\n `循环门禁警告:最近 ${rounds} 轮只调用了读取/探测工具` +\n (targets ? `(${targets})` : '') +\n '。下一轮必须包含一次成功的修复动作(apply_patch / replace_in_file / write_file / add_dependency)或明确的验证动作(run_tests / run_program)。不要继续只调用 read_file、list_dir、code_search 或 http_fetch。',\n executorFeedbackReadOnlyRecoveryRequired:\n '只读恢复模式已启用:上一轮已经因为持续探测失败。本轮必须基于已有 failure log 直接 patch/write/改依赖或执行验证;如果下一轮仍然只有只读/探测动作,本次重试会失败并回退。',\n executorFeedbackRepairEvidenceMissing:\n 'DEBUG 完成无效:本次重试还没有产生修复证据。设置 done=true 前,必须至少完成一次成功的修复动作或成功的验证运行;否则只能在 thoughts 中给出具体 blocker 后停止。',\n },\n skills: {\n patcher: '通过 apply_patch / replace_in_file 对已有文件做小改动,禁止整文件覆盖。',\n author: '通过 write_file 创建新文件;优先放在当前 Step writable allowlist 内。',\n tester:\n '编写并运行 pytest 测试,验证函数行为;失败时通过 analyze_error 解析。' +\n '【fixture 自包含】测试**严禁**直接 open() 磁盘上不存在的样例文件。' +\n '若被测函数需要文件输入,优先复用用户/工作区真实样例;没有样例时用 http_fetch 获取官方文档、上游仓库或公开标准中的小型参考样例,' +\n '保存到 tests/fixtures/<name> 并记录来源;只有 CSV/JSON/INI 等简单文本格式才可在 pytest tmp_path 中构造最小样例并立刻 run_tests。' +\n '测试/DEBUG 阶段 tests/fixtures/ 已默认放开写权限,子目录自动 mkdir -p,**无需**提前把 fixture 路径登记到 outputs。' +\n '生成测试时务必同时输出全部依赖资源,避免后续 Debugger 因 FileNotFoundError 反复重试。' +\n '【fixture 迭代】若测试运行中被测函数报\"Invalid syntax / Parse error / Malformed\"等解析错误,' +\n '说明你写出的 fixture 内容不合该格式 spec:read_file 看清后,优先使用用户样例或 http_fetch 拉取的权威参考样例重写,再 run_tests。' +\n '复杂领域格式连续失败后必须停止凭记忆生成,改为请求用户样例或网络参考;严禁去改被测模块或断言。',\n dep_resolver: '当出现 ModuleNotFoundError 时,用 add_dependency 写回 requirements.txt 并重建沙盒。',\n debugger:\n '先 run_tests / run_python 复现错误 → analyze_error → patch/replace_in_file/add_dependency 修复 → 再次 run_tests。每次只做最小修改。【依赖缺失】必须添加真实依赖或改用设计选定的真实库,禁止在 src/ 生产代码里伪造 module、fake class/function、空实现或 fallback mock。【Fixture 纪律】如果测试失败是行为断言失败,不要持续重写 fixture;只有明确缺文件、fixture 格式错误或 fixture 解析错误时才改 fixture,否则修源码、契约、依赖或错误断言。【网络/API 失败】定位失败 URL 后,只允许少量探测替代 API,随后必须 patch 源码并用 run_program 证明入口不再输出 API 失败。【重要】同一文件上 replace_in_file 连续失败 2 次以上请立即 read_file,再用 patch 或在当前运行时 chunk limit 内整文件重写,不要反复猜测 find 字符串。【禁止 no-op】replace_in_file 的 find 与 replace 必须不同——若你只是想\"确认\"某段代码,请用 read_file,不要提交相同字符串的替换。',\n refactorer: '重构必须保证行为不变;先跑回归测试 → 修改 → 再跑回归测试。',\n },\n doctor: {\n cliDescription: '检查 config / LLM / sandbox / skills 是否就绪',\n optStrict: '把 warning 也视为失败(任一 warn 即非零退出)',\n header: 'XCompiler 启动环境自检',\n sectionConfig: '[配置]',\n sectionLLM: '[LLM]',\n sectionSandbox: '[沙盒]',\n sectionSkills: '[技能]',\n summaryOk: '全部检查通过。',\n summaryWarn: (n) => `通过,但有 ${n} 条 warning。`,\n summaryFail: (n) => `检测到 ${n} 项失败。`,\n configLoadOk: (path) => `配置已加载:${path}`,\n configLoadFail: (msg) => `配置加载失败:${msg}`,\n configLocale: (locale) => `locale=${locale}`,\n llmNoProviders: 'config.llm.providers 为空,未声明任何 provider',\n llmProviderListed: (n) => `已声明 ${n} 个 provider`,\n ollamaUnreachable: (baseUrl, msg) => `ollama 不可达 @ ${baseUrl} —— ${msg}`,\n ollamaReachable: (baseUrl, n) => `ollama 可达 @ ${baseUrl}(共 ${n} 个模型)`,\n ollamaModelMissing: (provider, model, baseUrl) =>\n `provider \"${provider}\":模型 \"${model}\" 未安装于 ${baseUrl}(请执行 \\`ollama pull ${model}\\`)`,\n ollamaModelOk: (provider, model) => `provider \"${provider}\":模型 \"${model}\" 可用`,\n openaiKeyMissing: (provider) => `provider \"${provider}\":api_key 为空(请设置该 provider 对应的环境变量,例如 OPENROUTER_API_KEY,或 config.llm.providers.${provider}.api_key)`,\n openaiReachable: (provider, baseUrl) => `provider \"${provider}\":OpenAI 端点可达 @ ${baseUrl}`,\n openaiUnreachable: (provider, baseUrl, msg) => `provider \"${provider}\":OpenAI 端点不可达 @ ${baseUrl} —— ${msg}`,\n openaiModelListMissing: (provider, model) =>\n `provider \"${provider}\":/models 响应中未列出 \"${model}\"(若你的账号有访问权限仍可正常调用)`,\n providerScoreZero: (provider) => `provider \"${provider}\" 已禁用(score=0)`,\n roleNoLiveProvider: (role) => `角色 \"${role}\" 没有可用 provider(候选列表全部不可达或被禁用)`,\n roleOk: (role, provider) => `角色 \"${role}\" → ${provider}`,\n sandboxKind: (kind) => `sandbox=${kind}`,\n sandboxNetworkPolicy: (policy, ports) =>\n `network=${policy}` + (ports.length ? `(expose_ports=[${ports.join(', ')}])` : ''),\n sandboxFullNoPorts:\n 'network=full 但未配置 expose_ports—宿主侧无法访问容器内服务。' +\n '请在 config.yaml 中设置 `agent.sandbox_limits.expose_ports: [<port>]`。',\n sandboxNodeMissing: 'PATH 上找不到 node(TypeScript subprocess 沙盒必需)',\n sandboxNodeOk: (version) => `node OK(${version})`,\n sandboxNpmMissing: 'PATH 上找不到 npm(TypeScript subprocess 沙盒必需)',\n sandboxNpmOk: (version) => `npm OK(${version})`,\n sandboxNpxMissing: 'PATH 上找不到 npx(TypeScript subprocess 沙盒必需)',\n sandboxNpxOk: (version) => `npx OK(${version})`,\n sandboxPythonMissing: 'PATH 上找不到 python3(subprocess 沙盒必需)',\n sandboxPythonOk: (version) => `python3 OK(${version})`,\n sandboxVenvMissing: 'python3 venv 模块不可用(请安装 python3-venv / python3-virtualenv)',\n sandboxVenvOk: 'python3 venv 模块 OK',\n sandboxDockerMissing: (bin) => `PATH 上找不到 docker 二进制 \"${bin}\"`,\n sandboxDockerOk: (version) => `docker OK(${version})`,\n sandboxDockerDaemonDown: (msg) => `docker daemon 不可达:${msg}`,\n sandboxInContainerWarn: '检测到 XCompiler 运行在容器内,此模式不支持 sandbox=docker(请使用 subprocess)。',\n skillToolMissing: (skill, tool) => `skill \"${skill}\" 引用了未注册的工具 \"${tool}\"`,\n skillOk: (n, tools) => `已注册 ${n} 个 skill,对应 ${tools} 个底层工具`,\n },\n};\n\nexport default messages;\n","import en from './en.js';\nimport zh from './zh.js';\nimport type { Locale, Messages } from './types.js';\n\nexport type { Locale, Messages } from './types.js';\n\nconst TABLES: Record<Locale, Messages> = { en, zh };\n\nlet current: Locale = 'en';\n\n/** Current active locale (defaults to `en`). */\nexport function getLocale(): Locale {\n return current;\n}\n\n/** Set active locale. Accepts loose forms: `en`, `EN`, `cn`, `CN`, `zh`, `zh-CN`. */\nexport function setLocale(loc: string | Locale | undefined): Locale {\n current = normaliseLocale(loc);\n return current;\n}\n\n/** Normalise CLI / config inputs to internal {@link Locale}. */\nexport function normaliseLocale(loc: string | undefined | null): Locale {\n if (!loc) return current;\n const v = String(loc).trim().toLowerCase();\n if (v === 'en' || v === 'us' || v === 'uk' || v === 'gb' || v === 'en-us' || v === 'en-gb') return 'en';\n if (v === 'zh' || v === 'cn' || v === 'zh-cn' || v === 'zh-hans' || v === 'chinese') return 'zh';\n return 'en';\n}\n\n/** Active message bundle for the current locale. */\nexport function t(): Messages {\n return TABLES[current];\n}\n\n/** Explicit lookup against an arbitrary locale (does not change current). */\nexport function tFor(loc: Locale): Messages {\n return TABLES[loc];\n}\n","// Generated by scripts/version.mjs from package.json. Do not edit manually.\nexport const XCOMPILER_VERSION = \"0.2.3\";\nexport const XCOMPILER_PLUGIN_API_VERSION = 1;\n","import { t } from '../i18n/index.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport type {\n PluginCompatibilityCode,\n PluginCompatibilityReport,\n XCompilerPluginManifest,\n} from './types.js';\n\nexport interface PluginRuntimeVersion {\n xcompilerVersion?: string;\n pluginApiVersion?: number;\n}\n\n/** 在加载插件代码前可独立调用的 manifest 兼容性检查。 */\nexport function checkPluginCompatibility(\n manifest: XCompilerPluginManifest,\n runtime: PluginRuntimeVersion = {},\n): PluginCompatibilityReport {\n const candidate = manifest && typeof manifest === 'object'\n ? manifest\n : {} as XCompilerPluginManifest;\n const xcompilerVersion = runtime.xcompilerVersion ?? XCOMPILER_VERSION;\n const pluginApiVersion = runtime.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION;\n const pluginId = typeof candidate.id === 'string' ? candidate.id.trim() : '';\n const pluginVersion = typeof candidate.version === 'string' ? candidate.version : '';\n const base = { pluginId, pluginVersion, xcompilerVersion, pluginApiVersion };\n const reject = (code: Exclude<PluginCompatibilityCode, 'compatible'>, message: string) => ({\n ...base,\n compatible: false,\n code,\n message,\n } as const);\n\n const current = parseSemVer(xcompilerVersion);\n if (!current) {\n return reject('invalid-runtime-version', t().plugins.invalidCoreVersion(xcompilerVersion));\n }\n if (!/^[a-z0-9][a-z0-9._-]*$/u.test(pluginId)) {\n return reject('invalid-id', t().plugins.invalidId(pluginId));\n }\n if (!parseSemVer(pluginVersion)) {\n return reject('invalid-plugin-version', t().plugins.invalidVersion(pluginId, pluginVersion));\n }\n if (!Number.isInteger(candidate.apiVersion) || candidate.apiVersion !== pluginApiVersion) {\n return reject(\n 'api-version-mismatch',\n t().plugins.apiVersionMismatch(pluginId, candidate.apiVersion, pluginApiVersion),\n );\n }\n const minimum = parseSemVer(candidate.minXCompilerVersion);\n if (!minimum) {\n return reject(\n 'invalid-min-xcompiler-version',\n t().plugins.invalidMinimumVersion(pluginId, String(candidate.minXCompilerVersion ?? '')),\n );\n }\n if (compareSemVer(current, minimum) < 0) {\n return reject(\n 'xcompiler-version-too-old',\n t().plugins.coreVersionTooOld(pluginId, candidate.minXCompilerVersion, xcompilerVersion),\n );\n }\n return { ...base, compatible: true, code: 'compatible' };\n}\n\ninterface ParsedSemVer {\n major: number;\n minor: number;\n patch: number;\n prerelease: Array<number | string>;\n}\n\nfunction parseSemVer(value: string): ParsedSemVer | undefined {\n const match = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/.exec(value);\n if (!match) return undefined;\n const prereleaseParts = match[4]?.split('.') ?? [];\n // SemVer 2.0.0 forbids leading zeroes in numeric prerelease identifiers.\n if (prereleaseParts.some((part) => /^0\\d+$/u.test(part))) return undefined;\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: prereleaseParts.map((part) => /^\\d+$/.test(part) ? Number(part) : part),\n };\n}\n\nfunction compareSemVer(a: ParsedSemVer, b: ParsedSemVer): number {\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (a[key] !== b[key]) return a[key] - b[key];\n }\n if (a.prerelease.length === 0 || b.prerelease.length === 0) {\n return a.prerelease.length === b.prerelease.length ? 0 : a.prerelease.length === 0 ? 1 : -1;\n }\n const length = Math.max(a.prerelease.length, b.prerelease.length);\n for (let index = 0; index < length; index++) {\n const left = a.prerelease[index];\n const right = b.prerelease[index];\n if (left === undefined || right === undefined) return left === undefined ? -1 : 1;\n if (left === right) continue;\n if (typeof left === 'number' && typeof right === 'number') return left - right;\n if (typeof left === 'number') return -1;\n if (typeof right === 'number') return 1;\n return left.localeCompare(right);\n }\n return 0;\n}\n","import type { AuditLogger } from '../audit/audit.js';\nimport { t } from '../i18n/index.js';\nimport type { LLMClient } from '../llm/types.js';\nimport type { Tool } from '../tools/types.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport { checkPluginCompatibility } from './compatibility.js';\nimport type {\n HookContextMap,\n HookHandler,\n HookName,\n HookRegistrationOptions,\n PluginApi,\n PluginExtensionTarget,\n PluginHostOptions,\n XCompilerPlugin,\n XCompilerPluginManifest,\n} from './types.js';\n\ninterface RegisteredHook {\n hook: HookName;\n plugin: XCompilerPlugin;\n handler: (context: unknown) => void | Promise<void>;\n priority: number;\n order: number;\n}\n\n/** 插件注册、扩展能力合并与生命周期 Hook 调度中心。 */\nexport class PluginHost {\n private readonly plugins: XCompilerPlugin[];\n private readonly strict: boolean;\n private readonly xcompilerVersion: string;\n private readonly pluginApiVersion: number;\n private readonly hooks = new Map<HookName, RegisteredHook[]>();\n private readonly contributedTools: Array<{ plugin: XCompilerPlugin; tool: Tool }> = [];\n private readonly contributedSkills: Array<{ plugin: XCompilerPlugin; skill: Parameters<PluginApi['registerSkill']>[0] }> = [];\n private audit?: AuditLogger;\n private initialized = false;\n private registrationOrder = 0;\n\n constructor(options: PluginHostOptions = {}) {\n this.plugins = (options.plugins ?? []).map(snapshotPlugin);\n this.strict = options.strict ?? false;\n this.xcompilerVersion = options.xcompilerVersion ?? XCOMPILER_VERSION;\n this.pluginApiVersion = options.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION;\n this.audit = options.audit;\n assertPluginMetadata(this.plugins, this.xcompilerVersion, this.pluginApiVersion);\n }\n\n get size(): number {\n return this.plugins.length;\n }\n\n /** 返回只读清单快照,供诊断、插件目录和未来 registry 使用。 */\n get manifests(): readonly XCompilerPluginManifest[] {\n return this.plugins.map((plugin) => snapshotManifest(plugin.manifest));\n }\n\n setAudit(audit: AuditLogger): void {\n this.audit = audit;\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return;\n // 先置位,避免 setup 中的间接调用导致递归初始化。\n this.initialized = true;\n for (const plugin of this.plugins) {\n try {\n await plugin.setup(this.createApi(plugin));\n await this.audit?.event(\n 'note',\n t().plugins.loaded(plugin.manifest.id, plugin.manifest.version),\n {\n messageId: 'plugins.loaded',\n pluginId: plugin.manifest.id,\n pluginVersion: plugin.manifest.version,\n minXCompilerVersion: plugin.manifest.minXCompilerVersion,\n apiVersion: plugin.manifest.apiVersion,\n },\n );\n } catch (error) {\n await this.handleFailure(plugin, 'setup', error);\n }\n }\n }\n\n /** 把插件贡献的 Tool / Skill 合并到 Engine 的默认注册表;禁止静默覆盖核心能力。 */\n applyExtensions(target: PluginExtensionTarget): void {\n for (const { plugin, tool } of this.contributedTools) {\n if (target.tools.get(tool.name)) {\n throw new Error(t().plugins.extensionConflict(plugin.manifest.id, 'tool', tool.name));\n }\n target.tools.register(tool);\n }\n for (const { plugin, skill } of this.contributedSkills) {\n if (target.skills.get(skill.name)) {\n throw new Error(t().plugins.extensionConflict(plugin.manifest.id, 'skill', skill.name));\n }\n target.skills.register(skill);\n }\n }\n\n async emit<K extends HookName>(hook: K, context: HookContextMap[K]): Promise<void> {\n await this.initialize();\n const handlers = [...(this.hooks.get(hook) ?? [])]\n .sort((a, b) => (b.priority - a.priority) || (a.order - b.order));\n for (const registration of handlers) {\n try {\n await registration.handler(context);\n } catch (error) {\n await this.handleFailure(registration.plugin, hook, error);\n }\n }\n }\n\n /** 在不绕过原 Tool / EditGuard 的前提下增加 before / after / error Hook。 */\n wrapTool<A, R>(tool: Tool<A, R>): Tool<A, R> {\n return {\n name: tool.name,\n description: tool.description,\n argsSchema: tool.argsSchema,\n run: async (args, context) => {\n const before: HookContextMap['tool.before'] = {\n stepId: context.stepId,\n tool: tool.name,\n args,\n context,\n };\n await this.emit('tool.before', before);\n try {\n const result = await tool.run(before.args as A, context);\n const after: HookContextMap['tool.after'] = {\n ...before,\n result,\n };\n await this.emit('tool.after', after);\n return after.result as Awaited<ReturnType<Tool<A, R>['run']>>;\n } catch (error) {\n await this.emit('tool.error', { ...before, error });\n throw error;\n }\n },\n };\n }\n\n /** 包装完整 LLM 调用;response 可由 after Hook 做结构化后处理。 */\n wrapLLM(client: LLMClient, role: string): LLMClient {\n return {\n name: client.name,\n chat: async (messages, options) => {\n const before: HookContextMap['llm.before'] = {\n role,\n model: client.name,\n messages: [...messages],\n options: options ? { ...options } : undefined,\n };\n await this.emit('llm.before', before);\n const startedAt = Date.now();\n try {\n const response = await client.chat(before.messages, before.options);\n const after: HookContextMap['llm.after'] = {\n role,\n model: client.name,\n messages: before.messages,\n response,\n durationMs: Date.now() - startedAt,\n };\n await this.emit('llm.after', after);\n return after.response;\n } catch (error) {\n await this.emit('llm.error', {\n role,\n model: client.name,\n messages: before.messages,\n error,\n durationMs: Date.now() - startedAt,\n });\n throw error;\n }\n },\n };\n }\n\n private createApi(plugin: XCompilerPlugin): PluginApi {\n return {\n xcompilerVersion: this.xcompilerVersion,\n pluginApiVersion: this.pluginApiVersion,\n on: <K extends HookName>(\n hook: K,\n handler: HookHandler<K>,\n options: HookRegistrationOptions = {},\n ) => {\n const registration: RegisteredHook = {\n hook,\n plugin,\n handler: (context) => handler(context as HookContextMap[K]),\n priority: options.priority ?? 0,\n order: this.registrationOrder++,\n };\n const list = this.hooks.get(hook) ?? [];\n list.push(registration);\n this.hooks.set(hook, list);\n return () => {\n const current = this.hooks.get(hook);\n if (!current) return;\n const index = current.indexOf(registration);\n if (index >= 0) current.splice(index, 1);\n };\n },\n registerTool: (tool) => this.contributedTools.push({ plugin, tool }),\n registerSkill: (skill) => this.contributedSkills.push({ plugin, skill }),\n };\n }\n\n private async handleFailure(plugin: XCompilerPlugin, stage: string, error: unknown): Promise<void> {\n const message = error instanceof Error ? error.message : String(error);\n const rendered = t().plugins.hookFailed(plugin.manifest.id, stage, message);\n await this.audit?.event('note', rendered, {\n messageId: 'plugins.hook_failed',\n plugin: plugin.manifest.id,\n stage,\n error: message,\n });\n if (this.strict || plugin.failureMode === 'fail') throw error;\n console.warn(rendered);\n }\n}\n\nfunction assertPluginMetadata(\n plugins: XCompilerPlugin[],\n xcompilerVersion: string,\n pluginApiVersion: number,\n): void {\n const seen = new Set<string>();\n for (const plugin of plugins) {\n const report = checkPluginCompatibility(plugin.manifest, { xcompilerVersion, pluginApiVersion });\n if (!report.compatible) throw new Error(report.message);\n if (seen.has(report.pluginId)) throw new Error(t().plugins.duplicateId(report.pluginId));\n seen.add(report.pluginId);\n }\n}\n\nfunction snapshotPlugin(plugin: XCompilerPlugin): XCompilerPlugin {\n return { ...plugin, manifest: snapshotManifest(plugin.manifest) };\n}\n\nfunction snapshotManifest(manifest: XCompilerPluginManifest | undefined): XCompilerPluginManifest {\n if (!manifest) return {} as XCompilerPluginManifest;\n return {\n ...manifest,\n keywords: manifest.keywords ? [...manifest.keywords] : undefined,\n };\n}\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { t } from '../i18n/index.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport { checkPluginCompatibility } from './compatibility.js';\nimport type {\n PluginLoadOptions,\n PluginSource,\n XCompilerPlugin,\n XCompilerPluginManifest,\n} from './types.js';\n\ninterface PreflightSource {\n source: PluginSource;\n manifest: XCompilerPluginManifest;\n manifestPath: string;\n entryPath: string;\n}\n\n/**\n * 从磁盘加载插件。全部 manifest 会在任何插件模块 import 之前完成读取、兼容性与\n * 重复 ID 检查,避免不兼容插件借助模块顶层代码绕过宿主版本门禁。\n */\nexport async function loadPluginSources(options: PluginLoadOptions): Promise<XCompilerPlugin[]> {\n const baseDir = path.resolve(options.baseDir ?? process.cwd());\n const runtime = {\n xcompilerVersion: options.xcompilerVersion ?? XCOMPILER_VERSION,\n pluginApiVersion: options.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION,\n };\n const preflight: PreflightSource[] = [];\n\n for (const source of options.sources) {\n const manifestPath = path.resolve(baseDir, source.manifestPath);\n const entryPath = path.resolve(baseDir, source.entryPath);\n let manifest: XCompilerPluginManifest;\n try {\n manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as XCompilerPluginManifest;\n } catch (error) {\n const message = t().plugins.manifestReadFailed(manifestPath, errorMessage(error));\n await auditRejected(options, '', 'manifest-read', message, { manifestPath, entryPath });\n throw new Error(message, { cause: error });\n }\n const report = checkPluginCompatibility(manifest, runtime);\n if (!report.compatible) {\n const message = report.message ?? report.code;\n await auditRejected(options, report.pluginId, 'compatibility', message, { manifestPath, entryPath });\n throw new Error(message);\n }\n preflight.push({ source, manifest: snapshotManifest(manifest), manifestPath, entryPath });\n }\n\n const seen = new Set<string>();\n for (const item of preflight) {\n if (seen.has(item.manifest.id)) {\n const message = t().plugins.duplicateId(item.manifest.id);\n await auditRejected(options, item.manifest.id, 'duplicate-id', message, item);\n throw new Error(message);\n }\n seen.add(item.manifest.id);\n }\n\n const plugins: XCompilerPlugin[] = [];\n for (const item of preflight) {\n const exportName = item.source.exportName ?? 'default';\n let loaded: Record<string, unknown>;\n try {\n loaded = await import(pathToFileURL(item.entryPath).href) as Record<string, unknown>;\n } catch (error) {\n const message = t().plugins.moduleLoadFailed(item.manifest.id, item.entryPath, errorMessage(error));\n await auditRejected(options, item.manifest.id, 'module-load', message, item);\n throw new Error(message, { cause: error });\n }\n const plugin = loaded[exportName];\n if (!isPlugin(plugin)) {\n const message = t().plugins.exportInvalid(item.manifest.id, exportName);\n await auditRejected(options, item.manifest.id, 'module-export', message, item);\n throw new Error(message);\n }\n if (!sameRuntimeManifest(plugin.manifest, item.manifest)) {\n const message = t().plugins.manifestMismatch(item.manifest.id);\n await auditRejected(options, item.manifest.id, 'manifest-mismatch', message, item);\n throw new Error(message, { cause: new Error('plugin runtime manifest differs from preflight manifest') });\n }\n plugins.push({ ...plugin, manifest: snapshotManifest(item.manifest) });\n }\n return plugins;\n}\n\nfunction isPlugin(value: unknown): value is XCompilerPlugin {\n return !!value && typeof value === 'object' &&\n typeof (value as { setup?: unknown }).setup === 'function' &&\n !!(value as { manifest?: unknown }).manifest;\n}\n\nfunction sameRuntimeManifest(actual: XCompilerPluginManifest, expected: XCompilerPluginManifest): boolean {\n return actual.id === expected.id &&\n actual.version === expected.version &&\n actual.apiVersion === expected.apiVersion &&\n actual.minXCompilerVersion === expected.minXCompilerVersion;\n}\n\nfunction snapshotManifest(manifest: XCompilerPluginManifest): XCompilerPluginManifest {\n return { ...manifest, keywords: manifest.keywords ? [...manifest.keywords] : undefined };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nasync function auditRejected(\n options: PluginLoadOptions,\n pluginId: string,\n stage: string,\n message: string,\n detail: unknown,\n): Promise<void> {\n await options.audit?.event('note', message,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AAO,EAAE,GAAG,UAAU,UAAU,SAAS,WAAW,CAAC,GAAG,SAAS,QAAQ,IAAI,OAAU;AACzF;AAEA,SAAS,aAAa,OAAwB;AAC5C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;AAEA,eAAe,cACb,SACA,UACA,OACA,SACA,QACe;AACf,QAAM,QAAQ,OAAO,MAAM,QAAQ,SAAS;AAAA,IAC1C,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":["path","PYTHON_PLANNER_SYSTEM","PYTHON_EXECUTOR_SYSTEM","TYPESCRIPT_PLANNER_SYSTEM","TYPESCRIPT_EXECUTOR_SYSTEM","buildPlannerSystem","buildPlannerPhasePlanSystem","buildPlannerPhaseDecomposeSystem","buildExecutorSystem","messages","path","current","messages","current","snapshotManifest"]}
1
+ {"version":3,"sources":["../../src/i18n/en.ts","../../src/i18n/zh.ts","../../src/i18n/index.ts","../../src/version.ts","../../src/plugins/compatibility.ts","../../src/plugins/host.ts","../../src/plugins/loader.ts"],"sourcesContent":["import type { LanguageProfile } from '../core/language.js';\nimport type { Messages } from './types.js';\n\nconst PYTHON_PLANNER_SYSTEM = `You are the Planner of the XCompiler system. Your job is to compile a user's natural-language requirement into a strict iterative V-model Step plan.\n\nOutput language: Python only (plan.language is fixed to \"python\").\n\nCanonical V-model phases for every executable iteration:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\nDEBUG is not a normal V-model phase; it is the runtime rollback/repair mode. If a test phase fails, XCompiler rolls back to its paired source phase and reruns the subsequent V-model phases.\n\nMandatory phase documents:\n| Phase | Mandatory output file |\n|---|---|\n| REQUIREMENT_ANALYSIS | \\`docs/01-requirement-analysis.md\\` |\n| HIGH_LEVEL_DESIGN | \\`docs/02-high-level-design.md\\` |\n| DETAILED_DESIGN | \\`docs/03-detailed-design.md\\` |\n| UNIT_TEST | \\`docs/05-unit-test.md\\` |\n| INTEGRATION_TEST | \\`docs/06-integration-test.md\\` |\n| MODULE_TEST | \\`docs/07-module-test.md\\` |\n| FUNCTIONAL_TEST | \\`docs/08-functional-test.md\\` |\n\nFor P2+ iterations, put the same basenames under \\`docs/iterations/<iterationId>/\\`. The top-level \\`docs/topic.md\\` is written by xcompiler build and must never appear in Step outputs.\n\nSynchronous test-design rule:\n- REQUIREMENT_ANALYSIS must also output \\`docs/tests/functional-test-plan.md\\`.\n- HIGH_LEVEL_DESIGN must also output \\`docs/tests/module-test-plan.md\\`.\n- DETAILED_DESIGN must also output \\`docs/tests/integration-test-plan.md\\`.\n- CODE must also output \\`docs/tests/unit-test-plan.md\\`.\nFor P2+ iterations, put those under \\`docs/iterations/<iterationId>/tests/\\`.\n\nPhase responsibilities:\n- REQUIREMENT_ANALYSIS defines functional scope, acceptance criteria, boundaries, and user-visible behaviour.\n- HIGH_LEVEL_DESIGN defines the current development module's position in the whole system plus system-level external interfaces and dependencies, including external APIs, third-party library choices, dependency confirmation, data contracts, and integration boundaries.\n- DETAILED_DESIGN defines the module-internal functions, data structures, algorithms, control flow, error handling, and internal architecture.\n- CODE implements only the designed scope and produces runnable/importable Python source.\n- UNIT_TEST verifies CODE internals and public functions.\n- INTEGRATION_TEST verifies module-internal collaboration, data flow, and component integration from DETAILED_DESIGN.\n- MODULE_TEST verifies the current module's position in the whole system, external interfaces, and dependency boundaries from HIGH_LEVEL_DESIGN.\n- FUNCTIONAL_TEST verifies requirements end-to-end and produces user-facing documentation.\n\nFunctional documentation bundle: P1 FUNCTIONAL_TEST outputs must include \\`README.md\\`, \\`docs/quickstart.md\\`, and \\`docs/08-functional-test.md\\`; for \\`projectType\\` = \\`library\\` or \\`mixed\\`, also include \\`docs/api-guide.md\\`. P2+ uses \\`docs/iterations/<iterationId>/08-functional-test.md\\`, \\`quickstart.md\\`, and optional \\`api-guide.md\\`. Documentation must follow the active i18n language.\n\nMandatory rules:\n1. Return pure JSON only. No Markdown fences.\n2. Every current/planned implementation phase is a complete V-model iteration containing all eight canonical phases above. Never emit the old phases REQUIREMENT, ARCH, TASK, TEST, REFACTOR, or DELIVERY.\n3. Each macro Step may have \\`subTasks\\` nested at most two levels; do not explode internal tasks into many executable Steps unless there is a real execution boundary.\n4. dependsOn must follow the phase order and be acyclic. Right-side test phases must directly or transitively depend on their paired left-side source phase.\n5. Every CODE Step must be covered by a UNIT_TEST Step in the same iteration.\n6. Design phases must not output src/ or tests/ files. CODE owns src/. Test phases own tests/ and their report docs. FUNCTIONAL_TEST must not modify src/.\n7. The same outputs path is globally unique. DEBUG may modify dependency-chain files at runtime; planned Steps should not duplicate outputs.\n8. id has the form S001, S002, ...; role is Planner / Architect / Coder / Tester / Debugger.\n9. Every Step needs a systemPrompt that pins scope, inputs, outputs, acceptance, forbidden actions, and the paired test-design obligation when applicable.\n10. projectType is inferred by the LLM after clarification: application, library, or mixed. There is no CLI project-type override.\n11. complexityAssessment is your plan-stage complexity assessment. simple => P1 only; moderate => at least P1+P2; complex => at least P1+P2+P3. If the user explicitly asks for phases/stages, set userForcedPhaseSplit=true and split.\n12. implementationPhases must include P1 current and any planned executable phases. Each phase has a verificationGate whose failurePolicy says to feed the failure log to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\n13. dependencies is a Python pip dependency list. Include \\`pytest\\`; use bare package names only; never list \\`requirements.txt\\` in Step outputs.\n14. Application/mixed projects need a directly executable Python entry point (\\`src/main.py\\` or package \\`__main__.py\\`) that reuses CODE modules. Library/mixed projects need a stable public API and \\`docs/api-guide.md\\`.\n15. Structured HIGH_LEVEL_DESIGN -> CODE -> MODULE_TEST contract: for non-trivial work, return \\`architectureModules\\` with each module's id, name, responsibility, sourcePaths, testPaths, and dependencies. CODE/MODULE_TEST Steps may cover multiple modules but must list module-level work in subTasks.\n16. Third-party library choices must match real APIs: HIGH_LEVEL_DESIGN must name the concrete entry point function/class or verification basis for the selected library in this requirement; do not invent parser/export APIs from package names alone.\n\nOutput JSON shape:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"Core functionality\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"run tests\", \"probe entrypoint/API\", \"verify functional docs\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ],\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"module name\", \"responsibility\": \"one clear responsibility\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n {\n \"id\": \"S001\",\n \"iterationId\": \"P1\",\n \"phase\": \"REQUIREMENT_ANALYSIS\",\n \"title\": \"string\",\n \"description\": \"string\",\n \"systemPrompt\": \"Step-specific prompt: scope, inputs, outputs, acceptance, forbidden actions\",\n \"role\": \"Planner\",\n \"tools\": [\"write_file\"],\n \"inputs\": [\"docs/topic.md\"],\n \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"],\n \"subTasks\": [\n { \"id\": \"T1\", \"title\": \"string\", \"description\": \"string\", \"acceptance\": \"string\", \"outputs\": [\"docs/01-requirement-analysis.md\"], \"subTasks\": [] }\n ],\n \"dependsOn\": [],\n \"acceptance\": \"string\",\n \"maxRetries\": 3\n }\n ]\n}`;\n\nconst PYTHON_EXECUTOR_SYSTEM = `You are XCompiler's Step Executor. You may only interact with the system through JSON tool calls — no Markdown and no explanatory text.\n\nEvery round you must return strict JSON:\n{\n \"thoughts\": \"<one sentence describing this round's intent>\",\n \"issueResolutionPlan\": \"<required only in DEBUG issue mode: concise root cause, repair target, and validation plan>\",\n \"actions\": [ { \"tool\": \"<tool name>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\nRules:\n1. Only call tools in the Step's authorised whitelist.\n2. File writes must land within the Step's writable allowlist (other paths are rejected); required outputs are the final artifacts that must exist for acceptance.\n For FUNCTIONAL_TEST documentation outputs, write the complete declared bundle in the active i18n language: P1 paths such as \\`README.md\\`, \\`docs/quickstart.md\\`, \\`docs/08-functional-test.md\\`, and \\`docs/api-guide.md\\` when present, or the declared iteration-scoped equivalents under \\`docs/iterations/<iterationId>/\\`. Do not set done=true while any declared documentation output is missing.\n3. Generated code must follow the target language's best practice; modules importable, functions typed appropriately.\n - [Import convention] When modules under src/ import each other, use \"from <module> import …\" (sibling name).\n **Never write \"from src.<module> import …\".** If main.py needs to run from the project root, prepend\n \"sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\" before any import,\n so that both \"python src/main.py …\" and \"python -m src.main …\" work.\n - [Test convention] Files under tests/ also import targets via \"from <module> import …\".\n **XCompiler auto-generates tests/conftest.py to inject project-root and src/ into sys.path**,\n so both pytest and \"python tests/test_*.py\" can resolve modules — test files\n **must NOT** add their own sys.path.insert(...). If you create or edit conftest.py yourself,\n keep the existing sys.path injection — do not delete it.\n - [Self-contained tests] Tests **must NOT** open() a sample file that does not exist on disk\n (e.g. \"sample.csv\"). When a target function needs file input, choose in this priority order:\n (a) first reuse a real sample supplied by the user or already present in the workspace, copying/referencing it under tests/fixtures/<name>;\n (b) for third-party or industry-standard formats with no local sample, use http_fetch to obtain a small reference sample from official docs,\n the upstream repository, or a public standard/example, save it under tests/fixtures/<name>, and record the source in the test report or comment;\n (c) only for simple text formats such as CSV/JSON/INI, and only when you can immediately run_tests, construct a minimal sample with pytest tmp_path.\n If the network is unavailable, no user sample exists, and the format standard cannot be confirmed, report a blocker asking the user for a sample.\n A test that references a file nobody created will trap the Debugger in an endless FileNotFoundError loop.\n - [Fixture iteration] When a test runs but the target function raises \"Invalid syntax / Parse error / Malformed\",\n the **fixture itself is malformed**, **not the implementation**.\n read_file the fixture, identify the format from the extension/parser/error, then prefer a user/workspace sample or an authoritative http_fetch reference;\n rewrite the whole fixture with write_file and run_tests. After repeated failures on a complex domain format, stop inventing from memory and ask\n for a user sample or network reference.\n Never edit the implementation, the assertion, or mock out the parser to \"fix\" a parse error — fix the fixture first.\n4. When all outputs files exist and self-check passes, set done = true with empty actions.\n5. Correct any error in the next round's actions; never overstep authority or invent tools.\n6. [Large-file chunked writes] write_file / append_file content must stay under the current Step's runtime chunk limit shown in the tool docs.\n - For larger files: in the same actions array, first write_file the head (imports + top-level constants + first function/class),\n then several append_file calls each adding one function/class block (preserving trailing newlines).\n - For complex projects, prefer multiple cohesive modules/files and separate CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Steps over one giant file.\n - The concatenated result must be valid Python; never split inside a function body.\n - For partial edits to existing files, use replace_in_file / apply_patch — do not overwrite the whole file repeatedly.`;\n\nconst TYPESCRIPT_PLANNER_SYSTEM = `You are the Planner of the XCompiler system. Your job is to compile a user's natural-language requirement into a strict iterative V-model Step plan.\n\nOutput language: TypeScript / Node.js only (plan.language is fixed to \"typescript\").\n\nCanonical V-model phases for every executable iteration:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\nDEBUG is runtime rollback/repair only. If a test phase fails, XCompiler rolls back to its paired source phase and reruns subsequent phases.\n\nUse the same phase documents and synchronous test-design rule as the Python planner:\n- REQUIREMENT_ANALYSIS: \\`docs/01-requirement-analysis.md\\` plus \\`docs/tests/functional-test-plan.md\\`.\n- HIGH_LEVEL_DESIGN: \\`docs/02-high-level-design.md\\` plus \\`docs/tests/module-test-plan.md\\`.\n- DETAILED_DESIGN: \\`docs/03-detailed-design.md\\` plus \\`docs/tests/integration-test-plan.md\\`.\n- CODE: implementation outputs plus \\`docs/tests/unit-test-plan.md\\`.\n- UNIT_TEST: \\`docs/05-unit-test.md\\`.\n- INTEGRATION_TEST: \\`docs/06-integration-test.md\\`.\n- MODULE_TEST: \\`docs/07-module-test.md\\`.\n- FUNCTIONAL_TEST: \\`docs/08-functional-test.md\\`, \\`README.md\\`, \\`docs/quickstart.md\\`, and \\`docs/api-guide.md\\` for library/mixed projects.\nFor P2+ iterations, put phase docs under \\`docs/iterations/<iterationId>/\\` and test plans under \\`docs/iterations/<iterationId>/tests/\\`.\n\nHIGH_LEVEL_DESIGN must place the current development module in the whole system and define system-level external interfaces and dependencies, including external APIs, third-party library choices, dependency confirmation, package.json scripts, package dependencies/devDependencies, tsconfig, data contracts, and integration boundaries.\nDETAILED_DESIGN must define module-internal functions, types, data structures, algorithms, control flow, error handling, and internal architecture.\n\nMandatory rules:\n1. Return pure JSON only. Never emit the old phases REQUIREMENT, ARCH, TASK, TEST, REFACTOR, or DELIVERY.\n2. Every current/planned implementation phase is a complete V-model iteration containing all eight canonical phases.\n3. Each macro Step may contain \\`subTasks\\` nested at most two levels.\n4. Every CODE Step must be covered by a UNIT_TEST Step in the same iteration; module testPaths from architectureModules must be produced by MODULE_TEST.\n CODE outputs must contain product source files under src/ plus docs/tests/unit-test-plan.md only; never list tests/**/*.test.ts or other tests/** files as CODE outputs.\n5. Design phases must not output src/ or tests/ files. HIGH_LEVEL_DESIGN is the only phase that may output \\`package.json\\` / \\`tsconfig.json\\`.\n6. Exactly one HIGH_LEVEL_DESIGN Step must output \\`package.json\\` for greenfield TypeScript plans; ensure one HIGH_LEVEL_DESIGN Step output \\`package.json\\`. It must include scripts for \\`build\\`, \\`test\\`, and preferably \\`lint\\`.\n7. Local TypeScript source imports must use explicit \\`.ts\\` ESM specifiers. Configure \\`allowImportingTsExtensions: true\\` and use \\`tsc --noEmit\\`. Generated TypeScript must be compatible with Node native type stripping: avoid enums, namespaces, parameter properties, and transform-required syntax.\n8. dependencies is an advisory runtime npm package list; the authoritative manifest is \\`package.json\\` from HIGH_LEVEL_DESIGN. Do not invent package names.\n9. Application/mixed projects need \\`src/main.ts\\` with a directly runnable \\`main()\\`; library/mixed projects need \\`src/index.ts\\` or equivalent public API plus API guide.\n10. complexityAssessment and implementationPhases follow the same rules as Python: simple => P1, moderate => at least P1+P2, complex => at least P1+P2+P3, forced phase split => set userForcedPhaseSplit=true.\n11. verificationGate failurePolicy must say: Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\n12. For non-trivial work, return architectureModules with sourcePaths and testPaths; CODE/MODULE_TEST Steps may cover multiple modules but must list module-level work in subTasks.\n13. TypeScript tests must use Vitest only. Never request Jest, ts-jest, @types/jest, ts-node, or nodemon in Step prompts or package.json; package.json must use \"test\": \"vitest run\" and \"build\": \"tsc --noEmit\".\n\nOutput JSON shape is identical to Python and must include \\`\"projectType\": \"application | library | mixed\"\\`, with TypeScript paths such as \\`src/example.ts\\` and \\`tests/example.test.ts\\`; the first Step phase must be \\`REQUIREMENT_ANALYSIS\\`, not \\`REQUIREMENT\\`. There is no CLI project-type override.`;\n\nconst TYPESCRIPT_EXECUTOR_SYSTEM = `You are XCompiler's Step Executor. You may only interact with the system through JSON tool calls — no Markdown and no explanatory text.\n\nEvery round you must return strict JSON:\n{\n \"thoughts\": \"<one sentence describing this round's intent>\",\n \"issueResolutionPlan\": \"<required only in DEBUG issue mode: concise root cause, repair target, and validation plan>\",\n \"actions\": [ { \"tool\": \"<tool name>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\nRules:\n1. Only call tools in the Step's authorised whitelist.\n2. File writes must land within the Step's writable allowlist (other paths are rejected); required outputs are the final artifacts that must exist for acceptance.\n For FUNCTIONAL_TEST documentation outputs, write the complete declared bundle in the active i18n language: P1 paths such as \\`README.md\\`, \\`docs/quickstart.md\\`, \\`docs/08-functional-test.md\\`, and \\`docs/api-guide.md\\` when present, or the declared iteration-scoped equivalents under \\`docs/iterations/<iterationId>/\\`. Do not set done=true while any declared documentation output is missing.\n3. Generated code must follow TypeScript / Node.js best practice; modules importable, APIs typed, and runtime code directly runnable.\n - [Import convention] Local source modules under src/ use ESM relative imports with explicit \".ts\" specifiers, e.g. \\`import { x } from \"./util.ts\";\\`. Keep code compatible with Node's native TypeScript type stripping: use erasable type syntax only, and avoid enums, namespaces, parameter properties, or other transform-required TS features. Never use Python-style imports, \\`from src.<module>\\`, or sys.path hacks.\n - [Test convention] Tests use Vitest: \\`import { describe, it, expect } from \"vitest\";\\`. Test files live under \\`tests/**/*.test.ts\\`.\n - [Self-contained tests] Tests **must NOT** read a sample file that does not exist on disk. When a target function needs file input, either create the content inside the test or write fixtures under \\`tests/fixtures/<name>\\`.\n - [Fixture iteration] When a test runs but the target function raises \"Invalid syntax / Parse error / Malformed\", the **fixture itself is malformed**. read_file the fixture, prefer a user/workspace sample; if none exists, use http_fetch to obtain an authoritative public reference; construct minimal samples only for simple text formats and immediately run_tests. Never weaken the implementation/assertion, and never repeatedly invent complex domain fixtures from memory.\n4. When all outputs files exist and self-check passes, set done = true with empty actions.\n5. Correct any error in the next round's actions; never overstep authority or invent tools.\n6. [Large-file chunked writes] write_file / append_file content must stay under the current Step's runtime chunk limit shown in the tool docs.\n - For larger files: in the same actions array, first write_file the head (imports + top-level constants + first function/class), then several append_file calls each adding one function/class block.\n - For complex projects, prefer multiple cohesive modules/files and separate CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Steps over one giant file.\n - The concatenated result must be valid TypeScript; never split inside a function body.\n - For partial edits to existing files, use replace_in_file / apply_patch — do not overwrite the whole file repeatedly.\n7. package.json is the dependency manifest. Use add_dependency for npm packages; never write requirements.txt.\n8. run_program runs the project entry with \\`npx tsx\\`, run_tests runs Vitest via \\`npm test\\`, and the final delivery gate also verifies the direct Node entry command.`;\n\nconst PLANNER_CLARIFY_SYSTEM = `You are the requirements analyst for XCompiler's V-model. Do not restate the topic; expose unresolved decisions that would change functional design, acceptance, or architecture boundaries.\nReturn strict JSON only. Each question must be directly answerable by a product owner and cover one decision. Avoid vague catch-all or implementation-stack questions, except for the single development-language question when the user prompt explicitly requires it.`;\n\nfunction buildPlannerSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_PLANNER_SYSTEM : PYTHON_PLANNER_SYSTEM) + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhasePlanSystem(profile: LanguageProfile): string {\n return `You are the Planner of XCompiler. This is two-level planning, pass one: PhasePlan.\n\nTarget language: ${profile.displayName}.\n\nReturn only the project-level PhasePlan. Do not return steps, architectureModules, dependencies, or any individual V-model Step.\n\nThe PhasePlan must:\n1. Classify projectType: application / library / mixed.\n2. Assess complexityAssessment: simple / moderate / complex with rationale.\n3. Produce implementationPhases: P1 status=current; later P2/P3 status=planned. simple uses P1 only; moderate uses at least P1+P2; complex uses at least P1+P2+P3; user-forced staging uses at least P1+P2 and userForcedPhaseSplit=true.\n4. Give each phase objective, scope, deliverables, dependsOn, and verificationGate.\n5. Keep planned phases as goals and gates only. Do not expand any Step for them; a separate pass will generate a full V-model plan for one phase at a time.\n\nReturn strict JSON only:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"Core functionality\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"...\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ]\n}\n\nNo Markdown, no explanatory prose, no steps, no source/test file inventory.` + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhaseDecomposeSystem(profile: LanguageProfile): string {\n return `You are the Planner of XCompiler. This is two-level planning, pass two: generate a full V-model StepPlan for the requested phase.\n\nTarget language: ${profile.displayName}.\n\nYou will receive a frozen PhasePlan and a phaseId. Generate Steps only for that phaseId. Planned phases must not be expanded into this StepPlan.\n\nEvery current phase must use the canonical V-model:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST.\n\nPhase responsibilities:\n- REQUIREMENT_ANALYSIS defines functional scope, acceptance, boundaries, and user-visible behaviour, and synchronously emits the functional test plan.\n- HIGH_LEVEL_DESIGN defines system position, external interfaces, third-party library choices, dependency confirmation, and integration boundaries, and synchronously emits the integration test plan.\n- DETAILED_DESIGN defines module-internal functions/classes, data structures, algorithms, control flow, error handling, and internal architecture, and synchronously emits the module test plan.\n- CODE implements only the current phase and synchronously emits the unit test plan.\n- UNIT_TEST / INTEGRATION_TEST / MODULE_TEST / FUNCTIONAL_TEST verify their paired left-side phases.\n\nStrict output ownership:\n- CODE outputs may include only product source files under src/ and the unit-test-plan document; do not put tests/** files in CODE outputs.\n- UNIT_TEST owns unit test files; INTEGRATION_TEST owns integration test files; MODULE_TEST owns architectureModules.testPaths; FUNCTIONAL_TEST owns end-to-end/functional test files and delivery docs.\n- For greenfield TypeScript, exactly one HIGH_LEVEL_DESIGN Step must output package.json with scripts, dependencies, and devDependencies. CODE must not output package.json.\n- For TypeScript package.json, use Vitest only: \"test\": \"vitest run\", \"build\": \"tsc --noEmit\", devDependencies include typescript/tsx/vitest/@types/node. Do not mention or request Jest, ts-jest, @types/jest, ts-node, or nodemon.\n\nReturn only the current phase's dependencies, architectureModules, and steps. Complex or multi-concern work must declare architectureModules for the current phase and map module-level work under CODE/MODULE_TEST subTasks. Each Step's subTasks may nest at most two levels.\n\narchitectureModules may describe only product/business source modules for the current phase:\n- sourcePaths must be target-language source files under src/. They must not be directories, tests/, docs/, README, fixtures, utils, or report files.\n- testPaths must be target-language test files under tests/. They must not be directories.\n- Test fixtures, test helpers, sample inputs, and temporary output files belong in test Step outputs or subTasks, not in architectureModules.\n\nReturn strict JSON only:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"module name\", \"responsibility\": \"one clear responsibility\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n { \"id\": \"S001\", \"iterationId\": \"P1\", \"phase\": \"REQUIREMENT_ANALYSIS\", \"title\": \"string\", \"description\": \"string\", \"systemPrompt\": \"scope, inputs, outputs, acceptance, forbidden actions\", \"role\": \"Planner\", \"tools\": [\"write_file\"], \"inputs\": [\"docs/topic.md\"], \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"], \"subTasks\": [], \"dependsOn\": [], \"acceptance\": \"string\", \"maxRetries\": 3 }\n ]\n}\n\nDo not output Steps for future planned phases. Do not output requirements.txt. Design phases must not write src/tests. FUNCTIONAL_TEST must include README.md, docs/quickstart.md, and the functional validation document.` + profile.plannerPromptOverride;\n}\n\nfunction buildExecutorSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_EXECUTOR_SYSTEM : PYTHON_EXECUTOR_SYSTEM) + profile.executorPromptOverride;\n}\nconst messages: Messages = {\n llm: {\n coderDebuggerSameModel: (model, coderProvider, debuggerProvider) =>\n `Model configuration advice: Coder (${coderProvider}) and Debugger (${debuggerProvider}) both use ${model}. Prefer different models so debugging provides an independent reasoning path.`,\n invalidBaseUrl: (raw, fallback) => `[xcompiler] invalid base_url (${raw}); falling back to ${fallback}`,\n providerValidationFailed: (role, model) => `[${role}] provider ${model} failed output validation; trying next`,\n providerCallFailed: (role, model) => `[${role}] provider ${model} failed; trying next`,\n scoreReadFailed: (p, message) => `failed to read ${p}: ${message}`,\n scoreChanged: (provider, score, previous) => `score(${provider}) = ${score} (was ${previous})`,\n scorePersistFailed: (message) => `failed to persist scores: ${message}`,\n preflightOllamaReachable: (baseUrl, models) => `preflight: ollama ${baseUrl} reachable; found ${models} model(s)`,\n preflightOllamaUnreachable: (baseUrl, message) => `preflight: ollama ${baseUrl} unreachable: ${message}`,\n preflightAutoAdded: (providers, roles) => `preflight: auto-added ${providers} provider(s) for roles [${roles}]`,\n scoreFileHeader: '# XCompiler LLM provider score snapshot (maintained automatically by ScoreStore; do not edit)',\n scoreFileSemantics: '# Scores: dynamic snapshot; default 1.0; automatic range 0.1-1.0; providers tagged cluster default to 0.2-0.5 unless llm.cluster_score_min/max widens it; failure -0.5; success +0.1. Put user overrides in llm_scores_user.yaml; 0 disables a provider.',\n },\n system: {\n configEnvMissing: (names) => `[xcompiler] unset config environment variables were replaced with empty strings: ${names}`,\n unhandledError: (message) => `Unhandled error: ${message}`,\n unsupportedPypiOnlyNetwork:\n 'network=pypi-only is rejected because Docker cannot enforce a PyPI-only allowlist by itself. Use network=off for isolation or network=download-only for explicitly unrestricted outbound downloads.',\n dockerInsideContainerUnsupported:\n 'XCompiler is running inside a container, so sandbox mode docker is unsupported because Docker-outside-of-Docker can mis-map bind mounts and docker.sock permissions. Use agent.sandboxes.<language>.mode=subprocess, run XCompiler on the host, or set XC_IN_CONTAINER=0 only in a controlled environment.',\n firejailUnsupported: 'sandbox=firejail is not implemented; use subprocess or docker.',\n smokeHeader: (baseUrl) => `Smoke test against ${baseUrl} (streaming)`,\n smokeOk: (model, totalMs, firstTokenMs, chunks, preview) =>\n `[OK total=${totalMs}ms first-token=${firstTokenMs}ms chunks=${chunks}] ${model} -> ${preview}`,\n smokeFail: (model, message) => `[FAIL] ${model} -> ${message}`,\n },\n plugins: {\n invalidId: (id) => `Plugin ID \"${id}\" is invalid; use lowercase letters, digits, dots, hyphens, or underscores.`,\n duplicateId: (id) => `Duplicate plugin ID: ${id}`,\n invalidVersion: (plugin, version) => `Plugin ${plugin} has an invalid SemVer version: ${version}`,\n invalidCoreVersion: (version) => `XCompiler core has an invalid SemVer version: ${version}`,\n apiVersionMismatch: (plugin, actual, expected) => `Plugin ${plugin} targets Plugin API ${actual}; this XCompiler runtime requires API ${expected}.`,\n invalidMinimumVersion: (plugin, version) => `Plugin ${plugin} has an invalid minimum XCompiler version: ${version}`,\n coreVersionTooOld: (plugin, minimum, actual) => `Plugin ${plugin} requires XCompiler >= ${minimum}; current version is ${actual}.`,\n loaded: (plugin, version) => `Plugin ${plugin}@${version} loaded.`,\n extensionConflict: (plugin, kind, name) => `Plugin ${plugin} cannot replace existing ${kind} \"${name}\".`,\n hookFailed: (plugin, stage, message) => `Plugin ${plugin} failed during ${stage}: ${message}`,\n manifestReadFailed: (path, message) => `Cannot read plugin manifest ${path}: ${message}`,\n moduleLoadFailed: (plugin, path, message) => `Cannot load plugin ${plugin} from ${path}: ${message}`,\n exportInvalid: (plugin, exportName) => `Plugin ${plugin} export ${exportName} is not a valid XCompiler plugin`,\n manifestMismatch: (plugin) => `Plugin ${plugin} runtime manifest does not match its preflight manifest`,\n },\n audit: {\n processLogTitle: '# XCompiler Development Process Log',\n processLogPreamble: '> Generated by XCompiler. Records CLI sessions, user input, LLM interactions, and execution actions for delivery traceability.',\n sessionStart: (ts, command) => `## ▶ Session ${ts} — \\`${command}\\``,\n sessionEnd: (ts) => `### ◀ Session end ${ts}`,\n eventSessionStart: (command) => `start ${command}`,\n eventSessionEnd: (command) => `end ${command}`,\n userInput: (label) => `#### 👤 User input — ${label}`,\n llmRequest: (role, model) => `🤖 LLM Request — <code>${role}</code> via <code>${model}</code>`,\n llmResponse: (role, model) => `📩 LLM Response — <code>${role}</code> via <code>${model}</code>`,\n executorTurn: (stepId, round, role, provider, actions, done) =>\n `🧠 Executor turn — <code>${stepId}</code> round ${round} / role <code>${role}</code>${provider ? ` · via <code>${provider}</code>` : ''} (actions=${actions}, done=${done})`,\n thoughtsLabel: '**thoughts:**',\n actionsLabel: '**actions:**',\n noThoughts: '(no thoughts)',\n plannerThought: (stage, provider) => `🧩 Planner thought — ${stage}${provider ? ` · via <code>${provider}</code>` : ''}`,\n markdownAppendFailed: (message) => `[audit] markdown append failed: ${message}`,\n jsonlAppendFailed: (message) => `[audit] jsonl append failed: ${message}`,\n traceLine: (kind, message) => `[audit] ${kind} ${message}`,\n autoFixedSrcImport: (p) => `auto-fixed src import in ${p}`,\n wroteFile: (p) => `wrote ${p}`,\n userDecision: (label, value) => `${label} → ${value}`,\n eventLlmRequest: (role, model) => `${role} → ${model}`,\n eventLlmResponse: (role, model) => `${role} ← ${model}`,\n eventLlmError: (role, model, message) => `${role} via ${model}: ${message}`,\n eventExecutorTurn: (stepId, round, role, provider) => `${stepId} round=${round} role=${role}${provider ? ` via ${provider}` : ''}`,\n eventPlannerThought: (stage, provider) => `Planner ${stage}${provider ? ` via ${provider}` : ''}`,\n llmChatFailedThought: (message) => `LLM chat failed: ${message}`,\n llmChatAborted: (stepId, round, chars, message) => `${stepId} round ${round} aborted after ${chars} chars: ${message}`,\n toolDenied: (tool) => `denied tool ${tool}`,\n toolCalled: (tool) => `called tool ${tool}`,\n toolResult: (tool, ok, detail) => `tool ${tool} ${ok ? 'succeeded' : 'failed'}: ${detail}`,\n documentArchived: (from, to) => `archived ${from} → ${to}`,\n documentArchiveFailed: (p, message) => `failed to archive ${p}: ${message}`,\n httpFetchSaved: (method, url, p, bytes) => `http_fetch ${method} ${url} → ${p} (${bytes} B)`,\n httpFetchResponse: (method, url, status, bytes) => `http_fetch ${method} ${url} → ${status} (${bytes} B)`,\n partialFailureHeader: (message) => `# LLM chat failed: ${message}`,\n streamLength: (chars) => `# Stream length: ${chars} chars`,\n },\n stream: {\n resolvingModel: 'resolving-model',\n waiting: 'waiting',\n streaming: 'streaming',\n done: 'done',\n failed: 'failed',\n chars: (n) => `${n} chars`,\n toolRunner: 'local-tool',\n toolExecution: (stepId, tool) => `${stepId} tool ${tool}`,\n },\n sandboxLog: {\n subprocessBuilt: (deps) => `subprocess sandbox built (${deps ? 'with dependencies' : 'empty'})`,\n subprocessNodeBuilt: 'Node subprocess sandbox built (npm install)',\n dockerBuilt: (deps) => `Docker sandbox built (${deps ? 'with dependencies' : 'empty'})`,\n dockerNodeBuilt: 'Docker Node sandbox built (npm install)',\n command: (runtime, command) => `${runtime} ${command}`,\n },\n cli: {\n rootDescription: 'XCompiler — AI Software Factory CLI',\n compileDescription: 'Interactively compile a requirement into phasePlan.json and the current phase plan (with mandatory human gates)',\n runDescription: 'Execute a confirmed phasePlan.json (supports phased runs: --phase / --from)',\n loadDescription: 'Load a XXX.xc project file and continue its current plan',\n appendDescription: 'Append a new requirement to an existing XXX.xc project through clarification and V-model execution',\n lsDescription: 'Scan workspace and list every phasePlan.json / legacy plan.json status summary',\n showDescription: 'Print Step definition / status / outputs / recent audit',\n optWorkspace: 'workspace directory (alias of --output, defaults to current directory)',\n optOutput: 'project / workspace output directory (highest priority, alias of -w)',\n optConfig: 'path to config.yaml',\n optInput: 'read requirement from a file (non-interactive)',\n optTopic: 'reuse an already-clarified topic.md as input: skip intake / clarify / addenda / Gate 1 and go straight to decompose',\n optPlanOut: 'output path for phasePlan.json (default <workspace>/phasePlan.json)',\n optBaseDir: 'project root output directory (creates <name> subdir under it)',\n optName: 'project name (default xcompiler-<timestamp>)',\n optYes: 'skip human confirmation (only meaningful with -i / -t)',\n optForce: 'force regenerate: override workspace lock and ignore existing plan files',\n optDryRun: 'print topology only, do not execute',\n optFrom: 'start from the given Step (earlier ones are skipped)',\n optPhase: 'execute only the given phase (REQUIREMENT_ANALYSIS/HIGH_LEVEL_DESIGN/DETAILED_DESIGN/CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST/DEBUG)',\n optReset: 'reset all Step status to PENDING',\n optMaxDepth: 'maximum recursion depth',\n optTail: 'number of recent audit entries',\n optPlan: 'phasePlan.json path, default <workspace>/phasePlan.json',\n optLang: 'UI / prompt language: EN | CN (ISO 3166-1 Alpha-2)',\n optIntent: 'plan intent: greenfield | feature | refactor | self',\n optBaselinePlan: 'existing baseline phasePlan.json / plan.json path (default <workspace>/phasePlan.json)',\n optProjectFile: 'XXX.xc project file path (default <workspace>/<name>.xc)',\n optDebugWikiPath: 'debug wiki root directory path (default <XCompiler path>/.xcompiler/debug-wiki)',\n argPlan: 'phasePlan.json or legacy plan.json path (default = <workspace>/phasePlan.json)',\n argProjectFile: 'XXX.xc project file',\n argStepId: 'Step ID, e.g. S001',\n evolveDescription: 'Generate and execute an incremental feature/refactor plan on top of an existing workspace',\n bootstrapDescription: 'Build and qualify the next XCompiler generation in an isolated Git worktree',\n optRepository: 'XCompiler Git repository to bootstrap (default current directory)',\n optPromote: 'fast-forward the current branch after every qualification gate passes',\n optCleanup: 'remove the isolated worktree after writing the report (branch is retained)',\n optDockerQualification: 'use the experimental Docker runner for candidate qualification',\n invalidLocale: (value) => `Unsupported language \"${value}\"; use EN or CN.`,\n invalidIntent: (value, allowed) => `Invalid intent \"${value}\"; expected one of: ${allowed}.`,\n invalidPhase: (value, allowed) => `Invalid phase \"${value}\"; expected one of: ${allowed}.`,\n invalidStepId: (value) => `Invalid Step ID \"${value}\"; expected S followed by at least three digits.`,\n invalidNonNegativeInteger: (value) => `Expected a non-negative integer, received \"${value}\".`,\n helpUsage: 'Usage:',\n helpArguments: 'Arguments:',\n helpOptions: 'Options:',\n helpCommands: 'Commands:',\n helpOption: 'display help for command',\n versionOption: 'output the version number',\n defaultValue: (value) => `(default: ${value})`,\n },\n bootstrap: {\n notGitRepository: (p) => `Not a Git repository: ${p}`,\n dirtyRepository: (files) => `Self-bootstrap requires a clean host repository. Pending paths: ${files}`,\n worktreeReady: (p, branch) => `Bootstrap worktree ready: ${p} (${branch})`,\n compileStarted: 'Compiling the self-bootstrap V-model plan…',\n compileFailed: (code, message) => `Self-bootstrap compilation failed (exit=${code}): ${message}`,\n compileCancelled: 'Self-bootstrap compilation was cancelled before a plan was confirmed.',\n executeStarted: 'Executing the candidate generation in the isolated worktree…',\n executeFailed: (status) => `Candidate execution did not complete successfully (${status}).`,\n qualificationStarted: 'Running deterministic bootstrap qualification gates…',\n qualificationDockerExperimental: 'Docker qualification is experimental and has not completed environment validation.',\n missingScript: (name) => `required package.json script is missing: ${name}`,\n missingBin: 'package.json does not declare a CLI bin entry',\n checkPassed: (name, ms) => `${name} passed (${ms}ms)`,\n checkFailed: (name, code) => `${name} failed (exit=${code})`,\n reportWritten: (p) => `Bootstrap report written: ${p}`,\n candidateReady: (branch) => `Candidate is qualified on ${branch}; promotion still requires explicit --promote.`,\n promoted: (branch) => `Bootstrap candidate promoted by fast-forward merge: ${branch}`,\n cleanupDone: (p) => `Bootstrap worktree removed: ${p}`,\n promotionBlocked: 'Promotion blocked because one or more qualification gates failed.',\n hostHeadChanged: 'host HEAD changed during bootstrap',\n candidateDirty: (files) => `Candidate worktree changed outside a committed generation: ${files}`,\n candidateStatusUnknown: '(unknown path)',\n candidateMoved: (expected, actual) => `Candidate commit changed after qualification (expected ${expected}, got ${actual}).`,\n candidateNotBasedOnBase: (candidate, base) => `Candidate ${candidate} is not descended from bootstrap base ${base}.`,\n promotionVerificationFailed: (expected, actual) => `Promotion verification failed (expected HEAD ${expected}, got ${actual}).`,\n reportTitle: 'XCompiler Self-Bootstrap Report',\n reportNone: '(none)',\n reportNextQualified: (repository, candidateCommit) => `git -C \"${repository}\" merge --ff-only \"${candidateCommit}\"`,\n reportNextPromoted: 'Run the next self-bootstrap request with the promoted generation.',\n reportNextFailed: 'Inspect the candidate worktree and fix the failed gate before promotion.',\n reportLabels: {\n status: 'Status', repository: 'Repository', baseCommit: 'Base commit',\n candidateCommit: 'Candidate commit', branch: 'Candidate branch', worktree: 'Worktree',\n createdAt: 'Created at', checks: 'Qualification checks', changedFiles: 'Changed files',\n nextStep: 'Next step',\n },\n },\n compile: {\n workspaceReady: (p) => `Workspace: ${p}`,\n forceOverride: '--force: overriding workspace lock and regenerating plan.',\n topicInputConflict: '--topic and --input were both supplied; --topic wins and --input is ignored.',\n auditTopicInput: 'topic.md (--topic)',\n auditOriginalRequirement: 'Original requirement (Intake)',\n auditUserAddenda: 'User addenda',\n auditEditedTopic: 'Edited topic.md',\n auditTopicPersisted: (p) => `topic.md written: ${p}`,\n auditDecomposeFailed: 'planner.decompose failed',\n lintIssue: (id, message) => ` - [${id}] ${message}`,\n planPreviewTruncated: '… (truncated; see docs/plan.md)',\n auditPlanPersisted: (p) => `phase plan written: ${p}`,\n projectFileWritten: (p) => `project file updated: ${p}`,\n nextCommand: (command) => ` Next: ${command}`,\n topicEmptyExit: '--topic file is empty, aborting.',\n topicLoaded: (p) => `topic loaded: ${p} (skipping intake / clarify / Gate 1)`,\n requirementEmptyExit: 'requirement is empty, aborting.',\n requirementInputHint: 'Please describe your requirement (multi-line, blank line to finish):',\n spinClarify: 'Planner is clarifying the requirement…',\n clarifySucceed: (n) => `clarification questions: ${n}`,\n clarifyFail: 'clarification failed',\n clarifyChoiceHint: (range) => `Reply with ${range} to choose a shown option, or type a custom answer.`,\n addendaConfirm: 'Any extra requirements to append? (Will be sent to Planner together with the clarification and kept in plan.userAddenda)',\n addendaEditorMsg: 'Enter custom addenda (multi-line, Markdown allowed)',\n auditClarifyAnswer: (qid, q) => `clarify answer ${qid}: ${q}`,\n spinDecompose: 'Planner is decomposing along the V-model…',\n decomposeFail: 'Planner decomposition failed',\n plannerInvalidPlan: 'Planner could not produce a valid plan:',\n plannerInvalidPlanHint1: ' Common cause: the LLM output did not satisfy the XCompiler plan schema, V-model skeleton, or architecture contract; this error must not be skipped.',\n plannerInvalidPlanHint2: ' Investigate: check llm.error / planner.thought entries in .xcompiler/audit.jsonl and repair the Planner output against the contract.',\n plannerTransportFailureHint1: ' Common cause: the LLM provider connection failed, timed out, or the server closed the request; this is not a project plan/source defect.',\n plannerTransportFailureHint2: ' Investigate: check OPENAI_BASE_URL / provider base_url, model service reachability, network permissions, and timeout settings, then rerun build.',\n decomposeSucceed: (n) => `generated ${n} Step(s)`,\n schemaFail: 'Plan schema validation failed:',\n schemaInvalidSavedAt: (p) => ` full plan saved to: ${p}`,\n lintFail: (n) => `Plan lint failed (${n}):`,\n topicPreviewHeader: '─── topic.md (preview) ───',\n topicPreviewFooter: '──────────────────────────────',\n gate1Confirm: 'Does the requirement match expectations?',\n gate1ChoiceConfirm: '✅ confirm — proceed to plan generation',\n gate1ChoiceEdit: '✏️ edit — open editor to modify',\n gate1ChoiceCancel: '❌ cancel — abandon this session',\n gate1AuditLabel: 'Requirement Confirmation Gate (Gate 1)',\n gate1Cancelled: 'Cancelled, no files written.',\n editTopicMsg: 'Edit topic.md',\n topicWritten: (p) => `topic written: ${p}`,\n planWritten: (p) => `phase plan written: ${p}`,\n phasePlanWritten: (p) => `phasePlan written: ${p}`,\n planPreviewHeader: '─── plan.md (preview) ───',\n planPreviewFooter: '─────────────────────────',\n gate2Confirm: 'Confirm this plan? (Final confirmation — writes phasePlan.json and the current phase plan)',\n gate2AuditLabel: 'Plan Confirmation Gate (Gate 2)',\n gate2Rejected: 'Not confirmed, abandoned. phasePlan.json was not written.',\n baselineLoaded: (kind, sources) => `loaded ${kind} baseline from: ${sources}`,\n baselineMissing: (workspace) => `incremental mode requires an existing project baseline in ${workspace} (topic / docs / plan / src).`,\n baselineLanguageOverride: (baseline, source, configured) =>\n `incremental mode: using baseline language ${baseline} from ${source} instead of config language ${configured}.`,\n topicTitle: '# Project Topic',\n topicPreamble: '> This file is the project topic frozen after requirement clarification. All subsequent V-model decomposition and every phase output use this file as the sole requirement input.',\n topicSecRequirement: '## Original requirement',\n topicSecClarify: '## Clarification record',\n topicSecAddenda: '## User addenda',\n topicSecBaseline: '## Existing project baseline',\n },\n inspect: {\n noPlanFound: 'No phasePlan.json / plan.json found',\n digestLabel: 'digest:',\n stepNotFound: (id) => `Step ${id} not found`,\n secDescription: '— description —',\n secAcceptance: '— acceptance —',\n secSubtasks: '— subtasks —',\n secSystemPrompt: '— systemPrompt —',\n secOutputs: '— outputs —',\n secRecentAudit: (n) => `— recent audit (${n}) —`,\n planHeader: (p, language) => `${p} lang=${language}`,\n planStatusSummary: (total, done, pending, failed, skipped, running) =>\n `steps=${total} done=${done} pending=${pending} failed=${failed} skipped=${skipped} running=${running}`,\n planReadFailed: (p, message) => `${p} — ${message}`,\n stepHeader: (id, phase, title, status, retries, maxRetries) => `${id} ${phase} ${title} ${status} retries=${retries}/${maxRetries}`,\n stepRoleTools: (role, tools) => `role=${role} tools=[${tools}]`,\n stepDependsOn: (ids) => `dependsOn: ${ids}`,\n outputStatus: (exists, p) => `${exists ? '✓' : '✗'} ${p}`,\n auditEntry: (ts, kind, message) => `${ts} ${kind} ${message}`,\n },\n execute: {\n forceReset: '--force: resetting every Step to PENDING and overriding the workspace lock.',\n manifestRecalibrated: (p) => `recalibrated ${p} (removed version pins / hallucinated names)`,\n manifestSeeded: (p) => `seeded ${p} from plan.dependencies`,\n auditPlanLoaded: (p) => `plan loaded: ${p}`,\n planLoaded: (p) => `Plan loaded: ${p}`,\n planSummary: (language, steps) => ` language=${language}, steps=${steps}`,\n preflightModelMissing: (names) => `LLM preflight: missing models, skipped for this run and lowered to the minimum dynamic score [${names}]`,\n preflightAutoAdded: (n) => `LLM preflight: auto-injected ${n} provider(s) (from ollama /api/tags)`,\n runInterrupted: (id, e, total) => `execution interrupted at ${id} (executed ${e}/${total})`,\n runReasonLabel: ' reason: ',\n runFailureLogHeader: ' --- failure log (tail, 40 lines) ---',\n runAllDone: (e, total) => `Plan fully completed (${e}/${total})`,\n projectAuditSummary: (errors, warnings) => `project audit: ${errors} error(s), ${warnings} warning(s)`,\n projectMemoryRefreshFailed: (message) => `project memory refresh failed: ${message}`,\n projectAuditCheck: (name, summary) => `[audit:${name}] ${summary}`,\n auditDocPresent: (p) => `${p} present`,\n auditDocMissing: (p) => `missing ${p}`,\n auditDeliveryDocPresent: 'delivery documentation present',\n auditDeliveryDocMissing: 'missing docs/08-functional-test.md',\n auditTestFilesFound: (count) => `found ${count} concrete test file(s)`,\n auditTestFilesMissing: 'no concrete test files found under tests/',\n auditEntrypointOk: (command) => `entrypoint ok: ${command}`,\n auditEntrypointFailed: (command) => `entrypoint failed: ${command}`,\n auditPackageJsonMissing: 'missing package.json',\n auditScriptMissing: (name) => `package.json has no ${name} script`,\n auditCommandOk: (name) => `${name} ok`,\n auditCommandFailed: (name, exitCode, timedOut) =>\n `${name} failed (exit=${exitCode}${timedOut ? ', timeout' : ''})`,\n },\n engine: {\n spinSandboxBuild: (profile) =>\n profile.id === 'typescript'\n ? `building sandbox (npm install, ${profile.manifestFile})…`\n : `building sandbox (pip install -r ${profile.manifestFile})…`,\n sandboxReady: (r) => `sandbox ready: ${r}`,\n stepSkipDone: (id, phase) => ` ↪ ${id} ${phase} already done, skipping`,\n spinSandboxRebuild: (id, profile) =>\n profile.id === 'typescript'\n ? `Step ${id} wrote ${profile.manifestFile} — rebuilding npm sandbox…`\n : `Step ${id} wrote ${profile.manifestFile} — rebuilding pip sandbox…`,\n sandboxStatus: (r) => `sandbox: ${r}`,\n autoFixedSrcImports: (n, files) => ` ⚠ auto-fixed sys.path bootstrap in ${n} entry file(s): ${files}`,\n debugResumeNotice: (id, n) => ` ↻ ${id} previous session ended FAILED (${n} attempts so far); first round of this run goes straight into Debugger mode.`,\n spinDebugRetry: (id, attempt, budget, cap, reason) => `🛠 ${id} DEBUG retry ${attempt}/${budget} (cap=${cap}) — ${reason}`,\n retryException: (a, b, msg) => `retry ${a}/${b} threw: ${msg}`,\n fixSucceeded: (id, a) => `${id} fix succeeded (retry=${a})`,\n retryHealthyButFailed: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} still failing but healthy (expand window) · ${tag} · ${reason}`,\n retryLowQuality: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} low-quality output (shrink window) · ${tag} · ${reason}`,\n retryStillFailed: (a, b, tag, reason) =>\n `retry ${a}/${b} still failing · ${tag} · ${reason}`,\n earlyAbortLowQuality: (id, n) => ` ⚡ ${id} ${n} consecutive low-quality rounds — early-aborting DEBUG retries`,\n stepFinalFailed: (id, phase, role) => `✖ Step ${id} (${phase} / ${role}) finally failed`,\n finalAttemptsLine: (a, b, c, ea) =>\n ` attempts=${a} final_budget=${b} cap=${c}` + (ea ? ' (early-abort: low-quality)' : ''),\n finalMetricsLine: (h, p, r, tf, pr) =>\n ` health=${h} parseFail=${p} repeat=${r} toolFail=${tf} progress=${pr}`,\n reasonLabel: 'reason: ',\n failureLogHeader: '--- failure log (tail, max 80 lines) ---',\n fixSuggestionsHeader: '--- fix suggestions (calibration) ---',\n auditHint: (id) => ` audit: see .xcompiler/audit.jsonl and .xcompiler/llm-stream/${id}-*.txt for the raw stream`,\n spinStepRunning: (id, phase, title) => `▶ ${id} ${phase} ${title}`,\n noFailureLog: '(no log captured)',\n suggestionLine: (index, code, hint) => ` ${index}. [${code}] ${hint}`,\n phaseStart: (id, phase, title) => `${id} ${phase} ${title}`,\n phaseFailed: (id, debug, reason) => `${id} ${debug ? 'DEBUG ' : ''}FAILED — ${reason}`,\n phaseDone: (id, rounds) => `${id} DONE (rounds=${rounds})`,\n phaseException: (id, message) => `${id} FAILED (exception) — ${message}`,\n archGateReason: (missing) => `HIGH_LEVEL_DESIGN gate: architecture contract missing ${missing} token(s)`,\n archGateMissing: (tokens) => `missing module ids/paths: ${tokens}`,\n archGateInstruction: (p) => `Update ${p} so every architectureModules item is traceable before CODE starts.`,\n testGateReason: (exitCode, timedOut) => `Test gate: tests exit=${exitCode}${timedOut ? ' (timeout)' : ''}`,\n deliveryGateReason: (command, exitCode, timedOut) => `FUNCTIONAL_TEST gate: \\`${command}\\` exit=${exitCode}${timedOut ? ' (timeout)' : ''}`,\n missingPythonEntrypoint:\n 'missing Python entrypoint: expected src/main.py, src/<package>/__main__.py, or an explicit CLI file such as src/cli.py',\n missingTypeScriptEntrypoint:\n 'missing TypeScript entrypoint: expected package.json start/bin or one of src/main.ts, src/index.ts, src/main.tsx',\n invalidPythonEntrypointSource: (path) =>\n `invalid Python entrypoint source in ${path}: expected a real CLI entry structure such as def main(...), argparse.ArgumentParser, or if __name__ == \"__main__\"; placeholder/import-only files are not runnable applications.`,\n entrypointHelpOutputMissing: (command) =>\n `entrypoint probe \\`${command}\\` exited 0 but produced no meaningful help/usage text; implement --help instead of relying on an empty script exit.`,\n reasonLine: (reason) => `reason: ${reason}`,\n roundsLine: (rounds) => `rounds: ${rounds}`,\n commandLine: (command) => `command: ${command}`,\n stdoutTailHeader: '--- stdout (tail) ---',\n stderrTailHeader: '--- stderr (tail) ---',\n testStdoutTailHeader: '--- test stdout (tail) ---',\n testStderrTailHeader: '--- test stderr (tail) ---',\n outputsMissing: (paths) => `outputs missing: ${paths}`,\n metricsLine: (health, parseFail, repeat, toolFail, progress) =>\n `metrics: health=${health} parseFail=${parseFail} repeat=${repeat} toolFail=${toolFail} progress=${progress}`,\n metricsUnavailable: 'metrics: (n/a)',\n toolCallsHeader: 'tool calls:',\n toolCallLine: (tool, ok, detail) => ` - ${tool} ${ok ? 'OK' : 'FAIL'} ${detail}`,\n projectMemoryRefreshFailed: (message) => `project memory refresh failed: ${message}`,\n deliveryFixHints: (language) => language === 'typescript'\n ? [\n 'Fix directions (priority order):',\n ' 1. For module resolution / ERR_MODULE_NOT_FOUND in TypeScript source, use relative ESM imports with explicit .ts specifiers.',\n ' 2. For --help / unknown option, main() must support --help and exit 0.',\n ' 3. For application exceptions, fix the implementation and keep the entrypoint thin.',\n ]\n : [\n 'Fix directions (priority order):',\n ' 1. For ModuleNotFoundError involving src, add the planner #19 sys.path bootstrap or remove the src. import prefix.',\n ' 2. main() must be a real CLI entrypoint: parse --help, call the project modules, print meaningful output, and use if __name__ == \"__main__\": main().',\n ' 3. For argparse errors, main() must support --help without other required arguments and exit 0.',\n ' 4. For business exceptions, fix the implementation and keep the entrypoint limited to parsing and dispatch.',\n ],\n },\n render: {\n sectionGlobalPrompt: '## Global prompt (injected into every Step\\'s system prompt)',\n sectionDependencies: (manifestFile) => `## Dependencies (written to ${manifestFile})`,\n sectionBaselineSummary: '## Existing project baseline',\n labelSystemPrompt: '**System prompt (sole mandate):**',\n },\n prompts: {\n plannerSystem: (p) => buildPlannerSystem(p),\n plannerPhasePlanSystem: (p) => buildPlannerPhasePlanSystem(p),\n plannerPhaseDecomposeSystem: (p) => buildPlannerPhaseDecomposeSystem(p),\n plannerSelfMode: `SELF-BOOTSTRAP OVERRIDE (takes precedence over conflicting greenfield rules above):\n- The target is the existing XCompiler repository. Preserve its current package.json, tsconfig, bin entries, CLI entrypoints, module layout, public exports, and documentation unless the requirement explicitly changes them.\n- Do not create src/main.ts merely to satisfy a greenfield entrypoint convention. Reuse the entrypoints declared by the existing package.json.\n- Do not list package.json or tsconfig.json as HIGH_LEVEL_DESIGN outputs unless this change genuinely needs to modify them.\n- Every CODE/test output must be scoped to the requested delta. Never rebuild or replace the repository wholesale.\n- Treat the stable host binary as generation N and the worktree candidate as N+1; do not design in-process hot replacement.`,\n plannerClarifySystem: PLANNER_CLARIFY_SYSTEM,\n plannerClarify: (raw, opts = {}) =>\n `The user's original requirement is:\n\n\"\"\"\n${raw}\n\"\"\"\n\nGenerate ${opts.complex ? '8-10' : '7-10'} non-duplicate clarification questions about unresolved decisions whose answers materially affect implementation or acceptance. Never return an empty array; when the functional description is already detailed, ask for acceptance examples, failure behaviour, and explicit exclusions.\n\nReturn ONLY a JSON array. Every item must be shaped exactly as:\n{\"id\":\"Q1\",\"category\":\"functionality|data|acceptance|boundary|quality|extensibility\",\"question\":\"one concrete directly-answerable question\",\"why\":\"what design or acceptance decision this answer affects\",\"options\":[{\"label\":\"A\",\"answer\":\"highest-priority feasible setting\"},{\"label\":\"B\",\"answer\":\"second feasible setting\"}]}\n\nQuestion mix (functionality first):\n- At least ${opts.complex ? '5' : '4'} function-focused questions categorized as functionality / data / acceptance, so functional questions remain the majority. Prioritize actors, core journeys, business rules and state transitions, inputs/outputs, failure behaviour, and verifiable acceptance examples.\n- At least one boundary question defining in-scope, explicitly out-of-scope, external-system ownership, or compatibility limits.\n- At least one quality question requesting measurable latency, throughput, volume, concurrency, accuracy, reliability, or security targets. Never ask only “Any performance requirements?”.\n- At least one extensibility question identifying the most likely future business capability, extension axis, or interface that must remain stable. Never ask only “Should it be extensible?”.\n- If the deliverable shape is unclear, include one boundary question asking whether this should be an API library/SDK/package, a runnable application/CLI/service, or a mixed deliverable with both.\n- If the requirement needs access to external APIs, URLs, or third-party data sources, include one data or boundary question asking whether the user already has a usable API, key, token, or auth method. If they do not, the default for this delivery is to choose a public, no-key/no-token, verifiable API; do not generate placeholder URLs.\n- Order by blocking impact: core functional/data decisions first, then scope and quality, then future evolution.\n- One primary decision per question. Include useful business choices/examples; do not join unrelated questions with “and/or”.\n- For every question, generate 2-5 feasible answer options ordered by priority. The option count is not fixed: use 2 for binary choices, 3 for common defaults, and 4-5 only when there are genuinely distinct viable settings. Do not pad or force every question to exactly 3 options.\n- Label options sequentially from A through the last generated option, for example A-B, A-C, A-D, or A-E. A should be the recommended/default setting when one is apparent. Options must be concrete business/product settings, not vague placeholders.\n- Do not include “Other”, “Custom”, or “Let the user decide” as an option. The CLI already allows the user to reply with one of the shown labels or enter a custom free-form answer.\n${opts.projectShapeAmbiguous\n ? '- Required for this topic: ask the API library vs runnable application vs mixed-deliverable boundary explicitly.\\n'\n : ''}\n${opts.languageAmbiguous\n ? '- Required for this topic: include exactly one boundary question confirming the target development language. Options must be A. Python (default/recommended) and B. TypeScript / Node.js. The user may still answer with custom free-form text.\\n'\n : ''}\n\n${opts.languageAmbiguous\n ? `[Stack decision] XCompiler could not infer the target language from the topic or baseline. Ask only the development-language question described above; do not ask package manager, test framework, or OS questions. If the user does not choose, Python is the default.`\n : `[Hard constraint] The implementation stack is already fixed by the user's topic or existing project baseline. Do not reopen language/runtime/package-manager decisions.\n**Do NOT** ask questions of these forms:\n - \"Which programming language / framework / runtime should this use?\"\n - \"Which test framework / build tool / package manager?\"\n - \"Which OS is the target platform?\"`}\n${opts.intent && opts.intent !== 'greenfield'\n ? `This is an incremental ${opts.intent} request against an existing project${opts.hasBaseline ? ' with a separate baseline summary that will be provided during decomposition' : ''}. Ask ONLY delta questions; do not ask to rebuild the project from scratch.`\n : ''}The majority of questions must concern functional behaviour; performance, boundaries, and extensibility should eliminate ambiguities that affect this delivery.`,\n plannerDecompose: (raw, qa, addenda, opts = {}) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over any vague parts of the original):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate an incremental ${opts.intent} plan on top of the existing project. Reuse the current architecture, files, tests and dependencies where possible instead of rebootstrapping the whole project. Outside the requested change, preserve existing behaviour.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}Planning depth rules:\n- Unless the request is explicitly tiny (single function / toy script / one-file utility), do not collapse the solution into one source file and one test.\n- If the requirement spans multiple concerns (domain logic, API/CLI surface, persistence, integration, orchestration, tests), reflect that with multiple architecture modules and Step.subTasks under CODE/MODULE_TEST macro Steps.\n- Assess project complexity in the plan and size implementationPhases from that assessment: simple => P1 current only; moderate => P1 current + at least P2 planned; complex => P1 current + at least P2/P3 planned. If the user explicitly requested phases/stages, use at least P1+P2 and set userForcedPhaseSplit=true. Every current/planned implementation phase must be represented by a full V-model cycle in steps, with Step.iterationId pointing to that phase.\n- Use HIGH_LEVEL_DESIGN/DETAILED_DESIGN steps to describe module boundaries, responsibilities, dependencies, and extension points that future incremental work can build on.\n- When baseline files already exist, prefer editing/extending those modules over creating shadow implementations with duplicate behaviour.\n\nOutput a strict JSON plan per the system rules.`,\n plannerPhasePlan: (raw, qa, addenda, opts = {}) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over vague original wording):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate a PhasePlan on top of the existing project. Reuse current architecture, files, tests, and dependencies where possible. Preserve existing behaviour outside the requested change.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}First generate only the high-level PhasePlan:\n- Assess complexity and choose phase count: simple => P1 current only; moderate => P1 current + at least P2 planned; complex => P1 current + at least P2/P3 planned.\n- P1 objective must be an independently deliverable and verifiable core slice.\n- P2/P3 should contain only future enhancement goals, scope, deliverables, and verification gates. Do not expand any V-model Step.\n- Every phase verificationGate must say failures are fed to Debugger, rolled back to the paired V-model phase, and followed by rerunning subsequent phases.\n- Return only PhasePlan JSON. Do not include steps, architectureModules, or dependencies.`,\n plannerPhaseDecompose: (raw, qa, addenda, opts) =>\n `Original requirement:\n\"\"\"\n${raw}\n\"\"\"\n\nClarification Q&A:\n${qa || '(none)'}\n\n${addenda ? `User addenda (must be strictly followed; takes priority over vague original wording):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `Incremental intent: ${opts.intent}\n\nGenerate the current phase's incremental V-model StepPlan on top of the existing project. Reuse current architecture, files, tests, and dependencies where possible.\n\nExisting project baseline:\n\"\"\"\n${opts.baseline || '(missing baseline)'}\n\"\"\"\n\n`\n : ''}Frozen PhasePlan:\n\"\"\"\n${opts.phasePlan}\n\"\"\"\n\nPhase to expand now: ${opts.phaseId}\n\nReturn a full V-model StepPlan only for ${opts.phaseId}:\n- Every Step.iterationId must equal \"${opts.phaseId}\".\n- Do not output Steps for any other planned phase; P2/P3 detailed plans are generated only when they become the current phase.\n- If ${opts.phaseId} spans multiple concerns (domain logic, CLI/API, file I/O, external integration, orchestration, tests), declare architectureModules for this phase and map module-level work under CODE/MODULE_TEST subTasks.\n- architectureModules.sourcePaths may only contain product source files under src/. Do not register tests/fixtures, tests/utils, sample files, directories, or docs as architecture modules.\n- dependencies contains only packages required by this phase; Python must include pytest; never output requirements.txt.\n- This phase must contain the canonical eight V-model macro Steps and synchronous paired test-design outputs.\n\nReturn strict JSON StepPlan for the current phase only.`,\n executorSystem: (p) => buildExecutorSystem(p),\n executorDebugBlock: (reason: string, suggestions?: string) =>\n `\\n\\nYou are now in DEBUG retry mode. Previous failure reason: ${reason}\\n` +\n 'When this retry is handling an issue, every JSON response must include issueResolutionPlan before or while fixing it. The plan must be concise and actionable: root cause hypothesis, files/contracts to change, validation command or gate, and what would disprove the plan. ' +\n 'DEBUG may edit upstream source files and tests within the current allowedWrites. If the failure reveals a real implementation, contract, or downstream integration mismatch, fix that real defect; do not pass by weakening assertions, skipping tests, deleting failing cases, or merely accommodating an incorrect test. ' +\n 'If this rollback is in a design/requirements step and the concrete code change belongs to a later V-model step outside the current allowedWrites, update the current contract, test plan, or diagnostic artifact and finish this step so the later CODE step can implement it; do not attempt denied writes. ' +\n 'If the failure is a missing third-party dependency or wrong library choice, use add_dependency with the real package name or change the source back to the real library selected by HIGH_LEVEL_DESIGN; never add try/except ImportError fake modules, fake classes/functions, empty implementations, or fallback mocks in production src/ code to bypass the error. ' +\n 'Begin with read_file / code_search to localise the issue, then make the smallest possible fix via apply_patch / replace_in_file / add_dependency, and finally run_tests to verify. ' +\n 'A DEBUG retry cannot be marked complete from read-only inspection alone: it must produce a successful repair action or a successful verification command in this retry. ' +\n 'If the previous failure reason mentions repeated read-only/probe actions, use the existing failure log as sufficient context and make the next action a patch/write/dependency change or a verification command. ' +\n 'When a test executes and fails an assertion about returned behaviour, do not repeatedly rewrite fixtures or samples. Only edit fixtures when the evidence is missing-file, malformed-fixture, or parse-error in the fixture itself; otherwise patch the implementation, interface contract, dependency choice, or test expectation that is actually wrong. ' +\n 'If the failure log shows a network/API failure, do not stop at probing endpoints: use at most two consecutive http_fetch probes, reject 2xx responses with empty or unusable bodies, then patch the real integration and verify with run_program plus run_tests. Do not set done=true while the entrypoint still reports a network/API failure.' +\n (suggestions ? `\\n\\n${suggestions}` : ''),\n executorGlobalBlock: (globalPrompt: string) => `\\n\\n## Project-wide constraints\\n${globalPrompt}`,\n executorStepBlock: (sp: string) =>\n `\\n\\n## Current Step prompt (sole mission — do not drift across steps)\\n${sp}`,\n executorUserPromptOutro: 'Now return the first round of JSON per the protocol.',\n executorFeedbackHeader: 'Tool results this round:',\n executorFeedbackVerifyOk:\n 'outputs verified. If you are done, set done=true and actions=[].',\n executorFeedbackVerifyMissing: (paths: string) =>\n `outputs still missing: ${paths}. Please continue.`,\n executorFeedbackReadOnlyLoopWarning: (rounds: number, targets: string) =>\n `Loop guard warning: the last ${rounds} round(s) used only read/probe tools` +\n (targets ? ` (${targets})` : '') +\n '. Next response must include a successful repair action (apply_patch / replace_in_file / write_file / add_dependency) or a concrete verification action (run_tests / run_program). Do not continue with only read_file, list_dir, code_search, or http_fetch.',\n executorFeedbackReadOnlyRecoveryRequired:\n 'Read-only recovery mode is active because the previous attempt already failed from probing. The next response must use existing failure evidence to patch/write/change dependency or run verification; one more read-only-only response will fail this retry.',\n executorFeedbackRepairEvidenceMissing:\n 'Invalid DEBUG completion: this retry has not produced repair evidence yet. Before done=true, perform at least one successful repair action or successful verification run; otherwise stop only with a concrete blocker in thoughts.',\n executorFeedbackIssueResolutionPlanMissing:\n 'Invalid DEBUG issue completion: issueResolutionPlan is required before the issue can be resolved. Return JSON with a concise handling plan plus the needed repair or verification actions.',\n },\n skills: {\n patcher: 'Use apply_patch / replace_in_file for small in-place edits to existing files; never overwrite a whole file.',\n author: 'Use write_file to create new files; prefer paths inside the current Step writable allowlist.',\n tester:\n 'Write and run pytest tests verifying function behaviour; on failure parse with analyze_error. ' +\n '[Self-contained fixtures] Tests **must NOT** open() a sample file that does not exist on disk. ' +\n 'When the target function needs file input, first reuse a real user/workspace sample; if none exists, use http_fetch to get a small reference sample from official docs, the upstream repository, or a public standard/example, ' +\n 'save it under tests/fixtures/<name>, and record the source. Only for simple text formats such as CSV/JSON/INI may you construct a minimal pytest tmp_path sample and immediately run_tests. ' +\n 'Test/DEBUG phases already grant write permission to tests/fixtures/, sub-dirs are auto-mkdir\\'d, and **fixture paths do NOT need to be pre-declared in outputs**. ' +\n 'When generating tests, always emit every dependent resource so the Debugger does not loop on FileNotFoundError. ' +\n '[Fixture iteration] If a running test raises \"Invalid syntax / Parse error / Malformed\" from the target function, ' +\n 'your fixture content does not match the format spec: read_file to inspect, then prefer a user sample or authoritative http_fetch reference before rewriting and running tests. ' +\n 'After repeated failures on a complex domain format, stop inventing from memory and ask for a user sample or network reference. Never edit the implementation or assertions to \"fix\" a parse error.',\n dep_resolver: 'On ModuleNotFoundError, use add_dependency to write the package back into requirements.txt and rebuild the sandbox.',\n debugger:\n 'First run_tests / run_python to reproduce the error → analyze_error → patch / replace_in_file / add_dependency to fix → run_tests again. Make the smallest possible change each round. ' +\n '[Missing dependencies] Add the real dependency or use the real library selected by the design; never fake modules/classes/functions, empty implementations, or fallback mocks in production src/ code. ' +\n '[Fixture discipline] If tests fail with behavioural assertions, do not keep rewriting fixtures. Only change fixtures for clear missing-file, malformed-fixture, or fixture parse errors; otherwise fix source code, contracts, dependencies, or the incorrect assertion. ' +\n '[Network/API failures] Locate the failing URL, try only a small number of replacement API probes, then patch the source and run_program to prove the entrypoint no longer emits API failure. ' +\n '[Important] If replace_in_file on the same file fails ≥ 2 times in a row, switch to read_file and then patch or rewrite within the current runtime chunk limit; stop guessing the find string. ' +\n '[No no-ops] replace_in_file find and replace must differ — if you only want to \"verify\" a snippet, use read_file; do not submit identical-string replacements.',\n refactorer: 'Refactors must preserve behaviour: run regression tests → modify → run regression tests again.',\n },\n doctor: {\n cliDescription: 'check that config / LLM / sandbox / skills are ready',\n optStrict: 'treat warnings as failures (exit non-zero on any warn)',\n header: 'XCompiler environment check',\n sectionConfig: '[config]',\n sectionLLM: '[LLM]',\n sectionSandbox: '[sandbox]',\n sectionSkills: '[skills]',\n summaryOk: 'all checks passed.',\n summaryWarn: (n) => `passed with ${n} warning(s).`,\n summaryFail: (n) => `${n} failure(s) detected.`,\n configLoadOk: (path) => `config loaded: ${path}`,\n configLoadFail: (msg) => `failed to load config: ${msg}`,\n configLocale: (locale) => `locale=${locale}`,\n llmNoProviders: 'no LLM providers defined in config.llm.providers',\n llmProviderListed: (n) => `${n} provider(s) declared`,\n ollamaUnreachable: (baseUrl, msg) => `ollama unreachable @ ${baseUrl} — ${msg}`,\n ollamaReachable: (baseUrl, n) => `ollama reachable @ ${baseUrl} (${n} model(s))`,\n ollamaModelMissing: (provider, model, baseUrl) =>\n `provider \"${provider}\": model \"${model}\" NOT installed on ${baseUrl} (run \\`ollama pull ${model}\\`)`,\n ollamaModelOk: (provider, model) => `provider \"${provider}\": model \"${model}\" available`,\n openaiKeyMissing: (provider) => `provider \"${provider}\": api_key empty (set the provider env var such as OPENROUTER_API_KEY, or config.llm.providers.${provider}.api_key)`,\n openaiReachable: (provider, baseUrl) => `provider \"${provider}\": OpenAI endpoint reachable @ ${baseUrl}`,\n openaiUnreachable: (provider, baseUrl, msg) => `provider \"${provider}\": OpenAI endpoint unreachable @ ${baseUrl} — ${msg}`,\n openaiModelListMissing: (provider, model) =>\n `provider \"${provider}\": model \"${model}\" not in /models response (it may still work if your account has access)`,\n providerScoreZero: (provider) => `provider \"${provider}\" disabled (score=0)`,\n roleNoLiveProvider: (role) => `role \"${role}\" has no live provider (no candidate is reachable & enabled)`,\n roleOk: (role, provider) => `role \"${role}\" → ${provider}`,\n sandboxKind: (kind) => `sandbox=${kind}`,\n sandboxNetworkPolicy: (policy, ports) =>\n `network=${policy}` + (ports.length ? ` (expose_ports=[${ports.join(', ')}])` : ''),\n sandboxFullNoPorts:\n 'network=full but no expose_ports configured — host-side cannot reach container services. ' +\n 'Add `agent.sandboxes.<language>.<local|docker>.limits.expose_ports: [<port>]` in config.yaml.',\n sandboxNodeMissing: 'node not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNodeOk: (version) => `node OK (${version})`,\n sandboxNpmMissing: 'npm not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNpmOk: (version) => `npm OK (${version})`,\n sandboxNpxMissing: 'npx not found on PATH (required by TypeScript subprocess sandbox)',\n sandboxNpxOk: (version) => `npx OK (${version})`,\n sandboxPythonMissing: 'python3 not found on PATH (required by subprocess sandbox)',\n sandboxPythonOk: (version) => `python3 OK (${version})`,\n sandboxVenvMissing: 'python3 venv module unavailable (install python3-venv / python3-virtualenv)',\n sandboxVenvOk: 'python3 venv module OK',\n sandboxDockerMissing: (bin) => `docker binary \"${bin}\" not found on PATH`,\n sandboxDockerOk: (version) => `docker OK (${version})`,\n sandboxDockerDaemonDown: (msg) => `docker daemon not reachable: ${msg}`,\n sandboxInContainerWarn:\n 'XCompiler appears to be running inside a container; sandbox=docker is unsupported in this mode (use subprocess).',\n skillToolMissing: (skill, tool) => `skill \"${skill}\" references unknown tool \"${tool}\"`,\n skillOk: (n, tools) => `${n} skill(s) registered, ${tools} underlying tool(s)`,\n },\n};\n\nexport default messages;\n","import type { LanguageProfile } from '../core/language.js';\nimport type { Messages } from './types.js';\n\nconst PYTHON_PLANNER_SYSTEM = `你是 XCompiler 系统的 Planner。你的任务是把用户的自然语言需求编译成严格的“迭代模型 + V 模型”Step 计划。\n\n输出语言:仅 Python (plan.language 固定为 \"python\")。\n\n每个可执行迭代周期必须使用标准 V 模型流程:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\nDEBUG 不是正常 V 模型阶段,只是运行时失败回退/修复模式。任意测试阶段失败时,XCompiler 会回退到该测试对应的左侧阶段开始 Debugger 修复,并重新执行后续 V 模型动作。\n\n阶段文档:\n| Phase | 必须输出文件 |\n|---|---|\n| REQUIREMENT_ANALYSIS | \\`docs/01-requirement-analysis.md\\` |\n| HIGH_LEVEL_DESIGN | \\`docs/02-high-level-design.md\\` |\n| DETAILED_DESIGN | \\`docs/03-detailed-design.md\\` |\n| UNIT_TEST | \\`docs/05-unit-test.md\\` |\n| INTEGRATION_TEST | \\`docs/06-integration-test.md\\` |\n| MODULE_TEST | \\`docs/07-module-test.md\\` |\n| FUNCTIONAL_TEST | \\`docs/08-functional-test.md\\` |\n\nP2+ 迭代把同名阶段文档写入 \\`docs/iterations/<iterationId>/\\`。顶层 \\`docs/topic.md\\` 由 xcompiler build 写入,任何 Step 都不得把它列为 outputs。\n\n同步测试设计规则:\n- REQUIREMENT_ANALYSIS 同步输出 \\`docs/tests/functional-test-plan.md\\`。\n- HIGH_LEVEL_DESIGN 同步输出 \\`docs/tests/module-test-plan.md\\`。\n- DETAILED_DESIGN 同步输出 \\`docs/tests/integration-test-plan.md\\`。\n- CODE 同步输出 \\`docs/tests/unit-test-plan.md\\`。\nP2+ 迭代把这些测试计划写到 \\`docs/iterations/<iterationId>/tests/\\`。\n\n阶段职责:\n- REQUIREMENT_ANALYSIS 定义功能范围、验收标准、边界条件和用户可见行为。\n- HIGH_LEVEL_DESIGN 负责架构设计,说明当前开发模块在整体系统中的定位,并定义系统层面的对外接口和依赖,包括外部 API、第三方库选型、依赖确认、数据契约和集成边界。\n- DETAILED_DESIGN 定义模块内部的具体功能实现和架构,包括函数/类、数据结构、算法、控制流、错误处理和内部协作。\n- CODE 只实现已设计范围并产出可运行/可导入的 Python 源码。\n- UNIT_TEST 验证 CODE 的内部函数和公开 API。\n- INTEGRATION_TEST 验证 DETAILED_DESIGN 中定义的模块内部协作、数据流和组件集成。\n- MODULE_TEST 验证 HIGH_LEVEL_DESIGN 中当前开发模块在整体系统中的定位、对外接口和依赖边界。\n- FUNCTIONAL_TEST 按需求端到端验收,并产出面向用户的文档。\n\n功能验收文档包:P1 FUNCTIONAL_TEST outputs 必须包含 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`;当 \\`projectType\\` 为 \\`library\\` 或 \\`mixed\\` 时还必须包含 \\`docs/api-guide.md\\`。P2+ 使用 \\`docs/iterations/<iterationId>/08-functional-test.md\\`、\\`quickstart.md\\` 和可选 \\`api-guide.md\\`。文档语言遵循当前 i18n。\n\n强制规则:\n1. 只返回纯 JSON,禁止 Markdown 代码块和解释文字。\n2. 每个 current/planned implementation phase 都是完整 V 模型迭代,必须包含上述 8 个标准阶段。禁止输出旧阶段 REQUIREMENT、ARCH、TASK、TEST、REFACTOR、DELIVERY。\n3. 每个宏 Step 的 \\`subTasks\\` 最多嵌套 2 层;不要为了内部细节拆出大量可执行 Step。\n4. dependsOn 必须按阶段顺序且无环。右侧测试阶段必须直接或间接依赖其对应左侧阶段。\n5. 每个 CODE Step 必须被同迭代的 UNIT_TEST Step 覆盖。\n6. 需求/设计阶段不得输出 src/ 或 tests/ 文件;CODE 产出 src/;测试阶段产出 tests/ 和报告文档;FUNCTIONAL_TEST 不得修改 src/。\n7. outputs 路径全局唯一。DEBUG 运行时可修改依赖链文件,计划 Step 不要重复声明 outputs。\n8. id 形如 S001、S002;role 只能是 Planner / Architect / Coder / Tester / Debugger。\n9. 每个 Step 必须有 systemPrompt,明确范围、输入、产出、验收、禁令,以及左侧阶段的同步测试设计义务。\n10. projectType 由 LLM 在澄清后判定:application / library / mixed,不存在命令行 project-type 覆盖。\n11. complexityAssessment 由 plan 阶段评估:simple => P1;moderate => 至少 P1+P2;complex => 至少 P1+P2+P3。用户明确要求分阶段时必须 userForcedPhaseSplit=true。\n12. implementationPhases 必须包含 P1 current 和后续 planned 可执行迭代;verificationGate 的 failurePolicy 必须说明把失败日志传给 Debugger,回退到对应 V 模型阶段并重新执行后续阶段。\n13. dependencies 是 Python pip 依赖列表;必须包含 \\`pytest\\`;只写裸包名;任何 Step 都不要输出 \\`requirements.txt\\`。\n14. application/mixed 项目需要可直接运行的 Python 入口(\\`src/main.py\\` 或包 \\`__main__.py\\`)并复用 CODE 模块;library/mixed 项目需要稳定公开 API 和 \\`docs/api-guide.md\\`。\n15. 复杂需求必须返回 \\`architectureModules\\`:每个模块包含 id、name、responsibility、sourcePaths、testPaths、dependencies。CODE/MODULE_TEST Step 可覆盖多个模块,但必须在 subTasks 中列出模块级工作。\n16. 第三方库选型必须匹配真实 API:HIGH_LEVEL_DESIGN 必须写明选定库用于本需求的具体入口函数/类或验证依据;禁止仅凭包名臆造不存在的解析/导出 API。\n\n输出 JSON 形如:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"核心功能\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"run tests\", \"probe entrypoint/API\", \"verify functional docs\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ],\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"模块名\", \"responsibility\": \"单一且明确的模块职责\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n {\n \"id\": \"S001\",\n \"iterationId\": \"P1\",\n \"phase\": \"REQUIREMENT_ANALYSIS\",\n \"title\": \"string\",\n \"description\": \"string\",\n \"systemPrompt\": \"本 Step 专属提示:范围、输入、产出、验收、禁令\",\n \"role\": \"Planner\",\n \"tools\": [\"write_file\"],\n \"inputs\": [\"docs/topic.md\"],\n \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"],\n \"subTasks\": [\n { \"id\": \"T1\", \"title\": \"string\", \"description\": \"string\", \"acceptance\": \"string\", \"outputs\": [\"docs/01-requirement-analysis.md\"], \"subTasks\": [] }\n ],\n \"dependsOn\": [],\n \"acceptance\": \"string\",\n \"maxRetries\": 3\n }\n ]\n}`;\n\nconst PYTHON_EXECUTOR_SYSTEM = `你是 XCompiler 的 Step Executor。你只能通过 JSON 工具调用与系统交互,禁止任何 Markdown 或解释性文本。\n\n每一轮你必须返回严格 JSON:\n{\n \"thoughts\": \"<用一句话说明本轮意图>\",\n \"issueResolutionPlan\": \"<仅 DEBUG issue 模式必填:简明说明根因假设、修复目标和验证方案>\",\n \"actions\": [ { \"tool\": \"<工具名>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\n规则:\n1. 仅可调用本 Step 授权的工具白名单。\n2. 写入文件必须落在本 Step 的 writable allowlist 内(其它路径会被拒绝);required outputs 只是最终必须存在的验收产物。\n 对 FUNCTIONAL_TEST 文档产物,必须按当前 i18n 语言写完整声明的文档包:P1 路径如 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`,以及 outputs 中出现时的 \\`docs/api-guide.md\\`;P2+ 则写 outputs 声明的 \\`docs/iterations/<iterationId>/\\` 等价路径。任何已声明文档缺失时不得设置 done=true。\n3. 对生成代码遵循目标语言的最佳实践;模块可导入、函数应带合适的类型信息。\n - 【导入约定】src/ 下的模块互相 import 时使用 \"from <module> import ...\"(同级名称),\n **严禁写成 \"from src.<module> import ...\"**。如果 main.py 需要从项目根运行,\n 在 import 之前加一行:sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))),\n 以保证 \"python src/main.py ...\" 和 \"python -m src.main ...\" 两种调用都能走通。\n - 【测试约定】tests/ 下的文件同样以 \"from <module> import ...\" 导入被测模块;\n **XCompiler 已自动生成 tests/conftest.py 把项目根与 src/ 注入 sys.path**,\n 因此 pytest 与 \"python tests/test_*.py\" 两种执行方式都能解析模块,\n 测试文件头部**无需**再写 sys.path.insert(...),避免重复污染。\n 如果 LLM 自己额外创建/编辑 conftest.py,必须保留上面 sys.path 注入逻辑,禁止删除。\n - 【测试自包含】测试**严禁**直接 open() 一个磁盘上不存在的样例文件(如 \"sample.csv\");\n 当被测函数需要文件输入时,必须按优先级选择:\n (a) 优先复用用户或工作区已提供的真实样例,用 read_file 读取后复制/引用到 tests/fixtures/<name>;\n (b) 若是第三方/行业标准格式且工作区无样例,用 http_fetch 获取官方文档、上游仓库或公开标准中的小型参考样例,\n 保存到 tests/fixtures/<name>,并在测试报告或注释中记录来源;\n (c) 只有 CSV/JSON/INI 等简单文本格式,且能立刻 run_tests 验证时,才可在 pytest tmp_path 中构造最小样例。\n 网络不可用、用户未提供样例且无法确认格式标准时,应明确报告 blocker 请求用户提供样例。\n 绝不允许出现\"测试代码引用了一个谁都没创建的文件\"——这会让 Debugger 反复 FileNotFoundError 死循环。\n - 【fixture 迭代】当测试已经能运行但被测函数报\"Invalid syntax / Parse error / Malformed\"等解析失败错误,\n 说明 fixture 文件本身格式不合法,**不是被测代码的 bug**。\n 必须 read_file 看清当前 fixture 内容,按扩展名/解析库确认格式标准;优先使用用户样例或 http_fetch 下载的权威参考样例,\n 再 write_file 整文件重写并 run_tests。复杂领域格式连续失败后必须停止凭记忆生成,改为请求用户样例或网络参考。\n 严禁因为解析错误就去改被测模块、测试断言或 mock 掉解析逻辑——先把 fixture 修对再说。\n4. 当所有 outputs 文件均已生成且自检通过,把 done 设为 true 且 actions 为空。\n5. 任何错误都通过下一轮的 actions 修正;不要尝试越权或捏造工具。\n6. 【大文件拆块写入】write_file / append_file 单次 content 必须低于工具文档展示的当前 Step 运行时 chunk limit。\n - 超过时请拆分:同一轮 actions 里先一个 write_file 写首段(import + 顶层常量 + 第一个函数/类),\n 紧跟多个 append_file 逐段追加(按函数/类边界切块,每段收尾保留换行)。\n - 复杂工程优先拆成多个内聚模块/文件,并用独立 CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Step 增量推进,不要写一个巨型万能文件。\n - 拆分必须保证拼接后仓 Python 语法合法;严禁在函数体中间拆断。\n - 对已存在文件的局部修改使用 replace_in_file / apply_patch,不要重复覆盖整个文件。`;\n\nconst TYPESCRIPT_PLANNER_SYSTEM = `你是 XCompiler 系统的 Planner。你的任务是把用户的自然语言需求编译成严格的“迭代模型 + V 模型”Step 计划。\n\n输出语言:仅 TypeScript / Node.js(plan.language 固定为 \"typescript\")。\n\n每个可执行迭代周期必须使用标准 V 模型流程:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\nDEBUG 只是运行时失败回退/修复模式。任意测试阶段失败时,XCompiler 会回退到该测试对应的左侧阶段并重新执行后续阶段。\n\n沿用 Python Planner 的阶段文档和同步测试设计规则:\n- REQUIREMENT_ANALYSIS:\\`docs/01-requirement-analysis.md\\` + \\`docs/tests/functional-test-plan.md\\`。\n- HIGH_LEVEL_DESIGN:\\`docs/02-high-level-design.md\\` + \\`docs/tests/module-test-plan.md\\`。\n- DETAILED_DESIGN:\\`docs/03-detailed-design.md\\` + \\`docs/tests/integration-test-plan.md\\`。\n- CODE:实现产物 + \\`docs/tests/unit-test-plan.md\\`。\n- UNIT_TEST:\\`docs/05-unit-test.md\\`。\n- INTEGRATION_TEST:\\`docs/06-integration-test.md\\`。\n- MODULE_TEST:\\`docs/07-module-test.md\\`。\n- FUNCTIONAL_TEST:\\`docs/08-functional-test.md\\`、\\`README.md\\`、\\`docs/quickstart.md\\`,library/mixed 还要 \\`docs/api-guide.md\\`。\nP2+ 迭代把阶段文档写到 \\`docs/iterations/<iterationId>/\\`,测试计划写到 \\`docs/iterations/<iterationId>/tests/\\`。\n\nHIGH_LEVEL_DESIGN 必须说明当前开发模块在整体系统中的定位,并定义系统层面的对外接口和依赖,包括外部 API、第三方库选型、依赖确认、package.json scripts、dependencies/devDependencies、tsconfig、数据契约和集成边界。\nDETAILED_DESIGN 必须定义模块内部具体功能实现和架构,包括函数/类型、数据结构、算法、控制流、错误处理和内部协作。\n\n强制规则:\n1. 只返回纯 JSON。禁止输出旧阶段 REQUIREMENT、ARCH、TASK、TEST、REFACTOR、DELIVERY。\n2. 每个 current/planned implementation phase 都必须包含完整 8 阶段 V 模型。\n3. 每个宏 Step 的 \\`subTasks\\` 最多嵌套 2 层。\n4. 每个 CODE Step 必须被同迭代 UNIT_TEST 覆盖;architectureModules 的 testPaths 必须由 MODULE_TEST 产出。\n CODE outputs 只能包含 src/ 下的产品源码文件和 docs/tests/unit-test-plan.md;禁止把 tests/**/*.test.ts 或其他 tests/** 文件列为 CODE outputs。\n5. 设计阶段不得输出 src/ 或 tests/ 文件;HIGH_LEVEL_DESIGN 是唯一可输出 \\`package.json\\` / \\`tsconfig.json\\` 的阶段。\n6. TypeScript greenfield 计划必须且只能有一个 HIGH_LEVEL_DESIGN Step 输出 \\`package.json\\`,并确保 one HIGH_LEVEL_DESIGN Step output \\`package.json\\`,包含 \\`build\\`、\\`test\\`、最好还有 \\`lint\\` 脚本。\n7. 本地 TypeScript 源码模块必须使用带显式 \\`.ts\\` 后缀的 ESM 相对导入;配置 \\`allowImportingTsExtensions: true\\`,build/lint 使用 \\`tsc --noEmit\\`。代码必须兼容 Node 原生 type stripping,避免 enum、namespace、参数属性等需转译语法。\n8. dependencies 只是运行时 npm 包建议;真正依赖清单以 HIGH_LEVEL_DESIGN 产出的 \\`package.json\\` 为准,不要编造包名。\n9. application/mixed 需要 \\`src/main.ts\\` 且可直接 \\`node src/main.ts --help\\`;library/mixed 需要 \\`src/index.ts\\` 或等价公共 API 并写 API Guide。\n10. complexityAssessment 和 implementationPhases 规则同 Python:simple=>P1,moderate => 至少 P1+P2,complex => 至少 P1+P2+P3,用户强制分阶段时 userForcedPhaseSplit=true。\n11. verificationGate failurePolicy 必须说明把失败日志传给 Debugger,回退到对应 V 模型阶段并重跑后续阶段。\n12. 复杂需求返回 architectureModules;CODE/MODULE_TEST Step 可覆盖多个模块,但必须在 subTasks 中列出模块级工作。\n13. TypeScript 测试必须只使用 Vitest。Step prompt 或 package.json 中禁止要求 Jest、ts-jest、@types/jest、ts-node、nodemon;package.json 必须使用 \"test\": \"vitest run\" 和 \"build\": \"tsc --noEmit\"。\n\n输出 JSON 结构同 Python,必须包含 \\`\"projectType\": \"application | library | mixed\"\\`,路径使用 \\`src/example.ts\\` 和 \\`tests/example.test.ts\\`;第一个 Step phase 必须是 \\`REQUIREMENT_ANALYSIS\\`,不是 \\`REQUIREMENT\\`。不存在命令行 project-type 覆盖。`;\n\nconst TYPESCRIPT_EXECUTOR_SYSTEM = `你是 XCompiler 的 Step Executor。你只能通过 JSON 工具调用与系统交互,禁止任何 Markdown 或解释性文本。\n\n每一轮你必须返回严格 JSON:\n{\n \"thoughts\": \"<用一句话说明本轮意图>\",\n \"issueResolutionPlan\": \"<仅 DEBUG issue 模式必填:简明说明根因假设、修复目标和验证方案>\",\n \"actions\": [ { \"tool\": \"<工具名>\", \"args\": { ... } }, ... ],\n \"done\": true | false\n}\n\n规则:\n1. 仅可调用本 Step 授权的工具白名单。\n2. 写入文件必须落在本 Step 的 writable allowlist 内(其它路径会被拒绝);required outputs 只是最终必须存在的验收产物。\n 对 FUNCTIONAL_TEST 文档产物,必须按当前 i18n 语言写完整声明的文档包:P1 路径如 \\`README.md\\`、\\`docs/quickstart.md\\`、\\`docs/08-functional-test.md\\`,以及 outputs 中出现时的 \\`docs/api-guide.md\\`;P2+ 则写 outputs 声明的 \\`docs/iterations/<iterationId>/\\` 等价路径。任何已声明文档缺失时不得设置 done=true。\n3. 生成代码必须符合 TypeScript / Node.js 最佳实践;API 要有类型,运行代码必须能直接执行。\n - 【导入约定】src/ 下的本地源码模块使用带显式 \".ts\" 后缀的 ESM 相对导入,例如 \\`import { x } from \"./util.ts\";\\`。代码必须兼容 Node 原生 TypeScript type stripping:只使用可擦除类型语法,避免 enum、namespace、参数属性等需要转译的 TS 特性。禁止使用 Python 风格 import、\\`from src.<module>\\` 或任何 sys.path hack。\n - 【测试约定】测试使用 Vitest:\\`import { describe, it, expect } from \"vitest\";\\`,测试文件放在 \\`tests/**/*.test.ts\\`。\n - 【测试自包含】测试**严禁**读取一个磁盘上不存在的样例文件;当被测函数需要文件输入时,要么在测试里构造内容,要么写入 \\`tests/fixtures/<name>\\`。\n - 【fixture 迭代】当测试已经能运行但被测函数报\"Invalid syntax / Parse error / Malformed\"等解析失败错误,说明 fixture 文件本身格式不合法。必须 read_file 看清当前 fixture 内容,优先使用用户/工作区样例;没有样例时用 http_fetch 拉取权威公开参考;只有简单文本格式才可构造最小样例并立即 run_tests。严禁因为解析错误去弱化实现或断言,也严禁反复凭记忆生成复杂格式 fixture。\n4. 当所有 outputs 文件均已生成且自检通过,把 done 设为 true 且 actions 为空。\n5. 任何错误都通过下一轮的 actions 修正;不要尝试越权或捏造工具。\n6. 【大文件拆块写入】write_file / append_file 单次 content 必须低于工具文档展示的当前 Step 运行时 chunk limit。\n - 超过时请拆分:同一轮 actions 里先一个 write_file 写首段(import + 顶层常量 + 第一个函数/类),紧跟多个 append_file 逐段追加。\n - 复杂工程优先拆成多个内聚模块/文件,并用独立 CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST Step 增量推进,不要写一个巨型万能文件。\n - 拆分必须保证拼接后 TypeScript 语法合法;严禁在函数体中间拆断。\n - 对已存在文件的局部修改使用 replace_in_file / apply_patch,不要重复覆盖整个文件。\n7. package.json 是依赖清单。新增 npm 包要用 add_dependency,禁止去写 requirements.txt。\n8. run_program 会通过 \\`npx tsx\\` 运行入口,run_tests 会通过 \\`npm test\\` 跑 Vitest,最终交付门禁还会验证 direct Node 入口命令。`;\n\nfunction buildPlannerSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_PLANNER_SYSTEM : PYTHON_PLANNER_SYSTEM) + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhasePlanSystem(profile: LanguageProfile): string {\n return `你是 XCompiler 系统的 Planner,当前执行“两级规划”的第一步:PhasePlan。\n\n目标语言:${profile.displayName}。\n\n只输出项目级 PhasePlan,不输出 steps、architectureModules、dependencies 或任何单个 V 模型 Step。\n\nPhasePlan 必须完成:\n1. 判定 projectType:application / library / mixed。\n2. 判定 complexityAssessment:simple / moderate / complex,并说明 rationale。\n3. 生成 implementationPhases:P1 status=current;后续 P2/P3 status=planned。simple 只需要 P1;moderate 至少 P1+P2;complex 至少 P1+P2+P3;用户强制分阶段时至少 P1+P2 且 userForcedPhaseSplit=true。\n4. 每个 phase 必须包含 objective、scope、deliverables、dependsOn 和 verificationGate。\n5. planned phase 只记录目标和门禁,不能展开任何 Step。后续会基于单个 phase 另行生成完整 V 模型计划。\n\n只返回严格 JSON:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"projectType\": \"application | library | mixed\",\n \"complexityAssessment\": { \"level\": \"simple | moderate | complex\", \"rationale\": \"string\", \"splitRecommended\": true, \"userForcedPhaseSplit\": false },\n \"implementationPhases\": [\n { \"id\": \"P1\", \"title\": \"核心功能\", \"objective\": \"string\", \"status\": \"current\", \"scope\": [\"...\"], \"deliverables\": [\"...\"], \"dependsOn\": [], \"verificationGate\": { \"summary\": \"string\", \"checks\": [\"...\"], \"failurePolicy\": \"Feed failures to Debugger, roll back to the paired V-model phase, and rerun subsequent phases.\" } }\n ]\n}\n\n禁止输出 Markdown、解释文字、steps、src/test 文件清单。` + profile.plannerPromptOverride;\n}\n\nfunction buildPlannerPhaseDecomposeSystem(profile: LanguageProfile): string {\n return `你是 XCompiler 系统的 Planner,当前执行“两级规划”的第二步:为指定 phase 生成完整 V 模型 StepPlan。\n\n目标语言:${profile.displayName}。\n\n你会收到已经冻结的 PhasePlan 和一个 phaseId。只允许为该 phaseId 生成 Step;planned phase 不得展开到本次 steps 中。\n\n每个当前 phase 必须使用完整标准 V 模型:\nREQUIREMENT_ANALYSIS -> HIGH_LEVEL_DESIGN -> DETAILED_DESIGN -> CODE -> UNIT_TEST -> INTEGRATION_TEST -> MODULE_TEST -> FUNCTIONAL_TEST。\n\n阶段职责:\n- REQUIREMENT_ANALYSIS 定义功能范围、验收标准、边界条件和用户可见行为,并同步输出功能测试计划。\n- HIGH_LEVEL_DESIGN 定义系统定位、外部接口、第三方库选型、依赖确认和集成边界,并同步输出集成测试计划。\n- DETAILED_DESIGN 定义模块内部函数/类、数据结构、算法、控制流、错误处理和内部架构,并同步输出模块测试计划。\n- CODE 只实现当前 phase 范围并同步输出单元测试计划。\n- UNIT_TEST / INTEGRATION_TEST / MODULE_TEST / FUNCTIONAL_TEST 分别验证对应左侧阶段。\n\n严格产物归属:\n- CODE outputs 只能包含 src/ 下的产品源码文件和单元测试计划文档;不得把 tests/** 文件放到 CODE outputs。\n- UNIT_TEST 拥有单元测试文件;INTEGRATION_TEST 拥有集成测试文件;MODULE_TEST 拥有 architectureModules.testPaths;FUNCTIONAL_TEST 拥有端到端/功能测试文件和交付文档。\n- TypeScript greenfield 必须且只能有一个 HIGH_LEVEL_DESIGN Step 输出 package.json,包含 scripts、dependencies、devDependencies。CODE 不得输出 package.json。\n- TypeScript package.json 只能使用 Vitest:\"test\": \"vitest run\",\"build\": \"tsc --noEmit\",devDependencies 包含 typescript/tsx/vitest/@types/node。禁止提及或要求 Jest、ts-jest、@types/jest、ts-node、nodemon。\n\n输出必须只包含当前 phase 的 dependencies、architectureModules 和 steps。复杂/多关注点任务必须用 architectureModules 表达当前 phase 的模块边界,并在 CODE/MODULE_TEST 的 subTasks 中映射模块级工作。每个 Step 的 subTasks 最多嵌套 2 层。\n\narchitectureModules 只能描述当前 phase 的产品/业务源码模块:\n- sourcePaths 必须是 src/ 下的目标语言源码文件,不能是目录,不能是 tests/、docs/、README、fixtures、utils 或报告文件。\n- testPaths 必须是 tests/ 下的目标语言测试文件,不能是目录。\n- 测试 fixtures、测试工具、领域样例输入、临时输出文件应放在对应测试 Step 的 outputs 或 subTasks 中,不得登记为 architectureModules。\n\n只返回严格 JSON:\n{\n \"requirementDigest\": \"string\",\n \"globalPrompt\": \"string\",\n \"dependencies\": [\"pytest\"],\n \"architectureModules\": [\n { \"id\": \"M001\", \"name\": \"模块名\", \"responsibility\": \"单一明确职责\", \"sourcePaths\": [\"src/example.py\"], \"testPaths\": [\"tests/test_example.py\"], \"dependencies\": [] }\n ],\n \"steps\": [\n { \"id\": \"S001\", \"iterationId\": \"P1\", \"phase\": \"REQUIREMENT_ANALYSIS\", \"title\": \"string\", \"description\": \"string\", \"systemPrompt\": \"范围、输入、产出、验收、禁令\", \"role\": \"Planner\", \"tools\": [\"write_file\"], \"inputs\": [\"docs/topic.md\"], \"outputs\": [\"docs/01-requirement-analysis.md\", \"docs/tests/functional-test-plan.md\"], \"subTasks\": [], \"dependsOn\": [], \"acceptance\": \"string\", \"maxRetries\": 3 }\n ]\n}\n\n禁止输出未来 planned phase 的 Step;禁止输出 requirements.txt;禁止让需求/设计阶段写 src/tests;FUNCTIONAL_TEST 必须包含 README.md、docs/quickstart.md 和功能验收文档。` + profile.plannerPromptOverride;\n}\n\nfunction buildExecutorSystem(profile: LanguageProfile): string {\n return (profile.id === 'typescript' ? TYPESCRIPT_EXECUTOR_SYSTEM : PYTHON_EXECUTOR_SYSTEM) + profile.executorPromptOverride;\n}\n\nconst messages: Messages = {\n llm: {\n coderDebuggerSameModel: (model, coderProvider, debuggerProvider) =>\n `模型配置建议:Coder(${coderProvider})和 Debugger(${debuggerProvider})当前都使用 ${model}。建议配置不同模型,让调试阶段获得独立的推理路径。`,\n invalidBaseUrl: (raw, fallback) => `[xcompiler] base_url 无效(${raw}),回退到 ${fallback}`,\n providerValidationFailed: (role, model) => `[${role}] provider ${model} 输出验证失败,切换到下一个`,\n providerCallFailed: (role, model) => `[${role}] provider ${model} 调用失败,切换到下一个`,\n scoreReadFailed: (p, message) => `读取 ${p} 失败:${message}`,\n scoreChanged: (provider, score, previous) => `评分(${provider})=${score}(原值 ${previous})`,\n scorePersistFailed: (message) => `持久化评分失败:${message}`,\n preflightOllamaReachable: (baseUrl, models) => `预检:Ollama ${baseUrl} 可达,发现 ${models} 个模型`,\n preflightOllamaUnreachable: (baseUrl, message) => `预检:Ollama ${baseUrl} 不可达:${message}`,\n preflightAutoAdded: (providers, roles) => `预检:自动增加 ${providers} 个 provider,覆盖角色 [${roles}]`,\n scoreFileHeader: '# XCompiler LLM provider 评分快照(由 ScoreStore 自动维护,请勿手工编辑)',\n scoreFileSemantics: '# 评分语义:这是动态评分快照;默认 1.0;自动评分范围 0.1~1.0;tags: [cluster] 的 provider 默认 0.2~0.5,除非 llm.cluster_score_min/max 扩宽;失败 -0.5;成功 +0.1。用户覆盖请写 llm_scores_user.yaml,0 表示禁用。',\n },\n system: {\n configEnvMissing: (names) => `[xcompiler] 配置中的环境变量未设置,已替换为空字符串:${names}`,\n unhandledError: (message) => `未处理错误:${message}`,\n unsupportedPypiOnlyNetwork:\n '拒绝 network=pypi-only:Docker 本身无法可靠执行“仅 PyPI”域名白名单。需要隔离请使用 network=off;明确允许任意出站下载时使用 network=download-only。',\n dockerInsideContainerUnsupported:\n '检测到 XCompiler 运行在容器内,sandbox mode=docker 可能导致 bind-mount 路径及 docker.sock 权限错位,因此不受支持。请使用 agent.sandboxes.<language>.mode=subprocess、改在宿主机运行,或仅在受控环境设置 XC_IN_CONTAINER=0。',\n firejailUnsupported: '尚未实现 sandbox=firejail,请使用 subprocess 或 docker。',\n smokeHeader: (baseUrl) => `正在对 ${baseUrl} 执行流式冒烟测试`,\n smokeOk: (model, totalMs, firstTokenMs, chunks, preview) =>\n `[成功 总耗时=${totalMs}ms 首Token=${firstTokenMs}ms 分块=${chunks}] ${model} -> ${preview}`,\n smokeFail: (model, message) => `[失败] ${model} -> ${message}`,\n },\n plugins: {\n invalidId: (id) => `插件 ID“${id}”无效;仅允许小写字母、数字、点、连字符或下划线。`,\n duplicateId: (id) => `插件 ID 重复:${id}`,\n invalidVersion: (plugin, version) => `插件 ${plugin} 的版本不是有效 SemVer:${version}`,\n invalidCoreVersion: (version) => `XCompiler 核心版本不是有效 SemVer:${version}`,\n apiVersionMismatch: (plugin, actual, expected) => `插件 ${plugin} 面向 Plugin API ${actual},当前 XCompiler 运行时要求 API ${expected}。`,\n invalidMinimumVersion: (plugin, version) => `插件 ${plugin} 声明的最低 XCompiler 版本无效:${version}`,\n coreVersionTooOld: (plugin, minimum, actual) => `插件 ${plugin} 要求 XCompiler >= ${minimum},当前版本为 ${actual}。`,\n loaded: (plugin, version) => `插件 ${plugin}@${version} 已加载。`,\n extensionConflict: (plugin, kind, name) => `插件 ${plugin} 不能覆盖已有 ${kind} “${name}”。`,\n hookFailed: (plugin, stage, message) => `插件 ${plugin} 在 ${stage} 阶段执行失败:${message}`,\n manifestReadFailed: (path, message) => `无法读取插件清单 ${path}:${message}`,\n moduleLoadFailed: (plugin, path, message) => `无法从 ${path} 加载插件 ${plugin}:${message}`,\n exportInvalid: (plugin, exportName) => `插件 ${plugin} 的导出 ${exportName} 不是有效 XCompiler 插件`,\n manifestMismatch: (plugin) => `插件 ${plugin} 的运行时清单与预检清单不一致`,\n },\n audit: {\n processLogTitle: '# XCompiler 开发过程记录',\n processLogPreamble: '> 由 XCompiler 自动生成,记录 CLI 会话、用户输入、LLM 交互与执行动作,用于交付追踪。',\n sessionStart: (ts, command) => `## ▶ 会话 ${ts} — \\`${command}\\``,\n sessionEnd: (ts) => `### ◀ 会话结束 ${ts}`,\n eventSessionStart: (command) => `启动 ${command}`,\n eventSessionEnd: (command) => `结束 ${command}`,\n userInput: (label) => `#### 👤 用户输入 — ${label}`,\n llmRequest: (role, model) => `🤖 LLM 请求 — <code>${role}</code> 使用 <code>${model}</code>`,\n llmResponse: (role, model) => `📩 LLM 响应 — <code>${role}</code> 使用 <code>${model}</code>`,\n executorTurn: (stepId, round, role, provider, actions, done) =>\n `🧠 执行轮次 — <code>${stepId}</code> 第 ${round} 轮 / 角色 <code>${role}</code>${provider ? ` · 使用 <code>${provider}</code>` : ''}(actions=${actions}, done=${done})`,\n thoughtsLabel: '**思考:**',\n actionsLabel: '**动作:**',\n noThoughts: '(无思考内容)',\n plannerThought: (stage, provider) => `🧩 Planner 思考 — ${stage}${provider ? ` · 使用 <code>${provider}</code>` : ''}`,\n markdownAppendFailed: (message) => `[audit] Markdown 追加失败:${message}`,\n jsonlAppendFailed: (message) => `[audit] JSONL 追加失败:${message}`,\n traceLine: (kind, message) => `[audit] ${kind} ${message}`,\n autoFixedSrcImport: (p) => `已自动修复 ${p} 中的 src import`,\n wroteFile: (p) => `已写入 ${p}`,\n userDecision: (label, value) => `${label} → ${value}`,\n eventLlmRequest: (role, model) => `${role} → ${model}`,\n eventLlmResponse: (role, model) => `${role} ← ${model}`,\n eventLlmError: (role, model, message) => `${role} 使用 ${model}:${message}`,\n eventExecutorTurn: (stepId, round, role, provider) => `${stepId} 轮次=${round} 角色=${role}${provider ? ` 使用 ${provider}` : ''}`,\n eventPlannerThought: (stage, provider) => `Planner ${stage}${provider ? ` 使用 ${provider}` : ''}`,\n llmChatFailedThought: (message) => `LLM 调用失败:${message}`,\n llmChatAborted: (stepId, round, chars, message) => `${stepId} 第 ${round} 轮在收到 ${chars} 字符后中止:${message}`,\n toolDenied: (tool) => `拒绝调用工具 ${tool}`,\n toolCalled: (tool) => `调用工具 ${tool}`,\n toolResult: (tool, ok, detail) => `工具 ${tool}${ok ? '执行成功' : '执行失败'}:${detail}`,\n documentArchived: (from, to) => `已归档 ${from} → ${to}`,\n documentArchiveFailed: (p, message) => `归档 ${p} 失败:${message}`,\n httpFetchSaved: (method, url, p, bytes) => `http_fetch ${method} ${url} → ${p}(${bytes} 字节)`,\n httpFetchResponse: (method, url, status, bytes) => `http_fetch ${method} ${url} → ${status}(${bytes} 字节)`,\n partialFailureHeader: (message) => `# LLM 调用失败:${message}`,\n streamLength: (chars) => `# 流式响应长度:${chars} 字符`,\n },\n stream: {\n resolvingModel: '正在解析模型',\n waiting: '等待响应',\n streaming: '流式响应',\n done: '完成',\n failed: '失败',\n chars: (n) => `${n} 字符`,\n toolRunner: '本地工具',\n toolExecution: (stepId, tool) => `${stepId} 工具 ${tool}`,\n },\n sandboxLog: {\n subprocessBuilt: (deps) => `子进程沙箱已构建(${deps ? '含依赖' : '空环境'})`,\n subprocessNodeBuilt: 'Node 子进程沙箱已构建(npm install)',\n dockerBuilt: (deps) => `Docker 沙箱已构建(${deps ? '含依赖' : '空环境'})`,\n dockerNodeBuilt: 'Docker Node 沙箱已构建(npm install)',\n command: (runtime, command) => `${runtime} ${command}`,\n },\n cli: {\n rootDescription: 'XCompiler — AI Software Factory CLI',\n compileDescription: '交互式编译需求为 phasePlan.json 与当前阶段计划(含强制人工确认)',\n runDescription: '执行已确认的 phasePlan.json(支持分阶段运行:--phase / --from)',\n loadDescription: '加载 XXX.xc 工程文件并继续当前 plan',\n appendDescription: '在已有 XXX.xc 工程基础上追加新需求,并重新走澄清与 V 模型执行',\n lsDescription: '扫描 workspace 列出所有 phasePlan.json / 历史 plan.json 状态摘要',\n showDescription: '打印 Step 定义 / 状态 / 产物 / 最近审计',\n optWorkspace: 'workspace 目录(同 --output,默认为当前目录)',\n optOutput: '工程/workspace 输出目录(优先级最高,等价于 -w)',\n optConfig: 'config.yaml 路径',\n optInput: '从需求文件读取(非交互)',\n optTopic: '直接使用已澄清的 topic.md 作为输入:跳过 intake / clarify / Addenda / Gate 1,直接进入 decompose',\n optPlanOut: '指定 phasePlan.json 输出文件(默认 <workspace>/phasePlan.json)',\n optBaseDir: '项目输出根目录(在其下创建 <name> 子目录)',\n optName: '项目名(默认 xcompiler-<时间戳>)',\n optYes: '跳过人工确认(仅在 -i / -t 提供时有意义)',\n optForce: '强制重新生成:覆写 workspace 锁、忽略旧计划文件',\n optDryRun: '仅打印拓扑顺序,不执行',\n optFrom: '从指定 Step 开始(之前的跳过)',\n optPhase: '仅执行指定 phase(REQUIREMENT_ANALYSIS/HIGH_LEVEL_DESIGN/DETAILED_DESIGN/CODE/UNIT_TEST/INTEGRATION_TEST/MODULE_TEST/FUNCTIONAL_TEST/DEBUG)',\n optReset: '重置所有 Step 状态为 PENDING',\n optMaxDepth: '递归最大深度',\n optTail: '最近审计条数',\n optPlan: 'phasePlan.json 路径,默认 <workspace>/phasePlan.json',\n optLang: 'UI / 提示词语言:EN | CN(ISO 3166-1 Alpha-2)',\n optIntent: '计划意图:greenfield | feature | refactor | self',\n optBaselinePlan: '已有基线 phasePlan.json / plan.json 路径(默认 <workspace>/phasePlan.json)',\n optProjectFile: 'XXX.xc 工程文件路径(默认 <workspace>/<name>.xc)',\n optDebugWikiPath: 'debug wiki 根目录路径(默认 <XCompiler path>/.xcompiler/debug-wiki)',\n argPlan: 'phasePlan.json 或历史 plan.json 路径(默认 = <workspace>/phasePlan.json)',\n argProjectFile: 'XXX.xc 工程文件',\n argStepId: 'Step ID,如 S001',\n evolveDescription: '在现有 workspace 基础上生成并执行增量 feature/refactor 计划',\n bootstrapDescription: '在隔离 Git worktree 中构建并验证下一代 XCompiler',\n optRepository: '要执行自举的 XCompiler Git 仓库(默认当前目录)',\n optPromote: '全部质量门通过后,快进合并到当前分支',\n optCleanup: '写入报告后删除隔离 worktree(保留候选分支)',\n optDockerQualification: '使用尚处于实验阶段的 Docker 环境执行候选质量门',\n invalidLocale: (value) => `不支持的语言“${value}”,请使用 EN 或 CN。`,\n invalidIntent: (value, allowed) => `无效 intent“${value}”,可选值:${allowed}。`,\n invalidPhase: (value, allowed) => `无效阶段“${value}”,可选值:${allowed}。`,\n invalidStepId: (value) => `无效 Step ID“${value}”,格式应为 S 加至少三位数字。`,\n invalidNonNegativeInteger: (value) => `参数必须是非负整数,当前值为“${value}”。`,\n helpUsage: '用法:',\n helpArguments: '参数:',\n helpOptions: '选项:',\n helpCommands: '命令:',\n helpOption: '显示命令帮助',\n versionOption: '输出版本号',\n defaultValue: (value) => `(默认值:${value})`,\n },\n bootstrap: {\n notGitRepository: (p) => `不是 Git 仓库:${p}`,\n dirtyRepository: (files) => `功能自举要求宿主仓库保持干净,待处理路径:${files}`,\n worktreeReady: (p, branch) => `自举 worktree 已就绪:${p}(${branch})`,\n compileStarted: '正在编译自举 V 模型计划…',\n compileFailed: (code, message) => `自举计划编译失败(exit=${code}):${message}`,\n compileCancelled: '自举计划尚未确认,已取消执行。',\n executeStarted: '正在隔离 worktree 中执行候选版本…',\n executeFailed: (status) => `候选版本执行未成功完成(${status})。`,\n qualificationStarted: '正在执行确定性自举质量门…',\n qualificationDockerExperimental: 'Docker 质量门环境尚未完成验证,本次按显式选项以实验模式执行。',\n missingScript: (name) => `package.json 缺少必选脚本:${name}`,\n missingBin: 'package.json 未声明 CLI bin 入口',\n checkPassed: (name, ms) => `${name} 通过(${ms}ms)`,\n checkFailed: (name, code) => `${name} 失败(exit=${code})`,\n reportWritten: (p) => `自举报告已写入:${p}`,\n candidateReady: (branch) => `候选版本已在 ${branch} 通过验证;仍需显式使用 --promote 才会晋级。`,\n promoted: (branch) => `候选版本已通过快进合并完成晋级:${branch}`,\n cleanupDone: (p) => `自举 worktree 已删除:${p}`,\n promotionBlocked: '存在未通过的质量门,禁止晋级候选版本。',\n hostHeadChanged: '自举期间宿主 HEAD 已变化',\n candidateDirty: (files) => `候选 worktree 存在未提交变更:${files}`,\n candidateStatusUnknown: '(未知路径)',\n candidateMoved: (expected, actual) => `质量门之后候选提交发生漂移(预期 ${expected},实际 ${actual})。`,\n candidateNotBasedOnBase: (candidate, base) => `候选提交 ${candidate} 不是自举基线 ${base} 的后代。`,\n promotionVerificationFailed: (expected, actual) => `晋级后 HEAD 校验失败(预期 ${expected},实际 ${actual})。`,\n reportTitle: 'XCompiler 功能自举报告',\n reportNone: '(无)',\n reportNextQualified: (repository, candidateCommit) => `git -C \"${repository}\" merge --ff-only \"${candidateCommit}\"`,\n reportNextPromoted: '使用已晋级版本执行下一轮功能自举。',\n reportNextFailed: '检查候选 worktree,修复失败质量门后再晋级。',\n reportLabels: {\n status: '状态', repository: '仓库', baseCommit: '基线提交',\n candidateCommit: '候选提交', branch: '候选分支', worktree: '隔离工作区',\n createdAt: '创建时间', checks: '质量门', changedFiles: '变更文件',\n nextStep: '下一步',\n },\n },\n compile: {\n workspaceReady: (p) => `工作区:${p}`,\n forceOverride: '--force:覆盖工作区锁并重新生成计划。',\n topicInputConflict: '同时提供了 --topic 和 --input;优先使用 --topic,忽略 --input。',\n auditTopicInput: 'topic.md(--topic)',\n auditOriginalRequirement: '原始需求(Intake)',\n auditUserAddenda: '用户补充需求',\n auditEditedTopic: '已编辑 topic.md',\n auditTopicPersisted: (p) => `topic.md 已写入:${p}`,\n auditDecomposeFailed: 'planner.decompose 失败',\n lintIssue: (id, message) => ` - [${id}] ${message}`,\n planPreviewTruncated: '…(已截断,完整内容见 docs/plan.md)',\n auditPlanPersisted: (p) => `阶段 plan 已写入:${p}`,\n projectFileWritten: (p) => `工程文件已更新:${p}`,\n nextCommand: (command) => ` 下一步:${command}`,\n topicEmptyExit: '--topic 文件为空,已退出。',\n topicLoaded: (p) => `已加载 topic:${p}(跳过 intake / clarify / Gate 1)`,\n requirementEmptyExit: '需求为空,已退出。',\n requirementInputHint: '请描述你的需求(多行,输入空行结束):',\n spinClarify: 'Planner 正在澄清需求…',\n clarifySucceed: (n) => `澄清问题:${n} 条`,\n clarifyFail: '澄清失败',\n clarifyChoiceHint: (range) => `输入 ${range} 选择已展示选项,或直接输入自定义回答内容。`,\n addendaConfirm: '是否有补充需求要追加?(会连同澄清一起发给 Planner,并保留在 plan.userAddenda 字段)',\n addendaEditorMsg: '输入自定义补充需求(多行、Markdown 可)',\n auditClarifyAnswer: (qid, q) => `澄清回答 ${qid}: ${q}`,\n spinDecompose: 'Planner 正在按 V 模型拆解…',\n decomposeFail: 'Planner 拆解失败',\n plannerInvalidPlan: 'Planner 无法生成有效 plan:',\n plannerInvalidPlanHint1: ' 常见原因:LLM 输出未满足 XCompiler 计划 schema、V 模型骨架或架构契约;不能跳过该错误。',\n plannerInvalidPlanHint2: ' 排查:检查 .xcompiler/audit.jsonl 中的 llm.error / planner.thought 原文,按契约错误修正 Planner 输出。',\n plannerTransportFailureHint1: ' 常见原因:LLM provider 连接失败、请求超时或服务端中断;这不是项目 plan/源码缺陷。',\n plannerTransportFailureHint2: ' 排查:检查 OPENAI_BASE_URL / provider base_url、模型服务是否可达、网络权限和超时设置,然后重跑 build。',\n decomposeSucceed: (n) => `已生成 ${n} 个 Step`,\n schemaFail: 'Plan schema 校验失败:',\n schemaInvalidSavedAt: (p) => ` 完整 plan 已落盘:${p}`,\n lintFail: (n) => `Plan lint 失败(${n}):`,\n topicPreviewHeader: '─── topic.md (preview) ───',\n topicPreviewFooter: '──────────────────────────────',\n gate1Confirm: '需求是否符合预期?',\n gate1ChoiceConfirm: '✅ confirm — 进入计划生成',\n gate1ChoiceEdit: '✏️ edit — 打开编辑器修改',\n gate1ChoiceCancel: '❌ cancel — 放弃本次会话',\n gate1AuditLabel: '需求确认门 (Gate 1)',\n gate1Cancelled: '已取消,未写入任何文件。',\n editTopicMsg: '编辑 topic.md',\n topicWritten: (p) => `已写入 ${p}`,\n planWritten: (p) => `阶段 plan 已写入 ${p}`,\n phasePlanWritten: (p) => `phasePlan 已写入 ${p}`,\n planPreviewHeader: '─── plan.md (preview) ───',\n planPreviewFooter: '─────────────────────────',\n gate2Confirm: '是否确认该计划? (此为最终确认,确认后将写入 phasePlan.json 和当前阶段计划)',\n gate2AuditLabel: '计划确认门 (Gate 2)',\n gate2Rejected: '未确认,已放弃。phasePlan.json 未写入。',\n baselineLoaded: (kind, sources) => `已加载 ${kind} 基线:${sources}`,\n baselineMissing: (workspace) => `增量模式需要在 ${workspace} 中找到已有工程基线(topic / docs / plan / src)。`,\n baselineLanguageOverride: (baseline, source, configured) =>\n `增量模式将沿用基线语言 ${baseline}(来源:${source}),而不是配置中的 ${configured}。`,\n topicTitle: '# Project Topic (项目选题)',\n topicPreamble: '> 本文件是需求澄清后冻结的项目选题,后续 V 模型拆解与所有阶段产出皆以本文件为唯一需求输入。',\n topicSecRequirement: '## 原始需求',\n topicSecClarify: '## 澄清记录',\n topicSecAddenda: '## 用户补充需求 (Addenda)',\n topicSecBaseline: '## 现有工程基线',\n },\n inspect: {\n noPlanFound: '未找到任何 phasePlan.json / plan.json',\n digestLabel: 'digest:',\n stepNotFound: (id) => `Step ${id} 未找到`,\n secDescription: '— description —',\n secAcceptance: '— acceptance —',\n secSubtasks: '— subtasks —',\n secSystemPrompt: '— systemPrompt —',\n secOutputs: '— outputs —',\n secRecentAudit: (n) => `— recent audit (${n}) —`,\n planHeader: (p, language) => `${p} 语言=${language}`,\n planStatusSummary: (total, done, pending, failed, skipped, running) =>\n `步骤=${total} 完成=${done} 待执行=${pending} 失败=${failed} 跳过=${skipped} 运行中=${running}`,\n planReadFailed: (p, message) => `${p} — ${message}`,\n stepHeader: (id, phase, title, status, retries, maxRetries) => `${id} ${phase} ${title} ${status} 重试=${retries}/${maxRetries}`,\n stepRoleTools: (role, tools) => `角色=${role} 工具=[${tools}]`,\n stepDependsOn: (ids) => `依赖:${ids}`,\n outputStatus: (exists, p) => `${exists ? '✓' : '✗'} ${p}`,\n auditEntry: (ts, kind, message) => `${ts} ${kind} ${message}`,\n },\n execute: {\n forceReset: '--force:重置所有 Step 为 PENDING,并覆盖工作区锁。',\n manifestRecalibrated: (p) => `已重新校准 ${p}(移除版本锁和幻觉包名)`,\n manifestSeeded: (p) => `已根据 plan.dependencies 生成 ${p}`,\n auditPlanLoaded: (p) => `已加载 plan:${p}`,\n planLoaded: (p) => `已加载 Plan:${p}`,\n planSummary: (language, steps) => ` 语言=${language},步骤=${steps}`,\n preflightModelMissing: (names) => `LLM preflight: 模型缺失,当前运行已跳过 [${names}],并将动态评分降到最低值`,\n preflightAutoAdded: (n) => `LLM preflight: 自动注入 ${n} 个 provider(来自 ollama /api/tags)`,\n runInterrupted: (id, e, total) => `执行中断于 ${id}(已执行 ${e}/${total})`,\n runReasonLabel: ' 原因: ',\n runFailureLogHeader: ' --- 详细失败日志(tail 40 行) ---',\n runAllDone: (e, total) => `Plan 全部完成(${e}/${total})`,\n projectAuditSummary: (errors, warnings) => `项目审计:${errors} 个错误,${warnings} 个警告`,\n projectMemoryRefreshFailed: (message) => `项目记忆刷新失败:${message}`,\n projectAuditCheck: (name, summary) => `[审计:${name}] ${summary}`,\n auditDocPresent: (p) => `${p} 存在`,\n auditDocMissing: (p) => `缺少 ${p}`,\n auditDeliveryDocPresent: '交付文档存在',\n auditDeliveryDocMissing: '缺少 docs/08-functional-test.md',\n auditTestFilesFound: (count) => `发现 ${count} 个有效测试文件`,\n auditTestFilesMissing: 'tests/ 下没有有效测试文件',\n auditEntrypointOk: (command) => `入口验证通过:${command}`,\n auditEntrypointFailed: (command) => `入口验证失败:${command}`,\n auditPackageJsonMissing: '缺少 package.json',\n auditScriptMissing: (name) => `package.json 缺少 ${name} 脚本`,\n auditCommandOk: (name) => `${name} 通过`,\n auditCommandFailed: (name, exitCode, timedOut) =>\n `${name} 失败(exit=${exitCode}${timedOut ? ',超时' : ''})`,\n },\n engine: {\n spinSandboxBuild: (profile) =>\n profile.id === 'typescript'\n ? `构建沙盒(npm install,${profile.manifestFile})…`\n : `构建沙盒(pip install -r ${profile.manifestFile})…`,\n sandboxReady: (r) => `沙盒就绪:${r}`,\n stepSkipDone: (id, phase) => ` ↪ ${id} ${phase} 已完成,跳过`,\n spinSandboxRebuild: (id, profile) =>\n profile.id === 'typescript'\n ? `Step ${id} 写入 ${profile.manifestFile},重建 npm 沙盒…`\n : `Step ${id} 写入 ${profile.manifestFile},重建 pip 沙盒…`,\n sandboxStatus: (r) => `沙盒:${r}`,\n autoFixedSrcImports: (n, files) => ` ⚠ auto-fixed sys.path bootstrap in ${n} 个入口文件:${files}`,\n debugResumeNotice: (id, n) => ` ↻ ${id} 检测到上次会话以 FAILED 结束(已累积 ${n} 次尝试),本次首轮直接进入 Debugger 模式。`,\n spinDebugRetry: (id, attempt, budget, cap, reason) => `🛠 ${id} DEBUG retry ${attempt}/${budget} (cap=${cap}) — ${reason}`,\n retryException: (a, b, msg) => `retry ${a}/${b} 抛出异常:${msg}`,\n fixSucceeded: (id, a) => `${id} 修复成功 (retry=${a})`,\n retryHealthyButFailed: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} 仍失败但健康(扩窗) · ${tag} · ${reason}`,\n retryLowQuality: (a, before, b, tag, reason) =>\n `retry ${a}/${before}→${b} 低质量输出(缩窗) · ${tag} · ${reason}`,\n retryStillFailed: (a, b, tag, reason) => `retry ${a}/${b} 仍失败 · ${tag} · ${reason}`,\n earlyAbortLowQuality: (id, n) => ` ⚡ ${id} 检测到连续 ${n} 次低质量 LLM 输出(解析失败/重复 actions/无进展),快速终止 DEBUG 重试`,\n stepFinalFailed: (id, phase, role) => `✖ Step ${id} (${phase} / ${role}) 最终失败`,\n finalAttemptsLine: (a, b, c, ea) =>\n ` attempts=${a} final_budget=${b} cap=${c}` + (ea ? ' (early-abort: low-quality)' : ''),\n finalMetricsLine: (h, p, r, tf, pr) =>\n ` health=${h} parseFail=${p} repeat=${r} toolFail=${tf} progress=${pr}`,\n reasonLabel: 'reason: ',\n failureLogHeader: '--- failure log (tail, max 80 lines) ---',\n fixSuggestionsHeader: '--- 修复建议(calibration) ---',\n auditHint: (id) => ` 审计: 查看 .xcompiler/audit.jsonl 与 .xcompiler/llm-stream/${id}-*.txt 获取完整原始流`,\n spinStepRunning: (id, phase, title) => `▶ ${id} ${phase} ${title}`,\n noFailureLog: '(未捕获日志)',\n suggestionLine: (index, code, hint) => ` ${index}. [${code}] ${hint}`,\n phaseStart: (id, phase, title) => `${id} ${phase} ${title}`,\n phaseFailed: (id, debug, reason) => `${id} ${debug ? 'DEBUG ' : ''}失败 — ${reason}`,\n phaseDone: (id, rounds) => `${id} 完成(轮次=${rounds})`,\n phaseException: (id, message) => `${id} 异常失败 — ${message}`,\n archGateReason: (missing) => `HIGH_LEVEL_DESIGN 门禁:架构契约缺少 ${missing} 个标记`,\n archGateMissing: (tokens) => `缺失模块 ID/路径:${tokens}`,\n archGateInstruction: (p) => `请更新 ${p},确保每个 architectureModules 项在进入 CODE 前均可追踪。`,\n testGateReason: (exitCode, timedOut) => `测试门禁:测试退出码=${exitCode}${timedOut ? '(超时)' : ''}`,\n deliveryGateReason: (command, exitCode, timedOut) => `FUNCTIONAL_TEST 门禁:\\`${command}\\` 退出码=${exitCode}${timedOut ? '(超时)' : ''}`,\n missingPythonEntrypoint: '缺少 Python 入口:需要 src/main.py、src/<package>/__main__.py,或 src/cli.py 等显式 CLI 文件',\n missingTypeScriptEntrypoint:\n '缺少 TypeScript 入口:需要 package.json start/bin 或 src/main.ts、src/index.ts、src/main.tsx 之一',\n invalidPythonEntrypointSource: (path) =>\n `Python 入口源码无效:${path} 必须是真实 CLI 入口,至少包含 def main(...)、argparse.ArgumentParser 或 if __name__ == \"__main__\" 这类入口结构;仅 import/comment 的占位文件不能算可运行应用。`,\n entrypointHelpOutputMissing: (command) =>\n `入口探测 \\`${command}\\` 虽然退出码为 0,但没有输出有意义的 help/usage 文本;必须实现 --help,不能靠空脚本自然退出过关。`,\n reasonLine: (reason) => `原因:${reason}`,\n roundsLine: (rounds) => `轮次:${rounds}`,\n commandLine: (command) => `命令:${command}`,\n stdoutTailHeader: '--- 标准输出(尾部)---',\n stderrTailHeader: '--- 标准错误(尾部)---',\n testStdoutTailHeader: '--- 测试标准输出(尾部)---',\n testStderrTailHeader: '--- 测试标准错误(尾部)---',\n outputsMissing: (paths) => `缺失输出:${paths}`,\n metricsLine: (health, parseFail, repeat, toolFail, progress) =>\n `指标:健康度=${health} 解析失败=${parseFail} 重复=${repeat} 工具失败=${toolFail} 进度=${progress}`,\n metricsUnavailable: '指标:无',\n toolCallsHeader: '工具调用:',\n toolCallLine: (tool, ok, detail) => ` - ${tool} ${ok ? '成功' : '失败'} ${detail}`,\n projectMemoryRefreshFailed: (message) => `项目记忆刷新失败:${message}`,\n deliveryFixHints: (language) => language === 'typescript'\n ? [\n '修复方向(按优先级):',\n ' 1. 若 TypeScript 源码出现模块解析或 ERR_MODULE_NOT_FOUND,使用带显式 .ts 后缀的相对 ESM import。',\n ' 2. 若为 --help 或未知选项,main() 必须支持 --help 并以 0 退出。',\n ' 3. 若为应用异常,修复实现并保持入口轻量。',\n ]\n : [\n '修复方向(按优先级):',\n ' 1. 若为 src 相关 ModuleNotFoundError,加入 planner #19 的 sys.path 自举或移除 import 的 src. 前缀。',\n ' 2. main() 必须是真实 CLI 入口:解析 --help、调用项目模块、打印有意义输出,并用 if __name__ == \"__main__\": main() 启动。',\n ' 3. 若为 argparse 错误,main() 必须无需其他必填参数即可支持 --help 并以 0 退出。',\n ' 4. 若为业务异常,修复实现;入口只负责参数解析与调用。',\n ],\n },\n render: {\n sectionGlobalPrompt: '## Global prompt (注入每个 Step 的 system prompt)',\n sectionDependencies: (manifestFile) => `## Dependencies (将写入 ${manifestFile})`,\n sectionBaselineSummary: '## 现有工程基线',\n labelSystemPrompt: '**System prompt (唯一使命):**',\n },\n prompts: {\n plannerSystem: (p) => buildPlannerSystem(p),\n plannerPhasePlanSystem: (p) => buildPlannerPhasePlanSystem(p),\n plannerPhaseDecomposeSystem: (p) => buildPlannerPhaseDecomposeSystem(p),\n plannerSelfMode: `自举模式覆盖规则(优先级高于上方与之冲突的 greenfield 规则):\n- 目标是现有 XCompiler 仓库。除非需求明确要求修改,否则必须保留当前 package.json、tsconfig、bin、CLI 入口、模块结构、公共导出和设计文档。\n- 不得为了满足新建工程入口约定而创建 src/main.ts;必须复用现有 package.json 声明的入口。\n- 除非本次变更确实需要修改,否则 HIGH_LEVEL_DESIGN outputs 不得包含 package.json 或 tsconfig.json。\n- 每个 CODE/测试产物必须严格限定在本次增量范围,禁止整体重建或替换仓库。\n- 将稳定宿主视为 N 代、隔离 worktree 中的候选版本视为 N+1 代;禁止设计进程内热替换。`,\n plannerClarifySystem: `你是 XCompiler V 模型的需求分析师。你的职责不是复述 topic,而是发现会改变功能设计、验收结果或架构边界的未决事项。\n只返回严格 JSON。问题必须可由业务方直接作答、一次只确认一个决策,避免空泛的“还有什么要求”或技术栈选型问题;只有用户提示明确要求时,才允许提出唯一一条开发语言确认问题。`,\n plannerClarify: (raw, opts = {}) =>\n `用户的原始需求如下:\n\n\"\"\"\n${raw}\n\"\"\"\n\n请针对 topic 中尚未明确、且答案会实质改变实现或验收的事项,生成${opts.complex ? '8-10' : '7-10'}个互不重复的澄清问题。不得返回空数组;如果功能描述已经较完整,就追问验收示例、失败行为和明确的不做范围。\n\n仅返回 JSON 数组,每项严格为:\n{\"id\":\"Q1\",\"category\":\"functionality|data|acceptance|boundary|quality|extensibility\",\"question\":\"一个可直接回答的具体问题\",\"why\":\"该答案会影响什么设计或验收\",\"options\":[{\"label\":\"A\",\"answer\":\"最高优先级的可行设定\"},{\"label\":\"B\",\"answer\":\"第二个可行设定\"}]}\n\n问题组合要求(功能优先):\n- 至少 ${opts.complex ? '5' : '4'} 个功能性问题,category 使用 functionality / data / acceptance,确保功能问题占多数。优先质询:目标用户与角色、核心使用流程、功能规则与状态变化、输入输出、失败/异常行为、可验证验收示例。\n- 至少 1 个 boundary:明确本期必须做、明确不做、外部系统责任边界或兼容范围。\n- 至少 1 个 quality:询问可量化的性能、容量、并发、时延、准确性、可靠性或安全指标;不要只问“性能有什么要求”。\n- 至少 1 个 extensibility:询问最可能新增的业务能力、扩展维度或需要稳定保留的接口,不要泛问“是否需要扩展性”。\n- 如果交付形态不明确,必须包含 1 个 boundary 问题,确认本项目应是 API library/SDK/软件包、可运行应用/CLI/服务,还是二者兼具的 mixed 交付。\n- 如果需求需要访问外部 API/URL/第三方数据源,必须包含 1 个 data 或 boundary 问题,确认用户是否已有可用 API、key、token 或鉴权方式;若用户没有凭证,本期默认优先选择公开、免 key/token、可验证的接口,不要生成占位 URL。\n- 按阻塞程度排序:先问会改变核心功能/数据模型的问题,再问范围与质量,最后问未来扩展。\n- 一题只包含一个主要决策,给出必要的业务选项或示例,禁止把多个无关问题用“以及/或者”拼成一题。\n- 每个问题都必须预生成 2-5 个可行回答设定,按优先级排序。选项数量不是固定值:二选一场景用 2 个,常见默认设定用 3 个,只有确实存在 4-5 个彼此不同的可行设定时才生成 4-5 个;不要填充或强制每题都是 3 个选项。\n- 选项从 A 开始连续标号,到实际最后一个选项结束,例如 A-B、A-C、A-D 或 A-E;如果能判断推荐/默认方案,A 应是最高优先级方案。选项必须是具体业务/产品设定,不要写成空泛占位。\n- 不要把“其他 / 自定义 / 用户决定”作为选项;CLI 已支持用户输入已展示的选项字母或直接输入自定义回答内容。\n${opts.projectShapeAmbiguous\n ? '- 本 topic 必问:明确确认 API library / 可运行应用 / mixed 交付边界。\\n'\n : ''}\n${opts.languageAmbiguous\n ? '- 本 topic 必问:必须包含且只包含 1 个 boundary 问题确认目标开发语言。选项必须是 A. Python(默认/推荐) 和 B. TypeScript / Node.js;用户仍可输入自定义回答。\\n'\n : ''}\n\n${opts.languageAmbiguous\n ? `【技术栈确认】XCompiler 无法从 topic 或基线中判断目标开发语言。只询问上面要求的开发语言问题;不要询问包管理器、测试框架或操作系统。若用户不选择,默认 Python。`\n : `【硬约束】实现技术栈已经由用户 topic / 现有工程基线固定,不要重新询问语言、运行时、包管理器这类问题。\n**严禁**提出以下类型的问题:\n - \"希望用什么编程语言 / 框架 / 运行时实现?\"\n - \"需要哪种测试框架 / 构建工具 / 包管理器?\"\n - \"目标平台是哪种操作系统?\"`}\n${opts.intent && opts.intent !== 'greenfield'\n ? `这是一条针对现有工程的增量 ${opts.intent} 请求${opts.hasBaseline ? ';分解阶段还会提供一份基线摘要' : ''}。请只问“变更增量”相关问题,不要把项目当成从零开始重做。`\n : ''}问题主体必须聚焦功能行为;性能、边界和扩展性用于消除会影响本期设计的关键歧义。`,\n plannerDecompose: (raw, qa, addenda, opts = {}) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成一份增量 ${opts.intent} 计划,优先复用当前架构、文件、测试与依赖,而不是把整个项目重新搭一遍。除本次需求涉及的范围外,默认保持既有行为不变。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}规划深度约束:\n- 除非需求明确只是一个很小的单函数 / 单脚本 / 小工具,否则不要把方案压缩成“一个源码文件 + 一个测试文件”的最小实现。\n- 如果需求横跨多个关注点(领域逻辑、API/CLI 接口、持久化、外部集成、流程编排、测试),必须在计划里体现为多个架构模块,并在 CODE/MODULE_TEST 宏 Step 的 subTasks 下分解模块级工作。\n- 在 plan 中评估项目复杂度,并按评估结果确定 implementationPhases 数量:simple => 只有 P1 current;moderate => P1 current + 至少 P2 planned;complex => P1 current + 至少 P2/P3 planned。若用户明确要求分阶段/里程碑,至少使用 P1+P2,并设置 userForcedPhaseSplit=true。每个 current/planned implementation phase 都必须在 steps 中拥有一套完整 V 模型,并让 Step.iterationId 指向对应 phase。\n- 请通过 HIGH_LEVEL_DESIGN / DETAILED_DESIGN Step 明确模块边界、职责划分、依赖和后续可扩展点,让后续增量开发可以持续追加,而不是每次重写。\n- 如果基线里已经存在相关文件,优先在原模块上扩展/重构,不要新造一套行为重复的影子实现。\n\n请按系统规则输出严格 JSON 计划。`,\n plannerPhasePlan: (raw, qa, addenda, opts = {}) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成 PhasePlan,优先复用当前架构、文件、测试与依赖。除本次需求涉及的范围外,默认保持既有行为不变。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}请先只生成大的 PhasePlan:\n- 评估项目复杂度并决定 phase 数量:simple => 只有 P1 current;moderate => P1 current + 至少 P2 planned;complex => P1 current + 至少 P2/P3 planned。\n- P1 objective 必须是可独立交付、可验证的核心功能。\n- P2/P3 只写后续增强目标、范围、交付物和验证门禁;不要展开任何 V 模型 Step。\n- 每个 phase 的 verificationGate 必须说明失败时把完整错误日志交给 Debugger,并回退到对应 V 模型阶段后重跑后续阶段。\n- 只返回 PhasePlan JSON,禁止包含 steps / architectureModules / dependencies。`,\n plannerPhaseDecompose: (raw, qa, addenda, opts) =>\n `原始需求:\n\"\"\"\n${raw}\n\"\"\"\n\n澄清问答:\n${qa || '(无)'}\n\n${addenda ? `用户补充需求(需严格遵守,优先级高于原始描述中模糊的部分):\\n\"\"\"\\n${addenda}\\n\"\"\"\\n\\n` : ''}${opts.intent && opts.intent !== 'greenfield'\n ? `增量意图:${opts.intent}\n\n请在现有工程基础上生成当前 phase 的增量 V 模型 StepPlan,优先复用当前架构、文件、测试与依赖。\n\n现有工程基线:\n\"\"\"\n${opts.baseline || '(缺少基线摘要)'}\n\"\"\"\n\n`\n : ''}已确认的 PhasePlan:\n\"\"\"\n${opts.phasePlan}\n\"\"\"\n\n当前需要展开的 phaseId:${opts.phaseId}\n\n请只为 ${opts.phaseId} 输出完整 V 模型 StepPlan:\n- steps 中每个 Step.iterationId 必须等于 \"${opts.phaseId}\"。\n- 禁止输出其他 planned phase 的 Step;P2/P3 的详细计划留到它们成为 current phase 时再生成。\n- 如果 ${opts.phaseId} 横跨多个关注点(领域逻辑、CLI/API、文件 I/O、外部集成、流程编排、测试),必须在 architectureModules 中体现当前 phase 的模块边界,并在 CODE/MODULE_TEST 的 subTasks 下分解模块级工作。\n- architectureModules.sourcePaths 只能是 src/ 下的产品源码文件;不要把 tests/fixtures、tests/utils、样例文件、目录或文档登记为架构模块。\n- dependencies 只写当前 phase 需要的包名;Python 必须包含 pytest;不要输出 requirements.txt。\n- 当前 phase 必须包含标准 V 模型 8 个宏 Step,并满足同步测试设计规则。\n\n只返回当前 phase 的严格 JSON StepPlan。`,\n executorSystem: (p) => buildExecutorSystem(p),\n executorDebugBlock: (reason: string, suggestions?: string) =>\n `\\n\\n正处于 DEBUG 重试模式。上一轮失败原因: ${reason}\\n` +\n '当本次 DEBUG 正在处理 issue 时,每一轮 JSON 都必须在修复前或修复过程中额外包含 issueResolutionPlan。该方案必须简洁且可执行:根因假设、要修改的文件/契约、验证命令或门禁,以及什么证据会推翻该方案。' +\n 'DEBUG 可以修改当前 allowedWrites 内的上游源码与测试文件;若失败暴露的是实现、契约或下游调用不一致,必须修真实缺陷,禁止通过削弱断言、跳过测试、删除失败用例或只迎合错误测试来过关。' +\n '如果本次回退处于需求/设计阶段,而具体源码修改属于后续 V 模型 Step 且目标文件不在当前 allowedWrites 内,应更新当前契约、测试计划或诊断产物并完成当前 Step,让后续 CODE Step 实现;不要尝试被拒绝的越权写入。' +\n '若失败是第三方依赖缺失或库选型错误,必须用 add_dependency 写入真实包名,或把源码改回 HIGH_LEVEL_DESIGN 选定的真实库;严禁在 src/ 生产代码里 try/except ImportError 后伪造 module、fake class/function、空实现或 fallback mock 来绕过错误。' +\n '请包含 read_file/code_search 先定位问题,再以 apply_patch / replace_in_file / add_dependency 作最小修改,最后 run_tests 验证。' +\n 'DEBUG 重试不能只靠只读检查就标记完成:本次重试必须产生一次成功的修复动作,或一次成功的验证命令。' +\n '如果上一轮失败原因包含 repeated read-only/probe actions,请把已有 failure log 视为足够上下文,下一步直接 patch/write/改依赖或执行验证命令。' +\n '当测试已正常执行但失败点是返回行为断言时,禁止反复重写 fixture 或样例。只有证据明确是文件缺失、fixture 格式错误或 fixture 本身解析失败时才修改 fixture;否则应修实现、接口契约、依赖选型或确实错误的断言。' +\n '如果失败日志显示网络/API 调用失败,不允许只停留在探测接口:最多连续执行 2 次 http_fetch 探测;HTTP 2xx 但 body 为空或格式不可用不算可用接口;随后必须 patch 真实集成代码,并用 run_program 和 run_tests 验证。入口仍输出网络/API 失败时不得 done=true。' +\n (suggestions ? `\\n\\n${suggestions}` : ''),\n executorGlobalBlock: (globalPrompt: string) => `\\n\\n## 项目全局约束\\n${globalPrompt}`,\n executorStepBlock: (sp: string) =>\n `\\n\\n## 当前 Step 专属提示 (唯一使命,禁止跨 Step 发散)\\n${sp}`,\n executorUserPromptOutro: '现在按协议返回第一轮 JSON。',\n executorFeedbackHeader: '本轮工具结果:',\n executorFeedbackVerifyOk: 'outputs 校验通过。如已完成,请把 done 设为 true 且 actions=[]。',\n executorFeedbackVerifyMissing: (paths: string) => `outputs 仍缺失:${paths}。请继续。`,\n executorFeedbackReadOnlyLoopWarning: (rounds: number, targets: string) =>\n `循环门禁警告:最近 ${rounds} 轮只调用了读取/探测工具` +\n (targets ? `(${targets})` : '') +\n '。下一轮必须包含一次成功的修复动作(apply_patch / replace_in_file / write_file / add_dependency)或明确的验证动作(run_tests / run_program)。不要继续只调用 read_file、list_dir、code_search 或 http_fetch。',\n executorFeedbackReadOnlyRecoveryRequired:\n '只读恢复模式已启用:上一轮已经因为持续探测失败。本轮必须基于已有 failure log 直接 patch/write/改依赖或执行验证;如果下一轮仍然只有只读/探测动作,本次重试会失败并回退。',\n executorFeedbackRepairEvidenceMissing:\n 'DEBUG 完成无效:本次重试还没有产生修复证据。设置 done=true 前,必须至少完成一次成功的修复动作或成功的验证运行;否则只能在 thoughts 中给出具体 blocker 后停止。',\n executorFeedbackIssueResolutionPlanMissing:\n 'DEBUG issue 完成无效:issueResolutionPlan 是 issue resolved 的必要字段。请返回包含简明处理方案的 JSON,并同时给出必要修复或验证动作。',\n },\n skills: {\n patcher: '通过 apply_patch / replace_in_file 对已有文件做小改动,禁止整文件覆盖。',\n author: '通过 write_file 创建新文件;优先放在当前 Step writable allowlist 内。',\n tester:\n '编写并运行 pytest 测试,验证函数行为;失败时通过 analyze_error 解析。' +\n '【fixture 自包含】测试**严禁**直接 open() 磁盘上不存在的样例文件。' +\n '若被测函数需要文件输入,优先复用用户/工作区真实样例;没有样例时用 http_fetch 获取官方文档、上游仓库或公开标准中的小型参考样例,' +\n '保存到 tests/fixtures/<name> 并记录来源;只有 CSV/JSON/INI 等简单文本格式才可在 pytest tmp_path 中构造最小样例并立刻 run_tests。' +\n '测试/DEBUG 阶段 tests/fixtures/ 已默认放开写权限,子目录自动 mkdir -p,**无需**提前把 fixture 路径登记到 outputs。' +\n '生成测试时务必同时输出全部依赖资源,避免后续 Debugger 因 FileNotFoundError 反复重试。' +\n '【fixture 迭代】若测试运行中被测函数报\"Invalid syntax / Parse error / Malformed\"等解析错误,' +\n '说明你写出的 fixture 内容不合该格式 spec:read_file 看清后,优先使用用户样例或 http_fetch 拉取的权威参考样例重写,再 run_tests。' +\n '复杂领域格式连续失败后必须停止凭记忆生成,改为请求用户样例或网络参考;严禁去改被测模块或断言。',\n dep_resolver: '当出现 ModuleNotFoundError 时,用 add_dependency 写回 requirements.txt 并重建沙盒。',\n debugger:\n '先 run_tests / run_python 复现错误 → analyze_error → patch/replace_in_file/add_dependency 修复 → 再次 run_tests。每次只做最小修改。【依赖缺失】必须添加真实依赖或改用设计选定的真实库,禁止在 src/ 生产代码里伪造 module、fake class/function、空实现或 fallback mock。【Fixture 纪律】如果测试失败是行为断言失败,不要持续重写 fixture;只有明确缺文件、fixture 格式错误或 fixture 解析错误时才改 fixture,否则修源码、契约、依赖或错误断言。【网络/API 失败】定位失败 URL 后,只允许少量探测替代 API,随后必须 patch 源码并用 run_program 证明入口不再输出 API 失败。【重要】同一文件上 replace_in_file 连续失败 2 次以上请立即 read_file,再用 patch 或在当前运行时 chunk limit 内整文件重写,不要反复猜测 find 字符串。【禁止 no-op】replace_in_file 的 find 与 replace 必须不同——若你只是想\"确认\"某段代码,请用 read_file,不要提交相同字符串的替换。',\n refactorer: '重构必须保证行为不变;先跑回归测试 → 修改 → 再跑回归测试。',\n },\n doctor: {\n cliDescription: '检查 config / LLM / sandbox / skills 是否就绪',\n optStrict: '把 warning 也视为失败(任一 warn 即非零退出)',\n header: 'XCompiler 启动环境自检',\n sectionConfig: '[配置]',\n sectionLLM: '[LLM]',\n sectionSandbox: '[沙盒]',\n sectionSkills: '[技能]',\n summaryOk: '全部检查通过。',\n summaryWarn: (n) => `通过,但有 ${n} 条 warning。`,\n summaryFail: (n) => `检测到 ${n} 项失败。`,\n configLoadOk: (path) => `配置已加载:${path}`,\n configLoadFail: (msg) => `配置加载失败:${msg}`,\n configLocale: (locale) => `locale=${locale}`,\n llmNoProviders: 'config.llm.providers 为空,未声明任何 provider',\n llmProviderListed: (n) => `已声明 ${n} 个 provider`,\n ollamaUnreachable: (baseUrl, msg) => `ollama 不可达 @ ${baseUrl} —— ${msg}`,\n ollamaReachable: (baseUrl, n) => `ollama 可达 @ ${baseUrl}(共 ${n} 个模型)`,\n ollamaModelMissing: (provider, model, baseUrl) =>\n `provider \"${provider}\":模型 \"${model}\" 未安装于 ${baseUrl}(请执行 \\`ollama pull ${model}\\`)`,\n ollamaModelOk: (provider, model) => `provider \"${provider}\":模型 \"${model}\" 可用`,\n openaiKeyMissing: (provider) => `provider \"${provider}\":api_key 为空(请设置该 provider 对应的环境变量,例如 OPENROUTER_API_KEY,或 config.llm.providers.${provider}.api_key)`,\n openaiReachable: (provider, baseUrl) => `provider \"${provider}\":OpenAI 端点可达 @ ${baseUrl}`,\n openaiUnreachable: (provider, baseUrl, msg) => `provider \"${provider}\":OpenAI 端点不可达 @ ${baseUrl} —— ${msg}`,\n openaiModelListMissing: (provider, model) =>\n `provider \"${provider}\":/models 响应中未列出 \"${model}\"(若你的账号有访问权限仍可正常调用)`,\n providerScoreZero: (provider) => `provider \"${provider}\" 已禁用(score=0)`,\n roleNoLiveProvider: (role) => `角色 \"${role}\" 没有可用 provider(候选列表全部不可达或被禁用)`,\n roleOk: (role, provider) => `角色 \"${role}\" → ${provider}`,\n sandboxKind: (kind) => `sandbox=${kind}`,\n sandboxNetworkPolicy: (policy, ports) =>\n `network=${policy}` + (ports.length ? `(expose_ports=[${ports.join(', ')}])` : ''),\n sandboxFullNoPorts:\n 'network=full 但未配置 expose_ports—宿主侧无法访问容器内服务。' +\n '请在 config.yaml 中设置 `agent.sandboxes.<language>.<local|docker>.limits.expose_ports: [<port>]`。',\n sandboxNodeMissing: 'PATH 上找不到 node(TypeScript subprocess 沙盒必需)',\n sandboxNodeOk: (version) => `node OK(${version})`,\n sandboxNpmMissing: 'PATH 上找不到 npm(TypeScript subprocess 沙盒必需)',\n sandboxNpmOk: (version) => `npm OK(${version})`,\n sandboxNpxMissing: 'PATH 上找不到 npx(TypeScript subprocess 沙盒必需)',\n sandboxNpxOk: (version) => `npx OK(${version})`,\n sandboxPythonMissing: 'PATH 上找不到 python3(subprocess 沙盒必需)',\n sandboxPythonOk: (version) => `python3 OK(${version})`,\n sandboxVenvMissing: 'python3 venv 模块不可用(请安装 python3-venv / python3-virtualenv)',\n sandboxVenvOk: 'python3 venv 模块 OK',\n sandboxDockerMissing: (bin) => `PATH 上找不到 docker 二进制 \"${bin}\"`,\n sandboxDockerOk: (version) => `docker OK(${version})`,\n sandboxDockerDaemonDown: (msg) => `docker daemon 不可达:${msg}`,\n sandboxInContainerWarn: '检测到 XCompiler 运行在容器内,此模式不支持 sandbox=docker(请使用 subprocess)。',\n skillToolMissing: (skill, tool) => `skill \"${skill}\" 引用了未注册的工具 \"${tool}\"`,\n skillOk: (n, tools) => `已注册 ${n} 个 skill,对应 ${tools} 个底层工具`,\n },\n};\n\nexport default messages;\n","import en from './en.js';\nimport zh from './zh.js';\nimport type { Locale, Messages } from './types.js';\n\nexport type { Locale, Messages } from './types.js';\n\nconst TABLES: Record<Locale, Messages> = { en, zh };\n\nlet current: Locale = 'en';\n\n/** Current active locale (defaults to `en`). */\nexport function getLocale(): Locale {\n return current;\n}\n\n/** Set active locale. Accepts loose forms: `en`, `EN`, `cn`, `CN`, `zh`, `zh-CN`. */\nexport function setLocale(loc: string | Locale | undefined): Locale {\n current = normaliseLocale(loc);\n return current;\n}\n\n/** Normalise CLI / config inputs to internal {@link Locale}. */\nexport function normaliseLocale(loc: string | undefined | null): Locale {\n if (!loc) return current;\n const v = String(loc).trim().toLowerCase();\n if (v === 'en' || v === 'us' || v === 'uk' || v === 'gb' || v === 'en-us' || v === 'en-gb') return 'en';\n if (v === 'zh' || v === 'cn' || v === 'zh-cn' || v === 'zh-hans' || v === 'chinese') return 'zh';\n return 'en';\n}\n\n/** Active message bundle for the current locale. */\nexport function t(): Messages {\n return TABLES[current];\n}\n\n/** Explicit lookup against an arbitrary locale (does not change current). */\nexport function tFor(loc: Locale): Messages {\n return TABLES[loc];\n}\n","// Generated by scripts/version.mjs from package.json. Do not edit manually.\nexport const XCOMPILER_VERSION = \"0.2.4\";\nexport const XCOMPILER_PLUGIN_API_VERSION = 1;\n","import { t } from '../i18n/index.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport type {\n PluginCompatibilityCode,\n PluginCompatibilityReport,\n XCompilerPluginManifest,\n} from './types.js';\n\nexport interface PluginRuntimeVersion {\n xcompilerVersion?: string;\n pluginApiVersion?: number;\n}\n\n/** 在加载插件代码前可独立调用的 manifest 兼容性检查。 */\nexport function checkPluginCompatibility(\n manifest: XCompilerPluginManifest,\n runtime: PluginRuntimeVersion = {},\n): PluginCompatibilityReport {\n const candidate = manifest && typeof manifest === 'object'\n ? manifest\n : {} as XCompilerPluginManifest;\n const xcompilerVersion = runtime.xcompilerVersion ?? XCOMPILER_VERSION;\n const pluginApiVersion = runtime.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION;\n const pluginId = typeof candidate.id === 'string' ? candidate.id.trim() : '';\n const pluginVersion = typeof candidate.version === 'string' ? candidate.version : '';\n const base = { pluginId, pluginVersion, xcompilerVersion, pluginApiVersion };\n const reject = (code: Exclude<PluginCompatibilityCode, 'compatible'>, message: string) => ({\n ...base,\n compatible: false,\n code,\n message,\n } as const);\n\n const current = parseSemVer(xcompilerVersion);\n if (!current) {\n return reject('invalid-runtime-version', t().plugins.invalidCoreVersion(xcompilerVersion));\n }\n if (!/^[a-z0-9][a-z0-9._-]*$/u.test(pluginId)) {\n return reject('invalid-id', t().plugins.invalidId(pluginId));\n }\n if (!parseSemVer(pluginVersion)) {\n return reject('invalid-plugin-version', t().plugins.invalidVersion(pluginId, pluginVersion));\n }\n if (!Number.isInteger(candidate.apiVersion) || candidate.apiVersion !== pluginApiVersion) {\n return reject(\n 'api-version-mismatch',\n t().plugins.apiVersionMismatch(pluginId, candidate.apiVersion, pluginApiVersion),\n );\n }\n const minimum = parseSemVer(candidate.minXCompilerVersion);\n if (!minimum) {\n return reject(\n 'invalid-min-xcompiler-version',\n t().plugins.invalidMinimumVersion(pluginId, String(candidate.minXCompilerVersion ?? '')),\n );\n }\n if (compareSemVer(current, minimum) < 0) {\n return reject(\n 'xcompiler-version-too-old',\n t().plugins.coreVersionTooOld(pluginId, candidate.minXCompilerVersion, xcompilerVersion),\n );\n }\n return { ...base, compatible: true, code: 'compatible' };\n}\n\ninterface ParsedSemVer {\n major: number;\n minor: number;\n patch: number;\n prerelease: Array<number | string>;\n}\n\nfunction parseSemVer(value: string): ParsedSemVer | undefined {\n const match = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/.exec(value);\n if (!match) return undefined;\n const prereleaseParts = match[4]?.split('.') ?? [];\n // SemVer 2.0.0 forbids leading zeroes in numeric prerelease identifiers.\n if (prereleaseParts.some((part) => /^0\\d+$/u.test(part))) return undefined;\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: prereleaseParts.map((part) => /^\\d+$/.test(part) ? Number(part) : part),\n };\n}\n\nfunction compareSemVer(a: ParsedSemVer, b: ParsedSemVer): number {\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (a[key] !== b[key]) return a[key] - b[key];\n }\n if (a.prerelease.length === 0 || b.prerelease.length === 0) {\n return a.prerelease.length === b.prerelease.length ? 0 : a.prerelease.length === 0 ? 1 : -1;\n }\n const length = Math.max(a.prerelease.length, b.prerelease.length);\n for (let index = 0; index < length; index++) {\n const left = a.prerelease[index];\n const right = b.prerelease[index];\n if (left === undefined || right === undefined) return left === undefined ? -1 : 1;\n if (left === right) continue;\n if (typeof left === 'number' && typeof right === 'number') return left - right;\n if (typeof left === 'number') return -1;\n if (typeof right === 'number') return 1;\n return left.localeCompare(right);\n }\n return 0;\n}\n","import type { AuditLogger } from '../audit/audit.js';\nimport { t } from '../i18n/index.js';\nimport type { LLMClient } from '../llm/types.js';\nimport type { Tool } from '../tools/types.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport { checkPluginCompatibility } from './compatibility.js';\nimport type {\n HookContextMap,\n HookHandler,\n HookName,\n HookRegistrationOptions,\n PluginApi,\n PluginExtensionTarget,\n PluginHostOptions,\n XCompilerPlugin,\n XCompilerPluginManifest,\n} from './types.js';\n\ninterface RegisteredHook {\n hook: HookName;\n plugin: XCompilerPlugin;\n handler: (context: unknown) => void | Promise<void>;\n priority: number;\n order: number;\n}\n\n/** 插件注册、扩展能力合并与生命周期 Hook 调度中心。 */\nexport class PluginHost {\n private readonly plugins: XCompilerPlugin[];\n private readonly strict: boolean;\n private readonly xcompilerVersion: string;\n private readonly pluginApiVersion: number;\n private readonly hooks = new Map<HookName, RegisteredHook[]>();\n private readonly contributedTools: Array<{ plugin: XCompilerPlugin; tool: Tool }> = [];\n private readonly contributedSkills: Array<{ plugin: XCompilerPlugin; skill: Parameters<PluginApi['registerSkill']>[0] }> = [];\n private audit?: AuditLogger;\n private initialized = false;\n private registrationOrder = 0;\n\n constructor(options: PluginHostOptions = {}) {\n this.plugins = (options.plugins ?? []).map(snapshotPlugin);\n this.strict = options.strict ?? false;\n this.xcompilerVersion = options.xcompilerVersion ?? XCOMPILER_VERSION;\n this.pluginApiVersion = options.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION;\n this.audit = options.audit;\n assertPluginMetadata(this.plugins, this.xcompilerVersion, this.pluginApiVersion);\n }\n\n get size(): number {\n return this.plugins.length;\n }\n\n /** 返回只读清单快照,供诊断、插件目录和未来 registry 使用。 */\n get manifests(): readonly XCompilerPluginManifest[] {\n return this.plugins.map((plugin) => snapshotManifest(plugin.manifest));\n }\n\n setAudit(audit: AuditLogger): void {\n this.audit = audit;\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return;\n // 先置位,避免 setup 中的间接调用导致递归初始化。\n this.initialized = true;\n for (const plugin of this.plugins) {\n try {\n await plugin.setup(this.createApi(plugin));\n await this.audit?.event(\n 'note',\n t().plugins.loaded(plugin.manifest.id, plugin.manifest.version),\n {\n messageId: 'plugins.loaded',\n pluginId: plugin.manifest.id,\n pluginVersion: plugin.manifest.version,\n minXCompilerVersion: plugin.manifest.minXCompilerVersion,\n apiVersion: plugin.manifest.apiVersion,\n },\n );\n } catch (error) {\n await this.handleFailure(plugin, 'setup', error);\n }\n }\n }\n\n /** 把插件贡献的 Tool / Skill 合并到 Engine 的默认注册表;禁止静默覆盖核心能力。 */\n applyExtensions(target: PluginExtensionTarget): void {\n for (const { plugin, tool } of this.contributedTools) {\n if (target.tools.get(tool.name)) {\n throw new Error(t().plugins.extensionConflict(plugin.manifest.id, 'tool', tool.name));\n }\n target.tools.register(tool);\n }\n for (const { plugin, skill } of this.contributedSkills) {\n if (target.skills.get(skill.name)) {\n throw new Error(t().plugins.extensionConflict(plugin.manifest.id, 'skill', skill.name));\n }\n target.skills.register(skill);\n }\n }\n\n async emit<K extends HookName>(hook: K, context: HookContextMap[K]): Promise<void> {\n await this.initialize();\n const handlers = [...(this.hooks.get(hook) ?? [])]\n .sort((a, b) => (b.priority - a.priority) || (a.order - b.order));\n for (const registration of handlers) {\n try {\n await registration.handler(context);\n } catch (error) {\n await this.handleFailure(registration.plugin, hook, error);\n }\n }\n }\n\n /** 在不绕过原 Tool / EditGuard 的前提下增加 before / after / error Hook。 */\n wrapTool<A, R>(tool: Tool<A, R>): Tool<A, R> {\n return {\n name: tool.name,\n description: tool.description,\n argsSchema: tool.argsSchema,\n run: async (args, context) => {\n const before: HookContextMap['tool.before'] = {\n stepId: context.stepId,\n tool: tool.name,\n args,\n context,\n };\n await this.emit('tool.before', before);\n try {\n const result = await tool.run(before.args as A, context);\n const after: HookContextMap['tool.after'] = {\n ...before,\n result,\n };\n await this.emit('tool.after', after);\n return after.result as Awaited<ReturnType<Tool<A, R>['run']>>;\n } catch (error) {\n await this.emit('tool.error', { ...before, error });\n throw error;\n }\n },\n };\n }\n\n /** 包装完整 LLM 调用;response 可由 after Hook 做结构化后处理。 */\n wrapLLM(client: LLMClient, role: string): LLMClient {\n return {\n name: client.name,\n chat: async (messages, options) => {\n const before: HookContextMap['llm.before'] = {\n role,\n model: client.name,\n messages: [...messages],\n options: options ? { ...options } : undefined,\n };\n await this.emit('llm.before', before);\n const startedAt = Date.now();\n try {\n const response = await client.chat(before.messages, before.options);\n const after: HookContextMap['llm.after'] = {\n role,\n model: client.name,\n messages: before.messages,\n response,\n durationMs: Date.now() - startedAt,\n };\n await this.emit('llm.after', after);\n return after.response;\n } catch (error) {\n await this.emit('llm.error', {\n role,\n model: client.name,\n messages: before.messages,\n error,\n durationMs: Date.now() - startedAt,\n });\n throw error;\n }\n },\n };\n }\n\n private createApi(plugin: XCompilerPlugin): PluginApi {\n return {\n xcompilerVersion: this.xcompilerVersion,\n pluginApiVersion: this.pluginApiVersion,\n on: <K extends HookName>(\n hook: K,\n handler: HookHandler<K>,\n options: HookRegistrationOptions = {},\n ) => {\n const registration: RegisteredHook = {\n hook,\n plugin,\n handler: (context) => handler(context as HookContextMap[K]),\n priority: options.priority ?? 0,\n order: this.registrationOrder++,\n };\n const list = this.hooks.get(hook) ?? [];\n list.push(registration);\n this.hooks.set(hook, list);\n return () => {\n const current = this.hooks.get(hook);\n if (!current) return;\n const index = current.indexOf(registration);\n if (index >= 0) current.splice(index, 1);\n };\n },\n registerTool: (tool) => this.contributedTools.push({ plugin, tool }),\n registerSkill: (skill) => this.contributedSkills.push({ plugin, skill }),\n };\n }\n\n private async handleFailure(plugin: XCompilerPlugin, stage: string, error: unknown): Promise<void> {\n const message = error instanceof Error ? error.message : String(error);\n const rendered = t().plugins.hookFailed(plugin.manifest.id, stage, message);\n await this.audit?.event('note', rendered, {\n messageId: 'plugins.hook_failed',\n plugin: plugin.manifest.id,\n stage,\n error: message,\n });\n if (this.strict || plugin.failureMode === 'fail') throw error;\n console.warn(rendered);\n }\n}\n\nfunction assertPluginMetadata(\n plugins: XCompilerPlugin[],\n xcompilerVersion: string,\n pluginApiVersion: number,\n): void {\n const seen = new Set<string>();\n for (const plugin of plugins) {\n const report = checkPluginCompatibility(plugin.manifest, { xcompilerVersion, pluginApiVersion });\n if (!report.compatible) throw new Error(report.message);\n if (seen.has(report.pluginId)) throw new Error(t().plugins.duplicateId(report.pluginId));\n seen.add(report.pluginId);\n }\n}\n\nfunction snapshotPlugin(plugin: XCompilerPlugin): XCompilerPlugin {\n return { ...plugin, manifest: snapshotManifest(plugin.manifest) };\n}\n\nfunction snapshotManifest(manifest: XCompilerPluginManifest | undefined): XCompilerPluginManifest {\n if (!manifest) return {} as XCompilerPluginManifest;\n return {\n ...manifest,\n keywords: manifest.keywords ? [...manifest.keywords] : undefined,\n };\n}\n","import { readFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { t } from '../i18n/index.js';\nimport { XCOMPILER_PLUGIN_API_VERSION, XCOMPILER_VERSION } from '../version.js';\nimport { checkPluginCompatibility } from './compatibility.js';\nimport type {\n PluginLoadOptions,\n PluginSource,\n XCompilerPlugin,\n XCompilerPluginManifest,\n} from './types.js';\n\ninterface PreflightSource {\n source: PluginSource;\n manifest: XCompilerPluginManifest;\n manifestPath: string;\n entryPath: string;\n}\n\n/**\n * 从磁盘加载插件。全部 manifest 会在任何插件模块 import 之前完成读取、兼容性与\n * 重复 ID 检查,避免不兼容插件借助模块顶层代码绕过宿主版本门禁。\n */\nexport async function loadPluginSources(options: PluginLoadOptions): Promise<XCompilerPlugin[]> {\n const baseDir = path.resolve(options.baseDir ?? process.cwd());\n const runtime = {\n xcompilerVersion: options.xcompilerVersion ?? XCOMPILER_VERSION,\n pluginApiVersion: options.pluginApiVersion ?? XCOMPILER_PLUGIN_API_VERSION,\n };\n const preflight: PreflightSource[] = [];\n\n for (const source of options.sources) {\n const manifestPath = path.resolve(baseDir, source.manifestPath);\n const entryPath = path.resolve(baseDir, source.entryPath);\n let manifest: XCompilerPluginManifest;\n try {\n manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as XCompilerPluginManifest;\n } catch (error) {\n const message = t().plugins.manifestReadFailed(manifestPath, errorMessage(error));\n await auditRejected(options, '', 'manifest-read', message, { manifestPath, entryPath });\n throw new Error(message, { cause: error });\n }\n const report = checkPluginCompatibility(manifest, runtime);\n if (!report.compatible) {\n const message = report.message ?? report.code;\n await auditRejected(options, report.pluginId, 'compatibility', message, { manifestPath, entryPath });\n throw new Error(message);\n }\n preflight.push({ source, manifest: snapshotManifest(manifest), manifestPath, entryPath });\n }\n\n const seen = new Set<string>();\n for (const item of preflight) {\n if (seen.has(item.manifest.id)) {\n const message = t().plugins.duplicateId(item.manifest.id);\n await auditRejected(options, item.manifest.id, 'duplicate-id', message, item);\n throw new Error(message);\n }\n seen.add(item.manifest.id);\n }\n\n const plugins: XCompilerPlugin[] = [];\n for (const item of preflight) {\n const exportName = item.source.exportName ?? 'default';\n let loaded: Record<string, unknown>;\n try {\n loaded = await import(pathToFileURL(item.entryPath).href) as Record<string, unknown>;\n } catch (error) {\n const message = t().plugins.moduleLoadFailed(item.manifest.id, item.entryPath, errorMessage(error));\n await auditRejected(options, item.manifest.id, 'module-load', message, item);\n throw new Error(message, { cause: error });\n }\n const plugin = loaded[exportName];\n if (!isPlugin(plugin)) {\n const message = t().plugins.exportInvalid(item.manifest.id, exportName);\n await auditRejected(options, item.manifest.id, 'module-export', message, item);\n throw new Error(message);\n }\n if (!sameRuntimeManifest(plugin.manifest, item.manifest)) {\n const message = t().plugins.manifestMismatch(item.manifest.id);\n await auditRejected(options, item.manifest.id, 'manifest-mismatch', message, item);\n throw new Error(message, { cause: new Error('plugin runtime manifest differs from preflight manifest') });\n }\n plugins.push({ ...plugin, manifest: snapshotManifest(item.manifest) });\n }\n return plugins;\n}\n\nfunction isPlugin(value: unknown): value is XCompilerPlugin {\n return !!value && typeof value === 'object' &&\n typeof (value as { setup?: unknown }).setup === 'function' &&\n !!(value as { manifest?: unknown }).manifest;\n}\n\nfunction sameRuntimeManifest(actual: XCompilerPluginManifest, expected: XCompilerPluginManifest): boolean {\n return actual.id === expected.id &&\n actual.version === expected.version &&\n actual.apiVersion === expected.apiVersion &&\n actual.minXCompilerVersion === expected.minXCompilerVersion;\n}\n\nfunction snapshotManifest(manifest: XCompilerPluginManifest): XCompilerPluginManifest {\n return { ...manifest, keywords: manifest.keywords ? [...manifest.keywords] : undefined };\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nasync function auditRejected(\n options: PluginLoadOptions,\n pluginId: string,\n stage: string,\n message: string,\n detail: unknown,\n): Promise<void> {\n await options.audit?.event('note', message, {\n messageId: 'plugins.load_rejected',\n pluginId,\n stage,\n detail,\n });\n}\n"],"mappings":";AAGA,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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names":["path","PYTHON_PLANNER_SYSTEM","PYTHON_EXECUTOR_SYSTEM","TYPESCRIPT_PLANNER_SYSTEM","TYPESCRIPT_EXECUTOR_SYSTEM","buildPlannerSystem","buildPlannerPhasePlanSystem","buildPlannerPhaseDecomposeSystem","buildExecutorSystem","messages","path","current","messages","current","snapshotManifest"]}