@juspay/neurolink 7.42.0 → 7.43.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 +6 -0
- package/dist/cli/factories/commandFactory.js +42 -17
- package/dist/lib/utils/conversationMemoryUtils.d.ts +4 -0
- package/dist/lib/utils/conversationMemoryUtils.js +46 -0
- package/dist/utils/conversationMemoryUtils.d.ts +4 -0
- package/dist/utils/conversationMemoryUtils.js +46 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [7.43.0](https://github.com/juspay/neurolink/compare/v7.42.0...v7.43.0) (2025-09-23)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **(cli):** auto-detect and enable redis support in loop conversation memory ([b7b5514](https://github.com/juspay/neurolink/commit/b7b55149eb49a9f0ffa2a257c96d869b0da59eeb))
|
|
6
|
+
|
|
1
7
|
## [7.42.0](https://github.com/juspay/neurolink/compare/v7.41.4...v7.42.0) (2025-09-23)
|
|
2
8
|
|
|
3
9
|
### Features
|
|
@@ -15,6 +15,7 @@ import chalk from "chalk";
|
|
|
15
15
|
import { logger } from "../../lib/utils/logger.js";
|
|
16
16
|
import fs from "fs";
|
|
17
17
|
import { handleSetup } from "../commands/setup.js";
|
|
18
|
+
import { checkRedisAvailability } from "../../lib/utils/conversationMemoryUtils.js";
|
|
18
19
|
/**
|
|
19
20
|
* CLI Command Factory for generate commands
|
|
20
21
|
*/
|
|
@@ -151,7 +152,7 @@ export class CLICommandFactory {
|
|
|
151
152
|
quiet: {
|
|
152
153
|
type: "boolean",
|
|
153
154
|
alias: "q",
|
|
154
|
-
default:
|
|
155
|
+
default: true,
|
|
155
156
|
description: "Suppress non-essential output",
|
|
156
157
|
},
|
|
157
158
|
noColor: {
|
|
@@ -674,22 +675,29 @@ export class CLICommandFactory {
|
|
|
674
675
|
return {
|
|
675
676
|
command: "loop",
|
|
676
677
|
describe: "Start an interactive loop session",
|
|
677
|
-
builder: (yargs) => yargs
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
678
|
+
builder: (yargs) => this.buildOptions(yargs, {
|
|
679
|
+
"enable-conversation-memory": {
|
|
680
|
+
type: "boolean",
|
|
681
|
+
description: "Enable conversation memory for the loop session",
|
|
682
|
+
default: true,
|
|
683
|
+
},
|
|
684
|
+
"max-sessions": {
|
|
685
|
+
type: "number",
|
|
686
|
+
description: "Maximum number of conversation sessions to keep",
|
|
687
|
+
default: 50,
|
|
688
|
+
},
|
|
689
|
+
"max-turns-per-session": {
|
|
690
|
+
type: "number",
|
|
691
|
+
description: "Maximum turns per conversation session",
|
|
692
|
+
default: 20,
|
|
693
|
+
},
|
|
694
|
+
"auto-redis": {
|
|
695
|
+
type: "boolean",
|
|
696
|
+
description: "Automatically use Redis if available",
|
|
697
|
+
default: true,
|
|
698
|
+
},
|
|
692
699
|
})
|
|
700
|
+
.example("$0 loop --no-auto-redis", "Start loop with memory storage only")
|
|
693
701
|
.example("$0 loop", "Start interactive session")
|
|
694
702
|
.example("$0 loop --enable-conversation-memory", "Start loop with memory"),
|
|
695
703
|
handler: async (argv) => {
|
|
@@ -698,8 +706,25 @@ export class CLICommandFactory {
|
|
|
698
706
|
return;
|
|
699
707
|
}
|
|
700
708
|
let conversationMemoryConfig;
|
|
701
|
-
const { enableConversationMemory, maxSessions, maxTurnsPerSession } = argv;
|
|
709
|
+
const { enableConversationMemory, maxSessions, maxTurnsPerSession, autoRedis, } = argv;
|
|
702
710
|
if (enableConversationMemory) {
|
|
711
|
+
let storageType = "memory";
|
|
712
|
+
if (autoRedis) {
|
|
713
|
+
const isRedisAvailable = await checkRedisAvailability();
|
|
714
|
+
if (isRedisAvailable) {
|
|
715
|
+
storageType = "redis";
|
|
716
|
+
if (!argv.quiet) {
|
|
717
|
+
logger.always(chalk.green("✅ Using Redis for persistent conversation memory"));
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
else if (argv.debug) {
|
|
721
|
+
logger.debug("Redis not available, using in-memory storage");
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
else if (argv.debug) {
|
|
725
|
+
logger.debug("Auto-Redis disabled, using in-memory storage");
|
|
726
|
+
}
|
|
727
|
+
process.env.STORAGE_TYPE = storageType;
|
|
703
728
|
conversationMemoryConfig = {
|
|
704
729
|
enabled: true,
|
|
705
730
|
maxSessions: maxSessions,
|
|
@@ -19,3 +19,7 @@ export declare function getConversationMessages(conversationMemory: Conversation
|
|
|
19
19
|
* Saves user messages and AI responses for conversation memory
|
|
20
20
|
*/
|
|
21
21
|
export declare function storeConversationTurn(conversationMemory: ConversationMemoryManager | undefined, originalOptions: TextGenerationOptions, result: TextGenerationResult): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if Redis is available for conversation memory
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkRedisAvailability(): Promise<boolean>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getConversationMemoryDefaults } from "../config/conversationMemory.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
+
import { createRedisClient, getNormalizedConfig } from "./redis.js";
|
|
7
8
|
/**
|
|
8
9
|
* Apply conversation memory defaults to user configuration
|
|
9
10
|
* Merges user config with environment variables and default values
|
|
@@ -74,3 +75,48 @@ export async function storeConversationTurn(conversationMemory, originalOptions,
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if Redis is available for conversation memory
|
|
80
|
+
*/
|
|
81
|
+
export async function checkRedisAvailability() {
|
|
82
|
+
let testClient = null;
|
|
83
|
+
try {
|
|
84
|
+
const testConfig = getNormalizedConfig({
|
|
85
|
+
host: process.env.REDIS_HOST,
|
|
86
|
+
port: process.env.REDIS_PORT ? Number(process.env.REDIS_PORT) : undefined,
|
|
87
|
+
password: process.env.REDIS_PASSWORD,
|
|
88
|
+
db: process.env.REDIS_DB ? Number(process.env.REDIS_DB) : undefined,
|
|
89
|
+
keyPrefix: process.env.REDIS_KEY_PREFIX,
|
|
90
|
+
ttl: process.env.REDIS_TTL ? Number(process.env.REDIS_TTL) : undefined,
|
|
91
|
+
connectionOptions: {
|
|
92
|
+
connectTimeout: 5000,
|
|
93
|
+
maxRetriesPerRequest: 1,
|
|
94
|
+
retryDelayOnFailover: 100,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
// Test Redis connection
|
|
98
|
+
testClient = await createRedisClient(testConfig);
|
|
99
|
+
await testClient.ping();
|
|
100
|
+
logger.debug("Redis connection test successful");
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
logger.debug("Redis connection test failed", {
|
|
105
|
+
error: error instanceof Error ? error.message : String(error),
|
|
106
|
+
});
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
if (testClient) {
|
|
111
|
+
try {
|
|
112
|
+
await testClient.quit();
|
|
113
|
+
logger.debug("Redis test client disconnected successfully");
|
|
114
|
+
}
|
|
115
|
+
catch (quitError) {
|
|
116
|
+
logger.debug("Error during Redis test client disconnect", {
|
|
117
|
+
error: quitError instanceof Error ? quitError.message : String(quitError),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -19,3 +19,7 @@ export declare function getConversationMessages(conversationMemory: Conversation
|
|
|
19
19
|
* Saves user messages and AI responses for conversation memory
|
|
20
20
|
*/
|
|
21
21
|
export declare function storeConversationTurn(conversationMemory: ConversationMemoryManager | undefined, originalOptions: TextGenerationOptions, result: TextGenerationResult): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if Redis is available for conversation memory
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkRedisAvailability(): Promise<boolean>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getConversationMemoryDefaults } from "../config/conversationMemory.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
+
import { createRedisClient, getNormalizedConfig } from "./redis.js";
|
|
7
8
|
/**
|
|
8
9
|
* Apply conversation memory defaults to user configuration
|
|
9
10
|
* Merges user config with environment variables and default values
|
|
@@ -74,3 +75,48 @@ export async function storeConversationTurn(conversationMemory, originalOptions,
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if Redis is available for conversation memory
|
|
80
|
+
*/
|
|
81
|
+
export async function checkRedisAvailability() {
|
|
82
|
+
let testClient = null;
|
|
83
|
+
try {
|
|
84
|
+
const testConfig = getNormalizedConfig({
|
|
85
|
+
host: process.env.REDIS_HOST,
|
|
86
|
+
port: process.env.REDIS_PORT ? Number(process.env.REDIS_PORT) : undefined,
|
|
87
|
+
password: process.env.REDIS_PASSWORD,
|
|
88
|
+
db: process.env.REDIS_DB ? Number(process.env.REDIS_DB) : undefined,
|
|
89
|
+
keyPrefix: process.env.REDIS_KEY_PREFIX,
|
|
90
|
+
ttl: process.env.REDIS_TTL ? Number(process.env.REDIS_TTL) : undefined,
|
|
91
|
+
connectionOptions: {
|
|
92
|
+
connectTimeout: 5000,
|
|
93
|
+
maxRetriesPerRequest: 1,
|
|
94
|
+
retryDelayOnFailover: 100,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
// Test Redis connection
|
|
98
|
+
testClient = await createRedisClient(testConfig);
|
|
99
|
+
await testClient.ping();
|
|
100
|
+
logger.debug("Redis connection test successful");
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
logger.debug("Redis connection test failed", {
|
|
105
|
+
error: error instanceof Error ? error.message : String(error),
|
|
106
|
+
});
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
if (testClient) {
|
|
111
|
+
try {
|
|
112
|
+
await testClient.quit();
|
|
113
|
+
logger.debug("Redis test client disconnected successfully");
|
|
114
|
+
}
|
|
115
|
+
catch (quitError) {
|
|
116
|
+
logger.debug("Error during Redis test client disconnect", {
|
|
117
|
+
error: quitError instanceof Error ? quitError.message : String(quitError),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.43.0",
|
|
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 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Juspay Technologies",
|