@juspay/neurolink 9.3.0 → 9.5.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +8 -8
  3. package/dist/cli/commands/config.d.ts +3 -3
  4. package/dist/cli/index.js +1 -0
  5. package/dist/index.d.ts +35 -0
  6. package/dist/index.js +17 -0
  7. package/dist/lib/agent/directTools.d.ts +5 -5
  8. package/dist/lib/index.d.ts +35 -0
  9. package/dist/lib/index.js +17 -0
  10. package/dist/lib/neurolink.d.ts +12 -1
  11. package/dist/lib/neurolink.js +265 -4
  12. package/dist/lib/server/utils/validation.d.ts +8 -8
  13. package/dist/lib/types/generateTypes.d.ts +28 -0
  14. package/dist/lib/types/index.d.ts +6 -0
  15. package/dist/lib/types/index.js +12 -0
  16. package/dist/lib/types/modelTypes.d.ts +2 -2
  17. package/dist/lib/types/streamTypes.d.ts +35 -0
  18. package/dist/lib/types/workflowTypes.d.ts +558 -0
  19. package/dist/lib/types/workflowTypes.js +32 -0
  20. package/dist/lib/workflow/LAYER-EXAMPLES.d.ts +13 -0
  21. package/dist/lib/workflow/LAYER-EXAMPLES.js +312 -0
  22. package/dist/lib/workflow/PROMPT-EXAMPLES.d.ts +117 -0
  23. package/dist/lib/workflow/PROMPT-EXAMPLES.js +246 -0
  24. package/dist/lib/workflow/config.d.ts +1569 -0
  25. package/dist/lib/workflow/config.js +399 -0
  26. package/dist/lib/workflow/core/ensembleExecutor.d.ts +56 -0
  27. package/dist/lib/workflow/core/ensembleExecutor.js +398 -0
  28. package/dist/lib/workflow/core/judgeScorer.d.ts +26 -0
  29. package/dist/lib/workflow/core/judgeScorer.js +527 -0
  30. package/dist/lib/workflow/core/responseConditioner.d.ts +22 -0
  31. package/dist/lib/workflow/core/responseConditioner.js +226 -0
  32. package/dist/lib/workflow/core/types/conditionerTypes.d.ts +7 -0
  33. package/dist/lib/workflow/core/types/conditionerTypes.js +8 -0
  34. package/dist/lib/workflow/core/types/ensembleTypes.d.ts +7 -0
  35. package/dist/lib/workflow/core/types/ensembleTypes.js +8 -0
  36. package/dist/lib/workflow/core/types/index.d.ts +7 -0
  37. package/dist/lib/workflow/core/types/index.js +8 -0
  38. package/dist/lib/workflow/core/types/judgeTypes.d.ts +7 -0
  39. package/dist/lib/workflow/core/types/judgeTypes.js +8 -0
  40. package/dist/lib/workflow/core/types/layerTypes.d.ts +7 -0
  41. package/dist/lib/workflow/core/types/layerTypes.js +8 -0
  42. package/dist/lib/workflow/core/types/registryTypes.d.ts +7 -0
  43. package/dist/lib/workflow/core/types/registryTypes.js +8 -0
  44. package/dist/lib/workflow/core/workflowRegistry.d.ts +73 -0
  45. package/dist/lib/workflow/core/workflowRegistry.js +305 -0
  46. package/dist/lib/workflow/core/workflowRunner.d.ts +115 -0
  47. package/dist/lib/workflow/core/workflowRunner.js +554 -0
  48. package/dist/lib/workflow/index.d.ts +36 -0
  49. package/dist/lib/workflow/index.js +51 -0
  50. package/dist/lib/workflow/types.d.ts +19 -0
  51. package/dist/lib/workflow/types.js +10 -0
  52. package/dist/lib/workflow/utils/types/index.d.ts +7 -0
  53. package/dist/lib/workflow/utils/types/index.js +8 -0
  54. package/dist/lib/workflow/utils/types/metricsTypes.d.ts +7 -0
  55. package/dist/lib/workflow/utils/types/metricsTypes.js +8 -0
  56. package/dist/lib/workflow/utils/types/validationTypes.d.ts +7 -0
  57. package/dist/lib/workflow/utils/types/validationTypes.js +8 -0
  58. package/dist/lib/workflow/utils/workflowMetrics.d.ts +76 -0
  59. package/dist/lib/workflow/utils/workflowMetrics.js +312 -0
  60. package/dist/lib/workflow/utils/workflowValidation.d.ts +29 -0
  61. package/dist/lib/workflow/utils/workflowValidation.js +421 -0
  62. package/dist/lib/workflow/workflows/adaptiveWorkflow.d.ts +72 -0
  63. package/dist/lib/workflow/workflows/adaptiveWorkflow.js +367 -0
  64. package/dist/lib/workflow/workflows/consensusWorkflow.d.ts +69 -0
  65. package/dist/lib/workflow/workflows/consensusWorkflow.js +193 -0
  66. package/dist/lib/workflow/workflows/fallbackWorkflow.d.ts +49 -0
  67. package/dist/lib/workflow/workflows/fallbackWorkflow.js +226 -0
  68. package/dist/lib/workflow/workflows/multiJudgeWorkflow.d.ts +70 -0
  69. package/dist/lib/workflow/workflows/multiJudgeWorkflow.js +352 -0
  70. package/dist/neurolink.d.ts +12 -1
  71. package/dist/neurolink.js +265 -4
  72. package/dist/types/generateTypes.d.ts +28 -0
  73. package/dist/types/index.d.ts +6 -0
  74. package/dist/types/index.js +12 -0
  75. package/dist/types/streamTypes.d.ts +35 -0
  76. package/dist/types/workflowTypes.d.ts +558 -0
  77. package/dist/types/workflowTypes.js +31 -0
  78. package/dist/workflow/LAYER-EXAMPLES.d.ts +13 -0
  79. package/dist/workflow/LAYER-EXAMPLES.js +311 -0
  80. package/dist/workflow/PROMPT-EXAMPLES.d.ts +117 -0
  81. package/dist/workflow/PROMPT-EXAMPLES.js +245 -0
  82. package/dist/workflow/config.d.ts +1569 -0
  83. package/dist/workflow/config.js +398 -0
  84. package/dist/workflow/core/ensembleExecutor.d.ts +56 -0
  85. package/dist/workflow/core/ensembleExecutor.js +397 -0
  86. package/dist/workflow/core/judgeScorer.d.ts +26 -0
  87. package/dist/workflow/core/judgeScorer.js +526 -0
  88. package/dist/workflow/core/responseConditioner.d.ts +22 -0
  89. package/dist/workflow/core/responseConditioner.js +225 -0
  90. package/dist/workflow/core/types/conditionerTypes.d.ts +7 -0
  91. package/dist/workflow/core/types/conditionerTypes.js +7 -0
  92. package/dist/workflow/core/types/ensembleTypes.d.ts +7 -0
  93. package/dist/workflow/core/types/ensembleTypes.js +7 -0
  94. package/dist/workflow/core/types/index.d.ts +7 -0
  95. package/dist/workflow/core/types/index.js +7 -0
  96. package/dist/workflow/core/types/judgeTypes.d.ts +7 -0
  97. package/dist/workflow/core/types/judgeTypes.js +7 -0
  98. package/dist/workflow/core/types/layerTypes.d.ts +7 -0
  99. package/dist/workflow/core/types/layerTypes.js +7 -0
  100. package/dist/workflow/core/types/registryTypes.d.ts +7 -0
  101. package/dist/workflow/core/types/registryTypes.js +7 -0
  102. package/dist/workflow/core/workflowRegistry.d.ts +73 -0
  103. package/dist/workflow/core/workflowRegistry.js +304 -0
  104. package/dist/workflow/core/workflowRunner.d.ts +115 -0
  105. package/dist/workflow/core/workflowRunner.js +553 -0
  106. package/dist/workflow/index.d.ts +36 -0
  107. package/dist/workflow/index.js +50 -0
  108. package/dist/workflow/types.d.ts +19 -0
  109. package/dist/workflow/types.js +9 -0
  110. package/dist/workflow/utils/types/index.d.ts +7 -0
  111. package/dist/workflow/utils/types/index.js +7 -0
  112. package/dist/workflow/utils/types/metricsTypes.d.ts +7 -0
  113. package/dist/workflow/utils/types/metricsTypes.js +7 -0
  114. package/dist/workflow/utils/types/validationTypes.d.ts +7 -0
  115. package/dist/workflow/utils/types/validationTypes.js +7 -0
  116. package/dist/workflow/utils/workflowMetrics.d.ts +76 -0
  117. package/dist/workflow/utils/workflowMetrics.js +311 -0
  118. package/dist/workflow/utils/workflowValidation.d.ts +29 -0
  119. package/dist/workflow/utils/workflowValidation.js +420 -0
  120. package/dist/workflow/workflows/adaptiveWorkflow.d.ts +72 -0
  121. package/dist/workflow/workflows/adaptiveWorkflow.js +366 -0
  122. package/dist/workflow/workflows/consensusWorkflow.d.ts +69 -0
  123. package/dist/workflow/workflows/consensusWorkflow.js +192 -0
  124. package/dist/workflow/workflows/fallbackWorkflow.d.ts +49 -0
  125. package/dist/workflow/workflows/fallbackWorkflow.js +225 -0
  126. package/dist/workflow/workflows/multiJudgeWorkflow.d.ts +70 -0
  127. package/dist/workflow/workflows/multiJudgeWorkflow.js +351 -0
  128. package/package.json +3 -2
@@ -42,8 +42,8 @@ export declare const AgentExecuteRequestSchema: z.ZodObject<{
42
42
  sessionId?: string | undefined;
43
43
  temperature?: number | undefined;
44
44
  maxTokens?: number | undefined;
45
- stream?: boolean | undefined;
46
45
  systemPrompt?: string | undefined;
46
+ stream?: boolean | undefined;
47
47
  }, {
48
48
  input: string | {
49
49
  text: string;
@@ -57,8 +57,8 @@ export declare const AgentExecuteRequestSchema: z.ZodObject<{
57
57
  sessionId?: string | undefined;
58
58
  temperature?: number | undefined;
59
59
  maxTokens?: number | undefined;
60
- stream?: boolean | undefined;
61
60
  systemPrompt?: string | undefined;
61
+ stream?: boolean | undefined;
62
62
  }>;
63
63
  /**
64
64
  * Tool execute request schema
@@ -122,12 +122,12 @@ export declare const ToolSearchQuerySchema: z.ZodObject<{
122
122
  limit: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
123
123
  }, "strip", z.ZodTypeAny, {
124
124
  source?: string | undefined;
125
- q?: string | undefined;
126
125
  limit?: number | undefined;
126
+ q?: string | undefined;
127
127
  }, {
128
128
  source?: string | undefined;
129
- q?: string | undefined;
130
129
  limit?: string | undefined;
130
+ q?: string | undefined;
131
131
  }>;
132
132
  /**
133
133
  * Generic ID parameter schema (for session endpoints using :id)
@@ -148,12 +148,12 @@ export declare const SessionsListQuerySchema: z.ZodObject<{
148
148
  offset: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
149
149
  }, "strip", z.ZodTypeAny, {
150
150
  userId?: string | undefined;
151
- limit?: number | undefined;
152
151
  offset?: number | undefined;
152
+ limit?: number | undefined;
153
153
  }, {
154
154
  userId?: string | undefined;
155
- limit?: string | undefined;
156
155
  offset?: string | undefined;
156
+ limit?: string | undefined;
157
157
  }>;
158
158
  /**
159
159
  * Session messages query schema (for pagination)
@@ -162,11 +162,11 @@ export declare const SessionMessagesQuerySchema: z.ZodObject<{
162
162
  limit: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
163
163
  offset: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
164
164
  }, "strip", z.ZodTypeAny, {
165
- limit?: number | undefined;
166
165
  offset?: number | undefined;
166
+ limit?: number | undefined;
167
167
  }, {
168
- limit?: string | undefined;
169
168
  offset?: string | undefined;
169
+ limit?: string | undefined;
170
170
  }>;
171
171
  /**
172
172
  * Standardized error response format
@@ -258,6 +258,8 @@ export type GenerateOptions = {
258
258
  enableProgress?: boolean;
259
259
  fallbackToGenerate?: boolean;
260
260
  };
261
+ workflow?: string;
262
+ workflowConfig?: import("../workflow/types.js").WorkflowConfig;
261
263
  /**
262
264
  * RAG (Retrieval-Augmented Generation) configuration.
263
265
  *
@@ -415,6 +417,32 @@ export type GenerateResult = {
415
417
  streamId?: string;
416
418
  bufferOptimization?: boolean;
417
419
  };
420
+ workflow?: {
421
+ originalResponse: string;
422
+ processedResponse: string;
423
+ ensembleResponses: Array<{
424
+ provider: string;
425
+ model: string;
426
+ content: string;
427
+ responseTime: number;
428
+ status: "success" | "failure" | "timeout" | "partial";
429
+ error?: string;
430
+ }>;
431
+ judgeScores?: {
432
+ scores: Record<string, number>;
433
+ reasoning?: string;
434
+ selectedModel: string;
435
+ };
436
+ selectedModel: string;
437
+ metrics: {
438
+ totalTime: number;
439
+ ensembleTime: number;
440
+ judgeTime?: number;
441
+ conditioningTime?: number;
442
+ };
443
+ workflowId: string;
444
+ workflowName: string;
445
+ };
418
446
  };
419
447
  /**
420
448
  * Unified options for both generation and streaming
@@ -33,3 +33,9 @@ export type { EnhancedStreamProvider, ProgressCallback, StreamingMetadata, Strea
33
33
  ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
34
34
  export * from "./ttsTypes.js";
35
35
  export * from "./utilities.js";
36
+ export * from "./middlewareTypes.js";
37
+ export * from "./fileTypes.js";
38
+ export * from "./content.js";
39
+ export * from "./ttsTypes.js";
40
+ export * from "./hitlTypes.js";
41
+ export * from "./workflowTypes.js";
@@ -38,4 +38,16 @@ export * from "./serviceTypes.js";
38
38
  export * from "./ttsTypes.js";
39
39
  // Utilities Types - Utility module types (selective export to avoid conflicts)
40
40
  export * from "./utilities.js";
41
+ // Middleware Types - Middleware system types
42
+ export * from "./middlewareTypes.js";
43
+ // File detection and processing types
44
+ export * from "./fileTypes.js";
45
+ // Content types for multimodal support (includes multimodal re-exports for backward compatibility)
46
+ export * from "./content.js";
47
+ // TTS (Text-to-Speech) types
48
+ export * from "./ttsTypes.js";
49
+ // HITL (Human-in-the-Loop) types
50
+ export * from "./hitlTypes.js";
51
+ // Workflow types
52
+ export * from "./workflowTypes.js";
41
53
  //# sourceMappingURL=index.js.map
@@ -160,7 +160,6 @@ export declare const ModelRegistrySchema: z.ZodObject<{
160
160
  defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
161
161
  }, "strip", z.ZodTypeAny, {
162
162
  version: string;
163
- lastUpdated: string;
164
163
  models: Record<string, Record<string, {
165
164
  capabilities: string[];
166
165
  id: string;
@@ -173,11 +172,11 @@ export declare const ModelRegistrySchema: z.ZodObject<{
173
172
  contextWindow: number;
174
173
  releaseDate: string;
175
174
  }>>;
175
+ lastUpdated: string;
176
176
  aliases?: Record<string, string> | undefined;
177
177
  defaults?: Record<string, string> | undefined;
178
178
  }, {
179
179
  version: string;
180
- lastUpdated: string;
181
180
  models: Record<string, Record<string, {
182
181
  capabilities: string[];
183
182
  id: string;
@@ -190,6 +189,7 @@ export declare const ModelRegistrySchema: z.ZodObject<{
190
189
  contextWindow: number;
191
190
  releaseDate: string;
192
191
  }>>;
192
+ lastUpdated: string;
193
193
  aliases?: Record<string, string> | undefined;
194
194
  defaults?: Record<string, string> | undefined;
195
195
  }>;
@@ -348,6 +348,8 @@ export type StreamOptions = {
348
348
  };
349
349
  conversationMessages?: ChatMessage[];
350
350
  middleware?: MiddlewareFactoryOptions;
351
+ workflow?: string;
352
+ workflowConfig?: import("../workflow/types.js").WorkflowConfig;
351
353
  enableSummarization?: boolean;
352
354
  /**
353
355
  * RAG (Retrieval-Augmented Generation) configuration.
@@ -384,6 +386,12 @@ export type StreamResult = {
384
386
  imageOutput: {
385
387
  base64: string;
386
388
  };
389
+ } | {
390
+ content: string;
391
+ type?: "preliminary" | "final";
392
+ } | {
393
+ type: "audio";
394
+ audio: AudioChunk;
387
395
  }>;
388
396
  provider?: string;
389
397
  model?: string;
@@ -400,6 +408,7 @@ export type StreamResult = {
400
408
  totalChunks?: number;
401
409
  estimatedDuration?: number;
402
410
  responseTime?: number;
411
+ preliminaryTime?: number;
403
412
  fallback?: boolean;
404
413
  totalToolExecutions?: number;
405
414
  toolExecutionTime?: number;
@@ -421,6 +430,32 @@ export type StreamResult = {
421
430
  timestamp: number;
422
431
  [key: string]: unknown;
423
432
  }>;
433
+ workflow?: {
434
+ originalResponse: string;
435
+ processedResponse: string;
436
+ ensembleResponses: Array<{
437
+ provider: string;
438
+ model: string;
439
+ content: string;
440
+ responseTime: number;
441
+ status: "success" | "failure" | "timeout" | "partial";
442
+ error?: string;
443
+ }>;
444
+ judgeScores?: {
445
+ scores: Record<string, number>;
446
+ reasoning?: string;
447
+ selectedModel: string;
448
+ };
449
+ selectedModel: string;
450
+ metrics: {
451
+ totalTime: number;
452
+ ensembleTime: number;
453
+ judgeTime?: number;
454
+ conditioningTime?: number;
455
+ };
456
+ workflowId: string;
457
+ workflowName: string;
458
+ };
424
459
  };
425
460
  /**
426
461
  * Enhanced provider type with stream method