/** * @license * Copyright 2025 OSAgent OC * SPDX-License-Identifier: Apache-2.0 */ import type { RegisteredAgent, QueuedPrompt, SkillDetectionResult, OrchestrationDecision, OrchestratorResult, OrchestrationEvent, OrchestrationEventType, OrchestrationConfig, VerificationResult, ResponseMetadata } from './types.js'; import { AgentRegistry } from './agent-registry.js'; import { OrchestrationQueue } from './orchestration-queue.js'; /** * Agent execution function type */ export type AgentExecutor = (agent: RegisteredAgent, prompt: string, context?: Record) => Promise<{ result: string; success: boolean; error?: string; }>; /** * Main Orchestrator - coordinates agent selection and task execution */ export declare class Orchestrator { private config; private registry; private queue; private skillDetector; private eventListeners; private executor; private isProcessing; constructor(config?: Partial, registry?: AgentRegistry); /** * Set the agent executor function */ setExecutor(executor: AgentExecutor): void; /** * Submit a prompt for orchestration */ submit(prompt: string, options?: { priority?: number; parentPromptId?: string; skipDetection?: boolean; }): Promise; /** * Execute a queued prompt with the assigned agent */ executePrompt(queuedPrompt: QueuedPrompt, decision: OrchestrationDecision, agent: RegisteredAgent): Promise; /** * Make orchestration decision based on prompt analysis */ makeDecision(prompt: string, detectionResult?: SkillDetectionResult): OrchestrationDecision; /** * Generate human-readable reasoning for the decision */ private generateDecisionReasoning; /** * Process the next item in the queue */ processNext(): Promise; /** * Run verification checks on completed task */ verify(promptId: string, checks: string[]): Promise; /** * Create response metadata for a completed prompt */ createResponseMetadata(promptId: string, verification?: VerificationResult): ResponseMetadata | null; /** * Get queue statistics */ getStats(): { queueSize: number; pending: number; processing: number; historySize: number; averageProcessingTime: number; successRate: number; listenerErrors: number; }; /** * Get prompt by ID */ getPrompt(id: string): QueuedPrompt | null; /** * Get all queued prompts */ getQueuedPrompts(): QueuedPrompt[]; /** * Get recent history */ getHistory(limit?: number): QueuedPrompt[]; /** * Cancel a queued prompt */ cancel(promptId: string): boolean; /** * Update configuration */ updateConfig(config: Partial): void; /** * Get current configuration */ getConfig(): OrchestrationConfig; /** * Get agent registry */ getRegistry(): AgentRegistry; /** * Subscribe to orchestration events */ on(eventType: OrchestrationEventType, callback: (event: OrchestrationEvent) => void): () => void; /** * Emit an orchestration event */ private emit; /** * Export state for persistence */ export(): { config: OrchestrationConfig; queue: ReturnType; agents: RegisteredAgent[]; }; /** * Import state */ import(state: { config?: Partial; queue?: ReturnType; agents?: RegisteredAgent[]; }): void; } export declare const defaultOrchestrator: Orchestrator;