@soulcraft/brainy 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/CHANGELOG.md +53 -3
  2. package/README.md +353 -110
  3. package/bin/brainy.js +340 -62
  4. package/dist/api/ConfigAPI.d.ts +67 -0
  5. package/dist/api/ConfigAPI.js +166 -0
  6. package/dist/api/DataAPI.d.ts +123 -0
  7. package/dist/api/DataAPI.js +391 -0
  8. package/dist/api/SecurityAPI.d.ts +50 -0
  9. package/dist/api/SecurityAPI.js +139 -0
  10. package/dist/api/UniversalImportAPI.d.ts +134 -0
  11. package/dist/api/UniversalImportAPI.js +615 -0
  12. package/dist/augmentationManager.js +12 -7
  13. package/dist/augmentationPipeline.d.ts +0 -61
  14. package/dist/augmentationPipeline.js +0 -87
  15. package/dist/augmentationRegistry.d.ts +1 -1
  16. package/dist/augmentationRegistry.js +1 -1
  17. package/dist/augmentations/apiServerAugmentation.d.ts +27 -1
  18. package/dist/augmentations/apiServerAugmentation.js +290 -9
  19. package/dist/augmentations/auditLogAugmentation.d.ts +109 -0
  20. package/dist/augmentations/auditLogAugmentation.js +358 -0
  21. package/dist/augmentations/batchProcessingAugmentation.d.ts +3 -2
  22. package/dist/augmentations/batchProcessingAugmentation.js +123 -22
  23. package/dist/augmentations/brainyAugmentation.d.ts +142 -8
  24. package/dist/augmentations/brainyAugmentation.js +179 -2
  25. package/dist/augmentations/cacheAugmentation.d.ts +8 -5
  26. package/dist/augmentations/cacheAugmentation.js +116 -17
  27. package/dist/augmentations/conduitAugmentations.d.ts +2 -2
  28. package/dist/augmentations/conduitAugmentations.js +2 -2
  29. package/dist/augmentations/configResolver.d.ts +122 -0
  30. package/dist/augmentations/configResolver.js +440 -0
  31. package/dist/augmentations/connectionPoolAugmentation.d.ts +3 -1
  32. package/dist/augmentations/connectionPoolAugmentation.js +37 -12
  33. package/dist/augmentations/defaultAugmentations.d.ts +14 -10
  34. package/dist/augmentations/defaultAugmentations.js +16 -11
  35. package/dist/augmentations/discovery/catalogDiscovery.d.ts +142 -0
  36. package/dist/augmentations/discovery/catalogDiscovery.js +249 -0
  37. package/dist/augmentations/discovery/localDiscovery.d.ts +84 -0
  38. package/dist/augmentations/discovery/localDiscovery.js +246 -0
  39. package/dist/augmentations/discovery/runtimeLoader.d.ts +97 -0
  40. package/dist/augmentations/discovery/runtimeLoader.js +337 -0
  41. package/dist/augmentations/discovery.d.ts +152 -0
  42. package/dist/augmentations/discovery.js +441 -0
  43. package/dist/augmentations/display/cache.d.ts +130 -0
  44. package/dist/augmentations/display/cache.js +319 -0
  45. package/dist/augmentations/display/fieldPatterns.d.ts +52 -0
  46. package/dist/augmentations/display/fieldPatterns.js +393 -0
  47. package/dist/augmentations/display/iconMappings.d.ts +57 -0
  48. package/dist/augmentations/display/iconMappings.js +68 -0
  49. package/dist/augmentations/display/intelligentComputation.d.ts +109 -0
  50. package/dist/augmentations/display/intelligentComputation.js +462 -0
  51. package/dist/augmentations/display/types.d.ts +203 -0
  52. package/dist/augmentations/display/types.js +7 -0
  53. package/dist/augmentations/entityRegistryAugmentation.d.ts +3 -1
  54. package/dist/augmentations/entityRegistryAugmentation.js +5 -1
  55. package/dist/augmentations/indexAugmentation.d.ts +5 -3
  56. package/dist/augmentations/indexAugmentation.js +5 -2
  57. package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +24 -7
  58. package/dist/augmentations/intelligentVerbScoringAugmentation.js +111 -27
  59. package/dist/augmentations/manifest.d.ts +176 -0
  60. package/dist/augmentations/manifest.js +8 -0
  61. package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +168 -0
  62. package/dist/augmentations/marketplace/AugmentationMarketplace.js +329 -0
  63. package/dist/augmentations/marketplace/cli.d.ts +47 -0
  64. package/dist/augmentations/marketplace/cli.js +265 -0
  65. package/dist/augmentations/metricsAugmentation.d.ts +3 -3
  66. package/dist/augmentations/metricsAugmentation.js +2 -2
  67. package/dist/augmentations/monitoringAugmentation.d.ts +3 -3
  68. package/dist/augmentations/monitoringAugmentation.js +2 -2
  69. package/dist/augmentations/neuralImport.d.ts +1 -1
  70. package/dist/augmentations/neuralImport.js +4 -4
  71. package/dist/augmentations/rateLimitAugmentation.d.ts +82 -0
  72. package/dist/augmentations/rateLimitAugmentation.js +321 -0
  73. package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +2 -2
  74. package/dist/augmentations/requestDeduplicatorAugmentation.js +1 -1
  75. package/dist/augmentations/storageAugmentation.d.ts +1 -1
  76. package/dist/augmentations/storageAugmentation.js +2 -2
  77. package/dist/augmentations/storageAugmentations.d.ts +37 -8
  78. package/dist/augmentations/storageAugmentations.js +204 -15
  79. package/dist/augmentations/synapseAugmentation.d.ts +1 -1
  80. package/dist/augmentations/synapseAugmentation.js +35 -16
  81. package/dist/augmentations/typeMatching/brainyTypes.d.ts +83 -0
  82. package/dist/augmentations/typeMatching/brainyTypes.js +425 -0
  83. package/dist/augmentations/typeMatching/intelligentTypeMatcher.d.ts +39 -59
  84. package/dist/augmentations/typeMatching/intelligentTypeMatcher.js +103 -389
  85. package/dist/augmentations/universalDisplayAugmentation.d.ts +191 -0
  86. package/dist/augmentations/universalDisplayAugmentation.js +371 -0
  87. package/dist/brainy-unified.d.ts +106 -0
  88. package/dist/brainy-unified.js +327 -0
  89. package/dist/brainy.d.ts +273 -0
  90. package/dist/brainy.js +1181 -0
  91. package/dist/brainyData.d.ts +56 -111
  92. package/dist/brainyData.js +912 -756
  93. package/dist/brainyDataV3.d.ts +186 -0
  94. package/dist/brainyDataV3.js +337 -0
  95. package/dist/browserFramework.d.ts +6 -6
  96. package/dist/browserFramework.js +11 -8
  97. package/dist/browserFramework.minimal.d.ts +5 -5
  98. package/dist/browserFramework.minimal.js +11 -8
  99. package/dist/config/distributedPresets-new.d.ts +118 -0
  100. package/dist/config/distributedPresets-new.js +318 -0
  101. package/dist/config/distributedPresets.d.ts +118 -0
  102. package/dist/config/distributedPresets.js +318 -0
  103. package/dist/config/extensibleConfig.d.ts +99 -0
  104. package/dist/config/extensibleConfig.js +268 -0
  105. package/dist/config/index.d.ts +17 -0
  106. package/dist/config/index.js +35 -0
  107. package/dist/config/modelAutoConfig.d.ts +32 -0
  108. package/dist/config/modelAutoConfig.js +139 -0
  109. package/dist/config/modelPrecisionManager.d.ts +42 -0
  110. package/dist/config/modelPrecisionManager.js +98 -0
  111. package/dist/config/sharedConfigManager.d.ts +67 -0
  112. package/dist/config/sharedConfigManager.js +215 -0
  113. package/dist/config/storageAutoConfig.d.ts +41 -0
  114. package/dist/config/storageAutoConfig.js +328 -0
  115. package/dist/config/zeroConfig.d.ts +68 -0
  116. package/dist/config/zeroConfig.js +301 -0
  117. package/dist/cortex/backupRestore.d.ts +2 -2
  118. package/dist/cortex/backupRestore.js +85 -27
  119. package/dist/cortex/healthCheck.d.ts +2 -2
  120. package/dist/cortex/neuralImport.d.ts +2 -2
  121. package/dist/cortex/neuralImport.js +18 -13
  122. package/dist/cortex/performanceMonitor.d.ts +2 -2
  123. package/dist/critical/model-guardian.d.ts +4 -0
  124. package/dist/critical/model-guardian.js +31 -11
  125. package/dist/demo.d.ts +4 -4
  126. package/dist/demo.js +7 -7
  127. package/dist/distributed/cacheSync.d.ts +112 -0
  128. package/dist/distributed/cacheSync.js +265 -0
  129. package/dist/distributed/coordinator.d.ts +193 -0
  130. package/dist/distributed/coordinator.js +548 -0
  131. package/dist/distributed/httpTransport.d.ts +120 -0
  132. package/dist/distributed/httpTransport.js +446 -0
  133. package/dist/distributed/index.d.ts +8 -0
  134. package/dist/distributed/index.js +5 -0
  135. package/dist/distributed/networkTransport.d.ts +132 -0
  136. package/dist/distributed/networkTransport.js +633 -0
  137. package/dist/distributed/queryPlanner.d.ts +104 -0
  138. package/dist/distributed/queryPlanner.js +327 -0
  139. package/dist/distributed/readWriteSeparation.d.ts +134 -0
  140. package/dist/distributed/readWriteSeparation.js +350 -0
  141. package/dist/distributed/shardManager.d.ts +114 -0
  142. package/dist/distributed/shardManager.js +357 -0
  143. package/dist/distributed/shardMigration.d.ts +110 -0
  144. package/dist/distributed/shardMigration.js +289 -0
  145. package/dist/distributed/storageDiscovery.d.ts +160 -0
  146. package/dist/distributed/storageDiscovery.js +551 -0
  147. package/dist/embeddings/CachedEmbeddings.d.ts +40 -0
  148. package/dist/embeddings/CachedEmbeddings.js +146 -0
  149. package/dist/embeddings/EmbeddingManager.d.ts +102 -0
  150. package/dist/embeddings/EmbeddingManager.js +291 -0
  151. package/dist/embeddings/SingletonModelManager.d.ts +95 -0
  152. package/dist/embeddings/SingletonModelManager.js +220 -0
  153. package/dist/embeddings/index.d.ts +12 -0
  154. package/dist/embeddings/index.js +16 -0
  155. package/dist/embeddings/lightweight-embedder.d.ts +0 -1
  156. package/dist/embeddings/lightweight-embedder.js +4 -12
  157. package/dist/embeddings/model-manager.d.ts +11 -0
  158. package/dist/embeddings/model-manager.js +43 -7
  159. package/dist/embeddings/universal-memory-manager.d.ts +1 -1
  160. package/dist/embeddings/universal-memory-manager.js +27 -67
  161. package/dist/embeddings/worker-embedding.js +4 -8
  162. package/dist/errors/brainyError.d.ts +5 -1
  163. package/dist/errors/brainyError.js +12 -0
  164. package/dist/examples/basicUsage.js +7 -4
  165. package/dist/graph/graphAdjacencyIndex.d.ts +96 -0
  166. package/dist/graph/graphAdjacencyIndex.js +288 -0
  167. package/dist/graph/pathfinding.js +4 -2
  168. package/dist/hnsw/scaledHNSWSystem.js +11 -2
  169. package/dist/importManager.js +8 -5
  170. package/dist/index.d.ts +17 -22
  171. package/dist/index.js +37 -23
  172. package/dist/mcp/brainyMCPAdapter.d.ts +4 -4
  173. package/dist/mcp/brainyMCPAdapter.js +5 -5
  174. package/dist/mcp/brainyMCPService.d.ts +3 -3
  175. package/dist/mcp/brainyMCPService.js +3 -11
  176. package/dist/mcp/mcpAugmentationToolset.js +20 -30
  177. package/dist/neural/embeddedPatterns.d.ts +1 -1
  178. package/dist/neural/embeddedPatterns.js +2 -2
  179. package/dist/neural/entityExtractor.d.ts +65 -0
  180. package/dist/neural/entityExtractor.js +316 -0
  181. package/dist/neural/improvedNeuralAPI.d.ts +357 -0
  182. package/dist/neural/improvedNeuralAPI.js +2628 -0
  183. package/dist/neural/naturalLanguageProcessor.d.ts +155 -10
  184. package/dist/neural/naturalLanguageProcessor.js +941 -66
  185. package/dist/neural/naturalLanguageProcessorStatic.d.ts +2 -2
  186. package/dist/neural/naturalLanguageProcessorStatic.js +3 -3
  187. package/dist/neural/neuralAPI.js +8 -2
  188. package/dist/neural/patternLibrary.d.ts +57 -3
  189. package/dist/neural/patternLibrary.js +348 -13
  190. package/dist/neural/staticPatternMatcher.d.ts +2 -2
  191. package/dist/neural/staticPatternMatcher.js +2 -2
  192. package/dist/neural/types.d.ts +287 -0
  193. package/dist/neural/types.js +24 -0
  194. package/dist/shared/default-augmentations.d.ts +3 -3
  195. package/dist/shared/default-augmentations.js +5 -5
  196. package/dist/storage/adapters/baseStorageAdapter.d.ts +42 -0
  197. package/dist/storage/adapters/fileSystemStorage.d.ts +26 -2
  198. package/dist/storage/adapters/fileSystemStorage.js +218 -15
  199. package/dist/storage/adapters/memoryStorage.d.ts +4 -4
  200. package/dist/storage/adapters/memoryStorage.js +17 -12
  201. package/dist/storage/adapters/opfsStorage.d.ts +2 -2
  202. package/dist/storage/adapters/opfsStorage.js +2 -2
  203. package/dist/storage/adapters/s3CompatibleStorage.d.ts +2 -2
  204. package/dist/storage/adapters/s3CompatibleStorage.js +2 -2
  205. package/dist/storage/backwardCompatibility.d.ts +10 -78
  206. package/dist/storage/backwardCompatibility.js +17 -132
  207. package/dist/storage/baseStorage.d.ts +18 -2
  208. package/dist/storage/baseStorage.js +74 -3
  209. package/dist/storage/cacheManager.js +2 -2
  210. package/dist/storage/readOnlyOptimizations.js +8 -3
  211. package/dist/streaming/pipeline.d.ts +154 -0
  212. package/dist/streaming/pipeline.js +551 -0
  213. package/dist/triple/TripleIntelligence.d.ts +25 -110
  214. package/dist/triple/TripleIntelligence.js +4 -574
  215. package/dist/triple/TripleIntelligenceSystem.d.ts +159 -0
  216. package/dist/triple/TripleIntelligenceSystem.js +519 -0
  217. package/dist/types/apiTypes.d.ts +278 -0
  218. package/dist/types/apiTypes.js +33 -0
  219. package/dist/types/brainy.types.d.ts +308 -0
  220. package/dist/types/brainy.types.js +8 -0
  221. package/dist/types/brainyDataInterface.d.ts +5 -8
  222. package/dist/types/brainyDataInterface.js +2 -2
  223. package/dist/types/graphTypes.js +2 -2
  224. package/dist/utils/brainyTypes.d.ts +217 -0
  225. package/dist/utils/brainyTypes.js +261 -0
  226. package/dist/utils/cacheAutoConfig.d.ts +3 -3
  227. package/dist/utils/embedding.d.ts +9 -4
  228. package/dist/utils/embedding.js +89 -26
  229. package/dist/utils/enhancedLogger.d.ts +104 -0
  230. package/dist/utils/enhancedLogger.js +232 -0
  231. package/dist/utils/hybridModelManager.d.ts +19 -28
  232. package/dist/utils/hybridModelManager.js +36 -200
  233. package/dist/utils/index.d.ts +1 -1
  234. package/dist/utils/index.js +1 -1
  235. package/dist/utils/intelligentTypeMapper.d.ts +60 -0
  236. package/dist/utils/intelligentTypeMapper.js +349 -0
  237. package/dist/utils/metadataIndex.d.ts +118 -1
  238. package/dist/utils/metadataIndex.js +539 -16
  239. package/dist/utils/nodeVersionCheck.d.ts +24 -0
  240. package/dist/utils/nodeVersionCheck.js +65 -0
  241. package/dist/utils/paramValidation.d.ts +39 -0
  242. package/dist/utils/paramValidation.js +192 -0
  243. package/dist/utils/rateLimiter.d.ts +160 -0
  244. package/dist/utils/rateLimiter.js +271 -0
  245. package/dist/utils/statistics.d.ts +4 -4
  246. package/dist/utils/statistics.js +3 -3
  247. package/dist/utils/structuredLogger.d.ts +146 -0
  248. package/dist/utils/structuredLogger.js +394 -0
  249. package/dist/utils/textEncoding.js +2 -1
  250. package/dist/utils/typeValidation.d.ts +59 -0
  251. package/dist/utils/typeValidation.js +374 -0
  252. package/dist/utils/version.js +19 -3
  253. package/package.json +15 -4
  254. package/scripts/download-models.cjs +94 -20
  255. package/dist/augmentations/walAugmentation.d.ts +0 -109
  256. package/dist/augmentations/walAugmentation.js +0 -516
  257. package/dist/chat/BrainyChat.d.ts +0 -121
  258. package/dist/chat/BrainyChat.js +0 -396
  259. package/dist/chat/ChatCLI.d.ts +0 -61
  260. package/dist/chat/ChatCLI.js +0 -351
@@ -0,0 +1,318 @@
1
+ /**
2
+ * Extended Distributed Configuration Presets
3
+ * Common patterns for distributed and multi-service architectures
4
+ * All strongly typed with enums for compile-time safety
5
+ */
6
+ /**
7
+ * Strongly typed enum for preset names
8
+ */
9
+ export var PresetName;
10
+ (function (PresetName) {
11
+ // Basic presets
12
+ PresetName["PRODUCTION"] = "production";
13
+ PresetName["DEVELOPMENT"] = "development";
14
+ PresetName["MINIMAL"] = "minimal";
15
+ PresetName["ZERO"] = "zero";
16
+ // Distributed presets
17
+ PresetName["WRITER"] = "writer";
18
+ PresetName["READER"] = "reader";
19
+ // Service-specific presets
20
+ PresetName["INGESTION_SERVICE"] = "ingestion-service";
21
+ PresetName["SEARCH_API"] = "search-api";
22
+ PresetName["ANALYTICS_SERVICE"] = "analytics-service";
23
+ PresetName["EDGE_CACHE"] = "edge-cache";
24
+ PresetName["BATCH_PROCESSOR"] = "batch-processor";
25
+ PresetName["STREAMING_SERVICE"] = "streaming-service";
26
+ PresetName["ML_TRAINING"] = "ml-training";
27
+ PresetName["SIDECAR"] = "sidecar";
28
+ })(PresetName || (PresetName = {}));
29
+ /**
30
+ * Preset categories for organization
31
+ */
32
+ export var PresetCategory;
33
+ (function (PresetCategory) {
34
+ PresetCategory["BASIC"] = "basic";
35
+ PresetCategory["DISTRIBUTED"] = "distributed";
36
+ PresetCategory["SERVICE"] = "service";
37
+ })(PresetCategory || (PresetCategory = {}));
38
+ /**
39
+ * Model precision options
40
+ */
41
+ export var ModelPrecision;
42
+ (function (ModelPrecision) {
43
+ ModelPrecision["FP32"] = "fp32";
44
+ ModelPrecision["Q8"] = "q8";
45
+ ModelPrecision["AUTO"] = "auto";
46
+ ModelPrecision["FAST"] = "fast";
47
+ ModelPrecision["SMALL"] = "small";
48
+ })(ModelPrecision || (ModelPrecision = {}));
49
+ /**
50
+ * Storage options
51
+ */
52
+ export var StorageOption;
53
+ (function (StorageOption) {
54
+ StorageOption["AUTO"] = "auto";
55
+ StorageOption["MEMORY"] = "memory";
56
+ StorageOption["DISK"] = "disk";
57
+ StorageOption["CLOUD"] = "cloud";
58
+ })(StorageOption || (StorageOption = {}));
59
+ /**
60
+ * Feature set options
61
+ */
62
+ export var FeatureSet;
63
+ (function (FeatureSet) {
64
+ FeatureSet["MINIMAL"] = "minimal";
65
+ FeatureSet["DEFAULT"] = "default";
66
+ FeatureSet["FULL"] = "full";
67
+ FeatureSet["CUSTOM"] = "custom"; // For custom feature arrays
68
+ })(FeatureSet || (FeatureSet = {}));
69
+ /**
70
+ * Distributed role options
71
+ */
72
+ export var DistributedRole;
73
+ (function (DistributedRole) {
74
+ DistributedRole["WRITER"] = "writer";
75
+ DistributedRole["READER"] = "reader";
76
+ DistributedRole["HYBRID"] = "hybrid";
77
+ })(DistributedRole || (DistributedRole = {}));
78
+ /**
79
+ * Strongly typed preset configurations
80
+ */
81
+ export const PRESET_CONFIGS = {
82
+ // Basic presets
83
+ [PresetName.PRODUCTION]: {
84
+ storage: StorageOption.DISK,
85
+ model: ModelPrecision.AUTO,
86
+ features: FeatureSet.DEFAULT,
87
+ distributed: false,
88
+ verbose: false,
89
+ description: 'Optimized for production use',
90
+ category: PresetCategory.BASIC
91
+ },
92
+ [PresetName.DEVELOPMENT]: {
93
+ storage: StorageOption.MEMORY,
94
+ model: ModelPrecision.FP32,
95
+ features: FeatureSet.FULL,
96
+ distributed: false,
97
+ verbose: true,
98
+ description: 'Optimized for development with verbose logging',
99
+ category: PresetCategory.BASIC
100
+ },
101
+ [PresetName.MINIMAL]: {
102
+ storage: StorageOption.MEMORY,
103
+ model: ModelPrecision.Q8,
104
+ features: FeatureSet.MINIMAL,
105
+ distributed: false,
106
+ verbose: false,
107
+ description: 'Minimal footprint configuration',
108
+ category: PresetCategory.BASIC
109
+ },
110
+ [PresetName.ZERO]: {
111
+ storage: StorageOption.AUTO,
112
+ model: ModelPrecision.AUTO,
113
+ features: FeatureSet.DEFAULT,
114
+ distributed: false,
115
+ verbose: false,
116
+ description: 'True zero configuration with auto-detection',
117
+ category: PresetCategory.BASIC
118
+ },
119
+ // Distributed basic presets
120
+ [PresetName.WRITER]: {
121
+ storage: StorageOption.AUTO,
122
+ model: ModelPrecision.AUTO,
123
+ features: FeatureSet.MINIMAL,
124
+ distributed: true,
125
+ role: DistributedRole.WRITER,
126
+ writeOnly: true,
127
+ allowDirectReads: true,
128
+ verbose: false,
129
+ description: 'Write-only instance for distributed setups',
130
+ category: PresetCategory.DISTRIBUTED
131
+ },
132
+ [PresetName.READER]: {
133
+ storage: StorageOption.AUTO,
134
+ model: ModelPrecision.AUTO,
135
+ features: FeatureSet.DEFAULT,
136
+ distributed: true,
137
+ role: DistributedRole.READER,
138
+ readOnly: true,
139
+ lazyLoadInReadOnlyMode: true,
140
+ verbose: false,
141
+ description: 'Read-only instance for distributed setups',
142
+ category: PresetCategory.DISTRIBUTED
143
+ },
144
+ // Service-specific presets
145
+ [PresetName.INGESTION_SERVICE]: {
146
+ storage: StorageOption.CLOUD,
147
+ model: ModelPrecision.Q8,
148
+ features: ['core', 'batch-processing', 'entity-registry'],
149
+ distributed: true,
150
+ role: DistributedRole.WRITER,
151
+ writeOnly: true,
152
+ allowDirectReads: true,
153
+ verbose: false,
154
+ description: 'High-throughput data ingestion service',
155
+ category: PresetCategory.SERVICE
156
+ },
157
+ [PresetName.SEARCH_API]: {
158
+ storage: StorageOption.CLOUD,
159
+ model: ModelPrecision.FP32,
160
+ features: ['core', 'search', 'cache', 'triple-intelligence'],
161
+ distributed: true,
162
+ role: DistributedRole.READER,
163
+ readOnly: true,
164
+ lazyLoadInReadOnlyMode: true,
165
+ cache: {
166
+ hotCacheMaxSize: 10000,
167
+ autoTune: true
168
+ },
169
+ verbose: false,
170
+ description: 'Low-latency search API service',
171
+ category: PresetCategory.SERVICE
172
+ },
173
+ [PresetName.ANALYTICS_SERVICE]: {
174
+ storage: StorageOption.CLOUD,
175
+ model: ModelPrecision.AUTO,
176
+ features: ['core', 'search', 'metrics', 'monitoring'],
177
+ distributed: true,
178
+ role: DistributedRole.HYBRID,
179
+ verbose: false,
180
+ description: 'Analytics and data processing service',
181
+ category: PresetCategory.SERVICE
182
+ },
183
+ [PresetName.EDGE_CACHE]: {
184
+ storage: StorageOption.AUTO,
185
+ model: ModelPrecision.Q8,
186
+ features: ['core', 'search', 'cache'],
187
+ distributed: true,
188
+ role: DistributedRole.READER,
189
+ readOnly: true,
190
+ lazyLoadInReadOnlyMode: true,
191
+ cache: {
192
+ hotCacheMaxSize: 1000,
193
+ autoTune: false
194
+ },
195
+ verbose: false,
196
+ description: 'Edge location cache with minimal footprint',
197
+ category: PresetCategory.SERVICE
198
+ },
199
+ [PresetName.BATCH_PROCESSOR]: {
200
+ storage: StorageOption.CLOUD,
201
+ model: ModelPrecision.Q8,
202
+ features: ['core', 'batch-processing', 'neural-api'],
203
+ distributed: true,
204
+ role: DistributedRole.HYBRID,
205
+ cache: {
206
+ hotCacheMaxSize: 5000,
207
+ batchSize: 500
208
+ },
209
+ verbose: false,
210
+ description: 'Batch processing and bulk operations',
211
+ category: PresetCategory.SERVICE
212
+ },
213
+ [PresetName.STREAMING_SERVICE]: {
214
+ storage: StorageOption.CLOUD,
215
+ model: ModelPrecision.Q8,
216
+ features: ['core', 'batch-processing', 'wal'],
217
+ distributed: true,
218
+ role: DistributedRole.WRITER,
219
+ writeOnly: true,
220
+ allowDirectReads: false,
221
+ verbose: false,
222
+ description: 'Real-time data streaming service',
223
+ category: PresetCategory.SERVICE
224
+ },
225
+ [PresetName.ML_TRAINING]: {
226
+ storage: StorageOption.CLOUD,
227
+ model: ModelPrecision.FP32,
228
+ features: FeatureSet.FULL,
229
+ distributed: true,
230
+ role: DistributedRole.HYBRID,
231
+ cache: {
232
+ hotCacheMaxSize: 20000,
233
+ autoTune: true
234
+ },
235
+ verbose: true,
236
+ description: 'Machine learning training service',
237
+ category: PresetCategory.SERVICE
238
+ },
239
+ [PresetName.SIDECAR]: {
240
+ storage: StorageOption.AUTO,
241
+ model: ModelPrecision.Q8,
242
+ features: FeatureSet.MINIMAL,
243
+ distributed: false,
244
+ verbose: false,
245
+ description: 'Lightweight sidecar for microservices',
246
+ category: PresetCategory.SERVICE
247
+ }
248
+ };
249
+ /**
250
+ * Type-safe preset getter
251
+ */
252
+ export function getPreset(name) {
253
+ return PRESET_CONFIGS[name];
254
+ }
255
+ /**
256
+ * Check if a string is a valid preset name
257
+ */
258
+ export function isValidPreset(name) {
259
+ return Object.values(PresetName).includes(name);
260
+ }
261
+ /**
262
+ * Get presets by category
263
+ */
264
+ export function getPresetsByCategory(category) {
265
+ return Object.entries(PRESET_CONFIGS)
266
+ .filter(([_, config]) => config.category === category)
267
+ .map(([name]) => name);
268
+ }
269
+ /**
270
+ * Get all preset names
271
+ */
272
+ export function getAllPresetNames() {
273
+ return Object.values(PresetName);
274
+ }
275
+ /**
276
+ * Get preset description
277
+ */
278
+ export function getPresetDescription(name) {
279
+ return PRESET_CONFIGS[name].description;
280
+ }
281
+ /**
282
+ * Convert preset config to Brainy config
283
+ */
284
+ export function presetToBrainyConfig(preset) {
285
+ const config = {
286
+ storage: preset.storage,
287
+ model: preset.model,
288
+ verbose: preset.verbose
289
+ };
290
+ // Handle features
291
+ if (Array.isArray(preset.features)) {
292
+ config.features = preset.features;
293
+ }
294
+ else {
295
+ config.features = preset.features; // Will be expanded by processZeroConfig
296
+ }
297
+ // Handle distributed settings
298
+ if (preset.distributed) {
299
+ config.distributed = {
300
+ enabled: true,
301
+ role: preset.role
302
+ };
303
+ if (preset.readOnly)
304
+ config.readOnly = true;
305
+ if (preset.writeOnly)
306
+ config.writeOnly = true;
307
+ if (preset.allowDirectReads)
308
+ config.allowDirectReads = true;
309
+ if (preset.lazyLoadInReadOnlyMode)
310
+ config.lazyLoadInReadOnlyMode = true;
311
+ }
312
+ // Handle cache settings
313
+ if (preset.cache) {
314
+ config.cache = preset.cache;
315
+ }
316
+ return config;
317
+ }
318
+ //# sourceMappingURL=distributedPresets.js.map
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Extensible Configuration System
3
+ * Allows augmentations to register new storage types, presets, and configurations
4
+ */
5
+ import { PresetConfig } from './distributedPresets.js';
6
+ import { StorageConfigResult } from './storageAutoConfig.js';
7
+ /**
8
+ * Storage provider registration interface
9
+ */
10
+ export interface StorageProvider {
11
+ type: string;
12
+ name: string;
13
+ description: string;
14
+ detect: () => Promise<boolean>;
15
+ getConfig: () => Promise<any>;
16
+ priority?: number;
17
+ requirements?: {
18
+ env?: string[];
19
+ packages?: string[];
20
+ };
21
+ }
22
+ /**
23
+ * Preset extension interface
24
+ */
25
+ export interface PresetExtension {
26
+ name: string;
27
+ config: PresetConfig;
28
+ override?: boolean;
29
+ }
30
+ /**
31
+ * Global registry for extensions
32
+ */
33
+ declare class ConfigurationRegistry {
34
+ private static instance;
35
+ private storageProviders;
36
+ private presetExtensions;
37
+ private autoDetectHooks;
38
+ private constructor();
39
+ static getInstance(): ConfigurationRegistry;
40
+ /**
41
+ * Register a new storage provider
42
+ * This is how augmentations add new storage types
43
+ */
44
+ registerStorageProvider(provider: StorageProvider): void;
45
+ /**
46
+ * Register a new preset
47
+ */
48
+ registerPreset(name: string, extension: PresetExtension): void;
49
+ /**
50
+ * Register an auto-detection hook
51
+ */
52
+ registerAutoDetectHook(hook: () => Promise<any>): void;
53
+ /**
54
+ * Get all registered storage providers
55
+ */
56
+ getStorageProviders(): StorageProvider[];
57
+ /**
58
+ * Get all registered presets (built-in + extensions)
59
+ */
60
+ getAllPresets(): Map<string, PresetConfig>;
61
+ /**
62
+ * Auto-detect storage including extensions
63
+ */
64
+ autoDetectStorage(): Promise<StorageConfigResult>;
65
+ /**
66
+ * Register built-in providers
67
+ */
68
+ private registerBuiltInProviders;
69
+ }
70
+ /**
71
+ * Example: Redis storage provider registration
72
+ * This would be in the redis augmentation package
73
+ */
74
+ export declare const redisStorageProvider: StorageProvider;
75
+ /**
76
+ * Example: MongoDB storage provider
77
+ */
78
+ export declare const mongoStorageProvider: StorageProvider;
79
+ /**
80
+ * Example: PostgreSQL with pgvector extension
81
+ */
82
+ export declare const postgresStorageProvider: StorageProvider;
83
+ /**
84
+ * How an augmentation would register its storage provider
85
+ */
86
+ export declare function registerStorageAugmentation(provider: StorageProvider): void;
87
+ /**
88
+ * How to register a new preset
89
+ */
90
+ export declare function registerPresetAugmentation(name: string, config: PresetConfig): void;
91
+ /**
92
+ * Example preset for Redis-based caching service
93
+ */
94
+ export declare const redisCachePreset: PresetConfig;
95
+ /**
96
+ * Get the configuration registry
97
+ */
98
+ export declare function getConfigRegistry(): ConfigurationRegistry;
99
+ export {};
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Extensible Configuration System
3
+ * Allows augmentations to register new storage types, presets, and configurations
4
+ */
5
+ import { ModelPrecision, DistributedRole, PresetCategory } from './distributedPresets.js';
6
+ /**
7
+ * Global registry for extensions
8
+ */
9
+ class ConfigurationRegistry {
10
+ constructor() {
11
+ // Registered storage providers
12
+ this.storageProviders = new Map();
13
+ // Registered preset extensions
14
+ this.presetExtensions = new Map();
15
+ // Custom auto-detection hooks
16
+ this.autoDetectHooks = [];
17
+ // Initialize with built-in providers
18
+ this.registerBuiltInProviders();
19
+ }
20
+ static getInstance() {
21
+ if (!ConfigurationRegistry.instance) {
22
+ ConfigurationRegistry.instance = new ConfigurationRegistry();
23
+ }
24
+ return ConfigurationRegistry.instance;
25
+ }
26
+ /**
27
+ * Register a new storage provider
28
+ * This is how augmentations add new storage types
29
+ */
30
+ registerStorageProvider(provider) {
31
+ console.log(`📦 Registering storage provider: ${provider.type} (${provider.name})`);
32
+ this.storageProviders.set(provider.type, provider);
33
+ }
34
+ /**
35
+ * Register a new preset
36
+ */
37
+ registerPreset(name, extension) {
38
+ console.log(`🎨 Registering preset: ${name}`);
39
+ this.presetExtensions.set(name, extension);
40
+ }
41
+ /**
42
+ * Register an auto-detection hook
43
+ */
44
+ registerAutoDetectHook(hook) {
45
+ this.autoDetectHooks.push(hook);
46
+ }
47
+ /**
48
+ * Get all registered storage providers
49
+ */
50
+ getStorageProviders() {
51
+ return Array.from(this.storageProviders.values())
52
+ .sort((a, b) => (b.priority || 0) - (a.priority || 0));
53
+ }
54
+ /**
55
+ * Get all registered presets (built-in + extensions)
56
+ */
57
+ getAllPresets() {
58
+ // Start with built-in presets
59
+ const allPresets = new Map();
60
+ // Note: Would import from distributedPresets-new.ts
61
+ // Add extended presets
62
+ for (const [name, extension] of this.presetExtensions) {
63
+ if (extension.override || !allPresets.has(name)) {
64
+ allPresets.set(name, extension.config);
65
+ }
66
+ }
67
+ return allPresets;
68
+ }
69
+ /**
70
+ * Auto-detect storage including extensions
71
+ */
72
+ async autoDetectStorage() {
73
+ // Check registered providers first (in priority order)
74
+ for (const provider of this.getStorageProviders()) {
75
+ try {
76
+ if (await provider.detect()) {
77
+ const config = await provider.getConfig();
78
+ return {
79
+ type: provider.type,
80
+ config,
81
+ reason: `Auto-detected ${provider.name}`,
82
+ autoSelected: true
83
+ };
84
+ }
85
+ }
86
+ catch (error) {
87
+ console.warn(`Failed to detect ${provider.type}:`, error);
88
+ }
89
+ }
90
+ // Fallback to built-in detection
91
+ const { autoDetectStorage } = await import('./storageAutoConfig.js');
92
+ return autoDetectStorage();
93
+ }
94
+ /**
95
+ * Register built-in providers
96
+ */
97
+ registerBuiltInProviders() {
98
+ // These would be the built-in ones, but could be overridden
99
+ }
100
+ }
101
+ /**
102
+ * Example: Redis storage provider registration
103
+ * This would be in the redis augmentation package
104
+ */
105
+ export const redisStorageProvider = {
106
+ type: 'redis',
107
+ name: 'Redis Storage',
108
+ description: 'High-performance in-memory data store',
109
+ priority: 10, // Check before filesystem
110
+ requirements: {
111
+ env: ['REDIS_URL', 'REDIS_HOST'],
112
+ packages: ['redis', 'ioredis']
113
+ },
114
+ async detect() {
115
+ // Check for Redis connection info
116
+ if (process.env.REDIS_URL || process.env.REDIS_HOST) {
117
+ try {
118
+ // Try to connect to Redis (dynamic import for optional dependency)
119
+ const redis = await new Function('return import("ioredis")')().catch(() => null);
120
+ if (!redis)
121
+ return false;
122
+ const client = new redis.default(process.env.REDIS_URL);
123
+ await client.ping();
124
+ await client.quit();
125
+ return true;
126
+ }
127
+ catch {
128
+ // Redis not available
129
+ }
130
+ }
131
+ return false;
132
+ },
133
+ async getConfig() {
134
+ return {
135
+ type: 'redis',
136
+ redisStorage: {
137
+ url: process.env.REDIS_URL || `redis://${process.env.REDIS_HOST}:${process.env.REDIS_PORT || 6379}`,
138
+ prefix: process.env.REDIS_PREFIX || 'brainy:',
139
+ ttl: process.env.REDIS_TTL ? parseInt(process.env.REDIS_TTL) : undefined
140
+ }
141
+ };
142
+ }
143
+ };
144
+ /**
145
+ * Example: MongoDB storage provider
146
+ */
147
+ export const mongoStorageProvider = {
148
+ type: 'mongodb',
149
+ name: 'MongoDB Storage',
150
+ description: 'Document database for complex data',
151
+ priority: 8,
152
+ requirements: {
153
+ env: ['MONGODB_URI', 'MONGO_URL'],
154
+ packages: ['mongodb']
155
+ },
156
+ async detect() {
157
+ if (process.env.MONGODB_URI || process.env.MONGO_URL) {
158
+ try {
159
+ const mongodb = await new Function('return import("mongodb")')().catch(() => null);
160
+ if (!mongodb)
161
+ return false;
162
+ const client = new mongodb.MongoClient(process.env.MONGODB_URI || process.env.MONGO_URL);
163
+ await client.connect();
164
+ await client.close();
165
+ return true;
166
+ }
167
+ catch {
168
+ // MongoDB not available
169
+ }
170
+ }
171
+ return false;
172
+ },
173
+ async getConfig() {
174
+ return {
175
+ type: 'mongodb',
176
+ mongoStorage: {
177
+ uri: process.env.MONGODB_URI || process.env.MONGO_URL,
178
+ database: process.env.MONGO_DATABASE || 'brainy',
179
+ collection: process.env.MONGO_COLLECTION || 'vectors'
180
+ }
181
+ };
182
+ }
183
+ };
184
+ /**
185
+ * Example: PostgreSQL with pgvector extension
186
+ */
187
+ export const postgresStorageProvider = {
188
+ type: 'postgres',
189
+ name: 'PostgreSQL Storage',
190
+ description: 'PostgreSQL with pgvector for scalable vector search',
191
+ priority: 9,
192
+ requirements: {
193
+ env: ['DATABASE_URL', 'POSTGRES_URL'],
194
+ packages: ['pg', 'pgvector']
195
+ },
196
+ async detect() {
197
+ const url = process.env.DATABASE_URL || process.env.POSTGRES_URL;
198
+ if (url && url.includes('postgres')) {
199
+ try {
200
+ const pg = await new Function('return import("pg")')().catch(() => null);
201
+ if (!pg)
202
+ return false;
203
+ const client = new pg.Client({ connectionString: url });
204
+ await client.connect();
205
+ // Check for pgvector extension
206
+ const result = await client.query("SELECT * FROM pg_extension WHERE extname = 'vector'");
207
+ await client.end();
208
+ return result.rows.length > 0;
209
+ }
210
+ catch {
211
+ // PostgreSQL not available or pgvector not installed
212
+ }
213
+ }
214
+ return false;
215
+ },
216
+ async getConfig() {
217
+ return {
218
+ type: 'postgres',
219
+ postgresStorage: {
220
+ connectionString: process.env.DATABASE_URL || process.env.POSTGRES_URL,
221
+ table: process.env.POSTGRES_TABLE || 'brainy_vectors',
222
+ schema: process.env.POSTGRES_SCHEMA || 'public'
223
+ }
224
+ };
225
+ }
226
+ };
227
+ /**
228
+ * How an augmentation would register its storage provider
229
+ */
230
+ export function registerStorageAugmentation(provider) {
231
+ const registry = ConfigurationRegistry.getInstance();
232
+ registry.registerStorageProvider(provider);
233
+ }
234
+ /**
235
+ * How to register a new preset
236
+ */
237
+ export function registerPresetAugmentation(name, config) {
238
+ const registry = ConfigurationRegistry.getInstance();
239
+ registry.registerPreset(name, {
240
+ name,
241
+ config,
242
+ override: false
243
+ });
244
+ }
245
+ /**
246
+ * Example preset for Redis-based caching service
247
+ */
248
+ export const redisCachePreset = {
249
+ storage: 'redis', // Extended storage type
250
+ model: ModelPrecision.Q8,
251
+ features: ['core', 'cache', 'search'],
252
+ distributed: true,
253
+ role: DistributedRole.READER,
254
+ readOnly: true,
255
+ cache: {
256
+ hotCacheMaxSize: 50000, // Large Redis cache
257
+ autoTune: true
258
+ },
259
+ description: 'Redis-backed caching layer',
260
+ category: PresetCategory.SERVICE
261
+ };
262
+ /**
263
+ * Get the configuration registry
264
+ */
265
+ export function getConfigRegistry() {
266
+ return ConfigurationRegistry.getInstance();
267
+ }
268
+ //# sourceMappingURL=extensibleConfig.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Zero-Configuration System
3
+ * Main entry point for all auto-configuration features
4
+ */
5
+ export { autoSelectModelPrecision, ModelPrecision as ModelPrecisionType, // Avoid conflict
6
+ ModelPreset, shouldAutoDownloadModels, getModelPath, logModelConfig } from './modelAutoConfig.js';
7
+ export declare const getModelPrecision: () => "q8";
8
+ export { autoDetectStorage, StorageType, StoragePreset, StorageConfigResult, logStorageConfig, type StorageTypeString, type StoragePresetString } from './storageAutoConfig.js';
9
+ export { SharedConfig, SharedConfigManager } from './sharedConfigManager.js';
10
+ export { BrainyZeroConfig, processZeroConfig, createEmbeddingFunctionWithPrecision } from './zeroConfig.js';
11
+ export { PresetName, PresetCategory, ModelPrecision, StorageOption, FeatureSet, DistributedRole, PresetConfig, PRESET_CONFIGS, getPreset, isValidPreset, getPresetsByCategory, getAllPresetNames, getPresetDescription, presetToBrainyConfig } from './distributedPresets.js';
12
+ export { StorageProvider, registerStorageAugmentation, registerPresetAugmentation, getConfigRegistry } from './extensibleConfig.js';
13
+ /**
14
+ * Main zero-config processor
15
+ * This is what Brainy will call
16
+ */
17
+ export declare function applyZeroConfig(input?: string | any): Promise<any>;