@juspay/neurolink 9.5.2 → 9.6.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 (356) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +29 -25
  3. package/dist/agent/directTools.d.ts +5 -5
  4. package/dist/cli/commands/config.d.ts +9 -9
  5. package/dist/cli/commands/serve.d.ts +37 -0
  6. package/dist/cli/commands/serve.js +302 -229
  7. package/dist/cli/commands/setup-anthropic.d.ts +2 -2
  8. package/dist/cli/commands/setup-azure.d.ts +2 -2
  9. package/dist/cli/commands/setup-bedrock.d.ts +2 -2
  10. package/dist/cli/commands/setup-gcp.d.ts +2 -2
  11. package/dist/cli/commands/setup-google-ai.d.ts +2 -2
  12. package/dist/cli/commands/setup-huggingface.d.ts +2 -2
  13. package/dist/cli/commands/setup-mistral.d.ts +2 -2
  14. package/dist/cli/commands/setup-openai.d.ts +2 -2
  15. package/dist/cli/commands/setup.d.ts +2 -2
  16. package/dist/cli/factories/commandFactory.js +16 -2
  17. package/dist/cli/loop/optionsSchema.d.ts +2 -2
  18. package/dist/cli/loop/session.d.ts +4 -0
  19. package/dist/cli/loop/session.js +49 -4
  20. package/dist/cli/utils/interactiveSetup.d.ts +4 -4
  21. package/dist/config/conversationMemory.d.ts +2 -0
  22. package/dist/config/conversationMemory.js +5 -5
  23. package/dist/constants/contextWindows.d.ts +46 -0
  24. package/dist/constants/contextWindows.js +156 -0
  25. package/dist/context/budgetChecker.d.ts +18 -0
  26. package/dist/context/budgetChecker.js +71 -0
  27. package/dist/context/contextCompactor.d.ts +22 -0
  28. package/dist/context/contextCompactor.js +106 -0
  29. package/dist/context/effectiveHistory.d.ts +52 -0
  30. package/dist/context/effectiveHistory.js +105 -0
  31. package/dist/context/errorDetection.d.ts +14 -0
  32. package/dist/context/errorDetection.js +124 -0
  33. package/dist/context/fileSummarizationService.d.ts +54 -0
  34. package/dist/context/fileSummarizationService.js +255 -0
  35. package/dist/context/fileSummarizer.d.ts +56 -0
  36. package/dist/context/fileSummarizer.js +145 -0
  37. package/dist/context/fileTokenBudget.d.ts +53 -0
  38. package/dist/context/fileTokenBudget.js +127 -0
  39. package/dist/context/prompts/summarizationPrompt.d.ts +17 -0
  40. package/dist/context/prompts/summarizationPrompt.js +110 -0
  41. package/dist/context/stages/fileReadDeduplicator.d.ts +10 -0
  42. package/dist/context/stages/fileReadDeduplicator.js +66 -0
  43. package/dist/context/stages/slidingWindowTruncator.d.ts +11 -0
  44. package/dist/context/stages/slidingWindowTruncator.js +42 -0
  45. package/dist/context/stages/structuredSummarizer.d.ts +10 -0
  46. package/dist/context/stages/structuredSummarizer.js +49 -0
  47. package/dist/context/stages/toolOutputPruner.d.ts +10 -0
  48. package/dist/context/stages/toolOutputPruner.js +52 -0
  49. package/dist/context/summarizationEngine.d.ts +45 -0
  50. package/dist/context/summarizationEngine.js +110 -0
  51. package/dist/context/toolOutputLimits.d.ts +17 -0
  52. package/dist/context/toolOutputLimits.js +84 -0
  53. package/dist/context/toolPairRepair.d.ts +16 -0
  54. package/dist/context/toolPairRepair.js +66 -0
  55. package/dist/core/conversationMemoryManager.d.ts +5 -15
  56. package/dist/core/conversationMemoryManager.js +15 -75
  57. package/dist/core/modules/MessageBuilder.d.ts +1 -1
  58. package/dist/core/modules/MessageBuilder.js +2 -0
  59. package/dist/core/modules/TelemetryHandler.d.ts +2 -3
  60. package/dist/core/modules/TelemetryHandler.js +3 -3
  61. package/dist/core/modules/ToolsManager.d.ts +2 -2
  62. package/dist/core/redisConversationMemoryManager.d.ts +8 -14
  63. package/dist/core/redisConversationMemoryManager.js +69 -78
  64. package/dist/factories/providerFactory.d.ts +2 -2
  65. package/dist/files/fileReferenceRegistry.d.ts +276 -0
  66. package/dist/files/fileReferenceRegistry.js +1543 -0
  67. package/dist/files/fileTools.d.ts +423 -0
  68. package/dist/files/fileTools.js +449 -0
  69. package/dist/files/index.d.ts +14 -0
  70. package/dist/files/index.js +13 -0
  71. package/dist/files/streamingReader.d.ts +93 -0
  72. package/dist/files/streamingReader.js +321 -0
  73. package/dist/files/types.d.ts +23 -0
  74. package/dist/files/types.js +23 -0
  75. package/dist/image-gen/imageGenTools.d.ts +2 -2
  76. package/dist/image-gen/types.d.ts +12 -12
  77. package/dist/lib/agent/directTools.d.ts +7 -7
  78. package/dist/lib/config/conversationMemory.d.ts +2 -0
  79. package/dist/lib/config/conversationMemory.js +5 -5
  80. package/dist/lib/constants/contextWindows.d.ts +46 -0
  81. package/dist/lib/constants/contextWindows.js +157 -0
  82. package/dist/lib/context/budgetChecker.d.ts +18 -0
  83. package/dist/lib/context/budgetChecker.js +72 -0
  84. package/dist/lib/context/contextCompactor.d.ts +22 -0
  85. package/dist/lib/context/contextCompactor.js +107 -0
  86. package/dist/lib/context/effectiveHistory.d.ts +52 -0
  87. package/dist/lib/context/effectiveHistory.js +106 -0
  88. package/dist/lib/context/errorDetection.d.ts +14 -0
  89. package/dist/lib/context/errorDetection.js +125 -0
  90. package/dist/lib/context/fileSummarizationService.d.ts +54 -0
  91. package/dist/lib/context/fileSummarizationService.js +256 -0
  92. package/dist/lib/context/fileSummarizer.d.ts +56 -0
  93. package/dist/lib/context/fileSummarizer.js +146 -0
  94. package/dist/lib/context/fileTokenBudget.d.ts +53 -0
  95. package/dist/lib/context/fileTokenBudget.js +128 -0
  96. package/dist/lib/context/prompts/summarizationPrompt.d.ts +17 -0
  97. package/dist/lib/context/prompts/summarizationPrompt.js +111 -0
  98. package/dist/lib/context/stages/fileReadDeduplicator.d.ts +10 -0
  99. package/dist/lib/context/stages/fileReadDeduplicator.js +67 -0
  100. package/dist/lib/context/stages/slidingWindowTruncator.d.ts +11 -0
  101. package/dist/lib/context/stages/slidingWindowTruncator.js +43 -0
  102. package/dist/lib/context/stages/structuredSummarizer.d.ts +10 -0
  103. package/dist/lib/context/stages/structuredSummarizer.js +50 -0
  104. package/dist/lib/context/stages/toolOutputPruner.d.ts +10 -0
  105. package/dist/lib/context/stages/toolOutputPruner.js +53 -0
  106. package/dist/lib/context/summarizationEngine.d.ts +45 -0
  107. package/dist/lib/context/summarizationEngine.js +111 -0
  108. package/dist/lib/context/toolOutputLimits.d.ts +17 -0
  109. package/dist/lib/context/toolOutputLimits.js +85 -0
  110. package/dist/lib/context/toolPairRepair.d.ts +16 -0
  111. package/dist/lib/context/toolPairRepair.js +67 -0
  112. package/dist/lib/core/conversationMemoryManager.d.ts +5 -15
  113. package/dist/lib/core/conversationMemoryManager.js +15 -75
  114. package/dist/lib/core/modules/MessageBuilder.d.ts +1 -1
  115. package/dist/lib/core/modules/MessageBuilder.js +2 -0
  116. package/dist/lib/core/modules/TelemetryHandler.d.ts +2 -3
  117. package/dist/lib/core/modules/TelemetryHandler.js +3 -3
  118. package/dist/lib/core/modules/ToolsManager.d.ts +2 -2
  119. package/dist/lib/core/redisConversationMemoryManager.d.ts +8 -14
  120. package/dist/lib/core/redisConversationMemoryManager.js +69 -78
  121. package/dist/lib/factories/providerFactory.d.ts +2 -2
  122. package/dist/lib/files/fileReferenceRegistry.d.ts +276 -0
  123. package/dist/lib/files/fileReferenceRegistry.js +1544 -0
  124. package/dist/lib/files/fileTools.d.ts +423 -0
  125. package/dist/lib/files/fileTools.js +450 -0
  126. package/dist/lib/files/index.d.ts +14 -0
  127. package/dist/lib/files/index.js +14 -0
  128. package/dist/lib/files/streamingReader.d.ts +93 -0
  129. package/dist/lib/files/streamingReader.js +322 -0
  130. package/dist/lib/files/types.d.ts +23 -0
  131. package/dist/lib/files/types.js +24 -0
  132. package/dist/lib/image-gen/imageGenTools.d.ts +2 -2
  133. package/dist/lib/image-gen/types.d.ts +12 -12
  134. package/dist/lib/memory/mem0Initializer.d.ts +2 -2
  135. package/dist/lib/neurolink.d.ts +61 -2
  136. package/dist/lib/neurolink.js +619 -307
  137. package/dist/lib/processors/archive/ArchiveProcessor.d.ts +327 -0
  138. package/dist/lib/processors/archive/ArchiveProcessor.js +1309 -0
  139. package/dist/lib/processors/archive/index.d.ts +33 -0
  140. package/dist/lib/processors/archive/index.js +43 -0
  141. package/dist/lib/processors/base/types.d.ts +70 -64
  142. package/dist/lib/processors/base/types.js +6 -0
  143. package/dist/lib/processors/cli/fileProcessorCli.d.ts +8 -8
  144. package/dist/lib/processors/cli/fileProcessorCli.js +5 -5
  145. package/dist/lib/processors/config/mimeTypes.js +25 -0
  146. package/dist/lib/processors/config/sizeLimits.d.ts +52 -40
  147. package/dist/lib/processors/config/sizeLimits.js +56 -44
  148. package/dist/lib/processors/document/ExcelProcessor.d.ts +14 -0
  149. package/dist/lib/processors/document/ExcelProcessor.js +72 -1
  150. package/dist/lib/processors/document/PptxProcessor.d.ts +63 -0
  151. package/dist/lib/processors/document/PptxProcessor.js +158 -0
  152. package/dist/lib/processors/document/index.d.ts +1 -0
  153. package/dist/lib/processors/document/index.js +6 -0
  154. package/dist/lib/processors/errors/FileErrorCode.d.ts +2 -2
  155. package/dist/lib/processors/errors/errorHelpers.d.ts +2 -2
  156. package/dist/lib/processors/errors/errorSerializer.d.ts +4 -4
  157. package/dist/lib/processors/index.d.ts +8 -2
  158. package/dist/lib/processors/index.js +5 -2
  159. package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +8 -8
  160. package/dist/lib/processors/integration/FileProcessorIntegration.js +7 -7
  161. package/dist/lib/processors/media/AudioProcessor.d.ts +328 -0
  162. package/dist/lib/processors/media/AudioProcessor.js +708 -0
  163. package/dist/lib/processors/media/VideoProcessor.d.ts +350 -0
  164. package/dist/lib/processors/media/VideoProcessor.js +992 -0
  165. package/dist/lib/processors/media/index.d.ts +27 -0
  166. package/dist/lib/processors/media/index.js +37 -0
  167. package/dist/lib/processors/registry/ProcessorRegistry.d.ts +19 -5
  168. package/dist/lib/processors/registry/ProcessorRegistry.js +103 -8
  169. package/dist/lib/processors/registry/index.d.ts +1 -1
  170. package/dist/lib/processors/registry/index.js +1 -1
  171. package/dist/lib/processors/registry/types.d.ts +2 -2
  172. package/dist/lib/providers/googleAiStudio.d.ts +34 -0
  173. package/dist/lib/providers/googleAiStudio.js +267 -397
  174. package/dist/lib/providers/googleVertex.d.ts +55 -1
  175. package/dist/lib/providers/googleVertex.js +452 -719
  176. package/dist/lib/providers/sagemaker/detection.d.ts +6 -6
  177. package/dist/lib/providers/sagemaker/diagnostics.d.ts +4 -4
  178. package/dist/lib/providers/sagemaker/parsers.d.ts +4 -4
  179. package/dist/lib/rag/chunkers/RecursiveChunker.js +2 -2
  180. package/dist/lib/rag/document/loaders.d.ts +6 -71
  181. package/dist/lib/rag/document/loaders.js +5 -5
  182. package/dist/lib/rag/graphRag/graphRAG.js +26 -9
  183. package/dist/lib/rag/metadata/MetadataExtractorFactory.d.ts +5 -55
  184. package/dist/lib/rag/metadata/metadataExtractor.js +6 -3
  185. package/dist/lib/rag/pipeline/RAGPipeline.d.ts +8 -126
  186. package/dist/lib/rag/pipeline/RAGPipeline.js +11 -11
  187. package/dist/lib/rag/pipeline/contextAssembly.d.ts +3 -42
  188. package/dist/lib/rag/pipeline/contextAssembly.js +6 -3
  189. package/dist/lib/rag/reranker/RerankerFactory.d.ts +5 -60
  190. package/dist/lib/rag/resilience/CircuitBreaker.d.ts +3 -33
  191. package/dist/lib/rag/resilience/RetryHandler.d.ts +2 -21
  192. package/dist/lib/rag/retrieval/hybridSearch.d.ts +3 -41
  193. package/dist/lib/rag/retrieval/vectorQueryTool.d.ts +2 -13
  194. package/dist/lib/rag/retrieval/vectorQueryTool.js +4 -3
  195. package/dist/lib/rag/types.d.ts +3 -3
  196. package/dist/lib/sdk/toolRegistration.d.ts +2 -2
  197. package/dist/lib/server/middleware/cache.d.ts +2 -2
  198. package/dist/lib/server/middleware/rateLimit.d.ts +2 -2
  199. package/dist/lib/server/routes/mcpRoutes.js +277 -249
  200. package/dist/lib/server/routes/memoryRoutes.js +287 -281
  201. package/dist/lib/server/utils/validation.d.ts +10 -10
  202. package/dist/lib/session/globalSessionState.d.ts +2 -2
  203. package/dist/lib/telemetry/telemetryService.d.ts +2 -2
  204. package/dist/lib/types/common.d.ts +39 -0
  205. package/dist/lib/types/contextTypes.d.ts +255 -0
  206. package/dist/lib/types/contextTypes.js +0 -2
  207. package/dist/lib/types/conversation.d.ts +62 -0
  208. package/dist/lib/types/conversationMemoryInterface.d.ts +27 -0
  209. package/dist/lib/types/conversationMemoryInterface.js +7 -0
  210. package/dist/lib/types/fileReferenceTypes.d.ts +222 -0
  211. package/dist/lib/types/fileReferenceTypes.js +9 -0
  212. package/dist/lib/types/fileTypes.d.ts +26 -3
  213. package/dist/lib/types/generateTypes.d.ts +22 -1
  214. package/dist/lib/types/index.d.ts +4 -5
  215. package/dist/lib/types/index.js +8 -10
  216. package/dist/lib/types/modelTypes.d.ts +2 -2
  217. package/dist/lib/types/processorTypes.d.ts +597 -0
  218. package/dist/lib/types/processorTypes.js +91 -0
  219. package/dist/lib/types/ragTypes.d.ts +481 -0
  220. package/dist/lib/types/ragTypes.js +8 -0
  221. package/dist/lib/types/sdkTypes.d.ts +17 -18
  222. package/dist/lib/types/streamTypes.d.ts +11 -1
  223. package/dist/lib/utils/async/retry.d.ts +2 -2
  224. package/dist/lib/utils/async/withTimeout.js +3 -1
  225. package/dist/lib/utils/conversationMemory.d.ts +12 -6
  226. package/dist/lib/utils/conversationMemory.js +76 -36
  227. package/dist/lib/utils/fileDetector.d.ts +62 -0
  228. package/dist/lib/utils/fileDetector.js +1014 -14
  229. package/dist/lib/utils/json/safeParse.d.ts +2 -2
  230. package/dist/lib/utils/messageBuilder.js +806 -153
  231. package/dist/lib/utils/modelChoices.d.ts +2 -2
  232. package/dist/lib/utils/multimodalOptionsBuilder.d.ts +2 -1
  233. package/dist/lib/utils/multimodalOptionsBuilder.js +1 -0
  234. package/dist/lib/utils/rateLimiter.d.ts +2 -2
  235. package/dist/lib/utils/sanitizers/filename.d.ts +4 -4
  236. package/dist/lib/utils/sanitizers/svg.d.ts +2 -2
  237. package/dist/lib/utils/thinkingConfig.d.ts +6 -6
  238. package/dist/lib/utils/tokenEstimation.d.ts +68 -0
  239. package/dist/lib/utils/tokenEstimation.js +113 -0
  240. package/dist/lib/utils/tokenUtils.d.ts +4 -4
  241. package/dist/lib/utils/ttsProcessor.d.ts +2 -2
  242. package/dist/lib/workflow/config.d.ts +150 -150
  243. package/dist/memory/mem0Initializer.d.ts +2 -2
  244. package/dist/neurolink.d.ts +61 -2
  245. package/dist/neurolink.js +619 -307
  246. package/dist/processors/archive/ArchiveProcessor.d.ts +327 -0
  247. package/dist/processors/archive/ArchiveProcessor.js +1308 -0
  248. package/dist/processors/archive/index.d.ts +33 -0
  249. package/dist/processors/archive/index.js +42 -0
  250. package/dist/processors/base/types.d.ts +70 -64
  251. package/dist/processors/base/types.js +6 -0
  252. package/dist/processors/cli/fileProcessorCli.d.ts +8 -8
  253. package/dist/processors/cli/fileProcessorCli.js +5 -5
  254. package/dist/processors/config/mimeTypes.js +25 -0
  255. package/dist/processors/config/sizeLimits.d.ts +52 -40
  256. package/dist/processors/config/sizeLimits.js +56 -44
  257. package/dist/processors/document/ExcelProcessor.d.ts +14 -0
  258. package/dist/processors/document/ExcelProcessor.js +72 -1
  259. package/dist/processors/document/PptxProcessor.d.ts +63 -0
  260. package/dist/processors/document/PptxProcessor.js +157 -0
  261. package/dist/processors/document/index.d.ts +1 -0
  262. package/dist/processors/document/index.js +6 -0
  263. package/dist/processors/errors/FileErrorCode.d.ts +2 -2
  264. package/dist/processors/errors/errorHelpers.d.ts +2 -2
  265. package/dist/processors/errors/errorSerializer.d.ts +4 -4
  266. package/dist/processors/index.d.ts +8 -2
  267. package/dist/processors/index.js +5 -2
  268. package/dist/processors/integration/FileProcessorIntegration.d.ts +8 -8
  269. package/dist/processors/integration/FileProcessorIntegration.js +7 -7
  270. package/dist/processors/media/AudioProcessor.d.ts +328 -0
  271. package/dist/processors/media/AudioProcessor.js +707 -0
  272. package/dist/processors/media/VideoProcessor.d.ts +350 -0
  273. package/dist/processors/media/VideoProcessor.js +991 -0
  274. package/dist/processors/media/ffprobe-static.d.ts +4 -0
  275. package/dist/processors/media/index.d.ts +27 -0
  276. package/dist/processors/media/index.js +36 -0
  277. package/dist/processors/registry/ProcessorRegistry.d.ts +19 -5
  278. package/dist/processors/registry/ProcessorRegistry.js +103 -8
  279. package/dist/processors/registry/index.d.ts +1 -1
  280. package/dist/processors/registry/index.js +1 -1
  281. package/dist/processors/registry/types.d.ts +2 -2
  282. package/dist/providers/googleAiStudio.d.ts +34 -0
  283. package/dist/providers/googleAiStudio.js +267 -397
  284. package/dist/providers/googleVertex.d.ts +55 -1
  285. package/dist/providers/googleVertex.js +452 -719
  286. package/dist/providers/sagemaker/detection.d.ts +6 -6
  287. package/dist/providers/sagemaker/diagnostics.d.ts +4 -4
  288. package/dist/providers/sagemaker/parsers.d.ts +4 -4
  289. package/dist/rag/chunkers/RecursiveChunker.js +2 -2
  290. package/dist/rag/document/loaders.d.ts +6 -71
  291. package/dist/rag/document/loaders.js +5 -5
  292. package/dist/rag/graphRag/graphRAG.js +26 -9
  293. package/dist/rag/metadata/MetadataExtractorFactory.d.ts +5 -55
  294. package/dist/rag/metadata/metadataExtractor.js +6 -3
  295. package/dist/rag/pipeline/RAGPipeline.d.ts +8 -126
  296. package/dist/rag/pipeline/RAGPipeline.js +11 -11
  297. package/dist/rag/pipeline/contextAssembly.d.ts +3 -42
  298. package/dist/rag/pipeline/contextAssembly.js +6 -3
  299. package/dist/rag/reranker/RerankerFactory.d.ts +5 -60
  300. package/dist/rag/resilience/CircuitBreaker.d.ts +3 -33
  301. package/dist/rag/resilience/RetryHandler.d.ts +2 -21
  302. package/dist/rag/retrieval/hybridSearch.d.ts +3 -41
  303. package/dist/rag/retrieval/vectorQueryTool.d.ts +2 -13
  304. package/dist/rag/retrieval/vectorQueryTool.js +4 -3
  305. package/dist/rag/types.d.ts +3 -3
  306. package/dist/sdk/toolRegistration.d.ts +2 -2
  307. package/dist/server/middleware/cache.d.ts +2 -2
  308. package/dist/server/middleware/rateLimit.d.ts +2 -2
  309. package/dist/server/routes/mcpRoutes.js +277 -249
  310. package/dist/server/routes/memoryRoutes.js +287 -281
  311. package/dist/server/utils/validation.d.ts +4 -4
  312. package/dist/session/globalSessionState.d.ts +2 -2
  313. package/dist/telemetry/telemetryService.d.ts +2 -2
  314. package/dist/types/common.d.ts +39 -0
  315. package/dist/types/contextTypes.d.ts +255 -0
  316. package/dist/types/contextTypes.js +0 -2
  317. package/dist/types/conversation.d.ts +62 -0
  318. package/dist/types/conversationMemoryInterface.d.ts +27 -0
  319. package/dist/types/conversationMemoryInterface.js +6 -0
  320. package/dist/types/fileReferenceTypes.d.ts +222 -0
  321. package/dist/types/fileReferenceTypes.js +8 -0
  322. package/dist/types/fileTypes.d.ts +26 -3
  323. package/dist/types/generateTypes.d.ts +22 -1
  324. package/dist/types/index.d.ts +4 -5
  325. package/dist/types/index.js +8 -10
  326. package/dist/types/processorTypes.d.ts +597 -0
  327. package/dist/types/processorTypes.js +90 -0
  328. package/dist/types/ragTypes.d.ts +481 -0
  329. package/dist/types/ragTypes.js +7 -0
  330. package/dist/types/sdkTypes.d.ts +17 -18
  331. package/dist/types/streamTypes.d.ts +11 -1
  332. package/dist/utils/async/retry.d.ts +2 -2
  333. package/dist/utils/async/withTimeout.js +3 -1
  334. package/dist/utils/conversationMemory.d.ts +12 -6
  335. package/dist/utils/conversationMemory.js +76 -36
  336. package/dist/utils/fileDetector.d.ts +62 -0
  337. package/dist/utils/fileDetector.js +1014 -14
  338. package/dist/utils/json/safeParse.d.ts +2 -2
  339. package/dist/utils/messageBuilder.js +806 -153
  340. package/dist/utils/modelChoices.d.ts +2 -2
  341. package/dist/utils/multimodalOptionsBuilder.d.ts +2 -1
  342. package/dist/utils/multimodalOptionsBuilder.js +1 -0
  343. package/dist/utils/rateLimiter.d.ts +2 -2
  344. package/dist/utils/sanitizers/filename.d.ts +4 -4
  345. package/dist/utils/sanitizers/svg.d.ts +2 -2
  346. package/dist/utils/thinkingConfig.d.ts +6 -6
  347. package/dist/utils/tokenEstimation.d.ts +68 -0
  348. package/dist/utils/tokenEstimation.js +112 -0
  349. package/dist/utils/tokenUtils.d.ts +4 -4
  350. package/dist/utils/ttsProcessor.d.ts +2 -2
  351. package/dist/workflow/config.d.ts +104 -104
  352. package/package.json +18 -6
  353. package/dist/lib/utils/conversationMemoryUtils.d.ts +0 -25
  354. package/dist/lib/utils/conversationMemoryUtils.js +0 -138
  355. package/dist/utils/conversationMemoryUtils.d.ts +0 -25
  356. package/dist/utils/conversationMemoryUtils.js +0 -137
@@ -0,0 +1,597 @@
1
+ /**
2
+ * File Processor Types
3
+ *
4
+ * Centralized type definitions for the file processing system.
5
+ * These types are re-exported from the main types barrel for SDK consumers.
6
+ *
7
+ * @module types/processorTypes
8
+ */
9
+ /**
10
+ * Generic file information - provider agnostic.
11
+ * Replaces Slack-specific SlackFileInfo with a universal interface.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // From a URL source
16
+ * const fileInfo: FileInfo = {
17
+ * id: 'doc-123',
18
+ * name: 'report.pdf',
19
+ * mimetype: 'application/pdf',
20
+ * size: 1024000,
21
+ * url: 'https://example.com/files/report.pdf',
22
+ * };
23
+ *
24
+ * // From a buffer source
25
+ * const fileInfo: FileInfo = {
26
+ * id: 'img-456',
27
+ * name: 'photo.jpg',
28
+ * mimetype: 'image/jpeg',
29
+ * size: 512000,
30
+ * buffer: imageBuffer,
31
+ * };
32
+ * ```
33
+ */
34
+ export type ProcessorFileInfo = {
35
+ /** Unique identifier for the file */
36
+ id: string;
37
+ /** Original filename */
38
+ name: string;
39
+ /** MIME type of the file */
40
+ mimetype: string;
41
+ /** File size in bytes */
42
+ size: number;
43
+ /** Download URL (optional - use when file needs to be fetched) */
44
+ url?: string;
45
+ /** Direct file content (optional - use when file is already in memory) */
46
+ buffer?: Buffer;
47
+ /** Extensibility - additional provider-specific metadata */
48
+ metadata?: Record<string, unknown>;
49
+ };
50
+ /**
51
+ * Configuration for file processors.
52
+ * Defines constraints and defaults for a specific file type processor.
53
+ */
54
+ export type FileProcessorConfig = {
55
+ /** Maximum file size in megabytes */
56
+ maxSizeMB: number;
57
+ /** Download/processing timeout in milliseconds */
58
+ timeoutMs: number;
59
+ /** List of supported MIME types */
60
+ supportedMimeTypes: string[];
61
+ /** List of supported file extensions (with leading dot) */
62
+ supportedExtensions: string[];
63
+ /** Human-readable name for this file type (e.g., 'image', 'PDF') */
64
+ fileTypeName: string;
65
+ /** Default filename when original name is not available */
66
+ defaultFilename: string;
67
+ };
68
+ /**
69
+ * Base interface for processed file data.
70
+ * All specific processed types should extend this interface.
71
+ */
72
+ export type ProcessedFileBase = {
73
+ /** File content as a Buffer */
74
+ buffer: Buffer;
75
+ /** MIME type of the processed content */
76
+ mimetype: string;
77
+ /** Size of the processed content in bytes */
78
+ size: number;
79
+ /** Filename (may be normalized or sanitized) */
80
+ filename: string;
81
+ };
82
+ /**
83
+ * Structured error information for file processing failures.
84
+ * Provides both technical details and user-friendly messaging.
85
+ */
86
+ export type ProcessorFileError = {
87
+ /** Error code for programmatic handling (typed enum or string for extensibility) */
88
+ code: FileProcessorErrorCode | string;
89
+ /** Technical error message */
90
+ message: string;
91
+ /** User-friendly error message */
92
+ userMessage: string;
93
+ /** Additional context/details about the error */
94
+ details?: Record<string, unknown>;
95
+ };
96
+ /**
97
+ * Generic result type for internal operations.
98
+ * Uses discriminated union pattern for type-safe success/failure handling.
99
+ * Used for validation and download operations that don't return ProcessedFileBase.
100
+ */
101
+ export type ProcessorOperationResult<T = void> = {
102
+ success: true;
103
+ data: T;
104
+ } | {
105
+ success: false;
106
+ error: ProcessorFileError;
107
+ };
108
+ /**
109
+ * Result of a file processing operation.
110
+ * Uses discriminated union pattern for type-safe error handling.
111
+ */
112
+ export type ProcessorFileResult<T extends ProcessedFileBase = ProcessedFileBase> = {
113
+ success: true;
114
+ data: T;
115
+ } | {
116
+ success: false;
117
+ error: ProcessorFileError;
118
+ };
119
+ /**
120
+ * Configuration for retry behavior on transient failures.
121
+ * Implements exponential backoff with optional custom retry predicate.
122
+ */
123
+ export type ProcessorRetryConfig = {
124
+ /** Maximum number of retry attempts */
125
+ maxRetries: number;
126
+ /** Base delay between retries in milliseconds */
127
+ baseDelayMs: number;
128
+ /** Maximum delay between retries in milliseconds */
129
+ maxDelayMs: number;
130
+ /** Optional custom function to determine if an error is retryable */
131
+ retryOn?: (error: Error) => boolean;
132
+ };
133
+ /**
134
+ * Options for file processing operations.
135
+ * Allows customization of download behavior and retry logic.
136
+ */
137
+ export type ProcessorProcessOptions = {
138
+ /** Authentication headers for download requests */
139
+ authHeaders?: Record<string, string>;
140
+ /** Override default timeout (in milliseconds) */
141
+ timeout?: number;
142
+ /** Retry configuration for transient failures */
143
+ retryConfig?: ProcessorRetryConfig;
144
+ };
145
+ /**
146
+ * Information about a successfully processed file.
147
+ */
148
+ export type ProcessorProcessedFileInfo = {
149
+ /** File identifier */
150
+ fileId: string;
151
+ /** Filename */
152
+ filename: string;
153
+ /** MIME type */
154
+ mimetype: string;
155
+ /** Size in bytes */
156
+ size: number;
157
+ /** Type of processor used */
158
+ processorType: string;
159
+ };
160
+ /**
161
+ * Information about a file that failed to process.
162
+ */
163
+ export type ProcessorFailedFileInfo = {
164
+ /** File identifier */
165
+ fileId: string;
166
+ /** Filename */
167
+ filename: string;
168
+ /** MIME type */
169
+ mimetype: string;
170
+ /** Size in bytes */
171
+ size: number;
172
+ /** Error that caused the failure */
173
+ error: ProcessorFileError;
174
+ };
175
+ /**
176
+ * Information about a file that was skipped.
177
+ */
178
+ export type ProcessorSkippedFileInfo = {
179
+ /** File identifier */
180
+ fileId: string;
181
+ /** Filename */
182
+ filename: string;
183
+ /** MIME type */
184
+ mimetype: string;
185
+ /** Size in bytes */
186
+ size: number;
187
+ /** Reason for skipping */
188
+ reason: string;
189
+ /** Suggested alternative action */
190
+ suggestedAlternative?: string;
191
+ };
192
+ /**
193
+ * Warning about a file (non-fatal issue).
194
+ */
195
+ export type ProcessorFileWarning = {
196
+ /** File identifier */
197
+ fileId: string;
198
+ /** Filename */
199
+ filename: string;
200
+ /** Warning message */
201
+ message: string;
202
+ };
203
+ /**
204
+ * Summary of batch file processing operations.
205
+ */
206
+ export type ProcessorBatchSummary<T extends ProcessedFileBase = ProcessedFileBase> = {
207
+ /** Total number of files attempted */
208
+ totalFiles: number;
209
+ /** Successfully processed files */
210
+ processedFiles: ProcessorProcessedFileInfo[];
211
+ /** Files that failed to process */
212
+ failedFiles: ProcessorFailedFileInfo[];
213
+ /** Files that were skipped (e.g., unsupported format) */
214
+ skippedFiles: ProcessorSkippedFileInfo[];
215
+ /** Non-fatal warnings */
216
+ warnings: ProcessorFileWarning[];
217
+ /** Processed results (parallel array with processedFiles) */
218
+ results: T[];
219
+ };
220
+ /**
221
+ * Result of finding a matching processor for a file.
222
+ * Includes both the processor and metadata about the match quality.
223
+ */
224
+ export type ProcessorMatch<_T extends ProcessedFileBase = ProcessedFileBase> = {
225
+ /** Name of the matched processor */
226
+ name: string;
227
+ /** The processor instance (generic to avoid circular dependency) */
228
+ processor: unknown;
229
+ /** Priority level of this processor */
230
+ priority: number;
231
+ /**
232
+ * Confidence score for the match (0-100).
233
+ * Higher values indicate better match quality:
234
+ * - 100: Exact MIME type match
235
+ * - 80: MIME type prefix match (e.g., "image/*")
236
+ * - 60: File extension match
237
+ * - 40: Generic/fallback match
238
+ */
239
+ confidence: number;
240
+ };
241
+ /**
242
+ * Options for registry operations.
243
+ * Controls behavior when registering processors.
244
+ */
245
+ export type ProcessorRegistryOptions = {
246
+ /**
247
+ * Allow registering processors with duplicate names.
248
+ * If false (default), an error is thrown on duplicate names.
249
+ */
250
+ allowDuplicates?: boolean;
251
+ /**
252
+ * Overwrite existing processor with the same name.
253
+ * Takes precedence over allowDuplicates.
254
+ */
255
+ overwriteExisting?: boolean;
256
+ };
257
+ /**
258
+ * Detailed error information for unsupported file types.
259
+ * Provides helpful suggestions for the user.
260
+ */
261
+ export type ProcessorUnsupportedFileError = {
262
+ /** Error code for programmatic handling */
263
+ code: "NO_PROCESSOR_FOUND" | "PROCESSING_FAILED";
264
+ /** Human-readable error message */
265
+ message: string;
266
+ /** Original filename */
267
+ filename: string;
268
+ /** MIME type of the file */
269
+ mimetype: string;
270
+ /** Helpful suggestion for the user */
271
+ suggestion: string;
272
+ /** List of supported file types */
273
+ supportedTypes: string[];
274
+ };
275
+ /**
276
+ * Result of processing a file through the registry.
277
+ * Includes type information for tracking which processor was used.
278
+ */
279
+ export type ProcessorRegistryResult<T = unknown> = {
280
+ /** Type/name of the processor that handled the file */
281
+ type: string;
282
+ /** Processed data (null if processing failed) */
283
+ data: T | null;
284
+ /** Error information if processing failed */
285
+ error?: ProcessorUnsupportedFileError;
286
+ };
287
+ /**
288
+ * Enumeration of all file processing error codes.
289
+ * Each code represents a specific failure scenario with associated messaging.
290
+ */
291
+ export declare enum FileProcessorErrorCode {
292
+ DOWNLOAD_FAILED = "DOWNLOAD_FAILED",
293
+ DOWNLOAD_TIMEOUT = "DOWNLOAD_TIMEOUT",
294
+ DOWNLOAD_AUTH_FAILED = "DOWNLOAD_AUTH_FAILED",
295
+ NETWORK_ERROR = "NETWORK_ERROR",
296
+ FILE_NOT_FOUND = "FILE_NOT_FOUND",
297
+ RATE_LIMITED = "RATE_LIMITED",
298
+ FILE_TOO_LARGE = "FILE_TOO_LARGE",
299
+ UNSUPPORTED_TYPE = "UNSUPPORTED_TYPE",
300
+ INVALID_FORMAT = "INVALID_FORMAT",
301
+ INVALID_MIME_TYPE = "INVALID_MIME_TYPE",
302
+ INVALID_MAGIC_BYTES = "INVALID_MAGIC_BYTES",
303
+ CORRUPTED_FILE = "CORRUPTED_FILE",
304
+ INVALID_STRUCTURE = "INVALID_STRUCTURE",
305
+ PROCESSING_FAILED = "PROCESSING_FAILED",
306
+ PARSING_FAILED = "PARSING_FAILED",
307
+ ENCODING_ERROR = "ENCODING_ERROR",
308
+ EXTRACTION_FAILED = "EXTRACTION_FAILED",
309
+ DECOMPRESSION_FAILED = "DECOMPRESSION_FAILED",
310
+ SECURITY_VALIDATION_FAILED = "SECURITY_VALIDATION_FAILED",
311
+ XXE_DETECTED = "XXE_DETECTED",
312
+ XSS_DETECTED = "XSS_DETECTED",
313
+ CODE_EXECUTION_DETECTED = "CODE_EXECUTION_DETECTED",
314
+ ZIP_BOMB_DETECTED = "ZIP_BOMB_DETECTED",
315
+ UNKNOWN_ERROR = "UNKNOWN_ERROR"
316
+ }
317
+ /**
318
+ * Error message template with user-friendly messaging and retry information.
319
+ */
320
+ export type ProcessorErrorMessageTemplate = {
321
+ /** Technical error message */
322
+ message: string;
323
+ /** User-friendly error message */
324
+ userMessage: string;
325
+ /** Suggested action to resolve the error */
326
+ suggestedAction: string;
327
+ /** Whether this error is potentially retryable */
328
+ retryable: boolean;
329
+ };
330
+ /**
331
+ * Information about a registered processor.
332
+ * Used for discovery and documentation.
333
+ */
334
+ export type ProcessorInfo = {
335
+ /** Unique name for the processor */
336
+ name: string;
337
+ /** Human-readable description */
338
+ description: string;
339
+ /** List of supported MIME types */
340
+ supportedMimeTypes: string[];
341
+ /** List of supported file extensions */
342
+ supportedExtensions: string[];
343
+ /** Priority level (lower = higher priority) */
344
+ priority?: number;
345
+ };
346
+ /**
347
+ * Priority levels for file processors.
348
+ * Lower number = higher priority = matched first.
349
+ */
350
+ export declare const PROCESSOR_PRIORITIES: {
351
+ /** SVG files - processed as text before image processing */
352
+ readonly SVG: 5;
353
+ /** Image files - AI vision processing */
354
+ readonly IMAGE: 10;
355
+ /** PDF documents */
356
+ readonly PDF: 20;
357
+ /** CSV/tabular data */
358
+ readonly CSV: 30;
359
+ /** Markdown files - structured text */
360
+ readonly MARKDOWN: 40;
361
+ /** JSON data files */
362
+ readonly JSON: 50;
363
+ /** YAML configuration/data files */
364
+ readonly YAML: 60;
365
+ /** XML data files */
366
+ readonly XML: 70;
367
+ /** HTML web content */
368
+ readonly HTML: 80;
369
+ /** Excel spreadsheets */
370
+ readonly EXCEL: 90;
371
+ /** Legacy .doc files */
372
+ readonly DOC: 95;
373
+ /** Word documents (.docx) */
374
+ readonly WORD: 100;
375
+ /** Plain text files */
376
+ readonly TEXT: 110;
377
+ /** Source code files */
378
+ readonly SOURCE_CODE: 120;
379
+ /** Configuration files */
380
+ readonly CONFIG: 130;
381
+ /** RTF documents */
382
+ readonly RTF: 140;
383
+ /** OpenDocument format files */
384
+ readonly OPENDOCUMENT: 150;
385
+ };
386
+ /**
387
+ * Type for processor priority keys
388
+ */
389
+ export type ProcessorPriorityKey = keyof typeof PROCESSOR_PRIORITIES;
390
+ /**
391
+ * Type for processor priority values
392
+ */
393
+ export type ProcessorPriorityValue = (typeof PROCESSOR_PRIORITIES)[ProcessorPriorityKey];
394
+ /**
395
+ * Processed SVG result.
396
+ * Extends ProcessedFileBase with SVG-specific fields.
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * const result: ProcessedSvg = {
401
+ * textContent: '<svg><rect fill="red"/></svg>',
402
+ * rawContent: undefined, // Only present if sanitization modified content
403
+ * sanitized: false,
404
+ * securityWarnings: [],
405
+ * buffer: Buffer.from('...'),
406
+ * mimetype: 'image/svg+xml',
407
+ * size: 1234,
408
+ * filename: 'diagram.svg',
409
+ * };
410
+ * ```
411
+ */
412
+ export type ProcessedSvg = ProcessedFileBase & {
413
+ /** Sanitized SVG content as text for AI processing */
414
+ textContent: string;
415
+ /** Original raw content (only included if sanitization modified the content, for debugging) */
416
+ rawContent?: string;
417
+ /** Whether sanitization was applied to the content */
418
+ sanitized: boolean;
419
+ /** Security warnings found during processing */
420
+ securityWarnings: string[];
421
+ };
422
+ /**
423
+ * Processed XML file result.
424
+ * Extends base processed file with XML-specific fields.
425
+ */
426
+ export type ProcessedXml = ProcessedFileBase & {
427
+ /** Original XML content */
428
+ content: string;
429
+ /** Parsed XML content (as JavaScript object) */
430
+ parsed: unknown;
431
+ /** Whether the XML is syntactically valid */
432
+ valid: boolean;
433
+ /** Error message if XML is invalid */
434
+ errorMessage?: string;
435
+ /** Name of the root element */
436
+ rootElement?: string;
437
+ };
438
+ /**
439
+ * Processed Markdown result.
440
+ * Extends ProcessedFileBase with Markdown-specific fields.
441
+ *
442
+ * @example
443
+ * ```typescript
444
+ * const result: ProcessedMarkdown = {
445
+ * content: '# Hello\n\nWorld',
446
+ * lineCount: 3,
447
+ * hasCodeBlocks: false,
448
+ * hasTables: false,
449
+ * headings: ['Hello'],
450
+ * buffer: Buffer.from('...'),
451
+ * mimetype: 'text/markdown',
452
+ * size: 1234,
453
+ * filename: 'README.md',
454
+ * };
455
+ * ```
456
+ */
457
+ export type ProcessedMarkdown = ProcessedFileBase & {
458
+ /** Original Markdown content */
459
+ content: string;
460
+ /** Total number of lines in the document */
461
+ lineCount: number;
462
+ /** Whether the document contains fenced code blocks (```) */
463
+ hasCodeBlocks: boolean;
464
+ /** Whether the document contains Markdown tables */
465
+ hasTables: boolean;
466
+ /** List of headings extracted from the document (text only, no # prefix) */
467
+ headings: string[];
468
+ };
469
+ /**
470
+ * Processed source code result.
471
+ * Contains the code content with metadata for language detection and truncation status.
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * const processedCode: ProcessedSourceCode = {
476
+ * content: "const x = 1;",
477
+ * language: "TypeScript",
478
+ * lineCount: 100,
479
+ * truncated: false,
480
+ * encoding: "utf-8",
481
+ * buffer: codeBuffer,
482
+ * mimetype: "text/plain",
483
+ * size: 1024,
484
+ * filename: "app.ts",
485
+ * };
486
+ * ```
487
+ */
488
+ export type ProcessedSourceCode = ProcessedFileBase & {
489
+ /** The source code content (may be truncated) */
490
+ content: string;
491
+ /** Detected programming language (e.g., "TypeScript", "Python") */
492
+ language: string;
493
+ /** Number of lines in the content (after truncation if applicable) */
494
+ lineCount: number;
495
+ /** Whether the content was truncated due to line limit */
496
+ truncated: boolean;
497
+ /** Character encoding used to decode the file */
498
+ encoding: string;
499
+ };
500
+ /**
501
+ * Processed configuration file result.
502
+ * Contains the file content with security-redacted values and structured key-value pairs.
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const processedConfig: ProcessedConfig = {
507
+ * content: "API_URL=https://api.example.com\nAPI_KEY=[REDACTED]",
508
+ * format: "env",
509
+ * keyValues: { API_URL: "https://api.example.com", API_KEY: "[REDACTED]" },
510
+ * redactedKeys: ["API_KEY"],
511
+ * buffer: configBuffer,
512
+ * mimetype: "text/plain",
513
+ * size: 512,
514
+ * filename: ".env",
515
+ * };
516
+ * ```
517
+ */
518
+ export type ProcessedConfig = ProcessedFileBase & {
519
+ /** The configuration file content with redacted sensitive values */
520
+ content: string;
521
+ /** Detected configuration format */
522
+ format: "env" | "ini" | "toml" | "properties" | "unknown";
523
+ /** Extracted key-value pairs (with sensitive values redacted) */
524
+ keyValues: Record<string, string>;
525
+ /** List of keys that were redacted for security */
526
+ redactedKeys: string[];
527
+ };
528
+ /**
529
+ * Processed OpenDocument result
530
+ */
531
+ export type ProcessedOpenDocument = ProcessedFileBase & {
532
+ /** Extracted text content */
533
+ textContent: string;
534
+ /** Document format type */
535
+ format: "odt" | "ods" | "odp" | "unknown";
536
+ /** Number of paragraphs/text elements found */
537
+ paragraphCount: number;
538
+ /** Whether content was truncated */
539
+ truncated: boolean;
540
+ };
541
+ /**
542
+ * Processed JSON file result.
543
+ */
544
+ export type ProcessedJson = ProcessedFileBase & {
545
+ /** Pretty-printed JSON content (or original content if invalid) */
546
+ content: string;
547
+ /** Original raw content before pretty-printing */
548
+ rawContent: string;
549
+ /** Parsed JSON object/array/value */
550
+ parsed: unknown;
551
+ /** Whether the JSON is syntactically valid */
552
+ valid: boolean;
553
+ /** Error message if JSON is invalid */
554
+ errorMessage?: string;
555
+ /** Number of top-level keys (for objects) */
556
+ keyCount?: number;
557
+ /** Length of the array (for arrays) */
558
+ arrayLength?: number;
559
+ /** Whether content was truncated */
560
+ truncated: boolean;
561
+ };
562
+ /**
563
+ * Processed plain text file result.
564
+ */
565
+ export type ProcessedText = ProcessedFileBase & {
566
+ /** Text content (may be truncated if file is too large) */
567
+ content: string;
568
+ /** Total number of lines in the original file */
569
+ lineCount: number;
570
+ /** Total number of words in the original file */
571
+ wordCount: number;
572
+ /** Character encoding used to decode the file */
573
+ encoding: string;
574
+ /** Whether the content was truncated due to size limits */
575
+ truncated: boolean;
576
+ };
577
+ /**
578
+ * Processed HTML file result.
579
+ */
580
+ export type ProcessedHtml = ProcessedFileBase & {
581
+ /** Original HTML content */
582
+ content: string;
583
+ /** Text extracted from HTML (all tags stripped) */
584
+ textContent: string;
585
+ /** Whether the HTML contains script tags */
586
+ hasScripts: boolean;
587
+ /** Whether the HTML contains style tags */
588
+ hasStyles: boolean;
589
+ /** Page title extracted from title tag, if present */
590
+ title?: string;
591
+ /** Whether the HTML contains potentially dangerous content (XSS vectors) */
592
+ hasDangerousContent: boolean;
593
+ };
594
+ /**
595
+ * Type guard function signature for JSON parsing
596
+ */
597
+ export type JsonTypeGuard<T> = (parsed: unknown) => parsed is T;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * File Processor Types
3
+ *
4
+ * Centralized type definitions for the file processing system.
5
+ * These types are re-exported from the main types barrel for SDK consumers.
6
+ *
7
+ * @module types/processorTypes
8
+ */
9
+ // =============================================================================
10
+ // ERROR CODES
11
+ // =============================================================================
12
+ /**
13
+ * Enumeration of all file processing error codes.
14
+ * Each code represents a specific failure scenario with associated messaging.
15
+ */
16
+ export var FileProcessorErrorCode;
17
+ (function (FileProcessorErrorCode) {
18
+ // Download errors
19
+ FileProcessorErrorCode["DOWNLOAD_FAILED"] = "DOWNLOAD_FAILED";
20
+ FileProcessorErrorCode["DOWNLOAD_TIMEOUT"] = "DOWNLOAD_TIMEOUT";
21
+ FileProcessorErrorCode["DOWNLOAD_AUTH_FAILED"] = "DOWNLOAD_AUTH_FAILED";
22
+ FileProcessorErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
23
+ FileProcessorErrorCode["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
24
+ FileProcessorErrorCode["RATE_LIMITED"] = "RATE_LIMITED";
25
+ // Validation errors
26
+ FileProcessorErrorCode["FILE_TOO_LARGE"] = "FILE_TOO_LARGE";
27
+ FileProcessorErrorCode["UNSUPPORTED_TYPE"] = "UNSUPPORTED_TYPE";
28
+ FileProcessorErrorCode["INVALID_FORMAT"] = "INVALID_FORMAT";
29
+ FileProcessorErrorCode["INVALID_MIME_TYPE"] = "INVALID_MIME_TYPE";
30
+ FileProcessorErrorCode["INVALID_MAGIC_BYTES"] = "INVALID_MAGIC_BYTES";
31
+ FileProcessorErrorCode["CORRUPTED_FILE"] = "CORRUPTED_FILE";
32
+ FileProcessorErrorCode["INVALID_STRUCTURE"] = "INVALID_STRUCTURE";
33
+ // Processing errors
34
+ FileProcessorErrorCode["PROCESSING_FAILED"] = "PROCESSING_FAILED";
35
+ FileProcessorErrorCode["PARSING_FAILED"] = "PARSING_FAILED";
36
+ FileProcessorErrorCode["ENCODING_ERROR"] = "ENCODING_ERROR";
37
+ FileProcessorErrorCode["EXTRACTION_FAILED"] = "EXTRACTION_FAILED";
38
+ FileProcessorErrorCode["DECOMPRESSION_FAILED"] = "DECOMPRESSION_FAILED";
39
+ // Security errors
40
+ FileProcessorErrorCode["SECURITY_VALIDATION_FAILED"] = "SECURITY_VALIDATION_FAILED";
41
+ FileProcessorErrorCode["XXE_DETECTED"] = "XXE_DETECTED";
42
+ FileProcessorErrorCode["XSS_DETECTED"] = "XSS_DETECTED";
43
+ FileProcessorErrorCode["CODE_EXECUTION_DETECTED"] = "CODE_EXECUTION_DETECTED";
44
+ FileProcessorErrorCode["ZIP_BOMB_DETECTED"] = "ZIP_BOMB_DETECTED";
45
+ // System errors
46
+ FileProcessorErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
47
+ })(FileProcessorErrorCode || (FileProcessorErrorCode = {}));
48
+ // =============================================================================
49
+ // PRIORITY CONSTANTS
50
+ // =============================================================================
51
+ /**
52
+ * Priority levels for file processors.
53
+ * Lower number = higher priority = matched first.
54
+ */
55
+ export const PROCESSOR_PRIORITIES = {
56
+ /** SVG files - processed as text before image processing */
57
+ SVG: 5,
58
+ /** Image files - AI vision processing */
59
+ IMAGE: 10,
60
+ /** PDF documents */
61
+ PDF: 20,
62
+ /** CSV/tabular data */
63
+ CSV: 30,
64
+ /** Markdown files - structured text */
65
+ MARKDOWN: 40,
66
+ /** JSON data files */
67
+ JSON: 50,
68
+ /** YAML configuration/data files */
69
+ YAML: 60,
70
+ /** XML data files */
71
+ XML: 70,
72
+ /** HTML web content */
73
+ HTML: 80,
74
+ /** Excel spreadsheets */
75
+ EXCEL: 90,
76
+ /** Legacy .doc files */
77
+ DOC: 95,
78
+ /** Word documents (.docx) */
79
+ WORD: 100,
80
+ /** Plain text files */
81
+ TEXT: 110,
82
+ /** Source code files */
83
+ SOURCE_CODE: 120,
84
+ /** Configuration files */
85
+ CONFIG: 130,
86
+ /** RTF documents */
87
+ RTF: 140,
88
+ /** OpenDocument format files */
89
+ OPENDOCUMENT: 150,
90
+ };
91
+ //# sourceMappingURL=processorTypes.js.map