/**
 * Dual-layer mechanism definitions — platform section.
 * Auto-extracted from the monolithic dual_layer_mechanism_registry.
 */
export const MECHANISM_CONTRACTS_PLATFORM = [
    // ── 32. 扩展生命周期与权限管控 ──
    {
        mechanism_id: "mc-extension-contract",
        mechanism_name: "扩展生命周期与权限管控",
        owner_issue_id: "问题三十九",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/扩展生命周期规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["code_change"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/extension_contract.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["validateExtensionManifest", "evaluateExtensionLifecycle", "grantExtensionPermissions"],
            state_effects: ["extension registration → validated", "permission grant → approved"],
            hard_fail_conditions: ["第三方扩展自称 enforced", "高风险权限未审批"],
            degradation_behavior: "扩展不合规时拒绝注册",
        },
        evidence_layer: {
            outputs: ["ExtensionManifest", "ExtensionLifecycleResult", "PermissionGrantResult"],
            reports: ["ExtensionValidationReport"],
            diagnostic_codes: ["SF-EXT-3901", "SF-EXT-3902"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/extension_scenario_matrix.test.ts"],
            runtime_checks: ["extension_manifest_validation"],
            regression_cases: ["third_party_enforced_blocked", "lifecycle_transition_valid"],
            drift_checks: ["extension_contract_registry_sync"],
        },
        status: "dual_layer_enforced",
    },
    // ── 33. 跨平台路径安全 ──
    {
        mechanism_id: "mc-platform-compatibility",
        mechanism_name: "跨平台路径安全",
        owner_issue_id: "问题四十",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/跨平台路径安全规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["code_change"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/platform_context.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["normalizePathRef", "checkPathSafety", "detectPlatformContext"],
            state_effects: ["path normalization → safe_path", "scope boundary → validated"],
            hard_fail_conditions: ["路径逃逸未检测", "scope 边界绕过"],
            degradation_behavior: "路径不安全时拒绝操作",
        },
        evidence_layer: {
            outputs: ["NormalizedPathRef", "PathSafetyCheck"],
            reports: ["PlatformCompatibilityReport"],
            diagnostic_codes: ["SF-PLAT-4001", "SF-PLAT-4002"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/extension_scenario_matrix.test.ts"],
            runtime_checks: ["path_safety_check"],
            regression_cases: ["symlink_escape_blocked", "case_conflict_detected"],
            drift_checks: ["platform_context_registry_sync"],
        },
        status: "dual_layer_enforced",
    },
    // ── 34. 工作流模板包消费 ──
    {
        mechanism_id: "mc-workflow-template-pack",
        mechanism_name: "工作流模板包消费",
        owner_issue_id: "问题五十三",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/工作流模版包规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["code_change"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/workflow_template_pack.ts"],
            registries: ["mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["validateWorkflowTemplatePack", "advanceTemplateConsumptionStatus", "createTemplateConsumptionEvidence"],
            state_effects: ["template status → missing/file_created/indexed/registered/injected/consumed/verified"],
            hard_fail_conditions: ["模板停在中间状态", "消费 pipeline 不完整"],
            degradation_behavior: "消费不完整时阻断",
        },
        evidence_layer: {
            outputs: ["WorkflowTemplatePackContract", "PackValidationResult"],
            reports: ["TemplatePackReport"],
            diagnostic_codes: ["SF-WTP-5301", "SF-WTP-5302"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/extension_scenario_matrix.test.ts"],
            runtime_checks: ["template_pack_pipeline_validation"],
            regression_cases: ["template_stuck_in_middle_state"],
            drift_checks: ["template_pack_vs_consumable_assets"],
        },
        status: "dual_layer_enforced",
    },
    // ── 35. 指标治理 ──
    {
        mechanism_id: "mc-metric-governance",
        mechanism_name: "指标治理",
        owner_issue_id: "问题十九",
        priority: "P1",
        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: ["verification", "delivery"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/metric_governance.ts"],
            registries: ["mechanism_contract_registry"],
            entrypoints: ["evaluateMetrics", "evaluateGovernanceAction"],
            state_effects: ["metric evaluation → passed/failed", "governance action → approved/blocked"],
            hard_fail_conditions: ["skipped 算 passed", "空数组伪造 passed"],
            degradation_behavior: "指标不合规时标记为 failed",
        },
        evidence_layer: {
            outputs: ["MetricsEvaluationResult", "GovernanceFinding", "MetricSample[]"],
            reports: ["MetricGovernanceReport"],
            diagnostic_codes: ["SF-METRIC-1901", "SF-METRIC-1902"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/observability.test.ts"],
            runtime_checks: ["metric_sample_real_source"],
            regression_cases: ["empty_array_not_passed", "insufficient_history_guard"],
            drift_checks: ["metric_governance_vs_delivery"],
        },
        status: "dual_layer_enforced",
    },
    // ── 36. 施工指令契约 ──
    {
        mechanism_id: "mc-instruction-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" },
            ],
            injected_routes: ["code_change", "multi_stage_plan", "artifact_generation"],
            injected_workflows: ["code_change", "planning"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/instruction_contract.ts"],
            registries: ["mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["validateInstructionContract", "enforceInstructionBeforeImplementation", "checkInstructionCompleteness", "registerInstructionIssueCandidate"],
            state_effects: ["instruction draft → confirmed → executing → completed/blocked"],
            hard_fail_conditions: ["施工指令缺失必填字段", "blocked 状态被放行", "空值假通过"],
            degradation_behavior: "指令不完整时阻断，不可降级",
        },
        evidence_layer: {
            outputs: ["InstructionValidationResult", "InstructionEnforcementResult", "InstructionCompletenessResult"],
            reports: ["InstructionContractReport"],
            diagnostic_codes: ["SF-INSTR-5801", "SF-INSTR-5802"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/instruction_contract.test.ts"],
            runtime_checks: ["instruction_completeness_gate"],
            regression_cases: ["missing_goal_hard_fail", "empty_scope_hard_fail", "blocked_status_not_bypassed"],
            drift_checks: ["instruction_contract_vs_plan_gate"],
        },
        status: "dual_layer_enforced",
    },
    // ── 37. 证据驱动与反幻觉契约 ──
    {
        mechanism_id: "mc-evidence-grounding",
        mechanism_name: "证据驱动与反幻觉契约",
        owner_issue_id: "问题六十",
        priority: "P0",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/证据驱动与反幻觉规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
            ],
            injected_routes: ["code_execution", "multi_stage_plan"],
            injected_workflows: ["sf_expand", "sf_verify", "sf_deliver"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/evidence_grounding_contract.ts", "src/engine/contracts/instruction_contract.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["createEvidenceGroundingSystem", "assessTaskRisk"],
            state_effects: ["evidence_matrix", "unsupported_claims", "conflict_resolutions"],
            hard_fail_conditions: ["无证据声称项目事实", "generated_inference单独支撑事实", "forbidden evidence被注入", "tests/scenario/gate自证"],
            degradation_behavior: "降级为 advisory，标注为通用建议，不阻断低风险任务",
        },
        evidence_layer: {
            outputs: ["EvidenceMatrix", "EvidenceGateResult"],
            reports: ["evidence_advisory", "unsupported_claims"],
            diagnostic_codes: ["SF-EVIDENCE-6000", "SF-EVIDENCE-6001", "SF-EVIDENCE-6002"],
            task_context_facts: ["evidence_matrix", "unsupported_claims", "conflict_resolutions"],
        },
        verification_layer: {
            tests: ["tests/engine/evidence_grounding_contract.test.ts"],
            runtime_checks: ["validate-release 证据驱动检查"],
            regression_cases: ["无证据声称项目事实 → blocked", "generated_inference 单独支撑 → blocked", "validation_plan 冒充结果 → blocked"],
            drift_checks: ["adapter prompt 包含证据驱动规则"],
        },
        status: "dual_layer_enforced",
    },
    // ── 38. 全生命周期工作流导航契约 ──
    {
        mechanism_id: "mc-workflow-navigation-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: "knowledge_procedure", consumption_mode: "required" },
            ],
            injected_routes: ["*"],
            injected_workflows: ["sf_classify", "soloforge_next", "soloforge_stage"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/workflow/next_action_planner.ts", "src/engine/pipeline/stale_current_task_detector.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["planNextAction", "detectStaleCurrentTask"],
            state_effects: ["navigation_snapshot", "stale_task_resolution"],
            hard_fail_conditions: ["设计审计失败仍编码", "配置未确认仍任务", "陈旧任务阻塞新任务", "repair directive 未清零仍交付"],
            degradation_behavior: "降级为 advisory，不阻断",
        },
        evidence_layer: {
            outputs: ["NextActionPlan", "ExecutableWorkPackage", "StaleCurrentTaskResult"],
            reports: ["navigation_snapshot"],
            diagnostic_codes: ["SF-NAV-6501", "SF-NAV-6502", "SF-NAV-6503", "SF-NAV-6504"],
            task_context_facts: [],
        },
        verification_layer: {
            tests: ["tests/engine/workflow_navigation_contract.test.ts", "tests/bin/cli_next_action.test.ts", "tests/adapters/workflow_navigation_mainpath.test.ts"],
            runtime_checks: ["validate-release 工作流导航行为验证"],
            regression_cases: ["未初始化 → sf_init", "陈旧任务 → resume/archive/start_new", "设计失败 → 禁止编码"],
            drift_checks: ["adapter prompt 包含导航规则", "status/validate 消费同一模块"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-ood-solid-contract",
        mechanism_name: "OOD 与 SOLID 实现契约",
        owner_issue_id: "问题六十六",
        priority: "P1",
        template_layer: {
            required: true,
            assets: [
                { path: "templates/internal/rules/OOD与SOLID设计规则.md", asset_kind: "knowledge_rule", consumption_mode: "required" },
                { path: "templates/procedures/OOD设计工作流.md", asset_kind: "knowledge_procedure", consumption_mode: "required" },
                { path: "templates/rules/shared/SOLID代码审查规则.md", asset_kind: "review_rule", consumption_mode: "required" },
                { path: "templates/artifacts/shared/OOD设计摘要模版.md", asset_kind: "acceptance_template", consumption_mode: "supporting" },
                { path: "templates/patterns/SOLID设计规范.md", asset_kind: "pattern", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_change", "artifact_generation", "multi_stage_plan"],
            injected_workflows: ["sf_expand", "sf_review", "sf_verify", "sf_deliver"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/ood_solid_contract.ts", "src/server/tools/index.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["evaluateOodDesignGate", "reviewSolidCode", "hasBlockingSolidFindings"],
            state_effects: ["ood_solid_summary", "ood_solid_findings"],
            hard_fail_conditions: ["复杂编码无设计摘要", "SRP/LSP/ISP/DIP 硬失败仍交付"],
            degradation_behavior: "简单任务不触发；低风险过度设计只警告",
        },
        evidence_layer: {
            outputs: ["OodDesignSummary", "SolidReviewFinding"],
            reports: ["ood_solid_findings"],
            diagnostic_codes: ["SF-OOD-6601", "SF-OOD-6602"],
            task_context_facts: ["ood_solid_summary", "ood_solid_findings"],
        },
        verification_layer: {
            tests: ["tests/engine/ood_solid_contract.test.ts", "tests/adapters/implementation_contract_mainpath.test.ts"],
            runtime_checks: ["validate-release OOD/SOLID 行为验证"],
            regression_cases: ["复杂服务无摘要 → blocked", "Controller 业务逻辑 → blocked", "低风险修改 → not_applicable"],
            drift_checks: ["模板资产与工具消费一致"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-backend-implementation-contract",
        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: "knowledge_procedure", consumption_mode: "required" },
                { path: "templates/rules/shared/后端实现工程审查规则.md", asset_kind: "review_rule", consumption_mode: "required" },
                { path: "templates/artifacts/shared/后端实现验收清单.md", asset_kind: "acceptance_template", consumption_mode: "supporting" },
                { path: "templates/patterns/后端实现工程规范.md", asset_kind: "pattern", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_change", "artifact_generation", "multi_stage_plan"],
            injected_workflows: ["sf_expand", "sf_review", "sf_verify", "sf_deliver"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/backend_implementation_contract.ts", "src/server/tools/index.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["evaluateBackendImplementationGate", "reviewBackendImplementationFiles", "hasBlockingBackendFindings"],
            state_effects: ["backend_implementation_work_package", "backend_implementation_findings"],
            hard_fail_conditions: ["后端编码无工程工作包", "实体暴露/无校验/事务外调/无幂等/无安全审计仍交付"],
            degradation_behavior: "非后端或低风险文本任务不触发",
        },
        evidence_layer: {
            outputs: ["BackendImplementationWorkPackage", "BackendImplementationFinding"],
            reports: ["backend_implementation_findings"],
            diagnostic_codes: ["SF-BACKEND-6701", "SF-BACKEND-6702"],
            task_context_facts: ["backend_implementation_work_package", "backend_implementation_findings"],
        },
        verification_layer: {
            tests: ["tests/engine/backend_implementation_contract.test.ts", "tests/adapters/implementation_contract_mainpath.test.ts"],
            runtime_checks: ["validate-release 后端工程契约行为验证"],
            regression_cases: ["API 实现无工作包 → blocked", "写接口无 DTO 校验 → blocked", "事务内外部调用 → blocked"],
            drift_checks: ["模板资产与工具消费一致"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-code-maintainability-observability-contract",
        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/rules/shared/代码可维护性与可观测性审查.md", asset_kind: "review_rule", consumption_mode: "required" },
                { path: "templates/artifacts/shared/代码注释与日志验收模版.md", asset_kind: "acceptance_template", consumption_mode: "supporting" },
            ],
            injected_routes: ["code_change", "artifact_generation", "multi_stage_plan"],
            injected_workflows: ["sf_expand", "sf_review", "sf_verify", "sf_deliver"],
            target_hosts: ["claude_code"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: ["src/engine/contracts/code_maintainability_observability_contract.ts", "src/server/tools/index.ts"],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry", "consumable_asset_registry"],
            entrypoints: ["evaluateCodeObservabilityGate", "reviewCodeObservability", "detectSensitiveLogs", "hasBlockingObservabilityFindings"],
            state_effects: ["code_observability_work_package", "code_observability_findings"],
            hard_fail_conditions: [
                "敏感信息泄漏日志 (SF-OBS-6801)",
                "catch 吞异常无日志 (SF-OBS-6802)",
                "支付/金额/权限变更无日志 (SF-OBS-6803)",
                "数据修复/迁移无审计日志 (SF-OBS-6804)",
                "前端生产代码裸 console.log",
            ],
            degradation_behavior: "纯样式、文案、简单 getter/setter、测试 fixture、低风险只读查询不触发",
        },
        evidence_layer: {
            outputs: ["CodeObservabilityWorkPackage", "CodeObservabilityFinding"],
            reports: ["code_observability_findings"],
            diagnostic_codes: ["SF-OBS-6801", "SF-OBS-6802", "SF-OBS-6803", "SF-OBS-6804"],
            task_context_facts: ["code_observability_work_package", "code_observability_findings"],
        },
        verification_layer: {
            tests: ["tests/engine/code_maintainability_observability_contract.test.ts", "tests/adapters/implementation_contract_mainpath.test.ts"],
            runtime_checks: ["validate-release 代码可维护性与可观测性行为验证"],
            regression_cases: ["支付无日志 → blocked", "敏感信息进日志 → blocked", "catch 吞异常 → blocked", "简单 getter 不误拦 → not_applicable"],
            drift_checks: ["模板资产与工具消费一致"],
        },
        status: "dual_layer_enforced",
    },
    {
        mechanism_id: "mc-code-quality-gate",
        mechanism_name: "代码质量门禁（防 AI 偷懒）",
        owner_issue_id: "防AI偷懒-A4",
        priority: "P0",
        template_layer: {
            required: false,
            assets: [],
            injected_routes: ["code_change"],
            injected_workflows: ["sf_verify", "sf_deliver"],
            target_hosts: ["claude_code", "codex", "trae"],
            language_policy: "zh_first",
        },
        enforcement_layer: {
            required: true,
            enforcers: [
                "src/engine/contracts/lazy_pattern_detector.ts",
                "src/bin/commands/check_write.ts",
                "src/bin/commands/check_bash.ts",
            ],
            registries: ["dual_layer_mechanism_registry", "mechanism_contract_registry"],
            entrypoints: [
                "detectLazyPatterns",
                "evaluateArtifactStructure",
            ],
            state_effects: ["code_quality_result"],
            hard_fail_conditions: [
                "空函数体 (SF-LAZY-001)",
                "未实现占位 throw new Error('not implemented') (SF-LAZY-002)",
                "空 catch 块 (SF-LAZY-003)",
                "未实现注释 '待实现' 等 (SF-LAZY-004)",
                "错误处理路径验证 hard_fail (SF-ERROR-PATH)",
            ],
            degradation_behavior: ".d.ts / .test.ts / .spec.ts 豁免部分检测；纯样式文案不触发",
        },
        evidence_layer: {
            outputs: ["LazyPatternFinding", "ErrorPathFinding", "BehaviorCoverageFinding"],
            reports: ["code_quality_result"],
            diagnostic_codes: ["SF-LAZY-PATTERN-DETECTED", "SF-ERROR-PATH-VERIFICATION-FAILED", "SF-LAZY-001", "SF-LAZY-002", "SF-LAZY-003", "SF-LAZY-004"],
            task_context_facts: ["code_quality_result"],
        },
        verification_layer: {
            tests: [
                "tests/engine/lazy_pattern_detector.test.ts",
                "tests/engine/error_path_verifier.test.ts",
                "tests/engine/behavior_coverage_verifier.test.ts",
                "tests/architecture/architecture_boundary.test.ts",
            ],
            runtime_checks: ["check:quality npm script", "sf_verify 步骤 7a-7c"],
            regression_cases: [
                "空函数体 → hard_fail",
                "TODO 在 .test.ts → 豁免",
                "catch 吞异常 → hard_fail",
                "干净代码 → 无发现",
            ],
            drift_checks: ["WORKFLOW_TEMPLATE_HARD_RULES 条数 >= 21"],
        },
        status: "code_only_enforced",
    },
];
//# sourceMappingURL=mechanisms_platform.js.map