- Remove top-level Node.js imports that break bundlers
- Use universal adapters for crypto operations
- Add dynamic imports for Node.js-specific modules
- Add browser field to package.json for bundler hints
- Maintain full Node.js functionality while enabling browser usage
This allows Brainy to be used with modern bundlers (Vite, Webpack, etc.)
without requiring Node.js polyfills. Browser environments get core features
while Node.js retains all capabilities including filesystem and networking.
- Updated all fs, path, crypto, os, url, util, events, http, https, net, child_process, stream, and zlib imports
- Changed both static imports and dynamic imports to use node: protocol
- This makes Brainy more bundler-friendly by explicitly marking Node.js built-ins
- Prevents bundlers from attempting to polyfill or bundle these modules
- Reduces bundle size for web applications using Brainy
- Improves tree-shaking and dead code elimination
Benefits for external bundlers:
- Clear distinction between Node.js built-ins and external dependencies
- No ambiguity about what needs polyfilling
- Smaller bundles for browser builds
- Better compatibility with modern bundlers (Webpack 5, Vite, Rollup, esbuild)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Unified embedding system with single EmbeddingManager
- Q8 model support with 75% smaller footprint (23MB vs 90MB)
- Intelligent precision auto-selection based on environment
- Clean cached embeddings with TTL and memory management
- Zero-config setup with smart defaults
- Complete storage structure documentation
- Removed legacy worker and hybrid managers
- Streamlined model configuration and precision management
- Changed confusing 'dtype' to 'precision' for model variant selection
- Fixed Q8 quantized model loading in transformers.js pipeline
- Added proper model file detection for q8 vs fp32 models
- Updated all references across codebase to use new parameter
- Maintains backward compatibility while providing clearer API
Changed default dtype from q8 to fp32 across all embedding implementations:
- embedding.ts: Default dtype changed to fp32
- worker-embedding.ts: Use fp32 for consistency
- universal-memory-manager.ts: Use fp32 for consistency
- lightweight-embedder.ts: Use fp32 for consistency
- hybridModelManager.ts: Use fp32 for all configurations
This ensures we use the exact same model (model.onnx) everywhere,
maintaining data compatibility and avoiding 404 errors for quantized models.
Models should download automatically when not present locally. Fixed the
environment variable check to only block downloads when explicitly set to 'false'
rather than blocking when undefined.