@juspay/neurolink 9.25.1 → 9.25.2

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [9.25.2](https://github.com/juspay/neurolink/compare/v9.25.1...v9.25.2) (2026-03-15)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **(core):** remove hardcoded Ollama model and unsafe type assertions (BZ-463) ([f12e03b](https://github.com/juspay/neurolink/commit/f12e03bfef007464d27c36b44694c5c4c799c6ea))
6
+
1
7
  ## [9.25.1](https://github.com/juspay/neurolink/compare/v9.25.0...v9.25.1) (2026-03-15)
2
8
 
3
9
  ### Bug Fixes
@@ -1263,18 +1263,42 @@ Current user's request: ${currentInput}`;
1263
1263
  }
1264
1264
  // Filter and validate models before comparison
1265
1265
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
1266
- const targetModel = route.model || "llama3.2:latest";
1267
- const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1268
- if (!modelIsAvailable) {
1266
+ const targetModel = route.model;
1267
+ if (targetModel) {
1268
+ // Check if the specific routed model is available
1269
+ const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1270
+ if (!modelIsAvailable) {
1271
+ logger.debug("Orchestration provider validation failed", {
1272
+ taskType: classification.type,
1273
+ routedProvider: route.provider,
1274
+ routedModel: route.model,
1275
+ reason: `Ollama model '${targetModel}' not found`,
1276
+ orchestrationTime: `${Date.now() - startTime}ms`,
1277
+ });
1278
+ // Fall back to first available model instead of abandoning orchestration
1279
+ if (validModels.length > 0) {
1280
+ route.model = validModels[0].name;
1281
+ }
1282
+ else {
1283
+ return {}; // No models at all — preserve existing fallback behavior
1284
+ }
1285
+ }
1286
+ }
1287
+ else if (validModels.length === 0) {
1288
+ // No model specified and none available
1269
1289
  logger.debug("Orchestration provider validation failed", {
1270
1290
  taskType: classification.type,
1271
1291
  routedProvider: route.provider,
1272
1292
  routedModel: route.model,
1273
- reason: `Ollama model '${route.model || "llama3.2:latest"}' not found`,
1293
+ reason: "No Ollama models available",
1274
1294
  orchestrationTime: `${Date.now() - startTime}ms`,
1275
1295
  });
1276
1296
  return {}; // Return empty object to preserve existing fallback behavior
1277
1297
  }
1298
+ else {
1299
+ // No model specified but models are available — use the first one
1300
+ route.model = validModels[0].name;
1301
+ }
1278
1302
  }
1279
1303
  catch (error) {
1280
1304
  logger.debug("Orchestration provider validation failed", {
@@ -1377,18 +1401,42 @@ Current user's request: ${currentInput}`;
1377
1401
  }
1378
1402
  // Filter and validate models before comparison
1379
1403
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
1380
- const targetModel = route.model || "llama3.2:latest";
1381
- const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1382
- if (!modelIsAvailable) {
1404
+ const targetModel = route.model;
1405
+ if (targetModel) {
1406
+ // Check if the specific routed model is available
1407
+ const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1408
+ if (!modelIsAvailable) {
1409
+ logger.debug("Stream orchestration provider validation failed", {
1410
+ taskType: classification.type,
1411
+ routedProvider: route.provider,
1412
+ routedModel: route.model,
1413
+ reason: `Ollama model '${targetModel}' not found`,
1414
+ orchestrationTime: `${Date.now() - startTime}ms`,
1415
+ });
1416
+ // Fall back to first available model instead of abandoning orchestration
1417
+ if (validModels.length > 0) {
1418
+ route.model = validModels[0].name;
1419
+ }
1420
+ else {
1421
+ return {}; // No models at all — preserve existing fallback behavior
1422
+ }
1423
+ }
1424
+ }
1425
+ else if (validModels.length === 0) {
1426
+ // No model specified and none available
1383
1427
  logger.debug("Stream orchestration provider validation failed", {
1384
1428
  taskType: classification.type,
1385
1429
  routedProvider: route.provider,
1386
1430
  routedModel: route.model,
1387
- reason: `Ollama model '${route.model || "llama3.2:latest"}' not found`,
1431
+ reason: "No Ollama models available",
1388
1432
  orchestrationTime: `${Date.now() - startTime}ms`,
1389
1433
  });
1390
1434
  return {}; // Return empty object to preserve existing fallback behavior
1391
1435
  }
1436
+ else {
1437
+ // No model specified but models are available — use the first one
1438
+ route.model = validModels[0].name;
1439
+ }
1392
1440
  }
1393
1441
  catch (error) {
1394
1442
  logger.debug("Stream orchestration provider validation failed", {
@@ -2265,19 +2313,14 @@ Current user's request: ${currentInput}`;
2265
2313
  evaluation: textResult.evaluation
2266
2314
  ? {
2267
2315
  ...textResult.evaluation,
2268
- isOffTopic: textResult.evaluation
2269
- .isOffTopic ?? false,
2270
- alertSeverity: textResult.evaluation
2271
- .alertSeverity ?? "none",
2272
- reasoning: textResult.evaluation
2273
- .reasoning ?? "No evaluation provided",
2274
- evaluationModel: textResult.evaluation
2275
- .evaluationModel ?? "unknown",
2276
- evaluationTime: textResult.evaluation
2277
- .evaluationTime ?? Date.now(),
2278
- // Include evaluationDomain from original options
2279
- evaluationDomain: textResult.evaluation
2280
- .evaluationDomain ??
2316
+ isOffTopic: textResult.evaluation.isOffTopic ?? false,
2317
+ alertSeverity: textResult.evaluation.alertSeverity ??
2318
+ "none",
2319
+ reasoning: textResult.evaluation.reasoning ??
2320
+ "No evaluation provided",
2321
+ evaluationModel: textResult.evaluation.evaluationModel ?? "unknown",
2322
+ evaluationTime: textResult.evaluation.evaluationTime ?? Date.now(),
2323
+ evaluationDomain: textResult.evaluation.evaluationDomain ??
2281
2324
  textOptions.evaluationDomain ??
2282
2325
  factoryResult.domainType,
2283
2326
  }
@@ -4388,7 +4431,7 @@ Current user's request: ${currentInput}`;
4388
4431
  // Accept audio when frames are present; sampleRateHz is optional (defaults applied later)
4389
4432
  const hasAudio = !!(options?.input?.audio &&
4390
4433
  options.input.audio.frames &&
4391
- typeof options.input.audio.frames[Symbol.asyncIterator] !== "undefined");
4434
+ typeof options.input.audio.frames[Symbol.asyncIterator] === "function");
4392
4435
  if (!hasText && !hasAudio) {
4393
4436
  throw new Error("Stream options must include either input.text or input.audio");
4394
4437
  }
@@ -5110,8 +5153,7 @@ Current user's request: ${currentInput}`;
5110
5153
  }
5111
5154
  // Check if the memory manager is Redis-backed (has updateAgenticLoopReport method)
5112
5155
  if (!("updateAgenticLoopReport" in this.conversationMemory) ||
5113
- typeof this.conversationMemory
5114
- .updateAgenticLoopReport !== "function") {
5156
+ typeof this.conversationMemory.updateAgenticLoopReport !== "function") {
5115
5157
  throw new ConversationMemoryError("updateAgenticLoopReport is only supported with Redis conversation memory.", "CONFIG_ERROR");
5116
5158
  }
5117
5159
  await withTimeout(this
@@ -5812,7 +5854,6 @@ Current user's request: ${currentInput}`;
5812
5854
  }
5813
5855
  const responseData = await response.json();
5814
5856
  const models = responseData?.models;
5815
- const defaultOllamaModel = "llama3.2:latest";
5816
5857
  // Runtime-safe guard: ensure models is an array with valid objects
5817
5858
  if (!Array.isArray(models)) {
5818
5859
  logger.warn("Ollama API returned invalid models format in testProvider", {
@@ -5823,15 +5864,14 @@ Current user's request: ${currentInput}`;
5823
5864
  }
5824
5865
  // Filter and validate models before comparison
5825
5866
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
5826
- const modelIsAvailable = validModels.some((m) => m.name === defaultOllamaModel);
5827
- if (modelIsAvailable) {
5867
+ if (validModels.length > 0) {
5828
5868
  return {
5829
5869
  provider: providerName,
5830
5870
  status: "working",
5831
5871
  configured: true,
5832
5872
  authenticated: true,
5833
5873
  responseTime: Date.now() - startTime,
5834
- model: defaultOllamaModel,
5874
+ model: validModels[0].name,
5835
5875
  };
5836
5876
  }
5837
5877
  else {
@@ -5840,7 +5880,7 @@ Current user's request: ${currentInput}`;
5840
5880
  status: "failed",
5841
5881
  configured: true,
5842
5882
  authenticated: false,
5843
- error: `Ollama service running but model '${defaultOllamaModel}' not found`,
5883
+ error: "Ollama service running but no models installed",
5844
5884
  responseTime: Date.now() - startTime,
5845
5885
  };
5846
5886
  }
package/dist/neurolink.js CHANGED
@@ -1263,18 +1263,42 @@ Current user's request: ${currentInput}`;
1263
1263
  }
1264
1264
  // Filter and validate models before comparison
1265
1265
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
1266
- const targetModel = route.model || "llama3.2:latest";
1267
- const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1268
- if (!modelIsAvailable) {
1266
+ const targetModel = route.model;
1267
+ if (targetModel) {
1268
+ // Check if the specific routed model is available
1269
+ const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1270
+ if (!modelIsAvailable) {
1271
+ logger.debug("Orchestration provider validation failed", {
1272
+ taskType: classification.type,
1273
+ routedProvider: route.provider,
1274
+ routedModel: route.model,
1275
+ reason: `Ollama model '${targetModel}' not found`,
1276
+ orchestrationTime: `${Date.now() - startTime}ms`,
1277
+ });
1278
+ // Fall back to first available model instead of abandoning orchestration
1279
+ if (validModels.length > 0) {
1280
+ route.model = validModels[0].name;
1281
+ }
1282
+ else {
1283
+ return {}; // No models at all — preserve existing fallback behavior
1284
+ }
1285
+ }
1286
+ }
1287
+ else if (validModels.length === 0) {
1288
+ // No model specified and none available
1269
1289
  logger.debug("Orchestration provider validation failed", {
1270
1290
  taskType: classification.type,
1271
1291
  routedProvider: route.provider,
1272
1292
  routedModel: route.model,
1273
- reason: `Ollama model '${route.model || "llama3.2:latest"}' not found`,
1293
+ reason: "No Ollama models available",
1274
1294
  orchestrationTime: `${Date.now() - startTime}ms`,
1275
1295
  });
1276
1296
  return {}; // Return empty object to preserve existing fallback behavior
1277
1297
  }
1298
+ else {
1299
+ // No model specified but models are available — use the first one
1300
+ route.model = validModels[0].name;
1301
+ }
1278
1302
  }
1279
1303
  catch (error) {
1280
1304
  logger.debug("Orchestration provider validation failed", {
@@ -1377,18 +1401,42 @@ Current user's request: ${currentInput}`;
1377
1401
  }
1378
1402
  // Filter and validate models before comparison
1379
1403
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
1380
- const targetModel = route.model || "llama3.2:latest";
1381
- const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1382
- if (!modelIsAvailable) {
1404
+ const targetModel = route.model;
1405
+ if (targetModel) {
1406
+ // Check if the specific routed model is available
1407
+ const modelIsAvailable = validModels.some((m) => m.name === targetModel);
1408
+ if (!modelIsAvailable) {
1409
+ logger.debug("Stream orchestration provider validation failed", {
1410
+ taskType: classification.type,
1411
+ routedProvider: route.provider,
1412
+ routedModel: route.model,
1413
+ reason: `Ollama model '${targetModel}' not found`,
1414
+ orchestrationTime: `${Date.now() - startTime}ms`,
1415
+ });
1416
+ // Fall back to first available model instead of abandoning orchestration
1417
+ if (validModels.length > 0) {
1418
+ route.model = validModels[0].name;
1419
+ }
1420
+ else {
1421
+ return {}; // No models at all — preserve existing fallback behavior
1422
+ }
1423
+ }
1424
+ }
1425
+ else if (validModels.length === 0) {
1426
+ // No model specified and none available
1383
1427
  logger.debug("Stream orchestration provider validation failed", {
1384
1428
  taskType: classification.type,
1385
1429
  routedProvider: route.provider,
1386
1430
  routedModel: route.model,
1387
- reason: `Ollama model '${route.model || "llama3.2:latest"}' not found`,
1431
+ reason: "No Ollama models available",
1388
1432
  orchestrationTime: `${Date.now() - startTime}ms`,
1389
1433
  });
1390
1434
  return {}; // Return empty object to preserve existing fallback behavior
1391
1435
  }
1436
+ else {
1437
+ // No model specified but models are available — use the first one
1438
+ route.model = validModels[0].name;
1439
+ }
1392
1440
  }
1393
1441
  catch (error) {
1394
1442
  logger.debug("Stream orchestration provider validation failed", {
@@ -2265,19 +2313,14 @@ Current user's request: ${currentInput}`;
2265
2313
  evaluation: textResult.evaluation
2266
2314
  ? {
2267
2315
  ...textResult.evaluation,
2268
- isOffTopic: textResult.evaluation
2269
- .isOffTopic ?? false,
2270
- alertSeverity: textResult.evaluation
2271
- .alertSeverity ?? "none",
2272
- reasoning: textResult.evaluation
2273
- .reasoning ?? "No evaluation provided",
2274
- evaluationModel: textResult.evaluation
2275
- .evaluationModel ?? "unknown",
2276
- evaluationTime: textResult.evaluation
2277
- .evaluationTime ?? Date.now(),
2278
- // Include evaluationDomain from original options
2279
- evaluationDomain: textResult.evaluation
2280
- .evaluationDomain ??
2316
+ isOffTopic: textResult.evaluation.isOffTopic ?? false,
2317
+ alertSeverity: textResult.evaluation.alertSeverity ??
2318
+ "none",
2319
+ reasoning: textResult.evaluation.reasoning ??
2320
+ "No evaluation provided",
2321
+ evaluationModel: textResult.evaluation.evaluationModel ?? "unknown",
2322
+ evaluationTime: textResult.evaluation.evaluationTime ?? Date.now(),
2323
+ evaluationDomain: textResult.evaluation.evaluationDomain ??
2281
2324
  textOptions.evaluationDomain ??
2282
2325
  factoryResult.domainType,
2283
2326
  }
@@ -4388,7 +4431,7 @@ Current user's request: ${currentInput}`;
4388
4431
  // Accept audio when frames are present; sampleRateHz is optional (defaults applied later)
4389
4432
  const hasAudio = !!(options?.input?.audio &&
4390
4433
  options.input.audio.frames &&
4391
- typeof options.input.audio.frames[Symbol.asyncIterator] !== "undefined");
4434
+ typeof options.input.audio.frames[Symbol.asyncIterator] === "function");
4392
4435
  if (!hasText && !hasAudio) {
4393
4436
  throw new Error("Stream options must include either input.text or input.audio");
4394
4437
  }
@@ -5110,8 +5153,7 @@ Current user's request: ${currentInput}`;
5110
5153
  }
5111
5154
  // Check if the memory manager is Redis-backed (has updateAgenticLoopReport method)
5112
5155
  if (!("updateAgenticLoopReport" in this.conversationMemory) ||
5113
- typeof this.conversationMemory
5114
- .updateAgenticLoopReport !== "function") {
5156
+ typeof this.conversationMemory.updateAgenticLoopReport !== "function") {
5115
5157
  throw new ConversationMemoryError("updateAgenticLoopReport is only supported with Redis conversation memory.", "CONFIG_ERROR");
5116
5158
  }
5117
5159
  await withTimeout(this
@@ -5812,7 +5854,6 @@ Current user's request: ${currentInput}`;
5812
5854
  }
5813
5855
  const responseData = await response.json();
5814
5856
  const models = responseData?.models;
5815
- const defaultOllamaModel = "llama3.2:latest";
5816
5857
  // Runtime-safe guard: ensure models is an array with valid objects
5817
5858
  if (!Array.isArray(models)) {
5818
5859
  logger.warn("Ollama API returned invalid models format in testProvider", {
@@ -5823,15 +5864,14 @@ Current user's request: ${currentInput}`;
5823
5864
  }
5824
5865
  // Filter and validate models before comparison
5825
5866
  const validModels = models.filter((m) => m && typeof m === "object" && typeof m.name === "string");
5826
- const modelIsAvailable = validModels.some((m) => m.name === defaultOllamaModel);
5827
- if (modelIsAvailable) {
5867
+ if (validModels.length > 0) {
5828
5868
  return {
5829
5869
  provider: providerName,
5830
5870
  status: "working",
5831
5871
  configured: true,
5832
5872
  authenticated: true,
5833
5873
  responseTime: Date.now() - startTime,
5834
- model: defaultOllamaModel,
5874
+ model: validModels[0].name,
5835
5875
  };
5836
5876
  }
5837
5877
  else {
@@ -5840,7 +5880,7 @@ Current user's request: ${currentInput}`;
5840
5880
  status: "failed",
5841
5881
  configured: true,
5842
5882
  authenticated: false,
5843
- error: `Ollama service running but model '${defaultOllamaModel}' not found`,
5883
+ error: "Ollama service running but no models installed",
5844
5884
  responseTime: Date.now() - startTime,
5845
5885
  };
5846
5886
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.25.1",
3
+ "version": "9.25.2",
4
4
  "description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
5
5
  "author": {
6
6
  "name": "Juspay Technologies",