/**
 * Configuration Precedence Contract — Constants
 *
 * 优先级顺序、规则、过期规则、字段分类等常量。
 */
// ── 优先级顺序 (索引=排名, 数值越小优先级越高) ──
export const PRECEDENCE_ORDER = [
    "user_task",
    "cli_flag",
    "mcp_param",
    "confirmed_config",
    "project_policy",
    "fingerprint",
    "blueprint",
    "product_profile",
    "knowledge_default",
    "global_default",
];
/** 证据元数据来源 — 映射到规范解析来源 */
export const EVIDENCE_SOURCE_MAP = {
    user_declared: "confirmed_config",
    confirmed: "confirmed_config",
    detected: "fingerprint",
};
export const SOURCE_LIFETIME = {
    user_task: "task",
    cli_flag: "single_invocation",
    mcp_param: "single_invocation",
    confirmed_config: "project_persistent",
    project_policy: "project_persistent",
    fingerprint: "task",
    blueprint: "project_persistent",
    product_profile: "global",
    knowledge_default: "global",
    global_default: "global",
};
// ── 优先级规则 ──
export const PRECEDENCE_RULES = [
    {
        id: "pr-01",
        higher_source: "user_task",
        lower_source: "confirmed_config",
        description: "用户本次指令优先于持久配置，但只在本次任务生效",
        override_behavior: "selected",
        requires_report: true,
    },
    {
        id: "pr-02",
        higher_source: "cli_flag",
        lower_source: "confirmed_config",
        description: "CLI 参数可临时覆盖 config，但不写入 config",
        override_behavior: "selected",
        requires_report: true,
    },
    {
        id: "pr-03",
        higher_source: "confirmed_config",
        lower_source: "fingerprint",
        description: "confirmed_config 优先于 fingerprint",
        override_behavior: "overridden",
        requires_report: true,
    },
    {
        id: "pr-04",
        higher_source: "confirmed_config",
        lower_source: "product_profile",
        description: "product_profile 只能补充默认，不覆盖用户确认配置",
        override_behavior: "overridden",
        requires_report: false,
    },
    {
        id: "pr-05",
        higher_source: "confirmed_config",
        lower_source: "knowledge_default",
        description: "knowledge_default 不能覆盖 config",
        override_behavior: "overridden",
        requires_report: false,
    },
    {
        id: "pr-06",
        higher_source: "fingerprint",
        lower_source: "blueprint",
        description: "fingerprint 优先于 blueprint，真实项目指纹出现后重新评估",
        override_behavior: "overridden",
        requires_report: true,
    },
    {
        id: "pr-07",
        higher_source: "fingerprint",
        lower_source: "product_profile",
        description: "fingerprint 优先于 product_profile 默认",
        override_behavior: "overridden",
        requires_report: false,
    },
    {
        id: "pr-08",
        higher_source: "fingerprint",
        lower_source: "knowledge_default",
        description: "fingerprint 优先于 knowledge_default",
        override_behavior: "overridden",
        requires_report: false,
    },
    {
        id: "pr-09",
        higher_source: "product_profile",
        lower_source: "knowledge_default",
        description: "product_profile 优先于 knowledge_default",
        override_behavior: "overridden",
        requires_report: false,
    },
    {
        id: "pr-10",
        higher_source: "knowledge_default",
        lower_source: "global_default",
        description: "knowledge_default 优先于 global_default",
        override_behavior: "overridden",
        requires_report: false,
    },
];
// ── 过期/冲突规则 ──
export const STALE_RULES = [
    {
        id: "stale-01",
        trigger: "config_vs_fingerprint_mismatch",
        severity: "warning",
        description: "confirmed_config 与 fingerprint 冲突",
        action: "不自动覆盖 confirmed_config，产生 stale/conflict report",
    },
    {
        id: "stale-02",
        trigger: "fingerprint_drift",
        severity: "warning",
        description: "fingerprint 发生变化（如 React→Vue），config 仍是旧值",
        action: "产生 stale warning，不自动覆盖",
    },
    {
        id: "stale-03",
        trigger: "config_vs_blueprint_mismatch",
        severity: "warning",
        description: "blueprint 在空项目初期有效，真实项目指纹出现后应重新评估",
        action: "提示重新评估，blueprint 降为 advisory",
    },
];
// ── 字段分类写入规则 ──
/** C 类字段列表 — 仅允许人工确认写入，永不自动写入 */
export const C_CLASS_FIELDS = [
    "product_mapping",
    "delivery.auto_push",
    "delivery.auto_pr",
    "delivery.deploy",
    "secrets",
    "accounts",
    "production_database",
    "destructive_command_policy",
    "external_integrations",
    "compliance_policy",
    "privacy_policy",
    "core_knowledge_sovereignty",
];
// ── 默认配置字段 ──
export const DEFAULT_CONFIG_FIELDS = [
    "product_profile",
    "tech_stack.backend.framework",
    "tech_stack.frontend.framework",
];
//# sourceMappingURL=constants.js.map