/**
 * 证据驱动与反幻觉契约 (Evidence-Grounded / Anti-Hallucination Contract)
 *
 * 问题六十：约束任务理解、知识注入、方案生成、代码实现、验证交付必须基于证据。
 * AI 不得无证据声称项目事实、把推测当事实、把验证计划当结果。
 */
export type EvidenceSourceType = "project_file" | "task_context" | "knowledge_asset" | "command_output" | "validation_result" | "user_confirmation" | "generated_inference";
export type EvidenceAuthority = "authoritative" | "trusted" | "supporting" | "weak" | "forbidden";
export type EvidenceFreshness = "current" | "recent" | "stale" | "unknown" | "deprecated";
export type EvidencePermission = "allowed" | "scope_exceeded" | "forbidden";
/** 证据角色：区分模板引导与真实项目证据 */
export type EvidenceRole = "classification" | "template_guidance" | "project_source_file" | "existing_system_analysis" | "user_confirmation" | "command_result" | "validation_result" | "generated_inference";
export type ClaimCategory = "project_fact" | "tech_stack" | "file_change" | "test_execution" | "performance" | "security" | "business_rule" | "user_confirmation" | "release_status" | "validation_result" | "architecture" | "code_implementation";
export type HallucinationRiskLevel = "low" | "medium" | "high" | "critical";
export type ConflictResolutionStatus = "unresolved" | "resolved" | "deferred" | "blocked";
export interface EvidenceItem {
    id: string;
    source_type: EvidenceSourceType;
    evidence_role?: EvidenceRole;
    authority: EvidenceAuthority;
    freshness: EvidenceFreshness;
    permission: EvidencePermission;
    scope: string;
    hash?: string;
    description: string;
    source_ref?: string;
    timestamp: string;
}
export interface FactClaim {
    id: string;
    category: ClaimCategory;
    claim_text: string;
    evidence_ids: string[];
    is_uncertain: boolean;
    risk_level: HallucinationRiskLevel;
    /** 声明允许的证据源类型；未声明时使用声明类别默认规则 */
    required_source_types?: EvidenceSourceType[];
}
/**
 * 声明类别对应的允许证据源类型（source_type 级别）。
 * task_context/classification 只能支撑分类/路由/意图识别，不能支撑项目事实。
 * 未列入的类别无源类型限制。
 */
export declare const CATEGORY_REQUIRED_SOURCES: Partial<Record<ClaimCategory, EvidenceSourceType[]>>;
/**
 * 声明类别对应的允许证据角色（evidence_role 级别）。
 * template_guidance（默认模板/规则/流程）不得支撑 project_fact/architecture/tech_stack 等事实声明。
 * 只有真实项目证据（project_source_file/existing_system_analysis/user_confirmation/command_result）才能支撑。
 */
export declare const CATEGORY_REQUIRED_ROLES: Partial<Record<ClaimCategory, EvidenceRole[]>>;
export interface EvidenceConflict {
    claim_id: string;
    conflicting_evidence_ids: string[];
    description: string;
    resolution_status: ConflictResolutionStatus;
    recommended_action?: string;
}
export interface EvidenceMatrix {
    task_id: string;
    claims: FactClaim[];
    evidence: EvidenceItem[];
    conflicts: EvidenceConflict[];
    unsupported_claims: string[];
    risk_summary: Record<HallucinationRiskLevel, number>;
    created_at: string;
}
export interface RetrievalPlan {
    target_claims: string[];
    source_types: EvidenceSourceType[];
    keywords: string[];
    max_results: number;
}
export interface EvidenceGateResult {
    allowed: boolean;
    reason_zh: string;
    diagnostic_code: string;
    unsupported_claims: string[];
    unresolved_conflicts: string[];
    missing_evidence: string[];
    risk_level: HallucinationRiskLevel;
    requires_user_confirmation: string[];
}
export declare class EvidenceSourceRegistry {
    private sources;
    register(item: Omit<EvidenceItem, "id" | "timestamp">): EvidenceItem;
    get(id: string): EvidenceItem | undefined;
    query(filter: Partial<Pick<EvidenceItem, "source_type" | "authority" | "freshness" | "permission" | "evidence_role">>): EvidenceItem[];
    clear(): void;
    size(): number;
}
export declare class RetrievalContract {
    private registry;
    constructor(registry: EvidenceSourceRegistry);
    retrieve(plan: RetrievalPlan): EvidenceItem[];
}
export declare class EvidenceConflictDetector {
    detect(evidence: EvidenceItem[], claims: FactClaim[]): EvidenceConflict[];
}
export declare class HallucinationRiskClassifier {
    classify(claim: FactClaim, evidence: EvidenceItem[], taskRisk: "low" | "medium" | "high" | "critical"): HallucinationRiskLevel;
}
export declare class FactClaimVerifier {
    private registry;
    private classifier;
    constructor(registry: EvidenceSourceRegistry, classifier: HallucinationRiskClassifier);
    verify(claims: FactClaim[], taskRisk: "low" | "medium" | "high" | "critical"): {
        verified: FactClaim[];
        unsupported: FactClaim[];
        risk_summary: Record<HallucinationRiskLevel, number>;
    };
    /** 检测自证模式：只用 tests/scenario/gate 调用证明主链路消费 */
    private isSelfAttestation;
}
export declare class UnsupportedClaimGate {
    constructor(_conflictDetector: EvidenceConflictDetector);
    evaluate(matrix: EvidenceMatrix, taskRisk: "low" | "medium" | "high" | "critical"): EvidenceGateResult;
}
export declare class GroundedContextBuilder {
    private retrieval;
    constructor(_registry: EvidenceSourceRegistry, retrieval: RetrievalContract);
    buildContext(claims: FactClaim[], plan: RetrievalPlan): EvidenceMatrix;
}
export declare function createEvidenceGroundingSystem(): {
    registry: EvidenceSourceRegistry;
    retrieval: RetrievalContract;
    classifier: HallucinationRiskClassifier;
    conflictDetector: EvidenceConflictDetector;
    verifier: FactClaimVerifier;
    gate: UnsupportedClaimGate;
    builder: GroundedContextBuilder;
};
export declare function isHighRiskClaimCategory(category: ClaimCategory): boolean;
/** 判断任务风险等级 */
export declare function assessTaskRisk(taskType?: string, routeDecision?: string, intentKeywords?: string): "low" | "medium" | "high" | "critical";
//# sourceMappingURL=evidence_grounding_contract.d.ts.map