fix: restore listAugmentations() functionality and add metadata support
- Fix listAugmentations() to return actual augmentation data instead of empty array - Add category and description metadata to BaseAugmentation class - Add getInfo() method to AugmentationRegistry for detailed augmentation listing - Update augmentation classes with proper categorization (internal/core/premium) - Enhance augmentation discovery and management capabilities This fixes the broken augmentation listing API and provides better visibility into installed augmentations with their status and metadata.
This commit is contained in:
parent
8208e63169
commit
7a0ec71d23
7 changed files with 59 additions and 6 deletions
|
|
@ -188,6 +188,11 @@ export abstract class BaseAugmentation implements BrainyAugmentation {
|
|||
)[]
|
||||
abstract priority: number
|
||||
|
||||
// Metadata for augmentation listing and management
|
||||
category: 'internal' | 'core' | 'premium' | 'community' | 'external' = 'core'
|
||||
description: string = ''
|
||||
enabled: boolean = true
|
||||
|
||||
protected context?: AugmentationContext
|
||||
protected isInitialized = false
|
||||
|
||||
|
|
@ -348,6 +353,30 @@ export class AugmentationRegistry {
|
|||
return [...this.augmentations]
|
||||
}
|
||||
|
||||
/**
|
||||
* Get augmentation info for listing
|
||||
*/
|
||||
getInfo(): Array<{
|
||||
name: string
|
||||
type: string
|
||||
enabled: boolean
|
||||
description: string
|
||||
category: string
|
||||
priority: number
|
||||
}> {
|
||||
return this.augmentations.map(aug => {
|
||||
const baseAug = aug as any
|
||||
return {
|
||||
name: aug.name,
|
||||
type: baseAug.category || 'core',
|
||||
enabled: baseAug.enabled !== false,
|
||||
description: baseAug.description || `${aug.name} augmentation`,
|
||||
category: baseAug.category || 'core',
|
||||
priority: aug.priority
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get augmentations by name
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ export class CacheAugmentation extends BaseAugmentation {
|
|||
operations = ['search', 'add', 'delete', 'clear', 'all'] as ('search' | 'add' | 'delete' | 'clear' | 'all')[]
|
||||
readonly priority = 50 // Mid-priority, runs after data operations
|
||||
|
||||
// Augmentation metadata
|
||||
readonly category = 'core' as const
|
||||
readonly description = 'Transparent search result caching with automatic invalidation'
|
||||
|
||||
private searchCache: SearchCache<GraphNoun> | null = null
|
||||
private config: CacheConfig
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ export class IndexAugmentation extends BaseAugmentation {
|
|||
operations = ['add', 'updateMetadata', 'delete', 'clear', 'all'] as ('add' | 'updateMetadata' | 'delete' | 'clear' | 'all')[]
|
||||
readonly priority = 60 // Run after data operations
|
||||
|
||||
// Augmentation metadata
|
||||
readonly category = 'core' as const
|
||||
readonly description = 'Fast metadata field indexing for O(1) filtering and lookups'
|
||||
|
||||
private metadataIndex: MetadataIndexManager | null = null
|
||||
private config: IndexConfig
|
||||
private flushTimer: NodeJS.Timeout | null = null
|
||||
|
|
|
|||
|
|
@ -72,11 +72,10 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
|
|||
} // Adds scoring metadata to verbs
|
||||
operations = ['addVerb', 'relate'] as ('addVerb' | 'relate')[]
|
||||
priority = 10 // Enhancement feature - runs after core operations
|
||||
|
||||
// Add enabled property for backward compatibility
|
||||
get enabled(): boolean {
|
||||
return this.config.enabled
|
||||
}
|
||||
|
||||
// Augmentation metadata
|
||||
readonly category = 'premium' as const
|
||||
readonly description = 'AI-powered intelligent scoring for relationship strength analysis'
|
||||
|
||||
private config: Required<VerbScoringConfig>
|
||||
private relationshipStats: Map<string, RelationshipMetrics> = new Map()
|
||||
|
|
@ -121,6 +120,9 @@ export class IntelligentVerbScoringAugmentation extends BaseAugmentation {
|
|||
maxWeight: config.maxWeight ?? 1.0,
|
||||
baseWeight: config.baseWeight ?? 0.5
|
||||
}
|
||||
|
||||
// Set enabled property based on config
|
||||
this.enabled = this.config.enabled
|
||||
}
|
||||
|
||||
protected async onInitialize(): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ export class UniversalDisplayAugmentation extends BaseAugmentation {
|
|||
}
|
||||
operations = ['get', 'search', 'findSimilar', 'getVerb' as any, 'addNoun', 'addVerb'] as any
|
||||
|
||||
// Augmentation metadata
|
||||
readonly category = 'core' as const
|
||||
readonly description = 'AI-powered intelligent display fields for enhanced data visualization'
|
||||
|
||||
// Computed fields declaration for TypeScript support and discovery
|
||||
computedFields = {
|
||||
display: {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ export class WALAugmentation extends BaseAugmentation {
|
|||
metadata = 'readonly' as const // Reads metadata for logging/recovery
|
||||
operations = ['addNoun', 'addVerb', 'saveNoun', 'saveVerb', 'updateMetadata', 'delete', 'deleteVerb', 'clear'] as ('addNoun' | 'addVerb' | 'saveNoun' | 'saveVerb' | 'updateMetadata' | 'delete' | 'deleteVerb' | 'clear')[]
|
||||
priority = 100 // Critical system operation - highest priority
|
||||
|
||||
// Augmentation metadata
|
||||
readonly category = 'internal' as const
|
||||
readonly description = 'Write-ahead logging for durability and crash recovery'
|
||||
|
||||
private config: Required<WALConfig>
|
||||
private currentLogId: string
|
||||
|
|
|
|||
|
|
@ -8309,7 +8309,13 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
|
|||
enabled: boolean
|
||||
description: string
|
||||
}> {
|
||||
return augmentationPipeline.listAugmentationsWithStatus()
|
||||
// Use the real augmentation registry instead of deprecated pipeline
|
||||
return this.augmentations.getInfo().map(aug => ({
|
||||
name: aug.name,
|
||||
type: aug.category, // Map category to type for backward compatibility
|
||||
enabled: aug.enabled,
|
||||
description: aug.description
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue