/**
 * 统一契约注册表 — 内部共享函数
 *
 * 此模块导出 getRegistry 和 cloneEntry，仅供 contract_registry/ 目录内部使用。
 * 外部消费者不应直接导入此模块。
 */
import { BUILTIN_CONTRACTS_CORE_1 } from "./builtin_contracts_core.js";
import { BUILTIN_CONTRACTS_CORE_2 } from "./builtin_contracts_core_2.js";
import { BUILTIN_CONTRACTS_EXTENDED } from "./builtin_contracts_extended.js";
// ── 内置契约注册表 ──
const BUILTIN_CONTRACTS = [
    ...BUILTIN_CONTRACTS_CORE_1,
    ...BUILTIN_CONTRACTS_CORE_2,
    ...BUILTIN_CONTRACTS_EXTENDED,
];
// ── 运行时注册表（允许动态添加，用于测试和扩展） ──
let runtimeEntries = null;
export function getRegistry() {
    if (!runtimeEntries) {
        runtimeEntries = new Map();
        for (const entry of BUILTIN_CONTRACTS) {
            runtimeEntries.set(entry.contract_id, cloneEntry(entry));
        }
    }
    return runtimeEntries;
}
export function cloneEntry(e) {
    return {
        ...e,
        owner_files: [...e.owner_files],
        test_files: [...e.test_files],
        lifecycle_test_files: [...e.lifecycle_test_files],
        knowledge_refs: [...e.knowledge_refs],
        prompt_refs: [...e.prompt_refs],
        depends_on: [...e.depends_on],
        consumed_by: [...e.consumed_by],
        promotion_conditions: [...e.promotion_conditions],
        demotion_conditions: [...e.demotion_conditions],
        evidence_requirements: [...e.evidence_requirements],
        capability_ids: e.capability_ids ? [...e.capability_ids] : undefined,
    };
}
/** 重置运行时注册表为内置契约（用于测试清理） */
export function resetRegistry() {
    runtimeEntries = null;
}
//# sourceMappingURL=registry_internal.js.map