@juspay/neurolink 9.32.0 → 9.33.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 (475) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/auth/anthropicOAuth.js +1 -1
  3. package/dist/cli/commands/proxy.js +18 -5
  4. package/dist/client/aiSdkAdapter.js +1 -1
  5. package/dist/client/index.js +137 -501
  6. package/dist/core/factory.js +0 -1
  7. package/dist/core/redisConversationMemoryManager.js +1 -1
  8. package/dist/features/ppt/slideGenerator.js +0 -1
  9. package/dist/features/ppt/utils.js +0 -1
  10. package/dist/lib/neurolink.d.ts +10 -0
  11. package/dist/lib/neurolink.js +41 -7
  12. package/dist/lib/server/routes/claudeProxyRoutes.js +45 -9
  13. package/dist/lib/types/generateTypes.d.ts +16 -0
  14. package/dist/lib/types/streamTypes.d.ts +15 -0
  15. package/dist/mcp/elicitationProtocol.js +1 -1
  16. package/dist/mcp/servers/agent/directToolsServer.js +0 -1
  17. package/dist/neurolink.d.ts +10 -0
  18. package/dist/neurolink.js +41 -7
  19. package/dist/providers/azureOpenai.js +1 -1
  20. package/dist/providers/huggingFace.js +0 -1
  21. package/dist/providers/openaiCompatible.js +0 -1
  22. package/dist/sdk/toolRegistration.js +0 -1
  23. package/dist/server/openapi/generator.js +1 -1
  24. package/dist/server/routes/claudeProxyRoutes.js +45 -9
  25. package/dist/types/configTypes.js +0 -5
  26. package/dist/types/generateTypes.d.ts +16 -0
  27. package/dist/types/modelTypes.js +0 -1
  28. package/dist/types/streamTypes.d.ts +15 -0
  29. package/dist/types/tools.js +0 -1
  30. package/dist/types/typeAliases.js +0 -1
  31. package/dist/types/utilities.js +1 -1
  32. package/dist/types/workflowTypes.js +0 -1
  33. package/dist/utils/providerRetry.js +0 -1
  34. package/dist/utils/providerUtils.js +0 -1
  35. package/package.json +2 -2
  36. package/dist/client/adapters/providerImageAdapter.js +0 -588
  37. package/dist/client/adapters/tts/googleTTSHandler.js +0 -344
  38. package/dist/client/adapters/video/directorPipeline.js +0 -516
  39. package/dist/client/adapters/video/ffmpegAdapter.js +0 -206
  40. package/dist/client/adapters/video/frameExtractor.js +0 -143
  41. package/dist/client/adapters/video/vertexVideoHandler.js +0 -763
  42. package/dist/client/adapters/video/videoAnalyzer.js +0 -238
  43. package/dist/client/adapters/video/videoMerger.js +0 -171
  44. package/dist/client/agent/directTools.js +0 -840
  45. package/dist/client/auth/AuthProviderFactory.js +0 -111
  46. package/dist/client/auth/AuthProviderRegistry.js +0 -190
  47. package/dist/client/auth/RequestContext.js +0 -78
  48. package/dist/client/auth/accountPool.js +0 -178
  49. package/dist/client/auth/anthropicOAuth.js +0 -974
  50. package/dist/client/auth/authContext.js +0 -314
  51. package/dist/client/auth/errors.js +0 -39
  52. package/dist/client/auth/index.js +0 -61
  53. package/dist/client/auth/middleware/AuthMiddleware.js +0 -519
  54. package/dist/client/auth/middleware/rateLimitByUser.js +0 -554
  55. package/dist/client/auth/providers/BaseAuthProvider.js +0 -723
  56. package/dist/client/auth/providers/CognitoProvider.js +0 -304
  57. package/dist/client/auth/providers/KeycloakProvider.js +0 -393
  58. package/dist/client/auth/providers/auth0.js +0 -274
  59. package/dist/client/auth/providers/betterAuth.js +0 -182
  60. package/dist/client/auth/providers/clerk.js +0 -317
  61. package/dist/client/auth/providers/custom.js +0 -112
  62. package/dist/client/auth/providers/firebase.js +0 -226
  63. package/dist/client/auth/providers/jwt.js +0 -212
  64. package/dist/client/auth/providers/oauth2.js +0 -303
  65. package/dist/client/auth/providers/supabase.js +0 -259
  66. package/dist/client/auth/providers/workos.js +0 -284
  67. package/dist/client/auth/serverBridge.js +0 -25
  68. package/dist/client/auth/sessionManager.js +0 -437
  69. package/dist/client/auth/tokenStore.js +0 -799
  70. package/dist/client/client/aiSdkAdapter.js +0 -487
  71. package/dist/client/client/auth.js +0 -473
  72. package/dist/client/client/errors.js +0 -552
  73. package/dist/client/client/httpClient.js +0 -837
  74. package/dist/client/client/index.js +0 -172
  75. package/dist/client/client/interceptors.js +0 -601
  76. package/dist/client/client/sseClient.js +0 -545
  77. package/dist/client/client/streamingClient.js +0 -917
  78. package/dist/client/client/wsClient.js +0 -369
  79. package/dist/client/config/configManager.js +0 -303
  80. package/dist/client/config/conversationMemory.js +0 -86
  81. package/dist/client/config/taskClassificationConfig.js +0 -148
  82. package/dist/client/constants/contextWindows.js +0 -295
  83. package/dist/client/constants/enums.js +0 -853
  84. package/dist/client/constants/index.js +0 -207
  85. package/dist/client/constants/performance.js +0 -389
  86. package/dist/client/constants/retry.js +0 -266
  87. package/dist/client/constants/timeouts.js +0 -182
  88. package/dist/client/constants/tokens.js +0 -380
  89. package/dist/client/constants/videoErrors.js +0 -46
  90. package/dist/client/context/budgetChecker.js +0 -98
  91. package/dist/client/context/contextCompactor.js +0 -205
  92. package/dist/client/context/emergencyTruncation.js +0 -88
  93. package/dist/client/context/errorDetection.js +0 -171
  94. package/dist/client/context/errors.js +0 -21
  95. package/dist/client/context/fileTokenBudget.js +0 -127
  96. package/dist/client/context/prompts/summarizationPrompt.js +0 -117
  97. package/dist/client/context/stages/fileReadDeduplicator.js +0 -66
  98. package/dist/client/context/stages/slidingWindowTruncator.js +0 -190
  99. package/dist/client/context/stages/structuredSummarizer.js +0 -99
  100. package/dist/client/context/stages/toolOutputPruner.js +0 -52
  101. package/dist/client/context/summarizationEngine.js +0 -136
  102. package/dist/client/context/toolOutputLimits.js +0 -78
  103. package/dist/client/context/toolPairRepair.js +0 -66
  104. package/dist/client/core/analytics.js +0 -88
  105. package/dist/client/core/baseProvider.js +0 -1385
  106. package/dist/client/core/constants.js +0 -140
  107. package/dist/client/core/conversationMemoryFactory.js +0 -141
  108. package/dist/client/core/conversationMemoryInitializer.js +0 -128
  109. package/dist/client/core/conversationMemoryManager.js +0 -344
  110. package/dist/client/core/dynamicModels.js +0 -358
  111. package/dist/client/core/evaluation.js +0 -309
  112. package/dist/client/core/evaluationProviders.js +0 -248
  113. package/dist/client/core/factory.js +0 -412
  114. package/dist/client/core/infrastructure/baseError.js +0 -22
  115. package/dist/client/core/infrastructure/baseFactory.js +0 -54
  116. package/dist/client/core/infrastructure/baseRegistry.js +0 -53
  117. package/dist/client/core/infrastructure/index.js +0 -5
  118. package/dist/client/core/infrastructure/retry.js +0 -20
  119. package/dist/client/core/infrastructure/typedEventEmitter.js +0 -23
  120. package/dist/client/core/modelConfiguration.js +0 -851
  121. package/dist/client/core/modules/GenerationHandler.js +0 -588
  122. package/dist/client/core/modules/MessageBuilder.js +0 -273
  123. package/dist/client/core/modules/StreamHandler.js +0 -185
  124. package/dist/client/core/modules/TelemetryHandler.js +0 -203
  125. package/dist/client/core/modules/ToolsManager.js +0 -499
  126. package/dist/client/core/modules/Utilities.js +0 -331
  127. package/dist/client/core/redisConversationMemoryManager.js +0 -1435
  128. package/dist/client/core/streamAnalytics.js +0 -131
  129. package/dist/client/evaluation/contextBuilder.js +0 -134
  130. package/dist/client/evaluation/index.js +0 -61
  131. package/dist/client/evaluation/prompts.js +0 -73
  132. package/dist/client/evaluation/ragasEvaluator.js +0 -110
  133. package/dist/client/evaluation/retryManager.js +0 -78
  134. package/dist/client/evaluation/scoring.js +0 -61
  135. package/dist/client/factories/providerFactory.js +0 -166
  136. package/dist/client/factories/providerRegistry.js +0 -166
  137. package/dist/client/features/ppt/constants.js +0 -896
  138. package/dist/client/features/ppt/contentPlanner.js +0 -529
  139. package/dist/client/features/ppt/presentationOrchestrator.js +0 -236
  140. package/dist/client/features/ppt/slideGenerator.js +0 -532
  141. package/dist/client/features/ppt/slideRenderers.js +0 -2383
  142. package/dist/client/features/ppt/slideTypeInference.js +0 -405
  143. package/dist/client/features/ppt/types.js +0 -13
  144. package/dist/client/features/ppt/utils.js +0 -443
  145. package/dist/client/files/fileReferenceRegistry.js +0 -1543
  146. package/dist/client/files/fileTools.js +0 -450
  147. package/dist/client/files/streamingReader.js +0 -321
  148. package/dist/client/files/types.js +0 -23
  149. package/dist/client/hitl/hitlErrors.js +0 -54
  150. package/dist/client/hitl/hitlManager.js +0 -460
  151. package/dist/client/mcp/agentExposure.js +0 -356
  152. package/dist/client/mcp/auth/index.js +0 -11
  153. package/dist/client/mcp/auth/oauthClientProvider.js +0 -325
  154. package/dist/client/mcp/auth/tokenStorage.js +0 -134
  155. package/dist/client/mcp/batching/index.js +0 -10
  156. package/dist/client/mcp/batching/requestBatcher.js +0 -441
  157. package/dist/client/mcp/caching/index.js +0 -10
  158. package/dist/client/mcp/caching/toolCache.js +0 -433
  159. package/dist/client/mcp/elicitation/elicitationManager.js +0 -376
  160. package/dist/client/mcp/elicitation/index.js +0 -11
  161. package/dist/client/mcp/elicitation/types.js +0 -10
  162. package/dist/client/mcp/elicitationProtocol.js +0 -375
  163. package/dist/client/mcp/enhancedToolDiscovery.js +0 -481
  164. package/dist/client/mcp/externalServerManager.js +0 -1478
  165. package/dist/client/mcp/factory.js +0 -161
  166. package/dist/client/mcp/flexibleToolValidator.js +0 -161
  167. package/dist/client/mcp/httpRateLimiter.js +0 -391
  168. package/dist/client/mcp/httpRetryHandler.js +0 -178
  169. package/dist/client/mcp/index.js +0 -74
  170. package/dist/client/mcp/mcpCircuitBreaker.js +0 -427
  171. package/dist/client/mcp/mcpClientFactory.js +0 -708
  172. package/dist/client/mcp/mcpRegistryClient.js +0 -488
  173. package/dist/client/mcp/mcpServerBase.js +0 -373
  174. package/dist/client/mcp/multiServerManager.js +0 -579
  175. package/dist/client/mcp/registry.js +0 -158
  176. package/dist/client/mcp/routing/index.js +0 -10
  177. package/dist/client/mcp/routing/toolRouter.js +0 -416
  178. package/dist/client/mcp/serverCapabilities.js +0 -502
  179. package/dist/client/mcp/servers/agent/directToolsServer.js +0 -150
  180. package/dist/client/mcp/toolAnnotations.js +0 -239
  181. package/dist/client/mcp/toolConverter.js +0 -258
  182. package/dist/client/mcp/toolDiscoveryService.js +0 -798
  183. package/dist/client/mcp/toolIntegration.js +0 -334
  184. package/dist/client/mcp/toolRegistry.js +0 -729
  185. package/dist/client/memory/hippocampusInitializer.js +0 -19
  186. package/dist/client/memory/memoryRetrievalTools.js +0 -166
  187. package/dist/client/middleware/builtin/analytics.js +0 -132
  188. package/dist/client/middleware/builtin/autoEvaluation.js +0 -203
  189. package/dist/client/middleware/builtin/guardrails.js +0 -109
  190. package/dist/client/middleware/builtin/lifecycle.js +0 -168
  191. package/dist/client/middleware/factory.js +0 -327
  192. package/dist/client/middleware/registry.js +0 -295
  193. package/dist/client/middleware/utils/guardrailsUtils.js +0 -396
  194. package/dist/client/models/anthropicModels.js +0 -527
  195. package/dist/client/neurolink.js +0 -8233
  196. package/dist/client/observability/exporterRegistry.js +0 -413
  197. package/dist/client/observability/exporters/arizeExporter.js +0 -138
  198. package/dist/client/observability/exporters/baseExporter.js +0 -190
  199. package/dist/client/observability/exporters/braintrustExporter.js +0 -154
  200. package/dist/client/observability/exporters/datadogExporter.js +0 -196
  201. package/dist/client/observability/exporters/laminarExporter.js +0 -302
  202. package/dist/client/observability/exporters/langfuseExporter.js +0 -209
  203. package/dist/client/observability/exporters/langsmithExporter.js +0 -143
  204. package/dist/client/observability/exporters/otelExporter.js +0 -164
  205. package/dist/client/observability/exporters/posthogExporter.js +0 -287
  206. package/dist/client/observability/exporters/sentryExporter.js +0 -165
  207. package/dist/client/observability/index.js +0 -31
  208. package/dist/client/observability/metricsAggregator.js +0 -556
  209. package/dist/client/observability/otelBridge.js +0 -131
  210. package/dist/client/observability/retryPolicy.js +0 -383
  211. package/dist/client/observability/sampling/samplers.js +0 -216
  212. package/dist/client/observability/spanProcessor.js +0 -303
  213. package/dist/client/observability/tokenTracker.js +0 -413
  214. package/dist/client/observability/types/exporterTypes.js +0 -5
  215. package/dist/client/observability/types/index.js +0 -4
  216. package/dist/client/observability/types/spanTypes.js +0 -92
  217. package/dist/client/observability/utils/safeMetadata.js +0 -25
  218. package/dist/client/observability/utils/spanSerializer.js +0 -292
  219. package/dist/client/processors/archive/ArchiveProcessor.js +0 -1308
  220. package/dist/client/processors/base/BaseFileProcessor.js +0 -614
  221. package/dist/client/processors/base/types.js +0 -82
  222. package/dist/client/processors/config/fileTypes.js +0 -520
  223. package/dist/client/processors/config/index.js +0 -92
  224. package/dist/client/processors/config/languageMap.js +0 -410
  225. package/dist/client/processors/config/mimeTypes.js +0 -363
  226. package/dist/client/processors/config/sizeLimits.js +0 -258
  227. package/dist/client/processors/document/ExcelProcessor.js +0 -590
  228. package/dist/client/processors/document/OpenDocumentProcessor.js +0 -212
  229. package/dist/client/processors/document/PptxProcessor.js +0 -157
  230. package/dist/client/processors/document/RtfProcessor.js +0 -361
  231. package/dist/client/processors/document/WordProcessor.js +0 -353
  232. package/dist/client/processors/errors/FileErrorCode.js +0 -255
  233. package/dist/client/processors/errors/errorHelpers.js +0 -386
  234. package/dist/client/processors/errors/errorSerializer.js +0 -507
  235. package/dist/client/processors/errors/index.js +0 -49
  236. package/dist/client/processors/markup/SvgProcessor.js +0 -240
  237. package/dist/client/processors/media/AudioProcessor.js +0 -707
  238. package/dist/client/processors/media/VideoProcessor.js +0 -1045
  239. package/dist/client/providers/amazonBedrock.js +0 -1512
  240. package/dist/client/providers/amazonSagemaker.js +0 -162
  241. package/dist/client/providers/anthropic.js +0 -831
  242. package/dist/client/providers/azureOpenai.js +0 -143
  243. package/dist/client/providers/googleAiStudio.js +0 -1200
  244. package/dist/client/providers/googleNativeGemini3.js +0 -543
  245. package/dist/client/providers/googleVertex.js +0 -2936
  246. package/dist/client/providers/huggingFace.js +0 -315
  247. package/dist/client/providers/litellm.js +0 -488
  248. package/dist/client/providers/mistral.js +0 -157
  249. package/dist/client/providers/ollama.js +0 -1579
  250. package/dist/client/providers/openAI.js +0 -627
  251. package/dist/client/providers/openRouter.js +0 -543
  252. package/dist/client/providers/openaiCompatible.js +0 -290
  253. package/dist/client/providers/providerTypeUtils.js +0 -46
  254. package/dist/client/providers/sagemaker/adaptive-semaphore.js +0 -215
  255. package/dist/client/providers/sagemaker/client.js +0 -472
  256. package/dist/client/providers/sagemaker/config.js +0 -317
  257. package/dist/client/providers/sagemaker/detection.js +0 -606
  258. package/dist/client/providers/sagemaker/error-constants.js +0 -227
  259. package/dist/client/providers/sagemaker/errors.js +0 -299
  260. package/dist/client/providers/sagemaker/language-model.js +0 -775
  261. package/dist/client/providers/sagemaker/parsers.js +0 -634
  262. package/dist/client/providers/sagemaker/streaming.js +0 -331
  263. package/dist/client/providers/sagemaker/structured-parser.js +0 -625
  264. package/dist/client/proxy/accountQuota.js +0 -162
  265. package/dist/client/proxy/claudeFormat.js +0 -595
  266. package/dist/client/proxy/modelRouter.js +0 -29
  267. package/dist/client/proxy/oauthFetch.js +0 -367
  268. package/dist/client/proxy/proxyFetch.js +0 -586
  269. package/dist/client/proxy/requestLogger.js +0 -207
  270. package/dist/client/proxy/tokenRefresh.js +0 -124
  271. package/dist/client/proxy/usageStats.js +0 -74
  272. package/dist/client/proxy/utils/noProxyUtils.js +0 -149
  273. package/dist/client/rag/ChunkerFactory.js +0 -320
  274. package/dist/client/rag/ChunkerRegistry.js +0 -421
  275. package/dist/client/rag/chunkers/BaseChunker.js +0 -143
  276. package/dist/client/rag/chunkers/CharacterChunker.js +0 -28
  277. package/dist/client/rag/chunkers/HTMLChunker.js +0 -38
  278. package/dist/client/rag/chunkers/JSONChunker.js +0 -68
  279. package/dist/client/rag/chunkers/LaTeXChunker.js +0 -63
  280. package/dist/client/rag/chunkers/MarkdownChunker.js +0 -306
  281. package/dist/client/rag/chunkers/RecursiveChunker.js +0 -139
  282. package/dist/client/rag/chunkers/SemanticMarkdownChunker.js +0 -138
  283. package/dist/client/rag/chunkers/SentenceChunker.js +0 -66
  284. package/dist/client/rag/chunkers/TokenChunker.js +0 -61
  285. package/dist/client/rag/chunkers/index.js +0 -15
  286. package/dist/client/rag/chunking/characterChunker.js +0 -142
  287. package/dist/client/rag/chunking/chunkerRegistry.js +0 -194
  288. package/dist/client/rag/chunking/htmlChunker.js +0 -247
  289. package/dist/client/rag/chunking/index.js +0 -17
  290. package/dist/client/rag/chunking/jsonChunker.js +0 -281
  291. package/dist/client/rag/chunking/latexChunker.js +0 -251
  292. package/dist/client/rag/chunking/markdownChunker.js +0 -373
  293. package/dist/client/rag/chunking/recursiveChunker.js +0 -148
  294. package/dist/client/rag/chunking/semanticChunker.js +0 -306
  295. package/dist/client/rag/chunking/sentenceChunker.js +0 -230
  296. package/dist/client/rag/chunking/tokenChunker.js +0 -183
  297. package/dist/client/rag/document/MDocument.js +0 -392
  298. package/dist/client/rag/document/index.js +0 -5
  299. package/dist/client/rag/document/loaders.js +0 -500
  300. package/dist/client/rag/errors/RAGError.js +0 -274
  301. package/dist/client/rag/errors/index.js +0 -6
  302. package/dist/client/rag/graphRag/graphRAG.js +0 -401
  303. package/dist/client/rag/graphRag/index.js +0 -4
  304. package/dist/client/rag/index.js +0 -141
  305. package/dist/client/rag/metadata/MetadataExtractorFactory.js +0 -418
  306. package/dist/client/rag/metadata/MetadataExtractorRegistry.js +0 -362
  307. package/dist/client/rag/metadata/index.js +0 -9
  308. package/dist/client/rag/metadata/metadataExtractor.js +0 -280
  309. package/dist/client/rag/pipeline/RAGPipeline.js +0 -436
  310. package/dist/client/rag/pipeline/contextAssembly.js +0 -341
  311. package/dist/client/rag/pipeline/index.js +0 -5
  312. package/dist/client/rag/ragIntegration.js +0 -321
  313. package/dist/client/rag/reranker/RerankerFactory.js +0 -430
  314. package/dist/client/rag/reranker/RerankerRegistry.js +0 -402
  315. package/dist/client/rag/reranker/index.js +0 -9
  316. package/dist/client/rag/reranker/reranker.js +0 -277
  317. package/dist/client/rag/resilience/CircuitBreaker.js +0 -431
  318. package/dist/client/rag/resilience/RetryHandler.js +0 -304
  319. package/dist/client/rag/resilience/index.js +0 -7
  320. package/dist/client/rag/retrieval/hybridSearch.js +0 -335
  321. package/dist/client/rag/retrieval/index.js +0 -5
  322. package/dist/client/rag/retrieval/vectorQueryTool.js +0 -307
  323. package/dist/client/rag/types.js +0 -8
  324. package/dist/client/sdk/toolRegistration.js +0 -377
  325. package/dist/client/server/abstract/baseServerAdapter.js +0 -575
  326. package/dist/client/server/adapters/expressAdapter.js +0 -486
  327. package/dist/client/server/adapters/fastifyAdapter.js +0 -472
  328. package/dist/client/server/adapters/honoAdapter.js +0 -632
  329. package/dist/client/server/adapters/koaAdapter.js +0 -510
  330. package/dist/client/server/errors.js +0 -486
  331. package/dist/client/server/factory/serverAdapterFactory.js +0 -160
  332. package/dist/client/server/index.js +0 -108
  333. package/dist/client/server/middleware/abortSignal.js +0 -111
  334. package/dist/client/server/middleware/auth.js +0 -388
  335. package/dist/client/server/middleware/cache.js +0 -359
  336. package/dist/client/server/middleware/common.js +0 -281
  337. package/dist/client/server/middleware/deprecation.js +0 -190
  338. package/dist/client/server/middleware/mcpBodyAttachment.js +0 -63
  339. package/dist/client/server/middleware/rateLimit.js +0 -227
  340. package/dist/client/server/middleware/validation.js +0 -388
  341. package/dist/client/server/openapi/generator.js +0 -398
  342. package/dist/client/server/openapi/index.js +0 -36
  343. package/dist/client/server/openapi/schemas.js +0 -695
  344. package/dist/client/server/openapi/templates.js +0 -374
  345. package/dist/client/server/routes/agentRoutes.js +0 -189
  346. package/dist/client/server/routes/claudeProxyRoutes.js +0 -1600
  347. package/dist/client/server/routes/healthRoutes.js +0 -187
  348. package/dist/client/server/routes/index.js +0 -57
  349. package/dist/client/server/routes/mcpRoutes.js +0 -342
  350. package/dist/client/server/routes/memoryRoutes.js +0 -350
  351. package/dist/client/server/routes/openApiRoutes.js +0 -126
  352. package/dist/client/server/routes/toolRoutes.js +0 -199
  353. package/dist/client/server/streaming/dataStream.js +0 -486
  354. package/dist/client/server/streaming/index.js +0 -11
  355. package/dist/client/server/types.js +0 -67
  356. package/dist/client/server/utils/redaction.js +0 -334
  357. package/dist/client/server/utils/validation.js +0 -243
  358. package/dist/client/server/websocket/WebSocketHandler.js +0 -383
  359. package/dist/client/server/websocket/index.js +0 -4
  360. package/dist/client/services/server/ai/observability/instrumentation.js +0 -808
  361. package/dist/client/telemetry/attributes.js +0 -100
  362. package/dist/client/telemetry/index.js +0 -26
  363. package/dist/client/telemetry/telemetryService.js +0 -308
  364. package/dist/client/telemetry/tracers.js +0 -17
  365. package/dist/client/telemetry/withSpan.js +0 -34
  366. package/dist/client/types/actionTypes.js +0 -6
  367. package/dist/client/types/analytics.js +0 -5
  368. package/dist/client/types/authTypes.js +0 -9
  369. package/dist/client/types/circuitBreakerErrors.js +0 -34
  370. package/dist/client/types/cli.js +0 -21
  371. package/dist/client/types/clientTypes.js +0 -10
  372. package/dist/client/types/common.js +0 -51
  373. package/dist/client/types/configTypes.js +0 -49
  374. package/dist/client/types/content.js +0 -19
  375. package/dist/client/types/contextTypes.js +0 -400
  376. package/dist/client/types/conversation.js +0 -47
  377. package/dist/client/types/conversationMemoryInterface.js +0 -6
  378. package/dist/client/types/domainTypes.js +0 -5
  379. package/dist/client/types/errors.js +0 -167
  380. package/dist/client/types/evaluation.js +0 -5
  381. package/dist/client/types/evaluationProviders.js +0 -5
  382. package/dist/client/types/evaluationTypes.js +0 -1
  383. package/dist/client/types/externalMcp.js +0 -6
  384. package/dist/client/types/fileReferenceTypes.js +0 -8
  385. package/dist/client/types/fileTypes.js +0 -4
  386. package/dist/client/types/generateTypes.js +0 -1
  387. package/dist/client/types/guardrails.js +0 -1
  388. package/dist/client/types/hitlTypes.js +0 -8
  389. package/dist/client/types/index.js +0 -57
  390. package/dist/client/types/mcpTypes.js +0 -5
  391. package/dist/client/types/middlewareTypes.js +0 -1
  392. package/dist/client/types/modelTypes.js +0 -30
  393. package/dist/client/types/multimodal.js +0 -135
  394. package/dist/client/types/observability.js +0 -6
  395. package/dist/client/types/pptTypes.js +0 -82
  396. package/dist/client/types/providers.js +0 -111
  397. package/dist/client/types/proxyTypes.js +0 -16
  398. package/dist/client/types/ragTypes.js +0 -7
  399. package/dist/client/types/sdkTypes.js +0 -8
  400. package/dist/client/types/serviceTypes.js +0 -5
  401. package/dist/client/types/streamTypes.js +0 -1
  402. package/dist/client/types/subscriptionTypes.js +0 -9
  403. package/dist/client/types/taskClassificationTypes.js +0 -5
  404. package/dist/client/types/tools.js +0 -24
  405. package/dist/client/types/ttsTypes.js +0 -57
  406. package/dist/client/types/typeAliases.js +0 -48
  407. package/dist/client/types/utilities.js +0 -4
  408. package/dist/client/types/workflowTypes.js +0 -30
  409. package/dist/client/utils/async/withTimeout.js +0 -98
  410. package/dist/client/utils/asyncMutex.js +0 -60
  411. package/dist/client/utils/conversationMemory.js +0 -431
  412. package/dist/client/utils/csvProcessor.js +0 -846
  413. package/dist/client/utils/errorHandling.js +0 -936
  414. package/dist/client/utils/evaluationUtils.js +0 -131
  415. package/dist/client/utils/factoryProcessing.js +0 -589
  416. package/dist/client/utils/fileDetector.js +0 -2161
  417. package/dist/client/utils/imageCache.js +0 -376
  418. package/dist/client/utils/imageProcessor.js +0 -704
  419. package/dist/client/utils/logger.js +0 -491
  420. package/dist/client/utils/mcpDefaults.js +0 -134
  421. package/dist/client/utils/messageBuilder.js +0 -1653
  422. package/dist/client/utils/modelAliasResolver.js +0 -54
  423. package/dist/client/utils/modelDetection.js +0 -80
  424. package/dist/client/utils/modelRouter.js +0 -292
  425. package/dist/client/utils/multimodalOptionsBuilder.js +0 -65
  426. package/dist/client/utils/observabilityHelpers.js +0 -47
  427. package/dist/client/utils/parameterValidation.js +0 -966
  428. package/dist/client/utils/pdfProcessor.js +0 -410
  429. package/dist/client/utils/performance.js +0 -222
  430. package/dist/client/utils/pricing.js +0 -340
  431. package/dist/client/utils/promptRedaction.js +0 -62
  432. package/dist/client/utils/providerConfig.js +0 -1009
  433. package/dist/client/utils/providerHealth.js +0 -1237
  434. package/dist/client/utils/providerRetry.js +0 -112
  435. package/dist/client/utils/providerUtils.js +0 -434
  436. package/dist/client/utils/rateLimiter.js +0 -200
  437. package/dist/client/utils/redis.js +0 -368
  438. package/dist/client/utils/retryHandler.js +0 -269
  439. package/dist/client/utils/retryability.js +0 -22
  440. package/dist/client/utils/sanitizers/svg.js +0 -481
  441. package/dist/client/utils/schemaConversion.js +0 -255
  442. package/dist/client/utils/taskClassificationUtils.js +0 -149
  443. package/dist/client/utils/taskClassifier.js +0 -94
  444. package/dist/client/utils/thinkingConfig.js +0 -104
  445. package/dist/client/utils/timeout.js +0 -359
  446. package/dist/client/utils/tokenEstimation.js +0 -142
  447. package/dist/client/utils/tokenLimits.js +0 -125
  448. package/dist/client/utils/tokenUtils.js +0 -239
  449. package/dist/client/utils/toolUtils.js +0 -75
  450. package/dist/client/utils/transformationUtils.js +0 -554
  451. package/dist/client/utils/ttsProcessor.js +0 -286
  452. package/dist/client/utils/typeUtils.js +0 -97
  453. package/dist/client/utils/videoAnalysisProcessor.js +0 -67
  454. package/dist/client/workflow/config.js +0 -398
  455. package/dist/client/workflow/core/ensembleExecutor.js +0 -407
  456. package/dist/client/workflow/core/judgeScorer.js +0 -544
  457. package/dist/client/workflow/core/responseConditioner.js +0 -225
  458. package/dist/client/workflow/core/types/conditionerTypes.js +0 -7
  459. package/dist/client/workflow/core/types/ensembleTypes.js +0 -7
  460. package/dist/client/workflow/core/types/index.js +0 -7
  461. package/dist/client/workflow/core/types/judgeTypes.js +0 -7
  462. package/dist/client/workflow/core/types/layerTypes.js +0 -7
  463. package/dist/client/workflow/core/types/registryTypes.js +0 -7
  464. package/dist/client/workflow/core/workflowRegistry.js +0 -304
  465. package/dist/client/workflow/core/workflowRunner.js +0 -586
  466. package/dist/client/workflow/index.js +0 -50
  467. package/dist/client/workflow/types.js +0 -9
  468. package/dist/client/workflow/utils/types/index.js +0 -7
  469. package/dist/client/workflow/utils/workflowMetrics.js +0 -311
  470. package/dist/client/workflow/utils/workflowValidation.js +0 -420
  471. package/dist/client/workflow/workflows/adaptiveWorkflow.js +0 -366
  472. package/dist/client/workflow/workflows/consensusWorkflow.js +0 -192
  473. package/dist/client/workflow/workflows/fallbackWorkflow.js +0 -225
  474. package/dist/client/workflow/workflows/multiJudgeWorkflow.js +0 -351
  475. /package/dist/client/{client/reactHooks.js → reactHooks.js} +0 -0
@@ -1,966 +0,0 @@
1
- /**
2
- * Parameter Validation Utilities
3
- * Provides consistent parameter validation across all tool interfaces
4
- */
5
- import { VIDEO_ERROR_CODES } from "../constants/videoErrors.js";
6
- import { SYSTEM_LIMITS } from "../core/constants.js";
7
- import { ErrorFactory } from "./errorHandling.js";
8
- import { isNonNullObject } from "./typeUtils.js";
9
- // ============================================================================
10
- // VALIDATION ERROR TYPES
11
- // ============================================================================
12
- /**
13
- * Custom error class for parameter validation failures
14
- * Provides detailed information about validation errors including field context and suggestions
15
- */
16
- export class ValidationError extends Error {
17
- field;
18
- code;
19
- suggestions;
20
- /**
21
- * Creates a new ValidationError
22
- * @param message - Human-readable error message
23
- * @param field - Name of the field that failed validation (optional)
24
- * @param code - Error code for programmatic handling (optional)
25
- * @param suggestions - Array of suggested fixes (optional)
26
- */
27
- constructor(message, field, code, suggestions) {
28
- super(message);
29
- this.field = field;
30
- this.code = code;
31
- this.suggestions = suggestions;
32
- this.name = "ValidationError";
33
- }
34
- }
35
- // ============================================================================
36
- // BASIC PARAMETER VALIDATORS
37
- // ============================================================================
38
- /**
39
- * Validate that a string parameter is present and non-empty
40
- */
41
- export function validateRequiredString(value, fieldName, minLength = 1) {
42
- if (value === undefined || value === null) {
43
- return new ValidationError(`${fieldName} is required`, fieldName, "REQUIRED_FIELD", [`Provide a valid ${fieldName.toLowerCase()}`]);
44
- }
45
- if (typeof value !== "string") {
46
- return new ValidationError(`${fieldName} must be a string, received ${typeof value}`, fieldName, "INVALID_TYPE", [`Convert ${fieldName.toLowerCase()} to string format`]);
47
- }
48
- if (value.trim().length < minLength) {
49
- return new ValidationError(`${fieldName} must be at least ${minLength} character${minLength > 1 ? "s" : ""} long`, fieldName, "MIN_LENGTH", [`Provide a meaningful ${fieldName.toLowerCase()}`]);
50
- }
51
- return null;
52
- }
53
- /**
54
- * Validate that a number parameter is within acceptable range
55
- */
56
- export function validateNumberRange(value, fieldName, min, max, required = false) {
57
- if (value === undefined || value === null) {
58
- if (required) {
59
- return new ValidationError(`${fieldName} is required`, fieldName, "REQUIRED_FIELD", [`Provide a number between ${min} and ${max}`]);
60
- }
61
- return null; // Optional field
62
- }
63
- if (typeof value !== "number" || isNaN(value)) {
64
- return new ValidationError(`${fieldName} must be a valid number, received ${typeof value}`, fieldName, "INVALID_TYPE", [`Provide a number between ${min} and ${max}`]);
65
- }
66
- if (value < min || value > max) {
67
- return new ValidationError(`${fieldName} must be between ${min} and ${max}, received ${value}`, fieldName, "OUT_OF_RANGE", [`Use a value between ${min} and ${max}`]);
68
- }
69
- return null;
70
- }
71
- /**
72
- * Validate that a function parameter is async and has correct signature
73
- */
74
- export function validateAsyncFunction(value, fieldName, expectedParams = []) {
75
- if (typeof value !== "function") {
76
- return new ValidationError(`${fieldName} must be a function, received ${typeof value}`, fieldName, "INVALID_TYPE", [
77
- "Provide an async function",
78
- `Expected signature: async (${expectedParams.join(", ")}) => Promise<unknown>`,
79
- ]);
80
- }
81
- // Check if function appears to be async
82
- const funcStr = value.toString();
83
- const isAsync = funcStr.includes("async") || funcStr.includes("Promise");
84
- if (!isAsync) {
85
- return new ValidationError(`${fieldName} must be an async function that returns a Promise`, fieldName, "NOT_ASYNC", [
86
- "Add 'async' keyword to function declaration",
87
- "Return a Promise from the function",
88
- `Example: async (${expectedParams.join(", ")}) => { return result; }`,
89
- ]);
90
- }
91
- return null;
92
- }
93
- /**
94
- * Validate object structure with required properties
95
- */
96
- export function validateObjectStructure(value, fieldName, requiredProperties, optionalProperties = []) {
97
- if (!isNonNullObject(value)) {
98
- return new ValidationError(`${fieldName} must be an object, received ${typeof value}`, fieldName, "INVALID_TYPE", [
99
- `Provide an object with properties: ${requiredProperties.join(", ")}`,
100
- ...(optionalProperties.length > 0
101
- ? [`Optional properties: ${optionalProperties.join(", ")}`]
102
- : []),
103
- ]);
104
- }
105
- const obj = value;
106
- const missingProps = requiredProperties.filter((prop) => !(prop in obj));
107
- if (missingProps.length > 0) {
108
- return new ValidationError(`${fieldName} is missing required properties: ${missingProps.join(", ")}`, fieldName, "MISSING_PROPERTIES", [`Add missing properties: ${missingProps.join(", ")}`]);
109
- }
110
- return null;
111
- }
112
- // ============================================================================
113
- // TOOL-SPECIFIC VALIDATORS
114
- // ============================================================================
115
- /**
116
- * Validate tool name according to naming conventions
117
- */
118
- export function validateToolName(name) {
119
- const error = validateRequiredString(name, "Tool name", 1);
120
- if (error) {
121
- return error;
122
- }
123
- const toolName = name;
124
- // Check naming conventions
125
- if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(toolName)) {
126
- return new ValidationError("Tool name must start with a letter and contain only letters, numbers, underscores, and hyphens", "name", "INVALID_FORMAT", [
127
- "Use alphanumeric characters, underscores, and hyphens only",
128
- "Start with a letter",
129
- "Examples: 'calculateSum', 'data_processor', 'api-client'",
130
- ]);
131
- }
132
- if (toolName.length > 64) {
133
- return new ValidationError(`Tool name too long: ${toolName.length} characters (max: 64)`, "name", "MAX_LENGTH", ["Use a shorter, more concise name"]);
134
- }
135
- // Reserved names check
136
- const reservedNames = ["execute", "validate", "setup", "init", "config"];
137
- if (reservedNames.includes(toolName.toLowerCase())) {
138
- return new ValidationError(`Tool name '${toolName}' is reserved`, "name", "RESERVED_NAME", ["Choose a different name", "Add a prefix or suffix to make it unique"]);
139
- }
140
- return null;
141
- }
142
- /**
143
- * Validate tool description for clarity and usefulness
144
- */
145
- export function validateToolDescription(description) {
146
- const error = validateRequiredString(description, "Tool description", 10);
147
- if (error) {
148
- return error;
149
- }
150
- const desc = description;
151
- if (desc.length > 500) {
152
- return new ValidationError(`Tool description too long: ${desc.length} characters (max: 500)`, "description", "MAX_LENGTH", ["Keep description concise and focused", "Use under 500 characters"]);
153
- }
154
- // Check for meaningful content
155
- const meaningfulWords = desc.split(/\s+/).filter((word) => word.length > 2);
156
- if (meaningfulWords.length < 3) {
157
- return new ValidationError("Tool description should be more descriptive", "description", "TOO_BRIEF", [
158
- "Explain what the tool does",
159
- "Include expected parameters",
160
- "Describe the return value",
161
- ]);
162
- }
163
- return null;
164
- }
165
- /**
166
- * Validate MCP tool structure comprehensively
167
- */
168
- export function validateMCPTool(tool) {
169
- const errors = [];
170
- const warnings = [];
171
- const suggestions = [];
172
- if (!isNonNullObject(tool)) {
173
- errors.push(new ValidationError("Tool must be an object", "tool", "INVALID_TYPE", [
174
- "Provide a valid tool object with name, description, and execute properties",
175
- ]));
176
- return { isValid: false, errors, warnings, suggestions };
177
- }
178
- const mcpTool = tool;
179
- // Validate name
180
- const nameError = validateToolName(mcpTool.name);
181
- if (nameError) {
182
- errors.push(nameError);
183
- }
184
- // Validate description
185
- const descError = validateToolDescription(mcpTool.description);
186
- if (descError) {
187
- errors.push(descError);
188
- }
189
- // Validate execute function
190
- const execError = validateAsyncFunction(mcpTool.execute, "execute function", [
191
- "params",
192
- "context",
193
- ]);
194
- if (execError) {
195
- errors.push(execError);
196
- }
197
- // Simplified validation - just check if execute is a function
198
- if (mcpTool.execute && typeof mcpTool.execute !== "function") {
199
- errors.push(new ValidationError("Execute must be a function", "execute", "INVALID_TYPE", ["Provide a function for the execute property"]));
200
- }
201
- // Check optional properties
202
- if (mcpTool.inputSchema && !isNonNullObject(mcpTool.inputSchema)) {
203
- warnings.push("inputSchema should be an object if provided");
204
- suggestions.push("Provide a valid JSON schema or Zod schema for input validation");
205
- }
206
- if (mcpTool.outputSchema && !isNonNullObject(mcpTool.outputSchema)) {
207
- warnings.push("outputSchema should be an object if provided");
208
- suggestions.push("Provide a valid JSON schema or Zod schema for output validation");
209
- }
210
- return {
211
- isValid: errors.length === 0,
212
- errors,
213
- warnings,
214
- suggestions,
215
- };
216
- }
217
- // ============================================================================
218
- // OPTIONS VALIDATORS
219
- // ============================================================================
220
- /**
221
- * Validate text generation options
222
- */
223
- export function validateTextGenerationOptions(options) {
224
- const errors = [];
225
- const warnings = [];
226
- const suggestions = [];
227
- if (!isNonNullObject(options)) {
228
- errors.push(new ValidationError("Options must be an object", "options", "INVALID_TYPE"));
229
- return { isValid: false, errors, warnings, suggestions };
230
- }
231
- const opts = options;
232
- // Validate prompt
233
- const promptError = validateRequiredString(opts.prompt, "prompt", 1);
234
- if (promptError) {
235
- errors.push(promptError);
236
- }
237
- if (opts.prompt && opts.prompt.length > SYSTEM_LIMITS.MAX_PROMPT_LENGTH) {
238
- errors.push(new ValidationError(`Prompt too large: ${opts.prompt.length} characters (max: ${SYSTEM_LIMITS.MAX_PROMPT_LENGTH})`, "prompt", "MAX_LENGTH", [
239
- "Break prompt into smaller chunks",
240
- "Use summarization for long content",
241
- "Consider using streaming for large inputs",
242
- ]));
243
- }
244
- // Validate temperature
245
- const tempError = validateNumberRange(opts.temperature, "temperature", 0, 2);
246
- if (tempError) {
247
- errors.push(tempError);
248
- }
249
- // Validate maxTokens
250
- const tokensError = validateNumberRange(opts.maxTokens, "maxTokens", 1, 128000);
251
- if (tokensError) {
252
- errors.push(tokensError);
253
- }
254
- // Validate timeout
255
- if (opts.timeout !== undefined) {
256
- if (typeof opts.timeout === "string") {
257
- // Parse string timeouts like "30s", "2m", "1h"
258
- if (!/^\d+[smh]?$/.test(opts.timeout)) {
259
- errors.push(new ValidationError("Invalid timeout format. Use number (ms) or string like '30s', '2m', '1h'", "timeout", "INVALID_FORMAT", ["Use format: 30000 (ms), '30s', '2m', or '1h'"]));
260
- }
261
- }
262
- else if (typeof opts.timeout === "number") {
263
- if (opts.timeout < 1000 || opts.timeout > 600000) {
264
- warnings.push("Timeout outside recommended range (1s - 10m)");
265
- suggestions.push("Use timeout between 1000ms (1s) and 600000ms (10m)");
266
- }
267
- }
268
- else {
269
- errors.push(new ValidationError("Timeout must be a number (ms) or string", "timeout", "INVALID_TYPE"));
270
- }
271
- }
272
- return { isValid: errors.length === 0, errors, warnings, suggestions };
273
- }
274
- /**
275
- * Validate stream options
276
- */
277
- export function validateStreamOptions(options) {
278
- const errors = [];
279
- const warnings = [];
280
- const suggestions = [];
281
- if (!isNonNullObject(options)) {
282
- errors.push(new ValidationError("Options must be an object", "options", "INVALID_TYPE"));
283
- return { isValid: false, errors, warnings, suggestions };
284
- }
285
- const opts = options;
286
- // Validate input
287
- if (!opts.input || !isNonNullObject(opts.input)) {
288
- errors.push(new ValidationError("input is required and must be an object with text property", "input", "REQUIRED_FIELD", ["Provide input: { text: 'your prompt here' }"]));
289
- }
290
- else {
291
- const inputError = validateRequiredString(opts.input.text, "input.text", 1);
292
- if (inputError) {
293
- errors.push(inputError);
294
- }
295
- }
296
- // Validate temperature
297
- const tempError = validateNumberRange(opts.temperature, "temperature", 0, 2);
298
- if (tempError) {
299
- errors.push(tempError);
300
- }
301
- // Validate maxTokens
302
- const tokensError = validateNumberRange(opts.maxTokens, "maxTokens", 1, 128000);
303
- if (tokensError) {
304
- errors.push(tokensError);
305
- }
306
- return { isValid: errors.length === 0, errors, warnings, suggestions };
307
- }
308
- /**
309
- * Validate generate options (unified interface)
310
- */
311
- export function validateGenerateOptions(options) {
312
- const errors = [];
313
- const warnings = [];
314
- const suggestions = [];
315
- if (!isNonNullObject(options)) {
316
- errors.push(new ValidationError("Options must be an object", "options", "INVALID_TYPE"));
317
- return { isValid: false, errors, warnings, suggestions };
318
- }
319
- const opts = options;
320
- // Validate input
321
- if (!opts.input || !isNonNullObject(opts.input)) {
322
- errors.push(new ValidationError("input is required and must be an object with text property", "input", "REQUIRED_FIELD", ["Provide input: { text: 'your prompt here' }"]));
323
- }
324
- else {
325
- const inputError = validateRequiredString(opts.input.text, "input.text", 1);
326
- if (inputError) {
327
- errors.push(inputError);
328
- }
329
- }
330
- // Common validation for temperature and maxTokens
331
- const tempError = validateNumberRange(opts.temperature, "temperature", 0, 2);
332
- if (tempError) {
333
- errors.push(tempError);
334
- }
335
- const tokensError = validateNumberRange(opts.maxTokens, "maxTokens", 1, 128000);
336
- if (tokensError) {
337
- errors.push(tokensError);
338
- }
339
- // Validate factory config if present
340
- if (opts.factoryConfig && !isNonNullObject(opts.factoryConfig)) {
341
- warnings.push("factoryConfig should be an object if provided");
342
- suggestions.push("Provide valid factory configuration or remove the property");
343
- }
344
- return { isValid: errors.length === 0, errors, warnings, suggestions };
345
- }
346
- // ============================================================================
347
- // PARAMETER TRANSFORMATION VALIDATORS
348
- // ============================================================================
349
- /**
350
- * Validate tool execution parameters
351
- */
352
- export function validateToolExecutionParams(toolName, params, expectedSchema) {
353
- const errors = [];
354
- const warnings = [];
355
- const suggestions = [];
356
- // Basic parameter validation
357
- if (params !== undefined && params !== null && !isNonNullObject(params)) {
358
- errors.push(new ValidationError(`Parameters for tool '${toolName}' must be an object`, "params", "INVALID_TYPE", ["Provide parameters as an object: { key: value, ... }"]));
359
- return { isValid: false, errors, warnings, suggestions };
360
- }
361
- // Schema validation (if provided)
362
- if (expectedSchema && params) {
363
- try {
364
- // This is a placeholder for actual schema validation
365
- // In practice, you would use Zod or JSON schema validation here
366
- warnings.push("Schema validation not yet implemented");
367
- suggestions.push("Implement Zod schema validation for tool parameters");
368
- }
369
- catch (error) {
370
- errors.push(new ValidationError(`Parameter validation failed: ${error instanceof Error ? error.message : String(error)}`, "params", "SCHEMA_VALIDATION", ["Check parameter format against tool schema"]));
371
- }
372
- }
373
- return { isValid: errors.length === 0, errors, warnings, suggestions };
374
- }
375
- // ============================================================================
376
- // BATCH VALIDATION UTILITIES
377
- // ============================================================================
378
- /**
379
- * Validate multiple tools at once
380
- */
381
- export function validateToolBatch(tools) {
382
- const validTools = [];
383
- const invalidTools = [];
384
- const results = {};
385
- for (const [name, tool] of Object.entries(tools)) {
386
- const nameValidation = validateToolName(name);
387
- const toolValidation = validateMCPTool(tool);
388
- const combinedResult = {
389
- isValid: !nameValidation && toolValidation.isValid,
390
- errors: nameValidation
391
- ? [nameValidation, ...toolValidation.errors]
392
- : toolValidation.errors,
393
- warnings: toolValidation.warnings,
394
- suggestions: toolValidation.suggestions,
395
- };
396
- results[name] = combinedResult;
397
- if (combinedResult.isValid) {
398
- validTools.push(name);
399
- }
400
- else {
401
- invalidTools.push(name);
402
- }
403
- }
404
- return {
405
- isValid: invalidTools.length === 0,
406
- validTools,
407
- invalidTools,
408
- results,
409
- };
410
- }
411
- // ============================================================================
412
- // VIDEO GENERATION VALIDATORS
413
- // ============================================================================
414
- /**
415
- * Convert a NeuroLinkError to a ValidationError shape
416
- * Used to maintain consistent error types in validation results
417
- */
418
- function toValidationError(error) {
419
- // Field can be on error directly or in context (from ErrorFactory methods)
420
- const field = error.field ??
421
- error.context?.field;
422
- return new ValidationError(error.message, field, error.code, error.suggestions);
423
- }
424
- /**
425
- * Valid video generation options
426
- */
427
- const VALID_VIDEO_RESOLUTIONS = ["720p", "1080p"];
428
- const VALID_VIDEO_LENGTHS = [4, 6, 8];
429
- const VALID_VIDEO_ASPECT_RATIOS = ["9:16", "16:9"];
430
- const MAX_VIDEO_PROMPT_LENGTH = 500;
431
- const MAX_VIDEO_IMAGE_SIZE = 10 * 1024 * 1024; // 10MB
432
- /**
433
- * Validate video output options (resolution, length, aspect ratio, audio)
434
- *
435
- * @param options - VideoOutputOptions to validate
436
- * @returns NeuroLinkError if invalid, null if valid
437
- *
438
- * @example
439
- * ```typescript
440
- * const error = validateVideoOutputOptions({ resolution: "4K", length: 10 });
441
- * // error.code === "INVALID_VIDEO_RESOLUTION"
442
- * ```
443
- */
444
- export function validateVideoOutputOptions(options) {
445
- // Validate resolution
446
- if (options.resolution &&
447
- !VALID_VIDEO_RESOLUTIONS.includes(options.resolution)) {
448
- return ErrorFactory.invalidVideoResolution(options.resolution);
449
- }
450
- // Validate length
451
- if (options.length !== undefined &&
452
- !VALID_VIDEO_LENGTHS.includes(options.length)) {
453
- return ErrorFactory.invalidVideoLength(options.length);
454
- }
455
- // Validate aspect ratio
456
- if (options.aspectRatio &&
457
- !VALID_VIDEO_ASPECT_RATIOS.includes(options.aspectRatio)) {
458
- return ErrorFactory.invalidVideoAspectRatio(options.aspectRatio);
459
- }
460
- // Validate audio (must be boolean if provided)
461
- if (options.audio !== undefined && typeof options.audio !== "boolean") {
462
- return ErrorFactory.invalidVideoAudio(options.audio);
463
- }
464
- return null;
465
- }
466
- /**
467
- * Validate image input for video generation
468
- *
469
- * Checks image format (magic bytes) and size constraints.
470
- * Supports JPEG, PNG, and WebP formats.
471
- *
472
- * @param image - Image buffer to validate
473
- * @param maxSize - Maximum allowed size in bytes (default: 10MB)
474
- * @returns NeuroLinkError if invalid, null if valid
475
- *
476
- * @example
477
- * ```typescript
478
- * const imageBuffer = readFileSync("product.jpg");
479
- * const error = validateImageForVideo(imageBuffer);
480
- * if (error) throw error;
481
- * ```
482
- */
483
- export function validateImageForVideo(image, maxSize = MAX_VIDEO_IMAGE_SIZE) {
484
- // Handle null/undefined
485
- if (image === null || image === undefined) {
486
- return ErrorFactory.invalidImageType();
487
- }
488
- // If string (URL or path), skip detailed validation
489
- if (typeof image === "string") {
490
- // Basic URL/path validation
491
- if (image.trim().length === 0) {
492
- return ErrorFactory.emptyImagePath();
493
- }
494
- return null;
495
- }
496
- // Ensure it's a Buffer
497
- if (!Buffer.isBuffer(image)) {
498
- return ErrorFactory.invalidImageType();
499
- }
500
- // Check size
501
- if (image.length > maxSize) {
502
- const sizeMB = (image.length / 1024 / 1024).toFixed(2);
503
- const maxMB = (maxSize / 1024 / 1024).toFixed(0);
504
- return ErrorFactory.imageTooLarge(sizeMB, maxMB);
505
- }
506
- // Check minimum size (at least a few bytes for magic number detection)
507
- if (image.length < 8) {
508
- return ErrorFactory.imageTooSmall();
509
- }
510
- // Check magic bytes for supported formats
511
- const isJPEG = image[0] === 0xff && image[1] === 0xd8 && image[2] === 0xff;
512
- const isPNG = image[0] === 0x89 &&
513
- image[1] === 0x50 &&
514
- image[2] === 0x4e &&
515
- image[3] === 0x47;
516
- // WebP requires both RIFF header AND WEBP signature
517
- // Check for WebP: RIFF at bytes 0-3 AND "WEBP" at bytes 8-11
518
- const isWebP = image.length >= 12 &&
519
- image[0] === 0x52 &&
520
- image[1] === 0x49 &&
521
- image[2] === 0x46 &&
522
- image[3] === 0x46 && // RIFF header
523
- image[8] === 0x57 &&
524
- image[9] === 0x45 &&
525
- image[10] === 0x42 &&
526
- image[11] === 0x50; // WEBP signature
527
- const isValidFormat = isJPEG || isPNG || isWebP;
528
- if (!isValidFormat) {
529
- return ErrorFactory.invalidImageFormat();
530
- }
531
- return null;
532
- }
533
- /**
534
- * Validate complete video generation input
535
- *
536
- * Validates all requirements for video generation:
537
- * - output.mode must be "video"
538
- * - Must have exactly one input image
539
- * - Prompt must be within length limits
540
- * - Video output options must be valid
541
- *
542
- * @param options - GenerateOptions to validate for video generation
543
- * @returns EnhancedValidationResult with errors, warnings, and suggestions
544
- *
545
- * @example
546
- * ```typescript
547
- * const validation = validateVideoGenerationInput({
548
- * input: { text: "Product showcase video", images: [imageBuffer] },
549
- * output: { mode: "video", video: { resolution: "1080p" } }
550
- * });
551
- * if (!validation.isValid) {
552
- * console.error(validation.errors);
553
- * }
554
- * ```
555
- */
556
- export function validateVideoGenerationInput(options) {
557
- const errors = [];
558
- const warnings = [];
559
- const suggestions = [];
560
- // Must have video mode
561
- if (options.output?.mode !== "video") {
562
- errors.push(toValidationError(ErrorFactory.invalidVideoMode()));
563
- }
564
- // Must have at least one image
565
- if (!options.input?.images || options.input.images.length === 0) {
566
- errors.push(toValidationError(ErrorFactory.missingVideoImage()));
567
- }
568
- else if (options.input.images.length > 1) {
569
- // Warn if multiple images provided - only first will be used
570
- warnings.push("Only the first image will be used for video generation. Additional images will be ignored.");
571
- suggestions.push("Provide a single image for video generation");
572
- }
573
- // Validate the first image if present
574
- if (options.input?.images && options.input.images.length > 0) {
575
- const firstImage = options.input.images[0];
576
- // Handle ImageWithAltText type
577
- const imageData = typeof firstImage === "object" && "data" in firstImage
578
- ? firstImage.data
579
- : firstImage;
580
- // Skip validation for URL/path strings, validate Buffers
581
- if (typeof imageData !== "string") {
582
- const imageError = validateImageForVideo(imageData);
583
- if (imageError) {
584
- errors.push(toValidationError(imageError));
585
- }
586
- }
587
- }
588
- // Validate prompt/text - trim once for consistency
589
- const trimmedPrompt = options.input?.text?.trim() || "";
590
- if (trimmedPrompt.length === 0) {
591
- errors.push(toValidationError(ErrorFactory.emptyVideoPrompt()));
592
- }
593
- else if (trimmedPrompt.length > MAX_VIDEO_PROMPT_LENGTH) {
594
- errors.push(toValidationError(ErrorFactory.videoPromptTooLong(trimmedPrompt.length, MAX_VIDEO_PROMPT_LENGTH)));
595
- }
596
- // Validate video output options if provided
597
- if (options.output?.video) {
598
- const videoError = validateVideoOutputOptions(options.output.video);
599
- if (videoError) {
600
- errors.push(toValidationError(videoError));
601
- }
602
- }
603
- // Add helpful suggestions
604
- if (errors.length === 0 && warnings.length === 0) {
605
- suggestions.push("Video generation takes 60-180 seconds. Consider setting a longer timeout.");
606
- }
607
- return { isValid: errors.length === 0, errors, warnings, suggestions };
608
- }
609
- // ============================================================================
610
- // DIRECTOR MODE VALIDATION
611
- // ============================================================================
612
- const MIN_DIRECTOR_SEGMENTS = 2;
613
- const MAX_DIRECTOR_SEGMENTS = 10;
614
- const VALID_TRANSITION_DURATIONS = [4, 6, 8];
615
- /**
616
- * Validate Director Mode input: segments, transition prompts, and durations.
617
- *
618
- * @param options - GenerateOptions with input.segments and output.director
619
- * @returns EnhancedValidationResult with errors, warnings, and suggestions
620
- */
621
- export function validateDirectorModeInput(options) {
622
- const errors = [];
623
- const warnings = [];
624
- const suggestions = [];
625
- const segments = options.input?.segments;
626
- if (!segments || !Array.isArray(segments)) {
627
- errors.push(new ValidationError("Director Mode requires an input.segments array", "input.segments", VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
628
- return { isValid: false, errors, warnings, suggestions };
629
- }
630
- if (segments.length < MIN_DIRECTOR_SEGMENTS ||
631
- segments.length > MAX_DIRECTOR_SEGMENTS) {
632
- errors.push(new ValidationError(`Director Mode requires ${MIN_DIRECTOR_SEGMENTS}-${MAX_DIRECTOR_SEGMENTS} segments, got ${segments.length}`, "input.segments", segments.length > MAX_DIRECTOR_SEGMENTS
633
- ? VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_LIMIT_EXCEEDED
634
- : VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
635
- return { isValid: false, errors, warnings, suggestions };
636
- }
637
- // Validate each segment
638
- for (let i = 0; i < segments.length; i++) {
639
- const seg = segments[i];
640
- if (!seg || typeof seg !== "object") {
641
- errors.push(new ValidationError(`Segment ${i} must be an object with prompt and image`, `input.segments[${i}]`, VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
642
- continue;
643
- }
644
- if (!seg.prompt ||
645
- typeof seg.prompt !== "string" ||
646
- seg.prompt.trim().length === 0) {
647
- errors.push(new ValidationError(`Segment ${i} requires a non-empty prompt`, `input.segments[${i}].prompt`, VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
648
- }
649
- if (seg.image === undefined || seg.image === null) {
650
- errors.push(new ValidationError(`Segment ${i} requires a valid image (Buffer, URL, path, or ImageWithAltText)`, `input.segments[${i}].image`, VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
651
- }
652
- }
653
- // Validate director options
654
- const director = options.output?.director;
655
- const expectedTransitions = segments.length - 1;
656
- if (director?.transitionPrompts) {
657
- if (director.transitionPrompts.length !== expectedTransitions) {
658
- errors.push(new ValidationError(`Expected ${expectedTransitions} transition prompts, got ${director.transitionPrompts.length}`, "output.director.transitionPrompts", VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
659
- }
660
- }
661
- if (director?.transitionDurations) {
662
- if (director.transitionDurations.length !== expectedTransitions) {
663
- errors.push(new ValidationError(`Expected ${expectedTransitions} transition durations, got ${director.transitionDurations.length}`, "output.director.transitionDurations", VIDEO_ERROR_CODES.DIRECTOR_SEGMENT_MISMATCH));
664
- }
665
- else {
666
- for (let i = 0; i < director.transitionDurations.length; i++) {
667
- const d = director.transitionDurations[i];
668
- if (!VALID_TRANSITION_DURATIONS.includes(d)) {
669
- errors.push(new ValidationError(`Invalid transition duration at index ${i}: ${d}. Use 4, 6, or 8`, `output.director.transitionDurations[${i}]`, VIDEO_ERROR_CODES.DIRECTOR_INVALID_TRANSITION_DURATION));
670
- }
671
- }
672
- }
673
- }
674
- // Validate video output options if provided
675
- if (options.output?.video) {
676
- const videoError = validateVideoOutputOptions(options.output.video);
677
- if (videoError) {
678
- errors.push(toValidationError(videoError));
679
- }
680
- }
681
- if (errors.length === 0) {
682
- const totalCalls = segments.length + expectedTransitions;
683
- suggestions.push(`Director Mode will make ${totalCalls} API calls (${segments.length} clips + ${expectedTransitions} transitions). Ensure adequate timeout.`);
684
- }
685
- return { isValid: errors.length === 0, errors, warnings, suggestions };
686
- }
687
- // ============================================================================
688
- // PPT VALIDATION (Presentation Generation)
689
- // ============================================================================
690
- /**
691
- * Valid PPT generation options
692
- */
693
- const VALID_PPT_THEMES = [
694
- "modern",
695
- "corporate",
696
- "creative",
697
- "minimal",
698
- "dark",
699
- ];
700
- const VALID_PPT_AUDIENCES = [
701
- "business",
702
- "students",
703
- "technical",
704
- "general",
705
- ];
706
- const VALID_PPT_TONES = [
707
- "professional",
708
- "casual",
709
- "educational",
710
- "persuasive",
711
- ];
712
- const VALID_PPT_ASPECT_RATIOS = ["16:9", "4:3"];
713
- const VALID_PPT_FORMATS = ["pptx"];
714
- export const MIN_PPT_PAGES = 5;
715
- export const MAX_PPT_PAGES = 50;
716
- export const MIN_PPT_PROMPT_LENGTH = 10;
717
- export const MAX_PPT_PROMPT_LENGTH = 1000;
718
- /**
719
- * Validate PPT output options (pages, theme, audience, tone, etc.)
720
- *
721
- * @param options - PPTOutputOptions to validate
722
- * @returns NeuroLinkError if invalid, null if valid
723
- *
724
- * @example
725
- * ```typescript
726
- * const error = validatePPTOutputOptions({ pages: 100, theme: "invalid" });
727
- * // error.code === "INVALID_PPT_PAGES"
728
- * ```
729
- */
730
- export function validatePPTOutputOptions(options) {
731
- // Validate pages (slide count) - REQUIRED
732
- if (options.pages === undefined || options.pages === null) {
733
- return ErrorFactory.invalidPPTPages(undefined, "pages is required");
734
- }
735
- if (typeof options.pages !== "number") {
736
- return ErrorFactory.invalidPPTPages(options.pages, "not a number");
737
- }
738
- if (!Number.isInteger(options.pages)) {
739
- return ErrorFactory.invalidPPTPages(options.pages, "not an integer");
740
- }
741
- if (options.pages < MIN_PPT_PAGES || options.pages > MAX_PPT_PAGES) {
742
- return ErrorFactory.invalidPPTPages(options.pages, `out of range (${MIN_PPT_PAGES}-${MAX_PPT_PAGES})`);
743
- }
744
- // Validate format
745
- if (options.format !== undefined &&
746
- !VALID_PPT_FORMATS.includes(options.format)) {
747
- return ErrorFactory.invalidPPTFormat(options.format);
748
- }
749
- // Validate theme - optional (if not provided, AI will decide)
750
- if (options.theme !== undefined &&
751
- !VALID_PPT_THEMES.includes(options.theme)) {
752
- return ErrorFactory.invalidPPTOutputOptions("theme", options.theme, Array.from(VALID_PPT_THEMES));
753
- }
754
- // Validate audience - optional (if not provided, AI will decide)
755
- if (options.audience !== undefined &&
756
- !VALID_PPT_AUDIENCES.includes(options.audience)) {
757
- return ErrorFactory.invalidPPTOutputOptions("audience", options.audience, Array.from(VALID_PPT_AUDIENCES));
758
- }
759
- // Validate tone - optional (if not provided, AI will decide)
760
- if (options.tone !== undefined &&
761
- !VALID_PPT_TONES.includes(options.tone)) {
762
- return ErrorFactory.invalidPPTOutputOptions("tone", options.tone, Array.from(VALID_PPT_TONES));
763
- }
764
- // Validate aspectRatio
765
- if (options.aspectRatio !== undefined &&
766
- !VALID_PPT_ASPECT_RATIOS.includes(options.aspectRatio)) {
767
- return ErrorFactory.invalidPPTOutputOptions("aspectRatio", options.aspectRatio, Array.from(VALID_PPT_ASPECT_RATIOS));
768
- }
769
- // Validate generateAIImages (must be boolean if provided)
770
- if (options.generateAIImages !== undefined &&
771
- typeof options.generateAIImages !== "boolean") {
772
- return ErrorFactory.invalidPPTOutputOptions("generateAIImages", options.generateAIImages, ["true", "false"]);
773
- }
774
- // Validate logoPath (string path, Buffer, or ImageWithAltText)
775
- if (options.logoPath !== undefined) {
776
- if (typeof options.logoPath === "string") {
777
- if (options.logoPath.trim().length === 0) {
778
- return ErrorFactory.invalidPPTLogoPath(options.logoPath, "empty string");
779
- }
780
- }
781
- else if (Buffer.isBuffer(options.logoPath)) {
782
- // ok
783
- }
784
- else if (typeof options.logoPath === "object" &&
785
- "data" in options.logoPath) {
786
- const data = options.logoPath.data;
787
- if (typeof data === "string") {
788
- if (data.trim().length === 0) {
789
- return ErrorFactory.invalidPPTLogoPath(options.logoPath, "empty string");
790
- }
791
- }
792
- else if (!Buffer.isBuffer(data)) {
793
- return ErrorFactory.invalidPPTLogoPath(options.logoPath, "invalid data type");
794
- }
795
- }
796
- else {
797
- return ErrorFactory.invalidPPTLogoPath(options.logoPath, "invalid type");
798
- }
799
- }
800
- // Validate outputPath (must be non-empty string if provided)
801
- if (options.outputPath !== undefined) {
802
- if (typeof options.outputPath !== "string") {
803
- return ErrorFactory.invalidPPTOutputPath(options.outputPath, "not a string");
804
- }
805
- if (options.outputPath.trim().length === 0) {
806
- return ErrorFactory.invalidPPTOutputPath(options.outputPath, "empty string");
807
- }
808
- }
809
- return null;
810
- }
811
- /**
812
- * Validate PPT provider (supports vertex, openai, azure, anthropic, google-ai, bedrock)
813
- *
814
- * @param provider - Provider name to validate
815
- * @returns NeuroLinkError if invalid, null if valid
816
- *
817
- * @example
818
- * ```typescript
819
- * const error = validatePPTProvider("unsupported-provider");
820
- * // error.code === "INVALID_PPT_PROVIDER"
821
- * ```
822
- */
823
- export function validatePPTProvider(provider) {
824
- // PPT generation supported providers (subset of all AIProviderName values)
825
- // Supports major LLM providers with structured output capabilities
826
- const validProviders = [
827
- "vertex",
828
- "openai",
829
- "azure",
830
- "anthropic",
831
- "google-ai",
832
- "bedrock",
833
- ];
834
- // Convert enum or string to lowercase string for comparison
835
- const providerString = String(provider).toLowerCase();
836
- if (!validProviders.includes(providerString)) {
837
- return ErrorFactory.invalidPPTProvider(provider);
838
- }
839
- return null;
840
- }
841
- /**
842
- * Validate complete PPT generation input
843
- *
844
- * Validates all requirements for presentation generation:
845
- * - output.mode must be "ppt"
846
- * - Prompt must be within length limits
847
- * - PPT output options must be valid
848
- *
849
- * @param options - GenerateOptions to validate for PPT generation
850
- * @returns EnhancedValidationResult with errors, warnings, and suggestions
851
- *
852
- * @example
853
- * ```typescript
854
- * const validation = validatePPTGenerationInput({
855
- * input: { text: "Introducing Our New Product" },
856
- * output: { mode: "ppt", ppt: { pages: 10, theme: "modern" } }
857
- * });
858
- * if (!validation.isValid) {
859
- * console.error(validation.errors);
860
- * }
861
- * ```
862
- */
863
- export function validatePPTGenerationInput(options) {
864
- const errors = [];
865
- const warnings = [];
866
- const suggestions = [];
867
- // Validate prompt/text - must exist first
868
- if (!options.input?.text) {
869
- errors.push(toValidationError(ErrorFactory.invalidPPTPrompt("input.text is required")));
870
- // Return early since we can't validate further
871
- return { isValid: false, errors, warnings, suggestions };
872
- }
873
- // Validate prompt/text - trim once for consistency
874
- const trimmedPrompt = options.input.text.trim();
875
- if (trimmedPrompt === "") {
876
- errors.push(toValidationError(ErrorFactory.invalidPPTPrompt("empty prompt")));
877
- }
878
- else if (trimmedPrompt.length < MIN_PPT_PROMPT_LENGTH) {
879
- errors.push(toValidationError(ErrorFactory.invalidPPTPrompt(`prompt too short (${trimmedPrompt.length} characters, minimum ${MIN_PPT_PROMPT_LENGTH} required)`)));
880
- }
881
- else if (trimmedPrompt.length > MAX_PPT_PROMPT_LENGTH) {
882
- errors.push(toValidationError(ErrorFactory.invalidPPTPrompt(`prompt too long (${trimmedPrompt.length} characters, max ${MAX_PPT_PROMPT_LENGTH})`)));
883
- }
884
- // image PPT options if provided
885
- if (options.input.images && options.input.images.length > 0) {
886
- warnings.push("Images can be unused in PPT generation due to fail in quality standards and can lead to longer generation times.");
887
- suggestions.push("Only provide high-quality, relevant images for PPT generation.");
888
- }
889
- // Validate provider (optional - only validate if explicitly provided)
890
- if (options.provider !== undefined) {
891
- const providerError = validatePPTProvider(options.provider);
892
- if (providerError) {
893
- errors.push(toValidationError(providerError));
894
- }
895
- }
896
- // Mode is optional, but if provided must be "ppt"
897
- if (options.output?.mode !== undefined && options.output.mode !== "ppt") {
898
- errors.push(toValidationError(ErrorFactory.invalidPPTMode()));
899
- }
900
- // Validate PPT output options
901
- if (options.output?.ppt) {
902
- const pptError = validatePPTOutputOptions(options.output.ppt);
903
- if (pptError) {
904
- errors.push(toValidationError(pptError));
905
- }
906
- // Add specific warnings
907
- const pages = options.output.ppt.pages;
908
- if (pages !== undefined && pages > 30) {
909
- warnings.push(`Generating ${pages} slides may take significant time (estimated: ${Math.ceil(pages * 3)}-${Math.ceil(pages * 5)} seconds)`);
910
- }
911
- if (options.output.ppt.generateAIImages === undefined ||
912
- options.output.ppt.generateAIImages === true) {
913
- suggestions.push("AI image generation is enabled. Each slide with images will take additional time (~2-5 seconds per image).");
914
- }
915
- // Add suggestion about AI selection being used for undefined values
916
- const aiSelections = [];
917
- if (options.output.ppt.theme === undefined) {
918
- aiSelections.push("theme");
919
- }
920
- if (options.output.ppt.audience === undefined) {
921
- aiSelections.push("audience");
922
- }
923
- if (options.output.ppt.tone === undefined) {
924
- aiSelections.push("tone");
925
- }
926
- if (aiSelections.length > 0) {
927
- suggestions.push(`AI will decide: ${aiSelections.join(", ")} (based on topic analysis)`);
928
- }
929
- }
930
- else {
931
- errors.push(toValidationError(ErrorFactory.missingPPTProperty("output.ppt", [
932
- "Provide PPT generation options under output.ppt",
933
- "pages is required, theme/audience/tone are optional (AI will decide if not specified)",
934
- ])));
935
- }
936
- // Add helpful suggestions
937
- if (errors.length === 0 && warnings.length === 0) {
938
- suggestions.push("PPT generation typically takes 30-120 seconds depending on slide count and image generation.");
939
- }
940
- return { isValid: errors.length === 0, errors, warnings, suggestions };
941
- }
942
- // ============================================================================
943
- // HELPER FUNCTIONS
944
- // ============================================================================
945
- /**
946
- * Create a validation error summary for logging
947
- */
948
- export function createValidationSummary(result) {
949
- const parts = [];
950
- if (result.errors.length > 0) {
951
- parts.push(`Errors: ${result.errors.map((e) => e.message).join("; ")}`);
952
- }
953
- if (result.warnings.length > 0) {
954
- parts.push(`Warnings: ${result.warnings.join("; ")}`);
955
- }
956
- if (result.suggestions.length > 0) {
957
- parts.push(`Suggestions: ${result.suggestions.join("; ")}`);
958
- }
959
- return parts.join(" | ");
960
- }
961
- /**
962
- * Check if validation result has only warnings (no errors)
963
- */
964
- export function hasOnlyWarnings(result) {
965
- return result.errors.length === 0 && result.warnings.length > 0;
966
- }