@juspay/neurolink 7.13.0 → 7.14.1

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 (132) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +89 -25
  3. package/dist/agent/directTools.d.ts +3 -3
  4. package/dist/agent/directTools.js +1 -1
  5. package/dist/cli/commands/mcp.js +67 -207
  6. package/dist/cli/factories/commandFactory.js +7 -1
  7. package/dist/cli/utils/interactiveSetup.js +1 -1
  8. package/dist/config/conversationMemoryConfig.js +2 -1
  9. package/dist/context/ContextManager.js +15 -4
  10. package/dist/context/config.js +5 -1
  11. package/dist/context/utils.js +1 -1
  12. package/dist/core/baseProvider.d.ts +11 -30
  13. package/dist/core/baseProvider.js +268 -42
  14. package/dist/core/conversationMemoryManager.js +3 -2
  15. package/dist/core/dynamicModels.d.ts +14 -14
  16. package/dist/core/dynamicModels.js +1 -1
  17. package/dist/core/evaluation.js +1 -1
  18. package/dist/core/factory.js +1 -1
  19. package/dist/factories/providerFactory.js +5 -11
  20. package/dist/factories/providerRegistry.js +2 -2
  21. package/dist/index.d.ts +5 -4
  22. package/dist/index.js +1 -1
  23. package/dist/lib/agent/directTools.js +1 -1
  24. package/dist/lib/config/conversationMemoryConfig.js +2 -1
  25. package/dist/lib/context/ContextManager.js +15 -4
  26. package/dist/lib/context/config.js +5 -1
  27. package/dist/lib/context/utils.js +1 -1
  28. package/dist/lib/core/baseProvider.d.ts +11 -30
  29. package/dist/lib/core/baseProvider.js +268 -42
  30. package/dist/lib/core/conversationMemoryManager.js +3 -2
  31. package/dist/lib/core/dynamicModels.js +1 -1
  32. package/dist/lib/core/evaluation.js +1 -1
  33. package/dist/lib/core/factory.js +1 -1
  34. package/dist/lib/factories/providerFactory.js +5 -11
  35. package/dist/lib/factories/providerRegistry.js +2 -2
  36. package/dist/lib/index.d.ts +5 -4
  37. package/dist/lib/index.js +1 -1
  38. package/dist/lib/mcp/externalServerManager.d.ts +148 -0
  39. package/dist/lib/mcp/externalServerManager.js +1038 -0
  40. package/dist/lib/mcp/mcpCircuitBreaker.d.ts +184 -0
  41. package/dist/lib/mcp/mcpCircuitBreaker.js +338 -0
  42. package/dist/lib/mcp/mcpClientFactory.d.ts +105 -0
  43. package/dist/lib/mcp/mcpClientFactory.js +421 -0
  44. package/dist/lib/mcp/toolDiscoveryService.d.ts +193 -0
  45. package/dist/lib/mcp/toolDiscoveryService.js +646 -0
  46. package/dist/lib/mcp/toolRegistry.d.ts +15 -11
  47. package/dist/lib/mcp/toolRegistry.js +118 -55
  48. package/dist/lib/models/modelResolver.js +1 -1
  49. package/dist/lib/neurolink.d.ts +139 -43
  50. package/dist/lib/neurolink.js +604 -174
  51. package/dist/lib/providers/googleVertex.d.ts +7 -1
  52. package/dist/lib/providers/googleVertex.js +34 -7
  53. package/dist/lib/providers/huggingFace.js +1 -1
  54. package/dist/lib/providers/mistral.js +3 -3
  55. package/dist/lib/providers/ollama.js +1 -1
  56. package/dist/lib/providers/openAI.d.ts +3 -2
  57. package/dist/lib/providers/openAI.js +2 -2
  58. package/dist/lib/providers/openaiCompatible.d.ts +1 -1
  59. package/dist/lib/providers/openaiCompatible.js +2 -2
  60. package/dist/lib/providers/sagemaker/config.js +1 -1
  61. package/dist/lib/sdk/toolRegistration.d.ts +4 -13
  62. package/dist/lib/sdk/toolRegistration.js +19 -66
  63. package/dist/lib/types/cli.d.ts +0 -1
  64. package/dist/lib/types/cli.js +0 -1
  65. package/dist/lib/types/common.d.ts +1 -2
  66. package/dist/lib/types/common.js +0 -1
  67. package/dist/lib/types/contextTypes.d.ts +1 -1
  68. package/dist/lib/types/contextTypes.js +3 -3
  69. package/dist/lib/types/externalMcp.d.ts +288 -0
  70. package/dist/lib/types/externalMcp.js +7 -0
  71. package/dist/lib/types/generateTypes.d.ts +0 -1
  72. package/dist/lib/types/index.d.ts +2 -2
  73. package/dist/lib/types/index.js +0 -1
  74. package/dist/lib/types/mcpTypes.d.ts +53 -99
  75. package/dist/lib/types/providers.d.ts +0 -1
  76. package/dist/lib/types/providers.js +0 -1
  77. package/dist/lib/types/tools.d.ts +2 -2
  78. package/dist/lib/types/tools.js +2 -2
  79. package/dist/lib/utils/factoryProcessing.js +1 -1
  80. package/dist/lib/utils/mcpDefaults.d.ts +54 -0
  81. package/dist/lib/utils/mcpDefaults.js +125 -0
  82. package/dist/lib/utils/providerConfig.d.ts +1 -1
  83. package/dist/lib/utils/providerConfig.js +2 -2
  84. package/dist/lib/utils/providerHealth.js +6 -6
  85. package/dist/mcp/externalServerManager.d.ts +148 -0
  86. package/dist/mcp/externalServerManager.js +1038 -0
  87. package/dist/mcp/mcpCircuitBreaker.d.ts +184 -0
  88. package/dist/mcp/mcpCircuitBreaker.js +338 -0
  89. package/dist/mcp/mcpClientFactory.d.ts +105 -0
  90. package/dist/mcp/mcpClientFactory.js +421 -0
  91. package/dist/mcp/toolDiscoveryService.d.ts +193 -0
  92. package/dist/mcp/toolDiscoveryService.js +646 -0
  93. package/dist/mcp/toolRegistry.d.ts +15 -11
  94. package/dist/mcp/toolRegistry.js +118 -55
  95. package/dist/models/modelResolver.js +1 -1
  96. package/dist/neurolink.d.ts +139 -43
  97. package/dist/neurolink.js +604 -174
  98. package/dist/providers/googleVertex.d.ts +7 -1
  99. package/dist/providers/googleVertex.js +34 -7
  100. package/dist/providers/huggingFace.js +1 -1
  101. package/dist/providers/mistral.js +3 -3
  102. package/dist/providers/ollama.js +1 -1
  103. package/dist/providers/openAI.d.ts +3 -2
  104. package/dist/providers/openAI.js +2 -2
  105. package/dist/providers/openaiCompatible.d.ts +1 -1
  106. package/dist/providers/openaiCompatible.js +2 -2
  107. package/dist/providers/sagemaker/config.js +1 -1
  108. package/dist/sdk/toolRegistration.d.ts +4 -13
  109. package/dist/sdk/toolRegistration.js +19 -66
  110. package/dist/types/cli.d.ts +0 -1
  111. package/dist/types/cli.js +0 -1
  112. package/dist/types/common.d.ts +1 -2
  113. package/dist/types/common.js +0 -1
  114. package/dist/types/contextTypes.d.ts +1 -1
  115. package/dist/types/contextTypes.js +3 -3
  116. package/dist/types/externalMcp.d.ts +288 -0
  117. package/dist/types/externalMcp.js +7 -0
  118. package/dist/types/generateTypes.d.ts +0 -1
  119. package/dist/types/index.d.ts +2 -2
  120. package/dist/types/index.js +0 -1
  121. package/dist/types/mcpTypes.d.ts +53 -99
  122. package/dist/types/providers.d.ts +0 -1
  123. package/dist/types/providers.js +0 -1
  124. package/dist/types/tools.d.ts +2 -2
  125. package/dist/types/tools.js +2 -2
  126. package/dist/utils/factoryProcessing.js +1 -1
  127. package/dist/utils/mcpDefaults.d.ts +54 -0
  128. package/dist/utils/mcpDefaults.js +125 -0
  129. package/dist/utils/providerConfig.d.ts +1 -1
  130. package/dist/utils/providerConfig.js +2 -2
  131. package/dist/utils/providerHealth.js +6 -6
  132. package/package.json +1 -1
@@ -25,7 +25,7 @@ export declare class GoogleVertexProvider extends BaseProvider {
25
25
  private static readonly MAX_CACHE_SIZE;
26
26
  private static maxTokensCache;
27
27
  private static maxTokensCacheTime;
28
- constructor(modelName?: string, sdk?: unknown);
28
+ constructor(modelName?: string, providerName?: string, sdk?: unknown);
29
29
  protected getProviderName(): AIProviderName;
30
30
  protected getDefaultModel(): string;
31
31
  /**
@@ -90,6 +90,12 @@ export declare class GoogleVertexProvider extends BaseProvider {
90
90
  * @returns The current tool execution context
91
91
  */
92
92
  getToolContext(): Record<string, unknown>;
93
+ /**
94
+ * Set the tool executor function for custom tool execution
95
+ * This method is called by BaseProvider.setupToolExecutor()
96
+ * @param executor Function to execute tools by name
97
+ */
98
+ setToolExecutor(executor: (toolName: string, params: unknown) => Promise<unknown>): void;
93
99
  /**
94
100
  * Clear all static caches - useful for testing and memory cleanup
95
101
  * Public method to allow external cache management
@@ -125,7 +125,7 @@ export class GoogleVertexProvider extends BaseProvider {
125
125
  // Memory-managed cache for maxTokens handling decisions to optimize streaming performance
126
126
  static maxTokensCache = new Map();
127
127
  static maxTokensCacheTime = 0;
128
- constructor(modelName, sdk) {
128
+ constructor(modelName, providerName, sdk) {
129
129
  super(modelName, "vertex", sdk);
130
130
  // Validate Google Cloud credentials - now using consolidated utility
131
131
  if (!hasGoogleCredentials()) {
@@ -198,6 +198,14 @@ export class GoogleVertexProvider extends BaseProvider {
198
198
  hasSchema: !!analysisSchema,
199
199
  });
200
200
  const model = await this.getModel();
201
+ // Get all available tools (direct + MCP + external) for streaming
202
+ const shouldUseTools = !options.disableTools && this.supportsTools();
203
+ const tools = shouldUseTools ? await this.getAllTools() : {};
204
+ logger.debug(`${functionTag}: Tools for streaming`, {
205
+ shouldUseTools,
206
+ toolCount: Object.keys(tools).length,
207
+ toolNames: Object.keys(tools),
208
+ });
201
209
  // Model-specific maxTokens handling
202
210
  const modelName = this.modelName || getDefaultVertexModel();
203
211
  // Use cached model configuration to determine maxTokens handling for streaming performance
@@ -206,18 +214,19 @@ export class GoogleVertexProvider extends BaseProvider {
206
214
  const maxTokens = shouldSetMaxTokens
207
215
  ? options.maxTokens || DEFAULT_MAX_TOKENS
208
216
  : undefined;
209
- // Get tools consistently with generate method (using BaseProvider pattern)
210
- const shouldUseTools = !options.disableTools && this.supportsTools();
211
- const tools = shouldUseTools ? await this.getAllTools() : {};
212
217
  // Build complete stream options with proper typing
213
218
  let streamOptions = {
214
219
  model: model,
215
220
  messages: messages,
216
221
  temperature: options.temperature,
217
222
  ...(maxTokens && { maxTokens }),
218
- tools,
219
- maxSteps: options.maxSteps || DEFAULT_MAX_STEPS,
220
- toolChoice: shouldUseTools ? "auto" : "none",
223
+ // Add tools support for streaming
224
+ ...(shouldUseTools &&
225
+ Object.keys(tools).length > 0 && {
226
+ tools,
227
+ toolChoice: "auto",
228
+ maxSteps: options.maxSteps || DEFAULT_MAX_STEPS,
229
+ }),
221
230
  abortSignal: timeoutController?.controller.signal,
222
231
  onError: (event) => {
223
232
  const error = event.error;
@@ -258,10 +267,17 @@ export class GoogleVertexProvider extends BaseProvider {
258
267
  timeoutController?.cleanup();
259
268
  // Transform string stream to content object stream using BaseProvider method
260
269
  const transformedStream = this.createTextStream(result);
270
+ // Track tool calls and results for streaming
271
+ const toolCalls = [];
272
+ const toolResults = [];
261
273
  return {
262
274
  stream: transformedStream,
263
275
  provider: this.providerName,
264
276
  model: this.modelName,
277
+ ...(shouldUseTools && {
278
+ toolCalls,
279
+ toolResults,
280
+ }),
265
281
  };
266
282
  }
267
283
  catch (error) {
@@ -488,6 +504,17 @@ export class GoogleVertexProvider extends BaseProvider {
488
504
  getToolContext() {
489
505
  return { ...this.toolContext };
490
506
  }
507
+ /**
508
+ * Set the tool executor function for custom tool execution
509
+ * This method is called by BaseProvider.setupToolExecutor()
510
+ * @param executor Function to execute tools by name
511
+ */
512
+ setToolExecutor(executor) {
513
+ this.toolExecutor = executor;
514
+ logger.debug("GoogleVertexProvider.setToolExecutor: Tool executor set", {
515
+ hasExecutor: typeof executor === "function",
516
+ });
517
+ }
491
518
  /**
492
519
  * Clear all static caches - useful for testing and memory cleanup
493
520
  * Public method to allow external cache management
@@ -87,7 +87,7 @@ export class HuggingFaceProvider extends BaseProvider {
87
87
  "openchat",
88
88
  "wizardcoder",
89
89
  ];
90
- // Check if current model matches any tool-capable model patterns
90
+ // Check if current model matches tool-capable model patterns
91
91
  const isToolCapable = toolCapableModels.some((capableModel) => modelName.includes(capableModel));
92
92
  if (isToolCapable) {
93
93
  logger.debug("HuggingFace tool calling enabled", {
@@ -21,11 +21,11 @@ const getDefaultMistralModel = () => {
21
21
  export class MistralProvider extends BaseProvider {
22
22
  model;
23
23
  constructor(modelName, sdk) {
24
- // Type guard for NeuroLinkSDK parameter validation
25
- const validatedSdk = sdk && typeof sdk === "object" && "getInMemoryServers" in sdk
24
+ // Type guard for NeuroLink parameter validation
25
+ const validatedNeurolink = sdk && typeof sdk === "object" && "getInMemoryServers" in sdk
26
26
  ? sdk
27
27
  : undefined;
28
- super(modelName, "mistral", validatedSdk);
28
+ super(modelName, "mistral", validatedNeurolink);
29
29
  // Initialize Mistral model with API key validation
30
30
  const apiKey = getMistralApiKey();
31
31
  const mistral = createMistral({
@@ -270,7 +270,7 @@ export class OllamaProvider extends BaseProvider {
270
270
  // Get tool-capable models from configuration
271
271
  const ollamaConfig = modelConfig.getProviderConfig("ollama");
272
272
  const toolCapableModels = ollamaConfig?.modelBehavior?.toolCapableModels || [];
273
- // Check if current model matches any tool-capable model patterns
273
+ // Check if current model matches tool-capable model patterns
274
274
  const isToolCapable = toolCapableModels.some((capableModel) => modelName.includes(capableModel));
275
275
  if (isToolCapable) {
276
276
  logger.debug("Ollama tool calling enabled", {
@@ -2,14 +2,15 @@ import type { ZodType, ZodTypeDef } from "zod";
2
2
  import { type Schema, type LanguageModelV1 } from "ai";
3
3
  import { AIProviderName } from "../core/types.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
- import { BaseProvider, type NeuroLinkSDK } from "../core/baseProvider.js";
5
+ import { BaseProvider } from "../core/baseProvider.js";
6
+ import type { NeuroLink } from "../neurolink.js";
6
7
  /**
7
8
  * OpenAI Provider v2 - BaseProvider Implementation
8
9
  * Migrated to use factory pattern with exact Google AI provider pattern
9
10
  */
10
11
  export declare class OpenAIProvider extends BaseProvider {
11
12
  private model;
12
- constructor(modelName?: string, sdk?: NeuroLinkSDK);
13
+ constructor(modelName?: string, neurolink?: NeuroLink);
13
14
  protected getProviderName(): AIProviderName;
14
15
  protected getDefaultModel(): string;
15
16
  /**
@@ -21,8 +21,8 @@ const getOpenAIModel = () => {
21
21
  */
22
22
  export class OpenAIProvider extends BaseProvider {
23
23
  model;
24
- constructor(modelName, sdk) {
25
- super(modelName || getOpenAIModel(), AIProviderName.OPENAI, sdk);
24
+ constructor(modelName, neurolink) {
25
+ super(modelName || getOpenAIModel(), AIProviderName.OPENAI, neurolink);
26
26
  // Set OpenAI API key as environment variable (required by @ai-sdk/openai)
27
27
  process.env.OPENAI_API_KEY = getOpenAIApiKey();
28
28
  // Initialize model
@@ -5,7 +5,7 @@ import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
7
7
  * OpenAI Compatible Provider - BaseProvider Implementation
8
- * Provides access to any OpenAI-compatible endpoint (OpenRouter, vLLM, LiteLLM, etc.)
8
+ * Provides access to one of the OpenAI-compatible endpoint (OpenRouter, vLLM, LiteLLM, etc.)
9
9
  */
10
10
  export declare class OpenAICompatibleProvider extends BaseProvider {
11
11
  private model?;
@@ -35,7 +35,7 @@ const getDefaultOpenAICompatibleModel = () => {
35
35
  };
36
36
  /**
37
37
  * OpenAI Compatible Provider - BaseProvider Implementation
38
- * Provides access to any OpenAI-compatible endpoint (OpenRouter, vLLM, LiteLLM, etc.)
38
+ * Provides access to one of the OpenAI-compatible endpoint (OpenRouter, vLLM, LiteLLM, etc.)
39
39
  */
40
40
  export class OpenAICompatibleProvider extends BaseProvider {
41
41
  model;
@@ -47,7 +47,7 @@ export class OpenAICompatibleProvider extends BaseProvider {
47
47
  // Initialize OpenAI Compatible configuration
48
48
  this.config = getOpenAICompatibleConfig();
49
49
  // Create OpenAI SDK instance configured for custom endpoint
50
- // This allows us to use any OpenAI-compatible API by simply changing the baseURL
50
+ // This allows us to use OpenAI-compatible API by simply changing the baseURL
51
51
  this.customOpenAI = createOpenAI({
52
52
  baseURL: this.config.baseURL,
53
53
  apiKey: this.config.apiKey,
@@ -168,7 +168,7 @@ function checkAccessKeyPresence(accessKeyId) {
168
168
  if (!accessKeyId || accessKeyId.trim() === "") {
169
169
  return { isValid: false };
170
170
  }
171
- // Accept any non-empty string - let AWS handle validation
171
+ // Accept non-empty string - let AWS handle validation
172
172
  // This prevents attackers from learning about valid formats
173
173
  return { isValid: true };
174
174
  }
@@ -3,9 +3,8 @@
3
3
  * Simple interface for developers to register custom tools
4
4
  */
5
5
  import { z } from "zod";
6
- import type { Tool } from "ai";
7
6
  import { logger } from "../utils/logger.js";
8
- import type { InMemoryMCPServerConfig, InMemoryToolInfo } from "../types/mcpTypes.js";
7
+ import type { MCPServerInfo, MCPServerCategory } from "../types/mcpTypes.js";
9
8
  import type { ToolArgs, ToolContext as CoreToolContext, ToolResult, SimpleTool as CoreSimpleTool } from "../types/tools.js";
10
9
  import type { JsonValue } from "../types/common.js";
11
10
  /**
@@ -76,24 +75,16 @@ export interface SimpleTool<TArgs = ToolArgs, TResult = JsonValue> extends Omit<
76
75
  };
77
76
  }
78
77
  /**
79
- * Converts a SimpleTool to Vercel AI SDK format
80
- */
81
- export declare function convertToAISDKTool(name: string, simpleTool: SimpleTool): Tool;
82
- /**
83
- * Converts a SimpleTool to MCP tool format
84
- */
85
- export declare function convertToMCPTool(simpleTool: SimpleTool): InMemoryToolInfo;
86
- /**
87
- * Creates an in-memory MCP server configuration from a set of tools
78
+ * Creates a MCPServerInfo from a set of tools
88
79
  */
89
80
  export declare function createMCPServerFromTools(serverId: string, tools: Record<string, SimpleTool>, metadata?: {
90
81
  title?: string;
91
82
  description?: string;
92
- category?: string;
83
+ category?: MCPServerCategory;
93
84
  version?: string;
94
85
  author?: string;
95
86
  [key: string]: JsonValue | undefined;
96
- }): InMemoryMCPServerConfig;
87
+ }): MCPServerInfo;
97
88
  /**
98
89
  * Helper to create a tool with type safety
99
90
  */
@@ -2,9 +2,8 @@
2
2
  * NeuroLink SDK Tool Registration API
3
3
  * Simple interface for developers to register custom tools
4
4
  */
5
- import { z } from "zod";
6
- import { tool as createAISDKTool } from "ai";
7
5
  import { logger } from "../utils/logger.js";
6
+ import { createMCPServerInfo } from "../utils/mcpDefaults.js";
8
7
  /**
9
8
  * Configuration constants for tool validation
10
9
  */
@@ -65,75 +64,29 @@ const VALIDATION_CONFIG = {
65
64
  ].map((pattern) => new RegExp(pattern.replace(/_/g, "[_-]"), "i")),
66
65
  };
67
66
  /**
68
- * Converts a SimpleTool to Vercel AI SDK format
69
- */
70
- export function convertToAISDKTool(name, simpleTool) {
71
- return createAISDKTool({
72
- description: simpleTool.description,
73
- parameters: simpleTool.parameters || z.object({}),
74
- execute: async (args) => {
75
- try {
76
- // Create a minimal context for standalone execution
77
- const context = {
78
- sessionId: `tool-${name}-${Date.now()}`,
79
- logger,
80
- };
81
- const result = await simpleTool.execute(args, context);
82
- return result;
83
- }
84
- catch (error) {
85
- logger.error(`Tool ${name} execution failed:`, error);
86
- throw error;
87
- }
88
- },
89
- });
90
- }
91
- /**
92
- * Converts a SimpleTool to MCP tool format
93
- */
94
- export function convertToMCPTool(simpleTool) {
95
- return {
96
- description: simpleTool.description,
97
- execute: async (params) => {
98
- const typedParams = params;
99
- try {
100
- const result = await simpleTool.execute(typedParams);
101
- return {
102
- success: true,
103
- data: result,
104
- };
105
- }
106
- catch (error) {
107
- const errorMessage = error instanceof Error ? error.message : String(error);
108
- logger.error("MCP tool execution failed:", error);
109
- return {
110
- success: false,
111
- error: errorMessage,
112
- };
113
- }
114
- },
115
- inputSchema: simpleTool.parameters,
116
- isImplemented: true,
117
- metadata: simpleTool.metadata,
118
- };
119
- }
120
- /**
121
- * Creates an in-memory MCP server configuration from a set of tools
67
+ * Creates a MCPServerInfo from a set of tools
122
68
  */
123
69
  export function createMCPServerFromTools(serverId, tools, metadata) {
124
- const mcpTools = {};
70
+ const mcpTools = [];
125
71
  for (const [name, tool] of Object.entries(tools)) {
126
- mcpTools[name] = convertToMCPTool(tool);
72
+ mcpTools.push({
73
+ name,
74
+ description: tool.description || name,
75
+ inputSchema: {},
76
+ });
127
77
  }
128
- return {
129
- server: {
130
- title: metadata?.title || serverId,
131
- description: metadata?.description,
132
- tools: mcpTools,
133
- },
78
+ // SMART DEFAULTS: Use utility to eliminate manual MCPServerInfo creation
79
+ return createMCPServerInfo({
80
+ id: serverId,
81
+ name: metadata?.title || serverId,
82
+ tools: mcpTools,
83
+ description: metadata?.description || serverId,
134
84
  category: metadata?.category,
135
- metadata: metadata || {},
136
- };
85
+ // Detect category based on context if not provided
86
+ isExternal: metadata?.category === "external",
87
+ isBuiltIn: metadata?.category === "built-in",
88
+ isCustomTool: false,
89
+ });
137
90
  }
138
91
  /**
139
92
  * Helper to create a tool with type safety
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * CLI-specific type definitions for NeuroLink
3
- * Replaces 'any' types in CLI commands and arguments
4
3
  */
5
4
  import type { UnknownRecord, JsonValue } from "./common.js";
6
5
  import type { AnalyticsData, EvaluationData, TokenUsage } from "./providers.js";
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * CLI-specific type definitions for NeuroLink
3
- * Replaces 'any' types in CLI commands and arguments
4
3
  */
5
4
  /**
6
5
  * Type guard for generate result
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * Common utility types for NeuroLink
3
- * These types provide type-safe alternatives to 'any' usage
4
3
  */
5
4
  /**
6
- * Type-safe unknown value - use instead of 'any' when type is truly unknown
5
+ * Type-safe unknown value - use when type is truly unknown
7
6
  */
8
7
  export type Unknown = unknown;
9
8
  /**
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Common utility types for NeuroLink
3
- * These types provide type-safe alternatives to 'any' usage
4
3
  */
5
4
  /**
6
5
  * Type guard to check if value is Error
@@ -162,7 +162,7 @@ export declare class ContextConverter {
162
162
  */
163
163
  static convertBusinessContext(legacyContext: Record<string, unknown>, domainType: string, options?: ContextConversionOptions): ExecutionContext;
164
164
  /**
165
- * Create execution context for any domain
165
+ * Create execution context for required domain
166
166
  */
167
167
  static createDomainContext(domainType: string, domainData: Record<string, unknown>, sessionInfo?: {
168
168
  sessionId?: string;
@@ -327,7 +327,7 @@ export class ContextConverter {
327
327
  projectId: legacyContext.projectId,
328
328
  }
329
329
  : {}),
330
- // Include any additional custom data
330
+ // Include all additional custom data
331
331
  ...this.extractCustomData(legacyContext),
332
332
  },
333
333
  },
@@ -342,7 +342,7 @@ export class ContextConverter {
342
342
  };
343
343
  }
344
344
  /**
345
- * Create execution context for any domain
345
+ * Create execution context for required domain
346
346
  */
347
347
  static createDomainContext(domainType, domainData, sessionInfo = {}) {
348
348
  return {
@@ -385,7 +385,7 @@ export class ContextConverter {
385
385
  ...(config.additionalFields || []),
386
386
  ]);
387
387
  }
388
- // Remove any fields that should be included despite being in the exclude list
388
+ // Remove filtered fields that should be included despite being in the exclude list
389
389
  if (config.includeFields) {
390
390
  config.includeFields.forEach((field) => fieldsToExclude.delete(field));
391
391
  }