@juspay/neurolink 9.43.0 → 9.44.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.
- package/CHANGELOG.md +8 -0
- package/dist/browser/neurolink.min.js +258 -258
- package/dist/cli/commands/authProviders.d.ts +1 -1
- package/dist/cli/commands/task.js +1 -1
- package/dist/cli/errorHandler.js +1 -1
- package/dist/cli/factories/commandFactory.js +1 -1
- package/dist/cli/loop/conversationSelector.d.ts +2 -2
- package/dist/cli/loop/optionsSchema.d.ts +2 -2
- package/dist/cli/loop/session.d.ts +1 -1
- package/dist/cli/utils/audioFileUtils.d.ts +1 -1
- package/dist/cli/utils/envManager.d.ts +1 -1
- package/dist/cli/utils/videoFileUtils.d.ts +1 -1
- package/dist/client/auth.d.ts +3 -3
- package/dist/client/httpClient.d.ts +20 -20
- package/dist/client/index.d.ts +3 -3
- package/dist/client/interceptors.d.ts +1 -1
- package/dist/client/reactHooks.d.ts +1 -1
- package/dist/client/reactHooks.tsx +2 -2
- package/dist/client/sseClient.d.ts +1 -1
- package/dist/client/streamingClient.d.ts +1 -1
- package/dist/client/wsClient.d.ts +1 -1
- package/dist/files/fileTools.d.ts +1 -1
- package/dist/lib/agent/directTools.d.ts +2 -2
- package/dist/lib/client/auth.d.ts +3 -3
- package/dist/lib/client/httpClient.d.ts +20 -20
- package/dist/lib/client/index.d.ts +3 -3
- package/dist/lib/client/interceptors.d.ts +1 -1
- package/dist/lib/client/reactHooks.d.ts +1 -1
- package/dist/lib/client/sseClient.d.ts +1 -1
- package/dist/lib/client/streamingClient.d.ts +1 -1
- package/dist/lib/client/wsClient.d.ts +1 -1
- package/dist/lib/files/fileTools.d.ts +1 -1
- package/dist/lib/rag/types.d.ts +1 -68
- package/dist/lib/server/types.d.ts +3 -847
- package/dist/lib/server/types.js +3 -64
- package/dist/lib/tasks/tools/taskTools.d.ts +1 -1
- package/dist/lib/types/analytics.d.ts +1 -1
- package/dist/lib/types/cli.d.ts +1 -1
- package/dist/lib/types/clientTypes.d.ts +38 -20
- package/dist/lib/types/configTypes.d.ts +1 -1
- package/dist/lib/types/configTypes.js +0 -1
- package/dist/lib/types/index.d.ts +8 -6
- package/dist/lib/types/index.js +3 -0
- package/dist/lib/types/ragTypes.d.ts +69 -0
- package/dist/lib/types/sdkTypes.d.ts +1 -2
- package/dist/lib/types/serverTypes.d.ts +858 -0
- package/dist/lib/types/serverTypes.js +68 -0
- package/dist/lib/types/streamTypes.d.ts +2 -2
- package/dist/lib/types/typeAliases.d.ts +1 -37
- package/dist/lib/workflow/config.d.ts +3 -3
- package/dist/rag/errors/RAGError.d.ts +1 -1
- package/dist/rag/types.d.ts +1 -68
- package/dist/server/types.d.ts +3 -847
- package/dist/server/types.js +3 -64
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/cli.d.ts +1 -1
- package/dist/types/clientTypes.d.ts +38 -20
- package/dist/types/configTypes.d.ts +1 -1
- package/dist/types/index.d.ts +8 -6
- package/dist/types/index.js +3 -0
- package/dist/types/ragTypes.d.ts +69 -0
- package/dist/types/sdkTypes.d.ts +1 -2
- package/dist/types/serverTypes.d.ts +858 -0
- package/dist/types/serverTypes.js +67 -0
- package/dist/types/streamTypes.d.ts +2 -2
- package/dist/types/typeAliases.d.ts +1 -37
- package/dist/workflow/config.d.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Adapter Types
|
|
3
|
+
* Comprehensive type system for NeuroLink server adapters
|
|
4
|
+
*/
|
|
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
|
+
};
|
|
68
|
+
//# sourceMappingURL=serverTypes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LanguageModel, StepResult, Tool, ToolChoice } from "ai";
|
|
2
2
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
|
-
import type { EvaluationData } from "
|
|
4
|
-
import type { RAGConfig } from "
|
|
3
|
+
import type { EvaluationData } from "./evaluation.js";
|
|
4
|
+
import type { RAGConfig } from "./ragTypes.js";
|
|
5
5
|
import type { AnalyticsData, ToolExecutionEvent, ToolExecutionSummary } from "../types/index.js";
|
|
6
6
|
import type { MiddlewareFactoryOptions, OnChunkCallback, OnErrorCallback, OnFinishCallback } from "../types/middlewareTypes.js";
|
|
7
7
|
import type { TokenUsage } from "./analytics.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ZodTypeAny } from "zod";
|
|
6
6
|
import type { Schema } from "ai";
|
|
7
|
-
import type { JsonValue,
|
|
7
|
+
import type { JsonValue, Result, AsyncFunction } from "./common.js";
|
|
8
8
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
9
9
|
/**
|
|
10
10
|
* Type alias for complex Zod schema type to improve readability
|
|
@@ -65,11 +65,6 @@ export type JsonRecord = Record<string, JsonValue>;
|
|
|
65
65
|
export type OptionalStandardRecord = StandardRecord | undefined;
|
|
66
66
|
export type OptionalStringRecord = StringRecord | undefined;
|
|
67
67
|
export type OptionalJsonRecord = JsonRecord | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Standard async function type for tool execution
|
|
70
|
-
* Most common function signature in the codebase
|
|
71
|
-
*/
|
|
72
|
-
export type AsyncFunction<TParams = unknown, TResult = unknown> = (params: TParams) => Promise<TResult>;
|
|
73
68
|
/**
|
|
74
69
|
* Tool execution function with context
|
|
75
70
|
* Standard pattern for MCP tool execution
|
|
@@ -98,21 +93,11 @@ export type TransformFunction<TInput = unknown, TOutput = unknown> = (input: TIn
|
|
|
98
93
|
* Async transformation function type
|
|
99
94
|
*/
|
|
100
95
|
export type AsyncTransformFunction<TInput = unknown, TOutput = unknown> = (input: TInput) => Promise<TOutput>;
|
|
101
|
-
/**
|
|
102
|
-
* Array of unknown values
|
|
103
|
-
* Common for flexible array parameters
|
|
104
|
-
*/
|
|
105
|
-
export type UnknownArray = unknown[];
|
|
106
96
|
/**
|
|
107
97
|
* Array of standard records
|
|
108
98
|
* Common in data collections
|
|
109
99
|
*/
|
|
110
100
|
export type RecordArray = StandardRecord[];
|
|
111
|
-
/**
|
|
112
|
-
* Array of JSON objects
|
|
113
|
-
* API-safe array type
|
|
114
|
-
*/
|
|
115
|
-
export type JsonArray = JsonObject[];
|
|
116
101
|
/**
|
|
117
102
|
* String array type
|
|
118
103
|
* Very common for lists of identifiers, names, etc.
|
|
@@ -203,17 +188,6 @@ export type StandardError = {
|
|
|
203
188
|
details?: StandardRecord;
|
|
204
189
|
stack?: string;
|
|
205
190
|
};
|
|
206
|
-
/**
|
|
207
|
-
* Result type with success/error pattern
|
|
208
|
-
* Common pattern for operation results
|
|
209
|
-
*/
|
|
210
|
-
export type Result<TData = unknown, TError = StandardError> = {
|
|
211
|
-
success: true;
|
|
212
|
-
data: TData;
|
|
213
|
-
} | {
|
|
214
|
-
success: false;
|
|
215
|
-
error: TError;
|
|
216
|
-
};
|
|
217
191
|
/**
|
|
218
192
|
* Async result type
|
|
219
193
|
*/
|
|
@@ -285,16 +259,6 @@ export type ServiceConfig = {
|
|
|
285
259
|
apiKey?: string;
|
|
286
260
|
metadata?: StandardRecord;
|
|
287
261
|
};
|
|
288
|
-
/**
|
|
289
|
-
* Cache configuration
|
|
290
|
-
* Common caching parameters
|
|
291
|
-
*/
|
|
292
|
-
export type CacheConfig = {
|
|
293
|
-
enabled?: boolean;
|
|
294
|
-
ttl?: number;
|
|
295
|
-
maxSize?: number;
|
|
296
|
-
strategy?: "memory" | "redis" | "hybrid";
|
|
297
|
-
};
|
|
298
262
|
/**
|
|
299
263
|
* Rate limiting configuration
|
|
300
264
|
* Common rate limiting parameters
|
|
@@ -41,8 +41,8 @@ export declare const JudgeConfigSchema: z.ZodObject<{
|
|
|
41
41
|
model: z.ZodString;
|
|
42
42
|
criteria: z.ZodArray<z.ZodString>;
|
|
43
43
|
outputFormat: z.ZodEnum<{
|
|
44
|
-
scores: "scores";
|
|
45
44
|
detailed: "detailed";
|
|
45
|
+
scores: "scores";
|
|
46
46
|
ranking: "ranking";
|
|
47
47
|
best: "best";
|
|
48
48
|
}>;
|
|
@@ -195,8 +195,8 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
195
195
|
model: z.ZodString;
|
|
196
196
|
criteria: z.ZodArray<z.ZodString>;
|
|
197
197
|
outputFormat: z.ZodEnum<{
|
|
198
|
-
scores: "scores";
|
|
199
198
|
detailed: "detailed";
|
|
199
|
+
scores: "scores";
|
|
200
200
|
ranking: "ranking";
|
|
201
201
|
best: "best";
|
|
202
202
|
}>;
|
|
@@ -219,8 +219,8 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
219
219
|
model: z.ZodString;
|
|
220
220
|
criteria: z.ZodArray<z.ZodString>;
|
|
221
221
|
outputFormat: z.ZodEnum<{
|
|
222
|
-
scores: "scores";
|
|
223
222
|
detailed: "detailed";
|
|
223
|
+
scores: "scores";
|
|
224
224
|
ranking: "ranking";
|
|
225
225
|
best: "best";
|
|
226
226
|
}>;
|
|
@@ -82,7 +82,7 @@ export declare const RAGErrorFactory: {
|
|
|
82
82
|
readonly RETRY_EXHAUSTED: "RAG_RETRY_EXHAUSTED";
|
|
83
83
|
readonly INVALID_CONFIGURATION: "RAG_INVALID_CONFIGURATION";
|
|
84
84
|
};
|
|
85
|
-
create: (code: "
|
|
85
|
+
create: (code: "CHUNKING_ERROR" | "CHUNKING_INVALID_CONFIG" | "CHUNKING_STRATEGY_NOT_FOUND" | "CHUNKING_EMPTY_CONTENT" | "CHUNKING_SIZE_EXCEEDED" | "METADATA_EXTRACTION_ERROR" | "METADATA_EXTRACTION_TIMEOUT" | "METADATA_SCHEMA_INVALID" | "METADATA_EXTRACTOR_NOT_FOUND" | "EMBEDDING_ERROR" | "EMBEDDING_DIMENSION_MISMATCH" | "EMBEDDING_RATE_LIMIT" | "EMBEDDING_PROVIDER_ERROR" | "VECTOR_QUERY_ERROR" | "VECTOR_QUERY_TIMEOUT" | "VECTOR_STORE_UNAVAILABLE" | "VECTOR_STORE_CONNECTION_ERROR" | "VECTOR_INDEX_NOT_FOUND" | "RERANKER_ERROR" | "RERANKER_NOT_FOUND" | "RERANKER_API_ERROR" | "GRAPH_RAG_ERROR" | "GRAPH_TRAVERSAL_ERROR" | "GRAPH_NODE_NOT_FOUND" | "PIPELINE_ERROR" | "PIPELINE_STAGE_FAILED" | "PIPELINE_PARTIAL_FAILURE" | "CIRCUIT_BREAKER_OPEN" | "CIRCUIT_BREAKER_HALF_OPEN_LIMIT" | "OPERATION_TIMEOUT" | "RETRY_EXHAUSTED" | "INVALID_CONFIGURATION", message: string, options?: {
|
|
86
86
|
retryable?: boolean;
|
|
87
87
|
details?: Record<string, unknown>;
|
|
88
88
|
cause?: Error;
|
package/dist/rag/types.d.ts
CHANGED
|
@@ -698,71 +698,4 @@ export type RAGCommandArgs = {
|
|
|
698
698
|
/** Use Graph RAG */
|
|
699
699
|
graph?: boolean;
|
|
700
700
|
};
|
|
701
|
-
|
|
702
|
-
* RAG configuration for generate() and stream() APIs.
|
|
703
|
-
*
|
|
704
|
-
* When provided, NeuroLink automatically:
|
|
705
|
-
* 1. Loads the specified files
|
|
706
|
-
* 2. Chunks them using the selected strategy
|
|
707
|
-
* 3. Generates embeddings
|
|
708
|
-
* 4. Stores in an in-memory vector store
|
|
709
|
-
* 5. Creates a search tool the AI can invoke on demand
|
|
710
|
-
*
|
|
711
|
-
* @example
|
|
712
|
-
* ```typescript
|
|
713
|
-
* const result = await neurolink.generate({
|
|
714
|
-
* input: { text: "What is RAG?" },
|
|
715
|
-
* provider: "vertex",
|
|
716
|
-
* rag: {
|
|
717
|
-
* files: ["./docs/guide.md", "./docs/api.md"],
|
|
718
|
-
* strategy: "markdown",
|
|
719
|
-
* chunkSize: 512,
|
|
720
|
-
* topK: 5,
|
|
721
|
-
* }
|
|
722
|
-
* });
|
|
723
|
-
* ```
|
|
724
|
-
*/
|
|
725
|
-
export type RAGConfig = {
|
|
726
|
-
/** File paths to load and index for retrieval */
|
|
727
|
-
files: string[];
|
|
728
|
-
/**
|
|
729
|
-
* Chunking strategy to use. If not specified, auto-detected from file extension.
|
|
730
|
-
* @default "recursive"
|
|
731
|
-
*/
|
|
732
|
-
strategy?: ChunkingStrategy;
|
|
733
|
-
/**
|
|
734
|
-
* Maximum chunk size in characters.
|
|
735
|
-
* @default 1000
|
|
736
|
-
*/
|
|
737
|
-
chunkSize?: number;
|
|
738
|
-
/**
|
|
739
|
-
* Overlap between adjacent chunks in characters.
|
|
740
|
-
* @default 200
|
|
741
|
-
*/
|
|
742
|
-
chunkOverlap?: number;
|
|
743
|
-
/**
|
|
744
|
-
* Number of top results to retrieve per query.
|
|
745
|
-
* @default 5
|
|
746
|
-
*/
|
|
747
|
-
topK?: number;
|
|
748
|
-
/**
|
|
749
|
-
* Tool name visible to the AI model.
|
|
750
|
-
* @default "search_knowledge_base"
|
|
751
|
-
*/
|
|
752
|
-
toolName?: string;
|
|
753
|
-
/**
|
|
754
|
-
* Tool description for the AI model explaining what the knowledge base contains.
|
|
755
|
-
* @default "Search the loaded documents for relevant information to answer the user's question"
|
|
756
|
-
*/
|
|
757
|
-
toolDescription?: string;
|
|
758
|
-
/**
|
|
759
|
-
* Embedding model provider for generating embeddings.
|
|
760
|
-
* Defaults to the same provider used for generation.
|
|
761
|
-
*/
|
|
762
|
-
embeddingProvider?: string;
|
|
763
|
-
/**
|
|
764
|
-
* Embedding model name.
|
|
765
|
-
* Defaults to the provider's default embedding model.
|
|
766
|
-
*/
|
|
767
|
-
embeddingModel?: string;
|
|
768
|
-
};
|
|
701
|
+
export type { RAGConfig } from "../types/ragTypes.js";
|