declare global { interface FileSystemFileHandle { createSyncAccessHandle(): Promise; } interface FileSystemSyncAccessHandle { close(): void; } } /** Mirrors `bindings/wasm/src/lib.rs`'s `#[wasm_bindgen]` exports. Can drift if that changes. */ interface NidusHandleInstance { upsert(collection: string, records: unknown): number; search(collection: string, query: number[], topK: number): unknown; flush(): void; close(): void; } interface NidusHandleClass { open(location: string, dimension: number): NidusHandleInstance; } interface OpfsPoolOptions { /** Handles opened per grow (directory slot + body slots). Defaults to 8. */ slots?: number; /** Directory name under the OPFS root to open slot files in. Defaults to "nidus". */ dir?: string; } interface OpfsPool { /** The store constructor, ready to use: the pool it needs is already registered. */ readonly NidusHandle: NidusHandleClass; /** Open `slots` more handles and register them with the wasm pool (async growth step). */ grow(): Promise; /** Run `writeOnce`; on a pool-exhausted error, grow the pool once and retry. */ withPoolGrowth(writeOnce: () => T): Promise; } /** * Load the wasm module and open+register an initial pool of OPFS sync access handles. * Mirrors `bindings/wasm/demo/worker.js`'s `openSlots`/`withPoolGrowth` (:17-25, :36-44). */ declare function acquireOpfsPool(opts?: OpfsPoolOptions): Promise; export { type NidusHandleClass, type NidusHandleInstance, type OpfsPool, type OpfsPoolOptions, acquireOpfsPool };