Commit graph

12 commits

Author SHA1 Message Date
89d6d1e8ce feat: add Cortex - complete CLI command center for configuration and coordination
- New CLI tool for managing Brainy databases
- Encrypted configuration management (replaces .env files)
- Distributed storage migration coordination
- Advanced MongoDB-style query interface
- Backup/restore, health checks, statistics
- Interactive shell mode
- One-line integration: await brainy.loadEnvironment()
- Full documentation and migration guides
- Node.js only (browser safe with environment detection)

BREAKING CHANGE: Package size increased ~250KB due to CLI dependencies
2025-08-07 13:53:17 -07:00
06f502ec4a feat: add direct storage access in write-only mode for efficient deduplication
Enables ID-based lookups in write-only mode without loading search indexes, solving the fundamental conflict between write-only optimization and deduplication needs.

Key Features:
- New allowDirectReads configuration option
- Direct storage methods: has(), exists(), getMetadata(), getBatch()
- Enhanced get() and getVerb() support in write-only mode
- Smart operation separation (storage vs. search operations)

Use Cases:
- Bluesky services: Avoid redundant profile API calls
- GitHub packages: Efficient user processing with existence checks
- General writer services: Smart deduplication without search overhead

Performance Benefits:
- 50-100% reduction in external API calls
- No search index memory usage
- Fast direct storage lookups
- Optimal for high-throughput data ingestion

Configuration:
const brainy = new BrainyData({
  writeOnly: true,        // Skip search index loading
  allowDirectReads: true  // Enable direct ID lookups
})

Includes comprehensive tests (26/26 passing), real-world demo, and complete README documentation with configuration examples.
2025-08-07 07:57:41 -07:00
ee003a9473 feat: add zero-configuration Brainy service template with augmentation-first architecture
- Implement WebSocket augmentation for real-time communication
- Implement WebRTC augmentation for peer-to-peer connections
- Implement HTTP augmentation as minimal REST fallback
- Add auto-discovery augmentation for data pattern analysis
- Add adaptive storage augmentation for intelligent resource management
- Add environment adapter augmentation for universal compatibility
- Template auto-detects environment (browser, Node.js, serverless, containers)
- Intelligent transport selection (WebRTC → WebSocket → HTTP)
- Automatic storage optimization (memory → filesystem → S3)
- Zero configuration required - just npm start
- Includes intelligent verb scoring by default
- Works in any environment without configuration
- Full documentation and examples included
2025-08-06 18:17:32 -07:00
b1bc455810 fix: update Dockerfile and README to replace model extraction with download 2025-08-05 20:39:39 -07:00
d3ff38174c fix: update Dockerfile to reflect model download instead of extraction 2025-08-05 20:19:02 -07:00
cff9ae8215 feat: add GPU acceleration for embeddings with smart device auto-detection
Add comprehensive GPU support for embedding generation while maintaining optimized CPU processing for distance calculations:

- Add device option to TransformerEmbeddingOptions (auto, cpu, webgpu, cuda, gpu)
- Implement smart auto-detection of best available GPU (WebGPU for browsers, CUDA for Node.js)
- Add automatic CPU fallback if GPU initialization fails
- Fix misleading GPU acceleration claims in distance functions and HNSW search
- Update documentation to accurately reflect GPU usage (embeddings only)
- Add comprehensive example demonstrating GPU acceleration usage
- Maintain full backward compatibility with existing code

Performance improvements: 3-5x faster embedding generation when GPU is available, while keeping faster CPU processing for 384-dim vector distance calculations.
2025-08-05 20:00:04 -07:00
52a43d51d4 refactor: simplify build system and improve model loading flexibility
- Remove Rollup bundling in favor of direct TypeScript compilation
- Move from bundled models to dynamic model loading with configurable paths
- Add Docker deployment examples and documentation
- Implement robust model loader with fallback mechanisms
- Update storage adapters for better cross-environment compatibility
- Add comprehensive tests for model loading and package installation
- Simplify package.json scripts and remove complex build configurations
- Clean up deprecated demo files and old bundling scripts

BREAKING CHANGE: Models are no longer bundled with the package. They are now loaded dynamically from CDN or custom paths.
2025-08-05 16:09:30 -07:00
17bd7ab42d **feat(utils): add type utility functions and examples for runtime type management**
- Introduced `getNounTypes`, `getVerbTypes`, `getNounTypeMap`, and `getVerbTypeMap` utilities for managing noun and verb types at runtime.
- Added comprehensive unit tests (`type-utils.test.ts`) to ensure correctness of type utility functions.
- Created new example files (`type-utils-example.js`, `type-utils-example.ts`) to demonstrate the use of type utilities in JavaScript and TypeScript environments.
- Updated `README.md` with detailed documentation and usage examples for the new type utilities.
- Enhanced `index.ts` to export the new utility functions, making them accessible throughout the library.

**Purpose**: Facilitate easy access, validation, and manipulation of noun and verb types in client applications, providing better runtime type management.
2025-07-31 14:24:16 -07:00
5d82db12e2 **feat: add write-only mode support and example usage**
- Introduced `writeOnly` mode in `BrainyData` allowing optimized data ingestion by skipping index loading and disabling search operations.
- Enhanced `BrainyDataConfig` to include `writeOnly` support and validate compatibility with `readOnly` mode.
- Implemented error handling for search attempts during `writeOnly` mode.
- Updated the README with detailed usage examples for database modes, including `writeOnly` and `readOnly`.
- Added `examples/write-only-mode.js` to demonstrate practical applications of the `writeOnly` mode.

**Purpose**: Optimize memory usage and startup time for data ingestion scenarios by enabling write-only mode with comprehensive documentation and examples.
2025-07-30 13:32:30 -07:00
b81129276c **feat(examples, core, docs): add flushStatistics example, implementation, and documentation**
- **Examples**: Added a new `flush-statistics-example.js` script to demonstrate the usage of the `flushStatistics` method for ensuring updated statistics after data insertion.
- **Core**:
  - Implemented `flushStatistics` in the `BrainyData` class to allow immediate flushing of statistics to storage.
  - Updated `BaseStorageAdapter` with `flushStatisticsToStorage` to support flushing cached statistics.
  - Modified the `shutDown` method to ensure statistics are flushed before database shutdown.
- **Documentation**: Added `statistics-flush-solution.md` to explain the batch update mechanism, the issue with delayed statistics updates, and how to manually flush statistics in storage.

**Purpose**: Provide users with the ability to manually flush statistics for real-time accuracy, particularly useful for systems relying on immediate updates. Improved documentation and examples to guide developers in implementing and using this functionality effectively.
2025-07-25 10:55:37 -07:00
6e0045a6f1 **style(cli): update examples with consistent formatting and clean code**
- Removed extraneous semicolons across `cli-wrapper-example.js` for cleaner, consistent code style.
- Adjusted indentation and spacing for improved readability.
- Updated console statements to be consistent, ensuring uniform logging behavior across the example.

This change aligns the example file with the project's coding standards, improving code clarity and maintainability.
2025-07-15 11:53:42 -07:00
19ed3dd081 **refactor(tests): consolidate and replace outdated environment test scripts**
- Removed obsolete scripts: `test-all-environments.js`, `test-fallback-function.js`, `test-fallback-simple.js`, `test-fix.js`, `test-tensorflow-textencoder.js`, `test-unified-encoding.js`, and `test-worker-utils.js`.
- Introduced `scripts/comprehensive-test.js` as a unified testing script covering all environments: Browser, Node.js, and CLI.
- Added `examples/cli-wrapper-example.js` to demonstrate a proper CLI implementation with TensorFlow.js initialization.

This refactor simplifies the testing structure by consolidating redundant scripts into a single comprehensive script while ensuring robust cross-environment coverage.
2025-07-14 11:12:51 -07:00