chore: recovery checkpoint - v3.0 API successfully recovered
CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
This commit is contained in:
parent
f65455fb22
commit
8ff382ca3b
895 changed files with 143654 additions and 28268 deletions
|
|
@ -0,0 +1,318 @@
|
|||
/**
|
||||
* Extended Distributed Configuration Presets
|
||||
* Common patterns for distributed and multi-service architectures
|
||||
* All strongly typed with enums for compile-time safety
|
||||
*/
|
||||
/**
|
||||
* Strongly typed enum for preset names
|
||||
*/
|
||||
export var PresetName;
|
||||
(function (PresetName) {
|
||||
// Basic presets
|
||||
PresetName["PRODUCTION"] = "production";
|
||||
PresetName["DEVELOPMENT"] = "development";
|
||||
PresetName["MINIMAL"] = "minimal";
|
||||
PresetName["ZERO"] = "zero";
|
||||
// Distributed presets
|
||||
PresetName["WRITER"] = "writer";
|
||||
PresetName["READER"] = "reader";
|
||||
// Service-specific presets
|
||||
PresetName["INGESTION_SERVICE"] = "ingestion-service";
|
||||
PresetName["SEARCH_API"] = "search-api";
|
||||
PresetName["ANALYTICS_SERVICE"] = "analytics-service";
|
||||
PresetName["EDGE_CACHE"] = "edge-cache";
|
||||
PresetName["BATCH_PROCESSOR"] = "batch-processor";
|
||||
PresetName["STREAMING_SERVICE"] = "streaming-service";
|
||||
PresetName["ML_TRAINING"] = "ml-training";
|
||||
PresetName["SIDECAR"] = "sidecar";
|
||||
})(PresetName || (PresetName = {}));
|
||||
/**
|
||||
* Preset categories for organization
|
||||
*/
|
||||
export var PresetCategory;
|
||||
(function (PresetCategory) {
|
||||
PresetCategory["BASIC"] = "basic";
|
||||
PresetCategory["DISTRIBUTED"] = "distributed";
|
||||
PresetCategory["SERVICE"] = "service";
|
||||
})(PresetCategory || (PresetCategory = {}));
|
||||
/**
|
||||
* Model precision options
|
||||
*/
|
||||
export var ModelPrecision;
|
||||
(function (ModelPrecision) {
|
||||
ModelPrecision["FP32"] = "fp32";
|
||||
ModelPrecision["Q8"] = "q8";
|
||||
ModelPrecision["AUTO"] = "auto";
|
||||
ModelPrecision["FAST"] = "fast";
|
||||
ModelPrecision["SMALL"] = "small";
|
||||
})(ModelPrecision || (ModelPrecision = {}));
|
||||
/**
|
||||
* Storage options
|
||||
*/
|
||||
export var StorageOption;
|
||||
(function (StorageOption) {
|
||||
StorageOption["AUTO"] = "auto";
|
||||
StorageOption["MEMORY"] = "memory";
|
||||
StorageOption["DISK"] = "disk";
|
||||
StorageOption["CLOUD"] = "cloud";
|
||||
})(StorageOption || (StorageOption = {}));
|
||||
/**
|
||||
* Feature set options
|
||||
*/
|
||||
export var FeatureSet;
|
||||
(function (FeatureSet) {
|
||||
FeatureSet["MINIMAL"] = "minimal";
|
||||
FeatureSet["DEFAULT"] = "default";
|
||||
FeatureSet["FULL"] = "full";
|
||||
FeatureSet["CUSTOM"] = "custom"; // For custom feature arrays
|
||||
})(FeatureSet || (FeatureSet = {}));
|
||||
/**
|
||||
* Distributed role options
|
||||
*/
|
||||
export var DistributedRole;
|
||||
(function (DistributedRole) {
|
||||
DistributedRole["WRITER"] = "writer";
|
||||
DistributedRole["READER"] = "reader";
|
||||
DistributedRole["HYBRID"] = "hybrid";
|
||||
})(DistributedRole || (DistributedRole = {}));
|
||||
/**
|
||||
* Strongly typed preset configurations
|
||||
*/
|
||||
export const PRESET_CONFIGS = {
|
||||
// Basic presets
|
||||
[PresetName.PRODUCTION]: {
|
||||
storage: StorageOption.DISK,
|
||||
model: ModelPrecision.AUTO,
|
||||
features: FeatureSet.DEFAULT,
|
||||
distributed: false,
|
||||
verbose: false,
|
||||
description: 'Optimized for production use',
|
||||
category: PresetCategory.BASIC
|
||||
},
|
||||
[PresetName.DEVELOPMENT]: {
|
||||
storage: StorageOption.MEMORY,
|
||||
model: ModelPrecision.FP32,
|
||||
features: FeatureSet.FULL,
|
||||
distributed: false,
|
||||
verbose: true,
|
||||
description: 'Optimized for development with verbose logging',
|
||||
category: PresetCategory.BASIC
|
||||
},
|
||||
[PresetName.MINIMAL]: {
|
||||
storage: StorageOption.MEMORY,
|
||||
model: ModelPrecision.Q8,
|
||||
features: FeatureSet.MINIMAL,
|
||||
distributed: false,
|
||||
verbose: false,
|
||||
description: 'Minimal footprint configuration',
|
||||
category: PresetCategory.BASIC
|
||||
},
|
||||
[PresetName.ZERO]: {
|
||||
storage: StorageOption.AUTO,
|
||||
model: ModelPrecision.AUTO,
|
||||
features: FeatureSet.DEFAULT,
|
||||
distributed: false,
|
||||
verbose: false,
|
||||
description: 'True zero configuration with auto-detection',
|
||||
category: PresetCategory.BASIC
|
||||
},
|
||||
// Distributed basic presets
|
||||
[PresetName.WRITER]: {
|
||||
storage: StorageOption.AUTO,
|
||||
model: ModelPrecision.AUTO,
|
||||
features: FeatureSet.MINIMAL,
|
||||
distributed: true,
|
||||
role: DistributedRole.WRITER,
|
||||
writeOnly: true,
|
||||
allowDirectReads: true,
|
||||
verbose: false,
|
||||
description: 'Write-only instance for distributed setups',
|
||||
category: PresetCategory.DISTRIBUTED
|
||||
},
|
||||
[PresetName.READER]: {
|
||||
storage: StorageOption.AUTO,
|
||||
model: ModelPrecision.AUTO,
|
||||
features: FeatureSet.DEFAULT,
|
||||
distributed: true,
|
||||
role: DistributedRole.READER,
|
||||
readOnly: true,
|
||||
lazyLoadInReadOnlyMode: true,
|
||||
verbose: false,
|
||||
description: 'Read-only instance for distributed setups',
|
||||
category: PresetCategory.DISTRIBUTED
|
||||
},
|
||||
// Service-specific presets
|
||||
[PresetName.INGESTION_SERVICE]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.Q8,
|
||||
features: ['core', 'batch-processing', 'entity-registry'],
|
||||
distributed: true,
|
||||
role: DistributedRole.WRITER,
|
||||
writeOnly: true,
|
||||
allowDirectReads: true,
|
||||
verbose: false,
|
||||
description: 'High-throughput data ingestion service',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.SEARCH_API]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.FP32,
|
||||
features: ['core', 'search', 'cache', 'triple-intelligence'],
|
||||
distributed: true,
|
||||
role: DistributedRole.READER,
|
||||
readOnly: true,
|
||||
lazyLoadInReadOnlyMode: true,
|
||||
cache: {
|
||||
hotCacheMaxSize: 10000,
|
||||
autoTune: true
|
||||
},
|
||||
verbose: false,
|
||||
description: 'Low-latency search API service',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.ANALYTICS_SERVICE]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.AUTO,
|
||||
features: ['core', 'search', 'metrics', 'monitoring'],
|
||||
distributed: true,
|
||||
role: DistributedRole.HYBRID,
|
||||
verbose: false,
|
||||
description: 'Analytics and data processing service',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.EDGE_CACHE]: {
|
||||
storage: StorageOption.AUTO,
|
||||
model: ModelPrecision.Q8,
|
||||
features: ['core', 'search', 'cache'],
|
||||
distributed: true,
|
||||
role: DistributedRole.READER,
|
||||
readOnly: true,
|
||||
lazyLoadInReadOnlyMode: true,
|
||||
cache: {
|
||||
hotCacheMaxSize: 1000,
|
||||
autoTune: false
|
||||
},
|
||||
verbose: false,
|
||||
description: 'Edge location cache with minimal footprint',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.BATCH_PROCESSOR]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.Q8,
|
||||
features: ['core', 'batch-processing', 'neural-api'],
|
||||
distributed: true,
|
||||
role: DistributedRole.HYBRID,
|
||||
cache: {
|
||||
hotCacheMaxSize: 5000,
|
||||
batchSize: 500
|
||||
},
|
||||
verbose: false,
|
||||
description: 'Batch processing and bulk operations',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.STREAMING_SERVICE]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.Q8,
|
||||
features: ['core', 'batch-processing', 'wal'],
|
||||
distributed: true,
|
||||
role: DistributedRole.WRITER,
|
||||
writeOnly: true,
|
||||
allowDirectReads: false,
|
||||
verbose: false,
|
||||
description: 'Real-time data streaming service',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.ML_TRAINING]: {
|
||||
storage: StorageOption.CLOUD,
|
||||
model: ModelPrecision.FP32,
|
||||
features: FeatureSet.FULL,
|
||||
distributed: true,
|
||||
role: DistributedRole.HYBRID,
|
||||
cache: {
|
||||
hotCacheMaxSize: 20000,
|
||||
autoTune: true
|
||||
},
|
||||
verbose: true,
|
||||
description: 'Machine learning training service',
|
||||
category: PresetCategory.SERVICE
|
||||
},
|
||||
[PresetName.SIDECAR]: {
|
||||
storage: StorageOption.AUTO,
|
||||
model: ModelPrecision.Q8,
|
||||
features: FeatureSet.MINIMAL,
|
||||
distributed: false,
|
||||
verbose: false,
|
||||
description: 'Lightweight sidecar for microservices',
|
||||
category: PresetCategory.SERVICE
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Type-safe preset getter
|
||||
*/
|
||||
export function getPreset(name) {
|
||||
return PRESET_CONFIGS[name];
|
||||
}
|
||||
/**
|
||||
* Check if a string is a valid preset name
|
||||
*/
|
||||
export function isValidPreset(name) {
|
||||
return Object.values(PresetName).includes(name);
|
||||
}
|
||||
/**
|
||||
* Get presets by category
|
||||
*/
|
||||
export function getPresetsByCategory(category) {
|
||||
return Object.entries(PRESET_CONFIGS)
|
||||
.filter(([_, config]) => config.category === category)
|
||||
.map(([name]) => name);
|
||||
}
|
||||
/**
|
||||
* Get all preset names
|
||||
*/
|
||||
export function getAllPresetNames() {
|
||||
return Object.values(PresetName);
|
||||
}
|
||||
/**
|
||||
* Get preset description
|
||||
*/
|
||||
export function getPresetDescription(name) {
|
||||
return PRESET_CONFIGS[name].description;
|
||||
}
|
||||
/**
|
||||
* Convert preset config to Brainy config
|
||||
*/
|
||||
export function presetToBrainyConfig(preset) {
|
||||
const config = {
|
||||
storage: preset.storage,
|
||||
model: preset.model,
|
||||
verbose: preset.verbose
|
||||
};
|
||||
// Handle features
|
||||
if (Array.isArray(preset.features)) {
|
||||
config.features = preset.features;
|
||||
}
|
||||
else {
|
||||
config.features = preset.features; // Will be expanded by processZeroConfig
|
||||
}
|
||||
// Handle distributed settings
|
||||
if (preset.distributed) {
|
||||
config.distributed = {
|
||||
enabled: true,
|
||||
role: preset.role
|
||||
};
|
||||
if (preset.readOnly)
|
||||
config.readOnly = true;
|
||||
if (preset.writeOnly)
|
||||
config.writeOnly = true;
|
||||
if (preset.allowDirectReads)
|
||||
config.allowDirectReads = true;
|
||||
if (preset.lazyLoadInReadOnlyMode)
|
||||
config.lazyLoadInReadOnlyMode = true;
|
||||
}
|
||||
// Handle cache settings
|
||||
if (preset.cache) {
|
||||
config.cache = preset.cache;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
//# sourceMappingURL=distributedPresets.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue