2025-08-29 15:39:07 -07:00
|
|
|
/**
|
|
|
|
|
* Zero-Configuration System
|
|
|
|
|
* Main entry point for all auto-configuration features
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-18 10:31:02 -08:00
|
|
|
// Model configuration (simplified - always Q8 WASM)
|
|
|
|
|
export {
|
|
|
|
|
getModelPrecision,
|
2025-08-29 15:39:07 -07:00
|
|
|
shouldAutoDownloadModels,
|
2025-12-18 10:31:02 -08:00
|
|
|
getModelPath
|
2025-08-29 15:39:07 -07:00
|
|
|
} 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
|
2025-09-11 16:23:32 -07:00
|
|
|
* This is what Brainy will call
|
2025-08-29 15:39:07 -07:00
|
|
|
*/
|
|
|
|
|
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)
|
|
|
|
|
}
|