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,670 @@
|
|
|
1
|
+
import { LocalSemanticCompiler } from './LocalSemanticCompiler.js';
|
|
2
|
+
import { normalizeLexiconText } from '../lexicon/coreMemoryLexicon.js';
|
|
3
|
+
import { NoopAlgorithmReviewBackend } from '../algorithm/AlgorithmReviewBackend.js';
|
|
4
|
+
export class NoopCoreProposalEmitter {
|
|
5
|
+
emit() {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Offline deep consolidation stays asynchronous and independent from sync ingest.
|
|
11
|
+
* v1 performs a minimal nightly pass:
|
|
12
|
+
* - group interaction units / episodes inside a window
|
|
13
|
+
* - revisit low-confidence provisional facts/events
|
|
14
|
+
* - resolve pending entity references and same-name duplicates
|
|
15
|
+
* - promote stable provisional outputs to verified records
|
|
16
|
+
* - materialize belief updates from verified facts
|
|
17
|
+
*/
|
|
18
|
+
export class OfflineConsolidationPipeline {
|
|
19
|
+
deps;
|
|
20
|
+
semanticCompiler;
|
|
21
|
+
algorithmReviewBackend;
|
|
22
|
+
plasticityProposalEmitter;
|
|
23
|
+
enableAutoEdgeSeeding;
|
|
24
|
+
constructor(deps = {}) {
|
|
25
|
+
this.deps = deps;
|
|
26
|
+
this.semanticCompiler = deps.semanticCompiler || new LocalSemanticCompiler();
|
|
27
|
+
this.algorithmReviewBackend = deps.algorithmReviewBackend || new NoopAlgorithmReviewBackend();
|
|
28
|
+
this.plasticityProposalEmitter = deps.plasticityProposalEmitter || new NoopCoreProposalEmitter();
|
|
29
|
+
this.enableAutoEdgeSeeding = deps.enableAutoEdgeSeeding === true;
|
|
30
|
+
this.initCheckpointSchema();
|
|
31
|
+
}
|
|
32
|
+
schedule(request) {
|
|
33
|
+
const hasDeferredSignals = request.pendingReferenceIds.length > 0
|
|
34
|
+
|| request.reasons.length > 0
|
|
35
|
+
|| request.provisionalFacts.some((fact) => fact.status === 'provisional' && fact.confidence < 0.84)
|
|
36
|
+
|| request.provisionalEvents.some((event) => event.status === 'provisional');
|
|
37
|
+
return hasDeferredSignals
|
|
38
|
+
? {
|
|
39
|
+
scheduled: true,
|
|
40
|
+
queueReason: 'scheduled_for_async_window'
|
|
41
|
+
}
|
|
42
|
+
: {
|
|
43
|
+
scheduled: false,
|
|
44
|
+
queueReason: 'insufficient_signal'
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async run(input, reviewBackend) {
|
|
48
|
+
const algorithmReviewBackend = reviewBackend || this.algorithmReviewBackend;
|
|
49
|
+
const correctedEntityBindings = [];
|
|
50
|
+
const archivedFactIds = [];
|
|
51
|
+
const rejectedFactIds = [];
|
|
52
|
+
const archivedEntityIds = [];
|
|
53
|
+
const unresolvedReferenceIds = [];
|
|
54
|
+
const consolidatedBeliefs = [];
|
|
55
|
+
const verifiedFacts = [];
|
|
56
|
+
const verifiedEvents = [];
|
|
57
|
+
this.deps.deepWritePromotionPolicy?.promotePending(100);
|
|
58
|
+
const episodeById = new Map(input.rawEpisodes.map((episode) => [episode.id, episode]));
|
|
59
|
+
const lowConfidenceIndex = new Set(input.lowConfidenceItems.map((item) => `${item.targetType}:${item.targetId}`));
|
|
60
|
+
const workingEntities = [...input.provisionalEntities];
|
|
61
|
+
const workingFacts = [...input.provisionalFacts];
|
|
62
|
+
const knownFactKeys = new Set(workingFacts.map((fact) => `${fact.neuronId}|${this.toFactKey(fact)}`));
|
|
63
|
+
const persistSuggestedEntities = (entities) => {
|
|
64
|
+
if (!this.deps.entityStore)
|
|
65
|
+
return [];
|
|
66
|
+
const inserted = [];
|
|
67
|
+
for (const entity of entities) {
|
|
68
|
+
const existing = workingEntities.find((item) => item.type === entity.type
|
|
69
|
+
&& normalizeLexiconText(item.canonicalName).toLowerCase() === normalizeLexiconText(entity.canonicalName).toLowerCase());
|
|
70
|
+
if (existing) {
|
|
71
|
+
inserted.push(existing);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const record = this.deps.entityStore.upsertEntity({
|
|
75
|
+
canonicalName: entity.canonicalName,
|
|
76
|
+
type: entity.type,
|
|
77
|
+
aliases: entity.aliases,
|
|
78
|
+
metadata: entity.metadata,
|
|
79
|
+
instanceMode: entity.instanceMode,
|
|
80
|
+
createdAt: input.window.endTime || Date.now()
|
|
81
|
+
});
|
|
82
|
+
workingEntities.push(record);
|
|
83
|
+
inserted.push(record);
|
|
84
|
+
}
|
|
85
|
+
return inserted;
|
|
86
|
+
};
|
|
87
|
+
const persistSuggestedFacts = (facts, insertedEntities) => {
|
|
88
|
+
if (!this.deps.factStore || facts.length === 0)
|
|
89
|
+
return [];
|
|
90
|
+
const factInputs = facts
|
|
91
|
+
.map((fact) => {
|
|
92
|
+
const matchedEntity = insertedEntities.find((entity) => !fact.entityId && fact.object
|
|
93
|
+
&& normalizeLexiconText(entity.canonicalName).toLowerCase() === normalizeLexiconText(fact.object).toLowerCase());
|
|
94
|
+
return {
|
|
95
|
+
...fact,
|
|
96
|
+
entityId: fact.entityId || matchedEntity?.entityId
|
|
97
|
+
};
|
|
98
|
+
})
|
|
99
|
+
.filter((fact) => {
|
|
100
|
+
const key = `${fact.neuronId}|${this.toFactKey({
|
|
101
|
+
factId: 'pending',
|
|
102
|
+
...fact
|
|
103
|
+
})}`;
|
|
104
|
+
if (knownFactKeys.has(key))
|
|
105
|
+
return false;
|
|
106
|
+
knownFactKeys.add(key);
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
109
|
+
const inserted = this.deps.factStore.insertFacts(factInputs);
|
|
110
|
+
workingFacts.push(...inserted);
|
|
111
|
+
return inserted;
|
|
112
|
+
};
|
|
113
|
+
const multiFactReview = await algorithmReviewBackend.reviewMultiFactExtractionCandidates({
|
|
114
|
+
rawEpisodes: input.rawEpisodes,
|
|
115
|
+
facts: workingFacts,
|
|
116
|
+
entities: workingEntities,
|
|
117
|
+
mode: 'offline'
|
|
118
|
+
});
|
|
119
|
+
const multiFactEntities = persistSuggestedEntities(multiFactReview.suggestedEntities);
|
|
120
|
+
persistSuggestedFacts(multiFactReview.suggestedFacts, multiFactEntities);
|
|
121
|
+
const selfCorrectionReview = await algorithmReviewBackend.reviewSelfCorrectionCandidates({
|
|
122
|
+
rawEpisodes: input.rawEpisodes,
|
|
123
|
+
facts: workingFacts,
|
|
124
|
+
entities: workingEntities
|
|
125
|
+
});
|
|
126
|
+
persistSuggestedFacts(selfCorrectionReview.suggestedFacts, multiFactEntities);
|
|
127
|
+
const reviewResult = await algorithmReviewBackend.reviewProvisionalFactCandidates({
|
|
128
|
+
rawEpisodes: input.rawEpisodes,
|
|
129
|
+
facts: workingFacts,
|
|
130
|
+
entities: workingEntities
|
|
131
|
+
});
|
|
132
|
+
const adjudicationByFactId = new Map(reviewResult.adjudications.map((item) => [item.factId, item]));
|
|
133
|
+
const groupedFacts = new Map();
|
|
134
|
+
for (const fact of workingFacts) {
|
|
135
|
+
const factKey = this.toFactKey(fact);
|
|
136
|
+
const bucket = groupedFacts.get(factKey) || [];
|
|
137
|
+
bucket.push(fact);
|
|
138
|
+
groupedFacts.set(factKey, bucket);
|
|
139
|
+
}
|
|
140
|
+
for (const facts of groupedFacts.values()) {
|
|
141
|
+
facts.sort((a, b) => {
|
|
142
|
+
const reviewRank = (adjudicationByFactId.get(b.factId)?.action === 'verify' ? 2 : 0)
|
|
143
|
+
- (adjudicationByFactId.get(a.factId)?.action === 'verify' ? 2 : 0);
|
|
144
|
+
if (reviewRank !== 0)
|
|
145
|
+
return reviewRank;
|
|
146
|
+
const evidenceDelta = this.scoreFactEvidence(episodeById.get(b.neuronId)) - this.scoreFactEvidence(episodeById.get(a.neuronId));
|
|
147
|
+
if (evidenceDelta !== 0)
|
|
148
|
+
return evidenceDelta;
|
|
149
|
+
return (b.confidence - a.confidence) || (b.validFrom - a.validFrom);
|
|
150
|
+
});
|
|
151
|
+
const winner = facts[0];
|
|
152
|
+
const winnerEpisode = episodeById.get(winner.neuronId);
|
|
153
|
+
const reviewedWinner = adjudicationByFactId.get(winner.factId);
|
|
154
|
+
if (reviewedWinner?.action === 'supersede' || reviewedWinner?.action === 'reject' || reviewedWinner?.action === 'archive') {
|
|
155
|
+
const reviewedStatus = reviewedWinner.action === 'supersede'
|
|
156
|
+
? 'superseded'
|
|
157
|
+
: reviewedWinner.action === 'archive'
|
|
158
|
+
? 'archived'
|
|
159
|
+
: 'rejected';
|
|
160
|
+
this.deps.factStore?.updateFactStatus(winner.factId, reviewedStatus, winner.confidence, {
|
|
161
|
+
offlineConsolidatedAt: Date.now(),
|
|
162
|
+
supersededByFactId: reviewedWinner.supersededByFactId,
|
|
163
|
+
...(reviewedWinner.metadata || {})
|
|
164
|
+
});
|
|
165
|
+
if (reviewedStatus === 'archived')
|
|
166
|
+
archivedFactIds.push(winner.factId);
|
|
167
|
+
else
|
|
168
|
+
rejectedFactIds.push(winner.factId);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (reviewedWinner?.action === 'keep_provisional') {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (!winner.entityId && winner.object && this.deps.entityStore) {
|
|
175
|
+
const resolved = this.deps.entityStore.resolveReference(winner.object, this.inferEntityTypeFromFact(winner), {
|
|
176
|
+
projectId: input.window.projectId || winnerEpisode?.metadata.projectId,
|
|
177
|
+
beforeTime: input.window.endTime
|
|
178
|
+
});
|
|
179
|
+
if (resolved) {
|
|
180
|
+
this.deps.factStore?.bindFactEntity(winner.factId, resolved.entityId, Math.max(winner.confidence, 0.82), {
|
|
181
|
+
offlineConsolidatedAt: Date.now(),
|
|
182
|
+
correctedBy: 'offline_entity_resolution_v1'
|
|
183
|
+
});
|
|
184
|
+
winner.entityId = resolved.entityId;
|
|
185
|
+
winner.confidence = Math.max(winner.confidence, 0.82);
|
|
186
|
+
correctedEntityBindings.push({
|
|
187
|
+
targetId: winner.factId,
|
|
188
|
+
targetType: 'fact',
|
|
189
|
+
toEntityId: resolved.entityId,
|
|
190
|
+
reason: 'resolved_fact_entity_during_offline_consolidation'
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const winnerIsImportedSummarySupport = this.isImportedSummarySupport(winner, winnerEpisode);
|
|
195
|
+
if (!winnerIsImportedSummarySupport
|
|
196
|
+
&& (reviewedWinner?.action === 'verify'
|
|
197
|
+
|| this.shouldVerifyFact(winner, winnerEpisode, facts.length, lowConfidenceIndex))) {
|
|
198
|
+
winner.status = 'verified';
|
|
199
|
+
winner.confidence = Math.min(0.99, Math.max(reviewedWinner?.confidence || winner.confidence, facts.length > 1 ? 0.91 : 0.86));
|
|
200
|
+
this.deps.factStore?.updateFactStatus(winner.factId, 'verified', winner.confidence, {
|
|
201
|
+
offlineConsolidatedAt: Date.now(),
|
|
202
|
+
provenance: reviewedWinner?.metadata?.algorithm_review_kind ? 'offline_deep_consolidation_v2' : 'offline_deep_consolidation_v1',
|
|
203
|
+
corroborationCount: facts.length,
|
|
204
|
+
...(reviewedWinner?.metadata || {})
|
|
205
|
+
});
|
|
206
|
+
verifiedFacts.push(winner);
|
|
207
|
+
}
|
|
208
|
+
for (const duplicate of facts.slice(1)) {
|
|
209
|
+
const reviewedDuplicate = adjudicationByFactId.get(duplicate.factId);
|
|
210
|
+
const sameValue = this.toFactKey(duplicate) === this.toFactKey(winner);
|
|
211
|
+
const loserStatus = reviewedDuplicate?.action === 'supersede'
|
|
212
|
+
? 'superseded'
|
|
213
|
+
: reviewedDuplicate?.action === 'reject'
|
|
214
|
+
? 'rejected'
|
|
215
|
+
: sameValue
|
|
216
|
+
? 'archived'
|
|
217
|
+
: 'rejected';
|
|
218
|
+
this.deps.factStore?.updateFactStatus(duplicate.factId, loserStatus, duplicate.confidence, {
|
|
219
|
+
offlineConsolidatedAt: Date.now(),
|
|
220
|
+
supersededByFactId: reviewedDuplicate?.supersededByFactId || winner.factId,
|
|
221
|
+
...(reviewedDuplicate?.metadata || {})
|
|
222
|
+
});
|
|
223
|
+
if (loserStatus === 'archived')
|
|
224
|
+
archivedFactIds.push(duplicate.factId);
|
|
225
|
+
else
|
|
226
|
+
rejectedFactIds.push(duplicate.factId);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const eventGroups = new Map();
|
|
230
|
+
for (const event of input.provisionalEvents) {
|
|
231
|
+
const key = [event.eventType, event.actor || '', event.target || '', event.unitId || ''].join('|');
|
|
232
|
+
const bucket = eventGroups.get(key) || [];
|
|
233
|
+
bucket.push(event);
|
|
234
|
+
eventGroups.set(key, bucket);
|
|
235
|
+
}
|
|
236
|
+
for (const events of eventGroups.values()) {
|
|
237
|
+
events.sort((a, b) => (b.confidence - a.confidence) || (b.validFrom - a.validFrom));
|
|
238
|
+
const winner = events[0];
|
|
239
|
+
if (winner.status === 'provisional' && !lowConfidenceIndex.has(`event:${winner.eventId}`) && winner.confidence >= 0.72) {
|
|
240
|
+
winner.status = 'verified';
|
|
241
|
+
winner.confidence = Math.min(0.98, Math.max(winner.confidence, 0.84));
|
|
242
|
+
this.deps.factStore?.updateEventStatus(winner.eventId, 'verified', winner.confidence);
|
|
243
|
+
verifiedEvents.push(winner);
|
|
244
|
+
}
|
|
245
|
+
for (const duplicate of events.slice(1)) {
|
|
246
|
+
this.deps.factStore?.updateEventStatus(duplicate.eventId, 'archived', duplicate.confidence);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (const pending of input.unresolvedReferences) {
|
|
250
|
+
const resolved = this.deps.entityStore?.resolveReference(pending.referenceText, pending.entityType, {
|
|
251
|
+
projectId: input.window.projectId,
|
|
252
|
+
beforeTime: input.window.endTime
|
|
253
|
+
});
|
|
254
|
+
if (resolved) {
|
|
255
|
+
this.deps.entityStore?.resolvePendingReference(pending.pendingId, resolved.entityId, Date.now());
|
|
256
|
+
correctedEntityBindings.push({
|
|
257
|
+
targetId: pending.pendingId,
|
|
258
|
+
targetType: 'reference',
|
|
259
|
+
toEntityId: resolved.entityId,
|
|
260
|
+
reason: 'resolved_pending_reference_during_offline_consolidation'
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
unresolvedReferenceIds.push(pending.pendingId);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (this.deps.entityStore) {
|
|
268
|
+
const groupedEntities = new Map();
|
|
269
|
+
for (const entity of workingEntities) {
|
|
270
|
+
const key = `${entity.type}|${normalizeLexiconText(entity.canonicalName).toLowerCase()}`;
|
|
271
|
+
const bucket = groupedEntities.get(key) || [];
|
|
272
|
+
bucket.push(entity);
|
|
273
|
+
groupedEntities.set(key, bucket);
|
|
274
|
+
}
|
|
275
|
+
for (const entities of groupedEntities.values()) {
|
|
276
|
+
if (entities.length < 2)
|
|
277
|
+
continue;
|
|
278
|
+
entities.sort((a, b) => (b.updatedAt - a.updatedAt) || (b.createdAt - a.createdAt));
|
|
279
|
+
const primary = entities[0];
|
|
280
|
+
for (const duplicate of entities.slice(1)) {
|
|
281
|
+
this.deps.entityStore.addRelation({
|
|
282
|
+
sourceEntityId: duplicate.entityId,
|
|
283
|
+
targetEntityId: primary.entityId,
|
|
284
|
+
relationType: 'same_as',
|
|
285
|
+
createdAt: Date.now()
|
|
286
|
+
});
|
|
287
|
+
this.deps.entityStore.archiveEntity(duplicate.entityId, Date.now());
|
|
288
|
+
archivedEntityIds.push(duplicate.entityId);
|
|
289
|
+
correctedEntityBindings.push({
|
|
290
|
+
targetId: duplicate.entityId,
|
|
291
|
+
targetType: 'entity',
|
|
292
|
+
fromEntityId: duplicate.entityId,
|
|
293
|
+
toEntityId: primary.entityId,
|
|
294
|
+
reason: 'same_name_entity_merge_during_offline_consolidation'
|
|
295
|
+
});
|
|
296
|
+
for (const fact of workingFacts.filter((item) => item.entityId === duplicate.entityId)) {
|
|
297
|
+
this.deps.factStore?.bindFactEntity(fact.factId, primary.entityId, Math.max(fact.confidence, 0.84), {
|
|
298
|
+
offlineConsolidatedAt: Date.now(),
|
|
299
|
+
rebindReason: 'entity_merge'
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
for (const suggestion of reviewResult.aliasMergeSuggestions) {
|
|
306
|
+
const primary = workingEntities.find((entity) => entity.entityId === suggestion.primaryEntityId);
|
|
307
|
+
const duplicate = workingEntities.find((entity) => entity.entityId === suggestion.duplicateEntityId);
|
|
308
|
+
if (!primary || !duplicate || duplicate.status === 'archived')
|
|
309
|
+
continue;
|
|
310
|
+
this.deps.entityStore?.addRelation({
|
|
311
|
+
sourceEntityId: duplicate.entityId,
|
|
312
|
+
targetEntityId: primary.entityId,
|
|
313
|
+
relationType: 'same_as',
|
|
314
|
+
createdAt: Date.now()
|
|
315
|
+
});
|
|
316
|
+
this.deps.entityStore?.archiveEntity(duplicate.entityId, Date.now());
|
|
317
|
+
archivedEntityIds.push(duplicate.entityId);
|
|
318
|
+
correctedEntityBindings.push({
|
|
319
|
+
targetId: duplicate.entityId,
|
|
320
|
+
targetType: 'entity',
|
|
321
|
+
fromEntityId: duplicate.entityId,
|
|
322
|
+
toEntityId: primary.entityId,
|
|
323
|
+
reason: suggestion.reason
|
|
324
|
+
});
|
|
325
|
+
for (const fact of workingFacts.filter((item) => item.entityId === duplicate.entityId)) {
|
|
326
|
+
this.deps.factStore?.bindFactEntity(fact.factId, primary.entityId, Math.max(fact.confidence, 0.84), {
|
|
327
|
+
offlineConsolidatedAt: Date.now(),
|
|
328
|
+
rebindReason: 'alias_merge_suggestion_phase1'
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
duplicate.status = 'archived';
|
|
332
|
+
}
|
|
333
|
+
this.applyReviewAdjudications({
|
|
334
|
+
adjudications: reviewResult.adjudications,
|
|
335
|
+
facts: workingFacts,
|
|
336
|
+
verifiedFacts,
|
|
337
|
+
archivedFactIds,
|
|
338
|
+
rejectedFactIds
|
|
339
|
+
});
|
|
340
|
+
for (const fact of verifiedFacts) {
|
|
341
|
+
const candidate = this.factToBeliefCandidate(fact, episodeById.get(fact.neuronId), input.window.projectId);
|
|
342
|
+
if (!candidate || !this.deps.beliefStore)
|
|
343
|
+
continue;
|
|
344
|
+
const result = this.deps.beliefStore.upsert(candidate, fact.validFrom);
|
|
345
|
+
if (result.belief) {
|
|
346
|
+
this.deps.beliefStore.attachEvidence([
|
|
347
|
+
{
|
|
348
|
+
beliefId: result.belief.id,
|
|
349
|
+
neuronId: fact.neuronId,
|
|
350
|
+
evidenceType: 'verification',
|
|
351
|
+
weight: 1,
|
|
352
|
+
createdAt: fact.validFrom
|
|
353
|
+
}
|
|
354
|
+
]);
|
|
355
|
+
consolidatedBeliefs.push(result.belief);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const plasticityProposals = this.plasticityProposalEmitter.emit({
|
|
359
|
+
rawEpisodes: input.rawEpisodes,
|
|
360
|
+
interactionUnits: input.interactionUnits,
|
|
361
|
+
provisionalFacts: workingFacts,
|
|
362
|
+
provisionalEvents: input.provisionalEvents,
|
|
363
|
+
provisionalEntities: workingEntities,
|
|
364
|
+
verifiedFacts,
|
|
365
|
+
verifiedEvents,
|
|
366
|
+
archivedFactIds,
|
|
367
|
+
rejectedFactIds,
|
|
368
|
+
archivedEntityIds,
|
|
369
|
+
correctedEntityBindings,
|
|
370
|
+
window: input.window
|
|
371
|
+
});
|
|
372
|
+
this.deps.plasticityProposalLedgerStore?.append?.(plasticityProposals);
|
|
373
|
+
let autoEdgeSeeding;
|
|
374
|
+
if (this.enableAutoEdgeSeeding) {
|
|
375
|
+
autoEdgeSeeding = { seededEdgeCount: 0, archived: true };
|
|
376
|
+
}
|
|
377
|
+
await this.refreshTopicMaintenance(input);
|
|
378
|
+
return {
|
|
379
|
+
verifiedFacts,
|
|
380
|
+
verifiedEvents,
|
|
381
|
+
correctedEntityBindings,
|
|
382
|
+
consolidatedBeliefs,
|
|
383
|
+
archivedFactIds,
|
|
384
|
+
rejectedFactIds,
|
|
385
|
+
archivedEntityIds,
|
|
386
|
+
unresolvedReferenceIds,
|
|
387
|
+
plasticityProposals,
|
|
388
|
+
autoEdgeSeeding
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
async refreshTopicMaintenance(input) {
|
|
392
|
+
const runId = `offline-maintenance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
393
|
+
const startedAt = Date.now();
|
|
394
|
+
const timings = [];
|
|
395
|
+
let aborted = false;
|
|
396
|
+
const maxBudgetMs = this.deps.maxBudgetMs ?? 30_000;
|
|
397
|
+
const runStep = async (stepName, fn, budgeted = true) => {
|
|
398
|
+
if (aborted)
|
|
399
|
+
return;
|
|
400
|
+
const stepStartedAt = Date.now();
|
|
401
|
+
await fn();
|
|
402
|
+
const completedAt = Date.now();
|
|
403
|
+
timings.push({ stepName, durationMs: completedAt - stepStartedAt, completedAt });
|
|
404
|
+
if (budgeted && maxBudgetMs > 0 && completedAt - startedAt >= maxBudgetMs)
|
|
405
|
+
aborted = true;
|
|
406
|
+
};
|
|
407
|
+
const projectId = input.window.projectId;
|
|
408
|
+
const topicPaths = Array.from(new Set(input.rawEpisodes.map((episode) => episode.metadata.topicPath).filter((path) => Boolean(path))));
|
|
409
|
+
const steps = [
|
|
410
|
+
['MemoryConsolidationEngine', async () => {
|
|
411
|
+
if (!projectId)
|
|
412
|
+
return;
|
|
413
|
+
if (this.deps.topicSummaryBoard) {
|
|
414
|
+
for (const topicPath of topicPaths)
|
|
415
|
+
this.deps.topicSummaryBoard.refresh(topicPath, projectId);
|
|
416
|
+
}
|
|
417
|
+
this.deps.topicDecayPolicy?.applyDecay(projectId);
|
|
418
|
+
await this.deps.memoryConsolidationEngine?.run(projectId);
|
|
419
|
+
this.deps.userModelManager?.refresh(projectId);
|
|
420
|
+
}],
|
|
421
|
+
['ProceduralLearningBridge', async () => { if (projectId)
|
|
422
|
+
await this.deps.proceduralLearningBridge?.scan(projectId); }],
|
|
423
|
+
['CrossTopicSynthesizer', async () => { if (projectId)
|
|
424
|
+
await this.deps.crossTopicSynthesizer?.run(projectId); }],
|
|
425
|
+
['PrincipleDecayPolicy', async () => { if (projectId)
|
|
426
|
+
await this.deps.principleDecayPolicy?.run(projectId); }],
|
|
427
|
+
['GraphCommunityEngine', async () => {
|
|
428
|
+
if (!projectId)
|
|
429
|
+
return;
|
|
430
|
+
await this.deps.graphCommunityEngine?.run(projectId);
|
|
431
|
+
this.deps.orphanCleaner?.run(projectId);
|
|
432
|
+
}],
|
|
433
|
+
['WorkingMemoryDeltaCleanup', () => { this.deps.workingMemoryDelta?.cleanup(); }, false]
|
|
434
|
+
];
|
|
435
|
+
let startIndex = projectId ? this.readCheckpointIndex(projectId, steps.map(([name]) => name)) : 0;
|
|
436
|
+
for (let index = startIndex; index < steps.length; index += 1) {
|
|
437
|
+
const [stepName, fn, budgeted] = steps[index];
|
|
438
|
+
await runStep(stepName, fn, budgeted !== false);
|
|
439
|
+
if (aborted) {
|
|
440
|
+
if (maxBudgetMs > 0) {
|
|
441
|
+
this.recordRunAndCheckpoint(runId, timings, Date.now() - startedAt, true, projectId, projectId ? steps[Math.min(index + 1, steps.length - 1)][0] : undefined);
|
|
442
|
+
}
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (!aborted)
|
|
447
|
+
this.recordRunAndCheckpoint(runId, timings, Date.now() - startedAt, false, projectId);
|
|
448
|
+
}
|
|
449
|
+
initCheckpointSchema() {
|
|
450
|
+
this.deps.db?.exec(`
|
|
451
|
+
CREATE TABLE IF NOT EXISTS pipeline_checkpoints (
|
|
452
|
+
projectId TEXT NOT NULL PRIMARY KEY,
|
|
453
|
+
nextStep TEXT NOT NULL,
|
|
454
|
+
savedAt INTEGER NOT NULL
|
|
455
|
+
);
|
|
456
|
+
`);
|
|
457
|
+
}
|
|
458
|
+
readCheckpointIndex(projectId, steps) {
|
|
459
|
+
if (!this.deps.db)
|
|
460
|
+
return 0;
|
|
461
|
+
const row = this.deps.db.prepare(`SELECT nextStep, savedAt FROM pipeline_checkpoints WHERE projectId = ?`).get(projectId);
|
|
462
|
+
if (!row)
|
|
463
|
+
return 0;
|
|
464
|
+
const expiryMs = this.deps.checkpointExpiryMs ?? 24 * 60 * 60 * 1000;
|
|
465
|
+
if (row.savedAt < Date.now() - expiryMs) {
|
|
466
|
+
this.deps.db.prepare(`DELETE FROM pipeline_checkpoints WHERE projectId = ?`).run(projectId);
|
|
467
|
+
return 0;
|
|
468
|
+
}
|
|
469
|
+
const index = steps.indexOf(row.nextStep);
|
|
470
|
+
return index >= 0 ? index : 0;
|
|
471
|
+
}
|
|
472
|
+
recordRunAndCheckpoint(runId, timings, totalMs, aborted, projectId, nextStep) {
|
|
473
|
+
const write = () => {
|
|
474
|
+
this.deps.pipelineMetrics?.record(runId, timings, totalMs, aborted);
|
|
475
|
+
if (!projectId || !this.deps.db)
|
|
476
|
+
return;
|
|
477
|
+
if (aborted && nextStep) {
|
|
478
|
+
this.deps.db.prepare(`
|
|
479
|
+
INSERT INTO pipeline_checkpoints (projectId, nextStep, savedAt)
|
|
480
|
+
VALUES (?, ?, ?)
|
|
481
|
+
ON CONFLICT(projectId) DO UPDATE SET
|
|
482
|
+
nextStep = excluded.nextStep,
|
|
483
|
+
savedAt = excluded.savedAt
|
|
484
|
+
`).run(projectId, nextStep, Date.now());
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
this.deps.db.prepare(`DELETE FROM pipeline_checkpoints WHERE projectId = ?`).run(projectId);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
if (this.deps.db)
|
|
491
|
+
this.deps.db.transaction(write)();
|
|
492
|
+
else
|
|
493
|
+
write();
|
|
494
|
+
}
|
|
495
|
+
shouldVerifyFact(fact, episode, corroborationCount, lowConfidenceIndex) {
|
|
496
|
+
if (fact.status === 'verified')
|
|
497
|
+
return true;
|
|
498
|
+
if (lowConfidenceIndex.has(`fact:${fact.factId}`))
|
|
499
|
+
return corroborationCount > 1;
|
|
500
|
+
if (this.isImportedSummarySupport(fact, episode)) {
|
|
501
|
+
return corroborationCount > 1 && !this.isImportedSummaryOnlyGroup(fact, episode);
|
|
502
|
+
}
|
|
503
|
+
const compilerRun = this.deps.compilerConfidenceStore
|
|
504
|
+
?.listByTarget('memory', fact.neuronId)
|
|
505
|
+
.find((run) => run.targetId === fact.neuronId);
|
|
506
|
+
const semanticConfidence = compilerRun?.confidence || this.semanticCompiler.compileMemory({
|
|
507
|
+
text: episode?.content || fact.sourceText,
|
|
508
|
+
projectId: episode?.metadata.projectId,
|
|
509
|
+
type: episode?.metadata.type || 'doc',
|
|
510
|
+
createdAt: fact.validFrom
|
|
511
|
+
}).confidence;
|
|
512
|
+
const sourceBoost = episode?.metadata.sourceType === 'user_input' ? 0.06 : 0;
|
|
513
|
+
return fact.confidence + sourceBoost >= 0.8 || corroborationCount > 1 || semanticConfidence >= 0.78;
|
|
514
|
+
}
|
|
515
|
+
factToBeliefCandidate(fact, episode, projectId) {
|
|
516
|
+
const objectValue = fact.object || fact.predicateValue;
|
|
517
|
+
if (!objectValue)
|
|
518
|
+
return null;
|
|
519
|
+
const predicateMap = {
|
|
520
|
+
owns: 'ownership',
|
|
521
|
+
purchased: 'purchase',
|
|
522
|
+
likes: 'preference',
|
|
523
|
+
dislikes: 'preference',
|
|
524
|
+
worked_on: 'project_state',
|
|
525
|
+
has_issue: 'current_issue'
|
|
526
|
+
};
|
|
527
|
+
const predicate = predicateMap[fact.predicateFamily];
|
|
528
|
+
if (!predicate)
|
|
529
|
+
return null;
|
|
530
|
+
if (this.isImportedSummarySupport(fact, episode))
|
|
531
|
+
return null;
|
|
532
|
+
return {
|
|
533
|
+
projectId,
|
|
534
|
+
scope: 'project',
|
|
535
|
+
subject: fact.subject,
|
|
536
|
+
predicate,
|
|
537
|
+
objectValue: {
|
|
538
|
+
raw: objectValue,
|
|
539
|
+
normalized: normalizeLexiconText(objectValue).toLowerCase(),
|
|
540
|
+
type: 'string'
|
|
541
|
+
},
|
|
542
|
+
confidence: Math.min(0.98, Math.max(fact.confidence, 0.86)),
|
|
543
|
+
sourceNeuronId: fact.neuronId,
|
|
544
|
+
sourceType: 'verified_fact',
|
|
545
|
+
validFrom: fact.validFrom,
|
|
546
|
+
explanation: `offline verified from fact:${fact.factId}`,
|
|
547
|
+
metadata: {
|
|
548
|
+
factId: fact.factId,
|
|
549
|
+
entityId: fact.entityId,
|
|
550
|
+
source: 'offline_deep_consolidation_v1'
|
|
551
|
+
},
|
|
552
|
+
extractionReason: fact.predicateFamily === 'likes' || fact.predicateFamily === 'dislikes'
|
|
553
|
+
? 'preference_signal'
|
|
554
|
+
: 'tool_verified_fact'
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
toFactKey(fact) {
|
|
558
|
+
if (fact.predicateFamily === 'has_issue' || fact.metadata?.imported_summary_support === true) {
|
|
559
|
+
const issueAnchor = fact.entityId || normalizeLexiconText(fact.object || '') || fact.subject;
|
|
560
|
+
return [
|
|
561
|
+
issueAnchor,
|
|
562
|
+
fact.predicateFamily,
|
|
563
|
+
normalizeLexiconText(fact.predicateValue || ''),
|
|
564
|
+
normalizeLexiconText(fact.object || '')
|
|
565
|
+
].join('|');
|
|
566
|
+
}
|
|
567
|
+
return [
|
|
568
|
+
fact.entityId || fact.subject,
|
|
569
|
+
fact.predicateFamily,
|
|
570
|
+
normalizeLexiconText(fact.predicateValue || ''),
|
|
571
|
+
normalizeLexiconText(fact.object || ''),
|
|
572
|
+
normalizeLexiconText(fact.sourceText)
|
|
573
|
+
].join('|');
|
|
574
|
+
}
|
|
575
|
+
inferEntityTypeFromFact(fact) {
|
|
576
|
+
if (fact.predicateFamily === 'worked_on')
|
|
577
|
+
return 'project';
|
|
578
|
+
if (fact.predicateFamily === 'owns' || fact.predicateFamily === 'purchased' || fact.predicateFamily === 'has_issue')
|
|
579
|
+
return 'device';
|
|
580
|
+
return undefined;
|
|
581
|
+
}
|
|
582
|
+
scoreFactEvidence(episode) {
|
|
583
|
+
if (!episode)
|
|
584
|
+
return 0;
|
|
585
|
+
const tags = episode.metadata.tags || [];
|
|
586
|
+
if (tags.includes('reliability:imported_summary'))
|
|
587
|
+
return 0;
|
|
588
|
+
if (tags.includes('reliability:raw_utterance')) {
|
|
589
|
+
return episode.metadata.sourceType === 'user_input' ? 4 : 3;
|
|
590
|
+
}
|
|
591
|
+
if (tags.includes('reliability:self_summary'))
|
|
592
|
+
return 2;
|
|
593
|
+
if (tags.includes('reliability:reflection'))
|
|
594
|
+
return 1;
|
|
595
|
+
return episode.metadata.sourceType === 'user_input' ? 3 : 1;
|
|
596
|
+
}
|
|
597
|
+
isImportedSummarySupport(fact, episode) {
|
|
598
|
+
return fact.metadata?.imported_summary_support === true
|
|
599
|
+
|| (episode?.metadata.tags || []).includes('reliability:imported_summary');
|
|
600
|
+
}
|
|
601
|
+
isImportedSummaryOnlyGroup(fact, episode) {
|
|
602
|
+
if (fact.predicateFamily !== 'has_issue')
|
|
603
|
+
return false;
|
|
604
|
+
return this.isImportedSummarySupport(fact, episode);
|
|
605
|
+
}
|
|
606
|
+
applyReviewAdjudications(input) {
|
|
607
|
+
const verifiedIds = new Set(input.verifiedFacts.map((fact) => fact.factId));
|
|
608
|
+
const archivedIds = new Set(input.archivedFactIds);
|
|
609
|
+
const rejectedIds = new Set(input.rejectedFactIds);
|
|
610
|
+
const factById = new Map(input.facts.map((fact) => [fact.factId, fact]));
|
|
611
|
+
for (const adjudication of input.adjudications) {
|
|
612
|
+
const fact = factById.get(adjudication.factId);
|
|
613
|
+
if (!fact)
|
|
614
|
+
continue;
|
|
615
|
+
if (adjudication.action === 'verify' && fact.metadata?.imported_summary_support === true) {
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
if (adjudication.action === 'verify' && !verifiedIds.has(fact.factId)) {
|
|
619
|
+
fact.status = 'verified';
|
|
620
|
+
fact.confidence = Math.max(fact.confidence, adjudication.confidence || 0.86);
|
|
621
|
+
this.deps.factStore?.updateFactStatus(fact.factId, 'verified', fact.confidence, {
|
|
622
|
+
offlineConsolidatedAt: Date.now(),
|
|
623
|
+
provenance: 'offline_deep_consolidation_v2',
|
|
624
|
+
...(adjudication.metadata || {})
|
|
625
|
+
});
|
|
626
|
+
input.verifiedFacts.push(fact);
|
|
627
|
+
verifiedIds.add(fact.factId);
|
|
628
|
+
}
|
|
629
|
+
if (adjudication.action === 'supersede') {
|
|
630
|
+
fact.status = 'superseded';
|
|
631
|
+
this.deps.factStore?.updateFactStatus(fact.factId, 'superseded', fact.confidence, {
|
|
632
|
+
offlineConsolidatedAt: Date.now(),
|
|
633
|
+
supersededByFactId: adjudication.supersededByFactId,
|
|
634
|
+
...(adjudication.metadata || {})
|
|
635
|
+
});
|
|
636
|
+
const verifiedIndex = input.verifiedFacts.findIndex((item) => item.factId === fact.factId);
|
|
637
|
+
if (verifiedIndex >= 0)
|
|
638
|
+
input.verifiedFacts.splice(verifiedIndex, 1);
|
|
639
|
+
if (!rejectedIds.has(fact.factId)) {
|
|
640
|
+
input.rejectedFactIds.push(fact.factId);
|
|
641
|
+
rejectedIds.add(fact.factId);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (adjudication.action === 'archive' && !archivedIds.has(fact.factId)) {
|
|
645
|
+
fact.status = 'archived';
|
|
646
|
+
this.deps.factStore?.updateFactStatus(fact.factId, 'archived', fact.confidence, {
|
|
647
|
+
offlineConsolidatedAt: Date.now(),
|
|
648
|
+
...(adjudication.metadata || {})
|
|
649
|
+
});
|
|
650
|
+
const verifiedIndex = input.verifiedFacts.findIndex((item) => item.factId === fact.factId);
|
|
651
|
+
if (verifiedIndex >= 0)
|
|
652
|
+
input.verifiedFacts.splice(verifiedIndex, 1);
|
|
653
|
+
input.archivedFactIds.push(fact.factId);
|
|
654
|
+
archivedIds.add(fact.factId);
|
|
655
|
+
}
|
|
656
|
+
if (adjudication.action === 'reject' && !rejectedIds.has(fact.factId)) {
|
|
657
|
+
fact.status = 'rejected';
|
|
658
|
+
this.deps.factStore?.updateFactStatus(fact.factId, 'rejected', fact.confidence, {
|
|
659
|
+
offlineConsolidatedAt: Date.now(),
|
|
660
|
+
...(adjudication.metadata || {})
|
|
661
|
+
});
|
|
662
|
+
const verifiedIndex = input.verifiedFacts.findIndex((item) => item.factId === fact.factId);
|
|
663
|
+
if (verifiedIndex >= 0)
|
|
664
|
+
input.verifiedFacts.splice(verifiedIndex, 1);
|
|
665
|
+
input.rejectedFactIds.push(fact.factId);
|
|
666
|
+
rejectedIds.add(fact.factId);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MemoryGraph } from '../core/MemoryGraph.js';
|
|
2
|
+
export interface OrphanCleanerOptions {
|
|
3
|
+
orphanAgeMs?: number;
|
|
4
|
+
batchSize?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class OrphanCleaner {
|
|
7
|
+
private readonly memoryGraph;
|
|
8
|
+
private readonly options;
|
|
9
|
+
constructor(memoryGraph: MemoryGraph, options?: OrphanCleanerOptions);
|
|
10
|
+
run(projectId: string): Promise<{
|
|
11
|
+
orphansMarked: number;
|
|
12
|
+
}>;
|
|
13
|
+
private degree;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=OrphanCleaner.d.ts.map
|