@juspay/neurolink 3.0.1 → 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.
- package/CHANGELOG.md +66 -6
- package/README.md +318 -27
- package/dist/agent/direct-tools.d.ts +6 -6
- package/dist/chat/client-utils.d.ts +92 -0
- package/dist/chat/client-utils.js +298 -0
- package/dist/chat/index.d.ts +27 -0
- package/dist/chat/index.js +41 -0
- package/dist/chat/session-storage.d.ts +77 -0
- package/dist/chat/session-storage.js +233 -0
- package/dist/chat/session.d.ts +95 -0
- package/dist/chat/session.js +257 -0
- package/dist/chat/sse-handler.d.ts +49 -0
- package/dist/chat/sse-handler.js +266 -0
- package/dist/chat/types.d.ts +73 -0
- package/dist/chat/types.js +5 -0
- package/dist/chat/websocket-chat-handler.d.ts +36 -0
- package/dist/chat/websocket-chat-handler.js +262 -0
- package/dist/cli/commands/config.js +12 -12
- package/dist/cli/commands/mcp.js +3 -4
- package/dist/cli/index.d.ts +0 -7
- package/dist/cli/index.js +247 -28
- package/dist/config/configManager.d.ts +60 -0
- package/dist/config/configManager.js +300 -0
- package/dist/config/types.d.ts +136 -0
- package/dist/config/types.js +43 -0
- package/dist/core/analytics.d.ts +23 -0
- package/dist/core/analytics.js +131 -0
- package/dist/core/constants.d.ts +41 -0
- package/dist/core/constants.js +50 -0
- package/dist/core/defaults.d.ts +18 -0
- package/dist/core/defaults.js +29 -0
- package/dist/core/evaluation-config.d.ts +29 -0
- package/dist/core/evaluation-config.js +144 -0
- package/dist/core/evaluation-providers.d.ts +30 -0
- package/dist/core/evaluation-providers.js +187 -0
- package/dist/core/evaluation.d.ts +117 -0
- package/dist/core/evaluation.js +528 -0
- package/dist/core/factory.js +33 -25
- package/dist/core/types.d.ts +165 -6
- package/dist/core/types.js +3 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +25 -4
- package/dist/lib/agent/direct-tools.d.ts +6 -6
- package/dist/lib/chat/client-utils.d.ts +92 -0
- package/dist/lib/chat/client-utils.js +298 -0
- package/dist/lib/chat/index.d.ts +27 -0
- package/dist/lib/chat/index.js +41 -0
- package/dist/lib/chat/session-storage.d.ts +77 -0
- package/dist/lib/chat/session-storage.js +233 -0
- package/dist/lib/chat/session.d.ts +95 -0
- package/dist/lib/chat/session.js +257 -0
- package/dist/lib/chat/sse-handler.d.ts +49 -0
- package/dist/lib/chat/sse-handler.js +266 -0
- package/dist/lib/chat/types.d.ts +73 -0
- package/dist/lib/chat/types.js +5 -0
- package/dist/lib/chat/websocket-chat-handler.d.ts +36 -0
- package/dist/lib/chat/websocket-chat-handler.js +262 -0
- package/dist/lib/config/configManager.d.ts +60 -0
- package/dist/lib/config/configManager.js +300 -0
- package/dist/lib/config/types.d.ts +136 -0
- package/dist/lib/config/types.js +43 -0
- package/dist/lib/core/analytics.d.ts +23 -0
- package/dist/lib/core/analytics.js +131 -0
- package/dist/lib/core/constants.d.ts +41 -0
- package/dist/lib/core/constants.js +50 -0
- package/dist/lib/core/defaults.d.ts +18 -0
- package/dist/lib/core/defaults.js +29 -0
- package/dist/lib/core/evaluation-config.d.ts +29 -0
- package/dist/lib/core/evaluation-config.js +144 -0
- package/dist/lib/core/evaluation-providers.d.ts +30 -0
- package/dist/lib/core/evaluation-providers.js +187 -0
- package/dist/lib/core/evaluation.d.ts +117 -0
- package/dist/lib/core/evaluation.js +528 -0
- package/dist/lib/core/factory.js +33 -26
- package/dist/lib/core/types.d.ts +165 -6
- package/dist/lib/core/types.js +3 -4
- package/dist/lib/index.d.ts +9 -4
- package/dist/lib/index.js +25 -4
- package/dist/lib/mcp/contracts/mcpContract.d.ts +118 -0
- package/dist/lib/mcp/contracts/mcpContract.js +5 -0
- package/dist/lib/mcp/dynamic-chain-executor.d.ts +201 -0
- package/dist/lib/mcp/dynamic-chain-executor.js +489 -0
- package/dist/lib/mcp/dynamic-orchestrator.d.ts +109 -0
- package/dist/lib/mcp/dynamic-orchestrator.js +351 -0
- package/dist/lib/mcp/error-manager.d.ts +254 -0
- package/dist/lib/mcp/error-manager.js +501 -0
- package/dist/lib/mcp/error-recovery.d.ts +158 -0
- package/dist/lib/mcp/error-recovery.js +405 -0
- package/dist/lib/mcp/function-calling.js +11 -3
- package/dist/lib/mcp/health-monitor.d.ts +256 -0
- package/dist/lib/mcp/health-monitor.js +621 -0
- package/dist/lib/mcp/logging.js +5 -0
- package/dist/lib/mcp/neurolink-mcp-client.js +2 -1
- package/dist/lib/mcp/orchestrator.d.ts +136 -5
- package/dist/lib/mcp/orchestrator.js +332 -16
- package/dist/lib/mcp/registry.d.ts +71 -16
- package/dist/lib/mcp/registry.js +104 -6
- package/dist/lib/mcp/semaphore-manager.d.ts +137 -0
- package/dist/lib/mcp/semaphore-manager.js +329 -0
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.js +5 -4
- package/dist/lib/mcp/session-manager.d.ts +186 -0
- package/dist/lib/mcp/session-manager.js +400 -0
- package/dist/lib/mcp/session-persistence.d.ts +93 -0
- package/dist/lib/mcp/session-persistence.js +298 -0
- package/dist/lib/mcp/tool-integration.js +1 -1
- package/dist/lib/mcp/tool-registry.d.ts +55 -34
- package/dist/lib/mcp/tool-registry.js +111 -97
- package/dist/lib/mcp/transport-manager.d.ts +153 -0
- package/dist/lib/mcp/transport-manager.js +330 -0
- package/dist/lib/mcp/unified-mcp.js +6 -1
- package/dist/lib/mcp/unified-registry.d.ts +54 -5
- package/dist/lib/mcp/unified-registry.js +139 -6
- package/dist/lib/neurolink.d.ts +101 -0
- package/dist/lib/neurolink.js +147 -1
- package/dist/lib/providers/agent-enhanced-provider.d.ts +11 -2
- package/dist/lib/providers/agent-enhanced-provider.js +86 -15
- package/dist/lib/providers/amazonBedrock.d.ts +9 -1
- package/dist/lib/providers/amazonBedrock.js +26 -2
- package/dist/lib/providers/analytics-helper.d.ts +53 -0
- package/dist/lib/providers/analytics-helper.js +151 -0
- package/dist/lib/providers/anthropic.d.ts +11 -1
- package/dist/lib/providers/anthropic.js +29 -4
- package/dist/lib/providers/azureOpenAI.d.ts +3 -1
- package/dist/lib/providers/azureOpenAI.js +28 -4
- package/dist/lib/providers/function-calling-provider.d.ts +9 -1
- package/dist/lib/providers/function-calling-provider.js +14 -1
- package/dist/lib/providers/googleAIStudio.d.ts +15 -1
- package/dist/lib/providers/googleAIStudio.js +32 -2
- package/dist/lib/providers/googleVertexAI.d.ts +9 -1
- package/dist/lib/providers/googleVertexAI.js +31 -2
- package/dist/lib/providers/huggingFace.d.ts +3 -1
- package/dist/lib/providers/huggingFace.js +26 -3
- package/dist/lib/providers/mcp-provider.d.ts +9 -1
- package/dist/lib/providers/mcp-provider.js +12 -0
- package/dist/lib/providers/mistralAI.d.ts +3 -1
- package/dist/lib/providers/mistralAI.js +25 -2
- package/dist/lib/providers/ollama.d.ts +3 -1
- package/dist/lib/providers/ollama.js +27 -4
- package/dist/lib/providers/openAI.d.ts +15 -1
- package/dist/lib/providers/openAI.js +32 -2
- package/dist/lib/proxy/proxy-fetch.js +8 -7
- package/dist/lib/services/streaming/streaming-manager.d.ts +29 -0
- package/dist/lib/services/streaming/streaming-manager.js +244 -0
- package/dist/lib/services/types.d.ts +155 -0
- package/dist/lib/services/types.js +2 -0
- package/dist/lib/services/websocket/websocket-server.d.ts +34 -0
- package/dist/lib/services/websocket/websocket-server.js +304 -0
- package/dist/lib/telemetry/index.d.ts +15 -0
- package/dist/lib/telemetry/index.js +22 -0
- package/dist/lib/telemetry/telemetry-service.d.ts +47 -0
- package/dist/lib/telemetry/telemetry-service.js +259 -0
- package/dist/lib/utils/streaming-utils.d.ts +67 -0
- package/dist/lib/utils/streaming-utils.js +201 -0
- package/dist/mcp/contracts/mcpContract.d.ts +118 -0
- package/dist/mcp/contracts/mcpContract.js +5 -0
- package/dist/mcp/dynamic-chain-executor.d.ts +201 -0
- package/dist/mcp/dynamic-chain-executor.js +489 -0
- package/dist/mcp/dynamic-orchestrator.d.ts +109 -0
- package/dist/mcp/dynamic-orchestrator.js +351 -0
- package/dist/mcp/error-manager.d.ts +254 -0
- package/dist/mcp/error-manager.js +501 -0
- package/dist/mcp/error-recovery.d.ts +158 -0
- package/dist/mcp/error-recovery.js +405 -0
- package/dist/mcp/function-calling.js +11 -3
- package/dist/mcp/health-monitor.d.ts +256 -0
- package/dist/mcp/health-monitor.js +621 -0
- package/dist/mcp/logging.js +5 -0
- package/dist/mcp/neurolink-mcp-client.js +2 -1
- package/dist/mcp/orchestrator.d.ts +136 -5
- package/dist/mcp/orchestrator.js +332 -16
- package/dist/mcp/plugins/core/neurolink-mcp.json +15 -15
- package/dist/mcp/registry.d.ts +71 -16
- package/dist/mcp/registry.js +104 -6
- package/dist/mcp/semaphore-manager.d.ts +137 -0
- package/dist/mcp/semaphore-manager.js +329 -0
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +5 -4
- package/dist/mcp/session-manager.d.ts +186 -0
- package/dist/mcp/session-manager.js +400 -0
- package/dist/mcp/session-persistence.d.ts +93 -0
- package/dist/mcp/session-persistence.js +299 -0
- package/dist/mcp/tool-integration.js +1 -1
- package/dist/mcp/tool-registry.d.ts +55 -34
- package/dist/mcp/tool-registry.js +111 -97
- package/dist/mcp/transport-manager.d.ts +153 -0
- package/dist/mcp/transport-manager.js +331 -0
- package/dist/mcp/unified-mcp.js +6 -1
- package/dist/mcp/unified-registry.d.ts +54 -5
- package/dist/mcp/unified-registry.js +139 -6
- package/dist/neurolink.d.ts +101 -0
- package/dist/neurolink.js +147 -1
- package/dist/providers/agent-enhanced-provider.d.ts +11 -2
- package/dist/providers/agent-enhanced-provider.js +86 -15
- package/dist/providers/amazonBedrock.d.ts +9 -1
- package/dist/providers/amazonBedrock.js +26 -2
- package/dist/providers/analytics-helper.d.ts +53 -0
- package/dist/providers/analytics-helper.js +151 -0
- package/dist/providers/anthropic.d.ts +11 -1
- package/dist/providers/anthropic.js +29 -4
- package/dist/providers/azureOpenAI.d.ts +3 -1
- package/dist/providers/azureOpenAI.js +29 -4
- package/dist/providers/function-calling-provider.d.ts +9 -1
- package/dist/providers/function-calling-provider.js +14 -1
- package/dist/providers/googleAIStudio.d.ts +15 -1
- package/dist/providers/googleAIStudio.js +32 -2
- package/dist/providers/googleVertexAI.d.ts +9 -1
- package/dist/providers/googleVertexAI.js +31 -2
- package/dist/providers/huggingFace.d.ts +3 -1
- package/dist/providers/huggingFace.js +26 -3
- package/dist/providers/mcp-provider.d.ts +9 -1
- package/dist/providers/mcp-provider.js +12 -0
- package/dist/providers/mistralAI.d.ts +3 -1
- package/dist/providers/mistralAI.js +25 -2
- package/dist/providers/ollama.d.ts +3 -1
- package/dist/providers/ollama.js +27 -4
- package/dist/providers/openAI.d.ts +15 -1
- package/dist/providers/openAI.js +33 -2
- package/dist/proxy/proxy-fetch.js +8 -7
- package/dist/services/streaming/streaming-manager.d.ts +29 -0
- package/dist/services/streaming/streaming-manager.js +244 -0
- package/dist/services/types.d.ts +155 -0
- package/dist/services/types.js +2 -0
- package/dist/services/websocket/websocket-server.d.ts +34 -0
- package/dist/services/websocket/websocket-server.js +304 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +22 -0
- package/dist/telemetry/telemetry-service.d.ts +47 -0
- package/dist/telemetry/telemetry-service.js +261 -0
- package/dist/utils/streaming-utils.d.ts +67 -0
- package/dist/utils/streaming-utils.js +201 -0
- package/package.json +245 -228
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
# [4.1.0](https://github.com/juspay/neurolink/compare/v4.0.0...v4.1.0) (2025-07-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
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)
|
|
9
|
+
|
|
10
|
+
- feat(core)!: transform NeuroLink into enterprise AI analytics platform ([74c88d6](https://github.com/juspay/neurolink/commit/74c88d6484bbd983aba9119929481e655d62eab3))
|
|
2
11
|
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- Major architectural enhancement from basic AI SDK
|
|
15
|
+
to comprehensive enterprise platform with analytics, evaluation,
|
|
16
|
+
real-time services, and business intelligence capabilities.
|
|
17
|
+
|
|
18
|
+
Core Features Added:
|
|
19
|
+
|
|
20
|
+
- Analytics System: Usage tracking, cost estimation, performance monitoring
|
|
21
|
+
- Evaluation Framework: AI-powered quality assessment and scoring
|
|
22
|
+
- Enterprise Config: Backup/restore, validation, provider management
|
|
23
|
+
- Real-time Services: Chat, streaming, websocket capabilities
|
|
24
|
+
- Telemetry: OpenTelemetry integration for production monitoring
|
|
25
|
+
- Documentation: Complete business and technical documentation overhaul
|
|
26
|
+
- Examples: Comprehensive demo library with 30+ working examples
|
|
27
|
+
- Provider Integration: Analytics helper integrated across all 9 providers
|
|
28
|
+
|
|
29
|
+
Technical Implementation:
|
|
30
|
+
|
|
31
|
+
- NEW: src/lib/core/analytics.ts - Real usage tracking engine
|
|
32
|
+
- NEW: src/lib/core/evaluation.ts - AI quality assessment framework
|
|
33
|
+
- NEW: src/lib/config/configManager.ts - Enterprise configuration management
|
|
34
|
+
- NEW: src/lib/chat/ - Complete chat service infrastructure (7 files)
|
|
35
|
+
- NEW: src/lib/services/ - Streaming and WebSocket architecture
|
|
36
|
+
- NEW: src/lib/telemetry/ - OpenTelemetry integration
|
|
37
|
+
- NEW: examples/ - Comprehensive demo ecosystem (30+ examples)
|
|
38
|
+
- NEW: docs/ - Complete documentation overhaul (15+ guides)
|
|
39
|
+
- ENHANCED: All 9 providers with analytics integration
|
|
40
|
+
- ENHANCED: CLI with professional analytics display
|
|
41
|
+
- ENHANCED: Testing infrastructure with new test suites
|
|
42
|
+
|
|
43
|
+
Files Changed: 127 files (+20,542 additions, -6,142 deletions)
|
|
44
|
+
Backward Compatibility: 100% maintained - existing functionality preserved
|
|
45
|
+
New Features: Opt-in via --enable-analytics --enable-evaluation flags
|
|
46
|
+
|
|
47
|
+
Business Impact:
|
|
48
|
+
|
|
49
|
+
- Production Monitoring: Real-time performance and cost tracking
|
|
50
|
+
- Quality Assurance: AI-powered response evaluation and scoring
|
|
51
|
+
- Cost Optimization: Usage analytics and provider comparison
|
|
52
|
+
- Risk Management: Backup systems and error recovery
|
|
53
|
+
- Developer Experience: Professional CLI and comprehensive examples
|
|
54
|
+
- Enterprise Readiness: OpenTelemetry observability and operational excellence
|
|
55
|
+
|
|
56
|
+
Performance Metrics:
|
|
57
|
+
|
|
58
|
+
- Analytics: Real token counts (299-768), response times (2-10s)
|
|
59
|
+
- Evaluation: Quality scores (8-10/10), sub-6s processing
|
|
60
|
+
- Providers: All 9 providers enhanced with zero breaking changes
|
|
61
|
+
- CLI: Professional output with debug diagnostics
|
|
62
|
+
|
|
63
|
+
## [3.0.1](https://github.com/juspay/neurolink/compare/v3.0.0...v3.0.1) (2025-07-01)
|
|
3
64
|
|
|
4
65
|
### Bug Fixes
|
|
5
66
|
|
|
6
|
-
|
|
67
|
+
- **cli:** honor --model parameter in CLI commands ([467ea85](https://github.com/juspay/neurolink/commit/467ea8548688a9db6046c98dbfd268ecd297605c))
|
|
7
68
|
|
|
8
69
|
# [3.0.0](https://github.com/juspay/neurolink/compare/v2.1.0...v3.0.0) (2025-07-01)
|
|
9
70
|
|
|
10
|
-
|
|
11
71
|
### Features
|
|
12
72
|
|
|
13
|
-
|
|
14
|
-
|
|
73
|
+
- **proxy:** add comprehensive enterprise proxy support across all providers ([9668e67](https://github.com/juspay/neurolink/commit/9668e67dfaa27831ba85d45fdf5b7739de902b28))
|
|
15
74
|
|
|
16
75
|
### BREAKING CHANGES
|
|
17
76
|
|
|
18
|
-
|
|
77
|
+
- **proxy:** None - fully backward compatible
|
|
19
78
|
|
|
20
79
|
Files modified:
|
|
80
|
+
|
|
21
81
|
- docs/ENTERPRISE-PROXY-SETUP.md (NEW) - Comprehensive enterprise proxy guide
|
|
22
82
|
- docs/PROVIDER-CONFIGURATION.md - Added proxy configuration section
|
|
23
83
|
- docs/CLI-GUIDE.md - Added proxy environment variables documentation
|
package/README.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
#
|
|
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
|
[](https://www.npmjs.com/package/@juspay/neurolink)
|
|
4
15
|
[](https://www.npmjs.com/package/@juspay/neurolink)
|
|
@@ -7,9 +18,69 @@
|
|
|
7
18
|
[](https://www.typescriptlang.org/)
|
|
8
19
|
[](https://github.com/juspay/neurolink/actions)
|
|
9
20
|
|
|
10
|
-
>
|
|
21
|
+
> Enterprise AI Development Platform with real-time capabilities, advanced telemetry, and universal provider support. Production-ready with TypeScript support.
|
|
22
|
+
|
|
23
|
+
**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.
|
|
24
|
+
|
|
25
|
+
## 🚀 Enterprise Platform Features
|
|
26
|
+
|
|
27
|
+
- **🌐 Real-time WebSocket Infrastructure** - Professional-grade streaming with session management
|
|
28
|
+
- **📊 Advanced Telemetry** - Optional OpenTelemetry monitoring with zero overhead when disabled
|
|
29
|
+
- **💬 Enhanced Chat Services** - Dual-mode SSE + WebSocket support for enterprise applications
|
|
30
|
+
- **🏗️ Enterprise Architecture** - Production-ready scaling with connection pooling and optimization
|
|
31
|
+
|
|
32
|
+
## 🏗️ Enterprise Configuration Management
|
|
33
|
+
|
|
34
|
+
### **✨ NEW: Automatic Backup System**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# All config changes create automatic backups
|
|
38
|
+
npm run config:update
|
|
39
|
+
# ✅ Backup created: .neurolink.backups/neurolink-config-2025-01-07T10-30-00.js
|
|
40
|
+
|
|
41
|
+
# Auto-restore on failures
|
|
42
|
+
npm run config:validate
|
|
43
|
+
# ✅ Config validated with suggestions and warnings
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **✨ NEW: Industry-Standard Interfaces**
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Modern camelCase interfaces with rich context
|
|
50
|
+
interface ExecutionContext {
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
userId?: string;
|
|
53
|
+
aiProvider?: string;
|
|
54
|
+
permissions?: string[];
|
|
55
|
+
cacheOptions?: CacheOptions;
|
|
56
|
+
fallbackOptions?: FallbackOptions;
|
|
57
|
+
metadata?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Optional methods for maximum flexibility
|
|
61
|
+
interface McpRegistry {
|
|
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[]>;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### **Enterprise Features**
|
|
11
77
|
|
|
12
|
-
|
|
78
|
+
- **🔄 Automatic Backup/Restore** - Timestamped backups with hash verification
|
|
79
|
+
- **✅ Config Validation** - Comprehensive validation with suggestions
|
|
80
|
+
- **🏗️ Factory-First MCP** - Lighthouse-compatible architecture (99% compatible)
|
|
81
|
+
- **🔧 Type Safety** - Industry-standard TypeScript interfaces
|
|
82
|
+
- **⚡ Performance** - Tool execution <1ms, pipeline execution ~22ms
|
|
83
|
+
- **🛡️ Error Recovery** - Graceful failures with auto-restore
|
|
13
84
|
|
|
14
85
|
## 🚀 Quick Start
|
|
15
86
|
|
|
@@ -22,6 +93,12 @@ export GOOGLE_AI_API_KEY="AIza-your-google-ai-api-key"
|
|
|
22
93
|
# CLI - No installation required
|
|
23
94
|
npx @juspay/neurolink generate "Hello, AI"
|
|
24
95
|
npx @juspay/neurolink gen "Hello, AI" # Shortest form
|
|
96
|
+
|
|
97
|
+
# 🆕 NEW: AI Enhancement Features
|
|
98
|
+
npx @juspay/neurolink generate "Explain AI" --enable-analytics --debug
|
|
99
|
+
npx @juspay/neurolink generate "Write code" --enable-evaluation --debug
|
|
100
|
+
npx @juspay/neurolink generate "Help me" --context '{"userId":"123"}' --debug
|
|
101
|
+
|
|
25
102
|
npx @juspay/neurolink status
|
|
26
103
|
```
|
|
27
104
|
|
|
@@ -38,14 +115,181 @@ import { createBestAIProvider } from "@juspay/neurolink";
|
|
|
38
115
|
// Auto-selects best available provider
|
|
39
116
|
const provider = createBestAIProvider();
|
|
40
117
|
const result = await provider.generateText({
|
|
41
|
-
|
|
42
|
-
|
|
118
|
+
prompt: "Write a haiku about programming",
|
|
119
|
+
timeout: "30s", // Optional: Set custom timeout (default: 30s)
|
|
43
120
|
});
|
|
44
121
|
|
|
45
122
|
console.log(result.text);
|
|
46
123
|
console.log(`Used: ${result.provider}`);
|
|
47
124
|
```
|
|
48
125
|
|
|
126
|
+
#### 🔗 CLI-SDK Consistency (NEW! ✨)
|
|
127
|
+
|
|
128
|
+
Method aliases that match CLI command names:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
// All three methods are equivalent:
|
|
132
|
+
const result1 = await provider.generateText({ prompt: "Hello" }); // Original
|
|
133
|
+
const result2 = await provider.generate({ prompt: "Hello" }); // Matches CLI 'generate'
|
|
134
|
+
const result3 = await provider.gen({ prompt: "Hello" }); // Matches CLI 'gen'
|
|
135
|
+
|
|
136
|
+
// Use whichever style you prefer:
|
|
137
|
+
const provider = createBestAIProvider();
|
|
138
|
+
|
|
139
|
+
// Detailed method name
|
|
140
|
+
const story = await provider.generateText({
|
|
141
|
+
prompt: "Write a short story about AI",
|
|
142
|
+
maxTokens: 200,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// CLI-style method names
|
|
146
|
+
const poem = await provider.generate({ prompt: "Write a poem" });
|
|
147
|
+
const joke = await provider.gen({ prompt: "Tell me a joke" });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 🆕 Enhanced Usage (NEW! ✨)
|
|
151
|
+
|
|
152
|
+
#### Enhanced CLI with Analytics & Evaluation
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Basic AI generation
|
|
156
|
+
npx @juspay/neurolink generate "Write a business email"
|
|
157
|
+
|
|
158
|
+
# With analytics and evaluation (NEW!)
|
|
159
|
+
npx @juspay/neurolink generate "Write a business email" --enable-analytics --enable-evaluation --debug
|
|
160
|
+
|
|
161
|
+
# See detailed usage data:
|
|
162
|
+
# 📊 Analytics: Provider usage, token costs, response times
|
|
163
|
+
# ⭐ Response Evaluation: AI-powered quality scores
|
|
164
|
+
|
|
165
|
+
# With custom context
|
|
166
|
+
npx @juspay/neurolink generate "Create a proposal" --context '{"company":"TechCorp"}' --debug
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Enhanced SDK with Analytics & Evaluation
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { NeuroLink } from "@juspay/neurolink";
|
|
173
|
+
const neurolink = new NeuroLink();
|
|
174
|
+
|
|
175
|
+
// Basic usage
|
|
176
|
+
const result = await neurolink.generateText("Write a story");
|
|
177
|
+
|
|
178
|
+
// With enhancements (NEW!)
|
|
179
|
+
const enhancedResult = await neurolink.generateText({
|
|
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
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Access enhancement data
|
|
187
|
+
console.log("📊 Usage:", enhancedResult.analytics);
|
|
188
|
+
console.log("⭐ Quality:", enhancedResult.evaluation);
|
|
189
|
+
console.log("Response:", enhancedResult.content);
|
|
190
|
+
|
|
191
|
+
// 🆕 NEW: Enhanced Evaluation with Domain Awareness
|
|
192
|
+
import {
|
|
193
|
+
performEnhancedEvaluation,
|
|
194
|
+
createEnhancedContext,
|
|
195
|
+
} from "@juspay/neurolink";
|
|
196
|
+
|
|
197
|
+
const enhancedContext = createEnhancedContext(
|
|
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
|
+
},
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
const domainEvaluation = await performEnhancedEvaluation(enhancedContext);
|
|
215
|
+
console.log("🎯 Enhanced Evaluation:", domainEvaluation);
|
|
216
|
+
// {
|
|
217
|
+
// relevanceScore: 9, accuracyScore: 8, completenessScore: 9,
|
|
218
|
+
// domainAlignment: 9, terminologyAccuracy: 8, toolEffectiveness: 9,
|
|
219
|
+
// overall: 8.7, alertSeverity: 'none'
|
|
220
|
+
// }
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 🌐 Enterprise Real-time Features (NEW! 🚀)
|
|
224
|
+
|
|
225
|
+
#### Real-time WebSocket Chat
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import {
|
|
229
|
+
createEnhancedChatService,
|
|
230
|
+
NeuroLinkWebSocketServer,
|
|
231
|
+
} from "@juspay/neurolink";
|
|
232
|
+
|
|
233
|
+
// Enhanced chat with WebSocket support
|
|
234
|
+
const chatService = createEnhancedChatService({
|
|
235
|
+
provider: await createBestAIProvider(),
|
|
236
|
+
enableWebSocket: true,
|
|
237
|
+
enableSSE: true,
|
|
238
|
+
streamingConfig: {
|
|
239
|
+
bufferSize: 8192,
|
|
240
|
+
compressionEnabled: true,
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// WebSocket server for real-time applications
|
|
245
|
+
const wsServer = new NeuroLinkWebSocketServer({
|
|
246
|
+
port: 8080,
|
|
247
|
+
maxConnections: 1000,
|
|
248
|
+
enableCompression: true,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// Handle real-time chat
|
|
252
|
+
wsServer.on("chat-message", async ({ connectionId, message }) => {
|
|
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
|
+
});
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### Enterprise Telemetry Integration
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
import { initializeTelemetry, getTelemetryStatus } from "@juspay/neurolink";
|
|
269
|
+
|
|
270
|
+
// Optional enterprise monitoring (zero overhead when disabled)
|
|
271
|
+
const telemetry = initializeTelemetry({
|
|
272
|
+
serviceName: "my-ai-app",
|
|
273
|
+
endpoint: "http://localhost:4318",
|
|
274
|
+
enableTracing: true,
|
|
275
|
+
enableMetrics: true,
|
|
276
|
+
enableLogs: true,
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Check telemetry status
|
|
280
|
+
const status = await getTelemetryStatus();
|
|
281
|
+
console.log("Telemetry enabled:", status.enabled);
|
|
282
|
+
console.log("Service:", status.service);
|
|
283
|
+
console.log("Version:", status.version);
|
|
284
|
+
|
|
285
|
+
// All AI operations are now automatically monitored
|
|
286
|
+
const provider = await createBestAIProvider();
|
|
287
|
+
const result = await provider.generateText({
|
|
288
|
+
prompt: "Generate business report",
|
|
289
|
+
});
|
|
290
|
+
// Telemetry automatically tracks: response time, token usage, cost, errors
|
|
291
|
+
```
|
|
292
|
+
|
|
49
293
|
### Environment Setup
|
|
50
294
|
|
|
51
295
|
```bash
|
|
@@ -189,34 +433,34 @@ npx @juspay/neurolink batch prompts.txt --timeout 45s --output results.json
|
|
|
189
433
|
```typescript
|
|
190
434
|
// SvelteKit API route with timeout handling
|
|
191
435
|
export const POST: RequestHandler = async ({ request }) => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
+
}
|
|
207
451
|
};
|
|
208
452
|
|
|
209
453
|
// Next.js API route with timeout
|
|
210
454
|
export async function POST(request: NextRequest) {
|
|
211
|
-
|
|
212
|
-
|
|
455
|
+
const { prompt } = await request.json();
|
|
456
|
+
const provider = createBestAIProvider();
|
|
213
457
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
458
|
+
const result = await provider.generateText({
|
|
459
|
+
prompt,
|
|
460
|
+
timeout: process.env.AI_TIMEOUT || "30s", // Configurable timeout
|
|
461
|
+
});
|
|
218
462
|
|
|
219
|
-
|
|
463
|
+
return NextResponse.json({ text: result.text });
|
|
220
464
|
}
|
|
221
465
|
```
|
|
222
466
|
|
|
@@ -303,6 +547,53 @@ cd neurolink-demo && node server.js
|
|
|
303
547
|
- **Analysis Tools**: Usage optimization, performance benchmarking, parameter tuning
|
|
304
548
|
- **Workflow Tools**: Test generation, code refactoring, documentation, debugging
|
|
305
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
|
|
306
597
|
|
|
307
598
|
## 🤝 Contributing
|
|
308
599
|
|
|
@@ -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
|
-
content: string;
|
|
224
223
|
mode: "create" | "overwrite" | "append";
|
|
224
|
+
content: string;
|
|
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
|
-
content: string;
|
|
254
253
|
mode: "create" | "overwrite" | "append";
|
|
254
|
+
content: string;
|
|
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
|
-
content: string;
|
|
567
566
|
mode: "create" | "overwrite" | "append";
|
|
567
|
+
content: string;
|
|
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
|
-
content: string;
|
|
597
596
|
mode: "create" | "overwrite" | "append";
|
|
597
|
+
content: string;
|
|
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
|
-
content: string;
|
|
911
910
|
mode: "create" | "overwrite" | "append";
|
|
911
|
+
content: string;
|
|
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
|
-
content: string;
|
|
941
940
|
mode: "create" | "overwrite" | "append";
|
|
941
|
+
content: string;
|
|
942
942
|
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
943
943
|
success: boolean;
|
|
944
944
|
error: string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 3: SSE Chat Utilities
|
|
3
|
+
* Client-side utilities for SSE chat integration
|
|
4
|
+
*/
|
|
5
|
+
import type { ChatMessage } from "./types.js";
|
|
6
|
+
export interface ChatClientOptions {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
sessionId: string;
|
|
9
|
+
onMessage?: (message: ChatMessage) => void;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
onConnect?: () => void;
|
|
12
|
+
onDisconnect?: () => void;
|
|
13
|
+
reconnectAttempts?: number;
|
|
14
|
+
reconnectDelay?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ChatStreamHook {
|
|
17
|
+
messages: ChatMessage[];
|
|
18
|
+
isConnected: boolean;
|
|
19
|
+
isReconnecting: boolean;
|
|
20
|
+
sendMessage: (content: string) => Promise<void>;
|
|
21
|
+
disconnect: () => void;
|
|
22
|
+
reconnect: () => void;
|
|
23
|
+
clearHistory: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Client for SSE chat communication
|
|
27
|
+
*/
|
|
28
|
+
export declare class ChatClient {
|
|
29
|
+
private eventSource?;
|
|
30
|
+
private options;
|
|
31
|
+
private messages;
|
|
32
|
+
private reconnectCount;
|
|
33
|
+
private isConnected;
|
|
34
|
+
private isReconnecting;
|
|
35
|
+
private reconnectTimeout?;
|
|
36
|
+
constructor(options: ChatClientOptions);
|
|
37
|
+
/**
|
|
38
|
+
* Connect to SSE endpoint
|
|
39
|
+
*/
|
|
40
|
+
connect(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Send message to chat
|
|
43
|
+
*/
|
|
44
|
+
sendMessage(content: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Disconnect from SSE endpoint
|
|
47
|
+
*/
|
|
48
|
+
disconnect(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Get message history
|
|
51
|
+
*/
|
|
52
|
+
getMessages(): ChatMessage[];
|
|
53
|
+
/**
|
|
54
|
+
* Clear message history
|
|
55
|
+
*/
|
|
56
|
+
clearMessages(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Check connection status
|
|
59
|
+
*/
|
|
60
|
+
getConnectionStatus(): {
|
|
61
|
+
connected: boolean;
|
|
62
|
+
reconnecting: boolean;
|
|
63
|
+
reconnectCount: number;
|
|
64
|
+
};
|
|
65
|
+
private handleSSEEvent;
|
|
66
|
+
private handleDataEvent;
|
|
67
|
+
private handleErrorEvent;
|
|
68
|
+
private handleCompleteEvent;
|
|
69
|
+
private scheduleReconnect;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create chat client instance
|
|
73
|
+
*/
|
|
74
|
+
export declare function createChatClient(options: ChatClientOptions): ChatClient;
|
|
75
|
+
/**
|
|
76
|
+
* React-style hook for chat streaming (can be adapted for other frameworks)
|
|
77
|
+
*/
|
|
78
|
+
export declare function useChatStream(options: ChatClientOptions): ChatStreamHook;
|
|
79
|
+
/**
|
|
80
|
+
* Utility for creating SSE EventSource with automatic reconnection
|
|
81
|
+
*/
|
|
82
|
+
export declare function createSSEConnection(url: string, options?: {
|
|
83
|
+
onMessage?: (event: MessageEvent) => void;
|
|
84
|
+
onError?: (error: Error) => void;
|
|
85
|
+
onOpen?: () => void;
|
|
86
|
+
reconnect?: boolean;
|
|
87
|
+
maxReconnectAttempts?: number;
|
|
88
|
+
}): {
|
|
89
|
+
connect: () => void;
|
|
90
|
+
disconnect: () => void;
|
|
91
|
+
isConnected: () => boolean;
|
|
92
|
+
};
|