import type { AgentContext, AssetPack, Blueprint, BlueprintGroup, Domain, Profile, ProfileGroup, SchemaBundle, SourceAdapterContext, StructureLayout } from "../schema.js"; /** * 编译 Profile 为 AgentContext IR(v9)。 * - 遍历 Blueprint.groups * - 每个聚合组找 Profile 同名 ProfileGroup * - 按 modName 注册表聚合(dispatchGroup)—— modName 来源从 Blueprint.modules 改为 ProfileGroup.modules * * Phase term-P1:函数名 compileContext → compileAgentContext(IR 改名同步)。 * Phase term-P-modules-to-profile: * - Blueprint 退化为插槽契约(无 modules 字段),modules 由 ProfileGroup.modules 提供 * - 加越权/缺填告警(log warn + notify / log debug only)—— 设计文档 §5 * - ctx 可选:测试 / CLI 直接调可不传;运行链路(transpile)传入同 adapterCtx 用 logger 留痕 */ export declare function compileAgentContext(profile: Profile, blueprint: Blueprint, domains: Domain[], packs: AssetPack[], profilePack: string, workingSet: SchemaBundle["workingSet"], ctx?: SourceAdapterContext): AgentContext; /** v16:resolveDomains 返回值。三态可观测: * - domains:合并后的 Domain[](必填 + 可选,通过 modules 过滤) * - optionalMissing:可选 ref 中未解析的(prj 无该 domain)——info 级诊断 * - optionalNoMatch:可选 ref 中已解析但 H2 段全不匹配 modules 的——warning 级诊断 * back-compat:profile 不写 optional-domains → optionalMissing/NoMatch 均为空数组 */ export interface ResolveDomainsResult { domains: Domain[]; /** 可选 ref 中未解析的(prj 无该 domain)——info 级诊断。 */ optionalMissing: string[]; /** 可选 ref 中已解析但 H2 段全不匹配 modules 的——warning 级诊断。 */ optionalNoMatch: string[]; } /** v9 Domains 分发:全局 domains + 聚合组追加(去重,保序),按 ProfileGroup.modules 过滤。 * 规则:Domain 有该聚合组 modules 列出的任一 H2 段 → 贡献;没有 → 跳过。 * v9.1(modules-to-profile 迁移):modules 来源从 Blueprint.modules 改为 ProfileGroup.modules * —— Blueprint 退化为插槽契约,Profile 自带 modules 选择。ProfileGroup 不存在或 modules 为空 * 时返空数组(与 dispatchGroup 行为一致——产出空段由 render 跳过)。 * * 这就是 v9 "Domain 同一份内容可贡献多聚合组" 的语义——Profile 引用的 Domain, * 只有其 H2 段匹配 ProfileGroup.modules 时才进当前聚合组。 * * v16:合并必填 (domains) + 可选 (optional-domains) 两路 ref,返 ResolveDomainsResult: * - 必填走旧路径(skipOnMissing=true,无 collectMissing)—— back-compat 行为不变 * - 可选走 collectMissing=true 路径—— 未解析 ref 收进 optionalMissing * - 可选 ref 解析成功但 H2 段全不匹配 modules → rawRef 收进 optionalNoMatch * export 是因为 asset-health.ts 的 scanProjectHealth 需要复用(§5 规则 6/7 报告)。 */ export declare function resolveDomains(profile: Profile, profileGroup: ProfileGroup | undefined, _bpGroup: BlueprintGroup, workingSet: SchemaBundle["workingSet"], loadedPackNames: string[]): ResolveDomainsResult; /** v15.x PR3b(§4.5.2):合并多份同 name asset 的同 H2 段内容(按 schema 分发 mixin)。 * * 场景 D/E(不同 pack 同 name)→ resolveAndDedupRefs 保留多份 → dispatchGroup 遍历多份。 * 本函数在调 renderer 前合并内容,让多份 asset 的同 H2 段 union 后渲染一次(§4.5.2 期望)。 * * 按 schema 分发: * - Term[](Scene/User/Agent/Participant):Map by Term.name,后写覆盖前写 * - Trigger 项[]:Map by name,后写覆盖前写 * - Rule[] / FlowTemplate[] / Checklist[]:Map by name,后写覆盖前写 * - 未知段(fallback):保守取首份——避免未知 schema 误合并 * * 单份 content(parts.length === 1)→ 原样返回(back-compat 零开销)。 * 所有 domain 都无该 section → undefined。 */ export declare function mergeSectionContent(domains: Domain[], section: string): unknown; /** * v9 dispatchGroup:按 modName 驱动聚合。 * - 遍历 profileGroup.modules(Profile 填的聚合标题列表) * - 每个 modName 调对应 moduleRenderers[modName] 渲染 * - renderer 内部按段名 spec 取内容格式(Phase term-P9.3:不再按 d.type 分发) * - inject 不在此判断——inject 决定注入位置,由 AgentAdapter 处理(compile 不感知 Agent) * * v9.1(modules-to-profile 迁移):modName 来源从 BlueprintGroup.modules 改为 * ProfileGroup.modules。Blueprint 退化为插槽契约(声明有哪些插槽 + inject + mode), * Profile 通过 H2 `### Modules` 填聚合标题列表。 */ export declare function dispatchGroup(profileGroup: ProfileGroup | undefined, bpGroup: BlueprintGroup, refDomains: Domain[]): string; type ModuleRenderer = (d: Domain, content: unknown, mode?: StructureLayout["mode"]) => string; /** 扩展接口:加新 modName 只加一行 + 一个 renderer 函数。 */ export declare function registerModuleRenderer(modName: string, fn: ModuleRenderer): void; /** v15.x PR2(§8.1):sourceHash 加 packs[].{name, rootDir}(不含 version/description)。 * pack 内容变化触发 cache 失效;pack version 变化不进 hash(M1:内容 hash 已覆盖)。 * pack 列表顺序敏感——dedupByNameN 后的 pack 顺序固定,添加 settings pack 会改 hash。 */ export declare function computeSourceHash(profile: Profile, blueprint: Blueprint, domains: Domain[], packs: AssetPack[]): string; export {};