/**
 * Dual-layer mechanism definitions — audit section.
 * Auto-extracted from the monolithic dual_layer_mechanism_registry.
 */
export const MECHANISM_CONTRACTS_AUDIT = [
    // ── 代码审查 ──
    {
        mechanism_id: "mc-code-review",
        mechanism_name: "代码审查",
        owner_issue_id: "审计补注册",
        priority: "P1",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/code_reviewer.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["reviewCode", "renderSummaryBacktrace"],
            state_effects: ["review_result → advisory"],
            hard_fail_conditions: [],
            degradation_behavior: "代码审查结果为纯信息性，不阻断",
        },
        evidence_layer: {
            outputs: ["CodeReviewResult"],
            reports: ["CodeReviewReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/code_reviewer.test.ts"],
            runtime_checks: ["code_review_run_before_delivery"],
            regression_cases: ["review_finding_recorded"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 设计生命周期契约 ──
    {
        mechanism_id: "mc-design-lifecycle",
        mechanism_name: "设计生命周期契约",
        owner_issue_id: "审计补注册",
        priority: "P0",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change", "analysis"],
            injected_workflows: ["pipeline"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/design_lifecycle_contract.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["listDesignLifecycleStageContracts", "validateDesignLifecycleContract"],
            state_effects: ["stage_contracts → lifecycle validation"],
            hard_fail_conditions: ["阶段产物不完整", "跳过阶段"],
            degradation_behavior: "阶段产物缺失时报告为 finding",
        },
        evidence_layer: {
            outputs: ["DesignLifecycleStageContract", "DesignLifecycleContractFinding"],
            reports: ["DesignLifecycleReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/design_lifecycle_contract.test.ts"],
            runtime_checks: ["lifecycle_stages_covered"],
            regression_cases: ["all_stages_have_contracts"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── API 契约守卫 ──
    {
        mechanism_id: "mc-api-contract-guard",
        mechanism_name: "API 契约守卫",
        owner_issue_id: "审计补注册",
        priority: "P1",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/contract_guard.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["checkContractChanges"],
            state_effects: ["contract_guard_result → allow/advisory"],
            hard_fail_conditions: ["契约破坏性变更"],
            degradation_behavior: "守卫检查不可用时降级为 advisory",
        },
        evidence_layer: {
            outputs: ["ContractGuardResult"],
            reports: ["ContractGuardReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/contract_guard.test.ts"],
            runtime_checks: ["contract_breaking_change_detected"],
            regression_cases: ["breaking_change_caught"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── Diff 所有权追踪 ──
    {
        mechanism_id: "mc-diff-ownership",
        mechanism_name: "Diff 所有权追踪",
        owner_issue_id: "审计补注册",
        priority: "P0",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["code_change", "verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/diff_ownership.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["captureBaseline", "casCheck", "recordTaskWrite", "summarizeOwnership"],
            state_effects: ["ownership_snapshot → conflict detection"],
            hard_fail_conditions: [],
            degradation_behavior: "CAS 校验失败时仅 advisory",
        },
        evidence_layer: {
            outputs: ["OwnershipSnapshot", "CasCheckResult", "OwnershipSummary"],
            reports: ["DiffOwnershipReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/diff_ownership.test.ts"],
            runtime_checks: ["ownership_tracked"],
            regression_cases: ["cas_mismatch_detected"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── LLM 网关 ──
    {
        mechanism_id: "mc-llm-gateway",
        mechanism_name: "LLM 网关",
        owner_issue_id: "审计补注册",
        priority: "P1",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_execution", "read_only_analysis"],
            injected_workflows: ["code_change", "planning"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/core/llm_gateway.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["LLMGateway"],
            state_effects: ["budget_status → circuit_breaker"],
            hard_fail_conditions: ["预算超限"],
            degradation_behavior: "断路器触发后阻断调用，需手动 reset",
        },
        evidence_layer: {
            outputs: ["LLMGatewayResult", "budget_status"],
            reports: ["LLMGatewayReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/llm_gateway.test.ts"],
            runtime_checks: ["budget_tracked"],
            regression_cases: ["circuit_breaker_triggers"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 模板机制审计 ──
    {
        mechanism_id: "mc-template-mechanism-audit",
        mechanism_name: "模板机制审计",
        owner_issue_id: "审计补注册",
        priority: "P2",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["operation"],
            injected_workflows: ["validate-mechanisms", "validate-release"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/templates/template_mechanism_auditor.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["auditTemplateMechanisms", "isInjectionAllowed"],
            state_effects: ["audit_report → finding"],
            hard_fail_conditions: ["模板与机制不匹配"],
            degradation_behavior: "审计失败时报告 finding",
        },
        evidence_layer: {
            outputs: ["TemplateMechanismAuditReport"],
            reports: ["TemplateAuditReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/foundation_dual_layer.test.ts"],
            runtime_checks: ["template_mechanism_consistency"],
            regression_cases: ["template_mechanism_mismatch_detected"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 范围控制器 ──
    {
        mechanism_id: "mc-scope-control",
        mechanism_name: "范围控制器",
        owner_issue_id: "审计补注册",
        priority: "P0",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["code_change", "verification"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/pipeline/scope_controller.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["checkScope"],
            state_effects: ["scope_check → allowed/blocked"],
            hard_fail_conditions: ["scope 边界绕过"],
            degradation_behavior: "scope 检查不可用时保守阻断",
        },
        evidence_layer: {
            outputs: ["ScopeCheckResult"],
            reports: ["ScopeControlReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/scope_controller.test.ts"],
            runtime_checks: ["scope_boundary_enforced"],
            regression_cases: ["out_of_scope_blocked"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 运行时安全 ──
    {
        mechanism_id: "mc-runtime-safety",
        mechanism_name: "运行时安全",
        owner_issue_id: "审计补注册",
        priority: "P0",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/runtime_safety.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["buildEvidenceChain", "verifyEvidenceChain", "classifyCommand", "checkMigrationContract", "checkSupplyChain"],
            state_effects: ["command_classification → safety tier", "evidence_chain → integrity"],
            hard_fail_conditions: [],
            degradation_behavior: "安全检查不可用时保守阻断",
        },
        evidence_layer: {
            outputs: ["ClassifiedCommand", "EvidenceBlock", "MigrationCheckResult", "SupplyChainCheckResult"],
            reports: ["RuntimeSafetyReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/runtime_safety.test.ts"],
            runtime_checks: ["evidence_chain_integrity"],
            regression_cases: ["destructive_command_classified"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 诊断码契约 ──
    {
        mechanism_id: "mc-diagnostic-code-contract",
        mechanism_name: "诊断码契约",
        owner_issue_id: "审计补注册",
        priority: "P2",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["operation"],
            injected_workflows: ["all"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/diagnostic_registry.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["registerDiagnostic", "getDiagnosticByCode", "listAllDiagnostics", "validateDiagnosticCoverage"],
            state_effects: ["diagnostic_registry → coverage_report"],
            hard_fail_conditions: ["诊断码重复"],
            degradation_behavior: "注册失败时返回错误信息",
        },
        evidence_layer: {
            outputs: ["DiagnosticCodeEntry", "DiagnosticCoverageReport"],
            reports: ["DiagnosticCoverageReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/verification_scenario_matrix.test.ts"],
            runtime_checks: ["diagnostic_coverage_complete"],
            regression_cases: ["duplicate_code_rejected"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 契约状态存储 ──
    {
        mechanism_id: "mc-contract-state-lifecycle",
        mechanism_name: "契约状态存储",
        owner_issue_id: "审计补注册",
        priority: "P2",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["operation"],
            injected_workflows: ["all"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/contract_state_store.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["ContractStateStore"],
            state_effects: ["contract_state → lifecycle"],
            hard_fail_conditions: ["无效状态转换"],
            degradation_behavior: "状态存储不可用时降级为内存模式",
        },
        evidence_layer: {
            outputs: ["ContractState"],
            reports: ["ContractStateReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/contract_registry.test.ts"],
            runtime_checks: ["contract_state_valid"],
            regression_cases: ["invalid_transition_rejected"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
    // ── 技术债务追踪 ──
    {
        mechanism_id: "mc-tech-debt-lifecycle",
        mechanism_name: "技术债务追踪",
        owner_issue_id: "审计补注册",
        priority: "P2",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["operation"],
            injected_workflows: ["validate-release"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/audit/debt_tracker.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["DebtTracker"],
            state_effects: ["debt_report → threshold_check"],
            hard_fail_conditions: ["债务阈值溢出"],
            degradation_behavior: "债务追踪不可用时降级为 advisory",
        },
        evidence_layer: {
            outputs: ["DebtReport", "DebtThresholdResult"],
            reports: ["DebtTrackerReport"],
            diagnostic_codes: [],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/debt_tracker.test.ts"],
            runtime_checks: ["debt_threshold_tracked"],
            regression_cases: ["threshold_overflow_detected"],
            drift_checks: [],
        },
        status: "code_only_enforced",
    },
];
//# sourceMappingURL=mechanisms_audit.js.map