feat: implement zero-config system with Node.js 22 compatibility
- Add comprehensive zero-config preset system (production, development, minimal) - Implement intelligent auto-configuration for models and storage - Add Node.js version enforcement for ONNX Runtime stability - Force single-threaded ONNX operations to prevent V8 HandleScope crashes - Create extensible configuration architecture - Add 14 distributed system presets for enterprise deployments - Include detailed documentation and migration guides BREAKING CHANGE: Now requires Node.js 22.x LTS for optimal stability
This commit is contained in:
parent
4d60384755
commit
5f862bad98
20 changed files with 3718 additions and 71 deletions
83
src/config/index.ts
Normal file
83
src/config/index.ts
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* Zero-Configuration System
|
||||
* Main entry point for all auto-configuration features
|
||||
*/
|
||||
|
||||
// Model configuration
|
||||
export {
|
||||
autoSelectModelPrecision,
|
||||
ModelPrecision as ModelPrecisionType, // Avoid conflict
|
||||
ModelPreset,
|
||||
shouldAutoDownloadModels,
|
||||
getModelPath,
|
||||
logModelConfig
|
||||
} from './modelAutoConfig.js'
|
||||
|
||||
// Storage configuration
|
||||
export {
|
||||
autoDetectStorage,
|
||||
StorageType,
|
||||
StoragePreset,
|
||||
StorageConfigResult,
|
||||
logStorageConfig,
|
||||
// Backward compatibility types
|
||||
type StorageTypeString,
|
||||
type StoragePresetString
|
||||
} from './storageAutoConfig.js'
|
||||
|
||||
// Shared configuration for multi-instance
|
||||
export {
|
||||
SharedConfig,
|
||||
SharedConfigManager
|
||||
} from './sharedConfigManager.js'
|
||||
|
||||
// Main zero-config processor
|
||||
export {
|
||||
BrainyZeroConfig,
|
||||
processZeroConfig,
|
||||
createEmbeddingFunctionWithPrecision
|
||||
} from './zeroConfig.js'
|
||||
|
||||
// Strongly-typed presets and enums
|
||||
export {
|
||||
PresetName,
|
||||
PresetCategory,
|
||||
ModelPrecision,
|
||||
StorageOption,
|
||||
FeatureSet,
|
||||
DistributedRole,
|
||||
PresetConfig,
|
||||
PRESET_CONFIGS,
|
||||
getPreset,
|
||||
isValidPreset,
|
||||
getPresetsByCategory,
|
||||
getAllPresetNames,
|
||||
getPresetDescription,
|
||||
presetToBrainyConfig
|
||||
} from './distributedPresets.js'
|
||||
|
||||
// Extensible configuration
|
||||
export {
|
||||
StorageProvider,
|
||||
registerStorageAugmentation,
|
||||
registerPresetAugmentation,
|
||||
getConfigRegistry
|
||||
} from './extensibleConfig.js'
|
||||
|
||||
/**
|
||||
* Main zero-config processor
|
||||
* This is what BrainyData will call
|
||||
*/
|
||||
export async function applyZeroConfig(input?: string | any): Promise<any> {
|
||||
// Handle legacy config (full object) by detecting known legacy properties
|
||||
if (input && typeof input === 'object' &&
|
||||
(input.storage?.forceMemoryStorage || input.storage?.forceFileSystemStorage || input.storage?.s3Storage)) {
|
||||
// This is a legacy config object - pass through unchanged
|
||||
console.log('📦 Using legacy configuration format')
|
||||
return input
|
||||
}
|
||||
|
||||
// Process as zero-config (includes new object format)
|
||||
const { processZeroConfig } = await import('./zeroConfig.js')
|
||||
return processZeroConfig(input)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue