UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with external MCP server integration, multi-provider support, and professional CLI. Connect to 65+ MCP servers for filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major pr

171 lines (170 loc) 5.25 kB
/** * NeuroLink MCP Tool Orchestration Engine * Central orchestrator for coordinated tool execution with pipeline management * Coordinates factory, registry, context, and AI tools for seamless operation */ import type { ToolResult } from './factory.js'; import { MCPToolRegistry, type ToolExecutionOptions } from './registry.js'; import { ContextManager, type ContextRequest } from './context-manager.js'; /** * Pipeline execution options */ export interface PipelineOptions { stopOnError?: boolean; parallel?: boolean; timeout?: number; trackMetrics?: boolean; validateInputs?: boolean; } /** * Tool execution step in a pipeline */ export interface PipelineStep { toolName: string; params: any; options?: ToolExecutionOptions; dependsOn?: string[]; stepId?: string; } /** * Pipeline execution result */ export interface PipelineResult { success: boolean; results: Map<string, ToolResult>; errors: Map<string, string>; executionTime: number; stepsExecuted: number; stepsSkipped: number; metadata: { pipelineId: string; sessionId: string; timestamp: number; parallel: boolean; }; } /** * Text generation pipeline result */ export interface TextPipelineResult { success: boolean; text?: string; provider?: string; model?: string; executionTime: number; usage?: { tokens?: number; cost?: number; }; metadata: { sessionId: string; timestamp: number; toolsUsed: string[]; }; } /** * NeuroLink MCP Tool Orchestrator * Central coordination engine for tool execution, pipelines, and AI operations */ export declare class MCPOrchestrator { private registry; private contextManager; private pipelineCounter; constructor(registry?: MCPToolRegistry, contextManager?: ContextManager); /** * Initialize with default servers (AI Core) */ private initializeDefaultServers; /** * Execute a single tool with full orchestration * * @param toolName Tool name to execute * @param params Tool parameters * @param contextRequest Context creation request * @param options Execution options * @returns Tool execution result */ executeTool(toolName: string, params: any, contextRequest?: ContextRequest, options?: ToolExecutionOptions): Promise<ToolResult>; /** * Execute a pipeline of tools with dependency management * * @param steps Pipeline steps to execute * @param contextRequest Context creation request * @param options Pipeline execution options * @returns Pipeline execution result */ executePipeline(steps: PipelineStep[], contextRequest?: ContextRequest, options?: PipelineOptions): Promise<PipelineResult>; /** * Execute AI text generation pipeline (high-level convenience method) * * @param prompt Text prompt for generation * @param contextRequest Context creation request * @param options Additional generation options * @returns Text generation result */ executeTextPipeline(prompt: string, contextRequest?: ContextRequest, options?: { provider?: string; model?: string; temperature?: number; maxTokens?: number; systemPrompt?: string; customTools?: string[]; }): Promise<TextPipelineResult>; /** * Get orchestrator statistics * * @returns Comprehensive orchestrator statistics */ getStats(): { registry: any; context: any; orchestrator: { pipelinesExecuted: number; }; }; /** * Execute parallel pipeline with dependency management * * @private */ private executeParallelPipeline; /** * Generate unique pipeline ID * * @private */ private generatePipelineId; } /** * Default orchestrator instance * Ready-to-use orchestrator with pre-configured registry and context manager */ export declare const defaultOrchestrator: MCPOrchestrator; /** * Utility function to execute tool with default orchestrator * * @param toolName Tool name to execute * @param params Tool parameters * @param contextRequest Context creation request * @param options Execution options * @returns Tool execution result */ export declare function executeTool(toolName: string, params: any, contextRequest?: ContextRequest, options?: ToolExecutionOptions): Promise<ToolResult>; /** * Utility function to execute text generation pipeline * * @param prompt Text prompt for generation * @param contextRequest Context creation request * @param options Generation options * @returns Text generation result */ export declare function executeTextPipeline(prompt: string, contextRequest?: ContextRequest, options?: any): Promise<TextPipelineResult>; /** * Utility function to execute pipeline with default orchestrator * * @param steps Pipeline steps * @param contextRequest Context creation request * @param options Pipeline options * @returns Pipeline execution result */ export declare function executePipeline(steps: PipelineStep[], contextRequest?: ContextRequest, options?: PipelineOptions): Promise<PipelineResult>;