/**
 * Knowledge Injection Boundary — 知识注入边界三道门
 *
 * 将"可索引""可注入""注入优先级"拆成三道门，
 * 为每次 expand 生成知识注入报告，说明哪些知识被注入、
 * 哪些只能 advisory、哪些被排除以及排除原因。
 */
import type { KnowledgeEntry, KnowledgeInjectionReport, ArtifactSchemaInjection, KnowledgeConflict, ExclusionReason } from "../../types/index.js";
import type { IntentRouteDecision } from "../pipeline/intent_router.js";
import type { OperationType } from "../../types/pipeline.js";
import type { TaskStage } from "../workflow/workflow_navigation_contract.js";
import { type ConsumableAssetRef } from "../templates/consumable_asset_registry.js";
export interface InjectionGovernanceFinding {
    severity: "hard_fail" | "advisory";
    subject_id: string;
    field: string;
    message: string;
}
interface GateResult<T> {
    passed: T[];
    excluded: Array<{
        id: string;
        name: string;
        reason: ExclusionReason;
    }>;
}
/** 清除合同缓存（测试/重置时使用） */
export declare function clearInjectionContractCache(): void;
/** 门1: 过滤可索引的知识条目，排除非 active/pending_review 状态 */
export declare function filterIndexable(entries: KnowledgeEntry[]): GateResult<KnowledgeEntry>;
/** 门2: 过滤可注入的知识条目，按消费模式、作用域、产品、路由等条件筛选 */
export declare function filterInjectable(entries: KnowledgeEntry[], routeDecision: IntentRouteDecision | undefined, scopeFilters: string[], assets: ConsumableAssetRef[], productFilters?: string[], contractRoot?: string, taskStage?: TaskStage): {
    injectable: KnowledgeEntry[];
    advisory: KnowledgeEntry[];
    excluded: Array<{
        id: string;
        name: string;
        reason: ExclusionReason;
    }>;
    indexOnlyExcludedIds: Set<string>;
};
/** 门3: 按优先级排序知识条目，检测冲突，在预算内裁剪 */
export declare function sortByPriority(entries: KnowledgeEntry[], routeDecision: IntentRouteDecision | undefined, assets: ConsumableAssetRef[], budget: number, taskStage?: TaskStage): {
    sorted: KnowledgeEntry[];
    conflicts: KnowledgeConflict[];
    dropped: Array<{
        id: string;
        name: string;
        reason: ExclusionReason;
    }>;
};
/**
 * 解析产物 Schema 和 ProcessRules 的独立注入内容。
 *
 * 核心设计决策：Schema 和 ProcessRules 是结构约束，不是知识。
 * 它们绕过三道门的条目数/token 预算限制，作为独立注入通道。
 * 无论知识注入预算是否充足，Schema 始终被注入到 prompt 中。
 *
 * @param outputArtifact 路由决策中的 output_artifact（含 kind 和可选 template）
 * @param operationType 当前操作类型（extract/review/fix/iterate）
 * @returns Schema 注入内容，无匹配产物类型时返回 null
 */
export declare function resolveArtifactSchemaInjection(outputArtifact: {
    kind: string;
    template?: string;
} | undefined, operationType: OperationType | undefined): ArtifactSchemaInjection | null;
/** 知识注入边界主入口，依次执行三道门并生成注入报告 */
export declare function enforceKnowledgeInjectionBoundary(entries: KnowledgeEntry[], routeDecision: IntentRouteDecision | undefined, scopeFilters: string[], assets: ConsumableAssetRef[] | undefined, budget?: number, productFilters?: string[], contractRoot?: string, maxTokenBudget?: number, taskStage?: TaskStage): KnowledgeInjectionReport;
/** 自治理验证知识注入报告的合规性 */
export declare function validateInjectionReport(report: KnowledgeInjectionReport): InjectionGovernanceFinding[];
/**
 * 从报告中获取已注入的条目，回溯到原始 KnowledgeEntry 对象。
 */
export declare function getInjectedEntryIds(report: KnowledgeInjectionReport): string[];
export {};
//# sourceMappingURL=knowledge_injection_boundary.d.ts.map