@juspay/neurolink 1.5.3 → 1.9.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 (176) hide show
  1. package/CHANGELOG.md +241 -1
  2. package/README.md +113 -20
  3. package/dist/agent/direct-tools.d.ts +1203 -0
  4. package/dist/agent/direct-tools.js +387 -0
  5. package/dist/cli/commands/agent-generate.d.ts +2 -0
  6. package/dist/cli/commands/agent-generate.js +70 -0
  7. package/dist/cli/commands/config.d.ts +76 -9
  8. package/dist/cli/commands/config.js +358 -233
  9. package/dist/cli/commands/mcp.d.ts +2 -1
  10. package/dist/cli/commands/mcp.js +874 -146
  11. package/dist/cli/commands/ollama.d.ts +8 -0
  12. package/dist/cli/commands/ollama.js +333 -0
  13. package/dist/cli/index.js +591 -327
  14. package/dist/cli/utils/complete-setup.d.ts +19 -0
  15. package/dist/cli/utils/complete-setup.js +81 -0
  16. package/dist/cli/utils/env-manager.d.ts +44 -0
  17. package/dist/cli/utils/env-manager.js +226 -0
  18. package/dist/cli/utils/interactive-setup.d.ts +48 -0
  19. package/dist/cli/utils/interactive-setup.js +302 -0
  20. package/dist/core/dynamic-models.d.ts +208 -0
  21. package/dist/core/dynamic-models.js +250 -0
  22. package/dist/core/factory.d.ts +13 -6
  23. package/dist/core/factory.js +180 -50
  24. package/dist/core/types.d.ts +8 -3
  25. package/dist/core/types.js +7 -4
  26. package/dist/index.d.ts +16 -16
  27. package/dist/index.js +16 -16
  28. package/dist/lib/agent/direct-tools.d.ts +1203 -0
  29. package/dist/lib/agent/direct-tools.js +387 -0
  30. package/dist/lib/core/dynamic-models.d.ts +208 -0
  31. package/dist/lib/core/dynamic-models.js +250 -0
  32. package/dist/lib/core/factory.d.ts +13 -6
  33. package/dist/lib/core/factory.js +180 -50
  34. package/dist/lib/core/types.d.ts +8 -3
  35. package/dist/lib/core/types.js +7 -4
  36. package/dist/lib/index.d.ts +16 -16
  37. package/dist/lib/index.js +16 -16
  38. package/dist/lib/mcp/auto-discovery.d.ts +120 -0
  39. package/dist/lib/mcp/auto-discovery.js +793 -0
  40. package/dist/lib/mcp/client.d.ts +66 -0
  41. package/dist/lib/mcp/client.js +245 -0
  42. package/dist/lib/mcp/config.d.ts +31 -0
  43. package/dist/lib/mcp/config.js +74 -0
  44. package/dist/lib/mcp/context-manager.d.ts +4 -4
  45. package/dist/lib/mcp/context-manager.js +24 -18
  46. package/dist/lib/mcp/factory.d.ts +28 -11
  47. package/dist/lib/mcp/factory.js +36 -29
  48. package/dist/lib/mcp/function-calling.d.ts +51 -0
  49. package/dist/lib/mcp/function-calling.js +510 -0
  50. package/dist/lib/mcp/index.d.ts +190 -0
  51. package/dist/lib/mcp/index.js +156 -0
  52. package/dist/lib/mcp/initialize-tools.d.ts +28 -0
  53. package/dist/lib/mcp/initialize-tools.js +209 -0
  54. package/dist/lib/mcp/initialize.d.ts +17 -0
  55. package/dist/lib/mcp/initialize.js +51 -0
  56. package/dist/lib/mcp/logging.d.ts +71 -0
  57. package/dist/lib/mcp/logging.js +183 -0
  58. package/dist/lib/mcp/manager.d.ts +67 -0
  59. package/dist/lib/mcp/manager.js +176 -0
  60. package/dist/lib/mcp/neurolink-mcp-client.d.ts +96 -0
  61. package/dist/lib/mcp/neurolink-mcp-client.js +417 -0
  62. package/dist/lib/mcp/orchestrator.d.ts +3 -3
  63. package/dist/lib/mcp/orchestrator.js +46 -43
  64. package/dist/lib/mcp/registry.d.ts +2 -2
  65. package/dist/lib/mcp/registry.js +42 -33
  66. package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -1
  67. package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.js +205 -66
  68. package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +143 -99
  69. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
  70. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.js +404 -251
  71. package/dist/lib/mcp/servers/utilities/utility-server.d.ts +8 -0
  72. package/dist/lib/mcp/servers/utilities/utility-server.js +326 -0
  73. package/dist/lib/mcp/tool-integration.d.ts +67 -0
  74. package/dist/lib/mcp/tool-integration.js +179 -0
  75. package/dist/lib/mcp/unified-registry.d.ts +269 -0
  76. package/dist/lib/mcp/unified-registry.js +1411 -0
  77. package/dist/lib/neurolink.d.ts +68 -6
  78. package/dist/lib/neurolink.js +314 -42
  79. package/dist/lib/providers/agent-enhanced-provider.d.ts +59 -0
  80. package/dist/lib/providers/agent-enhanced-provider.js +242 -0
  81. package/dist/lib/providers/amazonBedrock.d.ts +3 -3
  82. package/dist/lib/providers/amazonBedrock.js +54 -50
  83. package/dist/lib/providers/anthropic.d.ts +2 -2
  84. package/dist/lib/providers/anthropic.js +92 -84
  85. package/dist/lib/providers/azureOpenAI.d.ts +2 -2
  86. package/dist/lib/providers/azureOpenAI.js +97 -86
  87. package/dist/lib/providers/function-calling-provider.d.ts +70 -0
  88. package/dist/lib/providers/function-calling-provider.js +359 -0
  89. package/dist/lib/providers/googleAIStudio.d.ts +10 -5
  90. package/dist/lib/providers/googleAIStudio.js +60 -38
  91. package/dist/lib/providers/googleVertexAI.d.ts +3 -3
  92. package/dist/lib/providers/googleVertexAI.js +96 -86
  93. package/dist/lib/providers/huggingFace.d.ts +31 -0
  94. package/dist/lib/providers/huggingFace.js +362 -0
  95. package/dist/lib/providers/index.d.ts +14 -8
  96. package/dist/lib/providers/index.js +18 -12
  97. package/dist/lib/providers/mcp-provider.d.ts +62 -0
  98. package/dist/lib/providers/mcp-provider.js +183 -0
  99. package/dist/lib/providers/mistralAI.d.ts +32 -0
  100. package/dist/lib/providers/mistralAI.js +223 -0
  101. package/dist/lib/providers/ollama.d.ts +51 -0
  102. package/dist/lib/providers/ollama.js +508 -0
  103. package/dist/lib/providers/openAI.d.ts +7 -3
  104. package/dist/lib/providers/openAI.js +45 -33
  105. package/dist/lib/utils/logger.js +2 -2
  106. package/dist/lib/utils/providerUtils.js +59 -22
  107. package/dist/mcp/auto-discovery.d.ts +120 -0
  108. package/dist/mcp/auto-discovery.js +794 -0
  109. package/dist/mcp/client.d.ts +66 -0
  110. package/dist/mcp/client.js +245 -0
  111. package/dist/mcp/config.d.ts +31 -0
  112. package/dist/mcp/config.js +74 -0
  113. package/dist/mcp/context-manager.d.ts +4 -4
  114. package/dist/mcp/context-manager.js +24 -18
  115. package/dist/mcp/factory.d.ts +28 -11
  116. package/dist/mcp/factory.js +36 -29
  117. package/dist/mcp/function-calling.d.ts +51 -0
  118. package/dist/mcp/function-calling.js +510 -0
  119. package/dist/mcp/index.d.ts +190 -0
  120. package/dist/mcp/index.js +156 -0
  121. package/dist/mcp/initialize-tools.d.ts +28 -0
  122. package/dist/mcp/initialize-tools.js +210 -0
  123. package/dist/mcp/initialize.d.ts +17 -0
  124. package/dist/mcp/initialize.js +51 -0
  125. package/dist/mcp/logging.d.ts +71 -0
  126. package/dist/mcp/logging.js +183 -0
  127. package/dist/mcp/manager.d.ts +67 -0
  128. package/dist/mcp/manager.js +176 -0
  129. package/dist/mcp/neurolink-mcp-client.d.ts +96 -0
  130. package/dist/mcp/neurolink-mcp-client.js +417 -0
  131. package/dist/mcp/orchestrator.d.ts +3 -3
  132. package/dist/mcp/orchestrator.js +46 -43
  133. package/dist/mcp/registry.d.ts +2 -2
  134. package/dist/mcp/registry.js +42 -33
  135. package/dist/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -1
  136. package/dist/mcp/servers/ai-providers/ai-analysis-tools.js +205 -66
  137. package/dist/mcp/servers/ai-providers/ai-core-server.js +143 -99
  138. package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
  139. package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +404 -253
  140. package/dist/mcp/servers/utilities/utility-server.d.ts +8 -0
  141. package/dist/mcp/servers/utilities/utility-server.js +326 -0
  142. package/dist/mcp/tool-integration.d.ts +67 -0
  143. package/dist/mcp/tool-integration.js +179 -0
  144. package/dist/mcp/unified-registry.d.ts +269 -0
  145. package/dist/mcp/unified-registry.js +1411 -0
  146. package/dist/neurolink.d.ts +68 -6
  147. package/dist/neurolink.js +314 -42
  148. package/dist/providers/agent-enhanced-provider.d.ts +59 -0
  149. package/dist/providers/agent-enhanced-provider.js +242 -0
  150. package/dist/providers/amazonBedrock.d.ts +3 -3
  151. package/dist/providers/amazonBedrock.js +54 -50
  152. package/dist/providers/anthropic.d.ts +2 -2
  153. package/dist/providers/anthropic.js +92 -84
  154. package/dist/providers/azureOpenAI.d.ts +2 -2
  155. package/dist/providers/azureOpenAI.js +97 -86
  156. package/dist/providers/function-calling-provider.d.ts +70 -0
  157. package/dist/providers/function-calling-provider.js +359 -0
  158. package/dist/providers/googleAIStudio.d.ts +10 -5
  159. package/dist/providers/googleAIStudio.js +60 -38
  160. package/dist/providers/googleVertexAI.d.ts +3 -3
  161. package/dist/providers/googleVertexAI.js +96 -86
  162. package/dist/providers/huggingFace.d.ts +31 -0
  163. package/dist/providers/huggingFace.js +362 -0
  164. package/dist/providers/index.d.ts +14 -8
  165. package/dist/providers/index.js +18 -12
  166. package/dist/providers/mcp-provider.d.ts +62 -0
  167. package/dist/providers/mcp-provider.js +183 -0
  168. package/dist/providers/mistralAI.d.ts +32 -0
  169. package/dist/providers/mistralAI.js +223 -0
  170. package/dist/providers/ollama.d.ts +51 -0
  171. package/dist/providers/ollama.js +508 -0
  172. package/dist/providers/openAI.d.ts +7 -3
  173. package/dist/providers/openAI.js +45 -33
  174. package/dist/utils/logger.js +2 -2
  175. package/dist/utils/providerUtils.js +59 -22
  176. package/package.json +28 -4
@@ -5,73 +5,119 @@
5
5
  * Enhanced configuration system with interactive setup,
6
6
  * multi-profile support, and smart validation.
7
7
  */
8
- import inquirer from 'inquirer';
9
- import fs from 'fs';
10
- import path from 'path';
11
- import os from 'os';
12
- import chalk from 'chalk';
13
- import { z } from 'zod';
8
+ import inquirer from "inquirer";
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import os from "os";
12
+ import chalk from "chalk";
13
+ import { z } from "zod";
14
14
  // Configuration schema for validation
15
15
  const ConfigSchema = z.object({
16
- defaultProvider: z.enum(['auto', 'openai', 'bedrock', 'vertex', 'anthropic', 'azure', 'google-ai', 'huggingface']).default('auto'),
17
- providers: z.object({
18
- openai: z.object({
16
+ defaultProvider: z
17
+ .enum([
18
+ "auto",
19
+ "openai",
20
+ "bedrock",
21
+ "vertex",
22
+ "anthropic",
23
+ "azure",
24
+ "google-ai",
25
+ "huggingface",
26
+ "ollama",
27
+ "mistral",
28
+ ])
29
+ .default("auto"),
30
+ providers: z
31
+ .object({
32
+ openai: z
33
+ .object({
19
34
  apiKey: z.string().optional(),
20
- model: z.string().default('gpt-4'),
21
- baseURL: z.string().optional()
22
- }).optional(),
23
- bedrock: z.object({
35
+ model: z.string().default("gpt-4"),
36
+ baseURL: z.string().optional(),
37
+ })
38
+ .optional(),
39
+ bedrock: z
40
+ .object({
24
41
  region: z.string().optional(),
25
42
  accessKeyId: z.string().optional(),
26
43
  secretAccessKey: z.string().optional(),
27
44
  sessionToken: z.string().optional(),
28
- model: z.string().default('arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0')
29
- }).optional(),
30
- vertex: z.object({
45
+ model: z
46
+ .string()
47
+ .default("arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0"),
48
+ })
49
+ .optional(),
50
+ vertex: z
51
+ .object({
31
52
  projectId: z.string().optional(),
32
- location: z.string().default('us-east5'),
53
+ location: z.string().default("us-east5"),
33
54
  credentials: z.string().optional(),
34
55
  serviceAccountKey: z.string().optional(),
35
56
  clientEmail: z.string().optional(),
36
57
  privateKey: z.string().optional(),
37
- model: z.string().default('gemini-1.5-pro')
38
- }).optional(),
39
- anthropic: z.object({
58
+ model: z.string().default("gemini-1.5-pro"),
59
+ })
60
+ .optional(),
61
+ anthropic: z
62
+ .object({
40
63
  apiKey: z.string().optional(),
41
- model: z.string().default('claude-3-5-sonnet-20241022')
42
- }).optional(),
43
- azure: z.object({
64
+ model: z.string().default("claude-3-5-sonnet-20241022"),
65
+ })
66
+ .optional(),
67
+ azure: z
68
+ .object({
44
69
  apiKey: z.string().optional(),
45
70
  endpoint: z.string().optional(),
46
71
  deploymentId: z.string().optional(),
47
- model: z.string().default('gpt-4')
48
- }).optional(),
49
- 'google-ai': z.object({
72
+ model: z.string().default("gpt-4"),
73
+ })
74
+ .optional(),
75
+ "google-ai": z
76
+ .object({
50
77
  apiKey: z.string().optional(),
51
- model: z.string().default('gemini-1.5-pro-latest')
52
- }).optional(),
53
- huggingface: z.object({
78
+ model: z.string().default("gemini-1.5-pro-latest"),
79
+ })
80
+ .optional(),
81
+ huggingface: z
82
+ .object({
54
83
  apiKey: z.string().optional(),
55
- model: z.string().default('microsoft/DialoGPT-large')
56
- }).optional()
57
- }).default({}),
84
+ model: z.string().default("microsoft/DialoGPT-large"),
85
+ })
86
+ .optional(),
87
+ ollama: z
88
+ .object({
89
+ baseUrl: z.string().default("http://localhost:11434"),
90
+ model: z.string().default("llama2"),
91
+ timeout: z.number().default(60000),
92
+ })
93
+ .optional(),
94
+ mistral: z
95
+ .object({
96
+ apiKey: z.string().optional(),
97
+ model: z.string().default("mistral-small"),
98
+ })
99
+ .optional(),
100
+ })
101
+ .default({}),
58
102
  profiles: z.record(z.string(), z.any()).default({}),
59
- preferences: z.object({
60
- outputFormat: z.enum(['text', 'json', 'yaml']).default('text'),
103
+ preferences: z
104
+ .object({
105
+ outputFormat: z.enum(["text", "json", "yaml"]).default("text"),
61
106
  temperature: z.number().min(0).max(2).default(0.7),
62
107
  maxTokens: z.number().min(1).max(4000).default(500),
63
108
  enableLogging: z.boolean().default(false),
64
109
  enableCaching: z.boolean().default(true),
65
- cacheStrategy: z.enum(['memory', 'file', 'redis']).default('memory')
66
- }).default({})
110
+ cacheStrategy: z.enum(["memory", "file", "redis"]).default("memory"),
111
+ })
112
+ .default({}),
67
113
  });
68
114
  export class ConfigManager {
69
115
  configDir;
70
116
  configFile;
71
117
  config;
72
118
  constructor() {
73
- this.configDir = path.join(os.homedir(), '.neurolink');
74
- this.configFile = path.join(this.configDir, 'config.json');
119
+ this.configDir = path.join(os.homedir(), ".neurolink");
120
+ this.configFile = path.join(this.configDir, "config.json");
75
121
  this.config = this.loadConfig();
76
122
  }
77
123
  /**
@@ -80,12 +126,12 @@ export class ConfigManager {
80
126
  loadConfig() {
81
127
  try {
82
128
  if (fs.existsSync(this.configFile)) {
83
- const configData = JSON.parse(fs.readFileSync(this.configFile, 'utf8'));
129
+ const configData = JSON.parse(fs.readFileSync(this.configFile, "utf8"));
84
130
  return ConfigSchema.parse(configData);
85
131
  }
86
132
  }
87
133
  catch (error) {
88
- console.warn(chalk.yellow(`⚠️ Invalid config file: ${error instanceof Error ? error.message : 'Unknown error'}`));
134
+ console.warn(chalk.yellow(`⚠️ Invalid config file: ${error instanceof Error ? error.message : "Unknown error"}`));
89
135
  }
90
136
  return ConfigSchema.parse({});
91
137
  }
@@ -104,7 +150,7 @@ export class ConfigManager {
104
150
  console.log(chalk.green(`✅ Configuration saved to ${this.configFile}`));
105
151
  }
106
152
  catch (error) {
107
- console.error(chalk.red(`❌ Failed to save config: ${error instanceof Error ? error.message : 'Unknown error'}`));
153
+ console.error(chalk.red(`❌ Failed to save config: ${error instanceof Error ? error.message : "Unknown error"}`));
108
154
  process.exit(1);
109
155
  }
110
156
  }
@@ -112,46 +158,56 @@ export class ConfigManager {
112
158
  * Interactive configuration setup
113
159
  */
114
160
  async initInteractive() {
115
- console.log(chalk.blue('🧠 NeuroLink Configuration Setup\n'));
161
+ console.log(chalk.blue("🧠 NeuroLink Configuration Setup\n"));
116
162
  try {
117
163
  // Basic preferences
118
164
  const preferences = await inquirer.prompt([
119
165
  {
120
- type: 'list',
121
- name: 'defaultProvider',
122
- message: 'Select your default AI provider:',
166
+ type: "list",
167
+ name: "defaultProvider",
168
+ message: "Select your default AI provider:",
123
169
  choices: [
124
- { name: 'Auto (recommended) - Automatically select best available', value: 'auto' },
125
- { name: 'OpenAI - GPT models', value: 'openai' },
126
- { name: 'Amazon Bedrock - Claude, Llama, Titan', value: 'bedrock' },
127
- { name: 'Google Vertex AI - Gemini models', value: 'vertex' },
128
- { name: 'Anthropic - Claude models (direct)', value: 'anthropic' },
129
- { name: 'Azure OpenAI - Enterprise GPT', value: 'azure' },
130
- { name: 'Google AI Studio - Gemini models (direct)', value: 'google-ai' },
131
- { name: 'Hugging Face - Open source models', value: 'huggingface' }
170
+ {
171
+ name: "Auto (recommended) - Automatically select best available",
172
+ value: "auto",
173
+ },
174
+ { name: "OpenAI - GPT models", value: "openai" },
175
+ { name: "Amazon Bedrock - Claude, Llama, Titan", value: "bedrock" },
176
+ { name: "Google Vertex AI - Gemini models", value: "vertex" },
177
+ { name: "Anthropic - Claude models (direct)", value: "anthropic" },
178
+ { name: "Azure OpenAI - Enterprise GPT", value: "azure" },
179
+ {
180
+ name: "Google AI Studio - Gemini models (direct)",
181
+ value: "google-ai",
182
+ },
183
+ { name: "Hugging Face - Open source models", value: "huggingface" },
184
+ {
185
+ name: "Mistral AI - European AI with competitive pricing",
186
+ value: "mistral",
187
+ },
132
188
  ],
133
- default: this.config.defaultProvider
189
+ default: this.config.defaultProvider,
134
190
  },
135
191
  {
136
- type: 'list',
137
- name: 'outputFormat',
138
- message: 'Preferred output format:',
139
- choices: ['text', 'json', 'yaml'],
140
- default: this.config.preferences.outputFormat
192
+ type: "list",
193
+ name: "outputFormat",
194
+ message: "Preferred output format:",
195
+ choices: ["text", "json", "yaml"],
196
+ default: this.config.preferences.outputFormat,
141
197
  },
142
198
  {
143
- type: 'number',
144
- name: 'temperature',
145
- message: 'Default creativity level (0.0 = focused, 1.0 = creative):',
199
+ type: "number",
200
+ name: "temperature",
201
+ message: "Default creativity level (0.0 = focused, 1.0 = creative):",
146
202
  default: this.config.preferences.temperature,
147
- validate: (value) => value >= 0 && value <= 2
203
+ validate: (value) => value >= 0 && value <= 2,
148
204
  },
149
205
  {
150
- type: 'confirm',
151
- name: 'setupProviders',
152
- message: 'Would you like to configure provider credentials now?',
153
- default: true
154
- }
206
+ type: "confirm",
207
+ name: "setupProviders",
208
+ message: "Would you like to configure provider credentials now?",
209
+ default: true,
210
+ },
155
211
  ]);
156
212
  // Update config with preferences
157
213
  this.config.defaultProvider = preferences.defaultProvider;
@@ -162,13 +218,14 @@ export class ConfigManager {
162
218
  await this.setupProviders();
163
219
  }
164
220
  this.saveConfig();
165
- console.log(chalk.green('\n✅ Configuration setup complete!'));
166
- console.log(chalk.blue('💡 You can modify settings anytime with: neurolink config edit'));
167
- console.log(chalk.blue('💡 Test your setup with: neurolink status'));
221
+ console.log(chalk.green("\n✅ Configuration setup complete!"));
222
+ console.log(chalk.blue("💡 You can modify settings anytime with: neurolink config edit"));
223
+ console.log(chalk.blue("💡 Test your setup with: neurolink status"));
168
224
  }
169
225
  catch (error) {
170
- if (error instanceof Error && error.message === 'User force closed the prompt with 0 null') {
171
- console.log(chalk.yellow('\n⚠️ Setup cancelled by user'));
226
+ if (error instanceof Error &&
227
+ error.message === "User force closed the prompt with 0 null") {
228
+ console.log(chalk.yellow("\n⚠️ Setup cancelled by user"));
172
229
  process.exit(0);
173
230
  }
174
231
  throw error;
@@ -180,19 +237,21 @@ export class ConfigManager {
180
237
  async setupProviders() {
181
238
  const { selectedProviders } = await inquirer.prompt([
182
239
  {
183
- type: 'checkbox',
184
- name: 'selectedProviders',
185
- message: 'Select providers to configure:',
240
+ type: "checkbox",
241
+ name: "selectedProviders",
242
+ message: "Select providers to configure:",
186
243
  choices: [
187
- { name: 'OpenAI (GPT-4, GPT-3.5)', value: 'openai' },
188
- { name: 'Amazon Bedrock (Claude, Llama)', value: 'bedrock' },
189
- { name: 'Google Vertex AI (Gemini)', value: 'vertex' },
190
- { name: 'Anthropic Direct (Claude)', value: 'anthropic' },
191
- { name: 'Azure OpenAI (Enterprise)', value: 'azure' },
192
- { name: 'Google AI Studio (Gemini Direct)', value: 'google-ai' },
193
- { name: 'Hugging Face (Open Source)', value: 'huggingface' }
194
- ]
195
- }
244
+ { name: "OpenAI (GPT-4, GPT-3.5)", value: "openai" },
245
+ { name: "Amazon Bedrock (Claude, Llama)", value: "bedrock" },
246
+ { name: "Google Vertex AI (Gemini)", value: "vertex" },
247
+ { name: "Anthropic Direct (Claude)", value: "anthropic" },
248
+ { name: "Azure OpenAI (Enterprise)", value: "azure" },
249
+ { name: "Google AI Studio (Gemini Direct)", value: "google-ai" },
250
+ { name: "Hugging Face (Open Source)", value: "huggingface" },
251
+ { name: "Ollama (Local AI Models)", value: "ollama" },
252
+ { name: "Mistral AI (European AI)", value: "mistral" },
253
+ ],
254
+ },
196
255
  ]);
197
256
  for (const provider of selectedProviders) {
198
257
  await this.setupProvider(provider);
@@ -204,27 +263,33 @@ export class ConfigManager {
204
263
  async setupProvider(provider) {
205
264
  console.log(chalk.blue(`\n🔧 Configuring ${provider.toUpperCase()}`));
206
265
  switch (provider) {
207
- case 'openai':
266
+ case "openai":
208
267
  await this.setupOpenAI();
209
268
  break;
210
- case 'bedrock':
269
+ case "bedrock":
211
270
  await this.setupBedrock();
212
271
  break;
213
- case 'vertex':
272
+ case "vertex":
214
273
  await this.setupVertex();
215
274
  break;
216
- case 'anthropic':
275
+ case "anthropic":
217
276
  await this.setupAnthropic();
218
277
  break;
219
- case 'azure':
278
+ case "azure":
220
279
  await this.setupAzure();
221
280
  break;
222
- case 'google-ai':
281
+ case "google-ai":
223
282
  await this.setupGoogleAI();
224
283
  break;
225
- case 'huggingface':
284
+ case "huggingface":
226
285
  await this.setupHuggingFace();
227
286
  break;
287
+ case "ollama":
288
+ await this.setupOllama();
289
+ break;
290
+ case "mistral":
291
+ await this.setupMistral();
292
+ break;
228
293
  }
229
294
  }
230
295
  /**
@@ -233,29 +298,29 @@ export class ConfigManager {
233
298
  async setupOpenAI() {
234
299
  const answers = await inquirer.prompt([
235
300
  {
236
- type: 'password',
237
- name: 'apiKey',
238
- message: 'OpenAI API Key (sk-...):',
239
- validate: (value) => value.startsWith('sk-') || 'API key should start with "sk-"'
301
+ type: "password",
302
+ name: "apiKey",
303
+ message: "OpenAI API Key (sk-...):",
304
+ validate: (value) => value.startsWith("sk-") || 'API key should start with "sk-"',
240
305
  },
241
306
  {
242
- type: 'list',
243
- name: 'model',
244
- message: 'Default model:',
245
- choices: ['gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo'],
246
- default: 'gpt-4'
307
+ type: "list",
308
+ name: "model",
309
+ message: "Default model:",
310
+ choices: ["gpt-4", "gpt-4-turbo", "gpt-3.5-turbo"],
311
+ default: "gpt-4",
247
312
  },
248
313
  {
249
- type: 'input',
250
- name: 'baseURL',
251
- message: 'Custom base URL (optional):',
252
- default: ''
253
- }
314
+ type: "input",
315
+ name: "baseURL",
316
+ message: "Custom base URL (optional):",
317
+ default: "",
318
+ },
254
319
  ]);
255
320
  this.config.providers.openai = {
256
321
  apiKey: answers.apiKey,
257
322
  model: answers.model,
258
- ...(answers.baseURL && { baseURL: answers.baseURL })
323
+ ...(answers.baseURL && { baseURL: answers.baseURL }),
259
324
  };
260
325
  }
261
326
  /**
@@ -264,39 +329,41 @@ export class ConfigManager {
264
329
  async setupBedrock() {
265
330
  const answers = await inquirer.prompt([
266
331
  {
267
- type: 'input',
268
- name: 'region',
269
- message: 'AWS Region:',
270
- default: 'us-east-1'
332
+ type: "input",
333
+ name: "region",
334
+ message: "AWS Region:",
335
+ default: "us-east-1",
271
336
  },
272
337
  {
273
- type: 'input',
274
- name: 'accessKeyId',
275
- message: 'AWS Access Key ID (optional if using IAM roles):'
338
+ type: "input",
339
+ name: "accessKeyId",
340
+ message: "AWS Access Key ID (optional if using IAM roles):",
276
341
  },
277
342
  {
278
- type: 'password',
279
- name: 'secretAccessKey',
280
- message: 'AWS Secret Access Key (optional if using IAM roles):'
343
+ type: "password",
344
+ name: "secretAccessKey",
345
+ message: "AWS Secret Access Key (optional if using IAM roles):",
281
346
  },
282
347
  {
283
- type: 'password',
284
- name: 'sessionToken',
285
- message: 'AWS Session Token (optional):'
348
+ type: "password",
349
+ name: "sessionToken",
350
+ message: "AWS Session Token (optional):",
286
351
  },
287
352
  {
288
- type: 'input',
289
- name: 'model',
290
- message: 'Model ARN:',
291
- default: 'arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0'
292
- }
353
+ type: "input",
354
+ name: "model",
355
+ message: "Model ARN:",
356
+ default: "arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0",
357
+ },
293
358
  ]);
294
359
  this.config.providers.bedrock = {
295
360
  region: answers.region,
296
361
  ...(answers.accessKeyId && { accessKeyId: answers.accessKeyId }),
297
- ...(answers.secretAccessKey && { secretAccessKey: answers.secretAccessKey }),
362
+ ...(answers.secretAccessKey && {
363
+ secretAccessKey: answers.secretAccessKey,
364
+ }),
298
365
  ...(answers.sessionToken && { sessionToken: answers.sessionToken }),
299
- model: answers.model
366
+ model: answers.model,
300
367
  };
301
368
  }
302
369
  /**
@@ -305,94 +372,97 @@ export class ConfigManager {
305
372
  async setupVertex() {
306
373
  const { authMethod } = await inquirer.prompt([
307
374
  {
308
- type: 'list',
309
- name: 'authMethod',
310
- message: 'Authentication method:',
375
+ type: "list",
376
+ name: "authMethod",
377
+ message: "Authentication method:",
311
378
  choices: [
312
- { name: 'Service Account File', value: 'file' },
313
- { name: 'Service Account JSON String', value: 'json' },
314
- { name: 'Individual Environment Variables', value: 'env' }
315
- ]
316
- }
379
+ { name: "Service Account File", value: "file" },
380
+ { name: "Service Account JSON String", value: "json" },
381
+ { name: "Individual Environment Variables", value: "env" },
382
+ ],
383
+ },
317
384
  ]);
318
385
  const commonAnswers = await inquirer.prompt([
319
386
  {
320
- type: 'input',
321
- name: 'projectId',
322
- message: 'Google Cloud Project ID:',
323
- validate: (value) => value.length > 0 || 'Project ID is required'
387
+ type: "input",
388
+ name: "projectId",
389
+ message: "Google Cloud Project ID:",
390
+ validate: (value) => value.length > 0 || "Project ID is required",
324
391
  },
325
392
  {
326
- type: 'input',
327
- name: 'location',
328
- message: 'Vertex AI Location:',
329
- default: 'us-east5'
393
+ type: "input",
394
+ name: "location",
395
+ message: "Vertex AI Location:",
396
+ default: "us-east5",
330
397
  },
331
398
  {
332
- type: 'list',
333
- name: 'model',
334
- message: 'Default model:',
335
- choices: ['gemini-1.5-pro', 'gemini-1.5-flash', 'gemini-pro'],
336
- default: 'gemini-1.5-pro'
337
- }
399
+ type: "list",
400
+ name: "model",
401
+ message: "Default model:",
402
+ choices: ["gemini-1.5-pro", "gemini-1.5-flash", "gemini-pro"],
403
+ default: "gemini-1.5-pro",
404
+ },
338
405
  ]);
339
406
  let authConfig = {};
340
407
  switch (authMethod) {
341
- case 'file':
408
+ case "file": {
342
409
  const fileAnswers = await inquirer.prompt([
343
410
  {
344
- type: 'input',
345
- name: 'credentials',
346
- message: 'Path to service account JSON file:',
347
- validate: (value) => fs.existsSync(value) || 'File does not exist'
348
- }
411
+ type: "input",
412
+ name: "credentials",
413
+ message: "Path to service account JSON file:",
414
+ validate: (value) => fs.existsSync(value) || "File does not exist",
415
+ },
349
416
  ]);
350
417
  authConfig = { credentials: fileAnswers.credentials };
351
418
  break;
352
- case 'json':
419
+ }
420
+ case "json": {
353
421
  const jsonAnswers = await inquirer.prompt([
354
422
  {
355
- type: 'input',
356
- name: 'serviceAccountKey',
357
- message: 'Service account JSON string:',
423
+ type: "input",
424
+ name: "serviceAccountKey",
425
+ message: "Service account JSON string:",
358
426
  validate: (value) => {
359
427
  try {
360
428
  JSON.parse(value);
361
429
  return true;
362
430
  }
363
431
  catch {
364
- return 'Invalid JSON';
432
+ return "Invalid JSON";
365
433
  }
366
- }
367
- }
434
+ },
435
+ },
368
436
  ]);
369
437
  authConfig = { serviceAccountKey: jsonAnswers.serviceAccountKey };
370
438
  break;
371
- case 'env':
439
+ }
440
+ case "env": {
372
441
  const envAnswers = await inquirer.prompt([
373
442
  {
374
- type: 'input',
375
- name: 'clientEmail',
376
- message: 'Service account email:',
377
- validate: (value) => value.includes('@') || 'Invalid email format'
443
+ type: "input",
444
+ name: "clientEmail",
445
+ message: "Service account email:",
446
+ validate: (value) => value.includes("@") || "Invalid email format",
378
447
  },
379
448
  {
380
- type: 'password',
381
- name: 'privateKey',
382
- message: 'Private key:'
383
- }
449
+ type: "password",
450
+ name: "privateKey",
451
+ message: "Private key:",
452
+ },
384
453
  ]);
385
454
  authConfig = {
386
455
  clientEmail: envAnswers.clientEmail,
387
- privateKey: envAnswers.privateKey
456
+ privateKey: envAnswers.privateKey,
388
457
  };
389
458
  break;
459
+ }
390
460
  }
391
461
  this.config.providers.vertex = {
392
462
  projectId: commonAnswers.projectId,
393
463
  location: commonAnswers.location,
394
464
  model: commonAnswers.model,
395
- ...authConfig
465
+ ...authConfig,
396
466
  };
397
467
  }
398
468
  /**
@@ -401,22 +471,22 @@ export class ConfigManager {
401
471
  async setupAnthropic() {
402
472
  const answers = await inquirer.prompt([
403
473
  {
404
- type: 'password',
405
- name: 'apiKey',
406
- message: 'Anthropic API Key:',
407
- validate: (value) => value.length > 0 || 'API key is required'
474
+ type: "password",
475
+ name: "apiKey",
476
+ message: "Anthropic API Key:",
477
+ validate: (value) => value.length > 0 || "API key is required",
408
478
  },
409
479
  {
410
- type: 'list',
411
- name: 'model',
412
- message: 'Default model:',
480
+ type: "list",
481
+ name: "model",
482
+ message: "Default model:",
413
483
  choices: [
414
- 'claude-3-5-sonnet-20241022',
415
- 'claude-3-5-haiku-20241022',
416
- 'claude-3-opus-20240229'
484
+ "claude-3-5-sonnet-20241022",
485
+ "claude-3-5-haiku-20241022",
486
+ "claude-3-opus-20240229",
417
487
  ],
418
- default: 'claude-3-5-sonnet-20241022'
419
- }
488
+ default: "claude-3-5-sonnet-20241022",
489
+ },
420
490
  ]);
421
491
  this.config.providers.anthropic = answers;
422
492
  }
@@ -426,28 +496,28 @@ export class ConfigManager {
426
496
  async setupAzure() {
427
497
  const answers = await inquirer.prompt([
428
498
  {
429
- type: 'password',
430
- name: 'apiKey',
431
- message: 'Azure OpenAI API Key:'
499
+ type: "password",
500
+ name: "apiKey",
501
+ message: "Azure OpenAI API Key:",
432
502
  },
433
503
  {
434
- type: 'input',
435
- name: 'endpoint',
436
- message: 'Azure OpenAI Endpoint:',
437
- validate: (value) => value.startsWith('https://') || 'Endpoint should start with https://'
504
+ type: "input",
505
+ name: "endpoint",
506
+ message: "Azure OpenAI Endpoint:",
507
+ validate: (value) => value.startsWith("https://") || "Endpoint should start with https://",
438
508
  },
439
509
  {
440
- type: 'input',
441
- name: 'deploymentId',
442
- message: 'Deployment ID:'
510
+ type: "input",
511
+ name: "deploymentId",
512
+ message: "Deployment ID:",
443
513
  },
444
514
  {
445
- type: 'list',
446
- name: 'model',
447
- message: 'Model:',
448
- choices: ['gpt-4', 'gpt-4-turbo', 'gpt-35-turbo'],
449
- default: 'gpt-4'
450
- }
515
+ type: "list",
516
+ name: "model",
517
+ message: "Model:",
518
+ choices: ["gpt-4", "gpt-4-turbo", "gpt-35-turbo"],
519
+ default: "gpt-4",
520
+ },
451
521
  ]);
452
522
  this.config.providers.azure = answers;
453
523
  }
@@ -457,25 +527,25 @@ export class ConfigManager {
457
527
  async setupGoogleAI() {
458
528
  const answers = await inquirer.prompt([
459
529
  {
460
- type: 'password',
461
- name: 'apiKey',
462
- message: 'Google AI API Key:',
463
- validate: (value) => value.length > 0 || 'API key is required'
530
+ type: "password",
531
+ name: "apiKey",
532
+ message: "Google AI API Key:",
533
+ validate: (value) => value.length > 0 || "API key is required",
464
534
  },
465
535
  {
466
- type: 'list',
467
- name: 'model',
468
- message: 'Default model:',
536
+ type: "list",
537
+ name: "model",
538
+ message: "Default model:",
469
539
  choices: [
470
- 'gemini-1.5-pro-latest',
471
- 'gemini-2.0-flash-exp',
472
- 'gemini-1.5-flash-latest',
473
- 'gemini-1.0-pro'
540
+ "gemini-1.5-pro-latest",
541
+ "gemini-2.0-flash-exp",
542
+ "gemini-1.5-flash-latest",
543
+ "gemini-1.0-pro",
474
544
  ],
475
- default: 'gemini-1.5-pro-latest'
476
- }
545
+ default: "gemini-1.5-pro-latest",
546
+ },
477
547
  ]);
478
- this.config.providers['google-ai'] = answers;
548
+ this.config.providers["google-ai"] = answers;
479
549
  }
480
550
  /**
481
551
  * Hugging Face provider setup
@@ -483,19 +553,74 @@ export class ConfigManager {
483
553
  async setupHuggingFace() {
484
554
  const answers = await inquirer.prompt([
485
555
  {
486
- type: 'password',
487
- name: 'apiKey',
488
- message: 'Hugging Face API Key:'
556
+ type: "password",
557
+ name: "apiKey",
558
+ message: "Hugging Face API Key:",
489
559
  },
490
560
  {
491
- type: 'input',
492
- name: 'model',
493
- message: 'Model name:',
494
- default: 'microsoft/DialoGPT-large'
495
- }
561
+ type: "input",
562
+ name: "model",
563
+ message: "Model name:",
564
+ default: "microsoft/DialoGPT-large",
565
+ },
496
566
  ]);
497
567
  this.config.providers.huggingface = answers;
498
568
  }
569
+ /**
570
+ * Ollama provider setup
571
+ */
572
+ async setupOllama() {
573
+ const answers = await inquirer.prompt([
574
+ {
575
+ type: "input",
576
+ name: "baseUrl",
577
+ message: "Ollama base URL:",
578
+ default: "http://localhost:11434",
579
+ validate: (value) => value.startsWith("http") ||
580
+ "URL should start with http:// or https://",
581
+ },
582
+ {
583
+ type: "input",
584
+ name: "model",
585
+ message: "Default model:",
586
+ default: "llama2",
587
+ },
588
+ {
589
+ type: "number",
590
+ name: "timeout",
591
+ message: "Request timeout (milliseconds):",
592
+ default: 60000,
593
+ validate: (value) => value > 0 || "Timeout must be positive",
594
+ },
595
+ ]);
596
+ this.config.providers.ollama = answers;
597
+ }
598
+ /**
599
+ * Mistral AI provider setup
600
+ */
601
+ async setupMistral() {
602
+ const answers = await inquirer.prompt([
603
+ {
604
+ type: "password",
605
+ name: "apiKey",
606
+ message: "Mistral AI API Key:",
607
+ validate: (value) => value.length > 0 || "API key is required",
608
+ },
609
+ {
610
+ type: "list",
611
+ name: "model",
612
+ message: "Default model:",
613
+ choices: [
614
+ "mistral-small",
615
+ "mistral-medium",
616
+ "mistral-large",
617
+ "mistral-tiny",
618
+ ],
619
+ default: "mistral-small",
620
+ },
621
+ ]);
622
+ this.config.providers.mistral = answers;
623
+ }
499
624
  /**
500
625
  * Get current configuration
501
626
  */
@@ -513,22 +638,22 @@ export class ConfigManager {
513
638
  * Show current configuration
514
639
  */
515
640
  showConfig() {
516
- console.log(chalk.blue('📋 Current NeuroLink Configuration\n'));
517
- console.log(chalk.cyan('General Settings:'));
641
+ console.log(chalk.blue("📋 Current NeuroLink Configuration\n"));
642
+ console.log(chalk.cyan("General Settings:"));
518
643
  console.log(` Default Provider: ${chalk.white(this.config.defaultProvider)}`);
519
644
  console.log(` Output Format: ${chalk.white(this.config.preferences.outputFormat)}`);
520
645
  console.log(` Temperature: ${chalk.white(this.config.preferences.temperature)}`);
521
646
  console.log(` Max Tokens: ${chalk.white(this.config.preferences.maxTokens)}`);
522
- console.log(chalk.cyan('\nConfigured Providers:'));
647
+ console.log(chalk.cyan("\nConfigured Providers:"));
523
648
  Object.entries(this.config.providers).forEach(([name, config]) => {
524
649
  if (config && Object.keys(config).length > 0) {
525
- console.log(` ${chalk.green('')} ${name.toUpperCase()}`);
526
- if ('model' in config) {
650
+ console.log(` ${chalk.green("")} ${name.toUpperCase()}`);
651
+ if ("model" in config) {
527
652
  console.log(` Model: ${chalk.white(config.model)}`);
528
653
  }
529
654
  }
530
655
  });
531
- console.log(chalk.cyan('\nConfiguration File:'));
656
+ console.log(chalk.cyan("\nConfiguration File:"));
532
657
  console.log(` Location: ${chalk.white(this.configFile)}`);
533
658
  }
534
659
  /**
@@ -541,17 +666,17 @@ export class ConfigManager {
541
666
  }
542
667
  catch (error) {
543
668
  if (error instanceof z.ZodError) {
544
- errors.push(...error.errors.map(e => `${e.path.join('.')}: ${e.message}`));
669
+ errors.push(...error.errors.map((e) => `${e.path.join(".")}: ${e.message}`));
545
670
  }
546
671
  }
547
672
  // Check for at least one configured provider
548
- const hasProvider = Object.values(this.config.providers).some(provider => provider && Object.keys(provider).length > 0);
673
+ const hasProvider = Object.values(this.config.providers).some((provider) => provider && Object.keys(provider).length > 0);
549
674
  if (!hasProvider) {
550
675
  errors.push('No providers configured. Run "neurolink config init" to set up providers.');
551
676
  }
552
677
  return {
553
678
  valid: errors.length === 0,
554
- errors
679
+ errors,
555
680
  };
556
681
  }
557
682
  /**
@@ -560,7 +685,7 @@ export class ConfigManager {
560
685
  resetConfig() {
561
686
  this.config = ConfigSchema.parse({});
562
687
  this.saveConfig();
563
- console.log(chalk.green('✅ Configuration reset to defaults'));
688
+ console.log(chalk.green("✅ Configuration reset to defaults"));
564
689
  }
565
690
  }
566
691
  // Export for use in other CLI commands