cogmem 3.6.2
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/BENCHMARKS.md +62 -0
- package/CHANGELOG.md +215 -0
- package/CONCURRENT_ACCESS.md +27 -0
- package/CONTRIBUTING.md +32 -0
- package/LICENSE +21 -0
- package/MEMORY_ATLAS.md +101 -0
- package/MEMORY_MODEL.md +179 -0
- package/README.md +751 -0
- package/RECALL_EXPLAINABILITY.md +152 -0
- package/RELEASE_CHECKLIST.md +92 -0
- package/SECURITY.md +21 -0
- package/dist/adapters/MarkdownSourceLoader.d.ts +5 -0
- package/dist/adapters/MarkdownSourceLoader.js +19 -0
- package/dist/adapters/conversation/ConversationMarkdownAdapter.d.ts +9 -0
- package/dist/adapters/conversation/ConversationMarkdownAdapter.js +233 -0
- package/dist/adapters/hermes/HermesStateDbAdapter.d.ts +10 -0
- package/dist/adapters/hermes/HermesStateDbAdapter.js +268 -0
- package/dist/adapters/hermes/HermesWorkspaceProfile.d.ts +15 -0
- package/dist/adapters/hermes/HermesWorkspaceProfile.js +82 -0
- package/dist/adapters/index.d.ts +15 -0
- package/dist/adapters/index.js +12 -0
- package/dist/adapters/openclaw/OpenClawAdapterSupport.d.ts +14 -0
- package/dist/adapters/openclaw/OpenClawAdapterSupport.js +29 -0
- package/dist/adapters/openclaw/OpenClawDailyMemoryAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawDailyMemoryAdapter.js +35 -0
- package/dist/adapters/openclaw/OpenClawMemoryIndexAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawMemoryIndexAdapter.js +23 -0
- package/dist/adapters/openclaw/OpenClawPersonaAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawPersonaAdapter.js +24 -0
- package/dist/adapters/openclaw/OpenClawSessionAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawSessionAdapter.js +15 -0
- package/dist/adapters/openclaw/OpenClawUserProfileAdapter.d.ts +8 -0
- package/dist/adapters/openclaw/OpenClawUserProfileAdapter.js +24 -0
- package/dist/adapters/openclaw/OpenClawWorkspaceProfile.d.ts +38 -0
- package/dist/adapters/openclaw/OpenClawWorkspaceProfile.js +199 -0
- package/dist/adapters/soul/SoulMarkdownAdapter.d.ts +14 -0
- package/dist/adapters/soul/SoulMarkdownAdapter.js +255 -0
- package/dist/adapters/types.d.ts +97 -0
- package/dist/adapters/types.js +185 -0
- package/dist/agent/AgentMemoryBackend.d.ts +291 -0
- package/dist/agent/AgentMemoryBackend.js +1272 -0
- package/dist/agent/AgentRecallQueryCompiler.d.ts +20 -0
- package/dist/agent/AgentRecallQueryCompiler.js +289 -0
- package/dist/agent/ContextHygiene.d.ts +9 -0
- package/dist/agent/ContextHygiene.js +20 -0
- package/dist/agent/MemoryUsageReceipt.d.ts +35 -0
- package/dist/agent/MemoryUsageReceipt.js +136 -0
- package/dist/agent/SessionWorkingState.d.ts +20 -0
- package/dist/agent/SessionWorkingState.js +94 -0
- package/dist/agent/index.d.ts +6 -0
- package/dist/agent/index.js +5 -0
- package/dist/algorithm/AlgorithmReviewBackend.d.ts +84 -0
- package/dist/algorithm/AlgorithmReviewBackend.js +261 -0
- package/dist/algorithm/AlgorithmReviewMetrics.d.ts +23 -0
- package/dist/algorithm/AlgorithmReviewMetrics.js +25 -0
- package/dist/algorithm/Phase2ModelAlgorithmReviewBackend.d.ts +38 -0
- package/dist/algorithm/Phase2ModelAlgorithmReviewBackend.js +372 -0
- package/dist/assets/FileAssetIngestionService.d.ts +32 -0
- package/dist/assets/FileAssetIngestionService.js +133 -0
- package/dist/assets/FileAssetStore.d.ts +36 -0
- package/dist/assets/FileAssetStore.js +152 -0
- package/dist/assets/FileBlockStore.d.ts +12 -0
- package/dist/assets/FileBlockStore.js +110 -0
- package/dist/assets/FileChunkStore.d.ts +23 -0
- package/dist/assets/FileChunkStore.js +179 -0
- package/dist/assets/FileChunker.d.ts +10 -0
- package/dist/assets/FileChunker.js +69 -0
- package/dist/assets/FileLoaderRegistry.d.ts +8 -0
- package/dist/assets/FileLoaderRegistry.js +21 -0
- package/dist/assets/FileLoaders.d.ts +37 -0
- package/dist/assets/FileLoaders.js +268 -0
- package/dist/assets/index.d.ts +10 -0
- package/dist/assets/index.js +7 -0
- package/dist/assets/providers/types.d.ts +47 -0
- package/dist/assets/providers/types.js +1 -0
- package/dist/assets/types.d.ts +159 -0
- package/dist/assets/types.js +1 -0
- package/dist/atlas/ActionFrameExtractor.d.ts +15 -0
- package/dist/atlas/ActionFrameExtractor.js +135 -0
- package/dist/atlas/MemoryAtlasIndexer.d.ts +32 -0
- package/dist/atlas/MemoryAtlasIndexer.js +74 -0
- package/dist/atlas/MemoryAtlasQueryCompiler.d.ts +23 -0
- package/dist/atlas/MemoryAtlasQueryCompiler.js +55 -0
- package/dist/atlas/MemoryAtlasService.d.ts +25 -0
- package/dist/atlas/MemoryAtlasService.js +216 -0
- package/dist/atlas/MemoryAtlasTypes.d.ts +107 -0
- package/dist/atlas/MemoryAtlasTypes.js +1 -0
- package/dist/atlas/index.d.ts +6 -0
- package/dist/atlas/index.js +5 -0
- package/dist/backend/SemanticBackend.d.ts +40 -0
- package/dist/backend/SemanticBackend.js +107 -0
- package/dist/batch/IngestionCursorStore.d.ts +52 -0
- package/dist/batch/IngestionCursorStore.js +153 -0
- package/dist/batch/InstalledBatchProcessor.d.ts +88 -0
- package/dist/batch/InstalledBatchProcessor.js +179 -0
- package/dist/batch/SourceOnboarding.d.ts +56 -0
- package/dist/batch/SourceOnboarding.js +366 -0
- package/dist/belief/BeliefGovernanceService.d.ts +59 -0
- package/dist/belief/BeliefGovernanceService.js +183 -0
- package/dist/belief/BeliefStore.d.ts +78 -0
- package/dist/belief/BeliefStore.js +898 -0
- package/dist/benchmark/BenchmarkRegistry.d.ts +16 -0
- package/dist/benchmark/BenchmarkRegistry.js +97 -0
- package/dist/benchmark/BenchmarkReport.d.ts +23 -0
- package/dist/benchmark/BenchmarkReport.js +62 -0
- package/dist/benchmark/BenchmarkRunner.d.ts +27 -0
- package/dist/benchmark/BenchmarkRunner.js +64 -0
- package/dist/benchmark/BrainEval.d.ts +134 -0
- package/dist/benchmark/BrainEval.js +252 -0
- package/dist/benchmark/ExternalBenchmarkRunner.d.ts +8 -0
- package/dist/benchmark/ExternalBenchmarkRunner.js +12 -0
- package/dist/benchmark/LongMemEvalAdapter.d.ts +46 -0
- package/dist/benchmark/LongMemEvalAdapter.js +88 -0
- package/dist/benchmark/LongMemEvalCli.d.ts +6 -0
- package/dist/benchmark/LongMemEvalCli.js +26 -0
- package/dist/bin/CliJson.d.ts +17 -0
- package/dist/bin/CliJson.js +20 -0
- package/dist/bin/brain-eval.d.ts +3 -0
- package/dist/bin/brain-eval.js +46 -0
- package/dist/bin/cogmem.d.ts +3 -0
- package/dist/bin/cogmem.js +95 -0
- package/dist/bin/compact.d.ts +3 -0
- package/dist/bin/compact.js +96 -0
- package/dist/bin/connect.d.ts +3 -0
- package/dist/bin/connect.js +398 -0
- package/dist/bin/doctor.d.ts +3 -0
- package/dist/bin/doctor.js +171 -0
- package/dist/bin/dream.d.ts +3 -0
- package/dist/bin/dream.js +65 -0
- package/dist/bin/episode.d.ts +3 -0
- package/dist/bin/episode.js +268 -0
- package/dist/bin/explain-recall.d.ts +3 -0
- package/dist/bin/explain-recall.js +139 -0
- package/dist/bin/import-hermes.d.ts +3 -0
- package/dist/bin/import-hermes.js +6 -0
- package/dist/bin/import-openclaw.d.ts +3 -0
- package/dist/bin/import-openclaw.js +6 -0
- package/dist/bin/import-support.d.ts +43 -0
- package/dist/bin/import-support.js +528 -0
- package/dist/bin/init.d.ts +30 -0
- package/dist/bin/init.js +761 -0
- package/dist/bin/mcp.d.ts +3 -0
- package/dist/bin/mcp.js +52 -0
- package/dist/bin/memory.d.ts +3 -0
- package/dist/bin/memory.js +803 -0
- package/dist/bin/migrate-vectors.d.ts +3 -0
- package/dist/bin/migrate-vectors.js +74 -0
- package/dist/bin/migrate.d.ts +3 -0
- package/dist/bin/migrate.js +95 -0
- package/dist/bin/normalize-transcript.d.ts +16 -0
- package/dist/bin/normalize-transcript.js +153 -0
- package/dist/bin/openclaw.d.ts +3 -0
- package/dist/bin/openclaw.js +78 -0
- package/dist/bin/prospective.d.ts +3 -0
- package/dist/bin/prospective.js +115 -0
- package/dist/bin/re-embed.d.ts +3 -0
- package/dist/bin/re-embed.js +46 -0
- package/dist/bin/repair.d.ts +3 -0
- package/dist/bin/repair.js +118 -0
- package/dist/bin/snapshot.d.ts +3 -0
- package/dist/bin/snapshot.js +100 -0
- package/dist/bin/strategy.d.ts +3 -0
- package/dist/bin/strategy.js +66 -0
- package/dist/bin/update-release.d.ts +15 -0
- package/dist/bin/update-release.js +62 -0
- package/dist/bin/update.d.ts +3 -0
- package/dist/bin/update.js +215 -0
- package/dist/binding/BindingClassifier.d.ts +19 -0
- package/dist/binding/BindingClassifier.js +270 -0
- package/dist/binding/BindingDecisionEngine.d.ts +11 -0
- package/dist/binding/BindingDecisionEngine.js +13 -0
- package/dist/binding/ClaimKeyGenerator.d.ts +4 -0
- package/dist/binding/ClaimKeyGenerator.js +21 -0
- package/dist/binding/MemoryBindingService.d.ts +28 -0
- package/dist/binding/MemoryBindingService.js +283 -0
- package/dist/binding/MemoryBindingTypes.d.ts +140 -0
- package/dist/binding/MemoryBindingTypes.js +1 -0
- package/dist/binding/TopicPathRegistry.d.ts +5 -0
- package/dist/binding/TopicPathRegistry.js +33 -0
- package/dist/binding/index.d.ts +12 -0
- package/dist/binding/index.js +6 -0
- package/dist/boards/ApprovalBoard.d.ts +14 -0
- package/dist/boards/ApprovalBoard.js +32 -0
- package/dist/boards/Board.d.ts +23 -0
- package/dist/boards/Board.js +1 -0
- package/dist/boards/BoardEventBuffer.d.ts +10 -0
- package/dist/boards/BoardEventBuffer.js +22 -0
- package/dist/boards/BoardEventBus.d.ts +15 -0
- package/dist/boards/BoardEventBus.js +38 -0
- package/dist/boards/BoardEventFilter.d.ts +5 -0
- package/dist/boards/BoardEventFilter.js +1 -0
- package/dist/boards/BoardRegistry.d.ts +11 -0
- package/dist/boards/BoardRegistry.js +15 -0
- package/dist/boards/ContextBoard.d.ts +15 -0
- package/dist/boards/ContextBoard.js +33 -0
- package/dist/boards/MemoryBoard.d.ts +13 -0
- package/dist/boards/MemoryBoard.js +30 -0
- package/dist/boards/ProcessBoard.d.ts +16 -0
- package/dist/boards/ProcessBoard.js +56 -0
- package/dist/boards/ProposalBoard.d.ts +13 -0
- package/dist/boards/ProposalBoard.js +37 -0
- package/dist/boards/ReasoningTraceBoard.d.ts +11 -0
- package/dist/boards/ReasoningTraceBoard.js +34 -0
- package/dist/boards/TaskBoard.d.ts +14 -0
- package/dist/boards/TaskBoard.js +37 -0
- package/dist/boards/index.d.ts +13 -0
- package/dist/boards/index.js +12 -0
- package/dist/config/CogmemConfig.d.ts +43 -0
- package/dist/config/CogmemConfig.js +247 -0
- package/dist/config/VectorDimension.d.ts +13 -0
- package/dist/config/VectorDimension.js +53 -0
- package/dist/context/ContextCortex.d.ts +71 -0
- package/dist/context/ContextCortex.js +156 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/core/ImportanceLevels.d.ts +4 -0
- package/dist/core/ImportanceLevels.js +6 -0
- package/dist/core/IntentParser.d.ts +12 -0
- package/dist/core/IntentParser.js +211 -0
- package/dist/core/MemoryGraph.d.ts +100 -0
- package/dist/core/MemoryGraph.js +860 -0
- package/dist/core/Metabolism.d.ts +43 -0
- package/dist/core/Metabolism.js +196 -0
- package/dist/core/Neuron.d.ts +20 -0
- package/dist/core/Neuron.js +51 -0
- package/dist/core/QueryClassifier.d.ts +36 -0
- package/dist/core/QueryClassifier.js +161 -0
- package/dist/core/Reflection.d.ts +42 -0
- package/dist/core/Reflection.js +183 -0
- package/dist/core/ResonanceCore.d.ts +26 -0
- package/dist/core/ResonanceCore.js +115 -0
- package/dist/core/Synapse.d.ts +10 -0
- package/dist/core/Synapse.js +27 -0
- package/dist/core/TwoStagePulseRanker.d.ts +16 -0
- package/dist/core/TwoStagePulseRanker.js +120 -0
- package/dist/dream/DreamScheduler.d.ts +47 -0
- package/dist/dream/DreamScheduler.js +156 -0
- package/dist/dream/index.d.ts +2 -0
- package/dist/dream/index.js +1 -0
- package/dist/embedding/EmbeddingProvider.d.ts +16 -0
- package/dist/embedding/EmbeddingProvider.js +12 -0
- package/dist/embedding/NeuronEmbeddingStore.d.ts +38 -0
- package/dist/embedding/NeuronEmbeddingStore.js +193 -0
- package/dist/embedding/OllamaEmbeddingProvider.d.ts +21 -0
- package/dist/embedding/OllamaEmbeddingProvider.js +65 -0
- package/dist/embedding/QwenAPIEmbeddingProvider.d.ts +26 -0
- package/dist/embedding/QwenAPIEmbeddingProvider.js +53 -0
- package/dist/embedding/ReEmbeddingPipeline.d.ts +30 -0
- package/dist/embedding/ReEmbeddingPipeline.js +119 -0
- package/dist/embedding/ReEmbeddingStatus.d.ts +10 -0
- package/dist/embedding/ReEmbeddingStatus.js +1 -0
- package/dist/embedding/index.d.ts +11 -0
- package/dist/embedding/index.js +5 -0
- package/dist/encryption/AesGcmEncryptionProvider.d.ts +9 -0
- package/dist/encryption/AesGcmEncryptionProvider.js +42 -0
- package/dist/encryption/EncryptionProvider.d.ts +6 -0
- package/dist/encryption/EncryptionProvider.js +3 -0
- package/dist/encryption/index.d.ts +4 -0
- package/dist/encryption/index.js +2 -0
- package/dist/engine/BeliefExtractor.d.ts +48 -0
- package/dist/engine/BeliefExtractor.js +1189 -0
- package/dist/engine/CognitiveGraphCompiler.d.ts +24 -0
- package/dist/engine/CognitiveGraphCompiler.js +243 -0
- package/dist/engine/ConsolidationPipeline.d.ts +66 -0
- package/dist/engine/ConsolidationPipeline.js +376 -0
- package/dist/engine/ConsolidationTrigger.d.ts +18 -0
- package/dist/engine/ConsolidationTrigger.js +41 -0
- package/dist/engine/CrossTopicSynthesizer.d.ts +28 -0
- package/dist/engine/CrossTopicSynthesizer.js +70 -0
- package/dist/engine/CrossTopicTrigger.d.ts +17 -0
- package/dist/engine/CrossTopicTrigger.js +29 -0
- package/dist/engine/DeepWriteConfig.d.ts +14 -0
- package/dist/engine/DeepWriteConfig.js +37 -0
- package/dist/engine/DeepWriteMemoryCompiler.d.ts +43 -0
- package/dist/engine/DeepWriteMemoryCompiler.js +42 -0
- package/dist/engine/DeepWriteMemoryOrchestrator.d.ts +60 -0
- package/dist/engine/DeepWriteMemoryOrchestrator.js +175 -0
- package/dist/engine/DeepWritePromotionPolicy.d.ts +48 -0
- package/dist/engine/DeepWritePromotionPolicy.js +514 -0
- package/dist/engine/DeepWriteRedactor.d.ts +14 -0
- package/dist/engine/DeepWriteRedactor.js +53 -0
- package/dist/engine/DreamCuratorSchedule.d.ts +18 -0
- package/dist/engine/DreamCuratorSchedule.js +95 -0
- package/dist/engine/DreamCuratorWorker.d.ts +67 -0
- package/dist/engine/DreamCuratorWorker.js +908 -0
- package/dist/engine/EntityResolutionEngine.d.ts +45 -0
- package/dist/engine/EntityResolutionEngine.js +105 -0
- package/dist/engine/EpisodicSemanticDistiller.d.ts +25 -0
- package/dist/engine/EpisodicSemanticDistiller.js +68 -0
- package/dist/engine/EvolutionVerifier.d.ts +39 -0
- package/dist/engine/EvolutionVerifier.js +104 -0
- package/dist/engine/FactCompiler.d.ts +41 -0
- package/dist/engine/FactCompiler.js +820 -0
- package/dist/engine/GraphCommunityEngine.d.ts +20 -0
- package/dist/engine/GraphCommunityEngine.js +91 -0
- package/dist/engine/ImportanceSignalDetector.d.ts +11 -0
- package/dist/engine/ImportanceSignalDetector.js +51 -0
- package/dist/engine/IngestionEngine.d.ts +44 -0
- package/dist/engine/IngestionEngine.js +182 -0
- package/dist/engine/InteractionBinder.d.ts +16 -0
- package/dist/engine/InteractionBinder.js +87 -0
- package/dist/engine/LocalSemanticCompiler.d.ts +40 -0
- package/dist/engine/LocalSemanticCompiler.js +111 -0
- package/dist/engine/MemoryConsolidationEngine.d.ts +11 -0
- package/dist/engine/MemoryConsolidationEngine.js +21 -0
- package/dist/engine/MemoryGate.d.ts +10 -0
- package/dist/engine/MemoryGate.js +34 -0
- package/dist/engine/OfflineConsolidationPipeline.d.ts +148 -0
- package/dist/engine/OfflineConsolidationPipeline.js +670 -0
- package/dist/engine/OrphanCleaner.d.ts +15 -0
- package/dist/engine/OrphanCleaner.js +27 -0
- package/dist/engine/PipelineMetrics.d.ts +32 -0
- package/dist/engine/PipelineMetrics.js +126 -0
- package/dist/engine/PrincipleDecayPolicy.d.ts +17 -0
- package/dist/engine/PrincipleDecayPolicy.js +64 -0
- package/dist/engine/TopologyCompiler.d.ts +25 -0
- package/dist/engine/TopologyCompiler.js +276 -0
- package/dist/engine/WorkingMemoryDelta.d.ts +23 -0
- package/dist/engine/WorkingMemoryDelta.js +63 -0
- package/dist/entity/EntityGovernanceService.d.ts +47 -0
- package/dist/entity/EntityGovernanceService.js +215 -0
- package/dist/entity/index.d.ts +3 -0
- package/dist/entity/index.js +1 -0
- package/dist/episode/CogmemBlockStripper.d.ts +11 -0
- package/dist/episode/CogmemBlockStripper.js +58 -0
- package/dist/episode/CorrectionResolver.d.ts +30 -0
- package/dist/episode/CorrectionResolver.js +17 -0
- package/dist/episode/EpisodeAssembler.d.ts +54 -0
- package/dist/episode/EpisodeAssembler.js +203 -0
- package/dist/episode/EpisodeImportIdentity.d.ts +7 -0
- package/dist/episode/EpisodeImportIdentity.js +17 -0
- package/dist/episode/EpisodeSemanticSummarizer.d.ts +4 -0
- package/dist/episode/EpisodeSemanticSummarizer.js +31 -0
- package/dist/episode/EpisodeStore.d.ts +189 -0
- package/dist/episode/EpisodeStore.js +680 -0
- package/dist/episode/EpisodeTypes.d.ts +96 -0
- package/dist/episode/EpisodeTypes.js +1 -0
- package/dist/episode/TurnRelationClassifier.d.ts +40 -0
- package/dist/episode/TurnRelationClassifier.js +205 -0
- package/dist/episode/index.d.ts +9 -0
- package/dist/episode/index.js +8 -0
- package/dist/eval/datasets/contradiction_injection.d.ts +3 -0
- package/dist/eval/datasets/contradiction_injection.js +56 -0
- package/dist/eval/datasets/noisy_tool_output_corpus.d.ts +16 -0
- package/dist/eval/datasets/noisy_tool_output_corpus.js +59 -0
- package/dist/eval/datasets/synthetic_long_conversation.d.ts +40 -0
- package/dist/eval/datasets/synthetic_long_conversation.js +136 -0
- package/dist/eval/runners/EvalRunner.d.ts +12 -0
- package/dist/eval/runners/EvalRunner.js +66 -0
- package/dist/eval/runners/ReportFormatter.d.ts +13 -0
- package/dist/eval/runners/ReportFormatter.js +59 -0
- package/dist/eval/strategy/ContextOutcomeStore.d.ts +12 -0
- package/dist/eval/strategy/ContextOutcomeStore.js +44 -0
- package/dist/eval/strategy/ContextPolicyScorer.d.ts +25 -0
- package/dist/eval/strategy/ContextPolicyScorer.js +58 -0
- package/dist/eval/strategy/MemoryUseJudge.d.ts +49 -0
- package/dist/eval/strategy/MemoryUseJudge.js +75 -0
- package/dist/eval/strategy/StrategyDiversitySelector.d.ts +8 -0
- package/dist/eval/strategy/StrategyDiversitySelector.js +44 -0
- package/dist/eval/strategy/StrategyRolloutEvaluator.d.ts +15 -0
- package/dist/eval/strategy/StrategyRolloutEvaluator.js +30 -0
- package/dist/eval/strategy/index.d.ts +6 -0
- package/dist/eval/strategy/index.js +5 -0
- package/dist/factory.d.ts +726 -0
- package/dist/factory.js +2118 -0
- package/dist/governance/CandidateReviewService.d.ts +33 -0
- package/dist/governance/CandidateReviewService.js +126 -0
- package/dist/governance/ContradictionResolver.d.ts +22 -0
- package/dist/governance/ContradictionResolver.js +54 -0
- package/dist/governance/CredibilityScorer.d.ts +10 -0
- package/dist/governance/CredibilityScorer.js +29 -0
- package/dist/governance/DecayPolicy.d.ts +18 -0
- package/dist/governance/DecayPolicy.js +28 -0
- package/dist/governance/MemoryExplain.d.ts +46 -0
- package/dist/governance/MemoryExplain.js +62 -0
- package/dist/governance/MemoryGovernanceExecutor.d.ts +18 -0
- package/dist/governance/MemoryGovernanceExecutor.js +37 -0
- package/dist/governance/MemoryGovernancePlan.d.ts +36 -0
- package/dist/governance/MemoryGovernancePlan.js +1 -0
- package/dist/governance/MemoryGovernanceValidator.d.ts +13 -0
- package/dist/governance/MemoryGovernanceValidator.js +53 -0
- package/dist/governance/ObservationHygieneRules.d.ts +17 -0
- package/dist/governance/ObservationHygieneRules.js +28 -0
- package/dist/governance/PiiRedactor.d.ts +20 -0
- package/dist/governance/PiiRedactor.js +37 -0
- package/dist/governance/SupersedeChain.d.ts +21 -0
- package/dist/governance/SupersedeChain.js +107 -0
- package/dist/governance/index.d.ts +14 -0
- package/dist/governance/index.js +6 -0
- package/dist/graph/BrainGraphView.d.ts +20 -0
- package/dist/graph/BrainGraphView.js +45 -0
- package/dist/host/openclaw/AutoMemoryPluginInstaller.d.ts +45 -0
- package/dist/host/openclaw/AutoMemoryPluginInstaller.js +1904 -0
- package/dist/internal.d.ts +148 -0
- package/dist/internal.js +144 -0
- package/dist/lexicon/coreMemoryLexicon.d.ts +96 -0
- package/dist/lexicon/coreMemoryLexicon.js +525 -0
- package/dist/lexicon/language-packs/en.d.ts +42 -0
- package/dist/lexicon/language-packs/en.js +41 -0
- package/dist/lexicon/language-packs/zh.d.ts +42 -0
- package/dist/lexicon/language-packs/zh.js +41 -0
- package/dist/lexicon/zh/entities.d.ts +2 -0
- package/dist/lexicon/zh/entities.js +17 -0
- package/dist/lexicon/zh/index.d.ts +5 -0
- package/dist/lexicon/zh/index.js +3 -0
- package/dist/lexicon/zh/stopwords.d.ts +2 -0
- package/dist/lexicon/zh/stopwords.js +22 -0
- package/dist/lexicon/zh/topics.d.ts +6 -0
- package/dist/lexicon/zh/topics.js +52 -0
- package/dist/mcp/CoreMcpTools.d.ts +33 -0
- package/dist/mcp/CoreMcpTools.js +832 -0
- package/dist/mcp/server.d.ts +5 -0
- package/dist/mcp/server.js +29 -0
- package/dist/meta/MetaObservationCollector.d.ts +37 -0
- package/dist/meta/MetaObservationCollector.js +348 -0
- package/dist/meta/PolicyProposalGenerator.d.ts +11 -0
- package/dist/meta/PolicyProposalGenerator.js +159 -0
- package/dist/meta/ProposalApplier.d.ts +18 -0
- package/dist/meta/ProposalApplier.js +91 -0
- package/dist/meta/ProposalConfigOverlay.d.ts +13 -0
- package/dist/meta/ProposalConfigOverlay.js +27 -0
- package/dist/meta/ProposalEvalRunner.d.ts +31 -0
- package/dist/meta/ProposalEvalRunner.js +62 -0
- package/dist/meta/ProposalLedger.d.ts +34 -0
- package/dist/meta/ProposalLedger.js +242 -0
- package/dist/meta/types.d.ts +63 -0
- package/dist/meta/types.js +1 -0
- package/dist/migrations/0001_init.d.ts +4 -0
- package/dist/migrations/0001_init.js +67 -0
- package/dist/migrations/0002_v06_platform.d.ts +10 -0
- package/dist/migrations/0002_v06_platform.js +103 -0
- package/dist/migrations/0003_v07_dialogues.d.ts +9 -0
- package/dist/migrations/0003_v07_dialogues.js +53 -0
- package/dist/migrations/0004_v09_self_improvement.d.ts +9 -0
- package/dist/migrations/0004_v09_self_improvement.js +100 -0
- package/dist/migrations/0005_dialogue_buffer.d.ts +8 -0
- package/dist/migrations/0005_dialogue_buffer.js +44 -0
- package/dist/migrations/0006_deep_write_memory.d.ts +3 -0
- package/dist/migrations/0006_deep_write_memory.js +54 -0
- package/dist/migrations/0007_deep_write_summaries.d.ts +3 -0
- package/dist/migrations/0007_deep_write_summaries.js +24 -0
- package/dist/migrations/0009_memory_importance.d.ts +3 -0
- package/dist/migrations/0009_memory_importance.js +18 -0
- package/dist/migrations/0010_skill_neurons.d.ts +3 -0
- package/dist/migrations/0010_skill_neurons.js +19 -0
- package/dist/migrations/0011_topic_path.d.ts +3 -0
- package/dist/migrations/0011_topic_path.js +19 -0
- package/dist/migrations/0012_governance_security.d.ts +3 -0
- package/dist/migrations/0012_governance_security.js +23 -0
- package/dist/migrations/0015_memory_governance.d.ts +3 -0
- package/dist/migrations/0015_memory_governance.js +74 -0
- package/dist/migrations/0016_entity_governance.d.ts +3 -0
- package/dist/migrations/0016_entity_governance.js +40 -0
- package/dist/migrations/0017_belief_graph.d.ts +3 -0
- package/dist/migrations/0017_belief_graph.js +41 -0
- package/dist/migrations/0018_temporal_memory.d.ts +3 -0
- package/dist/migrations/0018_temporal_memory.js +25 -0
- package/dist/migrations/0019_context_cortex.d.ts +3 -0
- package/dist/migrations/0019_context_cortex.js +19 -0
- package/dist/migrations/0020_prospective_memory.d.ts +3 -0
- package/dist/migrations/0020_prospective_memory.js +42 -0
- package/dist/migrations/0021_strategy_cortex.d.ts +3 -0
- package/dist/migrations/0021_strategy_cortex.js +23 -0
- package/dist/migrations/0022_episode_dream_engine.d.ts +3 -0
- package/dist/migrations/0022_episode_dream_engine.js +74 -0
- package/dist/migrations/0023_episode_dream_hardening.d.ts +3 -0
- package/dist/migrations/0023_episode_dream_hardening.js +65 -0
- package/dist/migrations/0024_episode_ontology_reliability.d.ts +3 -0
- package/dist/migrations/0024_episode_ontology_reliability.js +70 -0
- package/dist/migrations/0025_memory_atlas.d.ts +6 -0
- package/dist/migrations/0025_memory_atlas.js +268 -0
- package/dist/migrations/0026_runtime_governance_atlas_reliability.d.ts +3 -0
- package/dist/migrations/0026_runtime_governance_atlas_reliability.js +72 -0
- package/dist/migrations/0027_openclaw_upgrade_hotfix.d.ts +3 -0
- package/dist/migrations/0027_openclaw_upgrade_hotfix.js +21 -0
- package/dist/migrations/SchemaMigrationRunner.d.ts +21 -0
- package/dist/migrations/SchemaMigrationRunner.js +67 -0
- package/dist/migrations/index.d.ts +36 -0
- package/dist/migrations/index.js +57 -0
- package/dist/models/ModelCapabilityRouter.d.ts +17 -0
- package/dist/models/ModelCapabilityRouter.js +75 -0
- package/dist/models/ModelRegistry.d.ts +15 -0
- package/dist/models/ModelRegistry.js +132 -0
- package/dist/models/ModelRole.d.ts +19 -0
- package/dist/models/ModelRole.js +1 -0
- package/dist/models/UserInsight.d.ts +16 -0
- package/dist/models/UserInsight.js +9 -0
- package/dist/models/UserInsightExtractor.d.ts +19 -0
- package/dist/models/UserInsightExtractor.js +99 -0
- package/dist/models/UserModelManager.d.ts +21 -0
- package/dist/models/UserModelManager.js +41 -0
- package/dist/models/UserModelStore.d.ts +20 -0
- package/dist/models/UserModelStore.js +136 -0
- package/dist/models/WorkingMemoryReporter.d.ts +16 -0
- package/dist/models/WorkingMemoryReporter.js +38 -0
- package/dist/models/adapters/MemoryReviewAdapter.d.ts +12 -0
- package/dist/models/adapters/MemoryReviewAdapter.js +77 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +5 -0
- package/dist/models/providers/AnthropicClient.d.ts +17 -0
- package/dist/models/providers/AnthropicClient.js +40 -0
- package/dist/models/providers/OpenAICompatibleClient.d.ts +24 -0
- package/dist/models/providers/OpenAICompatibleClient.js +76 -0
- package/dist/observability/DecisionExplainer.d.ts +5 -0
- package/dist/observability/DecisionExplainer.js +62 -0
- package/dist/observability/TraceEvent.d.ts +11 -0
- package/dist/observability/TraceEvent.js +1 -0
- package/dist/observability/TraceQuery.d.ts +15 -0
- package/dist/observability/TraceQuery.js +28 -0
- package/dist/observability/TraceStore.d.ts +15 -0
- package/dist/observability/TraceStore.js +110 -0
- package/dist/observability/TraceWriter.d.ts +8 -0
- package/dist/observability/TraceWriter.js +14 -0
- package/dist/ontology/MemoryOntology.d.ts +4 -0
- package/dist/ontology/MemoryOntology.js +7 -0
- package/dist/prospective/ProspectiveMemoryService.d.ts +79 -0
- package/dist/prospective/ProspectiveMemoryService.js +258 -0
- package/dist/prospective/index.d.ts +2 -0
- package/dist/prospective/index.js +1 -0
- package/dist/public.d.ts +160 -0
- package/dist/public.js +115 -0
- package/dist/recall/BrainRecall.d.ts +96 -0
- package/dist/recall/BrainRecall.js +574 -0
- package/dist/recall/HierarchicalRecallRouter.d.ts +24 -0
- package/dist/recall/HierarchicalRecallRouter.js +62 -0
- package/dist/recall/RecallExplanation.d.ts +59 -0
- package/dist/recall/RecallExplanation.js +244 -0
- package/dist/recall/RecallGovernance.d.ts +10 -0
- package/dist/recall/RecallGovernance.js +83 -0
- package/dist/recall/RecallSufficiencyGate.d.ts +40 -0
- package/dist/recall/RecallSufficiencyGate.js +208 -0
- package/dist/recall/SourceContextMetadata.d.ts +49 -0
- package/dist/recall/SourceContextMetadata.js +134 -0
- package/dist/recall/TopicClassifier.d.ts +33 -0
- package/dist/recall/TopicClassifier.js +138 -0
- package/dist/recall/TopicDecayPolicy.d.ts +15 -0
- package/dist/recall/TopicDecayPolicy.js +46 -0
- package/dist/recall/TopicRegistry.d.ts +12 -0
- package/dist/recall/TopicRegistry.js +26 -0
- package/dist/recall/TopicSummaryBoard.d.ts +27 -0
- package/dist/recall/TopicSummaryBoard.js +139 -0
- package/dist/recall/VectorCandidateFilter.d.ts +50 -0
- package/dist/recall/VectorCandidateFilter.js +78 -0
- package/dist/retrieval/ConditionDslEvaluator.d.ts +33 -0
- package/dist/retrieval/ConditionDslEvaluator.js +160 -0
- package/dist/retrieval/EntityActivationIndex.d.ts +14 -0
- package/dist/retrieval/EntityActivationIndex.js +19 -0
- package/dist/retrieval/EvidenceFusionPolicy.d.ts +30 -0
- package/dist/retrieval/EvidenceFusionPolicy.js +112 -0
- package/dist/retrieval/EvidenceFusionRanker.d.ts +13 -0
- package/dist/retrieval/EvidenceFusionRanker.js +17 -0
- package/dist/retrieval/NarrativeRecallAssembler.d.ts +32 -0
- package/dist/retrieval/NarrativeRecallAssembler.js +27 -0
- package/dist/retrieval/NativeQueryParser.d.ts +23 -0
- package/dist/retrieval/NativeQueryParser.js +135 -0
- package/dist/retrieval/PlanDslExecutor.d.ts +67 -0
- package/dist/retrieval/PlanDslExecutor.js +194 -0
- package/dist/retrieval/PolicyRuntimeEvaluator.d.ts +48 -0
- package/dist/retrieval/PolicyRuntimeEvaluator.js +96 -0
- package/dist/retrieval/PolicySideEffectExecutor.d.ts +50 -0
- package/dist/retrieval/PolicySideEffectExecutor.js +202 -0
- package/dist/retrieval/PulseRetrievalEngine.d.ts +37 -0
- package/dist/retrieval/PulseRetrievalEngine.js +51 -0
- package/dist/retrieval/QueryCompiler.d.ts +18 -0
- package/dist/retrieval/QueryCompiler.js +97 -0
- package/dist/retrieval/QueryTimePendingEntityResolver.d.ts +67 -0
- package/dist/retrieval/QueryTimePendingEntityResolver.js +260 -0
- package/dist/retrieval/RetrievalPlanner.d.ts +42 -0
- package/dist/retrieval/RetrievalPlanner.js +209 -0
- package/dist/retrieval/TemporalBranchSearch.d.ts +38 -0
- package/dist/retrieval/TemporalBranchSearch.js +109 -0
- package/dist/retrieval/UniverseNavigator.d.ts +43 -0
- package/dist/retrieval/UniverseNavigator.js +75 -0
- package/dist/retrieval/UniverseTraversalExecutor.d.ts +21 -0
- package/dist/retrieval/UniverseTraversalExecutor.js +77 -0
- package/dist/routing/AnswerEvidenceTrace.d.ts +18 -0
- package/dist/routing/AnswerEvidenceTrace.js +1 -0
- package/dist/routing/BrainToolDispatcher.d.ts +37 -0
- package/dist/routing/BrainToolDispatcher.js +163 -0
- package/dist/routing/ConfidenceGate.d.ts +26 -0
- package/dist/routing/ConfidenceGate.js +40 -0
- package/dist/routing/ConfirmationPhraseMatcher.d.ts +9 -0
- package/dist/routing/ConfirmationPhraseMatcher.js +43 -0
- package/dist/routing/DirectReplyFormatter.d.ts +5 -0
- package/dist/routing/DirectReplyFormatter.js +55 -0
- package/dist/routing/EvidenceBudgetManager.d.ts +30 -0
- package/dist/routing/EvidenceBudgetManager.js +55 -0
- package/dist/routing/ExecutionLoop.d.ts +79 -0
- package/dist/routing/ExecutionLoop.js +234 -0
- package/dist/routing/IntentClassifier.d.ts +15 -0
- package/dist/routing/IntentClassifier.js +97 -0
- package/dist/routing/IntentPatternMatcher.d.ts +12 -0
- package/dist/routing/IntentPatternMatcher.js +206 -0
- package/dist/routing/IterativeLLMClarifier.d.ts +80 -0
- package/dist/routing/IterativeLLMClarifier.js +408 -0
- package/dist/routing/LLMToolSchema.d.ts +60 -0
- package/dist/routing/LLMToolSchema.js +143 -0
- package/dist/routing/MessageRouter.d.ts +20 -0
- package/dist/routing/MessageRouter.js +58 -0
- package/dist/routing/SessionContextSelector.d.ts +12 -0
- package/dist/routing/SessionContextSelector.js +86 -0
- package/dist/routing/SystemIntentClassifier.d.ts +15 -0
- package/dist/routing/SystemIntentClassifier.js +50 -0
- package/dist/routing/TaskPlan.d.ts +31 -0
- package/dist/routing/TaskPlan.js +1 -0
- package/dist/routing/TaskRouter.d.ts +13 -0
- package/dist/routing/TaskRouter.js +111 -0
- package/dist/routing/ToolCallParser.d.ts +16 -0
- package/dist/routing/ToolCallParser.js +123 -0
- package/dist/routing/ToolEvidenceNormalizer.d.ts +13 -0
- package/dist/routing/ToolEvidenceNormalizer.js +96 -0
- package/dist/routing/ToolEvidencePack.d.ts +36 -0
- package/dist/routing/ToolEvidencePack.js +84 -0
- package/dist/routing/ToolResultSanitizer.d.ts +19 -0
- package/dist/routing/ToolResultSanitizer.js +58 -0
- package/dist/routing/ToolUsePolicy.d.ts +78 -0
- package/dist/routing/ToolUsePolicy.js +163 -0
- package/dist/routing/index.d.ts +32 -0
- package/dist/routing/index.js +19 -0
- package/dist/routing/templates/ability_template.d.ts +2 -0
- package/dist/routing/templates/ability_template.js +34 -0
- package/dist/routing/templates/approvals_template.d.ts +2 -0
- package/dist/routing/templates/approvals_template.js +43 -0
- package/dist/routing/templates/context_template.d.ts +2 -0
- package/dist/routing/templates/context_template.js +25 -0
- package/dist/routing/templates/contradictions_template.d.ts +2 -0
- package/dist/routing/templates/contradictions_template.js +36 -0
- package/dist/routing/templates/importance_template.d.ts +2 -0
- package/dist/routing/templates/importance_template.js +23 -0
- package/dist/routing/templates/memory_template.d.ts +2 -0
- package/dist/routing/templates/memory_template.js +37 -0
- package/dist/routing/templates/self_manifest_template.d.ts +5 -0
- package/dist/routing/templates/self_manifest_template.js +64 -0
- package/dist/routing/templates/tasks_template.d.ts +2 -0
- package/dist/routing/templates/tasks_template.js +41 -0
- package/dist/routing/templates/trace_template.d.ts +2 -0
- package/dist/routing/templates/trace_template.js +37 -0
- package/dist/routing/tools/EntityExpandTool.d.ts +25 -0
- package/dist/routing/tools/EntityExpandTool.js +59 -0
- package/dist/routing/tools/NeuronContextTool.d.ts +32 -0
- package/dist/routing/tools/NeuronContextTool.js +66 -0
- package/dist/routing/tools/SecondaryRecallTool.d.ts +27 -0
- package/dist/routing/tools/SecondaryRecallTool.js +30 -0
- package/dist/routing/tools/SkillDiscoveryTool.d.ts +13 -0
- package/dist/routing/tools/SkillDiscoveryTool.js +11 -0
- package/dist/snapshot/SnapshotExporter.d.ts +13 -0
- package/dist/snapshot/SnapshotExporter.js +70 -0
- package/dist/snapshot/SnapshotHeader.d.ts +15 -0
- package/dist/snapshot/SnapshotHeader.js +1 -0
- package/dist/snapshot/SnapshotImporter.d.ts +20 -0
- package/dist/snapshot/SnapshotImporter.js +40 -0
- package/dist/snapshot/errors.d.ts +18 -0
- package/dist/snapshot/errors.js +34 -0
- package/dist/snapshot/index.d.ts +5 -0
- package/dist/snapshot/index.js +3 -0
- package/dist/storage/StorageCompactor.d.ts +30 -0
- package/dist/storage/StorageCompactor.js +95 -0
- package/dist/store/ActivationStore.d.ts +45 -0
- package/dist/store/ActivationStore.js +135 -0
- package/dist/store/BackgroundJobStore.d.ts +49 -0
- package/dist/store/BackgroundJobStore.js +156 -0
- package/dist/store/CandidateReviewStore.d.ts +33 -0
- package/dist/store/CandidateReviewStore.js +67 -0
- package/dist/store/CognitiveGraphStore.d.ts +42 -0
- package/dist/store/CognitiveGraphStore.js +193 -0
- package/dist/store/CompilerConfidenceStore.d.ts +20 -0
- package/dist/store/CompilerConfidenceStore.js +76 -0
- package/dist/store/DeepWriteCandidateStore.d.ts +94 -0
- package/dist/store/DeepWriteCandidateStore.js +290 -0
- package/dist/store/DeterministicEmbedder.d.ts +10 -0
- package/dist/store/DeterministicEmbedder.js +24 -0
- package/dist/store/DreamLedgerStore.d.ts +22 -0
- package/dist/store/DreamLedgerStore.js +84 -0
- package/dist/store/Embedder.d.ts +14 -0
- package/dist/store/Embedder.js +52 -0
- package/dist/store/EmbedderFactory.d.ts +12 -0
- package/dist/store/EmbedderFactory.js +51 -0
- package/dist/store/EntityStore.d.ts +195 -0
- package/dist/store/EntityStore.js +941 -0
- package/dist/store/EventStore.d.ts +118 -0
- package/dist/store/EventStore.js +699 -0
- package/dist/store/FactStore.d.ts +76 -0
- package/dist/store/FactStore.js +356 -0
- package/dist/store/HnswlibVectorStore.d.ts +2 -0
- package/dist/store/HnswlibVectorStore.js +1 -0
- package/dist/store/IVectorStore.d.ts +32 -0
- package/dist/store/IVectorStore.js +1 -0
- package/dist/store/InteractionUnitStore.d.ts +52 -0
- package/dist/store/InteractionUnitStore.js +167 -0
- package/dist/store/MemoryAtlasStore.d.ts +60 -0
- package/dist/store/MemoryAtlasStore.js +500 -0
- package/dist/store/MemoryBindingStore.d.ts +77 -0
- package/dist/store/MemoryBindingStore.js +608 -0
- package/dist/store/MemoryGovernanceStore.d.ts +23 -0
- package/dist/store/MemoryGovernanceStore.js +103 -0
- package/dist/store/MemoryInspectionStore.d.ts +61 -0
- package/dist/store/MemoryInspectionStore.js +215 -0
- package/dist/store/PlanRuntimeStore.d.ts +83 -0
- package/dist/store/PlanRuntimeStore.js +257 -0
- package/dist/store/PolicyExecutionProjector.d.ts +17 -0
- package/dist/store/PolicyExecutionProjector.js +115 -0
- package/dist/store/PolicyExecutionStore.d.ts +62 -0
- package/dist/store/PolicyExecutionStore.js +290 -0
- package/dist/store/PolicyProjectionStore.d.ts +18 -0
- package/dist/store/PolicyProjectionStore.js +61 -0
- package/dist/store/ProjectionObservabilityStore.d.ts +38 -0
- package/dist/store/ProjectionObservabilityStore.js +310 -0
- package/dist/store/ReasoningChainStore.d.ts +13 -0
- package/dist/store/ReasoningChainStore.js +74 -0
- package/dist/store/RuntimeProjectionStore.d.ts +18 -0
- package/dist/store/RuntimeProjectionStore.js +61 -0
- package/dist/store/RuntimeProjector.d.ts +17 -0
- package/dist/store/RuntimeProjector.js +119 -0
- package/dist/store/SqliteVecStore.d.ts +25 -0
- package/dist/store/SqliteVecStore.js +126 -0
- package/dist/store/SummaryStore.d.ts +56 -0
- package/dist/store/SummaryStore.js +225 -0
- package/dist/store/TemporalAdjacencyStore.d.ts +49 -0
- package/dist/store/TemporalAdjacencyStore.js +300 -0
- package/dist/store/TopologyStore.d.ts +89 -0
- package/dist/store/TopologyStore.js +657 -0
- package/dist/store/VectorProjector.d.ts +22 -0
- package/dist/store/VectorProjector.js +125 -0
- package/dist/store/VectorStore.d.ts +35 -0
- package/dist/store/VectorStore.js +201 -0
- package/dist/strategy/StrategyCapsule.d.ts +44 -0
- package/dist/strategy/StrategyCapsule.js +1 -0
- package/dist/strategy/StrategyConditionedCandidateBuilder.d.ts +9 -0
- package/dist/strategy/StrategyConditionedCandidateBuilder.js +11 -0
- package/dist/strategy/StrategyContextFormatter.d.ts +3 -0
- package/dist/strategy/StrategyContextFormatter.js +25 -0
- package/dist/strategy/StrategyCortex.d.ts +28 -0
- package/dist/strategy/StrategyCortex.js +78 -0
- package/dist/strategy/StrategyTemplateRegistry.d.ts +9 -0
- package/dist/strategy/StrategyTemplateRegistry.js +78 -0
- package/dist/strategy/index.d.ts +6 -0
- package/dist/strategy/index.js +5 -0
- package/dist/temporal/TemporalMemoryService.d.ts +62 -0
- package/dist/temporal/TemporalMemoryService.js +128 -0
- package/dist/temporal/index.d.ts +2 -0
- package/dist/temporal/index.js +1 -0
- package/dist/topic/TopicAliasRegistry.d.ts +21 -0
- package/dist/topic/TopicAliasRegistry.js +67 -0
- package/dist/topic/TopicGovernance.d.ts +21 -0
- package/dist/topic/TopicGovernance.js +173 -0
- package/dist/topic/TopicPathRegistry.d.ts +36 -0
- package/dist/topic/TopicPathRegistry.js +105 -0
- package/dist/topic/TopicRelationGraph.d.ts +23 -0
- package/dist/topic/TopicRelationGraph.js +55 -0
- package/dist/topic/TopicTypes.d.ts +73 -0
- package/dist/topic/TopicTypes.js +1 -0
- package/dist/topic/index.d.ts +6 -0
- package/dist/topic/index.js +5 -0
- package/dist/types/AsyncEnrichment.d.ts +62 -0
- package/dist/types/AsyncEnrichment.js +7 -0
- package/dist/types/BrainRecallResult.d.ts +66 -0
- package/dist/types/BrainRecallResult.js +1 -0
- package/dist/types/ExtensionPoints.d.ts +116 -0
- package/dist/types/ExtensionPoints.js +1 -0
- package/dist/types/Migration.d.ts +22 -0
- package/dist/types/Migration.js +1 -0
- package/dist/types/QueryTimePendingEntityResolution.d.ts +11 -0
- package/dist/types/QueryTimePendingEntityResolution.js +23 -0
- package/dist/types/index.d.ts +855 -0
- package/dist/types/index.js +24 -0
- package/dist/types/query-ir.d.ts +71 -0
- package/dist/types/query-ir.js +4 -0
- package/dist/types/reasoning.d.ts +16 -0
- package/dist/types/reasoning.js +4 -0
- package/dist/utils/AAAKGenerator.d.ts +57 -0
- package/dist/utils/AAAKGenerator.js +212 -0
- package/dist/utils/Config.d.ts +78 -0
- package/dist/utils/Config.js +91 -0
- package/dist/utils/ConversationMarkdownNormalization.d.ts +88 -0
- package/dist/utils/ConversationMarkdownNormalization.js +567 -0
- package/dist/utils/Logger.d.ts +22 -0
- package/dist/utils/Logger.js +77 -0
- package/dist/utils/hash.d.ts +33 -0
- package/dist/utils/hash.js +53 -0
- package/dist/utils/text.d.ts +2 -0
- package/dist/utils/text.js +19 -0
- package/dist/utils/vector.d.ts +26 -0
- package/dist/utils/vector.js +38 -0
- package/examples/hermes-backend/AGENTS.md +218 -0
- package/examples/hermes-backend/README.md +153 -0
- package/examples/hermes-backend/SKILL.md +365 -0
- package/examples/hermes-backend/references/operations.md +202 -0
- package/examples/openclaw-backend/AGENTS.md +195 -0
- package/examples/openclaw-backend/README.md +228 -0
- package/examples/openclaw-backend/SKILL.md +464 -0
- package/examples/openclaw-backend/references/operations.md +269 -0
- package/install.sh +84 -0
- package/package.json +90 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isRecallableMemoryEvidence } from './RecallGovernance.js';
|
|
2
|
+
export class VectorCandidateFilter {
|
|
3
|
+
rules;
|
|
4
|
+
constructor(rules = []) {
|
|
5
|
+
this.rules = rules;
|
|
6
|
+
}
|
|
7
|
+
filter(neuronIds, ctx) {
|
|
8
|
+
return this.rules.reduce((ids, rule) => rule.filter(ids, ctx), neuronIds);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class MemoryGraphVectorFilterRule {
|
|
12
|
+
memoryGraph;
|
|
13
|
+
constructor(memoryGraph) {
|
|
14
|
+
this.memoryGraph = memoryGraph;
|
|
15
|
+
}
|
|
16
|
+
neuron(id) {
|
|
17
|
+
return this.memoryGraph.getNeuron(id);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class WorkspaceFilter extends MemoryGraphVectorFilterRule {
|
|
21
|
+
name = 'workspace';
|
|
22
|
+
filter(neuronIds, context) {
|
|
23
|
+
if (!context.projectId)
|
|
24
|
+
return neuronIds;
|
|
25
|
+
return neuronIds.filter((id) => this.neuron(id)?.metadata.projectId === context.projectId);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class TopicFilter extends MemoryGraphVectorFilterRule {
|
|
29
|
+
name = 'topic';
|
|
30
|
+
filter(neuronIds, context) {
|
|
31
|
+
if (!context.topicPath)
|
|
32
|
+
return neuronIds;
|
|
33
|
+
const prefix = context.topicPath;
|
|
34
|
+
return neuronIds.filter((id) => {
|
|
35
|
+
const topicPath = this.neuron(id)?.metadata.topicPath;
|
|
36
|
+
if (!topicPath)
|
|
37
|
+
return false;
|
|
38
|
+
return topicPath === prefix || topicPath.startsWith(`${prefix}/`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class StaleFilter extends MemoryGraphVectorFilterRule {
|
|
43
|
+
name = 'stale';
|
|
44
|
+
filter(neuronIds, context) {
|
|
45
|
+
const maxStaleMs = context.maxStaleMs ?? 90 * 24 * 60 * 60 * 1000;
|
|
46
|
+
const cutoff = context.queryTime - maxStaleMs;
|
|
47
|
+
return neuronIds.filter((id) => (this.neuron(id)?.metadata.createdAt ?? 0) >= cutoff);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export class StatusFilter extends MemoryGraphVectorFilterRule {
|
|
51
|
+
name = 'status';
|
|
52
|
+
filter(neuronIds, _context) {
|
|
53
|
+
return neuronIds.filter((id) => {
|
|
54
|
+
const neuron = this.neuron(id);
|
|
55
|
+
return isRecallableMemoryEvidence(neuron);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export class CredibilityFilter extends MemoryGraphVectorFilterRule {
|
|
60
|
+
threshold;
|
|
61
|
+
name = 'credibility';
|
|
62
|
+
constructor(memoryGraph, threshold = 0.3) {
|
|
63
|
+
super(memoryGraph);
|
|
64
|
+
this.threshold = threshold;
|
|
65
|
+
}
|
|
66
|
+
filter(neuronIds, _context) {
|
|
67
|
+
return neuronIds.filter((id) => (this.neuron(id)?.metadata.confidence ?? 1) >= this.threshold);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function createDefaultVectorCandidateFilter(memoryGraph) {
|
|
71
|
+
return new VectorCandidateFilter([
|
|
72
|
+
new WorkspaceFilter(memoryGraph),
|
|
73
|
+
new TopicFilter(memoryGraph),
|
|
74
|
+
new StaleFilter(memoryGraph),
|
|
75
|
+
new StatusFilter(memoryGraph),
|
|
76
|
+
new CredibilityFilter(memoryGraph),
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ConditionEvaluationContext {
|
|
2
|
+
projectId?: string;
|
|
3
|
+
rawQuery?: string;
|
|
4
|
+
conditionHints?: string[];
|
|
5
|
+
entityHints?: string[];
|
|
6
|
+
environmentHints?: string[];
|
|
7
|
+
stateHints?: string[];
|
|
8
|
+
policyHints?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare class ConditionDslEvaluator {
|
|
11
|
+
private static readonly VALUE_ALIASES;
|
|
12
|
+
static evaluate(dsl: unknown, context: ConditionEvaluationContext): {
|
|
13
|
+
matched: boolean;
|
|
14
|
+
score: number;
|
|
15
|
+
reasons: string[];
|
|
16
|
+
executionReady: boolean;
|
|
17
|
+
normalizedContext: Record<string, string[]>;
|
|
18
|
+
policyActions: Array<{
|
|
19
|
+
policy: string;
|
|
20
|
+
action: 'allow' | 'deny' | 'prefer';
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
private static evaluateNode;
|
|
24
|
+
private static evaluateLeaf;
|
|
25
|
+
private static toCorpus;
|
|
26
|
+
private static normalizeValue;
|
|
27
|
+
private static matchesValue;
|
|
28
|
+
private static buildNormalizedContext;
|
|
29
|
+
private static buildPolicyActions;
|
|
30
|
+
private static rehydrateFromFlatClauses;
|
|
31
|
+
private static hasExplicitNegation;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ConditionDslEvaluator.d.ts.map
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export class ConditionDslEvaluator {
|
|
2
|
+
static VALUE_ALIASES = {
|
|
3
|
+
production: ['prod', '生产', '生产环境'],
|
|
4
|
+
staging: ['stage', '预发', '预发环境'],
|
|
5
|
+
development: ['dev', '开发', '开发环境'],
|
|
6
|
+
approved: ['approval', '已批准', '审批', '审批通过'],
|
|
7
|
+
running: ['运行中'],
|
|
8
|
+
healthy: ['health', '健康'],
|
|
9
|
+
'circuit-breaker': ['circuit breaker'],
|
|
10
|
+
strict: ['严格']
|
|
11
|
+
};
|
|
12
|
+
static evaluate(dsl, context) {
|
|
13
|
+
if (!dsl || typeof dsl !== 'object') {
|
|
14
|
+
return {
|
|
15
|
+
matched: false,
|
|
16
|
+
score: 0,
|
|
17
|
+
reasons: [],
|
|
18
|
+
executionReady: false,
|
|
19
|
+
normalizedContext: this.buildNormalizedContext(context),
|
|
20
|
+
policyActions: []
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const expr = dsl.expr;
|
|
24
|
+
const node = expr || this.rehydrateFromFlatClauses(dsl.clauses);
|
|
25
|
+
if (!node) {
|
|
26
|
+
return {
|
|
27
|
+
matched: false,
|
|
28
|
+
score: 0,
|
|
29
|
+
reasons: [],
|
|
30
|
+
executionReady: false,
|
|
31
|
+
normalizedContext: this.buildNormalizedContext(context),
|
|
32
|
+
policyActions: []
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const result = this.evaluateNode(node, context);
|
|
36
|
+
const normalizedContext = this.buildNormalizedContext(context);
|
|
37
|
+
return {
|
|
38
|
+
matched: result.matched,
|
|
39
|
+
score: result.score,
|
|
40
|
+
reasons: result.reasons,
|
|
41
|
+
executionReady: result.matched && result.reasons.length > 0,
|
|
42
|
+
normalizedContext,
|
|
43
|
+
policyActions: this.buildPolicyActions(normalizedContext, result.matched)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
static evaluateNode(node, context) {
|
|
47
|
+
if (node.kind === 'group') {
|
|
48
|
+
const childResults = node.clauses.map((clause) => this.evaluateNode(clause, context));
|
|
49
|
+
const matched = node.combinator === 'all'
|
|
50
|
+
? childResults.every((item) => item.matched)
|
|
51
|
+
: childResults.some((item) => item.matched);
|
|
52
|
+
const normalizedScore = childResults.length > 0
|
|
53
|
+
? childResults.reduce((sum, item) => sum + item.score, 0) / childResults.length
|
|
54
|
+
: 0;
|
|
55
|
+
return {
|
|
56
|
+
matched,
|
|
57
|
+
score: normalizedScore,
|
|
58
|
+
reasons: childResults.flatMap((item) => item.reasons)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return this.evaluateLeaf(node, context);
|
|
62
|
+
}
|
|
63
|
+
static evaluateLeaf(node, context) {
|
|
64
|
+
const value = this.normalizeValue(String(node.value || ''));
|
|
65
|
+
const operator = node.operator || 'eq';
|
|
66
|
+
const corpus = this.toCorpus(context);
|
|
67
|
+
const rawText = [context.rawQuery || '', ...(context.conditionHints || [])].join(' ').toLowerCase();
|
|
68
|
+
let positiveMatch = false;
|
|
69
|
+
if (node.kind === 'project_hint' && context.projectId) {
|
|
70
|
+
positiveMatch = this.matchesValue(context.projectId.toLowerCase(), value);
|
|
71
|
+
}
|
|
72
|
+
else if (node.kind === 'state') {
|
|
73
|
+
positiveMatch = (context.stateHints || []).some((hint) => this.matchesValue(hint, value));
|
|
74
|
+
}
|
|
75
|
+
else if (node.kind === 'policy_hint') {
|
|
76
|
+
positiveMatch = (context.policyHints || []).some((hint) => this.matchesValue(hint, value));
|
|
77
|
+
}
|
|
78
|
+
else if (node.kind === 'approval') {
|
|
79
|
+
positiveMatch = /(approved|approval|已批准|审批)/i.test(corpus);
|
|
80
|
+
}
|
|
81
|
+
else if (value) {
|
|
82
|
+
positiveMatch = this.matchesValue(corpus, value);
|
|
83
|
+
}
|
|
84
|
+
const explicitNegation = operator === 'neq' && this.hasExplicitNegation(rawText, value);
|
|
85
|
+
const matched = operator === 'neq'
|
|
86
|
+
? (explicitNegation || !positiveMatch)
|
|
87
|
+
: positiveMatch;
|
|
88
|
+
return {
|
|
89
|
+
matched,
|
|
90
|
+
score: matched ? 1 : 0,
|
|
91
|
+
reasons: matched ? [`condition:${node.kind}:${operator}:${value}`] : []
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
static toCorpus(context) {
|
|
95
|
+
return [
|
|
96
|
+
context.projectId || '',
|
|
97
|
+
context.rawQuery || '',
|
|
98
|
+
...(context.conditionHints || []),
|
|
99
|
+
...(context.entityHints || []),
|
|
100
|
+
...(context.environmentHints || []),
|
|
101
|
+
...(context.stateHints || []),
|
|
102
|
+
...(context.policyHints || [])
|
|
103
|
+
]
|
|
104
|
+
.join(' ')
|
|
105
|
+
.toLowerCase();
|
|
106
|
+
}
|
|
107
|
+
static normalizeValue(value) {
|
|
108
|
+
const normalized = value.trim().toLowerCase();
|
|
109
|
+
for (const [canonical, aliases] of Object.entries(this.VALUE_ALIASES)) {
|
|
110
|
+
if (normalized === canonical || aliases.includes(normalized))
|
|
111
|
+
return canonical;
|
|
112
|
+
}
|
|
113
|
+
return normalized;
|
|
114
|
+
}
|
|
115
|
+
static matchesValue(haystack, value) {
|
|
116
|
+
const normalizedHaystack = haystack.toLowerCase();
|
|
117
|
+
const aliases = [value, ...(this.VALUE_ALIASES[value] || [])];
|
|
118
|
+
return aliases.some((alias) => normalizedHaystack.includes(alias.toLowerCase()));
|
|
119
|
+
}
|
|
120
|
+
static buildNormalizedContext(context) {
|
|
121
|
+
const normalizeList = (items) => Array.from(new Set((items || []).map((item) => this.normalizeValue(item)).filter(Boolean)));
|
|
122
|
+
return {
|
|
123
|
+
environment: normalizeList(context.environmentHints),
|
|
124
|
+
state: normalizeList(context.stateHints),
|
|
125
|
+
policy: normalizeList(context.policyHints),
|
|
126
|
+
entity: normalizeList(context.entityHints),
|
|
127
|
+
condition: normalizeList(context.conditionHints)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
static buildPolicyActions(normalizedContext, matched) {
|
|
131
|
+
const actions = [];
|
|
132
|
+
for (const policy of normalizedContext.policy) {
|
|
133
|
+
if (policy === 'strict' || policy === 'circuit-breaker') {
|
|
134
|
+
actions.push({ policy, action: matched ? 'allow' : 'deny' });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
actions.push({ policy, action: matched ? 'prefer' : 'deny' });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return actions;
|
|
141
|
+
}
|
|
142
|
+
static rehydrateFromFlatClauses(rawClauses) {
|
|
143
|
+
if (!Array.isArray(rawClauses) || rawClauses.length === 0)
|
|
144
|
+
return null;
|
|
145
|
+
return {
|
|
146
|
+
kind: 'group',
|
|
147
|
+
combinator: 'all',
|
|
148
|
+
clauses: rawClauses.filter((item) => Boolean(item && typeof item === 'object'))
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
static hasExplicitNegation(rawText, value) {
|
|
152
|
+
if (!rawText || !value)
|
|
153
|
+
return false;
|
|
154
|
+
return (rawText.includes(`not ${value}`) ||
|
|
155
|
+
rawText.includes(`non-${value}`) ||
|
|
156
|
+
rawText.includes(`不是${value}`) ||
|
|
157
|
+
rawText.includes(`非${value}`) ||
|
|
158
|
+
rawText.includes(`不 ${value}`));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EntityStore } from '../store/EntityStore.js';
|
|
2
|
+
import type { FactStore } from '../store/FactStore.js';
|
|
3
|
+
export interface EntityActivationContext {
|
|
4
|
+
entityIds: string[];
|
|
5
|
+
factIds: string[];
|
|
6
|
+
neuronIds: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class EntityActivationIndex {
|
|
9
|
+
private entityStore;
|
|
10
|
+
private factStore;
|
|
11
|
+
constructor(entityStore: EntityStore, factStore: FactStore);
|
|
12
|
+
activate(entityIds: string[], predicateFamilies?: string[]): EntityActivationContext;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=EntityActivationIndex.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class EntityActivationIndex {
|
|
2
|
+
entityStore;
|
|
3
|
+
factStore;
|
|
4
|
+
constructor(entityStore, factStore) {
|
|
5
|
+
this.entityStore = entityStore;
|
|
6
|
+
this.factStore = factStore;
|
|
7
|
+
}
|
|
8
|
+
activate(entityIds, predicateFamilies) {
|
|
9
|
+
const facts = this.factStore.listFactsByEntityIds(entityIds, {
|
|
10
|
+
predicateFamilies,
|
|
11
|
+
limit: 60
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
entityIds,
|
|
15
|
+
factIds: facts.map((fact) => fact.factId),
|
|
16
|
+
neuronIds: Array.from(new Set(facts.map((fact) => fact.neuronId)))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ContextFusionPath, FusionResolutionReason, type ContextPack } from '../types/index.js';
|
|
2
|
+
import type { QueryTimePendingEntityResolutionHookOutput } from '../types/QueryTimePendingEntityResolution.js';
|
|
3
|
+
export interface EvidenceFusionPolicyInput {
|
|
4
|
+
compiledFacts: ContextPack['compiledFacts'];
|
|
5
|
+
compiledEvidence: ContextPack['compiledEvidence'];
|
|
6
|
+
rawEvidence: ContextPack['rawEvidence'];
|
|
7
|
+
supportingEpisodes: ContextPack['supportingEpisodes'];
|
|
8
|
+
queryTimePendingEntityResolution?: QueryTimePendingEntityResolutionHookOutput;
|
|
9
|
+
}
|
|
10
|
+
export interface EvidenceFusionPolicyDecision {
|
|
11
|
+
fusionPath: ContextFusionPath;
|
|
12
|
+
chosenEvidence: Array<{
|
|
13
|
+
source: 'compiled' | 'raw';
|
|
14
|
+
evidenceId: string;
|
|
15
|
+
}>;
|
|
16
|
+
rejectedEvidence: Array<{
|
|
17
|
+
source: 'compiled' | 'raw';
|
|
18
|
+
evidenceId: string;
|
|
19
|
+
reason: string;
|
|
20
|
+
}>;
|
|
21
|
+
resolutionReason?: FusionResolutionReason;
|
|
22
|
+
conflictTrace: ContextPack['conflictTrace'];
|
|
23
|
+
}
|
|
24
|
+
export interface EvidenceFusionPolicy {
|
|
25
|
+
decide(input: EvidenceFusionPolicyInput): EvidenceFusionPolicyDecision;
|
|
26
|
+
}
|
|
27
|
+
export declare class DefaultEvidenceFusionPolicy implements EvidenceFusionPolicy {
|
|
28
|
+
decide(input: EvidenceFusionPolicyInput): EvidenceFusionPolicyDecision;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=EvidenceFusionPolicy.d.ts.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ContextFusionPath, FusionResolutionReason } from '../types/index.js';
|
|
2
|
+
import { classifyIssueFamilies } from '../lexicon/coreMemoryLexicon.js';
|
|
3
|
+
export class DefaultEvidenceFusionPolicy {
|
|
4
|
+
decide(input) {
|
|
5
|
+
const hasCompiled = input.compiledEvidence.length > 0;
|
|
6
|
+
const hasRaw = input.rawEvidence.length > 0;
|
|
7
|
+
if (hasCompiled && !hasRaw) {
|
|
8
|
+
return {
|
|
9
|
+
fusionPath: ContextFusionPath.COMPILED_ONLY,
|
|
10
|
+
chosenEvidence: input.compiledEvidence.map((item) => ({ source: 'compiled', evidenceId: item.evidenceId })),
|
|
11
|
+
rejectedEvidence: [],
|
|
12
|
+
resolutionReason: FusionResolutionReason.COMPILED_WINS,
|
|
13
|
+
conflictTrace: []
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (!hasCompiled && hasRaw) {
|
|
17
|
+
return {
|
|
18
|
+
fusionPath: ContextFusionPath.RAW_ONLY,
|
|
19
|
+
chosenEvidence: input.rawEvidence.map((item) => ({ source: 'raw', evidenceId: item.neuronId })),
|
|
20
|
+
rejectedEvidence: [],
|
|
21
|
+
resolutionReason: FusionResolutionReason.RAW_WINS,
|
|
22
|
+
conflictTrace: []
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!hasCompiled && !hasRaw) {
|
|
26
|
+
return {
|
|
27
|
+
fusionPath: ContextFusionPath.RAW_ONLY,
|
|
28
|
+
chosenEvidence: [],
|
|
29
|
+
rejectedEvidence: [],
|
|
30
|
+
conflictTrace: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const conflictTrace = findFusionConflict(input.compiledFacts, input.supportingEpisodes);
|
|
34
|
+
if (conflictTrace.length > 0) {
|
|
35
|
+
const rejectedRawIds = new Set(conflictTrace.map((item) => item.conflictingRawContent));
|
|
36
|
+
return {
|
|
37
|
+
fusionPath: ContextFusionPath.CONFLICT_RESOLVED,
|
|
38
|
+
chosenEvidence: [
|
|
39
|
+
...input.compiledEvidence.map((item) => ({ source: 'compiled', evidenceId: item.evidenceId })),
|
|
40
|
+
...input.rawEvidence
|
|
41
|
+
.filter((item) => !rejectedRawIds.has(item.content))
|
|
42
|
+
.map((item) => ({ source: 'raw', evidenceId: item.neuronId }))
|
|
43
|
+
],
|
|
44
|
+
rejectedEvidence: input.rawEvidence
|
|
45
|
+
.filter((item) => rejectedRawIds.has(item.content))
|
|
46
|
+
.map((item) => ({ source: 'raw', evidenceId: item.neuronId, reason: 'conflict_resolved' })),
|
|
47
|
+
resolutionReason: conflictTrace[0]?.resolutionReason,
|
|
48
|
+
conflictTrace
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
fusionPath: ContextFusionPath.COMPILED_PLUS_RAW,
|
|
53
|
+
chosenEvidence: [
|
|
54
|
+
...input.compiledEvidence.map((item) => ({ source: 'compiled', evidenceId: item.evidenceId })),
|
|
55
|
+
...input.rawEvidence.map((item) => ({ source: 'raw', evidenceId: item.neuronId }))
|
|
56
|
+
],
|
|
57
|
+
rejectedEvidence: [],
|
|
58
|
+
conflictTrace: []
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function findFusionConflict(compiledFacts, supportingEpisodes) {
|
|
63
|
+
const targetFact = compiledFacts.find((fact) => ['has_issue', 'likes', 'dislikes'].includes(fact.predicateFamily));
|
|
64
|
+
if (!targetFact)
|
|
65
|
+
return [];
|
|
66
|
+
const compiledSignal = extractConflictSignal([targetFact.predicateValue, targetFact.object, targetFact.sourceText].filter(Boolean).join(' '));
|
|
67
|
+
if (!compiledSignal)
|
|
68
|
+
return [];
|
|
69
|
+
for (const episode of supportingEpisodes) {
|
|
70
|
+
if (episode.neuron.id === targetFact.neuronId)
|
|
71
|
+
continue;
|
|
72
|
+
const rawSignal = extractConflictSignal(episode.neuron.content);
|
|
73
|
+
if (!rawSignal)
|
|
74
|
+
continue;
|
|
75
|
+
if (rawSignal.domain !== compiledSignal.domain)
|
|
76
|
+
continue;
|
|
77
|
+
if (rawSignal.value === compiledSignal.value)
|
|
78
|
+
continue;
|
|
79
|
+
return [{
|
|
80
|
+
conflictingRawContent: episode.neuron.content,
|
|
81
|
+
conflictingCompiledFact: {
|
|
82
|
+
factId: targetFact.factId,
|
|
83
|
+
subject: targetFact.subject,
|
|
84
|
+
predicateFamily: targetFact.predicateFamily,
|
|
85
|
+
predicateValue: targetFact.predicateValue,
|
|
86
|
+
object: targetFact.object,
|
|
87
|
+
confidence: targetFact.confidence
|
|
88
|
+
},
|
|
89
|
+
resolutionReason: pickFusionResolutionReason(targetFact, episode.neuron)
|
|
90
|
+
}];
|
|
91
|
+
}
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
function extractConflictSignal(text) {
|
|
95
|
+
const issueFamilies = classifyIssueFamilies(text);
|
|
96
|
+
if (issueFamilies.length > 0)
|
|
97
|
+
return { domain: 'issue', value: issueFamilies[0] };
|
|
98
|
+
if (/(喜欢|i like)/i.test(text))
|
|
99
|
+
return { domain: 'preference', value: 'like' };
|
|
100
|
+
if (/(讨厌|不喜欢|i dislike)/i.test(text))
|
|
101
|
+
return { domain: 'preference', value: 'dislike' };
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function pickFusionResolutionReason(fact, rawNeuron) {
|
|
105
|
+
if (fact.confidence >= 0.9)
|
|
106
|
+
return FusionResolutionReason.COMPILED_WINS;
|
|
107
|
+
if (rawNeuron.metadata.createdAt > fact.validFrom)
|
|
108
|
+
return FusionResolutionReason.RECENCY_WINS;
|
|
109
|
+
if (fact.confidence >= 0.8)
|
|
110
|
+
return FusionResolutionReason.TRUST_SCORE_HIGHER;
|
|
111
|
+
return FusionResolutionReason.RAW_WINS;
|
|
112
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface EvidenceSourceScore {
|
|
2
|
+
neuronId: string;
|
|
3
|
+
score: number;
|
|
4
|
+
source: string;
|
|
5
|
+
reason: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class EvidenceFusionRanker {
|
|
8
|
+
rank(inputs: EvidenceSourceScore[], limit?: number): {
|
|
9
|
+
neuronIds: string[];
|
|
10
|
+
reasonsByNeuronId: Map<string, string[]>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=EvidenceFusionRanker.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class EvidenceFusionRanker {
|
|
2
|
+
rank(inputs, limit = 120) {
|
|
3
|
+
const scoreByNeuron = new Map();
|
|
4
|
+
const reasonsByNeuronId = new Map();
|
|
5
|
+
for (const input of inputs) {
|
|
6
|
+
scoreByNeuron.set(input.neuronId, (scoreByNeuron.get(input.neuronId) || 0) + input.score);
|
|
7
|
+
const reasons = reasonsByNeuronId.get(input.neuronId) || [];
|
|
8
|
+
reasons.push(`${input.source}:${input.reason}`);
|
|
9
|
+
reasonsByNeuronId.set(input.neuronId, reasons);
|
|
10
|
+
}
|
|
11
|
+
const neuronIds = Array.from(scoreByNeuron.entries())
|
|
12
|
+
.sort((a, b) => b[1] - a[1])
|
|
13
|
+
.slice(0, limit)
|
|
14
|
+
.map(([neuronId]) => neuronId);
|
|
15
|
+
return { neuronIds, reasonsByNeuronId };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface NarrativeRecallSummary {
|
|
2
|
+
headline: string;
|
|
3
|
+
path: string[];
|
|
4
|
+
whyMatched: string[];
|
|
5
|
+
runtimeSegments: Array<{
|
|
6
|
+
stage: string;
|
|
7
|
+
label: string;
|
|
8
|
+
count?: number;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare class NarrativeRecallAssembler {
|
|
12
|
+
assemble(input: {
|
|
13
|
+
query: string;
|
|
14
|
+
plannerReasons: string[];
|
|
15
|
+
pulseTrace: Array<{
|
|
16
|
+
stage: string;
|
|
17
|
+
candidateCount: number;
|
|
18
|
+
reason: string;
|
|
19
|
+
}>;
|
|
20
|
+
temporalLabels: string[];
|
|
21
|
+
branchIds: string[];
|
|
22
|
+
entityIds: string[];
|
|
23
|
+
denseJointCount?: number;
|
|
24
|
+
traversalPath?: string[];
|
|
25
|
+
traversalSegments?: Array<{
|
|
26
|
+
stage: string;
|
|
27
|
+
label: string;
|
|
28
|
+
count?: number;
|
|
29
|
+
}>;
|
|
30
|
+
}): NarrativeRecallSummary;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=NarrativeRecallAssembler.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class NarrativeRecallAssembler {
|
|
2
|
+
assemble(input) {
|
|
3
|
+
const path = input.traversalPath && input.traversalPath.length > 0
|
|
4
|
+
? input.traversalPath
|
|
5
|
+
: [
|
|
6
|
+
...input.entityIds.slice(0, 3).map((id) => `entity:${id}`),
|
|
7
|
+
...input.temporalLabels.slice(0, 3).map((label) => `time:${label}`),
|
|
8
|
+
...input.branchIds.slice(0, 3).map((id) => `branch:${id}`)
|
|
9
|
+
];
|
|
10
|
+
return {
|
|
11
|
+
headline: `universe navigation for: ${input.query}`,
|
|
12
|
+
path,
|
|
13
|
+
whyMatched: Array.from(new Set([
|
|
14
|
+
...input.plannerReasons.slice(0, 4),
|
|
15
|
+
...input.pulseTrace.slice(0, 4).map((item) => item.reason)
|
|
16
|
+
])),
|
|
17
|
+
runtimeSegments: input.traversalSegments && input.traversalSegments.length > 0
|
|
18
|
+
? input.traversalSegments
|
|
19
|
+
: [
|
|
20
|
+
{ stage: 'entity', label: input.entityIds[0] ? `entity:${input.entityIds[0]}` : 'entity:none', count: input.entityIds.length },
|
|
21
|
+
{ stage: 'temporal', label: input.temporalLabels[0] || 'temporal:none', count: input.temporalLabels.length },
|
|
22
|
+
{ stage: 'branch', label: input.branchIds[0] ? `branch:${input.branchIds[0]}` : 'branch:none', count: input.branchIds.length },
|
|
23
|
+
{ stage: 'dense', label: 'dense_joint_search', count: input.denseJointCount || 0 }
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NativeQueryDirectives } from '../types/query-ir.js';
|
|
2
|
+
export interface NativeQueryClause {
|
|
3
|
+
key: keyof NativeQueryDirectives;
|
|
4
|
+
value: string;
|
|
5
|
+
raw: string;
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NativeQueryParseResult {
|
|
10
|
+
directives?: NativeQueryDirectives;
|
|
11
|
+
clauses: NativeQueryClause[];
|
|
12
|
+
residualQuery: string;
|
|
13
|
+
parseMode: 'grammar';
|
|
14
|
+
}
|
|
15
|
+
export declare class NativeQueryParser {
|
|
16
|
+
private static readonly KEY_ALIASES;
|
|
17
|
+
parse(query: string): NativeQueryParseResult;
|
|
18
|
+
private buildResidualQuery;
|
|
19
|
+
private readIdentifier;
|
|
20
|
+
private readValue;
|
|
21
|
+
private skipWhitespace;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=NativeQueryParser.d.ts.map
|