/** * Injectable part library — the seam that keeps proprietary catalogs OUT of * the engine package. * * The de:volt application ships a closed catalog with product metadata (BOM, * palette copy, teaching text). The engine only needs model identity: uid, * kind, default_params, pin ids/functions, electrical_specs, spice_model. * Hosts therefore INJECT their catalog via setPartLibrary(); the bundled * default-parts.json is an open, stripped subset sufficient for the engine * corpus (family-correct logic thresholds, regulator/LED/battery identities, * thermal package profiles). * * Module state is deliberate: catalog identity resolution happens deep inside * stamp paths (sim-engine partFor, thermal profile lookup) where threading a * catalog handle through every call would churn the entire engine API for a * value that is constant per host process. The version counter lets those * paths keep cheap memoization while remaining injection-reactive: any cache * derived from the library must be keyed on getPartLibraryVersion() so a * late setPartLibrary() call still takes effect (hosts are free to inject * after modules were imported and even after engines were constructed — * already-committed engine state keeps its old resolution until the next * load()). */ import type { PartDefinition } from "../circuit/types.js"; /** * The bundled open subset. Exposed so hosts can extend rather than replace: * setPartLibrary([...BUNDLED_DEFAULT_PARTS, ...customParts]). */ export declare const BUNDLED_DEFAULT_PARTS: readonly PartDefinition[]; /** * Replace the whole active part library. Replacement (not merge) keeps the * semantics predictable: the injected array is the complete identity universe, * so a host can also REMOVE bundled parts it does not want resolvable. */ export declare function setPartLibrary(parts: PartDefinition[]): void; export declare function getPartLibrary(): readonly PartDefinition[]; /** * Monotonic generation counter for the active library. Caches derived from * the library (catalog resolvers, thermal LED profiles, engine identity * caches) key on this instead of on array identity so they stay correct * across injections without holding the array alive. */ export declare function getPartLibraryVersion(): number; /** Restore the bundled defaults; primarily test hygiene between suites. */ export declare function resetPartLibrary(): void;