@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,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Reference Architecture Types (canonical location)
|
|
3
|
+
*
|
|
4
|
+
* Types for the lazy on-demand file processing system.
|
|
5
|
+
* Files are registered as lightweight references with metadata and previews.
|
|
6
|
+
* Full content is processed on-demand when the LLM requests it via tools.
|
|
7
|
+
*/
|
|
8
|
+
import type { FileSource, FileType } from "./fileTypes.js";
|
|
9
|
+
/**
|
|
10
|
+
* Size tier determines the processing strategy for a file.
|
|
11
|
+
*
|
|
12
|
+
* - tiny: Inline in prompt (current behavior)
|
|
13
|
+
* - small: Full load, truncate to budget
|
|
14
|
+
* - medium: Outline + on-demand sections
|
|
15
|
+
* - large: Stream + chunked summarization
|
|
16
|
+
* - huge: Reference only + tool-based access
|
|
17
|
+
* - oversized: Reject with informative message
|
|
18
|
+
*/
|
|
19
|
+
export type SizeTier = "tiny" | "small" | "medium" | "large" | "huge" | "oversized";
|
|
20
|
+
/**
|
|
21
|
+
* Processing status of a file reference
|
|
22
|
+
*/
|
|
23
|
+
export type FileReferenceStatus = "registered" | "previewed" | "processing" | "processed" | "error";
|
|
24
|
+
/**
|
|
25
|
+
* A section in a file outline (used for code, PDFs, spreadsheets)
|
|
26
|
+
*/
|
|
27
|
+
export type OutlineSection = {
|
|
28
|
+
/** Section heading/name (e.g., function name, class name, sheet name) */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Type of section (function, class, import, sheet, page, heading) */
|
|
31
|
+
kind: string;
|
|
32
|
+
/** Starting line number (1-indexed) */
|
|
33
|
+
startLine: number;
|
|
34
|
+
/** Ending line number (1-indexed) */
|
|
35
|
+
endLine: number;
|
|
36
|
+
/** Nesting depth (0 = top-level) */
|
|
37
|
+
depth: number;
|
|
38
|
+
/** Child sections (e.g., methods within a class) */
|
|
39
|
+
children?: OutlineSection[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A lightweight reference to a file registered for on-demand processing.
|
|
43
|
+
*
|
|
44
|
+
* Registration is fast (~1ms): only stat + magic bytes + first 1KB preview.
|
|
45
|
+
* Full processing is deferred until the LLM requests it via tools.
|
|
46
|
+
*/
|
|
47
|
+
export type FileReference = {
|
|
48
|
+
/** Unique identifier (UUID v4) */
|
|
49
|
+
id: string;
|
|
50
|
+
/** How the file was provided */
|
|
51
|
+
source: FileSource;
|
|
52
|
+
/** Original file path or URL */
|
|
53
|
+
originalPath?: string;
|
|
54
|
+
/** Display name */
|
|
55
|
+
filename: string;
|
|
56
|
+
/** Original file size in bytes */
|
|
57
|
+
sizeBytes: number;
|
|
58
|
+
/** Detected file type from magic bytes / extension */
|
|
59
|
+
detectedType: FileType;
|
|
60
|
+
/** Detected MIME type */
|
|
61
|
+
mimeType: string;
|
|
62
|
+
/** Size tier determining processing strategy */
|
|
63
|
+
sizeTier: SizeTier;
|
|
64
|
+
/** Estimated tokens after processing (type-aware) */
|
|
65
|
+
estimatedTokens: number;
|
|
66
|
+
/** First ~500 tokens of content (lightweight preview) */
|
|
67
|
+
preview: string;
|
|
68
|
+
/** Current processing status */
|
|
69
|
+
status: FileReferenceStatus;
|
|
70
|
+
/** LLM-generated summary (populated lazily via summarize_file tool) */
|
|
71
|
+
summary?: string;
|
|
72
|
+
/** Structural outline for code/docs (populated lazily) */
|
|
73
|
+
outlineSections?: OutlineSection[];
|
|
74
|
+
/** Path in temp directory where buffer is persisted */
|
|
75
|
+
tempPath?: string;
|
|
76
|
+
/** Provider file API ID (for Anthropic Files API, Gemini File API, etc.) */
|
|
77
|
+
providerId?: string;
|
|
78
|
+
/** Full processed content (cached after first full processing) */
|
|
79
|
+
processedContent?: string;
|
|
80
|
+
/** Extracted images (e.g., video keyframes, PPTX slide images) */
|
|
81
|
+
extractedImages?: Buffer[];
|
|
82
|
+
/** Timestamp when the file was registered */
|
|
83
|
+
registeredAt: number;
|
|
84
|
+
/** Timestamp when the file was last accessed (for LRU eviction) */
|
|
85
|
+
lastAccessedAt: number;
|
|
86
|
+
/** Total line count (for text files, populated on first read) */
|
|
87
|
+
totalLines?: number;
|
|
88
|
+
/** File extension (e.g., 'py', 'xlsx', 'mp4') */
|
|
89
|
+
extension?: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Options for registering a file
|
|
93
|
+
*/
|
|
94
|
+
export type FileRegistrationOptions = {
|
|
95
|
+
/** Override filename detection */
|
|
96
|
+
filename?: string;
|
|
97
|
+
/** Override file type detection */
|
|
98
|
+
fileType?: FileType;
|
|
99
|
+
/** Maximum preview length in characters */
|
|
100
|
+
maxPreviewChars?: number;
|
|
101
|
+
/** Skip persisting buffer to temp directory */
|
|
102
|
+
skipTempPersist?: boolean;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Result of reading a file section
|
|
106
|
+
*/
|
|
107
|
+
export type FileReadResult = {
|
|
108
|
+
/** The content that was read */
|
|
109
|
+
content: string;
|
|
110
|
+
/** Starting line number (1-indexed) */
|
|
111
|
+
startLine: number;
|
|
112
|
+
/** Ending line number (1-indexed) */
|
|
113
|
+
endLine: number;
|
|
114
|
+
/** Total lines in the file */
|
|
115
|
+
totalLines: number;
|
|
116
|
+
/** Whether the content was truncated to fit token budget */
|
|
117
|
+
truncated: boolean;
|
|
118
|
+
/** Number of tokens in the returned content */
|
|
119
|
+
estimatedTokens: number;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Result of searching within a file
|
|
123
|
+
*/
|
|
124
|
+
export type FileSearchResult = {
|
|
125
|
+
/** Matching lines with context */
|
|
126
|
+
matches: FileSearchMatch[];
|
|
127
|
+
/** Total number of matches found */
|
|
128
|
+
totalMatches: number;
|
|
129
|
+
/** Whether results were truncated */
|
|
130
|
+
truncated: boolean;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* A single search match within a file
|
|
134
|
+
*/
|
|
135
|
+
export type FileSearchMatch = {
|
|
136
|
+
/** Line number (1-indexed) */
|
|
137
|
+
lineNumber: number;
|
|
138
|
+
/** The matching line content */
|
|
139
|
+
line: string;
|
|
140
|
+
/** Context lines before the match */
|
|
141
|
+
contextBefore: string[];
|
|
142
|
+
/** Context lines after the match */
|
|
143
|
+
contextAfter: string[];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Options for the streaming reader
|
|
147
|
+
*/
|
|
148
|
+
export type StreamingReaderOptions = {
|
|
149
|
+
/** Maximum tokens to read (stops when budget exhausted) */
|
|
150
|
+
tokenBudget?: number;
|
|
151
|
+
/** Starting line number (1-indexed, default 1) */
|
|
152
|
+
startLine?: number;
|
|
153
|
+
/** Ending line number (1-indexed, default EOF) */
|
|
154
|
+
endLine?: number;
|
|
155
|
+
/** Encoding (default 'utf-8') */
|
|
156
|
+
encoding?: BufferEncoding;
|
|
157
|
+
/** Provider name for token estimation multiplier */
|
|
158
|
+
provider?: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Parameters for targeted content extraction via extract_file_content tool.
|
|
162
|
+
* Different file types use different subsets of these parameters.
|
|
163
|
+
*/
|
|
164
|
+
export type FileExtractionParams = {
|
|
165
|
+
/** File ID (UUID) or filename */
|
|
166
|
+
file_id: string;
|
|
167
|
+
/** Start timestamp in seconds (video) */
|
|
168
|
+
start_time?: number;
|
|
169
|
+
/** End timestamp in seconds (video) */
|
|
170
|
+
end_time?: number;
|
|
171
|
+
/** Number of frames to extract in range (video, default: 5) */
|
|
172
|
+
frame_count?: number;
|
|
173
|
+
/** Specific page/slide numbers (1-indexed) */
|
|
174
|
+
pages?: number[];
|
|
175
|
+
/** Page range (1-indexed, inclusive) */
|
|
176
|
+
page_range?: {
|
|
177
|
+
start: number;
|
|
178
|
+
end: number;
|
|
179
|
+
};
|
|
180
|
+
/** Sheet name or 0-based index */
|
|
181
|
+
sheet?: string | number;
|
|
182
|
+
/** Row range (1-indexed) */
|
|
183
|
+
row_range?: {
|
|
184
|
+
start: number;
|
|
185
|
+
end: number;
|
|
186
|
+
};
|
|
187
|
+
/** Specific columns (e.g., ["A", "B", "D"]) */
|
|
188
|
+
columns?: string[];
|
|
189
|
+
/** File path within the archive */
|
|
190
|
+
entry_path?: string;
|
|
191
|
+
/** Output format hint */
|
|
192
|
+
format?: "text" | "detailed" | "summary";
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Result of targeted content extraction.
|
|
196
|
+
* May contain text, images, or both depending on the extraction type.
|
|
197
|
+
*/
|
|
198
|
+
export type FileExtractionResult = {
|
|
199
|
+
/** Whether the extraction succeeded */
|
|
200
|
+
success: boolean;
|
|
201
|
+
/** Extracted text content */
|
|
202
|
+
text?: string;
|
|
203
|
+
/** Extracted images as JPEG buffers (e.g., video frames, slide renders) */
|
|
204
|
+
images?: Buffer[];
|
|
205
|
+
/** Metadata about the extraction */
|
|
206
|
+
metadata?: Record<string, unknown>;
|
|
207
|
+
/** Error message if extraction failed */
|
|
208
|
+
error?: string;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Options for the file reference registry
|
|
212
|
+
*/
|
|
213
|
+
export type FileRegistryOptions = {
|
|
214
|
+
/** Directory for persisting file buffers (default: os.tmpdir()/neurolink-files/) */
|
|
215
|
+
tempDir?: string;
|
|
216
|
+
/** Maximum number of file references to keep (LRU eviction, default: 100) */
|
|
217
|
+
maxFiles?: number;
|
|
218
|
+
/** Maximum total bytes to persist to temp (default: 1GB) */
|
|
219
|
+
maxTempBytes?: number;
|
|
220
|
+
/** Default preview length in characters (default: 2000) */
|
|
221
|
+
defaultPreviewChars?: number;
|
|
222
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Reference Architecture Types (canonical location)
|
|
3
|
+
*
|
|
4
|
+
* Types for the lazy on-demand file processing system.
|
|
5
|
+
* Files are registered as lightweight references with metadata and previews.
|
|
6
|
+
* Full content is processed on-demand when the LLM requests it via tools.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=fileReferenceTypes.js.map
|
|
@@ -4,15 +4,34 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported file types for multimodal input
|
|
6
6
|
*/
|
|
7
|
-
export type FileType = "csv" | "image" | "pdf" | "audio" | "text" | "svg" | "docx" | "pptx" | "xlsx" | "unknown";
|
|
7
|
+
export type FileType = "csv" | "image" | "pdf" | "audio" | "video" | "archive" | "text" | "svg" | "docx" | "pptx" | "xlsx" | "unknown";
|
|
8
8
|
/**
|
|
9
9
|
* Office document types
|
|
10
10
|
*/
|
|
11
11
|
export type OfficeDocumentType = "docx" | "pptx" | "xlsx";
|
|
12
12
|
/**
|
|
13
|
-
* File
|
|
13
|
+
* File with metadata — allows callers to pass filename alongside a Buffer.
|
|
14
|
+
*
|
|
15
|
+
* This is the recommended way for applications (e.g. Slack bots) to pass
|
|
16
|
+
* files that were downloaded as Buffers but still have original filenames.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* files: [
|
|
21
|
+
* { buffer: pdfBuffer, filename: "quarterly-report.pdf" },
|
|
22
|
+
* { buffer: videoBuffer, filename: "meeting-recording.mov", mimetype: "video/quicktime" }
|
|
23
|
+
* ]
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type FileWithMetadata = {
|
|
27
|
+
buffer: Buffer;
|
|
28
|
+
filename: string;
|
|
29
|
+
mimetype?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* File input can be Buffer, string (path/URL/data URI), or an object with metadata.
|
|
14
33
|
*/
|
|
15
|
-
export type FileInput = Buffer | string;
|
|
34
|
+
export type FileInput = Buffer | string | FileWithMetadata;
|
|
16
35
|
/**
|
|
17
36
|
* File source type for tracking input origin
|
|
18
37
|
*/
|
|
@@ -38,6 +57,8 @@ export type FileProcessingResult = {
|
|
|
38
57
|
type: FileType;
|
|
39
58
|
content: string | Buffer;
|
|
40
59
|
mimeType: string;
|
|
60
|
+
/** Additional images extracted from the file (e.g., video keyframes, audio cover art) */
|
|
61
|
+
images?: Array<Buffer | string>;
|
|
41
62
|
metadata: {
|
|
42
63
|
confidence: number;
|
|
43
64
|
size?: number;
|
|
@@ -73,6 +94,8 @@ export type FileProcessingResult = {
|
|
|
73
94
|
modifiedDate?: string;
|
|
74
95
|
hasFormulas?: boolean;
|
|
75
96
|
hasImages?: boolean;
|
|
97
|
+
frameCount?: number;
|
|
98
|
+
hasKeyframes?: boolean;
|
|
76
99
|
};
|
|
77
100
|
};
|
|
78
101
|
/**
|
|
@@ -39,7 +39,7 @@ export type GenerateOptions = {
|
|
|
39
39
|
csvFiles?: Array<Buffer | string>;
|
|
40
40
|
pdfFiles?: Array<Buffer | string>;
|
|
41
41
|
videoFiles?: Array<Buffer | string>;
|
|
42
|
-
files?: Array<Buffer | string>;
|
|
42
|
+
files?: Array<Buffer | string | import("./fileTypes.js").FileWithMetadata>;
|
|
43
43
|
content?: Content[];
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -293,6 +293,17 @@ export type GenerateOptions = {
|
|
|
293
293
|
* ```
|
|
294
294
|
*/
|
|
295
295
|
rag?: RAGConfig;
|
|
296
|
+
/**
|
|
297
|
+
* File reference registry for on-demand file processing.
|
|
298
|
+
*
|
|
299
|
+
* When set, files above the "tiny" size tier (>10KB) will be registered
|
|
300
|
+
* as lightweight references instead of being fully loaded into the prompt.
|
|
301
|
+
* The LLM can then access file content on-demand via file tools
|
|
302
|
+
* (list_attached_files, read_file_section, search_in_file).
|
|
303
|
+
*
|
|
304
|
+
* @internal Set by NeuroLink SDK — not typically used directly by consumers.
|
|
305
|
+
*/
|
|
306
|
+
fileRegistry?: unknown;
|
|
296
307
|
};
|
|
297
308
|
/**
|
|
298
309
|
* Generate function result type - Primary output format
|
|
@@ -588,6 +599,16 @@ export type TextGenerationOptions = {
|
|
|
588
599
|
includeHeaders?: boolean;
|
|
589
600
|
};
|
|
590
601
|
enableSummarization?: boolean;
|
|
602
|
+
/**
|
|
603
|
+
* File reference registry for on-demand file processing (internal).
|
|
604
|
+
*
|
|
605
|
+
* When set, files above the "tiny" size tier (>10KB) will be registered
|
|
606
|
+
* as lightweight references instead of being fully loaded into the prompt.
|
|
607
|
+
* The LLM can then access file content on-demand via file tools.
|
|
608
|
+
*
|
|
609
|
+
* @internal Set by NeuroLink SDK — not typically used directly by consumers.
|
|
610
|
+
*/
|
|
611
|
+
fileRegistry?: unknown;
|
|
591
612
|
/**
|
|
592
613
|
* ## Extended Thinking Options
|
|
593
614
|
*
|
|
@@ -33,9 +33,8 @@ export type { EnhancedStreamProvider, ProgressCallback, StreamingMetadata, Strea
|
|
|
33
33
|
ToolCallResults, ToolCalls, ToolResult as StreamToolResult, } from "./streamTypes.js";
|
|
34
34
|
export * from "./ttsTypes.js";
|
|
35
35
|
export * from "./utilities.js";
|
|
36
|
-
export * from "./middlewareTypes.js";
|
|
37
|
-
export * from "./fileTypes.js";
|
|
38
|
-
export * from "./content.js";
|
|
39
|
-
export * from "./ttsTypes.js";
|
|
40
|
-
export * from "./hitlTypes.js";
|
|
41
36
|
export * from "./workflowTypes.js";
|
|
37
|
+
export * from "./contextTypes.js";
|
|
38
|
+
export * from "./fileReferenceTypes.js";
|
|
39
|
+
export * from "./ragTypes.js";
|
|
40
|
+
export * from "./conversationMemoryInterface.js";
|
package/dist/lib/types/index.js
CHANGED
|
@@ -38,16 +38,14 @@ export * from "./serviceTypes.js";
|
|
|
38
38
|
export * from "./ttsTypes.js";
|
|
39
39
|
// Utilities Types - Utility module types (selective export to avoid conflicts)
|
|
40
40
|
export * from "./utilities.js";
|
|
41
|
-
// Middleware Types - Middleware system types
|
|
42
|
-
export * from "./middlewareTypes.js";
|
|
43
|
-
// File detection and processing types
|
|
44
|
-
export * from "./fileTypes.js";
|
|
45
|
-
// Content types for multimodal support (includes multimodal re-exports for backward compatibility)
|
|
46
|
-
export * from "./content.js";
|
|
47
|
-
// TTS (Text-to-Speech) types
|
|
48
|
-
export * from "./ttsTypes.js";
|
|
49
|
-
// HITL (Human-in-the-Loop) types
|
|
50
|
-
export * from "./hitlTypes.js";
|
|
51
41
|
// Workflow types
|
|
52
42
|
export * from "./workflowTypes.js";
|
|
43
|
+
// Context compaction types
|
|
44
|
+
export * from "./contextTypes.js";
|
|
45
|
+
// File reference types
|
|
46
|
+
export * from "./fileReferenceTypes.js";
|
|
47
|
+
// RAG types
|
|
48
|
+
export * from "./ragTypes.js";
|
|
49
|
+
// Conversation memory manager type
|
|
50
|
+
export * from "./conversationMemoryInterface.js";
|
|
53
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -160,6 +160,7 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
160
160
|
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
161
161
|
}, "strip", z.ZodTypeAny, {
|
|
162
162
|
version: string;
|
|
163
|
+
lastUpdated: string;
|
|
163
164
|
models: Record<string, Record<string, {
|
|
164
165
|
capabilities: string[];
|
|
165
166
|
id: string;
|
|
@@ -172,11 +173,11 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
172
173
|
contextWindow: number;
|
|
173
174
|
releaseDate: string;
|
|
174
175
|
}>>;
|
|
175
|
-
lastUpdated: string;
|
|
176
176
|
aliases?: Record<string, string> | undefined;
|
|
177
177
|
defaults?: Record<string, string> | undefined;
|
|
178
178
|
}, {
|
|
179
179
|
version: string;
|
|
180
|
+
lastUpdated: string;
|
|
180
181
|
models: Record<string, Record<string, {
|
|
181
182
|
capabilities: string[];
|
|
182
183
|
id: string;
|
|
@@ -189,7 +190,6 @@ export declare const ModelRegistrySchema: z.ZodObject<{
|
|
|
189
190
|
contextWindow: number;
|
|
190
191
|
releaseDate: string;
|
|
191
192
|
}>>;
|
|
192
|
-
lastUpdated: string;
|
|
193
193
|
aliases?: Record<string, string> | undefined;
|
|
194
194
|
defaults?: Record<string, string> | undefined;
|
|
195
195
|
}>;
|