@juspay/neurolink 9.23.0 → 9.25.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 (225) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +10 -13
  3. package/dist/adapters/tts/googleTTSHandler.js +26 -1
  4. package/dist/adapters/video/vertexVideoHandler.js +23 -17
  5. package/dist/cli/commands/config.d.ts +3 -3
  6. package/dist/cli/commands/observability.d.ts +53 -0
  7. package/dist/cli/commands/observability.js +453 -0
  8. package/dist/cli/commands/telemetry.d.ts +63 -0
  9. package/dist/cli/commands/telemetry.js +689 -0
  10. package/dist/cli/factories/commandFactory.d.ts +34 -0
  11. package/dist/cli/factories/commandFactory.js +321 -116
  12. package/dist/cli/parser.js +6 -9
  13. package/dist/cli/utils/formatters.d.ts +13 -0
  14. package/dist/cli/utils/formatters.js +23 -0
  15. package/dist/constants/contextWindows.js +6 -0
  16. package/dist/constants/enums.d.ts +6 -0
  17. package/dist/constants/enums.js +8 -2
  18. package/dist/context/budgetChecker.js +75 -48
  19. package/dist/context/contextCompactor.js +135 -127
  20. package/dist/core/baseProvider.d.ts +5 -0
  21. package/dist/core/baseProvider.js +158 -102
  22. package/dist/core/conversationMemoryInitializer.js +7 -4
  23. package/dist/core/conversationMemoryManager.d.ts +2 -0
  24. package/dist/core/conversationMemoryManager.js +6 -2
  25. package/dist/core/modules/GenerationHandler.d.ts +2 -2
  26. package/dist/core/modules/GenerationHandler.js +12 -12
  27. package/dist/evaluation/ragasEvaluator.js +39 -19
  28. package/dist/evaluation/scoring.js +46 -20
  29. package/dist/features/ppt/index.d.ts +1 -1
  30. package/dist/features/ppt/index.js +1 -1
  31. package/dist/features/ppt/presentationOrchestrator.js +23 -0
  32. package/dist/features/ppt/slideGenerator.js +13 -0
  33. package/dist/features/ppt/slideRenderers.d.ts +1 -1
  34. package/dist/features/ppt/slideRenderers.js +6 -4
  35. package/dist/features/ppt/slideTypeInference.d.ts +1 -1
  36. package/dist/features/ppt/slideTypeInference.js +75 -73
  37. package/dist/files/fileTools.d.ts +6 -6
  38. package/dist/index.d.ts +46 -12
  39. package/dist/index.js +79 -17
  40. package/dist/lib/adapters/tts/googleTTSHandler.js +26 -1
  41. package/dist/lib/adapters/video/vertexVideoHandler.js +23 -17
  42. package/dist/lib/constants/contextWindows.js +6 -0
  43. package/dist/lib/constants/enums.d.ts +6 -0
  44. package/dist/lib/constants/enums.js +8 -2
  45. package/dist/lib/context/budgetChecker.js +75 -48
  46. package/dist/lib/context/contextCompactor.js +135 -127
  47. package/dist/lib/core/baseProvider.d.ts +5 -0
  48. package/dist/lib/core/baseProvider.js +158 -102
  49. package/dist/lib/core/conversationMemoryInitializer.js +7 -4
  50. package/dist/lib/core/conversationMemoryManager.d.ts +2 -0
  51. package/dist/lib/core/conversationMemoryManager.js +6 -2
  52. package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
  53. package/dist/lib/core/modules/GenerationHandler.js +12 -12
  54. package/dist/lib/evaluation/ragasEvaluator.js +39 -19
  55. package/dist/lib/evaluation/scoring.js +46 -20
  56. package/dist/lib/features/ppt/index.d.ts +1 -1
  57. package/dist/lib/features/ppt/index.js +1 -1
  58. package/dist/lib/features/ppt/presentationOrchestrator.js +23 -0
  59. package/dist/lib/features/ppt/slideGenerator.js +13 -0
  60. package/dist/lib/features/ppt/slideRenderers.d.ts +1 -1
  61. package/dist/lib/features/ppt/slideRenderers.js +6 -4
  62. package/dist/lib/features/ppt/slideTypeInference.d.ts +1 -1
  63. package/dist/lib/features/ppt/slideTypeInference.js +75 -73
  64. package/dist/lib/files/fileTools.d.ts +6 -6
  65. package/dist/lib/index.d.ts +46 -12
  66. package/dist/lib/index.js +79 -17
  67. package/dist/lib/mcp/httpRateLimiter.js +39 -12
  68. package/dist/lib/mcp/httpRetryHandler.js +22 -1
  69. package/dist/lib/mcp/mcpClientFactory.js +13 -15
  70. package/dist/lib/memory/memoryRetrievalTools.js +22 -0
  71. package/dist/lib/neurolink.d.ts +64 -72
  72. package/dist/lib/neurolink.js +984 -566
  73. package/dist/lib/observability/exporterRegistry.d.ts +152 -0
  74. package/dist/lib/observability/exporterRegistry.js +414 -0
  75. package/dist/lib/observability/exporters/arizeExporter.d.ts +32 -0
  76. package/dist/lib/observability/exporters/arizeExporter.js +139 -0
  77. package/dist/lib/observability/exporters/baseExporter.d.ts +117 -0
  78. package/dist/lib/observability/exporters/baseExporter.js +191 -0
  79. package/dist/lib/observability/exporters/braintrustExporter.d.ts +30 -0
  80. package/dist/lib/observability/exporters/braintrustExporter.js +155 -0
  81. package/dist/lib/observability/exporters/datadogExporter.d.ts +37 -0
  82. package/dist/lib/observability/exporters/datadogExporter.js +197 -0
  83. package/dist/lib/observability/exporters/index.d.ts +13 -0
  84. package/dist/lib/observability/exporters/index.js +14 -0
  85. package/dist/lib/observability/exporters/laminarExporter.d.ts +48 -0
  86. package/dist/lib/observability/exporters/laminarExporter.js +303 -0
  87. package/dist/lib/observability/exporters/langfuseExporter.d.ts +47 -0
  88. package/dist/lib/observability/exporters/langfuseExporter.js +200 -0
  89. package/dist/lib/observability/exporters/langsmithExporter.d.ts +26 -0
  90. package/dist/lib/observability/exporters/langsmithExporter.js +124 -0
  91. package/dist/lib/observability/exporters/otelExporter.d.ts +39 -0
  92. package/dist/lib/observability/exporters/otelExporter.js +165 -0
  93. package/dist/lib/observability/exporters/posthogExporter.d.ts +48 -0
  94. package/dist/lib/observability/exporters/posthogExporter.js +288 -0
  95. package/dist/lib/observability/exporters/sentryExporter.d.ts +32 -0
  96. package/dist/lib/observability/exporters/sentryExporter.js +166 -0
  97. package/dist/lib/observability/index.d.ts +25 -0
  98. package/dist/lib/observability/index.js +32 -0
  99. package/dist/lib/observability/metricsAggregator.d.ts +260 -0
  100. package/dist/lib/observability/metricsAggregator.js +553 -0
  101. package/dist/lib/observability/otelBridge.d.ts +49 -0
  102. package/dist/lib/observability/otelBridge.js +132 -0
  103. package/dist/lib/observability/retryPolicy.d.ts +192 -0
  104. package/dist/lib/observability/retryPolicy.js +384 -0
  105. package/dist/lib/observability/sampling/index.d.ts +4 -0
  106. package/dist/lib/observability/sampling/index.js +5 -0
  107. package/dist/lib/observability/sampling/samplers.d.ts +116 -0
  108. package/dist/lib/observability/sampling/samplers.js +217 -0
  109. package/dist/lib/observability/spanProcessor.d.ts +129 -0
  110. package/dist/lib/observability/spanProcessor.js +288 -0
  111. package/dist/lib/observability/tokenTracker.d.ts +156 -0
  112. package/dist/lib/observability/tokenTracker.js +414 -0
  113. package/dist/lib/observability/types/exporterTypes.d.ts +250 -0
  114. package/dist/lib/observability/types/exporterTypes.js +6 -0
  115. package/dist/lib/observability/types/index.d.ts +6 -0
  116. package/dist/lib/observability/types/index.js +5 -0
  117. package/dist/lib/observability/types/spanTypes.d.ts +244 -0
  118. package/dist/lib/observability/types/spanTypes.js +93 -0
  119. package/dist/lib/observability/utils/index.d.ts +4 -0
  120. package/dist/lib/observability/utils/index.js +5 -0
  121. package/dist/lib/observability/utils/spanSerializer.d.ts +115 -0
  122. package/dist/lib/observability/utils/spanSerializer.js +287 -0
  123. package/dist/lib/providers/amazonSagemaker.d.ts +5 -4
  124. package/dist/lib/providers/amazonSagemaker.js +3 -4
  125. package/dist/lib/providers/googleVertex.d.ts +7 -0
  126. package/dist/lib/providers/googleVertex.js +80 -2
  127. package/dist/lib/rag/pipeline/RAGPipeline.d.ts +0 -5
  128. package/dist/lib/rag/pipeline/RAGPipeline.js +122 -87
  129. package/dist/lib/rag/ragIntegration.js +30 -0
  130. package/dist/lib/rag/retrieval/hybridSearch.js +22 -0
  131. package/dist/lib/server/abstract/baseServerAdapter.js +51 -19
  132. package/dist/lib/server/middleware/common.js +44 -12
  133. package/dist/lib/services/server/ai/observability/instrumentation.d.ts +2 -2
  134. package/dist/lib/services/server/ai/observability/instrumentation.js +10 -5
  135. package/dist/lib/types/cli.d.ts +18 -2
  136. package/dist/lib/types/conversationMemoryInterface.d.ts +2 -0
  137. package/dist/lib/types/generateTypes.d.ts +2 -2
  138. package/dist/lib/types/modelTypes.d.ts +18 -18
  139. package/dist/lib/types/providers.d.ts +5 -0
  140. package/dist/lib/utils/pricing.js +25 -1
  141. package/dist/lib/utils/ttsProcessor.js +74 -59
  142. package/dist/lib/workflow/config.d.ts +36 -36
  143. package/dist/lib/workflow/core/ensembleExecutor.js +10 -0
  144. package/dist/lib/workflow/core/judgeScorer.js +20 -2
  145. package/dist/lib/workflow/core/workflowRunner.js +34 -1
  146. package/dist/mcp/httpRateLimiter.js +39 -12
  147. package/dist/mcp/httpRetryHandler.js +22 -1
  148. package/dist/mcp/mcpClientFactory.js +13 -15
  149. package/dist/memory/memoryRetrievalTools.js +22 -0
  150. package/dist/neurolink.d.ts +64 -72
  151. package/dist/neurolink.js +984 -566
  152. package/dist/observability/FEATURE-STATUS.md +269 -0
  153. package/dist/observability/exporterRegistry.d.ts +152 -0
  154. package/dist/observability/exporterRegistry.js +413 -0
  155. package/dist/observability/exporters/arizeExporter.d.ts +32 -0
  156. package/dist/observability/exporters/arizeExporter.js +138 -0
  157. package/dist/observability/exporters/baseExporter.d.ts +117 -0
  158. package/dist/observability/exporters/baseExporter.js +190 -0
  159. package/dist/observability/exporters/braintrustExporter.d.ts +30 -0
  160. package/dist/observability/exporters/braintrustExporter.js +154 -0
  161. package/dist/observability/exporters/datadogExporter.d.ts +37 -0
  162. package/dist/observability/exporters/datadogExporter.js +196 -0
  163. package/dist/observability/exporters/index.d.ts +13 -0
  164. package/dist/observability/exporters/index.js +13 -0
  165. package/dist/observability/exporters/laminarExporter.d.ts +48 -0
  166. package/dist/observability/exporters/laminarExporter.js +302 -0
  167. package/dist/observability/exporters/langfuseExporter.d.ts +47 -0
  168. package/dist/observability/exporters/langfuseExporter.js +199 -0
  169. package/dist/observability/exporters/langsmithExporter.d.ts +26 -0
  170. package/dist/observability/exporters/langsmithExporter.js +123 -0
  171. package/dist/observability/exporters/otelExporter.d.ts +39 -0
  172. package/dist/observability/exporters/otelExporter.js +164 -0
  173. package/dist/observability/exporters/posthogExporter.d.ts +48 -0
  174. package/dist/observability/exporters/posthogExporter.js +287 -0
  175. package/dist/observability/exporters/sentryExporter.d.ts +32 -0
  176. package/dist/observability/exporters/sentryExporter.js +165 -0
  177. package/dist/observability/index.d.ts +25 -0
  178. package/dist/observability/index.js +31 -0
  179. package/dist/observability/metricsAggregator.d.ts +260 -0
  180. package/dist/observability/metricsAggregator.js +552 -0
  181. package/dist/observability/otelBridge.d.ts +49 -0
  182. package/dist/observability/otelBridge.js +131 -0
  183. package/dist/observability/retryPolicy.d.ts +192 -0
  184. package/dist/observability/retryPolicy.js +383 -0
  185. package/dist/observability/sampling/index.d.ts +4 -0
  186. package/dist/observability/sampling/index.js +4 -0
  187. package/dist/observability/sampling/samplers.d.ts +116 -0
  188. package/dist/observability/sampling/samplers.js +216 -0
  189. package/dist/observability/spanProcessor.d.ts +129 -0
  190. package/dist/observability/spanProcessor.js +287 -0
  191. package/dist/observability/tokenTracker.d.ts +156 -0
  192. package/dist/observability/tokenTracker.js +413 -0
  193. package/dist/observability/types/exporterTypes.d.ts +250 -0
  194. package/dist/observability/types/exporterTypes.js +5 -0
  195. package/dist/observability/types/index.d.ts +6 -0
  196. package/dist/observability/types/index.js +4 -0
  197. package/dist/observability/types/spanTypes.d.ts +244 -0
  198. package/dist/observability/types/spanTypes.js +92 -0
  199. package/dist/observability/utils/index.d.ts +4 -0
  200. package/dist/observability/utils/index.js +4 -0
  201. package/dist/observability/utils/spanSerializer.d.ts +115 -0
  202. package/dist/observability/utils/spanSerializer.js +286 -0
  203. package/dist/providers/amazonSagemaker.d.ts +5 -4
  204. package/dist/providers/amazonSagemaker.js +3 -4
  205. package/dist/providers/googleVertex.d.ts +7 -0
  206. package/dist/providers/googleVertex.js +80 -2
  207. package/dist/rag/pipeline/RAGPipeline.d.ts +0 -5
  208. package/dist/rag/pipeline/RAGPipeline.js +122 -87
  209. package/dist/rag/ragIntegration.js +30 -0
  210. package/dist/rag/retrieval/hybridSearch.js +22 -0
  211. package/dist/server/abstract/baseServerAdapter.js +51 -19
  212. package/dist/server/middleware/common.js +44 -12
  213. package/dist/services/server/ai/observability/instrumentation.d.ts +2 -2
  214. package/dist/services/server/ai/observability/instrumentation.js +10 -5
  215. package/dist/types/cli.d.ts +18 -2
  216. package/dist/types/conversationMemoryInterface.d.ts +2 -0
  217. package/dist/types/generateTypes.d.ts +2 -2
  218. package/dist/types/providers.d.ts +5 -0
  219. package/dist/utils/pricing.js +25 -1
  220. package/dist/utils/ttsProcessor.js +74 -59
  221. package/dist/workflow/config.d.ts +52 -52
  222. package/dist/workflow/core/ensembleExecutor.js +10 -0
  223. package/dist/workflow/core/judgeScorer.js +20 -2
  224. package/dist/workflow/core/workflowRunner.js +34 -1
  225. package/package.json +1 -1
@@ -28,11 +28,21 @@ export declare class CLICommandFactory {
28
28
  * Auto-configures provider, model, and tools settings for video generation
29
29
  */
30
30
  private static configureVideoMode;
31
+ /**
32
+ * Helper method to configure options for PPT generation mode
33
+ * Auto-configures provider, model, and tools settings for presentation generation
34
+ */
35
+ private static configurePPTMode;
31
36
  /**
32
37
  * Helper method to handle video file output
33
38
  * Saves generated video to file when --videoOutput flag is provided
34
39
  */
35
40
  private static handleVideoOutput;
41
+ /**
42
+ * Helper method to handle PPT file output
43
+ * Displays PPT generation result info
44
+ */
45
+ private static handlePPTOutput;
36
46
  private static isValidTokenUsage;
37
47
  private static normalizeTokenUsage;
38
48
  private static formatAnalyticsForTextMode;
@@ -111,6 +121,30 @@ export declare class CLICommandFactory {
111
121
  * Execute provider status command
112
122
  */
113
123
  private static executeProviderStatus;
124
+ /**
125
+ * Handle stdin input for generate command
126
+ */
127
+ private static handleGenerateStdinInput;
128
+ /**
129
+ * Detect output mode (video, ppt, or text) based on CLI arguments
130
+ */
131
+ private static detectGenerateOutputMode;
132
+ /**
133
+ * Process context for generation command
134
+ */
135
+ private static processGenerateContext;
136
+ /**
137
+ * Build multimodal input from CLI arguments
138
+ */
139
+ private static buildGenerateMultimodalInput;
140
+ /**
141
+ * Build output configuration for generate request
142
+ */
143
+ private static buildGenerateOutputConfig;
144
+ /**
145
+ * Handle successful generation result
146
+ */
147
+ private static handleGenerateSuccess;
114
148
  /**
115
149
  * Execute the generate command
116
150
  */
@@ -290,9 +290,9 @@ export class CLICommandFactory {
290
290
  // Video Generation options (Veo 3.1)
291
291
  outputMode: {
292
292
  type: "string",
293
- choices: ["text", "video"],
293
+ choices: ["text", "video", "ppt"],
294
294
  default: "text",
295
- description: "Output mode: 'text' for standard generation, 'video' for video generation",
295
+ description: "Output mode: 'text' for standard generation, 'video' for video, 'ppt' for presentation",
296
296
  },
297
297
  videoOutput: {
298
298
  type: "string",
@@ -322,6 +322,42 @@ export class CLICommandFactory {
322
322
  default: true,
323
323
  description: "Enable/disable audio generation in video",
324
324
  },
325
+ // PPT Generation options
326
+ pptPages: {
327
+ type: "number",
328
+ alias: "pages",
329
+ description: "Number of slides to generate (5-50, default: 10 when PPT mode is enabled)",
330
+ },
331
+ pptTheme: {
332
+ type: "string",
333
+ choices: ["modern", "corporate", "creative", "minimal", "dark"],
334
+ description: "Presentation theme/style (default: AI selects based on topic)",
335
+ },
336
+ pptAudience: {
337
+ type: "string",
338
+ choices: ["business", "students", "technical", "general"],
339
+ description: "Target audience (default: AI selects based on topic)",
340
+ },
341
+ pptTone: {
342
+ type: "string",
343
+ choices: ["professional", "casual", "educational", "persuasive"],
344
+ description: "Presentation tone (default: AI selects based on topic)",
345
+ },
346
+ pptOutput: {
347
+ type: "string",
348
+ alias: "po",
349
+ description: "Path to save generated PPTX file (e.g., ./output.pptx)",
350
+ },
351
+ pptAspectRatio: {
352
+ type: "string",
353
+ choices: ["16:9", "4:3"],
354
+ description: "Slide aspect ratio (default: 16:9 when PPT mode is enabled)",
355
+ },
356
+ pptNoImages: {
357
+ type: "boolean",
358
+ default: false,
359
+ description: "Disable AI image generation for slides",
360
+ },
325
361
  thinking: {
326
362
  alias: "think",
327
363
  type: "boolean",
@@ -528,6 +564,14 @@ export class CLICommandFactory {
528
564
  videoLength: argv.videoLength,
529
565
  videoAspectRatio: argv.videoAspectRatio,
530
566
  videoAudio: argv.videoAudio,
567
+ // PPT generation options
568
+ pptPages: argv.pptPages,
569
+ pptTheme: argv.pptTheme,
570
+ pptAudience: argv.pptAudience,
571
+ pptTone: argv.pptTone,
572
+ pptOutput: argv.pptOutput,
573
+ pptAspectRatio: argv.pptAspectRatio,
574
+ pptNoImages: argv.pptNoImages,
531
575
  // Extended thinking options for Claude and Gemini models
532
576
  thinking: argv.thinking,
533
577
  thinkingBudget: argv.thinkingBudget,
@@ -749,6 +793,50 @@ export class CLICommandFactory {
749
793
  });
750
794
  }
751
795
  }
796
+ /**
797
+ * Helper method to configure options for PPT generation mode
798
+ * Auto-configures provider, model, and tools settings for presentation generation
799
+ */
800
+ static configurePPTMode(enhancedOptions, argv, options) {
801
+ const userEnabledTools = !argv.disableTools; // Tools are enabled by default
802
+ enhancedOptions.disableTools = true;
803
+ // Auto-set provider for PPT generation if not explicitly specified
804
+ // PPT works best with Vertex or Google AI for content planning
805
+ if (!enhancedOptions.provider) {
806
+ enhancedOptions.provider = "vertex";
807
+ if (options.debug) {
808
+ logger.debug("Auto-setting provider to 'vertex' for PPT generation mode");
809
+ }
810
+ }
811
+ // Auto-set model if not explicitly specified
812
+ if (!enhancedOptions.model) {
813
+ // Use gemini-2.5-flash for fast, high-quality content planning
814
+ const modelAlias = "gemini-2.5-flash";
815
+ const resolvedModel = ModelResolver.resolveModel(modelAlias);
816
+ const fullModelId = resolvedModel?.id || "gemini-2.5-flash-001";
817
+ enhancedOptions.model = fullModelId;
818
+ if (options.debug) {
819
+ logger.debug(`Auto-setting model to '${fullModelId}' for PPT generation mode`);
820
+ }
821
+ }
822
+ // Warn user if they explicitly enabled tools
823
+ if (userEnabledTools && !options.quiet) {
824
+ logger.always(chalk.yellow("⚠️ Note: MCP tools are not supported in PPT generation mode and have been disabled."));
825
+ }
826
+ if (options.debug) {
827
+ logger.debug("PPT generation mode enabled (tools auto-disabled):", {
828
+ provider: enhancedOptions.provider,
829
+ model: enhancedOptions.model,
830
+ pages: enhancedOptions.pptPages,
831
+ theme: enhancedOptions.pptTheme,
832
+ audience: enhancedOptions.pptAudience,
833
+ tone: enhancedOptions.pptTone,
834
+ aspectRatio: enhancedOptions.pptAspectRatio,
835
+ noImages: enhancedOptions.pptNoImages,
836
+ outputPath: enhancedOptions.pptOutput,
837
+ });
838
+ }
839
+ }
752
840
  /**
753
841
  * Helper method to handle video file output
754
842
  * Saves generated video to file when --videoOutput flag is provided
@@ -775,14 +863,11 @@ export class CLICommandFactory {
775
863
  // Save video to file
776
864
  const saveResult = await saveVideoToFile(video, videoOutputPath);
777
865
  if (saveResult.success) {
778
- if (!options.quiet) {
779
- // Format video info output
780
- const sizeInfo = formatVideoFileSize(saveResult.size);
781
- const metadataSummary = getVideoMetadataSummary(video);
782
- logger.always(chalk.green(`🎬 Video saved to: ${saveResult.path} (${sizeInfo})`));
783
- if (metadataSummary) {
784
- logger.always(chalk.gray(` ${metadataSummary}`));
785
- }
866
+ const sizeInfo = formatVideoFileSize(saveResult.size);
867
+ const metadataSummary = getVideoMetadataSummary(video);
868
+ logger.always(chalk.green(`🎬 Video saved to: ${saveResult.path} (${sizeInfo})`));
869
+ if (!options.quiet && metadataSummary) {
870
+ logger.always(chalk.gray(` ${metadataSummary}`));
786
871
  }
787
872
  }
788
873
  else {
@@ -793,6 +878,52 @@ export class CLICommandFactory {
793
878
  handleError(error, "Video Output");
794
879
  }
795
880
  }
881
+ /**
882
+ * Helper method to handle PPT file output
883
+ * Displays PPT generation result info
884
+ */
885
+ static async handlePPTOutput(result, options) {
886
+ // Extract PPT from result with proper type checking
887
+ if (!result || typeof result !== "object") {
888
+ return;
889
+ }
890
+ const generateResult = result;
891
+ const ppt = generateResult.ppt;
892
+ if (!ppt) {
893
+ // PPT not in result - either not PPT mode or generation failed
894
+ return;
895
+ }
896
+ try {
897
+ if (options.quiet) {
898
+ if (ppt.filePath) {
899
+ logger.always(chalk.green(`📊 Presentation saved to: ${ppt.filePath}`));
900
+ }
901
+ else {
902
+ logger.always(chalk.green("📊 Presentation generated successfully."));
903
+ }
904
+ if (ppt.totalSlides) {
905
+ logger.always(chalk.white(`📄 Slides: ${ppt.totalSlides}`));
906
+ }
907
+ return;
908
+ }
909
+ logger.always(chalk.green("\n📊 Presentation Generated Successfully!"));
910
+ logger.always(chalk.gray("─".repeat(50)));
911
+ if (ppt.filePath) {
912
+ logger.always(chalk.white(` 📁 File: ${ppt.filePath}`));
913
+ }
914
+ if (ppt.totalSlides) {
915
+ logger.always(chalk.white(` 📄 Slides: ${ppt.totalSlides}`));
916
+ }
917
+ if (ppt.format) {
918
+ logger.always(chalk.white(` 📋 Format: ${ppt.format.toUpperCase()}`));
919
+ }
920
+ logger.always(chalk.gray("─".repeat(50)));
921
+ logger.always(chalk.cyan("💡 Tip: Open the file with PowerPoint or Google Slides to view."));
922
+ }
923
+ catch (error) {
924
+ handleError(error, "PPT Output");
925
+ }
926
+ }
796
927
  // Helper method to validate token usage data with fallback handling
797
928
  static isValidTokenUsage(tokens) {
798
929
  if (!tokens || typeof tokens !== "object" || tokens === null) {
@@ -916,8 +1047,9 @@ export class CLICommandFactory {
916
1047
  .example('$0 generate "Describe this video" --video path/to/video.mp4', "Analyze video content")
917
1048
  .example('$0 generate "Product showcase video" --image ./product.jpg --outputMode video --videoOutput ./output.mp4', "Generate video from image")
918
1049
  .example('$0 generate "Smooth camera movement" --image ./input.jpg --provider vertex --model veo-3.1-generate-001 --outputMode video --videoResolution 720p --videoLength 6 --videoAspectRatio 16:9 --videoOutput ./output.mp4', "Video generation with full options")
919
- .example('$0 generate "Explain AI" --provider anthropic --subscription-tier pro', "Use Anthropic with Pro subscription tier")
920
- .example('$0 generate "Deep analysis" --provider anthropic-subscription --subscription-tier max --auth-method oauth', "Use Anthropic with Max subscription and OAuth"));
1050
+ .example('$0 generate "AI in Healthcare" --pptPages 10', "Generate a PowerPoint presentation")
1051
+ .example('$0 generate "Company Q4 Results" --pptPages 15 --pptTheme corporate --pptAudience business', "Generate presentation with options")
1052
+ .example('$0 generate "Machine Learning 101" --pptTheme minimal --pptTone educational --pptNoImages', "Generate educational slides without AI images"));
921
1053
  },
922
1054
  handler: async (argv) => await CLICommandFactory.executeGenerate(argv),
923
1055
  };
@@ -1449,72 +1581,196 @@ export class CLICommandFactory {
1449
1581
  }
1450
1582
  }
1451
1583
  /**
1452
- * Execute the generate command
1584
+ * Handle stdin input for generate command
1453
1585
  */
1454
- static async executeGenerate(argv) {
1455
- // Handle stdin input if no input provided
1586
+ static async handleGenerateStdinInput(argv) {
1456
1587
  if (!argv.input && !process.stdin.isTTY) {
1457
1588
  let stdinData = "";
1458
1589
  process.stdin.setEncoding("utf8");
1459
1590
  for await (const chunk of process.stdin) {
1460
1591
  stdinData += chunk;
1461
1592
  }
1462
- argv.input = stdinData.trim();
1463
- if (!argv.input) {
1593
+ const trimmedData = stdinData.trim();
1594
+ if (!trimmedData) {
1464
1595
  throw new Error("No input received from stdin");
1465
1596
  }
1597
+ return trimmedData;
1466
1598
  }
1467
1599
  else if (!argv.input) {
1468
1600
  throw new Error('Input required. Use: neurolink generate "your prompt" or echo "prompt" | neurolink generate');
1469
1601
  }
1470
- const options = CLICommandFactory.processOptions(argv);
1471
- // Validate Anthropic subscription options if using Anthropic provider
1472
- this.validateAnthropicSubscriptionOptions(options);
1473
- // Determine if video generation mode is enabled
1474
- const isVideoMode = options.outputMode === "video";
1602
+ return argv.input;
1603
+ }
1604
+ /**
1605
+ * Detect output mode (video, ppt, or text) based on CLI arguments
1606
+ */
1607
+ static detectGenerateOutputMode(argv, options) {
1608
+ const outputMode = options.outputMode;
1609
+ const isVideoMode = outputMode === "video";
1610
+ const hasPPTFlags = argv.pptPages !== undefined ||
1611
+ argv.pptTheme !== undefined ||
1612
+ argv.pptAudience !== undefined ||
1613
+ argv.pptTone !== undefined ||
1614
+ argv.pptOutput !== undefined ||
1615
+ argv.pptAspectRatio !== undefined ||
1616
+ argv.pptNoImages === true;
1617
+ const hasVideoSignals = outputMode === "video" || argv.videoOutput !== undefined;
1618
+ const hasPPTSignals = outputMode === "ppt" || hasPPTFlags;
1619
+ if (hasVideoSignals && hasPPTSignals) {
1620
+ throw new Error("Conflicting output mode signals detected. Use either video mode (--outputMode video, optionally with --videoOutput) or PPT mode (--outputMode ppt / --ppt* flags), not both.");
1621
+ }
1622
+ const isPPTMode = outputMode === "ppt" || hasPPTFlags;
1475
1623
  const spinnerMessage = isVideoMode
1476
1624
  ? "🎬 Generating video... (this may take 1-2 minutes)"
1477
- : "🤖 Generating text...";
1625
+ : isPPTMode
1626
+ ? "📊 Generating presentation... (this may take 2-5 minutes)"
1627
+ : "🤖 Generating text...";
1628
+ return { isVideoMode, isPPTMode, spinnerMessage };
1629
+ }
1630
+ /**
1631
+ * Process context for generation command
1632
+ */
1633
+ static processGenerateContext(inputText, options) {
1634
+ let processedInputText = inputText;
1635
+ let contextMetadata;
1636
+ if (options.context && options.contextConfig) {
1637
+ const processedContextResult = ContextFactory.processContext(options.context, options.contextConfig);
1638
+ if (processedContextResult.processedContext) {
1639
+ processedInputText =
1640
+ processedContextResult.processedContext + processedInputText;
1641
+ }
1642
+ contextMetadata = {
1643
+ ...ContextFactory.extractAnalyticsContext(options.context),
1644
+ contextMode: processedContextResult.config.mode,
1645
+ contextTruncated: processedContextResult.metadata.truncated,
1646
+ };
1647
+ if (options.debug) {
1648
+ logger.debug("Context processed:", {
1649
+ mode: processedContextResult.config.mode,
1650
+ truncated: processedContextResult.metadata.truncated,
1651
+ processingTime: processedContextResult.metadata.processingTime,
1652
+ });
1653
+ }
1654
+ }
1655
+ return { inputText: processedInputText, contextMetadata };
1656
+ }
1657
+ /**
1658
+ * Build multimodal input from CLI arguments
1659
+ */
1660
+ static buildGenerateMultimodalInput(inputText, argv) {
1661
+ const imageBuffers = CLICommandFactory.processCliImages(argv.image);
1662
+ const csvFiles = CLICommandFactory.processCliCSVFiles(argv.csv);
1663
+ const pdfFiles = CLICommandFactory.processCliPDFFiles(argv.pdf);
1664
+ const videoFiles = CLICommandFactory.processCliVideoFiles(argv.video);
1665
+ const files = CLICommandFactory.processCliFiles(argv.file);
1666
+ return {
1667
+ text: inputText,
1668
+ ...(imageBuffers && { images: imageBuffers }),
1669
+ ...(csvFiles && { csvFiles }),
1670
+ ...(pdfFiles && { pdfFiles }),
1671
+ ...(videoFiles && { videoFiles }),
1672
+ ...(files && { files }),
1673
+ };
1674
+ }
1675
+ /**
1676
+ * Build output configuration for generate request
1677
+ */
1678
+ static buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions) {
1679
+ if (isVideoMode) {
1680
+ return {
1681
+ mode: "video",
1682
+ video: {
1683
+ resolution: enhancedOptions.videoResolution,
1684
+ length: enhancedOptions.videoLength,
1685
+ aspectRatio: enhancedOptions.videoAspectRatio,
1686
+ audio: enhancedOptions.videoAudio,
1687
+ },
1688
+ };
1689
+ }
1690
+ if (isPPTMode) {
1691
+ return {
1692
+ mode: "ppt",
1693
+ ppt: {
1694
+ pages: enhancedOptions.pptPages || 10,
1695
+ theme: enhancedOptions.pptTheme,
1696
+ audience: enhancedOptions.pptAudience,
1697
+ tone: enhancedOptions.pptTone,
1698
+ aspectRatio: enhancedOptions.pptAspectRatio || "16:9",
1699
+ generateAIImages: !enhancedOptions.pptNoImages,
1700
+ outputPath: enhancedOptions.pptOutput,
1701
+ },
1702
+ };
1703
+ }
1704
+ return undefined;
1705
+ }
1706
+ /**
1707
+ * Handle successful generation result
1708
+ */
1709
+ static async handleGenerateSuccess(result, options, isVideoMode, isPPTMode, spinner) {
1710
+ const genResult = result;
1711
+ if (spinner) {
1712
+ if (isVideoMode) {
1713
+ spinner.succeed(chalk.green("✅ Video generated successfully!"));
1714
+ }
1715
+ else if (isPPTMode) {
1716
+ spinner.succeed(chalk.green("✅ Presentation generated successfully!"));
1717
+ }
1718
+ else {
1719
+ spinner.succeed(chalk.green("✅ Text generated successfully!"));
1720
+ }
1721
+ }
1722
+ if (!options.quiet) {
1723
+ const providerInfo = genResult.provider || "auto";
1724
+ const modelInfo = genResult.model || "default";
1725
+ logger.always(chalk.gray(`🔧 Provider: ${providerInfo} | Model: ${modelInfo}`));
1726
+ }
1727
+ if (!isVideoMode && !isPPTMode) {
1728
+ CLICommandFactory.handleOutput(genResult, options);
1729
+ }
1730
+ await CLICommandFactory.handleTTSOutput(genResult, options);
1731
+ await CLICommandFactory.handleVideoOutput(genResult, options);
1732
+ await CLICommandFactory.handlePPTOutput(genResult, options);
1733
+ if (options.debug) {
1734
+ logger.debug("\n" + chalk.yellow("Debug Information:"));
1735
+ logger.debug("Provider:", genResult.provider);
1736
+ logger.debug("Model:", genResult.model);
1737
+ if (genResult.analytics) {
1738
+ logger.debug("Analytics:", JSON.stringify(genResult.analytics, null, 2));
1739
+ }
1740
+ if (genResult.evaluation) {
1741
+ logger.debug("Evaluation:", JSON.stringify(genResult.evaluation, null, 2));
1742
+ }
1743
+ }
1744
+ if (!globalSession.getCurrentSessionId()) {
1745
+ await CLICommandFactory.flushLangfuseTraces();
1746
+ process.exit(0);
1747
+ }
1748
+ }
1749
+ /**
1750
+ * Execute the generate command
1751
+ */
1752
+ static async executeGenerate(argv) {
1753
+ // Handle stdin input
1754
+ const rawInput = await CLICommandFactory.handleGenerateStdinInput(argv);
1755
+ argv.input = rawInput;
1756
+ const options = CLICommandFactory.processOptions(argv);
1757
+ // Detect output mode
1758
+ const { isVideoMode, isPPTMode, spinnerMessage } = CLICommandFactory.detectGenerateOutputMode(argv, options);
1478
1759
  const spinner = argv.quiet ? null : ora(spinnerMessage).start();
1479
1760
  try {
1480
1761
  // Add delay if specified
1481
1762
  if (options.delay) {
1482
1763
  await new Promise((resolve) => setTimeout(resolve, options.delay));
1483
1764
  }
1484
- // Process context if provided
1485
- let inputText = argv.input;
1486
- let contextMetadata;
1487
- if (options.context && options.contextConfig) {
1488
- const processedContextResult = ContextFactory.processContext(options.context, options.contextConfig);
1489
- // Integrate context into prompt if configured
1490
- if (processedContextResult.processedContext) {
1491
- inputText = processedContextResult.processedContext + inputText;
1492
- }
1493
- // Add context metadata for analytics
1494
- contextMetadata = {
1495
- ...ContextFactory.extractAnalyticsContext(options.context),
1496
- contextMode: processedContextResult.config.mode,
1497
- contextTruncated: processedContextResult.metadata.truncated,
1498
- };
1499
- if (options.debug) {
1500
- logger.debug("Context processed:", {
1501
- mode: processedContextResult.config.mode,
1502
- truncated: processedContextResult.metadata.truncated,
1503
- processingTime: processedContextResult.metadata.processingTime,
1504
- });
1505
- }
1506
- }
1765
+ // Process context
1766
+ const { inputText, contextMetadata } = CLICommandFactory.processGenerateContext(rawInput, options);
1507
1767
  // Handle dry-run mode for testing
1508
1768
  if (options.dryRun) {
1509
1769
  const mockResult = {
1510
1770
  content: "Mock response for testing purposes",
1511
1771
  provider: options.provider || "auto",
1512
1772
  model: options.model || "test-model",
1513
- usage: {
1514
- input: 10,
1515
- output: 15,
1516
- total: 25,
1517
- },
1773
+ usage: { input: 10, output: 15, total: 25 },
1518
1774
  responseTime: 150,
1519
1775
  analytics: options.enableAnalytics
1520
1776
  ? {
@@ -1552,7 +1808,9 @@ export class CLICommandFactory {
1552
1808
  await CLICommandFactory.flushLangfuseTraces();
1553
1809
  process.exit(0);
1554
1810
  }
1811
+ return;
1555
1812
  }
1813
+ // Initialize SDK and session
1556
1814
  const sdk = globalSession.getOrCreateNeuroLink();
1557
1815
  const sessionVariables = globalSession.getSessionVariables();
1558
1816
  const enhancedOptions = { ...options, ...sessionVariables };
@@ -1566,24 +1824,17 @@ export class CLICommandFactory {
1566
1824
  toolsEnabled: !options.disableTools,
1567
1825
  });
1568
1826
  }
1569
- // Video generation doesn't support tools, so auto-disable them
1827
+ // Configure mode-specific options
1570
1828
  if (isVideoMode) {
1571
1829
  CLICommandFactory.configureVideoMode(enhancedOptions, argv, options);
1572
1830
  }
1573
- // Process CLI multimodal inputs
1574
- const imageBuffers = CLICommandFactory.processCliImages(argv.image);
1575
- const csvFiles = CLICommandFactory.processCliCSVFiles(argv.csv);
1576
- const pdfFiles = CLICommandFactory.processCliPDFFiles(argv.pdf);
1577
- const videoFiles = CLICommandFactory.processCliVideoFiles(argv.video);
1578
- const files = CLICommandFactory.processCliFiles(argv.file);
1579
- const generateInput = {
1580
- text: inputText,
1581
- ...(imageBuffers && { images: imageBuffers }),
1582
- ...(csvFiles && { csvFiles }),
1583
- ...(pdfFiles && { pdfFiles }),
1584
- ...(videoFiles && { videoFiles }),
1585
- ...(files && { files }),
1586
- };
1831
+ if (isPPTMode) {
1832
+ CLICommandFactory.configurePPTMode(enhancedOptions, argv, options);
1833
+ }
1834
+ // Build multimodal input and output configuration
1835
+ const generateInput = CLICommandFactory.buildGenerateMultimodalInput(inputText, argv);
1836
+ const outputConfig = CLICommandFactory.buildGenerateOutputConfig(isVideoMode, isPPTMode, enhancedOptions);
1837
+ // Execute generation
1587
1838
  const result = await sdk.generate({
1588
1839
  input: generateInput,
1589
1840
  csvOptions: {
@@ -1596,18 +1847,7 @@ export class CLICommandFactory {
1596
1847
  format: argv.videoFormat,
1597
1848
  transcribeAudio: argv.transcribeAudio,
1598
1849
  },
1599
- // Video generation output configuration
1600
- output: isVideoMode
1601
- ? {
1602
- mode: "video",
1603
- video: {
1604
- resolution: enhancedOptions.videoResolution,
1605
- length: enhancedOptions.videoLength,
1606
- aspectRatio: enhancedOptions.videoAspectRatio,
1607
- audio: enhancedOptions.videoAudio,
1608
- },
1609
- }
1610
- : undefined,
1850
+ output: outputConfig,
1611
1851
  provider: enhancedOptions.provider,
1612
1852
  model: enhancedOptions.model,
1613
1853
  temperature: enhancedOptions.temperature,
@@ -1656,43 +1896,8 @@ export class CLICommandFactory {
1656
1896
  }
1657
1897
  : undefined,
1658
1898
  });
1659
- if (spinner) {
1660
- if (isVideoMode) {
1661
- spinner.succeed(chalk.green("✅ Video generated successfully!"));
1662
- }
1663
- else {
1664
- spinner.succeed(chalk.green("✅ Text generated successfully!"));
1665
- }
1666
- }
1667
- // Display provider and model info by default (unless quiet mode)
1668
- if (!options.quiet) {
1669
- const providerInfo = result.provider || "auto";
1670
- const modelInfo = result.model || "default";
1671
- logger.always(chalk.gray(`🔧 Provider: ${providerInfo} | Model: ${modelInfo}`));
1672
- }
1673
- // Handle output with universal formatting (for text mode)
1674
- if (!isVideoMode) {
1675
- CLICommandFactory.handleOutput(result, options);
1676
- }
1677
- // Handle TTS audio file output if --tts-output is provided
1678
- await CLICommandFactory.handleTTSOutput(result, options);
1679
- // Handle video file output if --videoOutput is provided
1680
- await CLICommandFactory.handleVideoOutput(result, options);
1681
- if (options.debug) {
1682
- logger.debug("\n" + chalk.yellow("Debug Information:"));
1683
- logger.debug("Provider:", result.provider);
1684
- logger.debug("Model:", result.model);
1685
- if (result.analytics) {
1686
- logger.debug("Analytics:", JSON.stringify(result.analytics, null, 2));
1687
- }
1688
- if (result.evaluation) {
1689
- logger.debug("Evaluation:", JSON.stringify(result.evaluation, null, 2));
1690
- }
1691
- }
1692
- if (!globalSession.getCurrentSessionId()) {
1693
- await CLICommandFactory.flushLangfuseTraces();
1694
- process.exit(0);
1695
- }
1899
+ // Handle successful result
1900
+ await CLICommandFactory.handleGenerateSuccess(result, options, isVideoMode, isPPTMode, spinner);
1696
1901
  }
1697
1902
  catch (error) {
1698
1903
  if (spinner) {
@@ -2141,7 +2346,7 @@ export class CLICommandFactory {
2141
2346
  await CLICommandFactory.handleStdinInput(argv);
2142
2347
  const options = CLICommandFactory.processOptions(argv);
2143
2348
  // Validate Anthropic subscription options if using Anthropic provider
2144
- this.validateAnthropicSubscriptionOptions(options);
2349
+ CLICommandFactory.validateAnthropicSubscriptionOptions(options);
2145
2350
  if (!options.quiet) {
2146
2351
  logger.always(chalk.blue("🔄 Streaming..."));
2147
2352
  }
@@ -10,9 +10,8 @@ import { SetupCommandFactory } from "./factories/setupCommandFactory.js";
10
10
  import { ServerCommandFactory } from "./commands/server.js";
11
11
  import { ServeCommandFactory } from "./commands/serve.js";
12
12
  import { ragCommand } from "./commands/rag.js";
13
- import { DocsCommandFactory } from "./commands/docs.js";
14
- import { AuthCommandFactory } from "./factories/authCommandFactory.js";
15
- import { WorkflowCommandFactory } from "./commands/workflow.js";
13
+ import { ObservabilityCommandFactory } from "./commands/observability.js";
14
+ import { TelemetryCommandFactory } from "./commands/telemetry.js";
16
15
  // Enhanced CLI with Professional UX
17
16
  export function initializeCliParser() {
18
17
  return (yargs(hideBin(process.argv))
@@ -176,11 +175,9 @@ export function initializeCliParser() {
176
175
  .command(ServeCommandFactory.createServeCommands())
177
176
  // RAG Document Processing Commands
178
177
  .command(ragCommand)
179
- // Docs MCP Server Command
180
- .command(DocsCommandFactory.createDocsCommand())
181
- // Auth Commands - Using AuthCommandFactory
182
- .command(AuthCommandFactory.createAuthCommands())
183
- // Workflow Commands
184
- .command(WorkflowCommandFactory.createWorkflowCommands())); // Close the main return statement
178
+ // Observability Commands
179
+ .command(ObservabilityCommandFactory.createObservabilityCommands())
180
+ // Telemetry Commands
181
+ .command(TelemetryCommandFactory.createTelemetryCommands())); // Close the main return statement
185
182
  }
186
183
  //# sourceMappingURL=parser.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shared CLI formatting utilities
3
+ *
4
+ * Common formatting functions used across CLI command modules.
5
+ */
6
+ /**
7
+ * Format a table row with padding
8
+ */
9
+ export declare function formatRow(label: string, value: string, width?: number): string;
10
+ /**
11
+ * Format currency value
12
+ */
13
+ export declare function formatCost(cost: number, currency?: string): string;