@wanshi-kg/wanshi 0.1.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/LICENSE +21 -0
- package/README.md +458 -0
- package/dist/__tests__/helpers.js +27 -0
- package/dist/__tests__/helpers.js.map +1 -0
- package/dist/cli/commands/export.command.js +99 -0
- package/dist/cli/commands/export.command.js.map +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/inspectMerges.command.js +84 -0
- package/dist/cli/commands/inspectMerges.command.js.map +1 -0
- package/dist/cli/commands/metrics.command.js +196 -0
- package/dist/cli/commands/metrics.command.js.map +1 -0
- package/dist/cli/commands/process.command.js +82 -0
- package/dist/cli/commands/process.command.js.map +1 -0
- package/dist/cli/commands/watch.command.js +91 -0
- package/dist/cli/commands/watch.command.js.map +1 -0
- package/dist/cli/index.js +269 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/optionsToConfig.js +160 -0
- package/dist/cli/optionsToConfig.js.map +1 -0
- package/dist/config/index.js +59 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/legacyHints.js +113 -0
- package/dist/config/legacyHints.js.map +1 -0
- package/dist/config/schema.js +803 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/ui.js +221 -0
- package/dist/config/ui.js.map +1 -0
- package/dist/core/DirectoryProcessor.js +725 -0
- package/dist/core/DirectoryProcessor.js.map +1 -0
- package/dist/core/adapters/IStructuredAdapter.js +3 -0
- package/dist/core/adapters/IStructuredAdapter.js.map +1 -0
- package/dist/core/adapters/SqliteAdapter.js +267 -0
- package/dist/core/adapters/SqliteAdapter.js.map +1 -0
- package/dist/core/adapters/StructuredAdapterRegistry.js +31 -0
- package/dist/core/adapters/StructuredAdapterRegistry.js.map +1 -0
- package/dist/core/adapters/index.js +20 -0
- package/dist/core/adapters/index.js.map +1 -0
- package/dist/core/checkpoint/CheckpointService.js +188 -0
- package/dist/core/checkpoint/CheckpointService.js.map +1 -0
- package/dist/core/checkpoint/index.js +18 -0
- package/dist/core/checkpoint/index.js.map +1 -0
- package/dist/core/corpus/CorpusAnalyzer.js +266 -0
- package/dist/core/corpus/CorpusAnalyzer.js.map +1 -0
- package/dist/core/corpus/CorpusProfileStore.js +92 -0
- package/dist/core/corpus/CorpusProfileStore.js.map +1 -0
- package/dist/core/corpus/index.js +21 -0
- package/dist/core/corpus/index.js.map +1 -0
- package/dist/core/corpus/normalizeGlossary.js +60 -0
- package/dist/core/corpus/normalizeGlossary.js.map +1 -0
- package/dist/core/corpus/relPath.js +52 -0
- package/dist/core/corpus/relPath.js.map +1 -0
- package/dist/core/corpus/termFrequency.js +86 -0
- package/dist/core/corpus/termFrequency.js.map +1 -0
- package/dist/core/cost/CostMeter.js +235 -0
- package/dist/core/cost/CostMeter.js.map +1 -0
- package/dist/core/cost/index.js +19 -0
- package/dist/core/cost/index.js.map +1 -0
- package/dist/core/cost/prices.js +38 -0
- package/dist/core/cost/prices.js.map +1 -0
- package/dist/core/cv/ObjectDetectionService.js +119 -0
- package/dist/core/cv/ObjectDetectionService.js.map +1 -0
- package/dist/core/di/ContainerFactory.js +670 -0
- package/dist/core/di/ContainerFactory.js.map +1 -0
- package/dist/core/di/DIContainer.js +103 -0
- package/dist/core/di/DIContainer.js.map +1 -0
- package/dist/core/di/index.js +19 -0
- package/dist/core/di/index.js.map +1 -0
- package/dist/core/errors/CustomErrors.js +342 -0
- package/dist/core/errors/CustomErrors.js.map +1 -0
- package/dist/core/errors/index.js +18 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/export/KnowledgeGraphExportService.js +56 -0
- package/dist/core/export/KnowledgeGraphExportService.js.map +1 -0
- package/dist/core/export/index.js +19 -0
- package/dist/core/export/index.js.map +1 -0
- package/dist/core/export/strategies/GraphitiExportStrategy.js +115 -0
- package/dist/core/export/strategies/GraphitiExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/GraphvizDotExportStrategy.js +331 -0
- package/dist/core/export/strategies/GraphvizDotExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/IExportStrategy.js +3 -0
- package/dist/core/export/strategies/IExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/JsonExportStrategy.js +19 -0
- package/dist/core/export/strategies/JsonExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/JsonlExportStrategy.js +69 -0
- package/dist/core/export/strategies/JsonlExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/KblamExportStrategy.js +36 -0
- package/dist/core/export/strategies/KblamExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/LoraExportStrategy.js +46 -0
- package/dist/core/export/strategies/LoraExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/McpExportStrategy.js +67 -0
- package/dist/core/export/strategies/McpExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/index.js +25 -0
- package/dist/core/export/strategies/index.js.map +1 -0
- package/dist/core/export/strategies/kbTriples.js +60 -0
- package/dist/core/export/strategies/kbTriples.js.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/knowledge/KnowledgeGraphBuilder.js +627 -0
- package/dist/core/knowledge/KnowledgeGraphBuilder.js.map +1 -0
- package/dist/core/knowledge/MergeRecord.js +3 -0
- package/dist/core/knowledge/MergeRecord.js.map +1 -0
- package/dist/core/knowledge/canon/Canonicalizer.js +414 -0
- package/dist/core/knowledge/canon/Canonicalizer.js.map +1 -0
- package/dist/core/knowledge/canon/index.js +18 -0
- package/dist/core/knowledge/canon/index.js.map +1 -0
- package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js +92 -0
- package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js.map +1 -0
- package/dist/core/knowledge/contradiction/LlmContradictionChecker.js +52 -0
- package/dist/core/knowledge/contradiction/LlmContradictionChecker.js.map +1 -0
- package/dist/core/knowledge/contradiction/index.js +19 -0
- package/dist/core/knowledge/contradiction/index.js.map +1 -0
- package/dist/core/knowledge/grounding/KeywordGroundingChecker.js +33 -0
- package/dist/core/knowledge/grounding/KeywordGroundingChecker.js.map +1 -0
- package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js +82 -0
- package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js.map +1 -0
- package/dist/core/knowledge/grounding/index.js +20 -0
- package/dist/core/knowledge/grounding/index.js.map +1 -0
- package/dist/core/knowledge/grounding/verbalize.js +38 -0
- package/dist/core/knowledge/grounding/verbalize.js.map +1 -0
- package/dist/core/knowledge/images/imageMetaGraph.js +136 -0
- package/dist/core/knowledge/images/imageMetaGraph.js.map +1 -0
- package/dist/core/knowledge/index.js +20 -0
- package/dist/core/knowledge/index.js.map +1 -0
- package/dist/core/knowledge/merging/KnowledgeMerger.js +624 -0
- package/dist/core/knowledge/merging/KnowledgeMerger.js.map +1 -0
- package/dist/core/knowledge/references/ReferenceResolver.js +184 -0
- package/dist/core/knowledge/references/ReferenceResolver.js.map +1 -0
- package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js +401 -0
- package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js.map +1 -0
- package/dist/core/knowledge/references/citations/CitationResolver.js +95 -0
- package/dist/core/knowledge/references/citations/CitationResolver.js.map +1 -0
- package/dist/core/knowledge/references/citations/GrobidClient.js +143 -0
- package/dist/core/knowledge/references/citations/GrobidClient.js.map +1 -0
- package/dist/core/knowledge/references/citations/TitleIdResolver.js +101 -0
- package/dist/core/knowledge/references/citations/TitleIdResolver.js.map +1 -0
- package/dist/core/knowledge/references/web/FetchCacheService.js +114 -0
- package/dist/core/knowledge/references/web/FetchCacheService.js.map +1 -0
- package/dist/core/knowledge/references/web/GatedFetcher.js +228 -0
- package/dist/core/knowledge/references/web/GatedFetcher.js.map +1 -0
- package/dist/core/knowledge/references/web/WebReferenceProcessor.js +164 -0
- package/dist/core/knowledge/references/web/WebReferenceProcessor.js.map +1 -0
- package/dist/core/knowledge/search/KnowledgeGraphSearch.js +261 -0
- package/dist/core/knowledge/search/KnowledgeGraphSearch.js.map +1 -0
- package/dist/core/knowledge/vocabulary.js +162 -0
- package/dist/core/knowledge/vocabulary.js.map +1 -0
- package/dist/core/llm/EmbeddingService.js +113 -0
- package/dist/core/llm/EmbeddingService.js.map +1 -0
- package/dist/core/llm/OllamaService.js +146 -0
- package/dist/core/llm/OllamaService.js.map +1 -0
- package/dist/core/llm/OpenAICompatibleService.js +190 -0
- package/dist/core/llm/OpenAICompatibleService.js.map +1 -0
- package/dist/core/llm/OpenAIEmbeddingService.js +129 -0
- package/dist/core/llm/OpenAIEmbeddingService.js.map +1 -0
- package/dist/core/llm/embeddingUtils.js +25 -0
- package/dist/core/llm/embeddingUtils.js.map +1 -0
- package/dist/core/llm/index.js +23 -0
- package/dist/core/llm/index.js.map +1 -0
- package/dist/core/llm/prompts/PromptManager.js +388 -0
- package/dist/core/llm/prompts/PromptManager.js.map +1 -0
- package/dist/core/llm/prompts/PromptTemplateEngine.js +257 -0
- package/dist/core/llm/prompts/PromptTemplateEngine.js.map +1 -0
- package/dist/core/llm/prompts/templates/partials/examples/EXAMPLE_STYLE_GUIDE.md +84 -0
- package/dist/core/llm/prompts/templates/partials/examples/article.md +187 -0
- package/dist/core/llm/prompts/templates/partials/examples/code.md +229 -0
- package/dist/core/llm/prompts/templates/partials/examples/communication.md +205 -0
- package/dist/core/llm/prompts/templates/partials/examples/documentation.md +262 -0
- package/dist/core/llm/prompts/templates/partials/examples/financial.md +157 -0
- package/dist/core/llm/prompts/templates/partials/examples/legal.md +153 -0
- package/dist/core/llm/prompts/templates/partials/examples/logs.md +127 -0
- package/dist/core/llm/prompts/templates/partials/examples/medical.md +218 -0
- package/dist/core/llm/prompts/templates/partials/examples/notes.md +201 -0
- package/dist/core/llm/prompts/templates/partials/examples/research.md +208 -0
- package/dist/core/llm/prompts/templates/partials/examples/tabular.md +178 -0
- package/dist/core/llm/prompts/templates/partials/examples/transcript.md +204 -0
- package/dist/core/llm/prompts/templates/partials/retrieved-context.hbs +18 -0
- package/dist/core/llm/prompts/templates/v1/system.hbs +371 -0
- package/dist/core/llm/prompts/templates/v1/user.hbs +20 -0
- package/dist/core/llm/prompts/templates/v2/system.hbs +573 -0
- package/dist/core/llm/prompts/templates/v2/user.hbs +20 -0
- package/dist/core/llm/prompts/templates/v3/system.hbs +861 -0
- package/dist/core/llm/prompts/templates/v3/user.hbs +16 -0
- package/dist/core/llm/prompts/templates/v4/system.hbs +800 -0
- package/dist/core/llm/prompts/templates/v4/user.hbs +40 -0
- package/dist/core/llm/prompts/templates/v4.5/system.hbs +71 -0
- package/dist/core/llm/prompts/templates/v4.5/user.hbs +46 -0
- package/dist/core/llm/prompts/templates/v5/glossary/system.hbs +40 -0
- package/dist/core/llm/prompts/templates/v5/glossary/user.hbs +11 -0
- package/dist/core/llm/prompts/templates/v5/system.hbs +163 -0
- package/dist/core/llm/prompts/templates/v5/user.hbs +55 -0
- package/dist/core/pipeline/GroundingTransform.js +52 -0
- package/dist/core/pipeline/GroundingTransform.js.map +1 -0
- package/dist/core/pipeline/PipelineRunner.js +51 -0
- package/dist/core/pipeline/PipelineRunner.js.map +1 -0
- package/dist/core/pipeline/RelationFilterTransform.js +72 -0
- package/dist/core/pipeline/RelationFilterTransform.js.map +1 -0
- package/dist/core/pipeline/index.js +20 -0
- package/dist/core/pipeline/index.js.map +1 -0
- package/dist/core/processor/FileProcessor.js +184 -0
- package/dist/core/processor/FileProcessor.js.map +1 -0
- package/dist/core/processor/ProcessedRegistry.js +38 -0
- package/dist/core/processor/ProcessedRegistry.js.map +1 -0
- package/dist/core/processor/ast/AstSeedService.js +0 -0
- package/dist/core/processor/ast/AstSeedService.js.map +1 -0
- package/dist/core/processor/ast/AstSymbolStore.js +110 -0
- package/dist/core/processor/ast/AstSymbolStore.js.map +1 -0
- package/dist/core/processor/ast/index.js +19 -0
- package/dist/core/processor/ast/index.js.map +1 -0
- package/dist/core/processor/chunking/TextChunker.js +98 -0
- package/dist/core/processor/chunking/TextChunker.js.map +1 -0
- package/dist/core/processor/chunking/index.js +18 -0
- package/dist/core/processor/chunking/index.js.map +1 -0
- package/dist/core/processor/classifier/CONTENT_CLASSES.js +294 -0
- package/dist/core/processor/classifier/CONTENT_CLASSES.js.map +1 -0
- package/dist/core/processor/classifier/CascadeContentClassifier.js +107 -0
- package/dist/core/processor/classifier/CascadeContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/HeuristicContentClassifier.js +113 -0
- package/dist/core/processor/classifier/HeuristicContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/IContentTypeClassifier.js +3 -0
- package/dist/core/processor/classifier/IContentTypeClassifier.js.map +1 -0
- package/dist/core/processor/classifier/LlmContentClassifier.js +107 -0
- package/dist/core/processor/classifier/LlmContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js +498 -0
- package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js.map +1 -0
- package/dist/core/processor/classifier/index.js +21 -0
- package/dist/core/processor/classifier/index.js.map +1 -0
- package/dist/core/processor/classifier/mergeClassifications.js +32 -0
- package/dist/core/processor/classifier/mergeClassifications.js.map +1 -0
- package/dist/core/processor/index.js +20 -0
- package/dist/core/processor/index.js.map +1 -0
- package/dist/core/processor/readers/AudioReader.js +462 -0
- package/dist/core/processor/readers/AudioReader.js.map +1 -0
- package/dist/core/processor/readers/BinaryReader.js +90 -0
- package/dist/core/processor/readers/BinaryReader.js.map +1 -0
- package/dist/core/processor/readers/ChandraPdfReader.js +187 -0
- package/dist/core/processor/readers/ChandraPdfReader.js.map +1 -0
- package/dist/core/processor/readers/ChatExportReader.js +365 -0
- package/dist/core/processor/readers/ChatExportReader.js.map +1 -0
- package/dist/core/processor/readers/DoclingReader.js +445 -0
- package/dist/core/processor/readers/DoclingReader.js.map +1 -0
- package/dist/core/processor/readers/EmailReader.js +259 -0
- package/dist/core/processor/readers/EmailReader.js.map +1 -0
- package/dist/core/processor/readers/EpubReader.js +175 -0
- package/dist/core/processor/readers/EpubReader.js.map +1 -0
- package/dist/core/processor/readers/FileReader.js +90 -0
- package/dist/core/processor/readers/FileReader.js.map +1 -0
- package/dist/core/processor/readers/FileReaderFactory.js +49 -0
- package/dist/core/processor/readers/FileReaderFactory.js.map +1 -0
- package/dist/core/processor/readers/HtmlReader.js +371 -0
- package/dist/core/processor/readers/HtmlReader.js.map +1 -0
- package/dist/core/processor/readers/ImageReader.js +162 -0
- package/dist/core/processor/readers/ImageReader.js.map +1 -0
- package/dist/core/processor/readers/JsonFileReader.js +232 -0
- package/dist/core/processor/readers/JsonFileReader.js.map +1 -0
- package/dist/core/processor/readers/JupyterReader.js +178 -0
- package/dist/core/processor/readers/JupyterReader.js.map +1 -0
- package/dist/core/processor/readers/LatexReader.js +176 -0
- package/dist/core/processor/readers/LatexReader.js.map +1 -0
- package/dist/core/processor/readers/MarkdownReader.js +289 -0
- package/dist/core/processor/readers/MarkdownReader.js.map +1 -0
- package/dist/core/processor/readers/MarkerPdfReader.js +193 -0
- package/dist/core/processor/readers/MarkerPdfReader.js.map +1 -0
- package/dist/core/processor/readers/MistralOcrReader.js +198 -0
- package/dist/core/processor/readers/MistralOcrReader.js.map +1 -0
- package/dist/core/processor/readers/OfficeReader.js +174 -0
- package/dist/core/processor/readers/OfficeReader.js.map +1 -0
- package/dist/core/processor/readers/PdfReader.js +116 -0
- package/dist/core/processor/readers/PdfReader.js.map +1 -0
- package/dist/core/processor/readers/RtfReader.js +107 -0
- package/dist/core/processor/readers/RtfReader.js.map +1 -0
- package/dist/core/processor/readers/SubtitleReader.js +145 -0
- package/dist/core/processor/readers/SubtitleReader.js.map +1 -0
- package/dist/core/processor/readers/TesseractPdfReader.js +183 -0
- package/dist/core/processor/readers/TesseractPdfReader.js.map +1 -0
- package/dist/core/processor/readers/TextReader.js +129 -0
- package/dist/core/processor/readers/TextReader.js.map +1 -0
- package/dist/core/processor/readers/TranscriptReader.js +234 -0
- package/dist/core/processor/readers/TranscriptReader.js.map +1 -0
- package/dist/core/processor/readers/image/imageMetadata.js +155 -0
- package/dist/core/processor/readers/image/imageMetadata.js.map +1 -0
- package/dist/core/processor/readers/index.js +41 -0
- package/dist/core/processor/readers/index.js.map +1 -0
- package/dist/core/processor/readers/referenceExtraction.js +198 -0
- package/dist/core/processor/readers/referenceExtraction.js.map +1 -0
- package/dist/core/processor/readers/stripReferences.js +59 -0
- package/dist/core/processor/readers/stripReferences.js.map +1 -0
- package/dist/core/processor/readers/transcript/turnPacking.js +81 -0
- package/dist/core/processor/readers/transcript/turnPacking.js.map +1 -0
- package/dist/core/progress/NdjsonProgressEmitter.js +30 -0
- package/dist/core/progress/NdjsonProgressEmitter.js.map +1 -0
- package/dist/core/progress/NoopProgressEmitter.js +15 -0
- package/dist/core/progress/NoopProgressEmitter.js.map +1 -0
- package/dist/core/progress/index.js +19 -0
- package/dist/core/progress/index.js.map +1 -0
- package/dist/core/trace/TraceWriter.js +100 -0
- package/dist/core/trace/TraceWriter.js.map +1 -0
- package/dist/core/trace/events.js +13 -0
- package/dist/core/trace/events.js.map +1 -0
- package/dist/core/trace/index.js +20 -0
- package/dist/core/trace/index.js.map +1 -0
- package/dist/core/trace/lineage.js +97 -0
- package/dist/core/trace/lineage.js.map +1 -0
- package/dist/evaluation/BenchmarkRunner.js +171 -0
- package/dist/evaluation/BenchmarkRunner.js.map +1 -0
- package/dist/evaluation/classifier/ClassifierAccuracy.js +185 -0
- package/dist/evaluation/classifier/ClassifierAccuracy.js.map +1 -0
- package/dist/evaluation/classifier/labeledSamples.js +379 -0
- package/dist/evaluation/classifier/labeledSamples.js.map +1 -0
- package/dist/evaluation/compare/goldCompare.js +126 -0
- package/dist/evaluation/compare/goldCompare.js.map +1 -0
- package/dist/evaluation/crossre/compareScoring.js +30 -0
- package/dist/evaluation/crossre/compareScoring.js.map +1 -0
- package/dist/evaluation/datasets/CrossREDataset.js +170 -0
- package/dist/evaluation/datasets/CrossREDataset.js.map +1 -0
- package/dist/evaluation/datasets/IDataset.js +3 -0
- package/dist/evaluation/datasets/IDataset.js.map +1 -0
- package/dist/evaluation/datasets/RebelDataset.js +117 -0
- package/dist/evaluation/datasets/RebelDataset.js.map +1 -0
- package/dist/evaluation/datasets/RedocredDataset.js +218 -0
- package/dist/evaluation/datasets/RedocredDataset.js.map +1 -0
- package/dist/evaluation/datasets/SemEval2010Dataset.js +150 -0
- package/dist/evaluation/datasets/SemEval2010Dataset.js.map +1 -0
- package/dist/evaluation/index.js +33 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/matching/ExactMatcher.js +75 -0
- package/dist/evaluation/matching/ExactMatcher.js.map +1 -0
- package/dist/evaluation/matching/SemanticMatcher.js +143 -0
- package/dist/evaluation/matching/SemanticMatcher.js.map +1 -0
- package/dist/evaluation/metrics/TripleMetrics.js +64 -0
- package/dist/evaluation/metrics/TripleMetrics.js.map +1 -0
- package/dist/evaluation/mine/MineCheckpoint.js +114 -0
- package/dist/evaluation/mine/MineCheckpoint.js.map +1 -0
- package/dist/evaluation/mine/MineDataset.js +208 -0
- package/dist/evaluation/mine/MineDataset.js.map +1 -0
- package/dist/evaluation/mine/MineReporter.js +98 -0
- package/dist/evaluation/mine/MineReporter.js.map +1 -0
- package/dist/evaluation/mine/MineRunner.js +148 -0
- package/dist/evaluation/mine/MineRunner.js.map +1 -0
- package/dist/evaluation/mine/MineScorer.js +127 -0
- package/dist/evaluation/mine/MineScorer.js.map +1 -0
- package/dist/evaluation/mine/types.js +12 -0
- package/dist/evaluation/mine/types.js.map +1 -0
- package/dist/evaluation/reporters/ConsoleReporter.js +55 -0
- package/dist/evaluation/reporters/ConsoleReporter.js.map +1 -0
- package/dist/evaluation/reporters/JsonReporter.js +50 -0
- package/dist/evaluation/reporters/JsonReporter.js.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/quality/CompositeScore.js +61 -0
- package/dist/quality/CompositeScore.js.map +1 -0
- package/dist/quality/ConsistencyMetrics.js +70 -0
- package/dist/quality/ConsistencyMetrics.js.map +1 -0
- package/dist/quality/FactualMetrics.js +76 -0
- package/dist/quality/FactualMetrics.js.map +1 -0
- package/dist/quality/GraphHealthMetrics.js +68 -0
- package/dist/quality/GraphHealthMetrics.js.map +1 -0
- package/dist/quality/SemanticMetrics.js +102 -0
- package/dist/quality/SemanticMetrics.js.map +1 -0
- package/dist/quality/StructuralMetrics.js +60 -0
- package/dist/quality/StructuralMetrics.js.map +1 -0
- package/dist/quality/index.js +23 -0
- package/dist/quality/index.js.map +1 -0
- package/dist/shared/index.js +20 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/logger/Logger.js +3 -0
- package/dist/shared/logger/Logger.js.map +1 -0
- package/dist/shared/logger/LoggerFactory.js +75 -0
- package/dist/shared/logger/LoggerFactory.js.map +1 -0
- package/dist/shared/logger/index.js +19 -0
- package/dist/shared/logger/index.js.map +1 -0
- package/dist/shared/shutdown.js +30 -0
- package/dist/shared/shutdown.js.map +1 -0
- package/dist/shared/utils/agglomerativeCluster.js +269 -0
- package/dist/shared/utils/agglomerativeCluster.js.map +1 -0
- package/dist/shared/utils/astSymbols.js +69 -0
- package/dist/shared/utils/astSymbols.js.map +1 -0
- package/dist/shared/utils/cosineSimilarity.js +18 -0
- package/dist/shared/utils/cosineSimilarity.js.map +1 -0
- package/dist/shared/utils/directoryTree.js +184 -0
- package/dist/shared/utils/directoryTree.js.map +1 -0
- package/dist/shared/utils/documentOutline.js +74 -0
- package/dist/shared/utils/documentOutline.js.map +1 -0
- package/dist/shared/utils/index.js +24 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/jaroWinklerSimilarity.js +60 -0
- package/dist/shared/utils/jaroWinklerSimilarity.js.map +1 -0
- package/dist/shared/utils/parseJsonLenient.js +27 -0
- package/dist/shared/utils/parseJsonLenient.js.map +1 -0
- package/dist/shared/utils/readConfig.js +42 -0
- package/dist/shared/utils/readConfig.js.map +1 -0
- package/dist/shared/utils/readRtf.js +216 -0
- package/dist/shared/utils/readRtf.js.map +1 -0
- package/dist/shared/utils/softmax.js +26 -0
- package/dist/shared/utils/softmax.js.map +1 -0
- package/dist/types/ContentClass.js +3 -0
- package/dist/types/ContentClass.js.map +1 -0
- package/dist/types/CorpusProfile.js +3 -0
- package/dist/types/CorpusProfile.js.map +1 -0
- package/dist/types/IContradictionChecker.js +3 -0
- package/dist/types/IContradictionChecker.js.map +1 -0
- package/dist/types/ICorpusAnalyzer.js +3 -0
- package/dist/types/ICorpusAnalyzer.js.map +1 -0
- package/dist/types/IDirectoryProcessor.js +3 -0
- package/dist/types/IDirectoryProcessor.js.map +1 -0
- package/dist/types/IEmbeddingProvider.js +3 -0
- package/dist/types/IEmbeddingProvider.js.map +1 -0
- package/dist/types/IEmbeddingService.js +6 -0
- package/dist/types/IEmbeddingService.js.map +1 -0
- package/dist/types/IFileProcessor.js +3 -0
- package/dist/types/IFileProcessor.js.map +1 -0
- package/dist/types/IGroundingChecker.js +3 -0
- package/dist/types/IGroundingChecker.js.map +1 -0
- package/dist/types/IKnowledgeGraphBuilder.js +3 -0
- package/dist/types/IKnowledgeGraphBuilder.js.map +1 -0
- package/dist/types/IKnowledgeGraphExporter.js +3 -0
- package/dist/types/IKnowledgeGraphExporter.js.map +1 -0
- package/dist/types/IKnowledgeGraphMerger.js +3 -0
- package/dist/types/IKnowledgeGraphMerger.js.map +1 -0
- package/dist/types/IKnowledgeGraphSearch.js +3 -0
- package/dist/types/IKnowledgeGraphSearch.js.map +1 -0
- package/dist/types/ILLMProvider.js +3 -0
- package/dist/types/ILLMProvider.js.map +1 -0
- package/dist/types/ILLMService.js +3 -0
- package/dist/types/ILLMService.js.map +1 -0
- package/dist/types/IObjectDetector.js +3 -0
- package/dist/types/IObjectDetector.js.map +1 -0
- package/dist/types/IProcessingService.js +3 -0
- package/dist/types/IProcessingService.js.map +1 -0
- package/dist/types/IProgressEmitter.js +3 -0
- package/dist/types/IProgressEmitter.js.map +1 -0
- package/dist/types/IPromptManager.js +3 -0
- package/dist/types/IPromptManager.js.map +1 -0
- package/dist/types/KnowledgeGraph.js +3 -0
- package/dist/types/KnowledgeGraph.js.map +1 -0
- package/dist/types/MCPKnowledgeGraph.js +3 -0
- package/dist/types/MCPKnowledgeGraph.js.map +1 -0
- package/dist/types/Observation.js +21 -0
- package/dist/types/Observation.js.map +1 -0
- package/dist/types/ProcessingOptions.js +3 -0
- package/dist/types/ProcessingOptions.js.map +1 -0
- package/dist/types/index.js +40 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
const commander_1 = require("commander");
|
|
47
|
+
const info = __importStar(require("../../package.json"));
|
|
48
|
+
const commands_1 = require("./commands");
|
|
49
|
+
const di_1 = require("../core/di");
|
|
50
|
+
const shared_1 = require("../shared");
|
|
51
|
+
const config_1 = require("../config");
|
|
52
|
+
const optionsToConfig_1 = require("./optionsToConfig");
|
|
53
|
+
const program = new commander_1.Command();
|
|
54
|
+
program
|
|
55
|
+
.name(info.name)
|
|
56
|
+
.description(info.description)
|
|
57
|
+
.option("--config <file>", "path to yaml/json configuration file with processing options")
|
|
58
|
+
// Core Processing
|
|
59
|
+
.option("-i, --input <path>", "input directory (default: pwd)")
|
|
60
|
+
.option("-f, --filter <filter>", "include files by filter (default: **/*)")
|
|
61
|
+
.option("-e, --exclude <filter...>", "exclude files by filter(s) (default: empty)")
|
|
62
|
+
.option("-o, --output <path>", "output knowledge graph file")
|
|
63
|
+
.option("-d, --description <text>", "short description for the files being processed")
|
|
64
|
+
// LLM Configuration
|
|
65
|
+
.option("--provider <name>", "LLM provider for generation (ollama|openai). 'openai' targets any OpenAI-compatible endpoint via --host")
|
|
66
|
+
.option("-m, --model <name>", "LLM to use for generation")
|
|
67
|
+
.option("-h, --host <url>", "Ollama host URL, or OpenAI-compatible base URL when --provider openai")
|
|
68
|
+
.option("--api-key <key>", "API key for the OpenAI-compatible provider (falls back to OPENAI_API_KEY / WANSHI_API_KEY env)")
|
|
69
|
+
.option("--temperature <number>", "model temperature")
|
|
70
|
+
.option("--repeat-penalty <number>", "repeat penalty, Ollama only (>1.0 discourages repetition, <1.0 promotes it, 1.0 = off)")
|
|
71
|
+
.option("--context-length <number>", "model context length, should be long enough to fit system prompt, file content/chunk and response (default: 8192)")
|
|
72
|
+
.option("--max-tokens <number>", "max output tokens per generation; raise it (or lower --chunk-size) if large knowledge-graph JSON gets truncated mid-output")
|
|
73
|
+
.option("--seed <number>", "model seed")
|
|
74
|
+
.option("-s, --system <prompt|path>", "LLM system prompt or path to handlebars template")
|
|
75
|
+
.option("--prompt-version <version>", "prompt template version under templates/ (default v5; use v4.5 for the legacy prompts)")
|
|
76
|
+
.option("--embeddings-provider <name>", "embeddings provider (ollama|openai). Independent from --provider; defaults to local Ollama")
|
|
77
|
+
.option("--embeddings-model <name>", "embeddings model used for observations similarity merging")
|
|
78
|
+
.option("--embeddings-host <url>", "embeddings host / OpenAI-compatible base URL")
|
|
79
|
+
.option("--embeddings-api-key <key>", "API key for OpenAI-compatible embeddings (falls back to OPENAI_API_KEY / WANSHI_API_KEY env)")
|
|
80
|
+
.option("--embeddings-max-input-chars <n>", "truncate embedding inputs to at most N characters (auto-shrinks further if the model still rejects them)")
|
|
81
|
+
// Text Processing
|
|
82
|
+
.option("--chunking <mode>", "set chunking mode (disabled|auto|enabled)")
|
|
83
|
+
.option("-c, --chunk-size <size>", "maximum chunk size in characters")
|
|
84
|
+
.option("--overlap-size <size>", "overlap size between chunks in characters")
|
|
85
|
+
// Whisper Audio/Video Processing
|
|
86
|
+
.option("--asr <mode>", "set automatic speech recognition mode (disabled|auto|enabled)")
|
|
87
|
+
.option("--asr-engine <engine>", "transcription engine: whisper (built-in) | dual (vendored Python VAD+dual-STT+diarization, Apple-Silicon only)")
|
|
88
|
+
.option("--whisper-model <name>", "set whisper model (default: medium)")
|
|
89
|
+
.option("--language <lang>", "set speech recognition language (default: auto)")
|
|
90
|
+
.option("--translate", "translate to english (default: false)")
|
|
91
|
+
.option("--asr-models <which>", "dual engine: which ASR backends to run (both|parakeet|whisper)")
|
|
92
|
+
.option("--num-speakers <n>", "dual engine: hint the diarizer's speaker count", (v) => parseInt(v, 10))
|
|
93
|
+
// PDF reading engine selection
|
|
94
|
+
.option("--pdf-engine <engine>", "PDF reading engine: pdf2json (built-in) | tesseract (pure-JS/WASM OCR) | docling | marker (Python subprocess) | mistral (HTTP OCR API)")
|
|
95
|
+
.option("--marker-use-llm", "marker engine: enable --use_llm hybrid mode (better tables, costs LLM calls)")
|
|
96
|
+
.option("--tesseract-lang <lang>", "tesseract engine: OCR language code(s), e.g. \"eng\" or \"eng+deu\" (default: eng)")
|
|
97
|
+
.option("--chandra-method <method>", "chandra engine: backend hf (HuggingFace, M4-runnable) | vllm (GPU server) (default: hf)")
|
|
98
|
+
// Quarantine trailing references/bibliography sections before extraction
|
|
99
|
+
.option("--strip-references", "quarantine trailing references/bibliography sections before extraction (PDF + markdown, default: false)")
|
|
100
|
+
// Image metadata enrichment (deterministic, default off)
|
|
101
|
+
.option("--exif", "extract image EXIF (GPS→location, capture time→validAt, camera/author/software) into graph facts")
|
|
102
|
+
.option("--c2pa", "read C2PA content credentials (via c2patool) into a trust observation on the image")
|
|
103
|
+
.option("--object-detection", "CV pre-pass: detect objects in images → VLM context + cv-detection graph facts")
|
|
104
|
+
.option("--detection-mode <mode>", "object-detection mode: closed (COCO classes) | zero-shot (open-vocab via readers.cv.detection.labels)")
|
|
105
|
+
// Reference & link resolution (Phase 0, network-free; off by default)
|
|
106
|
+
.option("--reference-links", "resolve internal links ([x](./other.md), [[wikilinks]], HTML href) to corpus files as links_to edges (default: false)")
|
|
107
|
+
.option("--reference-citations", "parse bibliography + inline arXiv/DOI/PMID into cites edges (network-free; default: false)")
|
|
108
|
+
.option("--reference-follow", "follow internal links to discover & process referenced files (each once); network-free, confined to input (default: false)")
|
|
109
|
+
.option("--reference-web", "fetch allowlisted external web links, extract, emit references edges (opt-in network; needs references.web.allowlist) (default: false)")
|
|
110
|
+
// Reference & link resolution (Phase 2, citation span-fetch; opt-in network, off by default)
|
|
111
|
+
.option("--reference-citation-fetch", "resolve id-bearing cites to OA full text and fetch it (opt-in network; auto-enables citation extraction) (default: false)")
|
|
112
|
+
.option("--unpaywall-email <email>", "Unpaywall polite-pool email (or $UNPAYWALL_EMAIL) — required to resolve DOI citations")
|
|
113
|
+
.option("--grobid", "use a local GROBID service to link citation markers to references (enables span-select + faithfulness) (default: false)")
|
|
114
|
+
.option("--grobid-url <url>", "GROBID service base URL (default: http://localhost:8070)")
|
|
115
|
+
.option("--reference-title-resolver", "resolve id-less references to a DOI/arXiv id via Crossref/Semantic Scholar/OpenAlex (default: false)")
|
|
116
|
+
// JSON reading strategy
|
|
117
|
+
.option("--json-strategy <mode>", "JSON reader strategy: structural (compact + split on JSON structure, default) or raw (compact + text split)")
|
|
118
|
+
// Content Classification
|
|
119
|
+
.option("--classifier <mode>", "content classifier mode (disabled|heuristic|llm|cascade)")
|
|
120
|
+
// Enable Image Processing
|
|
121
|
+
.option("--images <mode>", "enable image processing (disabled|auto|enabled)")
|
|
122
|
+
// Context Retrieval
|
|
123
|
+
.option("--retrieval <mode>", "set retrieval mode (disabled|auto|enabled)")
|
|
124
|
+
.option("--retrieval-limit <number>", "context retrieval limit")
|
|
125
|
+
.option("--retrieval-scope <mode>", "retrieval granularity: chunk (per-chunk, default) or file (once per file from first chunk)")
|
|
126
|
+
// Inline Grounding Gate
|
|
127
|
+
.option("--grounding <mode>", "inline grounding gate: disabled | flag (annotate observations) | drop (remove ungrounded ones)")
|
|
128
|
+
.option("--grounding-min-score <number>", "minimum keyword-overlap grounding score (0..1) an observation must reach")
|
|
129
|
+
.option("--grounding-checker <checker>", "grounding checker: keyword (overlap) | minicheck (local NLI fact-checker)")
|
|
130
|
+
.option("--grounding-model <model>", "Ollama model for the minicheck grounding checker (default bespoke-minicheck:7b)")
|
|
131
|
+
// Corpus Analysis Pre-pass (experimental)
|
|
132
|
+
.option("--corpus-profiling <mode>", "corpus analysis pre-pass: disabled | enabled (term frequency + cached classification + LLM glossary, injected as naming hints)")
|
|
133
|
+
.option("--corpus-top-terms <number>", "number of most-frequent terms fed to the glossary call")
|
|
134
|
+
.option("--corpus-profile-path <path>", "corpus profile sidecar path (default: <output>.corpus-profile.json)")
|
|
135
|
+
// AST symbol seed (code extraction)
|
|
136
|
+
.option("--ast <mode>", "AST symbol seed: enabled | disabled (seed code definitions + exported members as entities before the LLM)")
|
|
137
|
+
// Knowledge Graph Merging
|
|
138
|
+
.option("--entity-similarity-threshold <number>", "Jaro-Winkler similarity threshold for entity names merging")
|
|
139
|
+
.option("--observation-similarity-threshold <number>", "how similar observation embeddings needs to be so they are considered same")
|
|
140
|
+
.option("--enable-similarity-merging", "set similarity merging for entities and observations")
|
|
141
|
+
.option("--supersession <mode>", "merge-time supersession (KG-10): disabled | heuristic | llm — invalidate an older contradicted fact instead of deleting it")
|
|
142
|
+
// Export Options
|
|
143
|
+
.option("--export-format <format>", "export format (json|jsonl|mcp-jsonl|dot|kblam|lora|graphiti)")
|
|
144
|
+
// Logging & Debug
|
|
145
|
+
.option("-L, --log-level <level>", "log level")
|
|
146
|
+
.option("-l, --log-file <path>", "log file")
|
|
147
|
+
.option("-D, --debug", "debug mode")
|
|
148
|
+
.option("-S, --silent", "silent mode")
|
|
149
|
+
.option("--progress-ndjson", "emit structured NDJSON progress events (and log lines) to stdout for a parent process / UI to consume; suppresses pretty logging so stdout stays a clean NDJSON stream")
|
|
150
|
+
// Resume / Continuation
|
|
151
|
+
.option("--resume", "checkpoint each processed chunk and skip already-done chunks on re-run (survives interrupted/credit-exhausted runs)")
|
|
152
|
+
.option("--checkpoint <path>", "checkpoint sidecar file path (default: <output>.checkpoint.jsonl)")
|
|
153
|
+
// Debug/observability run-trace
|
|
154
|
+
.option("--trace", "emit a structured decision run-trace to a JSONL sidecar (debug/observability; off by default)")
|
|
155
|
+
.option("--trace-path <path>", "trace sidecar file path (default: <output>.trace.jsonl)")
|
|
156
|
+
// Cost / token metering
|
|
157
|
+
.option("--cost", "meter LLM token usage + cost: print a pre-run estimate and an end-of-run tally (off by default)")
|
|
158
|
+
.option("--max-cost <amount>", "hard spend cap for this run; stops gracefully (checkpoints + exports) when exceeded (implies --cost)")
|
|
159
|
+
.option("--cost-ledger <path>", "cumulative cost ledger sidecar (default: <output>.cost.json)")
|
|
160
|
+
// Structured-emit adapters (data-sink track)
|
|
161
|
+
.option("--sqlite", "map .db/.sqlite files directly to a graph (tables→types, rows→entities, FK→edges; no LLM; off by default)")
|
|
162
|
+
// Runtime Modes
|
|
163
|
+
.option("-w, --watch", "watch for changes and update knowledge graph")
|
|
164
|
+
.option("--export-only", "convert an existing knowledge-graph JSON file (--input) to --export-format, written to --output")
|
|
165
|
+
.version(info.version)
|
|
166
|
+
.action((cliOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
// Resolve the effective config: defaults < file < CLI flags < env. CLI flags
|
|
169
|
+
// carry no Commander defaults, so an unset flag never overrides file config.
|
|
170
|
+
const fileRaw = cliOptions.config
|
|
171
|
+
? (yield (0, shared_1.readConfigurationFile)(cliOptions.config))
|
|
172
|
+
: {};
|
|
173
|
+
const cliRaw = (0, optionsToConfig_1.cliArgsToConfig)(cliOptions);
|
|
174
|
+
const merged = (0, optionsToConfig_1.deepMerge)(fileRaw, cliRaw);
|
|
175
|
+
// API keys may come from the environment instead of CLI/config.
|
|
176
|
+
// WANSHI_API_KEY is the branded var; KG_API_KEY kept as a deprecated fallback.
|
|
177
|
+
const envApiKey = process.env.OPENAI_API_KEY || process.env.WANSHI_API_KEY || process.env.KG_API_KEY;
|
|
178
|
+
if (envApiKey) {
|
|
179
|
+
if (!((_a = merged.llm) === null || _a === void 0 ? void 0 : _a.apiKey))
|
|
180
|
+
(0, optionsToConfig_1.setPath)(merged, "llm.apiKey", envApiKey);
|
|
181
|
+
if (!((_b = merged.embeddings) === null || _b === void 0 ? void 0 : _b.apiKey))
|
|
182
|
+
(0, optionsToConfig_1.setPath)(merged, "embeddings.apiKey", envApiKey);
|
|
183
|
+
}
|
|
184
|
+
let options;
|
|
185
|
+
try {
|
|
186
|
+
options = (0, config_1.parseConfig)(merged);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (error instanceof config_1.ConfigError) {
|
|
190
|
+
console.error(error.message);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
// Initialize DI container
|
|
196
|
+
const container = di_1.ContainerFactory.createContainer({
|
|
197
|
+
processingOptions: options,
|
|
198
|
+
});
|
|
199
|
+
const logger = yield container.resolve(di_1.TYPES.Logger);
|
|
200
|
+
try {
|
|
201
|
+
if (options.runtime.exportOnly) {
|
|
202
|
+
yield (0, commands_1.exportCommand)(container);
|
|
203
|
+
}
|
|
204
|
+
else if (options.runtime.watch) {
|
|
205
|
+
yield (0, commands_1.watchCommand)(container);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
yield (0, commands_1.processCommand)(container);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
logger.error(`Command failed: ${error}`);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
// `wanshi schema` — emit the config JSON Schema + UI metadata so a frontend can
|
|
217
|
+
// render the run form without duplicating the option list. The single source of
|
|
218
|
+
// truth is the Zod ConfigSchema in src/config.
|
|
219
|
+
program
|
|
220
|
+
.command("schema")
|
|
221
|
+
.description("print the configuration JSON Schema (+ UI group metadata) as JSON")
|
|
222
|
+
.option("--json", "compact single-line JSON (default is pretty-printed)")
|
|
223
|
+
.action((opts) => {
|
|
224
|
+
const payload = (0, config_1.configSchemaPayload)();
|
|
225
|
+
process.stdout.write(JSON.stringify(payload, null, opts.json ? 0 : 2) + "\n");
|
|
226
|
+
});
|
|
227
|
+
// `wanshi metrics <graph.json>` — the no-ground-truth A/B scorecard (entity/
|
|
228
|
+
// relation-type counts, self-loops, bidirectional contradictions, referential
|
|
229
|
+
// integrity, parallel edges). With --ground-truth it adds semantic triple
|
|
230
|
+
// precision/recall + fabricated-edge rate. Used to capture the baseline numbers
|
|
231
|
+
// and to score every canonicalization arm uniformly.
|
|
232
|
+
program
|
|
233
|
+
.command("metrics")
|
|
234
|
+
.description("compute knowledge-graph health metrics (and ground-truth scores) for a json graph")
|
|
235
|
+
.argument("<graph.json>", "path to a json-format knowledge graph ({entities, relations})")
|
|
236
|
+
.option("--config <file>", "config file (for embeddings/provider settings, used only with --ground-truth)")
|
|
237
|
+
.option("--ground-truth <file.jsonl>", "JSONL of ground-truth triples/edges for precision/recall + fabricated-edge rate")
|
|
238
|
+
.option("--match-threshold <number>", "semantic match cosine threshold (default 0.80)")
|
|
239
|
+
.option("--output <file>", "also write the full metrics report as JSON to this path")
|
|
240
|
+
.action((graphPath, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
241
|
+
try {
|
|
242
|
+
yield (0, commands_1.metricsCommand)(graphPath, opts);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
}));
|
|
249
|
+
// `wanshi inspect-merges <merges.jsonl>` — table view over the canonicalization
|
|
250
|
+
// merge log: what got fused, how tight each cluster was, suspicious over-merges
|
|
251
|
+
// first. The merge log is the experiment's deliverable, not the graph.
|
|
252
|
+
program
|
|
253
|
+
.command("inspect-merges")
|
|
254
|
+
.description("render the canonicalization merge log as a table (suspicious over-merges first)")
|
|
255
|
+
.argument("<merges.jsonl>", "path to a merges.jsonl emitted by a canonicalization run")
|
|
256
|
+
.option("--target <kind>", "only show 'entity' or 'relation' clusters")
|
|
257
|
+
.option("--suspect-below <number>", "flag clusters whose min intra-cluster sim is below this (default 0.80)")
|
|
258
|
+
.option("--limit <number>", "limit the number of rows printed")
|
|
259
|
+
.action((logPath, opts) => {
|
|
260
|
+
try {
|
|
261
|
+
(0, commands_1.inspectMergesCommand)(logPath, opts);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
program.parse();
|
|
269
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,yDAA2C;AAC3C,yCAMoB;AACpB,mCAAqD;AACrD,sCAA0D;AAC1D,sCAKmB;AACnB,uDAAwE;AAExE,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;KACf,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;KAE7B,MAAM,CAAC,iBAAiB,EAAE,8DAA8D,CAAC;IAE1F,kBAAkB;KACjB,MAAM,CAAC,oBAAoB,EAAE,gCAAgC,CAAC;KAC9D,MAAM,CAAC,uBAAuB,EAAE,yCAAyC,CAAC;KAC1E,MAAM,CAAC,2BAA2B,EAAE,6CAA6C,CAAC;KAClF,MAAM,CAAC,qBAAqB,EAAE,6BAA6B,CAAC;KAC5D,MAAM,CAAC,0BAA0B,EAAE,iDAAi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D,CAAC;KACtF,MAAM,CAAC,iBAAiB,EAAE,2CAA2C,CAAC;KACtE,MAAM,CAAC,0BAA0B,EAAE,wEAAwE,CAAC;KAC5G,MAAM,CAAC,kBAAkB,EAAE,kCAAkC,CAAC;KAC9D,MAAM,CAAC,CAAC,OAAe,EAAE,IAAI,EAAE,EAAE;IAChC,IAAI,CAAC;QACH,IAAA,+BAAoB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Translate Commander's flat, camelCase CLI options into the nested config shape
|
|
4
|
+
* (`src/config/schema.ts`). CLI flags stay flat and ergonomic (`--chunk-size`,
|
|
5
|
+
* not `--chunking.size`); this maps them onto their nested home so the schema —
|
|
6
|
+
* the single source of truth — validates and defaults everything.
|
|
7
|
+
*
|
|
8
|
+
* CLI flags carry NO Commander defaults (see cli/index.ts): an unset flag is
|
|
9
|
+
* absent here, so it never clobbers a file-config value. That makes precedence
|
|
10
|
+
* defaults < file < CLI < env work as a plain deep merge.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.FLAG_TO_PATH = void 0;
|
|
14
|
+
exports.setPath = setPath;
|
|
15
|
+
exports.cliArgsToConfig = cliArgsToConfig;
|
|
16
|
+
exports.deepMerge = deepMerge;
|
|
17
|
+
/** camelCase CLI option key → dotted path in the nested config. */
|
|
18
|
+
exports.FLAG_TO_PATH = {
|
|
19
|
+
input: "input",
|
|
20
|
+
filter: "filter",
|
|
21
|
+
exclude: "exclude",
|
|
22
|
+
output: "output",
|
|
23
|
+
description: "description",
|
|
24
|
+
// llm
|
|
25
|
+
provider: "llm.provider",
|
|
26
|
+
model: "llm.model",
|
|
27
|
+
host: "llm.host",
|
|
28
|
+
apiKey: "llm.apiKey",
|
|
29
|
+
temperature: "llm.temperature",
|
|
30
|
+
repeatPenalty: "llm.repeatPenalty",
|
|
31
|
+
contextLength: "llm.contextLength",
|
|
32
|
+
maxTokens: "llm.maxTokens",
|
|
33
|
+
seed: "llm.seed",
|
|
34
|
+
system: "llm.system",
|
|
35
|
+
promptVersion: "llm.promptVersion",
|
|
36
|
+
// embeddings
|
|
37
|
+
embeddingsProvider: "embeddings.provider",
|
|
38
|
+
embeddingsModel: "embeddings.model",
|
|
39
|
+
embeddingsHost: "embeddings.host",
|
|
40
|
+
embeddingsApiKey: "embeddings.apiKey",
|
|
41
|
+
embeddingsMaxInputChars: "embeddings.maxInputChars",
|
|
42
|
+
// chunking
|
|
43
|
+
chunking: "chunking.mode",
|
|
44
|
+
chunkSize: "chunking.size",
|
|
45
|
+
overlapSize: "chunking.overlap",
|
|
46
|
+
// readers
|
|
47
|
+
asr: "readers.asr.mode",
|
|
48
|
+
asrEngine: "readers.asr.engine",
|
|
49
|
+
whisperModel: "readers.asr.whisperModel",
|
|
50
|
+
language: "readers.asr.language",
|
|
51
|
+
translate: "readers.asr.translate",
|
|
52
|
+
asrModels: "readers.asr.dual.asr",
|
|
53
|
+
numSpeakers: "readers.asr.dual.numSpeakers",
|
|
54
|
+
pdfEngine: "readers.pdfEngine",
|
|
55
|
+
markerUseLlm: "readers.marker.useLlm",
|
|
56
|
+
tesseractLang: "readers.tesseract.lang",
|
|
57
|
+
chandraMethod: "readers.chandra.method",
|
|
58
|
+
stripReferences: "readers.stripReferences",
|
|
59
|
+
jsonStrategy: "readers.json.strategy",
|
|
60
|
+
images: "readers.images",
|
|
61
|
+
exif: "readers.exif.enabled",
|
|
62
|
+
c2pa: "readers.c2pa.enabled",
|
|
63
|
+
objectDetection: "readers.cv.detection.enabled",
|
|
64
|
+
detectionMode: "readers.cv.detection.mode",
|
|
65
|
+
// references (Phase 0, network-free; off by default)
|
|
66
|
+
referenceLinks: "references.internalLinks.enabled",
|
|
67
|
+
referenceCitations: "references.citations.enabled",
|
|
68
|
+
referenceFollow: "references.follow.enabled",
|
|
69
|
+
referenceWeb: "references.web.enabled",
|
|
70
|
+
// references — Phase 2 citation span-fetch (opt-in network)
|
|
71
|
+
referenceCitationFetch: "references.citations.fetch.enabled",
|
|
72
|
+
unpaywallEmail: "references.citations.fetch.unpaywallEmail",
|
|
73
|
+
grobid: "references.citations.grobid.enabled",
|
|
74
|
+
grobidUrl: "references.citations.grobid.url",
|
|
75
|
+
referenceTitleResolver: "references.citations.titleResolver.enabled",
|
|
76
|
+
// classifier
|
|
77
|
+
classifier: "classifier.mode",
|
|
78
|
+
// retrieval
|
|
79
|
+
retrieval: "retrieval.mode",
|
|
80
|
+
retrievalLimit: "retrieval.limit",
|
|
81
|
+
retrievalScope: "retrieval.scope",
|
|
82
|
+
// grounding
|
|
83
|
+
grounding: "grounding.mode",
|
|
84
|
+
groundingMinScore: "grounding.minScore",
|
|
85
|
+
groundingChecker: "grounding.checker",
|
|
86
|
+
groundingModel: "grounding.model",
|
|
87
|
+
// corpus
|
|
88
|
+
corpusProfiling: "corpus.profiling",
|
|
89
|
+
corpusTopTerms: "corpus.topTerms",
|
|
90
|
+
corpusProfilePath: "corpus.profilePath",
|
|
91
|
+
// ast
|
|
92
|
+
ast: "ast.mode",
|
|
93
|
+
// merging
|
|
94
|
+
entitySimilarityThreshold: "merging.entitySimilarityThreshold",
|
|
95
|
+
observationSimilarityThreshold: "merging.observationSimilarityThreshold",
|
|
96
|
+
enableSimilarityMerging: "merging.enableSimilarityMerging",
|
|
97
|
+
supersession: "merging.supersession",
|
|
98
|
+
// export
|
|
99
|
+
exportFormat: "export.format",
|
|
100
|
+
// logging
|
|
101
|
+
logLevel: "logging.level",
|
|
102
|
+
logFile: "logging.file",
|
|
103
|
+
debug: "logging.debug",
|
|
104
|
+
silent: "logging.silent",
|
|
105
|
+
progressNdjson: "logging.progressNdjson",
|
|
106
|
+
// resume
|
|
107
|
+
resume: "resume.enabled",
|
|
108
|
+
checkpoint: "resume.checkpointPath",
|
|
109
|
+
// trace (debug/observability run-trace)
|
|
110
|
+
trace: "trace.enabled",
|
|
111
|
+
tracePath: "trace.path",
|
|
112
|
+
// cost (token/cost metering; --max-cost auto-enables in ContainerFactory)
|
|
113
|
+
cost: "cost.enabled",
|
|
114
|
+
maxCost: "cost.maxCost",
|
|
115
|
+
costLedger: "cost.ledgerPath",
|
|
116
|
+
// structured-emit adapters (data-sink track)
|
|
117
|
+
sqlite: "adapters.sqlite.enabled",
|
|
118
|
+
// runtime
|
|
119
|
+
watch: "runtime.watch",
|
|
120
|
+
exportOnly: "runtime.exportOnly",
|
|
121
|
+
};
|
|
122
|
+
/** Set a dotted path on a nested object, creating intermediate objects. */
|
|
123
|
+
function setPath(target, path, value) {
|
|
124
|
+
const parts = path.split(".");
|
|
125
|
+
let node = target;
|
|
126
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
127
|
+
const key = parts[i];
|
|
128
|
+
if (typeof node[key] !== "object" || node[key] === null)
|
|
129
|
+
node[key] = {};
|
|
130
|
+
node = node[key];
|
|
131
|
+
}
|
|
132
|
+
node[parts[parts.length - 1]] = value;
|
|
133
|
+
}
|
|
134
|
+
/** Build a nested config partial from Commander's flat options (defined keys only). */
|
|
135
|
+
function cliArgsToConfig(cliOptions) {
|
|
136
|
+
const out = {};
|
|
137
|
+
for (const [flag, path] of Object.entries(exports.FLAG_TO_PATH)) {
|
|
138
|
+
const value = cliOptions[flag];
|
|
139
|
+
if (value !== undefined)
|
|
140
|
+
setPath(out, path, value);
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
/** Recursively merge `override` onto `base` (plain objects deep-merged, arrays/scalars replaced). */
|
|
145
|
+
function deepMerge(base, override) {
|
|
146
|
+
const out = Object.assign({}, base);
|
|
147
|
+
for (const [key, value] of Object.entries(override)) {
|
|
148
|
+
if (isPlainObject(value) && isPlainObject(out[key])) {
|
|
149
|
+
out[key] = deepMerge(out[key], value);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
out[key] = value;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
function isPlainObject(v) {
|
|
158
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=optionsToConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionsToConfig.js","sourceRoot":"","sources":["../../src/cli/optionsToConfig.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA6GH,0BASC;AAGD,0CAOC;AAGD,8BAUC;AA3ID,mEAAmE;AACtD,QAAA,YAAY,GAA2B;IAClD,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;IAC1B,MAAM;IACN,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,WAAW,EAAE,iBAAiB;IAC9B,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,mBAAmB;IAClC,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,mBAAmB;IAClC,aAAa;IACb,kBAAkB,EAAE,qBAAqB;IACzC,eAAe,EAAE,kBAAkB;IACnC,cAAc,EAAE,iBAAiB;IACjC,gBAAgB,EAAE,mBAAmB;IACrC,uBAAuB,EAAE,0BAA0B;IACnD,W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.ConfigError = exports.CONTROLLED_PATHS = exports.CONFIG_GROUPS = exports.formatConfigError = exports.LEGACY_KEY_HINTS = exports.ConfigSchema = void 0;
|
|
4
|
+
exports.parseConfig = parseConfig;
|
|
5
|
+
exports.configJsonSchema = configJsonSchema;
|
|
6
|
+
exports.configSchemaPayload = configSchemaPayload;
|
|
7
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
8
|
+
const schema_1 = require("./schema");
|
|
9
|
+
const legacyHints_1 = require("./legacyHints");
|
|
10
|
+
const ui_1 = require("./ui");
|
|
11
|
+
var schema_2 = require("./schema");
|
|
12
|
+
Object.defineProperty(exports, "ConfigSchema", { enumerable: true, get: function () { return schema_2.ConfigSchema; } });
|
|
13
|
+
var legacyHints_2 = require("./legacyHints");
|
|
14
|
+
Object.defineProperty(exports, "LEGACY_KEY_HINTS", { enumerable: true, get: function () { return legacyHints_2.LEGACY_KEY_HINTS; } });
|
|
15
|
+
Object.defineProperty(exports, "formatConfigError", { enumerable: true, get: function () { return legacyHints_2.formatConfigError; } });
|
|
16
|
+
var ui_2 = require("./ui");
|
|
17
|
+
Object.defineProperty(exports, "CONFIG_GROUPS", { enumerable: true, get: function () { return ui_2.CONFIG_GROUPS; } });
|
|
18
|
+
Object.defineProperty(exports, "CONTROLLED_PATHS", { enumerable: true, get: function () { return ui_2.CONTROLLED_PATHS; } });
|
|
19
|
+
/**
|
|
20
|
+
* Validate a raw (merged) config object and apply all defaults. Throws a
|
|
21
|
+
* `ConfigError` with an actionable message (legacy keys → new nested paths) on
|
|
22
|
+
* a validation failure.
|
|
23
|
+
*/
|
|
24
|
+
function parseConfig(raw) {
|
|
25
|
+
const result = schema_1.ConfigSchema.safeParse(raw !== null && raw !== void 0 ? raw : {});
|
|
26
|
+
if (!result.success) {
|
|
27
|
+
throw new ConfigError((0, legacyHints_1.formatConfigError)(result.error), result.error);
|
|
28
|
+
}
|
|
29
|
+
return result.data;
|
|
30
|
+
}
|
|
31
|
+
/** Error carrying a human-formatted config validation message. */
|
|
32
|
+
class ConfigError extends Error {
|
|
33
|
+
constructor(message, cause) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.cause = cause;
|
|
36
|
+
this.name = "ConfigError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ConfigError = ConfigError;
|
|
40
|
+
/** The config JSON Schema (inlined, no $refs) for external consumers. */
|
|
41
|
+
function configJsonSchema() {
|
|
42
|
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(schema_1.ConfigSchema, {
|
|
43
|
+
name: "KgGenConfig",
|
|
44
|
+
$refStrategy: "none",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The full schema payload the `wanshi schema` command emits and the frontend
|
|
49
|
+
* consumes: the JSON Schema (types/enums/defaults/help) plus UI layout metadata
|
|
50
|
+
* (groups + widget hints) so the run form is rendered without duplicating it.
|
|
51
|
+
*/
|
|
52
|
+
function configSchemaPayload() {
|
|
53
|
+
return {
|
|
54
|
+
jsonSchema: configJsonSchema(),
|
|
55
|
+
groups: ui_1.CONFIG_GROUPS,
|
|
56
|
+
controlledPaths: ui_1.CONTROLLED_PATHS,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAiDA,kCAMC;AAWD,4CAKC;AAOD,kDAUC;AAvFD,2DAAqD;AACrD,qCAWkB;AAClB,+CAAkD;AAClD,6BAAuD;AAEvD,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,6CAAoE;AAA3D,+GAAA,gBAAgB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAC5C,2BAAuD;AAA9C,mGAAA,aAAa,OAAA;AAAE,sGAAA,gBAAgB,OAAA;AAyBxC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,GAAY;IACtC,MAAM,MAAM,GAAG,qBAAY,CAAC,SAAS,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,WAAW,CAAC,IAAA,+BAAiB,EAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,kEAAkE;AAClE,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe,EAAW,KAAkB;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QADqB,UAAK,GAAL,KAAK,CAAa;QAEtD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAED,yEAAyE;AACzE,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,oCAAe,EAAC,qBAAY,EAAE;QACnC,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,MAAM;KACrB,CAA4B,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB;IAKjC,OAAO;QACL,UAAU,EAAE,gBAAgB,EAAE;QAC9B,MAAM,EAAE,kBAAa;QACrB,eAAe,EAAE,qBAAgB;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LEGACY_KEY_HINTS = void 0;
|
|
4
|
+
exports.formatConfigError = formatConfigError;
|
|
5
|
+
/**
|
|
6
|
+
* Map of legacy flat config keys → their new nested path, so a clean-break
|
|
7
|
+
* validation error can tell the user exactly where the key moved. Covers the
|
|
8
|
+
* pre-nesting flat shape (see docs/MIGRATION.md). Keys not listed here are reported
|
|
9
|
+
* as plain "unknown key".
|
|
10
|
+
*/
|
|
11
|
+
exports.LEGACY_KEY_HINTS = {
|
|
12
|
+
// llm
|
|
13
|
+
provider: "llm.provider",
|
|
14
|
+
model: "llm.model",
|
|
15
|
+
host: "llm.host",
|
|
16
|
+
apiKey: "llm.apiKey",
|
|
17
|
+
temperature: "llm.temperature",
|
|
18
|
+
repeatPenalty: "llm.repeatPenalty",
|
|
19
|
+
contextLength: "llm.contextLength",
|
|
20
|
+
maxTokens: "llm.maxTokens",
|
|
21
|
+
seed: "llm.seed",
|
|
22
|
+
system: "llm.system",
|
|
23
|
+
promptVersion: "llm.promptVersion",
|
|
24
|
+
// embeddings
|
|
25
|
+
embeddingsProvider: "embeddings.provider",
|
|
26
|
+
embeddingsModel: "embeddings.model",
|
|
27
|
+
embeddingsHost: "embeddings.host",
|
|
28
|
+
embeddingsApiKey: "embeddings.apiKey",
|
|
29
|
+
embeddingsMaxInputChars: "embeddings.maxInputChars",
|
|
30
|
+
// chunking
|
|
31
|
+
chunking: "chunking.mode",
|
|
32
|
+
chunkSize: "chunking.size",
|
|
33
|
+
overlapSize: "chunking.overlap",
|
|
34
|
+
// retrieval
|
|
35
|
+
retrieval: "retrieval.mode",
|
|
36
|
+
retrievalLimit: "retrieval.limit",
|
|
37
|
+
retrievalScope: "retrieval.scope",
|
|
38
|
+
// merging
|
|
39
|
+
entitySimilarityThreshold: "merging.entitySimilarityThreshold",
|
|
40
|
+
observationSimilarityThreshold: "merging.observationSimilarityThreshold",
|
|
41
|
+
enableSimilarityMerging: "merging.enableSimilarityMerging",
|
|
42
|
+
// grounding
|
|
43
|
+
grounding: "grounding.mode",
|
|
44
|
+
groundingMinScore: "grounding.minScore",
|
|
45
|
+
// corpus
|
|
46
|
+
corpusProfiling: "corpus.profiling",
|
|
47
|
+
corpusTopTerms: "corpus.topTerms",
|
|
48
|
+
corpusProfilePath: "corpus.profilePath",
|
|
49
|
+
corpusClustering: "corpus.clustering",
|
|
50
|
+
// classifier
|
|
51
|
+
classifier: "classifier.mode",
|
|
52
|
+
// readers
|
|
53
|
+
docling: "readers.pdfEngine: docling",
|
|
54
|
+
pdfEngine: "readers.pdfEngine",
|
|
55
|
+
images: "readers.images",
|
|
56
|
+
jsonStrategy: "readers.json.strategy",
|
|
57
|
+
jsonReader: "readers.json",
|
|
58
|
+
asr: "readers.asr.mode",
|
|
59
|
+
whisperModel: "readers.asr.whisperModel",
|
|
60
|
+
language: "readers.asr.language",
|
|
61
|
+
translate: "readers.asr.translate",
|
|
62
|
+
outline: "readers.outline",
|
|
63
|
+
// export
|
|
64
|
+
exportFormat: "export.format",
|
|
65
|
+
dotOptions: "export.dot",
|
|
66
|
+
// resume
|
|
67
|
+
resume: "resume.enabled",
|
|
68
|
+
checkpointPath: "resume.checkpointPath",
|
|
69
|
+
// logging
|
|
70
|
+
logLevel: "logging.level",
|
|
71
|
+
logFile: "logging.file",
|
|
72
|
+
debug: "logging.debug",
|
|
73
|
+
silent: "logging.silent",
|
|
74
|
+
progressNdjson: "logging.progressNdjson",
|
|
75
|
+
// runtime
|
|
76
|
+
watch: "runtime.watch",
|
|
77
|
+
exportOnly: "runtime.exportOnly",
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Render a ZodError from `parseConfig` into an actionable message. Unrecognized
|
|
81
|
+
* keys (the common symptom of a legacy flat config) are listed with their new
|
|
82
|
+
* nested location; everything else is shown as a normal validation problem.
|
|
83
|
+
*/
|
|
84
|
+
function formatConfigError(error) {
|
|
85
|
+
const lines = ["Invalid configuration:"];
|
|
86
|
+
const moved = [];
|
|
87
|
+
const other = [];
|
|
88
|
+
for (const issue of error.issues) {
|
|
89
|
+
if (issue.code === "unrecognized_keys") {
|
|
90
|
+
for (const key of issue.keys) {
|
|
91
|
+
const hint = exports.LEGACY_KEY_HINTS[key];
|
|
92
|
+
moved.push(hint
|
|
93
|
+
? ` • '${key}' → '${hint}' (the config format is now nested)`
|
|
94
|
+
: ` • unknown key '${key}'`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const path = issue.path.join(".") || "(root)";
|
|
99
|
+
other.push(` • ${path}: ${issue.message}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (moved.length) {
|
|
103
|
+
lines.push("", "Keys that moved (flat → nested):", ...moved);
|
|
104
|
+
}
|
|
105
|
+
if (other.length) {
|
|
106
|
+
lines.push("", "Validation problems:", ...other);
|
|
107
|
+
}
|
|
108
|
+
if (moved.length) {
|
|
109
|
+
lines.push("", "See docs/MIGRATION.md for the full flat → nested mapping.");
|
|
110
|
+
}
|
|
111
|
+
return lines.join("\n");
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=legacyHints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyHints.js","sourceRoot":"","sources":["../../src/config/legacyHints.ts"],"names":[],"mappings":";;;AAkFA,8CA+BC;AA/GD;;;;;GAKG;AACU,QAAA,gBAAgB,GAA2B;IACtD,MAAM;IACN,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,WAAW,EAAE,iBAAiB;IAC9B,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,mBAAmB;IAClC,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,mBAAmB;IAClC,aAAa;IACb,kBAAkB,EAAE,qBAAqB;IACzC,eAAe,EAAE,kBAAkB;IACnC,cAAc,EAAE,iBAAiB;IACjC,gBAAgB,EAAE,mBAAmB;IACrC,uBAAuB,EAAE,0BAA0B;IACnD,WAAW;IACX,QAAQ,EAAE,eAAe;IACzB,SAAS,EAAE,eAAe;IAC1B,WAAW,EAAE,kBAAkB;IAC/B,YAAY;IACZ,SAAS,EAAE,gBAAgB;IAC3B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,UAAU;IACV,yBAAyB,EAAE,mCAAmC;IAC9D,8BAA8B,E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