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