2025-05-23 10:55:20 -07:00
/ * *
* OPFS BrainyData
* A vector database using HNSW indexing with Origin Private File System storage
* /
// Export main BrainyData class and related types
2025-05-29 09:52:30 -07:00
import { BrainyData , BrainyDataConfig } from './brainyData.js'
2025-05-23 10:55:20 -07:00
export { BrainyData }
export type { BrainyDataConfig }
// Export distance functions for convenience
2025-05-29 09:52:30 -07:00
import {
euclideanDistance ,
cosineDistance ,
manhattanDistance ,
dotProductDistance
} from './utils/index.js'
export {
euclideanDistance ,
cosineDistance ,
manhattanDistance ,
dotProductDistance
2025-05-23 10:55:20 -07:00
}
2025-05-27 13:58:49 -07:00
// Export embedding functionality
import {
UniversalSentenceEncoder ,
createEmbeddingFunction ,
2025-05-27 15:11:12 -07:00
createTensorFlowEmbeddingFunction ,
2025-05-27 13:58:49 -07:00
defaultEmbeddingFunction
2025-05-29 09:52:30 -07:00
} from './utils/embedding.js'
2025-05-27 13:58:49 -07:00
export {
UniversalSentenceEncoder ,
createEmbeddingFunction ,
2025-05-27 15:11:12 -07:00
createTensorFlowEmbeddingFunction ,
2025-05-27 13:58:49 -07:00
defaultEmbeddingFunction
}
2025-05-23 10:55:20 -07:00
// Export storage adapters
2025-05-29 09:52:30 -07:00
import {
OPFSStorage ,
MemoryStorage ,
createStorage
} from './storage/opfsStorage.js'
2025-06-04 10:00:38 -07:00
import { FileSystemStorage } from './storage/fileSystemStorage.js'
import { R2Storage , S3CompatibleStorage } from './storage/s3CompatibleStorage.js'
2025-05-29 09:52:30 -07:00
export {
OPFSStorage ,
MemoryStorage ,
2025-06-04 10:00:38 -07:00
FileSystemStorage ,
R2Storage ,
S3CompatibleStorage ,
2025-05-29 09:52:30 -07:00
createStorage
2025-05-23 10:55:20 -07:00
}
2025-05-27 10:08:01 -07:00
// Export augmentation pipeline
import {
AugmentationPipeline ,
augmentationPipeline ,
ExecutionMode ,
PipelineOptions
2025-05-29 09:52:30 -07:00
} from './augmentationPipeline.js'
2025-06-04 10:00:38 -07:00
// Export sequential pipeline
import {
SequentialPipeline ,
sequentialPipeline ,
PipelineResult ,
SequentialPipelineOptions
} from './sequentialPipeline.js'
2025-05-27 10:08:01 -07:00
export {
AugmentationPipeline ,
augmentationPipeline ,
2025-06-04 10:00:38 -07:00
ExecutionMode ,
SequentialPipeline ,
sequentialPipeline
2025-05-27 10:08:01 -07:00
}
2025-06-04 10:00:38 -07:00
export type { PipelineOptions , PipelineResult , SequentialPipelineOptions }
2025-05-27 10:08:01 -07:00
2025-05-29 09:52:30 -07:00
// Export augmentation registry for build-time loading
2025-05-28 15:39:14 -07:00
import {
2025-05-29 09:52:30 -07:00
availableAugmentations ,
registerAugmentation ,
initializeAugmentationPipeline ,
setAugmentationEnabled ,
getAugmentationsByType
} from './augmentationRegistry.js'
export {
availableAugmentations ,
registerAugmentation ,
initializeAugmentationPipeline ,
setAugmentationEnabled ,
getAugmentationsByType
}
// Export augmentation registry loader for build tools
import {
loadAugmentationsFromModules ,
createAugmentationRegistryPlugin ,
createAugmentationRegistryRollupPlugin
} from './augmentationRegistryLoader.js'
2025-05-28 15:39:14 -07:00
import type {
2025-05-29 09:52:30 -07:00
AugmentationRegistryLoaderOptions ,
AugmentationLoadResult
} from './augmentationRegistryLoader.js'
2025-05-28 15:39:14 -07:00
export {
2025-05-29 09:52:30 -07:00
loadAugmentationsFromModules ,
createAugmentationRegistryPlugin ,
createAugmentationRegistryRollupPlugin
2025-05-28 15:39:14 -07:00
}
export type {
2025-05-29 09:52:30 -07:00
AugmentationRegistryLoaderOptions ,
AugmentationLoadResult
2025-05-28 15:39:14 -07:00
}
2025-05-29 10:29:52 -07:00
// Export augmentation implementations
import {
2025-06-02 12:23:11 -07:00
MemoryStorageAugmentation ,
FileSystemStorageAugmentation ,
OPFSStorageAugmentation ,
createMemoryAugmentation
} from './augmentations/memoryAugmentations.js'
2025-06-06 08:48:50 -07:00
import {
WebSocketConduitAugmentation ,
WebRTCConduitAugmentation ,
createConduitAugmentation
} from './augmentations/conduitAugmentations.js'
2025-06-06 10:48:01 -07:00
import {
ServerSearchConduitAugmentation ,
ServerSearchActivationAugmentation ,
createServerSearchAugmentations
} from './augmentations/serverSearchAugmentations.js'
2025-05-29 10:29:52 -07:00
2025-06-19 14:59:42 -07:00
// Non-LLM exports
2025-05-29 10:29:52 -07:00
export {
2025-06-02 12:23:11 -07:00
MemoryStorageAugmentation ,
FileSystemStorageAugmentation ,
OPFSStorageAugmentation ,
2025-06-06 08:48:50 -07:00
createMemoryAugmentation ,
WebSocketConduitAugmentation ,
WebRTCConduitAugmentation ,
2025-06-06 10:48:01 -07:00
createConduitAugmentation ,
ServerSearchConduitAugmentation ,
ServerSearchActivationAugmentation ,
2025-06-19 14:59:42 -07:00
createServerSearchAugmentations
2025-05-29 10:29:52 -07:00
}
2025-06-19 14:59:42 -07:00
// LLM augmentations are optional and not imported by default
// They can be imported directly from their module if needed:
// import { LLMCognitionAugmentation, LLMActivationAugmentation, createLLMAugmentations } from './augmentations/llmAugmentations.js'
2025-05-29 09:52:30 -07:00
2025-05-23 10:55:20 -07:00
// Export types
import type {
Vector ,
VectorDocument ,
SearchResult ,
DistanceFunction ,
EmbeddingFunction ,
EmbeddingModel ,
2025-06-05 11:18:20 -07:00
HNSWNoun ,
GraphVerb ,
2025-05-23 10:55:20 -07:00
HNSWConfig ,
StorageAdapter
2025-05-29 09:52:30 -07:00
} from './coreTypes.js'
2025-06-19 14:59:42 -07:00
// Export HNSW index and optimized version
import { HNSWIndex } from './hnsw/hnswIndex.js'
import { HNSWIndexOptimized , HNSWOptimizedConfig } from './hnsw/hnswIndexOptimized.js'
export {
HNSWIndex ,
HNSWIndexOptimized
}
2025-05-23 10:55:20 -07:00
export type {
Vector ,
VectorDocument ,
SearchResult ,
DistanceFunction ,
EmbeddingFunction ,
EmbeddingModel ,
2025-06-05 11:18:20 -07:00
HNSWNoun ,
GraphVerb ,
2025-05-23 10:55:20 -07:00
HNSWConfig ,
2025-06-19 14:59:42 -07:00
HNSWOptimizedConfig ,
2025-05-23 10:55:20 -07:00
StorageAdapter
}
2025-05-27 10:08:01 -07:00
// Export augmentation types
import type {
IAugmentation ,
AugmentationResponse ,
2025-05-28 11:03:32 -07:00
IWebSocketSupport ,
ISenseAugmentation ,
IConduitAugmentation ,
ICognitionAugmentation ,
IMemoryAugmentation ,
IPerceptionAugmentation ,
IDialogAugmentation ,
IActivationAugmentation
2025-05-29 09:52:30 -07:00
} from './types/augmentations.js'
import { AugmentationType , BrainyAugmentations } from './types/augmentations.js'
2025-05-27 10:08:01 -07:00
export type {
IAugmentation ,
AugmentationResponse ,
2025-05-28 11:48:24 -07:00
IWebSocketSupport
}
export {
AugmentationType ,
BrainyAugmentations ,
2025-05-28 11:03:32 -07:00
ISenseAugmentation ,
IConduitAugmentation ,
ICognitionAugmentation ,
IMemoryAugmentation ,
IPerceptionAugmentation ,
IDialogAugmentation ,
IActivationAugmentation
2025-05-27 10:08:01 -07:00
}
// Export combined WebSocket augmentation interfaces
export type {
IWebSocketCognitionAugmentation ,
IWebSocketSenseAugmentation ,
IWebSocketPerceptionAugmentation ,
IWebSocketActivationAugmentation ,
IWebSocketDialogAugmentation ,
IWebSocketConduitAugmentation ,
IWebSocketMemoryAugmentation
2025-05-29 09:52:30 -07:00
} from './types/augmentations.js'
2025-05-28 11:31:10 -07:00
// Export graph types
import type {
GraphNoun ,
EmbeddedGraphVerb ,
Person ,
Place ,
Thing ,
Event ,
Concept ,
Content
2025-05-29 09:52:30 -07:00
} from './types/graphTypes.js'
import { NounType , VerbType } from './types/graphTypes.js'
2025-05-28 11:31:10 -07:00
export type {
GraphNoun ,
EmbeddedGraphVerb ,
Person ,
Place ,
Thing ,
Event ,
Concept ,
Content
}
export { NounType , VerbType }
**feat: add MCP service integration and enhance environment detection**
### Changes:
- Introduced `initializeMCPService` in `cloud-wrapper/src/index.ts` to support initializing Model Control Protocol (MCP) services.
- Enabled configuration for WebSocket and REST APIs with customizable options like ports, authentication, rate limiting, and CORS.
- Exported MCP modules, types, and services (`BrainyMCPAdapter`, `BrainyMCPService`, etc.) in `src/index.ts`.
- Enhanced `unified.ts` to include global environment detection by populating `globalThis.__ENV__`.
- Added environment-specific logging for browser, Node.js, and serverless scenarios.
- Improved the structure of `environment` object and its global accessibility.
### Purpose:
Implemented MCP service integration to expand Brainy's external compatibility via WebSocket and REST interfaces. Enhanced environment detection provides better global access and debugging insights, ensuring robust operation across various runtime environments.
2025-06-20 10:57:31 -07:00
// Export MCP (Model Control Protocol) components
import {
BrainyMCPAdapter ,
MCPAugmentationToolset ,
BrainyMCPService
} from './mcp/index.js' // Import from mcp/index.js
import {
MCPRequest ,
MCPResponse ,
MCPDataAccessRequest ,
MCPToolExecutionRequest ,
MCPSystemInfoRequest ,
MCPAuthenticationRequest ,
MCPRequestType ,
MCPServiceOptions ,
MCPTool ,
MCP_VERSION
} from './types/mcpTypes.js'
export {
// MCP classes
BrainyMCPAdapter ,
MCPAugmentationToolset ,
BrainyMCPService ,
// MCP types
MCPRequestType ,
MCP_VERSION
}
export type {
MCPRequest ,
MCPResponse ,
MCPDataAccessRequest ,
MCPToolExecutionRequest ,
MCPSystemInfoRequest ,
MCPAuthenticationRequest ,
MCPServiceOptions ,
MCPTool
}