import type { AssetPack, Blueprint, Profile, WorkingSet } from "../schema.js"; /** 解析 ref → {kind, pack, name}。双层语义(§2.4.4): * - kind="location":位置 alias(prj/pt + project/builtin)→ 按 pack name 物理位置查 * - kind="identity":身份 alias(manifest.name)→ 按 pack.name 身份查 * 不限定 ref 自动绑定 selfPack(kind="identity")。 * 畸形输入抛异常(§4.5.1 运行时校验)。 */ export declare function parseRef(raw: string, selfPack: string): { kind: "location" | "identity"; pack: string; name: string; }; /** 判断 raw 是否限定 ref(以 @ 开头)。诊断用。 */ export declare function isQualifiedRef(raw: string): boolean; /** 位置 alias 归一(project → prj 等)。非位置 alias 原样返回。 * 与 parseRef 的 kind="location" 分支语义一致——独立暴露便于诊断。 */ export declare function normalizePackName(raw: string): string; /** v15.x PR6(fix pt-parse-blueprint-warn-misleading):跨 pack Blueprint 解析。 * v15.x §4.4.2:workingSet 改为双索引 WorkingSet——按 parseRef 的 kind 分发查询: * - kind="location":查 location 索引(位置 alias 短名) * - kind="identity":查 identity 索引(manifest.name) * - 限定 ref(@pack/name):只在目标 pack 查;查不到返 undefined(精确语义) * - 不限定 ref(foo):先在 self.sourcePack 查;查不到按 packNames 顺序 fallback * - 与 transpile 阶段(§4.6 back-compat)行为等价——parse 阶段不再单独报 * "unknown Blueprint" warn(false positive),统一交给 compile 阶段 throw。 * * 设计:parse 和 compile 共用同一份 fallback 逻辑,避免行为漂移。 * packNames 顺序 = [project, ...settings.reverse(), builtin],前者赢。 * fallback 时跳过 selfPack(已查过),按声明顺序查后续 pack(查 identity 索引,因 packNames 都是 pack.name = manifest.name)。 */ export declare function resolveBlueprint(profile: { blueprint: string; sourcePack?: string; }, blueprintWS: WorkingSet, packNames: readonly string[]): { pack: AssetPack; asset: Blueprint; } | undefined; /** v15.x PR3(§4.4.2):fingerprint = sha256(rootDir + content)。 * - rootDir 不同 → fp 不同(避免不同 pack 偶然同内容被合并) * - content 不同 → fp 不同 * 用于 resolveAndDedupRefs 的 dedup by fp(后者覆盖前者)。 */ export declare function fingerprint(pack: AssetPack, asset: T): string; /** v15.x §4.4.2(双层语义):解析 refs + fingerprint dedup(后者覆盖前者)。 * workingSet 改为 WorkingSet 双索引——按 parseRef 的 kind 分发查询: * - kind="location":查 location 索引(位置 alias 短名) * - kind="identity":查 identity 索引(manifest.name) * fallback 查其他 pack 时查 identity 索引(packNames 是 manifest.name 列表)。 * * 阶段 1:所有 ref 解析为 {pack, asset, fp, rawRef}(保留原顺序) * 阶段 2:dedup by fp——Map.set 同 fp 后写覆盖前写 = 后者赢 * * 返回值按首次插入顺序,值=最后写入的 ref(同 fp 后者赢)。 * 场景 A/B/C(同 fp)→ dedup 后 1 份;场景 D/E/F(不同 fp)→ 保留多份。 * * 错误信息含 loadedPackNames 帮用户定位(§4.5.1)。 */ export interface ResolveResult { resolved: Array<{ pack: AssetPack; asset: T; fp: string; rawRef: string; }>; /** collectMissing=true 时收集未解析的 ref(skipOnMissing=true 且找不到的 raw 字符串)。 */ missing?: string[]; } export declare function resolveAndDedupRefs(refs: string[], self: Profile, workingSet: WorkingSet, loadedPackNames: string[], options?: { skipOnMissing?: boolean; collectMissing?: boolean; }): ResolveResult;