@juspay/neurolink 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +14 -5
  2. package/README.md +150 -92
  3. package/dist/lib/mcp/dynamic-chain-executor.d.ts +201 -0
  4. package/dist/lib/mcp/dynamic-chain-executor.js +489 -0
  5. package/dist/lib/mcp/dynamic-orchestrator.d.ts +109 -0
  6. package/dist/lib/mcp/dynamic-orchestrator.js +351 -0
  7. package/dist/lib/mcp/error-manager.d.ts +254 -0
  8. package/dist/lib/mcp/error-manager.js +501 -0
  9. package/dist/lib/mcp/error-recovery.d.ts +158 -0
  10. package/dist/lib/mcp/error-recovery.js +405 -0
  11. package/dist/lib/mcp/health-monitor.d.ts +256 -0
  12. package/dist/lib/mcp/health-monitor.js +621 -0
  13. package/dist/lib/mcp/orchestrator.d.ts +136 -5
  14. package/dist/lib/mcp/orchestrator.js +316 -9
  15. package/dist/lib/mcp/registry.d.ts +22 -0
  16. package/dist/lib/mcp/registry.js +24 -0
  17. package/dist/lib/mcp/semaphore-manager.d.ts +137 -0
  18. package/dist/lib/mcp/semaphore-manager.js +329 -0
  19. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  20. package/dist/lib/mcp/session-manager.d.ts +186 -0
  21. package/dist/lib/mcp/session-manager.js +400 -0
  22. package/dist/lib/mcp/session-persistence.d.ts +93 -0
  23. package/dist/lib/mcp/session-persistence.js +298 -0
  24. package/dist/lib/mcp/transport-manager.d.ts +153 -0
  25. package/dist/lib/mcp/transport-manager.js +330 -0
  26. package/dist/lib/mcp/unified-registry.d.ts +42 -1
  27. package/dist/lib/mcp/unified-registry.js +122 -2
  28. package/dist/lib/neurolink.d.ts +75 -0
  29. package/dist/lib/neurolink.js +104 -0
  30. package/dist/mcp/dynamic-chain-executor.d.ts +201 -0
  31. package/dist/mcp/dynamic-chain-executor.js +489 -0
  32. package/dist/mcp/dynamic-orchestrator.d.ts +109 -0
  33. package/dist/mcp/dynamic-orchestrator.js +351 -0
  34. package/dist/mcp/error-manager.d.ts +254 -0
  35. package/dist/mcp/error-manager.js +501 -0
  36. package/dist/mcp/error-recovery.d.ts +158 -0
  37. package/dist/mcp/error-recovery.js +405 -0
  38. package/dist/mcp/health-monitor.d.ts +256 -0
  39. package/dist/mcp/health-monitor.js +621 -0
  40. package/dist/mcp/orchestrator.d.ts +136 -5
  41. package/dist/mcp/orchestrator.js +316 -9
  42. package/dist/mcp/plugins/core/neurolink-mcp.json +15 -15
  43. package/dist/mcp/registry.d.ts +22 -0
  44. package/dist/mcp/registry.js +24 -0
  45. package/dist/mcp/semaphore-manager.d.ts +137 -0
  46. package/dist/mcp/semaphore-manager.js +329 -0
  47. package/dist/mcp/session-manager.d.ts +186 -0
  48. package/dist/mcp/session-manager.js +400 -0
  49. package/dist/mcp/session-persistence.d.ts +93 -0
  50. package/dist/mcp/session-persistence.js +299 -0
  51. package/dist/mcp/transport-manager.d.ts +153 -0
  52. package/dist/mcp/transport-manager.js +331 -0
  53. package/dist/mcp/unified-registry.d.ts +42 -1
  54. package/dist/mcp/unified-registry.js +122 -2
  55. package/dist/neurolink.d.ts +75 -0
  56. package/dist/neurolink.js +104 -0
  57. package/package.json +245 -244
package/CHANGELOG.md CHANGED
@@ -1,16 +1,22 @@
1
- # [4.0.0](https://github.com/juspay/neurolink/compare/v3.0.1...v4.0.0) (2025-07-06)
1
+ # [4.1.0](https://github.com/juspay/neurolink/compare/v4.0.0...v4.1.0) (2025-07-09)
2
+
2
3
 
4
+ ### Features
3
5
 
4
- * feat(core)!: transform NeuroLink into enterprise AI analytics platform ([74c88d6](https://github.com/juspay/neurolink/commit/74c88d6484bbd983aba9119929481e655d62eab3))
6
+ * **mcp:** comprehensive MCP system overhaul with GitHub PR fixes ([c0d8114](https://github.com/juspay/neurolink/commit/c0d8114ef1ab2d5dd3162c369f234d0de17397f7))
7
+
8
+ # [4.0.0](https://github.com/juspay/neurolink/compare/v3.0.1...v4.0.0) (2025-07-06)
5
9
 
10
+ - feat(core)!: transform NeuroLink into enterprise AI analytics platform ([74c88d6](https://github.com/juspay/neurolink/commit/74c88d6484bbd983aba9119929481e655d62eab3))
6
11
 
7
12
  ### BREAKING CHANGES
8
13
 
9
- * Major architectural enhancement from basic AI SDK
10
- to comprehensive enterprise platform with analytics, evaluation,
11
- real-time services, and business intelligence capabilities.
14
+ - Major architectural enhancement from basic AI SDK
15
+ to comprehensive enterprise platform with analytics, evaluation,
16
+ real-time services, and business intelligence capabilities.
12
17
 
13
18
  Core Features Added:
19
+
14
20
  - Analytics System: Usage tracking, cost estimation, performance monitoring
15
21
  - Evaluation Framework: AI-powered quality assessment and scoring
16
22
  - Enterprise Config: Backup/restore, validation, provider management
@@ -21,6 +27,7 @@ Core Features Added:
21
27
  - Provider Integration: Analytics helper integrated across all 9 providers
22
28
 
23
29
  Technical Implementation:
30
+
24
31
  - NEW: src/lib/core/analytics.ts - Real usage tracking engine
25
32
  - NEW: src/lib/core/evaluation.ts - AI quality assessment framework
26
33
  - NEW: src/lib/config/configManager.ts - Enterprise configuration management
@@ -38,6 +45,7 @@ Backward Compatibility: 100% maintained - existing functionality preserved
38
45
  New Features: Opt-in via --enable-analytics --enable-evaluation flags
39
46
 
40
47
  Business Impact:
48
+
41
49
  - Production Monitoring: Real-time performance and cost tracking
42
50
  - Quality Assurance: AI-powered response evaluation and scoring
43
51
  - Cost Optimization: Usage analytics and provider comparison
@@ -46,6 +54,7 @@ Business Impact:
46
54
  - Enterprise Readiness: OpenTelemetry observability and operational excellence
47
55
 
48
56
  Performance Metrics:
57
+
49
58
  - Analytics: Real token counts (299-768), response times (2-10s)
50
59
  - Evaluation: Quality scores (8-10/10), sub-6s processing
51
60
  - Providers: All 9 providers enhanced with zero breaking changes
package/README.md CHANGED
@@ -1,4 +1,15 @@
1
- # 🧠 NeuroLink
1
+ # @juspay/neurolink
2
+
3
+ <!-- TOC -->
4
+
5
+ - [📄 License](#[object Object])
6
+ - [🔗 Related Projects](#-related-projects)
7
+ <!-- /TOC -->
8
+
9
+ Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.
10
+
11
+ **Version:** 4.0.0
12
+ **License:** MIT
2
13
 
3
14
  [![NPM Version](https://img.shields.io/npm/v/@juspay/neurolink)](https://www.npmjs.com/package/@juspay/neurolink)
4
15
  [![Downloads](https://img.shields.io/npm/dm/@juspay/neurolink)](https://www.npmjs.com/package/@juspay/neurolink)
@@ -37,28 +48,28 @@ npm run config:validate
37
48
  ```typescript
38
49
  // Modern camelCase interfaces with rich context
39
50
  interface ExecutionContext {
40
- sessionId?: string;
41
- userId?: string;
42
- aiProvider?: string;
43
- permissions?: string[];
44
- cacheOptions?: CacheOptions;
45
- fallbackOptions?: FallbackOptions;
46
- metadata?: Record<string, unknown>;
51
+ sessionId?: string;
52
+ userId?: string;
53
+ aiProvider?: string;
54
+ permissions?: string[];
55
+ cacheOptions?: CacheOptions;
56
+ fallbackOptions?: FallbackOptions;
57
+ metadata?: Record<string, unknown>;
47
58
  }
48
59
 
49
60
  // Optional methods for maximum flexibility
50
61
  interface McpRegistry {
51
- registerServer?(
52
- serverId: string,
53
- config?: unknown,
54
- context?: ExecutionContext,
55
- ): Promise<void>;
56
- executeTool?<T>(
57
- toolName: string,
58
- args?: unknown,
59
- context?: ExecutionContext,
60
- ): Promise<T>;
61
- listTools?(context?: ExecutionContext): Promise<ToolInfo[]>;
62
+ registerServer?(
63
+ serverId: string,
64
+ config?: unknown,
65
+ context?: ExecutionContext,
66
+ ): Promise<void>;
67
+ executeTool?<T>(
68
+ toolName: string,
69
+ args?: unknown,
70
+ context?: ExecutionContext,
71
+ ): Promise<T>;
72
+ listTools?(context?: ExecutionContext): Promise<ToolInfo[]>;
62
73
  }
63
74
  ```
64
75
 
@@ -104,8 +115,8 @@ import { createBestAIProvider } from "@juspay/neurolink";
104
115
  // Auto-selects best available provider
105
116
  const provider = createBestAIProvider();
106
117
  const result = await provider.generateText({
107
- prompt: "Write a haiku about programming",
108
- timeout: "30s", // Optional: Set custom timeout (default: 30s)
118
+ prompt: "Write a haiku about programming",
119
+ timeout: "30s", // Optional: Set custom timeout (default: 30s)
109
120
  });
110
121
 
111
122
  console.log(result.text);
@@ -127,8 +138,8 @@ const provider = createBestAIProvider();
127
138
 
128
139
  // Detailed method name
129
140
  const story = await provider.generateText({
130
- prompt: "Write a short story about AI",
131
- maxTokens: 200,
141
+ prompt: "Write a short story about AI",
142
+ maxTokens: 200,
132
143
  });
133
144
 
134
145
  // CLI-style method names
@@ -166,10 +177,10 @@ const result = await neurolink.generateText("Write a story");
166
177
 
167
178
  // With enhancements (NEW!)
168
179
  const enhancedResult = await neurolink.generateText({
169
- prompt: "Write a business proposal",
170
- enableAnalytics: true, // Get usage & cost data
171
- enableEvaluation: true, // Get AI quality scores
172
- context: { project: "Q1-sales" }, // Custom context
180
+ prompt: "Write a business proposal",
181
+ enableAnalytics: true, // Get usage & cost data
182
+ enableEvaluation: true, // Get AI quality scores
183
+ context: { project: "Q1-sales" }, // Custom context
173
184
  });
174
185
 
175
186
  // Access enhancement data
@@ -179,25 +190,25 @@ console.log("Response:", enhancedResult.content);
179
190
 
180
191
  // 🆕 NEW: Enhanced Evaluation with Domain Awareness
181
192
  import {
182
- performEnhancedEvaluation,
183
- createEnhancedContext,
193
+ performEnhancedEvaluation,
194
+ createEnhancedContext,
184
195
  } from "@juspay/neurolink";
185
196
 
186
197
  const enhancedContext = createEnhancedContext(
187
- "Write a business proposal for Q1 expansion",
188
- enhancedResult.text,
189
- {
190
- domain: "Business development",
191
- role: "Business proposal assistant",
192
- toolsUsed: ["generate-text", "analytics-helper"],
193
- conversationHistory: [
194
- { role: "user", content: "I need help with our Q1 business plan" },
195
- {
196
- role: "assistant",
197
- content: "I can help you create a comprehensive plan",
198
- },
199
- ],
200
- },
198
+ "Write a business proposal for Q1 expansion",
199
+ enhancedResult.text,
200
+ {
201
+ domain: "Business development",
202
+ role: "Business proposal assistant",
203
+ toolsUsed: ["generate-text", "analytics-helper"],
204
+ conversationHistory: [
205
+ { role: "user", content: "I need help with our Q1 business plan" },
206
+ {
207
+ role: "assistant",
208
+ content: "I can help you create a comprehensive plan",
209
+ },
210
+ ],
211
+ },
201
212
  );
202
213
 
203
214
  const domainEvaluation = await performEnhancedEvaluation(enhancedContext);
@@ -215,39 +226,39 @@ console.log("🎯 Enhanced Evaluation:", domainEvaluation);
215
226
 
216
227
  ```typescript
217
228
  import {
218
- createEnhancedChatService,
219
- NeuroLinkWebSocketServer,
229
+ createEnhancedChatService,
230
+ NeuroLinkWebSocketServer,
220
231
  } from "@juspay/neurolink";
221
232
 
222
233
  // Enhanced chat with WebSocket support
223
234
  const chatService = createEnhancedChatService({
224
- provider: await createBestAIProvider(),
225
- enableWebSocket: true,
226
- enableSSE: true,
227
- streamingConfig: {
228
- bufferSize: 8192,
229
- compressionEnabled: true,
230
- },
235
+ provider: await createBestAIProvider(),
236
+ enableWebSocket: true,
237
+ enableSSE: true,
238
+ streamingConfig: {
239
+ bufferSize: 8192,
240
+ compressionEnabled: true,
241
+ },
231
242
  });
232
243
 
233
244
  // WebSocket server for real-time applications
234
245
  const wsServer = new NeuroLinkWebSocketServer({
235
- port: 8080,
236
- maxConnections: 1000,
237
- enableCompression: true,
246
+ port: 8080,
247
+ maxConnections: 1000,
248
+ enableCompression: true,
238
249
  });
239
250
 
240
251
  // Handle real-time chat
241
252
  wsServer.on("chat-message", async ({ connectionId, message }) => {
242
- await chatService.streamChat({
243
- prompt: message.data.prompt,
244
- onChunk: (chunk) => {
245
- wsServer.sendMessage(connectionId, {
246
- type: "ai-chunk",
247
- data: { chunk },
248
- });
249
- },
250
- });
253
+ await chatService.streamChat({
254
+ prompt: message.data.prompt,
255
+ onChunk: (chunk) => {
256
+ wsServer.sendMessage(connectionId, {
257
+ type: "ai-chunk",
258
+ data: { chunk },
259
+ });
260
+ },
261
+ });
251
262
  });
252
263
  ```
253
264
 
@@ -258,11 +269,11 @@ import { initializeTelemetry, getTelemetryStatus } from "@juspay/neurolink";
258
269
 
259
270
  // Optional enterprise monitoring (zero overhead when disabled)
260
271
  const telemetry = initializeTelemetry({
261
- serviceName: "my-ai-app",
262
- endpoint: "http://localhost:4318",
263
- enableTracing: true,
264
- enableMetrics: true,
265
- enableLogs: true,
272
+ serviceName: "my-ai-app",
273
+ endpoint: "http://localhost:4318",
274
+ enableTracing: true,
275
+ enableMetrics: true,
276
+ enableLogs: true,
266
277
  });
267
278
 
268
279
  // Check telemetry status
@@ -274,7 +285,7 @@ console.log("Version:", status.version);
274
285
  // All AI operations are now automatically monitored
275
286
  const provider = await createBestAIProvider();
276
287
  const result = await provider.generateText({
277
- prompt: "Generate business report",
288
+ prompt: "Generate business report",
278
289
  });
279
290
  // Telemetry automatically tracks: response time, token usage, cost, errors
280
291
  ```
@@ -422,34 +433,34 @@ npx @juspay/neurolink batch prompts.txt --timeout 45s --output results.json
422
433
  ```typescript
423
434
  // SvelteKit API route with timeout handling
424
435
  export const POST: RequestHandler = async ({ request }) => {
425
- const { message } = await request.json();
426
- const provider = createBestAIProvider();
427
-
428
- try {
429
- const result = await provider.streamText({
430
- prompt: message,
431
- timeout: "2m", // 2 minutes for streaming
432
- });
433
- return new Response(result.toReadableStream());
434
- } catch (error) {
435
- if (error.name === "TimeoutError") {
436
- return new Response("Request timed out", { status: 408 });
437
- }
438
- throw error;
439
- }
436
+ const { message } = await request.json();
437
+ const provider = createBestAIProvider();
438
+
439
+ try {
440
+ const result = await provider.streamText({
441
+ prompt: message,
442
+ timeout: "2m", // 2 minutes for streaming
443
+ });
444
+ return new Response(result.toReadableStream());
445
+ } catch (error) {
446
+ if (error.name === "TimeoutError") {
447
+ return new Response("Request timed out", { status: 408 });
448
+ }
449
+ throw error;
450
+ }
440
451
  };
441
452
 
442
453
  // Next.js API route with timeout
443
454
  export async function POST(request: NextRequest) {
444
- const { prompt } = await request.json();
445
- const provider = createBestAIProvider();
455
+ const { prompt } = await request.json();
456
+ const provider = createBestAIProvider();
446
457
 
447
- const result = await provider.generateText({
448
- prompt,
449
- timeout: process.env.AI_TIMEOUT || "30s", // Configurable timeout
450
- });
458
+ const result = await provider.generateText({
459
+ prompt,
460
+ timeout: process.env.AI_TIMEOUT || "30s", // Configurable timeout
461
+ });
451
462
 
452
- return NextResponse.json({ text: result.text });
463
+ return NextResponse.json({ text: result.text });
453
464
  }
454
465
  ```
455
466
 
@@ -536,6 +547,53 @@ cd neurolink-demo && node server.js
536
547
  - **Analysis Tools**: Usage optimization, performance benchmarking, parameter tuning
537
548
  - **Workflow Tools**: Test generation, code refactoring, documentation, debugging
538
549
  - **Extensibility**: Connect external tools and services via MCP protocol
550
+ - **🆕 Dynamic Server Management**: Programmatically add MCP servers at runtime
551
+
552
+ ### 🔧 NEW: Programmatic MCP Server Management
553
+
554
+ **Add external MCP servers dynamically** for enhanced tool ecosystem:
555
+
556
+ ```typescript
557
+ import { NeuroLink } from "@juspay/neurolink";
558
+ const neurolink = new NeuroLink();
559
+
560
+ // Add Bitbucket integration
561
+ await neurolink.addMCPServer("bitbucket", {
562
+ command: "npx",
563
+ args: ["-y", "@nexus2520/bitbucket-mcp-server"],
564
+ env: {
565
+ BITBUCKET_USERNAME: "your-username",
566
+ BITBUCKET_APP_PASSWORD: "your-app-password",
567
+ },
568
+ });
569
+
570
+ // Add custom database connector
571
+ await neurolink.addMCPServer("database", {
572
+ command: "node",
573
+ args: ["./custom-db-mcp-server.js"],
574
+ env: { DB_CONNECTION_STRING: "postgresql://..." },
575
+ });
576
+
577
+ // Add any MCP-compatible server
578
+ await neurolink.addMCPServer("slack-integration", {
579
+ command: "npx",
580
+ args: ["-y", "@slack/mcp-server"],
581
+ env: { SLACK_BOT_TOKEN: "xoxb-..." },
582
+ cwd: "/tmp",
583
+ });
584
+
585
+ // Verify servers are registered
586
+ const status = await neurolink.getMCPStatus();
587
+ console.log("Active servers:", status.totalServers);
588
+ console.log("Available tools:", status.totalTools);
589
+ ```
590
+
591
+ **Perfect for:**
592
+
593
+ - **External Service Integration**: Bitbucket, Slack, Jira, databases
594
+ - **Custom Tool Development**: Your own MCP servers
595
+ - **Dynamic Workflows**: Add servers based on project needs
596
+ - **Enterprise Applications**: Runtime tool ecosystem management
539
597
 
540
598
  ## 🤝 Contributing
541
599
 
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Dynamic AI Tool Chain Executor
3
+ * Allows AI to dynamically decide tool execution sequences based on context and results
4
+ */
5
+ import type { MCPOrchestrator } from "./orchestrator.js";
6
+ import type { MCPRegistry } from "./registry.js";
7
+ import type { NeuroLinkExecutionContext } from "./factory.js";
8
+ import { ErrorManager } from "./error-manager.js";
9
+ /**
10
+ * Tool execution result with metadata
11
+ */
12
+ export interface ToolExecutionResult {
13
+ toolName: string;
14
+ success: boolean;
15
+ result?: any;
16
+ error?: Error;
17
+ timestamp: number;
18
+ executionTime: number;
19
+ context?: Record<string, any>;
20
+ }
21
+ /**
22
+ * Chain execution step
23
+ */
24
+ export interface ChainStep {
25
+ stepId: string;
26
+ toolName: string;
27
+ parameters: any;
28
+ reasoning: string;
29
+ confidence: number;
30
+ expectedOutcome: string;
31
+ }
32
+ /**
33
+ * Chain execution context
34
+ */
35
+ export interface ChainExecutionContext {
36
+ goal: string;
37
+ currentStep: number;
38
+ totalSteps?: number;
39
+ executionHistory: ToolExecutionResult[];
40
+ accumulatedContext: Record<string, any>;
41
+ userContext?: NeuroLinkExecutionContext;
42
+ maxSteps: number;
43
+ aiModel?: string;
44
+ }
45
+ /**
46
+ * Chain execution result
47
+ */
48
+ export interface ChainExecutionResult {
49
+ success: boolean;
50
+ goal: string;
51
+ totalSteps: number;
52
+ executionTime: number;
53
+ results: ToolExecutionResult[];
54
+ finalResult?: any;
55
+ reasoning: string;
56
+ error?: Error;
57
+ metadata: {
58
+ toolsUsed: string[];
59
+ averageConfidence: number;
60
+ contextEvolution: Record<string, any>[];
61
+ };
62
+ }
63
+ /**
64
+ * AI Tool Chain Planner interface
65
+ */
66
+ export interface AIChainPlanner {
67
+ name: string;
68
+ planNextStep(goal: string, availableTools: Array<{
69
+ name: string;
70
+ description: string;
71
+ inputSchema: any;
72
+ }>, executionHistory: ToolExecutionResult[], accumulatedContext: Record<string, any>): Promise<ChainStep | null>;
73
+ evaluateResult(step: ChainStep, result: ToolExecutionResult, goal: string): Promise<{
74
+ goalAchieved: boolean;
75
+ confidence: number;
76
+ nextAction: "continue" | "retry" | "abort" | "complete";
77
+ reasoning: string;
78
+ }>;
79
+ }
80
+ /**
81
+ * Simple AI Chain Planner using heuristics
82
+ */
83
+ export declare class HeuristicChainPlanner implements AIChainPlanner {
84
+ name: string;
85
+ planNextStep(goal: string, availableTools: Array<{
86
+ name: string;
87
+ description: string;
88
+ inputSchema: any;
89
+ }>, executionHistory: ToolExecutionResult[], accumulatedContext: Record<string, any>): Promise<ChainStep | null>;
90
+ evaluateResult(step: ChainStep, result: ToolExecutionResult, goal: string): Promise<{
91
+ goalAchieved: boolean;
92
+ confidence: number;
93
+ nextAction: "continue" | "retry" | "abort" | "complete";
94
+ reasoning: string;
95
+ }>;
96
+ private generateParameters;
97
+ }
98
+ /**
99
+ * Advanced AI Chain Planner using actual AI model
100
+ */
101
+ export declare class AIModelChainPlanner implements AIChainPlanner {
102
+ name: string;
103
+ private aiModel;
104
+ constructor(aiModel?: string);
105
+ planNextStep(goal: string, availableTools: Array<{
106
+ name: string;
107
+ description: string;
108
+ inputSchema: any;
109
+ }>, executionHistory: ToolExecutionResult[], accumulatedContext: Record<string, any>): Promise<ChainStep | null>;
110
+ evaluateResult(step: ChainStep, result: ToolExecutionResult, goal: string): Promise<{
111
+ goalAchieved: boolean;
112
+ confidence: number;
113
+ nextAction: "continue" | "retry" | "abort" | "complete";
114
+ reasoning: string;
115
+ }>;
116
+ private buildPlanningPrompt;
117
+ private buildEvaluationPrompt;
118
+ private callAIModel;
119
+ private parseAIResponse;
120
+ private parseEvaluationResponse;
121
+ }
122
+ /**
123
+ * Dynamic Chain Executor
124
+ */
125
+ export declare class DynamicChainExecutor {
126
+ private orchestrator;
127
+ private registry;
128
+ private errorManager;
129
+ private planner;
130
+ constructor(orchestrator: MCPOrchestrator, registry: MCPRegistry, errorManager: ErrorManager, planner?: AIChainPlanner);
131
+ /**
132
+ * Execute dynamic tool chain to achieve a goal
133
+ *
134
+ * @param goal The goal to achieve
135
+ * @param initialContext Initial context data
136
+ * @param userContext User execution context
137
+ * @param options Execution options
138
+ * @returns Chain execution result
139
+ */
140
+ executeChain(goal: string, initialContext?: Record<string, any>, userContext?: NeuroLinkExecutionContext, options?: {
141
+ maxSteps?: number;
142
+ aiModel?: string;
143
+ timeout?: number;
144
+ }): Promise<ChainExecutionResult>;
145
+ /**
146
+ * Execute chain steps iteratively
147
+ *
148
+ * @private
149
+ */
150
+ private executeChainSteps;
151
+ /**
152
+ * Execute a single step
153
+ *
154
+ * @private
155
+ */
156
+ private executeStep;
157
+ /**
158
+ * Update accumulated context with new result
159
+ *
160
+ * @private
161
+ */
162
+ private updateAccumulatedContext;
163
+ /**
164
+ * Calculate average confidence across execution history
165
+ *
166
+ * @private
167
+ */
168
+ private calculateAverageConfidence;
169
+ /**
170
+ * Track context evolution through execution
171
+ *
172
+ * @private
173
+ */
174
+ private trackContextEvolution;
175
+ /**
176
+ * Set AI planner
177
+ *
178
+ * @param planner AI chain planner instance
179
+ */
180
+ setPlanner(planner: AIChainPlanner): void;
181
+ /**
182
+ * Get current planner
183
+ *
184
+ * @returns Current AI chain planner
185
+ */
186
+ getPlanner(): AIChainPlanner;
187
+ }
188
+ /**
189
+ * Default dynamic chain executor instance
190
+ */
191
+ export declare let defaultDynamicChainExecutor: DynamicChainExecutor | null;
192
+ /**
193
+ * Initialize default dynamic chain executor
194
+ *
195
+ * @param orchestrator MCP orchestrator
196
+ * @param registry Tool registry
197
+ * @param errorManager Error manager
198
+ * @param planner Optional AI planner
199
+ * @returns Dynamic chain executor instance
200
+ */
201
+ export declare function initializeDynamicChainExecutor(orchestrator: MCPOrchestrator, registry: MCPRegistry, errorManager: ErrorManager, planner?: AIChainPlanner): DynamicChainExecutor;