@juspay/neurolink 9.1.1 → 9.3.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 +27 -0
- package/README.md +106 -37
- package/dist/agent/directTools.d.ts +11 -11
- package/dist/cli/commands/config.d.ts +6 -6
- package/dist/cli/commands/rag.d.ts +19 -0
- package/dist/cli/commands/rag.js +756 -0
- package/dist/cli/factories/commandFactory.js +146 -83
- package/dist/cli/parser.js +4 -1
- package/dist/core/baseProvider.d.ts +43 -30
- package/dist/core/baseProvider.js +98 -138
- package/dist/core/conversationMemoryFactory.d.ts +2 -2
- package/dist/core/conversationMemoryFactory.js +2 -2
- package/dist/core/conversationMemoryInitializer.d.ts +1 -2
- package/dist/core/conversationMemoryInitializer.js +2 -2
- package/dist/core/infrastructure/baseError.d.ts +21 -0
- package/dist/core/infrastructure/baseError.js +22 -0
- package/dist/core/infrastructure/baseFactory.d.ts +21 -0
- package/dist/core/infrastructure/baseFactory.js +54 -0
- package/dist/core/infrastructure/baseRegistry.d.ts +21 -0
- package/dist/core/infrastructure/baseRegistry.js +49 -0
- package/dist/core/infrastructure/index.d.ts +5 -0
- package/dist/core/infrastructure/index.js +5 -0
- package/dist/core/infrastructure/retry.d.ts +7 -0
- package/dist/core/infrastructure/retry.js +20 -0
- package/dist/core/infrastructure/typedEventEmitter.d.ts +8 -0
- package/dist/core/infrastructure/typedEventEmitter.js +23 -0
- package/dist/core/redisConversationMemoryManager.d.ts +1 -6
- package/dist/core/redisConversationMemoryManager.js +7 -19
- package/dist/factories/providerFactory.d.ts +5 -3
- package/dist/factories/providerFactory.js +31 -24
- package/dist/image-gen/ImageGenService.d.ts +143 -0
- package/dist/image-gen/ImageGenService.js +345 -0
- package/dist/image-gen/imageGenTools.d.ts +126 -0
- package/dist/image-gen/imageGenTools.js +304 -0
- package/dist/image-gen/index.d.ts +46 -0
- package/dist/image-gen/index.js +48 -0
- package/dist/image-gen/types.d.ts +237 -0
- package/dist/image-gen/types.js +24 -0
- package/dist/index.d.ts +46 -12
- package/dist/index.js +88 -36
- package/dist/lib/agent/directTools.d.ts +8 -8
- package/dist/lib/core/baseProvider.d.ts +43 -30
- package/dist/lib/core/baseProvider.js +98 -138
- package/dist/lib/core/conversationMemoryFactory.d.ts +2 -2
- package/dist/lib/core/conversationMemoryFactory.js +2 -2
- package/dist/lib/core/conversationMemoryInitializer.d.ts +1 -2
- package/dist/lib/core/conversationMemoryInitializer.js +2 -2
- package/dist/lib/core/infrastructure/baseError.d.ts +21 -0
- package/dist/lib/core/infrastructure/baseError.js +23 -0
- package/dist/lib/core/infrastructure/baseFactory.d.ts +21 -0
- package/dist/lib/core/infrastructure/baseFactory.js +55 -0
- package/dist/lib/core/infrastructure/baseRegistry.d.ts +21 -0
- package/dist/lib/core/infrastructure/baseRegistry.js +50 -0
- package/dist/lib/core/infrastructure/index.d.ts +5 -0
- package/dist/lib/core/infrastructure/index.js +6 -0
- package/dist/lib/core/infrastructure/retry.d.ts +7 -0
- package/dist/lib/core/infrastructure/retry.js +21 -0
- package/dist/lib/core/infrastructure/typedEventEmitter.d.ts +8 -0
- package/dist/lib/core/infrastructure/typedEventEmitter.js +24 -0
- package/dist/lib/core/redisConversationMemoryManager.d.ts +1 -6
- package/dist/lib/core/redisConversationMemoryManager.js +7 -19
- package/dist/lib/factories/providerFactory.d.ts +5 -3
- package/dist/lib/factories/providerFactory.js +31 -24
- package/dist/lib/image-gen/ImageGenService.d.ts +143 -0
- package/dist/lib/image-gen/ImageGenService.js +346 -0
- package/dist/lib/image-gen/imageGenTools.d.ts +126 -0
- package/dist/lib/image-gen/imageGenTools.js +305 -0
- package/dist/lib/image-gen/index.d.ts +46 -0
- package/dist/lib/image-gen/index.js +49 -0
- package/dist/lib/image-gen/types.d.ts +237 -0
- package/dist/lib/image-gen/types.js +25 -0
- package/dist/lib/index.d.ts +46 -12
- package/dist/lib/index.js +88 -36
- package/dist/lib/mcp/index.d.ts +6 -5
- package/dist/lib/mcp/index.js +7 -5
- package/dist/lib/neurolink.d.ts +11 -13
- package/dist/lib/neurolink.js +95 -29
- package/dist/lib/processors/base/BaseFileProcessor.d.ts +273 -0
- package/dist/lib/processors/base/BaseFileProcessor.js +614 -0
- package/dist/lib/processors/base/index.d.ts +14 -0
- package/dist/lib/processors/base/index.js +20 -0
- package/dist/lib/processors/base/types.d.ts +593 -0
- package/dist/lib/processors/base/types.js +77 -0
- package/dist/lib/processors/cli/fileProcessorCli.d.ts +163 -0
- package/dist/lib/processors/cli/fileProcessorCli.js +389 -0
- package/dist/lib/processors/cli/index.d.ts +37 -0
- package/dist/lib/processors/cli/index.js +50 -0
- package/dist/lib/processors/code/ConfigProcessor.d.ts +171 -0
- package/dist/lib/processors/code/ConfigProcessor.js +401 -0
- package/dist/lib/processors/code/SourceCodeProcessor.d.ts +174 -0
- package/dist/lib/processors/code/SourceCodeProcessor.js +305 -0
- package/dist/lib/processors/code/index.d.ts +44 -0
- package/dist/lib/processors/code/index.js +61 -0
- package/dist/lib/processors/config/fileTypes.d.ts +283 -0
- package/dist/lib/processors/config/fileTypes.js +521 -0
- package/dist/lib/processors/config/index.d.ts +32 -0
- package/dist/lib/processors/config/index.js +93 -0
- package/dist/lib/processors/config/languageMap.d.ts +66 -0
- package/dist/lib/processors/config/languageMap.js +411 -0
- package/dist/lib/processors/config/mimeTypes.d.ts +376 -0
- package/dist/lib/processors/config/mimeTypes.js +339 -0
- package/dist/lib/processors/config/sizeLimits.d.ts +194 -0
- package/dist/lib/processors/config/sizeLimits.js +247 -0
- package/dist/lib/processors/data/JsonProcessor.d.ts +122 -0
- package/dist/lib/processors/data/JsonProcessor.js +204 -0
- package/dist/lib/processors/data/XmlProcessor.d.ts +160 -0
- package/dist/lib/processors/data/XmlProcessor.js +284 -0
- package/dist/lib/processors/data/YamlProcessor.d.ts +163 -0
- package/dist/lib/processors/data/YamlProcessor.js +295 -0
- package/dist/lib/processors/data/index.d.ts +49 -0
- package/dist/lib/processors/data/index.js +77 -0
- package/dist/lib/processors/document/ExcelProcessor.d.ts +238 -0
- package/dist/lib/processors/document/ExcelProcessor.js +520 -0
- package/dist/lib/processors/document/OpenDocumentProcessor.d.ts +69 -0
- package/dist/lib/processors/document/OpenDocumentProcessor.js +211 -0
- package/dist/lib/processors/document/RtfProcessor.d.ts +152 -0
- package/dist/lib/processors/document/RtfProcessor.js +362 -0
- package/dist/lib/processors/document/WordProcessor.d.ts +168 -0
- package/dist/lib/processors/document/WordProcessor.js +354 -0
- package/dist/lib/processors/document/index.d.ts +54 -0
- package/dist/lib/processors/document/index.js +91 -0
- package/dist/lib/processors/errors/FileErrorCode.d.ts +98 -0
- package/dist/lib/processors/errors/FileErrorCode.js +256 -0
- package/dist/lib/processors/errors/errorHelpers.d.ts +151 -0
- package/dist/lib/processors/errors/errorHelpers.js +379 -0
- package/dist/lib/processors/errors/errorSerializer.d.ts +139 -0
- package/dist/lib/processors/errors/errorSerializer.js +508 -0
- package/dist/lib/processors/errors/index.d.ts +46 -0
- package/dist/lib/processors/errors/index.js +50 -0
- package/dist/lib/processors/index.d.ts +76 -0
- package/dist/lib/processors/index.js +113 -0
- package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +244 -0
- package/dist/lib/processors/integration/FileProcessorIntegration.js +273 -0
- package/dist/lib/processors/integration/index.d.ts +42 -0
- package/dist/lib/processors/integration/index.js +45 -0
- package/dist/lib/processors/markup/HtmlProcessor.d.ts +169 -0
- package/dist/lib/processors/markup/HtmlProcessor.js +250 -0
- package/dist/lib/processors/markup/MarkdownProcessor.d.ts +165 -0
- package/dist/lib/processors/markup/MarkdownProcessor.js +245 -0
- package/dist/lib/processors/markup/SvgProcessor.d.ts +156 -0
- package/dist/lib/processors/markup/SvgProcessor.js +241 -0
- package/dist/lib/processors/markup/TextProcessor.d.ts +135 -0
- package/dist/lib/processors/markup/TextProcessor.js +189 -0
- package/dist/lib/processors/markup/index.d.ts +66 -0
- package/dist/lib/processors/markup/index.js +103 -0
- package/dist/lib/processors/registry/ProcessorRegistry.d.ts +334 -0
- package/dist/lib/processors/registry/ProcessorRegistry.js +609 -0
- package/dist/lib/processors/registry/index.d.ts +12 -0
- package/dist/lib/processors/registry/index.js +17 -0
- package/dist/lib/processors/registry/types.d.ts +53 -0
- package/dist/lib/processors/registry/types.js +11 -0
- package/dist/lib/providers/amazonBedrock.d.ts +15 -2
- package/dist/lib/providers/amazonBedrock.js +65 -8
- package/dist/lib/providers/anthropic.d.ts +3 -3
- package/dist/lib/providers/anthropic.js +10 -7
- package/dist/lib/providers/googleAiStudio.d.ts +5 -5
- package/dist/lib/providers/googleAiStudio.js +10 -7
- package/dist/lib/providers/googleVertex.d.ts +16 -4
- package/dist/lib/providers/googleVertex.js +72 -16
- package/dist/lib/providers/litellm.d.ts +3 -3
- package/dist/lib/providers/litellm.js +10 -10
- package/dist/lib/providers/mistral.d.ts +3 -3
- package/dist/lib/providers/mistral.js +7 -6
- package/dist/lib/providers/ollama.d.ts +3 -4
- package/dist/lib/providers/ollama.js +7 -8
- package/dist/lib/providers/openAI.d.ts +14 -2
- package/dist/lib/providers/openAI.js +60 -6
- package/dist/lib/providers/openRouter.d.ts +2 -2
- package/dist/lib/providers/openRouter.js +10 -6
- package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/lib/rag/ChunkerFactory.d.ts +91 -0
- package/dist/lib/rag/ChunkerFactory.js +321 -0
- package/dist/lib/rag/ChunkerRegistry.d.ts +91 -0
- package/dist/lib/rag/ChunkerRegistry.js +422 -0
- package/dist/lib/rag/chunkers/BaseChunker.d.ts +53 -0
- package/dist/lib/rag/chunkers/BaseChunker.js +144 -0
- package/dist/lib/rag/chunkers/CharacterChunker.d.ts +18 -0
- package/dist/lib/rag/chunkers/CharacterChunker.js +29 -0
- package/dist/lib/rag/chunkers/HTMLChunker.d.ts +19 -0
- package/dist/lib/rag/chunkers/HTMLChunker.js +39 -0
- package/dist/lib/rag/chunkers/JSONChunker.d.ts +19 -0
- package/dist/lib/rag/chunkers/JSONChunker.js +69 -0
- package/dist/lib/rag/chunkers/LaTeXChunker.d.ts +15 -0
- package/dist/lib/rag/chunkers/LaTeXChunker.js +64 -0
- package/dist/lib/rag/chunkers/MarkdownChunker.d.ts +15 -0
- package/dist/lib/rag/chunkers/MarkdownChunker.js +103 -0
- package/dist/lib/rag/chunkers/RecursiveChunker.d.ts +27 -0
- package/dist/lib/rag/chunkers/RecursiveChunker.js +140 -0
- package/dist/lib/rag/chunkers/SemanticMarkdownChunker.d.ts +22 -0
- package/dist/lib/rag/chunkers/SemanticMarkdownChunker.js +139 -0
- package/dist/lib/rag/chunkers/SentenceChunker.d.ts +19 -0
- package/dist/lib/rag/chunkers/SentenceChunker.js +67 -0
- package/dist/lib/rag/chunkers/TokenChunker.d.ts +19 -0
- package/dist/lib/rag/chunkers/TokenChunker.js +62 -0
- package/dist/lib/rag/chunkers/index.d.ts +15 -0
- package/dist/lib/rag/chunkers/index.js +16 -0
- package/dist/lib/rag/chunking/characterChunker.d.ts +16 -0
- package/dist/lib/rag/chunking/characterChunker.js +143 -0
- package/dist/lib/rag/chunking/chunkerRegistry.d.ts +67 -0
- package/dist/lib/rag/chunking/chunkerRegistry.js +195 -0
- package/dist/lib/rag/chunking/htmlChunker.d.ts +34 -0
- package/dist/lib/rag/chunking/htmlChunker.js +248 -0
- package/dist/lib/rag/chunking/index.d.ts +15 -0
- package/dist/lib/rag/chunking/index.js +18 -0
- package/dist/lib/rag/chunking/jsonChunker.d.ts +20 -0
- package/dist/lib/rag/chunking/jsonChunker.js +282 -0
- package/dist/lib/rag/chunking/latexChunker.d.ts +26 -0
- package/dist/lib/rag/chunking/latexChunker.js +252 -0
- package/dist/lib/rag/chunking/markdownChunker.d.ts +19 -0
- package/dist/lib/rag/chunking/markdownChunker.js +202 -0
- package/dist/lib/rag/chunking/recursiveChunker.d.ts +19 -0
- package/dist/lib/rag/chunking/recursiveChunker.js +149 -0
- package/dist/lib/rag/chunking/semanticChunker.d.ts +41 -0
- package/dist/lib/rag/chunking/semanticChunker.js +307 -0
- package/dist/lib/rag/chunking/sentenceChunker.d.ts +25 -0
- package/dist/lib/rag/chunking/sentenceChunker.js +231 -0
- package/dist/lib/rag/chunking/tokenChunker.d.ts +36 -0
- package/dist/lib/rag/chunking/tokenChunker.js +184 -0
- package/dist/lib/rag/document/MDocument.d.ts +198 -0
- package/dist/lib/rag/document/MDocument.js +393 -0
- package/dist/lib/rag/document/index.d.ts +5 -0
- package/dist/lib/rag/document/index.js +6 -0
- package/dist/lib/rag/document/loaders.d.ts +201 -0
- package/dist/lib/rag/document/loaders.js +501 -0
- package/dist/lib/rag/errors/RAGError.d.ts +244 -0
- package/dist/lib/rag/errors/RAGError.js +275 -0
- package/dist/lib/rag/errors/index.d.ts +6 -0
- package/dist/lib/rag/errors/index.js +7 -0
- package/dist/lib/rag/graphRag/graphRAG.d.ts +115 -0
- package/dist/lib/rag/graphRag/graphRAG.js +385 -0
- package/dist/lib/rag/graphRag/index.d.ts +4 -0
- package/dist/lib/rag/graphRag/index.js +5 -0
- package/dist/lib/rag/index.d.ts +103 -0
- package/dist/lib/rag/index.js +142 -0
- package/dist/lib/rag/metadata/MetadataExtractorFactory.d.ts +157 -0
- package/dist/lib/rag/metadata/MetadataExtractorFactory.js +419 -0
- package/dist/lib/rag/metadata/MetadataExtractorRegistry.d.ts +99 -0
- package/dist/lib/rag/metadata/MetadataExtractorRegistry.js +363 -0
- package/dist/lib/rag/metadata/index.d.ts +6 -0
- package/dist/lib/rag/metadata/index.js +10 -0
- package/dist/lib/rag/metadata/metadataExtractor.d.ts +69 -0
- package/dist/lib/rag/metadata/metadataExtractor.js +278 -0
- package/dist/lib/rag/pipeline/RAGPipeline.d.ts +235 -0
- package/dist/lib/rag/pipeline/RAGPipeline.js +402 -0
- package/dist/lib/rag/pipeline/contextAssembly.d.ts +126 -0
- package/dist/lib/rag/pipeline/contextAssembly.js +338 -0
- package/dist/lib/rag/pipeline/index.d.ts +5 -0
- package/dist/lib/rag/pipeline/index.js +6 -0
- package/dist/lib/rag/ragIntegration.d.ts +38 -0
- package/dist/lib/rag/ragIntegration.js +212 -0
- package/dist/lib/rag/reranker/RerankerFactory.d.ts +184 -0
- package/dist/lib/rag/reranker/RerankerFactory.js +431 -0
- package/dist/lib/rag/reranker/RerankerRegistry.d.ts +119 -0
- package/dist/lib/rag/reranker/RerankerRegistry.js +403 -0
- package/dist/lib/rag/reranker/index.d.ts +6 -0
- package/dist/lib/rag/reranker/index.js +10 -0
- package/dist/lib/rag/reranker/reranker.d.ts +71 -0
- package/dist/lib/rag/reranker/reranker.js +278 -0
- package/dist/lib/rag/resilience/CircuitBreaker.d.ts +215 -0
- package/dist/lib/rag/resilience/CircuitBreaker.js +432 -0
- package/dist/lib/rag/resilience/RetryHandler.d.ts +115 -0
- package/dist/lib/rag/resilience/RetryHandler.js +301 -0
- package/dist/lib/rag/resilience/index.d.ts +7 -0
- package/dist/lib/rag/resilience/index.js +8 -0
- package/dist/lib/rag/retrieval/hybridSearch.d.ts +94 -0
- package/dist/lib/rag/retrieval/hybridSearch.js +314 -0
- package/dist/lib/rag/retrieval/index.d.ts +5 -0
- package/dist/lib/rag/retrieval/index.js +6 -0
- package/dist/lib/rag/retrieval/vectorQueryTool.d.ts +93 -0
- package/dist/lib/rag/retrieval/vectorQueryTool.js +290 -0
- package/dist/lib/rag/types.d.ts +768 -0
- package/dist/lib/rag/types.js +9 -0
- package/dist/lib/server/index.d.ts +15 -11
- package/dist/lib/server/index.js +55 -51
- package/dist/lib/server/utils/validation.d.ts +2 -2
- package/dist/lib/types/common.d.ts +0 -1
- package/dist/lib/types/fileTypes.d.ts +1 -1
- package/dist/lib/types/generateTypes.d.ts +42 -8
- package/dist/lib/types/generateTypes.js +1 -1
- package/dist/lib/types/index.d.ts +25 -24
- package/dist/lib/types/index.js +21 -20
- package/dist/lib/types/modelTypes.d.ts +16 -16
- package/dist/lib/types/pptTypes.d.ts +14 -2
- package/dist/lib/types/pptTypes.js +16 -0
- package/dist/lib/types/streamTypes.d.ts +28 -8
- package/dist/lib/types/streamTypes.js +1 -1
- package/dist/lib/utils/async/delay.d.ts +40 -0
- package/dist/lib/utils/async/delay.js +43 -0
- package/dist/lib/utils/async/index.d.ts +23 -0
- package/dist/lib/utils/async/index.js +24 -0
- package/dist/lib/utils/async/retry.d.ts +141 -0
- package/dist/lib/utils/async/retry.js +172 -0
- package/dist/lib/utils/async/withTimeout.d.ts +73 -0
- package/dist/lib/utils/async/withTimeout.js +97 -0
- package/dist/lib/utils/fileDetector.d.ts +7 -1
- package/dist/lib/utils/fileDetector.js +91 -18
- package/dist/lib/utils/json/extract.d.ts +103 -0
- package/dist/lib/utils/json/extract.js +249 -0
- package/dist/lib/utils/json/index.d.ts +36 -0
- package/dist/lib/utils/json/index.js +37 -0
- package/dist/lib/utils/json/safeParse.d.ts +137 -0
- package/dist/lib/utils/json/safeParse.js +191 -0
- package/dist/lib/utils/messageBuilder.d.ts +2 -2
- package/dist/lib/utils/messageBuilder.js +15 -7
- package/dist/lib/utils/modelRouter.d.ts +4 -4
- package/dist/lib/utils/modelRouter.js +4 -4
- package/dist/lib/utils/sanitizers/filename.d.ts +137 -0
- package/dist/lib/utils/sanitizers/filename.js +366 -0
- package/dist/lib/utils/sanitizers/html.d.ts +170 -0
- package/dist/lib/utils/sanitizers/html.js +326 -0
- package/dist/lib/utils/sanitizers/index.d.ts +26 -0
- package/dist/lib/utils/sanitizers/index.js +30 -0
- package/dist/lib/utils/sanitizers/svg.d.ts +81 -0
- package/dist/lib/utils/sanitizers/svg.js +483 -0
- package/dist/mcp/index.d.ts +6 -5
- package/dist/mcp/index.js +7 -5
- package/dist/neurolink.d.ts +11 -13
- package/dist/neurolink.js +95 -29
- package/dist/processors/base/BaseFileProcessor.d.ts +273 -0
- package/dist/processors/base/BaseFileProcessor.js +613 -0
- package/dist/processors/base/index.d.ts +14 -0
- package/dist/processors/base/index.js +19 -0
- package/dist/processors/base/types.d.ts +593 -0
- package/dist/processors/base/types.js +76 -0
- package/dist/processors/cli/fileProcessorCli.d.ts +163 -0
- package/dist/processors/cli/fileProcessorCli.js +388 -0
- package/dist/processors/cli/index.d.ts +37 -0
- package/dist/processors/cli/index.js +49 -0
- package/dist/processors/code/ConfigProcessor.d.ts +171 -0
- package/dist/processors/code/ConfigProcessor.js +400 -0
- package/dist/processors/code/SourceCodeProcessor.d.ts +174 -0
- package/dist/processors/code/SourceCodeProcessor.js +304 -0
- package/dist/processors/code/index.d.ts +44 -0
- package/dist/processors/code/index.js +60 -0
- package/dist/processors/config/fileTypes.d.ts +283 -0
- package/dist/processors/config/fileTypes.js +520 -0
- package/dist/processors/config/index.d.ts +32 -0
- package/dist/processors/config/index.js +92 -0
- package/dist/processors/config/languageMap.d.ts +66 -0
- package/dist/processors/config/languageMap.js +410 -0
- package/dist/processors/config/mimeTypes.d.ts +376 -0
- package/dist/processors/config/mimeTypes.js +338 -0
- package/dist/processors/config/sizeLimits.d.ts +194 -0
- package/dist/processors/config/sizeLimits.js +246 -0
- package/dist/processors/data/JsonProcessor.d.ts +122 -0
- package/dist/processors/data/JsonProcessor.js +203 -0
- package/dist/processors/data/XmlProcessor.d.ts +160 -0
- package/dist/processors/data/XmlProcessor.js +283 -0
- package/dist/processors/data/YamlProcessor.d.ts +163 -0
- package/dist/processors/data/YamlProcessor.js +294 -0
- package/dist/processors/data/index.d.ts +49 -0
- package/dist/processors/data/index.js +76 -0
- package/dist/processors/document/ExcelProcessor.d.ts +238 -0
- package/dist/processors/document/ExcelProcessor.js +519 -0
- package/dist/processors/document/OpenDocumentProcessor.d.ts +69 -0
- package/dist/processors/document/OpenDocumentProcessor.js +210 -0
- package/dist/processors/document/RtfProcessor.d.ts +152 -0
- package/dist/processors/document/RtfProcessor.js +361 -0
- package/dist/processors/document/WordProcessor.d.ts +168 -0
- package/dist/processors/document/WordProcessor.js +353 -0
- package/dist/processors/document/index.d.ts +54 -0
- package/dist/processors/document/index.js +90 -0
- package/dist/processors/errors/FileErrorCode.d.ts +98 -0
- package/dist/processors/errors/FileErrorCode.js +255 -0
- package/dist/processors/errors/errorHelpers.d.ts +151 -0
- package/dist/processors/errors/errorHelpers.js +378 -0
- package/dist/processors/errors/errorSerializer.d.ts +139 -0
- package/dist/processors/errors/errorSerializer.js +507 -0
- package/dist/processors/errors/index.d.ts +46 -0
- package/dist/processors/errors/index.js +49 -0
- package/dist/processors/index.d.ts +76 -0
- package/dist/processors/index.js +112 -0
- package/dist/processors/integration/FileProcessorIntegration.d.ts +244 -0
- package/dist/processors/integration/FileProcessorIntegration.js +272 -0
- package/dist/processors/integration/index.d.ts +42 -0
- package/dist/processors/integration/index.js +44 -0
- package/dist/processors/markup/HtmlProcessor.d.ts +169 -0
- package/dist/processors/markup/HtmlProcessor.js +249 -0
- package/dist/processors/markup/MarkdownProcessor.d.ts +165 -0
- package/dist/processors/markup/MarkdownProcessor.js +244 -0
- package/dist/processors/markup/SvgProcessor.d.ts +156 -0
- package/dist/processors/markup/SvgProcessor.js +240 -0
- package/dist/processors/markup/TextProcessor.d.ts +135 -0
- package/dist/processors/markup/TextProcessor.js +188 -0
- package/dist/processors/markup/index.d.ts +66 -0
- package/dist/processors/markup/index.js +102 -0
- package/dist/processors/registry/ProcessorRegistry.d.ts +334 -0
- package/dist/processors/registry/ProcessorRegistry.js +608 -0
- package/dist/processors/registry/index.d.ts +12 -0
- package/dist/processors/registry/index.js +16 -0
- package/dist/processors/registry/types.d.ts +53 -0
- package/dist/processors/registry/types.js +10 -0
- package/dist/providers/amazonBedrock.d.ts +15 -2
- package/dist/providers/amazonBedrock.js +65 -8
- package/dist/providers/anthropic.d.ts +3 -3
- package/dist/providers/anthropic.js +10 -7
- package/dist/providers/googleAiStudio.d.ts +5 -5
- package/dist/providers/googleAiStudio.js +10 -7
- package/dist/providers/googleVertex.d.ts +16 -4
- package/dist/providers/googleVertex.js +72 -16
- package/dist/providers/litellm.d.ts +3 -3
- package/dist/providers/litellm.js +10 -10
- package/dist/providers/mistral.d.ts +3 -3
- package/dist/providers/mistral.js +7 -6
- package/dist/providers/ollama.d.ts +3 -4
- package/dist/providers/ollama.js +7 -8
- package/dist/providers/openAI.d.ts +14 -2
- package/dist/providers/openAI.js +60 -6
- package/dist/providers/openRouter.d.ts +2 -2
- package/dist/providers/openRouter.js +10 -6
- package/dist/rag/ChunkerFactory.d.ts +91 -0
- package/dist/rag/ChunkerFactory.js +320 -0
- package/dist/rag/ChunkerRegistry.d.ts +91 -0
- package/dist/rag/ChunkerRegistry.js +421 -0
- package/dist/rag/chunkers/BaseChunker.d.ts +53 -0
- package/dist/rag/chunkers/BaseChunker.js +143 -0
- package/dist/rag/chunkers/CharacterChunker.d.ts +18 -0
- package/dist/rag/chunkers/CharacterChunker.js +28 -0
- package/dist/rag/chunkers/HTMLChunker.d.ts +19 -0
- package/dist/rag/chunkers/HTMLChunker.js +38 -0
- package/dist/rag/chunkers/JSONChunker.d.ts +19 -0
- package/dist/rag/chunkers/JSONChunker.js +68 -0
- package/dist/rag/chunkers/LaTeXChunker.d.ts +15 -0
- package/dist/rag/chunkers/LaTeXChunker.js +63 -0
- package/dist/rag/chunkers/MarkdownChunker.d.ts +15 -0
- package/dist/rag/chunkers/MarkdownChunker.js +102 -0
- package/dist/rag/chunkers/RecursiveChunker.d.ts +27 -0
- package/dist/rag/chunkers/RecursiveChunker.js +139 -0
- package/dist/rag/chunkers/SemanticMarkdownChunker.d.ts +22 -0
- package/dist/rag/chunkers/SemanticMarkdownChunker.js +138 -0
- package/dist/rag/chunkers/SentenceChunker.d.ts +19 -0
- package/dist/rag/chunkers/SentenceChunker.js +66 -0
- package/dist/rag/chunkers/TokenChunker.d.ts +19 -0
- package/dist/rag/chunkers/TokenChunker.js +61 -0
- package/dist/rag/chunkers/index.d.ts +15 -0
- package/dist/rag/chunkers/index.js +15 -0
- package/dist/rag/chunking/characterChunker.d.ts +16 -0
- package/dist/rag/chunking/characterChunker.js +142 -0
- package/dist/rag/chunking/chunkerRegistry.d.ts +67 -0
- package/dist/rag/chunking/chunkerRegistry.js +194 -0
- package/dist/rag/chunking/htmlChunker.d.ts +34 -0
- package/dist/rag/chunking/htmlChunker.js +247 -0
- package/dist/rag/chunking/index.d.ts +15 -0
- package/dist/rag/chunking/index.js +17 -0
- package/dist/rag/chunking/jsonChunker.d.ts +20 -0
- package/dist/rag/chunking/jsonChunker.js +281 -0
- package/dist/rag/chunking/latexChunker.d.ts +26 -0
- package/dist/rag/chunking/latexChunker.js +251 -0
- package/dist/rag/chunking/markdownChunker.d.ts +19 -0
- package/dist/rag/chunking/markdownChunker.js +201 -0
- package/dist/rag/chunking/recursiveChunker.d.ts +19 -0
- package/dist/rag/chunking/recursiveChunker.js +148 -0
- package/dist/rag/chunking/semanticChunker.d.ts +41 -0
- package/dist/rag/chunking/semanticChunker.js +306 -0
- package/dist/rag/chunking/sentenceChunker.d.ts +25 -0
- package/dist/rag/chunking/sentenceChunker.js +230 -0
- package/dist/rag/chunking/tokenChunker.d.ts +36 -0
- package/dist/rag/chunking/tokenChunker.js +183 -0
- package/dist/rag/document/MDocument.d.ts +198 -0
- package/dist/rag/document/MDocument.js +392 -0
- package/dist/rag/document/index.d.ts +5 -0
- package/dist/rag/document/index.js +5 -0
- package/dist/rag/document/loaders.d.ts +201 -0
- package/dist/rag/document/loaders.js +500 -0
- package/dist/rag/errors/RAGError.d.ts +244 -0
- package/dist/rag/errors/RAGError.js +274 -0
- package/dist/rag/errors/index.d.ts +6 -0
- package/dist/rag/errors/index.js +6 -0
- package/dist/rag/graphRag/graphRAG.d.ts +115 -0
- package/dist/rag/graphRag/graphRAG.js +384 -0
- package/dist/rag/graphRag/index.d.ts +4 -0
- package/dist/rag/graphRag/index.js +4 -0
- package/dist/rag/index.d.ts +103 -0
- package/dist/rag/index.js +141 -0
- package/dist/rag/metadata/MetadataExtractorFactory.d.ts +157 -0
- package/dist/rag/metadata/MetadataExtractorFactory.js +418 -0
- package/dist/rag/metadata/MetadataExtractorRegistry.d.ts +99 -0
- package/dist/rag/metadata/MetadataExtractorRegistry.js +362 -0
- package/dist/rag/metadata/index.d.ts +6 -0
- package/dist/rag/metadata/index.js +9 -0
- package/dist/rag/metadata/metadataExtractor.d.ts +69 -0
- package/dist/rag/metadata/metadataExtractor.js +277 -0
- package/dist/rag/pipeline/RAGPipeline.d.ts +235 -0
- package/dist/rag/pipeline/RAGPipeline.js +401 -0
- package/dist/rag/pipeline/contextAssembly.d.ts +126 -0
- package/dist/rag/pipeline/contextAssembly.js +337 -0
- package/dist/rag/pipeline/index.d.ts +5 -0
- package/dist/rag/pipeline/index.js +5 -0
- package/dist/rag/ragIntegration.d.ts +38 -0
- package/dist/rag/ragIntegration.js +211 -0
- package/dist/rag/reranker/RerankerFactory.d.ts +184 -0
- package/dist/rag/reranker/RerankerFactory.js +430 -0
- package/dist/rag/reranker/RerankerRegistry.d.ts +119 -0
- package/dist/rag/reranker/RerankerRegistry.js +402 -0
- package/dist/rag/reranker/index.d.ts +6 -0
- package/dist/rag/reranker/index.js +9 -0
- package/dist/rag/reranker/reranker.d.ts +71 -0
- package/dist/rag/reranker/reranker.js +277 -0
- package/dist/rag/resilience/CircuitBreaker.d.ts +215 -0
- package/dist/rag/resilience/CircuitBreaker.js +431 -0
- package/dist/rag/resilience/RetryHandler.d.ts +115 -0
- package/dist/rag/resilience/RetryHandler.js +300 -0
- package/dist/rag/resilience/index.d.ts +7 -0
- package/dist/rag/resilience/index.js +7 -0
- package/dist/rag/retrieval/hybridSearch.d.ts +94 -0
- package/dist/rag/retrieval/hybridSearch.js +313 -0
- package/dist/rag/retrieval/index.d.ts +5 -0
- package/dist/rag/retrieval/index.js +5 -0
- package/dist/rag/retrieval/vectorQueryTool.d.ts +93 -0
- package/dist/rag/retrieval/vectorQueryTool.js +289 -0
- package/dist/rag/types.d.ts +768 -0
- package/dist/rag/types.js +8 -0
- package/dist/server/index.d.ts +15 -11
- package/dist/server/index.js +55 -51
- package/dist/server/utils/validation.d.ts +8 -8
- package/dist/types/common.d.ts +0 -1
- package/dist/types/fileTypes.d.ts +1 -1
- package/dist/types/generateTypes.d.ts +42 -8
- package/dist/types/generateTypes.js +1 -1
- package/dist/types/index.d.ts +25 -24
- package/dist/types/index.js +21 -20
- package/dist/types/modelTypes.d.ts +10 -10
- package/dist/types/pptTypes.d.ts +14 -2
- package/dist/types/pptTypes.js +16 -0
- package/dist/types/streamTypes.d.ts +28 -8
- package/dist/types/streamTypes.js +1 -1
- package/dist/utils/async/delay.d.ts +40 -0
- package/dist/utils/async/delay.js +42 -0
- package/dist/utils/async/index.d.ts +23 -0
- package/dist/utils/async/index.js +23 -0
- package/dist/utils/async/retry.d.ts +141 -0
- package/dist/utils/async/retry.js +171 -0
- package/dist/utils/async/withTimeout.d.ts +73 -0
- package/dist/utils/async/withTimeout.js +96 -0
- package/dist/utils/fileDetector.d.ts +7 -1
- package/dist/utils/fileDetector.js +91 -18
- package/dist/utils/json/extract.d.ts +103 -0
- package/dist/utils/json/extract.js +248 -0
- package/dist/utils/json/index.d.ts +36 -0
- package/dist/utils/json/index.js +36 -0
- package/dist/utils/json/safeParse.d.ts +137 -0
- package/dist/utils/json/safeParse.js +190 -0
- package/dist/utils/messageBuilder.d.ts +2 -2
- package/dist/utils/messageBuilder.js +15 -7
- package/dist/utils/modelRouter.d.ts +4 -4
- package/dist/utils/modelRouter.js +4 -4
- package/dist/utils/sanitizers/filename.d.ts +137 -0
- package/dist/utils/sanitizers/filename.js +365 -0
- package/dist/utils/sanitizers/html.d.ts +170 -0
- package/dist/utils/sanitizers/html.js +325 -0
- package/dist/utils/sanitizers/index.d.ts +26 -0
- package/dist/utils/sanitizers/index.js +29 -0
- package/dist/utils/sanitizers/svg.d.ts +81 -0
- package/dist/utils/sanitizers/svg.js +482 -0
- package/package.json +2 -2
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
1
|
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import ora from "ora";
|
|
5
|
+
import { ModelResolver } from "../../lib/models/modelResolver.js";
|
|
3
6
|
import { globalSession } from "../../lib/session/globalSessionState.js";
|
|
4
|
-
|
|
5
|
-
import {
|
|
7
|
+
// Use TokenUsage from standard types - no local interface needed
|
|
8
|
+
import { ContextFactory, } from "../../lib/types/contextTypes.js";
|
|
9
|
+
import { checkRedisAvailability } from "../../lib/utils/conversationMemoryUtils.js";
|
|
6
10
|
import { normalizeEvaluationData } from "../../lib/utils/evaluationUtils.js";
|
|
11
|
+
import { logger } from "../../lib/utils/logger.js";
|
|
7
12
|
import { createThinkingConfigFromRecord } from "../../lib/utils/thinkingConfig.js";
|
|
13
|
+
import { configManager } from "../commands/config.js";
|
|
14
|
+
import { MCPCommandFactory } from "../commands/mcp.js";
|
|
15
|
+
import { ModelsCommandFactory } from "../commands/models.js";
|
|
16
|
+
import { handleSetup } from "../commands/setup.js";
|
|
17
|
+
import { handleError } from "../errorHandler.js";
|
|
8
18
|
import { LoopSession } from "../loop/session.js";
|
|
9
19
|
import { initializeCliParser } from "../parser.js";
|
|
20
|
+
import { formatFileSize, saveAudioToFile } from "../utils/audioFileUtils.js";
|
|
10
21
|
import { resolveFilePaths } from "../utils/pathResolver.js";
|
|
11
|
-
|
|
12
|
-
import { ContextFactory, } from "../../lib/types/contextTypes.js";
|
|
13
|
-
import { ModelsCommandFactory } from "../commands/models.js";
|
|
14
|
-
import { MCPCommandFactory } from "../commands/mcp.js";
|
|
22
|
+
import { formatVideoFileSize, getVideoMetadataSummary, saveVideoToFile, } from "../utils/videoFileUtils.js";
|
|
15
23
|
import { OllamaCommandFactory } from "./ollamaCommandFactory.js";
|
|
16
24
|
import { SageMakerCommandFactory } from "./sagemakerCommandFactory.js";
|
|
17
|
-
import { ModelResolver } from "../../lib/models/modelResolver.js";
|
|
18
|
-
import ora from "ora";
|
|
19
|
-
import chalk from "chalk";
|
|
20
|
-
import { logger } from "../../lib/utils/logger.js";
|
|
21
|
-
import { handleSetup } from "../commands/setup.js";
|
|
22
|
-
import { checkRedisAvailability } from "../../lib/utils/conversationMemoryUtils.js";
|
|
23
|
-
import { saveAudioToFile, formatFileSize } from "../utils/audioFileUtils.js";
|
|
24
|
-
import { saveVideoToFile, formatVideoFileSize, getVideoMetadataSummary, } from "../utils/videoFileUtils.js";
|
|
25
25
|
/**
|
|
26
26
|
* CLI Command Factory for generate commands
|
|
27
27
|
*/
|
|
@@ -324,11 +324,53 @@ export class CLICommandFactory {
|
|
|
324
324
|
description: "Vertex AI region (e.g., us-central1, europe-west1, asia-northeast1)",
|
|
325
325
|
alias: "r",
|
|
326
326
|
},
|
|
327
|
+
// RAG options
|
|
328
|
+
ragFiles: {
|
|
329
|
+
type: "array",
|
|
330
|
+
description: "File paths to load for RAG (Retrieval-Augmented Generation). AI will search these documents to answer your question.",
|
|
331
|
+
alias: "rag-files",
|
|
332
|
+
string: true,
|
|
333
|
+
},
|
|
334
|
+
ragStrategy: {
|
|
335
|
+
type: "string",
|
|
336
|
+
description: "Chunking strategy for RAG documents (auto-detected from file extension if not specified)",
|
|
337
|
+
alias: "rag-strategy",
|
|
338
|
+
choices: [
|
|
339
|
+
"character",
|
|
340
|
+
"recursive",
|
|
341
|
+
"sentence",
|
|
342
|
+
"token",
|
|
343
|
+
"markdown",
|
|
344
|
+
"html",
|
|
345
|
+
"json",
|
|
346
|
+
"latex",
|
|
347
|
+
"semantic",
|
|
348
|
+
"semantic-markdown",
|
|
349
|
+
],
|
|
350
|
+
},
|
|
351
|
+
ragChunkSize: {
|
|
352
|
+
type: "number",
|
|
353
|
+
description: "Maximum chunk size in characters for RAG documents",
|
|
354
|
+
alias: "rag-chunk-size",
|
|
355
|
+
default: 1000,
|
|
356
|
+
},
|
|
357
|
+
ragChunkOverlap: {
|
|
358
|
+
type: "number",
|
|
359
|
+
description: "Overlap between adjacent chunks for RAG documents",
|
|
360
|
+
alias: "rag-chunk-overlap",
|
|
361
|
+
default: 200,
|
|
362
|
+
},
|
|
363
|
+
ragTopK: {
|
|
364
|
+
type: "number",
|
|
365
|
+
description: "Number of top results to retrieve for RAG",
|
|
366
|
+
alias: "rag-top-k",
|
|
367
|
+
default: 5,
|
|
368
|
+
},
|
|
327
369
|
};
|
|
328
370
|
// Helper method to build options for commands
|
|
329
371
|
static buildOptions(yargs, additionalOptions = {}) {
|
|
330
372
|
return yargs.options({
|
|
331
|
-
...
|
|
373
|
+
...CLICommandFactory.commonOptions,
|
|
332
374
|
...additionalOptions,
|
|
333
375
|
});
|
|
334
376
|
}
|
|
@@ -538,7 +580,8 @@ export class CLICommandFactory {
|
|
|
538
580
|
}
|
|
539
581
|
// Add analytics display for text mode when enabled
|
|
540
582
|
if (options.enableAnalytics && generateResult.analytics) {
|
|
541
|
-
output +=
|
|
583
|
+
output +=
|
|
584
|
+
CLICommandFactory.formatAnalyticsForTextMode(generateResult);
|
|
542
585
|
}
|
|
543
586
|
}
|
|
544
587
|
else if (result && typeof result === "object" && "text" in result) {
|
|
@@ -710,7 +753,7 @@ export class CLICommandFactory {
|
|
|
710
753
|
}
|
|
711
754
|
// Helper method to normalize token usage data to standard format
|
|
712
755
|
static normalizeTokenUsage(tokens) {
|
|
713
|
-
if (!
|
|
756
|
+
if (!CLICommandFactory.isValidTokenUsage(tokens)) {
|
|
714
757
|
return null;
|
|
715
758
|
}
|
|
716
759
|
const tokensObj = tokens;
|
|
@@ -754,7 +797,7 @@ export class CLICommandFactory {
|
|
|
754
797
|
}
|
|
755
798
|
analyticsText += "\n";
|
|
756
799
|
// Token usage with fallback handling
|
|
757
|
-
const normalizedTokens =
|
|
800
|
+
const normalizedTokens = CLICommandFactory.normalizeTokenUsage(analytics.tokenUsage);
|
|
758
801
|
if (normalizedTokens) {
|
|
759
802
|
analyticsText += ` Tokens: ${normalizedTokens.input} input + ${normalizedTokens.output} output = ${normalizedTokens.total} total\n`;
|
|
760
803
|
}
|
|
@@ -796,7 +839,7 @@ export class CLICommandFactory {
|
|
|
796
839
|
command: ["generate <input>", "gen <input>"],
|
|
797
840
|
describe: "Generate content using AI providers",
|
|
798
841
|
builder: (yargs) => {
|
|
799
|
-
return
|
|
842
|
+
return CLICommandFactory.buildOptions(yargs
|
|
800
843
|
.positional("input", {
|
|
801
844
|
type: "string",
|
|
802
845
|
description: "Text prompt for AI generation (or read from stdin)",
|
|
@@ -812,7 +855,7 @@ export class CLICommandFactory {
|
|
|
812
855
|
.example('$0 generate "Product showcase video" --image ./product.jpg --outputMode video --videoOutput ./output.mp4', "Generate video from image")
|
|
813
856
|
.example('$0 generate "Smooth camera movement" --image ./input.jpg --provider vertex --model veo-3.1-generate-001 --outputMode video --videoResolution 720p --videoLength 6 --videoAspectRatio 16:9 --videoOutput ./output.mp4', "Video generation with full options"));
|
|
814
857
|
},
|
|
815
|
-
handler: async (argv) => await
|
|
858
|
+
handler: async (argv) => await CLICommandFactory.executeGenerate(argv),
|
|
816
859
|
};
|
|
817
860
|
}
|
|
818
861
|
/**
|
|
@@ -823,7 +866,7 @@ export class CLICommandFactory {
|
|
|
823
866
|
command: "stream <input>",
|
|
824
867
|
describe: "Stream generation in real-time",
|
|
825
868
|
builder: (yargs) => {
|
|
826
|
-
return
|
|
869
|
+
return CLICommandFactory.buildOptions(yargs
|
|
827
870
|
.positional("input", {
|
|
828
871
|
type: "string",
|
|
829
872
|
description: "Text prompt for streaming (or read from stdin)",
|
|
@@ -834,7 +877,7 @@ export class CLICommandFactory {
|
|
|
834
877
|
.example('echo "Live demo" | $0 stream', "Stream from stdin")
|
|
835
878
|
.example('$0 stream "Narrate this video" --video path/to/video.mp4', "Stream video analysis"));
|
|
836
879
|
},
|
|
837
|
-
handler: async (argv) => await
|
|
880
|
+
handler: async (argv) => await CLICommandFactory.executeStream(argv),
|
|
838
881
|
};
|
|
839
882
|
}
|
|
840
883
|
/**
|
|
@@ -845,7 +888,7 @@ export class CLICommandFactory {
|
|
|
845
888
|
command: "batch <file>",
|
|
846
889
|
describe: "Process multiple prompts from a file",
|
|
847
890
|
builder: (yargs) => {
|
|
848
|
-
return
|
|
891
|
+
return CLICommandFactory.buildOptions(yargs
|
|
849
892
|
.positional("file", {
|
|
850
893
|
type: "string",
|
|
851
894
|
description: "File with prompts (one per line)",
|
|
@@ -856,7 +899,7 @@ export class CLICommandFactory {
|
|
|
856
899
|
.example("$0 batch tasks.txt -p vertex --delay 2000", "Use Vertex AI with 2s delay")
|
|
857
900
|
.example("$0 batch batch.txt --output results.json", "Save results to file"));
|
|
858
901
|
},
|
|
859
|
-
handler: async (argv) => await
|
|
902
|
+
handler: async (argv) => await CLICommandFactory.executeBatch(argv),
|
|
860
903
|
};
|
|
861
904
|
}
|
|
862
905
|
/**
|
|
@@ -868,7 +911,7 @@ export class CLICommandFactory {
|
|
|
868
911
|
describe: "Manage AI provider configurations and status",
|
|
869
912
|
builder: (yargs) => {
|
|
870
913
|
return yargs
|
|
871
|
-
.command("status", "Check status of all configured AI providers", (y) =>
|
|
914
|
+
.command("status", "Check status of all configured AI providers", (y) => CLICommandFactory.buildOptions(y)
|
|
872
915
|
.example("$0 provider status", "Check all provider status")
|
|
873
916
|
.example("$0 provider status --verbose", "Detailed provider diagnostics")
|
|
874
917
|
.example("$0 provider status --quiet", "Minimal status output"), (argv) => CLICommandFactory.executeProviderStatus(argv))
|
|
@@ -884,7 +927,7 @@ export class CLICommandFactory {
|
|
|
884
927
|
return {
|
|
885
928
|
command: "status",
|
|
886
929
|
describe: "Check AI provider connectivity and performance (alias for provider status)",
|
|
887
|
-
builder: (yargs) =>
|
|
930
|
+
builder: (yargs) => CLICommandFactory.buildOptions(yargs)
|
|
888
931
|
.example("$0 status", "Quick provider status check")
|
|
889
932
|
.example("$0 status --verbose", "Detailed connectivity diagnostics")
|
|
890
933
|
.example("$0 status --format json", "Export status as JSON"),
|
|
@@ -918,25 +961,25 @@ export class CLICommandFactory {
|
|
|
918
961
|
describe: "Manage conversation memory",
|
|
919
962
|
builder: (yargs) => {
|
|
920
963
|
return yargs
|
|
921
|
-
.command("stats", "Show conversation memory statistics", (y) =>
|
|
964
|
+
.command("stats", "Show conversation memory statistics", (y) => CLICommandFactory.buildOptions(y)
|
|
922
965
|
.example("$0 memory stats", "Show memory usage statistics")
|
|
923
|
-
.example("$0 memory stats --format json", "Export stats as JSON"), async (argv) => await
|
|
924
|
-
.command("history <sessionId>", "Show conversation history for a session", (y) =>
|
|
966
|
+
.example("$0 memory stats --format json", "Export stats as JSON"), async (argv) => await CLICommandFactory.executeMemoryStats(argv))
|
|
967
|
+
.command("history <sessionId>", "Show conversation history for a session", (y) => CLICommandFactory.buildOptions(y)
|
|
925
968
|
.positional("sessionId", {
|
|
926
969
|
type: "string",
|
|
927
970
|
description: "Session ID to retrieve history for",
|
|
928
971
|
demandOption: true,
|
|
929
972
|
})
|
|
930
973
|
.example("$0 memory history session-123", "Show conversation history")
|
|
931
|
-
.example("$0 memory history session-123 --format json", "Export history as JSON"), async (argv) => await
|
|
932
|
-
.command("clear [sessionId]", "Clear conversation history", (y) =>
|
|
974
|
+
.example("$0 memory history session-123 --format json", "Export history as JSON"), async (argv) => await CLICommandFactory.executeMemoryHistory(argv))
|
|
975
|
+
.command("clear [sessionId]", "Clear conversation history", (y) => CLICommandFactory.buildOptions(y)
|
|
933
976
|
.positional("sessionId", {
|
|
934
977
|
type: "string",
|
|
935
978
|
description: "Session ID to clear (omit to clear all sessions)",
|
|
936
979
|
demandOption: false,
|
|
937
980
|
})
|
|
938
981
|
.example("$0 memory clear", "Clear all conversation history")
|
|
939
|
-
.example("$0 memory clear session-123", "Clear specific session"), async (argv) => await
|
|
982
|
+
.example("$0 memory clear session-123", "Clear specific session"), async (argv) => await CLICommandFactory.executeMemoryClear(argv))
|
|
940
983
|
.demandCommand(1, "Please specify a memory subcommand");
|
|
941
984
|
},
|
|
942
985
|
handler: () => { }, // No-op handler as subcommands handle everything
|
|
@@ -951,13 +994,13 @@ export class CLICommandFactory {
|
|
|
951
994
|
describe: "Manage NeuroLink configuration",
|
|
952
995
|
builder: (yargs) => {
|
|
953
996
|
return yargs
|
|
954
|
-
.command("init", "Interactive configuration setup wizard", (y) =>
|
|
997
|
+
.command("init", "Interactive configuration setup wizard", (y) => CLICommandFactory.buildOptions(y), async (_argv) => {
|
|
955
998
|
await configManager.initInteractive();
|
|
956
999
|
})
|
|
957
|
-
.command("show", "Display current configuration", (y) =>
|
|
1000
|
+
.command("show", "Display current configuration", (y) => CLICommandFactory.buildOptions(y), async (_argv) => {
|
|
958
1001
|
configManager.showConfig();
|
|
959
1002
|
})
|
|
960
|
-
.command("validate", "Validate current configuration", (y) =>
|
|
1003
|
+
.command("validate", "Validate current configuration", (y) => CLICommandFactory.buildOptions(y), async (_argv) => {
|
|
961
1004
|
const result = configManager.validateConfig();
|
|
962
1005
|
if (result.valid) {
|
|
963
1006
|
logger.always(chalk.green("✅ Configuration is valid"));
|
|
@@ -967,10 +1010,10 @@ export class CLICommandFactory {
|
|
|
967
1010
|
handleError(new Error(`Configuration has errors:\n • ${errorMessages}`), "Configuration validation");
|
|
968
1011
|
}
|
|
969
1012
|
})
|
|
970
|
-
.command("reset", "Reset configuration to defaults", (y) =>
|
|
1013
|
+
.command("reset", "Reset configuration to defaults", (y) => CLICommandFactory.buildOptions(y), async (_argv) => {
|
|
971
1014
|
configManager.resetConfig();
|
|
972
1015
|
})
|
|
973
|
-
.command("export", "Export current configuration", (y) =>
|
|
1016
|
+
.command("export", "Export current configuration", (y) => CLICommandFactory.buildOptions(y), (argv) => CLICommandFactory.executeConfigExport(argv))
|
|
974
1017
|
.demandCommand(1, "");
|
|
975
1018
|
},
|
|
976
1019
|
handler: () => { }, // No-op handler as subcommands handle everything
|
|
@@ -983,7 +1026,7 @@ export class CLICommandFactory {
|
|
|
983
1026
|
return {
|
|
984
1027
|
command: "validate",
|
|
985
1028
|
describe: "Validate current configuration (alias for 'config validate')",
|
|
986
|
-
builder: (yargs) =>
|
|
1029
|
+
builder: (yargs) => CLICommandFactory.buildOptions(yargs),
|
|
987
1030
|
handler: async (_argv) => {
|
|
988
1031
|
const result = configManager.validateConfig();
|
|
989
1032
|
if (result.valid) {
|
|
@@ -1003,11 +1046,11 @@ export class CLICommandFactory {
|
|
|
1003
1046
|
return {
|
|
1004
1047
|
command: "get-best-provider",
|
|
1005
1048
|
describe: "Show the best available AI provider",
|
|
1006
|
-
builder: (yargs) =>
|
|
1049
|
+
builder: (yargs) => CLICommandFactory.buildOptions(yargs)
|
|
1007
1050
|
.example("$0 get-best-provider", "Get best available provider")
|
|
1008
1051
|
.example("$0 get-best-provider --format json", "Get provider as JSON")
|
|
1009
1052
|
.example("$0 get-best-provider --quiet", "Just the provider name"),
|
|
1010
|
-
handler: async (argv) => await
|
|
1053
|
+
handler: async (argv) => await CLICommandFactory.executeGetBestProvider(argv),
|
|
1011
1054
|
};
|
|
1012
1055
|
}
|
|
1013
1056
|
/**
|
|
@@ -1024,7 +1067,7 @@ export class CLICommandFactory {
|
|
|
1024
1067
|
command: ["setup [provider]", "s [provider]"],
|
|
1025
1068
|
describe: "Interactive AI provider setup wizard",
|
|
1026
1069
|
builder: (yargs) => {
|
|
1027
|
-
return
|
|
1070
|
+
return CLICommandFactory.buildOptions(yargs
|
|
1028
1071
|
.positional("provider", {
|
|
1029
1072
|
type: "string",
|
|
1030
1073
|
description: "Specific provider to set up",
|
|
@@ -1073,7 +1116,7 @@ export class CLICommandFactory {
|
|
|
1073
1116
|
return {
|
|
1074
1117
|
command: "loop",
|
|
1075
1118
|
describe: "Start an interactive loop session with conversation management",
|
|
1076
|
-
builder: (yargs) =>
|
|
1119
|
+
builder: (yargs) => CLICommandFactory.buildOptions(yargs, {
|
|
1077
1120
|
"enable-conversation-memory": {
|
|
1078
1121
|
type: "boolean",
|
|
1079
1122
|
description: "Enable conversation memory for the loop session",
|
|
@@ -1200,12 +1243,12 @@ export class CLICommandFactory {
|
|
|
1200
1243
|
return {
|
|
1201
1244
|
command: "completion",
|
|
1202
1245
|
describe: "Generate shell completion script",
|
|
1203
|
-
builder: (yargs) =>
|
|
1246
|
+
builder: (yargs) => CLICommandFactory.buildOptions(yargs)
|
|
1204
1247
|
.example("$0 completion", "Generate shell completion")
|
|
1205
1248
|
.example("$0 completion > ~/.neurolink-completion.sh", "Save completion script")
|
|
1206
1249
|
.example("source ~/.neurolink-completion.sh", "Enable completions (bash)")
|
|
1207
1250
|
.epilogue("Add the completion script to your shell profile for persistent completions"),
|
|
1208
|
-
handler: async (argv) => await
|
|
1251
|
+
handler: async (argv) => await CLICommandFactory.executeCompletion(argv),
|
|
1209
1252
|
};
|
|
1210
1253
|
}
|
|
1211
1254
|
/**
|
|
@@ -1333,7 +1376,7 @@ export class CLICommandFactory {
|
|
|
1333
1376
|
else if (!argv.input) {
|
|
1334
1377
|
throw new Error('Input required. Use: neurolink generate "your prompt" or echo "prompt" | neurolink generate');
|
|
1335
1378
|
}
|
|
1336
|
-
const options =
|
|
1379
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
1337
1380
|
// Determine if video generation mode is enabled
|
|
1338
1381
|
const isVideoMode = options.outputMode === "video";
|
|
1339
1382
|
const spinnerMessage = isVideoMode
|
|
@@ -1405,7 +1448,7 @@ export class CLICommandFactory {
|
|
|
1405
1448
|
if (spinner) {
|
|
1406
1449
|
spinner.succeed(chalk.green("✅ Dry-run completed successfully!"));
|
|
1407
1450
|
}
|
|
1408
|
-
|
|
1451
|
+
CLICommandFactory.handleOutput(mockResult, options);
|
|
1409
1452
|
if (options.debug) {
|
|
1410
1453
|
logger.debug("\n" + chalk.yellow("Debug Information (Dry-run):"));
|
|
1411
1454
|
logger.debug("Provider:", mockResult.provider);
|
|
@@ -1413,7 +1456,7 @@ export class CLICommandFactory {
|
|
|
1413
1456
|
logger.debug("Mode: DRY-RUN (no actual API calls made)");
|
|
1414
1457
|
}
|
|
1415
1458
|
if (!globalSession.getCurrentSessionId()) {
|
|
1416
|
-
await
|
|
1459
|
+
await CLICommandFactory.flushLangfuseTraces();
|
|
1417
1460
|
process.exit(0);
|
|
1418
1461
|
}
|
|
1419
1462
|
}
|
|
@@ -1432,7 +1475,7 @@ export class CLICommandFactory {
|
|
|
1432
1475
|
}
|
|
1433
1476
|
// Video generation doesn't support tools, so auto-disable them
|
|
1434
1477
|
if (isVideoMode) {
|
|
1435
|
-
|
|
1478
|
+
CLICommandFactory.configureVideoMode(enhancedOptions, argv, options);
|
|
1436
1479
|
}
|
|
1437
1480
|
// Process CLI multimodal inputs
|
|
1438
1481
|
const imageBuffers = CLICommandFactory.processCliImages(argv.image);
|
|
@@ -1495,6 +1538,16 @@ export class CLICommandFactory {
|
|
|
1495
1538
|
validateDomainData: true,
|
|
1496
1539
|
}
|
|
1497
1540
|
: undefined,
|
|
1541
|
+
// RAG configuration
|
|
1542
|
+
rag: argv.ragFiles?.length
|
|
1543
|
+
? {
|
|
1544
|
+
files: argv.ragFiles,
|
|
1545
|
+
strategy: argv.ragStrategy,
|
|
1546
|
+
chunkSize: argv.ragChunkSize,
|
|
1547
|
+
chunkOverlap: argv.ragChunkOverlap,
|
|
1548
|
+
topK: argv.ragTopK,
|
|
1549
|
+
}
|
|
1550
|
+
: undefined,
|
|
1498
1551
|
});
|
|
1499
1552
|
if (spinner) {
|
|
1500
1553
|
if (isVideoMode) {
|
|
@@ -1512,12 +1565,12 @@ export class CLICommandFactory {
|
|
|
1512
1565
|
}
|
|
1513
1566
|
// Handle output with universal formatting (for text mode)
|
|
1514
1567
|
if (!isVideoMode) {
|
|
1515
|
-
|
|
1568
|
+
CLICommandFactory.handleOutput(result, options);
|
|
1516
1569
|
}
|
|
1517
1570
|
// Handle TTS audio file output if --tts-output is provided
|
|
1518
|
-
await
|
|
1571
|
+
await CLICommandFactory.handleTTSOutput(result, options);
|
|
1519
1572
|
// Handle video file output if --videoOutput is provided
|
|
1520
|
-
await
|
|
1573
|
+
await CLICommandFactory.handleVideoOutput(result, options);
|
|
1521
1574
|
if (options.debug) {
|
|
1522
1575
|
logger.debug("\n" + chalk.yellow("Debug Information:"));
|
|
1523
1576
|
logger.debug("Provider:", result.provider);
|
|
@@ -1530,7 +1583,7 @@ export class CLICommandFactory {
|
|
|
1530
1583
|
}
|
|
1531
1584
|
}
|
|
1532
1585
|
if (!globalSession.getCurrentSessionId()) {
|
|
1533
|
-
await
|
|
1586
|
+
await CLICommandFactory.flushLangfuseTraces();
|
|
1534
1587
|
process.exit(0);
|
|
1535
1588
|
}
|
|
1536
1589
|
}
|
|
@@ -1615,7 +1668,7 @@ export class CLICommandFactory {
|
|
|
1615
1668
|
model: mockAnalytics.model,
|
|
1616
1669
|
toolsUsed: [],
|
|
1617
1670
|
};
|
|
1618
|
-
const analyticsDisplay =
|
|
1671
|
+
const analyticsDisplay = CLICommandFactory.formatAnalyticsForTextMode(mockGenerateResult);
|
|
1619
1672
|
logger.always(analyticsDisplay);
|
|
1620
1673
|
}
|
|
1621
1674
|
if (options.enableEvaluation) {
|
|
@@ -1639,7 +1692,7 @@ export class CLICommandFactory {
|
|
|
1639
1692
|
logger.debug("Mode: DRY-RUN (no actual API calls made)");
|
|
1640
1693
|
}
|
|
1641
1694
|
if (!globalSession.getCurrentSessionId()) {
|
|
1642
|
-
await
|
|
1695
|
+
await CLICommandFactory.flushLangfuseTraces();
|
|
1643
1696
|
process.exit(0);
|
|
1644
1697
|
}
|
|
1645
1698
|
}
|
|
@@ -1702,9 +1755,19 @@ export class CLICommandFactory {
|
|
|
1702
1755
|
validateDomainData: true,
|
|
1703
1756
|
}
|
|
1704
1757
|
: undefined,
|
|
1758
|
+
// RAG configuration
|
|
1759
|
+
rag: argv.ragFiles?.length
|
|
1760
|
+
? {
|
|
1761
|
+
files: argv.ragFiles,
|
|
1762
|
+
strategy: argv.ragStrategy,
|
|
1763
|
+
chunkSize: argv.ragChunkSize,
|
|
1764
|
+
chunkOverlap: argv.ragChunkOverlap,
|
|
1765
|
+
topK: argv.ragTopK,
|
|
1766
|
+
}
|
|
1767
|
+
: undefined,
|
|
1705
1768
|
});
|
|
1706
|
-
const fullContent = await
|
|
1707
|
-
await
|
|
1769
|
+
const fullContent = await CLICommandFactory.processStreamWithTimeout(stream, options);
|
|
1770
|
+
await CLICommandFactory.displayStreamResults(stream, fullContent, options);
|
|
1708
1771
|
return fullContent;
|
|
1709
1772
|
}
|
|
1710
1773
|
/**
|
|
@@ -1822,7 +1885,7 @@ export class CLICommandFactory {
|
|
|
1822
1885
|
model: stream.model,
|
|
1823
1886
|
toolsUsed: stream.toolCalls?.map((tc) => tc.toolName) || [],
|
|
1824
1887
|
};
|
|
1825
|
-
const analyticsDisplay =
|
|
1888
|
+
const analyticsDisplay = CLICommandFactory.formatAnalyticsForTextMode(streamAnalytics);
|
|
1826
1889
|
logger.always(analyticsDisplay);
|
|
1827
1890
|
}
|
|
1828
1891
|
// Display evaluation after streaming
|
|
@@ -1864,7 +1927,7 @@ export class CLICommandFactory {
|
|
|
1864
1927
|
}
|
|
1865
1928
|
// Debug output for streaming
|
|
1866
1929
|
if (options.debug) {
|
|
1867
|
-
await
|
|
1930
|
+
await CLICommandFactory.logStreamDebugInfo({
|
|
1868
1931
|
provider: options.provider,
|
|
1869
1932
|
model: options.model,
|
|
1870
1933
|
});
|
|
@@ -1916,8 +1979,8 @@ export class CLICommandFactory {
|
|
|
1916
1979
|
* Execute the stream command
|
|
1917
1980
|
*/
|
|
1918
1981
|
static async executeStream(argv) {
|
|
1919
|
-
await
|
|
1920
|
-
const options =
|
|
1982
|
+
await CLICommandFactory.handleStdinInput(argv);
|
|
1983
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
1921
1984
|
if (!options.quiet) {
|
|
1922
1985
|
logger.always(chalk.blue("🔄 Streaming..."));
|
|
1923
1986
|
}
|
|
@@ -1926,16 +1989,16 @@ export class CLICommandFactory {
|
|
|
1926
1989
|
if (options.delay) {
|
|
1927
1990
|
await new Promise((resolve) => setTimeout(resolve, options.delay));
|
|
1928
1991
|
}
|
|
1929
|
-
const { inputText, contextMetadata } = await
|
|
1992
|
+
const { inputText, contextMetadata } = await CLICommandFactory.processStreamContext(argv, options);
|
|
1930
1993
|
// Handle dry-run mode for testing
|
|
1931
1994
|
if (options.dryRun) {
|
|
1932
|
-
await
|
|
1995
|
+
await CLICommandFactory.executeDryRunStream(options, contextMetadata);
|
|
1933
1996
|
return;
|
|
1934
1997
|
}
|
|
1935
|
-
const fullContent = await
|
|
1936
|
-
await
|
|
1998
|
+
const fullContent = await CLICommandFactory.executeRealStream(argv, options, inputText, contextMetadata);
|
|
1999
|
+
await CLICommandFactory.handleStreamOutput(options, fullContent);
|
|
1937
2000
|
if (!globalSession.getCurrentSessionId()) {
|
|
1938
|
-
await
|
|
2001
|
+
await CLICommandFactory.flushLangfuseTraces();
|
|
1939
2002
|
process.exit(0);
|
|
1940
2003
|
}
|
|
1941
2004
|
}
|
|
@@ -1947,7 +2010,7 @@ export class CLICommandFactory {
|
|
|
1947
2010
|
* Execute the batch command
|
|
1948
2011
|
*/
|
|
1949
2012
|
static async executeBatch(argv) {
|
|
1950
|
-
const options =
|
|
2013
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
1951
2014
|
const spinner = options.quiet ? null : ora().start();
|
|
1952
2015
|
try {
|
|
1953
2016
|
if (!argv.file) {
|
|
@@ -2055,9 +2118,9 @@ export class CLICommandFactory {
|
|
|
2055
2118
|
spinner.succeed(chalk.green("✅ Batch processing complete!"));
|
|
2056
2119
|
}
|
|
2057
2120
|
// Handle output with universal formatting
|
|
2058
|
-
|
|
2121
|
+
CLICommandFactory.handleOutput(results, options);
|
|
2059
2122
|
if (!globalSession.getCurrentSessionId()) {
|
|
2060
|
-
await
|
|
2123
|
+
await CLICommandFactory.flushLangfuseTraces();
|
|
2061
2124
|
process.exit(0);
|
|
2062
2125
|
}
|
|
2063
2126
|
}
|
|
@@ -2072,7 +2135,7 @@ export class CLICommandFactory {
|
|
|
2072
2135
|
* Execute config export command
|
|
2073
2136
|
*/
|
|
2074
2137
|
static async executeConfigExport(argv) {
|
|
2075
|
-
const options =
|
|
2138
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
2076
2139
|
try {
|
|
2077
2140
|
const config = {
|
|
2078
2141
|
providers: {
|
|
@@ -2091,7 +2154,7 @@ export class CLICommandFactory {
|
|
|
2091
2154
|
},
|
|
2092
2155
|
timestamp: new Date().toISOString(),
|
|
2093
2156
|
};
|
|
2094
|
-
|
|
2157
|
+
CLICommandFactory.handleOutput(config, options);
|
|
2095
2158
|
}
|
|
2096
2159
|
catch (error) {
|
|
2097
2160
|
handleError(error, "Configuration export");
|
|
@@ -2101,19 +2164,19 @@ export class CLICommandFactory {
|
|
|
2101
2164
|
* Execute get best provider command
|
|
2102
2165
|
*/
|
|
2103
2166
|
static async executeGetBestProvider(argv) {
|
|
2104
|
-
const options =
|
|
2167
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
2105
2168
|
try {
|
|
2106
2169
|
const { getBestProvider } = await import("../../lib/utils/providerUtils.js");
|
|
2107
2170
|
const bestProvider = await getBestProvider();
|
|
2108
2171
|
if (options.format === "json") {
|
|
2109
|
-
|
|
2172
|
+
CLICommandFactory.handleOutput({ provider: bestProvider }, options);
|
|
2110
2173
|
}
|
|
2111
2174
|
else {
|
|
2112
2175
|
if (!options.quiet) {
|
|
2113
2176
|
logger.always(chalk.green(`🎯 Best available provider: ${bestProvider}`));
|
|
2114
2177
|
}
|
|
2115
2178
|
else {
|
|
2116
|
-
|
|
2179
|
+
CLICommandFactory.handleOutput(bestProvider, options);
|
|
2117
2180
|
}
|
|
2118
2181
|
}
|
|
2119
2182
|
}
|
|
@@ -2125,7 +2188,7 @@ export class CLICommandFactory {
|
|
|
2125
2188
|
* Execute memory stats command
|
|
2126
2189
|
*/
|
|
2127
2190
|
static async executeMemoryStats(argv) {
|
|
2128
|
-
const options =
|
|
2191
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
2129
2192
|
const spinner = options.quiet
|
|
2130
2193
|
? null
|
|
2131
2194
|
: ora("🧠 Getting memory stats...").start();
|
|
@@ -2141,7 +2204,7 @@ export class CLICommandFactory {
|
|
|
2141
2204
|
if (spinner) {
|
|
2142
2205
|
spinner.succeed(chalk.green("✅ Memory stats retrieved (dry-run)"));
|
|
2143
2206
|
}
|
|
2144
|
-
|
|
2207
|
+
CLICommandFactory.handleOutput(mockStats, options);
|
|
2145
2208
|
return;
|
|
2146
2209
|
}
|
|
2147
2210
|
const stats = await sdk.getConversationStats();
|
|
@@ -2149,7 +2212,7 @@ export class CLICommandFactory {
|
|
|
2149
2212
|
spinner.succeed(chalk.green("✅ Memory stats retrieved"));
|
|
2150
2213
|
}
|
|
2151
2214
|
if (options.format === "json") {
|
|
2152
|
-
|
|
2215
|
+
CLICommandFactory.handleOutput(stats, options);
|
|
2153
2216
|
}
|
|
2154
2217
|
else {
|
|
2155
2218
|
logger.always(chalk.blue("📊 Conversation Memory Stats:"));
|
|
@@ -2175,7 +2238,7 @@ export class CLICommandFactory {
|
|
|
2175
2238
|
* Execute memory history command
|
|
2176
2239
|
*/
|
|
2177
2240
|
static async executeMemoryHistory(argv) {
|
|
2178
|
-
const options =
|
|
2241
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
2179
2242
|
const spinner = options.quiet
|
|
2180
2243
|
? null
|
|
2181
2244
|
: ora(`🧠 Getting history for ${argv.sessionId}...`).start();
|
|
@@ -2198,7 +2261,7 @@ export class CLICommandFactory {
|
|
|
2198
2261
|
if (spinner) {
|
|
2199
2262
|
spinner.succeed(chalk.green(`✅ History retrieved for ${argv.sessionId} (dry-run)`));
|
|
2200
2263
|
}
|
|
2201
|
-
|
|
2264
|
+
CLICommandFactory.handleOutput(mockHistory, options);
|
|
2202
2265
|
return;
|
|
2203
2266
|
}
|
|
2204
2267
|
const history = await sdk.getConversationHistory(argv.sessionId);
|
|
@@ -2210,7 +2273,7 @@ export class CLICommandFactory {
|
|
|
2210
2273
|
return;
|
|
2211
2274
|
}
|
|
2212
2275
|
if (options.format === "json") {
|
|
2213
|
-
|
|
2276
|
+
CLICommandFactory.handleOutput(history, options);
|
|
2214
2277
|
}
|
|
2215
2278
|
else {
|
|
2216
2279
|
logger.always(chalk.blue(`💬 Conversation History (${argv.sessionId}):`));
|
|
@@ -2238,7 +2301,7 @@ export class CLICommandFactory {
|
|
|
2238
2301
|
* Execute memory clear command
|
|
2239
2302
|
*/
|
|
2240
2303
|
static async executeMemoryClear(argv) {
|
|
2241
|
-
const options =
|
|
2304
|
+
const options = CLICommandFactory.processOptions(argv);
|
|
2242
2305
|
const isAllSessions = !argv.sessionId;
|
|
2243
2306
|
const target = isAllSessions ? "all sessions" : `session ${argv.sessionId}`;
|
|
2244
2307
|
const spinner = options.quiet
|
|
@@ -2257,7 +2320,7 @@ export class CLICommandFactory {
|
|
|
2257
2320
|
sessionId: argv.sessionId || null,
|
|
2258
2321
|
message: `${isAllSessions ? "All sessions" : "Session"} would be cleared`,
|
|
2259
2322
|
};
|
|
2260
|
-
|
|
2323
|
+
CLICommandFactory.handleOutput(result, options);
|
|
2261
2324
|
return;
|
|
2262
2325
|
}
|
|
2263
2326
|
let success;
|
|
@@ -2286,7 +2349,7 @@ export class CLICommandFactory {
|
|
|
2286
2349
|
action: isAllSessions ? "clear_all" : "clear_session",
|
|
2287
2350
|
sessionId: argv.sessionId || null,
|
|
2288
2351
|
};
|
|
2289
|
-
|
|
2352
|
+
CLICommandFactory.handleOutput(result, options);
|
|
2290
2353
|
}
|
|
2291
2354
|
else if (!success && !isAllSessions) {
|
|
2292
2355
|
logger.always(chalk.yellow(`⚠️ Session ${argv.sessionId} not found or already empty`));
|
package/dist/cli/parser.js
CHANGED
|
@@ -9,6 +9,7 @@ import { logger } from "../lib/utils/logger.js";
|
|
|
9
9
|
import { SetupCommandFactory } from "./factories/setupCommandFactory.js";
|
|
10
10
|
import { ServerCommandFactory } from "./commands/server.js";
|
|
11
11
|
import { ServeCommandFactory } from "./commands/serve.js";
|
|
12
|
+
import { ragCommand } from "./commands/rag.js";
|
|
12
13
|
// Enhanced CLI with Professional UX
|
|
13
14
|
export function initializeCliParser() {
|
|
14
15
|
return (yargs(hideBin(process.argv))
|
|
@@ -163,6 +164,8 @@ export function initializeCliParser() {
|
|
|
163
164
|
// Server Command Group - Using ServerCommandFactory
|
|
164
165
|
.command(ServerCommandFactory.createServerCommands())
|
|
165
166
|
// Serve Command - Simplified server start - Using ServeCommandFactory
|
|
166
|
-
.command(ServeCommandFactory.createServeCommands())
|
|
167
|
+
.command(ServeCommandFactory.createServeCommands())
|
|
168
|
+
// RAG Document Processing Commands
|
|
169
|
+
.command(ragCommand)); // Close the main return statement
|
|
167
170
|
}
|
|
168
171
|
//# sourceMappingURL=parser.js.map
|