@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.
- package/CHANGELOG.md +241 -1
- package/README.md +113 -20
- 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 +76 -9
- package/dist/cli/commands/config.js +358 -233
- package/dist/cli/commands/mcp.d.ts +2 -1
- package/dist/cli/commands/mcp.js +874 -146
- package/dist/cli/commands/ollama.d.ts +8 -0
- package/dist/cli/commands/ollama.js +333 -0
- package/dist/cli/index.js +591 -327
- 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 +180 -50
- package/dist/core/types.d.ts +8 -3
- package/dist/core/types.js +7 -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 +180 -50
- package/dist/lib/core/types.d.ts +8 -3
- package/dist/lib/core/types.js +7 -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 +205 -66
- package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +143 -99
- 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 +404 -251
- 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 +314 -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 +31 -0
- package/dist/lib/providers/huggingFace.js +362 -0
- package/dist/lib/providers/index.d.ts +14 -8
- package/dist/lib/providers/index.js +18 -12
- 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 +32 -0
- package/dist/lib/providers/mistralAI.js +223 -0
- package/dist/lib/providers/ollama.d.ts +51 -0
- package/dist/lib/providers/ollama.js +508 -0
- 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 +59 -22
- 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 +205 -66
- package/dist/mcp/servers/ai-providers/ai-core-server.js +143 -99
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +404 -253
- 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 +314 -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 +31 -0
- package/dist/providers/huggingFace.js +362 -0
- package/dist/providers/index.d.ts +14 -8
- package/dist/providers/index.js +18 -12
- package/dist/providers/mcp-provider.d.ts +62 -0
- package/dist/providers/mcp-provider.js +183 -0
- package/dist/providers/mistralAI.d.ts +32 -0
- package/dist/providers/mistralAI.js +223 -0
- package/dist/providers/ollama.d.ts +51 -0
- package/dist/providers/ollama.js +508 -0
- 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 +59 -22
- package/package.json +28 -4
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive Setup Utilities for NeuroLink CLI
|
|
3
|
+
*
|
|
4
|
+
* Provides interactive configuration wizard with provider selection,
|
|
5
|
+
* credential collection, testing, and environment file management.
|
|
6
|
+
*/
|
|
7
|
+
import { AIProviderName } from "../../lib/core/types.js";
|
|
8
|
+
import { NeuroLink } from "../../lib/neurolink.js";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import ora from "ora";
|
|
11
|
+
export const PROVIDER_CONFIGS = [
|
|
12
|
+
{
|
|
13
|
+
id: AIProviderName.OPENAI,
|
|
14
|
+
name: "OpenAI",
|
|
15
|
+
description: "GPT-4, GPT-3.5, and other OpenAI models",
|
|
16
|
+
envVars: [
|
|
17
|
+
{
|
|
18
|
+
key: "OPENAI_API_KEY",
|
|
19
|
+
prompt: "OpenAI API Key (sk-...)",
|
|
20
|
+
secure: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: AIProviderName.GOOGLE_AI,
|
|
26
|
+
name: "Google AI Studio",
|
|
27
|
+
description: "Gemini models via Google AI Studio",
|
|
28
|
+
envVars: [
|
|
29
|
+
{
|
|
30
|
+
key: "GOOGLE_AI_API_KEY",
|
|
31
|
+
prompt: "Google AI Studio API Key (AIza-...)",
|
|
32
|
+
secure: true,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: AIProviderName.ANTHROPIC,
|
|
38
|
+
name: "Anthropic",
|
|
39
|
+
description: "Claude models via Anthropic API",
|
|
40
|
+
envVars: [
|
|
41
|
+
{
|
|
42
|
+
key: "ANTHROPIC_API_KEY",
|
|
43
|
+
prompt: "Anthropic API Key (sk-ant-...)",
|
|
44
|
+
secure: true,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: AIProviderName.BEDROCK,
|
|
50
|
+
name: "AWS Bedrock",
|
|
51
|
+
description: "Claude, Llama, and other models via AWS Bedrock",
|
|
52
|
+
envVars: [
|
|
53
|
+
{ key: "AWS_ACCESS_KEY_ID", prompt: "AWS Access Key ID", secure: false },
|
|
54
|
+
{
|
|
55
|
+
key: "AWS_SECRET_ACCESS_KEY",
|
|
56
|
+
prompt: "AWS Secret Access Key",
|
|
57
|
+
secure: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: "AWS_REGION",
|
|
61
|
+
prompt: "AWS Region",
|
|
62
|
+
default: "us-east-1",
|
|
63
|
+
secure: false,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: AIProviderName.VERTEX,
|
|
69
|
+
name: "Google Vertex AI",
|
|
70
|
+
description: "Gemini models via Google Cloud Vertex AI",
|
|
71
|
+
envVars: [
|
|
72
|
+
{
|
|
73
|
+
key: "GOOGLE_APPLICATION_CREDENTIALS",
|
|
74
|
+
prompt: "Path to Service Account JSON file",
|
|
75
|
+
secure: false,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "GOOGLE_VERTEX_PROJECT",
|
|
79
|
+
prompt: "Google Cloud Project ID",
|
|
80
|
+
secure: false,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: AIProviderName.AZURE,
|
|
86
|
+
name: "Azure OpenAI",
|
|
87
|
+
description: "GPT models via Azure OpenAI Service",
|
|
88
|
+
envVars: [
|
|
89
|
+
{
|
|
90
|
+
key: "AZURE_OPENAI_API_KEY",
|
|
91
|
+
prompt: "Azure OpenAI API Key",
|
|
92
|
+
secure: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "AZURE_OPENAI_ENDPOINT",
|
|
96
|
+
prompt: "Azure OpenAI Endpoint URL",
|
|
97
|
+
secure: false,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: AIProviderName.HUGGINGFACE,
|
|
103
|
+
name: "Hugging Face",
|
|
104
|
+
description: "100,000+ open source models",
|
|
105
|
+
envVars: [
|
|
106
|
+
{
|
|
107
|
+
key: "HUGGINGFACE_API_KEY",
|
|
108
|
+
prompt: "Hugging Face API Token (hf_...)",
|
|
109
|
+
secure: true,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: AIProviderName.OLLAMA,
|
|
115
|
+
name: "Ollama",
|
|
116
|
+
description: "Local AI models running on your machine",
|
|
117
|
+
envVars: [
|
|
118
|
+
{
|
|
119
|
+
key: "OLLAMA_BASE_URL",
|
|
120
|
+
prompt: "Ollama Server URL",
|
|
121
|
+
default: "http://localhost:11434",
|
|
122
|
+
secure: false,
|
|
123
|
+
optional: true,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: AIProviderName.MISTRAL,
|
|
129
|
+
name: "Mistral AI",
|
|
130
|
+
description: "European GDPR-compliant AI models",
|
|
131
|
+
envVars: [
|
|
132
|
+
{ key: "MISTRAL_API_KEY", prompt: "Mistral AI API Key", secure: true },
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
/**
|
|
137
|
+
* Run the interactive setup wizard
|
|
138
|
+
*/
|
|
139
|
+
export async function runInteractiveSetup(quiet = false) {
|
|
140
|
+
// Dynamic import to avoid bundling inquirer in SDK
|
|
141
|
+
const { default: inquirer } = await import("inquirer");
|
|
142
|
+
const result = {
|
|
143
|
+
selectedProviders: [],
|
|
144
|
+
credentials: {},
|
|
145
|
+
testResults: [],
|
|
146
|
+
};
|
|
147
|
+
if (!quiet) {
|
|
148
|
+
console.log(chalk.blue("\n🎉 Welcome to NeuroLink Interactive Setup!"));
|
|
149
|
+
console.log(chalk.gray("This wizard will help you configure AI providers for NeuroLink.\n"));
|
|
150
|
+
}
|
|
151
|
+
// Step 1: Provider Selection
|
|
152
|
+
const providerChoices = PROVIDER_CONFIGS.map((config) => ({
|
|
153
|
+
name: `${config.name} - ${config.description}`,
|
|
154
|
+
value: config.id,
|
|
155
|
+
checked: false,
|
|
156
|
+
}));
|
|
157
|
+
const { selectedProviders } = await inquirer.prompt([
|
|
158
|
+
{
|
|
159
|
+
type: "checkbox",
|
|
160
|
+
name: "selectedProviders",
|
|
161
|
+
message: "Which AI providers would you like to configure?",
|
|
162
|
+
choices: providerChoices,
|
|
163
|
+
validate: (answers) => {
|
|
164
|
+
if (answers.length === 0) {
|
|
165
|
+
return "Please select at least one provider.";
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
]);
|
|
171
|
+
result.selectedProviders = selectedProviders;
|
|
172
|
+
// Step 2: Credential Collection
|
|
173
|
+
if (!quiet) {
|
|
174
|
+
console.log(chalk.blue("\n🔑 Collecting credentials for selected providers...\n"));
|
|
175
|
+
}
|
|
176
|
+
for (const providerId of selectedProviders) {
|
|
177
|
+
const config = PROVIDER_CONFIGS.find((c) => c.id === providerId);
|
|
178
|
+
if (!config) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (!quiet) {
|
|
182
|
+
console.log(chalk.yellow(`\n📋 Configuring ${config.name}:`));
|
|
183
|
+
}
|
|
184
|
+
for (const envVar of config.envVars) {
|
|
185
|
+
const currentValue = process.env[envVar.key];
|
|
186
|
+
const hasCurrentValue = !!currentValue;
|
|
187
|
+
let promptMessage = envVar.prompt;
|
|
188
|
+
if (hasCurrentValue) {
|
|
189
|
+
promptMessage += chalk.gray(` (current: ${envVar.secure ? "***" : currentValue})`);
|
|
190
|
+
}
|
|
191
|
+
if (envVar.default) {
|
|
192
|
+
promptMessage += chalk.gray(` (default: ${envVar.default})`);
|
|
193
|
+
}
|
|
194
|
+
const { value } = await inquirer.prompt([
|
|
195
|
+
{
|
|
196
|
+
type: envVar.secure ? "password" : "input",
|
|
197
|
+
name: "value",
|
|
198
|
+
message: promptMessage,
|
|
199
|
+
default: envVar.default,
|
|
200
|
+
validate: (input) => {
|
|
201
|
+
if (!envVar.optional && !input && !hasCurrentValue) {
|
|
202
|
+
return `${envVar.key} is required.`;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
},
|
|
206
|
+
when: () => {
|
|
207
|
+
if (hasCurrentValue && !envVar.optional) {
|
|
208
|
+
// Ask if they want to update existing value
|
|
209
|
+
return inquirer
|
|
210
|
+
.prompt([
|
|
211
|
+
{
|
|
212
|
+
type: "confirm",
|
|
213
|
+
name: "update",
|
|
214
|
+
message: `Update existing ${envVar.key}?`,
|
|
215
|
+
default: false,
|
|
216
|
+
},
|
|
217
|
+
])
|
|
218
|
+
.then((answer) => answer.update);
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
]);
|
|
224
|
+
if (value || envVar.default) {
|
|
225
|
+
result.credentials[envVar.key] = value || envVar.default || "";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Test provider connectivity using existing logic
|
|
233
|
+
*/
|
|
234
|
+
export async function testProviderConnectivity(providers, quiet = false) {
|
|
235
|
+
const sdk = new NeuroLink();
|
|
236
|
+
const results = [];
|
|
237
|
+
if (!quiet) {
|
|
238
|
+
console.log(chalk.blue("\n🧪 Testing provider connectivity...\n"));
|
|
239
|
+
}
|
|
240
|
+
const spinner = quiet ? null : ora().start();
|
|
241
|
+
for (const provider of providers) {
|
|
242
|
+
if (spinner) {
|
|
243
|
+
spinner.text = `Testing ${provider}...`;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
const start = Date.now();
|
|
247
|
+
await sdk.generateText({ prompt: "test", provider, maxTokens: 1 });
|
|
248
|
+
const duration = Date.now() - start;
|
|
249
|
+
results.push({ provider, status: "working", responseTime: duration });
|
|
250
|
+
if (spinner) {
|
|
251
|
+
spinner.succeed(`${provider}: ${chalk.green("✅ Working")} (${duration}ms)`);
|
|
252
|
+
spinner.start(); // Restart for next provider
|
|
253
|
+
}
|
|
254
|
+
else if (!quiet) {
|
|
255
|
+
console.log(`${provider}: ${chalk.green("✅ Working")} (${duration}ms)`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
260
|
+
results.push({ provider, status: "failed", error: errorMessage });
|
|
261
|
+
if (spinner) {
|
|
262
|
+
spinner.fail(`${provider}: ${chalk.red("❌ Failed")} - ${errorMessage.split("\n")[0]}`);
|
|
263
|
+
spinner.start(); // Restart for next provider
|
|
264
|
+
}
|
|
265
|
+
else if (!quiet) {
|
|
266
|
+
console.error(`${provider}: ${chalk.red("❌ Failed")} - ${errorMessage.split("\n")[0]}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (spinner) {
|
|
271
|
+
spinner.stop();
|
|
272
|
+
}
|
|
273
|
+
return results;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Display setup summary
|
|
277
|
+
*/
|
|
278
|
+
export function displaySetupSummary(result, quiet = false) {
|
|
279
|
+
if (quiet) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const working = result.testResults.filter((r) => r.status === "working").length;
|
|
283
|
+
const total = result.testResults.length;
|
|
284
|
+
console.log(chalk.blue("\n📊 Setup Summary:"));
|
|
285
|
+
console.log(chalk.blue("================"));
|
|
286
|
+
console.log(`Selected providers: ${result.selectedProviders.length}`);
|
|
287
|
+
console.log(`Working providers: ${working}/${total}`);
|
|
288
|
+
if (result.envFileBackup) {
|
|
289
|
+
console.log(chalk.gray(`Environment backup: ${result.envFileBackup}`));
|
|
290
|
+
}
|
|
291
|
+
if (working > 0) {
|
|
292
|
+
console.log(chalk.green("\n✅ Setup completed successfully!"));
|
|
293
|
+
console.log(chalk.yellow("💡 You can now use NeuroLink with your configured providers."));
|
|
294
|
+
console.log(chalk.gray(' Try: neurolink generate-text "Hello, AI!"'));
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
console.log(chalk.red("\n❌ No providers are working."));
|
|
298
|
+
console.log(chalk.yellow("💡 Please check your credentials and try again."));
|
|
299
|
+
console.log(chalk.gray(" Run: neurolink config setup"));
|
|
300
|
+
}
|
|
301
|
+
console.log(chalk.blue("\n📚 Documentation: https://github.com/juspay/neurolink#setup"));
|
|
302
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Model configuration schema for validation
|
|
4
|
+
*/
|
|
5
|
+
declare const ModelConfigSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
displayName: z.ZodString;
|
|
8
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
deprecated: z.ZodBoolean;
|
|
10
|
+
pricing: z.ZodObject<{
|
|
11
|
+
input: z.ZodNumber;
|
|
12
|
+
output: z.ZodNumber;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
input: number;
|
|
15
|
+
output: number;
|
|
16
|
+
}, {
|
|
17
|
+
input: number;
|
|
18
|
+
output: number;
|
|
19
|
+
}>;
|
|
20
|
+
contextWindow: z.ZodNumber;
|
|
21
|
+
releaseDate: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
id: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
capabilities: string[];
|
|
26
|
+
deprecated: boolean;
|
|
27
|
+
pricing: {
|
|
28
|
+
input: number;
|
|
29
|
+
output: number;
|
|
30
|
+
};
|
|
31
|
+
contextWindow: number;
|
|
32
|
+
releaseDate: string;
|
|
33
|
+
}, {
|
|
34
|
+
id: string;
|
|
35
|
+
displayName: string;
|
|
36
|
+
capabilities: string[];
|
|
37
|
+
deprecated: boolean;
|
|
38
|
+
pricing: {
|
|
39
|
+
input: number;
|
|
40
|
+
output: number;
|
|
41
|
+
};
|
|
42
|
+
contextWindow: number;
|
|
43
|
+
releaseDate: string;
|
|
44
|
+
}>;
|
|
45
|
+
declare const ModelRegistrySchema: z.ZodObject<{
|
|
46
|
+
version: z.ZodString;
|
|
47
|
+
lastUpdated: z.ZodString;
|
|
48
|
+
models: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
displayName: z.ZodString;
|
|
51
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
52
|
+
deprecated: z.ZodBoolean;
|
|
53
|
+
pricing: z.ZodObject<{
|
|
54
|
+
input: z.ZodNumber;
|
|
55
|
+
output: z.ZodNumber;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
input: number;
|
|
58
|
+
output: number;
|
|
59
|
+
}, {
|
|
60
|
+
input: number;
|
|
61
|
+
output: number;
|
|
62
|
+
}>;
|
|
63
|
+
contextWindow: z.ZodNumber;
|
|
64
|
+
releaseDate: z.ZodString;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
id: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
capabilities: string[];
|
|
69
|
+
deprecated: boolean;
|
|
70
|
+
pricing: {
|
|
71
|
+
input: number;
|
|
72
|
+
output: number;
|
|
73
|
+
};
|
|
74
|
+
contextWindow: number;
|
|
75
|
+
releaseDate: string;
|
|
76
|
+
}, {
|
|
77
|
+
id: string;
|
|
78
|
+
displayName: string;
|
|
79
|
+
capabilities: string[];
|
|
80
|
+
deprecated: boolean;
|
|
81
|
+
pricing: {
|
|
82
|
+
input: number;
|
|
83
|
+
output: number;
|
|
84
|
+
};
|
|
85
|
+
contextWindow: number;
|
|
86
|
+
releaseDate: string;
|
|
87
|
+
}>>>;
|
|
88
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
89
|
+
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
version: string;
|
|
92
|
+
lastUpdated: string;
|
|
93
|
+
models: Record<string, Record<string, {
|
|
94
|
+
id: string;
|
|
95
|
+
displayName: string;
|
|
96
|
+
capabilities: string[];
|
|
97
|
+
deprecated: boolean;
|
|
98
|
+
pricing: {
|
|
99
|
+
input: number;
|
|
100
|
+
output: number;
|
|
101
|
+
};
|
|
102
|
+
contextWindow: number;
|
|
103
|
+
releaseDate: string;
|
|
104
|
+
}>>;
|
|
105
|
+
aliases?: Record<string, string> | undefined;
|
|
106
|
+
defaults?: Record<string, string> | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
version: string;
|
|
109
|
+
lastUpdated: string;
|
|
110
|
+
models: Record<string, Record<string, {
|
|
111
|
+
id: string;
|
|
112
|
+
displayName: string;
|
|
113
|
+
capabilities: string[];
|
|
114
|
+
deprecated: boolean;
|
|
115
|
+
pricing: {
|
|
116
|
+
input: number;
|
|
117
|
+
output: number;
|
|
118
|
+
};
|
|
119
|
+
contextWindow: number;
|
|
120
|
+
releaseDate: string;
|
|
121
|
+
}>>;
|
|
122
|
+
aliases?: Record<string, string> | undefined;
|
|
123
|
+
defaults?: Record<string, string> | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
export type ModelConfig = z.infer<typeof ModelConfigSchema>;
|
|
126
|
+
export type ModelRegistry = z.infer<typeof ModelRegistrySchema>;
|
|
127
|
+
/**
|
|
128
|
+
* Dynamic Model Provider
|
|
129
|
+
* Loads and manages model configurations from external sources
|
|
130
|
+
*/
|
|
131
|
+
export declare class DynamicModelProvider {
|
|
132
|
+
private static instance;
|
|
133
|
+
private modelRegistry;
|
|
134
|
+
private lastFetch;
|
|
135
|
+
private readonly CACHE_DURATION;
|
|
136
|
+
private constructor();
|
|
137
|
+
static getInstance(): DynamicModelProvider;
|
|
138
|
+
/**
|
|
139
|
+
* Initialize the model registry from multiple sources
|
|
140
|
+
*/
|
|
141
|
+
initialize(): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Load configuration from a source (URL or file path)
|
|
144
|
+
*/
|
|
145
|
+
private loadFromSource;
|
|
146
|
+
/**
|
|
147
|
+
* Get all available models for a provider
|
|
148
|
+
*/
|
|
149
|
+
getModelsForProvider(provider: string): Record<string, ModelConfig>;
|
|
150
|
+
/**
|
|
151
|
+
* Resolve a model by provider and model hint
|
|
152
|
+
*/
|
|
153
|
+
resolveModel(provider: string, modelHint?: string): ModelConfig | null;
|
|
154
|
+
/**
|
|
155
|
+
* Search models by capabilities
|
|
156
|
+
*/
|
|
157
|
+
searchByCapability(capability: string, options?: {
|
|
158
|
+
provider?: string;
|
|
159
|
+
maxPrice?: number;
|
|
160
|
+
excludeDeprecated?: boolean;
|
|
161
|
+
}): Array<{
|
|
162
|
+
provider: string;
|
|
163
|
+
model: string;
|
|
164
|
+
config: ModelConfig;
|
|
165
|
+
}>;
|
|
166
|
+
/**
|
|
167
|
+
* Get the best model for a specific use case
|
|
168
|
+
*/
|
|
169
|
+
getBestModelFor(useCase: "coding" | "analysis" | "vision" | "fastest" | "cheapest"): {
|
|
170
|
+
provider: string;
|
|
171
|
+
model: string;
|
|
172
|
+
config: ModelConfig;
|
|
173
|
+
} | null;
|
|
174
|
+
/**
|
|
175
|
+
* Get all models across all providers
|
|
176
|
+
*/
|
|
177
|
+
getAllModels(): Array<{
|
|
178
|
+
provider: string;
|
|
179
|
+
model: string;
|
|
180
|
+
config: ModelConfig;
|
|
181
|
+
}>;
|
|
182
|
+
/**
|
|
183
|
+
* Get total number of models
|
|
184
|
+
*/
|
|
185
|
+
getTotalModelCount(): number;
|
|
186
|
+
/**
|
|
187
|
+
* Check if cache needs refresh
|
|
188
|
+
*/
|
|
189
|
+
needsRefresh(): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Force refresh the model registry
|
|
192
|
+
*/
|
|
193
|
+
refresh(): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Ensure the registry is initialized
|
|
196
|
+
*/
|
|
197
|
+
private ensureInitialized;
|
|
198
|
+
/**
|
|
199
|
+
* Get registry metadata
|
|
200
|
+
*/
|
|
201
|
+
getMetadata(): {
|
|
202
|
+
version: string;
|
|
203
|
+
lastUpdated: string;
|
|
204
|
+
modelCount: number;
|
|
205
|
+
} | null;
|
|
206
|
+
}
|
|
207
|
+
export declare const dynamicModelProvider: DynamicModelProvider;
|
|
208
|
+
export {};
|