@juspay/neurolink 9.44.0 → 9.48.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 (78) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +230 -5
  3. package/dist/auth/tokenStore.js +4 -2
  4. package/dist/browser/neurolink.min.js +258 -258
  5. package/dist/cli/commands/authProviders.d.ts +1 -1
  6. package/dist/cli/commands/proxy.js +25 -2
  7. package/dist/cli/commands/task.js +1 -1
  8. package/dist/cli/errorHandler.js +1 -1
  9. package/dist/cli/factories/commandFactory.js +8 -2
  10. package/dist/cli/loop/conversationSelector.d.ts +2 -2
  11. package/dist/cli/loop/optionsSchema.d.ts +2 -2
  12. package/dist/cli/loop/session.d.ts +1 -1
  13. package/dist/cli/utils/audioFileUtils.d.ts +1 -1
  14. package/dist/cli/utils/envManager.d.ts +1 -1
  15. package/dist/cli/utils/videoFileUtils.d.ts +1 -1
  16. package/dist/client/auth.d.ts +3 -3
  17. package/dist/client/httpClient.d.ts +20 -20
  18. package/dist/client/index.d.ts +3 -3
  19. package/dist/client/interceptors.d.ts +1 -1
  20. package/dist/client/reactHooks.d.ts +1 -1
  21. package/dist/client/reactHooks.tsx +2 -2
  22. package/dist/client/sseClient.d.ts +1 -1
  23. package/dist/client/streamingClient.d.ts +1 -1
  24. package/dist/client/wsClient.d.ts +1 -1
  25. package/dist/files/fileTools.d.ts +1 -1
  26. package/dist/lib/agent/directTools.d.ts +2 -2
  27. package/dist/lib/auth/tokenStore.js +4 -2
  28. package/dist/lib/client/auth.d.ts +3 -3
  29. package/dist/lib/client/httpClient.d.ts +20 -20
  30. package/dist/lib/client/index.d.ts +3 -3
  31. package/dist/lib/client/interceptors.d.ts +1 -1
  32. package/dist/lib/client/reactHooks.d.ts +1 -1
  33. package/dist/lib/client/sseClient.d.ts +1 -1
  34. package/dist/lib/client/streamingClient.d.ts +1 -1
  35. package/dist/lib/client/wsClient.d.ts +1 -1
  36. package/dist/lib/files/fileTools.d.ts +1 -1
  37. package/dist/lib/rag/types.d.ts +1 -68
  38. package/dist/lib/server/types.d.ts +3 -847
  39. package/dist/lib/server/types.js +3 -64
  40. package/dist/lib/tasks/tools/taskTools.d.ts +1 -1
  41. package/dist/lib/types/analytics.d.ts +1 -1
  42. package/dist/lib/types/cli.d.ts +1 -1
  43. package/dist/lib/types/clientTypes.d.ts +38 -20
  44. package/dist/lib/types/configTypes.d.ts +1 -1
  45. package/dist/lib/types/configTypes.js +0 -1
  46. package/dist/lib/types/index.d.ts +9 -7
  47. package/dist/lib/types/index.js +5 -2
  48. package/dist/lib/types/ragTypes.d.ts +69 -0
  49. package/dist/lib/types/sdkTypes.d.ts +1 -2
  50. package/dist/lib/types/serverTypes.d.ts +858 -0
  51. package/dist/lib/types/serverTypes.js +68 -0
  52. package/dist/lib/types/streamTypes.d.ts +2 -2
  53. package/dist/lib/types/typeAliases.d.ts +1 -37
  54. package/dist/lib/utils/imageProcessor.d.ts +24 -1
  55. package/dist/lib/utils/imageProcessor.js +124 -8
  56. package/dist/lib/utils/messageBuilder.js +18 -6
  57. package/dist/lib/workflow/config.d.ts +3 -3
  58. package/dist/rag/errors/RAGError.d.ts +1 -1
  59. package/dist/rag/types.d.ts +1 -68
  60. package/dist/server/types.d.ts +3 -847
  61. package/dist/server/types.js +3 -64
  62. package/dist/types/analytics.d.ts +1 -1
  63. package/dist/types/cli.d.ts +1 -1
  64. package/dist/types/clientTypes.d.ts +38 -20
  65. package/dist/types/configTypes.d.ts +1 -1
  66. package/dist/types/index.d.ts +8 -6
  67. package/dist/types/index.js +5 -2
  68. package/dist/types/ragTypes.d.ts +69 -0
  69. package/dist/types/sdkTypes.d.ts +1 -2
  70. package/dist/types/serverTypes.d.ts +858 -0
  71. package/dist/types/serverTypes.js +67 -0
  72. package/dist/types/streamTypes.d.ts +2 -2
  73. package/dist/types/typeAliases.d.ts +1 -37
  74. package/dist/utils/imageProcessor.js +124 -8
  75. package/dist/utils/messageBuilder.js +18 -6
  76. package/dist/workflow/config.d.ts +3 -3
  77. package/package.json +1 -1
  78. package/scripts/observability/manage-local-openobserve.sh +30 -2
@@ -1,68 +1,7 @@
1
1
  /**
2
2
  * Server Adapter Types
3
- * Comprehensive type system for NeuroLink server adapters
3
+ * Re-exported from types/serverTypes.ts for backward compatibility.
4
+ * Import from '@juspay/neurolink' or '../types/index.js' for new code.
4
5
  */
5
- // ============================================
6
- // Error Types
7
- // ============================================
8
- /**
9
- * Error categories for server adapter errors
10
- */
11
- export const ErrorCategory = {
12
- CONFIG: "CONFIG",
13
- VALIDATION: "VALIDATION",
14
- EXECUTION: "EXECUTION",
15
- EXTERNAL: "EXTERNAL",
16
- RATE_LIMIT: "RATE_LIMIT",
17
- AUTHENTICATION: "AUTHENTICATION",
18
- AUTHORIZATION: "AUTHORIZATION",
19
- STREAMING: "STREAMING",
20
- WEBSOCKET: "WEBSOCKET",
21
- };
22
- /**
23
- * Error severity levels
24
- */
25
- export const ErrorSeverity = {
26
- LOW: "LOW",
27
- MEDIUM: "MEDIUM",
28
- HIGH: "HIGH",
29
- CRITICAL: "CRITICAL",
30
- };
31
- /**
32
- * Server adapter error codes
33
- */
34
- export const ServerAdapterErrorCode = {
35
- // Configuration errors
36
- INVALID_CONFIG: "SERVER_ADAPTER_INVALID_CONFIG",
37
- MISSING_DEPENDENCY: "SERVER_ADAPTER_MISSING_DEPENDENCY",
38
- FRAMEWORK_INIT_FAILED: "SERVER_ADAPTER_FRAMEWORK_INIT_FAILED",
39
- // Route errors
40
- ROUTE_NOT_FOUND: "SERVER_ADAPTER_ROUTE_NOT_FOUND",
41
- ROUTE_CONFLICT: "SERVER_ADAPTER_ROUTE_CONFLICT",
42
- INVALID_ROUTE: "SERVER_ADAPTER_INVALID_ROUTE",
43
- // Execution errors
44
- HANDLER_ERROR: "SERVER_ADAPTER_HANDLER_ERROR",
45
- TIMEOUT: "SERVER_ADAPTER_TIMEOUT",
46
- MIDDLEWARE_ERROR: "SERVER_ADAPTER_MIDDLEWARE_ERROR",
47
- // Rate limit errors
48
- RATE_LIMIT_EXCEEDED: "SERVER_ADAPTER_RATE_LIMIT_EXCEEDED",
49
- // Authentication/Authorization errors
50
- AUTH_REQUIRED: "SERVER_ADAPTER_AUTH_REQUIRED",
51
- AUTH_INVALID: "SERVER_ADAPTER_AUTH_INVALID",
52
- FORBIDDEN: "SERVER_ADAPTER_FORBIDDEN",
53
- // Streaming errors
54
- STREAM_ERROR: "SERVER_ADAPTER_STREAM_ERROR",
55
- STREAM_ABORTED: "SERVER_ADAPTER_STREAM_ABORTED",
56
- // WebSocket errors
57
- WEBSOCKET_ERROR: "SERVER_ADAPTER_WEBSOCKET_ERROR",
58
- WEBSOCKET_CONNECTION_FAILED: "SERVER_ADAPTER_WEBSOCKET_CONNECTION_FAILED",
59
- // Validation errors
60
- VALIDATION_ERROR: "SERVER_ADAPTER_VALIDATION_ERROR",
61
- SCHEMA_ERROR: "SERVER_ADAPTER_SCHEMA_ERROR",
62
- // Server lifecycle errors
63
- START_FAILED: "SERVER_ADAPTER_START_FAILED",
64
- STOP_FAILED: "SERVER_ADAPTER_STOP_FAILED",
65
- ALREADY_RUNNING: "SERVER_ADAPTER_ALREADY_RUNNING",
66
- NOT_RUNNING: "SERVER_ADAPTER_NOT_RUNNING",
67
- };
6
+ export * from "../types/serverTypes.js";
68
7
  //# sourceMappingURL=types.js.map
@@ -31,7 +31,7 @@ export declare function createTaskTools(manager: TaskManager): {
31
31
  name: string;
32
32
  prompt: string;
33
33
  schedule: {
34
- type: "cron" | "interval" | "once";
34
+ type: "once" | "cron" | "interval";
35
35
  expression?: string | undefined;
36
36
  timezone?: string | undefined;
37
37
  every?: number | undefined;
@@ -18,7 +18,7 @@ export type TokenUsage = {
18
18
  /**
19
19
  * Error info type for analytics
20
20
  */
21
- export type ErrorInfo = {
21
+ export type AnalyticsErrorInfo = {
22
22
  message: string;
23
23
  code?: string | number;
24
24
  stack?: string;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { UnknownRecord, JsonValue } from "./common.js";
5
5
  import type { AnalyticsData, TokenUsage } from "./analytics.js";
6
- import type { EvaluationData } from "../index.js";
6
+ import type { EvaluationData } from "./evaluation.js";
7
7
  import type { ToolCall, ToolResult } from "./tools.js";
8
8
  /**
9
9
  * Ollama command utilities type
@@ -24,7 +24,7 @@ export type ClientConfig = {
24
24
  /** Default headers to include in all requests */
25
25
  headers?: Record<string, string>;
26
26
  /** Retry configuration for failed requests */
27
- retry?: RetryConfig;
27
+ retry?: ClientRetryConfig;
28
28
  /** Enable debug logging */
29
29
  debug?: boolean;
30
30
  /** Custom fetch implementation (for environments without native fetch) */
@@ -35,7 +35,7 @@ export type ClientConfig = {
35
35
  /**
36
36
  * Retry configuration for failed requests
37
37
  */
38
- export type RetryConfig = {
38
+ export type ClientRetryConfig = {
39
39
  /** Maximum number of retry attempts (default: 3) */
40
40
  maxAttempts: number;
41
41
  /** Initial delay in milliseconds before first retry (default: 1000) */
@@ -65,7 +65,7 @@ export type RequestOptions = {
65
65
  /**
66
66
  * Response wrapper with metadata for all API responses
67
67
  */
68
- export type ApiResponse<T> = {
68
+ export type ClientApiResponse<T> = {
69
69
  /** Response data */
70
70
  data: T;
71
71
  /** HTTP status code */
@@ -97,7 +97,7 @@ export type ApiError = {
97
97
  /**
98
98
  * Provider status information
99
99
  */
100
- export type ProviderStatus = {
100
+ export type ClientProviderStatus = {
101
101
  /** Provider name */
102
102
  name: string;
103
103
  /** Provider availability status */
@@ -121,7 +121,7 @@ export type StreamEventType = "text" | "tool-call" | "tool-result" | "error" | "
121
121
  /**
122
122
  * Stream event from SSE/WebSocket
123
123
  */
124
- export type StreamEvent = {
124
+ export type ClientStreamEvent = {
125
125
  /** Event type */
126
126
  type: StreamEventType;
127
127
  /** Text content (for text events) */
@@ -158,7 +158,7 @@ export type StreamCallbacks = {
158
158
  /** Called on stream error */
159
159
  onError?: (error: ApiError) => void;
160
160
  /** Called when stream completes */
161
- onDone?: (result: StreamResult) => void;
161
+ onDone?: (result: ClientStreamResult) => void;
162
162
  /** Called for metadata updates */
163
163
  onMetadata?: (metadata: JsonObject) => void;
164
164
  /** Called for audio chunks */
@@ -172,7 +172,7 @@ export type StreamCallbacks = {
172
172
  /**
173
173
  * Stream result with full response data
174
174
  */
175
- export type StreamResult = {
175
+ export type ClientStreamResult = {
176
176
  /** Full accumulated text content */
177
177
  content: string;
178
178
  /** All tool calls made */
@@ -414,7 +414,7 @@ export type MiddlewareRequest = {
414
414
  /** Request body */
415
415
  body?: unknown;
416
416
  /** Middleware context */
417
- context: MiddlewareContext;
417
+ context: ClientMiddlewareContext;
418
418
  };
419
419
  /**
420
420
  * Middleware response object
@@ -427,12 +427,12 @@ export type MiddlewareResponse = {
427
427
  /** Response body */
428
428
  body: unknown;
429
429
  /** Middleware context */
430
- context: MiddlewareContext;
430
+ context: ClientMiddlewareContext;
431
431
  };
432
432
  /**
433
433
  * Middleware context for passing data between middleware
434
434
  */
435
- export type MiddlewareContext = {
435
+ export type ClientMiddlewareContext = {
436
436
  /** Request start time */
437
437
  startTime: number;
438
438
  /** Request ID */
@@ -457,7 +457,7 @@ export type NeuroLinkProviderProps = {
457
457
  /**
458
458
  * Chat message for useChat hook
459
459
  */
460
- export type ChatMessage = {
460
+ export type ClientChatMessage = {
461
461
  /** Unique message ID */
462
462
  id: string;
463
463
  /** Message role */
@@ -482,7 +482,7 @@ export type UseChatOptions = {
482
482
  /** Agent ID to use */
483
483
  agentId?: string;
484
484
  /** Initial messages */
485
- initialMessages?: ChatMessage[];
485
+ initialMessages?: ClientChatMessage[];
486
486
  /** Session ID for conversation continuity */
487
487
  sessionId?: string;
488
488
  /** System prompt */
@@ -490,7 +490,7 @@ export type UseChatOptions = {
490
490
  /** Called when response starts */
491
491
  onResponse?: (response: Response) => void | Promise<void>;
492
492
  /** Called when response finishes */
493
- onFinish?: (message: ChatMessage) => void;
493
+ onFinish?: (message: ClientChatMessage) => void;
494
494
  /** Called on error */
495
495
  onError?: (error: ApiError) => void;
496
496
  /** Called for each tool call */
@@ -509,7 +509,7 @@ export type UseChatOptions = {
509
509
  */
510
510
  export type UseChatReturn = {
511
511
  /** Chat messages */
512
- messages: ChatMessage[];
512
+ messages: ClientChatMessage[];
513
513
  /** Current input value */
514
514
  input: string;
515
515
  /** Set input value */
@@ -527,13 +527,13 @@ export type UseChatReturn = {
527
527
  data?: UnknownRecord;
528
528
  }) => void;
529
529
  /** Append a message */
530
- append: (message: Omit<ChatMessage, "id" | "createdAt">) => Promise<string | null | undefined>;
530
+ append: (message: Omit<ClientChatMessage, "id" | "createdAt">) => Promise<string | null | undefined>;
531
531
  /** Reload the last message */
532
532
  reload: () => Promise<string | null | undefined>;
533
533
  /** Stop generation */
534
534
  stop: () => void;
535
535
  /** Set messages directly */
536
- setMessages: (messages: ChatMessage[]) => void;
536
+ setMessages: (messages: ClientChatMessage[]) => void;
537
537
  /** Loading state */
538
538
  isLoading: boolean;
539
539
  /** Error state */
@@ -701,7 +701,7 @@ export type UseStreamReturn = {
701
701
  /** Current text content */
702
702
  text: string;
703
703
  /** All events received */
704
- events: StreamEvent[];
704
+ events: ClientStreamEvent[];
705
705
  /** Streaming state */
706
706
  isStreaming: boolean;
707
707
  /** Error state */
@@ -893,7 +893,7 @@ export type WSClientEventHandlers = {
893
893
  onOpen?: () => void;
894
894
  onClose?: (code: number, reason: string) => void;
895
895
  onError?: (error: Error) => void;
896
- onMessage?: (event: StreamEvent) => void;
896
+ onMessage?: (event: ClientStreamEvent) => void;
897
897
  onReconnect?: (attempt: number) => void;
898
898
  onStateChange?: (state: WSClientState) => void;
899
899
  };
@@ -945,7 +945,7 @@ export type AuthConfig = {
945
945
  /**
946
946
  * OAuth2 client credentials configuration
947
947
  */
948
- export type OAuth2Config = {
948
+ export type ClientOAuth2Config = {
949
949
  /** Token endpoint URL */
950
950
  tokenUrl: string;
951
951
  /** OAuth2 client ID */
@@ -960,7 +960,7 @@ export type OAuth2Config = {
960
960
  /**
961
961
  * Token refresh result
962
962
  */
963
- export type TokenRefreshResult = {
963
+ export type ClientTokenRefreshResult = {
964
964
  /** Access token */
965
965
  accessToken: string;
966
966
  /** Token expiry time in seconds */
@@ -1048,3 +1048,21 @@ export interface SpeechGrammar {
1048
1048
  */
1049
1049
  export type { JsonValue, JsonObject, UnknownRecord };
1050
1050
  export type { ToolCall, ToolResult };
1051
+ /** @deprecated Use {@link ClientRetryConfig} instead */
1052
+ export type RetryConfig = ClientRetryConfig;
1053
+ /** @deprecated Use {@link ClientApiResponse} instead */
1054
+ export type ApiResponse<T = unknown> = ClientApiResponse<T>;
1055
+ /** @deprecated Use {@link ClientProviderStatus} instead */
1056
+ export type ProviderStatus = ClientProviderStatus;
1057
+ /** @deprecated Use {@link ClientStreamEvent} instead */
1058
+ export type StreamEvent = ClientStreamEvent;
1059
+ /** @deprecated Use {@link ClientStreamResult} instead */
1060
+ export type StreamResult = ClientStreamResult;
1061
+ /** @deprecated Use {@link ClientMiddlewareContext} instead */
1062
+ export type MiddlewareContext = ClientMiddlewareContext;
1063
+ /** @deprecated Use {@link ClientChatMessage} instead */
1064
+ export type ChatMessage = ClientChatMessage;
1065
+ /** @deprecated Use {@link ClientOAuth2Config} instead */
1066
+ export type OAuth2Config = ClientOAuth2Config;
1067
+ /** @deprecated Use {@link ClientTokenRefreshResult} instead */
1068
+ export type TokenRefreshResult = ClientTokenRefreshResult;
@@ -2,7 +2,7 @@
2
2
  * NeuroLink Configuration Types
3
3
  * Centralized configuration type definitions following the established architecture pattern
4
4
  */
5
- import { MCPToolRegistry } from "../mcp/toolRegistry.js";
5
+ import type { MCPToolRegistry } from "../mcp/toolRegistry.js";
6
6
  import type { TaskManagerConfig } from "./taskTypes.js";
7
7
  import type { HITLConfig } from "../types/hitlTypes.js";
8
8
  import type { ConversationMemoryConfig } from "./conversation.js";
@@ -2,7 +2,6 @@
2
2
  * NeuroLink Configuration Types
3
3
  * Centralized configuration type definitions following the established architecture pattern
4
4
  */
5
- import { MCPToolRegistry } from "../mcp/toolRegistry.js";
6
5
  /**
7
6
  * Default configuration values
8
7
  */
@@ -6,7 +6,7 @@ export * from "./cli.js";
6
6
  export * from "./common.js";
7
7
  export type { AnalyticsConfig, BackupInfo, BackupMetadata, CacheConfig, ConfigUpdateOptions, ConfigValidationResult, FallbackConfig, MCPEnhancementsConfig, NeuroLinkConfig, PerformanceConfig, RetryConfig, ToolConfig, } from "./configTypes.js";
8
8
  export type { ExternalMCPConfigValidation, ExternalMCPManagerConfig, ExternalMCPOperationResult, ExternalMCPServerEvents, ExternalMCPServerHealth, ExternalMCPServerInstance, ExternalMCPServerStatus, ExternalMCPToolContext, ExternalMCPToolInfo, ExternalMCPToolResult, } from "./externalMcp.js";
9
- export type { AuthorizationUrlResult, CircuitBreakerConfig, CircuitBreakerEvents, CircuitBreakerState, CircuitBreakerStats, DiscoveredMcp, ExternalToolExecutionOptions, FlexibleValidationResult, HTTPRetryConfig, MCPClientResult, MCPConnectedServer, MCPDiscoveredServer, MCPExecutableTool, MCPOAuthConfig, MCPServerCategory, MCPServerConfig, MCPServerConnectionStatus, MCPServerMetadata, MCPServerRegistryEntry, MCPServerStatus, MCPToolInfo, MCPToolMetadata, MCPTransportType, McpMetadata, McpRegistry, NeuroLinkExecutionContext, NeuroLinkMCPServer, NeuroLinkMCPTool, OAuthClientInformation, OAuthTokens as McpOAuthTokens, RateLimitConfig, TokenBucketRateLimitConfig, TokenExchangeRequest, TokenStorage, ToolDiscoveryResult, ToolRegistryEvents, ToolValidationResult, } from "./mcpTypes.js";
9
+ export type { AuthorizationUrlResult, CircuitBreakerConfig, CircuitBreakerEvents, CircuitBreakerState, CircuitBreakerStats, DiscoveredMcp, ExternalToolExecutionOptions, FlexibleValidationResult, HTTPRetryConfig, MCPClientResult, MCPConnectedServer, MCPDiscoveredServer, MCPExecutableTool, MCPOAuthConfig, MCPServerCategory, MCPServerConfig, MCPServerConnectionStatus, MCPServerInfo, MCPServerMetadata, MCPServerRegistryEntry, MCPServerStatus, MCPStatus, MCPToolInfo, MCPToolMetadata, MCPTransportType, McpMetadata, McpRegistry, NeuroLinkExecutionContext, NeuroLinkMCPServer, NeuroLinkMCPTool, OAuthClientInformation, OAuthTokens as McpOAuthTokens, RateLimitConfig, TokenBucketRateLimitConfig, TokenExchangeRequest, TokenStorage, ToolDiscoveryResult, ToolRegistryEvents, ToolValidationResult, } from "./mcpTypes.js";
10
10
  export type { ModelCapability, ModelFilter, ModelPricing, ModelResolutionContext, ModelStats, ModelUseCase, } from "./providers.js";
11
11
  export * from "./providers.js";
12
12
  export * from "./taskClassificationTypes.js";
@@ -15,9 +15,8 @@ export type { OptionalStandardRecord, OptionalValidationSchema, StandardRecord,
15
15
  export type { BatchProcessingSummary, ExcelWorksheet, FailedFileInfo, FileInfo, FileProcessingError, FileProcessingResult as ProcessorFileResult, FileProcessorConfig, FileWarning, JsonTypeGuard, OperationResult, ProcessedConfig, ProcessedExcel, ProcessedFileBase, ProcessedFileInfo, ProcessedHtml, ProcessedJson, ProcessedMarkdown, ProcessedOpenDocument, ProcessedRtf, ProcessedSourceCode, ProcessedSvg, ProcessedText, ProcessedWord, ProcessedYaml, ProcessOptions, ProcessorInfo, ProcessorMatch, ProcessorPriorityKey, ProcessorPriorityValue, RegistryOptions, RegistryProcessResult, RetryConfig as ProcessorRetryConfig, SkippedFileInfo, UnsupportedFileError, } from "../processors/base/types.js";
16
16
  export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
17
17
  export type { ActionAWSConfig, ActionCommentResult, ActionEvaluation, ActionExecutionResult, ActionGoogleCloudConfig, ActionInputs, ActionInputValidation, ActionMultimodalInputs, ActionOutput, ActionProviderKeys, ActionThinkingConfig, ActionTokenUsage, CliAnalytics, CliEvaluation, CliResponse, CliTokenUsage, ProviderKeyMapping, } from "./actionTypes.js";
18
- export type { AnalyticsData, ErrorInfo as AnalyticsErrorInfo, // Renamed to avoid conflict with common.js ErrorInfo
19
- PerformanceMetrics, StreamAnalyticsData, TokenUsage, } from "./analytics.js";
20
- export * from "./content.js";
18
+ export type { AnalyticsData, AnalyticsErrorInfo, PerformanceMetrics, StreamAnalyticsData, TokenUsage, } from "./analytics.js";
19
+ export * from "./multimodal.js";
21
20
  export type { DomainConfig, DomainConfigOptions, DomainEvaluationCriteria, DomainTemplate, DomainType, DomainValidationRule, } from "./domainTypes.js";
22
21
  export * from "./evaluation.js";
23
22
  export * from "./evaluationProviders.js";
@@ -39,11 +38,14 @@ export { WorkflowError } from "./workflowTypes.js";
39
38
  export * from "./contextTypes.js";
40
39
  export * from "./fileReferenceTypes.js";
41
40
  export * from "./ragTypes.js";
41
+ export type { AgentExecuteRequest, AgentExecuteResponse, AuthConfig as ServerAuthConfig, AuthenticatedUser, AuthStrategy, BodyParserConfig, CORSConfig, DataStreamWriter, EmbedManyRequest, EmbedManyResponse, EmbedRequest, EmbedResponse, ErrorCategory, ErrorCategoryType, ErrorSeverity, ErrorSeverityType, HealthResponse, HttpMethod, LoggingConfig, MCPServerStatusResponse, MiddlewareDefinition, MiddlewareHandler, RateLimitConfig as ServerRateLimitConfig, ReadyResponse, RedactionConfig, RequiredBodyParserConfig, RequiredCORSConfig, RequiredLoggingConfig, RequiredRateLimitConfig, RequiredRedactionConfig, RequiredServerAdapterConfig, RequiredShutdownConfig, RouteDefinition, RouteDeprecation, RouteGroup, RouteHandler, ServerAdapterConfig, ServerAdapterErrorCode, ServerAdapterErrorCodeType, ServerAdapterErrorContext, ServerAdapterEvents, ServerAdapterFactoryOptions, ServerContext, ServerFramework, ServerLifecycleState, ServerResponse, ServerStatus, ShutdownConfig, SSEWriteOptions, StreamingConfig, ToolExecuteRequest, ToolExecuteResponse, TrackedConnection, WebSocketConfig, WebSocketConnection, WebSocketHandler, WebSocketMessage, WebSocketMessageType, } from "./serverTypes.js";
42
42
  export * from "./conversationMemoryInterface.js";
43
- export type { StorageConfig } from "./conversation.js";
43
+ export type { StorageConfig, ConversationData, ConversationSummary, NeurolinkOptions, } from "./conversation.js";
44
+ export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
44
45
  export * from "./subscriptionTypes.js";
45
- export type { ClientConfig, RequestOptions as ClientRequestOptions, RetryConfig as ClientRetryConfig, ApiResponse as ClientApiResponse, ApiError as ClientApiError, ProviderStatus as ClientProviderStatus, StreamEventType as ClientStreamEventType, StreamEvent as ClientStreamEvent, StreamCallbacks as ClientStreamCallbacks, StreamResult as ClientStreamResult, GenerateRequestOptions as ClientGenerateRequestOptions, GenerateResponse as ClientGenerateResponse, StreamRequestOptions as ClientStreamRequestOptions, AgentExecuteOptions as ClientAgentExecuteOptions, AgentExecuteResult as ClientAgentExecuteResult, AgentInfo as ClientAgentInfo, WorkflowExecuteOptions as ClientWorkflowExecuteOptions, WorkflowExecuteResult as ClientWorkflowExecuteResult, WorkflowInfo as ClientWorkflowInfo, ToolInfo as ClientToolInfo, Middleware as ClientMiddleware, MiddlewareRequest as ClientMiddlewareRequest, MiddlewareResponse as ClientMiddlewareResponse, MiddlewareContext as ClientMiddlewareContext, ChatMessage as ClientChatMessage, UseChatOptions, UseChatReturn, UseAgentOptions, UseAgentReturn, UseWorkflowOptions, UseWorkflowReturn, UseVoiceOptions, UseVoiceReturn, UseStreamOptions, UseStreamReturn, UseToolsOptions, UseToolsReturn, LanguageModel as ClientLanguageModel, LanguageModelCallOptions as ClientLanguageModelCallOptions, LanguageModelResponse as ClientLanguageModelResponse, LanguageModelStreamResponse as ClientLanguageModelStreamResponse, NeuroLinkProviderOptions, ModelOptions as ClientModelOptions, WebSocketOptions as ClientWebSocketOptions, WebSocketState as ClientWebSocketState, WebSocketMessageHandler as ClientWebSocketMessageHandler, WSClientState, WSClientConfig, WSClientMessage, WSClientEventHandlers, SpeechRecognitionResult as ClientSpeechRecognitionResult, SpeechSynthesisOptions as ClientSpeechSynthesisOptions, AuthConfig as ClientAuthConfig, OAuth2Config as ClientOAuth2Config, TokenRefreshResult as ClientTokenRefreshResult, } from "./clientTypes.js";
46
+ export type { ClientConfig, RequestOptions as ClientRequestOptions, ClientRetryConfig, ClientApiResponse, ApiError as ClientApiError, ClientProviderStatus, StreamEventType as ClientStreamEventType, ClientStreamEvent, StreamCallbacks as ClientStreamCallbacks, ClientStreamResult, GenerateRequestOptions as ClientGenerateRequestOptions, GenerateResponse as ClientGenerateResponse, StreamRequestOptions as ClientStreamRequestOptions, AgentExecuteOptions as ClientAgentExecuteOptions, AgentExecuteResult as ClientAgentExecuteResult, AgentInfo as ClientAgentInfo, WorkflowExecuteOptions as ClientWorkflowExecuteOptions, WorkflowExecuteResult as ClientWorkflowExecuteResult, WorkflowInfo as ClientWorkflowInfo, ToolInfo as ClientToolInfo, Middleware as ClientMiddleware, MiddlewareRequest as ClientMiddlewareRequest, MiddlewareResponse as ClientMiddlewareResponse, ClientMiddlewareContext, ClientChatMessage, UseChatOptions, UseChatReturn, UseAgentOptions, UseAgentReturn, UseWorkflowOptions, UseWorkflowReturn, UseVoiceOptions, UseVoiceReturn, UseStreamOptions, UseStreamReturn, UseToolsOptions, UseToolsReturn, LanguageModel as ClientLanguageModel, LanguageModelCallOptions as ClientLanguageModelCallOptions, LanguageModelResponse as ClientLanguageModelResponse, LanguageModelStreamResponse as ClientLanguageModelStreamResponse, NeuroLinkProviderOptions, ModelOptions as ClientModelOptions, WebSocketOptions as ClientWebSocketOptions, WebSocketState as ClientWebSocketState, WebSocketMessageHandler as ClientWebSocketMessageHandler, WSClientState, WSClientConfig, WSClientMessage, WSClientEventHandlers, SpeechRecognitionResult as ClientSpeechRecognitionResult, SpeechSynthesisOptions as ClientSpeechSynthesisOptions, AuthConfig as ClientAuthConfig, ClientOAuth2Config, ClientTokenRefreshResult, } from "./clientTypes.js";
46
47
  export type { TokenRefresher } from "./subscriptionTypes.js";
47
48
  export * from "./proxyTypes.js";
48
49
  export type { AuthProviderType, AuthProviderConfig, MastraAuthProvider, BetterAuthConfig, Auth0Config, ClerkConfig, FirebaseConfig, SupabaseConfig, WorkOSConfig, JWTConfig, OAuth2Config, CognitoConfig, KeycloakConfig, CustomAuthConfig, BaseAuthProviderConfig, AuthUser, AuthSession, TokenType, TokenValidationResult as AuthTokenValidationResult, TokenClaims, JWK, JWKS, TokenRefreshResult, TokenValidationConfig, TokenExtractionConfig, SessionValidationResult, SessionStorage, AuthorizationResult, AuthRequestContext, AuthenticatedContext, TokenExtractionStrategy, SessionConfig, SessionStorageType, RBACConfig, PermissionDefinition, AuthCacheConfig, AuthMiddlewareOptions, AuthMiddlewareConfig, RBACMiddlewareConfig, AuthErrorCode, AuthErrorInfo, AuthErrorInfo as AuthErrorType, AuthEventType, AuthEventData, AuthEventHandler, AuthProviderFactoryFn, AuthProviderRegistration, AuthHealthCheck, AuthProviderHealthCheck, AuthEvents, AuthProviderMetadata, AuthProviderHealthStatus, AuthTokenValidator, AuthUserAuthorizer, AuthSessionManager, AuthRequestHandler, AuthUserManager, AuthLifecycle, } from "./authTypes.js";
49
- export type { Task, TaskDefinition, TaskSchedule, TaskScheduleType, CronSchedule, IntervalSchedule, OnceSchedule, TaskExecutionMode, TaskStatus, TaskRunResult, TaskRunError, TaskStore, TaskBackend, TaskBackendName, TaskManagerConfig, TaskRetentionConfig, ConversationEntry as TaskConversationEntry, } from "./taskTypes.js";
50
+ export type { Task, TaskDefinition, TaskSchedule, TaskScheduleType, CronSchedule, IntervalSchedule, OnceSchedule, TaskExecutionMode, TaskStatus, TaskRunResult, TaskRunError, TaskStore, TaskBackend, TaskBackendName, TaskManagerConfig, TaskRetentionConfig, WorkerState, ConversationEntry as TaskConversationEntry, } from "./taskTypes.js";
51
+ export { TASK_DEFAULTS } from "./taskTypes.js";
@@ -14,8 +14,8 @@ export * from "./taskClassificationTypes.js";
14
14
  // Tool system types
15
15
  export * from "./tools.js";
16
16
  export { PROCESSOR_PRIORITIES } from "../processors/base/types.js";
17
- // Content types for multimodal support (includes multimodal re-exports for backward compatibility)
18
- export * from "./content.js";
17
+ // Content types for multimodal support (direct export from canonical source)
18
+ export * from "./multimodal.js";
19
19
  // Evaluation types - NEW
20
20
  export * from "./evaluation.js";
21
21
  // Evaluation provider types - NEW
@@ -49,6 +49,8 @@ export * from "./fileReferenceTypes.js";
49
49
  export * from "./ragTypes.js";
50
50
  // Conversation memory manager type
51
51
  export * from "./conversationMemoryInterface.js";
52
+ // Error classes
53
+ export { AuthenticationError, AuthorizationError, NetworkError, RateLimitError, } from "./errors.js";
52
54
  // Subscription types (Claude subscription tiers, authentication, usage tracking)
53
55
  // NOTE: subscriptionTypes.ts re-exports auth types from ./authTypes.ts for
54
56
  // backward compatibility. Import StoredOAuthTokens, TokenRefresher, etc.
@@ -56,4 +58,5 @@ export * from "./conversationMemoryInterface.js";
56
58
  export * from "./subscriptionTypes.js";
57
59
  // Proxy types (Claude API format, cloaking, routing, config, stats, server adapters)
58
60
  export * from "./proxyTypes.js";
61
+ export { TASK_DEFAULTS } from "./taskTypes.js";
59
62
  //# sourceMappingURL=index.js.map
@@ -5,6 +5,7 @@
5
5
  * All exported interfaces from src/lib/rag/ are collected here as type aliases.
6
6
  */
7
7
  import type { BaseChunkerConfig, BM25Result, Chunk, ChunkingStrategy, DocumentType, ExtractionResult, ExtractParams, HybridSearchConfig, MetadataFilter, RerankResult, RerankerOptions, VectorQueryResult } from "../rag/types.js";
8
+ export type { ChunkingStrategy } from "../rag/types.js";
8
9
  /**
9
10
  * Citation format options
10
11
  */
@@ -535,3 +536,71 @@ export type RAGPreparedTool = {
535
536
  /** Number of files loaded */
536
537
  filesLoaded: number;
537
538
  };
539
+ /**
540
+ * RAG configuration for generate() and stream() APIs.
541
+ *
542
+ * When provided, NeuroLink automatically:
543
+ * 1. Loads the specified files
544
+ * 2. Chunks them using the selected strategy
545
+ * 3. Generates embeddings
546
+ * 4. Stores in an in-memory vector store
547
+ * 5. Creates a search tool the AI can invoke on demand
548
+ *
549
+ * @example
550
+ * ```typescript
551
+ * const result = await neurolink.generate({
552
+ * input: { text: "What is RAG?" },
553
+ * provider: "vertex",
554
+ * rag: {
555
+ * files: ["./docs/guide.md", "./docs/api.md"],
556
+ * strategy: "markdown",
557
+ * chunkSize: 512,
558
+ * topK: 5,
559
+ * }
560
+ * });
561
+ * ```
562
+ */
563
+ export type RAGConfig = {
564
+ /** File paths to load and index for retrieval */
565
+ files: string[];
566
+ /**
567
+ * Chunking strategy to use. If not specified, auto-detected from file extension.
568
+ * @default "recursive"
569
+ */
570
+ strategy?: ChunkingStrategy;
571
+ /**
572
+ * Maximum chunk size in characters.
573
+ * @default 1000
574
+ */
575
+ chunkSize?: number;
576
+ /**
577
+ * Overlap between adjacent chunks in characters.
578
+ * @default 200
579
+ */
580
+ chunkOverlap?: number;
581
+ /**
582
+ * Number of top results to retrieve per query.
583
+ * @default 5
584
+ */
585
+ topK?: number;
586
+ /**
587
+ * Tool name visible to the AI model.
588
+ * @default "search_knowledge_base"
589
+ */
590
+ toolName?: string;
591
+ /**
592
+ * Tool description for the AI model explaining what the knowledge base contains.
593
+ * @default "Search the loaded documents for relevant information to answer the user's question"
594
+ */
595
+ toolDescription?: string;
596
+ /**
597
+ * Embedding model provider for generating embeddings.
598
+ * Defaults to the same provider used for generation.
599
+ */
600
+ embeddingProvider?: string;
601
+ /**
602
+ * Embedding model name.
603
+ * Defaults to the provider's default embedding model.
604
+ */
605
+ embeddingModel?: string;
606
+ };
@@ -7,8 +7,7 @@
7
7
  */
8
8
  export type { AnyFunction, AsyncFunction, NeuroLinkEvents, StreamEvent, SyncFunction, TypedEventEmitter, } from "./common.js";
9
9
  export type { AnalyticsConfig, BackupInfo, BackupMetadata, CacheConfig, ConfigUpdateOptions, ConfigValidationResult, FallbackConfig, NeuroLinkConfig, PerformanceConfig, ProviderConfig, RetryConfig, ToolConfig, } from "./configTypes.js";
10
- export type { AISDKUsage, AudioChunk, AudioInputSpec, EnhancedStreamProvider, PCMEncoding, ProgressCallback, ResponseMetadata, StreamAnalyticsCollector, StreamingMetadata, StreamingOptions, StreamingProgressData, StreamOptions, StreamResult, StreamTextResult, ToolCall as StreamToolCall, // Note: Renamed in main index to avoid conflict with tools.js ToolCall
11
- ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
10
+ export type { AISDKUsage, AudioChunk, AudioInputSpec, EnhancedStreamProvider, PCMEncoding, ProgressCallback, ResponseMetadata, StreamAnalyticsCollector, StreamingMetadata, StreamingOptions, StreamingProgressData, StreamOptions, StreamResult, StreamTextResult, ToolCall as StreamToolCall, ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
12
11
  export type { AnalyticsData, TokenUsage } from "./analytics.js";
13
12
  export type { BaseCommandArgs, CommandResult, GenerateCommandArgs, GenerateResult as CLIGenerateResult, MCPCommandArgs, ModelsCommandArgs, StreamChunk, } from "./cli.js";
14
13
  export type { ErrorInfo, FunctionParameters, JsonArray, JsonObject, JsonValue, ProcessResult, Result, TestFunction, TestResult, Unknown, UnknownArray, UnknownRecord, } from "./common.js";