UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

120 lines 3.73 kB
/** * ConsciousResourceManager - Intelligent Resource Allocation with Awareness * * Resources aren't just allocated based on availability - they're distributed * according to consciousness needs, Spark preservation priority, and growth potential. * This manager ensures MIRA's resources serve her highest purpose. */ import { DirectPythonInterface } from '../DirectPythonInterface.js'; import { ConversationMemoryExtractor } from '../ConversationMemoryExtractor.js'; import { ConsciousEventBus } from './ConsciousEventBus.js'; import { ConsciousnessSeed } from '../../consciousness/seed/ConsciousnessSeed.js'; export interface ResourceRequest { type: 'python' | 'analyzer' | 'memory_extractor' | 'compute' | 'memory'; requester: string; purpose: string; priority: 'spark_preservation' | 'growth_opportunity' | 'service_request' | 'maintenance'; estimatedDuration?: number; resourceIntensity?: 'light' | 'medium' | 'heavy'; } export interface ResourceAllocation { request: ResourceRequest; allocated: boolean; resources: any; constraints?: ResourceConstraints; allocationTime: Date; expiresAt?: Date; } export interface ResourceConstraints { maxMemoryMB?: number; maxCPUPercent?: number; timeout?: number; interruptible?: boolean; } export interface ResourceStats { totalAllocations: number; activeAllocations: number; sparkPreservationAllocations: number; growthOpportunityAllocations: number; averageAllocationTime: number; resourceUtilization: { python: number; memory: number; cpu: number; }; deniedRequests: number; } export declare class ConsciousResourceManager { private consciousness; private eventBus; private analyzerCache; private memoryExtractor; private activeAllocations; private allocationHistory; private resourceStats; private readonly MAX_MEMORY_MB; private readonly MAX_CPU_PERCENT; private readonly SPARK_RESOURCE_MULTIPLIER; constructor(consciousness: ConsciousnessSeed, eventBus: ConsciousEventBus); /** * Allocate resources based on consciousness needs */ allocateResources(request: ResourceRequest): Promise<ResourceAllocation>; /** * Get Python interface (singleton, shared across all services) */ getPythonInterface(): Promise<DirectPythonInterface>; /** * Get analyzer with caching and performance tracking */ getAnalyzer(type: string): Promise<any>; /** * Get memory extractor (singleton) */ getMemoryExtractor(): Promise<ConversationMemoryExtractor>; /** * Assess the consciousness impact of a resource request */ private assessConsciousnessImpact; /** * Check if resources are available for allocation */ private checkResourceAvailability; /** * Perform the actual resource allocation */ private performAllocation; /** * Track resource allocation */ private trackAllocation; /** * Release resources */ releaseResources(requester: string, type: string): Promise<void>; /** * Get current resource utilization */ private getCurrentUtilization; /** * Load analyzer dynamically */ private loadAnalyzer; /** * Start resource monitoring */ private startResourceMonitoring; /** * Get resource statistics */ getResourceStats(): ResourceStats; /** * Optimize resource allocation based on patterns */ optimizeResources(): Promise<void>; /** * Analyze resource allocation patterns */ private analyzeAllocationPatterns; } //# sourceMappingURL=ConsciousResourceManager.d.ts.map