/** * content-delivery.ts — 统一内容供给管线(Content Delivery Pipeline) * * 目标:收敛所有"组装内容给 AI"的散点逻辑(prompt-builder / ai-context-generator / * analyze-engine / rag-engine / agent-adapter),提供唯一入口。 * * 核心:四层递进供给 + 能力探测 + 相关性分级 + 预算裁剪 * L0 引用索引 类型 + 名称 + 一句话 + 路径 ~30字/个 永远给 * L1 结构化摘要 符号签名/小节清单/HTML文本/图片描述 ~200-500字/个 默认给 * L2 按需原文 宿主有读文件工具时,给读取提示 路径 按能力给 * L3 视觉产物 截图/图片路径 路径 多模态时给 * * 设计原则:L0+L1 是确定性兜底(CLI 产出,保证不遗漏);L2+L3 按宿主能力增强。 * * 本文件是「骨架」:自包含、可独立测试,尚未接入现有调用点。 * 后续 prompt-builder / analyze-engine / rag-engine 的散点逻辑应逐步路由到这里。 */ /** 内容类型 */ export type ContentType = 'md' | 'code' | 'image' | 'html' | 'yaml' | 'json' | 'external'; /** * 相关性分级(三档,映射自 context-budget 的统一四档 ContentPriority) * core(0) = 需求/Spec ← P0 * related(1|2) = 代码/源码/图谱 ← P1 + P2 * peripheral(3) = 其他 ← P3 * 分级判定统一走 context-budget.classifyContent,本文件不再自行定义关键词。 */ export type Relevance = 'core' | 'related' | 'peripheral'; /** 统一分级(唯一来源:context-budget.classifyContent)→ 三档 Relevance */ export declare function classifyRelevance(name: string): Relevance; /** 宿主 AI 能力(由 ask-host-ai / agent-adapter 探测后传入) */ export interface HostCapabilities { multimodal: boolean; readFile: boolean; readImage: boolean; browse: boolean; } /** 单个待供给的内容项 */ export interface ContentItem { type: ContentType; /** 本地路径或 URL */ path: string; /** 名称 / 一句话摘要 */ title?: string; relevance: Relevance; /** 原始内容(调用方已读入时可传,避免管线重复 readFile) */ content?: string; } /** 内容供给请求 */ export interface ContentRequest { items: ContentItem[]; scope: string; budget: number; host: HostCapabilities; } /** 统一产出 */ export interface ContentBundle { index: string; summaries: string; onDemandHints: string; visuals: string[]; externalLinks: string[]; totalChars: number; } export declare function deliverContent(req: ContentRequest): Promise; /** 提取 Markdown 大纲:标题层级 + 每节首句,作为 L1 摘要 */ export declare function extractMdOutline(content: string): string; //# sourceMappingURL=content-delivery.d.ts.map