@juspay/neurolink 7.37.0 → 7.38.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 +12 -0
- package/dist/cli/commands/config.d.ts +18 -18
- package/dist/cli/factories/commandFactory.d.ts +24 -0
- package/dist/cli/factories/commandFactory.js +297 -245
- package/dist/core/baseProvider.d.ts +44 -3
- package/dist/core/baseProvider.js +729 -352
- package/dist/core/constants.d.ts +2 -30
- package/dist/core/constants.js +15 -43
- package/dist/core/redisConversationMemoryManager.d.ts +98 -15
- package/dist/core/redisConversationMemoryManager.js +665 -203
- package/dist/factories/providerFactory.js +23 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/lib/core/baseProvider.d.ts +44 -3
- package/dist/lib/core/baseProvider.js +729 -352
- package/dist/lib/core/constants.d.ts +2 -30
- package/dist/lib/core/constants.js +15 -43
- package/dist/lib/core/redisConversationMemoryManager.d.ts +98 -15
- package/dist/lib/core/redisConversationMemoryManager.js +665 -203
- package/dist/lib/factories/providerFactory.js +23 -6
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/index.js +4 -3
- package/dist/lib/mcp/externalServerManager.js +2 -2
- package/dist/lib/mcp/registry.js +2 -2
- package/dist/lib/mcp/servers/agent/directToolsServer.js +19 -10
- package/dist/lib/mcp/toolRegistry.js +4 -8
- package/dist/lib/neurolink.d.ts +95 -28
- package/dist/lib/neurolink.js +479 -719
- package/dist/lib/providers/amazonBedrock.js +2 -2
- package/dist/lib/providers/anthropic.js +8 -0
- package/dist/lib/providers/anthropicBaseProvider.js +8 -0
- package/dist/lib/providers/azureOpenai.js +8 -0
- package/dist/lib/providers/googleAiStudio.js +8 -0
- package/dist/lib/providers/googleVertex.d.ts +3 -23
- package/dist/lib/providers/googleVertex.js +24 -342
- package/dist/lib/providers/huggingFace.js +8 -0
- package/dist/lib/providers/litellm.js +8 -0
- package/dist/lib/providers/mistral.js +8 -0
- package/dist/lib/providers/openAI.d.ts +23 -0
- package/dist/lib/providers/openAI.js +323 -6
- package/dist/lib/providers/openaiCompatible.js +8 -0
- package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/lib/sdk/toolRegistration.js +18 -1
- package/dist/lib/types/common.d.ts +98 -0
- package/dist/lib/types/conversation.d.ts +52 -2
- package/dist/lib/types/streamTypes.d.ts +13 -6
- package/dist/lib/types/typeAliases.d.ts +3 -2
- package/dist/lib/utils/conversationMemory.js +3 -1
- package/dist/lib/utils/messageBuilder.d.ts +10 -2
- package/dist/lib/utils/messageBuilder.js +22 -1
- package/dist/lib/utils/parameterValidation.js +6 -25
- package/dist/lib/utils/promptRedaction.js +4 -4
- package/dist/lib/utils/redis.d.ts +10 -6
- package/dist/lib/utils/redis.js +71 -70
- package/dist/lib/utils/schemaConversion.d.ts +14 -0
- package/dist/lib/utils/schemaConversion.js +140 -0
- package/dist/lib/utils/transformationUtils.js +143 -5
- package/dist/mcp/externalServerManager.js +2 -2
- package/dist/mcp/registry.js +2 -2
- package/dist/mcp/servers/agent/directToolsServer.js +19 -10
- package/dist/mcp/toolRegistry.js +4 -8
- package/dist/neurolink.d.ts +95 -28
- package/dist/neurolink.js +479 -719
- package/dist/providers/amazonBedrock.js +2 -2
- package/dist/providers/anthropic.js +8 -0
- package/dist/providers/anthropicBaseProvider.js +8 -0
- package/dist/providers/azureOpenai.js +8 -0
- package/dist/providers/googleAiStudio.js +8 -0
- package/dist/providers/googleVertex.d.ts +3 -23
- package/dist/providers/googleVertex.js +24 -342
- package/dist/providers/huggingFace.js +8 -0
- package/dist/providers/litellm.js +8 -0
- package/dist/providers/mistral.js +8 -0
- package/dist/providers/openAI.d.ts +23 -0
- package/dist/providers/openAI.js +323 -6
- package/dist/providers/openaiCompatible.js +8 -0
- package/dist/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/sdk/toolRegistration.js +18 -1
- package/dist/types/common.d.ts +98 -0
- package/dist/types/conversation.d.ts +52 -2
- package/dist/types/streamTypes.d.ts +13 -6
- package/dist/types/typeAliases.d.ts +3 -2
- package/dist/utils/conversationMemory.js +3 -1
- package/dist/utils/messageBuilder.d.ts +10 -2
- package/dist/utils/messageBuilder.js +22 -1
- package/dist/utils/parameterValidation.js +6 -25
- package/dist/utils/promptRedaction.js +4 -4
- package/dist/utils/redis.d.ts +10 -6
- package/dist/utils/redis.js +71 -70
- package/dist/utils/schemaConversion.d.ts +14 -0
- package/dist/utils/schemaConversion.js +140 -0
- package/dist/utils/transformationUtils.js +143 -5
- package/package.json +3 -2
@@ -2,6 +2,7 @@
|
|
2
2
|
* Object Transformation Utilities
|
3
3
|
* Centralizes repeated object transformation patterns to improve code reuse and maintainability
|
4
4
|
*/
|
5
|
+
import { logger } from "./logger.js";
|
5
6
|
// ============================================================================
|
6
7
|
// TOOL EXECUTION TRANSFORMATIONS
|
7
8
|
// ============================================================================
|
@@ -43,22 +44,109 @@ export function transformToolExecutions(toolExecutions) {
|
|
43
44
|
if (!toolName) {
|
44
45
|
toolName = `tool_execution_${index}`;
|
45
46
|
}
|
47
|
+
// Enhanced tool parameter extraction with structured logging
|
48
|
+
const parameterExtractionData = {
|
49
|
+
executionIndex: index,
|
50
|
+
toolNameExtracted: toolName,
|
51
|
+
primarySources: {
|
52
|
+
hasInput: !!teRecord.input,
|
53
|
+
hasParameters: !!teRecord.parameters,
|
54
|
+
hasArgs: !!teRecord.args,
|
55
|
+
inputType: typeof teRecord.input,
|
56
|
+
parametersType: typeof teRecord.parameters,
|
57
|
+
argsType: typeof teRecord.args,
|
58
|
+
},
|
59
|
+
rawRecordKeys: Object.keys(teRecord),
|
60
|
+
};
|
61
|
+
logger.debug("[TransformationUtils] Tool parameter extraction analysis", parameterExtractionData);
|
46
62
|
// Enhanced input extraction
|
47
63
|
let input = teRecord.input ||
|
48
64
|
teRecord.parameters ||
|
49
65
|
teRecord.args ||
|
50
66
|
{};
|
67
|
+
const primaryExtractionResult = {
|
68
|
+
keysCount: Object.keys(input).length,
|
69
|
+
keys: Object.keys(input),
|
70
|
+
extractionSuccessful: Object.keys(input).length > 0,
|
71
|
+
extractionSource: teRecord.input
|
72
|
+
? "input"
|
73
|
+
: teRecord.parameters
|
74
|
+
? "parameters"
|
75
|
+
: teRecord.args
|
76
|
+
? "args"
|
77
|
+
: "empty",
|
78
|
+
};
|
79
|
+
logger.debug("[TransformationUtils] Primary parameter extraction result", primaryExtractionResult);
|
51
80
|
// Extract input from nested toolCall if available
|
52
81
|
if (Object.keys(input).length === 0 &&
|
53
82
|
teRecord.toolCall &&
|
54
83
|
typeof teRecord.toolCall === "object") {
|
55
84
|
const toolCall = teRecord.toolCall;
|
85
|
+
const nestedExtractionData = {
|
86
|
+
reason: "Primary extraction failed, checking nested toolCall",
|
87
|
+
nestedSources: {
|
88
|
+
hasInput: !!toolCall.input,
|
89
|
+
hasParameters: !!toolCall.parameters,
|
90
|
+
hasArgs: !!toolCall.args,
|
91
|
+
},
|
92
|
+
toolCallKeys: Object.keys(toolCall),
|
93
|
+
};
|
94
|
+
logger.debug("[TransformationUtils] Nested parameter extraction attempt", nestedExtractionData);
|
56
95
|
input =
|
57
96
|
toolCall.input ||
|
58
97
|
toolCall.parameters ||
|
59
98
|
toolCall.args ||
|
60
99
|
{};
|
100
|
+
const nestedExtractionResult = {
|
101
|
+
keysCount: Object.keys(input).length,
|
102
|
+
keys: Object.keys(input),
|
103
|
+
extractionSuccessful: Object.keys(input).length > 0,
|
104
|
+
extractionSource: toolCall.input
|
105
|
+
? "toolCall.input"
|
106
|
+
: toolCall.parameters
|
107
|
+
? "toolCall.parameters"
|
108
|
+
: toolCall.args
|
109
|
+
? "toolCall.args"
|
110
|
+
: "empty",
|
111
|
+
};
|
112
|
+
logger.debug("[TransformationUtils] Nested parameter extraction result", nestedExtractionResult);
|
113
|
+
}
|
114
|
+
// Target tool parameter analysis for critical tools
|
115
|
+
if (toolName &&
|
116
|
+
(toolName.includes("SuccessRateSRByTime") ||
|
117
|
+
toolName.includes("juspay-analytics"))) {
|
118
|
+
const targetToolAnalysis = {
|
119
|
+
toolName,
|
120
|
+
inputKeys: Object.keys(input),
|
121
|
+
keysCount: Object.keys(input).length,
|
122
|
+
hasStartTime: "startTime" in input,
|
123
|
+
hasEndTime: "endTime" in input,
|
124
|
+
startTimeValue: input.startTime || "MISSING",
|
125
|
+
endTimeValue: input.endTime || "MISSING",
|
126
|
+
extractionStatus: Object.keys(input).length === 0 ? "FAILED" : "SUCCESS",
|
127
|
+
};
|
128
|
+
logger.debug("[TransformationUtils] Target tool parameter analysis", targetToolAnalysis);
|
129
|
+
if (Object.keys(input).length === 0) {
|
130
|
+
logger.error("[TransformationUtils] Critical: Target tool parameter extraction failed", {
|
131
|
+
toolName,
|
132
|
+
reason: "Both primary and nested extraction returned empty parameters",
|
133
|
+
impact: "AI response did not contain expected parameter structure",
|
134
|
+
});
|
135
|
+
}
|
61
136
|
}
|
137
|
+
// Final parameter extraction summary
|
138
|
+
const finalExtractionSummary = {
|
139
|
+
toolName,
|
140
|
+
inputKeysCount: Object.keys(input).length,
|
141
|
+
inputKeys: Object.keys(input),
|
142
|
+
hasParameters: Object.keys(input).length > 0,
|
143
|
+
duration: teRecord.duration ??
|
144
|
+
teRecord.executionTime ??
|
145
|
+
teRecord.responseTime ??
|
146
|
+
0,
|
147
|
+
hasOutput: !!(teRecord.output || teRecord.result || teRecord.response),
|
148
|
+
};
|
149
|
+
logger.debug("[TransformationUtils] Final parameter extraction result", finalExtractionSummary);
|
62
150
|
// Enhanced output extraction with success indication
|
63
151
|
const output = teRecord.output ||
|
64
152
|
teRecord.result ||
|
@@ -169,14 +257,61 @@ export function transformAvailableTools(availableTools) {
|
|
169
257
|
}
|
170
258
|
return availableTools.map((tool) => {
|
171
259
|
const toolRecord = tool;
|
260
|
+
let extractedParameters = {};
|
261
|
+
const inputSchema = toolRecord.inputSchema;
|
262
|
+
const directParameters = toolRecord.parameters;
|
263
|
+
const fallbackSchema = toolRecord.schema;
|
264
|
+
if (inputSchema && typeof inputSchema === "object") {
|
265
|
+
if (inputSchema.$ref && inputSchema.definitions) {
|
266
|
+
const definitions = inputSchema.definitions;
|
267
|
+
const refValue = inputSchema.$ref;
|
268
|
+
if (typeof refValue === "string") {
|
269
|
+
const refKey = refValue.replace("#/definitions/", "");
|
270
|
+
if (definitions[refKey] && typeof definitions[refKey] === "object") {
|
271
|
+
const resolvedSchema = definitions[refKey];
|
272
|
+
extractedParameters = {
|
273
|
+
type: resolvedSchema.type || "object",
|
274
|
+
properties: resolvedSchema.properties || {},
|
275
|
+
required: resolvedSchema.required || [],
|
276
|
+
...resolvedSchema, // Include all schema metadata
|
277
|
+
};
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
else if (inputSchema.properties) {
|
282
|
+
extractedParameters = {
|
283
|
+
type: inputSchema.type || "object",
|
284
|
+
properties: inputSchema.properties,
|
285
|
+
required: inputSchema.required || [],
|
286
|
+
...inputSchema,
|
287
|
+
};
|
288
|
+
}
|
289
|
+
else if (inputSchema.type === "object") {
|
290
|
+
extractedParameters = inputSchema;
|
291
|
+
}
|
292
|
+
else {
|
293
|
+
extractedParameters = inputSchema;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
else if (directParameters && typeof directParameters === "object") {
|
297
|
+
extractedParameters = directParameters;
|
298
|
+
}
|
299
|
+
else if (fallbackSchema && typeof fallbackSchema === "object") {
|
300
|
+
extractedParameters = fallbackSchema;
|
301
|
+
}
|
302
|
+
if (!extractedParameters || typeof extractedParameters !== "object") {
|
303
|
+
extractedParameters = {};
|
304
|
+
}
|
305
|
+
if (extractedParameters &&
|
306
|
+
!extractedParameters.type &&
|
307
|
+
extractedParameters.properties) {
|
308
|
+
extractedParameters.type = "object";
|
309
|
+
}
|
172
310
|
return {
|
173
311
|
name: tool.name || "",
|
174
312
|
description: tool.description || "",
|
175
313
|
server: tool.server || "",
|
176
|
-
parameters:
|
177
|
-
toolRecord.parameters ||
|
178
|
-
toolRecord.schema ||
|
179
|
-
{},
|
314
|
+
parameters: extractedParameters,
|
180
315
|
};
|
181
316
|
});
|
182
317
|
}
|
@@ -246,7 +381,10 @@ export function transformSchemaToParameterDescription(schema) {
|
|
246
381
|
.map(([key, value]) => {
|
247
382
|
const typedValue = value;
|
248
383
|
const required = requiredParams.has(key) ? " (required)" : "";
|
249
|
-
|
384
|
+
const description = typedValue.description
|
385
|
+
? ` - ${typedValue.description}`
|
386
|
+
: "";
|
387
|
+
return ` - ${key}: ${typedValue.type || "unknown"}${required}${description}`;
|
250
388
|
})
|
251
389
|
.join("\n");
|
252
390
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@juspay/neurolink",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.38.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",
|
@@ -174,6 +174,7 @@
|
|
174
174
|
"chalk": "^5.3.0",
|
175
175
|
"dotenv": "^16.5.0",
|
176
176
|
"inquirer": "^9.2.15",
|
177
|
+
"json-schema-to-zod": "^2.6.1",
|
177
178
|
"mathjs": "^14.5.3",
|
178
179
|
"nanoid": "^5.1.5",
|
179
180
|
"ollama-ai-provider": "^1.2.0",
|
@@ -186,7 +187,7 @@
|
|
186
187
|
"ws": "^8.18.3",
|
187
188
|
"yargs": "^17.7.2",
|
188
189
|
"zod": "^3.22.0",
|
189
|
-
"zod-to-json-schema": "^3.24.
|
190
|
+
"zod-to-json-schema": "^3.24.6"
|
190
191
|
},
|
191
192
|
"devDependencies": {
|
192
193
|
"@biomejs/biome": "^2.1.4",
|