/** * Self-Healing Controller * ADR-031: Strange Loop Self-Awareness * * Decides and executes healing actions based on observations and model analysis. * This is the "Decide" and "Act" steps in the strange loop. */ import type { SwarmHealthObservation, SelfHealingAction, ActionResult, ExecutedAction, StrangeLoopConfig } from './types.js'; import { SwarmSelfModel } from './self-model.js'; /** * Interface for executing healing actions on the swarm */ export interface ActionExecutor { /** Spawn a new agent */ spawnAgent(agentId: string, config?: Record): Promise; /** Terminate an agent */ terminateAgent(agentId: string): Promise; /** Add a connection between agents */ addConnection(sourceId: string, targetId: string): Promise; /** Remove a connection between agents */ removeConnection(sourceId: string, targetId: string): Promise; /** Redistribute load from an agent */ redistributeLoad(agentId: string): Promise; /** Restart an agent */ restartAgent(agentId: string): Promise; /** Promote an agent to coordinator */ promoteToCoordinator(agentId: string): Promise; /** Demote a coordinator to worker */ demoteCoordinator(agentId: string): Promise; /** Get current swarm observation */ observe(): Promise; } /** * Default no-op action executor for testing */ export declare class NoOpActionExecutor implements ActionExecutor { private mockObservation; spawnAgent(agentId: string): Promise; terminateAgent(): Promise; addConnection(): Promise; removeConnection(): Promise; redistributeLoad(): Promise; restartAgent(): Promise; promoteToCoordinator(): Promise; demoteCoordinator(): Promise; observe(): Promise; setMockObservation(observation: SwarmHealthObservation): void; } /** * Controls the self-healing process by deciding and executing actions */ export declare class SelfHealingController { private model; private executor; private config; private actionHistory; private lastActionTime; private pendingActions; constructor(model: SwarmSelfModel, executor: ActionExecutor, config?: Partial); /** * Decide what healing actions to take based on observation */ decide(observation: SwarmHealthObservation): Promise; /** * Execute a healing action */ act(action: SelfHealingAction): Promise; /** * Get action history */ getActionHistory(): readonly ExecutedAction[]; /** * Clear action history */ clearHistory(): void; /** * Update the health delta for the last action */ updateLastActionHealthDelta(healthDelta: number): void; private executeSpawnRedundantAgent; private executeAddConnection; private executeRemoveConnection; private executeRedistributeLoad; private executeRestartAgent; private executeIsolateAgent; private executePromoteToCoordinator; private executeDemoteCoordinator; private executeTriggerFailover; private executeScaleUp; private executeScaleDown; private executeRebalanceTopology; /** * Map a vulnerability to a healing action */ private mapVulnerabilityToAction; /** * Map a prediction to a healing action */ private mapPredictionToAction; /** * Convert severity to priority */ private severityToPriority; /** * Convert probability to priority */ private probabilityToPriority; /** * Deduplicate actions (same type + target) */ private deduplicateActions; /** * Prioritize actions by priority and estimated impact */ private prioritizeActions; /** * Compare priorities (higher value = higher priority) */ private comparePriority; } /** * Create a self-healing controller */ export declare function createSelfHealingController(model: SwarmSelfModel, executor: ActionExecutor, config?: Partial): SelfHealingController; //# sourceMappingURL=healing-controller.d.ts.map