@juspay/neurolink 9.5.3 → 9.7.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.
- package/CHANGELOG.md +16 -0
- package/README.md +29 -25
- package/dist/adapters/video/vertexVideoHandler.js +3 -3
- package/dist/agent/directTools.d.ts +5 -5
- package/dist/cli/commands/config.d.ts +9 -9
- package/dist/cli/commands/serve.d.ts +37 -0
- package/dist/cli/commands/serve.js +302 -229
- package/dist/cli/commands/setup-anthropic.d.ts +2 -2
- package/dist/cli/commands/setup-azure.d.ts +2 -2
- package/dist/cli/commands/setup-bedrock.d.ts +2 -2
- package/dist/cli/commands/setup-gcp.d.ts +2 -2
- package/dist/cli/commands/setup-google-ai.d.ts +2 -2
- package/dist/cli/commands/setup-huggingface.d.ts +2 -2
- package/dist/cli/commands/setup-mistral.d.ts +2 -2
- package/dist/cli/commands/setup-openai.d.ts +2 -2
- package/dist/cli/commands/setup.d.ts +2 -2
- package/dist/cli/factories/commandFactory.js +16 -2
- package/dist/cli/loop/optionsSchema.d.ts +2 -2
- package/dist/cli/loop/optionsSchema.js +4 -0
- package/dist/cli/loop/session.d.ts +4 -0
- package/dist/cli/loop/session.js +49 -4
- package/dist/cli/utils/interactiveSetup.d.ts +4 -4
- package/dist/config/conversationMemory.d.ts +2 -0
- package/dist/config/conversationMemory.js +5 -5
- package/dist/constants/contextWindows.d.ts +46 -0
- package/dist/constants/contextWindows.js +156 -0
- package/dist/context/budgetChecker.d.ts +18 -0
- package/dist/context/budgetChecker.js +71 -0
- package/dist/context/contextCompactor.d.ts +22 -0
- package/dist/context/contextCompactor.js +106 -0
- package/dist/context/effectiveHistory.d.ts +52 -0
- package/dist/context/effectiveHistory.js +105 -0
- package/dist/context/errorDetection.d.ts +14 -0
- package/dist/context/errorDetection.js +124 -0
- package/dist/context/fileSummarizationService.d.ts +54 -0
- package/dist/context/fileSummarizationService.js +255 -0
- package/dist/context/fileSummarizer.d.ts +56 -0
- package/dist/context/fileSummarizer.js +145 -0
- package/dist/context/fileTokenBudget.d.ts +53 -0
- package/dist/context/fileTokenBudget.js +127 -0
- package/dist/context/prompts/summarizationPrompt.d.ts +17 -0
- package/dist/context/prompts/summarizationPrompt.js +110 -0
- package/dist/context/stages/fileReadDeduplicator.d.ts +10 -0
- package/dist/context/stages/fileReadDeduplicator.js +66 -0
- package/dist/context/stages/slidingWindowTruncator.d.ts +11 -0
- package/dist/context/stages/slidingWindowTruncator.js +42 -0
- package/dist/context/stages/structuredSummarizer.d.ts +10 -0
- package/dist/context/stages/structuredSummarizer.js +49 -0
- package/dist/context/stages/toolOutputPruner.d.ts +10 -0
- package/dist/context/stages/toolOutputPruner.js +52 -0
- package/dist/context/summarizationEngine.d.ts +45 -0
- package/dist/context/summarizationEngine.js +110 -0
- package/dist/context/toolOutputLimits.d.ts +17 -0
- package/dist/context/toolOutputLimits.js +84 -0
- package/dist/context/toolPairRepair.d.ts +16 -0
- package/dist/context/toolPairRepair.js +66 -0
- package/dist/core/analytics.js +11 -4
- package/dist/core/baseProvider.d.ts +6 -0
- package/dist/core/baseProvider.js +83 -14
- package/dist/core/conversationMemoryManager.d.ts +14 -11
- package/dist/core/conversationMemoryManager.js +36 -68
- package/dist/core/dynamicModels.js +3 -2
- package/dist/core/modules/GenerationHandler.js +2 -0
- package/dist/core/modules/MessageBuilder.d.ts +1 -1
- package/dist/core/modules/MessageBuilder.js +2 -0
- package/dist/core/modules/TelemetryHandler.d.ts +2 -3
- package/dist/core/modules/TelemetryHandler.js +3 -3
- package/dist/core/modules/ToolsManager.d.ts +2 -2
- package/dist/core/redisConversationMemoryManager.d.ts +19 -14
- package/dist/core/redisConversationMemoryManager.js +94 -86
- package/dist/factories/providerFactory.d.ts +2 -2
- package/dist/files/fileReferenceRegistry.d.ts +276 -0
- package/dist/files/fileReferenceRegistry.js +1543 -0
- package/dist/files/fileTools.d.ts +423 -0
- package/dist/files/fileTools.js +449 -0
- package/dist/files/index.d.ts +14 -0
- package/dist/files/index.js +13 -0
- package/dist/files/streamingReader.d.ts +93 -0
- package/dist/files/streamingReader.js +321 -0
- package/dist/files/types.d.ts +23 -0
- package/dist/files/types.js +23 -0
- package/dist/image-gen/imageGenTools.d.ts +2 -2
- package/dist/image-gen/types.d.ts +12 -12
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/lib/adapters/video/vertexVideoHandler.js +3 -3
- package/dist/lib/agent/directTools.d.ts +7 -7
- package/dist/lib/config/conversationMemory.d.ts +2 -0
- package/dist/lib/config/conversationMemory.js +5 -5
- package/dist/lib/constants/contextWindows.d.ts +46 -0
- package/dist/lib/constants/contextWindows.js +157 -0
- package/dist/lib/context/budgetChecker.d.ts +18 -0
- package/dist/lib/context/budgetChecker.js +72 -0
- package/dist/lib/context/contextCompactor.d.ts +22 -0
- package/dist/lib/context/contextCompactor.js +107 -0
- package/dist/lib/context/effectiveHistory.d.ts +52 -0
- package/dist/lib/context/effectiveHistory.js +106 -0
- package/dist/lib/context/errorDetection.d.ts +14 -0
- package/dist/lib/context/errorDetection.js +125 -0
- package/dist/lib/context/fileSummarizationService.d.ts +54 -0
- package/dist/lib/context/fileSummarizationService.js +256 -0
- package/dist/lib/context/fileSummarizer.d.ts +56 -0
- package/dist/lib/context/fileSummarizer.js +146 -0
- package/dist/lib/context/fileTokenBudget.d.ts +53 -0
- package/dist/lib/context/fileTokenBudget.js +128 -0
- package/dist/lib/context/prompts/summarizationPrompt.d.ts +17 -0
- package/dist/lib/context/prompts/summarizationPrompt.js +111 -0
- package/dist/lib/context/stages/fileReadDeduplicator.d.ts +10 -0
- package/dist/lib/context/stages/fileReadDeduplicator.js +67 -0
- package/dist/lib/context/stages/slidingWindowTruncator.d.ts +11 -0
- package/dist/lib/context/stages/slidingWindowTruncator.js +43 -0
- package/dist/lib/context/stages/structuredSummarizer.d.ts +10 -0
- package/dist/lib/context/stages/structuredSummarizer.js +50 -0
- package/dist/lib/context/stages/toolOutputPruner.d.ts +10 -0
- package/dist/lib/context/stages/toolOutputPruner.js +53 -0
- package/dist/lib/context/summarizationEngine.d.ts +45 -0
- package/dist/lib/context/summarizationEngine.js +111 -0
- package/dist/lib/context/toolOutputLimits.d.ts +17 -0
- package/dist/lib/context/toolOutputLimits.js +85 -0
- package/dist/lib/context/toolPairRepair.d.ts +16 -0
- package/dist/lib/context/toolPairRepair.js +67 -0
- package/dist/lib/core/analytics.js +11 -4
- package/dist/lib/core/baseProvider.d.ts +6 -0
- package/dist/lib/core/baseProvider.js +83 -14
- package/dist/lib/core/conversationMemoryManager.d.ts +14 -11
- package/dist/lib/core/conversationMemoryManager.js +36 -68
- package/dist/lib/core/dynamicModels.js +3 -2
- package/dist/lib/core/modules/GenerationHandler.js +2 -0
- package/dist/lib/core/modules/MessageBuilder.d.ts +1 -1
- package/dist/lib/core/modules/MessageBuilder.js +2 -0
- package/dist/lib/core/modules/TelemetryHandler.d.ts +2 -3
- package/dist/lib/core/modules/TelemetryHandler.js +3 -3
- package/dist/lib/core/modules/ToolsManager.d.ts +2 -2
- package/dist/lib/core/redisConversationMemoryManager.d.ts +19 -14
- package/dist/lib/core/redisConversationMemoryManager.js +94 -86
- package/dist/lib/factories/providerFactory.d.ts +2 -2
- package/dist/lib/files/fileReferenceRegistry.d.ts +276 -0
- package/dist/lib/files/fileReferenceRegistry.js +1544 -0
- package/dist/lib/files/fileTools.d.ts +423 -0
- package/dist/lib/files/fileTools.js +450 -0
- package/dist/lib/files/index.d.ts +14 -0
- package/dist/lib/files/index.js +14 -0
- package/dist/lib/files/streamingReader.d.ts +93 -0
- package/dist/lib/files/streamingReader.js +322 -0
- package/dist/lib/files/types.d.ts +23 -0
- package/dist/lib/files/types.js +24 -0
- package/dist/lib/image-gen/imageGenTools.d.ts +2 -2
- package/dist/lib/image-gen/types.d.ts +12 -12
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.js +5 -0
- package/dist/lib/mcp/httpRetryHandler.js +6 -2
- package/dist/lib/memory/mem0Initializer.d.ts +2 -2
- package/dist/lib/neurolink.d.ts +66 -2
- package/dist/lib/neurolink.js +777 -315
- package/dist/lib/processors/archive/ArchiveProcessor.d.ts +327 -0
- package/dist/lib/processors/archive/ArchiveProcessor.js +1309 -0
- package/dist/lib/processors/archive/index.d.ts +33 -0
- package/dist/lib/processors/archive/index.js +43 -0
- package/dist/lib/processors/base/BaseFileProcessor.js +2 -1
- package/dist/lib/processors/base/types.d.ts +70 -64
- package/dist/lib/processors/base/types.js +6 -0
- package/dist/lib/processors/cli/fileProcessorCli.d.ts +8 -8
- package/dist/lib/processors/cli/fileProcessorCli.js +5 -5
- package/dist/lib/processors/config/mimeTypes.js +25 -0
- package/dist/lib/processors/config/sizeLimits.d.ts +52 -40
- package/dist/lib/processors/config/sizeLimits.js +56 -44
- package/dist/lib/processors/document/ExcelProcessor.d.ts +14 -0
- package/dist/lib/processors/document/ExcelProcessor.js +72 -1
- package/dist/lib/processors/document/PptxProcessor.d.ts +63 -0
- package/dist/lib/processors/document/PptxProcessor.js +158 -0
- package/dist/lib/processors/document/index.d.ts +1 -0
- package/dist/lib/processors/document/index.js +6 -0
- package/dist/lib/processors/errors/FileErrorCode.d.ts +2 -2
- package/dist/lib/processors/errors/errorHelpers.d.ts +2 -2
- package/dist/lib/processors/errors/errorHelpers.js +12 -4
- package/dist/lib/processors/errors/errorSerializer.d.ts +4 -4
- package/dist/lib/processors/index.d.ts +8 -2
- package/dist/lib/processors/index.js +5 -2
- package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +8 -8
- package/dist/lib/processors/integration/FileProcessorIntegration.js +7 -7
- package/dist/lib/processors/media/AudioProcessor.d.ts +328 -0
- package/dist/lib/processors/media/AudioProcessor.js +708 -0
- package/dist/lib/processors/media/VideoProcessor.d.ts +350 -0
- package/dist/lib/processors/media/VideoProcessor.js +992 -0
- package/dist/lib/processors/media/index.d.ts +27 -0
- package/dist/lib/processors/media/index.js +37 -0
- package/dist/lib/processors/registry/ProcessorRegistry.d.ts +19 -5
- package/dist/lib/processors/registry/ProcessorRegistry.js +103 -8
- package/dist/lib/processors/registry/index.d.ts +1 -1
- package/dist/lib/processors/registry/index.js +1 -1
- package/dist/lib/processors/registry/types.d.ts +2 -2
- package/dist/lib/providers/amazonBedrock.js +2 -1
- package/dist/lib/providers/anthropic.js +2 -2
- package/dist/lib/providers/anthropicBaseProvider.js +10 -4
- package/dist/lib/providers/azureOpenai.js +14 -25
- package/dist/lib/providers/googleAiStudio.js +136 -457
- package/dist/lib/providers/googleNativeGemini3.d.ts +119 -0
- package/dist/lib/providers/googleNativeGemini3.js +264 -0
- package/dist/lib/providers/googleVertex.d.ts +15 -1
- package/dist/lib/providers/googleVertex.js +341 -775
- package/dist/lib/providers/huggingFace.js +20 -5
- package/dist/lib/providers/litellm.js +6 -4
- package/dist/lib/providers/mistral.js +3 -2
- package/dist/lib/providers/openAI.js +2 -2
- package/dist/lib/providers/openRouter.js +8 -7
- package/dist/lib/providers/openaiCompatible.js +10 -4
- package/dist/lib/providers/sagemaker/detection.d.ts +6 -6
- package/dist/lib/providers/sagemaker/diagnostics.d.ts +4 -4
- package/dist/lib/providers/sagemaker/parsers.d.ts +4 -4
- package/dist/lib/rag/chunkers/RecursiveChunker.js +2 -2
- package/dist/lib/rag/document/loaders.d.ts +6 -71
- package/dist/lib/rag/document/loaders.js +5 -5
- package/dist/lib/rag/graphRag/graphRAG.js +26 -9
- package/dist/lib/rag/metadata/MetadataExtractorFactory.d.ts +5 -55
- package/dist/lib/rag/metadata/metadataExtractor.js +6 -3
- package/dist/lib/rag/pipeline/RAGPipeline.d.ts +8 -126
- package/dist/lib/rag/pipeline/RAGPipeline.js +11 -11
- package/dist/lib/rag/pipeline/contextAssembly.d.ts +3 -42
- package/dist/lib/rag/pipeline/contextAssembly.js +6 -3
- package/dist/lib/rag/reranker/RerankerFactory.d.ts +5 -60
- package/dist/lib/rag/resilience/CircuitBreaker.d.ts +3 -33
- package/dist/lib/rag/resilience/RetryHandler.d.ts +2 -21
- package/dist/lib/rag/resilience/RetryHandler.js +6 -2
- package/dist/lib/rag/retrieval/hybridSearch.d.ts +3 -41
- package/dist/lib/rag/retrieval/vectorQueryTool.d.ts +2 -13
- package/dist/lib/rag/retrieval/vectorQueryTool.js +4 -3
- package/dist/lib/rag/types.d.ts +3 -3
- package/dist/lib/sdk/toolRegistration.d.ts +2 -2
- package/dist/lib/server/middleware/cache.d.ts +2 -2
- package/dist/lib/server/middleware/rateLimit.d.ts +2 -2
- package/dist/lib/server/routes/mcpRoutes.js +277 -249
- package/dist/lib/server/routes/memoryRoutes.js +287 -281
- package/dist/lib/server/utils/validation.d.ts +10 -10
- package/dist/lib/services/server/ai/observability/instrumentation.d.ts +24 -2
- package/dist/lib/services/server/ai/observability/instrumentation.js +12 -1
- package/dist/lib/session/globalSessionState.d.ts +2 -2
- package/dist/lib/telemetry/telemetryService.d.ts +2 -2
- package/dist/lib/types/common.d.ts +39 -0
- package/dist/lib/types/contextTypes.d.ts +255 -0
- package/dist/lib/types/contextTypes.js +0 -2
- package/dist/lib/types/conversation.d.ts +62 -0
- package/dist/lib/types/conversationMemoryInterface.d.ts +27 -0
- package/dist/lib/types/conversationMemoryInterface.js +7 -0
- package/dist/lib/types/fileReferenceTypes.d.ts +222 -0
- package/dist/lib/types/fileReferenceTypes.js +9 -0
- package/dist/lib/types/fileTypes.d.ts +26 -3
- package/dist/lib/types/generateTypes.d.ts +50 -1
- package/dist/lib/types/index.d.ts +4 -5
- package/dist/lib/types/index.js +8 -10
- package/dist/lib/types/modelTypes.d.ts +2 -2
- package/dist/lib/types/processorTypes.d.ts +597 -0
- package/dist/lib/types/processorTypes.js +91 -0
- package/dist/lib/types/ragTypes.d.ts +489 -0
- package/dist/lib/types/ragTypes.js +8 -0
- package/dist/lib/types/sdkTypes.d.ts +17 -18
- package/dist/lib/types/streamTypes.d.ts +24 -1
- package/dist/lib/utils/async/retry.d.ts +2 -2
- package/dist/lib/utils/async/withTimeout.js +3 -1
- package/dist/lib/utils/conversationMemory.d.ts +12 -6
- package/dist/lib/utils/conversationMemory.js +91 -36
- package/dist/lib/utils/errorHandling.d.ts +5 -0
- package/dist/lib/utils/errorHandling.js +19 -0
- package/dist/lib/utils/fileDetector.d.ts +62 -0
- package/dist/lib/utils/fileDetector.js +1014 -14
- package/dist/lib/utils/json/safeParse.d.ts +2 -2
- package/dist/lib/utils/messageBuilder.js +806 -153
- package/dist/lib/utils/modelChoices.d.ts +2 -2
- package/dist/lib/utils/multimodalOptionsBuilder.d.ts +2 -1
- package/dist/lib/utils/multimodalOptionsBuilder.js +1 -0
- package/dist/lib/utils/pricing.d.ts +12 -0
- package/dist/lib/utils/pricing.js +134 -0
- package/dist/lib/utils/rateLimiter.d.ts +2 -2
- package/dist/lib/utils/redis.d.ts +17 -0
- package/dist/lib/utils/redis.js +105 -0
- package/dist/lib/utils/sanitizers/filename.d.ts +4 -4
- package/dist/lib/utils/sanitizers/svg.d.ts +2 -2
- package/dist/lib/utils/thinkingConfig.d.ts +6 -6
- package/dist/lib/utils/timeout.d.ts +10 -0
- package/dist/lib/utils/timeout.js +15 -0
- package/dist/lib/utils/tokenEstimation.d.ts +68 -0
- package/dist/lib/utils/tokenEstimation.js +113 -0
- package/dist/lib/utils/tokenUtils.d.ts +4 -4
- package/dist/lib/utils/ttsProcessor.d.ts +2 -2
- package/dist/lib/workflow/config.d.ts +150 -150
- package/dist/mcp/httpRetryHandler.js +6 -2
- package/dist/memory/mem0Initializer.d.ts +2 -2
- package/dist/neurolink.d.ts +66 -2
- package/dist/neurolink.js +777 -315
- package/dist/processors/archive/ArchiveProcessor.d.ts +327 -0
- package/dist/processors/archive/ArchiveProcessor.js +1308 -0
- package/dist/processors/archive/index.d.ts +33 -0
- package/dist/processors/archive/index.js +42 -0
- package/dist/processors/base/BaseFileProcessor.js +2 -1
- package/dist/processors/base/types.d.ts +70 -64
- package/dist/processors/base/types.js +6 -0
- package/dist/processors/cli/fileProcessorCli.d.ts +8 -8
- package/dist/processors/cli/fileProcessorCli.js +5 -5
- package/dist/processors/config/mimeTypes.js +25 -0
- package/dist/processors/config/sizeLimits.d.ts +52 -40
- package/dist/processors/config/sizeLimits.js +56 -44
- package/dist/processors/document/ExcelProcessor.d.ts +14 -0
- package/dist/processors/document/ExcelProcessor.js +72 -1
- package/dist/processors/document/PptxProcessor.d.ts +63 -0
- package/dist/processors/document/PptxProcessor.js +157 -0
- package/dist/processors/document/index.d.ts +1 -0
- package/dist/processors/document/index.js +6 -0
- package/dist/processors/errors/FileErrorCode.d.ts +2 -2
- package/dist/processors/errors/errorHelpers.d.ts +2 -2
- package/dist/processors/errors/errorHelpers.js +12 -4
- package/dist/processors/errors/errorSerializer.d.ts +4 -4
- package/dist/processors/index.d.ts +8 -2
- package/dist/processors/index.js +5 -2
- package/dist/processors/integration/FileProcessorIntegration.d.ts +8 -8
- package/dist/processors/integration/FileProcessorIntegration.js +7 -7
- package/dist/processors/media/AudioProcessor.d.ts +328 -0
- package/dist/processors/media/AudioProcessor.js +707 -0
- package/dist/processors/media/VideoProcessor.d.ts +350 -0
- package/dist/processors/media/VideoProcessor.js +991 -0
- package/dist/processors/media/ffprobe-static.d.ts +4 -0
- package/dist/processors/media/index.d.ts +27 -0
- package/dist/processors/media/index.js +36 -0
- package/dist/processors/registry/ProcessorRegistry.d.ts +19 -5
- package/dist/processors/registry/ProcessorRegistry.js +103 -8
- package/dist/processors/registry/index.d.ts +1 -1
- package/dist/processors/registry/index.js +1 -1
- package/dist/processors/registry/types.d.ts +2 -2
- package/dist/providers/amazonBedrock.js +2 -1
- package/dist/providers/anthropic.js +2 -2
- package/dist/providers/anthropicBaseProvider.js +10 -4
- package/dist/providers/azureOpenai.js +14 -25
- package/dist/providers/googleAiStudio.js +136 -457
- package/dist/providers/googleNativeGemini3.d.ts +119 -0
- package/dist/providers/googleNativeGemini3.js +263 -0
- package/dist/providers/googleVertex.d.ts +15 -1
- package/dist/providers/googleVertex.js +341 -775
- package/dist/providers/huggingFace.js +20 -5
- package/dist/providers/litellm.js +6 -4
- package/dist/providers/mistral.js +3 -2
- package/dist/providers/openAI.js +2 -2
- package/dist/providers/openRouter.js +8 -7
- package/dist/providers/openaiCompatible.js +10 -4
- package/dist/providers/sagemaker/detection.d.ts +6 -6
- package/dist/providers/sagemaker/diagnostics.d.ts +4 -4
- package/dist/providers/sagemaker/parsers.d.ts +4 -4
- package/dist/rag/chunkers/RecursiveChunker.js +2 -2
- package/dist/rag/document/loaders.d.ts +6 -71
- package/dist/rag/document/loaders.js +5 -5
- package/dist/rag/graphRag/graphRAG.js +26 -9
- package/dist/rag/metadata/MetadataExtractorFactory.d.ts +5 -55
- package/dist/rag/metadata/metadataExtractor.js +6 -3
- package/dist/rag/pipeline/RAGPipeline.d.ts +8 -126
- package/dist/rag/pipeline/RAGPipeline.js +11 -11
- package/dist/rag/pipeline/contextAssembly.d.ts +3 -42
- package/dist/rag/pipeline/contextAssembly.js +6 -3
- package/dist/rag/reranker/RerankerFactory.d.ts +5 -60
- package/dist/rag/resilience/CircuitBreaker.d.ts +3 -33
- package/dist/rag/resilience/RetryHandler.d.ts +2 -21
- package/dist/rag/resilience/RetryHandler.js +6 -2
- package/dist/rag/retrieval/hybridSearch.d.ts +3 -41
- package/dist/rag/retrieval/vectorQueryTool.d.ts +2 -13
- package/dist/rag/retrieval/vectorQueryTool.js +4 -3
- package/dist/rag/types.d.ts +3 -3
- package/dist/sdk/toolRegistration.d.ts +2 -2
- package/dist/server/middleware/cache.d.ts +2 -2
- package/dist/server/middleware/rateLimit.d.ts +2 -2
- package/dist/server/routes/mcpRoutes.js +277 -249
- package/dist/server/routes/memoryRoutes.js +287 -281
- package/dist/server/utils/validation.d.ts +4 -4
- package/dist/services/server/ai/observability/instrumentation.d.ts +24 -2
- package/dist/services/server/ai/observability/instrumentation.js +12 -1
- package/dist/session/globalSessionState.d.ts +2 -2
- package/dist/telemetry/telemetryService.d.ts +2 -2
- package/dist/types/common.d.ts +39 -0
- package/dist/types/contextTypes.d.ts +255 -0
- package/dist/types/contextTypes.js +0 -2
- package/dist/types/conversation.d.ts +62 -0
- package/dist/types/conversationMemoryInterface.d.ts +27 -0
- package/dist/types/conversationMemoryInterface.js +6 -0
- package/dist/types/fileReferenceTypes.d.ts +222 -0
- package/dist/types/fileReferenceTypes.js +8 -0
- package/dist/types/fileTypes.d.ts +26 -3
- package/dist/types/generateTypes.d.ts +50 -1
- package/dist/types/index.d.ts +4 -5
- package/dist/types/index.js +8 -10
- package/dist/types/processorTypes.d.ts +597 -0
- package/dist/types/processorTypes.js +90 -0
- package/dist/types/ragTypes.d.ts +489 -0
- package/dist/types/ragTypes.js +7 -0
- package/dist/types/sdkTypes.d.ts +17 -18
- package/dist/types/streamTypes.d.ts +24 -1
- package/dist/utils/async/retry.d.ts +2 -2
- package/dist/utils/async/withTimeout.js +3 -1
- package/dist/utils/conversationMemory.d.ts +12 -6
- package/dist/utils/conversationMemory.js +91 -36
- package/dist/utils/errorHandling.d.ts +5 -0
- package/dist/utils/errorHandling.js +19 -0
- package/dist/utils/fileDetector.d.ts +62 -0
- package/dist/utils/fileDetector.js +1014 -14
- package/dist/utils/json/safeParse.d.ts +2 -2
- package/dist/utils/messageBuilder.js +806 -153
- package/dist/utils/modelChoices.d.ts +2 -2
- package/dist/utils/multimodalOptionsBuilder.d.ts +2 -1
- package/dist/utils/multimodalOptionsBuilder.js +1 -0
- package/dist/utils/pricing.d.ts +12 -0
- package/dist/utils/pricing.js +133 -0
- package/dist/utils/rateLimiter.d.ts +2 -2
- package/dist/utils/redis.d.ts +17 -0
- package/dist/utils/redis.js +105 -0
- package/dist/utils/sanitizers/filename.d.ts +4 -4
- package/dist/utils/sanitizers/svg.d.ts +2 -2
- package/dist/utils/thinkingConfig.d.ts +6 -6
- package/dist/utils/timeout.d.ts +10 -0
- package/dist/utils/timeout.js +15 -0
- package/dist/utils/tokenEstimation.d.ts +68 -0
- package/dist/utils/tokenEstimation.js +112 -0
- package/dist/utils/tokenUtils.d.ts +4 -4
- package/dist/utils/ttsProcessor.d.ts +2 -2
- package/dist/workflow/config.d.ts +104 -104
- package/package.json +18 -6
- package/dist/lib/utils/conversationMemoryUtils.d.ts +0 -25
- package/dist/lib/utils/conversationMemoryUtils.js +0 -138
- package/dist/utils/conversationMemoryUtils.d.ts +0 -25
- package/dist/utils/conversationMemoryUtils.js +0 -137
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archive Processors Module
|
|
3
|
+
*
|
|
4
|
+
* Exports archive file processors for ZIP, TAR, TAR.GZ, and GZ formats.
|
|
5
|
+
* Handles downloading, validating, and extracting file listings from archives
|
|
6
|
+
* with comprehensive security validation.
|
|
7
|
+
*
|
|
8
|
+
* @module processors/archive
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {
|
|
13
|
+
* ArchiveProcessor,
|
|
14
|
+
* archiveProcessor,
|
|
15
|
+
* isArchiveFile,
|
|
16
|
+
* processArchive,
|
|
17
|
+
* type ProcessedArchive,
|
|
18
|
+
* type ArchiveEntry,
|
|
19
|
+
* type ArchiveFormat,
|
|
20
|
+
* } from "./archive/index.js";
|
|
21
|
+
*
|
|
22
|
+
* // Check if a file is an archive
|
|
23
|
+
* if (isArchiveFile(file.mimetype, file.name)) {
|
|
24
|
+
* const result = await processArchive(fileInfo);
|
|
25
|
+
* if (result.success) {
|
|
26
|
+
* console.log(`Format: ${result.data.archiveMetadata.format}`);
|
|
27
|
+
* console.log(`Entries: ${result.data.archiveMetadata.totalEntries}`);
|
|
28
|
+
* console.log(result.data.textContent);
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export { type ArchiveEntry, type ArchiveFormat, ArchiveProcessor, archiveProcessor, isArchiveFile, type ProcessedArchive, processArchive, } from "./ArchiveProcessor.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Archive Processors Module
|
|
3
|
+
*
|
|
4
|
+
* Exports archive file processors for ZIP, TAR, TAR.GZ, and GZ formats.
|
|
5
|
+
* Handles downloading, validating, and extracting file listings from archives
|
|
6
|
+
* with comprehensive security validation.
|
|
7
|
+
*
|
|
8
|
+
* @module processors/archive
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {
|
|
13
|
+
* ArchiveProcessor,
|
|
14
|
+
* archiveProcessor,
|
|
15
|
+
* isArchiveFile,
|
|
16
|
+
* processArchive,
|
|
17
|
+
* type ProcessedArchive,
|
|
18
|
+
* type ArchiveEntry,
|
|
19
|
+
* type ArchiveFormat,
|
|
20
|
+
* } from "./archive/index.js";
|
|
21
|
+
*
|
|
22
|
+
* // Check if a file is an archive
|
|
23
|
+
* if (isArchiveFile(file.mimetype, file.name)) {
|
|
24
|
+
* const result = await processArchive(fileInfo);
|
|
25
|
+
* if (result.success) {
|
|
26
|
+
* console.log(`Format: ${result.data.archiveMetadata.format}`);
|
|
27
|
+
* console.log(`Entries: ${result.data.archiveMetadata.totalEntries}`);
|
|
28
|
+
* console.log(result.data.textContent);
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// ARCHIVE PROCESSOR
|
|
35
|
+
// =============================================================================
|
|
36
|
+
export {
|
|
37
|
+
// Class
|
|
38
|
+
ArchiveProcessor,
|
|
39
|
+
// Singleton instance
|
|
40
|
+
archiveProcessor,
|
|
41
|
+
// Helper functions
|
|
42
|
+
isArchiveFile, processArchive, } from "./ArchiveProcessor.js";
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
import { promisify } from "util";
|
|
47
47
|
import { gunzip } from "zlib";
|
|
48
48
|
import { SIZE_LIMITS } from "../config/index.js";
|
|
49
|
+
import { isAbortError } from "../../utils/errorHandling.js";
|
|
49
50
|
import { createFileError, extractHttpStatus, FileErrorCode, isRetryableError, } from "../errors/index.js";
|
|
50
51
|
import { DEFAULT_RETRY_CONFIG } from "./types.js";
|
|
51
52
|
const gunzipAsync = promisify(gunzip);
|
|
@@ -545,7 +546,7 @@ export class BaseFileProcessor {
|
|
|
545
546
|
* @returns Structured file processing error
|
|
546
547
|
*/
|
|
547
548
|
classifyDownloadError(error) {
|
|
548
|
-
if (error
|
|
549
|
+
if (isAbortError(error)) {
|
|
549
550
|
return this.createError(FileErrorCode.DOWNLOAD_TIMEOUT, { timeoutMs: this.config.timeoutMs }, error);
|
|
550
551
|
}
|
|
551
552
|
if (error.message.includes("HTTP")) {
|
|
@@ -22,7 +22,7 @@ import type { FileErrorCode } from "../errors/FileErrorCode.js";
|
|
|
22
22
|
* };
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type FileInfo = {
|
|
26
26
|
/** Unique identifier for the file */
|
|
27
27
|
id: string;
|
|
28
28
|
/** Original filename */
|
|
@@ -37,12 +37,12 @@ export interface FileInfo {
|
|
|
37
37
|
buffer?: Buffer;
|
|
38
38
|
/** Extensibility - additional provider-specific metadata */
|
|
39
39
|
metadata?: Record<string, unknown>;
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
/**
|
|
42
42
|
* Configuration for file processors.
|
|
43
43
|
* Defines constraints and defaults for a specific file type processor.
|
|
44
44
|
*/
|
|
45
|
-
export
|
|
45
|
+
export type FileProcessorConfig = {
|
|
46
46
|
/** Maximum file size in megabytes */
|
|
47
47
|
maxSizeMB: number;
|
|
48
48
|
/** Download/processing timeout in milliseconds */
|
|
@@ -55,12 +55,12 @@ export interface FileProcessorConfig {
|
|
|
55
55
|
fileTypeName: string;
|
|
56
56
|
/** Default filename when original name is not available */
|
|
57
57
|
defaultFilename: string;
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
/**
|
|
60
60
|
* Base interface for processed file data.
|
|
61
61
|
* All specific processed types should extend this interface.
|
|
62
62
|
*/
|
|
63
|
-
export
|
|
63
|
+
export type ProcessedFileBase = {
|
|
64
64
|
/** File content as a Buffer */
|
|
65
65
|
buffer: Buffer;
|
|
66
66
|
/** MIME type of the processed content */
|
|
@@ -69,12 +69,12 @@ export interface ProcessedFileBase {
|
|
|
69
69
|
size: number;
|
|
70
70
|
/** Filename (may be normalized or sanitized) */
|
|
71
71
|
filename: string;
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
/**
|
|
74
74
|
* Structured file processing error with user-friendly messaging.
|
|
75
75
|
* This is the canonical error type used across all processor infrastructure.
|
|
76
76
|
*/
|
|
77
|
-
export
|
|
77
|
+
export type FileProcessingError = {
|
|
78
78
|
/** Error code from FileErrorCode enum */
|
|
79
79
|
code: FileErrorCode | string;
|
|
80
80
|
/** Technical error message */
|
|
@@ -91,19 +91,19 @@ export interface FileProcessingError {
|
|
|
91
91
|
technicalDetails?: string;
|
|
92
92
|
/** Original error that caused this failure */
|
|
93
93
|
originalError?: Error;
|
|
94
|
-
}
|
|
94
|
+
};
|
|
95
95
|
/**
|
|
96
96
|
* Generic result type for internal operations.
|
|
97
97
|
* Used for validation and download operations that don't return ProcessedFileBase.
|
|
98
98
|
*/
|
|
99
|
-
export
|
|
99
|
+
export type OperationResult<T = void> = {
|
|
100
100
|
/** Whether the operation was successful */
|
|
101
101
|
success: boolean;
|
|
102
102
|
/** Operation result data (present when success is true) */
|
|
103
103
|
data?: T;
|
|
104
104
|
/** Error information (present when success is false) */
|
|
105
105
|
error?: FileProcessingError;
|
|
106
|
-
}
|
|
106
|
+
};
|
|
107
107
|
/**
|
|
108
108
|
* Result of a file processing operation.
|
|
109
109
|
* Uses discriminated union pattern for type-safe error handling.
|
|
@@ -118,19 +118,19 @@ export interface OperationResult<T = void> {
|
|
|
118
118
|
* }
|
|
119
119
|
* ```
|
|
120
120
|
*/
|
|
121
|
-
export
|
|
121
|
+
export type FileProcessingResult<T extends ProcessedFileBase = ProcessedFileBase> = {
|
|
122
122
|
/** Whether the processing was successful */
|
|
123
123
|
success: boolean;
|
|
124
124
|
/** Processed file data (present when success is true) */
|
|
125
125
|
data?: T;
|
|
126
126
|
/** Error information (present when success is false) */
|
|
127
127
|
error?: FileProcessingError;
|
|
128
|
-
}
|
|
128
|
+
};
|
|
129
129
|
/**
|
|
130
130
|
* Configuration for retry behavior on transient failures.
|
|
131
131
|
* Implements exponential backoff with optional custom retry predicate.
|
|
132
132
|
*/
|
|
133
|
-
export
|
|
133
|
+
export type RetryConfig = {
|
|
134
134
|
/** Maximum number of retry attempts */
|
|
135
135
|
maxRetries: number;
|
|
136
136
|
/** Base delay between retries in milliseconds */
|
|
@@ -139,19 +139,19 @@ export interface RetryConfig {
|
|
|
139
139
|
maxDelayMs: number;
|
|
140
140
|
/** Optional custom function to determine if an error is retryable */
|
|
141
141
|
retryOn?: (error: Error) => boolean;
|
|
142
|
-
}
|
|
142
|
+
};
|
|
143
143
|
/**
|
|
144
144
|
* Options for file processing operations.
|
|
145
145
|
* Allows customization of download behavior and retry logic.
|
|
146
146
|
*/
|
|
147
|
-
export
|
|
147
|
+
export type ProcessOptions = {
|
|
148
148
|
/** Authentication headers for download requests */
|
|
149
149
|
authHeaders?: Record<string, string>;
|
|
150
150
|
/** Override default timeout (in milliseconds) */
|
|
151
151
|
timeout?: number;
|
|
152
152
|
/** Retry configuration for transient failures */
|
|
153
153
|
retryConfig?: RetryConfig;
|
|
154
|
-
}
|
|
154
|
+
};
|
|
155
155
|
/**
|
|
156
156
|
* Default retry configuration for file downloads.
|
|
157
157
|
* Uses exponential backoff: 1s, 2s, 4s (capped at maxDelayMs)
|
|
@@ -168,7 +168,7 @@ export declare const DEFAULT_IMAGE_MAX_SIZE_MB = 10;
|
|
|
168
168
|
/**
|
|
169
169
|
* Information about a successfully processed file.
|
|
170
170
|
*/
|
|
171
|
-
export
|
|
171
|
+
export type ProcessedFileInfo = {
|
|
172
172
|
/** File identifier */
|
|
173
173
|
fileId: string;
|
|
174
174
|
/** Filename */
|
|
@@ -179,11 +179,11 @@ export interface ProcessedFileInfo {
|
|
|
179
179
|
size: number;
|
|
180
180
|
/** Type of processor used */
|
|
181
181
|
processorType: string;
|
|
182
|
-
}
|
|
182
|
+
};
|
|
183
183
|
/**
|
|
184
184
|
* Information about a file that failed to process.
|
|
185
185
|
*/
|
|
186
|
-
export
|
|
186
|
+
export type FailedFileInfo = {
|
|
187
187
|
/** File identifier */
|
|
188
188
|
fileId: string;
|
|
189
189
|
/** Filename */
|
|
@@ -194,11 +194,11 @@ export interface FailedFileInfo {
|
|
|
194
194
|
size: number;
|
|
195
195
|
/** Error that caused the failure */
|
|
196
196
|
error: FileProcessingError;
|
|
197
|
-
}
|
|
197
|
+
};
|
|
198
198
|
/**
|
|
199
199
|
* Information about a file that was skipped.
|
|
200
200
|
*/
|
|
201
|
-
export
|
|
201
|
+
export type SkippedFileInfo = {
|
|
202
202
|
/** File identifier */
|
|
203
203
|
fileId: string;
|
|
204
204
|
/** Filename */
|
|
@@ -211,22 +211,22 @@ export interface SkippedFileInfo {
|
|
|
211
211
|
reason: string;
|
|
212
212
|
/** Suggested alternative action */
|
|
213
213
|
suggestedAlternative?: string;
|
|
214
|
-
}
|
|
214
|
+
};
|
|
215
215
|
/**
|
|
216
216
|
* Warning about a file (non-fatal issue).
|
|
217
217
|
*/
|
|
218
|
-
export
|
|
218
|
+
export type FileWarning = {
|
|
219
219
|
/** File identifier */
|
|
220
220
|
fileId: string;
|
|
221
221
|
/** Filename */
|
|
222
222
|
filename: string;
|
|
223
223
|
/** Warning message */
|
|
224
224
|
message: string;
|
|
225
|
-
}
|
|
225
|
+
};
|
|
226
226
|
/**
|
|
227
227
|
* Summary of batch file processing operations.
|
|
228
228
|
*/
|
|
229
|
-
export
|
|
229
|
+
export type BatchProcessingSummary<T extends ProcessedFileBase = ProcessedFileBase> = {
|
|
230
230
|
/** Total number of files attempted */
|
|
231
231
|
totalFiles: number;
|
|
232
232
|
/** Successfully processed files */
|
|
@@ -239,7 +239,7 @@ export interface BatchProcessingSummary<T extends ProcessedFileBase = ProcessedF
|
|
|
239
239
|
warnings: FileWarning[];
|
|
240
240
|
/** Processed results (parallel array with processedFiles) */
|
|
241
241
|
results: T[];
|
|
242
|
-
}
|
|
242
|
+
};
|
|
243
243
|
/**
|
|
244
244
|
* Result of finding a matching processor for a file.
|
|
245
245
|
* Includes both the processor and metadata about the match quality.
|
|
@@ -247,7 +247,7 @@ export interface BatchProcessingSummary<T extends ProcessedFileBase = ProcessedF
|
|
|
247
247
|
* Note: `processor` is typed as `unknown` here to avoid circular dependency
|
|
248
248
|
* on BaseFileProcessor. The registry module uses the properly typed version.
|
|
249
249
|
*/
|
|
250
|
-
export
|
|
250
|
+
export type ProcessorMatch<_T extends ProcessedFileBase = ProcessedFileBase> = {
|
|
251
251
|
/** Name of the matched processor */
|
|
252
252
|
name: string;
|
|
253
253
|
/** The processor instance */
|
|
@@ -263,12 +263,12 @@ export interface ProcessorMatch<_T extends ProcessedFileBase = ProcessedFileBase
|
|
|
263
263
|
* - 40: Generic/fallback match
|
|
264
264
|
*/
|
|
265
265
|
confidence: number;
|
|
266
|
-
}
|
|
266
|
+
};
|
|
267
267
|
/**
|
|
268
268
|
* Options for registry operations.
|
|
269
269
|
* Controls behavior when registering processors.
|
|
270
270
|
*/
|
|
271
|
-
export
|
|
271
|
+
export type RegistryOptions = {
|
|
272
272
|
/**
|
|
273
273
|
* Allow registering processors with duplicate names.
|
|
274
274
|
* If false (default), an error is thrown on duplicate names.
|
|
@@ -279,12 +279,12 @@ export interface RegistryOptions {
|
|
|
279
279
|
* Takes precedence over allowDuplicates.
|
|
280
280
|
*/
|
|
281
281
|
overwriteExisting?: boolean;
|
|
282
|
-
}
|
|
282
|
+
};
|
|
283
283
|
/**
|
|
284
284
|
* Detailed error information for unsupported file types.
|
|
285
285
|
* Provides helpful suggestions for the user.
|
|
286
286
|
*/
|
|
287
|
-
export
|
|
287
|
+
export type UnsupportedFileError = {
|
|
288
288
|
/** Error code for programmatic handling */
|
|
289
289
|
code: "NO_PROCESSOR_FOUND" | "PROCESSING_FAILED";
|
|
290
290
|
/** Human-readable error message */
|
|
@@ -297,19 +297,19 @@ export interface UnsupportedFileError {
|
|
|
297
297
|
suggestion: string;
|
|
298
298
|
/** List of supported file types */
|
|
299
299
|
supportedTypes: string[];
|
|
300
|
-
}
|
|
300
|
+
};
|
|
301
301
|
/**
|
|
302
302
|
* Result of processing a file through the registry.
|
|
303
303
|
* Includes type information for tracking which processor was used.
|
|
304
304
|
*/
|
|
305
|
-
export
|
|
305
|
+
export type RegistryProcessResult<T = unknown> = {
|
|
306
306
|
/** Type/name of the processor that handled the file */
|
|
307
307
|
type: string;
|
|
308
308
|
/** Processed data (null if processing failed) */
|
|
309
309
|
data: T | null;
|
|
310
310
|
/** Error information if processing failed */
|
|
311
311
|
error?: UnsupportedFileError;
|
|
312
|
-
}
|
|
312
|
+
};
|
|
313
313
|
/**
|
|
314
314
|
* Priority levels for file processors.
|
|
315
315
|
* Lower number = higher priority = matched first.
|
|
@@ -354,6 +354,12 @@ export declare const PROCESSOR_PRIORITIES: {
|
|
|
354
354
|
readonly RTF: 140;
|
|
355
355
|
/** OpenDocument format files */
|
|
356
356
|
readonly OPENDOCUMENT: 150;
|
|
357
|
+
/** Video files */
|
|
358
|
+
readonly VIDEO: 160;
|
|
359
|
+
/** Audio files */
|
|
360
|
+
readonly AUDIO: 170;
|
|
361
|
+
/** Archive files */
|
|
362
|
+
readonly ARCHIVE: 180;
|
|
357
363
|
};
|
|
358
364
|
/**
|
|
359
365
|
* Type for processor priority keys
|
|
@@ -367,7 +373,7 @@ export type ProcessorPriorityValue = (typeof PROCESSOR_PRIORITIES)[ProcessorPrio
|
|
|
367
373
|
* Information about a registered processor.
|
|
368
374
|
* Used for discovery and documentation.
|
|
369
375
|
*/
|
|
370
|
-
export
|
|
376
|
+
export type ProcessorInfo = {
|
|
371
377
|
/** Unique name for the processor */
|
|
372
378
|
name: string;
|
|
373
379
|
/** Human-readable description */
|
|
@@ -378,7 +384,7 @@ export interface ProcessorInfo {
|
|
|
378
384
|
supportedExtensions: string[];
|
|
379
385
|
/** Priority level (lower = higher priority) */
|
|
380
386
|
priority?: number;
|
|
381
|
-
}
|
|
387
|
+
};
|
|
382
388
|
/**
|
|
383
389
|
* Error message template with user-friendly messaging and retry information.
|
|
384
390
|
* Re-exported from errors module for convenience.
|
|
@@ -388,7 +394,7 @@ export type { ErrorMessageTemplate, FileErrorCode, } from "../errors/FileErrorCo
|
|
|
388
394
|
* Processed SVG result.
|
|
389
395
|
* Extends ProcessedFileBase with SVG-specific fields.
|
|
390
396
|
*/
|
|
391
|
-
export
|
|
397
|
+
export type ProcessedSvg = ProcessedFileBase & {
|
|
392
398
|
/** Sanitized SVG content as text for AI processing */
|
|
393
399
|
textContent: string;
|
|
394
400
|
/** Original raw content (only included if sanitization modified the content) */
|
|
@@ -397,11 +403,11 @@ export interface ProcessedSvg extends ProcessedFileBase {
|
|
|
397
403
|
sanitized: boolean;
|
|
398
404
|
/** Security warnings found during processing */
|
|
399
405
|
securityWarnings: string[];
|
|
400
|
-
}
|
|
406
|
+
};
|
|
401
407
|
/**
|
|
402
408
|
* Processed XML file result.
|
|
403
409
|
*/
|
|
404
|
-
export
|
|
410
|
+
export type ProcessedXml = ProcessedFileBase & {
|
|
405
411
|
/** Original XML content */
|
|
406
412
|
content: string;
|
|
407
413
|
/** Parsed XML content (as JavaScript object) */
|
|
@@ -412,11 +418,11 @@ export interface ProcessedXml extends ProcessedFileBase {
|
|
|
412
418
|
errorMessage?: string;
|
|
413
419
|
/** Name of the root element */
|
|
414
420
|
rootElement?: string;
|
|
415
|
-
}
|
|
421
|
+
};
|
|
416
422
|
/**
|
|
417
423
|
* Processed Markdown result.
|
|
418
424
|
*/
|
|
419
|
-
export
|
|
425
|
+
export type ProcessedMarkdown = ProcessedFileBase & {
|
|
420
426
|
/** Original Markdown content */
|
|
421
427
|
content: string;
|
|
422
428
|
/** Total number of lines in the document */
|
|
@@ -427,11 +433,11 @@ export interface ProcessedMarkdown extends ProcessedFileBase {
|
|
|
427
433
|
hasTables: boolean;
|
|
428
434
|
/** List of headings extracted from the document */
|
|
429
435
|
headings: string[];
|
|
430
|
-
}
|
|
436
|
+
};
|
|
431
437
|
/**
|
|
432
438
|
* Processed source code result.
|
|
433
439
|
*/
|
|
434
|
-
export
|
|
440
|
+
export type ProcessedSourceCode = ProcessedFileBase & {
|
|
435
441
|
/** The source code content (may be truncated) */
|
|
436
442
|
content: string;
|
|
437
443
|
/** Detected programming language (e.g., "TypeScript", "Python") */
|
|
@@ -442,11 +448,11 @@ export interface ProcessedSourceCode extends ProcessedFileBase {
|
|
|
442
448
|
truncated: boolean;
|
|
443
449
|
/** Character encoding used to decode the file */
|
|
444
450
|
encoding: string;
|
|
445
|
-
}
|
|
451
|
+
};
|
|
446
452
|
/**
|
|
447
453
|
* Processed configuration file result.
|
|
448
454
|
*/
|
|
449
|
-
export
|
|
455
|
+
export type ProcessedConfig = ProcessedFileBase & {
|
|
450
456
|
/** The configuration file content with redacted sensitive values */
|
|
451
457
|
content: string;
|
|
452
458
|
/** Detected configuration format */
|
|
@@ -455,11 +461,11 @@ export interface ProcessedConfig extends ProcessedFileBase {
|
|
|
455
461
|
keyValues: Record<string, string>;
|
|
456
462
|
/** List of keys that were redacted for security */
|
|
457
463
|
redactedKeys: string[];
|
|
458
|
-
}
|
|
464
|
+
};
|
|
459
465
|
/**
|
|
460
466
|
* Processed OpenDocument result.
|
|
461
467
|
*/
|
|
462
|
-
export
|
|
468
|
+
export type ProcessedOpenDocument = ProcessedFileBase & {
|
|
463
469
|
/** Extracted text content */
|
|
464
470
|
textContent: string;
|
|
465
471
|
/** Document format type */
|
|
@@ -468,11 +474,11 @@ export interface ProcessedOpenDocument extends ProcessedFileBase {
|
|
|
468
474
|
paragraphCount: number;
|
|
469
475
|
/** Whether content was truncated */
|
|
470
476
|
truncated: boolean;
|
|
471
|
-
}
|
|
477
|
+
};
|
|
472
478
|
/**
|
|
473
479
|
* Processed JSON file result.
|
|
474
480
|
*/
|
|
475
|
-
export
|
|
481
|
+
export type ProcessedJson = ProcessedFileBase & {
|
|
476
482
|
/** Pretty-printed JSON content (or original content if invalid) */
|
|
477
483
|
content: string;
|
|
478
484
|
/** Original raw content before pretty-printing */
|
|
@@ -489,11 +495,11 @@ export interface ProcessedJson extends ProcessedFileBase {
|
|
|
489
495
|
arrayLength?: number;
|
|
490
496
|
/** Whether content was truncated */
|
|
491
497
|
truncated: boolean;
|
|
492
|
-
}
|
|
498
|
+
};
|
|
493
499
|
/**
|
|
494
500
|
* Processed plain text file result.
|
|
495
501
|
*/
|
|
496
|
-
export
|
|
502
|
+
export type ProcessedText = ProcessedFileBase & {
|
|
497
503
|
/** Text content (may be truncated if file is too large) */
|
|
498
504
|
content: string;
|
|
499
505
|
/** Total number of lines in the original file */
|
|
@@ -504,11 +510,11 @@ export interface ProcessedText extends ProcessedFileBase {
|
|
|
504
510
|
encoding: string;
|
|
505
511
|
/** Whether the content was truncated due to size limits */
|
|
506
512
|
truncated: boolean;
|
|
507
|
-
}
|
|
513
|
+
};
|
|
508
514
|
/**
|
|
509
515
|
* Processed HTML file result.
|
|
510
516
|
*/
|
|
511
|
-
export
|
|
517
|
+
export type ProcessedHtml = ProcessedFileBase & {
|
|
512
518
|
/** Original HTML content */
|
|
513
519
|
content: string;
|
|
514
520
|
/** Text extracted from HTML (all tags stripped) */
|
|
@@ -521,11 +527,11 @@ export interface ProcessedHtml extends ProcessedFileBase {
|
|
|
521
527
|
title?: string;
|
|
522
528
|
/** Whether the HTML contains potentially dangerous content (XSS vectors) */
|
|
523
529
|
hasDangerousContent: boolean;
|
|
524
|
-
}
|
|
530
|
+
};
|
|
525
531
|
/**
|
|
526
532
|
* Processed YAML file result.
|
|
527
533
|
*/
|
|
528
|
-
export
|
|
534
|
+
export type ProcessedYaml = ProcessedFileBase & {
|
|
529
535
|
/** Original YAML content */
|
|
530
536
|
content: string;
|
|
531
537
|
/** Parsed YAML content (as JavaScript object) */
|
|
@@ -536,11 +542,11 @@ export interface ProcessedYaml extends ProcessedFileBase {
|
|
|
536
542
|
errorMessage?: string;
|
|
537
543
|
/** YAML content converted to JSON string for AI consumption */
|
|
538
544
|
asJson: string | null;
|
|
539
|
-
}
|
|
545
|
+
};
|
|
540
546
|
/**
|
|
541
547
|
* Single worksheet extracted from an Excel file.
|
|
542
548
|
*/
|
|
543
|
-
export
|
|
549
|
+
export type ExcelWorksheet = {
|
|
544
550
|
/** Name of the worksheet (tab name in Excel) */
|
|
545
551
|
name: string;
|
|
546
552
|
/** Row data as a 2D array. Each inner array represents a row. */
|
|
@@ -551,11 +557,11 @@ export interface ExcelWorksheet {
|
|
|
551
557
|
rowCount: number;
|
|
552
558
|
/** Number of columns (based on headers or first row) */
|
|
553
559
|
columnCount: number;
|
|
554
|
-
}
|
|
560
|
+
};
|
|
555
561
|
/**
|
|
556
562
|
* Processed Excel file result.
|
|
557
563
|
*/
|
|
558
|
-
export
|
|
564
|
+
export type ProcessedExcel = ProcessedFileBase & {
|
|
559
565
|
/** Array of processed worksheets */
|
|
560
566
|
worksheets: ExcelWorksheet[];
|
|
561
567
|
/** Number of sheets processed (may be less than total if truncated) */
|
|
@@ -566,27 +572,27 @@ export interface ProcessedExcel extends ProcessedFileBase {
|
|
|
566
572
|
truncated: boolean;
|
|
567
573
|
/** Names of sheets that were truncated */
|
|
568
574
|
truncatedSheets: string[];
|
|
569
|
-
}
|
|
575
|
+
};
|
|
570
576
|
/**
|
|
571
577
|
* Processed Word document result.
|
|
572
578
|
*/
|
|
573
|
-
export
|
|
579
|
+
export type ProcessedWord = ProcessedFileBase & {
|
|
574
580
|
/** Extracted plain text content from the Word document */
|
|
575
581
|
textContent: string;
|
|
576
582
|
/** HTML representation of the Word document */
|
|
577
583
|
htmlContent: string;
|
|
578
584
|
/** Warnings from mammoth extraction (e.g., unsupported elements) */
|
|
579
585
|
warnings: string[];
|
|
580
|
-
}
|
|
586
|
+
};
|
|
581
587
|
/**
|
|
582
588
|
* Processed RTF document result.
|
|
583
589
|
*/
|
|
584
|
-
export
|
|
590
|
+
export type ProcessedRtf = ProcessedFileBase & {
|
|
585
591
|
/** Extracted plain text content from the RTF document */
|
|
586
592
|
textContent: string;
|
|
587
593
|
/** Raw RTF content (preserved for debugging/analysis) */
|
|
588
594
|
rawContent: string;
|
|
589
|
-
}
|
|
595
|
+
};
|
|
590
596
|
/**
|
|
591
597
|
* Type guard function signature for JSON parsing.
|
|
592
598
|
*/
|
|
@@ -73,5 +73,11 @@ export const PROCESSOR_PRIORITIES = {
|
|
|
73
73
|
RTF: 140,
|
|
74
74
|
/** OpenDocument format files */
|
|
75
75
|
OPENDOCUMENT: 150,
|
|
76
|
+
/** Video files */
|
|
77
|
+
VIDEO: 160,
|
|
78
|
+
/** Audio files */
|
|
79
|
+
AUDIO: 170,
|
|
80
|
+
/** Archive files */
|
|
81
|
+
ARCHIVE: 180,
|
|
76
82
|
};
|
|
77
83
|
//# sourceMappingURL=types.js.map
|
|
@@ -32,18 +32,18 @@ import type { FileInfo } from "../base/types.js";
|
|
|
32
32
|
/**
|
|
33
33
|
* Options for CLI file processing
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type CliFileProcessingOptions = {
|
|
36
36
|
/** Verbose output - shows processing details */
|
|
37
37
|
verbose?: boolean;
|
|
38
38
|
/** Processor to use (bypasses auto-detection) */
|
|
39
39
|
processor?: string;
|
|
40
40
|
/** Output format: json, text, or raw */
|
|
41
41
|
outputFormat?: "json" | "text" | "raw";
|
|
42
|
-
}
|
|
42
|
+
};
|
|
43
43
|
/**
|
|
44
44
|
* Result of CLI file processing
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export type CliProcessingResult = {
|
|
47
47
|
/** Whether processing succeeded */
|
|
48
48
|
success: boolean;
|
|
49
49
|
/** Name of the processor that was used */
|
|
@@ -52,11 +52,11 @@ export interface CliProcessingResult {
|
|
|
52
52
|
output: string;
|
|
53
53
|
/** Error message if processing failed */
|
|
54
54
|
error?: string;
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
/**
|
|
57
57
|
* Information about a supported file type
|
|
58
58
|
*/
|
|
59
|
-
export
|
|
59
|
+
export type SupportedFileTypeInfo = {
|
|
60
60
|
/** Processor name */
|
|
61
61
|
name: string;
|
|
62
62
|
/** Priority (lower = processed first) */
|
|
@@ -67,7 +67,7 @@ export interface SupportedFileTypeInfo {
|
|
|
67
67
|
mimeTypes: string[];
|
|
68
68
|
/** Optional description */
|
|
69
69
|
description?: string;
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
/**
|
|
72
72
|
* Load a file from the filesystem and create a FileInfo object.
|
|
73
73
|
*
|
|
@@ -117,7 +117,7 @@ export declare function processFileFromPath(filePath: string, options?: CliFileP
|
|
|
117
117
|
* }
|
|
118
118
|
* ```
|
|
119
119
|
*/
|
|
120
|
-
export declare function getSupportedFileTypes(): SupportedFileTypeInfo[]
|
|
120
|
+
export declare function getSupportedFileTypes(): Promise<SupportedFileTypeInfo[]>;
|
|
121
121
|
/**
|
|
122
122
|
* List all supported file types formatted for CLI display.
|
|
123
123
|
*
|
|
@@ -128,7 +128,7 @@ export declare function getSupportedFileTypes(): SupportedFileTypeInfo[];
|
|
|
128
128
|
* console.log(listSupportedFileTypes());
|
|
129
129
|
* ```
|
|
130
130
|
*/
|
|
131
|
-
export declare function listSupportedFileTypes(): string
|
|
131
|
+
export declare function listSupportedFileTypes(): Promise<string>;
|
|
132
132
|
/**
|
|
133
133
|
* Get CLI usage information for file processing commands.
|
|
134
134
|
*
|
|
@@ -114,7 +114,7 @@ export async function processFileFromPath(filePath, options) {
|
|
|
114
114
|
logger.info(` Size: ${fileInfo.size} bytes`);
|
|
115
115
|
logger.info(` MIME: ${fileInfo.mimetype}`);
|
|
116
116
|
}
|
|
117
|
-
const registry = getProcessorRegistry();
|
|
117
|
+
const registry = await getProcessorRegistry();
|
|
118
118
|
// If a specific processor is requested, use it directly
|
|
119
119
|
if (options?.processor) {
|
|
120
120
|
const processorReg = registry.getProcessor(options.processor);
|
|
@@ -248,8 +248,8 @@ function formatOutput(data, format) {
|
|
|
248
248
|
* }
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
|
-
export function getSupportedFileTypes() {
|
|
252
|
-
const registry = getProcessorRegistry();
|
|
251
|
+
export async function getSupportedFileTypes() {
|
|
252
|
+
const registry = await getProcessorRegistry();
|
|
253
253
|
const processors = registry.listProcessors();
|
|
254
254
|
return processors.map((proc) => {
|
|
255
255
|
// Extract config from processor via public getConfig() method
|
|
@@ -273,8 +273,8 @@ export function getSupportedFileTypes() {
|
|
|
273
273
|
* console.log(listSupportedFileTypes());
|
|
274
274
|
* ```
|
|
275
275
|
*/
|
|
276
|
-
export function listSupportedFileTypes() {
|
|
277
|
-
const types = getSupportedFileTypes();
|
|
276
|
+
export async function listSupportedFileTypes() {
|
|
277
|
+
const types = await getSupportedFileTypes();
|
|
278
278
|
if (types.length === 0) {
|
|
279
279
|
return "No processors registered. Initialize the processor registry first.";
|
|
280
280
|
}
|