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,43 @@
|
|
|
1
|
+
import type { QueryCompiler } from './QueryCompiler.js';
|
|
2
|
+
import type { RetrievalPlanner } from './RetrievalPlanner.js';
|
|
3
|
+
import type { TemporalBranchSearch } from './TemporalBranchSearch.js';
|
|
4
|
+
import type { PulseRetrievalEngine } from './PulseRetrievalEngine.js';
|
|
5
|
+
import type { NarrativeRecallAssembler } from './NarrativeRecallAssembler.js';
|
|
6
|
+
import type { UniverseTraversalExecutor } from './UniverseTraversalExecutor.js';
|
|
7
|
+
export interface UniverseNavigationResult {
|
|
8
|
+
compiledQuery: ReturnType<QueryCompiler['compile']>;
|
|
9
|
+
branchSearch: ReturnType<TemporalBranchSearch['search']>;
|
|
10
|
+
pulse: ReturnType<PulseRetrievalEngine['run']>;
|
|
11
|
+
narrative: ReturnType<NarrativeRecallAssembler['assemble']>;
|
|
12
|
+
runtime: {
|
|
13
|
+
path: string[];
|
|
14
|
+
segments: Array<{
|
|
15
|
+
stage: string;
|
|
16
|
+
label: string;
|
|
17
|
+
count?: number;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare class UniverseNavigator {
|
|
22
|
+
private queryCompiler;
|
|
23
|
+
private retrievalPlanner;
|
|
24
|
+
private temporalBranchSearch;
|
|
25
|
+
private pulseRetrievalEngine;
|
|
26
|
+
private narrativeRecallAssembler;
|
|
27
|
+
private traversalExecutor;
|
|
28
|
+
constructor(queryCompiler: QueryCompiler, retrievalPlanner: RetrievalPlanner, temporalBranchSearch: TemporalBranchSearch, pulseRetrievalEngine: PulseRetrievalEngine, narrativeRecallAssembler: NarrativeRecallAssembler, traversalExecutor: UniverseTraversalExecutor);
|
|
29
|
+
navigate(input: {
|
|
30
|
+
query: string;
|
|
31
|
+
projectId?: string;
|
|
32
|
+
startTime?: number;
|
|
33
|
+
endTime?: number;
|
|
34
|
+
topologyIds: string[];
|
|
35
|
+
branchIds: string[];
|
|
36
|
+
temporalBucketIds: string[];
|
|
37
|
+
temporalNeuronIds: string[];
|
|
38
|
+
graphIds: string[];
|
|
39
|
+
cognitiveGraphIds: string[];
|
|
40
|
+
entityNeuronIds: string[];
|
|
41
|
+
}): UniverseNavigationResult;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=UniverseNavigator.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export class UniverseNavigator {
|
|
2
|
+
queryCompiler;
|
|
3
|
+
retrievalPlanner;
|
|
4
|
+
temporalBranchSearch;
|
|
5
|
+
pulseRetrievalEngine;
|
|
6
|
+
narrativeRecallAssembler;
|
|
7
|
+
traversalExecutor;
|
|
8
|
+
constructor(queryCompiler, retrievalPlanner, temporalBranchSearch, pulseRetrievalEngine, narrativeRecallAssembler, traversalExecutor) {
|
|
9
|
+
this.queryCompiler = queryCompiler;
|
|
10
|
+
this.retrievalPlanner = retrievalPlanner;
|
|
11
|
+
this.temporalBranchSearch = temporalBranchSearch;
|
|
12
|
+
this.pulseRetrievalEngine = pulseRetrievalEngine;
|
|
13
|
+
this.narrativeRecallAssembler = narrativeRecallAssembler;
|
|
14
|
+
this.traversalExecutor = traversalExecutor;
|
|
15
|
+
}
|
|
16
|
+
navigate(input) {
|
|
17
|
+
const compiledQuery = this.queryCompiler.compile(input.query, input.projectId);
|
|
18
|
+
const plan = this.retrievalPlanner.plan(compiledQuery.ir);
|
|
19
|
+
const startTime = input.startTime ?? compiledQuery.ir.temporal.start;
|
|
20
|
+
const endTime = input.endTime ?? compiledQuery.ir.temporal.end;
|
|
21
|
+
const branchSearch = this.temporalBranchSearch.search({
|
|
22
|
+
projectId: input.projectId,
|
|
23
|
+
startTime,
|
|
24
|
+
endTime,
|
|
25
|
+
temporalBucketIds: input.temporalBucketIds,
|
|
26
|
+
entityNeuronIds: input.entityNeuronIds,
|
|
27
|
+
terms: Array.from(new Set([
|
|
28
|
+
...compiledQuery.ir.entities,
|
|
29
|
+
...compiledQuery.ir.semantics.entityHints,
|
|
30
|
+
...compiledQuery.ir.mustMatch,
|
|
31
|
+
...compiledQuery.ir.shouldMatch
|
|
32
|
+
]))
|
|
33
|
+
});
|
|
34
|
+
const pulse = this.pulseRetrievalEngine.run({
|
|
35
|
+
plan,
|
|
36
|
+
ir: compiledQuery.ir,
|
|
37
|
+
entityIds: compiledQuery.entityResolution.resolved.map((entity) => entity.entityId),
|
|
38
|
+
topologyIds: Array.from(new Set([...input.topologyIds, ...branchSearch.neuronIds, ...branchSearch.denseJointNeuronIds])),
|
|
39
|
+
branchIds: Array.from(new Set([...input.branchIds, ...branchSearch.neuronIds])),
|
|
40
|
+
temporalBucketIds: Array.from(new Set([...input.temporalBucketIds, ...branchSearch.temporalTraversal.bucketIds])),
|
|
41
|
+
temporalNeuronIds: Array.from(new Set([...input.temporalNeuronIds, ...branchSearch.temporalTraversal.neuronIds])),
|
|
42
|
+
graphIds: input.graphIds,
|
|
43
|
+
cognitiveGraphIds: input.cognitiveGraphIds,
|
|
44
|
+
entityNeuronIds: Array.from(new Set([...input.entityNeuronIds, ...branchSearch.denseJointNeuronIds]))
|
|
45
|
+
});
|
|
46
|
+
const traversal = this.traversalExecutor.execute({
|
|
47
|
+
temporalSegments: branchSearch.temporalTraversal.segments,
|
|
48
|
+
branchIds: branchSearch.branchIds,
|
|
49
|
+
taskIds: branchSearch.taskIds,
|
|
50
|
+
clusterIds: branchSearch.clusterIds,
|
|
51
|
+
denseJointCount: branchSearch.denseJointNeuronIds.length
|
|
52
|
+
});
|
|
53
|
+
const narrative = this.narrativeRecallAssembler.assemble({
|
|
54
|
+
query: input.query,
|
|
55
|
+
plannerReasons: plan.diagnostics.reasons,
|
|
56
|
+
pulseTrace: pulse.trace,
|
|
57
|
+
temporalLabels: branchSearch.temporalTraversal.labels,
|
|
58
|
+
branchIds: branchSearch.branchIds,
|
|
59
|
+
entityIds: compiledQuery.entityResolution.resolved.map((entity) => entity.entityId),
|
|
60
|
+
denseJointCount: branchSearch.denseJointNeuronIds.length,
|
|
61
|
+
traversalPath: traversal.path,
|
|
62
|
+
traversalSegments: traversal.segments
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
compiledQuery,
|
|
66
|
+
branchSearch,
|
|
67
|
+
pulse,
|
|
68
|
+
narrative,
|
|
69
|
+
runtime: {
|
|
70
|
+
path: traversal.path,
|
|
71
|
+
segments: traversal.segments
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TemporalTraversalSegment } from './TemporalBranchSearch.js';
|
|
2
|
+
export interface UniverseTraversalSegment {
|
|
3
|
+
stage: 'temporal' | 'day' | 'adjacent_days' | 'project_branch' | 'task_branch' | 'event_cluster' | 'dense';
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
count?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UniverseTraversalExecution {
|
|
9
|
+
path: string[];
|
|
10
|
+
segments: UniverseTraversalSegment[];
|
|
11
|
+
}
|
|
12
|
+
export declare class UniverseTraversalExecutor {
|
|
13
|
+
execute(input: {
|
|
14
|
+
temporalSegments: TemporalTraversalSegment[];
|
|
15
|
+
branchIds: string[];
|
|
16
|
+
taskIds: string[];
|
|
17
|
+
clusterIds: string[];
|
|
18
|
+
denseJointCount: number;
|
|
19
|
+
}): UniverseTraversalExecution;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=UniverseTraversalExecutor.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export class UniverseTraversalExecutor {
|
|
2
|
+
execute(input) {
|
|
3
|
+
const temporalSegments = input.temporalSegments
|
|
4
|
+
.slice()
|
|
5
|
+
.sort((a, b) => a.bucketStart - b.bucketStart);
|
|
6
|
+
const segments = [];
|
|
7
|
+
segments.push({
|
|
8
|
+
stage: 'temporal',
|
|
9
|
+
key: 'temporal-root',
|
|
10
|
+
label: temporalSegments[0]?.label || 'temporal:none',
|
|
11
|
+
count: temporalSegments.length
|
|
12
|
+
});
|
|
13
|
+
const firstTemporal = temporalSegments[0];
|
|
14
|
+
if (firstTemporal) {
|
|
15
|
+
segments.push({
|
|
16
|
+
stage: 'day',
|
|
17
|
+
key: firstTemporal.bucketId,
|
|
18
|
+
label: firstTemporal.label,
|
|
19
|
+
count: firstTemporal.neuronIds.length
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
for (const segment of temporalSegments.slice(1, 4)) {
|
|
23
|
+
segments.push({
|
|
24
|
+
stage: 'adjacent_days',
|
|
25
|
+
key: segment.bucketId,
|
|
26
|
+
label: segment.label,
|
|
27
|
+
count: segment.neuronIds.length
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const preferredBranches = Array.from(new Set([
|
|
31
|
+
...temporalSegments.flatMap((segment) => segment.branchIds),
|
|
32
|
+
...input.branchIds
|
|
33
|
+
]));
|
|
34
|
+
const preferredTasks = Array.from(new Set([
|
|
35
|
+
...temporalSegments.flatMap((segment) => segment.taskIds),
|
|
36
|
+
...input.taskIds
|
|
37
|
+
]));
|
|
38
|
+
const preferredClusters = Array.from(new Set([
|
|
39
|
+
...temporalSegments.flatMap((segment) => segment.clusterIds),
|
|
40
|
+
...input.clusterIds
|
|
41
|
+
]));
|
|
42
|
+
for (const branchId of preferredBranches.slice(0, 3)) {
|
|
43
|
+
segments.push({
|
|
44
|
+
stage: 'project_branch',
|
|
45
|
+
key: branchId,
|
|
46
|
+
label: `branch:${branchId}`,
|
|
47
|
+
count: 1
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
for (const taskId of preferredTasks.slice(0, 3)) {
|
|
51
|
+
segments.push({
|
|
52
|
+
stage: 'task_branch',
|
|
53
|
+
key: taskId,
|
|
54
|
+
label: `task:${taskId}`,
|
|
55
|
+
count: 1
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
for (const clusterId of preferredClusters.slice(0, 3)) {
|
|
59
|
+
segments.push({
|
|
60
|
+
stage: 'event_cluster',
|
|
61
|
+
key: clusterId,
|
|
62
|
+
label: `cluster:${clusterId}`,
|
|
63
|
+
count: 1
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
segments.push({
|
|
67
|
+
stage: 'dense',
|
|
68
|
+
key: 'dense_joint',
|
|
69
|
+
label: 'dense_joint_search',
|
|
70
|
+
count: input.denseJointCount
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
path: segments.map((segment) => `${segment.stage}:${segment.label}`),
|
|
74
|
+
segments
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface EvidenceRef {
|
|
2
|
+
source: 'initial_recall' | 'brain_recall' | 'get_neuron_context' | 'expand_entity' | 'find_file_assets' | 'get_file_context' | 'find_skills';
|
|
3
|
+
toolCallId?: string;
|
|
4
|
+
iterationIndex: number;
|
|
5
|
+
factIds?: string[];
|
|
6
|
+
neuronIds?: string[];
|
|
7
|
+
entityIds?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface AnswerEvidenceTrace {
|
|
10
|
+
finalAnswer: string;
|
|
11
|
+
evidenceRefs: EvidenceRef[];
|
|
12
|
+
iterationCount: number;
|
|
13
|
+
toolCallIds: string[];
|
|
14
|
+
stoppedByPolicy: boolean;
|
|
15
|
+
stoppedByMaxIter: boolean;
|
|
16
|
+
totalTokensUsed: number;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=AnswerEvidenceTrace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BrainToolDispatcher.ts
|
|
3
|
+
* Routes BrainToolCall to the correct tool implementation.
|
|
4
|
+
* Phase 48 — v1.1
|
|
5
|
+
*/
|
|
6
|
+
import type { FactStore } from '../store/FactStore.js';
|
|
7
|
+
import type { EntityStore } from '../store/EntityStore.js';
|
|
8
|
+
import type { BeliefStore } from '../belief/BeliefStore.js';
|
|
9
|
+
import type { MemoryGraph } from '../core/MemoryGraph.js';
|
|
10
|
+
import type { GraphEdgeStoreLike } from '../types/ExtensionPoints.js';
|
|
11
|
+
import type { FileAssetStore, FileChunkStore } from '../assets/index.js';
|
|
12
|
+
import type { ISkillDiscovery } from '../types/ExtensionPoints.js';
|
|
13
|
+
import type { BrainToolCall, BrainToolResult } from './LLMToolSchema.js';
|
|
14
|
+
import type { RecallFunction } from './ExecutionLoop.js';
|
|
15
|
+
import type { BrainToolDispatcherLike, BrainToolDispatchContext } from './IterativeLLMClarifier.js';
|
|
16
|
+
export interface BrainToolDispatcherDeps {
|
|
17
|
+
recallFn: RecallFunction;
|
|
18
|
+
memoryGraph: MemoryGraph;
|
|
19
|
+
factStore: FactStore;
|
|
20
|
+
entityStore: EntityStore;
|
|
21
|
+
beliefStore: BeliefStore;
|
|
22
|
+
graphEdgeStore?: GraphEdgeStoreLike;
|
|
23
|
+
fileAssetStore?: FileAssetStore;
|
|
24
|
+
fileChunkStore?: FileChunkStore;
|
|
25
|
+
skillDiscoveryEngine?: ISkillDiscovery;
|
|
26
|
+
}
|
|
27
|
+
export declare class BrainToolDispatcher implements BrainToolDispatcherLike {
|
|
28
|
+
private readonly deps;
|
|
29
|
+
private readonly secondaryRecall;
|
|
30
|
+
private readonly neuronContext;
|
|
31
|
+
private readonly entityExpand;
|
|
32
|
+
private readonly skillDiscovery?;
|
|
33
|
+
constructor(deps: BrainToolDispatcherDeps);
|
|
34
|
+
dispatch(call: BrainToolCall, context?: BrainToolDispatchContext): Promise<BrainToolResult>;
|
|
35
|
+
private error;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=BrainToolDispatcher.d.ts.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BrainToolDispatcher.ts
|
|
3
|
+
* Routes BrainToolCall to the correct tool implementation.
|
|
4
|
+
* Phase 48 — v1.1
|
|
5
|
+
*/
|
|
6
|
+
import { SecondaryRecallTool } from './tools/SecondaryRecallTool.js';
|
|
7
|
+
import { NeuronContextTool } from './tools/NeuronContextTool.js';
|
|
8
|
+
import { EntityExpandTool } from './tools/EntityExpandTool.js';
|
|
9
|
+
import { SkillDiscoveryTool } from './tools/SkillDiscoveryTool.js';
|
|
10
|
+
/** Unique monotonic counter for call IDs (per process lifetime) */
|
|
11
|
+
let callSeq = 0;
|
|
12
|
+
function nextCallId() {
|
|
13
|
+
return `tool-call-${Date.now()}-${++callSeq}`;
|
|
14
|
+
}
|
|
15
|
+
export class BrainToolDispatcher {
|
|
16
|
+
deps;
|
|
17
|
+
secondaryRecall;
|
|
18
|
+
neuronContext;
|
|
19
|
+
entityExpand;
|
|
20
|
+
skillDiscovery;
|
|
21
|
+
constructor(deps) {
|
|
22
|
+
this.deps = deps;
|
|
23
|
+
this.secondaryRecall = new SecondaryRecallTool(deps.recallFn);
|
|
24
|
+
this.neuronContext = new NeuronContextTool(deps.memoryGraph, deps.graphEdgeStore);
|
|
25
|
+
this.entityExpand = new EntityExpandTool(deps.factStore, deps.entityStore, deps.beliefStore);
|
|
26
|
+
this.skillDiscovery = deps.skillDiscoveryEngine ? new SkillDiscoveryTool(deps.skillDiscoveryEngine) : undefined;
|
|
27
|
+
}
|
|
28
|
+
async dispatch(call, context = {}) {
|
|
29
|
+
const callId = nextCallId();
|
|
30
|
+
const startedAt = Date.now();
|
|
31
|
+
try {
|
|
32
|
+
switch (call.action) {
|
|
33
|
+
case 'brain_recall': {
|
|
34
|
+
if (!call.query) {
|
|
35
|
+
return this.error(call.action, callId, 'brain_recall requires a query parameter', startedAt);
|
|
36
|
+
}
|
|
37
|
+
const output = await this.secondaryRecall.execute({
|
|
38
|
+
query: call.query,
|
|
39
|
+
entityHint: call.entity_hint,
|
|
40
|
+
limit: call.limit,
|
|
41
|
+
projectId: context.projectId,
|
|
42
|
+
topicPath: context.topicPath,
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
toolName: call.action,
|
|
46
|
+
callId,
|
|
47
|
+
success: true,
|
|
48
|
+
result: output,
|
|
49
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
case 'get_neuron_context': {
|
|
53
|
+
if (!call.neuron_id) {
|
|
54
|
+
return this.error(call.action, callId, 'get_neuron_context requires a neuron_id parameter', startedAt);
|
|
55
|
+
}
|
|
56
|
+
const output = this.neuronContext.execute(call.neuron_id, context.projectId);
|
|
57
|
+
if (!output) {
|
|
58
|
+
return this.error(call.action, callId, `Neuron not found: ${call.neuron_id}`, startedAt);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
toolName: call.action,
|
|
62
|
+
callId,
|
|
63
|
+
success: true,
|
|
64
|
+
result: output,
|
|
65
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
case 'expand_entity': {
|
|
69
|
+
if (!call.entity_name) {
|
|
70
|
+
return this.error(call.action, callId, 'expand_entity requires an entity_name parameter', startedAt);
|
|
71
|
+
}
|
|
72
|
+
const output = this.entityExpand.execute(call.entity_name, call.entity_type, context.projectId);
|
|
73
|
+
if (!output) {
|
|
74
|
+
return this.error(call.action, callId, `Entity not found: ${call.entity_name}`, startedAt);
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
toolName: call.action,
|
|
78
|
+
callId,
|
|
79
|
+
success: true,
|
|
80
|
+
result: output,
|
|
81
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
case 'find_file_assets': {
|
|
85
|
+
if (!this.deps.fileAssetStore) {
|
|
86
|
+
return this.error(call.action, callId, 'find_file_assets is not available in this runtime', startedAt);
|
|
87
|
+
}
|
|
88
|
+
if (!call.query) {
|
|
89
|
+
return this.error(call.action, callId, 'find_file_assets requires a query parameter', startedAt);
|
|
90
|
+
}
|
|
91
|
+
const output = this.deps.fileAssetStore.listByQuery({
|
|
92
|
+
query: call.query,
|
|
93
|
+
projectId: context.projectId,
|
|
94
|
+
extension: call.extension,
|
|
95
|
+
mimeType: call.mime_type,
|
|
96
|
+
limit: call.limit
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
toolName: call.action,
|
|
100
|
+
callId,
|
|
101
|
+
success: true,
|
|
102
|
+
result: { assets: output },
|
|
103
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
case 'get_file_context': {
|
|
107
|
+
if (!this.deps.fileChunkStore) {
|
|
108
|
+
return this.error(call.action, callId, 'get_file_context is not available in this runtime', startedAt);
|
|
109
|
+
}
|
|
110
|
+
if (!call.asset_id || typeof call.chunk_index !== 'number') {
|
|
111
|
+
return this.error(call.action, callId, 'get_file_context requires asset_id and chunk_index parameters', startedAt);
|
|
112
|
+
}
|
|
113
|
+
const evidence = this.deps.fileChunkStore.listContext(call.asset_id, call.chunk_index, call.radius ?? 1);
|
|
114
|
+
return {
|
|
115
|
+
toolName: call.action,
|
|
116
|
+
callId,
|
|
117
|
+
success: true,
|
|
118
|
+
result: { fileEvidence: this.deps.fileChunkStore.groupEvidenceByAsset(evidence) },
|
|
119
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
case 'find_skills': {
|
|
123
|
+
if (!this.skillDiscovery) {
|
|
124
|
+
return this.error(call.action, callId, 'find_skills is not available in this runtime', startedAt);
|
|
125
|
+
}
|
|
126
|
+
if (!call.query) {
|
|
127
|
+
return this.error(call.action, callId, 'find_skills requires a query parameter', startedAt);
|
|
128
|
+
}
|
|
129
|
+
const output = this.skillDiscovery.execute({
|
|
130
|
+
query: call.query,
|
|
131
|
+
limit: call.limit,
|
|
132
|
+
projectId: context.projectId
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
toolName: call.action,
|
|
136
|
+
callId,
|
|
137
|
+
success: true,
|
|
138
|
+
result: output,
|
|
139
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
default: {
|
|
143
|
+
const unknownAction = call.action;
|
|
144
|
+
return this.error(
|
|
145
|
+
// Cast to handle unknown actions gracefully
|
|
146
|
+
'brain_recall', callId, `Unknown tool action: ${unknownAction}`, startedAt);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
return this.error(call.action, callId, err instanceof Error ? err.message : String(err), startedAt);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
error(toolName, callId, message, startedAt) {
|
|
155
|
+
return {
|
|
156
|
+
toolName,
|
|
157
|
+
callId,
|
|
158
|
+
success: false,
|
|
159
|
+
errorMessage: message,
|
|
160
|
+
durationMs: Math.max(0, Date.now() - startedAt),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BrainRecallResult } from '../types/BrainRecallResult.js';
|
|
2
|
+
export interface ConfidenceGateResult {
|
|
3
|
+
score: number;
|
|
4
|
+
verdict: 'cpu_sufficient' | 'needs_llm';
|
|
5
|
+
reason: string;
|
|
6
|
+
signals: {
|
|
7
|
+
hasCompiledFacts: boolean;
|
|
8
|
+
highConfidenceFact: boolean;
|
|
9
|
+
exactEntityMatch: boolean;
|
|
10
|
+
graphEdgeTraversed: boolean;
|
|
11
|
+
timeRangeClear: boolean;
|
|
12
|
+
multipleCorroborating: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class ConfidenceGate {
|
|
16
|
+
private readonly threshold;
|
|
17
|
+
constructor(options?: {
|
|
18
|
+
threshold?: number;
|
|
19
|
+
});
|
|
20
|
+
evaluate(recallResult: BrainRecallResult, options?: {
|
|
21
|
+
queryText?: string;
|
|
22
|
+
entityHint?: string;
|
|
23
|
+
}): ConfidenceGateResult;
|
|
24
|
+
private matchesEntityHint;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ConfidenceGate.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export class ConfidenceGate {
|
|
2
|
+
threshold;
|
|
3
|
+
constructor(options = {}) {
|
|
4
|
+
this.threshold = options.threshold ?? 0.75;
|
|
5
|
+
}
|
|
6
|
+
evaluate(recallResult, options = {}) {
|
|
7
|
+
const facts = recallResult.compiledMemory.facts;
|
|
8
|
+
const normalizedEntityHint = options.entityHint?.trim().toLowerCase();
|
|
9
|
+
const signals = {
|
|
10
|
+
hasCompiledFacts: facts.length > 0,
|
|
11
|
+
highConfidenceFact: facts.some((fact) => fact.confidence >= 0.85),
|
|
12
|
+
exactEntityMatch: normalizedEntityHint
|
|
13
|
+
? facts.some((fact) => this.matchesEntityHint(fact.subject, fact.object, normalizedEntityHint))
|
|
14
|
+
: false,
|
|
15
|
+
graphEdgeTraversed: recallResult.strategy.primaryLevel === 'compiled_memory' &&
|
|
16
|
+
facts.length > 0 &&
|
|
17
|
+
recallResult.rawEvidence.length > facts.length,
|
|
18
|
+
timeRangeClear: facts.some((fact) => typeof fact.validFrom === 'number' && fact.validFrom > 0),
|
|
19
|
+
multipleCorroborating: facts.length >= 2
|
|
20
|
+
};
|
|
21
|
+
const score = Math.min(1, (signals.hasCompiledFacts ? 0.3 : 0) +
|
|
22
|
+
(signals.highConfidenceFact ? 0.2 : 0) +
|
|
23
|
+
(signals.exactEntityMatch ? 0.2 : 0) +
|
|
24
|
+
(signals.graphEdgeTraversed ? 0.15 : 0) +
|
|
25
|
+
(signals.timeRangeClear ? 0.1 : 0) +
|
|
26
|
+
(signals.multipleCorroborating ? 0.05 : 0));
|
|
27
|
+
const triggeredSignals = Object.entries(signals)
|
|
28
|
+
.filter(([, active]) => active)
|
|
29
|
+
.map(([name]) => name);
|
|
30
|
+
return {
|
|
31
|
+
score,
|
|
32
|
+
verdict: score >= this.threshold ? 'cpu_sufficient' : 'needs_llm',
|
|
33
|
+
reason: triggeredSignals.length > 0 ? triggeredSignals.join(', ') : 'none',
|
|
34
|
+
signals
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
matchesEntityHint(subject, object, entityHint) {
|
|
38
|
+
return subject.toLowerCase().includes(entityHint) || object?.toLowerCase().includes(entityHint) === true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ConfirmationMatchResult {
|
|
2
|
+
action: 'approve' | 'reject';
|
|
3
|
+
subject?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ConfirmationPhraseMatcher {
|
|
6
|
+
matchConfirmation(message: string): ConfirmationMatchResult | null;
|
|
7
|
+
private extractSubject;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ConfirmationPhraseMatcher.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const APPROVE_SUBJECT_PATTERNS = [
|
|
2
|
+
/^(?:确认|批准|同意|允许|执行)\s*(?:部署|发布|运行|执行|启动)?\s*[::]?\s*(.+?)\s*$/i,
|
|
3
|
+
/^(?:approve|confirm|authorize)\s+(?:the\s+)?(?:deploy(?:ment)?|release|run|execution)?\s*[: ]\s*(.+?)\s*$/i,
|
|
4
|
+
/^(?:yes|go\s+ahead|proceed)\s+(?:with\s+)?(.+?)\s*$/i
|
|
5
|
+
];
|
|
6
|
+
const REJECT_SUBJECT_PATTERNS = [
|
|
7
|
+
/^(?:取消|拒绝|停止|终止|撤销|不要)\s*(?:部署|发布|运行|执行|任务)?\s*[::]?\s*(.+?)\s*$/i,
|
|
8
|
+
/^(?:reject|deny|cancel|abort|decline|stop)\s+(?:the\s+)?(?:deployment|release|run|execution|task)?\s*[: ]\s*(.+?)\s*$/i,
|
|
9
|
+
/^(?:no|don'?t)\s+(?:do|run|deploy|execute)?\s*(.+?)\s*$/i
|
|
10
|
+
];
|
|
11
|
+
const SUBJECT_STRIP_PATTERN = /^(?:that|it|the|这个|那个|本次|这次|该)\s+|[\s,。,.::;;!?!]+$/g;
|
|
12
|
+
const BARE_CONFIRMATION_PATTERN = /^(?:是|对|好|嗯|确认|没错|正确|否|不是|不|错|取消|放弃|yes|no|y|n)[\s。,!!?.]*$/i;
|
|
13
|
+
export class ConfirmationPhraseMatcher {
|
|
14
|
+
matchConfirmation(message) {
|
|
15
|
+
const normalizedMessage = message.trim();
|
|
16
|
+
if (!normalizedMessage) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (BARE_CONFIRMATION_PATTERN.test(normalizedMessage)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const approveSubject = this.extractSubject(normalizedMessage, APPROVE_SUBJECT_PATTERNS);
|
|
23
|
+
if (approveSubject !== null) {
|
|
24
|
+
return approveSubject ? { action: 'approve', subject: approveSubject } : { action: 'approve' };
|
|
25
|
+
}
|
|
26
|
+
const rejectSubject = this.extractSubject(normalizedMessage, REJECT_SUBJECT_PATTERNS);
|
|
27
|
+
if (rejectSubject !== null) {
|
|
28
|
+
return rejectSubject ? { action: 'reject', subject: rejectSubject } : { action: 'reject' };
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
extractSubject(message, patterns) {
|
|
33
|
+
for (const pattern of patterns) {
|
|
34
|
+
const match = message.match(pattern);
|
|
35
|
+
if (!match) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const subject = match[1]?.replace(SUBJECT_STRIP_PATTERN, '').trim();
|
|
39
|
+
return subject || '';
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { formatApprovalsReply } from './templates/approvals_template.js';
|
|
2
|
+
import { formatCapabilitiesReply } from './templates/ability_template.js';
|
|
3
|
+
import { formatContradictionsReply } from './templates/contradictions_template.js';
|
|
4
|
+
import { formatContextReply } from './templates/context_template.js';
|
|
5
|
+
import { formatImportanceReply } from './templates/importance_template.js';
|
|
6
|
+
import { formatMemoryReply } from './templates/memory_template.js';
|
|
7
|
+
import { formatTasksReply } from './templates/tasks_template.js';
|
|
8
|
+
import { formatTraceReply } from './templates/trace_template.js';
|
|
9
|
+
import { formatEnvironmentReply, formatFileAssetsReply, formatModelsReply, formatSelfManifestReply } from './templates/self_manifest_template.js';
|
|
10
|
+
export class DirectReplyFormatter {
|
|
11
|
+
format(intent, data) {
|
|
12
|
+
if (data === null || data === undefined) {
|
|
13
|
+
return '(暂无数据)';
|
|
14
|
+
}
|
|
15
|
+
switch (intent) {
|
|
16
|
+
case 'system_query.tasks':
|
|
17
|
+
case 'system_command.resume':
|
|
18
|
+
case 'system_command.cancel_task':
|
|
19
|
+
return formatTasksReply(data);
|
|
20
|
+
case 'system_query.approvals':
|
|
21
|
+
case 'system_command.approve':
|
|
22
|
+
case 'system_command.reject':
|
|
23
|
+
case 'system_confirmation.yes_no':
|
|
24
|
+
return formatApprovalsReply(data);
|
|
25
|
+
case 'system_query.contradictions':
|
|
26
|
+
return formatContradictionsReply(data);
|
|
27
|
+
case 'system_query.capabilities':
|
|
28
|
+
return formatCapabilitiesReply(data);
|
|
29
|
+
case 'system_query.environment':
|
|
30
|
+
return formatEnvironmentReply(data);
|
|
31
|
+
case 'system_query.models':
|
|
32
|
+
return formatModelsReply(data);
|
|
33
|
+
case 'system_query.file_assets':
|
|
34
|
+
return formatFileAssetsReply(data);
|
|
35
|
+
case 'system_query.self_manifest':
|
|
36
|
+
return formatSelfManifestReply(data);
|
|
37
|
+
case 'system_query.memory_recent':
|
|
38
|
+
case 'system_query.memory_search':
|
|
39
|
+
return formatMemoryReply(data);
|
|
40
|
+
case 'system_query.important_memories':
|
|
41
|
+
case 'system_command.mark_important':
|
|
42
|
+
case 'system_command.mark_permanent':
|
|
43
|
+
case 'system_command.unmark_important':
|
|
44
|
+
return formatImportanceReply(data);
|
|
45
|
+
case 'system_query.context':
|
|
46
|
+
return formatContextReply(data);
|
|
47
|
+
case 'system_query.trace':
|
|
48
|
+
return formatTraceReply(data);
|
|
49
|
+
case 'reasoning_required':
|
|
50
|
+
return '(暂无数据)';
|
|
51
|
+
default:
|
|
52
|
+
return '(暂无数据)';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BrainToolCall, BrainToolResult } from './LLMToolSchema.js';
|
|
2
|
+
import { ToolEvidencePack, type ToolEvidenceItem } from './ToolEvidencePack.js';
|
|
3
|
+
export interface EvidenceBudgetConfig {
|
|
4
|
+
maxTotalTokens: number;
|
|
5
|
+
maxFactsPerPack: number;
|
|
6
|
+
maxNeuronSummaries: number;
|
|
7
|
+
compressionStrategy: 'drop_tail' | 'salience_sort' | 'summary';
|
|
8
|
+
}
|
|
9
|
+
export interface EvidenceBudgetState {
|
|
10
|
+
usedTokens: number;
|
|
11
|
+
remainingTokens: number;
|
|
12
|
+
isOverBudget: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class EvidenceBudgetManager {
|
|
15
|
+
private readonly config;
|
|
16
|
+
private readonly evidencePack;
|
|
17
|
+
private readonly normalizer;
|
|
18
|
+
constructor(config?: Partial<EvidenceBudgetConfig>);
|
|
19
|
+
absorb(input: {
|
|
20
|
+
toolResult: BrainToolResult;
|
|
21
|
+
call: BrainToolCall;
|
|
22
|
+
sanitizedResult: unknown;
|
|
23
|
+
projectId?: string;
|
|
24
|
+
injectionRiskDetected?: boolean;
|
|
25
|
+
}): ToolEvidenceItem;
|
|
26
|
+
state(): EvidenceBudgetState;
|
|
27
|
+
pack(): ToolEvidencePack;
|
|
28
|
+
compress(): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=EvidenceBudgetManager.d.ts.map
|