/** * Installed-module registry + delivery-backed installer for the browser/Helia * node (WS4.5). Tracks which modules are installed, persists across sessions via * a pluggable RegistryStore (localStorage/IndexedDB in the browser, in-memory in * tests), and provides the per-module fetch -> decrypt -> register step the * dependency installer drives (installClosure). */ import type { InstalledModules, InstallFn, PlanStep } from './module-dependency-resolver'; export interface InstalledModuleRecord { pluginId: string; version: string; installedAtMs?: number; } /** RegistryStore persists the registry as a JSON-serializable snapshot. */ export interface RegistryStore { load(): InstalledModuleRecord[]; save(records: InstalledModuleRecord[]): void; } /** In-memory RegistryStore for tests / ephemeral nodes. */ export declare class MemoryRegistryStore implements RegistryStore { private snapshot; load(): InstalledModuleRecord[]; save(records: InstalledModuleRecord[]): void; } /** localStorage/Storage-backed RegistryStore (browser). */ export declare class LocalStorageRegistryStore implements RegistryStore { private readonly storage; private readonly key; constructor(storage: Pick, key?: string); load(): InstalledModuleRecord[]; save(records: InstalledModuleRecord[]): void; } /** * InstalledModuleRegistry is the browser node's catalog of installed modules. It * implements InstalledModules so the dependency resolver skips modules already * present, and persists through an optional RegistryStore. */ export declare class InstalledModuleRegistry implements InstalledModules { private readonly store?; private readonly records; constructor(store?: RegistryStore | undefined); installedVersion(pluginId: string): string | undefined; has(pluginId: string): boolean; list(): InstalledModuleRecord[]; record(rec: InstalledModuleRecord): void; remove(pluginId: string): void; } /** * FetchAndDecrypt fetches + decrypts a module's WASM bytes for a plan step. In * the browser this wraps requestEncryptedModuleBundle + the client-decrypt * module; tests inject a fake. */ export type FetchAndDecrypt = (step: PlanStep) => Promise; /** RegisterModule loads/registers decrypted module bytes into the runtime. */ export type RegisterModule = (step: PlanStep, wasmBytes: Uint8Array) => Promise; export interface ModuleInstallerOptions { fetchAndDecrypt: FetchAndDecrypt; register: RegisterModule; registry: InstalledModuleRegistry; nowMs?: () => number; } /** * createModuleInstaller returns an InstallFn that fetches + decrypts a module, * registers it into the runtime, and records it in the installed registry — the * per-module fetch -> decrypt -> register step installClosure drives, once per * module in dependency-first order. Already-installed modules are skipped. */ export declare function createModuleInstaller(options: ModuleInstallerOptions): InstallFn; //# sourceMappingURL=installed-module-registry.d.ts.map