/**
 * Dual-layer mechanism definitions — core section.
 * Auto-extracted from the monolithic dual_layer_mechanism_registry.
 */
export const MECHANISM_CONTRACTS_CORE = [
    // ── 1. 意图路由 ──
    {
        mechanism_id: "mc-intent-router",
        mechanism_name: "意图路由",
        owner_issue_id: "问题九",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/意图路由规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/procedures/意图路由流程.md", asset_kind: "pipeline_procedure", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "read_only_analysis", "single_artifact", "source_extraction", "multi_stage_plan"],
            injected_workflows: ["code_change", "planning", "review"],
            target_hosts: ["claude_code", "codex", "trae"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/intent_router.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["routeIntent", "selectPromptTemplate"],
            state_effects: ["route_decision → workflow selection", "execution_shape → template selection"],
            hard_fail_conditions: ["route 未确定就进入 expand", "route 与 execution_shape 矛盾"],
            degradation_behavior: "route 未命中时降级为 code_execution，不阻断主链路",
        },
        evidence_layer: {
            outputs: ["route_decision", "execution_shape"],
            reports: ["WorkflowTrace"],
            diagnostic_codes: ["route-mismatch", "degraded-route"],
            task_context_facts: ["route", "execution_shape"],
        },
        verification_layer: {
            tests: ["tests/engine/intent_router.test.ts"],
            runtime_checks: ["route_mismatch_check"],
            regression_cases: ["unknown_route_defaults_safely", "route_template_consistency"],
            drift_checks: ["route_decision_matches_workflow_template"],
        },
        status: "dual_layer_enforced",
    },
    // ── 2. 工作流契约 ──
    {
        mechanism_id: "mc-workflow-contract",
        mechanism_name: "工作流契约",
        owner_issue_id: "问题九",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/工作流契约规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/checklists/工作流验收清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan", "single_artifact"],
            injected_workflows: ["code_change", "verification", "delivery"],
            target_hosts: ["claude_code", "codex", "trae"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/workflow/workflow_contract_registry.ts"],
            registries: ["workflow_contract_registry"],
            entrypoints: ["resolveWorkflow", "validateWorkflowContracts"],
            state_effects: ["workflow_id → mechanism binding", "required_mechanisms → guard check"],
            hard_fail_conditions: ["workflow 缺失 required_mechanism", "workflow 与 route 不匹配"],
            degradation_behavior: "workflow 未命中时降级为默认 workflow，不阻断",
        },
        evidence_layer: {
            outputs: ["WorkflowTrace", "governance_findings"],
            reports: ["WorkflowValidationReport"],
            diagnostic_codes: ["workflow-regression", "missing-required-mechanism"],
            task_context_facts: ["workflow_id", "mutation_allowed", "required_mechanisms"],
        },
        verification_layer: {
            tests: ["tests/engine/workflow_contract_registry.test.ts"],
            runtime_checks: ["workflow_contract_validation"],
            regression_cases: ["all_workflows_have_required_mechanisms", "workflow_route_coverage"],
            drift_checks: ["workflow_template_matches_route"],
        },
        status: "dual_layer_enforced",
    },
    // ── 3. 知识注入边界 ──
    {
        mechanism_id: "mc-knowledge-injection-boundary",
        mechanism_name: "知识注入边界",
        owner_issue_id: "问题八",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/知识注入边界规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/checklists/知识注入验收清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "read_only_analysis", "multi_stage_plan"],
            injected_workflows: ["code_change", "planning"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/knowledge/knowledge_injection_boundary.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["enforceKnowledgeInjectionBoundary", "validateInjectionReport"],
            state_effects: ["required knowledge 缺失 → blocked prompt", "injection_report → governance_findings"],
            hard_fail_conditions: ["required knowledge 缺失且无法回退", "注入校验 hard_fail"],
            degradation_behavior: "knowledge 未命中时降级为空注入，标记 degraded",
        },
        evidence_layer: {
            outputs: ["KnowledgeInjectionReport", "missing_required_knowledge"],
            reports: ["InjectionBoundaryReport"],
            diagnostic_codes: ["boundary-violation", "route-template-mismatch"],
            task_context_facts: ["injected_ids", "missing_required"],
        },
        verification_layer: {
            tests: ["tests/engine/knowledge_injection_boundary.test.ts", "tests/engine/intent_expander_integration.test.ts"],
            runtime_checks: ["injection_boundary_gate"],
            regression_cases: ["required_knowledge_blocks_when_missing", "degraded_route_still_works"],
            drift_checks: ["injection_report_matches_filtered_entries"],
        },
        status: "dual_layer_enforced",
    },
    // ── 4. 工具调用契约 ──
    {
        mechanism_id: "mc-tool-invocation-contract",
        mechanism_name: "工具调用契约",
        owner_issue_id: "问题二十二",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/工具调用规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/procedures/工具调用流程.md", asset_kind: "pipeline_procedure", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["code_change", "verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/tool_invocation_contract_registry.ts"],
            registries: ["tool_invocation_contract_registry"],
            entrypoints: ["validateToolInvocation"],
            state_effects: ["forbidden tool → blocked", "strict tool → requires approval"],
            hard_fail_conditions: ["forbidden tool transition", "strict tool without approval"],
            degradation_behavior: "tool contract 未命中时降级为 normal，不阻断",
        },
        evidence_layer: {
            outputs: ["ToolInvocationFinding", "forbidden_transition"],
            reports: ["ToolInvocationReport"],
            diagnostic_codes: ["forbidden-tool-transition", "strict-tool-without-approval"],
            task_context_facts: ["next_allowed_tools", "forbidden_tools"],
        },
        verification_layer: {
            tests: ["tests/engine/tool_invocation_contract_registry.test.ts"],
            runtime_checks: ["tool_transition_gate"],
            regression_cases: ["no_forbidden_transition_allowed", "strict_tools_require_confirm"],
            drift_checks: ["tool_contract_matches_adapter_tools"],
        },
        status: "dual_layer_enforced",
    },
    // ── 5. 验证契约 ──
    {
        mechanism_id: "mc-verifier",
        mechanism_name: "验证契约",
        owner_issue_id: "问题十二",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/验证契约规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/checklists/验证验收清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/release/verifier.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["generateVerifyCommands"],
            state_effects: ["verify → learn", "main_path_integration_failed → retrying"],
            hard_fail_conditions: ["build failed", "tests failed", "integration check failed"],
            degradation_behavior: "无 build/test 命令时降级为 plan_only，不阻断",
        },
        evidence_layer: {
            outputs: ["VerifyResult", "evidence"],
            reports: ["VerificationReport", "CorePrinciplesReport"],
            diagnostic_codes: ["verification-strategy-mismatch", "evidence-level-insufficient"],
            task_context_facts: ["verification_result", "build_passed", "tests_passed"],
        },
        verification_layer: {
            tests: ["tests/engine/verifier_phase25.test.ts"],
            runtime_checks: ["verification_gate"],
            regression_cases: ["verify_generates_correct_commands", "verify_handles_no_build_gracefully"],
            drift_checks: ["verify_output_matches_acceptance"],
        },
        status: "dual_layer_enforced",
    },
    // ── 6. 主链路接入 ──
    {
        mechanism_id: "mc-main-path-integration",
        mechanism_name: "主链路接入防孤岛",
        owner_issue_id: "问题四十四",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/防孤岛实现规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/procedures/主链路接入验证流程.md", asset_kind: "pipeline_procedure", consumption_mode: "required" },
                { path: "templates/checklists/主链路接入验收清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/main_path_integration_contract.ts"],
            registries: ["main_path_integration_contract"],
            entrypoints: ["orphanGate", "auditIntegration", "validateMainPathIntegration"],
            state_effects: ["orphan detected → retrying", "integration_passed → done"],
            hard_fail_conditions: ["orphan module detected", "integration test missing for non-trivial module"],
            degradation_behavior: "integration check 不可用时降级为 advisory",
        },
        evidence_layer: {
            outputs: ["IntegrationAuditReport", "IntegrationFinding", "orphan_id"],
            reports: ["IntegrationReport"],
            diagnostic_codes: ["orphan-module", "test-only-module", "unreachable-capability"],
            task_context_facts: ["integration_result", "orphan_modules"],
        },
        verification_layer: {
            tests: ["tests/adapters/main_path_integration_gate.test.ts"],
            runtime_checks: ["orphan_scan", "reachability_scan"],
            regression_cases: ["new_module_must_have_integration_test", "no_orphan_allowed"],
            drift_checks: ["integration_coverage_matches_registry"],
        },
        status: "dual_layer_enforced",
    },
    // ── 7. 隐私边界 ──
    {
        mechanism_id: "mc-privacy-boundary",
        mechanism_name: "隐私/敏感信息边界",
        owner_issue_id: "问题三十二",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/敏感信息处理规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/checklists/隐私审查清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "source_extraction", "read_only_analysis"],
            injected_workflows: ["code_change", "review"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/privacy_secret_contract.ts", "src/engine/pipeline/scope_controller.ts"],
            registries: ["privacy_secret_contract", "capability_registry"],
            entrypoints: ["scanTextSensitivity", "evaluatePrivacyGate", "redactSensitiveText"],
            state_effects: ["secret detected → read blocked", "redaction applied to prompt"],
            hard_fail_conditions: ["secret in prompt", "PII not redacted", "forbidden source read"],
            degradation_behavior: "privacy scanner 不可用时保守阻断",
        },
        evidence_layer: {
            outputs: ["RedactionRecord", "PrivacyFinding"],
            reports: ["PrivacyBoundaryReport"],
            diagnostic_codes: ["secret-leak", "pii-exposure"],
            task_context_facts: ["sensitivity_labels", "redaction_records"],
        },
        verification_layer: {
            tests: ["tests/engine/privacy_secret_contract.test.ts"],
            runtime_checks: ["secret_scan", "pii_detection"],
            regression_cases: ["env_file_blocked", "token_redacted", ".ssh_forbidden"],
            drift_checks: ["privacy_rules_match_code_patterns"],
        },
        status: "dual_layer_enforced",
    },
    // ── 8. 命令执行契约 ──
    {
        mechanism_id: "mc-command-execution",
        mechanism_name: "命令执行契约",
        owner_issue_id: "问题三十三",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/命令执行规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/procedures/命令执行流程.md", asset_kind: "pipeline_procedure", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution"],
            injected_workflows: ["verification"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/command_execution_contract.ts"],
            registries: ["command_execution_contract"],
            entrypoints: ["classifyCommand", "validateCommandExecution"],
            state_effects: ["destructive command → must_confirm", "unclassified command → blocked"],
            hard_fail_conditions: ["destructive command without confirmation", "unclassified command"],
            degradation_behavior: "command classifier 不可用时降级为 advisory",
        },
        evidence_layer: {
            outputs: ["CommandClassification", "CommandExecutionResult"],
            reports: ["CommandExecutionReport"],
            diagnostic_codes: ["destructive-command", "unclassified-command"],
            task_context_facts: ["command_tier", "command_classification"],
        },
        verification_layer: {
            tests: ["tests/engine/command_execution_contract.test.ts"],
            runtime_checks: ["command_classification_gate"],
            regression_cases: ["destructive_commands_blocked", "unclassified_command_rejected"],
            drift_checks: ["command_rules_match_classifier"],
        },
        status: "dual_layer_enforced",
    },
    // ── 9. 核心工程执行原则 ──
    {
        mechanism_id: "mc-core-engineering-principles",
        mechanism_name: "核心工程执行原则",
        owner_issue_id: "问题四十六",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/核心工程执行原则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/checklists/核心工程执行验收清单.md", asset_kind: "checklist", consumption_mode: "supporting" },
                { path: "templates/procedures/编码前澄清流程.md", asset_kind: "pipeline_procedure", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan", "single_artifact"],
            injected_workflows: ["code_change", "verification", "review"],
            target_hosts: ["claude_code", "codex", "trae"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/core_engineering_principles.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["checkCorePrinciples", "validateAntiCircumvention"],
            state_effects: ["principles_failed → repair_reverify", "principles_passed → advance"],
            hard_fail_conditions: ["required principle failed at L2+", "pseudo-satisfaction detected"],
            degradation_behavior: "principles module 不可用时降级为 advisory，不阻断",
        },
        evidence_layer: {
            outputs: ["CorePrinciplesReport", "ClarificationNeed", "AssumptionRecord", "GoalDefinition"],
            reports: ["CorePrinciplesCheckResult"],
            diagnostic_codes: ["principle-violation", "pseudo-satisfaction", "missing-goal-definition"],
            task_context_facts: ["core_principles_result", "task_level"],
        },
        verification_layer: {
            tests: ["tests/engine/core_engineering_principles.test.ts"],
            runtime_checks: ["principle_gate_at_verify"],
            regression_cases: ["L2_requires_all_principles", "anti_circumvention_catches_pseudo"],
            drift_checks: ["principle_rules_match_code_checks"],
        },
        status: "dual_layer_enforced",
    },
    // ── 10. 交付门禁（补齐） ──
    {
        mechanism_id: "mc-delivery-gate",
        mechanism_name: "交付门禁",
        owner_issue_id: "问题十二",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/procedures/验收测试规划.md", asset_kind: "pipeline_procedure", consumption_mode: "required" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/delivery.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["deliver", "generateChangelogEntry"],
            state_effects: ["delivery_ready → deliver", "delivery_blocked → retrying"],
            hard_fail_conditions: ["delivery without verification", "active write lease conflict"],
            degradation_behavior: "delivery module 不可用时降级为 manual_required",
        },
        evidence_layer: {
            outputs: ["DeliveryResult", "ArtifactVerificationResult"],
            reports: ["DeliveryReadinessReport"],
            diagnostic_codes: ["delivery-without-verify", "lease-conflict"],
            task_context_facts: ["delivery_status", "artifact_status"],
        },
        verification_layer: {
            tests: ["tests/engine/delivery.test.ts"],
            runtime_checks: ["delivery_readiness_gate"],
            regression_cases: ["cannot_deliver_without_verify", "lease_conflict_blocks_delivery"],
            drift_checks: ["delivery_contract_matches_verifier_output"],
        },
        status: "dual_layer_enforced",
    },
];
//# sourceMappingURL=mechanisms_core.js.map