@juspay/neurolink 5.0.0 → 5.2.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 (214) hide show
  1. package/CHANGELOG.md +20 -7
  2. package/README.md +160 -172
  3. package/dist/agent/direct-tools.d.ts +6 -6
  4. package/dist/chat/sse-handler.js +5 -4
  5. package/dist/chat/websocket-chat-handler.js +9 -9
  6. package/dist/cli/commands/config.d.ts +3 -3
  7. package/dist/cli/commands/mcp.js +9 -8
  8. package/dist/cli/commands/ollama.js +3 -3
  9. package/dist/cli/factories/command-factory.d.ts +18 -0
  10. package/dist/cli/factories/command-factory.js +183 -0
  11. package/dist/cli/index.js +105 -157
  12. package/dist/cli/utils/interactive-setup.js +2 -2
  13. package/dist/core/base-provider.d.ts +423 -0
  14. package/dist/core/base-provider.js +365 -0
  15. package/dist/core/constants.d.ts +1 -1
  16. package/dist/core/constants.js +1 -1
  17. package/dist/core/dynamic-models.d.ts +6 -6
  18. package/dist/core/evaluation.d.ts +19 -80
  19. package/dist/core/evaluation.js +185 -484
  20. package/dist/core/factory.d.ts +3 -3
  21. package/dist/core/factory.js +31 -91
  22. package/dist/core/service-registry.d.ts +47 -0
  23. package/dist/core/service-registry.js +112 -0
  24. package/dist/core/types.d.ts +49 -49
  25. package/dist/core/types.js +1 -0
  26. package/dist/factories/compatibility-factory.d.ts +20 -0
  27. package/dist/factories/compatibility-factory.js +69 -0
  28. package/dist/factories/provider-factory.d.ts +72 -0
  29. package/dist/factories/provider-factory.js +144 -0
  30. package/dist/factories/provider-generate-factory.d.ts +20 -0
  31. package/dist/factories/provider-generate-factory.js +87 -0
  32. package/dist/factories/provider-registry.d.ts +38 -0
  33. package/dist/factories/provider-registry.js +107 -0
  34. package/dist/index.d.ts +8 -5
  35. package/dist/index.js +5 -5
  36. package/dist/lib/agent/direct-tools.d.ts +6 -6
  37. package/dist/lib/chat/sse-handler.js +5 -4
  38. package/dist/lib/chat/websocket-chat-handler.js +9 -9
  39. package/dist/lib/core/base-provider.d.ts +423 -0
  40. package/dist/lib/core/base-provider.js +365 -0
  41. package/dist/lib/core/constants.d.ts +1 -1
  42. package/dist/lib/core/constants.js +1 -1
  43. package/dist/lib/core/dynamic-models.d.ts +6 -6
  44. package/dist/lib/core/evaluation.d.ts +19 -80
  45. package/dist/lib/core/evaluation.js +185 -484
  46. package/dist/lib/core/factory.d.ts +3 -3
  47. package/dist/lib/core/factory.js +30 -91
  48. package/dist/lib/core/service-registry.d.ts +47 -0
  49. package/dist/lib/core/service-registry.js +112 -0
  50. package/dist/lib/core/types.d.ts +49 -49
  51. package/dist/lib/core/types.js +1 -0
  52. package/dist/lib/factories/compatibility-factory.d.ts +20 -0
  53. package/dist/lib/factories/compatibility-factory.js +69 -0
  54. package/dist/lib/factories/provider-factory.d.ts +72 -0
  55. package/dist/lib/factories/provider-factory.js +144 -0
  56. package/dist/lib/factories/provider-generate-factory.d.ts +20 -0
  57. package/dist/lib/factories/provider-generate-factory.js +87 -0
  58. package/dist/lib/factories/provider-registry.d.ts +38 -0
  59. package/dist/lib/factories/provider-registry.js +107 -0
  60. package/dist/lib/index.d.ts +8 -5
  61. package/dist/lib/index.js +5 -5
  62. package/dist/lib/mcp/client.js +5 -5
  63. package/dist/lib/mcp/config.js +28 -3
  64. package/dist/lib/mcp/dynamic-orchestrator.js +8 -8
  65. package/dist/lib/mcp/external-client.js +2 -2
  66. package/dist/lib/mcp/factory.d.ts +1 -1
  67. package/dist/lib/mcp/factory.js +1 -1
  68. package/dist/lib/mcp/function-calling.js +1 -1
  69. package/dist/lib/mcp/initialize-tools.d.ts +1 -1
  70. package/dist/lib/mcp/initialize-tools.js +45 -1
  71. package/dist/lib/mcp/initialize.js +16 -6
  72. package/dist/lib/mcp/neurolink-mcp-client.js +10 -10
  73. package/dist/lib/mcp/orchestrator.js +4 -4
  74. package/dist/lib/mcp/servers/agent/direct-tools-server.d.ts +8 -0
  75. package/dist/lib/mcp/servers/agent/direct-tools-server.js +109 -0
  76. package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.js +10 -10
  77. package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +8 -6
  78. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  79. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.js +16 -16
  80. package/dist/lib/mcp/unified-registry.d.ts +4 -0
  81. package/dist/lib/mcp/unified-registry.js +42 -9
  82. package/dist/lib/neurolink.d.ts +161 -174
  83. package/dist/lib/neurolink.js +723 -397
  84. package/dist/lib/providers/amazon-bedrock.d.ts +32 -0
  85. package/dist/lib/providers/amazon-bedrock.js +143 -0
  86. package/dist/lib/providers/analytics-helper.js +7 -4
  87. package/dist/lib/providers/anthropic-baseprovider.d.ts +23 -0
  88. package/dist/lib/providers/anthropic-baseprovider.js +114 -0
  89. package/dist/lib/providers/anthropic.d.ts +19 -39
  90. package/dist/lib/providers/anthropic.js +84 -378
  91. package/dist/lib/providers/azure-openai.d.ts +20 -0
  92. package/dist/lib/providers/azure-openai.js +89 -0
  93. package/dist/lib/providers/function-calling-provider.d.ts +14 -12
  94. package/dist/lib/providers/function-calling-provider.js +114 -64
  95. package/dist/lib/providers/google-ai-studio.d.ts +23 -0
  96. package/dist/lib/providers/google-ai-studio.js +107 -0
  97. package/dist/lib/providers/google-vertex.d.ts +47 -0
  98. package/dist/lib/providers/google-vertex.js +205 -0
  99. package/dist/lib/providers/huggingFace.d.ts +33 -27
  100. package/dist/lib/providers/huggingFace.js +103 -400
  101. package/dist/lib/providers/index.d.ts +9 -9
  102. package/dist/lib/providers/index.js +9 -9
  103. package/dist/lib/providers/mcp-provider.d.ts +13 -8
  104. package/dist/lib/providers/mcp-provider.js +63 -18
  105. package/dist/lib/providers/mistral.d.ts +42 -0
  106. package/dist/lib/providers/mistral.js +160 -0
  107. package/dist/lib/providers/ollama.d.ts +52 -35
  108. package/dist/lib/providers/ollama.js +297 -477
  109. package/dist/lib/providers/openAI.d.ts +21 -21
  110. package/dist/lib/providers/openAI.js +81 -245
  111. package/dist/lib/sdk/tool-extension.d.ts +181 -0
  112. package/dist/lib/sdk/tool-extension.js +283 -0
  113. package/dist/lib/sdk/tool-registration.d.ts +95 -0
  114. package/dist/lib/sdk/tool-registration.js +167 -0
  115. package/dist/lib/types/generate-types.d.ts +80 -0
  116. package/dist/lib/types/generate-types.js +1 -0
  117. package/dist/lib/types/mcp-types.d.ts +116 -0
  118. package/dist/lib/types/mcp-types.js +5 -0
  119. package/dist/lib/types/stream-types.d.ts +95 -0
  120. package/dist/lib/types/stream-types.js +1 -0
  121. package/dist/lib/types/universal-provider-options.d.ts +87 -0
  122. package/dist/lib/types/universal-provider-options.js +53 -0
  123. package/dist/lib/utils/providerUtils-fixed.js +1 -1
  124. package/dist/lib/utils/streaming-utils.d.ts +14 -2
  125. package/dist/lib/utils/streaming-utils.js +0 -3
  126. package/dist/mcp/client.js +5 -5
  127. package/dist/mcp/config.js +28 -3
  128. package/dist/mcp/dynamic-orchestrator.js +8 -8
  129. package/dist/mcp/external-client.js +2 -2
  130. package/dist/mcp/factory.d.ts +1 -1
  131. package/dist/mcp/factory.js +1 -1
  132. package/dist/mcp/function-calling.js +1 -1
  133. package/dist/mcp/initialize-tools.d.ts +1 -1
  134. package/dist/mcp/initialize-tools.js +45 -1
  135. package/dist/mcp/initialize.js +16 -6
  136. package/dist/mcp/neurolink-mcp-client.js +10 -10
  137. package/dist/mcp/orchestrator.js +4 -4
  138. package/dist/mcp/servers/agent/direct-tools-server.d.ts +8 -0
  139. package/dist/mcp/servers/agent/direct-tools-server.js +109 -0
  140. package/dist/mcp/servers/ai-providers/ai-analysis-tools.js +10 -10
  141. package/dist/mcp/servers/ai-providers/ai-core-server.js +8 -6
  142. package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  143. package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +16 -16
  144. package/dist/mcp/unified-registry.d.ts +4 -0
  145. package/dist/mcp/unified-registry.js +42 -9
  146. package/dist/neurolink.d.ts +161 -174
  147. package/dist/neurolink.js +723 -397
  148. package/dist/providers/amazon-bedrock.d.ts +32 -0
  149. package/dist/providers/amazon-bedrock.js +143 -0
  150. package/dist/providers/analytics-helper.js +7 -4
  151. package/dist/providers/anthropic-baseprovider.d.ts +23 -0
  152. package/dist/providers/anthropic-baseprovider.js +114 -0
  153. package/dist/providers/anthropic.d.ts +19 -39
  154. package/dist/providers/anthropic.js +83 -377
  155. package/dist/providers/azure-openai.d.ts +20 -0
  156. package/dist/providers/azure-openai.js +89 -0
  157. package/dist/providers/function-calling-provider.d.ts +14 -12
  158. package/dist/providers/function-calling-provider.js +114 -64
  159. package/dist/providers/google-ai-studio.d.ts +23 -0
  160. package/dist/providers/google-ai-studio.js +108 -0
  161. package/dist/providers/google-vertex.d.ts +47 -0
  162. package/dist/providers/google-vertex.js +205 -0
  163. package/dist/providers/huggingFace.d.ts +33 -27
  164. package/dist/providers/huggingFace.js +102 -399
  165. package/dist/providers/index.d.ts +9 -9
  166. package/dist/providers/index.js +9 -9
  167. package/dist/providers/mcp-provider.d.ts +13 -8
  168. package/dist/providers/mcp-provider.js +63 -18
  169. package/dist/providers/mistral.d.ts +42 -0
  170. package/dist/providers/mistral.js +160 -0
  171. package/dist/providers/ollama.d.ts +52 -35
  172. package/dist/providers/ollama.js +297 -476
  173. package/dist/providers/openAI.d.ts +21 -21
  174. package/dist/providers/openAI.js +81 -246
  175. package/dist/sdk/tool-extension.d.ts +181 -0
  176. package/dist/sdk/tool-extension.js +283 -0
  177. package/dist/sdk/tool-registration.d.ts +95 -0
  178. package/dist/sdk/tool-registration.js +168 -0
  179. package/dist/types/generate-types.d.ts +80 -0
  180. package/dist/types/generate-types.js +1 -0
  181. package/dist/types/mcp-types.d.ts +116 -0
  182. package/dist/types/mcp-types.js +5 -0
  183. package/dist/types/stream-types.d.ts +95 -0
  184. package/dist/types/stream-types.js +1 -0
  185. package/dist/types/universal-provider-options.d.ts +87 -0
  186. package/dist/types/universal-provider-options.js +53 -0
  187. package/dist/utils/providerUtils-fixed.js +1 -1
  188. package/dist/utils/streaming-utils.d.ts +14 -2
  189. package/dist/utils/streaming-utils.js +0 -3
  190. package/package.json +15 -10
  191. package/dist/lib/providers/agent-enhanced-provider.d.ts +0 -89
  192. package/dist/lib/providers/agent-enhanced-provider.js +0 -614
  193. package/dist/lib/providers/amazonBedrock.d.ts +0 -19
  194. package/dist/lib/providers/amazonBedrock.js +0 -334
  195. package/dist/lib/providers/azureOpenAI.d.ts +0 -39
  196. package/dist/lib/providers/azureOpenAI.js +0 -436
  197. package/dist/lib/providers/googleAIStudio.d.ts +0 -49
  198. package/dist/lib/providers/googleAIStudio.js +0 -333
  199. package/dist/lib/providers/googleVertexAI.d.ts +0 -38
  200. package/dist/lib/providers/googleVertexAI.js +0 -519
  201. package/dist/lib/providers/mistralAI.d.ts +0 -34
  202. package/dist/lib/providers/mistralAI.js +0 -294
  203. package/dist/providers/agent-enhanced-provider.d.ts +0 -89
  204. package/dist/providers/agent-enhanced-provider.js +0 -614
  205. package/dist/providers/amazonBedrock.d.ts +0 -19
  206. package/dist/providers/amazonBedrock.js +0 -334
  207. package/dist/providers/azureOpenAI.d.ts +0 -39
  208. package/dist/providers/azureOpenAI.js +0 -437
  209. package/dist/providers/googleAIStudio.d.ts +0 -49
  210. package/dist/providers/googleAIStudio.js +0 -333
  211. package/dist/providers/googleVertexAI.d.ts +0 -38
  212. package/dist/providers/googleVertexAI.js +0 -519
  213. package/dist/providers/mistralAI.d.ts +0 -34
  214. package/dist/providers/mistralAI.js +0 -294
package/CHANGELOG.md CHANGED
@@ -1,23 +1,34 @@
1
- # [5.0.0](https://github.com/juspay/neurolink/compare/v4.2.0...v5.0.0) (2025-07-11)
1
+ # [5.2.0](https://github.com/juspay/neurolink/compare/v5.1.0...v5.2.0) (2025-07-22)
2
2
 
3
3
 
4
- * refactor(cli)!: remove agent-generate command, unify CLI to single generate command ([9c034b7](https://github.com/juspay/neurolink/commit/9c034b7b5a8df3b861fccae0e617c5aa4c85a903))
4
+ ### Features
5
5
 
6
+ * **core:** implement comprehensive factory pattern architecture with full MCP integration and provider unification ([b13963a](https://github.com/juspay/neurolink/commit/b13963aaf6f95233be8b1e9bdc69ce1b65604cdf))
6
7
 
7
- ### Bug Fixes
8
+ # [5.1.0](https://github.com/juspay/neurolink/compare/v5.0.0...v5.1.0) (2025-07-13)
8
9
 
9
- * **scripts:** update docs:generate to use docs:validate instead of removed docs:sync ([3277bab](https://github.com/juspay/neurolink/commit/3277bab3eb1cec24a60fe28bf3897fce63d83d3a))
10
+ ### Features
11
+
12
+ - **core:** complete unified multimodal AI platform architecture with generate/stream unification ([846e409](https://github.com/juspay/neurolink/commit/846e409a4a77024ddee9961c9b5049bc99f8335e))
13
+
14
+ # [5.0.0](https://github.com/juspay/neurolink/compare/v4.2.0...v5.0.0) (2025-07-11)
10
15
 
16
+ - refactor(cli)!: remove agent-generate command, unify CLI to single generate command ([9c034b7](https://github.com/juspay/neurolink/commit/9c034b7b5a8df3b861fccae0e617c5aa4c85a903))
17
+
18
+ ### Bug Fixes
19
+
20
+ - **scripts:** update docs:generate to use docs:validate instead of removed docs:sync ([3277bab](https://github.com/juspay/neurolink/commit/3277bab3eb1cec24a60fe28bf3897fce63d83d3a))
11
21
 
12
22
  ### BREAKING CHANGES
13
23
 
14
- * agent-generate command has been removed
24
+ - agent-generate command has been removed
15
25
 
16
- The agent-generate command has been completely removed from the CLI. All
17
- functionality is now available through the enhanced generate command with
26
+ The agent-generate command has been completely removed from the CLI. All
27
+ functionality is now available through the enhanced generate command with
18
28
  tools enabled by default.
19
29
 
20
30
  ### Changes Made:
31
+
21
32
  - Delete src/cli/commands/agent-generate.ts command implementation
22
33
  - Remove agent-generate import and registration from src/cli/index.ts
23
34
  - Update docs/CLI-GUIDE.md to remove agent-generate documentation
@@ -25,12 +36,14 @@ tools enabled by default.
25
36
  - Remove agent-generate test cases from scripts/corrected-functionality-test.js
26
37
 
27
38
  ### Migration Guide:
39
+
28
40
  - Replace `neurolink agent-generate "prompt"` with `neurolink generate "prompt"`
29
41
  - Tools are enabled by default in generate command
30
42
  - Use `--disable-tools` flag if tool-calling is not desired
31
43
  - All previous agent-generate functionality available in generate command
32
44
 
33
45
  ### Technical Impact:
46
+
34
47
  - Simplified CLI interface with single text generation command
35
48
  - Reduced codebase complexity and maintenance overhead
36
49
  - Enhanced generate command provides all tool-calling capabilities
package/README.md CHANGED
@@ -7,69 +7,48 @@
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
8
8
  [![CI](https://github.com/juspay/neurolink/workflows/CI/badge.svg)](https://github.com/juspay/neurolink/actions)
9
9
 
10
- > Enterprise AI Development Platform with real-time capabilities, advanced telemetry, and universal provider support. Production-ready with TypeScript support.
10
+ > Enterprise AI Development Platform with built-in tools, universal provider support, and factory pattern architecture. Production-ready with TypeScript support.
11
11
 
12
- **NeuroLink** is an Enterprise AI Development Platform that unifies 9 major AI providers with intelligent fallback, real-time WebSocket infrastructure, and optional enterprise telemetry. Available as both a **programmatic SDK** and **professional CLI tool**. Extracted from production use at Juspay.
12
+ **NeuroLink** is an Enterprise AI Development Platform that unifies 9 major AI providers with intelligent fallback and built-in tool support. Available as both a **programmatic SDK** and **professional CLI tool**. Features 6 core tools working across all providers plus SDK custom tool registration. Extracted from production use at Juspay.
13
13
 
14
14
  ## 🚀 Enterprise Platform Features
15
15
 
16
- - **🌐 Real-time WebSocket Infrastructure** - Professional-grade streaming with session management
17
- - **📊 Advanced Telemetry** - Optional OpenTelemetry monitoring with zero overhead when disabled
18
- - **💬 Enhanced Chat Services** - Dual-mode SSE + WebSocket support for enterprise applications
19
- - **🏗️ Enterprise Architecture** - Production-ready scaling with connection pooling and optimization
16
+ - **🏭 Factory Pattern Architecture** - Unified provider management through BaseProvider inheritance
17
+ - **🔧 Tools-First Design** - All providers include built-in tool support without additional configuration
18
+ - **🌐 Real-time WebSocket Infrastructure** - [Coming Soon - Broken in migration, being fixed]
19
+ - **📊 Advanced Telemetry** - [Coming Soon - Broken in migration, being fixed]
20
+ - **💬 Enhanced Chat Services** - [Coming Soon - Broken in migration, being fixed]
21
+ - **🏗️ Enterprise Architecture** - Production-ready with clean abstractions
22
+ - **🔄 Configuration Management** - Flexible provider configuration
23
+ - **✅ Type Safety** - Industry-standard TypeScript interfaces
24
+ - **⚡ Performance** - Fast response times with streaming support
25
+ - **🛡️ Error Recovery** - Graceful failures with provider fallback
20
26
 
21
- ## 🏗️ Enterprise Configuration Management
27
+ ## LATEST UPDATE: Factory Pattern Refactoring Complete (2025-01-20)
22
28
 
23
- ### **✨ NEW: Automatic Backup System**
29
+ **NeuroLink now features a unified factory pattern architecture with automatic tool support for all providers.**
24
30
 
25
- ```bash
26
- # All config changes create automatic backups
27
- npm run config:update
28
- #Backup created: .neurolink.backups/neurolink-config-2025-01-07T10-30-00.js
31
+ - ✅ **Unified Architecture**: All providers inherit from BaseProvider with built-in tool support
32
+ - **Direct Tools**: Six core tools available across all providers (getCurrentTime, readFile, listDirectory, calculateMath, writeFile, searchFiles)
33
+ - **Simplified Providers**: Removed duplicate code - providers now focus only on model-specific logic
34
+ -**Better Testing**: 78% of providers fully working with tools (7/9 providers), 22% partial support
35
+ - ✅ **Zero Breaking Changes**: All existing code continues working (backward compatibility)
36
+ - ✅ **SDK Custom Tools**: Register your own tools programmatically with the SDK
29
37
 
30
- # Auto-restore on failures
31
- npm run config:validate
32
- # ✅ Config validated with suggestions and warnings
33
- ```
38
+ > **Factory Pattern**: NeuroLink uses BaseProvider inheritance to provide consistent tool support across all AI providers without code duplication.
34
39
 
35
- ### **✨ NEW: Industry-Standard Interfaces**
40
+ ## Stream Function Migration Complete (2025-01-12)
36
41
 
37
- ```typescript
38
- // Modern camelCase interfaces with rich context
39
- 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>;
47
- }
42
+ **NeuroLink uses `stream()` as the primary streaming function with future-ready multi-modal interface.**
48
43
 
49
- // Optional methods for maximum flexibility
50
- 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
- }
63
- ```
44
+ - **New Primary Streaming**: `stream()` with multi-modal ready interface
45
+ - **Enhanced Generation**: `generate()` as primary generation function
46
+ - ✅ **Factory Enhanced**: Better provider management across all methods
47
+ - ✅ **Zero Breaking Changes**: All existing code continues working (backward compatibility)
64
48
 
65
- ### **Enterprise Features**
49
+ > **Enhanced API**: NeuroLink uses `stream()` and `generate()` as primary functions with multi-modal ready interfaces and improved factory patterns.
66
50
 
67
- - **🔄 Automatic Backup/Restore** - Timestamped backups with hash verification
68
- - **✅ Config Validation** - Comprehensive validation with suggestions
69
- - **🏗️ Factory-First MCP** - Lighthouse-compatible architecture (99% compatible)
70
- - **🔧 Type Safety** - Industry-standard TypeScript interfaces
71
- - **⚡ Performance** - Tool execution <1ms, pipeline execution ~22ms
72
- - **🛡️ Error Recovery** - Graceful failures with auto-restore
51
+ ---
73
52
 
74
53
  ## 🚀 Quick Start
75
54
 
@@ -83,7 +62,11 @@ export GOOGLE_AI_API_KEY="AIza-your-google-ai-api-key"
83
62
  npx @juspay/neurolink generate "Hello, AI"
84
63
  npx @juspay/neurolink gen "Hello, AI" # Shortest form
85
64
 
86
- # 🆕 NEW: AI Enhancement Features
65
+ # Primary Method (generate) - Recommended
66
+ npx @juspay/neurolink generate "Explain AI" --provider google-ai
67
+ npx @juspay/neurolink gen "Write code" --provider openai # Shortest form
68
+
69
+ # 🆕 AI Enhancement Features
87
70
  npx @juspay/neurolink generate "Explain AI" --enable-analytics --debug
88
71
  npx @juspay/neurolink generate "Write code" --enable-evaluation --debug
89
72
  npx @juspay/neurolink generate "Help me" --context '{"userId":"123"}' --debug
@@ -99,16 +82,24 @@ npm install @juspay/neurolink
99
82
  ### Basic Usage
100
83
 
101
84
  ```typescript
102
- import { createBestAIProvider } from "@juspay/neurolink";
85
+ import { NeuroLink } from "@juspay/neurolink";
103
86
 
104
- // Auto-selects best available provider
105
- const provider = createBestAIProvider();
106
- const result = await provider.generateText({
107
- prompt: "Write a haiku about programming",
87
+ // NEW: Primary method (recommended)
88
+ const neurolink = new NeuroLink();
89
+ const result = await neurolink.generate({
90
+ input: { text: "Write a haiku about programming" },
91
+ provider: "google-ai",
108
92
  timeout: "30s", // Optional: Set custom timeout (default: 30s)
109
93
  });
94
+ // Alternative: Auto-selects best available provider
95
+ import { createBestAIProvider } from "@juspay/neurolink";
96
+ const provider = createBestAIProvider();
97
+ const providerResult = await provider.generate({
98
+ input: { text: "Write a haiku about programming" },
99
+ timeout: "30s",
100
+ });
110
101
 
111
- console.log(result.text);
102
+ console.log(result.content);
112
103
  console.log(`Used: ${result.provider}`);
113
104
  ```
114
105
 
@@ -118,22 +109,22 @@ Method aliases that match CLI command names:
118
109
 
119
110
  ```typescript
120
111
  // All three methods are equivalent:
121
- const result1 = await provider.generateText({ prompt: "Hello" }); // Original
122
- const result2 = await provider.generate({ prompt: "Hello" }); // Matches CLI 'generate'
123
- const result3 = await provider.gen({ prompt: "Hello" }); // Matches CLI 'gen'
112
+ const result1 = await provider.generate({ input: { text: "Hello" } }); // Original
113
+ const result2 = await provider.generate({ input: { text: "Hello" } }); // Matches CLI 'generate'
114
+ const result3 = await provider.gen({ input: { text: "Hello" } }); // Matches CLI 'gen'
124
115
 
125
116
  // Use whichever style you prefer:
126
117
  const provider = createBestAIProvider();
127
118
 
128
119
  // Detailed method name
129
- const story = await provider.generateText({
130
- prompt: "Write a short story about AI",
120
+ const story = await provider.generate({
121
+ input: { text: "Write a short story about AI" },
131
122
  maxTokens: 200,
132
123
  });
133
124
 
134
125
  // CLI-style method names
135
- const poem = await provider.generate({ prompt: "Write a poem" });
136
- const joke = await provider.gen({ prompt: "Tell me a joke" });
126
+ const poem = await provider.generate({ input: { text: "Write a poem" } });
127
+ const joke = await provider.gen({ input: { text: "Tell me a joke" } });
137
128
  ```
138
129
 
139
130
  ### 🆕 Enhanced Usage (NEW! ✨)
@@ -162,11 +153,11 @@ import { NeuroLink } from "@juspay/neurolink";
162
153
  const neurolink = new NeuroLink();
163
154
 
164
155
  // Basic usage
165
- const result = await neurolink.generateText("Write a story");
156
+ const result = await neurolink.generate({ input: { text: "Write a story" } });
166
157
 
167
158
  // With enhancements (NEW!)
168
- const enhancedResult = await neurolink.generateText({
169
- prompt: "Write a business proposal",
159
+ const enhancedResult = await neurolink.generate({
160
+ input: { text: "Write a business proposal" },
170
161
  enableAnalytics: true, // Get usage & cost data
171
162
  enableEvaluation: true, // Get AI quality scores
172
163
  context: { project: "Q1-sales" }, // Custom context
@@ -177,36 +168,8 @@ console.log("📊 Usage:", enhancedResult.analytics);
177
168
  console.log("⭐ Quality:", enhancedResult.evaluation);
178
169
  console.log("Response:", enhancedResult.content);
179
170
 
180
- // 🆕 NEW: Enhanced Evaluation with Domain Awareness
181
- import {
182
- performEnhancedEvaluation,
183
- createEnhancedContext,
184
- } from "@juspay/neurolink";
185
-
186
- 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
- },
201
- );
202
-
203
- const domainEvaluation = await performEnhancedEvaluation(enhancedContext);
204
- console.log("🎯 Enhanced Evaluation:", domainEvaluation);
205
- // {
206
- // relevanceScore: 9, accuracyScore: 8, completenessScore: 9,
207
- // domainAlignment: 9, terminologyAccuracy: 8, toolEffectiveness: 9,
208
- // overall: 8.7, alertSeverity: 'none'
209
- // }
171
+ // Enhanced evaluation included when enableEvaluation is true
172
+ // Returns basic quality scores for the generated content
210
173
  ```
211
174
 
212
175
  ### 🌐 Enterprise Real-time Features (NEW! 🚀)
@@ -273,7 +236,7 @@ console.log("Version:", status.version);
273
236
 
274
237
  // All AI operations are now automatically monitored
275
238
  const provider = await createBestAIProvider();
276
- const result = await provider.generateText({
239
+ const result = await provider.generate({
277
240
  prompt: "Generate business report",
278
241
  });
279
242
  // Telemetry automatically tracks: response time, token usage, cost, errors
@@ -295,6 +258,8 @@ npx @juspay/neurolink status
295
258
 
296
259
  ## ✨ Key Features
297
260
 
261
+ - 🏭 **Factory Pattern Architecture** - Unified provider management with BaseProvider inheritance
262
+ - 🔧 **Tools-First Design** - All providers automatically include direct tool support (getCurrentTime, readFile, listDirectory, calculateMath, writeFile, searchFiles)
298
263
  - 🔄 **9 AI Providers** - OpenAI, Bedrock, Vertex AI, Google AI Studio, Anthropic, Azure, Hugging Face, Ollama, Mistral AI
299
264
  - ⚡ **Dynamic Model System** - Self-updating model configurations without code changes
300
265
  - 💰 **Cost Optimization** - Automatic selection of cheapest models for tasks
@@ -310,16 +275,17 @@ npx @juspay/neurolink status
310
275
  - 🌍 **Open Source Models** - Access 100,000+ models via Hugging Face
311
276
  - 🇪🇺 **GDPR Compliance** - European data processing with Mistral AI
312
277
 
313
- ## 🛠️ MCP Integration Status (v1.11.1) ✅ **PRODUCTION READY**
278
+ ## 🛠️ MCP Integration Status ✅ **BUILT-IN TOOLS WORKING**
314
279
 
315
- | Component | Status | Description |
316
- | ------------------- | ------------------ | ---------------------------------------------------------- |
317
- | Built-in Tools | ✅ **Working** | Time tool, utilities - fully functional |
318
- | External Discovery | ✅ **Working** | 58+ MCP servers auto-discovered from all AI tools |
319
- | Tool Execution | **Working** | Real-time AI tool calling with built-in tools |
320
- | **External Tools** | ✅ **SOLVED** | **Two-step tool calling fixed - human-readable responses** |
321
- | **CLI Integration** | **READY** | **Production-ready AI assistant with external tools** |
322
- | External Activation | 🔧 **Development** | Discovery complete, activation protocol in progress |
280
+ | Component | Status | Description |
281
+ | ------------------- | ------------------ | -------------------------------------------------------- |
282
+ | Built-in Tools | ✅ **Working** | 6 core tools fully functional across all providers |
283
+ | SDK Custom Tools | ✅ **Working** | Register custom tools programmatically |
284
+ | External Discovery | 🔍 **Discovery** | 58+ MCP servers discovered from AI tools ecosystem |
285
+ | Tool Execution | ✅ **Working** | Real-time AI tool calling with built-in tools |
286
+ | **External Tools** | 🚧 **Development** | Manual config needs one-line fix, activation in progress |
287
+ | **CLI Integration** | **READY** | **Production-ready with built-in tools** |
288
+ | External Activation | 🔧 **Development** | Discovery complete, activation protocol in progress |
323
289
 
324
290
  ### ✅ Quick MCP Test (v1.7.1)
325
291
 
@@ -327,18 +293,54 @@ npx @juspay/neurolink status
327
293
  # Test built-in tools (works immediately)
328
294
  npx @juspay/neurolink generate "What time is it?" --debug
329
295
 
330
- # Alternative short form
331
- npx @juspay/neurolink gen "What time is it?" --debug
296
+ # Disable tools for pure text generation
297
+ npx @juspay/neurolink generate "Write a poem" --disable-tools
298
+
299
+ # Discover available MCP servers
300
+ npx @juspay/neurolink mcp discover --format table
301
+ ```
332
302
 
333
- # Test tool discovery
334
- npx @juspay/neurolink generate "What tools do you have access to?" --debug
303
+ ### 🔧 SDK Custom Tool Registration (NEW!)
335
304
 
336
- # Alternative short form
337
- npx @juspay/neurolink gen "What tools do you have access to?" --debug
305
+ Register your own tools programmatically with the SDK:
338
306
 
339
- # Test external server discovery
340
- npx @juspay/neurolink mcp discover --format table
341
- # Shows all discovered MCP servers from Claude, VS Code, Cursor, etc.
307
+ ```typescript
308
+ import { NeuroLink } from "@juspay/neurolink";
309
+ const neurolink = new NeuroLink();
310
+
311
+ // Register a simple tool
312
+ neurolink.registerTool("weatherLookup", {
313
+ description: "Get current weather for a city",
314
+ parameters: z.object({
315
+ city: z.string().describe("City name"),
316
+ units: z.enum(["celsius", "fahrenheit"]).optional(),
317
+ }),
318
+ execute: async ({ city, units = "celsius" }) => {
319
+ // Your implementation here
320
+ return {
321
+ city,
322
+ temperature: 22,
323
+ units,
324
+ condition: "sunny",
325
+ };
326
+ },
327
+ });
328
+
329
+ // Use it in generation
330
+ const result = await neurolink.generate({
331
+ input: { text: "What's the weather in London?" },
332
+ provider: "google-ai",
333
+ });
334
+
335
+ // Register multiple tools at once
336
+ neurolink.registerTools({
337
+ stockPrice: {
338
+ /* tool definition */
339
+ },
340
+ calculator: {
341
+ /* tool definition */
342
+ },
343
+ });
342
344
  ```
343
345
 
344
346
  ## ⚡ Dynamic Model System (v1.8.0)
@@ -426,7 +428,20 @@ export const POST: RequestHandler = async ({ request }) => {
426
428
  const provider = createBestAIProvider();
427
429
 
428
430
  try {
429
- const result = await provider.streamText({
431
+ // NEW: Primary streaming method (recommended)
432
+ const result = await provider.stream({
433
+ input: { text: message },
434
+ timeout: "2m", // 2 minutes for streaming
435
+ });
436
+
437
+ // Process stream
438
+ for await (const chunk of result.stream) {
439
+ // Handle streaming content
440
+ console.log(chunk.content);
441
+ }
442
+
443
+ // LEGACY: Backward compatibility (still works)
444
+ const legacyResult = await provider.stream({ input: { text:
430
445
  prompt: message,
431
446
  timeout: "2m", // 2 minutes for streaming
432
447
  });
@@ -444,12 +459,12 @@ export async function POST(request: NextRequest) {
444
459
  const { prompt } = await request.json();
445
460
  const provider = createBestAIProvider();
446
461
 
447
- const result = await provider.generateText({
462
+ const result = await provider.generate({
448
463
  prompt,
449
464
  timeout: process.env.AI_TIMEOUT || "30s", // Configurable timeout
450
465
  });
451
466
 
452
- return NextResponse.json({ text: result.text });
467
+ return NextResponse.json({ text: result.content });
453
468
  }
454
469
  ```
455
470
 
@@ -494,6 +509,7 @@ cd neurolink-demo && node server.js
494
509
 
495
510
  ### Advanced Features
496
511
 
512
+ - **[🏭 Factory Pattern Migration](./docs/FACTORY-PATTERN-MIGRATION.md)** - Guide to the new unified provider architecture
497
513
  - **[🔄 MCP Foundation](./docs/MCP-FOUNDATION.md)** - Model Context Protocol architecture
498
514
  - **[⚡ Dynamic Models](./docs/DYNAMIC-MODELS.md)** - Self-updating model configurations and cost optimization
499
515
  - **[🧠 AI Analysis Tools](./docs/AI-ANALYSIS-TOOLS.md)** - Usage optimization and benchmarking
@@ -507,17 +523,24 @@ cd neurolink-demo && node server.js
507
523
 
508
524
  ## 🏗️ Supported Providers & Models
509
525
 
510
- | Provider | Models | Auth Method | Free Tier |
511
- | -------------------- | ---------------------------- | ------------------ | --------- |
512
- | **OpenAI** | GPT-4o, GPT-4o-mini | API Key | ❌ |
513
- | **Google AI Studio** | Gemini 1.5/2.0 Flash/Pro | API Key | ✅ |
514
- | **Amazon Bedrock** | Claude 3.5/3.7 Sonnet | AWS Credentials | ❌ |
515
- | **Google Vertex AI** | Gemini 2.5 Flash | Service Account | ❌ |
516
- | **Anthropic** | Claude 3.5 Sonnet | API Key | ❌ |
517
- | **Azure OpenAI** | GPT-4, GPT-3.5 | API Key + Endpoint | ❌ |
518
- | **Hugging Face** 🆕 | 100,000+ models | API Key | ✅ |
519
- | **Ollama** 🆕 | Llama 2, Code Llama, Mistral | None (Local) | ✅ |
520
- | **Mistral AI** 🆕 | Tiny, Small, Medium, Large | API Key | ✅ |
526
+ | Provider | Models | Auth Method | Free Tier | Tool Support |
527
+ | -------------------- | -------------------------- | ------------------ | --------- | ------------ |
528
+ | **OpenAI** | GPT-4o, GPT-4o-mini | API Key | ❌ | ✅ Full |
529
+ | **Google AI Studio** | Gemini 2.5 Flash/Pro | API Key | ✅ | ✅ Full |
530
+ | **Amazon Bedrock** | Claude 3.5/3.7 Sonnet | AWS Credentials | ❌ | ✅ Full\* |
531
+ | **Google Vertex AI** | Gemini 2.5 Flash | Service Account | ❌ | ✅ Full |
532
+ | **Anthropic** | Claude 3.5 Sonnet | API Key | ❌ | ✅ Full |
533
+ | **Azure OpenAI** | GPT-4, GPT-3.5 | API Key + Endpoint | ❌ | ✅ Full |
534
+ | **Hugging Face** 🆕 | 100,000+ models | API Key | ✅ | ⚠️ Partial |
535
+ | **Ollama** 🆕 | Llama 3.2, Gemma, Mistral | None (Local) | ✅ | ⚠️ Partial |
536
+ | **Mistral AI** 🆕 | Tiny, Small, Medium, Large | API Key | ✅ | ✅ Full |
537
+
538
+ **Tool Support Legend:**
539
+
540
+ - ✅ Full: All tools working correctly
541
+ - ⚠️ Partial: Tools visible but may not execute properly
542
+ - ❌ Limited: Issues with model or configuration
543
+ - \* Bedrock requires valid AWS credentials, Ollama requires specific models like gemma3n for tool support
521
544
 
522
545
  **✨ Auto-Selection**: NeuroLink automatically chooses the best available provider based on speed, reliability, and configuration.
523
546
 
@@ -538,51 +561,16 @@ cd neurolink-demo && node server.js
538
561
  - **Extensibility**: Connect external tools and services via MCP protocol
539
562
  - **🆕 Dynamic Server Management**: Programmatically add MCP servers at runtime
540
563
 
541
- ### 🔧 NEW: Programmatic MCP Server Management
564
+ ### 🔧 Programmatic MCP Server Management [Coming Soon]
542
565
 
543
- **Add external MCP servers dynamically** for enhanced tool ecosystem:
544
-
545
- ```typescript
546
- import { NeuroLink } from "@juspay/neurolink";
547
- const neurolink = new NeuroLink();
548
-
549
- // Add Bitbucket integration
550
- await neurolink.addMCPServer("bitbucket", {
551
- command: "npx",
552
- args: ["-y", "@nexus2520/bitbucket-mcp-server"],
553
- env: {
554
- BITBUCKET_USERNAME: "your-username",
555
- BITBUCKET_APP_PASSWORD: "your-app-password",
556
- },
557
- });
558
-
559
- // Add custom database connector
560
- await neurolink.addMCPServer("database", {
561
- command: "node",
562
- args: ["./custom-db-mcp-server.js"],
563
- env: { DB_CONNECTION_STRING: "postgresql://..." },
564
- });
565
-
566
- // Add any MCP-compatible server
567
- await neurolink.addMCPServer("slack-integration", {
568
- command: "npx",
569
- args: ["-y", "@slack/mcp-server"],
570
- env: { SLACK_BOT_TOKEN: "xoxb-..." },
571
- cwd: "/tmp",
572
- });
573
-
574
- // Verify servers are registered
575
- const status = await neurolink.getMCPStatus();
576
- console.log("Active servers:", status.totalServers);
577
- console.log("Available tools:", status.totalTools);
578
- ```
566
+ **Note**: External MCP server activation is in development. Currently available:
579
567
 
580
- **Perfect for:**
568
+ - ✅ 6 built-in tools working across all providers
569
+ - ✅ SDK custom tool registration
570
+ - 🔍 MCP server discovery (58+ servers found)
571
+ - 🚧 External server activation (one-line fix pending)
581
572
 
582
- - **External Service Integration**: Bitbucket, Slack, Jira, databases
583
- - **Custom Tool Development**: Your own MCP servers
584
- - **Dynamic Workflows**: Add servers based on project needs
585
- - **Enterprise Applications**: Runtime tool ecosystem management
573
+ Manual MCP configuration (`.mcp-config.json`) support coming soon.
586
574
 
587
575
  ## 🤝 Contributing
588
576
 
@@ -220,8 +220,8 @@ export declare const directAgentTools: {
220
220
  mode: z.ZodDefault<z.ZodEnum<["create", "overwrite", "append"]>>;
221
221
  }, "strip", z.ZodTypeAny, {
222
222
  path: string;
223
- mode: "create" | "overwrite" | "append";
224
223
  content: string;
224
+ mode: "create" | "overwrite" | "append";
225
225
  }, {
226
226
  path: string;
227
227
  content: string;
@@ -250,8 +250,8 @@ export declare const directAgentTools: {
250
250
  }> & {
251
251
  execute: (args: {
252
252
  path: string;
253
- mode: "create" | "overwrite" | "append";
254
253
  content: string;
254
+ mode: "create" | "overwrite" | "append";
255
255
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
256
256
  success: boolean;
257
257
  error: string;
@@ -563,8 +563,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
563
563
  mode: z.ZodDefault<z.ZodEnum<["create", "overwrite", "append"]>>;
564
564
  }, "strip", z.ZodTypeAny, {
565
565
  path: string;
566
- mode: "create" | "overwrite" | "append";
567
566
  content: string;
567
+ mode: "create" | "overwrite" | "append";
568
568
  }, {
569
569
  path: string;
570
570
  content: string;
@@ -593,8 +593,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
593
593
  }> & {
594
594
  execute: (args: {
595
595
  path: string;
596
- mode: "create" | "overwrite" | "append";
597
596
  content: string;
597
+ mode: "create" | "overwrite" | "append";
598
598
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
599
599
  success: boolean;
600
600
  error: string;
@@ -907,8 +907,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
907
907
  mode: z.ZodDefault<z.ZodEnum<["create", "overwrite", "append"]>>;
908
908
  }, "strip", z.ZodTypeAny, {
909
909
  path: string;
910
- mode: "create" | "overwrite" | "append";
911
910
  content: string;
911
+ mode: "create" | "overwrite" | "append";
912
912
  }, {
913
913
  path: string;
914
914
  content: string;
@@ -937,8 +937,8 @@ export declare function getToolsForCategory(category?: "basic" | "filesystem" |
937
937
  }> & {
938
938
  execute: (args: {
939
939
  path: string;
940
- mode: "create" | "overwrite" | "append";
941
940
  content: string;
941
+ mode: "create" | "overwrite" | "append";
942
942
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
943
943
  success: boolean;
944
944
  error: string;
@@ -42,14 +42,15 @@ export class SSEChatHandler {
42
42
  data: { type: "start", sessionId, messageId: userMessage.id },
43
43
  });
44
44
  // Generate AI response with streaming
45
- const aiResponse = await this.provider.streamText({
46
- prompt: message,
45
+ const aiResponse = await this.provider.stream({
46
+ input: { text: message },
47
47
  temperature: options.temperature,
48
48
  maxTokens: options.maxTokens,
49
49
  systemPrompt: options.systemPrompt,
50
50
  });
51
- if (aiResponse?.textStream) {
52
- const reader = aiResponse.textStream.getReader();
51
+ if (aiResponse?.stream) {
52
+ // Convert async iterable to readable stream
53
+ const reader = aiResponse.stream;
53
54
  let fullResponse = "";
54
55
  try {
55
56
  while (true) {