@juspay/neurolink 4.0.0 → 4.1.1

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 (56) hide show
  1. package/CHANGELOG.md +20 -5
  2. package/README.md +59 -1
  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/registry.d.ts +22 -0
  43. package/dist/mcp/registry.js +24 -0
  44. package/dist/mcp/semaphore-manager.d.ts +137 -0
  45. package/dist/mcp/semaphore-manager.js +329 -0
  46. package/dist/mcp/session-manager.d.ts +186 -0
  47. package/dist/mcp/session-manager.js +400 -0
  48. package/dist/mcp/session-persistence.d.ts +93 -0
  49. package/dist/mcp/session-persistence.js +299 -0
  50. package/dist/mcp/transport-manager.d.ts +153 -0
  51. package/dist/mcp/transport-manager.js +331 -0
  52. package/dist/mcp/unified-registry.d.ts +42 -1
  53. package/dist/mcp/unified-registry.js +122 -2
  54. package/dist/neurolink.d.ts +75 -0
  55. package/dist/neurolink.js +104 -0
  56. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,16 +1,28 @@
1
- # [4.0.0](https://github.com/juspay/neurolink/compare/v3.0.1...v4.0.0) (2025-07-06)
1
+ ## [4.1.1](https://github.com/juspay/neurolink/compare/v4.1.0...v4.1.1) (2025-07-10)
2
+
2
3
 
4
+ ### Bug Fixes
3
5
 
4
- * feat(core)!: transform NeuroLink into enterprise AI analytics platform ([74c88d6](https://github.com/juspay/neurolink/commit/74c88d6484bbd983aba9119929481e655d62eab3))
6
+ * **format:** fix formatting for all follow ([a49a94b](https://github.com/juspay/neurolink/commit/a49a94bf4d2e02cf1b1f7d4b555c3c71e25a0ea5))
5
7
 
8
+ # [4.1.0](https://github.com/juspay/neurolink/compare/v4.0.0...v4.1.0) (2025-07-09)
9
+
10
+ ### Features
11
+
12
+ - **mcp:** comprehensive MCP system overhaul with GitHub PR fixes ([c0d8114](https://github.com/juspay/neurolink/commit/c0d8114ef1ab2d5dd3162c369f234d0de17397f7))
13
+
14
+ # [4.0.0](https://github.com/juspay/neurolink/compare/v3.0.1...v4.0.0) (2025-07-06)
15
+
16
+ - feat(core)!: transform NeuroLink into enterprise AI analytics platform ([74c88d6](https://github.com/juspay/neurolink/commit/74c88d6484bbd983aba9119929481e655d62eab3))
6
17
 
7
18
  ### BREAKING CHANGES
8
19
 
9
- * Major architectural enhancement from basic AI SDK
10
- to comprehensive enterprise platform with analytics, evaluation,
11
- real-time services, and business intelligence capabilities.
20
+ - Major architectural enhancement from basic AI SDK
21
+ to comprehensive enterprise platform with analytics, evaluation,
22
+ real-time services, and business intelligence capabilities.
12
23
 
13
24
  Core Features Added:
25
+
14
26
  - Analytics System: Usage tracking, cost estimation, performance monitoring
15
27
  - Evaluation Framework: AI-powered quality assessment and scoring
16
28
  - Enterprise Config: Backup/restore, validation, provider management
@@ -21,6 +33,7 @@ Core Features Added:
21
33
  - Provider Integration: Analytics helper integrated across all 9 providers
22
34
 
23
35
  Technical Implementation:
36
+
24
37
  - NEW: src/lib/core/analytics.ts - Real usage tracking engine
25
38
  - NEW: src/lib/core/evaluation.ts - AI quality assessment framework
26
39
  - NEW: src/lib/config/configManager.ts - Enterprise configuration management
@@ -38,6 +51,7 @@ Backward Compatibility: 100% maintained - existing functionality preserved
38
51
  New Features: Opt-in via --enable-analytics --enable-evaluation flags
39
52
 
40
53
  Business Impact:
54
+
41
55
  - Production Monitoring: Real-time performance and cost tracking
42
56
  - Quality Assurance: AI-powered response evaluation and scoring
43
57
  - Cost Optimization: Usage analytics and provider comparison
@@ -46,6 +60,7 @@ Business Impact:
46
60
  - Enterprise Readiness: OpenTelemetry observability and operational excellence
47
61
 
48
62
  Performance Metrics:
63
+
49
64
  - Analytics: Real token counts (299-768), response times (2-10s)
50
65
  - Evaluation: Quality scores (8-10/10), sub-6s processing
51
66
  - 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)
@@ -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;