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,156 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
const INTENT_LAYERS = {
|
|
3
|
+
greeting: [],
|
|
4
|
+
short_followup: ['session_state', 'turn_bridge'],
|
|
5
|
+
exact_quote: ['raw_source', 'graph', 'belief'],
|
|
6
|
+
decision_history: ['temporal', 'belief', 'raw_source', 'graph'],
|
|
7
|
+
preference_lookup: ['belief', 'raw_source', 'graph'],
|
|
8
|
+
project_status: ['belief', 'temporal', 'graph', 'raw_source'],
|
|
9
|
+
debugging: ['graph', 'raw_source', 'belief', 'temporal'],
|
|
10
|
+
general_memory: ['belief', 'graph', 'temporal', 'raw_source', 'vector'],
|
|
11
|
+
};
|
|
12
|
+
export class ContextCortex {
|
|
13
|
+
db;
|
|
14
|
+
constructor(db) {
|
|
15
|
+
this.db = db;
|
|
16
|
+
if (db)
|
|
17
|
+
this.initializeSchema();
|
|
18
|
+
}
|
|
19
|
+
classifyIntent(query) {
|
|
20
|
+
const text = query.trim().toLowerCase();
|
|
21
|
+
if (/^(hi|hello|hey|你好|您好|早上好|晚上好|嗨)[!!。. ]*$/.test(text))
|
|
22
|
+
return 'greeting';
|
|
23
|
+
if (/^(继续|接着|然后呢|上面那个|刚才说的|这个呢|continue|go on|and then)[??!!。. ]*$/.test(text))
|
|
24
|
+
return 'short_followup';
|
|
25
|
+
if (/原话|逐字|怎么说的|完整对话|exact quote|verbatim|word for word/.test(text))
|
|
26
|
+
return 'exact_quote';
|
|
27
|
+
if (/为什么.*(改|变|推翻)|何时|什么时候|之前.*决定|decision.*(change|history)|why.*change|timeline|历史/.test(text))
|
|
28
|
+
return 'decision_history';
|
|
29
|
+
if (/偏好|喜欢|不喜欢|边界|习惯|preference|prefer|boundary/.test(text))
|
|
30
|
+
return 'preference_lookup';
|
|
31
|
+
if (/项目.*(状态|进度|当前)|release status|project status|current state/.test(text))
|
|
32
|
+
return 'project_status';
|
|
33
|
+
if (/报错|错误|调试|根因|bug|debug|error|failure|root cause/.test(text))
|
|
34
|
+
return 'debugging';
|
|
35
|
+
return 'general_memory';
|
|
36
|
+
}
|
|
37
|
+
plan(input) {
|
|
38
|
+
const intent = this.classifyIntent(input.query);
|
|
39
|
+
const requestedRatio = input.maxMemoryRatio ?? input.strategy?.maxMemoryRatio ?? 0.25;
|
|
40
|
+
const ratio = Math.max(0, Math.min(0.3, requestedRatio, input.strategy?.maxMemoryRatio ?? 0.3));
|
|
41
|
+
const budgetTokens = Math.max(0, Math.floor(Math.max(0, input.availableTokens) * ratio));
|
|
42
|
+
const intentLayers = input.topicRelation === 'new'
|
|
43
|
+
? INTENT_LAYERS[intent].filter((layer) => layer !== 'session_state' && layer !== 'turn_bridge')
|
|
44
|
+
: INTENT_LAYERS[intent];
|
|
45
|
+
const strategyLayers = input.strategy
|
|
46
|
+
? [...input.strategy.primaryLayers, ...input.strategy.secondaryLayers]
|
|
47
|
+
: intentLayers;
|
|
48
|
+
const allowedLayers = strategyLayers.filter((layer) => intentLayers.includes(layer));
|
|
49
|
+
const selected = [];
|
|
50
|
+
const selectedReceipt = [];
|
|
51
|
+
const suppressed = [];
|
|
52
|
+
const seen = new Set();
|
|
53
|
+
let usedTokens = 0;
|
|
54
|
+
const eligible = [];
|
|
55
|
+
for (const candidate of input.candidates) {
|
|
56
|
+
const hardReason = this.hardSuppressionReason(candidate, input, intent);
|
|
57
|
+
if (hardReason) {
|
|
58
|
+
suppressed.push({ id: candidate.id, layer: candidate.layer, reason: hardReason });
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (intent === 'greeting') {
|
|
62
|
+
suppressed.push({ id: candidate.id, layer: candidate.layer, reason: 'intent_suppresses_memory' });
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (!allowedLayers.includes(candidate.layer)) {
|
|
66
|
+
suppressed.push({ id: candidate.id, layer: candidate.layer, reason: 'layer_not_activated' });
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (seen.has(candidate.id)) {
|
|
70
|
+
suppressed.push({ id: candidate.id, layer: candidate.layer, reason: 'duplicate' });
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
seen.add(candidate.id);
|
|
74
|
+
eligible.push({ candidate, tokens: this.estimateTokens(candidate) });
|
|
75
|
+
}
|
|
76
|
+
eligible.sort((a, b) => {
|
|
77
|
+
const layerDelta = allowedLayers.indexOf(a.candidate.layer) - allowedLayers.indexOf(b.candidate.layer);
|
|
78
|
+
return layerDelta || (b.candidate.confidence ?? 0.5) - (a.candidate.confidence ?? 0.5) || a.candidate.id.localeCompare(b.candidate.id);
|
|
79
|
+
});
|
|
80
|
+
for (const item of eligible) {
|
|
81
|
+
if (usedTokens + item.tokens > budgetTokens) {
|
|
82
|
+
suppressed.push({ id: item.candidate.id, layer: item.candidate.layer, reason: 'budget_exceeded' });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
selected.push(item.candidate);
|
|
86
|
+
usedTokens += item.tokens;
|
|
87
|
+
selectedReceipt.push({
|
|
88
|
+
id: item.candidate.id,
|
|
89
|
+
layer: item.candidate.layer,
|
|
90
|
+
tokens: item.tokens,
|
|
91
|
+
reason: input.strategy ? `activated_for:${intent}:${input.strategy.templateId}` : `activated_for:${intent}`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const receipt = {
|
|
95
|
+
receiptId: `context-${randomUUID()}`,
|
|
96
|
+
query: input.query,
|
|
97
|
+
intent,
|
|
98
|
+
projectId: input.projectId,
|
|
99
|
+
budgetTokens,
|
|
100
|
+
usedTokens,
|
|
101
|
+
strategyId: input.strategy?.capsuleId,
|
|
102
|
+
strategyTemplate: input.strategy?.templateId,
|
|
103
|
+
selected: selectedReceipt,
|
|
104
|
+
suppressed,
|
|
105
|
+
createdAt: Date.now(),
|
|
106
|
+
};
|
|
107
|
+
this.persistReceipt(receipt);
|
|
108
|
+
return { intent, budgetTokens, usedTokens, selected, receipt, strategy: input.strategy };
|
|
109
|
+
}
|
|
110
|
+
getReceipt(receiptId) {
|
|
111
|
+
if (!this.db)
|
|
112
|
+
return null;
|
|
113
|
+
const row = this.db.prepare(`SELECT receipt_json FROM context_activation_receipts WHERE receipt_id = ?`).get(receiptId);
|
|
114
|
+
return row ? JSON.parse(row.receipt_json) : null;
|
|
115
|
+
}
|
|
116
|
+
hardSuppressionReason(candidate, input, intent) {
|
|
117
|
+
if (input.projectId && candidate.projectId && candidate.projectId !== input.projectId)
|
|
118
|
+
return 'project_boundary';
|
|
119
|
+
if (candidate.superseded)
|
|
120
|
+
return 'superseded';
|
|
121
|
+
if (input.currentSessionId && candidate.sessionId === input.currentSessionId
|
|
122
|
+
&& candidate.layer !== 'session_state' && candidate.layer !== 'turn_bridge')
|
|
123
|
+
return 'current_session_echo';
|
|
124
|
+
if (candidate.ownership === 'user' && !candidate.sourceRoles?.includes('user'))
|
|
125
|
+
return 'user_belief_without_user_evidence';
|
|
126
|
+
if (candidate.sensitive && !input.allowSensitive && intent !== 'exact_quote')
|
|
127
|
+
return 'sensitive_without_need';
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
estimateTokens(candidate) {
|
|
131
|
+
if (Number.isFinite(candidate.estimatedTokens) && Number(candidate.estimatedTokens) > 0) {
|
|
132
|
+
return Math.ceil(Number(candidate.estimatedTokens));
|
|
133
|
+
}
|
|
134
|
+
return Math.max(1, Math.ceil(candidate.content.length / 4));
|
|
135
|
+
}
|
|
136
|
+
persistReceipt(receipt) {
|
|
137
|
+
if (!this.db)
|
|
138
|
+
return;
|
|
139
|
+
this.db.prepare(`
|
|
140
|
+
INSERT INTO context_activation_receipts (
|
|
141
|
+
receipt_id, project_id, intent, budget_tokens, used_tokens, receipt_json, created_at
|
|
142
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
143
|
+
`).run(receipt.receiptId, receipt.projectId ?? null, receipt.intent, receipt.budgetTokens, receipt.usedTokens, JSON.stringify(receipt), receipt.createdAt);
|
|
144
|
+
}
|
|
145
|
+
initializeSchema() {
|
|
146
|
+
this.db.exec(`
|
|
147
|
+
CREATE TABLE IF NOT EXISTS context_activation_receipts (
|
|
148
|
+
receipt_id TEXT PRIMARY KEY, project_id TEXT, intent TEXT NOT NULL,
|
|
149
|
+
budget_tokens INTEGER NOT NULL, used_tokens INTEGER NOT NULL,
|
|
150
|
+
receipt_json TEXT NOT NULL, created_at INTEGER NOT NULL
|
|
151
|
+
);
|
|
152
|
+
CREATE INDEX IF NOT EXISTS idx_context_activation_project_time
|
|
153
|
+
ON context_activation_receipts(project_id, created_at DESC);
|
|
154
|
+
`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ContextCortex.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QueryIR } from '../types/query-ir.js';
|
|
2
|
+
export declare class IntentParser {
|
|
3
|
+
static parse(query: string): QueryIR;
|
|
4
|
+
private static extractEntities;
|
|
5
|
+
private static detectIntent;
|
|
6
|
+
private static extractTemporal;
|
|
7
|
+
private static extractSpatial;
|
|
8
|
+
private static extractConstraints;
|
|
9
|
+
private static extractSemantics;
|
|
10
|
+
private static detectPredicateHint;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=IntentParser.d.ts.map
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// IntentParser - 意图解析器(轻量级规则/正则)
|
|
3
|
+
// ============================================
|
|
4
|
+
const TEMPORAL_KEYWORDS = {
|
|
5
|
+
'今天': { relative: 'today' },
|
|
6
|
+
'昨天': { relative: 'yesterday' },
|
|
7
|
+
'本周': { relative: 'this_week' },
|
|
8
|
+
'上周': { relative: 'last_week' },
|
|
9
|
+
'这个月': { relative: 'this_month' },
|
|
10
|
+
'上个月': { relative: 'last_month' },
|
|
11
|
+
'今年': { relative: 'this_year' },
|
|
12
|
+
'去年': { relative: 'last_year' },
|
|
13
|
+
'近半年': { relative: 'past_six_months' },
|
|
14
|
+
'过去半年': { relative: 'past_six_months' },
|
|
15
|
+
'近一年': { relative: 'past_year' },
|
|
16
|
+
'过去一年': { relative: 'past_year' },
|
|
17
|
+
'半年前': { relative: 'around_half_year_ago' },
|
|
18
|
+
'today': { relative: 'today' },
|
|
19
|
+
'yesterday': { relative: 'yesterday' },
|
|
20
|
+
'this week': { relative: 'this_week' },
|
|
21
|
+
'last week': { relative: 'last_week' },
|
|
22
|
+
'this year': { relative: 'this_year' },
|
|
23
|
+
'last year': { relative: 'last_year' },
|
|
24
|
+
'past six months': { relative: 'past_six_months' },
|
|
25
|
+
'last 6 months': { relative: 'past_six_months' },
|
|
26
|
+
'past year': { relative: 'past_year' },
|
|
27
|
+
'half year ago': { relative: 'around_half_year_ago' }
|
|
28
|
+
};
|
|
29
|
+
const INTENT_KEYWORDS = {
|
|
30
|
+
'查找': 'recall', '找': 'recall', 'recall': 'recall', 'search': 'recall',
|
|
31
|
+
'追溯': 'trace', 'trace': 'trace', '溯源': 'trace',
|
|
32
|
+
'更新': 'update', 'update': 'update', '修改': 'update'
|
|
33
|
+
};
|
|
34
|
+
const ENTITY_STOPWORDS = new Set([
|
|
35
|
+
'的', '了', '是', '在', '和', '与', '或',
|
|
36
|
+
'the', 'a', 'an', 'is', 'are', 'show', 'for', 'my', 'what', 'which',
|
|
37
|
+
'preference', 'decision', 'constraint', 'workflow', 'history'
|
|
38
|
+
]);
|
|
39
|
+
export class IntentParser {
|
|
40
|
+
static parse(query) {
|
|
41
|
+
const lowerQuery = query.toLowerCase();
|
|
42
|
+
const entities = this.extractEntities(query);
|
|
43
|
+
const intentType = this.detectIntent(lowerQuery);
|
|
44
|
+
const temporal = this.extractTemporal(lowerQuery);
|
|
45
|
+
const spatial = this.extractSpatial(query);
|
|
46
|
+
const { mustMatch, shouldMatch } = this.extractConstraints(query, entities);
|
|
47
|
+
const semantics = this.extractSemantics(query, lowerQuery, entities, mustMatch, shouldMatch);
|
|
48
|
+
return {
|
|
49
|
+
rawQuery: query,
|
|
50
|
+
entities,
|
|
51
|
+
intentType,
|
|
52
|
+
temporal,
|
|
53
|
+
spatial,
|
|
54
|
+
mustMatch,
|
|
55
|
+
shouldMatch,
|
|
56
|
+
semantics
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static extractEntities(query) {
|
|
60
|
+
const words = query.split(/[\s,,。!?、]+/);
|
|
61
|
+
return words
|
|
62
|
+
.map((word) => word.replace(/^[^\p{L}\p{N}._-]+|[^\p{L}\p{N}._-]+$/gu, ''))
|
|
63
|
+
.filter(w => w.length >= 2 && !ENTITY_STOPWORDS.has(w.toLowerCase()) && !/^\d+$/.test(w))
|
|
64
|
+
.slice(0, 10);
|
|
65
|
+
}
|
|
66
|
+
static detectIntent(query) {
|
|
67
|
+
for (const [kw, type] of Object.entries(INTENT_KEYWORDS)) {
|
|
68
|
+
if (query.includes(kw))
|
|
69
|
+
return type;
|
|
70
|
+
}
|
|
71
|
+
return 'recall';
|
|
72
|
+
}
|
|
73
|
+
static extractTemporal(query) {
|
|
74
|
+
for (const [kw, constraint] of Object.entries(TEMPORAL_KEYWORDS)) {
|
|
75
|
+
if (query.includes(kw.toLowerCase()))
|
|
76
|
+
return constraint;
|
|
77
|
+
}
|
|
78
|
+
// 尝试解析具体日期(YYYY-MM-DD)
|
|
79
|
+
const dateMatch = query.match(/(\d{4}-\d{2}-\d{2})/);
|
|
80
|
+
if (dateMatch) {
|
|
81
|
+
const ts = new Date(dateMatch[1]).getTime();
|
|
82
|
+
return { start: ts, end: ts + 86400000 };
|
|
83
|
+
}
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
static extractSpatial(query) {
|
|
87
|
+
const result = {};
|
|
88
|
+
// 提取项目ID(project:xxx)
|
|
89
|
+
const projectMatch = query.match(/project[::]\s*([\w.-]+)/i);
|
|
90
|
+
if (projectMatch)
|
|
91
|
+
result.projectId = projectMatch[1];
|
|
92
|
+
// 提取文件类型(.ts, .js)
|
|
93
|
+
const extMatch = query.match(/\.(\w+)$/);
|
|
94
|
+
if (extMatch)
|
|
95
|
+
result.fileType = extMatch[1];
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
static extractConstraints(query, entities) {
|
|
99
|
+
// 引号内容为硬约束
|
|
100
|
+
const quoted = query.match(/["「『]([^"」』]+)["」』]/g) || [];
|
|
101
|
+
const mustMatch = quoted.map(q => q.replace(/["「」『』]/g, ''));
|
|
102
|
+
// 其他实体为软约束
|
|
103
|
+
const shouldMatch = entities.filter(e => !mustMatch.includes(e));
|
|
104
|
+
return { mustMatch, shouldMatch };
|
|
105
|
+
}
|
|
106
|
+
static extractSemantics(query, lowerQuery, entities, mustMatch, shouldMatch) {
|
|
107
|
+
const predicateHint = this.detectPredicateHint(lowerQuery);
|
|
108
|
+
const subjectHint = /(我|i|my|mine)/i.test(query) ? 'user' : undefined;
|
|
109
|
+
const valueHints = [];
|
|
110
|
+
if (/(喜欢|like|prefer)/i.test(query))
|
|
111
|
+
valueHints.push('like');
|
|
112
|
+
if (/(讨厌|dislike|不喜欢)/i.test(query))
|
|
113
|
+
valueHints.push('dislike');
|
|
114
|
+
if (/(必须|must use)/i.test(query))
|
|
115
|
+
valueHints.push('required');
|
|
116
|
+
if (/(不能|禁止|must not|do not use|don't use)/i.test(query))
|
|
117
|
+
valueHints.push('forbidden');
|
|
118
|
+
if (/(选择|决定|choose|decide)/i.test(query))
|
|
119
|
+
valueHints.push('selected');
|
|
120
|
+
if (/(retry|重试)/i.test(query))
|
|
121
|
+
valueHints.push('retry');
|
|
122
|
+
if (/(rollback|回滚)/i.test(query))
|
|
123
|
+
valueHints.push('rollback');
|
|
124
|
+
if (/(recover|recovery|恢复)/i.test(query))
|
|
125
|
+
valueHints.push('recover');
|
|
126
|
+
if (/(redeploy|重新部署)/i.test(query))
|
|
127
|
+
valueHints.push('redeploy');
|
|
128
|
+
if (/(backoff|退避)/i.test(query))
|
|
129
|
+
valueHints.push('backoff');
|
|
130
|
+
if (/(merge|合并)/i.test(query))
|
|
131
|
+
valueHints.push('merge');
|
|
132
|
+
if (/(branch|分支)/i.test(query))
|
|
133
|
+
valueHints.push('branch');
|
|
134
|
+
if (/(state|状态|transition|迁移)/i.test(query))
|
|
135
|
+
valueHints.push('state_transition');
|
|
136
|
+
if (/(policy|策略)/i.test(query))
|
|
137
|
+
valueHints.push('policy');
|
|
138
|
+
const conditionHints = [];
|
|
139
|
+
const conditionalMatches = query.match(/如果.+?(?=[,,]|$)|if\s+.+?(?=[,,]|$)/ig) || [];
|
|
140
|
+
for (const item of conditionalMatches)
|
|
141
|
+
conditionHints.push(item.trim());
|
|
142
|
+
const environmentHints = [];
|
|
143
|
+
const envMatches = query.match(/production|prod|staging|stage|dev|development|test|测试|生产|预发|开发/ig) || [];
|
|
144
|
+
for (const item of envMatches)
|
|
145
|
+
environmentHints.push(item.toLowerCase());
|
|
146
|
+
const stateHints = [];
|
|
147
|
+
const stateMatches = query.match(/pending|running|healthy|failed|success|approved|approval|等待|运行中|健康|失败|成功|已批准|审批/ig) || [];
|
|
148
|
+
for (const item of stateMatches)
|
|
149
|
+
stateHints.push(item.toLowerCase());
|
|
150
|
+
const policyHints = [];
|
|
151
|
+
const policyMatches = query.match(/policy|策略|circuit-breaker|canary|strict|lenient|fallback|quota|rate-limit/ig) || [];
|
|
152
|
+
for (const item of policyMatches)
|
|
153
|
+
policyHints.push(item.toLowerCase());
|
|
154
|
+
const guardHints = [];
|
|
155
|
+
const guardMatches = query.match(/guard|approval|approved|gate|准入|批准|审批/ig) || [];
|
|
156
|
+
for (const item of guardMatches)
|
|
157
|
+
guardHints.push(item.toLowerCase());
|
|
158
|
+
const executorHints = [];
|
|
159
|
+
const executorMatches = query.match(/executor|runner|worker-runner|agent-runner|执行器|执行/ig) || [];
|
|
160
|
+
for (const item of executorMatches)
|
|
161
|
+
executorHints.push(item.toLowerCase());
|
|
162
|
+
const validationHints = [];
|
|
163
|
+
const validationMatches = query.match(/validate|validation|校验|check|health|quota|smoke|metrics/ig) || [];
|
|
164
|
+
for (const item of validationMatches)
|
|
165
|
+
validationHints.push(item.toLowerCase());
|
|
166
|
+
const mergeHints = [];
|
|
167
|
+
const mergeMatches = query.match(/merge|合并|release|propagate|传播/ig) || [];
|
|
168
|
+
for (const item of mergeMatches)
|
|
169
|
+
mergeHints.push(item.toLowerCase());
|
|
170
|
+
const entityHints = Array.from(new Set([...mustMatch, ...shouldMatch, ...entities]))
|
|
171
|
+
.map((item) => item.replace(/^[^\p{L}\p{N}._-]+|[^\p{L}\p{N}._-]+$/gu, ''))
|
|
172
|
+
.map((item) => item.toLowerCase())
|
|
173
|
+
.filter((item) => item.length >= 2)
|
|
174
|
+
.filter((item) => !ENTITY_STOPWORDS.has(item))
|
|
175
|
+
.filter((item) => !/(喜欢|讨厌|必须|不能|workflow|graph|history|历史|版本|偏好|决定|约束)/i.test(item));
|
|
176
|
+
return {
|
|
177
|
+
subjectHint,
|
|
178
|
+
predicateHint,
|
|
179
|
+
entityHints,
|
|
180
|
+
valueHints: Array.from(new Set(valueHints)),
|
|
181
|
+
conditionHints,
|
|
182
|
+
environmentHints: Array.from(new Set(environmentHints)),
|
|
183
|
+
stateHints: Array.from(new Set(stateHints)),
|
|
184
|
+
policyHints: Array.from(new Set(policyHints)),
|
|
185
|
+
guardHints: Array.from(new Set(guardHints)),
|
|
186
|
+
executorHints: Array.from(new Set(executorHints)),
|
|
187
|
+
validationHints: Array.from(new Set(validationHints)),
|
|
188
|
+
mergeHints: Array.from(new Set(mergeHints)),
|
|
189
|
+
asksForHistory: /(历史|history|版本|变化|contradiction|冲突)/i.test(query)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
static detectPredicateHint(query) {
|
|
193
|
+
if (/(喜欢|讨厌|偏好|prefer|preference|dislike|like)/i.test(query))
|
|
194
|
+
return 'preference';
|
|
195
|
+
if (/(决定|选择|choose|decision|decide)/i.test(query))
|
|
196
|
+
return 'decision';
|
|
197
|
+
if (/(约束|限制|必须|不能|constraint|rule)/i.test(query))
|
|
198
|
+
return 'constraint';
|
|
199
|
+
if (/(计划|plan|rollback|recover|recovery|redeploy|retry|execute|executor|执行|validate|校验|merge|传播)/i.test(query))
|
|
200
|
+
return 'plan';
|
|
201
|
+
if (/(workflow|流程|工作流)/i.test(query))
|
|
202
|
+
return 'workflow';
|
|
203
|
+
if (/(graph|架构|依赖链|拓扑)/i.test(query))
|
|
204
|
+
return 'graph';
|
|
205
|
+
if (/(先|再|then|first|步骤|sequence)/i.test(query))
|
|
206
|
+
return 'sequence';
|
|
207
|
+
if (/(事实|配置|地址|api|endpoint|database|port|which|what is)/i.test(query))
|
|
208
|
+
return 'fact';
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { MemoryAnchor, MemoryImportanceLevel, Neuron, NeuronMetadata, NeuronType, Synapse, TopicNode } from '../types/index.js';
|
|
2
|
+
export interface VectorPageRow {
|
|
3
|
+
id: string;
|
|
4
|
+
vector: number[];
|
|
5
|
+
}
|
|
6
|
+
export interface TopicReclassifiedObservation {
|
|
7
|
+
type: 'TopicReclassified';
|
|
8
|
+
neuronId: string;
|
|
9
|
+
projectId?: string;
|
|
10
|
+
from: string | undefined;
|
|
11
|
+
to: string | undefined;
|
|
12
|
+
content: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class MemoryGraph {
|
|
16
|
+
private db;
|
|
17
|
+
private timeIndex;
|
|
18
|
+
private projectIndex;
|
|
19
|
+
private anchorIndex;
|
|
20
|
+
private topicReclassifiedListeners;
|
|
21
|
+
constructor(dbPath?: string);
|
|
22
|
+
private initializeSchema;
|
|
23
|
+
private ensureCompatibilityColumns;
|
|
24
|
+
addNeuron(neuron: Neuron): void;
|
|
25
|
+
addNeuronInTransaction(neuron: Neuron): void;
|
|
26
|
+
private insertNeuron;
|
|
27
|
+
private insertIntoFTS;
|
|
28
|
+
rebuildIndexes(): void;
|
|
29
|
+
private updateMemoryIndexes;
|
|
30
|
+
addSynapse(sourceId: string, synapse: Synapse): void;
|
|
31
|
+
getNeuron(id: string): Neuron | null;
|
|
32
|
+
getNeuronIdsByProject(projectId: string): string[];
|
|
33
|
+
getSynapses(sourceId: string): Synapse[];
|
|
34
|
+
getAllNeurons(): Neuron[];
|
|
35
|
+
findNeuronsByType(type: NeuronType, options?: {
|
|
36
|
+
projectId?: string;
|
|
37
|
+
topicPath?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): Neuron[];
|
|
40
|
+
listNeuronsByTimeRange(startTime: number, endTime: number, projectId?: string): Neuron[];
|
|
41
|
+
private mapNeuron;
|
|
42
|
+
private encodeAaakSummary;
|
|
43
|
+
private decodeAaakSummary;
|
|
44
|
+
private decodeProceduralLink;
|
|
45
|
+
private decodeVectorBlob;
|
|
46
|
+
createAnchor(neuronIds: string[], projectId?: string): MemoryAnchor;
|
|
47
|
+
private computeAnchorSummary;
|
|
48
|
+
getLatestAnchor(projectId?: string): MemoryAnchor | null;
|
|
49
|
+
getLatestNeuronSelfHash(projectId?: string): string | null;
|
|
50
|
+
fullTextSearch(query: string, projectId?: string, limit?: number): string[];
|
|
51
|
+
private toFTSQuery;
|
|
52
|
+
private extractFallbackSearchTokens;
|
|
53
|
+
private fallbackTextSearch;
|
|
54
|
+
transaction(fn: () => void): void;
|
|
55
|
+
close(): void;
|
|
56
|
+
getStats(): {
|
|
57
|
+
neuronCount: number;
|
|
58
|
+
synapseCount: number;
|
|
59
|
+
anchorCount: number;
|
|
60
|
+
};
|
|
61
|
+
findSimilarNeurons(vector: number[], topK: number): Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
score: number;
|
|
64
|
+
}>;
|
|
65
|
+
private cosineSimilarity;
|
|
66
|
+
updateNeuronStatus(neuronId: string, status: 'active' | 'cold' | 'archived'): void;
|
|
67
|
+
updateNeuronMetadata(neuronId: string, metadata: Partial<NeuronMetadata>): void;
|
|
68
|
+
onTopicReclassified(listener: (observation: TopicReclassifiedObservation) => void): () => void;
|
|
69
|
+
getTopicPaths(projectId?: string): string[];
|
|
70
|
+
getNeuronIdsByTopicPrefix(prefix: string, projectId?: string): string[];
|
|
71
|
+
buildTopicTree(projectId?: string): TopicNode[];
|
|
72
|
+
updateNeuronContent(neuronId: string, content: string): void;
|
|
73
|
+
updateNeuronImportance(neuronId: string, importanceLevel: MemoryImportanceLevel, isPinned?: boolean): void;
|
|
74
|
+
listPinnedNeurons(options?: number | {
|
|
75
|
+
limit?: number;
|
|
76
|
+
projectId?: string;
|
|
77
|
+
}): Neuron[];
|
|
78
|
+
getRecentNeurons(options?: {
|
|
79
|
+
sinceMs?: number;
|
|
80
|
+
limit?: number;
|
|
81
|
+
projectId?: string;
|
|
82
|
+
}): Neuron[];
|
|
83
|
+
hasSynapse(sourceId: string, targetId: string): boolean;
|
|
84
|
+
getNeuronEnergy(neuronId: string): number;
|
|
85
|
+
getOrphanNeuronIds(limit: number): string[];
|
|
86
|
+
getNeuronIdsForReinforcement(limit: number): string[];
|
|
87
|
+
getNeuronIdsForTransition(limit: number): string[];
|
|
88
|
+
getArchivedFileNeurons(): Neuron[];
|
|
89
|
+
iterateNeuronVectors(pageSize: number, options?: {
|
|
90
|
+
includeStatuses?: Array<'active' | 'cold' | 'suspect' | 'archived'>;
|
|
91
|
+
projectId?: string;
|
|
92
|
+
onlyNotDeleted?: boolean;
|
|
93
|
+
}): IterableIterator<VectorPageRow[]>;
|
|
94
|
+
forEachNeuronVectorPage(pageSize: number, onPage: (rows: VectorPageRow[]) => Promise<void> | void, options?: {
|
|
95
|
+
includeStatuses?: Array<'active' | 'cold' | 'suspect' | 'archived'>;
|
|
96
|
+
projectId?: string;
|
|
97
|
+
onlyNotDeleted?: boolean;
|
|
98
|
+
}): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=MemoryGraph.d.ts.map
|