@juspay/neurolink 8.28.0 → 8.30.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/README.md +23 -2
- package/dist/adapters/video/vertexVideoHandler.d.ts +12 -2
- package/dist/adapters/video/vertexVideoHandler.js +12 -2
- package/dist/core/baseProvider.d.ts +19 -0
- package/dist/core/baseProvider.js +174 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -1
- package/dist/lib/adapters/video/vertexVideoHandler.d.ts +12 -2
- package/dist/lib/adapters/video/vertexVideoHandler.js +12 -2
- package/dist/lib/core/baseProvider.d.ts +19 -0
- package/dist/lib/core/baseProvider.js +174 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +7 -1
- package/dist/lib/mcp/auth/index.d.ts +6 -0
- package/dist/lib/mcp/auth/index.js +12 -0
- package/dist/lib/mcp/auth/oauthClientProvider.d.ts +93 -0
- package/dist/lib/mcp/auth/oauthClientProvider.js +326 -0
- package/dist/lib/mcp/auth/tokenStorage.d.ts +56 -0
- package/dist/lib/mcp/auth/tokenStorage.js +135 -0
- package/dist/lib/mcp/externalServerManager.d.ts +5 -1
- package/dist/lib/mcp/externalServerManager.js +84 -22
- package/dist/lib/mcp/httpRateLimiter.d.ts +152 -0
- package/dist/lib/mcp/httpRateLimiter.js +365 -0
- package/dist/lib/mcp/httpRetryHandler.d.ts +62 -0
- package/dist/lib/mcp/httpRetryHandler.js +154 -0
- package/dist/lib/mcp/index.d.ts +5 -0
- package/dist/lib/mcp/index.js +8 -0
- package/dist/lib/mcp/mcpClientFactory.d.ts +25 -2
- package/dist/lib/mcp/mcpClientFactory.js +206 -10
- package/dist/lib/mcp/toolRegistry.d.ts +1 -2
- package/dist/lib/mcp/toolRegistry.js +1 -5
- package/dist/lib/neurolink.js +3 -0
- package/dist/lib/providers/amazonBedrock.js +4 -1
- package/dist/lib/providers/ollama.js +4 -1
- package/dist/lib/sdk/toolRegistration.d.ts +3 -25
- package/dist/lib/types/cli.d.ts +42 -42
- package/dist/lib/types/externalMcp.d.ts +55 -3
- package/dist/lib/types/externalMcp.js +0 -1
- package/dist/lib/types/generateTypes.d.ts +37 -0
- package/dist/lib/types/hitlTypes.d.ts +38 -0
- package/dist/lib/types/index.d.ts +6 -8
- package/dist/lib/types/index.js +4 -4
- package/dist/lib/types/mcpTypes.d.ts +235 -27
- package/dist/lib/types/providers.d.ts +16 -16
- package/dist/lib/types/sdkTypes.d.ts +2 -2
- package/dist/lib/types/tools.d.ts +42 -3
- package/dist/lib/types/utilities.d.ts +19 -0
- package/dist/mcp/auth/index.d.ts +6 -0
- package/dist/mcp/auth/index.js +11 -0
- package/dist/mcp/auth/oauthClientProvider.d.ts +93 -0
- package/dist/mcp/auth/oauthClientProvider.js +325 -0
- package/dist/mcp/auth/tokenStorage.d.ts +56 -0
- package/dist/mcp/auth/tokenStorage.js +134 -0
- package/dist/mcp/externalServerManager.d.ts +5 -1
- package/dist/mcp/externalServerManager.js +84 -22
- package/dist/mcp/httpRateLimiter.d.ts +152 -0
- package/dist/mcp/httpRateLimiter.js +364 -0
- package/dist/mcp/httpRetryHandler.d.ts +62 -0
- package/dist/mcp/httpRetryHandler.js +153 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/mcpClientFactory.d.ts +25 -2
- package/dist/mcp/mcpClientFactory.js +206 -10
- package/dist/mcp/toolRegistry.d.ts +1 -2
- package/dist/mcp/toolRegistry.js +1 -5
- package/dist/neurolink.js +3 -0
- package/dist/providers/amazonBedrock.js +4 -1
- package/dist/providers/ollama.js +4 -1
- package/dist/sdk/toolRegistration.d.ts +3 -25
- package/dist/types/cli.d.ts +42 -42
- package/dist/types/externalMcp.d.ts +55 -3
- package/dist/types/externalMcp.js +0 -1
- package/dist/types/generateTypes.d.ts +37 -0
- package/dist/types/hitlTypes.d.ts +38 -0
- package/dist/types/index.d.ts +6 -8
- package/dist/types/index.js +4 -4
- package/dist/types/mcpTypes.d.ts +235 -27
- package/dist/types/providers.d.ts +16 -16
- package/dist/types/sdkTypes.d.ts +2 -2
- package/dist/types/tools.d.ts +42 -3
- package/dist/types/utilities.d.ts +19 -0
- package/package.json +2 -1
|
@@ -385,11 +385,26 @@ export type FactoryEnhancedProvider = EnhancedProvider & {
|
|
|
385
385
|
};
|
|
386
386
|
/**
|
|
387
387
|
* Text generation options type (consolidated from core types)
|
|
388
|
+
* Extended to support video generation mode
|
|
388
389
|
*/
|
|
389
390
|
export type TextGenerationOptions = {
|
|
390
391
|
prompt?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Alternative input format for multimodal SDK operations.
|
|
394
|
+
*
|
|
395
|
+
* NOTE: This field is only used by the higher-level `generate()` API
|
|
396
|
+
* (NeuroLink.generate, BaseProvider.generate). Legacy `generateText()`
|
|
397
|
+
* callers must still use the `prompt` field directly.
|
|
398
|
+
*
|
|
399
|
+
* Supports text, images, and other multimodal inputs.
|
|
400
|
+
*/
|
|
391
401
|
input?: {
|
|
392
402
|
text: string;
|
|
403
|
+
/**
|
|
404
|
+
* Images to include in the request.
|
|
405
|
+
* For video generation, the first image is used as the source frame.
|
|
406
|
+
*/
|
|
407
|
+
images?: Array<Buffer | string | import("./content.js").ImageWithAltText>;
|
|
393
408
|
};
|
|
394
409
|
provider?: AIProviderName;
|
|
395
410
|
model?: string;
|
|
@@ -398,8 +413,29 @@ export type TextGenerationOptions = {
|
|
|
398
413
|
maxTokens?: number;
|
|
399
414
|
systemPrompt?: string;
|
|
400
415
|
schema?: ZodUnknownSchema | Schema<unknown>;
|
|
416
|
+
/**
|
|
417
|
+
* Output configuration options
|
|
418
|
+
*
|
|
419
|
+
* @example Video generation
|
|
420
|
+
* ```typescript
|
|
421
|
+
* output: {
|
|
422
|
+
* mode: "video",
|
|
423
|
+
* video: { resolution: "1080p", length: 8 }
|
|
424
|
+
* }
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
401
427
|
output?: {
|
|
402
428
|
format?: "text" | "structured" | "json";
|
|
429
|
+
/**
|
|
430
|
+
* Output mode - determines the type of content generated
|
|
431
|
+
* - "text": Standard text generation (default)
|
|
432
|
+
* - "video": Video generation using models like Veo 3.1
|
|
433
|
+
*/
|
|
434
|
+
mode?: "text" | "video";
|
|
435
|
+
/**
|
|
436
|
+
* Video generation configuration (used when mode is "video")
|
|
437
|
+
*/
|
|
438
|
+
video?: VideoOutputOptions;
|
|
403
439
|
};
|
|
404
440
|
tools?: Record<string, Tool>;
|
|
405
441
|
timeout?: number | string;
|
|
@@ -570,6 +606,7 @@ export type TextGenerationResult = {
|
|
|
570
606
|
analytics?: AnalyticsData;
|
|
571
607
|
evaluation?: EvaluationData;
|
|
572
608
|
audio?: TTSResult;
|
|
609
|
+
video?: VideoGenerationResult;
|
|
573
610
|
};
|
|
574
611
|
/**
|
|
575
612
|
* Enhanced result type with optional analytics/evaluation
|
|
@@ -194,3 +194,41 @@ export type HITLStatistics = {
|
|
|
194
194
|
/** Number of timed out requests */
|
|
195
195
|
timedOutRequests: number;
|
|
196
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* HITLManager type
|
|
199
|
+
* Defines the public contract for HITL manager implementations.
|
|
200
|
+
* Used for type annotations when referencing HITLManager instances.
|
|
201
|
+
*/
|
|
202
|
+
export type HITLManager = {
|
|
203
|
+
/** Check if HITL is currently enabled */
|
|
204
|
+
isEnabled(): boolean;
|
|
205
|
+
/** Check if a tool requires confirmation based on configuration */
|
|
206
|
+
requiresConfirmation(toolName: string, args?: unknown): boolean;
|
|
207
|
+
/** Request confirmation for a tool execution */
|
|
208
|
+
requestConfirmation(toolName: string, arguments_: unknown, context?: {
|
|
209
|
+
serverId?: string;
|
|
210
|
+
sessionId?: string;
|
|
211
|
+
userId?: string;
|
|
212
|
+
}): Promise<ConfirmationResult>;
|
|
213
|
+
/** Process user response to confirmation request */
|
|
214
|
+
processUserResponse(confirmationId: string, response: {
|
|
215
|
+
approved: boolean;
|
|
216
|
+
reason?: string;
|
|
217
|
+
modifiedArguments?: unknown;
|
|
218
|
+
responseTime?: number;
|
|
219
|
+
userId?: string;
|
|
220
|
+
}): void;
|
|
221
|
+
/** Get current HITL usage statistics */
|
|
222
|
+
getStatistics(): HITLStatistics;
|
|
223
|
+
/** Get current configuration */
|
|
224
|
+
getConfig(): HITLConfig;
|
|
225
|
+
/** Update configuration dynamically */
|
|
226
|
+
updateConfig(newConfig: Partial<HITLConfig>): void;
|
|
227
|
+
/** Clean up resources and reject pending confirmations */
|
|
228
|
+
cleanup(): void;
|
|
229
|
+
/** Get count of pending confirmations */
|
|
230
|
+
getPendingCount(): number;
|
|
231
|
+
/** EventEmitter methods for HITL events */
|
|
232
|
+
on(event: string, listener: (...args: unknown[]) => void): HITLManager;
|
|
233
|
+
emit(event: string, ...args: unknown[]): boolean;
|
|
234
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,20 +9,17 @@ export * from "./providers.js";
|
|
|
9
9
|
export * from "./cli.js";
|
|
10
10
|
export * from "./taskClassificationTypes.js";
|
|
11
11
|
export type { NeuroLinkConfig, PerformanceConfig, CacheConfig, FallbackConfig, RetryConfig, AnalyticsConfig, ToolConfig, BackupInfo, BackupMetadata, ConfigValidationResult, ConfigUpdateOptions, } from "./configTypes.js";
|
|
12
|
-
export type {
|
|
13
|
-
export type { ToolArgs, ToolContext, ToolResult, ToolDefinition, SimpleTool, AvailableTool, ToolInfo, ToolExecution, ToolExecutionResult, ValidationResult, ExecutionContext, CacheOptions, FallbackOptions, } from "./tools.js";
|
|
14
|
-
export type { AISDKModel, ProviderError, AIModelProviderConfig, OpenRouterConfig, OpenRouterModelInfo, OpenRouterModelsResponse, OpenRouterProviderCache, } from "./providers.js";
|
|
15
|
-
export type { BaseCommandArgs, GenerateCommandArgs, MCPCommandArgs, ModelsCommandArgs, CommandResult, GenerateResult, StreamChunk, } from "./cli.js";
|
|
16
|
-
export type { TaskType, TaskClassification, ClassificationScores, ClassificationStats, ClassificationValidation, } from "./taskClassificationTypes.js";
|
|
17
|
-
export type { MCPTransportType, MCPServerConnectionStatus, MCPServerCategory, MCPServerStatus, MCPDiscoveredServer, MCPConnectedServer, MCPToolInfo, MCPExecutableTool, MCPServerMetadata, MCPToolMetadata, MCPServerRegistryEntry, NeuroLinkMCPTool, NeuroLinkMCPServer, NeuroLinkExecutionContext, MCPServerConfig, DiscoveredMcp, McpMetadata, ToolDiscoveryResult, ExternalToolExecutionOptions, ToolValidationResult, ToolRegistryEvents, CircuitBreakerState, CircuitBreakerConfig, CircuitBreakerStats, CircuitBreakerEvents, McpRegistry, MCPClientResult, FlexibleValidationResult, } from "./mcpTypes.js";
|
|
12
|
+
export type { MCPTransportType, MCPServerConnectionStatus, MCPServerCategory, MCPServerStatus, MCPDiscoveredServer, MCPConnectedServer, MCPToolInfo, MCPExecutableTool, MCPServerMetadata, MCPToolMetadata, MCPServerRegistryEntry, NeuroLinkMCPTool, NeuroLinkMCPServer, NeuroLinkExecutionContext, MCPServerConfig, DiscoveredMcp, McpMetadata, ToolDiscoveryResult, ExternalToolExecutionOptions, ToolValidationResult, ToolRegistryEvents, CircuitBreakerState, CircuitBreakerConfig, CircuitBreakerStats, CircuitBreakerEvents, McpRegistry, MCPClientResult, FlexibleValidationResult, OAuthTokens, TokenStorage, MCPOAuthConfig, OAuthClientInformation, AuthorizationUrlResult, TokenExchangeRequest, TokenBucketRateLimitConfig, RateLimitConfig, HTTPRetryConfig, } from "./mcpTypes.js";
|
|
18
13
|
export type { ExternalMCPServerInstance, ExternalMCPServerStatus, ExternalMCPToolInfo, ExternalMCPServerHealth, ExternalMCPConfigValidation, ExternalMCPOperationResult, ExternalMCPToolContext, ExternalMCPToolResult, ExternalMCPServerEvents, ExternalMCPManagerConfig, } from "./externalMcp.js";
|
|
19
14
|
export type { ModelCapability, ModelUseCase, ModelFilter, ModelResolutionContext, ModelStats, ModelPricing, } from "./providers.js";
|
|
20
15
|
export type { DomainType, DomainConfig, DomainTemplate, DomainConfigOptions, DomainEvaluationCriteria, DomainValidationRule, } from "./domainTypes.js";
|
|
21
|
-
export
|
|
16
|
+
export type { GenerateOptions, GenerateResult as GenerateApiResult, // Renamed to avoid conflict with cli.js GenerateResult
|
|
17
|
+
UnifiedGenerationOptions, EnhancedProvider, FactoryEnhancedProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, } from "./generateTypes.js";
|
|
22
18
|
export type { StreamingProgressData, StreamingMetadata, ProgressCallback, ToolCall as StreamToolCall, // Renamed to avoid conflict with tools.js ToolCall
|
|
23
19
|
ToolResult as StreamToolResult, // Renamed to avoid conflict with tools.js ToolResult
|
|
24
20
|
ToolCallResults, ToolCalls, StreamOptions, StreamingOptions, StreamResult, EnhancedStreamProvider, } from "./streamTypes.js";
|
|
25
|
-
export
|
|
21
|
+
export type { TokenUsage, ErrorInfo as AnalyticsErrorInfo, // Renamed to avoid conflict with common.js ErrorInfo
|
|
22
|
+
AnalyticsData, StreamAnalyticsData, PerformanceMetrics, } from "./analytics.js";
|
|
26
23
|
export * from "./evaluation.js";
|
|
27
24
|
export * from "./modelTypes.js";
|
|
28
25
|
export * from "./serviceTypes.js";
|
|
@@ -33,3 +30,4 @@ export * from "./middlewareTypes.js";
|
|
|
33
30
|
export * from "./fileTypes.js";
|
|
34
31
|
export * from "./content.js";
|
|
35
32
|
export * from "./ttsTypes.js";
|
|
33
|
+
export * from "./hitlTypes.js";
|
package/dist/types/index.js
CHANGED
|
@@ -13,10 +13,6 @@ export * from "./providers.js";
|
|
|
13
13
|
export * from "./cli.js";
|
|
14
14
|
// Task classification types
|
|
15
15
|
export * from "./taskClassificationTypes.js";
|
|
16
|
-
// Generate types - NEW
|
|
17
|
-
export * from "./generateTypes.js";
|
|
18
|
-
// Analytics types - NEW
|
|
19
|
-
export * from "./analytics.js";
|
|
20
16
|
// Evaluation types - NEW
|
|
21
17
|
export * from "./evaluation.js";
|
|
22
18
|
// Model types - NEW
|
|
@@ -26,6 +22,8 @@ export * from "./serviceTypes.js";
|
|
|
26
22
|
// Evaluation provider types - NEW
|
|
27
23
|
export * from "./evaluationProviders.js";
|
|
28
24
|
// SDK Types - Core types for external developers
|
|
25
|
+
// Note: sdkTypes.ts uses selective re-exports internally, so we use wildcard here
|
|
26
|
+
// The conflicts were from generateTypes and analytics which are now handled above
|
|
29
27
|
export * from "./sdkTypes.js";
|
|
30
28
|
// Utilities Types - Utility module types (selective export to avoid conflicts)
|
|
31
29
|
export * from "./utilities.js";
|
|
@@ -37,3 +35,5 @@ export * from "./fileTypes.js";
|
|
|
37
35
|
export * from "./content.js";
|
|
38
36
|
// TTS (Text-to-Speech) types
|
|
39
37
|
export * from "./ttsTypes.js";
|
|
38
|
+
// HITL (Human-in-the-Loop) types
|
|
39
|
+
export * from "./hitlTypes.js";
|
package/dist/types/mcpTypes.d.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Enables various integrations to register tools directly
|
|
4
4
|
*/
|
|
5
5
|
import type { JsonValue, JsonObject } from "./common.js";
|
|
6
|
-
import type { ExecutionContext, ToolInfo } from "./tools.js";
|
|
6
|
+
import type { ExecutionContext, ToolInfo, ToolResult } from "./tools.js";
|
|
7
7
|
/**
|
|
8
8
|
* In-memory MCP server configuration
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* MCP Transport Types - Maximally Reusable
|
|
12
12
|
*/
|
|
13
|
-
export type MCPTransportType = "stdio" | "sse" | "websocket" | "ws" | "tcp" | "unix";
|
|
13
|
+
export type MCPTransportType = "stdio" | "sse" | "websocket" | "http" | "ws" | "tcp" | "unix";
|
|
14
14
|
/**
|
|
15
15
|
* MCP Server Connection Status - Individual server status
|
|
16
16
|
*/
|
|
@@ -44,6 +44,9 @@ export type MCPServerInfo = {
|
|
|
44
44
|
args?: string[];
|
|
45
45
|
env?: Record<string, string>;
|
|
46
46
|
url?: string;
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
/** HTTP transport-specific options */
|
|
49
|
+
httpOptions?: MCPHTTPTransportOptions;
|
|
47
50
|
timeout?: number;
|
|
48
51
|
retries?: number;
|
|
49
52
|
error?: string;
|
|
@@ -51,7 +54,53 @@ export type MCPServerInfo = {
|
|
|
51
54
|
cwd?: string;
|
|
52
55
|
autoRestart?: boolean;
|
|
53
56
|
healthCheckInterval?: number;
|
|
57
|
+
/** Retry configuration for HTTP transport */
|
|
58
|
+
retryConfig?: {
|
|
59
|
+
maxAttempts?: number;
|
|
60
|
+
initialDelay?: number;
|
|
61
|
+
maxDelay?: number;
|
|
62
|
+
backoffMultiplier?: number;
|
|
63
|
+
};
|
|
64
|
+
/** Rate limiting configuration for HTTP transport */
|
|
65
|
+
rateLimiting?: {
|
|
66
|
+
/** Maximum requests per minute (default: 60) */
|
|
67
|
+
requestsPerMinute?: number;
|
|
68
|
+
/** Maximum requests per hour (optional) */
|
|
69
|
+
requestsPerHour?: number;
|
|
70
|
+
/** Maximum burst size for token bucket (default: 10) */
|
|
71
|
+
maxBurst?: number;
|
|
72
|
+
/** Use token bucket algorithm (default: true) */
|
|
73
|
+
useTokenBucket?: boolean;
|
|
74
|
+
};
|
|
54
75
|
blockedTools?: string[];
|
|
76
|
+
/** Authentication configuration for HTTP/SSE/WebSocket transports */
|
|
77
|
+
auth?: {
|
|
78
|
+
/** Authentication type */
|
|
79
|
+
type: "oauth2" | "bearer" | "api-key";
|
|
80
|
+
/** OAuth 2.1 configuration */
|
|
81
|
+
oauth?: {
|
|
82
|
+
/** OAuth client ID */
|
|
83
|
+
clientId: string;
|
|
84
|
+
/** OAuth client secret (optional for public clients with PKCE) */
|
|
85
|
+
clientSecret?: string;
|
|
86
|
+
/** Authorization endpoint URL */
|
|
87
|
+
authorizationUrl: string;
|
|
88
|
+
/** Token endpoint URL */
|
|
89
|
+
tokenUrl: string;
|
|
90
|
+
/** Redirect URI for OAuth callback */
|
|
91
|
+
redirectUrl: string;
|
|
92
|
+
/** OAuth scope (space-separated) */
|
|
93
|
+
scope?: string;
|
|
94
|
+
/** Enable PKCE (Proof Key for Code Exchange) - recommended for OAuth 2.1 */
|
|
95
|
+
usePKCE?: boolean;
|
|
96
|
+
};
|
|
97
|
+
/** Bearer token for simple token authentication */
|
|
98
|
+
token?: string;
|
|
99
|
+
/** API key for API key authentication */
|
|
100
|
+
apiKey?: string;
|
|
101
|
+
/** Header name for API key (default: "X-API-Key") */
|
|
102
|
+
apiKeyHeader?: string;
|
|
103
|
+
};
|
|
55
104
|
metadata?: {
|
|
56
105
|
uptime?: number;
|
|
57
106
|
toolCount?: number;
|
|
@@ -63,6 +112,19 @@ export type MCPServerInfo = {
|
|
|
63
112
|
[key: string]: unknown;
|
|
64
113
|
};
|
|
65
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* HTTP Transport Options for fine-grained control
|
|
117
|
+
*/
|
|
118
|
+
export type MCPHTTPTransportOptions = {
|
|
119
|
+
/** Connection timeout in milliseconds (default: 30000) */
|
|
120
|
+
connectionTimeout?: number;
|
|
121
|
+
/** Request timeout in milliseconds (default: 60000) */
|
|
122
|
+
requestTimeout?: number;
|
|
123
|
+
/** Idle timeout for connection pool (default: 120000) */
|
|
124
|
+
idleTimeout?: number;
|
|
125
|
+
/** Keep-alive timeout (default: 30000) */
|
|
126
|
+
keepAliveTimeout?: number;
|
|
127
|
+
};
|
|
66
128
|
/**
|
|
67
129
|
* MCP Server Status for CLI Operations - High Reusability
|
|
68
130
|
*/
|
|
@@ -227,31 +289,7 @@ export type NeuroLinkExecutionContext = {
|
|
|
227
289
|
metadata?: Record<string, unknown>;
|
|
228
290
|
[key: string]: unknown;
|
|
229
291
|
};
|
|
230
|
-
|
|
231
|
-
* Tool execution result - Standardized result format
|
|
232
|
-
*/
|
|
233
|
-
export type ToolResult = {
|
|
234
|
-
success: boolean;
|
|
235
|
-
data?: unknown;
|
|
236
|
-
error?: string | Error;
|
|
237
|
-
usage?: {
|
|
238
|
-
tokens?: number;
|
|
239
|
-
cost?: number;
|
|
240
|
-
provider?: string;
|
|
241
|
-
model?: string;
|
|
242
|
-
executionTime?: number;
|
|
243
|
-
};
|
|
244
|
-
metadata?: {
|
|
245
|
-
toolName?: string;
|
|
246
|
-
serverId?: string;
|
|
247
|
-
serverTitle?: string;
|
|
248
|
-
sessionId?: string;
|
|
249
|
-
timestamp?: number;
|
|
250
|
-
executionTime?: number;
|
|
251
|
-
executionId?: string;
|
|
252
|
-
[key: string]: unknown;
|
|
253
|
-
};
|
|
254
|
-
};
|
|
292
|
+
export type { ToolResult } from "./tools.js";
|
|
255
293
|
/**
|
|
256
294
|
* Unified MCP Registry type
|
|
257
295
|
*/
|
|
@@ -577,3 +615,173 @@ export type FlexibleValidationResult = {
|
|
|
577
615
|
schema?: string;
|
|
578
616
|
};
|
|
579
617
|
};
|
|
618
|
+
/**
|
|
619
|
+
* OAuth tokens structure for MCP HTTP transport authentication
|
|
620
|
+
*/
|
|
621
|
+
export type OAuthTokens = {
|
|
622
|
+
/** Access token for API authentication */
|
|
623
|
+
accessToken: string;
|
|
624
|
+
/** Refresh token for obtaining new access tokens */
|
|
625
|
+
refreshToken?: string;
|
|
626
|
+
/** Token expiration timestamp (Unix epoch in milliseconds) */
|
|
627
|
+
expiresAt?: number;
|
|
628
|
+
/** Token type (typically "Bearer") */
|
|
629
|
+
tokenType: string;
|
|
630
|
+
/** OAuth scope granted */
|
|
631
|
+
scope?: string;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Token storage type for OAuth 2.1 authentication
|
|
635
|
+
* Implementations can use in-memory, file-based, or external storage
|
|
636
|
+
*/
|
|
637
|
+
export type TokenStorage = {
|
|
638
|
+
/**
|
|
639
|
+
* Get stored tokens for a server
|
|
640
|
+
* @param serverId - Unique identifier for the MCP server
|
|
641
|
+
* @returns Stored tokens or null if not found
|
|
642
|
+
*/
|
|
643
|
+
getTokens(serverId: string): Promise<OAuthTokens | null>;
|
|
644
|
+
/**
|
|
645
|
+
* Save tokens for a server
|
|
646
|
+
* @param serverId - Unique identifier for the MCP server
|
|
647
|
+
* @param tokens - OAuth tokens to store
|
|
648
|
+
*/
|
|
649
|
+
saveTokens(serverId: string, tokens: OAuthTokens): Promise<void>;
|
|
650
|
+
/**
|
|
651
|
+
* Delete stored tokens for a server
|
|
652
|
+
* @param serverId - Unique identifier for the MCP server
|
|
653
|
+
*/
|
|
654
|
+
deleteTokens(serverId: string): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Check if tokens exist for a server
|
|
657
|
+
* @param serverId - Unique identifier for the MCP server
|
|
658
|
+
* @returns True if tokens exist
|
|
659
|
+
*/
|
|
660
|
+
hasTokens?(serverId: string): Promise<boolean>;
|
|
661
|
+
/**
|
|
662
|
+
* Clear all stored tokens
|
|
663
|
+
*/
|
|
664
|
+
clearAll?(): Promise<void>;
|
|
665
|
+
};
|
|
666
|
+
/**
|
|
667
|
+
* OAuth 2.1 configuration for MCP servers
|
|
668
|
+
*/
|
|
669
|
+
export type MCPOAuthConfig = {
|
|
670
|
+
/** OAuth client ID */
|
|
671
|
+
clientId: string;
|
|
672
|
+
/** OAuth client secret (optional for public clients with PKCE) */
|
|
673
|
+
clientSecret?: string;
|
|
674
|
+
/** Authorization endpoint URL */
|
|
675
|
+
authorizationUrl: string;
|
|
676
|
+
/** Token endpoint URL */
|
|
677
|
+
tokenUrl: string;
|
|
678
|
+
/** Redirect URI for OAuth callback */
|
|
679
|
+
redirectUrl: string;
|
|
680
|
+
/** OAuth scope (space-separated) */
|
|
681
|
+
scope?: string;
|
|
682
|
+
/** Enable PKCE (Proof Key for Code Exchange) - recommended for OAuth 2.1 */
|
|
683
|
+
usePKCE?: boolean;
|
|
684
|
+
/** Additional authorization parameters */
|
|
685
|
+
additionalParams?: Record<string, string>;
|
|
686
|
+
};
|
|
687
|
+
/**
|
|
688
|
+
* OAuth client information returned to MCP SDK
|
|
689
|
+
*/
|
|
690
|
+
export type OAuthClientInformation = {
|
|
691
|
+
clientId: string;
|
|
692
|
+
clientSecret?: string;
|
|
693
|
+
redirectUri: string;
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* Authorization URL result from OAuth flow
|
|
697
|
+
*/
|
|
698
|
+
export type AuthorizationUrlResult = {
|
|
699
|
+
url: string;
|
|
700
|
+
state: string;
|
|
701
|
+
codeVerifier?: string;
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* Token exchange request for OAuth code exchange
|
|
705
|
+
*/
|
|
706
|
+
export type TokenExchangeRequest = {
|
|
707
|
+
code: string;
|
|
708
|
+
state: string;
|
|
709
|
+
codeVerifier?: string;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Token bucket rate limit configuration options for HTTP transport
|
|
713
|
+
*/
|
|
714
|
+
export type TokenBucketRateLimitConfig = {
|
|
715
|
+
/** Maximum requests per window */
|
|
716
|
+
requestsPerWindow: number;
|
|
717
|
+
/** Window size in milliseconds (default: 60000 = 1 minute) */
|
|
718
|
+
windowMs: number;
|
|
719
|
+
/** Use token bucket algorithm (default: true) */
|
|
720
|
+
useTokenBucket: boolean;
|
|
721
|
+
/** Token refill rate (tokens per second, for token bucket) */
|
|
722
|
+
refillRate: number;
|
|
723
|
+
/** Maximum burst size (for token bucket) */
|
|
724
|
+
maxBurst: number;
|
|
725
|
+
};
|
|
726
|
+
/** @deprecated Use TokenBucketRateLimitConfig instead */
|
|
727
|
+
export type RateLimitConfig = TokenBucketRateLimitConfig;
|
|
728
|
+
/**
|
|
729
|
+
* HTTP retry configuration for MCP transport
|
|
730
|
+
*/
|
|
731
|
+
export type HTTPRetryConfig = {
|
|
732
|
+
/** Maximum retry attempts (default: 3) */
|
|
733
|
+
maxAttempts: number;
|
|
734
|
+
/** Initial delay in ms (default: 1000) */
|
|
735
|
+
initialDelay: number;
|
|
736
|
+
/** Maximum delay in ms (default: 30000) */
|
|
737
|
+
maxDelay: number;
|
|
738
|
+
/** Backoff multiplier (default: 2) */
|
|
739
|
+
backoffMultiplier: number;
|
|
740
|
+
/** HTTP status codes that trigger retry */
|
|
741
|
+
retryableStatusCodes: number[];
|
|
742
|
+
};
|
|
743
|
+
/**
|
|
744
|
+
* PKCE (Proof Key for Code Exchange) challenge data for OAuth 2.1 authentication
|
|
745
|
+
* Used internally by OAuth client providers to generate and store PKCE parameters
|
|
746
|
+
*/
|
|
747
|
+
export type PKCEChallenge = {
|
|
748
|
+
/** Random code verifier string (43-128 characters, URL-safe) */
|
|
749
|
+
codeVerifier: string;
|
|
750
|
+
/** SHA-256 hash of code verifier, base64url encoded */
|
|
751
|
+
codeChallenge: string;
|
|
752
|
+
/** Challenge method - always "S256" per OAuth 2.1 specification */
|
|
753
|
+
codeChallengeMethod: "S256";
|
|
754
|
+
};
|
|
755
|
+
/**
|
|
756
|
+
* Rate limiter statistics for monitoring and debugging HTTP transport rate limiting
|
|
757
|
+
* Provides insight into token bucket state and queue status
|
|
758
|
+
*/
|
|
759
|
+
export type RateLimiterStats = {
|
|
760
|
+
/** Current number of available tokens */
|
|
761
|
+
tokens: number;
|
|
762
|
+
/** Maximum burst size (token capacity) */
|
|
763
|
+
maxBurst: number;
|
|
764
|
+
/** Token refill rate (tokens per second) */
|
|
765
|
+
refillRate: number;
|
|
766
|
+
/** Number of requests waiting in queue */
|
|
767
|
+
queueLength: number;
|
|
768
|
+
/** Timestamp of last token refill */
|
|
769
|
+
lastRefill: Date;
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
* Token response from OAuth server
|
|
773
|
+
* Standard OAuth 2.0/2.1 token endpoint response structure
|
|
774
|
+
* Used internally by NeuroLinkOAuthProvider for token exchange and refresh
|
|
775
|
+
*/
|
|
776
|
+
export type TokenResponse = {
|
|
777
|
+
/** Access token for API authentication */
|
|
778
|
+
access_token: string;
|
|
779
|
+
/** Refresh token for obtaining new access tokens (optional) */
|
|
780
|
+
refresh_token?: string;
|
|
781
|
+
/** Token lifetime in seconds (optional) */
|
|
782
|
+
expires_in?: number;
|
|
783
|
+
/** Token type (typically "Bearer") */
|
|
784
|
+
token_type: string;
|
|
785
|
+
/** OAuth scope granted (optional, space-separated) */
|
|
786
|
+
scope?: string;
|
|
787
|
+
};
|
|
@@ -1043,54 +1043,54 @@ export type ProviderHealthCheckOptions = {
|
|
|
1043
1043
|
* Amazon Bedrock specific types
|
|
1044
1044
|
*/
|
|
1045
1045
|
export declare namespace BedrockTypes {
|
|
1046
|
-
|
|
1046
|
+
type Client = {
|
|
1047
1047
|
send(command: unknown): Promise<unknown>;
|
|
1048
1048
|
config: {
|
|
1049
1049
|
region?: string;
|
|
1050
1050
|
credentials?: unknown;
|
|
1051
1051
|
};
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1052
|
+
};
|
|
1053
|
+
type InvokeModelCommand = {
|
|
1054
1054
|
input: {
|
|
1055
1055
|
modelId: string;
|
|
1056
1056
|
body: string;
|
|
1057
1057
|
contentType?: string;
|
|
1058
1058
|
};
|
|
1059
|
-
}
|
|
1059
|
+
};
|
|
1060
1060
|
}
|
|
1061
1061
|
/**
|
|
1062
1062
|
* Mistral specific types
|
|
1063
1063
|
*/
|
|
1064
1064
|
export declare namespace MistralTypes {
|
|
1065
|
-
|
|
1065
|
+
type Client = {
|
|
1066
1066
|
chat?: {
|
|
1067
1067
|
complete?: (options: unknown) => Promise<unknown>;
|
|
1068
1068
|
stream?: (options: unknown) => AsyncIterable<unknown>;
|
|
1069
1069
|
};
|
|
1070
|
-
}
|
|
1070
|
+
};
|
|
1071
1071
|
}
|
|
1072
1072
|
/**
|
|
1073
1073
|
* OpenTelemetry specific types (for telemetry service)
|
|
1074
1074
|
*/
|
|
1075
1075
|
export declare namespace TelemetryTypes {
|
|
1076
|
-
|
|
1076
|
+
type Meter = {
|
|
1077
1077
|
createCounter(name: string, options?: unknown): Counter;
|
|
1078
1078
|
createHistogram(name: string, options?: unknown): Histogram;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1079
|
+
};
|
|
1080
|
+
type Tracer = {
|
|
1081
1081
|
startSpan(name: string, options?: unknown): Span;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1082
|
+
};
|
|
1083
|
+
type Counter = {
|
|
1084
1084
|
add(value: number, attributes?: UnknownRecord): void;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1085
|
+
};
|
|
1086
|
+
type Histogram = {
|
|
1087
1087
|
record(value: number, attributes?: UnknownRecord): void;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1088
|
+
};
|
|
1089
|
+
type Span = {
|
|
1090
1090
|
end(): void;
|
|
1091
1091
|
setStatus(status: unknown): void;
|
|
1092
1092
|
recordException(exception: unknown): void;
|
|
1093
|
-
}
|
|
1093
|
+
};
|
|
1094
1094
|
}
|
|
1095
1095
|
/**
|
|
1096
1096
|
* OpenRouter provider configuration
|
package/dist/types/sdkTypes.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ ToolResult as StreamToolResult, // Note: Renamed in main index to avoid conflict
|
|
|
10
10
|
ToolCallResults, ToolCalls, StreamOptions, StreamingOptions, EnhancedStreamProvider, StreamTextResult, AISDKUsage, StreamAnalyticsCollector, ResponseMetadata, AudioInputSpec, AudioChunk, PCMEncoding, } from "./streamTypes.js";
|
|
11
11
|
export type { TypedEventEmitter, NeuroLinkEvents, StreamEvent, AsyncFunction, SyncFunction, AnyFunction, } from "./common.js";
|
|
12
12
|
export type { NeuroLinkConfig, ProviderConfig, PerformanceConfig, CacheConfig, FallbackConfig, RetryConfig, AnalyticsConfig, ToolConfig, BackupInfo, BackupMetadata, ConfigValidationResult, ConfigUpdateOptions, } from "./configTypes.js";
|
|
13
|
-
export type { ToolArgs, ToolContext, ToolResult, ToolDefinition, SimpleTool, AvailableTool, ToolExecution, BaseToolArgs, ToolExecutionEvent, ToolExecutionSummary, ToolExecutionContext, ToolExecutionMetadata, ToolParameterSchema, ZodUnknownSchema, ZodAnySchema, ZodObjectSchema, ZodStringSchema, } from "./tools.js";
|
|
14
13
|
export type { AISDKModel, ProviderError, AIModelProviderConfig, ProviderName, ModelCapability, ModelUseCase, ModelFilter, ModelResolutionContext, ModelStats, ModelPricing, ProviderCapabilities, } from "./providers.js";
|
|
15
|
-
export type { GenerateOptions, GenerateResult
|
|
14
|
+
export type { GenerateOptions, GenerateResult as GenerateApiResult, // Renamed to avoid conflict with cli.js GenerateResult
|
|
15
|
+
UnifiedGenerationOptions, EnhancedProvider, FactoryEnhancedProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, } from "./generateTypes.js";
|
|
16
16
|
export type { TokenUsage, AnalyticsData } from "./analytics.js";
|
|
17
17
|
export type { TextContent, ImageContent, Content, VisionCapability, ProviderImageFormat, ProcessedImage, MultimodalMessage, ProviderMultimodalPayload, } from "./content.js";
|
|
18
18
|
export type { MCPTransportType, MCPServerConnectionStatus, MCPServerCategory, MCPServerStatus, MCPDiscoveredServer, MCPConnectedServer, MCPToolInfo, MCPExecutableTool, MCPServerMetadata, MCPToolMetadata, MCPServerRegistryEntry, } from "./mcpTypes.js";
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -146,6 +146,32 @@ export type ToolContext = {
|
|
|
146
146
|
aiProvider?: string;
|
|
147
147
|
metadata?: ToolExecutionMetadata;
|
|
148
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* SDK-specific tool context with additional fields for SDK usage
|
|
151
|
+
* Extends the base ToolContext with session management, provider info, and logging
|
|
152
|
+
*/
|
|
153
|
+
export type SDKToolContext = ToolContext & {
|
|
154
|
+
/**
|
|
155
|
+
* Current session ID (required for SDK context)
|
|
156
|
+
*/
|
|
157
|
+
sessionId: string;
|
|
158
|
+
/**
|
|
159
|
+
* AI provider being used
|
|
160
|
+
*/
|
|
161
|
+
provider?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Model being used
|
|
164
|
+
*/
|
|
165
|
+
model?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Call another tool
|
|
168
|
+
*/
|
|
169
|
+
callTool?: (name: string, params: ToolArgs) => Promise<ToolResult>;
|
|
170
|
+
/**
|
|
171
|
+
* Logger instance
|
|
172
|
+
*/
|
|
173
|
+
logger: import("./utilities.js").Logger;
|
|
174
|
+
};
|
|
149
175
|
/**
|
|
150
176
|
* Tool execution result metadata
|
|
151
177
|
*/
|
|
@@ -156,14 +182,27 @@ export type ToolResultMetadata = {
|
|
|
156
182
|
source?: string;
|
|
157
183
|
version?: string;
|
|
158
184
|
serverId?: string;
|
|
185
|
+
sessionId?: string;
|
|
186
|
+
blocked?: boolean;
|
|
187
|
+
[key: string]: JsonValue | undefined;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Tool result usage information
|
|
191
|
+
*/
|
|
192
|
+
export type ToolResultUsage = {
|
|
193
|
+
executionTime?: number;
|
|
194
|
+
tokensUsed?: number;
|
|
195
|
+
cost?: number;
|
|
196
|
+
[key: string]: JsonValue | undefined;
|
|
159
197
|
};
|
|
160
198
|
/**
|
|
161
199
|
* Tool execution result
|
|
162
200
|
*/
|
|
163
|
-
export type ToolResult<T = JsonValue> = Result<T, ErrorInfo> & {
|
|
201
|
+
export type ToolResult<T = JsonValue | unknown> = Result<T, ErrorInfo | string> & {
|
|
164
202
|
success: boolean;
|
|
165
|
-
data?: T;
|
|
166
|
-
error?: ErrorInfo;
|
|
203
|
+
data?: T | null;
|
|
204
|
+
error?: ErrorInfo | string;
|
|
205
|
+
usage?: ToolResultUsage;
|
|
167
206
|
metadata?: ToolResultMetadata;
|
|
168
207
|
};
|
|
169
208
|
/**
|
|
@@ -65,6 +65,25 @@ export type LogEntry = {
|
|
|
65
65
|
/** Optional additional data associated with the log entry (objects, arrays, etc.) */
|
|
66
66
|
data?: unknown;
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Logger interface matching the logger object shape
|
|
70
|
+
* Used for SDK tool contexts and other components that need a logger
|
|
71
|
+
*/
|
|
72
|
+
export type Logger = {
|
|
73
|
+
debug: (...args: unknown[]) => void;
|
|
74
|
+
info: (...args: unknown[]) => void;
|
|
75
|
+
warn: (...args: unknown[]) => void;
|
|
76
|
+
error: (...args: unknown[]) => void;
|
|
77
|
+
always: (...args: unknown[]) => void;
|
|
78
|
+
table: (data: unknown) => void;
|
|
79
|
+
setLogLevel: (level: LogLevel) => void;
|
|
80
|
+
getLogs: (level?: LogLevel) => LogEntry[];
|
|
81
|
+
clearLogs: () => void;
|
|
82
|
+
setEventEmitter: (emitter: {
|
|
83
|
+
emit: (event: string, ...args: unknown[]) => boolean;
|
|
84
|
+
}) => void;
|
|
85
|
+
clearEventEmitter: () => void;
|
|
86
|
+
};
|
|
68
87
|
export type StructuredError = {
|
|
69
88
|
code: string;
|
|
70
89
|
message: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.30.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 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Juspay Technologies",
|
|
@@ -187,6 +187,7 @@
|
|
|
187
187
|
"dotenv": "^16.6.1",
|
|
188
188
|
"exceljs": "^4.4.0",
|
|
189
189
|
"inquirer": "^9.3.7",
|
|
190
|
+
"google-auth-library": "^9.1.0",
|
|
190
191
|
"json-schema-to-zod": "^2.6.1",
|
|
191
192
|
"mammoth": "^1.11.0",
|
|
192
193
|
"mathjs": "^14.7.0",
|