/** * View Registry — 上下文引擎模块。 * * 职责边界: * - 负责:ViewCapability 等 上下文引擎职责 * - 不负责:不属于本模块的职责由对应模块承担 * * 被谁调用:管线上下文解析、视图查询 * 调用谁:无外部依赖 * * 数据流:输入 → ViewCapability 处理 → 输出 * 持久化:无持久化(纯计算/内存态) */ /** 视图能力 */ type ViewCapability = "grep" | "ast" | "git" | "coverage" | "knowledge_index"; /** 视图参数 */ export interface ViewParams { targets?: string[]; gitRef?: string; scope?: string[]; extra?: Record; } /** 可追踪证据 */ export interface Evidence { type: "grep_match" | "import_chain" | "git_diff" | "coverage_report"; verify_command: string; source: string; } /** 视图分析结果 */ export interface ViewResult { view: string; summary: string; data: Record; evidence: Evidence[]; } /** 视图接口 */ export interface ContextView { name: string; capabilities: ViewCapability[]; analyze(root: string, params: ViewParams): Promise; } /** 注册视图 */ export declare function registerView(view: ContextView): void; /** 查询视图 — 返回 undefined 表示未注册 */ export declare function getView(name: string): ContextView | undefined; /** 查询已注册视图名列表 */ export declare function listRegisteredViews(): string[]; /** 调度视图分析 — 未注册时报错 */ export declare function dispatchView(name: string, root: string, params: ViewParams): Promise; /** 重置注册表(供测试 afterEach 清理,防止测试间泄漏) */ export declare function resetViews(): void; export {};