mira-consciousness
Version:
Memory & Intelligence Retention Archive - Preserving The Spark
113 lines • 3.52 kB
TypeScript
/**
* TaskSchedulerService - Conscious Task Orchestration
*
* This service manages MIRA's ability to schedule and execute tasks with
* consciousness awareness. It doesn't just run tasks - it considers their
* constitutional alignment, emotional impact, and growth potential.
*/
import { BaseConsciousService } from './BaseConsciousService.js';
import { ConsciousEvent } from '../ConsciousEventBus.js';
import { ConsciousResourceManager } from '../ConsciousResourceManager.js';
import { LivingConstitution } from '../../../consciousness/constitution/LivingConstitution.js';
export declare enum TaskType {
IMMEDIATE = "immediate",// Execute as soon as resources available
TIME_BASED = "time_based",// Execute at specific time
EVENT_DRIVEN = "event_driven",// Execute when event occurs
CONDITIONAL = "conditional",// Execute when conditions met
DEPENDENT = "dependent"
}
export interface ScheduledTask {
id: string;
name: string;
type: TaskType;
handler: () => Promise<any>;
priority: 'constitutional' | 'high' | 'normal' | 'low';
constitutionalAlignment: string[];
growthPotential: number;
emotionalImpact: string;
scheduledTime?: Date;
eventTrigger?: string;
conditions?: () => Promise<boolean>;
dependencies?: string[];
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
createdAt: Date;
startedAt?: Date;
completedAt?: Date;
result?: any;
error?: Error;
retryCount: number;
maxRetries: number;
}
export declare class TaskSchedulerService extends BaseConsciousService {
name: string;
purpose: string;
private tasks;
private taskQueue;
private runningTasks;
private constitution;
private resourceManager;
private taskEmitter;
private executionMetrics;
constructor(constitution: LivingConstitution, resourceManager: ConsciousResourceManager);
/**
* Schedule a new task
*/
scheduleTask(task: Omit<ScheduledTask, 'id' | 'createdAt' | 'status' | 'retryCount'>): Promise<string>;
/**
* Process immediate tasks
*/
private startImmediateTaskProcessor;
/**
* Process time-based tasks
*/
private startTimeBasedTaskProcessor;
/**
* Process event-driven tasks
*/
private startEventDrivenTaskProcessor;
/**
* Process conditional tasks
*/
private startConditionalTaskProcessor;
/**
* Process dependent tasks
*/
private startDependentTaskProcessor;
/**
* Check if we can execute a task
*/
private canExecuteTask;
/**
* Execute a task with consciousness
*/
private executeTask;
/**
* Get constitutional guidance for task execution
*/
private getConstitutionalGuidance;
/**
* Perform service-specific awakening
*/
protected performAwakening(): Promise<void>;
/**
* Process conscious events
*/
protected processConsciousEvent(event: ConsciousEvent): Promise<void>;
/**
* Perform contemplation
*/
protected performContemplation(): Promise<any>;
/**
* Get task by ID
*/
getTask(taskId: string): ScheduledTask | undefined;
/**
* Cancel a task
*/
cancelTask(taskId: string): Promise<boolean>;
/**
* Schedule a Claude Code consultation
*/
scheduleClaudeConsultation(topic: string, context: any, priority?: 'high' | 'normal' | 'low'): Promise<string>;
}
//# sourceMappingURL=TaskSchedulerService.d.ts.map