@soulcraft/brainy 3.20.2 → 3.20.3
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.
- package/CHANGELOG.md +9 -0
- package/bin/brainy-interactive.js +2 -2
- package/dist/brainy.d.ts +1 -1
- package/dist/mcp/brainyMCPAdapter.d.ts +1 -1
- package/dist/mcp/brainyMCPService.d.ts +1 -1
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +1 -1
- package/dist/shared/default-augmentations.d.ts +1 -1
- package/dist/types/{brainyDataInterface.js → brainyInterface.js} +1 -1
- package/package.json +1 -1
- package/dist/augmentationFactory.d.ts +0 -86
- package/dist/augmentationFactory.js +0 -342
- package/dist/augmentationRegistry.d.ts +0 -38
- package/dist/augmentationRegistry.js +0 -54
- package/dist/augmentationRegistryLoader.d.ts +0 -146
- package/dist/augmentationRegistryLoader.js +0 -213
- package/dist/augmentations/KnowledgeAugmentation.d.ts +0 -40
- package/dist/augmentations/KnowledgeAugmentation.js +0 -251
- package/dist/augmentations/intelligentVerbScoring.d.ts +0 -158
- package/dist/augmentations/intelligentVerbScoring.js +0 -377
- package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +0 -168
- package/dist/augmentations/marketplace/AugmentationMarketplace.js +0 -329
- package/dist/augmentations/marketplace/cli.d.ts +0 -47
- package/dist/augmentations/marketplace/cli.js +0 -265
- package/dist/augmentations/memoryAugmentations.d.ts +0 -72
- package/dist/augmentations/memoryAugmentations.js +0 -280
- package/dist/augmentations/serverSearchAugmentations.d.ts +0 -190
- package/dist/augmentations/serverSearchAugmentations.js +0 -586
- package/dist/brainy-unified.d.ts +0 -106
- package/dist/brainy-unified.js +0 -327
- package/dist/brainyData.d.ts +0 -1832
- package/dist/brainyData.js +0 -6443
- package/dist/brainyDataV3.d.ts +0 -186
- package/dist/brainyDataV3.js +0 -337
- package/dist/config/distributedPresets-new.d.ts +0 -118
- package/dist/config/distributedPresets-new.js +0 -318
- package/dist/config/modelPrecisionManager.d.ts +0 -42
- package/dist/config/modelPrecisionManager.js +0 -98
- package/dist/connectors/interfaces/IConnector.d.ts +0 -143
- package/dist/connectors/interfaces/IConnector.js +0 -8
- package/dist/demo.d.ts +0 -106
- package/dist/demo.js +0 -201
- package/dist/embeddings/SingletonModelManager.d.ts +0 -95
- package/dist/embeddings/SingletonModelManager.js +0 -220
- package/dist/embeddings/lightweight-embedder.d.ts +0 -22
- package/dist/embeddings/lightweight-embedder.js +0 -128
- package/dist/embeddings/model-manager.d.ts +0 -39
- package/dist/embeddings/model-manager.js +0 -245
- package/dist/embeddings/universal-memory-manager.d.ts +0 -38
- package/dist/embeddings/universal-memory-manager.js +0 -166
- package/dist/embeddings/worker-embedding.d.ts +0 -7
- package/dist/embeddings/worker-embedding.js +0 -73
- package/dist/embeddings/worker-manager.d.ts +0 -28
- package/dist/embeddings/worker-manager.js +0 -162
- package/dist/examples/basicUsage.d.ts +0 -4
- package/dist/examples/basicUsage.js +0 -121
- package/dist/indices/fieldIndex.d.ts +0 -76
- package/dist/indices/fieldIndex.js +0 -357
- package/dist/mcp/brainyMCPBroadcast.d.ts +0 -82
- package/dist/mcp/brainyMCPBroadcast.js +0 -303
- package/dist/mcp/brainyMCPClient.d.ts +0 -92
- package/dist/mcp/brainyMCPClient.js +0 -258
- package/dist/scripts/precomputePatternEmbeddings.d.ts +0 -19
- package/dist/scripts/precomputePatternEmbeddings.js +0 -100
- package/dist/utils/cacheAutoConfig.d.ts +0 -63
- package/dist/utils/cacheAutoConfig.js +0 -261
- package/dist/utils/hybridModelManager.d.ts +0 -64
- package/dist/utils/hybridModelManager.js +0 -95
- package/dist/utils/statistics.d.ts +0 -28
- package/dist/utils/statistics.js +0 -25
- package/dist/vfs/ConceptSystem.d.ts +0 -203
- package/dist/vfs/ConceptSystem.js +0 -545
- package/dist/vfs/EntityManager.d.ts +0 -75
- package/dist/vfs/EntityManager.js +0 -216
- package/dist/vfs/EventRecorder.d.ts +0 -84
- package/dist/vfs/EventRecorder.js +0 -269
- package/dist/vfs/GitBridge.d.ts +0 -167
- package/dist/vfs/GitBridge.js +0 -537
- package/dist/vfs/KnowledgeAugmentation.d.ts +0 -104
- package/dist/vfs/KnowledgeAugmentation.js +0 -146
- package/dist/vfs/KnowledgeLayer.d.ts +0 -35
- package/dist/vfs/KnowledgeLayer.js +0 -443
- package/dist/vfs/PersistentEntitySystem.d.ts +0 -165
- package/dist/vfs/PersistentEntitySystem.js +0 -503
- package/dist/vfs/SemanticVersioning.d.ts +0 -105
- package/dist/vfs/SemanticVersioning.js +0 -309
- package/dist/vfs/VFSHealthCheck.d.ts +0 -78
- package/dist/vfs/VFSHealthCheck.js +0 -299
- /package/dist/types/{brainyDataInterface.d.ts → brainyInterface.d.ts} +0 -0
|
@@ -1,318 +0,0 @@
|
|
|
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-new.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Central Model Precision Manager
|
|
3
|
-
*
|
|
4
|
-
* Single source of truth for model precision configuration.
|
|
5
|
-
* Ensures consistent usage of Q8 or FP32 models throughout the system.
|
|
6
|
-
*/
|
|
7
|
-
import { ModelPrecision } from './modelAutoConfig.js';
|
|
8
|
-
export declare class ModelPrecisionManager {
|
|
9
|
-
private static instance;
|
|
10
|
-
private precision;
|
|
11
|
-
private isLocked;
|
|
12
|
-
private constructor();
|
|
13
|
-
static getInstance(): ModelPrecisionManager;
|
|
14
|
-
/**
|
|
15
|
-
* Get the current model precision
|
|
16
|
-
*/
|
|
17
|
-
getPrecision(): ModelPrecision;
|
|
18
|
-
/**
|
|
19
|
-
* Set the model precision (can only be done before first model load)
|
|
20
|
-
*/
|
|
21
|
-
setPrecision(precision: ModelPrecision): void;
|
|
22
|
-
/**
|
|
23
|
-
* Lock the precision (called after first model load)
|
|
24
|
-
*/
|
|
25
|
-
lock(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Check if precision is locked
|
|
28
|
-
*/
|
|
29
|
-
isConfigLocked(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Get precision info for logging
|
|
32
|
-
*/
|
|
33
|
-
getInfo(): string;
|
|
34
|
-
/**
|
|
35
|
-
* Validate that a given precision matches the configured one
|
|
36
|
-
*/
|
|
37
|
-
validatePrecision(precision: ModelPrecision): boolean;
|
|
38
|
-
}
|
|
39
|
-
export declare const getModelPrecision: () => ModelPrecision;
|
|
40
|
-
export declare const setModelPrecision: (precision: ModelPrecision) => void;
|
|
41
|
-
export declare const lockModelPrecision: () => void;
|
|
42
|
-
export declare const validateModelPrecision: (precision: ModelPrecision) => boolean;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Central Model Precision Manager
|
|
3
|
-
*
|
|
4
|
-
* Single source of truth for model precision configuration.
|
|
5
|
-
* Ensures consistent usage of Q8 or FP32 models throughout the system.
|
|
6
|
-
*/
|
|
7
|
-
export class ModelPrecisionManager {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.precision = 'q8'; // DEFAULT TO Q8
|
|
10
|
-
this.isLocked = false;
|
|
11
|
-
// Check environment variable override
|
|
12
|
-
const envPrecision = process.env.BRAINY_MODEL_PRECISION;
|
|
13
|
-
if (envPrecision === 'fp32' || envPrecision === 'q8') {
|
|
14
|
-
this.precision = envPrecision;
|
|
15
|
-
console.log(`Model precision set from environment: ${envPrecision.toUpperCase()}`);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
console.log('Using default model precision: Q8 (75% smaller, 99% accuracy)');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
static getInstance() {
|
|
22
|
-
if (!ModelPrecisionManager.instance) {
|
|
23
|
-
ModelPrecisionManager.instance = new ModelPrecisionManager();
|
|
24
|
-
}
|
|
25
|
-
return ModelPrecisionManager.instance;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get the current model precision
|
|
29
|
-
*/
|
|
30
|
-
getPrecision() {
|
|
31
|
-
return this.precision;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Set the model precision (can only be done before first model load)
|
|
35
|
-
*/
|
|
36
|
-
setPrecision(precision) {
|
|
37
|
-
if (this.isLocked) {
|
|
38
|
-
console.warn(`⚠️ Cannot change precision after model initialization. Current: ${this.precision.toUpperCase()}`);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (precision !== this.precision) {
|
|
42
|
-
console.log(`Model precision changed: ${this.precision.toUpperCase()} → ${precision.toUpperCase()}`);
|
|
43
|
-
this.precision = precision;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Lock the precision (called after first model load)
|
|
48
|
-
*/
|
|
49
|
-
lock() {
|
|
50
|
-
if (!this.isLocked) {
|
|
51
|
-
this.isLocked = true;
|
|
52
|
-
console.log(`Model precision locked: ${this.precision.toUpperCase()}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Check if precision is locked
|
|
57
|
-
*/
|
|
58
|
-
isConfigLocked() {
|
|
59
|
-
return this.isLocked;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Get precision info for logging
|
|
63
|
-
*/
|
|
64
|
-
getInfo() {
|
|
65
|
-
const info = this.precision === 'q8'
|
|
66
|
-
? 'Q8 (quantized, 23MB, 99% accuracy)'
|
|
67
|
-
: 'FP32 (full precision, 90MB, 100% accuracy)';
|
|
68
|
-
return `${info}${this.isLocked ? ' [LOCKED]' : ''}`;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Validate that a given precision matches the configured one
|
|
72
|
-
*/
|
|
73
|
-
validatePrecision(precision) {
|
|
74
|
-
if (precision !== this.precision) {
|
|
75
|
-
console.error(`❌ Precision mismatch! Expected: ${this.precision.toUpperCase()}, Got: ${precision.toUpperCase()}`);
|
|
76
|
-
console.error('This will cause incompatible embeddings!');
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Export singleton instance getter
|
|
83
|
-
export const getModelPrecision = () => {
|
|
84
|
-
return ModelPrecisionManager.getInstance().getPrecision();
|
|
85
|
-
};
|
|
86
|
-
// Export setter (for configuration phase)
|
|
87
|
-
export const setModelPrecision = (precision) => {
|
|
88
|
-
ModelPrecisionManager.getInstance().setPrecision(precision);
|
|
89
|
-
};
|
|
90
|
-
// Export lock function (for after model initialization)
|
|
91
|
-
export const lockModelPrecision = () => {
|
|
92
|
-
ModelPrecisionManager.getInstance().lock();
|
|
93
|
-
};
|
|
94
|
-
// Export validation function
|
|
95
|
-
export const validateModelPrecision = (precision) => {
|
|
96
|
-
return ModelPrecisionManager.getInstance().validatePrecision(precision);
|
|
97
|
-
};
|
|
98
|
-
//# sourceMappingURL=modelPrecisionManager.js.map
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Brainy Connector Interface - Atomic Age Integration Framework
|
|
3
|
-
*
|
|
4
|
-
* 🧠 Base interface for all premium connectors in Brain Cloud
|
|
5
|
-
* ⚛️ Open source interface, implementations are premium-only
|
|
6
|
-
*/
|
|
7
|
-
export interface ConnectorConfig {
|
|
8
|
-
/** Connector identifier (e.g., 'notion', 'salesforce') */
|
|
9
|
-
connectorId: string;
|
|
10
|
-
/** Premium license key (required for Brain Cloud connectors) */
|
|
11
|
-
licenseKey: string;
|
|
12
|
-
/** API credentials for the external service */
|
|
13
|
-
credentials: {
|
|
14
|
-
apiKey?: string;
|
|
15
|
-
accessToken?: string;
|
|
16
|
-
refreshToken?: string;
|
|
17
|
-
clientId?: string;
|
|
18
|
-
clientSecret?: string;
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
};
|
|
21
|
-
/** Connector-specific configuration */
|
|
22
|
-
options?: {
|
|
23
|
-
syncInterval?: number;
|
|
24
|
-
batchSize?: number;
|
|
25
|
-
retryAttempts?: number;
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
};
|
|
28
|
-
/** Brainy database instance configuration */
|
|
29
|
-
brainy?: {
|
|
30
|
-
endpoint?: string;
|
|
31
|
-
storage?: string;
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export interface SyncResult {
|
|
36
|
-
/** Number of items successfully synced */
|
|
37
|
-
synced: number;
|
|
38
|
-
/** Number of items that failed to sync */
|
|
39
|
-
failed: number;
|
|
40
|
-
/** Number of items skipped (duplicates, etc.) */
|
|
41
|
-
skipped: number;
|
|
42
|
-
/** Total processing time in milliseconds */
|
|
43
|
-
duration: number;
|
|
44
|
-
/** Sync operation timestamp */
|
|
45
|
-
timestamp: string;
|
|
46
|
-
/** Error details for failed items */
|
|
47
|
-
errors?: Array<{
|
|
48
|
-
item: string;
|
|
49
|
-
error: string;
|
|
50
|
-
retryable: boolean;
|
|
51
|
-
}>;
|
|
52
|
-
/** Metadata about the sync operation */
|
|
53
|
-
metadata?: {
|
|
54
|
-
lastSyncId?: string;
|
|
55
|
-
nextPageToken?: string;
|
|
56
|
-
hasMore?: boolean;
|
|
57
|
-
[key: string]: any;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export interface ConnectorStatus {
|
|
61
|
-
/** Current connector state */
|
|
62
|
-
status: 'connected' | 'disconnected' | 'error' | 'syncing' | 'paused';
|
|
63
|
-
/** Human-readable status message */
|
|
64
|
-
message: string;
|
|
65
|
-
/** Last successful sync timestamp */
|
|
66
|
-
lastSync?: string;
|
|
67
|
-
/** Next scheduled sync timestamp */
|
|
68
|
-
nextSync?: string;
|
|
69
|
-
/** Connection health indicators */
|
|
70
|
-
health: {
|
|
71
|
-
apiReachable: boolean;
|
|
72
|
-
credentialsValid: boolean;
|
|
73
|
-
licenseValid: boolean;
|
|
74
|
-
quotaRemaining?: number;
|
|
75
|
-
};
|
|
76
|
-
/** Usage statistics */
|
|
77
|
-
stats?: {
|
|
78
|
-
totalSyncs: number;
|
|
79
|
-
totalItems: number;
|
|
80
|
-
averageDuration: number;
|
|
81
|
-
errorRate: number;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Base interface for all Brainy premium connectors
|
|
86
|
-
*
|
|
87
|
-
* Implementations auto-load with Brain Cloud subscription after auth
|
|
88
|
-
*/
|
|
89
|
-
export interface IConnector {
|
|
90
|
-
/** Unique connector identifier */
|
|
91
|
-
readonly id: string;
|
|
92
|
-
/** Human-readable connector name */
|
|
93
|
-
readonly name: string;
|
|
94
|
-
/** Connector version */
|
|
95
|
-
readonly version: string;
|
|
96
|
-
/** Supported data types this connector can handle */
|
|
97
|
-
readonly supportedTypes: string[];
|
|
98
|
-
/**
|
|
99
|
-
* Initialize the connector with configuration
|
|
100
|
-
*/
|
|
101
|
-
initialize(config: ConnectorConfig): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Test connection to the external service
|
|
104
|
-
*/
|
|
105
|
-
testConnection(): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* Get current connector status and health
|
|
108
|
-
*/
|
|
109
|
-
getStatus(): Promise<ConnectorStatus>;
|
|
110
|
-
/**
|
|
111
|
-
* Start syncing data from the external service
|
|
112
|
-
*/
|
|
113
|
-
startSync(): Promise<SyncResult>;
|
|
114
|
-
/**
|
|
115
|
-
* Stop any ongoing sync operations
|
|
116
|
-
*/
|
|
117
|
-
stopSync(): Promise<void>;
|
|
118
|
-
/**
|
|
119
|
-
* Perform incremental sync (delta changes only)
|
|
120
|
-
*/
|
|
121
|
-
incrementalSync(): Promise<SyncResult>;
|
|
122
|
-
/**
|
|
123
|
-
* Perform full sync (all data)
|
|
124
|
-
*/
|
|
125
|
-
fullSync(): Promise<SyncResult>;
|
|
126
|
-
/**
|
|
127
|
-
* Preview what would be synced without actually syncing
|
|
128
|
-
*/
|
|
129
|
-
previewSync(limit?: number): Promise<{
|
|
130
|
-
items: Array<{
|
|
131
|
-
type: string;
|
|
132
|
-
title: string;
|
|
133
|
-
preview: string;
|
|
134
|
-
relationships: string[];
|
|
135
|
-
}>;
|
|
136
|
-
totalCount: number;
|
|
137
|
-
estimatedDuration: number;
|
|
138
|
-
}>;
|
|
139
|
-
/**
|
|
140
|
-
* Clean up resources and disconnect
|
|
141
|
-
*/
|
|
142
|
-
disconnect(): Promise<void>;
|
|
143
|
-
}
|