@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.
- package/CHANGELOG.md +16 -0
- package/README.md +29 -25
- 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/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/conversationMemoryManager.d.ts +5 -15
- package/dist/core/conversationMemoryManager.js +15 -75
- 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 +8 -14
- package/dist/core/redisConversationMemoryManager.js +69 -78
- 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/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/conversationMemoryManager.d.ts +5 -15
- package/dist/lib/core/conversationMemoryManager.js +15 -75
- 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 +8 -14
- package/dist/lib/core/redisConversationMemoryManager.js +69 -78
- 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/memory/mem0Initializer.d.ts +2 -2
- package/dist/lib/neurolink.d.ts +61 -2
- package/dist/lib/neurolink.js +619 -307
- 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/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/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/googleAiStudio.d.ts +34 -0
- package/dist/lib/providers/googleAiStudio.js +267 -397
- package/dist/lib/providers/googleVertex.d.ts +55 -1
- package/dist/lib/providers/googleVertex.js +452 -719
- 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/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/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 +22 -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 +481 -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 +11 -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 +76 -36
- 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/rateLimiter.d.ts +2 -2
- 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/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/memory/mem0Initializer.d.ts +2 -2
- package/dist/neurolink.d.ts +61 -2
- package/dist/neurolink.js +619 -307
- 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/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/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/googleAiStudio.d.ts +34 -0
- package/dist/providers/googleAiStudio.js +267 -397
- package/dist/providers/googleVertex.d.ts +55 -1
- package/dist/providers/googleVertex.js +452 -719
- 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/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/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 +22 -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 +481 -0
- package/dist/types/ragTypes.js +7 -0
- package/dist/types/sdkTypes.d.ts +17 -18
- package/dist/types/streamTypes.d.ts +11 -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 +76 -36
- 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/rateLimiter.d.ts +2 -2
- 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/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,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Processors Module
|
|
3
|
+
*
|
|
4
|
+
* Barrel export for media file processors (video, audio).
|
|
5
|
+
* Provides processors for extracting AI-consumable content from multimedia files.
|
|
6
|
+
*
|
|
7
|
+
* @module processors/media
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {
|
|
12
|
+
* videoProcessor,
|
|
13
|
+
* isVideoFile,
|
|
14
|
+
* processVideo,
|
|
15
|
+
* type ProcessedVideo,
|
|
16
|
+
* } from "./media/index.js";
|
|
17
|
+
*
|
|
18
|
+
* if (isVideoFile(file.mimetype, file.name)) {
|
|
19
|
+
* const result = await processVideo(fileInfo);
|
|
20
|
+
* if (result.success) {
|
|
21
|
+
* console.log(result.data.textContent);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type { ProcessedVideo } from "./VideoProcessor.js";
|
|
27
|
+
export { isVideoFile, processVideo, VideoProcessor, videoProcessor, } from "./VideoProcessor.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Processors Module
|
|
3
|
+
*
|
|
4
|
+
* Barrel export for media file processors (video, audio).
|
|
5
|
+
* Provides processors for extracting AI-consumable content from multimedia files.
|
|
6
|
+
*
|
|
7
|
+
* @module processors/media
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {
|
|
12
|
+
* videoProcessor,
|
|
13
|
+
* isVideoFile,
|
|
14
|
+
* processVideo,
|
|
15
|
+
* type ProcessedVideo,
|
|
16
|
+
* } from "./media/index.js";
|
|
17
|
+
*
|
|
18
|
+
* if (isVideoFile(file.mimetype, file.name)) {
|
|
19
|
+
* const result = await processVideo(fileInfo);
|
|
20
|
+
* if (result.success) {
|
|
21
|
+
* console.log(result.data.textContent);
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export { isVideoFile, processVideo, VideoProcessor, videoProcessor, } from "./VideoProcessor.js";
|
|
27
|
+
// =============================================================================
|
|
28
|
+
// AUDIO PROCESSOR (placeholder for future implementation)
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// export {
|
|
31
|
+
// AudioProcessor,
|
|
32
|
+
// audioProcessor,
|
|
33
|
+
// isAudioFile,
|
|
34
|
+
// processAudio,
|
|
35
|
+
// } from "./AudioProcessor.js";
|
|
36
|
+
// export type { ProcessedAudio } from "./AudioProcessor.js";
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Central registry for file processors with priority-based selection.
|
|
5
5
|
* Uses singleton pattern to ensure a single source of truth for processor registration.
|
|
6
6
|
*
|
|
7
|
+
* All 16 BaseFileProcessor-based processors are auto-registered on first access
|
|
8
|
+
* via getProcessorRegistry(). Legacy processors (CSV, Image, PDF, PPTX) that use
|
|
9
|
+
* static methods and don't extend BaseFileProcessor are excluded — they continue
|
|
10
|
+
* to be routed via the switch/case in FileDetector.processFile().
|
|
11
|
+
*
|
|
7
12
|
* Key features:
|
|
8
13
|
* - Priority-based processor selection (lower number = higher priority)
|
|
9
14
|
* - Confidence scoring for match quality
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
* ```typescript
|
|
18
23
|
* import { ProcessorRegistry, getProcessorRegistry, PROCESSOR_PRIORITIES } from "./registry/index.js";
|
|
19
24
|
*
|
|
20
|
-
* const registry = getProcessorRegistry();
|
|
25
|
+
* const registry = await getProcessorRegistry();
|
|
21
26
|
*
|
|
22
27
|
* // Register a processor
|
|
23
28
|
* registry.register({
|
|
@@ -319,16 +324,25 @@ export declare class ProcessorRegistry {
|
|
|
319
324
|
}
|
|
320
325
|
/**
|
|
321
326
|
* Get the ProcessorRegistry singleton instance.
|
|
327
|
+
* On first call, auto-initializes with all 16 default processors.
|
|
322
328
|
* Convenience function for shorter imports.
|
|
323
329
|
*
|
|
324
|
-
* @returns The ProcessorRegistry singleton
|
|
330
|
+
* @returns The ProcessorRegistry singleton (auto-initialized with default processors)
|
|
325
331
|
*
|
|
326
332
|
* @example
|
|
327
333
|
* ```typescript
|
|
328
334
|
* import { getProcessorRegistry } from "./registry/index.js";
|
|
329
335
|
*
|
|
330
|
-
* const registry = getProcessorRegistry();
|
|
331
|
-
* registry.
|
|
336
|
+
* const registry = await getProcessorRegistry();
|
|
337
|
+
* const match = registry.findProcessor("image/svg+xml", "icon.svg");
|
|
332
338
|
* ```
|
|
333
339
|
*/
|
|
334
|
-
export declare const getProcessorRegistry: () => ProcessorRegistry
|
|
340
|
+
export declare const getProcessorRegistry: () => Promise<ProcessorRegistry>;
|
|
341
|
+
/**
|
|
342
|
+
* Get the ProcessorRegistry singleton instance synchronously (without auto-initialization).
|
|
343
|
+
* Use this when you know the registry is already initialized, or when you only
|
|
344
|
+
* need the raw registry instance (e.g., for manual registration in tests).
|
|
345
|
+
*
|
|
346
|
+
* @returns The ProcessorRegistry singleton (may be empty if not yet initialized)
|
|
347
|
+
*/
|
|
348
|
+
export declare const getProcessorRegistrySync: () => ProcessorRegistry;
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Central registry for file processors with priority-based selection.
|
|
5
5
|
* Uses singleton pattern to ensure a single source of truth for processor registration.
|
|
6
6
|
*
|
|
7
|
+
* All 16 BaseFileProcessor-based processors are auto-registered on first access
|
|
8
|
+
* via getProcessorRegistry(). Legacy processors (CSV, Image, PDF, PPTX) that use
|
|
9
|
+
* static methods and don't extend BaseFileProcessor are excluded — they continue
|
|
10
|
+
* to be routed via the switch/case in FileDetector.processFile().
|
|
11
|
+
*
|
|
7
12
|
* Key features:
|
|
8
13
|
* - Priority-based processor selection (lower number = higher priority)
|
|
9
14
|
* - Confidence scoring for match quality
|
|
@@ -17,7 +22,7 @@
|
|
|
17
22
|
* ```typescript
|
|
18
23
|
* import { ProcessorRegistry, getProcessorRegistry, PROCESSOR_PRIORITIES } from "./registry/index.js";
|
|
19
24
|
*
|
|
20
|
-
* const registry = getProcessorRegistry();
|
|
25
|
+
* const registry = await getProcessorRegistry();
|
|
21
26
|
*
|
|
22
27
|
* // Register a processor
|
|
23
28
|
* registry.register({
|
|
@@ -566,13 +571,13 @@ export class ProcessorRegistry {
|
|
|
566
571
|
return "Convert ICO files to PNG format before uploading.";
|
|
567
572
|
}
|
|
568
573
|
if ([".zip", ".rar", ".7z", ".tar", ".gz"].includes(ext)) {
|
|
569
|
-
return "
|
|
574
|
+
return "Archive files are now supported. NeuroLink will list contents and extract metadata.";
|
|
570
575
|
}
|
|
571
576
|
if ([".mp4", ".avi", ".mov", ".mkv", ".wmv"].includes(ext)) {
|
|
572
|
-
return "Video files are
|
|
577
|
+
return "Video files are now supported. NeuroLink will extract metadata and keyframes.";
|
|
573
578
|
}
|
|
574
579
|
if ([".mp3", ".wav", ".aac", ".ogg", ".flac"].includes(ext)) {
|
|
575
|
-
return "Audio files are
|
|
580
|
+
return "Audio files are now supported. NeuroLink will extract metadata and tags.";
|
|
576
581
|
}
|
|
577
582
|
if ([".psd", ".ai", ".sketch"].includes(ext)) {
|
|
578
583
|
return "Export design files to PNG, PDF, or SVG format before uploading.";
|
|
@@ -589,20 +594,110 @@ export class ProcessorRegistry {
|
|
|
589
594
|
}
|
|
590
595
|
}
|
|
591
596
|
// =============================================================================
|
|
597
|
+
// DEFAULT PROCESSOR REGISTRATION
|
|
598
|
+
// =============================================================================
|
|
599
|
+
/**
|
|
600
|
+
* Register all 16 BaseFileProcessor-based processors with the registry.
|
|
601
|
+
*
|
|
602
|
+
* Legacy processors (CSV, Image, PDF, PPTX) that use static methods and don't
|
|
603
|
+
* extend BaseFileProcessor are excluded — they continue to be routed via the
|
|
604
|
+
* switch/case in FileDetector.processFile().
|
|
605
|
+
*
|
|
606
|
+
* Uses dynamic imports to avoid circular dependencies and enable tree-shaking.
|
|
607
|
+
* Each processor is registered with its priority from PROCESSOR_PRIORITIES,
|
|
608
|
+
* and uses the processor's own isFileSupported() method for detection.
|
|
609
|
+
*
|
|
610
|
+
* @param registry - The ProcessorRegistry instance to register processors into
|
|
611
|
+
*/
|
|
612
|
+
async function initializeDefaultProcessors(registry) {
|
|
613
|
+
// Import all processor singletons via barrel exports
|
|
614
|
+
// Use dynamic import to avoid circular dependency issues
|
|
615
|
+
const [markup, code, data, document, media, archive, priorities] = await Promise.all([
|
|
616
|
+
import("../markup/index.js"),
|
|
617
|
+
import("../code/index.js"),
|
|
618
|
+
import("../data/index.js"),
|
|
619
|
+
import("../document/index.js"),
|
|
620
|
+
import("../media/AudioProcessor.js"),
|
|
621
|
+
import("../archive/ArchiveProcessor.js"),
|
|
622
|
+
import("../base/types.js"),
|
|
623
|
+
]);
|
|
624
|
+
// Also import video separately (same pattern as audio)
|
|
625
|
+
const video = await import("../media/VideoProcessor.js");
|
|
626
|
+
const { PROCESSOR_PRIORITIES: P } = priorities;
|
|
627
|
+
// Registration helper — wraps register() with allowDuplicates to be idempotent
|
|
628
|
+
const reg = (name, priority, processor, description, aliases) => {
|
|
629
|
+
registry.register({
|
|
630
|
+
name,
|
|
631
|
+
priority,
|
|
632
|
+
processor,
|
|
633
|
+
isSupported: (mimetype, filename) => processor.isFileSupported(mimetype, filename),
|
|
634
|
+
description,
|
|
635
|
+
aliases,
|
|
636
|
+
}, { allowDuplicates: true });
|
|
637
|
+
};
|
|
638
|
+
// ── Markup processors ────────────────────────────────────────────────────
|
|
639
|
+
reg("svg", P.SVG, markup.svgProcessor, "SVG vector graphics (processed as text, not image)", ["svgz"]);
|
|
640
|
+
reg("html", P.HTML, markup.htmlProcessor, "HTML web content with OWASP-compliant sanitization", ["htm", "xhtml"]);
|
|
641
|
+
reg("markdown", P.MARKDOWN, markup.markdownProcessor, "Markdown structured text", ["md", "mdx"]);
|
|
642
|
+
reg("text", P.TEXT, markup.textProcessor, "Plain text files", ["txt", "log"]);
|
|
643
|
+
// ── Code processors ──────────────────────────────────────────────────────
|
|
644
|
+
reg("source_code", P.SOURCE_CODE, code.sourceCodeProcessor, "Source code files (50+ languages)", ["ts", "js", "py", "java", "go", "rs", "cpp"]);
|
|
645
|
+
reg("config", P.CONFIG, code.configProcessor, "Configuration files (.env, .ini, .toml, .cfg)", ["env", "ini", "toml", "cfg"]);
|
|
646
|
+
// ── Data processors ──────────────────────────────────────────────────────
|
|
647
|
+
reg("json", P.JSON, data.jsonProcessor, "JSON data files", ["json", "jsonl", "geojson"]);
|
|
648
|
+
reg("yaml", P.YAML, data.yamlProcessor, "YAML configuration and data files", ["yaml", "yml"]);
|
|
649
|
+
reg("xml", P.XML, data.xmlProcessor, "XML data files", ["xml", "xsd", "xsl"]);
|
|
650
|
+
// ── Document processors ──────────────────────────────────────────────────
|
|
651
|
+
reg("excel", P.EXCEL, document.excelProcessor, "Excel spreadsheets with sheet extraction", ["xlsx", "xls"]);
|
|
652
|
+
reg("word", P.WORD, document.wordProcessor, "Word documents with text extraction", ["docx"]);
|
|
653
|
+
reg("rtf", P.RTF, document.rtfProcessor, "RTF documents", ["rtf"]);
|
|
654
|
+
reg("opendocument", P.OPENDOCUMENT, document.openDocumentProcessor, "OpenDocument format files", ["odt", "ods", "odp"]);
|
|
655
|
+
// ── Media processors ─────────────────────────────────────────────────────
|
|
656
|
+
reg("audio", P.AUDIO, media.audioProcessor, "Audio files with metadata and tag extraction", ["mp3", "wav", "ogg", "flac", "aac", "m4a", "wma"]);
|
|
657
|
+
reg("video", P.VIDEO, video.videoProcessor, "Video files with metadata and keyframe extraction", ["mp4", "mkv", "webm", "avi", "mov", "m4v"]);
|
|
658
|
+
// ── Archive processors ───────────────────────────────────────────────────
|
|
659
|
+
reg("archive", P.ARCHIVE, archive.archiveProcessor, "Archive files with content listing", ["zip", "tar", "gz", "tgz"]);
|
|
660
|
+
registry.markInitialized();
|
|
661
|
+
}
|
|
662
|
+
// =============================================================================
|
|
592
663
|
// CONVENIENCE EXPORT
|
|
593
664
|
// =============================================================================
|
|
665
|
+
/** Promise tracking the ongoing initialization (prevents double-init races) */
|
|
666
|
+
let initPromise = null;
|
|
594
667
|
/**
|
|
595
668
|
* Get the ProcessorRegistry singleton instance.
|
|
669
|
+
* On first call, auto-initializes with all 16 default processors.
|
|
596
670
|
* Convenience function for shorter imports.
|
|
597
671
|
*
|
|
598
|
-
* @returns The ProcessorRegistry singleton
|
|
672
|
+
* @returns The ProcessorRegistry singleton (auto-initialized with default processors)
|
|
599
673
|
*
|
|
600
674
|
* @example
|
|
601
675
|
* ```typescript
|
|
602
676
|
* import { getProcessorRegistry } from "./registry/index.js";
|
|
603
677
|
*
|
|
604
|
-
* const registry = getProcessorRegistry();
|
|
605
|
-
* registry.
|
|
678
|
+
* const registry = await getProcessorRegistry();
|
|
679
|
+
* const match = registry.findProcessor("image/svg+xml", "icon.svg");
|
|
606
680
|
* ```
|
|
607
681
|
*/
|
|
608
|
-
export const getProcessorRegistry = () =>
|
|
682
|
+
export const getProcessorRegistry = async () => {
|
|
683
|
+
const registry = ProcessorRegistry.getInstance();
|
|
684
|
+
if (!registry.isInitialized()) {
|
|
685
|
+
if (!initPromise) {
|
|
686
|
+
initPromise = initializeDefaultProcessors(registry).catch((err) => {
|
|
687
|
+
// Reset so next call retries
|
|
688
|
+
initPromise = null;
|
|
689
|
+
throw err;
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
await initPromise;
|
|
693
|
+
}
|
|
694
|
+
return registry;
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* Get the ProcessorRegistry singleton instance synchronously (without auto-initialization).
|
|
698
|
+
* Use this when you know the registry is already initialized, or when you only
|
|
699
|
+
* need the raw registry instance (e.g., for manual registration in tests).
|
|
700
|
+
*
|
|
701
|
+
* @returns The ProcessorRegistry singleton (may be empty if not yet initialized)
|
|
702
|
+
*/
|
|
703
|
+
export const getProcessorRegistrySync = () => ProcessorRegistry.getInstance();
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
export type { ProcessorMatch, ProcessorPriorityKey, ProcessorPriorityValue, RegistryOptions, RegistryProcessResult, UnsupportedFileError, } from "../base/types.js";
|
|
10
10
|
export type { ProcessorRegistration } from "./types.js";
|
|
11
11
|
export { PROCESSOR_PRIORITIES } from "../base/types.js";
|
|
12
|
-
export { getProcessorRegistry, ProcessorRegistry, } from "./ProcessorRegistry.js";
|
|
12
|
+
export { getProcessorRegistry, getProcessorRegistrySync, ProcessorRegistry, } from "./ProcessorRegistry.js";
|
|
@@ -13,4 +13,4 @@ export { PROCESSOR_PRIORITIES } from "../base/types.js";
|
|
|
13
13
|
// =============================================================================
|
|
14
14
|
// CLASS EXPORTS
|
|
15
15
|
// =============================================================================
|
|
16
|
-
export { getProcessorRegistry, ProcessorRegistry, } from "./ProcessorRegistry.js";
|
|
16
|
+
export { getProcessorRegistry, getProcessorRegistrySync, ProcessorRegistry, } from "./ProcessorRegistry.js";
|
|
@@ -28,7 +28,7 @@ import type { ProcessedFileBase } from "../base/types.js";
|
|
|
28
28
|
* };
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type ProcessorRegistration<T extends ProcessedFileBase = ProcessedFileBase> = {
|
|
32
32
|
/** Unique name for the processor */
|
|
33
33
|
name: string;
|
|
34
34
|
/**
|
|
@@ -50,4 +50,4 @@ export interface ProcessorRegistration<T extends ProcessedFileBase = ProcessedFi
|
|
|
50
50
|
description?: string;
|
|
51
51
|
/** Alternative names that can be used to look up this processor */
|
|
52
52
|
aliases?: string[];
|
|
53
|
-
}
|
|
53
|
+
};
|
|
@@ -74,6 +74,40 @@ export declare class GoogleAIStudioProvider extends BaseProvider {
|
|
|
74
74
|
* Override generate to route Gemini 3 models with tools to native SDK
|
|
75
75
|
*/
|
|
76
76
|
generate(optionsOrPrompt: TextGenerationOptions | string): Promise<EnhancedGenerateResult | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Convert Vercel AI SDK tools to @google/genai FunctionDeclarations and an execute map.
|
|
79
|
+
* Shared by executeNativeGemini3Stream and executeNativeGemini3Generate.
|
|
80
|
+
*/
|
|
81
|
+
private buildNativeToolDeclarations;
|
|
82
|
+
/**
|
|
83
|
+
* Build the native @google/genai config object shared by stream and generate.
|
|
84
|
+
*/
|
|
85
|
+
private buildNativeConfig;
|
|
86
|
+
/**
|
|
87
|
+
* Compute a safe, clamped maxSteps value.
|
|
88
|
+
*/
|
|
89
|
+
private computeMaxSteps;
|
|
90
|
+
/**
|
|
91
|
+
* Process stream chunks to extract raw response parts, function calls, and usage metadata.
|
|
92
|
+
* Shared by executeNativeGemini3Stream and executeNativeGemini3Generate.
|
|
93
|
+
*/
|
|
94
|
+
private collectStreamChunks;
|
|
95
|
+
/**
|
|
96
|
+
* Extract text from raw response parts. Used after collectStreamChunks.
|
|
97
|
+
*/
|
|
98
|
+
private extractTextFromParts;
|
|
99
|
+
/**
|
|
100
|
+
* Execute a batch of function calls with retry tracking and permanent failure detection.
|
|
101
|
+
* Shared by executeNativeGemini3Stream and executeNativeGemini3Generate.
|
|
102
|
+
*
|
|
103
|
+
* Returns function responses for history and optional tool execution records for generate.
|
|
104
|
+
*/
|
|
105
|
+
private executeNativeToolCalls;
|
|
106
|
+
/**
|
|
107
|
+
* Handle maxSteps termination by producing a final text when the model
|
|
108
|
+
* was still calling tools when the step limit was reached.
|
|
109
|
+
*/
|
|
110
|
+
private handleMaxStepsTermination;
|
|
77
111
|
private executeAudioStreamViaGeminiLive;
|
|
78
112
|
private getApiKey;
|
|
79
113
|
}
|