@juspay/neurolink 7.33.3 → 7.34.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 (135) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +37 -0
  3. package/dist/cli/commands/config.d.ts +3 -4
  4. package/dist/cli/commands/config.js +2 -3
  5. package/dist/cli/errorHandler.d.ts +1 -0
  6. package/dist/cli/errorHandler.js +28 -0
  7. package/dist/cli/factories/commandFactory.d.ts +23 -0
  8. package/dist/cli/factories/commandFactory.js +375 -60
  9. package/dist/cli/factories/ollamaCommandFactory.js +7 -1
  10. package/dist/cli/index.d.ts +1 -1
  11. package/dist/cli/index.js +9 -164
  12. package/dist/cli/loop/optionsSchema.d.ts +15 -0
  13. package/dist/cli/loop/optionsSchema.js +59 -0
  14. package/dist/cli/loop/session.d.ts +15 -0
  15. package/dist/cli/loop/session.js +252 -0
  16. package/dist/cli/parser.d.ts +1 -0
  17. package/dist/cli/parser.js +158 -0
  18. package/dist/cli/utils/ollamaUtils.js +6 -0
  19. package/dist/config/{conversationMemoryConfig.d.ts → conversationMemory.d.ts} +1 -1
  20. package/dist/core/baseProvider.js +43 -4
  21. package/dist/core/constants.d.ts +12 -3
  22. package/dist/core/constants.js +22 -6
  23. package/dist/core/conversationMemoryFactory.d.ts +23 -0
  24. package/dist/core/conversationMemoryFactory.js +144 -0
  25. package/dist/core/conversationMemoryInitializer.d.ts +14 -0
  26. package/dist/core/conversationMemoryInitializer.js +127 -0
  27. package/dist/core/conversationMemoryManager.d.ts +3 -2
  28. package/dist/core/conversationMemoryManager.js +4 -3
  29. package/dist/core/factory.js +19 -0
  30. package/dist/core/redisConversationMemoryManager.d.ts +73 -0
  31. package/dist/core/redisConversationMemoryManager.js +483 -0
  32. package/dist/core/types.d.ts +1 -1
  33. package/dist/factories/providerRegistry.js +2 -0
  34. package/dist/lib/config/{conversationMemoryConfig.d.ts → conversationMemory.d.ts} +1 -1
  35. package/dist/lib/core/baseProvider.js +43 -4
  36. package/dist/lib/core/constants.d.ts +12 -3
  37. package/dist/lib/core/constants.js +22 -6
  38. package/dist/lib/core/conversationMemoryFactory.d.ts +23 -0
  39. package/dist/lib/core/conversationMemoryFactory.js +144 -0
  40. package/dist/lib/core/conversationMemoryInitializer.d.ts +14 -0
  41. package/dist/lib/core/conversationMemoryInitializer.js +127 -0
  42. package/dist/lib/core/conversationMemoryManager.d.ts +3 -2
  43. package/dist/lib/core/conversationMemoryManager.js +4 -3
  44. package/dist/lib/core/factory.js +19 -0
  45. package/dist/lib/core/redisConversationMemoryManager.d.ts +73 -0
  46. package/dist/lib/core/redisConversationMemoryManager.js +483 -0
  47. package/dist/lib/core/types.d.ts +1 -1
  48. package/dist/lib/factories/providerRegistry.js +2 -0
  49. package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +2 -2
  50. package/dist/lib/neurolink.d.ts +15 -9
  51. package/dist/lib/neurolink.js +218 -67
  52. package/dist/lib/providers/amazonBedrock.d.ts +4 -4
  53. package/dist/lib/providers/amazonBedrock.js +2 -2
  54. package/dist/lib/providers/anthropic.d.ts +4 -4
  55. package/dist/lib/providers/anthropic.js +3 -12
  56. package/dist/lib/providers/anthropicBaseProvider.js +1 -2
  57. package/dist/lib/providers/azureOpenai.d.ts +4 -4
  58. package/dist/lib/providers/azureOpenai.js +49 -8
  59. package/dist/lib/providers/googleAiStudio.d.ts +4 -4
  60. package/dist/lib/providers/googleAiStudio.js +2 -2
  61. package/dist/lib/providers/googleVertex.js +2 -2
  62. package/dist/lib/providers/huggingFace.d.ts +4 -4
  63. package/dist/lib/providers/huggingFace.js +1 -2
  64. package/dist/lib/providers/litellm.d.ts +1 -1
  65. package/dist/lib/providers/litellm.js +1 -2
  66. package/dist/lib/providers/mistral.d.ts +4 -4
  67. package/dist/lib/providers/mistral.js +4 -4
  68. package/dist/lib/providers/ollama.js +7 -8
  69. package/dist/lib/providers/openAI.d.ts +4 -4
  70. package/dist/lib/providers/openAI.js +2 -2
  71. package/dist/lib/providers/openaiCompatible.js +5 -2
  72. package/dist/lib/providers/sagemaker/language-model.d.ts +5 -0
  73. package/dist/lib/providers/sagemaker/language-model.js +9 -1
  74. package/dist/lib/session/globalSessionState.d.ts +27 -0
  75. package/dist/lib/session/globalSessionState.js +77 -0
  76. package/dist/lib/types/{conversationTypes.d.ts → conversation.d.ts} +32 -0
  77. package/dist/lib/types/generateTypes.d.ts +1 -1
  78. package/dist/lib/types/streamTypes.d.ts +1 -1
  79. package/dist/lib/utils/conversationMemory.d.ts +22 -0
  80. package/dist/lib/utils/conversationMemory.js +121 -0
  81. package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -1
  82. package/dist/lib/utils/conversationMemoryUtils.js +2 -2
  83. package/dist/lib/utils/messageBuilder.d.ts +1 -1
  84. package/dist/lib/utils/messageBuilder.js +1 -1
  85. package/dist/lib/utils/providerHealth.js +7 -3
  86. package/dist/lib/utils/redis.d.ts +42 -0
  87. package/dist/lib/utils/redis.js +263 -0
  88. package/dist/lib/utils/tokenLimits.d.ts +2 -2
  89. package/dist/lib/utils/tokenLimits.js +10 -3
  90. package/dist/mcp/servers/aiProviders/aiWorkflowTools.js +2 -2
  91. package/dist/neurolink.d.ts +15 -9
  92. package/dist/neurolink.js +218 -67
  93. package/dist/providers/amazonBedrock.d.ts +4 -4
  94. package/dist/providers/amazonBedrock.js +2 -2
  95. package/dist/providers/anthropic.d.ts +4 -4
  96. package/dist/providers/anthropic.js +3 -12
  97. package/dist/providers/anthropicBaseProvider.js +1 -2
  98. package/dist/providers/azureOpenai.d.ts +4 -4
  99. package/dist/providers/azureOpenai.js +49 -8
  100. package/dist/providers/googleAiStudio.d.ts +4 -4
  101. package/dist/providers/googleAiStudio.js +2 -2
  102. package/dist/providers/googleVertex.js +2 -2
  103. package/dist/providers/huggingFace.d.ts +4 -4
  104. package/dist/providers/huggingFace.js +1 -2
  105. package/dist/providers/litellm.d.ts +1 -1
  106. package/dist/providers/litellm.js +1 -2
  107. package/dist/providers/mistral.d.ts +4 -4
  108. package/dist/providers/mistral.js +4 -4
  109. package/dist/providers/ollama.js +7 -8
  110. package/dist/providers/openAI.d.ts +4 -4
  111. package/dist/providers/openAI.js +2 -2
  112. package/dist/providers/openaiCompatible.js +5 -2
  113. package/dist/providers/sagemaker/language-model.d.ts +5 -0
  114. package/dist/providers/sagemaker/language-model.js +9 -1
  115. package/dist/session/globalSessionState.d.ts +27 -0
  116. package/dist/session/globalSessionState.js +77 -0
  117. package/dist/types/{conversationTypes.d.ts → conversation.d.ts} +32 -0
  118. package/dist/types/generateTypes.d.ts +1 -1
  119. package/dist/types/streamTypes.d.ts +1 -1
  120. package/dist/utils/conversationMemory.d.ts +22 -0
  121. package/dist/utils/conversationMemory.js +121 -0
  122. package/dist/utils/conversationMemoryUtils.d.ts +1 -1
  123. package/dist/utils/conversationMemoryUtils.js +2 -2
  124. package/dist/utils/messageBuilder.d.ts +1 -1
  125. package/dist/utils/messageBuilder.js +1 -1
  126. package/dist/utils/providerHealth.js +7 -3
  127. package/dist/utils/redis.d.ts +42 -0
  128. package/dist/utils/redis.js +263 -0
  129. package/dist/utils/tokenLimits.d.ts +2 -2
  130. package/dist/utils/tokenLimits.js +10 -3
  131. package/package.json +3 -1
  132. /package/dist/config/{conversationMemoryConfig.js → conversationMemory.js} +0 -0
  133. /package/dist/lib/config/{conversationMemoryConfig.js → conversationMemory.js} +0 -0
  134. /package/dist/lib/types/{conversationTypes.js → conversation.js} +0 -0
  135. /package/dist/types/{conversationTypes.js → conversation.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [7.34.0](https://github.com/juspay/neurolink/compare/v7.33.4...v7.34.0) (2025-09-09)
2
+
3
+ ### Features
4
+
5
+ - **(cli):** expose memory commands to cli from sdk ([b9eb802](https://github.com/juspay/neurolink/commit/b9eb802c0ecfa521327e0423b5a9167119ac2fca))
6
+ - **(cli):** Implement interactive loop mode ([89b5012](https://github.com/juspay/neurolink/commit/89b5012ff44bac58e01846834d05ea50fe37cd35))
7
+ - **(memory):** Add Redis Support for conversation History ([28e2f86](https://github.com/juspay/neurolink/commit/28e2f86b4aa5b6e43d2bc71a86885cca40851e44))
8
+ - **(tool):** Optimize tool discovery and add conversation tutorial ([56c7a3f](https://github.com/juspay/neurolink/commit/56c7a3fac9713cdd17f3f719f793e41fce39259b))
9
+
10
+ ## [7.33.4](https://github.com/juspay/neurolink/compare/v7.33.3...v7.33.4) (2025-09-04)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **(azure):** resolve provider initialization and streaming issues ([f35114b](https://github.com/juspay/neurolink/commit/f35114bcf29ee23c3b9abefcb99c49f7a0533507))
15
+
1
16
  ## [7.33.3](https://github.com/juspay/neurolink/compare/v7.33.2...v7.33.3) (2025-09-04)
2
17
 
3
18
  ## [7.33.2](https://github.com/juspay/neurolink/compare/v7.33.1...v7.33.2) (2025-09-04)
package/README.md CHANGED
@@ -508,6 +508,43 @@ npx @juspay/neurolink generate "Complex analysis" --provider litellm --model "an
508
508
  npx @juspay/neurolink generate "Write code" # Automatically chooses optimal provider
509
509
  ```
510
510
 
511
+ ## ✨ Interactive Loop Mode
512
+
513
+ NeuroLink features a powerful **interactive loop mode** that transforms the CLI into a persistent, stateful session. This allows you to run multiple commands, set session-wide variables, and maintain conversation history without restarting.
514
+
515
+ ### Start the Loop
516
+
517
+ ```bash
518
+ npx @juspay/neurolink loop
519
+ ```
520
+
521
+ ### Example Session
522
+
523
+ ```bash
524
+ # Start the interactive session
525
+ $ npx @juspay/neurolink loop
526
+
527
+ neurolink » set provider google-ai
528
+ ✓ provider set to google-ai
529
+
530
+ neurolink » set temperature 0.8
531
+ ✓ temperature set to 0.8
532
+
533
+ neurolink » generate "Tell me a fun fact about space"
534
+ The quietest place on Earth is an anechoic chamber at Microsoft's headquarters in Redmond, Washington. The background noise is so low that it's measured in negative decibels, and you can hear your own heartbeat.
535
+
536
+ # Exit the session
537
+ neurolink » exit
538
+ ```
539
+
540
+ ### Conversation Memory in Loop Mode
541
+
542
+ Start the loop with conversation memory to have the AI remember the context of your previous commands.
543
+
544
+ ```bash
545
+ npx @juspay/neurolink loop --enable-conversation-memory
546
+ ```
547
+
511
548
  ## 💻 Essential Examples
512
549
 
513
550
  ### CLI Commands
@@ -238,7 +238,7 @@ declare const ConfigSchema: z.ZodObject<{
238
238
  preferences: z.ZodDefault<z.ZodObject<{
239
239
  outputFormat: z.ZodDefault<z.ZodEnum<["text", "json", "yaml"]>>;
240
240
  temperature: z.ZodDefault<z.ZodNumber>;
241
- maxTokens: z.ZodDefault<z.ZodNumber>;
241
+ maxTokens: z.ZodOptional<z.ZodNumber>;
242
242
  enableLogging: z.ZodDefault<z.ZodBoolean>;
243
243
  enableCaching: z.ZodDefault<z.ZodBoolean>;
244
244
  cacheStrategy: z.ZodDefault<z.ZodEnum<["memory", "file", "redis"]>>;
@@ -246,7 +246,6 @@ declare const ConfigSchema: z.ZodObject<{
246
246
  enableAnalyticsByDefault: z.ZodDefault<z.ZodBoolean>;
247
247
  enableEvaluationByDefault: z.ZodDefault<z.ZodBoolean>;
248
248
  }, "strip", z.ZodTypeAny, {
249
- maxTokens: number;
250
249
  temperature: number;
251
250
  outputFormat: "text" | "json" | "yaml";
252
251
  enableLogging: boolean;
@@ -254,6 +253,7 @@ declare const ConfigSchema: z.ZodObject<{
254
253
  cacheStrategy: "memory" | "redis" | "file";
255
254
  enableAnalyticsByDefault: boolean;
256
255
  enableEvaluationByDefault: boolean;
256
+ maxTokens?: number | undefined;
257
257
  defaultEvaluationDomain?: string | undefined;
258
258
  }, {
259
259
  maxTokens?: number | undefined;
@@ -508,7 +508,6 @@ declare const ConfigSchema: z.ZodObject<{
508
508
  defaultProvider: "openai" | "anthropic" | "vertex" | "google-ai" | "bedrock" | "azure" | "huggingface" | "ollama" | "mistral" | "auto";
509
509
  profiles: Record<string, any>;
510
510
  preferences: {
511
- maxTokens: number;
512
511
  temperature: number;
513
512
  outputFormat: "text" | "json" | "yaml";
514
513
  enableLogging: boolean;
@@ -516,6 +515,7 @@ declare const ConfigSchema: z.ZodObject<{
516
515
  cacheStrategy: "memory" | "redis" | "file";
517
516
  enableAnalyticsByDefault: boolean;
518
517
  enableEvaluationByDefault: boolean;
518
+ maxTokens?: number | undefined;
519
519
  defaultEvaluationDomain?: string | undefined;
520
520
  };
521
521
  domains: {
@@ -713,7 +713,6 @@ export declare class ConfigManager {
713
713
  * Mistral AI provider setup
714
714
  */
715
715
  private setupMistral;
716
- /**
717
716
  /**
718
717
  * Get current configuration
719
718
  */
@@ -110,7 +110,7 @@ const ConfigSchema = z.object({
110
110
  .number()
111
111
  .min(CLI_LIMITS.maxTokens.min)
112
112
  .max(CLI_LIMITS.maxTokens.max)
113
- .default(CLI_LIMITS.maxTokens.default),
113
+ .optional(), // No default limit
114
114
  enableLogging: z.boolean().default(false),
115
115
  enableCaching: z.boolean().default(true),
116
116
  cacheStrategy: z.enum(["memory", "file", "redis"]).default("memory"),
@@ -726,7 +726,6 @@ export class ConfigManager {
726
726
  ]);
727
727
  this.config.providers.mistral = answers;
728
728
  }
729
- /**
730
729
  /**
731
730
  * Get current configuration
732
731
  */
@@ -749,7 +748,7 @@ export class ConfigManager {
749
748
  logger.always(` Default Provider: ${chalk.white(this.config.defaultProvider)}`);
750
749
  logger.always(` Output Format: ${chalk.white(this.config.preferences.outputFormat)}`);
751
750
  logger.always(` Temperature: ${chalk.white(this.config.preferences.temperature)}`);
752
- logger.always(` Max Tokens: ${chalk.white(this.config.preferences.maxTokens)}`);
751
+ logger.always(` Max Tokens: ${chalk.white(this.config.preferences.maxTokens ?? "Provider default (no cap)")}`);
753
752
  logger.always(` Default Evaluation Domain: ${chalk.white(this.config.preferences.defaultEvaluationDomain || "None")}`);
754
753
  logger.always(` Analytics by Default: ${chalk.white(this.config.preferences.enableAnalyticsByDefault)}`);
755
754
  logger.always(` Evaluation by Default: ${chalk.white(this.config.preferences.enableEvaluationByDefault)}`);
@@ -0,0 +1 @@
1
+ export declare function handleError(_error: Error, context: string): void;
@@ -0,0 +1,28 @@
1
+ import chalk from "chalk";
2
+ import { logger } from "../lib/utils/logger.js";
3
+ import { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "../lib/types/errors.js";
4
+ import { globalSession } from "../lib/session/globalSessionState.js";
5
+ export function handleError(_error, context) {
6
+ logger.error(chalk.red(`❌ ${context} failed: ${_error.message}`));
7
+ if (_error instanceof AuthenticationError) {
8
+ logger.error(chalk.yellow("💡 Set Google AI Studio API key (RECOMMENDED): export GOOGLE_AI_API_KEY=AIza-..."));
9
+ logger.error(chalk.yellow("💡 Or set OpenAI API key: export OPENAI_API_KEY=sk-..."));
10
+ logger.error(chalk.yellow("💡 Or set AWS Bedrock credentials: export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... AWS_REGION=us-east-1"));
11
+ logger.error(chalk.yellow("💡 Or set Google Vertex AI credentials: export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json"));
12
+ logger.error(chalk.yellow("💡 Or set Anthropic API key: export ANTHROPIC_API_KEY=sk-ant-..."));
13
+ logger.error(chalk.yellow("💡 Or set Azure OpenAI credentials: export AZURE_OPENAI_API_KEY=... AZURE_OPENAI_ENDPOINT=..."));
14
+ }
15
+ else if (_error instanceof RateLimitError) {
16
+ logger.error(chalk.yellow("💡 Try again in a few moments or use --provider vertex"));
17
+ }
18
+ else if (_error instanceof AuthorizationError) {
19
+ logger.error(chalk.yellow("💡 Check your account permissions for the selected model/service."));
20
+ logger.error(chalk.yellow("💡 For AWS Bedrock, ensure you have permissions for the specific model and consider using inference profile ARNs."));
21
+ }
22
+ else if (_error instanceof NetworkError) {
23
+ logger.error(chalk.yellow("💡 Check your internet connection and the provider's status page."));
24
+ }
25
+ if (!globalSession.getCurrentSessionId()) {
26
+ process.exit(1);
27
+ }
28
+ }
@@ -42,6 +42,10 @@ export declare class CLICommandFactory {
42
42
  * Create discover command
43
43
  */
44
44
  static createDiscoverCommand(): CommandModule;
45
+ /**
46
+ * Create memory commands
47
+ */
48
+ static createMemoryCommands(): CommandModule;
45
49
  /**
46
50
  * Create config commands
47
51
  */
@@ -62,6 +66,13 @@ export declare class CLICommandFactory {
62
66
  * Create SageMaker commands
63
67
  */
64
68
  static createSageMakerCommands(): CommandModule;
69
+ /**
70
+ * Create completion command
71
+ */
72
+ /**
73
+ * Create loop command
74
+ */
75
+ static createLoopCommand(): CommandModule;
65
76
  /**
66
77
  * Create completion command
67
78
  */
@@ -98,6 +109,18 @@ export declare class CLICommandFactory {
98
109
  * Execute get best provider command
99
110
  */
100
111
  private static executeGetBestProvider;
112
+ /**
113
+ * Execute memory stats command
114
+ */
115
+ private static executeMemoryStats;
116
+ /**
117
+ * Execute memory history command
118
+ */
119
+ private static executeMemoryHistory;
120
+ /**
121
+ * Execute memory clear command
122
+ */
123
+ private static executeMemoryClear;
101
124
  /**
102
125
  * Execute completion command
103
126
  */