@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.
Files changed (176) hide show
  1. package/CHANGELOG.md +193 -7
  2. package/README.md +100 -17
  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 +6 -6
  8. package/dist/cli/commands/config.js +326 -273
  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 +1 -1
  12. package/dist/cli/commands/ollama.js +153 -143
  13. package/dist/cli/index.js +589 -323
  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 +176 -61
  24. package/dist/core/types.d.ts +4 -2
  25. package/dist/core/types.js +4 -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 +176 -61
  34. package/dist/lib/core/types.d.ts +4 -2
  35. package/dist/lib/core/types.js +4 -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 +204 -65
  68. package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +142 -102
  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 +197 -142
  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 +304 -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 +3 -3
  94. package/dist/lib/providers/huggingFace.js +70 -63
  95. package/dist/lib/providers/index.d.ts +11 -11
  96. package/dist/lib/providers/index.js +18 -18
  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 +3 -3
  100. package/dist/lib/providers/mistralAI.js +42 -36
  101. package/dist/lib/providers/ollama.d.ts +4 -4
  102. package/dist/lib/providers/ollama.js +113 -98
  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 +53 -31
  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 +204 -65
  137. package/dist/mcp/servers/ai-providers/ai-core-server.js +142 -102
  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 +197 -142
  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 +304 -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 +3 -3
  163. package/dist/providers/huggingFace.js +70 -63
  164. package/dist/providers/index.d.ts +11 -11
  165. package/dist/providers/index.js +18 -18
  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 +3 -3
  169. package/dist/providers/mistralAI.js +42 -36
  170. package/dist/providers/ollama.d.ts +4 -4
  171. package/dist/providers/ollama.js +113 -98
  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 +53 -31
  176. package/package.json +175 -161
@@ -1,4 +1,4 @@
1
- import type { Argv } from 'yargs';
1
+ import type { Argv } from "yargs";
2
2
  export declare const ollamaCommand: {
3
3
  command: string;
4
4
  describe: string;
@@ -1,40 +1,40 @@
1
- import { execSync } from 'child_process';
2
- import chalk from 'chalk';
3
- import ora from 'ora';
4
- import inquirer from 'inquirer';
1
+ import { execSync } from "child_process";
2
+ import chalk from "chalk";
3
+ import ora from "ora";
4
+ import inquirer from "inquirer";
5
5
  export const ollamaCommand = {
6
- command: 'ollama <command>',
7
- describe: 'Manage Ollama local AI models',
6
+ command: "ollama <command>",
7
+ describe: "Manage Ollama local AI models",
8
8
  builder: (yargs) => {
9
9
  return yargs
10
- .command('list-models', 'List installed Ollama models', {}, listModelsHandler)
11
- .command('pull <model>', 'Download an Ollama model', {
10
+ .command("list-models", "List installed Ollama models", {}, listModelsHandler)
11
+ .command("pull <model>", "Download an Ollama model", {
12
12
  model: {
13
- describe: 'Model name to download',
14
- type: 'string',
15
- demandOption: true
16
- }
13
+ describe: "Model name to download",
14
+ type: "string",
15
+ demandOption: true,
16
+ },
17
17
  }, pullModelHandler)
18
- .command('remove <model>', 'Remove an Ollama model', {
18
+ .command("remove <model>", "Remove an Ollama model", {
19
19
  model: {
20
- describe: 'Model name to remove',
21
- type: 'string',
22
- demandOption: true
23
- }
20
+ describe: "Model name to remove",
21
+ type: "string",
22
+ demandOption: true,
23
+ },
24
24
  }, removeModelHandler)
25
- .command('status', 'Check Ollama service status', {}, statusHandler)
26
- .command('start', 'Start Ollama service', {}, startHandler)
27
- .command('stop', 'Stop Ollama service', {}, stopHandler)
28
- .command('setup', 'Interactive Ollama setup', {}, setupHandler)
29
- .demandCommand(1, 'Please specify a command');
25
+ .command("status", "Check Ollama service status", {}, statusHandler)
26
+ .command("start", "Start Ollama service", {}, startHandler)
27
+ .command("stop", "Stop Ollama service", {}, stopHandler)
28
+ .command("setup", "Interactive Ollama setup", {}, setupHandler)
29
+ .demandCommand(1, "Please specify a command");
30
30
  },
31
- handler: () => { } // No-op handler as subcommands handle everything
31
+ handler: () => { }, // No-op handler as subcommands handle everything
32
32
  };
33
33
  async function listModelsHandler() {
34
- const spinner = ora('Fetching installed models...').start();
34
+ const spinner = ora("Fetching installed models...").start();
35
35
  try {
36
- const output = execSync('ollama list', { encoding: 'utf8' });
37
- spinner.succeed('Installed models:');
36
+ const output = execSync("ollama list", { encoding: "utf8" });
37
+ spinner.succeed("Installed models:");
38
38
  if (output.trim()) {
39
39
  console.log(output);
40
40
  }
@@ -43,24 +43,24 @@ async function listModelsHandler() {
43
43
  }
44
44
  }
45
45
  catch (error) {
46
- spinner.fail('Failed to list models. Is Ollama installed?');
47
- console.error(chalk.red('Error:', error.message));
48
- console.log(chalk.blue('\nTip: Install Ollama from https://ollama.ai'));
46
+ spinner.fail("Failed to list models. Is Ollama installed?");
47
+ console.error(chalk.red("Error:", error.message));
48
+ console.log(chalk.blue("\nTip: Install Ollama from https://ollama.ai"));
49
49
  process.exit(1);
50
50
  }
51
51
  }
52
52
  async function pullModelHandler(argv) {
53
53
  const { model } = argv;
54
54
  console.log(chalk.blue(`Downloading model: ${model}`));
55
- console.log(chalk.gray('This may take several minutes...'));
55
+ console.log(chalk.gray("This may take several minutes..."));
56
56
  try {
57
- execSync(`ollama pull ${model}`, { stdio: 'inherit' });
57
+ execSync(`ollama pull ${model}`, { stdio: "inherit" });
58
58
  console.log(chalk.green(`\n✅ Successfully downloaded ${model}`));
59
59
  console.log(chalk.blue(`\nTest it with: npx @juspay/neurolink generate-text "Hello!" --provider ollama --model ${model}`));
60
60
  }
61
61
  catch (error) {
62
62
  console.error(chalk.red(`\n❌ Failed to download ${model}`));
63
- console.error(chalk.red('Error:', error.message));
63
+ console.error(chalk.red("Error:", error.message));
64
64
  process.exit(1);
65
65
  }
66
66
  }
@@ -69,36 +69,38 @@ async function removeModelHandler(argv) {
69
69
  // Confirm removal
70
70
  const { confirm } = await inquirer.prompt([
71
71
  {
72
- type: 'confirm',
73
- name: 'confirm',
72
+ type: "confirm",
73
+ name: "confirm",
74
74
  message: `Are you sure you want to remove model "${model}"?`,
75
- default: false
76
- }
75
+ default: false,
76
+ },
77
77
  ]);
78
78
  if (!confirm) {
79
- console.log(chalk.yellow('Removal cancelled.'));
79
+ console.log(chalk.yellow("Removal cancelled."));
80
80
  return;
81
81
  }
82
82
  const spinner = ora(`Removing model ${model}...`).start();
83
83
  try {
84
- execSync(`ollama rm ${model}`, { encoding: 'utf8' });
84
+ execSync(`ollama rm ${model}`, { encoding: "utf8" });
85
85
  spinner.succeed(`Successfully removed ${model}`);
86
86
  }
87
87
  catch (error) {
88
88
  spinner.fail(`Failed to remove ${model}`);
89
- console.error(chalk.red('Error:', error.message));
89
+ console.error(chalk.red("Error:", error.message));
90
90
  process.exit(1);
91
91
  }
92
92
  }
93
93
  async function statusHandler() {
94
- const spinner = ora('Checking Ollama service status...').start();
94
+ const spinner = ora("Checking Ollama service status...").start();
95
95
  try {
96
96
  // Try to run a simple command
97
- execSync('ollama list', { encoding: 'utf8' });
98
- spinner.succeed('Ollama service is running');
97
+ execSync("ollama list", { encoding: "utf8" });
98
+ spinner.succeed("Ollama service is running");
99
99
  // Get additional info
100
100
  try {
101
- const response = execSync('curl -s http://localhost:11434/api/tags', { encoding: 'utf8' });
101
+ const response = execSync("curl -s http://localhost:11434/api/tags", {
102
+ encoding: "utf8",
103
+ });
102
104
  const data = JSON.parse(response);
103
105
  if (data.models && data.models.length > 0) {
104
106
  console.log(chalk.green(`\n${data.models.length} models available`));
@@ -109,156 +111,156 @@ async function statusHandler() {
109
111
  }
110
112
  }
111
113
  catch (error) {
112
- spinner.fail('Ollama service is not running');
113
- console.log(chalk.yellow('\nStart Ollama with: ollama serve'));
114
- console.log(chalk.blue('Or restart the Ollama app if using the desktop version'));
114
+ spinner.fail("Ollama service is not running");
115
+ console.log(chalk.yellow("\nStart Ollama with: ollama serve"));
116
+ console.log(chalk.blue("Or restart the Ollama app if using the desktop version"));
115
117
  process.exit(1);
116
118
  }
117
119
  }
118
120
  async function startHandler() {
119
- console.log(chalk.blue('Starting Ollama service...'));
121
+ console.log(chalk.blue("Starting Ollama service..."));
120
122
  try {
121
123
  // Check if already running
122
124
  try {
123
- execSync('ollama list', { encoding: 'utf8' });
124
- console.log(chalk.yellow('Ollama service is already running!'));
125
+ execSync("ollama list", { encoding: "utf8" });
126
+ console.log(chalk.yellow("Ollama service is already running!"));
125
127
  return;
126
128
  }
127
129
  catch {
128
130
  // Not running, continue to start
129
131
  }
130
132
  // Different approaches for different platforms
131
- if (process.platform === 'darwin') {
133
+ if (process.platform === "darwin") {
132
134
  // macOS
133
- console.log(chalk.gray('Starting Ollama on macOS...'));
135
+ console.log(chalk.gray("Starting Ollama on macOS..."));
134
136
  try {
135
- execSync('open -a Ollama');
136
- console.log(chalk.green('✅ Ollama app started'));
137
+ execSync("open -a Ollama");
138
+ console.log(chalk.green("✅ Ollama app started"));
137
139
  }
138
140
  catch {
139
141
  // Try service command
140
- execSync('ollama serve > /dev/null 2>&1 &', { stdio: 'ignore' });
141
- console.log(chalk.green('✅ Ollama service started'));
142
+ execSync("ollama serve > /dev/null 2>&1 &", { stdio: "ignore" });
143
+ console.log(chalk.green("✅ Ollama service started"));
142
144
  }
143
145
  }
144
- else if (process.platform === 'linux') {
146
+ else if (process.platform === "linux") {
145
147
  // Linux
146
- console.log(chalk.gray('Starting Ollama service on Linux...'));
148
+ console.log(chalk.gray("Starting Ollama service on Linux..."));
147
149
  try {
148
- execSync('systemctl start ollama', { encoding: 'utf8' });
149
- console.log(chalk.green('✅ Ollama service started'));
150
+ execSync("systemctl start ollama", { encoding: "utf8" });
151
+ console.log(chalk.green("✅ Ollama service started"));
150
152
  }
151
153
  catch {
152
154
  // Try direct command
153
- execSync('ollama serve > /dev/null 2>&1 &', { stdio: 'ignore' });
154
- console.log(chalk.green('✅ Ollama service started'));
155
+ execSync("ollama serve > /dev/null 2>&1 &", { stdio: "ignore" });
156
+ console.log(chalk.green("✅ Ollama service started"));
155
157
  }
156
158
  }
157
159
  else {
158
160
  // Windows
159
- console.log(chalk.gray('Starting Ollama on Windows...'));
160
- execSync('start ollama serve', { stdio: 'ignore' });
161
- console.log(chalk.green('✅ Ollama service started'));
161
+ console.log(chalk.gray("Starting Ollama on Windows..."));
162
+ execSync("start ollama serve", { stdio: "ignore" });
163
+ console.log(chalk.green("✅ Ollama service started"));
162
164
  }
163
- console.log(chalk.blue('\nWait a few seconds for the service to initialize...'));
165
+ console.log(chalk.blue("\nWait a few seconds for the service to initialize..."));
164
166
  }
165
167
  catch (error) {
166
- console.error(chalk.red('Failed to start Ollama service'));
167
- console.error(chalk.red('Error:', error.message));
168
- console.log(chalk.blue('\nTry starting Ollama manually or check installation'));
168
+ console.error(chalk.red("Failed to start Ollama service"));
169
+ console.error(chalk.red("Error:", error.message));
170
+ console.log(chalk.blue("\nTry starting Ollama manually or check installation"));
169
171
  process.exit(1);
170
172
  }
171
173
  }
172
174
  async function stopHandler() {
173
- const spinner = ora('Stopping Ollama service...').start();
175
+ const spinner = ora("Stopping Ollama service...").start();
174
176
  try {
175
- if (process.platform === 'darwin') {
177
+ if (process.platform === "darwin") {
176
178
  // macOS
177
179
  try {
178
- execSync('pkill ollama', { encoding: 'utf8' });
180
+ execSync("pkill ollama", { encoding: "utf8" });
179
181
  }
180
182
  catch {
181
- execSync('killall Ollama', { encoding: 'utf8' });
183
+ execSync("killall Ollama", { encoding: "utf8" });
182
184
  }
183
185
  }
184
- else if (process.platform === 'linux') {
186
+ else if (process.platform === "linux") {
185
187
  // Linux
186
188
  try {
187
- execSync('systemctl stop ollama', { encoding: 'utf8' });
189
+ execSync("systemctl stop ollama", { encoding: "utf8" });
188
190
  }
189
191
  catch {
190
- execSync('pkill ollama', { encoding: 'utf8' });
192
+ execSync("pkill ollama", { encoding: "utf8" });
191
193
  }
192
194
  }
193
195
  else {
194
196
  // Windows
195
- execSync('taskkill /F /IM ollama.exe', { encoding: 'utf8' });
197
+ execSync("taskkill /F /IM ollama.exe", { encoding: "utf8" });
196
198
  }
197
- spinner.succeed('Ollama service stopped');
199
+ spinner.succeed("Ollama service stopped");
198
200
  }
199
201
  catch (error) {
200
- spinner.fail('Failed to stop Ollama service');
201
- console.error(chalk.red('It may not be running or requires manual stop'));
202
+ spinner.fail("Failed to stop Ollama service");
203
+ console.error(chalk.red("It may not be running or requires manual stop"));
202
204
  }
203
205
  }
204
206
  async function setupHandler() {
205
- console.log(chalk.blue('🦙 Welcome to Ollama Setup!\n'));
207
+ console.log(chalk.blue("🦙 Welcome to Ollama Setup!\n"));
206
208
  // Check if Ollama is installed
207
- const checkSpinner = ora('Checking Ollama installation...').start();
209
+ const checkSpinner = ora("Checking Ollama installation...").start();
208
210
  let isInstalled = false;
209
211
  try {
210
- execSync('ollama --version', { encoding: 'utf8' });
212
+ execSync("ollama --version", { encoding: "utf8" });
211
213
  isInstalled = true;
212
- checkSpinner.succeed('Ollama is installed');
214
+ checkSpinner.succeed("Ollama is installed");
213
215
  }
214
216
  catch {
215
- checkSpinner.fail('Ollama is not installed');
217
+ checkSpinner.fail("Ollama is not installed");
216
218
  }
217
219
  if (!isInstalled) {
218
- console.log(chalk.yellow('\nOllama needs to be installed first.'));
219
- console.log(chalk.blue('\nInstallation instructions:'));
220
- if (process.platform === 'darwin') {
221
- console.log('\nFor macOS:');
222
- console.log(chalk.gray(' brew install ollama'));
223
- console.log(chalk.gray(' # or download from https://ollama.ai'));
220
+ console.log(chalk.yellow("\nOllama needs to be installed first."));
221
+ console.log(chalk.blue("\nInstallation instructions:"));
222
+ if (process.platform === "darwin") {
223
+ console.log("\nFor macOS:");
224
+ console.log(chalk.gray(" brew install ollama"));
225
+ console.log(chalk.gray(" # or download from https://ollama.ai"));
224
226
  }
225
- else if (process.platform === 'linux') {
226
- console.log('\nFor Linux:');
227
- console.log(chalk.gray(' curl -fsSL https://ollama.ai/install.sh | sh'));
227
+ else if (process.platform === "linux") {
228
+ console.log("\nFor Linux:");
229
+ console.log(chalk.gray(" curl -fsSL https://ollama.ai/install.sh | sh"));
228
230
  }
229
231
  else {
230
- console.log('\nFor Windows:');
231
- console.log(chalk.gray(' Download from https://ollama.ai'));
232
+ console.log("\nFor Windows:");
233
+ console.log(chalk.gray(" Download from https://ollama.ai"));
232
234
  }
233
235
  const { proceedAnyway } = await inquirer.prompt([
234
236
  {
235
- type: 'confirm',
236
- name: 'proceedAnyway',
237
- message: 'Would you like to continue with setup anyway?',
238
- default: false
239
- }
237
+ type: "confirm",
238
+ name: "proceedAnyway",
239
+ message: "Would you like to continue with setup anyway?",
240
+ default: false,
241
+ },
240
242
  ]);
241
243
  if (!proceedAnyway) {
242
- console.log(chalk.blue('\nInstall Ollama and run setup again!'));
244
+ console.log(chalk.blue("\nInstall Ollama and run setup again!"));
243
245
  return;
244
246
  }
245
247
  }
246
248
  // Check if service is running
247
249
  let serviceRunning = false;
248
250
  try {
249
- execSync('ollama list', { encoding: 'utf8' });
251
+ execSync("ollama list", { encoding: "utf8" });
250
252
  serviceRunning = true;
251
- console.log(chalk.green('\n✅ Ollama service is running'));
253
+ console.log(chalk.green("\n✅ Ollama service is running"));
252
254
  }
253
255
  catch {
254
- console.log(chalk.yellow('\n⚠️ Ollama service is not running'));
256
+ console.log(chalk.yellow("\n⚠️ Ollama service is not running"));
255
257
  const { startService } = await inquirer.prompt([
256
258
  {
257
- type: 'confirm',
258
- name: 'startService',
259
- message: 'Would you like to start the Ollama service?',
260
- default: true
261
- }
259
+ type: "confirm",
260
+ name: "startService",
261
+ message: "Would you like to start the Ollama service?",
262
+ default: true,
263
+ },
262
264
  ]);
263
265
  if (startService) {
264
266
  await startHandler();
@@ -267,45 +269,51 @@ async function setupHandler() {
267
269
  }
268
270
  if (serviceRunning) {
269
271
  // List available models
270
- console.log(chalk.blue('\n📦 Popular Ollama models:'));
271
- console.log(' • llama2 (7B) - General purpose');
272
- console.log(' • codellama (7B) - Code generation');
273
- console.log(' • mistral (7B) - Fast and efficient');
274
- console.log(' • tinyllama (1B) - Lightweight');
275
- console.log(' • phi (2.7B) - Microsoft\'s compact model');
272
+ console.log(chalk.blue("\n📦 Popular Ollama models:"));
273
+ console.log(" • llama2 (7B) - General purpose");
274
+ console.log(" • codellama (7B) - Code generation");
275
+ console.log(" • mistral (7B) - Fast and efficient");
276
+ console.log(" • tinyllama (1B) - Lightweight");
277
+ console.log(" • phi (2.7B) - Microsoft's compact model");
276
278
  const { downloadModel } = await inquirer.prompt([
277
279
  {
278
- type: 'confirm',
279
- name: 'downloadModel',
280
- message: 'Would you like to download a model?',
281
- default: true
282
- }
280
+ type: "confirm",
281
+ name: "downloadModel",
282
+ message: "Would you like to download a model?",
283
+ default: true,
284
+ },
283
285
  ]);
284
286
  if (downloadModel) {
285
287
  const { selectedModel } = await inquirer.prompt([
286
288
  {
287
- type: 'list',
288
- name: 'selectedModel',
289
- message: 'Select a model to download:',
289
+ type: "list",
290
+ name: "selectedModel",
291
+ message: "Select a model to download:",
290
292
  choices: [
291
- { name: 'llama2 (7B) - Recommended for general use', value: 'llama2' },
292
- { name: 'codellama (7B) - Best for code generation', value: 'codellama' },
293
- { name: 'mistral (7B) - Fast and efficient', value: 'mistral' },
294
- { name: 'tinyllama (1B) - Lightweight, fast', value: 'tinyllama' },
295
- { name: 'phi (2.7B) - Microsoft\'s compact model', value: 'phi' },
296
- { name: 'Other (enter manually)', value: 'other' }
297
- ]
298
- }
293
+ {
294
+ name: "llama2 (7B) - Recommended for general use",
295
+ value: "llama2",
296
+ },
297
+ {
298
+ name: "codellama (7B) - Best for code generation",
299
+ value: "codellama",
300
+ },
301
+ { name: "mistral (7B) - Fast and efficient", value: "mistral" },
302
+ { name: "tinyllama (1B) - Lightweight, fast", value: "tinyllama" },
303
+ { name: "phi (2.7B) - Microsoft's compact model", value: "phi" },
304
+ { name: "Other (enter manually)", value: "other" },
305
+ ],
306
+ },
299
307
  ]);
300
308
  let modelToDownload = selectedModel;
301
- if (selectedModel === 'other') {
309
+ if (selectedModel === "other") {
302
310
  const { customModel } = await inquirer.prompt([
303
311
  {
304
- type: 'input',
305
- name: 'customModel',
306
- message: 'Enter the model name:',
307
- validate: (input) => input.trim().length > 0 || 'Model name is required'
308
- }
312
+ type: "input",
313
+ name: "customModel",
314
+ message: "Enter the model name:",
315
+ validate: (input) => input.trim().length > 0 || "Model name is required",
316
+ },
309
317
  ]);
310
318
  modelToDownload = customModel;
311
319
  }
@@ -313,11 +321,13 @@ async function setupHandler() {
313
321
  }
314
322
  }
315
323
  // Final instructions
316
- console.log(chalk.green('\n✅ Setup complete!\n'));
317
- console.log(chalk.blue('Next steps:'));
318
- console.log('1. List models: ' + chalk.gray('neurolink ollama list-models'));
319
- console.log('2. Generate text: ' + chalk.gray('neurolink generate-text "Hello!" --provider ollama'));
320
- console.log('3. Use specific model: ' + chalk.gray('neurolink generate-text "Hello!" --provider ollama --model codellama'));
321
- console.log(chalk.gray('\nFor more information, see: https://docs.neurolink.ai/providers/ollama'));
324
+ console.log(chalk.green("\n✅ Setup complete!\n"));
325
+ console.log(chalk.blue("Next steps:"));
326
+ console.log("1. List models: " + chalk.gray("neurolink ollama list-models"));
327
+ console.log("2. Generate text: " +
328
+ chalk.gray('neurolink generate-text "Hello!" --provider ollama'));
329
+ console.log("3. Use specific model: " +
330
+ chalk.gray('neurolink generate-text "Hello!" --provider ollama --model codellama'));
331
+ console.log(chalk.gray("\nFor more information, see: https://docs.neurolink.ai/providers/ollama"));
322
332
  }
323
333
  export default ollamaCommand;