@juspay/neurolink 7.48.1 → 7.49.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 (130) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +215 -16
  3. package/dist/agent/directTools.d.ts +55 -0
  4. package/dist/agent/directTools.js +266 -0
  5. package/dist/cli/factories/commandFactory.d.ts +2 -0
  6. package/dist/cli/factories/commandFactory.js +130 -16
  7. package/dist/cli/index.js +0 -0
  8. package/dist/cli/loop/conversationSelector.d.ts +45 -0
  9. package/dist/cli/loop/conversationSelector.js +222 -0
  10. package/dist/cli/loop/optionsSchema.d.ts +1 -1
  11. package/dist/cli/loop/session.d.ts +36 -8
  12. package/dist/cli/loop/session.js +257 -61
  13. package/dist/core/baseProvider.js +9 -2
  14. package/dist/core/evaluation.js +5 -2
  15. package/dist/factories/providerRegistry.js +2 -2
  16. package/dist/lib/agent/directTools.d.ts +55 -0
  17. package/dist/lib/agent/directTools.js +266 -0
  18. package/dist/lib/core/baseProvider.js +9 -2
  19. package/dist/lib/core/evaluation.js +5 -2
  20. package/dist/lib/factories/providerRegistry.js +2 -2
  21. package/dist/lib/mcp/factory.d.ts +2 -157
  22. package/dist/lib/mcp/flexibleToolValidator.d.ts +1 -5
  23. package/dist/lib/mcp/index.d.ts +3 -2
  24. package/dist/lib/mcp/mcpCircuitBreaker.d.ts +1 -75
  25. package/dist/lib/mcp/mcpClientFactory.d.ts +1 -20
  26. package/dist/lib/mcp/mcpClientFactory.js +1 -0
  27. package/dist/lib/mcp/registry.d.ts +3 -10
  28. package/dist/lib/mcp/servers/agent/directToolsServer.d.ts +1 -1
  29. package/dist/lib/mcp/servers/aiProviders/aiCoreServer.d.ts +1 -1
  30. package/dist/lib/mcp/servers/utilities/utilityServer.d.ts +1 -1
  31. package/dist/lib/mcp/toolDiscoveryService.d.ts +3 -84
  32. package/dist/lib/mcp/toolRegistry.d.ts +2 -24
  33. package/dist/lib/middleware/builtin/guardrails.d.ts +5 -16
  34. package/dist/lib/middleware/builtin/guardrails.js +44 -39
  35. package/dist/lib/middleware/utils/guardrailsUtils.d.ts +64 -0
  36. package/dist/lib/middleware/utils/guardrailsUtils.js +387 -0
  37. package/dist/lib/neurolink.d.ts +1 -1
  38. package/dist/lib/providers/anthropic.js +46 -3
  39. package/dist/lib/providers/azureOpenai.js +8 -2
  40. package/dist/lib/providers/googleAiStudio.js +8 -2
  41. package/dist/lib/providers/googleVertex.js +11 -2
  42. package/dist/lib/providers/huggingFace.js +1 -1
  43. package/dist/lib/providers/litellm.js +1 -1
  44. package/dist/lib/providers/mistral.js +1 -1
  45. package/dist/lib/providers/openAI.js +46 -3
  46. package/dist/lib/session/globalSessionState.d.ts +26 -0
  47. package/dist/lib/session/globalSessionState.js +49 -0
  48. package/dist/lib/types/cli.d.ts +28 -0
  49. package/dist/lib/types/content.d.ts +18 -5
  50. package/dist/lib/types/contextTypes.d.ts +1 -1
  51. package/dist/lib/types/conversation.d.ts +55 -4
  52. package/dist/lib/types/fileTypes.d.ts +65 -0
  53. package/dist/lib/types/fileTypes.js +4 -0
  54. package/dist/lib/types/generateTypes.d.ts +12 -0
  55. package/dist/lib/types/guardrails.d.ts +103 -0
  56. package/dist/lib/types/guardrails.js +1 -0
  57. package/dist/lib/types/index.d.ts +4 -2
  58. package/dist/lib/types/index.js +4 -0
  59. package/dist/lib/types/mcpTypes.d.ts +407 -14
  60. package/dist/lib/types/streamTypes.d.ts +7 -0
  61. package/dist/lib/types/tools.d.ts +132 -35
  62. package/dist/lib/utils/csvProcessor.d.ts +68 -0
  63. package/dist/lib/utils/csvProcessor.js +277 -0
  64. package/dist/lib/utils/fileDetector.d.ts +57 -0
  65. package/dist/lib/utils/fileDetector.js +457 -0
  66. package/dist/lib/utils/imageProcessor.d.ts +10 -0
  67. package/dist/lib/utils/imageProcessor.js +22 -0
  68. package/dist/lib/utils/loopUtils.d.ts +71 -0
  69. package/dist/lib/utils/loopUtils.js +262 -0
  70. package/dist/lib/utils/messageBuilder.d.ts +2 -1
  71. package/dist/lib/utils/messageBuilder.js +197 -2
  72. package/dist/lib/utils/optionsUtils.d.ts +1 -1
  73. package/dist/mcp/factory.d.ts +2 -157
  74. package/dist/mcp/flexibleToolValidator.d.ts +1 -5
  75. package/dist/mcp/index.d.ts +3 -2
  76. package/dist/mcp/mcpCircuitBreaker.d.ts +1 -75
  77. package/dist/mcp/mcpClientFactory.d.ts +1 -20
  78. package/dist/mcp/mcpClientFactory.js +1 -0
  79. package/dist/mcp/registry.d.ts +3 -10
  80. package/dist/mcp/servers/agent/directToolsServer.d.ts +1 -1
  81. package/dist/mcp/servers/aiProviders/aiCoreServer.d.ts +1 -1
  82. package/dist/mcp/servers/utilities/utilityServer.d.ts +1 -1
  83. package/dist/mcp/toolDiscoveryService.d.ts +3 -84
  84. package/dist/mcp/toolRegistry.d.ts +2 -24
  85. package/dist/middleware/builtin/guardrails.d.ts +5 -16
  86. package/dist/middleware/builtin/guardrails.js +44 -39
  87. package/dist/middleware/utils/guardrailsUtils.d.ts +64 -0
  88. package/dist/middleware/utils/guardrailsUtils.js +387 -0
  89. package/dist/neurolink.d.ts +1 -1
  90. package/dist/providers/anthropic.js +46 -3
  91. package/dist/providers/azureOpenai.js +8 -2
  92. package/dist/providers/googleAiStudio.js +8 -2
  93. package/dist/providers/googleVertex.js +11 -2
  94. package/dist/providers/huggingFace.js +1 -1
  95. package/dist/providers/litellm.js +1 -1
  96. package/dist/providers/mistral.js +1 -1
  97. package/dist/providers/openAI.js +46 -3
  98. package/dist/session/globalSessionState.d.ts +26 -0
  99. package/dist/session/globalSessionState.js +49 -0
  100. package/dist/types/cli.d.ts +28 -0
  101. package/dist/types/content.d.ts +18 -5
  102. package/dist/types/contextTypes.d.ts +1 -1
  103. package/dist/types/conversation.d.ts +55 -4
  104. package/dist/types/fileTypes.d.ts +65 -0
  105. package/dist/types/fileTypes.js +4 -0
  106. package/dist/types/generateTypes.d.ts +12 -0
  107. package/dist/types/guardrails.d.ts +103 -0
  108. package/dist/types/guardrails.js +1 -0
  109. package/dist/types/index.d.ts +4 -2
  110. package/dist/types/index.js +4 -0
  111. package/dist/types/mcpTypes.d.ts +407 -14
  112. package/dist/types/modelTypes.d.ts +6 -6
  113. package/dist/types/streamTypes.d.ts +7 -0
  114. package/dist/types/tools.d.ts +132 -35
  115. package/dist/utils/csvProcessor.d.ts +68 -0
  116. package/dist/utils/csvProcessor.js +277 -0
  117. package/dist/utils/fileDetector.d.ts +57 -0
  118. package/dist/utils/fileDetector.js +457 -0
  119. package/dist/utils/imageProcessor.d.ts +10 -0
  120. package/dist/utils/imageProcessor.js +22 -0
  121. package/dist/utils/loopUtils.d.ts +71 -0
  122. package/dist/utils/loopUtils.js +262 -0
  123. package/dist/utils/messageBuilder.d.ts +2 -1
  124. package/dist/utils/messageBuilder.js +197 -2
  125. package/dist/utils/optionsUtils.d.ts +1 -1
  126. package/package.json +9 -3
  127. package/dist/lib/mcp/contracts/mcpContract.d.ts +0 -106
  128. package/dist/lib/mcp/contracts/mcpContract.js +0 -5
  129. package/dist/mcp/contracts/mcpContract.d.ts +0 -106
  130. package/dist/mcp/contracts/mcpContract.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [7.49.0](https://github.com/juspay/neurolink/compare/v7.48.1...v7.49.0) (2025-10-07)
2
+
3
+ ### Features
4
+
5
+ - **(cli):** added support for resuming a conversation ([b860d29](https://github.com/juspay/neurolink/commit/b860d2995a2c3fe29a39c750f152d9f32abb612f))
6
+ - **(middleware):** implement guardrails pre-call filtering with demo and proof ([b99a7f1](https://github.com/juspay/neurolink/commit/b99a7f15e5972eec4bd5652792f56f192239fd8d))
7
+ - **(multimodal):** add comprehensive CSV file support with auto-detection and analysis tools ([374b375](https://github.com/juspay/neurolink/commit/374b3750a996a4e2e466bc1af1d54c9aec7f3b8c))
8
+
9
+ ### Bug Fixes
10
+
11
+ - **(azure):** add SDK parameter support for lighthouse tool events compatibility ([a3bca3b](https://github.com/juspay/neurolink/commit/a3bca3b27b5505919a403896ee1dc1fb55a1983f))
12
+ - **(formatting):** fixed linting issues with docs ([a7d1aff](https://github.com/juspay/neurolink/commit/a7d1affa6d8d00fd2b7491e1643e86654b242a40))
13
+
1
14
  ## [7.48.1](https://github.com/juspay/neurolink/compare/v7.48.0...v7.48.1) (2025-10-02)
2
15
 
3
16
  ## [7.48.0](https://github.com/juspay/neurolink/compare/v7.47.3...v7.48.0) (2025-09-30)
package/README.md CHANGED
@@ -9,12 +9,29 @@
9
9
 
10
10
  Enterprise AI development platform with unified provider access, production-ready tooling, and an opinionated factory architecture. NeuroLink ships as both a TypeScript SDK and a professional CLI so teams can build, operate, and iterate on AI features quickly.
11
11
 
12
+ ## 🧠 What is NeuroLink?
13
+
14
+ **NeuroLink is the universal AI integration platform that unifies 12 major AI providers and 100+ models under one consistent API.**
15
+
16
+ Extracted from production systems at Juspay and battle-tested at enterprise scale, NeuroLink provides a production-ready solution for integrating AI into any application. Whether you're building with OpenAI, Anthropic, Google, AWS Bedrock, Azure, or any of our 12 supported providers, NeuroLink gives you a single, consistent interface that works everywhere.
17
+
18
+ **Why NeuroLink?** Switch providers with a single parameter change, leverage 64+ built-in tools and MCP servers, deploy with confidence using enterprise features like Redis memory and multi-provider failover, and optimize costs automatically with intelligent routing. Use it via our professional CLI or TypeScript SDK—whichever fits your workflow.
19
+
20
+ **Where we're headed:** We're building for the future of AI—edge-first execution and continuous streaming architectures that make AI practically free and universally available. **[Read our vision →](docs/about/vision.md)**
21
+
22
+ **[Get Started in <5 Minutes →](docs/getting-started/quick-start.md)**
23
+
24
+ ---
25
+
12
26
  ## What's New (Q4 2025)
13
27
 
14
- - **Human-in-the-loop workflows** – Pause generation for user approval/input before tool execution or continuing. → [`docs/features/hitl.md`](docs/features/hitl.md)
15
- - **Guardrails middleware** – Block PII, profanity, and unsafe content with built-in content filtering. → [`docs/features/guardrails.md`](docs/features/guardrails.md)
16
- - **Context summarization** – Automatic conversation compression for long-running sessions with memory. → [`docs/features/context-summarization.md`](docs/features/context-summarization.md)
17
- - **Redis conversation export** – Export full session history as JSON for analytics and debugging. → [`docs/features/conversation-history.md`](docs/features/conversation-history.md)
28
+ - **CSV File Support** – Attach CSV files to prompts for AI-powered data analysis with auto-detection. → [CSV Guide](docs/features/multimodal-chat.md#csv-file-support)
29
+ - **LiteLLM Integration** – Access 100+ AI models from all major providers through unified interface. → [Setup Guide](docs/LITELLM-INTEGRATION.md)
30
+ - **SageMaker Integration** – Deploy and use custom trained models on AWS infrastructure. → [Setup Guide](docs/SAGEMAKER-INTEGRATION.md)
31
+ - **Human-in-the-loop workflows** – Pause generation for user approval/input before tool execution. → [HITL Guide](docs/features/hitl.md)
32
+ - **Guardrails middleware** – Block PII, profanity, and unsafe content with built-in filtering. → [Guardrails Guide](docs/features/guardrails.md)
33
+ - **Context summarization** – Automatic conversation compression for long-running sessions. → [Summarization Guide](docs/CONTEXT-SUMMARIZATION.md)
34
+ - **Redis conversation export** – Export full session history as JSON for analytics and debugging. → [History Guide](docs/features/conversation-history.md)
18
35
 
19
36
  > **Q3 highlights** (multimodal chat, auto-evaluation, loop sessions, orchestration) are now in [Platform Capabilities](#platform-capabilities-at-a-glance) below.
20
37
 
@@ -28,7 +45,186 @@ pnpm dlx @juspay/neurolink setup
28
45
  npx @juspay/neurolink generate "Write a launch plan for multimodal chat"
29
46
  ```
30
47
 
31
- Need a persistent workspace? Launch loop mode:
48
+ Need a persistent workspace? Launch loop mode with `npx @juspay/neurolink loop` - [Learn more →](docs/features/cli-loop-sessions.md)
49
+
50
+ ## 🌟 Complete Feature Set
51
+
52
+ NeuroLink is a comprehensive AI development platform. Every feature below is production-ready and fully documented.
53
+
54
+ ### 🤖 AI Provider Integration
55
+
56
+ **12 providers unified under one API** - Switch providers with a single parameter change.
57
+
58
+ | Provider | Models | Free Tier | Tool Support | Status | Documentation |
59
+ | --------------------- | ------------------------------ | --------------- | ------------ | ------------- | ----------------------------------------------------------------------- |
60
+ | **OpenAI** | GPT-4o, GPT-4o-mini, o1 | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#openai) |
61
+ | **Anthropic** | Claude 3.5/3.7 Sonnet, Opus | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#anthropic) |
62
+ | **Google AI Studio** | Gemini 2.5 Flash/Pro | ✅ Free Tier | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#google-ai) |
63
+ | **AWS Bedrock** | Claude, Titan, Llama, Nova | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#bedrock) |
64
+ | **Google Vertex** | Gemini via GCP | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#vertex) |
65
+ | **Azure OpenAI** | GPT-4, GPT-4o, o1 | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#azure) |
66
+ | **LiteLLM** | 100+ models unified | Varies | ✅ Full | ✅ Production | [Setup Guide](docs/LITELLM-INTEGRATION.md) |
67
+ | **AWS SageMaker** | Custom deployed models | ❌ | ✅ Full | ✅ Production | [Setup Guide](docs/SAGEMAKER-INTEGRATION.md) |
68
+ | **Mistral AI** | Mistral Large, Small | ✅ Free Tier | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#mistral) |
69
+ | **Hugging Face** | 100,000+ models | ✅ Free | ⚠️ Partial | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#huggingface) |
70
+ | **Ollama** | Local models (Llama, Mistral) | ✅ Free (Local) | ⚠️ Partial | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#ollama) |
71
+ | **OpenAI Compatible** | Any OpenAI-compatible endpoint | Varies | ✅ Full | ✅ Production | [Setup Guide](docs/getting-started/provider-setup.md#openai-compatible) |
72
+
73
+ **[📖 Provider Comparison Guide](docs/reference/provider-comparison.md)** - Detailed feature matrix and selection criteria
74
+
75
+ ---
76
+
77
+ ### 🔧 Built-in Tools & MCP Integration
78
+
79
+ **6 Core Tools** (work across all providers, zero configuration):
80
+
81
+ | Tool | Purpose | Auto-Available | Documentation |
82
+ | -------------------- | ------------------------ | ----------------------- | --------------------------------------------------------- |
83
+ | `getCurrentTime` | Real-time clock access | ✅ | [Tool Reference](docs/sdk/custom-tools.md#getCurrentTime) |
84
+ | `readFile` | File system reading | ✅ | [Tool Reference](docs/sdk/custom-tools.md#readFile) |
85
+ | `writeFile` | File system writing | ✅ | [Tool Reference](docs/sdk/custom-tools.md#writeFile) |
86
+ | `listDirectory` | Directory listing | ✅ | [Tool Reference](docs/sdk/custom-tools.md#listDirectory) |
87
+ | `calculateMath` | Mathematical operations | ✅ | [Tool Reference](docs/sdk/custom-tools.md#calculateMath) |
88
+ | `websearchGrounding` | Google Vertex web search | ⚠️ Requires credentials | [Tool Reference](docs/sdk/custom-tools.md#websearch) |
89
+
90
+ **58+ External MCP Servers** supported (GitHub, PostgreSQL, Google Drive, Slack, and more):
91
+
92
+ ```typescript
93
+ // Add any MCP server dynamically
94
+ await neurolink.addExternalMCPServer("github", {
95
+ command: "npx",
96
+ args: ["-y", "@modelcontextprotocol/server-github"],
97
+ transport: "stdio",
98
+ env: { GITHUB_TOKEN: process.env.GITHUB_TOKEN },
99
+ });
100
+
101
+ // Tools automatically available to AI
102
+ const result = await neurolink.generate({
103
+ input: { text: 'Create a GitHub issue titled "Bug in auth flow"' },
104
+ });
105
+ ```
106
+
107
+ **[📖 MCP Integration Guide](docs/advanced/mcp-integration.md)** - Setup external servers
108
+
109
+ ---
110
+
111
+ ### 💻 Developer Experience Features
112
+
113
+ **SDK-First Design** with TypeScript, IntelliSense, and type safety:
114
+
115
+ | Feature | Description | Documentation |
116
+ | --------------------------- | ------------------------------ | ----------------------------------------------------- |
117
+ | **Auto Provider Selection** | Intelligent provider fallback | [SDK Guide](docs/sdk/index.md#auto-selection) |
118
+ | **Streaming Responses** | Real-time token streaming | [Streaming Guide](docs/advanced/streaming.md) |
119
+ | **Conversation Memory** | Automatic context management | [Memory Guide](docs/sdk/index.md#memory) |
120
+ | **Full Type Safety** | Complete TypeScript types | [Type Reference](docs/sdk/api-reference.md) |
121
+ | **Error Handling** | Graceful provider fallback | [Error Guide](docs/reference/troubleshooting.md) |
122
+ | **Analytics & Evaluation** | Usage tracking, quality scores | [Analytics Guide](docs/advanced/analytics.md) |
123
+ | **Middleware System** | Request/response hooks | [Middleware Guide](docs/CUSTOM-MIDDLEWARE-GUIDE.md) |
124
+ | **Framework Integration** | Next.js, SvelteKit, Express | [Framework Guides](docs/sdk/framework-integration.md) |
125
+
126
+ ---
127
+
128
+ ### 🏢 Enterprise & Production Features
129
+
130
+ **Production-ready capabilities for regulated industries:**
131
+
132
+ | Feature | Description | Use Case | Documentation |
133
+ | --------------------------- | ---------------------------------- | ------------------------- | ----------------------------------------------------------- |
134
+ | **Enterprise Proxy** | Corporate proxy support | Behind firewalls | [Proxy Setup](docs/ENTERPRISE-PROXY-SETUP.md) |
135
+ | **Redis Memory** | Distributed conversation state | Multi-instance deployment | [Redis Guide](docs/getting-started/provider-setup.md#redis) |
136
+ | **Cost Optimization** | Automatic cheapest model selection | Budget control | [Cost Guide](docs/advanced/index.md) |
137
+ | **Multi-Provider Failover** | Automatic provider switching | High availability | [Failover Guide](docs/advanced/index.md) |
138
+ | **Telemetry & Monitoring** | OpenTelemetry integration | Observability | [Telemetry Guide](docs/TELEMETRY-GUIDE.md) |
139
+ | **Security Hardening** | Credential management, auditing | Compliance | [Security Guide](docs/advanced/enterprise.md) |
140
+ | **Custom Model Hosting** | SageMaker integration | Private models | [SageMaker Guide](docs/SAGEMAKER-INTEGRATION.md) |
141
+ | **Load Balancing** | LiteLLM proxy integration | Scale & routing | [Load Balancing](docs/LITELLM-INTEGRATION.md) |
142
+
143
+ **Security & Compliance:**
144
+
145
+ - ✅ SOC2 Type II compliant deployments
146
+ - ✅ ISO 27001 certified infrastructure compatible
147
+ - ✅ GDPR-compliant data handling (EU providers available)
148
+ - ✅ HIPAA compatible (with proper configuration)
149
+ - ✅ Hardened OS verified (SELinux, AppArmor)
150
+ - ✅ Zero credential logging
151
+ - ✅ Encrypted configuration storage
152
+
153
+ **[📖 Enterprise Deployment Guide](docs/advanced/enterprise.md)** - Complete production checklist
154
+
155
+ ---
156
+
157
+ ### 🎨 Professional CLI
158
+
159
+ **15+ commands** for every workflow:
160
+
161
+ | Command | Purpose | Example | Documentation |
162
+ | ---------- | ---------------------------------- | -------------------------- | ----------------------------------------- |
163
+ | `setup` | Interactive provider configuration | `neurolink setup` | [Setup Guide](docs/cli/index.md) |
164
+ | `generate` | Text generation | `neurolink gen "Hello"` | [Generate](docs/cli/commands.md#generate) |
165
+ | `stream` | Streaming generation | `neurolink stream "Story"` | [Stream](docs/cli/commands.md#stream) |
166
+ | `status` | Provider health check | `neurolink status` | [Status](docs/cli/commands.md#status) |
167
+ | `loop` | Interactive session | `neurolink loop` | [Loop](docs/cli/commands.md#loop) |
168
+ | `mcp` | MCP server management | `neurolink mcp discover` | [MCP CLI](docs/cli/commands.md#mcp) |
169
+ | `models` | Model listing | `neurolink models` | [Models](docs/cli/commands.md#models) |
170
+ | `eval` | Model evaluation | `neurolink eval` | [Eval](docs/cli/commands.md#eval) |
171
+
172
+ **[📖 Complete CLI Reference](docs/cli/commands.md)** - All commands and options
173
+
174
+ ## 💰 Smart Model Selection
175
+
176
+ NeuroLink features intelligent model selection and cost optimization:
177
+
178
+ ### Cost Optimization Features
179
+
180
+ - **💰 Automatic Cost Optimization**: Selects cheapest models for simple tasks
181
+ - **🔄 LiteLLM Model Routing**: Access 100+ models with automatic load balancing
182
+ - **🔍 Capability-Based Selection**: Find models with specific features (vision, function calling)
183
+ - **⚡ Intelligent Fallback**: Seamless switching when providers fail
184
+
185
+ ```bash
186
+ # Cost optimization - automatically use cheapest model
187
+ npx @juspay/neurolink generate "Hello" --optimize-cost
188
+
189
+ # LiteLLM specific model selection
190
+ npx @juspay/neurolink generate "Complex analysis" --provider litellm --model "anthropic/claude-3-5-sonnet"
191
+
192
+ # Auto-select best available provider
193
+ npx @juspay/neurolink generate "Write code" # Automatically chooses optimal provider
194
+ ```
195
+
196
+ ## ✨ Interactive Loop Mode
197
+
198
+ NeuroLink features a powerful **interactive loop mode** that transforms the CLI into a persistent, stateful session. This allows you to run multiple commands, set session-wide variables, and maintain conversation history without restarting.
199
+
200
+ ### Start the Loop
201
+
202
+ ```bash
203
+ npx @juspay/neurolink loop
204
+ ```
205
+
206
+ ### Example Session
207
+
208
+ ```bash
209
+ # Start the interactive session
210
+ $ npx @juspay/neurolink loop
211
+
212
+ neurolink » set provider google-ai
213
+ ✓ provider set to google-ai
214
+
215
+ neurolink » set temperature 0.8
216
+ ✓ temperature set to 0.8
217
+
218
+ neurolink » generate "Tell me a fun fact about space"
219
+ The quietest place on Earth is an anechoic chamber at Microsoft's headquarters in Redmond, Washington. The background noise is so low that it's measured in negative decibels, and you can hear your own heartbeat.
220
+
221
+ # Exit the session
222
+ neurolink » exit
223
+ ```
224
+
225
+ ### Conversation Memory in Loop Mode
226
+
227
+ Start the loop with conversation memory to have the AI remember the context of your previous commands.
32
228
 
33
229
  ```bash
34
230
  npx @juspay/neurolink loop --enable-conversation-memory
@@ -67,8 +263,11 @@ const neurolink = new NeuroLink({
67
263
 
68
264
  const result = await neurolink.generate({
69
265
  input: {
70
- text: "Create a multimodal onboarding script",
71
- images: ["./diagrams/architecture.png"],
266
+ text: "Create a comprehensive analysis",
267
+ files: [
268
+ "./sales_data.csv", // Auto-detected as CSV
269
+ "./diagrams/architecture.png", // Auto-detected as image
270
+ ],
72
271
  },
73
272
  enableEvaluation: true,
74
273
  region: "us-east-1",
@@ -82,15 +281,15 @@ Full command and API breakdown lives in [`docs/cli/commands.md`](docs/cli/comman
82
281
 
83
282
  ## Platform Capabilities at a Glance
84
283
 
85
- | Capability | Highlights |
86
- | ------------------------ | --------------------------------------------------------------------------------------------- |
87
- | **Provider unification** | 12+ providers with automatic fallback, cost-aware routing, provider orchestration (Q3). |
88
- | **Multimodal pipeline** | Stream images + text across providers with local/remote assets (Q3 2025). |
89
- | **Quality & governance** | Auto-evaluation engine (Q3), guardrails middleware (Q4), HITL workflows (Q4), audit logging. |
90
- | **Memory & context** | Conversation memory, Mem0 integration, Redis history export (Q4), context summarization (Q4). |
91
- | **CLI tooling** | Loop sessions (Q3), setup wizard, config validation, Redis auto-detect, JSON output. |
92
- | **Enterprise ops** | Proxy support, regional routing (Q3), telemetry hooks, configuration management. |
93
- | **Tool ecosystem** | MCP auto discovery, LiteLLM hub access, SageMaker custom deployment, web search. |
284
+ | Capability | Highlights |
285
+ | ------------------------ | -------------------------------------------------------------------------------------------------------- |
286
+ | **Provider unification** | 12+ providers with automatic fallback, cost-aware routing, provider orchestration (Q3). |
287
+ | **Multimodal pipeline** | Stream images + CSV data across providers with local/remote assets. Auto-detection for mixed file types. |
288
+ | **Quality & governance** | Auto-evaluation engine (Q3), guardrails middleware (Q4), HITL workflows (Q4), audit logging. |
289
+ | **Memory & context** | Conversation memory, Mem0 integration, Redis history export (Q4), context summarization (Q4). |
290
+ | **CLI tooling** | Loop sessions (Q3), setup wizard, config validation, Redis auto-detect, JSON output. |
291
+ | **Enterprise ops** | Proxy support, regional routing (Q3), telemetry hooks, configuration management. |
292
+ | **Tool ecosystem** | MCP auto discovery, LiteLLM hub access, SageMaker custom deployment, web search. |
94
293
 
95
294
  ## Documentation Map
96
295
 
@@ -346,6 +346,61 @@ export declare const directAgentTools: {
346
346
  count?: undefined;
347
347
  }>;
348
348
  };
349
+ analyzeCSV: import("ai").Tool<z.ZodObject<{
350
+ filePath: z.ZodEffects<z.ZodString, string, string>;
351
+ operation: z.ZodEnum<["count_by_column", "sum_by_column", "average_by_column", "min_max_by_column", "describe"]>;
352
+ column: z.ZodOptional<z.ZodString>;
353
+ maxRows: z.ZodOptional<z.ZodNumber>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
356
+ filePath: string;
357
+ maxRows?: number | undefined;
358
+ column?: string | undefined;
359
+ }, {
360
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
361
+ filePath: string;
362
+ maxRows?: number | undefined;
363
+ column?: string | undefined;
364
+ }>, {
365
+ success: boolean;
366
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
367
+ column: string | undefined;
368
+ result: string;
369
+ rowCount: number;
370
+ } | {
371
+ success: boolean;
372
+ error: string;
373
+ operation?: undefined;
374
+ column?: undefined;
375
+ } | {
376
+ success: boolean;
377
+ error: string;
378
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
379
+ column: string | undefined;
380
+ }> & {
381
+ execute: (args: {
382
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
383
+ filePath: string;
384
+ maxRows?: number | undefined;
385
+ column?: string | undefined;
386
+ }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
387
+ success: boolean;
388
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
389
+ column: string | undefined;
390
+ result: string;
391
+ rowCount: number;
392
+ } | {
393
+ success: boolean;
394
+ error: string;
395
+ operation?: undefined;
396
+ column?: undefined;
397
+ } | {
398
+ success: boolean;
399
+ error: string;
400
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
401
+ column: string | undefined;
402
+ }>;
403
+ };
349
404
  websearchGrounding: import("ai").Tool<z.ZodObject<{
350
405
  query: z.ZodString;
351
406
  maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -8,6 +8,7 @@ import * as fs from "fs";
8
8
  import * as path from "path";
9
9
  import { logger } from "../utils/logger.js";
10
10
  import { VertexAI } from "@google-cloud/vertexai";
11
+ import { CSVProcessor } from "../utils/csvProcessor.js";
11
12
  // Runtime Google Search tool creation - bypasses TypeScript strict typing
12
13
  function createGoogleSearchTools() {
13
14
  const searchTool = {};
@@ -336,6 +337,271 @@ export const directAgentTools = {
336
337
  }
337
338
  },
338
339
  }),
340
+ analyzeCSV: tool({
341
+ description: "Analyze CSV file for accurate counting, aggregation, and statistical analysis. Use this for precise data operations like counting rows by column, calculating sums/averages, finding min/max values, etc. The tool reads the file directly - do NOT pass CSV content.",
342
+ parameters: z.object({
343
+ filePath: z
344
+ .string()
345
+ .refine((inputPath) => {
346
+ const resolvedPath = path.resolve(inputPath);
347
+ const normalizedPath = resolvedPath
348
+ .toLowerCase()
349
+ .replace(/\\/g, "/");
350
+ const sensitivePatterns = [
351
+ "/etc/",
352
+ "/sys/",
353
+ "/proc/",
354
+ "/dev/",
355
+ "/root/",
356
+ "/.ssh/",
357
+ "/private/etc/",
358
+ "/private/var/",
359
+ "c:/windows/",
360
+ "c:/program files/",
361
+ "c:/programdata/",
362
+ ];
363
+ return !sensitivePatterns.some((pattern) => normalizedPath.startsWith(pattern));
364
+ }, {
365
+ message: "Invalid file path: access to system directories is not allowed",
366
+ })
367
+ .describe("Path to the CSV file to analyze (e.g., 'test/data.csv' or '/absolute/path/file.csv')"),
368
+ operation: z
369
+ .enum([
370
+ "count_by_column",
371
+ "sum_by_column",
372
+ "average_by_column",
373
+ "min_max_by_column",
374
+ "describe",
375
+ ])
376
+ .describe("Type of analysis to perform"),
377
+ column: z
378
+ .string()
379
+ .optional()
380
+ .describe("Column name for the operation (required for most operations)"),
381
+ maxRows: z
382
+ .number()
383
+ .optional()
384
+ .describe("Maximum rows to process (default: 1000)"),
385
+ }),
386
+ execute: async ({ filePath, operation, column, maxRows = 1000 }) => {
387
+ const startTime = Date.now();
388
+ logger.info(`[analyzeCSV] 🚀 START: file=${filePath}, operation=${operation}, column=${column}, maxRows=${maxRows}`);
389
+ try {
390
+ // Resolve file path
391
+ logger.debug(`[analyzeCSV] Resolving file: ${filePath}`);
392
+ const path = await import("path");
393
+ // Resolve path (support both relative and absolute)
394
+ const resolvedPath = path.isAbsolute(filePath)
395
+ ? filePath
396
+ : path.resolve(process.cwd(), filePath);
397
+ logger.debug(`[analyzeCSV] Resolved path: ${resolvedPath}`);
398
+ // Parse CSV using streaming from disk (memory efficient)
399
+ logger.info(`[analyzeCSV] Starting CSV parsing (max ${maxRows} rows)...`);
400
+ const rows = (await CSVProcessor.parseCSVFile(resolvedPath, maxRows));
401
+ logger.info(`[analyzeCSV] ✅ CSV parsing complete: ${rows.length} rows`);
402
+ if (rows.length === 0) {
403
+ logger.warn(`[analyzeCSV] No data rows found`);
404
+ return {
405
+ success: false,
406
+ error: "No data rows found in CSV",
407
+ };
408
+ }
409
+ // Log column names
410
+ const columnNames = rows.length > 0 ? Object.keys(rows[0]) : [];
411
+ logger.info(`[analyzeCSV] Found ${rows.length} rows with columns:`, columnNames);
412
+ logger.info(`[analyzeCSV] Executing operation: ${operation}`);
413
+ let result;
414
+ switch (operation) {
415
+ case "count_by_column": {
416
+ logger.info(`[analyzeCSV] count_by_column: column=${column}`);
417
+ if (!column) {
418
+ return {
419
+ success: false,
420
+ error: "Column name required for count_by_column operation",
421
+ };
422
+ }
423
+ // Count occurrences of each value in the column
424
+ const counts = {};
425
+ logger.debug(`[analyzeCSV] Counting rows...`);
426
+ for (const row of rows) {
427
+ const value = row[column];
428
+ if (value !== undefined) {
429
+ counts[value] = (counts[value] || 0) + 1;
430
+ }
431
+ }
432
+ logger.debug(`[analyzeCSV] Found ${Object.keys(counts).length} unique values`);
433
+ // Sort by count descending
434
+ logger.debug(`[analyzeCSV] Sorting results...`);
435
+ result = Object.fromEntries(Object.entries(counts).sort(([, a], [, b]) => b - a));
436
+ logger.info(`[analyzeCSV] ✅ count_by_column complete. Result:`, result);
437
+ break;
438
+ }
439
+ case "sum_by_column": {
440
+ logger.info(`[analyzeCSV] sum_by_column: column=${column}`);
441
+ if (!column) {
442
+ return {
443
+ success: false,
444
+ error: "Column name required for sum_by_column operation",
445
+ };
446
+ }
447
+ // Sum numeric values from the target column itself for each group
448
+ const groups = {};
449
+ logger.debug(`[analyzeCSV] Grouping and summing ${rows.length} rows...`);
450
+ let processedRows = 0;
451
+ let totalNumericValuesFound = 0;
452
+ for (const row of rows) {
453
+ const key = row[column];
454
+ if (!key) {
455
+ continue;
456
+ }
457
+ // Parse numeric value from the target column
458
+ const value = row[column];
459
+ if (value === undefined || value === null || value === "") {
460
+ continue;
461
+ }
462
+ const num = parseFloat(value);
463
+ if (isNaN(num)) {
464
+ continue;
465
+ }
466
+ if (!groups[key]) {
467
+ groups[key] = 0;
468
+ }
469
+ groups[key] += num;
470
+ totalNumericValuesFound++;
471
+ processedRows++;
472
+ if (processedRows % 10 === 0) {
473
+ logger.debug(`[analyzeCSV] Processed ${processedRows}/${rows.length} rows`);
474
+ }
475
+ }
476
+ // Fail fast if no numeric data found in the requested column
477
+ if (totalNumericValuesFound === 0) {
478
+ return {
479
+ success: false,
480
+ error: `No numeric data found in column "${column}" for sum_by_column operation`,
481
+ };
482
+ }
483
+ logger.debug(`[analyzeCSV] Calculated sums for ${Object.keys(groups).length} groups (${totalNumericValuesFound} numeric values)`);
484
+ result = groups;
485
+ logger.info(`[analyzeCSV] ✅ sum_by_column complete`);
486
+ break;
487
+ }
488
+ case "average_by_column": {
489
+ logger.info(`[analyzeCSV] average_by_column: column=${column}`);
490
+ if (!column) {
491
+ return {
492
+ success: false,
493
+ error: "Column name required for average_by_column operation",
494
+ };
495
+ }
496
+ // Average numeric values from the target column itself for each group
497
+ const groups = {};
498
+ logger.debug(`[analyzeCSV] Grouping and averaging ${rows.length} rows...`);
499
+ let processedRows = 0;
500
+ let totalNumericValuesFound = 0;
501
+ for (const row of rows) {
502
+ const key = row[column];
503
+ if (!key) {
504
+ continue;
505
+ }
506
+ // Parse numeric value from the target column
507
+ const value = row[column];
508
+ if (value === undefined || value === null || value === "") {
509
+ continue;
510
+ }
511
+ const num = parseFloat(value);
512
+ if (isNaN(num)) {
513
+ continue;
514
+ }
515
+ if (!groups[key]) {
516
+ groups[key] = { sum: 0, count: 0 };
517
+ }
518
+ groups[key].sum += num;
519
+ groups[key].count++;
520
+ totalNumericValuesFound++;
521
+ processedRows++;
522
+ if (processedRows % 10 === 0) {
523
+ logger.debug(`[analyzeCSV] Processed ${processedRows}/${rows.length} rows`);
524
+ }
525
+ }
526
+ // Fail fast if no numeric data found in the requested column
527
+ if (totalNumericValuesFound === 0) {
528
+ return {
529
+ success: false,
530
+ error: `No numeric data found in column "${column}" for average_by_column operation`,
531
+ };
532
+ }
533
+ logger.debug(`[analyzeCSV] Calculated averages for ${Object.keys(groups).length} groups (${totalNumericValuesFound} numeric values)`);
534
+ result = Object.fromEntries(Object.entries(groups).map(([k, v]) => [
535
+ k,
536
+ v.count > 0 ? v.sum / v.count : 0,
537
+ ]));
538
+ logger.info(`[analyzeCSV] ✅ average_by_column complete`);
539
+ break;
540
+ }
541
+ case "min_max_by_column": {
542
+ if (!column) {
543
+ return {
544
+ success: false,
545
+ error: "Column name required for min_max_by_column operation",
546
+ };
547
+ }
548
+ const values = rows
549
+ .map((row) => row[column])
550
+ .filter((v) => v !== undefined && v !== "");
551
+ const numericValues = values
552
+ .map((v) => parseFloat(v))
553
+ .filter((n) => !isNaN(n));
554
+ if (numericValues.length === 0) {
555
+ return {
556
+ success: false,
557
+ error: `No numeric data found in column "${column}" for min_max_by_column operation`,
558
+ };
559
+ }
560
+ result = {
561
+ min: Math.min(...numericValues),
562
+ max: Math.max(...numericValues),
563
+ numericCount: numericValues.length,
564
+ totalCount: values.length,
565
+ };
566
+ break;
567
+ }
568
+ case "describe": {
569
+ const columnNames = rows.length > 0 ? Object.keys(rows[0]) : [];
570
+ result = {
571
+ total_rows: rows.length,
572
+ columns: columnNames,
573
+ column_count: columnNames.length,
574
+ };
575
+ break;
576
+ }
577
+ default:
578
+ return {
579
+ success: false,
580
+ error: `Unknown operation: ${operation}`,
581
+ };
582
+ }
583
+ const duration = Date.now() - startTime;
584
+ logger.info(`[analyzeCSV] 🏁 COMPLETE: ${operation} took ${duration}ms`);
585
+ const response = {
586
+ success: true,
587
+ operation,
588
+ column,
589
+ result: JSON.stringify(result, null, 2),
590
+ rowCount: rows.length,
591
+ };
592
+ logger.debug(`[analyzeCSV] 📤 RETURNING TO LLM:`, JSON.stringify(response, null, 2));
593
+ return response;
594
+ }
595
+ catch (error) {
596
+ return {
597
+ success: false,
598
+ error: error instanceof Error ? error.message : String(error),
599
+ operation,
600
+ column,
601
+ };
602
+ }
603
+ },
604
+ }),
339
605
  websearchGrounding: tool({
340
606
  description: "Search the web for current information using Google Search grounding. Returns raw search data for AI processing.",
341
607
  parameters: z.object({
@@ -6,6 +6,8 @@ export declare class CLICommandFactory {
6
6
  private static readonly commonOptions;
7
7
  private static buildOptions;
8
8
  private static processCliImages;
9
+ private static processCliCSVFiles;
10
+ private static processCliFiles;
9
11
  private static processOptions;
10
12
  private static handleOutput;
11
13
  private static isValidTokenUsage;