/** * TotalReclaw LSH Hasher (WASM-backed) * * Thin wrapper over `WasmLshHasher` from `@totalreclaw/core`. Same class * interface as the previous pure-TS implementation so callers don't need * to change. * * Default parameters: * - 32 bits per table (balanced discrimination vs. recall) * - 20 tables (moderate table count for good coverage) * * Matches mcp/src/subgraph/lsh.ts exactly. */ /** * Random Hyperplane LSH hasher. * * All state is deterministic from the seed -- no randomness at hash time. * Construct once per session; call `hash()` for every store/search operation. */ export declare class LSHHasher { private inner; /** Embedding dimensionality (cached for error messages). */ private readonly dims; /** * Create a new LSH hasher. * * @param seed - 32-byte seed from `deriveLshSeed()` in seed.ts. * @param dims - Embedding dimensionality (e.g. 640 for Harrier-OSS-v1-270M). * @param nTables - Number of independent hash tables (default 20). * @param nBits - Number of bits per table (default 32). */ constructor(seed: Uint8Array, dims: number, nTables?: number, nBits?: number); /** * Hash an embedding vector to an array of blind-hashed bucket IDs. * * For each table: * 1. Compute the N-bit signature (sign of dot product with each hyperplane). * 2. Build the bucket string: `lsh_t{tableIndex}_{binarySignature}`. * 3. SHA-256 the bucket string to produce a blind hash (hex). * * @param embedding - The embedding vector (must have `dims` elements). * @returns Array of `nTables` hex strings (one blind hash per table). */ hash(embedding: number[]): string[]; /** Number of hash tables. */ get tables(): number; /** Number of bits per table. */ get bits(): number; /** Embedding dimensionality. */ get dimensions(): number; } /** * Compute the Hamming distance between two binary signature strings. * * @param bucket1 - First bucket ID (binary string) * @param bucket2 - Second bucket ID (binary string) * @returns Number of differing bits */ export declare function hammingDistance(bucket1: string, bucket2: string): number; /** * Estimate similarity from Hamming distance. * * For random hyperplane LSH, the expected Hamming distance * is proportional to the angle between vectors. */ export declare function estimateSimilarity(hammingDist: number, nBits: number): number; //# sourceMappingURL=hyperplane.d.ts.map