@juspay/neurolink 7.33.0 → 7.33.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 (151) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/agent/directTools.d.ts +6 -6
  3. package/dist/cli/commands/config.d.ts +68 -68
  4. package/dist/cli/utils/interactiveSetup.d.ts +1 -1
  5. package/dist/cli/utils/interactiveSetup.js +1 -1
  6. package/dist/core/analytics.d.ts +1 -2
  7. package/dist/core/baseProvider.d.ts +1 -1
  8. package/dist/core/baseProvider.js +1 -0
  9. package/dist/core/dynamicModels.d.ts +1 -132
  10. package/dist/core/dynamicModels.js +0 -7
  11. package/dist/core/evaluation.d.ts +1 -39
  12. package/dist/core/evaluationProviders.d.ts +1 -17
  13. package/dist/core/evaluationProviders.js +1 -1
  14. package/dist/core/factory.d.ts +1 -3
  15. package/dist/core/factory.js +0 -1
  16. package/dist/core/modelConfiguration.d.ts +8 -69
  17. package/dist/core/modelConfiguration.js +11 -11
  18. package/dist/core/serviceRegistry.d.ts +1 -8
  19. package/dist/core/streamAnalytics.d.ts +2 -45
  20. package/dist/factories/providerFactory.d.ts +1 -1
  21. package/dist/factories/providerRegistry.js +1 -1
  22. package/dist/index.d.ts +8 -9
  23. package/dist/index.js +1 -1
  24. package/dist/lib/core/analytics.d.ts +1 -2
  25. package/dist/lib/core/baseProvider.d.ts +1 -1
  26. package/dist/lib/core/baseProvider.js +1 -0
  27. package/dist/lib/core/dynamicModels.d.ts +1 -132
  28. package/dist/lib/core/dynamicModels.js +0 -7
  29. package/dist/lib/core/evaluation.d.ts +1 -39
  30. package/dist/lib/core/evaluationProviders.d.ts +1 -17
  31. package/dist/lib/core/evaluationProviders.js +1 -1
  32. package/dist/lib/core/factory.d.ts +1 -3
  33. package/dist/lib/core/factory.js +0 -1
  34. package/dist/lib/core/modelConfiguration.d.ts +8 -69
  35. package/dist/lib/core/modelConfiguration.js +11 -11
  36. package/dist/lib/core/serviceRegistry.d.ts +1 -8
  37. package/dist/lib/core/streamAnalytics.d.ts +2 -45
  38. package/dist/lib/factories/providerFactory.d.ts +1 -1
  39. package/dist/lib/factories/providerRegistry.js +1 -1
  40. package/dist/lib/index.d.ts +5 -6
  41. package/dist/lib/index.js +1 -1
  42. package/dist/lib/models/modelRegistry.d.ts +1 -1
  43. package/dist/lib/models/modelRegistry.js +1 -1
  44. package/dist/lib/models/modelResolver.d.ts +1 -1
  45. package/dist/lib/neurolink.d.ts +1 -1
  46. package/dist/lib/neurolink.js +1 -1
  47. package/dist/lib/providers/amazonBedrock.d.ts +1 -2
  48. package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
  49. package/dist/lib/providers/anthropic.d.ts +1 -1
  50. package/dist/lib/providers/anthropic.js +1 -1
  51. package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
  52. package/dist/lib/providers/anthropicBaseProvider.js +1 -1
  53. package/dist/lib/providers/azureOpenai.d.ts +1 -1
  54. package/dist/lib/providers/googleAiStudio.d.ts +1 -1
  55. package/dist/lib/providers/googleAiStudio.js +1 -1
  56. package/dist/lib/providers/googleVertex.d.ts +1 -1
  57. package/dist/lib/providers/googleVertex.js +1 -1
  58. package/dist/lib/providers/huggingFace.d.ts +1 -1
  59. package/dist/lib/providers/index.d.ts +1 -1
  60. package/dist/lib/providers/litellm.d.ts +1 -1
  61. package/dist/lib/providers/mistral.d.ts +1 -1
  62. package/dist/lib/providers/ollama.d.ts +1 -1
  63. package/dist/lib/providers/ollama.js +1 -1
  64. package/dist/lib/providers/openAI.d.ts +1 -1
  65. package/dist/lib/providers/openAI.js +1 -1
  66. package/dist/lib/providers/openaiCompatible.d.ts +1 -1
  67. package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
  68. package/dist/lib/types/analytics.d.ts +53 -0
  69. package/dist/lib/types/analytics.js +5 -0
  70. package/dist/lib/types/cli.d.ts +1 -1
  71. package/dist/lib/types/evaluation.d.ts +119 -0
  72. package/dist/lib/types/evaluation.js +5 -0
  73. package/dist/lib/types/evaluationProviders.d.ts +104 -0
  74. package/dist/lib/types/evaluationProviders.js +5 -0
  75. package/dist/lib/types/generateTypes.d.ts +89 -18
  76. package/dist/lib/types/index.d.ts +10 -2
  77. package/dist/lib/types/index.js +12 -0
  78. package/dist/lib/types/modelTypes.d.ts +242 -0
  79. package/dist/lib/types/modelTypes.js +30 -0
  80. package/dist/lib/types/providers.d.ts +193 -127
  81. package/dist/lib/types/providers.js +110 -18
  82. package/dist/lib/types/serviceTypes.d.ts +79 -0
  83. package/dist/lib/types/serviceTypes.js +5 -0
  84. package/dist/lib/types/streamTypes.d.ts +101 -21
  85. package/dist/lib/utils/analyticsUtils.d.ts +5 -1
  86. package/dist/lib/utils/analyticsUtils.js +13 -0
  87. package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -1
  88. package/dist/lib/utils/evaluationUtils.d.ts +1 -1
  89. package/dist/lib/utils/factoryProcessing.d.ts +1 -1
  90. package/dist/lib/utils/messageBuilder.d.ts +1 -1
  91. package/dist/lib/utils/providerHealth.d.ts +1 -1
  92. package/dist/lib/utils/providerHealth.js +1 -1
  93. package/dist/lib/utils/providerUtils.d.ts +5 -0
  94. package/dist/lib/utils/providerUtils.js +6 -0
  95. package/dist/models/modelRegistry.d.ts +1 -1
  96. package/dist/models/modelRegistry.js +1 -1
  97. package/dist/models/modelResolver.d.ts +1 -1
  98. package/dist/neurolink.d.ts +1 -1
  99. package/dist/neurolink.js +1 -1
  100. package/dist/providers/amazonBedrock.d.ts +1 -2
  101. package/dist/providers/amazonSagemaker.d.ts +1 -1
  102. package/dist/providers/anthropic.d.ts +1 -1
  103. package/dist/providers/anthropic.js +1 -1
  104. package/dist/providers/anthropicBaseProvider.d.ts +1 -1
  105. package/dist/providers/anthropicBaseProvider.js +1 -1
  106. package/dist/providers/azureOpenai.d.ts +1 -1
  107. package/dist/providers/googleAiStudio.d.ts +1 -1
  108. package/dist/providers/googleAiStudio.js +1 -1
  109. package/dist/providers/googleVertex.d.ts +1 -1
  110. package/dist/providers/googleVertex.js +1 -1
  111. package/dist/providers/huggingFace.d.ts +1 -1
  112. package/dist/providers/index.d.ts +1 -1
  113. package/dist/providers/litellm.d.ts +1 -1
  114. package/dist/providers/mistral.d.ts +1 -1
  115. package/dist/providers/ollama.d.ts +1 -1
  116. package/dist/providers/ollama.js +1 -1
  117. package/dist/providers/openAI.d.ts +1 -1
  118. package/dist/providers/openAI.js +1 -1
  119. package/dist/providers/openaiCompatible.d.ts +1 -1
  120. package/dist/types/analytics.d.ts +53 -0
  121. package/dist/types/analytics.js +5 -0
  122. package/dist/types/cli.d.ts +1 -1
  123. package/dist/types/evaluation.d.ts +119 -0
  124. package/dist/types/evaluation.js +5 -0
  125. package/dist/types/evaluationProviders.d.ts +104 -0
  126. package/dist/types/evaluationProviders.js +5 -0
  127. package/dist/types/generateTypes.d.ts +89 -18
  128. package/dist/types/index.d.ts +10 -2
  129. package/dist/types/index.js +12 -0
  130. package/dist/types/modelTypes.d.ts +242 -0
  131. package/dist/types/modelTypes.js +30 -0
  132. package/dist/types/providers.d.ts +193 -127
  133. package/dist/types/providers.js +110 -18
  134. package/dist/types/serviceTypes.d.ts +79 -0
  135. package/dist/types/serviceTypes.js +5 -0
  136. package/dist/types/streamTypes.d.ts +101 -21
  137. package/dist/utils/analyticsUtils.d.ts +5 -1
  138. package/dist/utils/analyticsUtils.js +13 -0
  139. package/dist/utils/conversationMemoryUtils.d.ts +1 -1
  140. package/dist/utils/evaluationUtils.d.ts +1 -1
  141. package/dist/utils/factoryProcessing.d.ts +1 -1
  142. package/dist/utils/messageBuilder.d.ts +1 -1
  143. package/dist/utils/providerHealth.d.ts +1 -1
  144. package/dist/utils/providerHealth.js +1 -1
  145. package/dist/utils/providerUtils.d.ts +5 -0
  146. package/dist/utils/providerUtils.js +6 -0
  147. package/package.json +1 -1
  148. package/dist/core/types.d.ts +0 -223
  149. package/dist/core/types.js +0 -111
  150. package/dist/lib/core/types.d.ts +0 -223
  151. package/dist/lib/core/types.js +0 -111
@@ -1,26 +1,65 @@
1
1
  import type { Tool } from "ai";
2
2
  import type { ValidationSchema, StandardRecord } from "./typeAliases.js";
3
- import type { AIProviderName, AnalyticsData } from "../core/types.js";
4
- import type { EvaluationData } from "../index.js";
5
- import type { TokenUsage } from "./providers.js";
3
+ import type { AIProviderName, ProviderConfig } from "./providers.js";
4
+ import type { AnalyticsData, TokenUsage } from "./analytics.js";
5
+ import type { EvaluationData } from "./evaluation.js";
6
6
  import type { UnknownRecord, JsonValue } from "./common.js";
7
7
  import type { ChatMessage } from "./conversationTypes.js";
8
- import type { MiddlewareFactoryOptions } from "../types/middlewareTypes.js";
8
+ import type { MiddlewareFactoryOptions } from "./middlewareTypes.js";
9
9
  /**
10
- * Interface for tool execution calls (AI SDK compatible)
10
+ * Progress tracking and metadata for streaming operations
11
11
  */
12
- export interface ToolCall {
12
+ export type StreamingProgressData = {
13
+ chunkCount: number;
14
+ totalBytes: number;
15
+ chunkSize: number;
16
+ elapsedTime: number;
17
+ estimatedRemaining?: number;
18
+ streamId?: string;
19
+ phase: "initializing" | "streaming" | "processing" | "complete" | "error";
20
+ };
21
+ /**
22
+ * Streaming metadata for performance tracking
23
+ */
24
+ export type StreamingMetadata = {
25
+ startTime: number;
26
+ endTime?: number;
27
+ totalDuration?: number;
28
+ averageChunkSize: number;
29
+ maxChunkSize: number;
30
+ minChunkSize: number;
31
+ throughputBytesPerSecond?: number;
32
+ streamingProvider: string;
33
+ modelUsed: string;
34
+ };
35
+ /**
36
+ * Options for AI requests with unified provider configuration
37
+ */
38
+ export type StreamingOptions = {
39
+ providers: ProviderConfig[];
40
+ temperature?: number;
41
+ maxTokens?: number;
42
+ systemPrompt?: string;
43
+ };
44
+ /**
45
+ * Progress callback for streaming operations
46
+ */
47
+ export type ProgressCallback = (progress: StreamingProgressData) => void | Promise<void>;
48
+ /**
49
+ * Type for tool execution calls (AI SDK compatible)
50
+ */
51
+ export type ToolCall = {
13
52
  type?: "tool-call";
14
53
  toolCallId?: string;
15
54
  toolName: string;
16
55
  parameters?: UnknownRecord;
17
56
  args?: UnknownRecord;
18
57
  id?: string;
19
- }
58
+ };
20
59
  /**
21
- * Interface for tool execution results - Enhanced for type safety
60
+ * Type for tool execution results - Enhanced for type safety
22
61
  */
23
- export interface ToolResult {
62
+ export type ToolResult = {
24
63
  toolName: string;
25
64
  status: "success" | "failure";
26
65
  output?: JsonValue;
@@ -34,7 +73,7 @@ export interface ToolResult {
34
73
  toolCategory?: string;
35
74
  isExternal?: boolean;
36
75
  };
37
- }
76
+ };
38
77
  /**
39
78
  * Tool Call Results Array - High Reusability
40
79
  */
@@ -46,7 +85,7 @@ export type ToolCalls = Array<ToolCall>;
46
85
  /**
47
86
  * Stream Analytics Data - Enhanced for performance tracking
48
87
  */
49
- export interface StreamAnalyticsData {
88
+ export type StreamAnalyticsData = {
50
89
  /** Tool execution results with timing */
51
90
  toolResults?: Promise<ToolCallResults>;
52
91
  /** Tool calls made during stream */
@@ -61,9 +100,9 @@ export interface StreamAnalyticsData {
61
100
  };
62
101
  /** Provider analytics */
63
102
  providerAnalytics?: AnalyticsData;
64
- }
103
+ };
65
104
  /**
66
- * Stream function options interface - Primary method for streaming content
105
+ * Stream function options type - Primary method for streaming content
67
106
  * Future-ready for multi-modal capabilities while maintaining text focus
68
107
  */
69
108
  export type PCMEncoding = "PCM16LE";
@@ -79,7 +118,7 @@ export interface AudioChunk {
79
118
  channels: number;
80
119
  encoding: PCMEncoding;
81
120
  }
82
- export interface StreamOptions {
121
+ export type StreamOptions = {
83
122
  input: {
84
123
  text?: string;
85
124
  audio?: AudioInputSpec;
@@ -127,12 +166,12 @@ export interface StreamOptions {
127
166
  };
128
167
  conversationMessages?: ChatMessage[];
129
168
  middleware?: MiddlewareFactoryOptions;
130
- }
169
+ };
131
170
  /**
132
- * Stream function result interface - Primary output format for streaming
171
+ * Stream function result type - Primary output format for streaming
133
172
  * Future-ready for multi-modal outputs while maintaining text focus
134
173
  */
135
- export interface StreamResult {
174
+ export type StreamResult = {
136
175
  stream: AsyncIterable<{
137
176
  content: string;
138
177
  } | {
@@ -155,12 +194,53 @@ export interface StreamResult {
155
194
  };
156
195
  analytics?: AnalyticsData | Promise<AnalyticsData>;
157
196
  evaluation?: EvaluationData | Promise<EvaluationData>;
158
- }
197
+ };
159
198
  /**
160
- * Enhanced provider interface with stream method
199
+ * Enhanced provider type with stream method
161
200
  */
162
- export interface EnhancedStreamProvider {
201
+ export type EnhancedStreamProvider = {
163
202
  stream(options: StreamOptions): Promise<StreamResult>;
164
203
  getName(): string;
165
204
  isAvailable(): Promise<boolean>;
166
- }
205
+ };
206
+ /**
207
+ * Stream text result from AI SDK
208
+ */
209
+ export type StreamTextResult = {
210
+ textStream: AsyncIterable<string>;
211
+ text: Promise<string>;
212
+ usage: Promise<AISDKUsage | undefined>;
213
+ response: Promise<{
214
+ id?: string;
215
+ model?: string;
216
+ timestamp?: number | Date;
217
+ } | undefined>;
218
+ finishReason: Promise<"stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown">;
219
+ toolResults?: Promise<ToolResult[]>;
220
+ toolCalls?: Promise<ToolCall[]>;
221
+ };
222
+ /**
223
+ * Raw usage data from Vercel AI SDK
224
+ */
225
+ export type AISDKUsage = {
226
+ promptTokens: number;
227
+ completionTokens: number;
228
+ totalTokens: number;
229
+ };
230
+ /**
231
+ * Stream analytics collector type
232
+ */
233
+ export type StreamAnalyticsCollector = {
234
+ collectUsage(result: StreamTextResult): Promise<TokenUsage>;
235
+ collectMetadata(result: StreamTextResult): Promise<ResponseMetadata>;
236
+ createAnalytics(provider: string, model: string, result: StreamTextResult, startTime: number, context?: Record<string, unknown>): Promise<AnalyticsData>;
237
+ };
238
+ /**
239
+ * Response metadata from stream
240
+ */
241
+ export type ResponseMetadata = {
242
+ id?: string;
243
+ model?: string;
244
+ timestamp?: number | Date;
245
+ finishReason?: string;
246
+ };
@@ -2,7 +2,7 @@
2
2
  * Analytics utility functions for TokenUsage and AnalyticsData
3
3
  * Provides helper functions to avoid manual field access patterns
4
4
  */
5
- import type { TokenUsage, AnalyticsData } from "../types/providers.js";
5
+ import type { TokenUsage, AnalyticsData } from "../types/index.js";
6
6
  /**
7
7
  * Format token usage as a human-readable string
8
8
  */
@@ -31,3 +31,7 @@ export declare function getAnalyticsSummary(analytics: AnalyticsData): {
31
31
  costPerToken: number | null;
32
32
  requestsPerSecond: number;
33
33
  };
34
+ /**
35
+ * Type guard for token usage
36
+ */
37
+ export declare function isTokenUsage(value: unknown): value is TokenUsage;
@@ -74,3 +74,16 @@ export function getAnalyticsSummary(analytics) {
74
74
  requestsPerSecond,
75
75
  };
76
76
  }
77
+ /**
78
+ * Type guard for token usage
79
+ */
80
+ export function isTokenUsage(value) {
81
+ return (typeof value === "object" &&
82
+ value !== null &&
83
+ "input" in value &&
84
+ "output" in value &&
85
+ "total" in value &&
86
+ typeof value.input === "number" &&
87
+ typeof value.output === "number" &&
88
+ typeof value.total === "number");
89
+ }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { ConversationMemoryConfig, ChatMessage } from "../types/conversationTypes.js";
6
6
  import type { ConversationMemoryManager } from "../core/conversationMemoryManager.js";
7
- import type { TextGenerationOptions, TextGenerationResult } from "../core/types.js";
7
+ import type { TextGenerationOptions, TextGenerationResult } from "../types/index.js";
8
8
  /**
9
9
  * Apply conversation memory defaults to user configuration
10
10
  * Merges user config with environment variables and default values
@@ -3,7 +3,7 @@
3
3
  * Provides helper functions to handle partial evaluation data and ensure
4
4
  * complete EvaluationData objects with safe defaults
5
5
  */
6
- import type { EvaluationData } from "../types/providers.js";
6
+ import type { EvaluationData } from "../types/evaluation.js";
7
7
  /**
8
8
  * Normalize partial EvaluationData into a complete EvaluationData object
9
9
  * with safe defaults for missing required fields
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { GenerateOptions } from "../types/generateTypes.js";
7
7
  import type { StreamOptions } from "../types/streamTypes.js";
8
- import type { TextGenerationOptions } from "../core/types.js";
8
+ import type { TextGenerationOptions } from "../types/index.js";
9
9
  import type { UnknownRecord, JsonValue } from "../types/common.js";
10
10
  import type { StandardRecord } from "../types/typeAliases.js";
11
11
  /**
@@ -3,7 +3,7 @@
3
3
  * Centralized logic for building message arrays from TextGenerationOptions
4
4
  */
5
5
  import type { ChatMessage } from "../types/conversationTypes.js";
6
- import type { TextGenerationOptions } from "../core/types.js";
6
+ import type { TextGenerationOptions } from "../types/index.js";
7
7
  import type { StreamOptions } from "../types/streamTypes.js";
8
8
  /**
9
9
  * Build a properly formatted message array for AI providers
@@ -2,7 +2,7 @@
2
2
  * Provider Health Checking System
3
3
  * Prevents 500 errors by validating provider availability and configuration
4
4
  */
5
- import { AIProviderName } from "../core/types.js";
5
+ import { AIProviderName } from "../types/index.js";
6
6
  export interface ProviderHealthStatus {
7
7
  provider: AIProviderName;
8
8
  isHealthy: boolean;
@@ -3,7 +3,7 @@
3
3
  * Prevents 500 errors by validating provider availability and configuration
4
4
  */
5
5
  import { logger } from "./logger.js";
6
- import { AIProviderName } from "../core/types.js";
6
+ import { AIProviderName } from "../types/index.js";
7
7
  import { basename } from "path";
8
8
  import { createProxyFetch } from "../proxy/proxyFetch.js";
9
9
  export class ProviderHealthChecker {
@@ -1,3 +1,4 @@
1
+ import type { ProviderError } from "../types/index.js";
1
2
  /**
2
3
  * Get the best available provider based on real-time availability checks
3
4
  * Enhanced version consolidated from providerUtils-fixed.ts
@@ -40,3 +41,7 @@ export declare function getAvailableProviders(): string[];
40
41
  * @returns True if provider name is valid
41
42
  */
42
43
  export declare function isValidProvider(provider: string): boolean;
44
+ /**
45
+ * Type guard for provider error
46
+ */
47
+ export declare function isProviderError(error: unknown): error is ProviderError;
@@ -434,3 +434,9 @@ export function getAvailableProviders() {
434
434
  export function isValidProvider(provider) {
435
435
  return getAvailableProviders().includes(provider.toLowerCase());
436
436
  }
437
+ /**
438
+ * Type guard for provider error
439
+ */
440
+ export function isProviderError(error) {
441
+ return error instanceof Error && "provider" in error;
442
+ }
@@ -3,7 +3,7 @@
3
3
  * Provides centralized model data for models command system
4
4
  * Part of Phase 4.1 - Models Command System
5
5
  */
6
- import { AIProviderName } from "../core/types.js";
6
+ import { AIProviderName } from "../types/index.js";
7
7
  import type { JsonValue } from "../types/common.js";
8
8
  /**
9
9
  * Model capabilities interface
@@ -3,7 +3,7 @@
3
3
  * Provides centralized model data for models command system
4
4
  * Part of Phase 4.1 - Models Command System
5
5
  */
6
- import { AIProviderName } from "../core/types.js";
6
+ import { AIProviderName } from "../types/index.js";
7
7
  /**
8
8
  * Comprehensive model registry
9
9
  */
@@ -3,7 +3,7 @@
3
3
  * Provides model resolution, search, and recommendation functionality
4
4
  * Part of Phase 4.1 - Models Command System
5
5
  */
6
- import { AIProviderName } from "../core/types.js";
6
+ import { AIProviderName } from "../types/index.js";
7
7
  import type { JsonValue } from "../types/common.js";
8
8
  import { type ModelInfo, type ModelSearchFilters, type ModelSearchResult, type ModelCapabilities, type UseCaseSuitability } from "./modelRegistry.js";
9
9
  /**
@@ -5,7 +5,7 @@
5
5
  * Enhanced AI provider system with natural MCP tool access.
6
6
  * Uses real MCP infrastructure for tool discovery and execution.
7
7
  */
8
- import type { TextGenerationOptions, TextGenerationResult } from "./core/types.js";
8
+ import type { TextGenerationOptions, TextGenerationResult } from "./types/index.js";
9
9
  import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
10
10
  import type { StreamOptions, StreamResult } from "./types/streamTypes.js";
11
11
  import type { MCPServerInfo, MCPExecutableTool } from "./types/mcpTypes.js";
package/dist/neurolink.js CHANGED
@@ -36,7 +36,7 @@ import { ExternalServerManager } from "./mcp/externalServerManager.js";
36
36
  // Import direct tools server for automatic registration
37
37
  import { directToolsServer } from "./mcp/servers/agent/directToolsServer.js";
38
38
  import { isNonNullObject } from "./utils/typeUtils.js";
39
- // Core types imported from core/types.js
39
+ // Core types imported from "./types/index.js"
40
40
  export class NeuroLink {
41
41
  mcpInitialized = false;
42
42
  emitter = new EventEmitter();
@@ -1,8 +1,7 @@
1
1
  import { BedrockRuntimeClient } from "@aws-sdk/client-bedrock-runtime";
2
2
  import { BaseProvider } from "../core/baseProvider.js";
3
- import type { AIProviderName, EnhancedGenerateResult } from "../core/types.js";
3
+ import type { AIProviderName, EnhancedGenerateResult, TextGenerationOptions } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
- import type { TextGenerationOptions } from "../core/types.js";
6
5
  import type { NeuroLink } from "../neurolink.js";
7
6
  export declare class AmazonBedrockProvider extends BaseProvider {
8
7
  private bedrockClient;
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { ZodType, ZodTypeDef } from "zod";
8
8
  import type { Schema, LanguageModelV1 } from "ai";
9
- import type { AIProviderName } from "../core/types.js";
9
+ import type { AIProviderName } from "../types/index.js";
10
10
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
11
11
  import { BaseProvider } from "../core/baseProvider.js";
12
12
  /**
@@ -1,6 +1,6 @@
1
1
  import { type LanguageModelV1 } from "ai";
2
2
  import type { ValidationSchema } from "../types/typeAliases.js";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { createAnthropic } from "@ai-sdk/anthropic";
2
2
  import { streamText } from "ai";
3
- import { AnthropicModels } from "../core/types.js";
3
+ import { AnthropicModels } from "../types/index.js";
4
4
  import { BaseProvider } from "../core/baseProvider.js";
5
5
  import { logger } from "../utils/logger.js";
6
6
  import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
@@ -1,6 +1,6 @@
1
1
  import type { ZodType, ZodTypeDef } from "zod";
2
2
  import { type Schema, type LanguageModelV1 } from "ai";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { createAnthropic } from "@ai-sdk/anthropic";
2
2
  import { streamText } from "ai";
3
- import { AnthropicModels } from "../core/types.js";
3
+ import { AnthropicModels } from "../types/index.js";
4
4
  import { BaseProvider } from "../core/baseProvider.js";
5
5
  import { logger } from "../utils/logger.js";
6
6
  import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
@@ -1,6 +1,6 @@
1
1
  import { type LanguageModelV1 } from "ai";
2
2
  import { BaseProvider } from "../core/baseProvider.js";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  export declare class AzureOpenAIProvider extends BaseProvider {
6
6
  private apiKey;
@@ -1,6 +1,6 @@
1
1
  import { type Schema, type LanguageModelV1 } from "ai";
2
2
  import type { ZodUnknownSchema } from "../types/typeAliases.js";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { createGoogleGenerativeAI } from "@ai-sdk/google";
2
2
  import { streamText } from "ai";
3
- import { GoogleAIModels } from "../core/types.js";
3
+ import { GoogleAIModels } from "../types/index.js";
4
4
  import { BaseProvider } from "../core/baseProvider.js";
5
5
  import { logger } from "../utils/logger.js";
6
6
  import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
@@ -1,6 +1,6 @@
1
1
  import type { ZodType, ZodTypeDef } from "zod";
2
2
  import { type Schema, type LanguageModelV1, type LanguageModel } from "ai";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1122,7 +1122,7 @@ export class GoogleVertexProvider extends BaseProvider {
1122
1122
  // Cache expired, refresh it with memory management
1123
1123
  GoogleVertexProvider.modelConfigCache.clear();
1124
1124
  const config = ModelConfigurationManager.getInstance();
1125
- const vertexConfig = config.getProviderConfig("google-vertex");
1125
+ const vertexConfig = config.getProviderConfiguration("google-vertex");
1126
1126
  GoogleVertexProvider.modelConfigCache.set(cacheKey, vertexConfig);
1127
1127
  GoogleVertexProvider.modelConfigCacheTime = now;
1128
1128
  }
@@ -1,6 +1,6 @@
1
1
  import type { ZodType, ZodTypeDef } from "zod";
2
2
  import { type Schema, type LanguageModelV1 } from "ai";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -14,7 +14,7 @@ export { HuggingFaceProvider as HuggingFace } from "./huggingFace.js";
14
14
  export { OllamaProvider as Ollama } from "./ollama.js";
15
15
  export { MistralProvider as MistralAI } from "./mistral.js";
16
16
  export { LiteLLMProvider as LiteLLM } from "./litellm.js";
17
- export type { AIProvider } from "../core/types.js";
17
+ export type { AIProvider } from "../types/index.js";
18
18
  /**
19
19
  * Provider registry for dynamic provider instantiation
20
20
  */
@@ -1,6 +1,6 @@
1
1
  import type { ZodType, ZodTypeDef } from "zod";
2
2
  import { type Schema, type LanguageModelV1 } from "ai";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { type LanguageModelV1 } from "ai";
2
2
  import type { ValidationSchema } from "../types/typeAliases.js";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -1,4 +1,4 @@
1
- import type { AIProviderName } from "../core/types.js";
1
+ import type { AIProviderName } from "../types/index.js";
2
2
  import type { LanguageModelV1 } from "ai";
3
3
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
4
4
  import type { ZodUnknownSchema } from "../types/typeAliases.js";
@@ -273,7 +273,7 @@ export class OllamaProvider extends BaseProvider {
273
273
  supportsTools() {
274
274
  const modelName = this.modelName.toLowerCase();
275
275
  // Get tool-capable models from configuration
276
- const ollamaConfig = modelConfig.getProviderConfig("ollama");
276
+ const ollamaConfig = modelConfig.getProviderConfiguration("ollama");
277
277
  const toolCapableModels = ollamaConfig?.modelBehavior?.toolCapableModels || [];
278
278
  // Check if current model matches tool-capable model patterns
279
279
  const isToolCapable = toolCapableModels.some((capableModel) => modelName.includes(capableModel));
@@ -1,6 +1,6 @@
1
1
  import { type LanguageModelV1 } from "ai";
2
2
  import type { ValidationSchema } from "../types/typeAliases.js";
3
- import { AIProviderName } from "../core/types.js";
3
+ import { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  import type { NeuroLink } from "../neurolink.js";
@@ -1,6 +1,6 @@
1
1
  import { createOpenAI } from "@ai-sdk/openai";
2
2
  import { streamText } from "ai";
3
- import { AIProviderName } from "../core/types.js";
3
+ import { AIProviderName } from "../types/index.js";
4
4
  import { BaseProvider } from "../core/baseProvider.js";
5
5
  import { logger } from "../utils/logger.js";
6
6
  import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
@@ -1,6 +1,6 @@
1
1
  import { type Schema, type LanguageModelV1 } from "ai";
2
2
  import type { ZodUnknownSchema } from "../types/typeAliases.js";
3
- import type { AIProviderName } from "../core/types.js";
3
+ import type { AIProviderName } from "../types/index.js";
4
4
  import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
5
5
  import { BaseProvider } from "../core/baseProvider.js";
6
6
  /**
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Analytics-related type definitions for NeuroLink
3
+ * Comprehensive usage tracking, performance metrics, and cost analysis types
4
+ */
5
+ import type { JsonValue, UnknownRecord } from "./common.js";
6
+ /**
7
+ * Token usage information (consolidated from multiple sources)
8
+ */
9
+ export type TokenUsage = {
10
+ input: number;
11
+ output: number;
12
+ total: number;
13
+ };
14
+ /**
15
+ * Error info type for analytics
16
+ */
17
+ export type ErrorInfo = {
18
+ message: string;
19
+ code?: string | number;
20
+ stack?: string;
21
+ details?: UnknownRecord;
22
+ };
23
+ /**
24
+ * Analytics data structure (consolidated from core analytics)
25
+ */
26
+ export type AnalyticsData = {
27
+ provider: string;
28
+ model?: string;
29
+ tokenUsage: TokenUsage;
30
+ requestDuration: number;
31
+ timestamp: string;
32
+ cost?: number;
33
+ context?: JsonValue;
34
+ };
35
+ /**
36
+ * Stream Analytics Data - Enhanced for performance tracking
37
+ */
38
+ export type StreamAnalyticsData = {
39
+ /** Tool execution results with timing */
40
+ toolResults?: Promise<Array<unknown>>;
41
+ /** Tool calls made during stream */
42
+ toolCalls?: Promise<Array<unknown>>;
43
+ /** Stream performance metrics */
44
+ performance?: {
45
+ startTime: number;
46
+ endTime?: number;
47
+ chunkCount: number;
48
+ avgChunkSize: number;
49
+ totalBytes: number;
50
+ };
51
+ /** Provider analytics */
52
+ providerAnalytics?: AnalyticsData;
53
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Analytics-related type definitions for NeuroLink
3
+ * Comprehensive usage tracking, performance metrics, and cost analysis types
4
+ */
5
+ export {};
@@ -2,7 +2,7 @@
2
2
  * CLI-specific type definitions for NeuroLink
3
3
  */
4
4
  import type { UnknownRecord, JsonValue } from "./common.js";
5
- import type { AnalyticsData, TokenUsage } from "./providers.js";
5
+ import type { AnalyticsData, TokenUsage } from "./analytics.js";
6
6
  import type { EvaluationData } from "../index.js";
7
7
  import type { ToolCall, ToolResult } from "./tools.js";
8
8
  /**